All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] i386: Make PIT and PIC the property of common x86 base machine type
@ 2022-01-11  7:35 Xiaoyao Li
  2022-01-11  7:35 ` [PATCH v1 1/2] hw/i386: Make pit a " Xiaoyao Li
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Xiaoyao Li @ 2022-01-11  7:35 UTC (permalink / raw)
  To: Sergio Lopez, Michael S. Tsirkin, Marcel Apfelbaum,
	Richard Henderson, Eduardo Habkost
  Cc: Xiaoyao Li, qemu-devel

For PIT, it's straightforward to merge microvm::pit and
pc_machine::pit_enabled into x86ms::pit

For PIC, move microvm::pic to x86ms:pic, which gives PC machine the
ability to dis-/en-able PIC and it's the preparation for future TDX
support.

Xiaoyao Li (2):
  hw/i386: Make pit a property of common x86 base machine type
  hw/i386: Make pic a property of common x86 base machine type

 hw/i386/microvm.c         | 54 ++-------------------------------------
 hw/i386/pc.c              | 24 +++--------------
 hw/i386/pc_piix.c         |  4 ++-
 hw/i386/pc_q35.c          |  4 ++-
 hw/i386/x86.c             | 50 ++++++++++++++++++++++++++++++++++++
 include/hw/i386/microvm.h |  4 ---
 include/hw/i386/pc.h      |  2 --
 include/hw/i386/x86.h     |  4 +++
 8 files changed, 65 insertions(+), 81 deletions(-)

-- 
2.27.0



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 1/2] hw/i386: Make pit a property of common x86 base machine type
  2022-01-11  7:35 [PATCH v1 0/2] i386: Make PIT and PIC the property of common x86 base machine type Xiaoyao Li
@ 2022-01-11  7:35 ` Xiaoyao Li
  2022-01-11 11:07   ` Sergio Lopez
  2022-01-12  1:41   ` Xiaoyao Li
  2022-01-11  7:35 ` [PATCH v1 2/2] hw/i386: Make pic " Xiaoyao Li
  2022-02-14 14:45 ` [PATCH v1 0/2] i386: Make PIT and PIC the " Xiaoyao Li
  2 siblings, 2 replies; 8+ messages in thread
From: Xiaoyao Li @ 2022-01-11  7:35 UTC (permalink / raw)
  To: Sergio Lopez, Michael S. Tsirkin, Marcel Apfelbaum,
	Richard Henderson, Eduardo Habkost
  Cc: Xiaoyao Li, qemu-devel

Both pc and microvm have pit property individually. Let's just make it
the property of common x86 base machine type.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 hw/i386/microvm.c         | 27 +--------------------------
 hw/i386/pc.c              | 24 +++---------------------
 hw/i386/x86.c             | 25 +++++++++++++++++++++++++
 include/hw/i386/microvm.h |  2 --
 include/hw/i386/pc.h      |  2 --
 include/hw/i386/x86.h     |  2 ++
 6 files changed, 31 insertions(+), 51 deletions(-)

diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 4b3b1dd262f1..89b555a2f584 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -257,7 +257,7 @@ static void microvm_devices_init(MicrovmMachineState *mms)
         g_free(i8259);
     }
 
