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),

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