public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] iommu/amd: Fix PASID format in INVALIDATE_IOTLB_PAGES command
@ 2014-02-26 21:49 suravee.suthikulpanit
  2014-03-04 14:12 ` Joerg Roedel
  0 siblings, 1 reply; 4+ messages in thread
From: suravee.suthikulpanit @ 2014-02-26 21:49 UTC (permalink / raw)
  To: iommu, joro; +Cc: linux-kernel, Jay Cornwall

From: Jay Cornwall <jay.cornwall@amd.com>

This patch corrects the PASID format in the INVALIDATE_IOTLB_PAGES
command, which was caused by incorrect information in
the AMD IOMMU Architectural Specification v2.01 document.

    Incorrect format:
         cmd->data[0][16:23] = PASID[7:0]
         cmd->data[1][16:27] = PASID[19:8]

     Correct format:
         cmd->data[0][16:23] = PASID[15:8]
         cmd->data[1][16:23] = PASID[7:0]

However, this does not affect the IOMMUv2 hardware implementation,
and has been corrected since version 2.02 of the specification
(available through AMD NDA).

Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd_iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index faf0da4..1dd9f81 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -982,10 +982,10 @@ static void build_inv_iotlb_pasid(struct iommu_cmd *cmd, u16 devid, int pasid,
 	address &= ~(0xfffULL);
 
 	cmd->data[0]  = devid;
-	cmd->data[0] |= (pasid & 0xff) << 16;
+	cmd->data[0] |= ((pasid >> 8) & 0xff) << 16;
 	cmd->data[0] |= (qdep  & 0xff) << 24;
 	cmd->data[1]  = devid;
-	cmd->data[1] |= ((pasid >> 8) & 0xfff) << 16;
+	cmd->data[1] |= (pasid & 0xff) << 16;
 	cmd->data[2]  = lower_32_bits(address);
 	cmd->data[2] |= CMD_INV_IOMMU_PAGES_GN_MASK;
 	cmd->data[3]  = upper_32_bits(address);
-- 
1.8.1.2



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

* Re: [PATCH 1/1] iommu/amd: Fix PASID format in INVALIDATE_IOTLB_PAGES command
  2014-02-26 21:49 [PATCH 1/1] iommu/amd: Fix PASID format in INVALIDATE_IOTLB_PAGES command suravee.suthikulpanit
@ 2014-03-04 14:12 ` Joerg Roedel
  2014-03-04 16:53   ` Suravee Suthikulpanit
  0 siblings, 1 reply; 4+ messages in thread
From: Joerg Roedel @ 2014-03-04 14:12 UTC (permalink / raw)
  To: suravee.suthikulpanit; +Cc: iommu, linux-kernel, Jay Cornwall

On Wed, Feb 26, 2014 at 03:49:31PM -0600, suravee.suthikulpanit@amd.com wrote:
> From: Jay Cornwall <jay.cornwall@amd.com>
> 
> This patch corrects the PASID format in the INVALIDATE_IOTLB_PAGES
> command, which was caused by incorrect information in
> the AMD IOMMU Architectural Specification v2.01 document.
> 
>     Incorrect format:
>          cmd->data[0][16:23] = PASID[7:0]
>          cmd->data[1][16:27] = PASID[19:8]
> 
>      Correct format:
>          cmd->data[0][16:23] = PASID[15:8]
>          cmd->data[1][16:23] = PASID[7:0]
> 
> However, this does not affect the IOMMUv2 hardware implementation,
> and has been corrected since version 2.02 of the specification
> (available through AMD NDA).
> 
> Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
> Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>

Applied, thanks.

Does this mean that PASIDs are only 16 bits wide now from the former 20
bits?



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

* Re: [PATCH 1/1] iommu/amd: Fix PASID format in INVALIDATE_IOTLB_PAGES command
  2014-03-04 14:12 ` Joerg Roedel
@ 2014-03-04 16:53   ` Suravee Suthikulpanit
  2014-03-04 17:06     ` Suravee Suthikulpanit
  0 siblings, 1 reply; 4+ messages in thread
