iommu/amd: Add prefetch iommu pages command build function
Subsystems (2)
PATCH 1/1 iommu/amd: Add prefetch iommu pages command build function
Add function to build prefetch iommu pages command
Signed-off-by Wesley Sheng <[email protected]>
--- drivers/iommu/amd/amd_iommu_types.h | 2 ++ drivers/iommu/amd/iommu.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+)
drivers/iommu/amd/amd_iommu_types.h +2 -0
@@ -173,6 +173,7 @@#define CMD_INV_IOMMU_PAGES 0x03#define CMD_INV_IOTLB_PAGES 0x04#define CMD_INV_IRT 0x05 +#define CMD_PF_IOMMU_PAGES 0x06#define CMD_COMPLETE_PPR 0x07#define CMD_INV_ALL 0x08
@@ -181,6 +182,7 @@#define CMD_INV_IOMMU_PAGES_SIZE_MASK 0x01#define CMD_INV_IOMMU_PAGES_PDE_MASK 0x02#define CMD_INV_IOMMU_PAGES_GN_MASK 0x04 +#define CMD_PF_IOMMU_PAGES_INV_MASK 0x10#define PPR_STATUS_MASK 0xf#define PPR_STATUS_SHIFT 12
drivers/iommu/amd/iommu.c +19 -0
@@ -976,6 +976,25 @@ static void build_inv_irt(struct iommu_cmd *cmd, u16 devid)CMD_SET_TYPE (cmd,CMD_INV_IRT ); } +static void build_pf_iommu_pages (struct iommu_cmd *cmd,u64 address, +u16 devid,int pfcnt,bool size, +bool inv) +{ +memset (cmd,0 ,sizeof (*cmd)); + + address &=PAGE_MASK ; + + cmd->data[0 ] = devid; + cmd->data[0 ] |= (pfcnt &0xff ) <<24 ; + cmd->data[2 ] =lower_32_bits (address); + cmd->data[3] = upper_32_bits(address; +if (size) + cmd->data[2 ] |=CMD_INV_IOMMU_PAGES_SIZE_MASK ; +if (inv) + cmd->data[2 ] |=CMD_PF_IOMMU_PAGES_INV_MASK ; +CMD_SET_TYPE (cmd,CMD_PF_IOMMU_PAGES ); +} +/* * Writes the command to the IOMMUs command buffer and informs the * hardware about the new command.
Signature · 1 line
2.16.2
Joerg Roedel
maintainerQuoted 8 lines · Wesley Sheng
drivers/iommu/amd/iommu.c +8
-0+static void build_pf_iommu_pages (struct iommu_cmd *cmd,u64 address, +u16 devid,int pfcnt,bool size, +bool inv) +{ +memset (cmd,0 ,sizeof (*cmd)); + + address &=PAGE_MASK ; +
drivers/iommu/amd/iommu.c static void build_inv_irt(struct iommu_cmd *cmd, u16 devid) · line 996
Quoted 10 lines
drivers/iommu/amd/iommu.c +10
-0+ cmd->data[0 ] = devid; + cmd->data[0 ] |= (pfcnt &0xff ) <<24 ; + cmd->data[2 ] =lower_32_bits (address); + cmd->data[3] = upper_32_bits(address; +if (size) + cmd->data[2 ] |=CMD_INV_IOMMU_PAGES_SIZE_MASK ; +if (inv) + cmd->data[2 ] |=CMD_PF_IOMMU_PAGES_INV_MASK ; +CMD_SET_TYPE (cmd,CMD_PF_IOMMU_PAGES ); +}
This also needs to add a user of this function.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu