[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/15] pci: advertise a page aligned ATS
From: |
Michael S. Tsirkin |
Subject: |
[PULL 10/15] pci: advertise a page aligned ATS |
Date: |
Fri, 30 Oct 2020 10:12:11 -0400 |
From: Jason Wang <jasowang@redhat.com>
After Linux kernel commit 61363c1474b1 ("iommu/vt-d: Enable ATS only
if the device uses page aligned address."), ATS will be only enabled
if device advertises a page aligned request.
Unfortunately, vhost-net is the only user and we don't advertise the
aligned request capability in the past since both vhost IOTLB and
address_space_get_iotlb_entry() can support non page aligned request.
Though it's not clear that if the above kernel commit makes
sense. Let's advertise a page aligned ATS here to make vhost device
IOTLB work with Intel IOMMU again.
Note that in the future we may extend pcie_ats_init() to accept
parameters like queue depth and page alignment.
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20200909081731.24688-1-jasowang@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/pci/pcie.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 5b48bae0f6..d4010cf8f3 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -971,8 +971,9 @@ void pcie_ats_init(PCIDevice *dev, uint16_t offset)
dev->exp.ats_cap = offset;
- /* Invalidate Queue Depth 0, Page Aligned Request 0 */
- pci_set_word(dev->config + offset + PCI_ATS_CAP, 0);
+ /* Invalidate Queue Depth 0, Page Aligned Request 1 */
+ pci_set_word(dev->config + offset + PCI_ATS_CAP,
+ PCI_ATS_CAP_PAGE_ALIGNED);
/* STU 0, Disabled by default */
pci_set_word(dev->config + offset + PCI_ATS_CTRL, 0);
--
MST
- [PULL 01/15] vhost-vdpa: negotiate VIRTIO_NET_F_STATUS with driver, (continued)
- [PULL 01/15] vhost-vdpa: negotiate VIRTIO_NET_F_STATUS with driver, Michael S. Tsirkin, 2020/10/30
- [PULL 02/15] vhost-vsock: set vhostfd to non-blocking mode, Michael S. Tsirkin, 2020/10/30
- [PULL 03/15] acpi/crs: Prevent bad ranges for host bridges, Michael S. Tsirkin, 2020/10/30
- [PULL 06/15] hw/pci: Extract pci_bus_change_irq_level() from pci_change_irq_level(), Michael S. Tsirkin, 2020/10/30
- [PULL 04/15] acpi/crs: Support ranges > 32b for hosts, Michael S. Tsirkin, 2020/10/30
- [PULL 08/15] vhost: Don't special case vq->used_phys in vhost_get_log_size(), Michael S. Tsirkin, 2020/10/30
- [PULL 09/15] pc: Implement -no-hpet as sugar for -machine hpet=on, Michael S. Tsirkin, 2020/10/30
- [PULL 13/15] vhost-blk: set features before setting inflight feature, Michael S. Tsirkin, 2020/10/30
- [PULL 07/15] pci: Assert irqnum is between 0 and bus->nirqs in pci_bus_change_irq_level, Michael S. Tsirkin, 2020/10/30
- [PULL 05/15] hw/virtio/vhost-vdpa: Fix Coverity CID 1432864, Michael S. Tsirkin, 2020/10/30
- [PULL 10/15] pci: advertise a page aligned ATS,
Michael S. Tsirkin <=
- [PULL 12/15] pci: Disallow improper BAR registration for type 1, Michael S. Tsirkin, 2020/10/30
- [PULL 14/15] virtio: skip guest index check on device load, Michael S. Tsirkin, 2020/10/30
- [PULL 11/15] pci: Change error_report to assert(3), Michael S. Tsirkin, 2020/10/30
- [PULL 15/15] intel_iommu: Fix two misuse of "0x%u" prints, Michael S. Tsirkin, 2020/10/30
- Re: [PULL 00/15] pc,pci,vhost,virtio: misc fixes, no-reply, 2020/10/30