From: CLEMENT MATHIEU--DRIF Date: Sat, 28 Jun 2025 18:03:58 +0000 (+0000) Subject: pci: Add a memory attribute for pre-translated DMA operations X-Git-Tag: v10.1.0-rc0~19^2~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=06895f7948a32e833a8686d8394064ca2a4d66cc;p=thirdparty%2Fqemu.git pci: Add a memory attribute for pre-translated DMA operations The address_type bit will be set to PCI_AT_TRANSLATED by devices that use cached addresses obtained via ATS. Signed-off-by: Clement Mathieu--Drif Message-Id: <20250628180226.133285-2-clement.mathieu--drif@eviden.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h index 8db1d30464..52ee955249 100644 --- a/include/exec/memattrs.h +++ b/include/exec/memattrs.h @@ -54,6 +54,9 @@ typedef struct MemTxAttrs { */ unsigned int pid:8; + /* PCI - IOMMU operations, see PCIAddressType */ + unsigned int address_type:1; + /* * Bus masters which don't specify any attributes will get this * (via the MEMTXATTRS_UNSPECIFIED constant), so that we can diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index df3cc7b875..6b7d3ac8a3 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -134,6 +134,15 @@ struct PCIHostDeviceAddress { unsigned int function; }; +/* + * Represents the Address Type (AT) field in a PCI request, + * see MemTxAttrs.address_type + */ +typedef enum PCIAddressType { + PCI_AT_UNTRANSLATED = 0, /* Default when no attribute is set */ + PCI_AT_TRANSLATED = 1, +} PCIAddressType; + typedef void PCIConfigWriteFunc(PCIDevice *pci_dev, uint32_t address, uint32_t data, int len); typedef uint32_t PCIConfigReadFunc(PCIDevice *pci_dev,