search for: virtio_iommu_probe_pgsize_mask

Displaying 11 results from an estimated 11 matches for "virtio_iommu_probe_pgsize_mask".

2020 Apr 01
2
[RFC PATCH v2] iommu/virtio: Use page size bitmap supported by endpoint
...> + u64 pgsize_bitmap; > }; > > struct viommu_request { > @@ -415,6 +416,20 @@ static int viommu_replay_mappings(struct viommu_domain *vdomain) > return ret; > } > > +static int viommu_set_pgsize_bitmap(struct viommu_endpoint *vdev, > + struct virtio_iommu_probe_pgsize_mask *mask, > + size_t len) > + > +{ > + u64 pgsize_bitmap = le64_to_cpu(mask->pgsize_bitmap); > + > + if (len < sizeof(*mask)) > + return -EINVAL; > + > + vdev->pgsize_bitmap = pgsize_bitmap; > + return 0; > +} > + > static int viommu_add_resv_m...
2020 May 06
1
[PATCH v5] iommu/virtio: Use page size bitmap supported by endpoint
...gions; > + u64 pgsize_bitmap; > }; > > struct viommu_request { > @@ -415,6 +416,19 @@ static int viommu_replay_mappings(struct viommu_domain *vdomain) > return ret; > } > > +static int viommu_set_pgsize_bitmap(struct viommu_endpoint *vdev, > + struct virtio_iommu_probe_pgsize_mask *mask, > + size_t len) > +{ > + u64 pgsize_bitmap = le64_to_cpu(mask->pgsize_bitmap); > + > + if (len < sizeof(*mask)) This is too late to validate length, you have dereferenced it already. do it before the read pls. > + return -EINVAL; OK but note that guest will...
2020 May 07
2
[EXT] Re: [PATCH v5] iommu/virtio: Use page size bitmap supported by endpoint
...mmu_request { > > > @@ -415,6 +416,19 @@ static int viommu_replay_mappings(struct > > viommu_domain *vdomain) > > > return ret; > > > } > > > > > > +static int viommu_set_pgsize_bitmap(struct viommu_endpoint *vdev, > > > + struct virtio_iommu_probe_pgsize_mask *mask, > > > + size_t len) > > > +{ > > > + u64 pgsize_bitmap = le64_to_cpu(mask->pgsize_bitmap); > > > + > > > + if (len < sizeof(*mask)) > > > > This is too late to validate length, you have dereferenced it already. > >...
2020 May 14
2
[PATCH v6] iommu/virtio: Use page size bitmap supported by endpoint
...gions; > + u64 pgsize_bitmap; > }; > > struct viommu_request { > @@ -415,6 +416,23 @@ static int viommu_replay_mappings(struct viommu_domain *vdomain) > return ret; > } > > +static int viommu_set_pgsize_bitmap(struct viommu_endpoint *vdev, > + struct virtio_iommu_probe_pgsize_mask *mask, > + size_t len) > +{ > + u64 pgsize_bitmap; > + > + if (len < sizeof(*mask)) > + return -EINVAL; > + > + pgsize_bitmap = le64_to_cpu(mask->pgsize_bitmap); > + if (!pgsize_bitmap) > + return -EINVAL; > + > + vdev->pgsize_bitmap = pgsize_bi...
2020 May 14
2
[PATCH v6] iommu/virtio: Use page size bitmap supported by endpoint
...gions; > + u64 pgsize_bitmap; > }; > > struct viommu_request { > @@ -415,6 +416,23 @@ static int viommu_replay_mappings(struct viommu_domain *vdomain) > return ret; > } > > +static int viommu_set_pgsize_bitmap(struct viommu_endpoint *vdev, > + struct virtio_iommu_probe_pgsize_mask *mask, > + size_t len) > +{ > + u64 pgsize_bitmap; > + > + if (len < sizeof(*mask)) > + return -EINVAL; > + > + pgsize_bitmap = le64_to_cpu(mask->pgsize_bitmap); > + if (!pgsize_bitmap) > + return -EINVAL; > + > + vdev->pgsize_bitmap = pgsize_bi...
2020 May 12
1
[PATCH v5] iommu/virtio: Use page size bitmap supported by endpoint
...gions; > + u64 pgsize_bitmap; > }; > > struct viommu_request { > @@ -415,6 +416,19 @@ static int viommu_replay_mappings(struct viommu_domain *vdomain) > return ret; > } > > +static int viommu_set_pgsize_bitmap(struct viommu_endpoint *vdev, > + struct virtio_iommu_probe_pgsize_mask *mask, > + size_t len) > +{ > + u64 pgsize_bitmap = le64_to_cpu(mask->pgsize_bitmap); > + > + if (len < sizeof(*mask)) > + return -EINVAL; > + > + vdev->pgsize_bitmap = pgsize_bitmap; > + return 0; > +} > + > static int viommu_add_resv_mem(struc...
2020 May 07
0
[EXT] Re: [PATCH v5] iommu/virtio: Use page size bitmap supported by endpoint
...; struct viommu_request { >>> @@ -415,6 +416,19 @@ static int viommu_replay_mappings(struct >> viommu_domain *vdomain) >>> return ret; >>> } >>> >>> +static int viommu_set_pgsize_bitmap(struct viommu_endpoint *vdev, >>> + struct virtio_iommu_probe_pgsize_mask *mask, >>> + size_t len) >>> +{ >>> + u64 pgsize_bitmap = le64_to_cpu(mask->pgsize_bitmap); >>> + >>> + if (len < sizeof(*mask)) >> >> This is too late to validate length, you have dereferenced it already. >> do it before t...
2020 May 07
0
[EXT] Re: [PATCH v5] iommu/virtio: Use page size bitmap supported by endpoint
...gt;>>> @@ -415,6 +416,19 @@ static int viommu_replay_mappings(struct >>> viommu_domain *vdomain) >>>> return ret; >>>> } >>>> >>>> +static int viommu_set_pgsize_bitmap(struct viommu_endpoint *vdev, >>>> + struct virtio_iommu_probe_pgsize_mask *mask, >>>> + size_t len) >>>> +{ >>>> + u64 pgsize_bitmap = le64_to_cpu(mask->pgsize_bitmap); >>>> + >>>> + if (len < sizeof(*mask)) >>> >>> This is too late to validate length, you have dereferenced it alre...
2020 Apr 02
0
[EXT] Re: [RFC PATCH v2] iommu/virtio: Use page size bitmap supported by endpoint
On Thu, Apr 02, 2020 at 03:53:40AM +0000, Bharat Bhushan wrote: > > > > +struct virtio_iommu_probe_pgsize_mask { > > > > + struct virtio_iommu_probe_property head; > > > > + __u8 reserved[4]; > > > > + __u64 pgsize_bitmap; > > > > Should be __le64 > > Based on" iommu/virtio: Fix sparse warning" patch https://www.spinics.net/lists/linu...
2020 May 13
0
[EXT] Re: [PATCH v5] iommu/virtio: Use page size bitmap supported by endpoint
...t lists.linux-foundation.org; iommu at lists.linux-foundation.org; > > linux-kernel at vger.kernel.org; eric.auger.pro at gmail.com; eric.auger at redhat.com > > Subject: [EXT] Re: [PATCH v5] iommu/virtio: Use page size bitmap supported by > > endpoint [...] > > > +struct virtio_iommu_probe_pgsize_mask { > > > + struct virtio_iommu_probe_property head; > > > + __u8 reserved[4]; > > > + __le64 pgsize_bitmap; > > > +}; > > > + > > > > This is UAPI. Document the format of pgsize_bitmap please. > > I do not see uapi documentatio...
2020 May 14
0
[PATCH v6] iommu/virtio: Use page size bitmap supported by endpoint
...ize_bitmap, but that's not a reason to propagate > the error. Realistically we're not going to have a page granule larger than 4G, it's going to be 4k or 64k. But we can add a check that truncates the page_size_mask to 32-bit and makes sure that it's non-null. > > +struct virtio_iommu_probe_pgsize_mask { > > + struct virtio_iommu_probe_property head; > > + __u8 reserved[4]; > > + /* Same format as virtio_iommu_config::page_size_mask */ > > It's actually slightly different in that > this must be a superset of domain page size mask, right? No it overrides the gl...