From: Alex Williamson <alex.williamson@redhat.com>
To: alex.williamson@redhat.com
Cc: Ronnie Swanink <ronnie@ronnieswanink.nl>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] vfio/pci-quirks: Only quirk to size of PCI config space
Date: Tue, 17 Nov 2015 16:41:09 -0700 [thread overview]
Message-ID: <20151117234028.23385.99569.stgit@gimli.home> (raw)
For quirks that support the full PCIe extended config space, limit the
quirk to only the size of config space available through vfio. This
allows host systems with broken MMCONFIG regions to still make use of
these quirks without generating bad address faults trying to access
beyond the end of config space exposed through vfio. This may expose
direct access to parts of extended config space that we'd prefer not
to expose, but that's why we have an IOMMU.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reported-by: Ronnie Swanink <ronnie@ronnieswanink.nl>
---
hw/vfio/pci-quirks.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index 30c68a1..e117c41 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -328,7 +328,7 @@ static void vfio_probe_ati_bar4_quirk(VFIOPCIDevice *vdev, int nr)
window->data_offset = 4;
window->nr_matches = 1;
window->matches[0].match = 0x4000;
- window->matches[0].mask = PCIE_CONFIG_SPACE_SIZE - 1;
+ window->matches[0].mask = vdev->config_size - 1;
window->bar = nr;
window->addr_mem = &quirk->mem[0];
window->data_mem = &quirk->mem[1];
@@ -674,7 +674,7 @@ static void vfio_probe_nvidia_bar5_quirk(VFIOPCIDevice *vdev, int nr)
window->matches[0].match = 0x1800;
window->matches[0].mask = PCI_CONFIG_SPACE_SIZE - 1;
window->matches[1].match = 0x88000;
- window->matches[1].mask = PCIE_CONFIG_SPACE_SIZE - 1;
+ window->matches[1].mask = vdev->config_size - 1;
window->bar = nr;
window->addr_mem = bar5->addr_mem = &quirk->mem[0];
window->data_mem = bar5->data_mem = &quirk->mem[1];
@@ -765,7 +765,7 @@ static void vfio_probe_nvidia_bar0_quirk(VFIOPCIDevice *vdev, int nr)
memory_region_init_io(mirror->mem, OBJECT(vdev),
&vfio_nvidia_mirror_quirk, mirror,
"vfio-nvidia-bar0-88000-mirror-quirk",
- PCIE_CONFIG_SPACE_SIZE);
+ vdev->config_size);
memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem,
mirror->offset, mirror->mem, 1);
next reply other threads:[~2015-11-17 23:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-17 23:41 Alex Williamson [this message]
2015-11-18 9:36 ` [Qemu-devel] [PATCH] vfio/pci-quirks: Only quirk to size of PCI config space Laszlo Ersek
2015-11-18 16:03 ` Alex Williamson
2015-11-18 17:21 ` Laszlo Ersek
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=20151117234028.23385.99569.stgit@gimli.home \
--to=alex.williamson@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=ronnie@ronnieswanink.nl \
/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).