hw/riscv: Modify MROM size to end at 0x10000
Subsystems (2)
PATCH v2 1/2 hw/riscv: Modify MROM size to end at 0x10000
From: Bin Meng <[email protected]>
At present the size of Mask ROM for sifive_u / spike / virt machines is set to 0x11000, which ends at an unusual address. This changes the size to 0xf000 so that it ends at 0x10000.
---
(no changes since v1)
hw/riscv/sifive_u.c | 2 +- hw/riscv/spike.c | 2 +- hw/riscv/virt.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
hw/riscv/sifive_u.c +1 -1
@@ -70,7 +70,7 @@ static const struct MemmapEntry {hwaddr size; } sifive_u_memmap[] = { [SIFIVE_U_DEBUG] = { 0x0, 0x100 }, - [SIFIVE_U_MROM] = { 0x1000, 0x11000 }, + [SIFIVE_U_MROM] = { 0x1000, 0xf000 }, [SIFIVE_U_CLINT] = { 0x2000000, 0x10000 }, [SIFIVE_U_L2LIM] = { 0x8000000, 0x2000000 }, [SIFIVE_U_PLIC] = { 0xc000000, 0x4000000 },
hw/riscv/spike.c +1 -1
@@ -57,7 +57,7 @@ static const struct MemmapEntry {hwaddr base;hwaddr size; } spike_memmap[] = { - [SPIKE_MROM] = { 0x1000, 0x11000 }, + [SPIKE_MROM] = { 0x1000, 0xf000 }, [SPIKE_CLINT] = { 0x2000000, 0x10000 }, [SPIKE_DRAM] = { 0x80000000, 0x0 }, };
hw/riscv/virt.c +1 -1
@@ -53,7 +53,7 @@ static const struct MemmapEntry {hwaddr size; } virt_memmap[] = { [VIRT_DEBUG] = { 0x0, 0x100 }, - [VIRT_MROM] = { 0x1000, 0x11000 }, + [VIRT_MROM] = { 0x1000, 0xf000 }, [VIRT_TEST] = { 0x100000, 0x1000 }, [VIRT_RTC] = { 0x101000, 0x1000 }, [VIRT_CLINT] = { 0x2000000, 0x10000 },
Signature · 1 line
2.7.4
PATCH v2 2/2 hw/riscv: sifive_u: Provide a reliable way for bootloader to detect whether it is running in QEMU
From: Bin Meng <[email protected]>
The reset vector codes are subject to change, e.g.: with recent fw_dynamic type image support, it breaks oreboot again.
Add a subregion in the MROM, with the size of machine RAM stored, so that we can provide a reliable way for bootloader to detect whether it is running in QEMU.
---
Changes in v2:
- correctly populate the value in little-endian
hw/riscv/sifive_u.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
hw/riscv/sifive_u.c +21 -0
@@ -88,6 +88,7 @@ static const struct MemmapEntry {#define OTP_SERIAL 1#define GEM_REVISION 0x10070109 +#define MROM_RAMSIZE_OFFSET 0xf8static void create_fdt (SiFiveUState *s,const struct MemmapEntry *memmap,uint64_t mem_size,const char *cmdline)
@@ -496,6 +497,26 @@ static void sifive_u_machine_init(MachineState *machine)riscv_rom_copy_firmware_info (memmap[SIFIVE_U_MROM ].base, memmap[SIFIVE_U_MROM ].size,sizeof (reset_vec), kernel_entry); + +/* +* Tell guest the machine ram size at MROM_RAMSIZE_OFFSET. +* On real hardware, the 64-bit value from MROM_RAMSIZE_OFFSET is zero. +* QEMU aware bootloader (e.g.: oreboot, U-Boot) can check value stored +* here to determine whether it is running in QEMU. +*/ + +uint32_t ram_size[2 ] = { + machine->ram_size, + ((uint64_t )(machine->ram_size)) >>32 + }; + +/* copy in the ram size in little_endian byte order */ +for (i =0 ; i <ARRAY_SIZE (ram_size); i++) { + ram_size[i] =cpu_to_le32 (ram_size[i]); + } +rom_add_blob_fixed_as ("mrom.ram_size" , ram_size,sizeof (ram_size), + memmap[SIFIVE_U_MROM ].base +MROM_RAMSIZE_OFFSET , + &address_space_memory); }static bool sifive_u_machine_get_start_in_flash (Object *obj,Error **errp)
Signature · 1 line
2.7.4
Re: [PATCH v2 2/2] hw/riscv: sifive_u: Provide a reliable way for bootloader to detect whether it is running in QEMU
Quoted 5 lines · Bin Meng
From: Bin Meng <[email protected]>
The reset vector codes are subject to change, e.g.: with recent
fw_dynamictype image support, it breaks oreboot again.
This is a recurring problem, I have another patch for Oreboot to fix the latest breakage.
Quoted 4 lines
Add a subregion in the MROM, with the size of machine RAM stored, so that we can provide a reliable way for bootloader to detect whether it is running in QEMU.
I don't really like this though. I would prefer that we don't encourage guest software to behave differently on QEMU. I don't think other upstream boards do this.
Besides Oreboot setting up the clocks are there any other users of this?
Alistair
Quoted 54 lines
Signed-off-by Bin Meng <[email protected]>---
Changes in v2:
- correctly populate the value in little-endianhw/riscv/sifive_u.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)hw/riscv/sifive_u.c +21
-1@@ -88,6 +88,7 @@ static const struct MemmapEntry {#define OTP_SERIAL 1#define GEM_REVISION 0x10070109 +#define MROM_RAMSIZE_OFFSET 0xf8static void create_fdt (SiFiveUState *s,const struct MemmapEntry *memmap,uint64_t mem_size,const char *cmdline)@@ -496,6 +497,26 @@ static void sifive_u_machine_init(MachineState *machine)riscv_rom_copy_firmware_info (memmap[SIFIVE_U_MROM ].base, memmap[SIFIVE_U_MROM ].size,sizeof (reset_vec), kernel_entry); + +/* +* Tell guest the machine ram size at MROM_RAMSIZE_OFFSET. +* On real hardware, the 64-bit value from MROM_RAMSIZE_OFFSET is zero. +* QEMU aware bootloader (e.g.: oreboot, U-Boot) can check value stored +* here to determine whether it is running in QEMU. +*/ + +uint32_t ram_size[2 ] = { + machine->ram_size, + ((uint64_t )(machine->ram_size)) >>32 + }; + +/* copy in the ram size in little_endian byte order */ +for (i =0 ; i <ARRAY_SIZE (ram_size); i++) { + ram_size[i] =cpu_to_le32 (ram_size[i]); + } +rom_add_blob_fixed_as ("mrom.ram_size" , ram_size,sizeof (ram_size), + memmap[SIFIVE_U_MROM ].base +MROM_RAMSIZE_OFFSET , + &address_space_memory); }static bool sifive_u_machine_get_start_in_flash (Object *obj,Error **errp) --2.7.4
Re: [PATCH v2 2/2] hw/riscv: sifive_u: Provide a reliable way for bootloader to detect whether it is running in QEMU
Quoted 11 lines · On Thu, 09 Jul 2020 15:09:18 PDT (-0700), [email protected] wrote:
Quoted 5 lines · Bin Meng
From: Bin Meng <[email protected]>
The reset vector codes are subject to change, e.g.: with recent
fw_dynamictype image support, it breaks oreboot again.This is a recurring problem, I have another patch for Oreboot to fix the latest breakage.
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Add a subregion in the MROM, with the size of machine RAM stored, so that we can provide a reliable way for bootloader to detect whether it is running in QEMU.
I don't really like this though. I would prefer that we don't encourage guest software to behave differently on QEMU. I don't think other upstream boards do this.
I agree. If you want an explicitly virtual board, use the virt board. Users of sifive_u are presumably trying to do their best to test against what the hardware does without actually using the hardware. Otherwise there should be no reason to use the sifive_u board, as it's just sticking a layer of complexity in the middle of everything.
Quoted 1 line
Besides Oreboot setting up the clocks are there any other users of this?
IIRC we have a scheme for handling the clock setup in QEMU where we accept pretty much any control write and then just return reads that say the PLLs have locked. I'd be in favor of improving the scheme to improve compatibility with the actual hardware, but adding some way for programs to skip the clocks because they know they're in QEMU seems like the wrong way to go.
Quoted 56 lines
Alistair
Quoted 54 lines
Signed-off-by Bin Meng <[email protected]>---
Changes in v2:
- correctly populate the value in little-endianhw/riscv/sifive_u.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)hw/riscv/sifive_u.c +21
-1@@ -88,6 +88,7 @@ static const struct MemmapEntry {#define OTP_SERIAL 1#define GEM_REVISION 0x10070109 +#define MROM_RAMSIZE_OFFSET 0xf8static void create_fdt (SiFiveUState *s,const struct MemmapEntry *memmap,uint64_t mem_size,const char *cmdline)@@ -496,6 +497,26 @@ static void sifive_u_machine_init(MachineState *machine)riscv_rom_copy_firmware_info (memmap[SIFIVE_U_MROM ].base, memmap[SIFIVE_U_MROM ].size,sizeof (reset_vec), kernel_entry); + +/* +* Tell guest the machine ram size at MROM_RAMSIZE_OFFSET. +* On real hardware, the 64-bit value from MROM_RAMSIZE_OFFSET is zero. +* QEMU aware bootloader (e.g.: oreboot, U-Boot) can check value stored +* here to determine whether it is running in QEMU. +*/ + +uint32_t ram_size[2 ] = { + machine->ram_size, + ((uint64_t )(machine->ram_size)) >>32 + }; + +/* copy in the ram size in little_endian byte order */ +for (i =0 ; i <ARRAY_SIZE (ram_size); i++) { + ram_size[i] =cpu_to_le32 (ram_size[i]); + } +rom_add_blob_fixed_as ("mrom.ram_size" , ram_size,sizeof (ram_size), + memmap[SIFIVE_U_MROM ].base +MROM_RAMSIZE_OFFSET , + &address_space_memory); }static bool sifive_u_machine_get_start_in_flash (Object *obj,Error **errp) --2.7.4
Re: [PATCH v2 2/2] hw/riscv: sifive_u: Provide a reliable way for bootloader to detect whether it is running in QEMU
Hi Palmer,
Quoted 21 lines · Palmer Dabbelt
Quoted 11 lines · On Thu, 09 Jul 2020 15:09:18 PDT (-0700), [email protected] wrote:
Quoted 5 lines · Bin Meng
From: Bin Meng <[email protected]>
The reset vector codes are subject to change, e.g.: with recent
fw_dynamictype image support, it breaks oreboot again.This is a recurring problem, I have another patch for Oreboot to fix the latest breakage.
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Add a subregion in the MROM, with the size of machine RAM stored, so that we can provide a reliable way for bootloader to detect whether it is running in QEMU.
I don't really like this though. I would prefer that we don't encourage guest software to behave differently on QEMU. I don't think other upstream boards do this.
Quoted 5 lines
I agree. If you want an explicitly virtual board, use the virt board. Users of
sifive_uare presumably trying to do their best to test against what the hardware does without actually using the hardware. Otherwise there should be no reason to use thesifive_uboard, as it's just sticking a layer of complexity in the middle of everything.
Understood. Then let's drop this patch.
Quoted 9 lines
Quoted 2 lines
Besides Oreboot setting up the clocks are there any other users of this?
IIRC we have a scheme for handling the clock setup in QEMU where we accept pretty much any control write and then just return reads that say the PLLs have locked. I'd be in favor of improving the scheme to improve compatibility with the actual hardware, but adding some way for programs to skip the clocks because they know they're in QEMU seems like the wrong way to go.
Yep, that's my question to Oreboot too.
U-Boot SPL can boot with QEMU and no problem was seen with clock settings in PRCI model in QEMU.
Regards,
Bin
Re: [PATCH v2 2/2] hw/riscv: sifive_u: Provide a reliable way for bootloader to detect whether it is running in QEMU
Quoted 43 lines · Bin Meng
Hi Palmer,
Quoted 21 lines · Palmer Dabbelt
Quoted 11 lines · On Thu, 09 Jul 2020 15:09:18 PDT (-0700), [email protected] wrote:
Quoted 5 lines · Bin Meng
From: Bin Meng <[email protected]>
The reset vector codes are subject to change, e.g.: with recent
fw_dynamictype image support, it breaks oreboot again.This is a recurring problem, I have another patch for Oreboot to fix the latest breakage.
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Add a subregion in the MROM, with the size of machine RAM stored, so that we can provide a reliable way for bootloader to detect whether it is running in QEMU.
I don't really like this though. I would prefer that we don't encourage guest software to behave differently on QEMU. I don't think other upstream boards do this.
Quoted 5 lines
I agree. If you want an explicitly virtual board, use the virt board. Users of
sifive_uare presumably trying to do their best to test against what the hardware does without actually using the hardware. Otherwise there should be no reason to use thesifive_uboard, as it's just sticking a layer of complexity in the middle of everything.Understood. Then let's drop this patch.
Quoted 9 lines
Quoted 2 lines
Besides Oreboot setting up the clocks are there any other users of this?
IIRC we have a scheme for handling the clock setup in QEMU where we accept pretty much any control write and then just return reads that say the PLLs have locked. I'd be in favor of improving the scheme to improve compatibility with the actual hardware, but adding some way for programs to skip the clocks because they know they're in QEMU seems like the wrong way to go.
Quoted 4 lines
Yep, that's my question to Oreboot too.
U-Boot SPL can boot with QEMU and no problem was seen with clock settings in PRCI model in QEMU.
I don't think it's an unsolvable problem. There is just little work on Oreboot to run on QEMU. I can dig into it a bit and see if I can find a better fix on the Oreboot side.
Alistair
Quoted 3 lines
Regards,
Bin
Re: [PATCH v2 2/2] hw/riscv: sifive_u: Provide a reliable way for bootloader to detect whether it is running in QEMU
Hi Alistair,
Quoted 45 lines · Alistair Francis
Quoted 43 lines · Bin Meng
Hi Palmer,
Quoted 21 lines · Palmer Dabbelt
Quoted 11 lines · On Thu, 09 Jul 2020 15:09:18 PDT (-0700), [email protected] wrote:
Quoted 5 lines · Bin Meng
From: Bin Meng <[email protected]>
The reset vector codes are subject to change, e.g.: with recent
fw_dynamictype image support, it breaks oreboot again.This is a recurring problem, I have another patch for Oreboot to fix the latest breakage.
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Add a subregion in the MROM, with the size of machine RAM stored, so that we can provide a reliable way for bootloader to detect whether it is running in QEMU.
I don't really like this though. I would prefer that we don't encourage guest software to behave differently on QEMU. I don't think other upstream boards do this.
Quoted 5 lines
I agree. If you want an explicitly virtual board, use the virt board. Users of
sifive_uare presumably trying to do their best to test against what the hardware does without actually using the hardware. Otherwise there should be no reason to use thesifive_uboard, as it's just sticking a layer of complexity in the middle of everything.Understood. Then let's drop this patch.
Quoted 9 lines
Quoted 2 lines
Besides Oreboot setting up the clocks are there any other users of this?
IIRC we have a scheme for handling the clock setup in QEMU where we accept pretty much any control write and then just return reads that say the PLLs have locked. I'd be in favor of improving the scheme to improve compatibility with the actual hardware, but adding some way for programs to skip the clocks because they know they're in QEMU seems like the wrong way to go.
Quoted 9 lines
Quoted 4 lines
Yep, that's my question to Oreboot too.
U-Boot SPL can boot with QEMU and no problem was seen with clock settings in PRCI model in QEMU.
I don't think it's an unsolvable problem. There is just little work on Oreboot to run on QEMU. I can dig into it a bit and see if I can find a better fix on the Oreboot side.
Can we remove the QEMU detect logic completely in Oreboot? Except the QSPI controller QEMU should be able to run Oreboot since it runs U-Boot SPL.
Regards,
Bin
Re: [PATCH v2 2/2] hw/riscv: sifive_u: Provide a reliable way for bootloader to detect whether it is running in QEMU
Quoted 54 lines · Bin Meng
Hi Alistair,
Quoted 50 lines · Alistair Francis
Quoted 47 lines · Bin Meng
Hi Palmer,
Quoted 21 lines · Palmer Dabbelt
Quoted 11 lines · On Thu, 09 Jul 2020 15:09:18 PDT (-0700), [email protected] wrote:
Quoted 5 lines · Bin Meng
From: Bin Meng <[email protected]>
The reset vector codes are subject to change, e.g.: with recent
fw_dynamictype image support, it breaks oreboot again.This is a recurring problem, I have another patch for Oreboot to fix the latest breakage.
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Add a subregion in the MROM, with the size of machine RAM stored, so that we can provide a reliable way for bootloader to detect whether it is running in QEMU.
I don't really like this though. I would prefer that we don't encourage guest software to behave differently on QEMU. I don't think other upstream boards do this.
Quoted 5 lines
I agree. If you want an explicitly virtual board, use the virt board. Users of
sifive_uare presumably trying to do their best to test against what the hardware does without actually using the hardware. Otherwise there should be no reason to use thesifive_uboard, as it's just sticking a layer of complexity in the middle of everything.Understood. Then let's drop this patch.
Quoted 9 lines
Quoted 2 lines
Besides Oreboot setting up the clocks are there any other users of this?
IIRC we have a scheme for handling the clock setup in QEMU where we accept pretty much any control write and then just return reads that say the PLLs have locked. I'd be in favor of improving the scheme to improve compatibility with the actual hardware, but adding some way for programs to skip the clocks because they know they're in QEMU seems like the wrong way to go.
Yep, that's my question to Oreboot too.
U-Boot SPL can boot with QEMU and no problem was seen with clock settings in PRCI model in QEMU.
Quoted 8 lines
Quoted 4 lines
I don't think it's an unsolvable problem. There is just little work on Oreboot to run on QEMU. I can dig into it a bit and see if I can find a better fix on the Oreboot side.
Can we remove the QEMU detect logic completely in Oreboot? Except the QSPI controller QEMU should be able to run Oreboot since it runs U-Boot SPL.
That is the eventual goal.
Alistair
Quoted 3 lines
Regards,
Bin
Re: [PATCH v2 2/2] hw/riscv: sifive_u: Provide a reliable way for bootloader to detect whether it is running in QEMU
In reply to Alistair FrancisHi Alistair,
Quoted 11 lines · Alistair Francis
Quoted 5 lines · Bin Meng
From: Bin Meng <[email protected]>
The reset vector codes are subject to change, e.g.: with recent
fw_dynamictype image support, it breaks oreboot again.This is a recurring problem, I have another patch for Oreboot to fix the latest breakage.
Can Oreboot be updated to remove the QEMU detection?
Quoted 10 lines
Quoted 4 lines
Add a subregion in the MROM, with the size of machine RAM stored, so that we can provide a reliable way for bootloader to detect whether it is running in QEMU.
I don't really like this though. I would prefer that we don't encourage guest software to behave differently on QEMU. I don't think other upstream boards do this.
Besides Oreboot setting up the clocks are there any other users of this?
I don't really have any specific reason, except for testing U-Boot SPL by relaxing the requirement of hardcoding the memory to 8G "-m 8G" as I indicated in the commit message below:
commit 3eaea6eb4e534f7b87c6eca808149bb671976800
Author: Bin Meng <[email protected]> Date: Mon Jun 15 17:50:41 2020 -0700
hw/riscv: sifive_u: Add a dummy DDR memory controller device
It is enough to simply map the SiFive FU540 DDR memory controller into the MMIO space using create_unimplemented_device(), to make the upstream U-Boot v2020.07 DDR memory initialization codes happy.
Note we do not generate device tree fragment for the DDR memory controller. Since the controller data in device tree consumes a very large space (see fu540-hifive-unleashed-a00-ddr.dtsi in the U-Boot source), and it is only needed by U-Boot SPL but not any operating system, we choose not to generate the fragment here. This also means when testing with U-Boot SPL, the device tree has to come from U-Boot SPL itself, but not the one generated by QEMU on the fly. The memory has to be set to 8GiB to match the real HiFive Unleashed board when invoking QEMU (-m 8G).
Cc'ing Pragnesh and Sagar as they wanted to test U-Boot SPL with QEMU and talked to me the other day.
Regards,
Bin
Re: [PATCH v2 2/2] hw/riscv: sifive_u: Provide a reliable way for bootloader to detect whether it is running in QEMU
Quoted 9 lines · Bin Meng
Hi Alistair,
Quoted 5 lines · Alistair Francis
Quoted 3 lines · Bin Meng
From: Bin Meng <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
The reset vector codes are subject to change, e.g.: with recent
fw_dynamictype image support, it breaks oreboot again.This is a recurring problem, I have another patch for Oreboot to fix the latest breakage.
Can Oreboot be updated to remove the QEMU detection?
In general I think it should be.
Right now it's not critical to do. I think from a QEMU perspective we have finished changing the "ROM" code so after this release we can update Oreboot and then it should settle down again.
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
Add a subregion in the MROM, with the size of machine RAM stored, so that we can provide a reliable way for bootloader to detect whether it is running in QEMU.
I don't really like this though. I would prefer that we don't encourage guest software to behave differently on QEMU. I don't think other upstream boards do this.
Quoted 5 lines
Quoted 1 line
Besides Oreboot setting up the clocks are there any other users of this?
I don't really have any specific reason, except for testing U-Boot SPL by relaxing the requirement of hardcoding the memory to 8G "-m 8G" as I indicated in the commit message below:
Yeah, I think that's just something we will have to deal with. If the guest expects 8GB and doesn't check the device tree passed to it then the user has to create 8GB of memory.
Alistair
Quoted 26 lines
commit
3eaea6eb4e534f7b87c6eca808149bb671976800Author: Bin Meng <[email protected]> Date: Mon Jun 15 17:50:41 2020 -0700hw/riscv:
sifive_u: Add a dummy DDR memory controller deviceIt is enough to simply map the SiFive FU540 DDR memory controller into the MMIO space using
create_unimplemented_device(), to make the upstream U-Boot v2020.07 DDR memory initialization codes happy.Note we do not generate device tree fragment for the DDR memory controller. Since the controller data in device tree consumes a very large space (see
fu540-hifive-unleashed-a00-ddr.dtsiin the U-Boot source), and it is only needed by U-Boot SPL but not any operating system, we choose not to generate the fragment here. This also means when testing with U-Boot SPL, the device tree has to come from U-Boot SPL itself, but not the one generated by QEMU on the fly. The memory has to be set to 8GiB to match the real HiFive Unleashed board when invoking QEMU (-m 8G).Cc'ing Pragnesh and Sagar as they wanted to test U-Boot SPL with QEMU and talked to me the other day.
Regards,
Bin
Re: [PATCH v2 2/2] hw/riscv: sifive_u: Provide a reliable way for bootloader to detect whether it is running in QEMU
Hi Alistair,
Quoted 38 lines · Alistair Francis
Quoted 9 lines · Bin Meng
Hi Alistair,
Quoted 5 lines · Alistair Francis
Quoted 3 lines · Bin Meng
From: Bin Meng <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
The reset vector codes are subject to change, e.g.: with recent
fw_dynamictype image support, it breaks oreboot again.This is a recurring problem, I have another patch for Oreboot to fix the latest breakage.
Can Oreboot be updated to remove the QEMU detection?
In general I think it should be.
Right now it's not critical to do. I think from a QEMU perspective we have finished changing the "ROM" code so after this release we can update Oreboot and then it should settle down again.
Quoted 12 lines
Quoted 11 lines
Quoted 5 lines
Add a subregion in the MROM, with the size of machine RAM stored, so that we can provide a reliable way for bootloader to detect whether it is running in QEMU.
I don't really like this though. I would prefer that we don't encourage guest software to behave differently on QEMU. I don't think other upstream boards do this.
Besides Oreboot setting up the clocks are there any other users of this?
Quoted 8 lines
Quoted 3 lines
I don't really have any specific reason, except for testing U-Boot SPL by relaxing the requirement of hardcoding the memory to 8G "-m 8G" as I indicated in the commit message below:
Yeah, I think that's just something we will have to deal with. If the guest expects 8GB and doesn't check the device tree passed to it then the user has to create 8GB of memory.
Note there are two reasons that why "-m 8G" is used to test U-Boot SPL:
1. U-Boot DDR driver is hardcoding memory to 8G, which I had a fix locally and will send U-Boot upstream soon.
2. U-Boot SPL has to use its own device tree because we don't want to update QEMU to include all the DDR register settings in the device tree which is very big.
Why I wanted to add this patch here is that I wanted to dynamically patch U-Boot SPL DT to use the actual ram size that QEMU instantiates. This way we can avoid editing U-Boot SPL DT to set the actual memory size.
Regards,
Bin
Alistair Francis
AppliedQuoted 9 lines · Bin Meng
From: Bin Meng <[email protected]>
At present the size of Mask ROM for
sifive_u/ spike / virt machines is set to0x11000, which ends at an unusual address. This changes the size to0xf000so that it ends at0x10000.Signed-off-by Bin Meng <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Thanks!
Applied to riscv-to-apply.next
Alistair
Quoted 52 lines
---
(no changes since v1)
hw/riscv/sifive_u.c | 2 +- hw/riscv/spike.c | 2 +- hw/riscv/virt.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)hw/riscv/sifive_u.c +1
-1@@ -70,7 +70,7 @@ static const struct MemmapEntry {hwaddr size; } sifive_u_memmap[] = { [SIFIVE_U_DEBUG] = { 0x0, 0x100 }, - [SIFIVE_U_MROM] = { 0x1000, 0x11000 }, + [SIFIVE_U_MROM] = { 0x1000, 0xf000 }, [SIFIVE_U_CLINT] = { 0x2000000, 0x10000 }, [SIFIVE_U_L2LIM] = { 0x8000000, 0x2000000 }, [SIFIVE_U_PLIC] = { 0xc000000, 0x4000000 },hw/riscv/spike.c +1
-1@@ -57,7 +57,7 @@ static const struct MemmapEntry {hwaddr base;hwaddr size; } spike_memmap[] = { - [SPIKE_MROM] = { 0x1000, 0x11000 }, + [SPIKE_MROM] = { 0x1000, 0xf000 }, [SPIKE_CLINT] = { 0x2000000, 0x10000 }, [SPIKE_DRAM] = { 0x80000000, 0x0 }, };hw/riscv/virt.c +1
-2@@ -53,7 +53,7 @@ static const struct MemmapEntry {hwaddr size; } virt_memmap[] = { [VIRT_DEBUG] = { 0x0, 0x100 }, - [VIRT_MROM] = { 0x1000, 0x11000 }, + [VIRT_MROM] = { 0x1000, 0xf000 }, [VIRT_TEST] = { 0x100000, 0x1000 }, [VIRT_RTC] = { 0x101000, 0x1000 }, [VIRT_CLINT] = { 0x2000000, 0x10000 }, --2.7.4