Re: [PATCH] iommu/amd: Add prefetch iommu pages command build function

From: Joerg Roedel
Date: Fri Sep 18 2020 - 04:49:19 EST


On Sat, Sep 05, 2020 at 03:14:20PM +0800, Wesley Sheng wrote:
> +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);
> +}

This also needs to add a user of this function.