mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 06:43:53 -06:00
virtio-iommu: Rename reserved_regions into prop_resv_regions
Rename VirtIOIOMMU (nb_)reserved_regions fields with the "prop_" prefix to highlight those fields are set through a property, at machine level. They are IOMMU wide. A subsequent patch will introduce per IOMMUDevice reserved regions that will include both those IOMMU wide property reserved regions plus, sometimes, host reserved regions, if the device is backed by a host device protected by a physical IOMMU. Also change nb_ prefix by nr_. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
e4a8ae09c5
commit
41cc70cdf5
3 changed files with 14 additions and 13 deletions
|
@ -631,22 +631,23 @@ static ssize_t virtio_iommu_fill_resv_mem_prop(VirtIOIOMMU *s, uint32_t ep,
|
|||
size_t size = sizeof(prop), length = size - sizeof(prop.head), total;
|
||||
int i;
|
||||
|
||||
total = size * s->nb_reserved_regions;
|
||||
total = size * s->nr_prop_resv_regions;
|
||||
|
||||
if (total > free) {
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
for (i = 0; i < s->nb_reserved_regions; i++) {
|
||||
unsigned subtype = s->reserved_regions[i].type;
|
||||
for (i = 0; i < s->nr_prop_resv_regions; i++) {
|
||||
unsigned subtype = s->prop_resv_regions[i].type;
|
||||
Range *range = &s->prop_resv_regions[i].range;
|
||||
|
||||
assert(subtype == VIRTIO_IOMMU_RESV_MEM_T_RESERVED ||
|
||||
subtype == VIRTIO_IOMMU_RESV_MEM_T_MSI);
|
||||
prop.head.type = cpu_to_le16(VIRTIO_IOMMU_PROBE_T_RESV_MEM);
|
||||
prop.head.length = cpu_to_le16(length);
|
||||
prop.subtype = subtype;
|
||||
prop.start = cpu_to_le64(range_lob(&s->reserved_regions[i].range));
|
||||
prop.end = cpu_to_le64(range_upb(&s->reserved_regions[i].range));
|
||||
prop.start = cpu_to_le64(range_lob(range));
|
||||
prop.end = cpu_to_le64(range_upb(range));
|
||||
|
||||
memcpy(buf, &prop, size);
|
||||
|
||||
|
@ -894,8 +895,8 @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr,
|
|||
goto unlock;
|
||||
}
|
||||
|
||||
for (i = 0; i < s->nb_reserved_regions; i++) {
|
||||
ReservedRegion *reg = &s->reserved_regions[i];
|
||||
for (i = 0; i < s->nr_prop_resv_regions; i++) {
|
||||
ReservedRegion *reg = &s->prop_resv_regions[i];
|
||||
|
||||
if (range_contains(®->range, addr)) {
|
||||
switch (reg->type) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue