linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Misc vSVA fixes for VT-d
@ 2021-03-02 10:13 Jacob Pan
  2021-03-02 10:13 ` [PATCH v2 1/4] iommu/vt-d: Enable write protect for supervisor SVM Jacob Pan
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Jacob Pan @ 2021-03-02 10:13 UTC (permalink / raw)
  To: LKML, iommu, Joerg Roedel, Lu Baolu, David Woodhouse
  Cc: Yi Liu, Raj Ashok, Tian, Kevin, Eric Auger,
	Jean-Philippe Brucker, Jacob Pan

Hi Baolu et al,

This is a collection of SVA-related fixes.

ChangeLog:

v2:
	- For guest SVA, call pasid_set_wpe directly w/o checking host CR0.wp
	  (Review comments by Kevin T.)
	- Added fixes tag

Thanks,

Jacob

Jacob Pan (4):
  iommu/vt-d: Enable write protect for supervisor SVM
  iommu/vt-d: Enable write protect propagation from guest
  iommu/vt-d: Reject unsupported page request modes
  iommu/vt-d: Calculate and set flags for handle_mm_fault

 drivers/iommu/intel/pasid.c | 29 +++++++++++++++++++++++++++++
 drivers/iommu/intel/svm.c   | 21 +++++++++++++++++----
 include/uapi/linux/iommu.h  |  3 ++-
 3 files changed, 48 insertions(+), 5 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/4] iommu/vt-d: Enable write protect for supervisor SVM
  2021-03-02 10:13 [PATCH v2 0/4] Misc vSVA fixes for VT-d Jacob Pan
@ 2021-03-02 10:13 ` Jacob Pan
  2021-03-03  4:56   ` Lu Baolu
  2021-03-22 17:53   ` Guenter Roeck
  2021-03-02 10:13 ` [PATCH v2 2/4] iommu/vt-d: Enable write protect propagation from guest Jacob Pan
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 11+ messages in thread
From: Jacob Pan @ 2021-03-02 10:13 UTC (permalink / raw)
  To: LKML, iommu, Joerg Roedel, Lu Baolu, David Woodhouse
  Cc: Yi Liu, Raj Ashok, Tian, Kevin, Eric Auger,
	Jean-Philippe Brucker, Jacob Pan, Sanjay Kumar

Write protect bit, when set, inhibits supervisor writes to the read-only
pages. In supervisor shared virtual addressing (SVA), where page tables
are shared between CPU and DMA, IOMMU PASID entry WPE bit should match
CR0.WP bit in the CPU.
This patch sets WPE bit for supervisor PASIDs if CR0.WP is set.

Signed-off-by: Sanjay Kumar <sanjay.k.kumar@intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
---
 drivers/iommu/intel/pasid.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
index 0cceaabc3ce6..0b7e0e726ade 100644
--- a/drivers/iommu/intel/pasid.c
+++ b/drivers/iommu/intel/pasid.c
@@ -410,6 +410,15 @@ static inline void pasid_set_sre(struct pasid_entry *pe)
 	pasid_set_bits(&pe->val[2], 1 << 0, 1);
 }
 
+/*
+ * Setup the WPE(Write Protect Enable) field (Bit 132) of a
+ * scalable mode PASID entry.
+ */
+static inline void pasid_set_wpe(struct pasid_entry *pe)
+{
+	pasid_set_bits(&pe->val[2], 1 << 4, 1 << 4);
+}
+
 /*
  * Setup the P(Present) field (Bit 0) of a scalable mode PASID
  * entry.
@@ -553,6 +562,20 @@ static void pasid_flush_caches(struct intel_iommu *iommu,
 	}
 }
 
+static inline int pasid_enable_wpe(struct pasid_entry *pte)
+{
+	unsigned long cr0 = read_cr0();
+
+	/* CR0.WP is normally set but just to be sure */
+	if (unlikely(!(cr0 & X86_CR0_WP))) {
+		pr_err_ratelimited("No CPU write protect!\n");
+		return -EINVAL;
+	}
+	pasid_set_wpe(pte);
+
+	return 0;
+};
+
 /*
  * Set up the scalable mode pasid table entry for first only
  * translation type.
@@ -584,6 +607,9 @@ int intel_pasid_setup_first_level(struct intel_iommu *iommu,
 			return -EINVAL;
 		}
 		pasid_set_sre(pte);
+		if (pasid_enable_wpe(pte))
+			return -EINVAL;
+
 	}
 
 	if (flags & PASID_FLAG_FL5LP) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/4] iommu/vt-d: Enable write protect propagation from guest
  2021-03-02 10:13 [PATCH v2 0/4] Misc vSVA fixes for VT-d Jacob Pan
  2021-03-02 10:13 ` [PATCH v2 1/4] iommu/vt-d: Enable write protect for supervisor SVM Jacob Pan
