diff options
| author | Jason Wang | 2016-12-30 11:09:15 +0100 |
|---|---|---|
| committer | Michael S. Tsirkin | 2017-01-10 04:56:59 +0100 |
| commit | 615c4ed20598ab3eda5e071ba7ba2a5bf70be59f (patch) | |
| tree | 28db0d008fd713671715aba171b882c41fd1f60d /hw/pci | |
| parent | intel_iommu: support device iotlb descriptor (diff) | |
| download | qemu-615c4ed20598ab3eda5e071ba7ba2a5bf70be59f.tar.gz qemu-615c4ed20598ab3eda5e071ba7ba2a5bf70be59f.tar.xz qemu-615c4ed20598ab3eda5e071ba7ba2a5bf70be59f.zip | |
virtio-pci: address space translation service (ATS) support
This patches enable the Address Translation Service support for virtio
pci devices. This is needed for a guest visible Device IOTLB
implementation and will be required by vhost device IOTLB API
implementation for intel IOMMU.
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci')
| -rw-r--r-- | hw/pci/pcie.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 99cfb4561b..adeda04036 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -717,3 +717,18 @@ void pcie_dev_ser_num_init(PCIDevice *dev, uint16_t offset, uint64_t ser_num) PCI_EXT_CAP_DSN_SIZEOF); pci_set_quad(dev->config + offset + pci_dsn_cap, ser_num); } + +void pcie_ats_init(PCIDevice *dev, uint16_t offset) +{ + pcie_add_capability(dev, PCI_EXT_CAP_ID_ATS, 0x1, + offset, PCI_EXT_CAP_ATS_SIZEOF); + + dev->exp.ats_cap = offset; + + /* Invalidate Queue Depth 0, Page Aligned Request 0 */ + pci_set_word(dev->config + offset + PCI_ATS_CAP, 0); + /* STU 0, Disabled by default */ + pci_set_word(dev->config + offset + PCI_ATS_CTRL, 0); + + pci_set_word(dev->wmask + dev->exp.ats_cap + PCI_ATS_CTRL, 0x800f); +} |
