> -----Original Message-----
> From: Duan, Zhenzhong <[email protected]>
> Sent: Wednesday, July 16, 2025 4:39 AM
> To: Nicolin Chen <[email protected]>
> Cc: Shameerali Kolothum Thodi
> <[email protected]>; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; Linuxarm <[email protected]>; Wangzhou (B)
> <[email protected]>; jiangkunkun <[email protected]>;
> Jonathan Cameron <[email protected]>;
> [email protected]; [email protected]
> Subject: RE: [RFC PATCH v3 05/15] hw/arm/smmuv3-accel: Introduce
> smmuv3 accel device
> 
> 
> 
> >-----Original Message-----
> >From: Nicolin Chen <[email protected]>
> >Subject: Re: [RFC PATCH v3 05/15] hw/arm/smmuv3-accel: Introduce
> >smmuv3 accel device
> >
> >On Tue, Jul 15, 2025 at 10:48:31AM +0000, Duan, Zhenzhong wrote:
> >> >+static const TypeInfo types[] = {
> >> >+    {
> >> >+        .name = TYPE_ARM_SMMUV3_ACCEL,
> >> >+        .parent = TYPE_ARM_SMMUV3,
> >> >+        .class_init = smmuv3_accel_class_init,
> >> >+    }
> >>
> >> In cover-letter, I see "-device arm-smmuv3", so where is above accel
> >> device created so we could use smmuv3_accel_ops?
> >
> >The smmu-common.c is the shared file between accel and non-accel
> >instances. It has a module property:
> >    DEFINE_PROP_BOOL("accel", SMMUState, accel, false),
> 
> It looks we expose a new TYPE_ARM_SMMUV3_ACCEL type device just for
> exporting accel iommu_ops?
> What about returning accel iommu_ops directly in
> smmu_iommu_ops_by_type() and drop the new type?

We are not creating any new device here. Its just a Class object of different 
type.
I had a different approach previously and Eric suggested to try this as there
are examples in VFIO/IOMMUFD for something like this.

https://lore.kernel.org/qemu-devel/[email protected]/

Thanks,
Shameer

> >
> >where it directs to different iommu_ops:
> >937 static const PCIIOMMUOps *smmu_iommu_ops_by_type(SMMUState
> *s)
> >938 {
> >939     SMMUBaseClass *sbc;
> >940
> >941     if (s->accel) {
> >942         sbc =
> >ARM_SMMU_CLASS(object_class_by_name(TYPE_ARM_SMMUV3_ACCEL));
> >943     } else {
> >944         sbc =
> >ARM_SMMU_CLASS(object_class_by_name(TYPE_ARM_SMMU));
> >945     }
> >946     assert(sbc->iommu_ops);
> >947
> >948     return sbc->iommu_ops;
> >949 }
> >
> >Nicolin


Reply via email to