[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 06/19] pcie: Helper functions to check if PASID is enabled
From: |
CLEMENT MATHIEU--DRIF |
Subject: |
[PATCH v1 06/19] pcie: Helper functions to check if PASID is enabled |
Date: |
Fri, 29 Nov 2024 07:43:53 +0000 |
From: Clément Mathieu--Drif <clement.mathieu--drif@eviden.com>
pasid_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: Clément Mathieu--Drif <clement.mathieu--drif@eviden.com>
---
hw/pci/pcie.c | 9 +++++++++
include/hw/pci/pcie.h | 2 ++
2 files changed, 11 insertions(+)
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 5b896496ae..b6e84acc93 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -1234,3 +1234,12 @@ void pcie_pasid_init(PCIDevice *dev, uint16_t offset,
uint8_t pasid_width,
dev->exp.pasid_cap = offset;
}
+
+bool pcie_pasid_enabled(const PCIDevice *dev)
+{
+ if (!pci_is_express(dev) || !dev->exp.pasid_cap) {
+ return false;
+ }
+ return (pci_get_word(dev->config + dev->exp.pasid_cap + PCI_PASID_CTRL) &
+ PCI_PASID_CTRL_ENABLE) != 0;
+}
diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h
index aa040c3e97..63604ccc6e 100644
--- a/include/hw/pci/pcie.h
+++ b/include/hw/pci/pcie.h
@@ -156,4 +156,6 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler
*hotplug_dev,
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);
#endif /* QEMU_PCIE_H */
--
2.47.0
- [PATCH v1 13/19] atc: Generic ATC that can be used by PCIe devices that support SVM, (continued)
- [PATCH v1 13/19] atc: Generic ATC that can be used by PCIe devices that support SVM, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 15/19] memory: Add an API for ATS support, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 16/19] pci: Add a pci-level API for ATS, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 11/19] memory: Store user data pointer in the IOMMU notifiers, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 18/19] intel_iommu: Return page walk level even when the translation fails, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 03/19] memory: Allow to store the PASID in IOMMUTLBEntry, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 01/19] memory: Add permissions in IOMMUAccessFlags, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 04/19] intel_iommu: Fill the PASID field when creating an IOMMUTLBEntry, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 09/19] pci: Add IOMMU operations to get memory regions with PASID, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 14/19] atc: Add unit tests, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 06/19] pcie: Helper functions to check if PASID is enabled,
CLEMENT MATHIEU--DRIF <=
- [PATCH v1 10/19] intel_iommu: Implement the get_memory_region_pasid iommu operation, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 17/19] intel_iommu: Set address mask when a translation fails and adjust W permission, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 12/19] pci: Add a pci-level initialization function for iommu notifiers, CLEMENT MATHIEU--DRIF, 2024/11/29
- [PATCH v1 19/19] intel_iommu: Add support for ATS, CLEMENT MATHIEU--DRIF, 2024/11/29