|
|
7f1c5b |
From 305a369fd18f29914bf96cc181add532d435d8ed Mon Sep 17 00:00:00 2001
|
|
|
7f1c5b |
From: Gavin Shan <gshan@redhat.com>
|
|
|
7f1c5b |
Date: Wed, 21 Dec 2022 08:48:45 +0800
|
|
|
7f1c5b |
Subject: [PATCH 3/8] hw/arm/virt: Introduce variable region_base in
|
|
|
7f1c5b |
virt_set_high_memmap()
|
|
|
7f1c5b |
|
|
|
7f1c5b |
RH-Author: Gavin Shan <gshan@redhat.com>
|
|
|
7f1c5b |
RH-MergeRequest: 126: hw/arm/virt: Optimize high memory region address assignment
|
|
|
7f1c5b |
RH-Bugzilla: 2113840
|
|
|
7f1c5b |
RH-Acked-by: Eric Auger <eric.auger@redhat.com>
|
|
|
7f1c5b |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
7f1c5b |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7f1c5b |
RH-Commit: [3/8] 15de90df217d680ccc858b679898b3993e1c050a
|
|
|
7f1c5b |
|
|
|
7f1c5b |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2113840
|
|
|
7f1c5b |
|
|
|
7f1c5b |
This introduces variable 'region_base' for the base address of the
|
|
|
7f1c5b |
specific high memory region. It's the preparatory work to optimize
|
|
|
7f1c5b |
high memory region address assignment.
|
|
|
7f1c5b |
|
|
|
7f1c5b |
No functional change intended.
|
|
|
7f1c5b |
|
|
|
7f1c5b |
Signed-off-by: Gavin Shan <gshan@redhat.com>
|
|
|
7f1c5b |
Reviewed-by: Eric Auger <eric.auger@redhat.com>
|
|
|
7f1c5b |
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
7f1c5b |
Reviewed-by: Marc Zyngier <maz@kernel.org>
|
|
|
7f1c5b |
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
|
|
|
7f1c5b |
Message-id: 20221029224307.138822-4-gshan@redhat.com
|
|
|
7f1c5b |
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
7f1c5b |
(cherry picked from commit fa245799b9407fc7b561da185b3d889df5e16a88)
|
|
|
7f1c5b |
Signed-off-by: Gavin Shan <gshan@redhat.com>
|
|
|
7f1c5b |
---
|
|
|
7f1c5b |
hw/arm/virt.c | 12 ++++++------
|
|
|
7f1c5b |
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
7f1c5b |
|
|
|
7f1c5b |
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
|
|
7f1c5b |
index ca098d40b8..ddcf7ee2f8 100644
|
|
|
7f1c5b |
--- a/hw/arm/virt.c
|
|
|
7f1c5b |
+++ b/hw/arm/virt.c
|
|
|
7f1c5b |
@@ -1739,15 +1739,15 @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx)
|
|
|
7f1c5b |
static void virt_set_high_memmap(VirtMachineState *vms,
|
|
|
7f1c5b |
hwaddr base, int pa_bits)
|
|
|
7f1c5b |
{
|
|
|
7f1c5b |
- hwaddr region_size;
|
|
|
7f1c5b |
+ hwaddr region_base, region_size;
|
|
|
7f1c5b |
bool fits;
|
|
|
7f1c5b |
int i;
|
|
|
7f1c5b |
|
|
|
7f1c5b |
for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) {
|
|
|
7f1c5b |
+ region_base = ROUND_UP(base, extended_memmap[i].size);
|
|
|
7f1c5b |
region_size = extended_memmap[i].size;
|
|
|
7f1c5b |
|
|
|
7f1c5b |
- base = ROUND_UP(base, region_size);
|
|
|
7f1c5b |
- vms->memmap[i].base = base;
|
|
|
7f1c5b |
+ vms->memmap[i].base = region_base;
|
|
|
7f1c5b |
vms->memmap[i].size = region_size;
|
|
|
7f1c5b |
|
|
|
7f1c5b |
/*
|
|
|
7f1c5b |
@@ -1756,9 +1756,9 @@ static void virt_set_high_memmap(VirtMachineState *vms,
|
|
|
7f1c5b |
*
|
|
|
7f1c5b |
* For each device that doesn't fit, disable it.
|
|
|
7f1c5b |
*/
|
|
|
7f1c5b |
- fits = (base + region_size) <= BIT_ULL(pa_bits);
|
|
|
7f1c5b |
+ fits = (region_base + region_size) <= BIT_ULL(pa_bits);
|
|
|
7f1c5b |
if (fits) {
|
|
|
7f1c5b |
- vms->highest_gpa = base + region_size - 1;
|
|
|
7f1c5b |
+ vms->highest_gpa = region_base + region_size - 1;
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
|
|
|
7f1c5b |
switch (i) {
|
|
|
7f1c5b |
@@ -1773,7 +1773,7 @@ static void virt_set_high_memmap(VirtMachineState *vms,
|
|
|
7f1c5b |
break;
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
|
|
|
7f1c5b |
- base += region_size;
|
|
|
7f1c5b |
+ base = region_base + region_size;
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
|
|
|
7f1c5b |
--
|
|
|
7f1c5b |
2.31.1
|
|
|
7f1c5b |
|