]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
pci: Add a memory attribute for pre-translated DMA operations
authorCLEMENT MATHIEU--DRIF <clement.mathieu--drif@eviden.com>
Sat, 28 Jun 2025 18:03:58 +0000 (18:03 +0000)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 15 Jul 2025 06:56:39 +0000 (02:56 -0400)
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 <clement.mathieu--drif@eviden.com>
Message-Id: <20250628180226.133285-2-clement.mathieu--drif@eviden.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
include/exec/memattrs.h
include/hw/pci/pci.h

index 8db1d3046479c21a32928086ea8804a66a5d5ffa..52ee9552491570e26db7f0e37d1e3e53b0381d6d 100644 (file)
@@ -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
index df3cc7b8750014454bd5ab4c3e9a3feca122eca3..6b7d3ac8a3611d00d1c1c949c260f3dd44d36cc4 100644 (file)
@@ -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,