iommu/amd: Fix PASID format in INVALIDATE_IOTLB_PAGES command
authorJay Cornwall <jay.cornwall@amd.com>
Wed, 26 Feb 2014 21:49:31 +0000 (15:49 -0600)
committerJoerg Roedel <joro@8bytes.org>
Tue, 4 Mar 2014 14:10:17 +0000 (15:10 +0100)
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>
Signed-off-by: Joerg Roedel <joro@8bytes.org>
drivers/iommu/amd_iommu.c

index faf0da4bb3a2f84bfd69c911d8de100028b25b7e..1dd9f818fc84403f868620c71c1b81f6d0e06222 100644 (file)
@@ -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);