43
43
#include "sysemu/sysemu.h"
44
44
#include "hw/s390x/pv.h"
45
45
#include "migration/blocker.h"
46
+ #include "qapi/visitor.h"
46
47
47
48
static Error * pv_mig_blocker ;
48
49
@@ -589,38 +590,6 @@ static ram_addr_t s390_fixup_ram_size(ram_addr_t sz)
589
590
return newsz ;
590
591
}
591
592
592
- static void ccw_machine_class_init (ObjectClass * oc , void * data )
593
- {
594
- MachineClass * mc = MACHINE_CLASS (oc );
595
- NMIClass * nc = NMI_CLASS (oc );
596
- HotplugHandlerClass * hc = HOTPLUG_HANDLER_CLASS (oc );
597
- S390CcwMachineClass * s390mc = S390_CCW_MACHINE_CLASS (mc );
598
-
599
- s390mc -> ri_allowed = true;
600
- s390mc -> cpu_model_allowed = true;
601
- s390mc -> css_migration_enabled = true;
602
- s390mc -> hpage_1m_allowed = true;
603
- mc -> init = ccw_init ;
604
- mc -> reset = s390_machine_reset ;
605
- mc -> block_default_type = IF_VIRTIO ;
606
- mc -> no_cdrom = 1 ;
607
- mc -> no_floppy = 1 ;
608
- mc -> no_parallel = 1 ;
609
- mc -> no_sdcard = 1 ;
610
- mc -> max_cpus = S390_MAX_CPUS ;
611
- mc -> has_hotpluggable_cpus = true;
612
- assert (!mc -> get_hotplug_handler );
613
- mc -> get_hotplug_handler = s390_get_hotplug_handler ;
614
- mc -> cpu_index_to_instance_props = s390_cpu_index_to_props ;
615
- mc -> possible_cpu_arch_ids = s390_possible_cpu_arch_ids ;
616
- /* it is overridden with 'host' cpu *in kvm_arch_init* */
617
- mc -> default_cpu_type = S390_CPU_TYPE_NAME ("qemu" );
618
- hc -> plug = s390_machine_device_plug ;
619
- hc -> unplug_request = s390_machine_device_unplug_request ;
620
- nc -> nmi_monitor_handler = s390_nmi ;
621
- mc -> default_ram_id = "s390.ram" ;
622
- }
623
-
624
593
static inline bool machine_get_aes_key_wrap (Object * obj , Error * * errp )
625
594
{
626
595
S390CcwMachineState * ms = S390_CCW_MACHINE (obj );
@@ -710,19 +679,29 @@ bool hpage_1m_allowed(void)
710
679
return get_machine_class ()-> hpage_1m_allowed ;
711
680
}
712
681
713
- static char * machine_get_loadparm (Object * obj , Error * * errp )
682
+ static void machine_get_loadparm (Object * obj , Visitor * v ,
683
+ const char * name , void * opaque ,
684
+ Error * * errp )
714
685
{
715
686
S390CcwMachineState * ms = S390_CCW_MACHINE (obj );
687
+ char * str = g_strndup ((char * ) ms -> loadparm , sizeof (ms -> loadparm ));
716
688
717
- /* make a NUL-terminated string */
718
- return g_strndup (( char * ) ms -> loadparm , sizeof ( ms -> loadparm ) );
689
+ visit_type_str ( v , name , & str , errp );
690
+ g_free ( str );
719
691
}
720
692
721
- static void machine_set_loadparm (Object * obj , const char * val , Error * * errp )
693
+ static void machine_set_loadparm (Object * obj , Visitor * v ,
694
+ const char * name , void * opaque ,
695
+ Error * * errp )
722
696
{
723
697
S390CcwMachineState * ms = S390_CCW_MACHINE (obj );
698
+ char * val ;
724
699
int i ;
725
700
701
+ if (!visit_type_str (v , name , & val , errp )) {
702
+ return ;
703
+ }
704
+
726
705
for (i = 0 ; i < sizeof (ms -> loadparm ) && val [i ]; i ++ ) {
727
706
uint8_t c = qemu_toupper (val [i ]); /* mimic HMC */
728
707
@@ -740,34 +719,72 @@ static void machine_set_loadparm(Object *obj, const char *val, Error **errp)
740
719
ms -> loadparm [i ] = ' ' ; /* pad right with spaces */
741
720
}
742
721
}
743
- static inline void s390_machine_initfn (Object * obj )
722
+
723
+ static void ccw_machine_class_init (ObjectClass * oc , void * data )
744
724
{
745
- object_property_add_bool (obj , "aes-key-wrap" ,
746
- machine_get_aes_key_wrap ,
747
- machine_set_aes_key_wrap );
748
- object_property_set_description (obj , "aes-key-wrap" ,
725
+ MachineClass * mc = MACHINE_CLASS (oc );
726
+ NMIClass * nc = NMI_CLASS (oc );
727
+ HotplugHandlerClass * hc = HOTPLUG_HANDLER_CLASS (oc );
728
+ S390CcwMachineClass * s390mc = S390_CCW_MACHINE_CLASS (mc );
729
+
730
+ s390mc -> ri_allowed = true;
731
+ s390mc -> cpu_model_allowed = true;
732
+ s390mc -> css_migration_enabled = true;
733
+ s390mc -> hpage_1m_allowed = true;
734
+ mc -> init = ccw_init ;
735
+ mc -> reset = s390_machine_reset ;
736
+ mc -> block_default_type = IF_VIRTIO ;
737
+ mc -> no_cdrom = 1 ;
738
+ mc -> no_floppy = 1 ;
739
+ mc -> no_parallel = 1 ;
740
+ mc -> no_sdcard = 1 ;
741
+ mc -> max_cpus = S390_MAX_CPUS ;
742
+ mc -> has_hotpluggable_cpus = true;
743
+ assert (!mc -> get_hotplug_handler );
744
+ mc -> get_hotplug_handler = s390_get_hotplug_handler ;
745
+ mc -> cpu_index_to_instance_props = s390_cpu_index_to_props ;
746
+ mc -> possible_cpu_arch_ids = s390_possible_cpu_arch_ids ;
747
+ /* it is overridden with 'host' cpu *in kvm_arch_init* */
748
+ mc -> default_cpu_type = S390_CPU_TYPE_NAME ("qemu" );
749
+ hc -> plug = s390_machine_device_plug ;
750
+ hc -> unplug_request = s390_machine_device_unplug_request ;
751
+ nc -> nmi_monitor_handler = s390_nmi ;
752
+ mc -> default_ram_id = "s390.ram" ;
753
+
754
+ object_class_property_add_bool (oc , "aes-key-wrap" ,
755
+ machine_get_aes_key_wrap ,
756
+ machine_set_aes_key_wrap );
757
+ object_class_property_set_description (oc , "aes-key-wrap" ,
749
758
"enable/disable AES key wrapping using the CPACF wrapping key" );
750
- object_property_set_bool (obj , "aes-key-wrap" , true, NULL );
751
759
752
- object_property_add_bool ( obj , "dea-key-wrap" ,
753
- machine_get_dea_key_wrap ,
754
- machine_set_dea_key_wrap );
755
- object_property_set_description ( obj , "dea-key-wrap" ,
760
+ object_class_property_add_bool ( oc , "dea-key-wrap" ,
761
+ machine_get_dea_key_wrap ,
762
+ machine_set_dea_key_wrap );
763
+ object_class_property_set_description ( oc , "dea-key-wrap" ,
756
764
"enable/disable DEA key wrapping using the CPACF wrapping key" );
757
- object_property_set_bool (obj , "dea-key-wrap" , true, NULL );
758
- object_property_add_str (obj , "loadparm" ,
759
- machine_get_loadparm , machine_set_loadparm );
760
- object_property_set_description (obj , "loadparm" ,
765
+
766
+ object_class_property_add (oc , "loadparm" , "loadparm" ,
767
+ machine_get_loadparm , machine_set_loadparm ,
768
+ NULL , NULL );
769
+ object_class_property_set_description (oc , "loadparm" ,
761
770
"Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted"
762
771
" to upper case) to pass to machine loader, boot manager,"
763
772
" and guest kernel" );
764
773
765
- object_property_add_bool ( obj , "zpcii-disable" ,
766
- machine_get_zpcii_disable ,
767
- machine_set_zpcii_disable );
768
- object_property_set_description ( obj , "zpcii-disable" ,
774
+ object_class_property_add_bool ( oc , "zpcii-disable" ,
775
+ machine_get_zpcii_disable ,
776
+ machine_set_zpcii_disable );
777
+ object_class_property_set_description ( oc , "zpcii-disable" ,
769
778
"disable zPCI interpretation facilties" );
770
- object_property_set_bool (obj , "zpcii-disable" , false, NULL );
779
+ }
780
+
781
+ static inline void s390_machine_initfn (Object * obj )
782
+ {
783
+ S390CcwMachineState * ms = S390_CCW_MACHINE (obj );
784
+
785
+ ms -> aes_key_wrap = true;
786
+ ms -> dea_key_wrap = true;
787
+ ms -> zpcii_disable = false;
771
788
}
772
789
773
790
static const TypeInfo ccw_machine_info = {
0 commit comments