Thread (77 messages) 77 messages, 4 authors, 2025-01-23

Re: [PATCH v5 14/14] iommu/arm-smmu-v3: Report events that belong to devices attached to vIOMMU

From: Nicolin Chen <hidden>
Date: 2025-01-13 19:15:46
Also in: linux-doc, linux-iommu, linux-kselftest, linux-patches, lkml, oe-kbuild-all

On Mon, Jan 13, 2025 at 03:06:41PM -0400, Jason Gunthorpe wrote:
On Mon, Jan 13, 2025 at 11:01:10AM -0800, Nicolin Chen wrote:
quoted
+/* This is basically iommu_vevent_arm_smmuv3 in u64 for conversion */
+struct arm_vsmmu_evt {
+	union {
+		u64 evt[EVTQ_ENT_DWORDS];
+		struct iommu_vevent_arm_smmuv3 uevt;
+	};
+};
This doesn't seem right, don't make unions like this
This is copied from the invalidate union though... Any reason why
this is no longer good for evt v.s. cmd?
quoted
 int arm_vmaster_report_event(struct arm_smmu_vmaster *vmaster, u64 *evt)
 {
-	struct iommu_vevent_arm_smmuv3 vevt =
-		*(struct iommu_vevent_arm_smmuv3 *)evt;
evt is clearly not a iommu_vevent_arm_smmuv3 since it has the wrong
endianess? It should stay in its own type.

struct struct iommu_vevent_arm_smmuv3 uevt;

uet.evt[0] = cpu_to_le64((evt[0] & ~EVTQ_0_SID) | FIELD_PREP(EVTQ_0_SID, vmaster->vsid));
for (i = 1; i != EVTQ_ENT_DWORDS; i++)
    uet.evt[i] = cpu_to_le64(evt[i]);
I will use this.

Thanks!
Nicolin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help