Thread (28 messages) 28 messages, 4 authors, 2025-02-19

Re: [PATCH v1 01/13] genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie

From: Jacob Pan <hidden>
Date: 2025-02-13 20:28:52
Also in: linux-iommu, linux-kselftest, linux-patches, lkml

Hi Nicolin,

On Sat, 8 Feb 2025 01:02:34 -0800
Nicolin Chen [off-list ref] wrote:
-static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
-					     const void
*iommu_cookie) +/**
+ * iommu_dma_compose_msi_msg() - Apply translation to an MSI message
+ * @desc: MSI descriptor prepared by iommu_dma_prepare_msi()
+ * @msg: MSI message containing target physical address
+ */
Is it IOVA not PA?
+static inline void iommu_dma_compose_msi_msg(struct msi_desc *desc,
+					     struct msi_msg *msg)
 {
-}
+#ifdef CONFIG_IRQ_MSI_IOMMU
+	if (desc->iommu_msi_page_shift) {
+		u64 msi_iova = desc->iommu_msi_iova
+			       << desc->iommu_msi_page_shift;
+
+		msg->address_hi = upper_32_bits(msi_iova);
+		msg->address_lo = lower_32_bits(msi_iova) |
+				  (msg->address_lo &
+				   ((1 <<
desc->iommu_msi_page_shift) - 1));
+	}
 #endif
+}
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help