qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: eric.auger@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 v3 3/5] hw/arm/virt: Introduce variable region_base in virt_set_high_memmap()
Date: Thu, 29 Sep 2022 09:15:59 +1000	[thread overview]
Message-ID: <4e53182d-89f5-cd9e-fe71-073251bfe385@redhat.com> (raw)
In-Reply-To: <6e1b2667-b561-51ac-57af-123a393fc677@redhat.com>

Hi Eric,

On 9/28/22 10:10 PM, Eric Auger wrote:
> On 9/22/22 01:13, Gavin Shan wrote:
>> 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.
> Why is it a preparatory work (same comment for previous patch, ie [2/5]
> ). Are those changes really needed? why?
> 

In PATCH[4/5], @base argument is added to virt_set_high_memmap(), to
represent current global base address. With the optimization applied
in PATCH[4/5], @base isn't unconditionally updated to the top of the
iterated high memory region. So we need @region_base here (PATCH[3/5])
to track the aligned base address for the iterated high memory region,
which may or may be not updated to @base.

Since we have @region_base in PATCH[3/5], it'd better to have @region_size
in PATCH[2/5].

Actually, PATCH[1-3/5] are all preparatory patches for PATCH[4/5]. My
intention was to organize the patches in a way to keep the logical
change part simple enough, for easier review.

Thanks,
Gavin

>>
>> No functional change intended.
>>
>> Signed-off-by: Gavin Shan <gshan@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 187b3ee0e2..b0b679d1f4 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;
>>       }
>>   }
>>   
> 



  reply	other threads:[~2022-09-28 23:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 23:13 [PATCH v3 0/5] hw/arm/virt: Improve address assignment for high memory regions Gavin Shan
2022-09-21 23:13 ` [PATCH v3 1/5] hw/arm/virt: Introduce virt_set_high_memmap() helper Gavin Shan
2022-09-28 12:09   ` Eric Auger
2022-09-29 13:48   ` Cornelia Huck
2022-09-21 23:13 ` [PATCH v3 2/5] hw/arm/virt: Rename variable size to region_size in virt_set_high_memmap() Gavin Shan
2022-10-03  8:26   ` Eric Auger
2022-09-21 23:13 ` [PATCH v3 3/5] hw/arm/virt: Introduce variable region_base " Gavin Shan
2022-09-28 12:10   ` Eric Auger
2022-09-28 23:15     ` Gavin Shan [this message]
2022-10-03  8:26       ` Eric Auger
2022-10-03  8:27   ` Eric Auger
2022-09-21 23:13 ` [PATCH v3 4/5] hw/arm/virt: Improve high memory region address assignment Gavin Shan
2022-09-28 12:51   ` Eric Auger
2022-09-28 23:37     ` Gavin Shan
2022-10-03  8:44       ` Eric Auger
2022-10-03 22:17         ` Gavin Shan
2022-10-04  7:06           ` Eric Auger
2022-09-21 23:13 ` [PATCH v3 5/5] hw/arm/virt: Add 'highmem-compact' property Gavin Shan
2022-09-28 12:22   ` Eric Auger
2022-09-28 23:49     ` Gavin Shan
2022-09-29 10:27       ` Cornelia Huck
2022-09-29 11:21         ` Gavin Shan
2022-10-03  8:49       ` Eric Auger
2022-10-03 23:50         ` Gavin Shan
2022-09-22  1:50 ` [PATCH v3 0/5] hw/arm/virt: Improve address assignment for high memory regions Zhenyu Zhang

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=4e53182d-89f5-cd9e-fe71-073251bfe385@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).