hw/sh4/r2d: Raise amount of RAM from 64 to 192 MB
cover hw/sh4/r2d: Raise amount of RAM from 64 to 192 MB
It is possible to add more RAM on the R2D board:
- 1 real 64MB SDRAM
- 1 virtual 64MB SRAM (virtual because back then such SRAM size wouldn't exist).
Memory tree change with this series applied:
$ diff -uw a b
--- a 2025-11-24 10:48:58
+++ b 2025-11-24 10:49:30
@@ -1,4 +1,4 @@
-QEMU 10.0.0 monitor - type 'help' for more information
+QEMU 10.1.91 monitor - type 'help' for more information
(qemu) info mtree -f
FlatView #0
AS "memory", root: system
@@ -6,7 +6,7 @@
Root memory region: system
0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash
0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga
- 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram
+ 0000000008000000-000000000fffffff (prio 0, ram): ram
0000000010000000-00000000107fffff (prio 0, ram): sm501.local
0000000013e00000-0000000013e0006b (prio 0, i/o): sm501-system-config
0000000013e10040-0000000013e10053 (prio 0, i/o): sm501-i2c
@@ -16,6 +16,7 @@
0000000013f00000-0000000013f00053 (prio 0, i/o): sm501-2d-engine
000000001400080c-000000001400080f (prio 0, i/o): ide-mmio.2
0000000014001000-000000001400101f (prio 0, i/o): ide-mmio.1
+ 0000000018000000-000000001bffffff (prio 0, ram): ram @0000000008000000
000000001e080000-000000001e080003 (prio 0, i/o): intc @000000001e080000
000000001e080040-000000001e080043 (prio 0, i/o): intc @000000001e080040
000000001e080060-000000001e080063 (prio 0, i/o): intc @000000001e080060Philippe Mathieu-Daudé (13):
hw/sh4/r2d: Bail out early if user request invalid RAM size hw/sh4/r2d: Define BOOT_PARAMS_BASE
hw/sh4/r2d: Introduce sdram_base and sdram_size variables hw/sh4/r2d: Use memdev allocation for RAM
hw/sh4/r2d: Reword SH7750_BCR1 and SH7750_BCR2 initialization comments hw/sh4/r2d: Configure flash (CS#0) as 16-bit accessible hw/sh4/r2d: Introduce EXT_CS_BASE() macro and use it for SDRAM hw/sh4/r2d: Use EXT_CS_BASE() macro for boot flash device hw/sh4/r2d: Use EXT_CS_BASE() macro for FPGA device hw/sh4/r2d: Use EXT_CS_BASE() macro for display controller hw/sh4/r2d: Use EXT_CS_BASE() macro for pseudo ISA bus hw/sh4/r2d: Add 64MB of SDRAM in CS#2
hw/sh4/r2d: Add 64MB of SRAM in CS#6
hw/sh4/r2d.c | 76 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 20 deletions(-)
Signature · 1 line
2.51.0
PATCH 1/13 hw/sh4/r2d: Bail out early if user request invalid RAM size
Do not give false expectations, as this machine only uses 64MB of RAM.
--- hw/sh4/r2d.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/sh4/r2d.c +8 -0
@@ -251,6 +251,14 @@ static void r2d_init(MachineState *machine)USBBus *usb_bus;r2d_fpga_t *fpga; +switch (machine->ram_size) { +case 64 * MiB: +break ; +default : +error_report ("This machine can only use 64M of memory" ); +exit (EXIT_FAILURE ); + } + cpu =SUPERH_CPU (cpu_create (machine->cpu_type)); env = &cpu->env;
Signature · 1 line
2.51.0
Re: [PATCH-for-11.0 01/13] hw/sh4/r2d: Bail out early if user request invalid RAM size
Quoted 2 lines · Philippe Mathieu-Daudé
Do not give false expectations, as this machine only uses 64MB of RAM.
This broke my https://landley.net/bin/mkroot/0.8.13/sh4.tgz because every target in that directory does -m 256 as part of the template from https://github.com/landley/toybox/blob/0.8.13/mkroot/mkroot.sh#L333 which worked until now.
I can special case qemu-system-sh4 but that won't fix compatibility with existing shipped instances. Could you maybe just turn this into a warning instead of -Werror in production?
I fixed it up by hand for testing in the meantime, and it loaded the kernel with -m 192 but then initramfs couldn't find init. Without the patch series the same git version (942b0d378a1d) booted to a shell prompt. I can try to track down what happened in the morning...
Sorry if I missed newer stuff I should be testing instead, I've been a bit distracted.
Thanks,
Rob
Re: [PATCH-for-11.0 01/13] hw/sh4/r2d: Bail out early if user request invalid RAM size
Quoted 1 line · Rob Landley
I fixed it up by hand for testing in the meantime, and it loaded the kernel with -m 192 but then initramfs couldn't find init. Without the patch series the same git version (
942b0d378a1d) booted to a shell prompt. I can try to track down what happened in the morning...
Ah, it boots with the full patch stack applied for -m 64 but not -m 128. It's mapping in the extra memory that breaks it.
The initramfs doesn't seem to be extracting with the second memory block enabled? What's the diff in the output...
out2.txt 2025-12-31 01:42:47.359676340 -0600 renamed from out.txt 2025-12-31 01:42:33.487421358 -0600 +1 -4
@@ -105,7 +105,6 @@ NET: Registered PF_UNIX/PF_LOCAL protocol family PCI: CLS 0 bytes, default 32 Unpacking initramfs... -Freeing initrd memory: 528K workingset: timestamp_bits=30 max_order=14 bucket_order=0 squashfs: version 4.0 (2009/01/31) Phillip Lougher SuperH (H)SCI(F) driver initialized
@@ -121,50 +120,14 @@ Segment Routing with IPv6 In-situ OAM (IOAM) with IPv6 NET: Registered PF_PACKET protocol family +Freeing initrd memory: 528K netconsole: network logging started -check access for rdinit=/init failed: -2, ignoring -/dev/root: Can't open blockdev -VFS: Cannot open root device "" or unknown-block(1,0): error -6
... [filesystem list and panic dump elided]
- [<8c3d0e24>] kernel_init+0x0/0x104
-
-Rebooting in 1 seconds..
+devtmpfs: mounted
+Freeing unused kernel image (initmem) memory: 132K
+This architecture does not have kernel memory protection. +Run /init as init process
+8139cp 0000:00:02.0 eth0: link up, 100Mbps, full-duplex, lpa 0x05E1 +ESC[?7hType exit when done.
+$ exit
+reboot: Restarting system
Why on earth did the "freeing initrd memory" move? (Interrupts shouldn't be enabled until right before it spawns PID 1, unless they rewrote that part when I wasn't looking...)
Ah, the - is the fail and the + is the success, I'm guessing the extract failed and the error path freed it early. Possibly the new memory block is either overwriting the cpio.gz or changing where it lives in a way the kernel isn't finding it.
Anyway, you've got the tarball if you want to smoketest it yourself. Unless this is expected and we need kernel tweaks just to boot even when not using the new memory, in which case -m 256 warning and dropping down to 192 would _still_ lose backwards compatibility. (If there's an address range conflict, could the -initrd loaded contents be IN the new memory block, as if it had been loaded rather than a mapped in ROM?)
Thanks,
Rob
Re: [PATCH-for-11.0 01/13] hw/sh4/r2d: Bail out early if user request invalid RAM size
Quoted 39 lines · Rob Landley
Quoted 1 line · Rob Landley
I fixed it up by hand for testing in the meantime, and it loaded the kernel with -m 192 but then initramfs couldn't find init. Without the patch series the same git version (
942b0d378a1d) booted to a shell prompt. I can try to track down what happened in the morning...Ah, it boots with the full patch stack applied for -m 64 but not -m 128. It's mapping in the extra memory that breaks it.
The initramfs doesn't seem to be extracting with the second memory block enabled? What's the diff in the output...
out2.txt 2025-12-31 01:42:47.359676340 -0600 renamed from out.txt 2025-12-31 01:42:33.487421358 -0600 +0
-0@@ -105,7 +105,6 @@NET: Registered PF_UNIX/PF_LOCAL protocol family
PCI: CLS 0 bytes, default 32
Unpacking initramfs...
-Freeing initrd memory: 528K
workingset: timestamp_bits=30 max_order=14 bucket_order=0
squashfs: version 4.0 (2009/01/31) Phillip Lougher SuperH (H)SCI(F) driver initializedout2.txt 2025-12-31 01:42:47.359676340 -0600 renamed from out.txt 2025-12-31 01:42:33.487421358 -0600 +0
-0@@ -121,50 +120,14 @@Segment Routing with IPv6
In-situ OAM (IOAM) with IPv6
NET: RegisteredPF_PACKETprotocol family
+Freeing initrd memory: 528K
netconsole: network logging startedout2.txt 2025-12-31 01:42:47.359676340 -0600 renamed from out.txt 2025-12-31 01:42:33.487421358 -0600 +0
-3-check access for rdinit=/init failed: -2, ignoring -/dev/root: Can't open blockdev -VFS: Cannot open root device "" or unknown-block(1,0): error -6... [filesystem list and panic dump elided]
- [<8c3d0e24>]kernel_init+0x0/0x104out2.txt 2025-12-31 01:42:47.359676340 -0600 renamed from out.txt 2025-12-31 01:42:33.487421358 -0600 +8
-2- -Rebooting in 1 seconds.. +devtmpfs: mounted +Freeing unused kernel image (initmem) memory: 132K +This architecture does not have kernel memory protection. +Run /init as init process +8139cp 0000:00:02.0 eth0: link up, 100Mbps, full-duplex, lpa 0x05E1 +ESC[?7hType exit when done. +$ exit +reboot: Restarting system
Quoted 3 lines
Why on earth did the "freeing initrd memory" move? (Interrupts shouldn't be enabled until right before it spawns PID 1, unless they rewrote that part when I wasn't looking...)
Ah, the - is the fail and the + is the success, I'm guessing the extract failed and the error path freed it early. Possibly the new memory block is either overwriting the cpio.gz or changing where it lives in a way the kernel isn't finding it.
I don't know anything about this but have you tried comparing 'info mtree' output from QEMU Monitor to see what changed? That may show if some memory block moved or overlaps something now.
Quoted 1 line
Anyway, you've got the tarball if you want to smoketest it yourself. Unless this is expected and we need kernel tweaks just to boot even when not using the new memory, in which case -m 256 warning and dropping down to 192 would _still_ lose backwards compatibility. (If there's an address range conflict, could the -initrd loaded contents be IN the new memory block, as if it had been loaded rather than a mapped in ROM?)
The SH in QEMU is not much maintained and maybe there aren't many people to look at it so don't expect much help with it.
Regards,
BALATON Zoltan
Re: [PATCH-for-11.0 01/13] hw/sh4/r2d: Bail out early if user request invalid RAM size
Quoted 3 lines · BALATON Zoltan
Quoted 1 line
Ah, the - is the fail and the + is the success, I'm guessing the extract failed and the error path freed it early. Possibly the new memory block is either overwriting the cpio.gz or changing where it lives in a way the kernel isn't finding it.
I don't know anything about this
Unfortunately I know about it less than I like, but I'm digging into the code in the absence of further replies from people who presumably do know...
Quoted 1 line
but have you tried comparing 'info mtree' output from QEMU Monitor to see what changed? That may show if some memory block moved or overlaps something now.
I said "Possibly the new memory block is..." because the purpose of the patch series I was replying to was adding more memory blocks to the r2d board so it could have more than 64 megs ram. (Seems like this is like a 10 line change not a big series, but...) I was regression testing to see if unchanged kernels still worked fine, hence finding (what seems to be) a conflict with qemu's command line initrd loader. (Sorry for the delay following up, a dementia patient declared war on the city I live in.)
Alas "info mtree" is a bit verbose to wade through, although I'll probably take a swing at it if I can't parse the rest of this. (It would be nice if it WASN'T always printing 8 leading zeroes for every number on a 32 bit platform.) What I'd really like to get out of the monitor is the device tree, but that doesn't seem to be an option...
https://qemu-project.gitlab.io/qemu/system/monitor.html said that "info mem" is an option, but my qemu build disagred, so I did:
(qemu) info roms
info roms
addr=000000000c010000 size=0x000200 mem=ram name="boot_params" addr=000000000c800000 size=0x31e020 mem=ram name="./linux-kernel" addr=000000000d800000 size=0x084411 mem=ram name="./initramfs.cpio.gz" (qemu) info ramblock
Block Name PSize Offset
Used Total HVA RO
r2d.sdram 4 KiB 0x0000000000000000
0x0000000004000000 0x0000000004000000 0x00007fd6d7e00000 rw
r2d.flash 4 KiB 0x0000000004800000
0x0000000001000000 0x0000000001000000 0x00007fd6e2e00000 rw
sm501.local 4 KiB 0x0000000004000000
0x0000000000800000 0x0000000000800000 0x00007fd728c00000 rw
pci:02.0/rtl8139.rom 4 KiB 0x0000000005800000 0x0000000000040000 0x0000000000040000 0x00007fd728a00000 ro
Which SEEMS to say that the 64m of sram is at offset ZERO, despite hw/sh4/rd2.c (before all these patches) doing:
#define SDRAM_BASE 0x0c000000 /* Physical location of SDRAM: Area 3 */ #define SDRAM_SIZE 0x04000000
/* Allocate memory space */ memory_region_init_ram(sdram, NULL, "r2d.sdram", SDRAM_SIZE,
&error_fatal);
memory_region_add_subregion(address_space_mem, SDRAM_BASE, sdram);And then the boot params, kernel, and initrd.cpio.gz are loaded as _roms_ in what would otherwise be the ram area...? (Again, the docs are pointing me at nonexistent commands, so...)
I've just been reading the qemu source, but it's a bit eldritch in places and has bloated by about 3x since I last went through it...
You're right the mtree subset for "memory" shows things in the expected places, or at least sort of. (There's also address-space: I/O, cpu-memory-0, rtl8139, sh_pci_host, intc, timer, sh_pci, ANOTHER one called "memory", timer, sci, scif, rtl8139 _again_, I/O again, and then "system" seems to be "memory" again...)
"What does a kernel running on this emulated hardware see" would be a nice thing to get an answer to, but that doesn't appear to have occurred to the people who wrote "monitor". Or if it did, it's like -hda where the simple interface was deprecated, and it's one of the:
(qemu) info memdev
info memdev
(qemu) info memory-devices
info memory-devices
(qemu) info memory_size_summary
info memory_size_summary
base memory: 67108864
(Don't ask me why the first one has a blank line and the others don't. The third one doesn't say WHERE the memory is, or what mapping holes I could put more memory in...)
Hmmm... ah, this ALMOST seems to do what I want:
(qemu) info mtree -f
info mtree -f
FlatView #0
AS "memory", root: system
AS "cpu-memory-0", root: system
AS "sh_pci_host", root: bus master container
AS "rtl8139", root: bus master container
Root memory region: system
0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram 0000000010000000-00000000107fffff (prio 0, ram): sm501.local 0000000013e00000-0000000013e0006b (prio 0, i/o): sm501-system-config 0000000013e10040-0000000013e10053 (prio 0, i/o): sm501-i2c 0000000013e30000-0000000013e3001f (prio 0, i/o): serial 0000000013e40000-0000000013e400ff (prio 0, i/o): ohci 0000000013e80000-0000000013e80fff (prio 0, i/o): sm501-disp-ctrl 0000000013f00000-0000000013f00053 (prio 0, i/o): sm501-2d-engine 000000001400080c-000000001400080f (prio 0, i/o): ide-mmio.2 0000000014001000-000000001400101f (prio 0, i/o): ide-mmio.1 000000001e080000-000000001e080003 (prio 0, i/o): intc @000000001e080000 000000001e080040-000000001e080043 (prio 0, i/o): intc @000000001e080040 000000001e080060-000000001e080063 (prio 0, i/o): intc @000000001e080060 000000001e100000-000000001e10002f (prio 0, i/o): timer 000000001e200000-000000001e200223 (prio 0, i/o): sh_pci 000000001f000000-000000001f000fff (prio 0, i/o): memory @000000001f000000 000000001f800000-000000001f800fff (prio 0, i/o): memory @000000001f800000 000000001fc00000-000000001fc00fff (prio 0, i/o): memory @000000001fc00000 000000001fd00004-000000001fd00013 (prio 0, i/o): intc @000000001fd00004 000000001fd80000-000000001fd8002f (prio 0, i/o): timer 000000001fe00000-000000001fe00027 (prio 0, i/o): sci 000000001fe80000-000000001fe80027 (prio 0, i/o): scif 00000000f0000000-00000000f7ffffff (prio 0, i/o): cache-and-tlb 00000000fd040000-00000000fd0400ff (prio 1, i/o): rtl8139 00000000fe080000-00000000fe080003 (prio 0, i/o): intc @000000001e080000 00000000fe080040-00000000fe080043 (prio 0, i/o): intc @000000001e080040 00000000fe080060-00000000fe080063 (prio 0, i/o): intc @000000001e080060 00000000fe100000-00000000fe10002f (prio 0, i/o): timer 00000000fe200000-00000000fe200223 (prio 0, i/o): sh_pci 00000000fe240000-00000000fe240fff (prio 0, i/o): io 00000000fe241000-00000000fe2410ff (prio 1, i/o): rtl8139 00000000fe241100-00000000fe24ffff (prio 0, i/o): io @0000000000001100 00000000ff000000-00000000ff000fff (prio 0, i/o): memory @000000001f000000 00000000ff800000-00000000ff800fff (prio 0, i/o): memory @000000001f800000 00000000ffc00000-00000000ffc00fff (prio 0, i/o): memory @000000001fc00000 00000000ffd00004-00000000ffd00013 (prio 0, i/o): intc @000000001fd00004 00000000ffd80000-00000000ffd8002f (prio 0, i/o): timer 00000000ffe00000-00000000ffe00027 (prio 0, i/o): sci 00000000ffe80000-00000000ffe80027 (prio 0, i/o): scif
FlatView #1
AS "I/O", root: io
Root memory region: io
0000000000000000-0000000000000fff (prio 0, i/o): io 0000000000001000-00000000000010ff (prio 1, i/o): rtl8139 0000000000001100-000000000000ffff (prio 0, i/o): io @0000000000001100
Except for the "FlatView #1" part at the end? (Define "flat" if there's two of them...)
Quoted 1 line
The SH in QEMU is not much maintained
The subject says "Re: [PATCH... 01/13] because I was replying to a patch in a series to update sh in qemu.
Here's me first getting an sh4 kernel booted under qemu a couple decades ago now:
https://lists.gnu.org/archive/html/qemu-devel/2009-02/msg00961.html
I've regression tested both current linux/arch/sh and qemu-system-sh4 at least a couple times a year ever since: https://landley.net/bin/mkroot/latest/sh4.tgz is linux-6.17 because that was current at the time.
Quoted 1 line
and maybe there aren't many people to look at it so don't expect much help with it.
Other than the people I cc'd on the email, including the patch's author, the linux arch/sh maintainer, a previous linux arch/sh maintainer... (Who were all cc'd on the original patch series.)
Rob
Re: [PATCH-for-11.0 01/13] hw/sh4/r2d: Bail out early if user request invalid RAM size
Quoted 10 lines · Rob Landley
On 12/31/25 06:01, BALATON Zoltan wrote:
Which SEEMS to say that the 64m of sram is at offset ZERO, despite hw/sh4/rd2.c(before all these patches) doing:#define
SDRAM_BASE0x0c000000/* Physical location of SDRAM: Area 3 */ #defineSDRAM_SIZE0x04000000/* Allocate memory space */ memory_region_init_ram(sdram, NULL, "r2d.sdram",
SDRAM_SIZE,&error_fatal);
memory_region_add_subregion(address_space_mem, SDRAM_BASE, sdram);
Right, it looks like if I don't care what the real hardware is doing but just want to mangle the emulation to gimme a native build environment with enough ram to build linux from scratch etc in for the architecture, I can tweak hw/sh4/r2d2.c to have SDRAM_BASE of 0x4100000 and SDRAM_SIZE of 0xbf00000 which gives me ~200 megs, and then in the linux kernel config set CONFIG_MEMORY_START and CONFIG_MEMORY_SIZE to match and I don't even need a kernel patch, just a config change...
And yes!
Freeing unused kernel image (initmem) memory: 132K
This architecture does not have kernel memory protection. Run /init as init process
8139cp 0000:00:02.0 eth0: link up, 100Mbps, full-duplex, lpa 0x05E1 Type exit when done.
$ head /proc/cpuinfo machine : RTS7751R2D processor : 0 cpu family : sh4 cpu type : SH7751R cut : unknown cpu flags : fpu ptea cache type : split (harvard) icache size : 4KiB (2-way) dcache size : 4KiB (2-way) address sizes : 29 bits physical $ head /proc/meminfo MemTotal: 188356 kB MemFree: 182852 kB MemAvailable: 180324 kB Buffers: 0 kB Cached: 724 kB SwapCached: 0 kB Active: 620 kB Inactive: 292 kB Active(anon): 620 kB Inactive(anon): 292 kB
The kernel and qemu have to agree where the memory base is or the -kernel -initrd and -append can't hand off their blobs (which are relative to the start of the big SRAM block), but it works.
Sigh, I wouldn't need to patch qemu either if -m argument's csv format wasn't pointless. Instead of letting me specify address ranges (ala -m 64m@c0000000,16m@2000000), it's got:
-m [size=]megs[,slots=n,maxmem=size]
configure guest RAM
size: initial amount of guest memory
slots: number of hotplug slots (default: none)
maxmem: maximum amount of guest memory (default: none)
Which makes NO sense to me. (What's the point of specifying hotplug slots if I can't say what's IN each hotplug slot? Something somewhere in the board had to DEFINE the hardware slots, so what is the point of this slots= thing? You're just reiterating.)
Oh well. If I wanted to get clever I could read the -m 123 value, do a floor at the exiting 64 and a ceiling at 200, and subtract from the starting address to provide the requested amount of memory. So if you DON'T specify -m (or -m 64 the existing value), it works with existing kernels. And then you can just -m a different number and use a matching kernel .config to get more memory up to the "one bit contiguous block" size.
In theory with device tree support I wouldn't have to recompile the kernel to tell it about the extra memory. We did device tree support in the new j-core board, I wonder what it would take to use that as a model to port r2d...
(Alas I have NO IDEA how to add such support to qemu. Or how to teach its -kernel to load a vmlinux instead of mandating a zImage...)
But if I _did_ have device tree support there's a lot more places to shove ram into:
Quoted 2 lines
Root memory region: system 0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash
1000000-4000000 is a 64 meg gap
Quoted 1 line
0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga
The one it's using above.
Quoted 2 lines
000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram 0000000010000000-00000000107fffff (prio 0, ram): sm501.local
11000000-13e00000 is ~48 meg gap
Quoted 8 lines
0000000013e00000-0000000013e0006b (prio 0, i/o): sm501-system-config 0000000013e10040-0000000013e10053 (prio 0, i/o): sm501-i2c 0000000013e30000-0000000013e3001f (prio 0, i/o): serial 0000000013e40000-0000000013e400ff (prio 0, i/o): ohci 0000000013e80000-0000000013e80fff (prio 0, i/o): sm501-disp-ctrl 0000000013f00000-0000000013f00053 (prio 0, i/o): sm501-2d-engine 000000001400080c-000000001400080f (prio 0, i/o): ide-mmio.2 0000000014001000-000000001400101f (prio 0, i/o): ide-mmio.1
14100000-1e000000 is 128+48 meg gap.
Quoted 7 lines
000000001e080000-000000001e080003 (prio 0, i/o): intc @000000001e080000 000000001e080040-000000001e080043 (prio 0, i/o): intc @000000001e080040 000000001e080060-000000001e080063 (prio 0, i/o): intc @000000001e080060 000000001e100000-000000001e10002f (prio 0, i/o): timer 000000001e200000-000000001e200223 (prio 0, i/o):
sh_pci000000001f000000-000000001f000fff (prio 0, i/o): memory
@000000001f000000
Quoted 8 lines
000000001f800000-000000001f800fff (prio 0, i/o): memory
@000000001f800000
000000001fc00000-000000001fc00fff (prio 0, i/o): memory
@000000001fc00000
000000001fd00004-000000001fd00013 (prio 0, i/o): intc @000000001fd00004 000000001fd80000-000000001fd8002f (prio 0, i/o): timer 000000001fe00000-000000001fe00027 (prio 0, i/o): sci 000000001fe80000-000000001fe80027 (prio 0, i/o): scif
This one's huge but I vaguely recall some hardware limitations in the TLB or something? (I should ask.)
Still, the above adds up somewhere near 500 megs and that's PLENTY for doing real work on a 32 bit headless build node. (Honestly in mkroot I set even the 64 bit targets to 256 megs by default. When I do heavy lifting I run distcc hooked up to a cross compiler and have it move the heavy lifting of compilation outside the emulator while the build still _acts_ fully native, since there's only one set of headers, one set of libraries, and you can run anything you build and all the questions configure asks from uname and sysinfo and /proc and such get the right answers. The virtual network card becomes the bottleneck somewhere around -j3, not counting that "autoconf is always the bottleneck" even on -j32 build native machines. You can sing "autoconf is useless" to "every sperm is sacred", and I often do while it's endlessly running to ask three different ways if this system is compliant with posix-2008...)
And yes, I've been doing this for a while:
https://landley.net/aboriginal/about.html
https://landley.net/aboriginal/control-images/
Haven't learned how to set up a debian build node yet, but it's on the todo list. :)
Rob
Re: [PATCH-for-11.0 01/13] hw/sh4/r2d: Bail out early if user request invalid RAM size
Quoted 3 lines · Rob Landley
Right, it looks like if I don't care what the real hardware is doing but just want to mangle the emulation to gimme a native build environment with enough ram to build linux from scratch etc in for the architecture, I can tweak
hw/sh4/r2d2.cto haveSDRAM_BASEof0x4100000andSDRAM_SIZEof0xbf00000which gives me ~200 megs, and then in the linux kernel config setCONFIG_MEMORY_STARTandCONFIG_MEMORY_SIZEto match and I don't even need a kernel patch, just a config change...And yes!
...
Quoted 2 lines
$ head /proc/cpuinfo machine : RTS7751R2D
...
Quoted 6 lines
$ head /proc/meminfo MemTotal: 188356 kB MemFree: 182852 kB MemAvailable: 180324 kBThe kernel and qemu have to agree where the memory base is or the - kernel -initrd and -append can't hand off their blobs (which are relative to the start of the big SRAM block), but it works.
Here's a QEMU patch that Does The Thing, with -m wired up.
Rob
hw/sh4/r2d.c +29 -21
@@ -48,9 +48,6 @@#define FLASH_BASE 0x00000000#define FLASH_SIZE (16 * MiB) -#define SDRAM_BASE 0x0c000000/* Physical location of SDRAM: Area 3 */ -#define SDRAM_SIZE 0x04000000 -#define SM501_VRAM_SIZE 0x800000#define BOOT_PARAMS_OFFSET 0x0010000
@@ -234,9 +231,6 @@ static struct QEMU_PACKEDstatic void r2d_init (MachineState *machine) { -const char *kernel_filename = machine->kernel_filename; -const char *kernel_cmdline = machine->kernel_cmdline; -const char *initrd_filename = machine->initrd_filename;MachineClass *mc =MACHINE_GET_CLASS (machine);SuperHCPU *cpu;CPUSH4State *env;
@@ -250,6 +244,18 @@ static void r2d_init(MachineState *machine)PCIBus *pci_bus;USBBus *usb_bus;r2d_fpga_t *fpga; +unsigned sdram_base, sdram_size = machine->ram_size; + +/* Make <= 64 megs memory compatible with old/default kernels, otherwise +move start of slot 3 to put more RAM in preceding hole (Linux .config +must adjust CONFIG_MEMORY_START and CONFIG_MEMORY_SIZE to match.) */ + sdram_base =0xc000000 ; +if (machine->ram_size>64 *MiB) sdram_base -= machine->ram_size-64 *MiB; +/* Cap memory at size of available contiguous physical mapping */ +if (machine->ram_size>0xbf00000 ) { + sdram_size =0xbf00000 ; + sdram_base =0x4100000 ; + } cpu =SUPERH_CPU (cpu_create (machine->cpu_type)); env = &cpu->env;
@@ -260,8 +266,8 @@ static void r2d_init(MachineState *machine)qemu_register_reset (main_cpu_reset, reset_info);/* Allocate memory space */ -memory_region_init_ram (sdram,NULL ,"r2d.sdram" ,SDRAM_SIZE , &error_fatal); -memory_region_add_subregion (address_space_mem,SDRAM_BASE , sdram); +memory_region_init_ram (sdram,NULL ,"r2d.sdram" , sdram_size, &error_fatal); +memory_region_add_subregion (address_space_mem, sdram_base, sdram);/* Register peripherals */ s =sh7750_init (cpu, address_space_mem); fpga =r2d_fpga_init (address_space_mem,0x04000000 ,sh7750_irl (s));
@@ -325,15 +331,16 @@ static void r2d_init(MachineState *machine)/* Todo: register on board registers */ memset (&boot_params,0 ,sizeof (boot_params)); -if (kernel_filename) { +if (machine->kernel_filename) {int kernel_size; - kernel_size =load_image_targphys (kernel_filename, -SDRAM_BASE +LINUX_LOAD_OFFSET , + kernel_size =load_image_targphys (machine->kernel_filename, + sdram_base +LINUX_LOAD_OFFSET ,INITRD_LOAD_OFFSET -LINUX_LOAD_OFFSET ,NULL );if (kernel_size <0 ) { -error_report ("qemu: could not load kernel '%s'" , kernel_filename); +error_report ("qemu: could not load kernel '%s'" , + machine->kernel_filename);exit (1 ); }
@@ -343,19 +350,20 @@ static void r2d_init(MachineState *machine)address_space_stw (&address_space_memory,SH7750_BCR2 ,3 << (3 *2 ),MEMTXATTRS_UNSPECIFIED ,NULL );/* cs3 32bit */ /* Start from P2 area */ - reset_info->vector = (SDRAM_BASE +LINUX_LOAD_OFFSET ) |0xa0000000 ; + reset_info->vector = (sdram_base +LINUX_LOAD_OFFSET ) |0xa0000000 ; } -if (initrd_filename) { +if (machine->initrd_filename) {int initrd_size; - initrd_size =load_image_targphys (initrd_filename, -SDRAM_BASE +INITRD_LOAD_OFFSET , -SDRAM_SIZE -INITRD_LOAD_OFFSET , + initrd_size =load_image_targphys (machine->initrd_filename, + sdram_base +INITRD_LOAD_OFFSET , + sdram_size -INITRD_LOAD_OFFSET ,NULL );if (initrd_size <0 ) { -error_report ("qemu: could not load initrd '%s'" , initrd_filename); +error_report ("qemu: could not load initrd '%s'" , + machine->initrd_filename);exit (1 ); }
@@ -365,17 +373,17 @@ static void r2d_init(MachineState *machine) boot_params.initrd_size =tswap32 (initrd_size); } -if (kernel_cmdline) { +if (machine->kernel_cmdline) {/* * I see no evidence that this .kernel_cmdline buffer requires * NUL-termination, so using strncpy should be ok. */ -strncpy (boot_params.kernel_cmdline, kernel_cmdline, +strncpy (boot_params.kernel_cmdline, machine->kernel_cmdline,sizeof (boot_params.kernel_cmdline)); }rom_add_blob_fixed ("boot_params" , &boot_params,sizeof (boot_params), -SDRAM_BASE +BOOT_PARAMS_OFFSET ); + sdram_base +BOOT_PARAMS_OFFSET ); }static void r2d_machine_init (MachineClass *mc)
PATCH 2/13 hw/sh4/r2d: Define BOOT_PARAMS_BASE
In reply to Philippe Mathieu-DaudéLinux expects the boot_params structure at a fixed location.
--- hw/sh4/r2d.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/sh4/r2d.c +2 -1
@@ -53,6 +53,7 @@#define SM501_VRAM_SIZE 0x800000 +#define BOOT_PARAMS_BASE 0x0c000000#define BOOT_PARAMS_OFFSET 0x0010000/* CONFIG_BOOT_LINK_OFFSET of Linux kernel */ #define LINUX_LOAD_OFFSET 0x0800000
@@ -383,7 +384,7 @@ static void r2d_init(MachineState *machine) }rom_add_blob_fixed ("boot_params" , &boot_params,sizeof (boot_params), -SDRAM_BASE +BOOT_PARAMS_OFFSET ); +BOOT_PARAMS_BASE +BOOT_PARAMS_OFFSET ); }static void r2d_machine_init (MachineClass *mc)
Signature · 1 line
2.51.0
PATCH 3/13 hw/sh4/r2d: Introduce sdram_base and sdram_size variables
In reply to Philippe Mathieu-DaudéSoon RAM base / size won't be fixed, so introduce local variables for them.
--- hw/sh4/r2d.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
hw/sh4/r2d.c +9 -6
@@ -251,9 +251,12 @@ static void r2d_init(MachineState *machine)PCIBus *pci_bus;USBBus *usb_bus;r2d_fpga_t *fpga; +hwaddr sdram_base; +uint64_t sdram_size =SDRAM_SIZE ;switch (machine->ram_size) {case 64 * MiB: + sdram_base =SDRAM_BASE ;break ;default :error_report ("This machine can only use 64M of memory" );
@@ -269,8 +272,8 @@ static void r2d_init(MachineState *machine)qemu_register_reset (main_cpu_reset, reset_info);/* Allocate memory space */ -memory_region_init_ram (sdram,NULL ,"r2d.sdram" ,SDRAM_SIZE , &error_fatal); -memory_region_add_subregion (address_space_mem,SDRAM_BASE , sdram); +memory_region_init_ram (sdram,NULL ,"r2d.sdram" , sdram_size, &error_fatal); +memory_region_add_subregion (address_space_mem, sdram_base, sdram);/* Register peripherals */ s =sh7750_init (cpu, address_space_mem); fpga =r2d_fpga_init (address_space_mem,0x04000000 ,sh7750_irl (s));
@@ -338,7 +341,7 @@ static void r2d_init(MachineState *machine)int kernel_size; kernel_size =load_image_targphys (kernel_filename, -SDRAM_BASE +LINUX_LOAD_OFFSET , + sdram_base +LINUX_LOAD_OFFSET ,INITRD_LOAD_OFFSET -LINUX_LOAD_OFFSET ,NULL );if (kernel_size <0 ) {
@@ -352,15 +355,15 @@ static void r2d_init(MachineState *machine)address_space_stw (&address_space_memory,SH7750_BCR2 ,3 << (3 *2 ),MEMTXATTRS_UNSPECIFIED ,NULL );/* cs3 32bit */ /* Start from P2 area */ - reset_info->vector = (SDRAM_BASE +LINUX_LOAD_OFFSET ) |0xa0000000 ; + reset_info->vector = (sdram_base +LINUX_LOAD_OFFSET ) |0xa0000000 ; }if (initrd_filename) {int initrd_size; initrd_size =load_image_targphys (initrd_filename, -SDRAM_BASE +INITRD_LOAD_OFFSET , -SDRAM_SIZE -INITRD_LOAD_OFFSET , + sdram_base +INITRD_LOAD_OFFSET , + sdram_size -INITRD_LOAD_OFFSET ,NULL );if (initrd_size <0 ) {
Signature · 1 line
2.51.0
PATCH 4/13 hw/sh4/r2d: Use memdev allocation for RAM
In reply to Philippe Mathieu-DaudéMemdev allocated MemoryRegion is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region.
--- hw/sh4/r2d.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/sh4/r2d.c +4 -2
@@ -252,7 +252,7 @@ static void r2d_init(MachineState *machine)USBBus *usb_bus;r2d_fpga_t *fpga;hwaddr sdram_base; -uint64_t sdram_size =SDRAM_SIZE ; +uint64_t sdram_size = machine->ram_size;switch (machine->ram_size) {case 64 * MiB:
@@ -272,7 +272,7 @@ static void r2d_init(MachineState *machine)qemu_register_reset (main_cpu_reset, reset_info);/* Allocate memory space */ -memory_region_init_ram (sdram,NULL ,"r2d.sdram" , sdram_size, &error_fatal); +memory_region_init_alias (sdram,NULL ,"sdram" , machine->ram,0 , sdram_size);memory_region_add_subregion (address_space_mem, sdram_base, sdram);/* Register peripherals */ s =sh7750_init (cpu, address_space_mem);
@@ -396,6 +396,8 @@ static void r2d_machine_init(MachineClass *mc) mc->init = r2d_init; mc->block_default_type =IF_IDE ; mc->default_cpu_type =TYPE_SH7751R_CPU ; + mc->default_ram_size =64 * MiB; + mc->default_ram_id ="ram" ; mc->default_nic ="rtl8139" ; }
Signature · 1 line
2.51.0
PATCH 5/13 hw/sh4/r2d: Reword SH7750_BCR1 and SH7750_BCR2 initialization comments
In reply to Philippe Mathieu-Daudé--- hw/sh4/r2d.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
hw/sh4/r2d.c +6 -4
@@ -350,10 +350,12 @@ static void r2d_init(MachineState *machine) }/* initialization which should be done by firmware */ -address_space_stl (&address_space_memory,SH7750_BCR1 ,1 <<3 , -MEMTXATTRS_UNSPECIFIED ,NULL );/* cs3 SDRAM */ -address_space_stw (&address_space_memory,SH7750_BCR2 ,3 << (3 *2 ), -MEMTXATTRS_UNSPECIFIED ,NULL );/* cs3 32bit */ +address_space_stl (&address_space_memory,SH7750_BCR1 , + (1 <<3 ) |/* Areas 3 accessed as SDRAM */ +0 ,MEMTXATTRS_UNSPECIFIED ,NULL ); +address_space_stw (&address_space_memory,SH7750_BCR2 , + (0b11 <<2 *3 ) |/* Area 3 Bus width is 32 bits */ +0 ,MEMTXATTRS_UNSPECIFIED ,NULL );/* Start from P2 area */ reset_info->vector = (sdram_base +LINUX_LOAD_OFFSET ) |0xa0000000 ; }
Signature · 1 line
2.51.0
PATCH 6/13 hw/sh4/r2d: Configure flash (CS#0) as 16-bit accessible
In reply to Philippe Mathieu-Daudé--- hw/sh4/r2d.c | 1 + 1 file changed, 1 insertion(+)
hw/sh4/r2d.c +1 -0
@@ -355,6 +355,7 @@ static void r2d_init(MachineState *machine) 0, MEMTXATTRS_UNSPECIFIED, NULL);address_space_stw (&address_space_memory,SH7750_BCR2 , (0b11 <<2 *3 ) |/* Area 3 Bus width is 32 bits */ + (0b10 <<14 ) |/* Area 0 Bus Width is 16 bits */ 0 ,MEMTXATTRS_UNSPECIFIED ,NULL );/* Start from P2 area */ reset_info->vector = (sdram_base +LINUX_LOAD_OFFSET ) |0xa0000000 ;
Signature · 1 line
2.51.0
PATCH 7/13 hw/sh4/r2d: Introduce EXT_CS_BASE() macro and use it for SDRAM
In reply to Philippe Mathieu-DaudéThe SH7751 memory controller can access 7 external banks. The 64MB of SDRAM is on bank #3. Introduce the EXT_CS_BASE() macro and use it for SDRAM.
--- hw/sh4/r2d.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/sh4/r2d.c +4 -3
@@ -45,10 +45,11 @@#include "hw/block/flash.h" #include "exec/tswap.h" -#define FLASH_BASE 0x00000000 +#define EXT_CS_SIZE (64 * MiB) +#define EXT_CS_BASE (cs_index) ((cs_index) * EXT_CS_SIZE) +#define FLASH_SIZE (16 * MiB) -#define SDRAM_BASE 0x0c000000/* Physical location of SDRAM: Area 3 */ #define SDRAM_SIZE 0x04000000#define SM501_VRAM_SIZE 0x800000
@@ -256,7 +257,7 @@ static void r2d_init(MachineState *machine)switch (machine->ram_size) {case 64 * MiB: - sdram_base =SDRAM_BASE ; + sdram_base =EXT_CS_BASE (3 );/* 64M @CS3 */ break ;default :error_report ("This machine can only use 64M of memory" );
Signature · 1 line
2.51.0
PATCH 8/13 hw/sh4/r2d: Use EXT_CS_BASE() macro for boot flash device
In reply to Philippe Mathieu-Daudé--- hw/sh4/r2d.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/sh4/r2d.c +2 -1
@@ -252,6 +252,7 @@ static void r2d_init(MachineState *machine)PCIBus *pci_bus;USBBus *usb_bus;r2d_fpga_t *fpga; +const hwaddr flash_base =EXT_CS_BASE (0 );hwaddr sdram_base;uint64_t sdram_size = machine->ram_size;
@@ -321,7 +322,7 @@ static void r2d_init(MachineState *machine)* addressable in words of 16bit. */ dinfo =drive_get (IF_PFLASH ,0 ,0 ); -pflash_cfi02_register (0x0 ,"r2d.flash" ,FLASH_SIZE , +pflash_cfi02_register (flash_base,"r2d.flash" ,FLASH_SIZE , dinfo ?blk_by_legacy_dinfo (dinfo) :NULL ,64 * KiB,1 ,2 ,0x0001 ,0x227e ,0x2220 ,0x2200 ,0x555 ,0x2aa ,0 );
Signature · 1 line
2.51.0
PATCH 9/13 hw/sh4/r2d: Use EXT_CS_BASE() macro for FPGA device
In reply to Philippe Mathieu-Daudé--- hw/sh4/r2d.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/sh4/r2d.c +2 -1
@@ -253,6 +253,7 @@ static void r2d_init(MachineState *machine)USBBus *usb_bus;r2d_fpga_t *fpga;const hwaddr flash_base =EXT_CS_BASE (0 ); +const hwaddr fpga_base =EXT_CS_BASE (1 );hwaddr sdram_base;uint64_t sdram_size = machine->ram_size;
@@ -278,7 +279,7 @@ static void r2d_init(MachineState *machine)memory_region_add_subregion (address_space_mem, sdram_base, sdram);/* Register peripherals */ s =sh7750_init (cpu, address_space_mem); - fpga =r2d_fpga_init (address_space_mem,0x04000000 ,sh7750_irl (s)); + fpga =r2d_fpga_init (address_space_mem, fpga_base,sh7750_irl (s)); dev =qdev_new ("sh_pci" ); busdev =SYS_BUS_DEVICE (dev);
Signature · 1 line
2.51.0
PATCH 10/13 hw/sh4/r2d: Use EXT_CS_BASE() macro for display controller
In reply to Philippe Mathieu-Daudé--- hw/sh4/r2d.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/sh4/r2d.c +4 -3
@@ -254,6 +254,7 @@ static void r2d_init(MachineState *machine)r2d_fpga_t *fpga;const hwaddr flash_base =EXT_CS_BASE (0 );const hwaddr fpga_base =EXT_CS_BASE (1 ); +const hwaddr sm501_base =EXT_CS_BASE (4 );hwaddr sdram_base;uint64_t sdram_size = machine->ram_size;
@@ -295,11 +296,11 @@ static void r2d_init(MachineState *machine) dev =qdev_new ("sysbus-sm501" ); busdev =SYS_BUS_DEVICE (dev);qdev_prop_set_uint32 (dev,"vram-size" ,SM501_VRAM_SIZE ); -qdev_prop_set_uint64 (dev,"dma-offset" ,0x10000000 ); +qdev_prop_set_uint64 (dev,"dma-offset" , sm501_base);qdev_prop_set_chr (dev,"chardev" ,serial_hd (2 ));sysbus_realize_and_unref (busdev, &error_fatal); -sysbus_mmio_map (busdev,0 ,0x10000000 ); -sysbus_mmio_map (busdev,1 ,0x13e00000 ); +sysbus_mmio_map (busdev,0 , sm501_base); +sysbus_mmio_map (busdev,1 , sm501_base +0x3e00000 );sysbus_connect_irq (busdev,0 , &fpga->irq[SM501 ]);/* onboard CF (True IDE mode, Master only). */
Signature · 1 line
2.51.0
PATCH 11/13 hw/sh4/r2d: Use EXT_CS_BASE() macro for pseudo ISA bus
In reply to Philippe Mathieu-Daudé--- hw/sh4/r2d.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/sh4/r2d.c +3 -2
@@ -255,6 +255,7 @@ static void r2d_init(MachineState *machine)const hwaddr flash_base =EXT_CS_BASE (0 );const hwaddr fpga_base =EXT_CS_BASE (1 );const hwaddr sm501_base =EXT_CS_BASE (4 ); +const hwaddr isa_base =EXT_CS_BASE (5 );hwaddr sdram_base;uint64_t sdram_size = machine->ram_size;
@@ -310,8 +311,8 @@ static void r2d_init(MachineState *machine)sysbus_connect_irq (busdev,0 , &fpga->irq[CF_IDE ]);qdev_prop_set_uint32 (dev,"shift" ,1 );sysbus_realize_and_unref (busdev, &error_fatal); -sysbus_mmio_map (busdev,0 ,0x14001000 ); -sysbus_mmio_map (busdev,1 ,0x1400080c ); +sysbus_mmio_map (busdev,0 , isa_base +0x1000 ); +sysbus_mmio_map (busdev,1 , isa_base +0x080c );mmio_ide_init_drives (dev, dinfo,NULL );/*
Signature · 1 line
2.51.0
PATCH 12/13 hw/sh4/r2d: Add 64MB of SDRAM in CS#2
In reply to Philippe Mathieu-DaudéExpand maximum memory from 64MB to 128MB.
--- hw/sh4/r2d.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
hw/sh4/r2d.c +6 -1
@@ -263,8 +263,11 @@ static void r2d_init(MachineState *machine)case 64 * MiB: sdram_base =EXT_CS_BASE (3 );/* 64M @CS3 */ break ; +case 128 * MiB: + sdram_base =EXT_CS_BASE (2 );/* 64M @CS2, 64M@CS3 */ +break ;default : -error_report ("This machine can only use 64M of memory" ); +error_report ("This machine can only use 64M or 128M of memory" );exit (EXIT_FAILURE ); }
@@ -356,9 +359,11 @@ static void r2d_init(MachineState *machine)/* initialization which should be done by firmware */ address_space_stl (&address_space_memory,SH7750_BCR1 , + (1 <<2 ) |/* Areas 2 accessed as SDRAM */ (1 <<3 ) |/* Areas 3 accessed as SDRAM */ 0 ,MEMTXATTRS_UNSPECIFIED ,NULL );address_space_stw (&address_space_memory,SH7750_BCR2 , + (0b11 <<2 *2 ) |/* Area 2 Bus width is 32 bits */ (0b11 <<2 *3 ) |/* Area 3 Bus width is 32 bits */ (0b10 <<14 ) |/* Area 0 Bus Width is 16 bits */ 0 ,MEMTXATTRS_UNSPECIFIED ,NULL );
Signature · 1 line
2.51.0
PATCH 13/13 hw/sh4/r2d: Add 64MB of SRAM in CS#6
In reply to Philippe Mathieu-DaudéExpand maximum memory from 128MB to 192MB.
--- hw/sh4/r2d.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
hw/sh4/r2d.c +10 -1
@@ -245,6 +245,7 @@ static void r2d_init(MachineState *machine)ResetData *reset_info;struct SH7750State *s;MemoryRegion *sdram =g_new (MemoryRegion,1 ); +MemoryRegion *sram =g_new (MemoryRegion,1 );DriveInfo *dinfo;DeviceState *dev;SysBusDevice *busdev;
@@ -266,8 +267,15 @@ static void r2d_init(MachineState *machine)case 128 * MiB: sdram_base =EXT_CS_BASE (2 );/* 64M @CS2, 64M@CS3 */ break ; +case 192 * MiB: + sdram_base =EXT_CS_BASE (2 );/* 64M @CS2, 64M@CS3, 64M@CS6 */ + sdram_size =128 * MiB; +memory_region_init_alias (sram,NULL , +"sram" , machine->ram,128 * MiB,64 * MiB); +memory_region_add_subregion (address_space_mem,EXT_CS_BASE (6 ), sram); +break ;default : -error_report ("This machine can only use 64M or 128M of memory" ); +error_report ("This machine can only use 64M, 128M or 192M of memory" );exit (EXIT_FAILURE ); }
@@ -365,6 +373,7 @@ static void r2d_init(MachineState *machine)address_space_stw (&address_space_memory,SH7750_BCR2 , (0b11 <<2 *2 ) |/* Area 2 Bus width is 32 bits */ (0b11 <<2 *3 ) |/* Area 3 Bus width is 32 bits */ + (0b11 <<2 *6 ) |/* Area 6 Bus width is 32 bits */ (0b10 <<14 ) |/* Area 0 Bus Width is 16 bits */ 0 ,MEMTXATTRS_UNSPECIFIED ,NULL );/* Start from P2 area */
Signature · 1 line
2.51.0