Re: [PATCH 01/11] RISC-V: drivers/iommu: Add RISC-V IOMMU - Ziommu support.

From: Baolu Lu
Date: Thu Jul 20 2023 - 06:38:51 EST


On 2023/7/20 3:33, Tomasz Jeznach wrote:
+struct riscv_iommu_domain {
+ struct iommu_domain domain;
+
+ struct list_head endpoints;
+ struct mutex lock;
+ struct riscv_iommu_device *iommu;

How are domains and iommu devices connected? A domain can be attached to
multiple devices, which are possibly behind different iommu devices. So
a domain is possibly connected to multiple iommu devices.

Is it possible?

+
+ unsigned mode; /* RIO_ATP_MODE_* enum */
+ unsigned pscid; /* RISC-V IOMMU PSCID */
+
+ pgd_t *pgd_root; /* page table root pointer */
+};
+
+/* Private dev_iommu_priv object, device-domain relationship. */
+struct riscv_iommu_endpoint {
+ struct device *dev; /* platform or PCI endpoint device */
+ unsigned devid; /* PCI bus:device:function number */
+ unsigned domid; /* PCI domain number, segment */
+ struct rb_node node; /* device tracking node (lookup by devid) */
+ struct riscv_iommu_device *iommu; /* parent iommu device */
+
+ struct mutex lock;
+ struct list_head domain; /* endpoint attached managed domain */
+};

Best regards,
baolu