Re: [PATCH] iommu/arm-smmu-v3: Add a configurable tlbi_range_max_n_shift for TLBI
From: Nicolin Chen
Date: Wed Aug 16 2023 - 13:10:16 EST
On Wed, Aug 16, 2023 at 08:59:59AM -0300, Jason Gunthorpe wrote:
> 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
Will replace and add a new line.
> > +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.
Hmm. That'd be a direct 64-bit size configuration, and very likely
to be at upper 32-bit range, so I feel the value would be very big
that might be hard to read.
With that said, I can rename the uAPI, yet still keep the bitshift
configuration.
> > +static struct attribute_group arm_smmu_group = {
> > + .name = "arm-smmu-v3",
> > + .attrs = arm_smmu_attrs,
> > +};
>
> Do we really need the subdirectory?
OK. Let me try unfolding it.
Thanks!
Nicolin