diff options
| author | CLEMENT MATHIEU--DRIF <clement.mathieu--drif@eviden.com> | 2025-05-20 07:18:52 +0000 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2025-06-01 06:38:53 -0400 |
| commit | 6a3ae6a2440dead9dd8e3f84152dc53a5214c48d (patch) | |
| tree | 208d3ac054d92825b50e70cdfd778f0c446720c7 /hw/pci/pcie.c | |
| parent | 1e82e8a828cf18a8abfeca7295322db91879de04 (diff) | |
| download | focaccia-qemu-6a3ae6a2440dead9dd8e3f84152dc53a5214c48d.tar.gz focaccia-qemu-6a3ae6a2440dead9dd8e3f84152dc53a5214c48d.zip | |
pcie: Helper function to check if ATS is enabled
ats_enabled checks whether the capability is present or not. If so, we read the configuration space to get the status of the feature (enabled or not). Signed-off-by: Clement Mathieu--Drif <clement.mathieu--drif@eviden.com> Message-Id: <20250520071823.764266-4-clement.mathieu--drif@eviden.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci/pcie.c')
| -rw-r--r-- | hw/pci/pcie.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index db9756d861..36de709801 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -1248,3 +1248,12 @@ bool pcie_pasid_enabled(const PCIDevice *dev) return (pci_get_word(dev->config + dev->exp.pasid_cap + PCI_PASID_CTRL) & PCI_PASID_CTRL_ENABLE) != 0; } + +bool pcie_ats_enabled(const PCIDevice *dev) +{ + if (!pci_is_express(dev) || !dev->exp.ats_cap) { + return false; + } + return (pci_get_word(dev->config + dev->exp.ats_cap + PCI_ATS_CTRL) & + PCI_ATS_CTRL_ENABLE) != 0; +} |