[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 07/19] pcie: Helper function to check if ATS is enabled
From: |
CLEMENT MATHIEU--DRIF |
Subject: |
[PATCH v2 07/19] pcie: Helper function to check if ATS is enabled |
Date: |
Mon, 20 Jan 2025 17:41:45 +0000 |
From: Clement Mathieu--Drif <clement.mathieu--drif@eviden.com>
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>
---
hw/pci/pcie.c | 9 +++++++++
include/hw/pci/pcie.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 8186d64234..3b8fd6f33c 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -1247,3 +1247,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;
+}
diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h
index 63604ccc6e..7e7b8baa6e 100644
--- a/include/hw/pci/pcie.h
+++ b/include/hw/pci/pcie.h
@@ -158,4 +158,5 @@ void pcie_pasid_init(PCIDevice *dev, uint16_t offset,
uint8_t pasid_width,
bool exec_perm, bool priv_mod);
bool pcie_pasid_enabled(const PCIDevice *dev);
+bool pcie_ats_enabled(const PCIDevice *dev);
#endif /* QEMU_PCIE_H */
--
2.47.1
- [PATCH v2 00/19] intel_iommu: Add ATS support, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 01/19] memory: Add permissions in IOMMUAccessFlags, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 02/19] intel_iommu: Declare supported PASID size, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 04/19] intel_iommu: Fill the PASID field when creating an IOMMUTLBEntry, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 12/19] pci: Add a pci-level initialization function for iommu notifiers, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 07/19] pcie: Helper function to check if ATS is enabled,
CLEMENT MATHIEU--DRIF <=
- [PATCH v2 15/19] memory: Add an API for ATS support, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 06/19] pcie: Helper functions to check if PASID is enabled, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 05/19] pcie: Add helper to declare PASID capability for a pcie device, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 03/19] memory: Allow to store the PASID in IOMMUTLBEntry, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 08/19] pci: Cache the bus mastering status in the device, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 10/19] intel_iommu: Implement the get_memory_region_pasid iommu operation, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 09/19] pci: Add IOMMU operations to get memory regions with PASID, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 11/19] memory: Store user data pointer in the IOMMU notifiers, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 13/19] atc: Generic ATC that can be used by PCIe devices that support SVM, CLEMENT MATHIEU--DRIF, 2025/01/20
- [PATCH v2 14/19] atc: Add unit tests, CLEMENT MATHIEU--DRIF, 2025/01/20