summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorHe Zhe <zhe.he@windriver.com>2016-11-29 17:56:47 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-05 13:54:05 +0000
commit6dbfeb5ef3ff27b1fc52f93fea8c38b584f242a2 (patch)
tree0fb74333d3de43d0c6c56acd590e9989465da24c /meta/recipes-devtools
parent1349320ee0d1dc460c311f0a2461276c9aa13365 (diff)
downloadpoky-6dbfeb5ef3ff27b1fc52f93fea8c38b584f242a2.tar.gz
qemu: Fix pci-assign
Fix iommu pci device assignment failure. "qemu-system-x86_64: -device pci-assign,host=02:00.0: No IOMMU found. Unable to assign device "(null)"" (From OE-Core rev: 2011d1cc6c05ff3979e4bd664ce918dc8eb8e8fb) Signed-off-by: He Zhe <zhe.he@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch71
-rw-r--r--meta/recipes-devtools/qemu/qemu_2.7.0.bb1
2 files changed, 72 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch b/meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
new file mode 100644
index 0000000000..03472dd0bf
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
@@ -0,0 +1,71 @@
1From 6baa545df93253fced4fc0d52b14b98447e00473 Mon Sep 17 00:00:00 2001
2From: Peter Xu <peterx@redhat.com>
3Date: Mon, 28 Nov 2016 15:02:44 +0800
4Subject: [PATCH] pci-assign: sync MSI/MSI-X cap and table with PCIDevice
5
6Since commit e1d4fb2d ("kvm-irqchip: x86: add msi route notify fn"),
7kvm_irqchip_add_msi_route() starts to use pci_get_msi_message() to fetch
8MSI info. This requires that we setup MSI related fields in PCIDevice.
9For most devices, that won't be a problem, as long as we are using
10general interfaces like msi_init()/msix_init().
11
12However, for pci-assign devices, MSI/MSI-X is treated differently - PCI
13assign devices are maintaining its own MSI table and cap information in
14AssignedDevice struct. however that's not synced up with PCIDevice's
15fields. That will leads to pci_get_msi_message() failed to find correct
16MSI capability, even with an NULL msix_table.
17
18A quick fix is to sync up the two places: both the capability bits and
19table address for MSI/MSI-X.
20
21Upstream-Status: Backport [https://lists.gnu.org/archive/html/qemu-devel/2016-11/msg04649.html]
22
23Reported-by: Changlimin <address@hidden>
24Tested-by: Changlimin <address@hidden>
25Cc: address@hidden
26Fixes: e1d4fb2d ("kvm-irqchip: x86: add msi route notify fn")
27Signed-off-by: Peter Xu <address@hidden>
28Signed-off-by: He Zhe <zhe.he@windriver.com>
29---
30 hw/i386/kvm/pci-assign.c | 4 ++++
31 1 file changed, 4 insertions(+)
32
33diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
34index 8238fbc..87dcbdd 100644
35--- a/hw/i386/kvm/pci-assign.c
36+++ b/hw/i386/kvm/pci-assign.c
37@@ -1251,6 +1251,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
38 error_propagate(errp, local_err);
39 return -ENOTSUP;
40 }
41+ dev->dev.cap_present |= QEMU_PCI_CAP_MSI;
42 dev->cap.available |= ASSIGNED_DEVICE_CAP_MSI;
43 /* Only 32-bit/no-mask currently supported */
44 ret = pci_add_capability2(pci_dev, PCI_CAP_ID_MSI, pos, 10,
45@@ -1285,6 +1286,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
46 error_propagate(errp, local_err);
47 return -ENOTSUP;
48 }
49+ dev->dev.cap_present |= QEMU_PCI_CAP_MSIX;
50 dev->cap.available |= ASSIGNED_DEVICE_CAP_MSIX;
51 ret = pci_add_capability2(pci_dev, PCI_CAP_ID_MSIX, pos, 12,
52 &local_err);
53@@ -1648,6 +1650,7 @@ static void assigned_dev_register_msix_mmio(AssignedDevice *dev, Error **errp)
54 dev->msix_table = NULL;
55 return;
56 }
57+ dev->dev.msix_table = (uint8_t *)dev->msix_table;
58
59 assigned_dev_msix_reset(dev);
60
61@@ -1665,6 +1668,7 @@ static void assigned_dev_unregister_msix_mmio(AssignedDevice *dev)
62 error_report("error unmapping msix_table! %s", strerror(errno));
63 }
64 dev->msix_table = NULL;
65+ dev->dev.msix_table = NULL;
66 }
67
68 static const VMStateDescription vmstate_assigned_device = {
69--
702.8.3
71
diff --git a/meta/recipes-devtools/qemu/qemu_2.7.0.bb b/meta/recipes-devtools/qemu/qemu_2.7.0.bb
index 2b5cc5e01a..0d680a7eee 100644
--- a/meta/recipes-devtools/qemu/qemu_2.7.0.bb
+++ b/meta/recipes-devtools/qemu/qemu_2.7.0.bb
@@ -13,6 +13,7 @@ SRC_URI += "file://configure-fix-Darwin-target-detection.patch \
13 file://0002-fix-CVE-2016-7423.patch \ 13 file://0002-fix-CVE-2016-7423.patch \
14 file://0003-fix-CVE-2016-7908.patch \ 14 file://0003-fix-CVE-2016-7908.patch \
15 file://0004-fix-CVE-2016-7909.patch \ 15 file://0004-fix-CVE-2016-7909.patch \
16 file://0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch \
16" 17"
17 18
18SRC_URI_prepend = "http://wiki.qemu-project.org/download/${BP}.tar.bz2" 19SRC_URI_prepend = "http://wiki.qemu-project.org/download/${BP}.tar.bz2"