All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Helge Deller" <deller@gmx.de>,
	"Richard Henderson" <rth@twiddle.net>,
	"Sven Schnelle" <svens@stackframe.org>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 2/3] hw/hppa/machine: Do not limit the RAM to 3840MB
Date: Thu, 9 Jan 2020 12:39:06 +0100	[thread overview]
Message-ID: <20200109123906.2a055feb@redhat.com> (raw)
In-Reply-To: <00d20bb2-cd8c-37fd-0709-9df1ca0d1545@redhat.com>

On Thu, 9 Jan 2020 12:09:26 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> On 1/9/20 11:15 AM, Igor Mammedov wrote:
> > On Wed,  8 Jan 2020 19:14:24 +0100
> > Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> >   
> >> The hardware expects DIMM slots of 1 or 2 GB, allowing up to
> >> 4 GB of memory. Accept the same amount of memory the hardware
> >> can deal with.
> >>
> >> The CPU doesn't have access to the RAM mapped in the
> >> [0xf0000000 - 0xf1000000] range because this is the PDC area
> >> (Processor Dependent Code) where the firmware is loaded.
> >> To keep this region with higher priority than the RAM, lower
> >> the RAM priority. The PDC will overlap it.
> >>
> >> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>  
> > Looks good to me (since board doesn't fix up ram_size and uses
> > whatever user specified, proper support for 4Gb could be done on top later).
> >   
> >> ---
> >>   hw/hppa/machine.c | 11 +++++------
> >>   1 file changed, 5 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
> >> index 6775d879f8..d10c967d06 100644
> >> --- a/hw/hppa/machine.c
> >> +++ b/hw/hppa/machine.c
> >> @@ -90,16 +90,15 @@ static void machine_hppa_init(MachineState *machine)
> >>           g_free(name);
> >>       }
> >>   
> >> -    /* Limit main memory. */
> >> -    if (ram_size > FIRMWARE_START) {
> >> -        machine->ram_size = ram_size = FIRMWARE_START;
> >> -    }
> >> -
> >>       /* Main memory region. */
> >> +    if (machine->ram_size > 4 * GiB) {  
> > Could it break a build on 32-bit mingw host?
> > (machine->ram_size is 32-bit on that host and condition would be
> > always false, tripping -Werror)  
> 
> By following Helge tip to restrict to 3GB, v2 of this series doesn't 
> have this problem :)
> 
> > that's why I've worked around it using local uint64_t in the last version
> >   "[PATCH v3 43/86] hppa: allow max ram size upto 4Gb"
> > coincidentally that would get rid of global ram_size usage
> > and leave only machine->ram_size on this board.  
> 
> Since I was not sure how you wanted to clean this, I haven't modified 
> it. We can add it on top but I'd rather do a whole codebase cleanup.
with 3Gb there is no actual need to do that,
Like you said having a separate tree wide clean up would be a better approach.

> 
> Note: you also need to modify hppa_machine_reset() by using ms->ram_size 
> instead.
> 
> >> +        error_report("RAM size of 4GB or more is not supported");
> >> +        exit(EXIT_FAILURE);
> >> +    }
> >>       ram_region = g_new(MemoryRegion, 1);
> >>       memory_region_allocate_system_memory(ram_region, OBJECT(machine),
> >>                                            "ram", ram_size);
> >> -    memory_region_add_subregion(addr_space, 0, ram_region);
> >> +    memory_region_add_subregion_overlap(addr_space, 0, ram_region, -1);
> >>   
> >>       /* Init Dino (PCI host bus chip).  */
> >>       pci_bus = dino_init(addr_space, &rtc_irq, &serial_irq);  
> > 
> >   
> 



  reply	other threads:[~2020-01-09 11:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 18:14 [PATCH 0/3] hw/hppa/machine: Do not limit the RAM to 3840MB Philippe Mathieu-Daudé
2020-01-08 18:14 ` [PATCH 1/3] hw/hppa/machine: Correctly check the firmware is in PDC range Philippe Mathieu-Daudé
2020-01-08 21:15   ` Helge Deller
2020-01-08 18:14 ` [PATCH 2/3] hw/hppa/machine: Do not limit the RAM to 3840MB Philippe Mathieu-Daudé
2020-01-08 21:39   ` Helge Deller
2020-01-08 23:45     ` Philippe Mathieu-Daudé
2020-01-09 10:15   ` Igor Mammedov
2020-01-09 11:09     ` Philippe Mathieu-Daudé
2020-01-09 11:39       ` Igor Mammedov [this message]
2020-01-08 18:14 ` [RFC PATCH 3/3] hw/hppa/machine: Warn when using more than 4095MB of RAM Philippe Mathieu-Daudé

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=20200109123906.2a055feb@redhat.com \
    --to=imammedo@redhat.com \
    --cc=deller@gmx.de \
    --cc=f4bug@amsat.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=svens@stackframe.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.