Skip to contentSkip to conversation

iommu/vt-d: Set No Execute Enable bit in PASID table entry

PATCH In review Lu Baolu 2 participants 4 messages Jan 26, 2023 – Jan 31, 2023

Subsystems (2)
lore
Share & tools
lore

Lu Baolu

author maintainer
#0 lore raw

PATCH 1/1 iommu/vt-d: Set No Execute Enable bit in PASID table entry

Setup No Execute Enable bit (Bit 133) of a scalable mode PASID entry. It is required when XD bit of the first level page table entry is about to be set.

Fixes ddf09b6d43ec ("iommu/vt-d: Setup pasid entries for iova over first level")
---
 drivers/iommu/intel/pasid.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/iommu/intel/pasid.c +11 -0
index fb3c7020028d..ec964ac7d797 100644
@@ -364,6 +364,16 @@ static inline void pasid_set_page_snoop(struct pasid_entry *pe, bool value)
 	pasid_set_bits(&pe->val[1], 1 << 23, value << 23);
 }
 
+/*
+ * Setup No Execute Enable bit (Bit 133) of a scalable mode PASID
+ * entry. It is required when XD bit of the first level page table
+ * entry is about to be set.
+ */
+static inline void pasid_set_nxe(struct pasid_entry *pe)
+{
+	pasid_set_bits(&pe->val[2], 1 << 5, 1 << 5);
+}
+
 /*
  * Setup the Page Snoop (PGSNP) field (Bit 88) of a scalable mode
  * PASID entry.
@@ -557,6 +567,7 @@ int intel_pasid_setup_first_level(struct intel_iommu *iommu,
 	pasid_set_domain_id(pte, did);
 	pasid_set_address_width(pte, iommu->agaw);
 	pasid_set_page_snoop(pte, !!ecap_smpwc(iommu->ecap));
+	pasid_set_nxe(pte);
 
 	/* Setup Present and PASID Granular Transfer Type: */
 	pasid_set_translation_type(pte, PASID_ENTRY_PGTT_FL_ONLY);
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines

From: Lu Baolu <[email protected]>
Sent: Thursday, January 26, 2023 5:55 PM

Setup No Execute Enable bit (Bit 133) of a scalable mode PASID entry. It is required when XD bit of the first level page table entry is about to be set.

"is about to set" sounds like the NXE bit is set conditionally when certain event happens. But the actual definition of NXE bit is to allow the use of XD bit of the first level page table.

With the comment fixed:

author maintainer
#2 lore raw
Quoted 6 lines · Kevin
Quoted 6 lines

From: Lu Baolu<[email protected]>
Sent: Thursday, January 26, 2023 5:55 PM

Setup No Execute Enable bit (Bit 133) of a scalable mode PASID entry. It is required when XD bit of the first level page table entry is about to be set.

Quoted 7 lines

"is about to set" sounds like the NXE bit is set conditionally when certain event happens. But the actual definition of NXE bit is to allow the use of XD bit of the first level page table.

With the comment fixed:

Updated. Thank you, Kevin.

Best regards,
baolu

author maintainer
#3 lore raw
In reply to Lu Baolu
Quoted 7 lines · Lu Baolu

Setup No Execute Enable bit (Bit 133) of a scalable mode PASID entry. It is required when XD bit of the first level page table entry is about to be set.

Fixes ddf09b6d43ec ("iommu/vt-d: Setup pasid entries for iova over first level")

Patch queued for v6.3.

https://lore.kernel.org/linux-iommu/[email protected]/

Best regards,
baolu