← Prev in month ← Prev in thread
Next in thread → Next in month →

[PATCH v2 4/9] virtio-iommu: Add PASID field to DETACH

From
Jean-Philippe Brucker <>
Date
2023-10-06T16:14:28+00:00
ID
Thread
[PATCH v2 4/9] virtio-iommu: Add PASID field to DETACH
Some page table extensions (Intel scalable mode and some AMD
implementations) require populating host-managed PASID tables with
ATTACH_TABLE and DETACH requests. To mirror the PASID parameter in the
ATTACH_TABLE request, add a PASID parameter to DETACH.

This could later be used if we generalize PASID support to the ATTACH
request, but there is not plan for that at the moment.

Signed-off-by: Jean-Philippe Brucker <>
---
 device-types/iommu/description.tex | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/device-types/iommu/description.tex b/device-types/iommu/description.tex
index 58edaad..c057cdf 100644
--- a/device-types/iommu/description.tex
+++ b/device-types/iommu/description.tex
@@ -486,27 +486,36 @@ \subsubsection{DETACH request}
   struct virtio_iommu_req_head head;
   le32 domain;
   le32 endpoint;
-  u8   reserved[8];
+  le32 flags;
+  le32 pasid;
   struct virtio_iommu_req_tail tail;
 };
+
+#define VIRTIO_IOMMU_DETACH_F_PASID   (1 << 0)
 \end{lstlisting}
 
-Detach an endpoint from a domain. When this request completes,
-the endpoint cannot access any mapping from that domain anymore.
-However the endpoint may then be in bypass mode and access the
-guest-physical address space.
+Detach an address space from an endpoint. When this request
+completes, the endpoint cannot access any mapping from the
+address space anymore. However the endpoint may then be in bypass
+mode and access the guest-physical address space.
 
 After all endpoints have been successfully detached from a domain, it
 ceases to exist and its ID can be reused by the driver for another domain.
 
+When flag VIRTIO_IOMMU_DETACH_F_PASID is set, field \field{pasid}
+contains the identifier of the address space to detach from the
+device. This is only supported with some table formats, attached
+with a VIRTIO_IOMMU_T_ATTACH_TABLE request. When flag
+VIRTIO_IOMMU_DETACH_F_PASID is not set, detach all address spaces
+from the device.
+
 \drivernormative{\paragraph}{DETACH request}{Device Types / IOMMU Device / Device operations / DETACH request}
 
-The driver SHOULD set \field{reserved} to zero.
+The driver SHOULD set field \field{pasid} and flag
+VIRTIO_IOMMU_DETACH_F_PASID to zero if PASID is not supported.
 
 \devicenormative{\paragraph}{DETACH request}{Device Types / IOMMU Device / Device operations / DETACH request}
 
-The device MUST ignore \field{reserved}.
-
 If the endpoint identified by \field{endpoint} doesn't exist, then the
 device MUST reject the request and set \field{status} to
 VIRTIO_IOMMU_S_NOENT.
@@ -516,8 +525,9 @@ \subsubsection{DETACH request}
 then the device MAY set the request \field{status} to
 VIRTIO_IOMMU_S_INVAL.
 
-The device MUST ensure that after being detached from a domain, the
-endpoint cannot access any mapping from that domain.
+The device MUST ensure that after being detached from an address
+space, the endpoint cannot access any mapping from that address
+space.
 
 \subsubsection{MAP request}\label{sec:Device Types / IOMMU Device / Device operations / MAP request}
 
-- 
2.42.0
← Prev in month ← Prev in thread
Next in thread → Next in month →