[PATCH 1/6] ppc/pegasos2: Restrict memory to 2 gigabytes

BALATON Zoltan posted 6 patches 4 years, 3 months ago
Maintainers: BALATON Zoltan <balaton@eik.bme.hu>
[PATCH 1/6] ppc/pegasos2: Restrict memory to 2 gigabytes
Posted by BALATON Zoltan 4 years, 3 months ago
The CHRP spec this board confirms to only allows 2 GiB of system
memory below 4 GiB as the high 2 GiB is allocated to IO and system
resources. To avoid problems with memory overlapping these areas
restrict RAM to 2 GiB similar to mac_newworld.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/ppc/pegasos2.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c
index b8ce859f1a..474cfdeabf 100644
--- a/hw/ppc/pegasos2.c
+++ b/hw/ppc/pegasos2.c
@@ -117,6 +117,10 @@ static void pegasos2_init(MachineState *machine)
     qemu_register_reset(pegasos2_cpu_reset, pm->cpu);
 
     /* RAM */
+    if (machine->ram_size > 2 * GiB) {
+        error_report("RAM size more than 2 GiB is not supported");
+        exit(1);
+    }
     memory_region_add_subregion(get_system_memory(), 0, machine->ram);
 
     /* allocate and load firmware */
-- 
2.21.4


Re: [PATCH 1/6] ppc/pegasos2: Restrict memory to 2 gigabytes
Posted by David Gibson 4 years, 3 months ago
On Thu, Oct 14, 2021 at 09:50:19PM +0200, BALATON Zoltan wrote:
> The CHRP spec this board confirms to only allows 2 GiB of system
> memory below 4 GiB as the high 2 GiB is allocated to IO and system
> resources. To avoid problems with memory overlapping these areas
> restrict RAM to 2 GiB similar to mac_newworld.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>

Applied, thanks.

> ---
>  hw/ppc/pegasos2.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c
> index b8ce859f1a..474cfdeabf 100644
> --- a/hw/ppc/pegasos2.c
> +++ b/hw/ppc/pegasos2.c
> @@ -117,6 +117,10 @@ static void pegasos2_init(MachineState *machine)
>      qemu_register_reset(pegasos2_cpu_reset, pm->cpu);
>  
>      /* RAM */
> +    if (machine->ram_size > 2 * GiB) {
> +        error_report("RAM size more than 2 GiB is not supported");
> +        exit(1);
> +    }
>      memory_region_add_subregion(get_system_memory(), 0, machine->ram);
>  
>      /* allocate and load firmware */

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson