From: Gavin Shan <gshan@redhat.com>
To: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org, maz@kernel.org, eric.auger@redhat.com,
cohuck@redhat.com, zhenyzha@redhat.com,
richard.henderson@linaro.org, peter.maydell@linaro.org,
shan.gavin@gmail.com
Subject: [PATCH v6 3/7] hw/arm/virt: Introduce variable region_base in virt_set_high_memmap()
Date: Mon, 24 Oct 2022 11:54:12 +0800 [thread overview]
Message-ID: <20221024035416.34068-4-gshan@redhat.com> (raw)
In-Reply-To: <20221024035416.34068-1-gshan@redhat.com>
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>
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
---
hw/arm/virt.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index e2ae88cf8b..0bf3cb7057 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1692,15 +1692,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;
/*
@@ -1709,9 +1709,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) {
@@ -1726,7 +1726,7 @@ static void virt_set_high_memmap(VirtMachineState *vms,
break;
}
- base += region_size;
+ base = region_base + region_size;
}
}
--
2.23.0
next prev parent reply other threads:[~2022-10-24 6:20 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 3:54 [PATCH v6 0/7] hw/arm/virt: Improve address assignment for high memory regions Gavin Shan
2022-10-24 3:54 ` [PATCH v6 1/7] hw/arm/virt: Introduce virt_set_high_memmap() helper Gavin Shan
2022-10-24 3:54 ` [PATCH v6 2/7] hw/arm/virt: Rename variable size to region_size in virt_set_high_memmap() Gavin Shan
2022-10-24 3:54 ` Gavin Shan [this message]
2022-10-24 3:54 ` [PATCH v6 4/7] hw/arm/virt: Introduce virt_get_high_memmap_enabled() helper Gavin Shan
2022-10-24 3:54 ` [PATCH v6 5/7] hw/arm/virt: Improve high memory region address assignment Gavin Shan
2022-10-25 16:29 ` Eric Auger
2022-10-26 0:33 ` Gavin Shan
2022-10-26 10:43 ` Cornelia Huck
2022-10-28 6:45 ` Gavin Shan
2022-10-24 3:54 ` [PATCH v6 6/7] hw/arm/virt: Add 'compact-highmem' property Gavin Shan
2022-10-25 10:30 ` Cornelia Huck
2022-10-25 16:33 ` Eric Auger
2022-10-26 3:16 ` Gavin Shan
2022-10-24 3:54 ` [PATCH v6 7/7] hw/arm/virt: Add properties to disable high memory regions Gavin Shan
2022-10-25 10:54 ` Cornelia Huck
2022-10-26 3:55 ` Gavin Shan
2022-10-26 11:10 ` Cornelia Huck
2022-10-28 6:53 ` Gavin Shan
2022-10-26 0:29 ` [PATCH v6 0/7] hw/arm/virt: Improve address assignment for " Gavin Shan
2022-10-28 18:06 ` Peter Maydell
2022-10-29 22:53 ` Gavin Shan
2022-10-29 11:29 ` Marc Zyngier
2022-10-29 22:49 ` Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221024035416.34068-4-gshan@redhat.com \
--to=gshan@redhat.com \
--cc=cohuck@redhat.com \
--cc=eric.auger@redhat.com \
--cc=maz@kernel.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shan.gavin@gmail.com \
--cc=zhenyzha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).