Re: [PATCH v11 8/9] iommu/arm-smmu-v3: Add in-kernel support for NVIDIA Tegra241 (Grace) CMDQV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 14, 2024 at 06:57:53PM -0300, Jason Gunthorpe wrote:
> On Tue, Aug 06, 2024 at 07:11:53PM -0700, Nicolin Chen wrote:
> 
> > +static struct arm_smmu_device *
> > +tegra241_cmdqv_probe(struct arm_smmu_device *smmu,
> > +		     struct resource *res, int irq)
> > +{
> > +	struct tegra241_cmdqv *cmdqv = NULL;
> > +	struct tegra241_vintf *vintf;
> > +	void __iomem *base;
> > +	u32 regval;
> > +	int lidx;
> > +	int ret;
> > +
> > +	base = ioremap(res->start, resource_size(res));
> > +	if (IS_ERR(base)) {
> > +		dev_err(smmu->dev, "failed to ioremap: %ld\n", PTR_ERR(base));
> > +		goto iounmap;
> > +	}
> > +
> > +	regval = readl(base + TEGRA241_CMDQV_CONFIG);
> > +	if (disable_cmdqv) {
> > +		dev_info(smmu->dev, "Detected disable_cmdqv=true\n");
> > +		writel(regval & ~CMDQV_EN, base + TEGRA241_CMDQV_CONFIG);
> > +		goto iounmap;
> > +	}
> > +
> > +	cmdqv = devm_krealloc(smmu->dev, smmu, sizeof(*cmdqv), GFP_KERNEL);
> > +	if (!cmdqv)
> > +		goto iounmap;
> > +	smmu = &cmdqv->smmu;
> 
> Should stick a:
> 
> static_assert(offsetof(struct tegra241_cmdqv,smmu) == 0);

Done.

Thanks!
Nicolin

> In here. The copy inside the krealloc won't work otherwise.
> 
> But this still seems Ok to me with the new ops
> 
> Jason




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux