[PATCH] iommu/arm-smmu-v3: Add a configurable tlbi_range_max_n_shift for TLBI

Jason Gunthorpe jgg at nvidia.com
Wed Aug 16 04:59:59 PDT 2023


On Mon, Aug 14, 2023 at 02:57:01PM -0700, Nicolin Chen wrote:
> +static ssize_t tlbi_range_max_n_shift_show(struct device *dev,
> +					   struct device_attribute *attr,
> +					   char *buf)
> +{
> +	struct arm_smmu_device *smmu = dev_get_drvdata(dev->parent);
> +
> +	return sprintf(buf, "%u\n", smmu->tlbi_range_max_n_shift);
> +}

sysfs_emit and missing newline

> +static ssize_t tlbi_range_max_n_shift_store(struct device *dev,
> +					    struct device_attribute *attr,
> +					    const char *buf, size_t size)
> +{
> +	struct arm_smmu_device *smmu = dev_get_drvdata(dev->parent);
> +	unsigned int max_n_shift;
> +	int ret;
> +
> +	ret = kstrtou32(buf, 0, &max_n_shift);
> +	if (ret)
> +		return ret;
> +	if (max_n_shift > VA_BITS || max_n_shift < PAGE_SHIFT)
> +		return -EINVAL;
> +	smmu->tlbi_range_max_n_shift = max_n_shift;
> +	return size;

This seems convoluted for a uapi, you should just make it
'invalidate_threshold' in bytes or something simpler.

> +
> +static struct attribute_group arm_smmu_group = {
> +	.name = "arm-smmu-v3",
> +	.attrs = arm_smmu_attrs,
> +};

Do we really need the subdirectory?

Jason



More information about the linux-arm-kernel mailing list