How To Emulate An eMMC And SD Host Controller

2024-09-19 Thread darius . mcadam

Hello,

I'm developing a kernel for Arm64 and emulating it on QEMU. I'm using 
this version of QEMU:


QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.2)
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

I'm trying to emulate a SD host controller and an eMMC so I can test a 
SD host controller driver and an eMMC driver. Here's my emulation 
attempt:


qemu-system-aarch64 \
-machine virt,mte=off,virtualization=off,gic-version=3 \
-cpu cortex-a76 -smp 8,sockets=2 \
-m 4G \
-device sdhci-pci,sd-spec-version=3 -device sd-card,spec_version=3

For the virt board, the sdhci-pci host controller is the only one I saw 
supported, so I decided to use that. I didn't see an eMMC device, so I 
chose sd-card. I'm hoping that I can create a drive that provides an 
eMMC image to the sd-card that will allow me to test my SD host and eMMC 
drivers. But I don't know how to create the eMMC image. I read the 
qemu-img documentation but I'm still unsure how to do this.


So, my question is, how do I correctly emulate an eMMC on the virt 
board?


Thank you,
Darius

Re: How To Emulate An eMMC And SD Host Controller

2024-09-19 Thread Mihai Moldovan

* On 9/19/24 23:59, darius.mca...@goldkey.com wrote:
> [...]

QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.2)
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

>

[...]

>
For the virt board, thesdhci-pci host controller is the only one I saw 
supported, so I decided to use that. I didn't see an eMMC device, so I chose 
sd-card. I'm hoping that I can create a drive that provides an eMMC image to the 
sd-card that will allow me to test my SD host and eMMC drivers. But I don't know 
how to create the eMMC image. I read the qemu-img documentation but I'm still 
unsure how to do this.


So, my question is, how do I correctly emulate an eMMC on the virt board?


I can't directly help with that question, but your Qemu version is too old to 
support eMMC anyway.


According to 
https://gitlab.com/qemu-project/qemu/-/commit/e2f346aa98646e84eabe0256f89d08e89b1837cf 
you'll have to upgrade to 9.1.0.


Since you seem to be using Debian: unfortunately, bookworm-backports only 
contains 9.0.2, just like trixie. Sid, however, does contain 9.1.0, which is 
your target version. Another viable option might be to backport the version from 
sid to bookworm yourself, but I haven't checked the dependencies to figure out 
whether that's easily possible.




Mihai


OpenPGP_signature.asc
Description: OpenPGP digital signature