From: Suravee Suthikulpanit @ 2014-03-04 16:53 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: iommu, Linux Kernel Mailing List, Jay Cornwall, Naru, Kim

On 3/4/2014 8:12 AM, Joerg Roedel wrote:
> On Wed, Feb 26, 2014 at 03:49:31PM -0600, suravee.suthikulpanit@amd.com wrote:
>> From: Jay Cornwall <jay.cornwall@amd.com>
>>
>> This patch corrects the PASID format in the INVALIDATE_IOTLB_PAGES
>> command, which was caused by incorrect information in
>> the AMD IOMMU Architectural Specification v2.01 document.
>>
>>      Incorrect format:
>>           cmd->data[0][16:23] = PASID[7:0]
>>           cmd->data[1][16:27] = PASID[19:8]
>>
>>       Correct format:
>>           cmd->data[0][16:23] = PASID[15:8]
>>           cmd->data[1][16:23] = PASID[7:0]
>>
>> However, this does not affect the IOMMUv2 hardware implementation,
>> and has been corrected since version 2.02 of the specification
>> (available through AMD NDA).
>>
>> Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
>> Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
>
> Applied, thanks.
>
> Does this mean that PASIDs are only 16 bits wide now from the former 20
> bits?
>
>
>

Thank you Joerg. The specification also state that this command format 
does not support the maximum size of the PASID field. However, other 
commands seem to still support 20-bit PASID.

Suravee


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

* Re: [PATCH 1/1] iommu/amd: Fix PASID format in INVALIDATE_IOTLB_PAGES command
  2014-03-04 16:53   ` Suravee Suthikulpanit
@ 2014-03-04 17:06     ` Suravee Suthikulpanit
  0 siblings, 0 replies; 4+ messages in thread
From: Suravee Suthikulpanit @ 2014-03-04 17:06 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: iommu, Linux Kernel Mailing List, Jay Cornwall, Naru, Kim

On 3/4/2014 10:53 AM, Suravee Suthikulpanit wrote:
> On 3/4/2014 8:12 AM, Joerg Roedel wrote:
>> On Wed, Feb 26, 2014 at 03:49:31PM -0600,
>> suravee.suthikulpanit@amd.com wrote:
>>> From: Jay Cornwall <jay.cornwall@amd.com>
>>>
>>> This patch corrects the PASID format in the INVALIDATE_IOTLB_PAGES
>>> command, which was caused by incorrect information in
>>> the AMD IOMMU Architectural Specification v2.01 document.
>>>
>>>      Incorrect format:
>>>           cmd->data[0][16:23] = PASID[7:0]
>>>           cmd->data[1][16:27] = PASID[19:8]
>>>
>>>       Correct format:
>>>           cmd->data[0][16:23] = PASID[15:8]
>>>           cmd->data[1][16:23] = PASID[7:0]
>>>
>>> However, this does not affect the IOMMUv2 hardware implementation,
>>> and has been corrected since version 2.02 of the specification
>>> (available through AMD NDA).
>>>
>>> Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
>>> Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
>>
>> Applied, thanks.
>>
>> Does this mean that PASIDs are only 16 bits wide now from the former 20
>> bits?
>>
>>
>>
>
> Thank you Joerg. The specification also state that this command format
> does not support the maximum size of the PASID field. However, other
> commands seem to still support 20-bit PASID.
>
> Suravee

Actually, just thinking about this again, even though we don't have 
systems with 20-bit PASID yet (only up-to 16-bit), but for future proof, 
we should add another logic to make sure that this logic won't try to 
use the 20-bit PASID with this version of the command.  I'll send out 
another patch soon.

Suravee


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

end of thread, other threads:[~2014-03-04 17:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-26 21:49 [PATCH 1/1] iommu/amd: Fix PASID format in INVALIDATE_IOTLB_PAGES command suravee.suthikulpanit
2014-03-04 14:12 ` Joerg Roedel
2014-03-04 16:53   ` Suravee Suthikulpanit
2014-03-04 17:06     ` Suravee Suthikulpanit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox