thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-hw-arm-virt-Introduce-variable-region_base-in-virt_s.patch

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