From: Sheng Yang <sheng@linux.intel.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
kvm@vger.kernel.org, Sheng Yang <sheng@linux.intel.com>
Subject: [PATCH 5/5] qemu-kvm: device assignment: Enable in-kernel MSI-X mask support
Date: Wed, 20 Oct 2010 16:29:55 +0800 [thread overview]
Message-ID: <1287563395-30039-6-git-send-email-sheng@linux.intel.com> (raw)
In-Reply-To: <1287563395-30039-1-git-send-email-sheng@linux.intel.com>
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
---
hw/device-assignment.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index d1a6282..aa3358e 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -269,6 +269,9 @@ static void assigned_dev_iomem_map(PCIDevice *pci_dev, int region_num,
AssignedDevRegion *region = &r_dev->v_addrs[region_num];
PCIRegion *real_region = &r_dev->real_device.regions[region_num];
int ret = 0;
+#ifdef KVM_CAP_DEVICE_MSIX_MASK
+ struct kvm_assigned_msix_mmio msix_mmio;
+#endif
DEBUG("e_phys=%08" FMT_PCIBUS " r_virt=%p type=%d len=%08" FMT_PCIBUS " region_num=%d \n",
e_phys, region->u.r_virtbase, type, e_size, region_num);
@@ -287,6 +290,16 @@ static void assigned_dev_iomem_map(PCIDevice *pci_dev, int region_num,
cpu_register_physical_memory(e_phys + offset,
TARGET_PAGE_SIZE, r_dev->mmio_index);
+#ifdef KVM_CAP_DEVICE_MSIX_MASK
+ memset(&msix_mmio, 0, sizeof(struct kvm_assigned_msix_mmio));
+ msix_mmio.assigned_dev_id = calc_assigned_dev_id(r_dev->h_segnr,
+ r_dev->h_busnr, r_dev->h_devfn);
+ msix_mmio.base_addr = e_phys + offset;
+ if (kvm_assign_reg_msix_mmio(kvm_context, &msix_mmio))
+ fprintf(stderr, "fail to register in-kernel msix_mmio!\n");
+ /* We can still continue because the MMIO accessing can fall
+ * back to QEmu */
+#endif
}
}
--
1.7.0.1
next prev parent reply other threads:[~2010-10-20 8:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-20 8:29 [PATCH 0/5] MSI-X mask support for assigned device on userspace Sheng Yang
2010-10-20 8:29 ` [PATCH 1/5] qemu-kvm: Add kvm_enable_cap() interface for x86 Sheng Yang
2010-10-20 8:29 ` [PATCH 2/5] qemu-kvm: Ioctl for in-kernel mask support Sheng Yang
2010-10-20 8:29 ` [PATCH 3/5] qemu-kvm: device assignment: Some clean up about MSI-X code Sheng Yang
2010-10-20 8:29 ` [PATCH 4/5] qemu-kvm: device assignment: emulate MSI-X mask bits Sheng Yang
2010-10-20 8:29 ` Sheng Yang [this message]
2010-10-20 22:36 ` [PATCH 5/5] qemu-kvm: device assignment: Enable in-kernel MSI-X mask support Michael S. Tsirkin
2010-10-21 7:12 ` Sheng Yang
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=1287563395-30039-6-git-send-email-sheng@linux.intel.com \
--to=sheng@linux.intel.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.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