@ 2021-03-02 10:13 ` Jacob Pan
  2021-03-03  4:57   ` Lu Baolu
  2021-03-02 10:13 ` [PATCH v2 3/4] iommu/vt-d: Reject unsupported page request modes Jacob Pan
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Jacob Pan @ 2021-03-02 10:13 UTC (permalink / raw)
  To: LKML, iommu, Joerg Roedel, Lu Baolu, David Woodhouse
  Cc: Yi Liu, Raj Ashok, Tian, Kevin, Eric Auger,
	Jean-Philippe Brucker, Jacob Pan, Sanjay Kumar

Write protect bit, when set, inhibits supervisor writes to the read-only
pages. In guest supervisor shared virtual addressing (SVA), write-protect
should be honored upon guest bind supervisor PASID request.

This patch extends the VT-d portion of the IOMMU UAPI to include WP bit.
WPE bit of the  supervisor PASID entry will be set to match CPU CR0.WP bit.

Signed-off-by: Sanjay Kumar <sanjay.k.kumar@intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
---
 drivers/iommu/intel/pasid.c | 3 +++
 include/uapi/linux/iommu.h  | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
index 0b7e0e726ade..b7e39239f539 100644
--- a/drivers/iommu/intel/pasid.c
+++ b/drivers/iommu/intel/pasid.c
@@ -763,6 +763,9 @@ intel_pasid_setup_bind_data(struct intel_iommu *iommu, struct pasid_entry *pte,
 			return -EINVAL;
 		}
 		pasid_set_sre(pte);
+		/* Enable write protect WP if guest requested */
+		if (pasid_data->flags & IOMMU_SVA_VTD_GPASID_WPE)
+			pasid_set_wpe(pte);
 	}
 
 	if (pasid_data->flags & IOMMU_SVA_VTD_GPASID_EAFE) {
diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h
index 35d48843acd8..3a9164cc9937 100644
--- a/include/uapi/linux/iommu.h
+++ b/include/uapi/linux/iommu.h
@@ -288,7 +288,8 @@ struct iommu_gpasid_bind_data_vtd {
 #define IOMMU_SVA_VTD_GPASID_PWT	(1 << 3) /* page-level write through */
 #define IOMMU_SVA_VTD_GPASID_EMTE	(1 << 4) /* extended mem type enable */
 #define IOMMU_SVA_VTD_GPASID_CD		(1 << 5) /* PASID-level cache disable */
-#define IOMMU_SVA_VTD_GPASID_LAST	(1 << 6)
+#define IOMMU_SVA_VTD_GPASID_WPE	(1 << 6) /* Write protect enable */
+#define IOMMU_SVA_VTD_GPASID_LAST	(1 << 7)
 	__u64 flags;
 	__u32 pat;
 	__u32 emt;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/4] iommu/vt-d: Reject unsupported page request modes
  2021-03-02 10:13 [PATCH v2 0/4] Misc vSVA fixes for VT-d Jacob Pan
  2021-03-02 10:13 ` [PATCH v2 1/4] iommu/vt-d: Enable write protect for supervisor SVM Jacob Pan
  2021-03-02 10:13 ` [PATCH v2 2/4] iommu/vt-d: Enable write protect propagation from guest Jacob Pan
@ 2021-03-02 10:13 ` Jacob Pan
  2021-03-02 10:14 ` [PATCH v2 4/4] iommu/vt-d: Calculate and set flags for handle_mm_fault Jacob Pan
  2021-03-18 10:43 ` [PATCH v2 0/4] Misc vSVA fixes for VT-d Joerg Roedel
  4 siblings, 0 replies; 11+ messages in thread
