[PATCH v9 4/6] iommu/arm-smmu-v3: Add CS_NONE quirk for CONFIG_TEGRA241_CMDQV
Nicolin Chen
nicolinc at nvidia.com
Tue Jul 9 11:29:46 PDT 2024
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
More information about the linux-arm-kernel
mailing list