[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [RFC v8 10/18] virtio-iommu: Implement probe request
From: |
Jean-Philippe Brucker |
Subject: |
Re: [Qemu-arm] [RFC v8 10/18] virtio-iommu: Implement probe request |
Date: |
Wed, 14 Nov 2018 16:01:05 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
Hi Eric,
A few issues creeped in when the resv_mem structure changed
On 09/11/2018 11:29, Eric Auger wrote:
> +#define SUPPORTED_PROBE_PROPERTIES (\
> + VIRTIO_IOMMU_PROBE_T_NONE | \
> + VIRTIO_IOMMU_PROBE_T_RESV_MEM)
You might be missing "1 <<" here, since the properties types are normal
values
[...]
> +/**
> + * virtio_iommu_fill_resv_mem_prop - Add a RESV_MEM probe
> + * property into the probe request buffer
> + *
> + * @key: interval handle
> + * @value: handle to the reserved memory region
> + * @data: handle to the probe request buffer state
> + */
> +static gboolean virtio_iommu_fill_resv_mem_prop(gpointer key,
> + gpointer value,
> + gpointer data)
> +{
> + struct virtio_iommu_probe_resv_mem *resv =
> + (struct virtio_iommu_probe_resv_mem *)value;
> + struct virtio_iommu_probe_property *prop;
> + struct virtio_iommu_probe_resv_mem *current;
> + viommu_property_buffer *bufstate = (viommu_property_buffer *)data;
> + size_t size = sizeof(*resv), total_size;
> + uint8_t *prop_value;
> +
> + total_size = size + sizeof(*prop);
size already contains sizeof(*prop)
> +
> + if (bufstate->filled + total_size >= VIOMMU_PROBE_SIZE) {
> + bufstate->error = true;
> + /* get the traversal stopped by returning true */
> + return true;
> + }
> + prop = (struct virtio_iommu_probe_property *)
> + (bufstate->start + bufstate->filled);
> + prop->type = cpu_to_le16(VIRTIO_IOMMU_PROBE_T_RESV_MEM) &
> + VIRTIO_IOMMU_PROBE_T_MASK;
> + prop->length = cpu_to_le16(size);
Should be size-4
> +
> + prop_value = (uint8_t *)prop + 4;
> + current = (struct virtio_iommu_probe_resv_mem *)prop_value;
> + *current = *resv;
*resv includes the property header, but *current doesn't, so the resv
property is corrupted.
Thanks,
Jean
- [Qemu-arm] [RFC v8 02/18] linux-headers: Partial update for virtio-iommu v0.8, (continued)
- [Qemu-arm] [RFC v8 02/18] linux-headers: Partial update for virtio-iommu v0.8, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 01/18] update-linux-headers: Import virtio_iommu.h, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 05/18] virtio-iommu: Add the iommu regions, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 03/18] virtio-iommu: Add skeleton, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 07/18] virtio-iommu: Implement attach/detach command, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 04/18] virtio-iommu: Decode the command payload, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 08/18] virtio-iommu: Implement map/unmap, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 06/18] virtio-iommu: Endpoint and domains structs and helpers, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 09/18] virtio-iommu: Implement translate, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 10/18] virtio-iommu: Implement probe request, Eric Auger, 2018/11/09
- Re: [Qemu-arm] [RFC v8 10/18] virtio-iommu: Implement probe request,
Jean-Philippe Brucker <=
- [Qemu-arm] [RFC v8 11/18] virtio-iommu: Add an msi_bypass property, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 12/18] virtio-iommu: Implement fault reporting, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 13/18] virtio_iommu: Handle reserved regions in translation process, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 14/18] virtio-iommu-pci: Add virtio iommu pci support, Eric Auger, 2018/11/09
- [Qemu-arm] [RFC v8 15/18] hw/arm/virt: Add virtio-iommu to the virt board, Eric Auger, 2018/11/09
- Re: [Qemu-arm] [RFC v8 15/18] hw/arm/virt: Add virtio-iommu to the virt board, Bharat Bhushan, 2018/11/22