From: Jacob Pan @ 2021-03-02 10:13 UTC (permalink / raw)
  To: LKML, iommu, Joerg Roedel, Lu Baolu, David Woodhouse
  Cc: Yi Liu, Raj Ashok, Tian, Kevin, Eric Auger,
	Jean-Philippe Brucker, Jacob Pan

When supervisor/privilige mode SVM is used, we bind init_mm.pgd with
a supervisor PASID. There should not be any page fault for init_mm.
Execution request with DMA read is also not supported.

This patch checks PRQ descriptor for both unsupported configurations,
reject them both with invalid responses.

Fixes: 1c4f88b7f1f92 ("iommu/vt-d: Shared virtual address in scalable
mode")
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
---
 drivers/iommu/intel/svm.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
index 23a1e4f58c54..ff7ae7cc17d5 100644
--- a/drivers/iommu/intel/svm.c
+++ b/drivers/iommu/intel/svm.c
@@ -1113,7 +1113,17 @@ static irqreturn_t prq_event_thread(int irq, void *d)
 			       ((unsigned long long *)req)[1]);
 			goto no_pasid;
 		}
-
+		/* We shall not receive page request for supervisor SVM */
+		if (req->pm_req && (req->rd_req | req->wr_req)) {
+			pr_err("Unexpected page request in Privilege Mode");
+			/* No need to find the matching sdev as for bad_req */
+			goto no_pasid;
+		}
+		/* DMA read with exec requeset is not supported. */
+		if (req->exe_req && req->rd_req) {
+			pr_err("Execution request not supported\n");
+			goto no_pasid;
+		}
 		if (!svm || svm->pasid != req->pasid) {
 			rcu_read_lock();
 			svm = ioasid_find(NULL, req->pasid, NULL);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 4/4] iommu/vt-d: Calculate and set flags for handle_mm_fault
  2021-03-02 10:13 [PATCH v2 0/4] Misc vSVA fixes for VT-d Jacob Pan
                   ` (2 preceding siblings ...)
  2021-03-02 10:13 ` [PATCH v2 3/4] iommu/vt-d: Reject unsupported page request modes Jacob Pan
@ 2021-03-02 10:14 ` Jacob Pan
  2021-03-18 10:43 ` [PATCH v2 0/4] Misc vSVA fixes for VT-d Joerg Roedel
  4 siblings, 0 replies; 11+ messages in thread
From: Jacob Pan @ 2021-03-02 10:14 UTC (permalink / raw)
  To: LKML, iommu, Joerg Roedel, Lu Baolu, David Woodhouse
  Cc: Yi Liu, Raj Ashok, Tian, Kevin, Eric Auger,
	Jean-Philippe Brucker, Jacob Pan

Page requests are originated from the user page fault. Therefore, we
shall set FAULT_FLAG_USER. 

FAULT_FLAG_REMOTE indicates that we are walking an mm which is not
guaranteed to be the same as the current->mm and should not be subject
to protection key enforcement. Therefore, we should set FAULT_FLAG_REMOTE
to avoid faults when both SVM and PKEY are used.

References: commit 1b2ee1266ea6 ("mm/core: Do not enforce PKEY permissions on remote mm access")
Reviewed-by: Raj Ashok <ashok.raj@intel.com>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
---
 drivers/iommu/intel/svm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
index ff7ae7cc17d5..7bfd20a24a60 100644
--- a/drivers/iommu/intel/svm.c
+++ b/drivers/iommu/intel/svm.c
@@ -1086,6 +1086,7 @@ static irqreturn_t prq_event_thread(int irq, void *d)
 	struct intel_iommu *iommu = d;
 	struct intel_svm *svm = NULL;
 	int head, tail, handled = 0;