-    if (mms->pit == ON_OFF_AUTO_ON || mms->pit == ON_OFF_AUTO_AUTO) {
+    if (x86ms->pit == ON_OFF_AUTO_ON || x86ms->pit == ON_OFF_AUTO_AUTO) {
         if (kvm_pit_in_kernel()) {
             kvm_pit_init(isa_bus, 0x40);
         } else {
@@ -508,23 +508,6 @@ static void microvm_machine_set_pic(Object *obj, Visitor *v, const char *name,
     visit_type_OnOffAuto(v, name, &mms->pic, errp);
 }
 
-static void microvm_machine_get_pit(Object *obj, Visitor *v, const char *name,
-                                    void *opaque, Error **errp)
-{
-    MicrovmMachineState *mms = MICROVM_MACHINE(obj);
-    OnOffAuto pit = mms->pit;
-
-    visit_type_OnOffAuto(v, name, &pit, errp);
-}
-
-static void microvm_machine_set_pit(Object *obj, Visitor *v, const char *name,
-                                    void *opaque, Error **errp)
-{
-    MicrovmMachineState *mms = MICROVM_MACHINE(obj);
-
-    visit_type_OnOffAuto(v, name, &mms->pit, errp);
-}
-
 static void microvm_machine_get_rtc(Object *obj, Visitor *v, const char *name,
                                     void *opaque, Error **errp)
 {
@@ -650,7 +633,6 @@ static void microvm_machine_initfn(Object *obj)
 
     /* Configuration */
     mms->pic = ON_OFF_AUTO_AUTO;
-    mms->pit = ON_OFF_AUTO_AUTO;
     mms->rtc = ON_OFF_AUTO_AUTO;
     mms->pcie = ON_OFF_AUTO_AUTO;
     mms->ioapic2 = ON_OFF_AUTO_AUTO;
@@ -709,13 +691,6 @@ static void microvm_class_init(ObjectClass *oc, void *data)
     object_class_property_set_description(oc, MICROVM_MACHINE_PIC,
         "Enable i8259 PIC");
 
-    object_class_property_add(oc, MICROVM_MACHINE_PIT, "OnOffAuto",
-                              microvm_machine_get_pit,
-                              microvm_machine_set_pit,
-                              NULL, NULL);
-    object_class_property_set_description(oc, MICROVM_MACHINE_PIT,
-        "Enable i8254 PIT");
-
     object_class_property_add(oc, MICROVM_MACHINE_RTC, "OnOffAuto",
                               microvm_machine_get_rtc,
                               microvm_machine_set_rtc,
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c8696ac01e85..48ab4cf44012 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1071,6 +1071,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
     ISADevice *pit = NULL;
     MemoryRegion *ioport80_io = g_new(MemoryRegion, 1);
     MemoryRegion *ioportF0_io = g_new(MemoryRegion, 1);
+    X86MachineState *x86ms = X86_MACHINE(pcms);
 
     memory_region_init_io(ioport80_io, NULL, &ioport80_io_ops, NULL, "ioport80", 1);
     memory_region_add_subregion(isa_bus->address_space_io, 0x80, ioport80_io);
@@ -1115,7 +1116,8 @@ void pc_basic_device_init(struct PCMachineState *pcms,
 
     qemu_register_boot_set(pc_boot_set, *rtc_state);
 
-    if (!xen_enabled() && pcms->pit_enabled) {
+    if (!xen_enabled() &&
+        (x86ms->pit == ON_OFF_AUTO_AUTO || x86ms->pit == ON_OFF_AUTO_ON)) {
         if (kvm_pit_in_kernel()) {
             pit = kvm_pit_init(isa_bus, 0x40);
         } else {
@@ -1484,20 +1486,6 @@ static void pc_machine_set_sata(Object *obj, bool value, Error **errp)
     pcms->sata_enabled = value;
 }
 
-static bool pc_machine_get_pit(Object *obj, Error **errp)
-{
-    PCMachineState *pcms = PC_MACHINE(obj);
-
-    return pcms->pit_enabled;
-}
-
-static void pc_machine_set_pit(Object *obj, bool value, Error **errp)
-{
-    PCMachineState *pcms = PC_MACHINE(obj);
-
-    pcms->pit_enabled = value;
-}
-
 static bool pc_machine_get_hpet(Object *obj, Error **errp)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
@@ -1640,7 +1628,6 @@ static void pc_machine_initfn(Object *obj)
     pcms->acpi_build_enabled = PC_MACHINE_GET_CLASS(pcms)->has_acpi_build;
     pcms->smbus_enabled = true;
     pcms->sata_enabled = true;
-    pcms->pit_enabled = true;
     pcms->max_fw_size = 8 * MiB;
 #ifdef CONFIG_HPET
     pcms->hpet_enabled = true;
@@ -1767,11 +1754,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
     object_class_property_set_description(oc, PC_MACHINE_SATA,
         "Enable/disable Serial ATA bus");
 
-    object_class_property_add_bool(oc, PC_MACHINE_PIT,
-        pc_machine_get_pit, pc_machine_set_pit);
-    object_class_property_set_description(oc, PC_MACHINE_PIT,
-        "Enable/disable Intel 8254 programmable interval timer emulation");
-
     object_class_property_add_bool(oc, "hpet",
         pc_machine_get_hpet, pc_machine_set_hpet);
     object_class_property_set_description(oc, "hpet",
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index b84840a1bb99..744a50937761 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -1226,6 +1226,23 @@ static void x86_machine_set_acpi(Object *obj, Visitor *v, const char *name,
     visit_type_OnOffAuto(v, name, &x86ms->acpi, errp);
 }
 
+static void x86_machine_get_pit(Object *obj, Visitor *v, const char *name,
+                                    void *opaque, Error **errp)
+{
+    X86MachineState *x86ms = X86_MACHINE(obj);
+    OnOffAuto pit = x86ms->pit;
+
+    visit_type_OnOffAuto(v, name, &pit, errp);
+}
+
+static void x86_machine_set_pit(Object *obj, Visitor *v, const char *name,
+                                    void *opaque, Error **errp)
+{
+    X86MachineState *x86ms = X86_MACHINE(obj);;
+
+    visit_type_OnOffAuto(v, name, &x86ms->pit, errp);
+}
+
 static char *x86_machine_get_oem_id(Object *obj, Error **errp)
 {
     X86MachineState *x86ms = X86_MACHINE(obj);
@@ -1315,6 +1332,7 @@ static void x86_machine_initfn(Object *obj)
 
     x86ms->smm = ON_OFF_AUTO_AUTO;
     x86ms->acpi = ON_OFF_AUTO_AUTO;
+    x86ms->pit = ON_OFF_AUTO_AUTO;
     x86ms->pci_irq_mask = ACPI_BUILD_PCI_IRQS;
     x86ms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
     x86ms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
@@ -1347,6 +1365,13 @@ static void x86_machine_class_init(ObjectClass *oc, void *data)
     object_class_property_set_description(oc, X86_MACHINE_ACPI,
         "Enable ACPI");
 
+    object_class_property_add(oc, X86_MACHINE_PIT, "OnOffAuto",
+                              x86_machine_get_pit,
+                              x86_machine_set_pit,
+                              NULL, NULL);
+    object_class_property_set_description(oc, X86_MACHINE_PIT,
+        "Enable i8254 PIT");
+
     object_class_property_add_str(oc, X86_MACHINE_OEM_ID,
                                   x86_machine_get_oem_id,
                                   x86_machine_set_oem_id);
diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h
index efcbd926fd43..83f9ac0b2ad0 100644
--- a/include/hw/i386/microvm.h
+++ b/include/hw/i386/microvm.h
@@ -67,7 +67,6 @@
 #define PCIE_ECAM_SIZE        0x10000000
 
 /* Machine type options */
-#define MICROVM_MACHINE_PIT                 "pit"
 #define MICROVM_MACHINE_PIC                 "pic"
 #define MICROVM_MACHINE_RTC                 "rtc"
 #define MICROVM_MACHINE_PCIE                "pcie"
@@ -87,7 +86,6 @@ struct MicrovmMachineState {
 
     /* Machine type options */
     OnOffAuto pic;
-    OnOffAuto pit;
     OnOffAuto rtc;
     OnOffAuto pcie;
     OnOffAuto ioapic2;
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 9c9f4ac74810..01e84d5c4aa4 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -46,7 +46,6 @@ typedef struct PCMachineState {
     bool acpi_build_enabled;
     bool smbus_enabled;
     bool sata_enabled;
-    bool pit_enabled;
     bool hpet_enabled;
     bool default_bus_bypass_iommu;
     uint64_t max_fw_size;
@@ -63,7 +62,6 @@ typedef struct PCMachineState {
 #define PC_MACHINE_VMPORT           "vmport"
 #define PC_MACHINE_SMBUS            "smbus"
 #define PC_MACHINE_SATA             "sata"
-#define PC_MACHINE_PIT              "pit"
 #define PC_MACHINE_MAX_FW_SIZE      "max-fw-size"
 #define PC_MACHINE_SMBIOS_EP        "smbios-entry-point-type"
 
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index a145a303703f..f0168902356d 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -67,6 +67,7 @@ struct X86MachineState {
 
     OnOffAuto smm;
     OnOffAuto acpi;
+    OnOffAuto pit;
 
     char *oem_id;
     char *oem_table_id;
@@ -86,6 +87,7 @@ struct X86MachineState {
 
 #define X86_MACHINE_SMM              "smm"
 #define X86_MACHINE_ACPI             "acpi"
+#define X86_MACHINE_PIT              "pit"
 #define X86_MACHINE_OEM_ID           "x-oem-id"
 #define X86_MACHINE_OEM_TABLE_ID     "x-oem-table-id"
 #define X86_MACHINE_BUS_LOCK_RATELIMIT  "bus-lock-ratelimit"
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 2/2] hw/i386: Make pic a property of common x86 base machine type
  2022-01-11  7:35 [PATCH v1 0/2] i386: Make PIT and PIC the property of common x86 base machine type Xiaoyao Li
  2022-01-11  7:35 ` [PATCH v1 1/2] hw/i386: Make pit a " Xiaoyao Li
@ 2022-01-11  7:35 ` Xiaoyao Li
  2022-01-11 11:08   ` Sergio Lopez
  2022-01-12  1:42   ` Xiaoyao Li
  2022-02-14 14:45 ` [PATCH v1 0/2] i386: Make PIT and PIC the " Xiaoyao Li
  2 siblings, 2 replies; 8+ messages in thread
From: Xiaoyao Li @ 2022-01-11  7:35 UTC (permalink / raw)
  To: Sergio Lopez, Michael S. Tsirkin, Marcel Apfelbaum,
	Richard Henderson, Eduardo Habkost
  Cc: Xiaoyao Li, qemu-devel

Legacy PIC (8259) cannot be supported for TDX guests since TDX module
doesn't allow directly interrupt injection.  Using posted interrupts
for the PIC is not a viable option as the guest BIOS/kernel will not
do EOI for PIC IRQs, i.e. will leave the vIRR bit set.

Make PIC the property of common x86 machine type. Hence all x86
machines, including microvm, can disable it.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 hw/i386/microvm.c         | 27 +--------------------------
 hw/i386/pc_piix.c         |  4 +++-
 hw/i386/pc_q35.c          |  4 +++-
 hw/i386/x86.c             | 25 +++++++++++++++++++++++++
 include/hw/i386/microvm.h |  2 --
 include/hw/i386/x86.h     |  2 ++
 6 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 89b555a2f584..754f1d0593e5 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -247,7 +247,7 @@ static void microvm_devices_init(MicrovmMachineState *mms)
         x86ms->pci_irq_mask = 0;
     }
 
-    if (mms->pic == ON_OFF_AUTO_ON || mms->pic == ON_OFF_AUTO_AUTO) {
+    if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) {
         qemu_irq *i8259;
 
         i8259 = i8259_init(isa_bus, x86_allocate_cpu_irq());
@@ -491,23 +491,6 @@ static void microvm_machine_reset(MachineState *machine)
     }
 }
 
-static void microvm_machine_get_pic(Object *obj, Visitor *v, const char *name,
-                                    void *opaque, Error **errp)
-{
-    MicrovmMachineState *mms = MICROVM_MACHINE(obj);
-    OnOffAuto pic = mms->pic;
-
-    visit_type_OnOffAuto(v, name, &pic, errp);
-}
-
-static void microvm_machine_set_pic(Object *obj, Visitor *v, const char *name,
-                                    void *opaque, Error **errp)
-{
-    MicrovmMachineState *mms = MICROVM_MACHINE(obj);
-
-    visit_type_OnOffAuto(v, name, &mms->pic, errp);
-}
-
 static void microvm_machine_get_rtc(Object *obj, Visitor *v, const char *name,
                                     void *opaque, Error **errp)
 {
@@ -632,7 +615,6 @@ static void microvm_machine_initfn(Object *obj)
     MicrovmMachineState *mms = MICROVM_MACHINE(obj);
 
     /* Configuration */
-    mms->pic = ON_OFF_AUTO_AUTO;
     mms->rtc = ON_OFF_AUTO_AUTO;
     mms->pcie = ON_OFF_AUTO_AUTO;
     mms->ioapic2 = ON_OFF_AUTO_AUTO;
@@ -684,13 +666,6 @@ static void microvm_class_init(ObjectClass *oc, void *data)
 
     x86mc->fwcfg_dma_enabled = true;
 
-    object_class_property_add(oc, MICROVM_MACHINE_PIC, "OnOffAuto",
-                              microvm_machine_get_pic,
-                              microvm_machine_set_pic,
-                              NULL, NULL);
-    object_class_property_set_description(oc, MICROVM_MACHINE_PIC,
-        "Enable i8259 PIC");
-
     object_class_property_add(oc, MICROVM_MACHINE_RTC, "OnOffAuto",
                               microvm_machine_get_rtc,
                               microvm_machine_set_rtc,
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 7c7790a5ce34..d05683cd0d77 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -218,7 +218,9 @@ static void pc_init1(MachineState *machine,
     }
     isa_bus_irqs(isa_bus, x86ms->gsi);
 
-    pc_i8259_create(isa_bus, gsi_state->i8259_irq);
+    if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) {
+        pc_i8259_create(isa_bus, gsi_state->i8259_irq);
+    }
 
     if (pcmc->pci_enabled) {
         ioapic_init_gsi(gsi_state, "i440fx");
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 1780f79bc127..58e7e693f9e2 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -265,7 +265,9 @@ static void pc_q35_init(MachineState *machine)
     pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq);
     isa_bus = ich9_lpc->isa_bus;
 
-    pc_i8259_create(isa_bus, gsi_state->i8259_irq);
+    if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) {
+        pc_i8259_create(isa_bus, gsi_state->i8259_irq);
+    }
 
     if (pcmc->pci_enabled) {
         ioapic_init_gsi(gsi_state, "q35");
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 744a50937761..d4a4c0ec8f61 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -1243,6 +1243,23 @@ static void x86_machine_set_pit(Object *obj, Visitor *v, const char *name,
     visit_type_OnOffAuto(v, name, &x86ms->pit, errp);
 }
 
+static void x86_machine_get_pic(Object *obj, Visitor *v, const char *name,
+                                void *opaque, Error **errp)
+{
+    X86MachineState *x86ms = X86_MACHINE(obj);
+    OnOffAuto pic = x86ms->pic;
+
+    visit_type_OnOffAuto(v, name, &pic, errp);
+}
+
+static void x86_machine_set_pic(Object *obj, Visitor *v, const char *name,
+                                void *opaque, Error **errp)
+{
+    X86MachineState *x86ms = X86_MACHINE(obj);
+
+    visit_type_OnOffAuto(v, name, &x86ms->pic, errp);
+}
+
 static char *x86_machine_get_oem_id(Object *obj, Error **errp)
 {
     X86MachineState *x86ms = X86_MACHINE(obj);
@@ -1333,6 +1350,7 @@ static void x86_machine_initfn(Object *obj)
     x86ms->smm = ON_OFF_AUTO_AUTO;
     x86ms->acpi = ON_OFF_AUTO_AUTO;
     x86ms->pit = ON_OFF_AUTO_AUTO;
+    x86ms->pic = ON_OFF_AUTO_AUTO;
     x86ms->pci_irq_mask = ACPI_BUILD_PCI_IRQS;
     x86ms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
     x86ms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
@@ -1372,6 +1390,13 @@ static void x86_machine_class_init(ObjectClass *oc, void *data)
     object_class_property_set_description(oc, X86_MACHINE_PIT,
         "Enable i8254 PIT");
 
+    object_class_property_add(oc, X86_MACHINE_PIC, "OnOffAuto",
+                              x86_machine_get_pic,
+                              x86_machine_set_pic,
+                              NULL, NULL);
+    object_class_property_set_description(oc, X86_MACHINE_PIC,
+        "Enable i8259 PIC");
+
     object_class_property_add_str(oc, X86_MACHINE_OEM_ID,
                                   x86_machine_get_oem_id,
                                   x86_machine_set_oem_id);
diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h
index 83f9ac0b2ad0..fad97a891dcb 100644
--- a/include/hw/i386/microvm.h
+++ b/include/hw/i386/microvm.h
@@ -67,7 +67,6 @@
 #define PCIE_ECAM_SIZE        0x10000000
 
 /* Machine type options */
-#define MICROVM_MACHINE_PIC                 "pic"
 #define MICROVM_MACHINE_RTC                 "rtc"
 #define MICROVM_MACHINE_PCIE                "pcie"
 #define MICROVM_MACHINE_IOAPIC2             "ioapic2"
@@ -85,7 +84,6 @@ struct MicrovmMachineState {
     X86MachineState parent;
 
     /* Machine type options */
-    OnOffAuto pic;
     OnOffAuto rtc;
     OnOffAuto pcie;
     OnOffAuto ioapic2;
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index f0168902356d..e4930321c921 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -68,6 +68,7 @@ struct X86MachineState {
     OnOffAuto smm;
     OnOffAuto acpi;
     OnOffAuto pit;
+    OnOffAuto pic;
 
     char *oem_id;
     char *oem_table_id;
@@ -88,6 +89,7 @@ struct X86MachineState {
 #define X86_MACHINE_SMM              "smm"
 #define X86_MACHINE_ACPI             "acpi"
 #define X86_MACHINE_PIT              "pit"
+#define X86_MACHINE_PIC              "pic"
 #define X86_MACHINE_OEM_ID           "x-oem-id"
 #define X86_MACHINE_OEM_TABLE_ID     "x-oem-table-id"
 #define X86_MACHINE_BUS_LOCK_RATELIMIT  "bus-lock-ratelimit"
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] hw/i386: Make pit a property of common x86 base machine type
  2022-01-11  7:35 ` [PATCH v1 1/2] hw/i386: Make pit a " Xiaoyao Li
@ 2022-01-11 11:07   ` Sergio Lopez
  2022-01-12  1:41   ` Xiaoyao Li
  1 sibling, 0 replies; 8+ messages in thread
From: Sergio Lopez @ 2022-01-11 11:07 UTC (permalink / raw)
  To: Xiaoyao Li
  Cc: Eduardo Habkost, Richard Henderson, qemu-devel, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 646 bytes --]

On Tue, Jan 11, 2022 at 03:35:27PM +0800, Xiaoyao Li wrote:
> Both pc and microvm have pit property individually. Let's just make it
> the property of common x86 base machine type.
> 
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>  hw/i386/microvm.c         | 27 +--------------------------
>  hw/i386/pc.c              | 24 +++---------------------
>  hw/i386/x86.c             | 25 +++++++++++++++++++++++++
>  include/hw/i386/microvm.h |  2 --
>  include/hw/i386/pc.h      |  2 --
>  include/hw/i386/x86.h     |  2 ++
>  6 files changed, 31 insertions(+), 51 deletions(-)

Reviewed-by: Sergio Lopez <slp@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] hw/i386: Make pic a property of common x86 base machine type
  2022-01-11  7:35 ` [PATCH v1 2/2] hw/i386: Make pic " Xiaoyao Li
@ 2022-01-11 11:08   ` Sergio Lopez
  2022-01-12  1:42   ` Xiaoyao Li
  1 sibling, 0 replies; 8+ messages in thread
From: Sergio Lopez @ 2022-01-11 11:08 UTC (permalink / raw)
  To: Xiaoyao Li
  Cc: Eduardo Habkost, Richard Henderson, qemu-devel, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 899 bytes --]

On Tue, Jan 11, 2022 at 03:35:28PM +0800, Xiaoyao Li wrote:
> Legacy PIC (8259) cannot be supported for TDX guests since TDX module
> doesn't allow directly interrupt injection.  Using posted interrupts
> for the PIC is not a viable option as the guest BIOS/kernel will not
> do EOI for PIC IRQs, i.e. will leave the vIRR bit set.
> 
> Make PIC the property of common x86 machine type. Hence all x86
> machines, including microvm, can disable it.
> 
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>  hw/i386/microvm.c         | 27 +--------------------------
>  hw/i386/pc_piix.c         |  4 +++-
>  hw/i386/pc_q35.c          |  4 +++-
>  hw/i386/x86.c             | 25 +++++++++++++++++++++++++
>  include/hw/i386/microvm.h |  2 --
>  include/hw/i386/x86.h     |  2 ++
>  6 files changed, 34 insertions(+), 30 deletions(-)

Reviewed-by: Sergio Lopez <slp@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] hw/i386: Make pit a property of common x86 base machine type
  2022-01-11  7:35 ` [PATCH v1 1/2] hw/i386: Make pit a " Xiaoyao Li
  2022-01-11 11:07   ` Sergio Lopez
@ 2022-01-12  1:41   ` Xiaoyao Li
  1 sibling, 0 replies; 8+ messages in thread
From: Xiaoyao Li @ 2022-01-12  1:41 UTC (permalink / raw)
  To: Sergio Lopez, Michael S. Tsirkin, Marcel Apfelbaum,
	Richard Henderson, Eduardo Habkost, Paolo Bonzini
  Cc: qemu-devel

+ Paolo

On 1/11/2022 3:35 PM, Xiaoyao Li wrote:
> Both pc and microvm have pit property individually. Let's just make it
> the property of common x86 base machine type.
> 
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>   hw/i386/microvm.c         | 27 +--------------------------
>   hw/i386/pc.c              | 24 +++---------------------
>   hw/i386/x86.c             | 25 +++++++++++++++++++++++++
>   include/hw/i386/microvm.h |  2 --
>   include/hw/i386/pc.h      |  2 --
>   include/hw/i386/x86.h     |  2 ++
>   6 files changed, 31 insertions(+), 51 deletions(-)
> 
> diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
> index 4b3b1dd262f1..89b555a2f584 100644
> --- a/hw/i386/microvm.c
> +++ b/hw/i386/microvm.c
> @@ -257,7 +257,7 @@ static void microvm_devices_init(MicrovmMachineState *mms)
>           g_free(i8259);
>       }
>   
> -    if (mms->pit == ON_OFF_AUTO_ON || mms->pit == ON_OFF_AUTO_AUTO) {
> +    if (x86ms->pit == ON_OFF_AUTO_ON || x86ms->pit == ON_OFF_AUTO_AUTO) {
>           if (kvm_pit_in_kernel()) {
>               kvm_pit_init(isa_bus, 0x40);
>           } else {
> @@ -508,23 +508,6 @@ static void microvm_machine_set_pic(Object *obj, Visitor *v, const char *name,
>       visit_type_OnOffAuto(v, name, &mms->pic, errp);
>   }
>   
> -static void microvm_machine_get_pit(Object *obj, Visitor *v, const char *name,
> -                                    void *opaque, Error **errp)
> -{
> -    MicrovmMachineState *mms = MICROVM_MACHINE(obj);
> -    OnOffAuto pit = mms->pit;
> -
> -    visit_type_OnOffAuto(v, name, &pit, errp);
> -}
> -
> -static void microvm_machine_set_pit(Object *obj, Visitor *v, const char *name,
> -                                    void *opaque, Error **errp)
> -{
> -    MicrovmMachineState *mms = MICROVM_MACHINE(obj);
> -
> -    visit_type_OnOffAuto(v, name, &mms->pit, errp);
> -}
> -
>   static void microvm_machine_get_rtc(Object *obj, Visitor *v, const char *name,
>                                       void *opaque, Error **errp)
>   {
> @@ -650,7 +633,6 @@ static void microvm_machine_initfn(Object *obj)
>   
>       /* Configuration */
>       mms->pic = ON_OFF_AUTO_AUTO;
> -    mms->pit = ON_OFF_AUTO_AUTO;
>       mms->rtc = ON_OFF_AUTO_AUTO;
>       mms->pcie = ON_OFF_AUTO_AUTO;
>       mms->ioapic2 = ON_OFF_AUTO_AUTO;
> @@ -709,13 +691,6 @@ static void microvm_class_init(ObjectClass *oc, void *data)
>       object_class_property_set_description(oc, MICROVM_MACHINE_PIC,
>           "Enable i8259 PIC");
>   
> -    object_class_property_add(oc, MICROVM_MACHINE_PIT, "OnOffAuto",
> -                              microvm_machine_get_pit,
> -                              microvm_machine_set_pit,
> -                              NULL, NULL);
> -    object_class_property_set_description(oc, MICROVM_MACHINE_PIT,
> -        "Enable i8254 PIT");
> -
>       object_class_property_add(oc, MICROVM_MACHINE_RTC, "OnOffAuto",
>                                 microvm_machine_get_rtc,
>                                 microvm_machine_set_rtc,
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index c8696ac01e85..48ab4cf44012 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1071,6 +1071,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
>       ISADevice *pit = NULL;
>       MemoryRegion *ioport80_io = g_new(MemoryRegion, 1);
>       MemoryRegion *ioportF0_io = g_new(MemoryRegion, 1);
> +    X86MachineState *x86ms = X86_MACHINE(pcms);
>   
>       memory_region_init_io(ioport80_io, NULL, &ioport80_io_ops, NULL, "ioport80", 1);
>       memory_region_add_subregion(isa_bus->address_space_io, 0x80, ioport80_io);
> @@ -1115,7 +1116,8 @@ void pc_basic_device_init(struct PCMachineState *pcms,
>   
>       qemu_register_boot_set(pc_boot_set, *rtc_state);
>   
> -    if (!xen_enabled() && pcms->pit_enabled) {
> +    if (!xen_enabled() &&
> +        (x86ms->pit == ON_OFF_AUTO_AUTO || x86ms->pit == ON_OFF_AUTO_ON)) {
>           if (kvm_pit_in_kernel()) {
>               pit = kvm_pit_init(isa_bus, 0x40);
>           } else {
> @@ -1484,20 +1486,6 @@ static void pc_machine_set_sata(Object *obj, bool value, Error **errp)
>       pcms->sata_enabled = value;
>   }
>   
> -static bool pc_machine_get_pit(Object *obj, Error **errp)
> -{
> -    PCMachineState *pcms = PC_MACHINE(obj);
> -
> -    return pcms->pit_enabled;
> -}
> -
> -static void pc_machine_set_pit(Object *obj, bool value, Error **errp)
> -{
> -    PCMachineState *pcms = PC_MACHINE(obj);
> -
> -    pcms->pit_enabled = value;
> -}
> -
>   static bool pc_machine_get_hpet(Object *obj, Error **errp)
>   {
>       PCMachineState *pcms = PC_MACHINE(obj);
> @@ -1640,7 +1628,6 @@ static void pc_machine_initfn(Object *obj)
>       pcms->acpi_build_enabled = PC_MACHINE_GET_CLASS(pcms)->has_acpi_build;
>       pcms->smbus_enabled = true;
>       pcms->sata_enabled = true;
> -    pcms->pit_enabled = true;
>       pcms->max_fw_size = 8 * MiB;
>   #ifdef CONFIG_HPET
>       pcms->hpet_enabled = true;
> @@ -1767,11 +1754,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
>       object_class_property_set_description(oc, PC_MACHINE_SATA,
>           "Enable/disable Serial ATA bus");
>   
> -    object_class_property_add_bool(oc, PC_MACHINE_PIT,
> -        pc_machine_get_pit, pc_machine_set_pit);
> -    object_class_property_set_description(oc, PC_MACHINE_PIT,
> -        "Enable/disable Intel 8254 programmable interval timer emulation");
> -
>       object_class_property_add_bool(oc, "hpet",
>           pc_machine_get_hpet, pc_machine_set_hpet);
>       object_class_property_set_description(oc, "hpet",
> diff --git a/hw/i386/x86.c b/hw/i386/x86.c
> index b84840a1bb99..744a50937761 100644
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -1226,6 +1226,23 @@ static void x86_machine_set_acpi(Object *obj, Visitor *v, const char *name,
>       visit_type_OnOffAuto(v, name, &x86ms->acpi, errp);
>   }
>   
> +static void x86_machine_get_pit(Object *obj, Visitor *v, const char *name,
> +                                    void *opaque, Error **errp)
> +{
> +    X86MachineState *x86ms = X86_MACHINE(obj);
> +    OnOffAuto pit = x86ms->pit;
> +
> +    visit_type_OnOffAuto(v, name, &pit, errp);
> +}
> +
> +static void x86_machine_set_pit(Object *obj, Visitor *v, const char *name,
> +                                    void *opaque, Error **errp)
> +{
> +    X86MachineState *x86ms = X86_MACHINE(obj);;
> +
> +    visit_type_OnOffAuto(v, name, &x86ms->pit, errp);
> +}
> +
>   static char *x86_machine_get_oem_id(Object *obj, Error **errp)
>   {
>       X86MachineState *x86ms = X86_MACHINE(obj);
> @@ -1315,6 +1332,7 @@ static void x86_machine_initfn(Object *obj)
>   
>       x86ms->smm = ON_OFF_AUTO_AUTO;
>       x86ms->acpi = ON_OFF_AUTO_AUTO;
> +    x86ms->pit = ON_OFF_AUTO_AUTO;
>       x86ms->pci_irq_mask = ACPI_BUILD_PCI_IRQS;
>       x86ms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
>       x86ms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
> @@ -1347,6 +1365,13 @@ static void x86_machine_class_init(ObjectClass *oc, void *data)
>       object_class_property_set_description(oc, X86_MACHINE_ACPI,
>           "Enable ACPI");
>   
> +    object_class_property_add(oc, X86_MACHINE_PIT, "OnOffAuto",
> +                              x86_machine_get_pit,
> +                              x86_machine_set_pit,
> +                              NULL, NULL);
> +    object_class_property_set_description(oc, X86_MACHINE_PIT,
> +        "Enable i8254 PIT");
> +
>       object_class_property_add_str(oc, X86_MACHINE_OEM_ID,
>                                     x86_machine_get_oem_id,
>                                     x86_machine_set_oem_id);
> diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h
> index efcbd926fd43..83f9ac0b2ad0 100644
> --- a/include/hw/i386/microvm.h
> +++ b/include/hw/i386/microvm.h
> @@ -67,7 +67,6 @@
>   #define PCIE_ECAM_SIZE        0x10000000
>   
>   /* Machine type options */
> -#define MICROVM_MACHINE_PIT                 "pit"
>   #define MICROVM_MACHINE_PIC                 "pic"
>   #define MICROVM_MACHINE_RTC                 "rtc"
>   #define MICROVM_MACHINE_PCIE                "pcie"
> @@ -87,7 +86,6 @@ struct MicrovmMachineState {
>   
>       /* Machine type options */
>       OnOffAuto pic;
> -    OnOffAuto pit;
>       OnOffAuto rtc;
>       OnOffAuto pcie;
>       OnOffAuto ioapic2;
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 9c9f4ac74810..01e84d5c4aa4 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -46,7 +46,6 @@ typedef struct PCMachineState {
>       bool acpi_build_enabled;
>       bool smbus_enabled;
>       bool sata_enabled;
> -    bool pit_enabled;
>       bool hpet_enabled;
>       bool default_bus_bypass_iommu;
>       uint64_t max_fw_size;
> @@ -63,7 +62,6 @@ typedef struct PCMachineState {
>   #define PC_MACHINE_VMPORT           "vmport"
>   #define PC_MACHINE_SMBUS            "smbus"
>   #define PC_MACHINE_SATA             "sata"
> -#define PC_MACHINE_PIT              "pit"
>   #define PC_MACHINE_MAX_FW_SIZE      "max-fw-size"
>   #define PC_MACHINE_SMBIOS_EP        "smbios-entry-point-type"
>   
> diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
> index a145a303703f..f0168902356d 100644
> --- a/include/hw/i386/x86.h
> +++ b/include/hw/i386/x86.h
> @@ -67,6 +67,7 @@ struct X86MachineState {
>   
>       OnOffAuto smm;
>       OnOffAuto acpi;
> +    OnOffAuto pit;
>   
>       char *oem_id;
>       char *oem_table_id;
> @@ -86,6 +87,7 @@ struct X86MachineState {
>   
>   #define X86_MACHINE_SMM              "smm"
>   #define X86_MACHINE_ACPI             "acpi"
> +#define X86_MACHINE_PIT              "pit"
>   #define X86_MACHINE_OEM_ID           "x-oem-id"
>   #define X86_MACHINE_OEM_TABLE_ID     "x-oem-table-id"
>   #define X86_MACHINE_BUS_LOCK_RATELIMIT  "bus-lock-ratelimit"



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] hw/i386: Make pic a property of common x86 base machine type
  2022-01-11  7:35 ` [PATCH v1 2/2] hw/i386: Make pic " Xiaoyao Li
  2022-01-11 11:08   ` Sergio Lopez
@ 2022-01-12  1:42   ` Xiaoyao Li
  1 sibling, 0 replies; 8+ messages in thread
From: Xiaoyao Li @ 2022-01-12  1:42 UTC (permalink / raw)
  To: Sergio Lopez, Michael S. Tsirkin, Marcel Apfelbaum,
	Richard Henderson, Eduardo Habkost, Paolo Bonzini
  Cc: qemu-devel

+ Paolo

On 1/11/2022 3:35 PM, Xiaoyao Li wrote:
> Legacy PIC (8259) cannot be supported for TDX guests since TDX module
> doesn't allow directly interrupt injection.  Using posted interrupts
> for the PIC is not a viable option as the guest BIOS/kernel will not
> do EOI for PIC IRQs, i.e. will leave the vIRR bit set.
> 
> Make PIC the property of common x86 machine type. Hence all x86
> machines, including microvm, can disable it.
> 
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>   hw/i386/microvm.c         | 27 +--------------------------
>   hw/i386/pc_piix.c         |  4 +++-
>   hw/i386/pc_q35.c          |  4 +++-
>   hw/i386/x86.c             | 25 +++++++++++++++++++++++++
>   include/hw/i386/microvm.h |  2 --
>   include/hw/i386/x86.h     |  2 ++
>   6 files changed, 34 insertions(+), 30 deletions(-)
> 
> diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
> index 89b555a2f584..754f1d0593e5 100644
> --- a/hw/i386/microvm.c
> +++ b/hw/i386/microvm.c
> @@ -247,7 +247,7 @@ static void microvm_devices_init(MicrovmMachineState *mms)
>           x86ms->pci_irq_mask = 0;
>       }
>   
> -    if (mms->pic == ON_OFF_AUTO_ON || mms->pic == ON_OFF_AUTO_AUTO) {
> +    if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) {
>           qemu_irq *i8259;
>   
>           i8259 = i8259_init(isa_bus, x86_allocate_cpu_irq());
> @@ -491,23 +491,6 @@ static void microvm_machine_reset(MachineState *machine)
>       }
>   }
>   
> -static void microvm_machine_get_pic(Object *obj, Visitor *v, const char *name,
> -                                    void *opaque, Error **errp)
> -{
> -    MicrovmMachineState *mms = MICROVM_MACHINE(obj);
> -    OnOffAuto pic = mms->pic;
> -
> -    visit_type_OnOffAuto(v, name, &pic, errp);
> -}
> -
> -static void microvm_machine_set_pic(Object *obj, Visitor *v, const char *name,
> -                                    void *opaque, Error **errp)
> -{
> -    MicrovmMachineState *mms = MICROVM_MACHINE(obj);
> -
> -    visit_type_OnOffAuto(v, name, &mms->pic, errp);
> -}
> -
>   static void microvm_machine_get_rtc(Object *obj, Visitor *v, const char *name,
>                                       void *opaque, Error **errp)
>   {
> @@ -632,7 +615,6 @@ static void microvm_machine_initfn(Object *obj)
>       MicrovmMachineState *mms = MICROVM_MACHINE(obj);
>   
>       /* Configuration */
> -    mms->pic = ON_OFF_AUTO_AUTO;
>       mms->rtc = ON_OFF_AUTO_AUTO;
>       mms->pcie = ON_OFF_AUTO_AUTO;
>       mms->ioapic2 = ON_OFF_AUTO_AUTO;
> @@ -684,13 +666,6 @@ static void microvm_class_init(ObjectClass *oc, void *data)
>   
>       x86mc->fwcfg_dma_enabled = true;
>   
> -    object_class_property_add(oc, MICROVM_MACHINE_PIC, "OnOffAuto",
> -                              microvm_machine_get_pic,
> -                              microvm_machine_set_pic,
> -                              NULL, NULL);
> -    object_class_property_set_description(oc, MICROVM_MACHINE_PIC,
> -        "Enable i8259 PIC");
> -
>       object_class_property_add(oc, MICROVM_MACHINE_RTC, "OnOffAuto",
>                                 microvm_machine_get_rtc,
>                                 microvm_machine_set_rtc,
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 7c7790a5ce34..d05683cd0d77 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -218,7 +218,9 @@ static void pc_init1(MachineState *machine,
>       }
>       isa_bus_irqs(isa_bus, x86ms->gsi);
>   
> -    pc_i8259_create(isa_bus, gsi_state->i8259_irq);
> +    if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) {
> +        pc_i8259_create(isa_bus, gsi_state->i8259_irq);
> +    }
>   
>       if (pcmc->pci_enabled) {
>           ioapic_init_gsi(gsi_state, "i440fx");
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 1780f79bc127..58e7e693f9e2 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -265,7 +265,9 @@ static void pc_q35_init(MachineState *machine)
>       pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq);
>       isa_bus = ich9_lpc->isa_bus;
>   
> -    pc_i8259_create(isa_bus, gsi_state->i8259_irq);
> +    if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) {
> +        pc_i8259_create(isa_bus, gsi_state->i8259_irq);
> +    }
>   
>       if (pcmc->pci_enabled) {
>           ioapic_init_gsi(gsi_state, "q35");
> diff --git a/hw/i386/x86.c b/hw/i386/x86.c
> index 744a50937761..d4a4c0ec8f61 100644
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -1243,6 +1243,23 @@ static void x86_machine_set_pit(Object *obj, Visitor *v, const char *name,
>       visit_type_OnOffAuto(v, name, &x86ms->pit, errp);
>   }
>   
> +static void x86_machine_get_pic(Object *obj, Visitor *v, const char *name,
> +                                void *opaque, Error **errp)
> +{
> +    X86MachineState *x86ms = X86_MACHINE(obj);
> +    OnOffAuto pic = x86ms->pic;
> +
> +    visit_type_OnOffAuto(v, name, &pic, errp);
> +}
> +
> +static void x86_machine_set_pic(Object *obj, Visitor *v, const char *name,
> +                                void *opaque, Error **errp)
> +{
> +    X86MachineState *x86ms = X86_MACHINE(obj);
> +
> +    visit_type_OnOffAuto(v, name, &x86ms->pic, errp);
> +}
> +
>   static char *x86_machine_get_oem_id(Object *obj, Error **errp)
>   {
>       X86MachineState *x86ms = X86_MACHINE(obj);
> @@ -1333,6 +1350,7 @@ static void x86_machine_initfn(Object *obj)
>       x86ms->smm = ON_OFF_AUTO_AUTO;
>       x86ms->acpi = ON_OFF_AUTO_AUTO;
>       x86ms->pit = ON_OFF_AUTO_AUTO;
> +    x86ms->pic = ON_OFF_AUTO_AUTO;
>       x86ms->pci_irq_mask = ACPI_BUILD_PCI_IRQS;
>       x86ms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
>       x86ms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
> @@ -1372,6 +1390,13 @@ static void x86_machine_class_init(ObjectClass *oc, void *data)
>       object_class_property_set_description(oc, X86_MACHINE_PIT,
>           "Enable i8254 PIT");
>   
> +    object_class_property_add(oc, X86_MACHINE_PIC, "OnOffAuto",
> +                              x86_machine_get_pic,
> +                              x86_machine_set_pic,
> +                              NULL, NULL);
> +    object_class_property_set_description(oc, X86_MACHINE_PIC,
> +        "Enable i8259 PIC");
> +
>       object_class_property_add_str(oc, X86_MACHINE_OEM_ID,
>                                     x86_machine_get_oem_id,
>                                     x86_machine_set_oem_id);
> diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h
> index 83f9ac0b2ad0..fad97a891dcb 100644
> --- a/include/hw/i386/microvm.h
> +++ b/include/hw/i386/microvm.h
> @@ -67,7 +67,6 @@
>   #define PCIE_ECAM_SIZE        0x10000000
>   
>   /* Machine type options */
> -#define MICROVM_MACHINE_PIC                 "pic"
>   #define MICROVM_MACHINE_RTC                 "rtc"
>   #define MICROVM_MACHINE_PCIE                "pcie"
>   #define MICROVM_MACHINE_IOAPIC2             "ioapic2"
> @@ -85,7 +84,6 @@ struct MicrovmMachineState {
>       X86MachineState parent;
>   
>       /* Machine type options */
> -    OnOffAuto pic;
>       OnOffAuto rtc;
>       OnOffAuto pcie;
>       OnOffAuto ioapic2;
> diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
> index f0168902356d..e4930321c921 100644
> --- a/include/hw/i386/x86.h
> +++ b/include/hw/i386/x86.h
> @@ -68,6 +68,7 @@ struct X86MachineState {
>       OnOffAuto smm;
>       OnOffAuto acpi;
>       OnOffAuto pit;
> +    OnOffAuto pic;
>   
>       char *oem_id;
>       char *oem_table_id;
> @@ -88,6 +89,7 @@ struct X86MachineState {
>   #define X86_MACHINE_SMM              "smm"
>   #define X86_MACHINE_ACPI             "acpi"
>   #define X86_MACHINE_PIT              "pit"
> +#define X86_MACHINE_PIC              "pic"
>   #define X86_MACHINE_OEM_ID           "x-oem-id"
>   #define X86_MACHINE_OEM_TABLE_ID     "x-oem-table-id"
>   #define X86_MACHINE_BUS_LOCK_RATELIMIT  "bus-lock-ratelimit"



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 0/2] i386: Make PIT and PIC the property of common x86 base machine type
  2022-01-11  7:35 [PATCH v1 0/2] i386: Make PIT and PIC the property of common x86 base machine type Xiaoyao Li
  2022-01-11  7:35 ` [PATCH v1 1/2] hw/i386: Make pit a " Xiaoyao Li
  2022-01-11  7:35 ` [PATCH v1 2/2] hw/i386: Make pic " Xiaoyao Li
@ 2022-02-14 14:45 ` Xiaoyao Li
  2 siblings, 0 replies; 8+ messages in thread
From: Xiaoyao Li @ 2022-02-14 14:45 UTC (permalink / raw)
  To: Sergio Lopez, Michael S. Tsirkin, Marcel Apfelbaum,
	Richard Henderson, Eduardo Habkost, Paolo Bonzini
  Cc: qemu-devel

ping.

On 1/11/2022 3:35 PM, Xiaoyao Li wrote:
> For PIT, it's straightforward to merge microvm::pit and
> pc_machine::pit_enabled into x86ms::pit
> 
> For PIC, move microvm::pic to x86ms:pic, which gives PC machine the
> ability to dis-/en-able PIC and it's the preparation for future TDX
> support.
> 
> Xiaoyao Li (2):
>    hw/i386: Make pit a property of common x86 base machine type
>    hw/i386: Make pic a property of common x86 base machine type
> 
>   hw/i386/microvm.c         | 54 ++-------------------------------------
>   hw/i386/pc.c              | 24 +++--------------
>   hw/i386/pc_piix.c         |  4 ++-
>   hw/i386/pc_q35.c          |  4 ++-
>   hw/i386/x86.c             | 50 ++++++++++++++++++++++++++++++++++++
>   include/hw/i386/microvm.h |  4 ---
>   include/hw/i386/pc.h      |  2 --
>   include/hw/i386/x86.h     |  4 +++
>   8 files changed, 65 insertions(+), 81 deletions(-)
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-14 15:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11  7:35 [PATCH v1 0/2] i386: Make PIT and PIC the property of common x86 base machine type Xiaoyao Li
2022-01-11  7:35 ` [PATCH v1 1/2] hw/i386: Make pit a " Xiaoyao Li
2022-01-11 11:07   ` Sergio Lopez
2022-01-12  1:41   ` Xiaoyao Li
2022-01-11  7:35 ` [PATCH v1 2/2] hw/i386: Make pic " Xiaoyao Li
2022-01-11 11:08   ` Sergio Lopez
2022-01-12  1:42   ` Xiaoyao Li
2022-02-14 14:45 ` [PATCH v1 0/2] i386: Make PIT and PIC the " Xiaoyao Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.