From: Eric Auger <eric.auger@redhat.com>
To: Gavin Shan <gshan@redhat.com>, qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org, maz@kernel.org, cohuck@redhat.com,
zhenyzha@redhat.com, richard.henderson@linaro.org,
peter.maydell@linaro.org, shan.gavin@gmail.com
Subject: Re: [PATCH v5 4/6] hw/arm/virt: Introduce virt_get_high_memmap_enabled() helper
Date: Thu, 20 Oct 2022 06:57:58 +0200 [thread overview]
Message-ID: <34a15560-66e5-ab3d-5dba-c1cde4fe6946@redhat.com> (raw)
In-Reply-To: <20221011231832.149839-5-gshan@redhat.com>
On 10/12/22 01:18, Gavin Shan wrote:
> This introduces virt_get_high_memmap_enabled() helper, which returns
> the pointer to vms->highmem_{redists, ecam, mmio}. The pointer will
> be used in the subsequent patches.
>
> No functional change intended.
>
> Signed-off-by: Gavin Shan <gshan@redhat.com>
> Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Eric
> ---
> hw/arm/virt.c | 32 +++++++++++++++++++-------------
> 1 file changed, 19 insertions(+), 13 deletions(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 0bf3cb7057..ee98a8a3b6 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1689,14 +1689,31 @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx)
> return arm_cpu_mp_affinity(idx, clustersz);
> }
>
> +static inline bool *virt_get_high_memmap_enabled(VirtMachineState *vms,
> + int index)
> +{
> + bool *enabled_array[] = {
> + &vms->highmem_redists,
> + &vms->highmem_ecam,
> + &vms->highmem_mmio,
> + };
> +
> + assert(ARRAY_SIZE(extended_memmap) - VIRT_LOWMEMMAP_LAST ==
> + ARRAY_SIZE(enabled_array));
> + assert(index - VIRT_LOWMEMMAP_LAST < ARRAY_SIZE(enabled_array));
> +
> + return enabled_array[index - VIRT_LOWMEMMAP_LAST];
> +}
> +
> static void virt_set_high_memmap(VirtMachineState *vms,
> hwaddr base, int pa_bits)
> {
> hwaddr region_base, region_size;
> - bool fits;
> + bool *region_enabled, fits;
> int i;
>
> for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) {
> + region_enabled = virt_get_high_memmap_enabled(vms, i);
> region_base = ROUND_UP(base, extended_memmap[i].size);
> region_size = extended_memmap[i].size;
>
> @@ -1714,18 +1731,7 @@ static void virt_set_high_memmap(VirtMachineState *vms,
> vms->highest_gpa = region_base + region_size - 1;
> }
>
> - switch (i) {
> - case VIRT_HIGH_GIC_REDIST2:
> - vms->highmem_redists &= fits;
> - break;
> - case VIRT_HIGH_PCIE_ECAM:
> - vms->highmem_ecam &= fits;
> - break;
> - case VIRT_HIGH_PCIE_MMIO:
> - vms->highmem_mmio &= fits;
> - break;
> - }
> -
> + *region_enabled &= fits;
> base = region_base + region_size;
> }
> }
next prev parent reply other threads:[~2022-10-20 4:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 23:18 [PATCH v5 0/6] hw/arm/virt: Improve address assignment for high memory regions Gavin Shan
2022-10-11 23:18 ` [PATCH v5 1/6] hw/arm/virt: Introduce virt_set_high_memmap() helper Gavin Shan
2022-10-11 23:18 ` [PATCH v5 2/6] hw/arm/virt: Rename variable size to region_size in virt_set_high_memmap() Gavin Shan
2022-10-11 23:18 ` [PATCH v5 3/6] hw/arm/virt: Introduce variable region_base " Gavin Shan
2022-10-11 23:18 ` [PATCH v5 4/6] hw/arm/virt: Introduce virt_get_high_memmap_enabled() helper Gavin Shan
2022-10-19 13:50 ` Cornelia Huck
2022-10-20 4:57 ` Eric Auger [this message]
2022-10-11 23:18 ` [PATCH v5 5/6] hw/arm/virt: Improve high memory region address assignment Gavin Shan
2022-10-19 13:54 ` Cornelia Huck
2022-10-19 20:07 ` Eric Auger
2022-10-19 22:58 ` Gavin Shan
2022-10-11 23:18 ` [PATCH v5 6/6] hw/arm/virt: Add 'compact-highmem' property Gavin Shan
2022-10-19 14:00 ` Cornelia Huck
2022-10-19 23:08 ` Gavin Shan
2022-10-19 20:18 ` Eric Auger
2022-10-19 23:57 ` Gavin Shan
2022-10-20 9:44 ` Marc Zyngier
2022-10-20 11:13 ` 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=34a15560-66e5-ab3d-5dba-c1cde4fe6946@redhat.com \
--to=eric.auger@redhat.com \
--cc=cohuck@redhat.com \
--cc=gshan@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).