[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v12 05/13] virtio-iommu: Endpoint and domains structs and hel
From: |
Auger Eric |
Subject: |
Re: [PATCH v12 05/13] virtio-iommu: Endpoint and domains structs and helpers |
Date: |
Tue, 14 Jan 2020 09:51:59 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
Hi Peter,
On 1/13/20 9:23 PM, Peter Xu wrote:
> On Thu, Jan 09, 2020 at 03:43:11PM +0100, Eric Auger wrote:
>
> [...]
>
>> +VirtIOIOMMUEndpoint *virtio_iommu_get_endpoint(VirtIOIOMMU *s, uint32_t
>> ep_id);
>> +VirtIOIOMMUEndpoint *virtio_iommu_get_endpoint(VirtIOIOMMU *s, uint32_t
>> ep_id)
>
> Is the extra definition trying to workaround the compiler
> warning/error?
yes it does
>
> I'm not sure whether it's only me who prefer this, but again I'd
> really perfer we move the function into the caller patch, add "static"
> as needed altogether, even if that patch can be big.
OK I will do that.
>
>> +{
>> + VirtIOIOMMUEndpoint *ep;
>> +
>> + ep = g_tree_lookup(s->endpoints, GUINT_TO_POINTER(ep_id));
>> + if (ep) {
>> + return ep;
>> + }
>> + if (!virtio_iommu_mr(s, ep_id)) {
>
> Could I ask when this will trigger?
This can happen when a device is attached to a domain and its RID does
not correspond to one of the devices protected by the iommu.
Thanks
Eric
>
>> + return NULL;
>> + }
>> + ep = g_malloc0(sizeof(*ep));
>> + ep->id = ep_id;
>> + trace_virtio_iommu_get_endpoint(ep_id);
>> + g_tree_insert(s->endpoints, GUINT_TO_POINTER(ep_id), ep);
>> + return ep;
>> +}
>
> Thanks,
>
[PATCH v12 06/13] virtio-iommu: Implement attach/detach command, Eric Auger, 2020/01/09
[PATCH v12 07/13] virtio-iommu: Implement map/unmap, Eric Auger, 2020/01/09
[PATCH v12 08/13] virtio-iommu: Implement translate, Eric Auger, 2020/01/09
[PATCH v12 09/13] virtio-iommu: Implement fault reporting, Eric Auger, 2020/01/09