From: "Cédric Le Goater" <clg@kaod.org>
To: Peter Maydell <peter.maydell@linaro.org>, Peter Delevoryas <pdel@fb.com>
Cc: <andrew@aj.id.au>, <joel@jms.id.au>, <pbonzini@redhat.com>,
<berrange@redhat.com>, <eduardo@habkost.net>,
<marcel.apfelbaum@gmail.com>, <richard.henderson@linaro.org>,
<f4bug@amsat.org>, <ani@anisinha.ca>, <qemu-devel@nongnu.org>,
<qemu-arm@nongnu.org>, <kvm@vger.kernel.org>
Subject: Re: [PATCH 08/14] aspeed: Replace direct get_system_memory() calls
Date: Thu, 23 Jun 2022 17:39:22 +0200 [thread overview]
Message-ID: <6b7975b5-754b-c2d8-a46f-93a6f1827c66@kaod.org> (raw)
In-Reply-To: <CAFEAcA9GAr=Rv9GMsnUux3_PNk1gRPBOcSyPzD9MRP5UzOZO1Q@mail.gmail.com>
On 6/23/22 14:57, Peter Maydell wrote:
> On Thu, 23 Jun 2022 at 13:37, Peter Delevoryas <pdel@fb.com> wrote:
>>
>> Note: sysbus_mmio_map(), sysbus_mmio_map_overlap(), and others are still
>> using get_system_memory indirectly.
>>
>> Signed-off-by: Peter Delevoryas <pdel@fb.com>
>> ---
>> hw/arm/aspeed.c | 8 ++++----
>> hw/arm/aspeed_ast10x0.c | 5 ++---
>> hw/arm/aspeed_ast2600.c | 2 +-
>> hw/arm/aspeed_soc.c | 6 +++---
>> 4 files changed, 10 insertions(+), 11 deletions(-)
>>
>> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
>> index 8dae155183..3aa74e88fb 100644
>> --- a/hw/arm/aspeed.c
>> +++ b/hw/arm/aspeed.c
>> @@ -371,7 +371,7 @@ static void aspeed_machine_init(MachineState *machine)
>> amc->uart_default);
>> qdev_realize(DEVICE(&bmc->soc), NULL, &error_abort);
>>
>> - memory_region_add_subregion(get_system_memory(),
>> + memory_region_add_subregion(bmc->soc.system_memory,
>> sc->memmap[ASPEED_DEV_SDRAM],
>> &bmc->ram_container);
>
> This is board code, it shouldn't be reaching into the internals
> of the SoC object like this. The board code probably already
> has the right MemoryRegion because it was the one that passed
> it to the SoC link porperty in the first place.
It's a bit messy currently. May be I got it wrong initially. The
board allocates a ram container region in which the machine ram
region is mapped. See commit ad1a9782186d ("aspeed: add a RAM memory
region container")
There is an extra region after ram in the ram container to catch
invalid access done by FW. That's how FW determines the size of
ram. See commit ebe31c0a8ef7 ("aspeed: add a max_ram_size property
to the memory controller")
But I think I can safely move all the RAM logic under the board.
I will send a patch.
Thanks,
C.
>
> thanks
> -- PMM
next prev parent reply other threads:[~2022-06-23 15:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220623102617.2164175-1-pdel@fb.com>
[not found] ` <20220623102617.2164175-3-pdel@fb.com>
2022-06-23 12:11 ` [PATCH 02/14] sysbus: Remove sysbus_address_space Peter Maydell
[not found] ` <20220623102617.2164175-5-pdel@fb.com>
2022-06-23 12:15 ` [PATCH 04/14] sysbus: Add sysbus_mmio_map_in Peter Maydell
2022-06-23 18:29 ` Peter Delevoryas
[not found] ` <20220623102617.2164175-9-pdel@fb.com>
2022-06-23 12:57 ` [PATCH 08/14] aspeed: Replace direct get_system_memory() calls Peter Maydell
2022-06-23 15:39 ` Cédric Le Goater [this message]
2022-06-23 18:45 ` Peter Delevoryas
[not found] ` <20220623102617.2164175-13-pdel@fb.com>
2022-06-23 15:09 ` [PATCH 12/14] aspeed: Make aspeed_board_init_flashes public Cédric Le Goater
2022-06-23 18:43 ` Peter Delevoryas
2022-06-24 16:50 ` Cédric Le Goater
2022-06-29 9:11 ` Cédric Le Goater
2022-06-29 14:14 ` Alex Bennée
2022-06-29 15:54 ` Cédric Le Goater
2022-06-29 18:24 ` Alex Bennée
2022-06-30 8:49 ` Cédric Le Goater
2022-06-30 9:43 ` Alex Bennée
2022-07-05 12:35 ` Cédric Le Goater
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=6b7975b5-754b-c2d8-a46f-93a6f1827c66@kaod.org \
--to=clg@kaod.org \
--cc=andrew@aj.id.au \
--cc=ani@anisinha.ca \
--cc=berrange@redhat.com \
--cc=eduardo@habkost.net \
--cc=f4bug@amsat.org \
--cc=joel@jms.id.au \
--cc=kvm@vger.kernel.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=pdel@fb.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).