[PATCH v11 8/9] iommu/arm-smmu-v3: Add in-kernel support for NVIDIA Tegra241 (Grace) CMDQV
Jason Gunthorpe
jgg at nvidia.com
Wed Aug 14 14:57:53 PDT 2024
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);
In here. The copy inside the krealloc won't work otherwise.
But this still seems Ok to me with the new ops
Jason
More information about the linux-arm-kernel
mailing list