qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] [PATCH 03/20] msi: Generalize msix_supported to msi_supported
Date: Fri, 20 Jan 2012 15:26:29 -0200	[thread overview]
Message-ID: <60ba3cc231d6bc7b802ad4fe6b6fc159ecb112e2.1327080406.git.mtosatti@redhat.com> (raw)
In-Reply-To: <cover.1327080406.git.mtosatti@redhat.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

Rename msix_supported to msi_supported and control MSI and MSI-X
activation this way. That was likely to original intention for this
flag, but MSI support came after MSI-X.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/msi.c  |    8 ++++++++
 hw/msi.h  |    2 ++
 hw/msix.c |    9 ++++-----
 hw/msix.h |    2 --
 hw/pc.c   |    4 ++--
 5 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/hw/msi.c b/hw/msi.c
index f214fcf..5d6ceb6 100644
--- a/hw/msi.c
+++ b/hw/msi.c
@@ -36,6 +36,9 @@
 
 #define PCI_MSI_VECTORS_MAX     32
 
+/* Flag for interrupt controller to declare MSI/MSI-X support */
+bool msi_supported;
+
 /* If we get rid of cap allocator, we won't need this. */
 static inline uint8_t msi_cap_sizeof(uint16_t flags)
 {
@@ -116,6 +119,11 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
     uint16_t flags;
     uint8_t cap_size;
     int config_offset;
+
+    if (!msi_supported) {
+        return -ENOTSUP;
+    }
+
     MSI_DEV_PRINTF(dev,
                    "init offset: 0x%"PRIx8" vector: %"PRId8
                    " 64bit %d mask %d\n",
diff --git a/hw/msi.h b/hw/msi.h
index 5766018..3040bb0 100644
--- a/hw/msi.h
+++ b/hw/msi.h
@@ -24,6 +24,8 @@
 #include "qemu-common.h"
 #include "pci.h"
 
+extern bool msi_supported;
+
 bool msi_enabled(const PCIDevice *dev);
 int msi_init(struct PCIDevice *dev, uint8_t offset,
              unsigned int nr_vectors, bool msi64bit, bool msi_per_vector_mask);
diff --git a/hw/msix.c b/hw/msix.c
index f47d26b..3835eaa 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -15,6 +15,7 @@
  */
 
 #include "hw.h"
+#include "msi.h"
 #include "msix.h"
 #include "pci.h"
 #include "range.h"
@@ -35,9 +36,6 @@
 #define MSIX_MAX_ENTRIES 32
 
 
-/* Flag for interrupt controller to declare MSI-X support */
-int msix_supported;
-
 /* Add MSI-X capability to the config space for the device. */
 /* Given a bar and its size, add MSI-X table on top of it
  * and fill MSI-X capability in the config space.
@@ -238,10 +236,11 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,
               unsigned bar_nr, unsigned bar_size)
 {
     int ret;
+
     /* Nothing to do if MSI is not supported by interrupt controller */
-    if (!msix_supported)
+    if (!msi_supported) {
         return -ENOTSUP;
-
+    }
     if (nentries > MSIX_MAX_ENTRIES)
         return -EINVAL;
 
diff --git a/hw/msix.h b/hw/msix.h
index 7e04336..5aba22b 100644
--- a/hw/msix.h
+++ b/hw/msix.h
@@ -29,6 +29,4 @@ void msix_notify(PCIDevice *dev, unsigned vector);
 
 void msix_reset(PCIDevice *dev);
 
-extern int msix_supported;
-
 #endif
diff --git a/hw/pc.c b/hw/pc.c
index 85304cf..04304e0 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -36,7 +36,7 @@
 #include "elf.h"
 #include "multiboot.h"
 #include "mc146818rtc.h"
-#include "msix.h"
+#include "msi.h"
 #include "sysbus.h"
 #include "sysemu.h"
 #include "blockdev.h"
@@ -896,7 +896,7 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
         apic_mapped = 1;
     }
 
-    msix_supported = 1;
+    msi_supported = true;
 
     return dev;
 }
-- 
1.7.6.4

  parent reply	other threads:[~2012-01-20 17:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20 17:26 [Qemu-devel] [PATCH 00/20] [PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 01/20] hyper-v: introduce Hyper-V support infrastructure Marcelo Tosatti
2012-11-28 14:39   ` [Qemu-devel] kvm: let's add HYPERV capabilities (was Re: [PATCH 01/20] hyper-v: introduce Hyper-V support infrastructure.) Michael S. Tsirkin
2012-01-20 17:26 ` [Qemu-devel] [PATCH 02/20] hyper-v: initialize Hyper-V CPUID leaves Marcelo Tosatti
2012-01-20 17:26 ` Marcelo Tosatti [this message]
2012-01-20 17:26 ` [Qemu-devel] [PATCH 04/20] kvm: Move kvmclock into hw/kvm folder Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 05/20] apic: Stop timer on reset Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 06/20] apic: Inject external NMI events via LINT1 Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 07/20] apic: Introduce apic_report_irq_delivered Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 08/20] apic: Factor out base class for KVM reuse Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 09/20] apic: Open-code timer save/restore Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 10/20] i8259: Completely privatize PicState Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 11/20] i8259: Factor out base class for KVM reuse Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 12/20] ioapic: Drop post-load irr initialization Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 13/20] ioapic: Factor out base class for KVM reuse Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 14/20] memory: Introduce memory_region_init_reservation Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 15/20] kvm: Introduce core services for in-kernel irqchip support Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 16/20] kvm: x86: Establish IRQ0 override control Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 17/20] kvm: x86: Add user space part for in-kernel APIC Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 18/20] kvm: x86: Add user space part for in-kernel i8259 Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 19/20] kvm: x86: Add user space part for in-kernel IOAPIC Marcelo Tosatti
2012-01-20 17:26 ` [Qemu-devel] [PATCH 20/20] kvm: Activate in-kernel irqchip support Marcelo Tosatti
2012-01-23 17:44 ` [Qemu-devel] [PATCH 00/20] [PULL] qemu-kvm.git uq/master queue Anthony Liguori

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=60ba3cc231d6bc7b802ad4fe6b6fc159ecb112e2.1327080406.git.mtosatti@redhat.com \
    --to=mtosatti@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /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).