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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zo2Bmm0KfEBn2jMb@Asurada-Nvidia>
Date: Tue, 9 Jul 2024 11:29:46 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Will Deacon <will@...nel.org>
CC: <robin.murphy@....com>, <joro@...tes.org>, <jgg@...dia.com>,
	<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 v9 4/6] iommu/arm-smmu-v3: Add CS_NONE quirk for
 CONFIG_TEGRA241_CMDQV

Hi Will,

On Mon, Jul 08, 2024 at 11:00:00AM -0700, Nicolin Chen wrote:
> On Mon, Jul 08, 2024 at 12:29:28PM +0100, Will Deacon wrote:
> > > With that, we cannot avoid an unconditional hard-coding tegra
> > > function call even if we switch to an impl design:
> > >
> > > +static int acpi_smmu_impl_init(u32 model, struct arm_smmu_device *smmu)
> > > +{
> > > +     /*
> > > +      * unconditional go through ACPI table to detect if there is a tegra241
> > > +      * implementation that extends SMMU with a CMDQV. The probe() will fill
> > > +      * the smmu->impl pointer upon success. Otherwise, fall back to regular
> > > +      * SMMU CMDQ.
> > > +      */
> > > +     tegra241_impl_acpi_probe(smmu);
> > 
> > In-line the minimal DSDT parsing to figure out if we're on a Tegra part.
> > If it's that bad, put it in a static inline in arm-smmu-v3.h.
> 
> OK. How about the following?
> 
> /* arm-smmu-v3.h */
> static inline void arm_smmu_impl_acpi_dsdt_probe(struct arm_smmu_device *smmu,
> 						 struct acpi_iort_node *node)
> {
> 	tegra241_cmdqv_acpi_dsdt_probe(smmu, node);
> }
> 
> /* arm-smmu-v3.c */
> static int arm_smmu_impl_acpi_probe(struct arm_smmu_device *smmu,
> 				    struct acpi_iort_node *node)
> {
> 	/*
> 	 * DSDT might holds some SMMU extension, so we have no option but to go
> 	 * through ACPI tables unconditionally. This probe function should fill
> 	 * the smmu->impl pointer upon success. Otherwise, just carry on with a
> 	 * standard SMMU.
> 	 */
> 	arm_smmu_impl_acpi_dsdt_probe(smmu, node);
> 
> 	return 0;
> }

I have reworked my series and it looks like:
------------------------------------------------------------- 
@ -627,9 +630,35 @@ struct arm_smmu_strtab_cfg {
        u32                             strtab_base_cfg;
 };
 
+struct arm_smmu_impl {
+       int (*device_reset)(struct arm_smmu_device *smmu);
+       void (*device_remove)(struct arm_smmu_device *smmu);
+       struct arm_smmu_cmdq *(*get_secondary_cmdq)(struct arm_smmu_device *smmu,
+                              u8 opcode);
+};
+
+#ifdef CONFIG_TEGRA241_CMDQV
+struct arm_smmu_device *
+tegra241_cmdqv_acpi_dsdt_probe(struct arm_smmu_device *smmu,
+                              struct acpi_iort_node *node);
+#endif
+
+static inline struct arm_smmu_device *
+arm_smmu_impl_acpi_dsdt_probe(struct arm_smmu_device *smmu,
+                             struct acpi_iort_node *node)
+{
+#ifdef CONFIG_TEGRA241_CMDQV
+       smmu = tegra241_cmdqv_acpi_dsdt_probe(smmu, node);
+#endif
+       return smmu;
+}
+
 /* An SMMUv3 instance */
 struct arm_smmu_device {
        struct device                   *dev;
+       /* An SMMUv3 implementation */
+       const struct arm_smmu_impl      *impl;
+
        void __iomem                    *base;
        void __iomem                    *page1;
------------------------------------------------------------- 

One thing that I want to confirm is about the smmu pointer.
I implemented in the way that SMMUv2 driver does, i.e. the
passed-in SMMU pointer gets devm_realloc() to &cmdev->smmu.
Is it something you would prefer?

Thanks
Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