+	unsigned int flags = 0;
 
 	/* Clear PPR bit before reading head/tail registers, to
 	 * ensure that we get a new interrupt if needed. */
@@ -1186,9 +1187,11 @@ static irqreturn_t prq_event_thread(int irq, void *d)
 		if (access_error(vma, req))
 			goto invalid;
 
-		ret = handle_mm_fault(vma, address,
-				      req->wr_req ? FAULT_FLAG_WRITE : 0,
-				      NULL);
+		flags = FAULT_FLAG_USER | FAULT_FLAG_REMOTE;
+		if (req->wr_req)
+			flags |= FAULT_FLAG_WRITE;
+
+		ret = handle_mm_fault(vma, address, flags, NULL);
 		if (ret & VM_FAULT_ERROR)
 			goto invalid;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/4] iommu/vt-d: Enable write protect for supervisor SVM
  2021-03-02 10:13 ` [PATCH v2 1/4] iommu/vt-d: Enable write protect for supervisor SVM Jacob Pan
@ 2021-03-03  4:56   ` Lu Baolu
  2021-03-22 17:53   ` Guenter Roeck
  1 sibling, 0 replies; 11+ messages in thread
From: Lu Baolu @ 2021-03-03  4:56 UTC (permalink / raw)
  To: Jacob Pan, LKML, iommu, Joerg Roedel, David Woodhouse
  Cc: baolu.lu, Yi Liu, Raj Ashok, Tian, Kevin, Eric Auger,
	Jean-Philippe Brucker, Sanjay Kumar

On 3/2/21 6:13 PM, Jacob Pan wrote:
> Write protect bit, when set, inhibits supervisor writes to the read-only
> pages. In supervisor shared virtual addressing (SVA), where page tables
> are shared between CPU and DMA, IOMMU PASID entry WPE bit should match
> CR0.WP bit in the CPU.
> This patch sets WPE bit for supervisor PASIDs if CR0.WP is set.
> 
> Signed-off-by: Sanjay Kumar <sanjay.k.kumar@intel.com>
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> ---
>   drivers/iommu/intel/pasid.c | 26 ++++++++++++++++++++++++++
>   1 file changed, 26 insertions(+)
> 
> diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
> index 0cceaabc3ce6..0b7e0e726ade 100644
> --- a/drivers/iommu/intel/pasid.c
> +++ b/drivers/iommu/intel/pasid.c
> @@ -410,6 +410,15 @@ static inline void pasid_set_sre(struct pasid_entry *pe)
>   	pasid_set_bits(&pe->val[2], 1 << 0, 1);
>   }
>   
> +/*
> + * Setup the WPE(Write Protect Enable) field (Bit 132) of a
> + * scalable mode PASID entry.
> + */
> +static inline void pasid_set_wpe(struct pasid_entry *pe)
> +{
> +	pasid_set_bits(&pe->val[2], 1 << 4, 1 << 4);
> +}
> +
>   /*
>    * Setup the P(Present) field (Bit 0) of a scalable mode PASID
>    * entry.
> @@ -553,6 +562,20 @@ static void pasid_flush_caches(struct intel_iommu *iommu,
>   	}
>   }
>   
> +static inline int pasid_enable_wpe(struct pasid_entry *pte)
> +{
> +	unsigned long cr0 = read_cr0();
> +
> +	/* CR0.WP is normally set but just to be sure */
> +	if (unlikely(!(cr0 & X86_CR0_WP))) {
> +		pr_err_ratelimited("No CPU write protect!\n");
> +		return -EINVAL;
> +	}
> +	pasid_set_wpe(pte);
> +
> +	return 0;
> +};
> +
>   /*
>    * Set up the scalable mode pasid table entry for first only
>    * translation type.
> @@ -584,6 +607,9 @@ int intel_pasid_setup_first_level(struct intel_iommu *iommu,
>   			return -EINVAL;
>   		}
>   		pasid_set_sre(pte);
> +		if (pasid_enable_wpe(pte))
> +			return -EINVAL;
> +
>   	}
>   
>   	if (flags & PASID_FLAG_FL5LP) {
> 

Acked-by: Lu Baolu <baolu.lu@linux.intel.com>

Best regards,
baolu

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/4] iommu/vt-d: Enable write protect propagation from guest
  2021-03-02 10:13 ` [PATCH v2 2/4] iommu/vt-d: Enable write protect propagation from guest Jacob Pan
