[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v1 04/22] hw/iommu: introduce HostIOMMUContext
From: |
Liu, Yi L |
Subject: |
RE: [PATCH v1 04/22] hw/iommu: introduce HostIOMMUContext |
Date: |
Tue, 24 Mar 2020 10:00:59 +0000 |
> From: Peter Xu <address@hidden>
> Sent: Tuesday, March 24, 2020 4:59 AM
> To: Liu, Yi L <address@hidden>
> Subject: Re: [PATCH v1 04/22] hw/iommu: introduce HostIOMMUContext
>
> On Sun, Mar 22, 2020 at 05:36:01AM -0700, Liu Yi L wrote:
[...]
> > +
> > +void host_iommu_ctx_init(void *_host_icx, size_t instance_size,
> > + const char *mrtypename,
> > + uint64_t flags)
> > +{
> > + HostIOMMUContext *host_icx;
> > +
> > + object_initialize(_host_icx, instance_size, mrtypename);
> > + host_icx = HOST_IOMMU_CONTEXT(_host_icx);
> > + host_icx->flags = flags;
> > + host_icx->initialized = true;
> > +}
> > +
> > +void host_iommu_ctx_destroy(HostIOMMUContext *host_icx)
> > +{
> > + host_icx->flags = 0x0;
> > + host_icx->initialized = false;
> > +}
>
> Can we simply put this into .instance_finalize() and be called
> automatically when the object loses the last refcount?
>
> Actually an easier way may be dropping this directly.. If the object
> is to be destroyed then IMHO we don't need to care about flags at all,
> we just free memories we use, but for this object it's none.
right, I'll drop this function. :-)
> > +
> > +static void host_icx_init_fn(Object *obj)
> > +{
> > + HostIOMMUContext *host_icx = HOST_IOMMU_CONTEXT(obj);
> > +
> > + host_icx->flags = 0x0;
> > + host_icx->initialized = false;
>
> Here is also a bit strange... IIUC the only way to init this object
> is via host_iommu_ctx_init() where all these flags will be set. But
> if so, then we're setting all these twice always. Maybe this function
> can be dropped too?
yes, it is. At least, it is not necessary for now. Will drop it.
Thanks,
Yi Liu
- [PATCH v1 12/22] intel_iommu: add PASID cache management infrastructure, (continued)
- [PATCH v1 12/22] intel_iommu: add PASID cache management infrastructure, Liu Yi L, 2020/03/22
- [PATCH v1 14/22] intel_iommu: bind/unbind guest page table to host, Liu Yi L, 2020/03/22
- [PATCH v1 13/22] vfio: add bind stage-1 page table support, Liu Yi L, 2020/03/22
- [PATCH v1 19/22] intel_iommu: process PASID-based iotlb invalidation, Liu Yi L, 2020/03/22
- [PATCH v1 18/22] vfio: add support for flush iommu stage-1 cache, Liu Yi L, 2020/03/22
- [PATCH v1 20/22] intel_iommu: propagate PASID-based iotlb invalidation to host, Liu Yi L, 2020/03/22
- [PATCH v1 21/22] intel_iommu: process PASID-based Device-TLB invalidation, Liu Yi L, 2020/03/22
- [PATCH v1 22/22] intel_iommu: modify x-scalable-mode to be string option, Liu Yi L, 2020/03/22
- [PATCH v1 04/22] hw/iommu: introduce HostIOMMUContext, Liu Yi L, 2020/03/22
- Re: [PATCH v1 00/22] intel_iommu: expose Shared Virtual Addressing to VMs, no-reply, 2020/03/22