linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/vt-d: Fix status code for Allocate/Free PASID command
@ 2021-02-27  7:39 Zenghui Yu
  2021-03-01  0:44 ` Lu Baolu
  2021-03-04 12:32 ` Joerg Roedel
  0 siblings, 2 replies; 3+ messages in thread
From: Zenghui Yu @ 2021-02-27  7:39 UTC (permalink / raw)
  To: iommu, linux-kernel
  Cc: dwmw2, baolu.lu, joro, will, jacob.jun.pan, eric.auger, yi.l.liu,
	kevin.tian, wanghaibin.wang, Zenghui Yu

As per Intel vt-d spec, Rev 3.0 (section 10.4.45 "Virtual Command Response
Register"), the status code of "No PASID available" error in response to
the Allocate PASID command is 2, not 1. The same for "Invalid PASID" error
in response to the Free PASID command.

We will otherwise see confusing kernel log under the command failure from
guest side. Fix it.

Fixes: 24f27d32ab6b ("iommu/vt-d: Enlightened PASID allocation")
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
---
 drivers/iommu/intel/pasid.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/intel/pasid.h b/drivers/iommu/intel/pasid.h
index 97dfcffbf495..444c0bec221a 100644
--- a/drivers/iommu/intel/pasid.h
+++ b/drivers/iommu/intel/pasid.h
@@ -30,8 +30,8 @@
 #define VCMD_VRSP_IP			0x1
 #define VCMD_VRSP_SC(e)			(((e) >> 1) & 0x3)
 #define VCMD_VRSP_SC_SUCCESS		0
-#define VCMD_VRSP_SC_NO_PASID_AVAIL	1
-#define VCMD_VRSP_SC_INVALID_PASID	1
+#define VCMD_VRSP_SC_NO_PASID_AVAIL	2
+#define VCMD_VRSP_SC_INVALID_PASID	2
 #define VCMD_VRSP_RESULT_PASID(e)	(((e) >> 8) & 0xfffff)
 #define VCMD_CMD_OPERAND(e)		((e) << 8)
 /*
-- 
2.19.1


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

* Re: [PATCH] iommu/vt-d: Fix status code for Allocate/Free PASID command
  2021-02-27  7:39 [PATCH] iommu/vt-d: Fix status code for Allocate/Free PASID command Zenghui Yu
@ 2021-03-01  0:44 ` Lu Baolu
  2021-03-04 12:32 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Lu Baolu @ 2021-03-01  0:44 UTC (permalink / raw)
  To: Zenghui Yu, iommu, linux-kernel
  Cc: baolu.lu, dwmw2, joro, will, jacob.jun.pan, eric.auger, yi.l.liu,
	kevin.tian, wanghaibin.wang

On 2/27/21 3:39 PM, Zenghui Yu wrote:
> As per Intel vt-d spec, Rev 3.0 (section 10.4.45 "Virtual Command Response
> Register"), the status code of "No PASID available" error in response to
> the Allocate PASID command is 2, not 1. The same for "Invalid PASID" error
> in response to the Free PASID command.
> 
> We will otherwise see confusing kernel log under the command failure from
> guest side. Fix it.
> 
> Fixes: 24f27d32ab6b ("iommu/vt-d: Enlightened PASID allocation")
> Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
> ---
>   drivers/iommu/intel/pasid.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/intel/pasid.h b/drivers/iommu/intel/pasid.h
> index 97dfcffbf495..444c0bec221a 100644
> --- a/drivers/iommu/intel/pasid.h
> +++ b/drivers/iommu/intel/pasid.h
> @@ -30,8 +30,8 @@
>   #define VCMD_VRSP_IP			0x1
>   #define VCMD_VRSP_SC(e)			(((e) >> 1) & 0x3)
>   #define VCMD_VRSP_SC_SUCCESS		0
> -#define VCMD_VRSP_SC_NO_PASID_AVAIL	1
> -#define VCMD_VRSP_SC_INVALID_PASID	1
> +#define VCMD_VRSP_SC_NO_PASID_AVAIL	2
> +#define VCMD_VRSP_SC_INVALID_PASID	2
>   #define VCMD_VRSP_RESULT_PASID(e)	(((e) >> 8) & 0xfffff)
>   #define VCMD_CMD_OPERAND(e)		((e) << 8)
>   /*
> 

Thanks a lot for catching this.

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

Best regards,
baolu

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

* Re: [PATCH] iommu/vt-d: Fix status code for Allocate/Free PASID command
  2021-02-27  7:39 [PATCH] iommu/vt-d: Fix status code for Allocate/Free PASID command Zenghui Yu
  2021-03-01  0:44 ` Lu Baolu
@ 2021-03-04 12:32 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2021-03-04 12:32 UTC (permalink / raw)
  To: Zenghui Yu
  Cc: iommu, linux-kernel, dwmw2, baolu.lu, will, jacob.jun.pan,
	eric.auger, yi.l.liu, kevin.tian, wanghaibin.wang

On Sat, Feb 27, 2021 at 03:39:09PM +0800, Zenghui Yu wrote:
> As per Intel vt-d spec, Rev 3.0 (section 10.4.45 "Virtual Command Response
> Register"), the status code of "No PASID available" error in response to
> the Allocate PASID command is 2, not 1. The same for "Invalid PASID" error
> in response to the Free PASID command.
> 
> We will otherwise see confusing kernel log under the command failure from
> guest side. Fix it.
> 
> Fixes: 24f27d32ab6b ("iommu/vt-d: Enlightened PASID allocation")
> Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>

Applied for v5.12, thanks.

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

end of thread, other threads:[~2021-03-04 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-27  7:39 [PATCH] iommu/vt-d: Fix status code for Allocate/Free PASID command Zenghui Yu
2021-03-01  0:44 ` Lu Baolu
2021-03-04 12:32 ` 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).