qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH qemu 2/5] spapr-iommu: Subclass TYPE_IOMMU_M


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC PATCH qemu 2/5] spapr-iommu: Subclass TYPE_IOMMU_MEMORY_REGION
Date: Fri, 31 Mar 2017 14:03:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0


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

[Prev in Thread] Current Thread [Next in Thread]