]> Git Repo - qemu.git/commitdiff
msi_supported -> msi_nonbroken
authorMichael S. Tsirkin <[email protected]>
Fri, 4 Mar 2016 09:24:28 +0000 (11:24 +0200)
committerMichael S. Tsirkin <[email protected]>
Fri, 11 Mar 2016 14:45:21 +0000 (16:45 +0200)
Rename controller flag to make it clearer what it means.
Add some documentation as well.

Signed-off-by: Michael S. Tsirkin <[email protected]>
13 files changed:
hw/i386/kvm/apic.c
hw/i386/xen/xen_apic.c
hw/intc/apic.c
hw/intc/arm_gicv2m.c
hw/intc/openpic.c
hw/intc/openpic_kvm.c
hw/pci-bridge/pci_bridge_dev.c
hw/pci/msi.c
hw/pci/msix.c
hw/ppc/spapr.c
hw/ppc/spapr_pci.c
hw/s390x/s390-pci-bus.c
include/hw/pci/msi.h

index 694d3989b2bf3212327d4c88c9fb41ad99704e55..3c7c8fa00709e30d9c3c0843f812497bc6779d89 100644 (file)
@@ -186,7 +186,7 @@ static void kvm_apic_realize(DeviceState *dev, Error **errp)
                           APIC_SPACE_SIZE);
 
     if (kvm_has_gsi_routing()) {
-        msi_supported = true;
+        msi_nonbroken = true;
     }
 }
 
index 2b8d709d4d73149a884bbec6a4481bb737f0ec55..21d68ee04b0ae66c940940f98b3f0492c4e0d024 100644 (file)
@@ -44,7 +44,7 @@ static void xen_apic_realize(DeviceState *dev, Error **errp)
     s->vapic_control = 0;
     memory_region_init_io(&s->io_memory, OBJECT(s), &xen_apic_io_ops, s,
                           "xen-apic-msi", APIC_SPACE_SIZE);
-    msi_supported = true;
+    msi_nonbroken = true;
 }
 
 static void xen_apic_set_base(APICCommonState *s, uint64_t val)
index a2994624f5a2d870bc96fedb96024887cdffdc93..28c2ea540608aa179d4207ebb9138daea89d585a 100644 (file)
@@ -874,7 +874,7 @@ static void apic_realize(DeviceState *dev, Error **errp)
     s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, apic_timer, s);
     local_apics[s->idx] = s;
 
-    msi_supported = true;
+    msi_nonbroken = true;
 }
 
 static void apic_class_init(ObjectClass *klass, void *data)
index 70c0b97d99e03bf3a221d76633a94f517d6ff699..ebd368bbadebbb302a34e77620012e5b518cdfdb 100644 (file)
@@ -148,7 +148,7 @@ static void gicv2m_realize(DeviceState *dev, Error **errp)
         sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->spi[i]);
     }
 
-    msi_supported = true;
+    msi_nonbroken = true;
     kvm_gsi_direct_mapping = true;
     kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
 }
index 903888c02ec30ee90f14d439f8ebfc7678433d1f..7685250bf49dda35311f3fe7486ef2498810c1ff 100644 (file)
@@ -1375,7 +1375,7 @@ static void fsl_common_init(OpenPICState *opp)
 
     opp->irq_msi = 224;
 
-    msi_supported = true;
+    msi_nonbroken = true;
     for (i = 0; i < opp->fsl->max_ext; i++) {
         opp->src[i].level = false;
     }
index 4dcdb61a09a2a9e60c5b6f53aa6b9040a2fbc001..778af4a7d4bba050fd71f55ae9ea736f8e31971d 100644 (file)
@@ -239,7 +239,7 @@ static void kvm_openpic_realize(DeviceState *dev, Error **errp)
     memory_listener_register(&opp->mem_listener, &address_space_memory);
 
     /* indicate pic capabilities */
-    msi_supported = true;
+    msi_nonbroken = true;
     kvm_kernel_irqchip = true;
     kvm_async_interrupts_allowed = true;
 
