[PATCH v2] iommu/arm-smmu-v3: disable MSI polling if SEV polling is faster
Will Deacon
will at kernel.org
Fri Jul 31 08:43:52 EDT 2020
On Fri, Jul 31, 2020 at 12:30:27PM +0000, Song Bao Hua (Barry Song) wrote:
> Thanks for your comment. I had a patch with command line option as below.
> If it is what you prefer, I'd refine this one and send.
>
> [PATCH] iommu/arm-smmu-v3: permit users to disable msi polling
> ---
> drivers/iommu/arm-smmu-v3.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
> index f578677a5c41..4fb1681308e4 100644
> --- a/drivers/iommu/arm-smmu-v3.c
> +++ b/drivers/iommu/arm-smmu-v3.c
> @@ -418,6 +418,11 @@ module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO);
> MODULE_PARM_DESC(disable_bypass,
> "Disable bypass streams such that incoming transactions from devices that are not attached to an iommu domain will report an abort back to the device and will not be allowed to pass through the SMMU.");
>
> +static bool disable_msipolling = 1;
> +module_param_named(disable_msipolling, disable_msipolling, bool, S_IRUGO);
> +MODULE_PARM_DESC(disable_msipolling,
> + "Don't use MSI to poll the completion of CMD_SYNC if it is slower than SEV");
Reword this to "Disable MSI-based polling for CMD_SYNC completion."
> +
> enum pri_resp {
> PRI_RESP_DENY = 0,
> PRI_RESP_FAIL = 1,
> @@ -992,7 +997,7 @@ static void arm_smmu_cmdq_build_sync_cmd(u64 *cmd, struct arm_smmu_device *smmu,
> * Beware that Hi16xx adds an extra 32 bits of goodness to its MSI
> * payload, so the write will zero the entire command on that platform.
> */
> - if (smmu->features & ARM_SMMU_FEAT_MSI &&
> + if (!disable_msipolling && smmu->features & ARM_SMMU_FEAT_MSI &&
> smmu->features & ARM_SMMU_FEAT_COHERENCY) {
Probably now cleaner to wrap this up into a helper:
static bool arm_smmu_use_msipolling(struct arm_smmu_device *smmu)
{
return !disable_msipolling &&
smmu->features & ARM_SMMU_FEAT_COHERENCY &&
smmu->features & ARM_SMMU_FEAT_MSI;
}
> ent.sync.msiaddr = q->base_dma + Q_IDX(&q->llq, prod) *
> q->ent_dwords * 8;
> @@ -1332,7 +1337,7 @@ static int __arm_smmu_cmdq_poll_until_consumed(struct arm_smmu_device *smmu,
> static int arm_smmu_cmdq_poll_until_sync(struct arm_smmu_device *smmu,
> struct arm_smmu_ll_queue *llq)
> {
> - if (smmu->features & ARM_SMMU_FEAT_MSI &&
> + if (!disable_msipolling && smmu->features & ARM_SMMU_FEAT_MSI &&
> smmu->features & ARM_SMMU_FEAT_COHERENCY)
Then you can use the new helper here too.
Will
More information about the linux-arm-kernel
mailing list