@ 2021-03-03  4:57   ` Lu Baolu
  0 siblings, 0 replies; 11+ messages in thread
From: Lu Baolu @ 2021-03-03  4:57 UTC (permalink / raw)
  To: Jacob Pan, LKML, iommu, Joerg Roedel, David Woodhouse
  Cc: baolu.lu, Yi Liu, Raj Ashok, Tian, Kevin, Eric Auger,
	Jean-Philippe Brucker, Sanjay Kumar

On 3/2/21 6:13 PM, Jacob Pan wrote:
> Write protect bit, when set, inhibits supervisor writes to the read-only
> pages. In guest supervisor shared virtual addressing (SVA), write-protect
> should be honored upon guest bind supervisor PASID request.
> 
> This patch extends the VT-d portion of the IOMMU UAPI to include WP bit.
> WPE bit of the  supervisor PASID entry will be set to match CPU CR0.WP bit.
> 
> Signed-off-by: Sanjay Kumar <sanjay.k.kumar@intel.com>
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> ---
>   drivers/iommu/intel/pasid.c | 3 +++
>   include/uapi/linux/iommu.h  | 3 ++-
>   2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
> index 0b7e0e726ade..b7e39239f539 100644
> --- a/drivers/iommu/intel/pasid.c
> +++ b/drivers/iommu/intel/pasid.c
> @@ -763,6 +763,9 @@ intel_pasid_setup_bind_data(struct intel_iommu *iommu, struct pasid_entry *pte,
>   			return -EINVAL;
>   		}
>   		pasid_set_sre(pte);
> +		/* Enable write protect WP if guest requested */
> +		if (pasid_data->flags & IOMMU_SVA_VTD_GPASID_WPE)
> +			pasid_set_wpe(pte);
>   	}
>   
>   	if (pasid_data->flags & IOMMU_SVA_VTD_GPASID_EAFE) {
> diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h
> index 35d48843acd8..3a9164cc9937 100644
> --- a/include/uapi/linux/iommu.h
> +++ b/include/uapi/linux/iommu.h
> @@ -288,7 +288,8 @@ struct iommu_gpasid_bind_data_vtd {
>   #define IOMMU_SVA_VTD_GPASID_PWT	(1 << 3) /* page-level write through */
>   #define IOMMU_SVA_VTD_GPASID_EMTE	(1 << 4) /* extended mem type enable */
>   #define IOMMU_SVA_VTD_GPASID_CD		(1 << 5) /* PASID-level cache disable */
> -#define IOMMU_SVA_VTD_GPASID_LAST	(1 << 6)
> +#define IOMMU_SVA_VTD_GPASID_WPE	(1 << 6) /* Write protect enable */
> +#define IOMMU_SVA_VTD_GPASID_LAST	(1 << 7)
>   	__u64 flags;
>   	__u32 pat;
>   	__u32 emt;
> 

Acked-by: Lu Baolu <baolu.lu@linux.intel.com>

Best regards,
baolu

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/4] Misc vSVA fixes for VT-d
  2021-03-02 10:13 [PATCH v2 0/4] Misc vSVA fixes for VT-d Jacob Pan
                   ` (3 preceding siblings ...)
  2021-03-02 10:14 ` [PATCH v2 4/4] iommu/vt-d: Calculate and set flags for handle_mm_fault Jacob Pan
@ 2021-03-18 10:43 ` Joerg Roedel
  4 siblings, 0 replies; 11+ messages in thread
From: Joerg Roedel @ 2021-03-18 10:43 UTC (permalink / raw)
  To: Jacob Pan
  Cc: LKML, iommu, Lu Baolu, David Woodhouse, Yi Liu, Raj Ashok, Tian,
	Kevin, Eric Auger, Jean-Philippe Brucker

On Tue, Mar 02, 2021 at 02:13:56AM -0800, Jacob Pan wrote:
> Hi Baolu et al,
> 
> This is a collection of SVA-related fixes.
> 
> ChangeLog:
> 
> v2:
> 	- For guest SVA, call pasid_set_wpe directly w/o checking host CR0.wp
> 	  (Review comments by Kevin T.)
> 	- Added fixes tag
> 
> Thanks,
> 
> Jacob
> 
> Jacob Pan (4):
>   iommu/vt-d: Enable write protect for supervisor SVM
>   iommu/vt-d: Enable write protect propagation from guest
>   iommu/vt-d: Reject unsupported page request modes
>   iommu/vt-d: Calculate and set flags for handle_mm_fault
> 
>  drivers/iommu/intel/pasid.c | 29 +++++++++++++++++++++++++++++
>  drivers/iommu/intel/svm.c   | 21 +++++++++++++++++----
>  include/uapi/linux/iommu.h  |  3 ++-
>  3 files changed, 48 insertions(+), 5 deletions(-)

Applied, thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/4] iommu/vt-d: Enable write protect for supervisor SVM
  2021-03-02 10:13 ` [PATCH v2 1/4] iommu/vt-d: Enable write protect for supervisor SVM Jacob Pan
  2021-03-03  4:56   ` Lu Baolu
@ 2021-03-22 17:53   ` Guenter Roeck
  2021-03-30 17:52     ` Jacob Pan
  1 sibling, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2021-03-22 17:53 UTC (permalink / raw)
  To: Jacob Pan
  Cc: LKML, iommu, Joerg Roedel, Lu Baolu, David Woodhouse, Tian,
	Kevin, Raj Ashok, Sanjay Kumar, Jean-Philippe Brucker

On Tue, Mar 02, 2021 at 02:13:57AM -0800, Jacob Pan wrote:
> Write protect bit, when set, inhibits supervisor writes to the read-only
> pages. In supervisor shared virtual addressing (SVA), where page tables
> are shared between CPU and DMA, IOMMU PASID entry WPE bit should match
> CR0.WP bit in the CPU.
> This patch sets WPE bit for supervisor PASIDs if CR0.WP is set.
> 
> Signed-off-by: Sanjay Kumar <sanjay.k.kumar@intel.com>
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> ---

ia64:defconfig:

drivers/iommu/intel/pasid.c: In function 'pasid_enable_wpe':
drivers/iommu/intel/pasid.c:536:22: error: implicit declaration of function 'read_cr0'
drivers/iommu/intel/pasid.c:539:23: error: 'X86_CR0_WP' undeclared

Maybe it _is_ time to retire ia64 ?

Guenter

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/4] iommu/vt-d: Enable write protect for supervisor SVM
  2021-03-22 17:53   ` Guenter Roeck
@ 2021-03-30 17:52     ` Jacob Pan
  2021-03-30 19:02       ` Guenter Roeck
  0 siblings, 1 reply; 11+ messages in thread
From: Jacob Pan @ 2021-03-30 17:52 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: LKML, iommu, Joerg Roedel, Lu Baolu, David Woodhouse, Tian,
	Kevin, Raj Ashok, Sanjay Kumar, Jean-Philippe Brucker,
	jacob.jun.pan, Luck, Tony

Hi Guenter,

On Mon, 22 Mar 2021 10:53:38 -0700, Guenter Roeck <linux@roeck-us.net>
wrote:

> On Tue, Mar 02, 2021 at 02:13:57AM -0800, Jacob Pan wrote:
> > Write protect bit, when set, inhibits supervisor writes to the read-only
> > pages. In supervisor shared virtual addressing (SVA), where page tables
> > are shared between CPU and DMA, IOMMU PASID entry WPE bit should match
> > CR0.WP bit in the CPU.
> > This patch sets WPE bit for supervisor PASIDs if CR0.WP is set.
> > 
> > Signed-off-by: Sanjay Kumar <sanjay.k.kumar@intel.com>
> > Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> > ---  
> 
> ia64:defconfig:
> 
> drivers/iommu/intel/pasid.c: In function 'pasid_enable_wpe':
> drivers/iommu/intel/pasid.c:536:22: error: implicit declaration of
> function 'read_cr0' drivers/iommu/intel/pasid.c:539:23: error:
> 'X86_CR0_WP' undeclared
> 
> Maybe it _is_ time to retire ia64 ?

Good catch, sorry for the late reply. I guess otherwise I will have to do
some #ifdef?

There are many basic x86 helpers are missing in ia64.

+Tony

Thanks,

Jacob


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/4] iommu/vt-d: Enable write protect for supervisor SVM
  2021-03-30 17:52     ` Jacob Pan