index 100bb5ebf6d0a4a80958c17bffbaf64bfd2a8102..862a2366f237f455de85483241532f24b73bb089 100644 (file)
@@ -72,7 +72,7 @@ static int pci_bridge_dev_initfn(PCIDevice *dev)
         goto slotid_error;
     }
     if ((bridge_dev->flags & (1 << PCI_BRIDGE_DEV_F_MSI_REQ)) &&
-        msi_supported) {
+        msi_nonbroken) {
         err = msi_init(dev, 0, 1, true, true);
         if (err < 0) {
             goto msi_error;
index 85f21b8c4bb39c79a400bba7882e5b99ba59190d..e0e64c2d9e060603e738ff570456fe5d903be4ee 100644 (file)
 
 #define PCI_MSI_VECTORS_MAX     32
 
-/* Flag for interrupt controller to declare MSI/MSI-X support */
-bool msi_supported;
+/*
+ * Flag for interrupt controllers to declare broken MSI/MSI-X support.
+ * values: false - broken; true - non-broken.
+ *
+ * Setting this flag to false will remove MSI/MSI-X capability from all devices.
+ *
+ * It is preferrable for controllers to set this to true (non-broken) even if
+ * they do not actually support MSI/MSI-X: guests normally probe the controller
+ * type and do not attempt to enable MSI/MSI-X with interrupt controllers not
+ * supporting such, so removing the capability is not required, and
+ * it seems cleaner to have a given device look the same for all boards.
+ *
+ * TODO: some existing controllers violate the above rule. Identify and fix them.
+ */
+bool msi_nonbroken;
 
 /* If we get rid of cap allocator, we won't need this. */
 static inline uint8_t msi_cap_sizeof(uint16_t flags)
@@ -160,7 +173,7 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
     uint8_t cap_size;
     int config_offset;
 
-    if (!msi_supported) {
+    if (!msi_nonbroken) {
         return -ENOTSUP;
     }
 
index 537fdba747764350c0defd46918742988da70706..b75f0e9c47f8986b386a91cbef86860551ee279e 100644 (file)
@@ -249,7 +249,7 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,
     uint8_t *config;
 
     /* Nothing to do if MSI is not supported by interrupt controller */
-    if (!msi_supported) {
+    if (!msi_nonbroken) {
         return -ENOTSUP;
     }
 
index 64c4acce067a93314520e9fdd7255ad84132b8f1..298171a205166dd3dc5f2c9a86ffcbd81ddcb770 100644 (file)
@@ -439,7 +439,7 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
     _FDT((fdt_property_cell(fdt, "rtas-event-scan-rate",
                             RTAS_EVENT_SCAN_RATE)));
 
-    if (msi_supported) {
+    if (msi_nonbroken) {
         _FDT((fdt_property(fdt, "ibm,change-msix-capable", NULL, 0)));
     }
 
@@ -1743,7 +1743,7 @@ static void ppc_spapr_init(MachineState *machine)
     bool kernel_le = false;
     char *filename;
 
-    msi_supported = true;
+    msi_nonbroken = true;
 
     QLIST_INIT(&spapr->phbs);
 
index e8edad3ab7c3cafc056a015204b986bcbc819616..3fc78955ec0588a604124d67754da7b259e45687 100644 (file)
@@ -1790,7 +1790,7 @@ void spapr_pci_rtas_init(void)
                         rtas_ibm_read_pci_config);
     spapr_rtas_register(RTAS_IBM_WRITE_PCI_CONFIG, "ibm,write-pci-config",
                         rtas_ibm_write_pci_config);
-    if (msi_supported) {
+    if (msi_nonbroken) {
         spapr_rtas_register(RTAS_IBM_QUERY_INTERRUPT_SOURCE_NUMBER,
                             "ibm,query-interrupt-source-number",
                             rtas_ibm_query_interrupt_source_number);
index dba0202b70614bbdbad7e5efd3b55e6f7a92b31d..f5f679f82c71af5bef98fc05ab458fddd7118dbf 100644 (file)
@@ -597,7 +597,7 @@ static void s390_pcihost_class_init(ObjectClass *klass, void *data)
     k->init = s390_pcihost_init;
     hc->plug = s390_pcihost_hot_plug;
     hc->unplug = s390_pcihost_hot_unplug;
-    msi_supported = true;
+    msi_nonbroken = true;
 }
 
 static const TypeInfo s390_pcihost_info = {
index 50e452bd05bf4f9ea9e2f469161294b5eadddf23..8124908abd7f5b139d3b8e2b557682639ecdaad9 100644 (file)
@@ -29,7 +29,7 @@ struct MSIMessage {
     uint32_t data;
 };
 
-extern bool msi_supported;
+extern bool msi_nonbroken;
 
 void msi_set_message(PCIDevice *dev, MSIMessage msg);
 MSIMessage msi_get_message(PCIDevice *dev, unsigned int vector);
This page took 0.038473 seconds and 4 git commands to generate.