qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	xen-devel@lists.xensource.com,
	Eduardo Habkost <ehabkost@redhat.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Alexander Graf <agraf@suse.de>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PULL 17/53] msi_supported -> msi_nonbroken
Date: Fri, 11 Mar 2016 17:08:28 +0200	[thread overview]
Message-ID: <1457708548-14093-18-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1457708548-14093-1-git-send-email-mst@redhat.com>

Rename controller flag to make it clearer what it means.
Add some documentation as well.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/pci/msi.h           |  2 +-
 hw/i386/kvm/apic.c             |  2 +-
 hw/i386/xen/xen_apic.c         |  2 +-
 hw/intc/apic.c                 |  2 +-
 hw/intc/arm_gicv2m.c           |  2 +-
 hw/intc/openpic.c              |  2 +-
 hw/intc/openpic_kvm.c          |  2 +-
 hw/pci-bridge/pci_bridge_dev.c |  2 +-
 hw/pci/msi.c                   | 19 ++++++++++++++++---
 hw/pci/msix.c                  |  2 +-
 hw/ppc/spapr.c                 |  4 ++--
 hw/ppc/spapr_pci.c             |  2 +-
 hw/s390x/s390-pci-bus.c        |  2 +-
 13 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/include/hw/pci/msi.h b/include/hw/pci/msi.h
index 50e452b..8124908 100644
--- a/include/hw/pci/msi.h
+++ b/include/hw/pci/msi.h
@@ -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);
diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c
index 694d398..3c7c8fa 100644
--- a/hw/i386/kvm/apic.c
+++ b/hw/i386/kvm/apic.c
@@ -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;
     }
 }
 
diff --git a/hw/i386/xen/xen_apic.c b/hw/i386/xen/xen_apic.c
index 2b8d709..21d68ee 100644
--- a/hw/i386/xen/xen_apic.c
+++ b/hw/i386/xen/xen_apic.c
@@ -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)
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index a299462..28c2ea5 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -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)
diff --git a/hw/intc/arm_gicv2m.c b/hw/intc/arm_gicv2m.c
index 70c0b97..ebd368b 100644
--- a/hw/intc/arm_gicv2m.c
+++ b/hw/intc/arm_gicv2m.c
@@ -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();
 }
diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c
index 903888c..7685250 100644
--- a/hw/intc/openpic.c
+++ b/hw/intc/openpic.c
@@ -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;
     }
diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c
index 4dcdb61..778af4a 100644
--- a/hw/intc/openpic_kvm.c
+++ b/hw/intc/openpic_kvm.c
@@ -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;
 
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
index 100bb5e..862a2366 100644
--- a/hw/pci-bridge/pci_bridge_dev.c
+++ b/hw/pci-bridge/pci_bridge_dev.c
@@ -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;
diff --git a/hw/pci/msi.c b/hw/pci/msi.c
index 85f21b8..e0e64c2 100644
--- a/hw/pci/msi.c
+++ b/hw/pci/msi.c
@@ -34,8 +34,21 @@
 
 #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;
     }
 
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 537fdba..b75f0e9 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -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;
     }
 
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 64c4acc..298171a 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -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);
 
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index e8edad3..3fc7895 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -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);
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index dba0202..f5f679f 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -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 = {
-- 
MST

  parent reply	other threads:[~2016-03-11 15:08 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 15:07 [Qemu-devel] [PULL 00/53] vhost, virtio, pci, pc, acpi Michael S. Tsirkin
2016-03-11 15:07 ` [Qemu-devel] [PULL 01/53] acpi: add aml_create_field() Michael S. Tsirkin
2016-03-11 15:07 ` [Qemu-devel] [PULL 02/53] acpi: add aml_concatenate() Michael S. Tsirkin
2016-03-11 15:07 ` [Qemu-devel] [PULL 03/53] acpi: allow using object as offset for OperationRegion Michael S. Tsirkin
2016-03-11 15:07 ` [Qemu-devel] [PULL 04/53] acpi: add build_append_named_dword, returning an offset in buffer Michael S. Tsirkin
2016-03-11 15:07 ` [Qemu-devel] [PULL 05/53] balloon: fix segfault and harden the stats queue Michael S. Tsirkin
2016-03-11 15:07 ` [Qemu-devel] [PULL 06/53] hw/virtio: fix double use of a virtio flag Michael S. Tsirkin
2016-03-11 15:07 ` [Qemu-devel] [PULL 07/53] hw/virtio: group virtio flags into an enum Michael S. Tsirkin
2016-03-11 15:07 ` [Qemu-devel] [PULL 08/53] virtio-balloon: add 'available' counter Michael S. Tsirkin
2016-03-11 15:07 ` [Qemu-devel] [PULL 09/53] vhost-user: verify that number of queues is less than MAX_QUEUE_NUM Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 10/53] pc-dimm: fix error handling in pc_dimm_check_memdev_is_busy() Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 11/53] i386/acpi: make floppy controller object dynamic Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 12/53] i386: expose floppy drive CMOS type Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 13/53] fdc: add function to determine drive chs limits Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 14/53] i386: populate floppy drive information in DSDT Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 15/53] i386: update expected DSDT Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 16/53] virtio-pci: call pci reset variant when guest requests reset Michael S. Tsirkin
2016-03-14  1:36   ` Laszlo Ersek
2016-03-14  1:45     ` Laszlo Ersek
2016-03-11 15:08 ` Michael S. Tsirkin [this message]
2016-03-11 15:08 ` [Qemu-devel] [PULL 18/53] ich9lpc: fix typo Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 19/53] hw/acpi: fix Q35 support for legacy Windows OS Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 20/53] acpi-test-data: add _DIS methods Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 21/53] pci-ids: add virtio 1.0 ids to spec Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 22/53] nvdimm acpi: initialize the resource used by NVDIMM ACPI Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 23/53] nvdimm acpi: introduce patched dsm memory Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 24/53] nvdimm acpi: let qemu handle _DSM method Michael S. Tsirkin
2016-03-11 15:08 ` [Qemu-devel] [PULL 25/53] nvdimm acpi: emulate dsm method Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 26/53] vhost-user: fix use after free Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 27/53] vhost-user: remove useless is_server field Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 28/53] qemu-char: avoid potential double-free Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 29/53] qemu-char: remove all msgfds on disconnect Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 30/53] qemu-char: make tcp_chr_disconnect() reentrant-safe Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 31/53] pxb: cleanup Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 32/53] pc: acpi: remove NOP assignment Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 33/53] pc: init pcms->apic_id_limit once and use it throughout pc.c Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 34/53] machine: introduce MachineClass.possible_cpu_arch_ids() hook Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 35/53] pc: acpi: cleanup qdev_get_machine() calls Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 36/53] pc: acpi: SRAT: create only valid processor lapic entries Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 37/53] pc: acpi: create MADT.lapic entries only for valid lapics Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 38/53] pc: acpi: create Processor and Notify objects " Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 39/53] pc: acpi: drop cpu->found_cpus bitmap Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 40/53] pc: acpi: clarify why possible LAPIC entries must be present in MADT Michael S. Tsirkin
2016-03-11 15:09 ` [Qemu-devel] [PULL 41/53] MAINTAINERS: Add an entry for virtio header files Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 42/53] MAINTAINERS: machine core Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 43/53] ipmi: remove IPMI_CHECK_CMD_LEN() macro Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 44/53] ipmi: replace IPMI_ADD_RSP_DATA() macro with inline helpers Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 45/53] ipmi: remove IPMI_CHECK_RESERVATION() macro Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 46/53] ipmi: add rsp_buffer_set_error() helper Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 47/53] ipmi: add a realize function to the device class Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 48/53] ipmi: use a function to initialize the SDR table Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 49/53] ipmi: remove the need of an ending record in " Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 50/53] ipmi: add some local variables in ipmi_sdr_init Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 51/53] ipmi: use a file to load SDRs Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 52/53] ipmi: provide support for FRUs Michael S. Tsirkin
2016-03-11 15:10 ` [Qemu-devel] [PULL 53/53] fw-cfg: support writeable blobs Michael S. Tsirkin
2016-03-14 15:10 ` [Qemu-devel] [PULL 00/53] vhost, virtio, pci, pc, acpi Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457708548-14093-18-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).