@ 2021-03-30 19:02       ` Guenter Roeck
  0 siblings, 0 replies; 11+ messages in thread
From: Guenter Roeck @ 2021-03-30 19:02 UTC (permalink / raw)
  To: Jacob Pan
  Cc: LKML, iommu, Joerg Roedel, Lu Baolu, David Woodhouse, Tian,
	Kevin, Raj Ashok, Sanjay Kumar, Jean-Philippe Brucker, Luck,
	Tony

On 3/30/21 10:52 AM, Jacob Pan wrote:
> Hi Guenter,
> 
> On Mon, 22 Mar 2021 10:53:38 -0700, Guenter Roeck <linux@roeck-us.net>
> wrote:
> 
>> On Tue, Mar 02, 2021 at 02:13:57AM -0800, Jacob Pan wrote:
>>> Write protect bit, when set, inhibits supervisor writes to the read-only
>>> pages. In supervisor shared virtual addressing (SVA), where page tables
>>> are shared between CPU and DMA, IOMMU PASID entry WPE bit should match
>>> CR0.WP bit in the CPU.
>>> This patch sets WPE bit for supervisor PASIDs if CR0.WP is set.
>>>
>>> Signed-off-by: Sanjay Kumar <sanjay.k.kumar@intel.com>
>>> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
>>> ---  
>>
>> ia64:defconfig:
>>
>> drivers/iommu/intel/pasid.c: In function 'pasid_enable_wpe':
>> drivers/iommu/intel/pasid.c:536:22: error: implicit declaration of
>> function 'read_cr0' drivers/iommu/intel/pasid.c:539:23: error:
>> 'X86_CR0_WP' undeclared
>>
>> Maybe it _is_ time to retire ia64 ?
> 
> Good catch, sorry for the late reply. I guess otherwise I will have to do
> some #ifdef?
> 

I really can't tell you how to resolve this.

> There are many basic x86 helpers are missing in ia64.
> 
I'd say that Intel needs to decide what to do with the ia64 architecture.

Guenter

> +Tony
> 
> Thanks,
> 
> Jacob
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-03-30 19:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 10:13 [PATCH v2 0/4] Misc vSVA fixes for VT-d Jacob Pan
2021-03-02 10:13 ` [PATCH v2 1/4] iommu/vt-d: Enable write protect for supervisor SVM Jacob Pan
2021-03-03  4:56   ` Lu Baolu
2021-03-22 17:53   ` Guenter Roeck
2021-03-30 17:52     ` Jacob Pan
2021-03-30 19:02       ` Guenter Roeck
2021-03-02 10:13 ` [PATCH v2 2/4] iommu/vt-d: Enable write protect propagation from guest Jacob Pan
2021-03-03  4:57   ` Lu Baolu
2021-03-02 10:13 ` [PATCH v2 3/4] iommu/vt-d: Reject unsupported page request modes Jacob Pan
2021-03-02 10:14 ` [PATCH v2 4/4] iommu/vt-d: Calculate and set flags for handle_mm_fault Jacob Pan
2021-03-18 10:43 ` [PATCH v2 0/4] Misc vSVA fixes for VT-d Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).