On 31/03/2017 13:47, Alexey Kardashevskiy wrote:
>>>  
>>> +static void spapr_iommu_memory_region_class_init(ObjectClass *k, void 
>>> *data)
>>> +{
>>> +    sPAPRIOMMUMemoryRegionClass *smrc = SPAPR_IOMMU_MEMORY_REGION_CLASS(k);
>>> +
>>> +    smrc->get_fd = spapr_tce_get_fd;
>>> +}
>>> +
>> You don't even need the virtual function.  Rather, make spapr_tce_get_fd
>> public and give it a sPAPRTCETable argument.  Then vfio_spapr_notify_kvm
>> can use SPAPR_IOMMU_MEMORY_REGION(iommumr).
> Well, if I make spapr_tce_get_fd() public, vfio_spapr_notify_kvm() could
> just take MemoryRegion and cast it to sPAPRTCETable without all these
> dances with MemoryRegion, IOMMUMemoryRegion, what do I miss here? I have
> made a big patch with IOMMUMemoryRegion though, post it?

*I* was missing that the call was inside an "if (container->iommu_type == TCE)".

So the hierarchy is good to have, but the virtual function can be removed.

Paolo

Reply via email to