Re: [PATCH 21/26] hw/riscv: pfsoc: Fix Icicle Kit RAM size at 2 GiB

Chao Liu <[email protected]> Mon, 27 Jul 2026 13:33:58 +0800
Newsgroups org.nongnu.qemu-riscv,org.nongnu.qemu-devel
Message-ID <[email protected]>
On Thu, Jul 23, 2026 at 11:18:48PM +0800, Bin Meng wrote:
> The Icicle Kit has 2 GiB of RAM, and its firmware device tree
> describes that fixed capacity. The model currently defaults to
> 1537 MiB and accepts any larger size, allowing configurations
> that do not match the board.
> 
> Set the default to 2 GiB and reject every other size. Update the
> documentation and L2CC qtest command line accordingly.
> 
> Signed-off-by: Bin Meng <[email protected]>
Reviewed-by: Chao Liu <[email protected]>

Thanks,
Chao

> ---
> 
>  docs/system/riscv/microchip-icicle-kit.rst |  4 +---
>  hw/riscv/microchip_pfsoc.c                 | 15 ++++-----------
>  2 files changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/docs/system/riscv/microchip-icicle-kit.rst b/docs/system/riscv/microchip-icicle-kit.rst
> index 9809e94b84..3db2b3c7e3 100644
> --- a/docs/system/riscv/microchip-icicle-kit.rst
> +++ b/docs/system/riscv/microchip-icicle-kit.rst
> @@ -26,9 +26,7 @@ The ``microchip-icicle-kit`` machine supports the following devices:
>  * 2 GEM Ethernet controllers
>  * 1 SDHC storage controller
>  
> -The memory is set to 1537 MiB by default.  A sanity check on RAM size is
> -performed in the machine init routine to prompt user to increase the RAM size
> -to > 1537 MiB when less than 1537 MiB RAM is detected.
> +The machine has a fixed 2 GiB of RAM. Other memory sizes are rejected.
>  
>  Boot options
>  ------------
> diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c
> index a2fbc89222..b604f7008b 100644
> --- a/hw/riscv/microchip_pfsoc.c
> +++ b/hw/riscv/microchip_pfsoc.c
> @@ -557,10 +557,10 @@ static void microchip_icicle_kit_machine_init(MachineState *machine)
>      DriveInfo *dinfo = drive_get(IF_SD, 0, 0);
>      RISCVBootInfo boot_info;
>  
> -    /* Sanity check on RAM size */
> -    if (machine->ram_size < mc->default_ram_size) {
> +    /* The board has a fixed RAM size */
> +    if (machine->ram_size != mc->default_ram_size) {
>          char *sz = size_to_str(mc->default_ram_size);
> -        error_report("Invalid RAM size, should be bigger than %s", sz);
> +        error_report("Invalid RAM size, should be %s", sz);
>          g_free(sz);
>          exit(EXIT_FAILURE);
>      }
> @@ -770,14 +770,7 @@ static void microchip_icicle_kit_machine_class_init(ObjectClass *oc,
>      mc->default_ram_id = "microchip.icicle.kit.ram";
>      mc->auto_create_sdcard = true;
>  
> -    /*
> -     * Map 513 MiB high memory, the minimum required high memory size, because
> -     * HSS will do memory test against the high memory address range regardless
> -     * of physical memory installed.
> -     *
> -     * See memory_tests() in mss_ddr.c in the HSS source code.
> -     */
> -    mc->default_ram_size = 1537 * MiB;
> +    mc->default_ram_size = 2 * GiB;
>  
>      object_class_property_add(oc, "clint-timebase-frequency", "uint32_t",
>                                microchip_icicle_kit_get_clint_timebase_freq,
> -- 
> 2.34.1
>