qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Rob Landley <rob@landley.net>, Thorsten Glaser <tg@debian.org>,
	Michael Tokarev <mjt@tls.msk.ru>,
	QEMU Developers <qemu-devel@nongnu.org>
Cc: security@debian.org,
	Debian QEMU Team <pkg-qemu-devel@lists.alioth.debian.org>,
	debian-ports@lists.debian.org,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Rich Felker <dalias@libc.org>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	linux-sh@vger.kernel.org
Subject: 64mb limitation of qemu-system-sh4 board
Date: Mon, 24 Nov 2025 08:31:03 +0100	[thread overview]
Message-ID: <b42433a7-e102-43f7-a7fa-1c9417a21146@linaro.org> (raw)
In-Reply-To: <79f14fef-123f-4938-b069-10f07e7d0405@landley.net>

On 24/8/25 20:07, Rob Landley wrote:
> On 8/23/25 09:19, Thorsten Glaser wrote:
>>> There are no alternatives - qemu is unique in this regard.  And
>>> it has never been designed for this usage.  What we had for 15+
>>> years, unnoticed, is like `chmod u+s /bin/sh`, which is never
>>> supposed to be used like this.
>>
>> Perhaps, but there’s shades in between.
> 
> I find qemu system emulation a LOT less problematic.
> 
> For sh4 I boot qemu-system-sh4 and then use a network block device to 
> provide swap (so the 64mb limitation of the board isn't a limiting 
> factor).

The R2D+ board uses a SH7751 SoC, which memory controller can access
7 external banks. This board has its boot flash on CS#0, a FPGA on CS#1,
64MB of SDRAM on CS#3, a SM501 display on CS#4 and some ISA bus on CS#5;
leaving CS#2, and CS#6 available. CS#2 can have SDRAM, while CS#6 only
SRAM (not really a difference in emulation).

 From QEMU side, we could fill these empty slots with 2*64MB of RAM, so
the machine could use up to 192MB. But then it is up to the guest to
use it.

Looking at Linux i.e. it seems to hardcode the RAM base/size in
arch/sh/include/asm/page.h, so we'd need changes there to use more
memory, which seems unlikely to get for a such old board...

> The sh4 build in toybox's mkroot works fine for this (binaries 
> at https://landley.net/bin/mkroot if you'd like to try). It also works 
> with -hda but I think can only provide _one_ of those so you have to 
> partition it, which I generally don't bother.
> 
> qemu-system-sh4: -hdb hdb.img: machine type does not support 
> if=ide,bus=0,unit=1
> qemu-system-sh4: -hdc hdc.img: machine type does not support 
> if=ide,bus=1,unit=0
> qemu-system-sh4: -hdd hdd.img: machine type does not support 
> if=ide,bus=1,unit=1
> 
> (You'd think it could at least do -hdb since that's just master/slave on 
> the same controller but the qemu guys never bothered to wire it up. 
> Anyway, I stick a 4gb ext3 image in /dev/sda so I have lots of scratch 
> space for builds because building on network filesystems tends to have 
> strange permission hiccups for me, or rm -rf fails because nfs didn't 
> _really_ delete a file that's still open but just renamed it, or...)
> 
> Anyway, this works fine on little endian, but the qemu-system-sh4eb 
> build has something hinky in the ethernet, I haven't tackled it myself 
> because I don't know whether the device emulation or the driver is 
> what's missing an endian swap. (I don't want to fix it the "wrong way", 
> and don't have big endian physical hardware lying around to try it on. I 
> moved _again_ at the start of the month, just unpacked the storage space 
> with those boxes into my sister's garage last weekend, but haven't 
> sorted very far yet.)
> 
> In theory I could use a swap _file_ instead of swap partition, and thus 
> a single /dev/hda would be plenty without partitioning it, but I haven't 
> tried? (When the network doesn't work I can't upload the results of the 
> build in an automated fashion anyway, so...)
> 
> You can speed this build process up further by hooking up distcc to call 
> out to the cross compiler, which lets you keep about -j3 busy before the 
> preprocessing, data transmission, and linking become the bottleneck. (I 
> mean ./configure is _always_ the bottleneck but that's because autoconf 
> is really stupid and largely pointless.) I had that distcc setup working 
> (and even automated) back in https://landley.net/aboriginal/about.html 
> and can help anyone interested fish the relevant bits out of those old 
> build scripts.
> 
>>> If you rely on suid/sgid *foreign* binaries, that's where the
>>> problem lies.
>>
>> Yes. People expect to be able to run foreign-arch chroots.
>> Entire buildd setups partly rely on this, too…
> 
> A qemu-system vm doesn't require any weird translation. As far as the 
> kernel running in the emulator is concerned, everything is entirely 
> native. :)
> 
> Rob
> 



  parent reply	other threads:[~2025-11-24  7:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <aKi6IWVX2uIlGKnw@seger.debian.org>
     [not found] ` <Pine.BSM.4.64L.2508230023030.21591@herc.mirbsd.org>
     [not found]   ` <6abe2750-5e2c-43a1-be57-1dc2ccabdd91@tls.msk.ru>
     [not found]     ` <119d5858-52f4-ce1b-9ee7-9615ce2054b9@debian.org>
     [not found]       ` <79f14fef-123f-4938-b069-10f07e7d0405@landley.net>
     [not found]         ` <CAMuHMdXZNroJF=s8gXj_vguGPGjUvgLu7w2PZxQg9tcHtSkNyg@mail.gmail.com>
2025-11-24  7:18           ` qemu-system-sh4eb build has something hinky in the ethernet Philippe Mathieu-Daudé
2025-11-24  7:31         ` Philippe Mathieu-Daudé [this message]
2025-11-24  7:33           ` 64mb limitation of qemu-system-sh4 board John Paul Adrian Glaubitz
2025-11-24  8:48             ` 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=b42433a7-e102-43f7-a7fa-1c9417a21146@linaro.org \
    --to=philmd@linaro.org \
    --cc=dalias@libc.org \
    --cc=debian-ports@lists.debian.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-sh@vger.kernel.org \
    --cc=mjt@tls.msk.ru \
    --cc=pkg-qemu-devel@lists.alioth.debian.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rob@landley.net \
    --cc=security@debian.org \
    --cc=tg@debian.org \
    --cc=ysato@users.sourceforge.jp \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).