Skip to content

Commit

Permalink
hw/arm/virt: Introduce variable region_base in virt_set_high_memmap()
Browse files Browse the repository at this point in the history
This introduces variable 'region_base' for the base address of the
specific high memory region. It's the preparatory work to optimize
high memory region address assignment.

No functional change intended.

Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
Message-id: 20221029224307.138822-4-gshan@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
Gavin Shan authored and pm215 committed Dec 15, 2022
1 parent 370bea9 commit fa24579
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions hw/arm/virt.c
Expand Up @@ -1693,15 +1693,15 @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx)
static void virt_set_high_memmap(VirtMachineState *vms,
hwaddr base, int pa_bits)
{
hwaddr region_size;
hwaddr region_base, region_size;
bool fits;
int i;

for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) {
region_base = ROUND_UP(base, extended_memmap[i].size);
region_size = extended_memmap[i].size;

base = ROUND_UP(base, region_size);
vms->memmap[i].base = base;
vms->memmap[i].base = region_base;
vms->memmap[i].size = region_size;

/*
Expand All @@ -1710,9 +1710,9 @@ static void virt_set_high_memmap(VirtMachineState *vms,
*
* For each device that doesn't fit, disable it.
*/
fits = (base + region_size) <= BIT_ULL(pa_bits);
fits = (region_base + region_size) <= BIT_ULL(pa_bits);
if (fits) {
vms->highest_gpa = base + region_size - 1;
vms->highest_gpa = region_base + region_size - 1;
}

switch (i) {
Expand All @@ -1727,7 +1727,7 @@ static void virt_set_high_memmap(VirtMachineState *vms,
break;
}

base += region_size;
base = region_base + region_size;
}
}

Expand Down

0 comments on commit fa24579

Please sign in to comment.