lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zr2RsrcZ0478Cy5B@Asurada-Nvidia>
Date: Wed, 14 Aug 2024 22:27:14 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: <will@...nel.org>, <robin.murphy@....com>, <joro@...tes.org>,
	<thierry.reding@...il.com>, <vdumpa@...dia.com>, <jonathanh@...dia.com>,
	<linux-kernel@...r.kernel.org>, <iommu@...ts.linux.dev>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-tegra@...r.kernel.org>
Subject: Re: [PATCH v11 8/9] iommu/arm-smmu-v3: Add in-kernel support for
 NVIDIA Tegra241 (Grace) CMDQV

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