From: Bean Huo <beanhuo@iokpp.de>
To: Stanley Jhu <stanleyjhu@google.com>,
"Martin K. Petersen" <mkp@kernel.org>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
Jonathan Corbet <corbet@lwn.net>
Cc: Bart Van Assche <bvanassche@acm.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
Jeuk Kim <jeuk20.kim@samsung.com>,
linux-scsi@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: ufs: docs: Describe how to test with QEMU
Date: Mon, 12 Oct 2026 13:09:14 +0200 [thread overview]
Message-ID: <91cc71e731252e372d6cbfddf6a9f6ebbdf7bcca.camel@iokpp.de> (raw)
In-Reply-To: <20261011103319.820657-1-stanleyjhu@google.com>
Stanley,
Thanks, this is very useful, a few comments as below:
On Sun, 2026-10-11 at 18:33 +0800, Stanley Jhu wrote:
> QEMU emulates a UFS host controller and logical units, but the kernel
> tree does not mention it, so developers without UFS hardware have no
> documented way to exercise the UFS core.
>
> Add a short section with the required kernel options, an example QEMU
> command line, and what the emulation does not cover.
>
> Signed-off-by: Stanley Jhu <stanleyjhu@google.com>
> ---
> Documentation/scsi/ufs.rst | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/Documentation/scsi/ufs.rst b/Documentation/scsi/ufs.rst
> index a7b2b2ed1c3a..1ff1c8218bf1 100644
> --- a/Documentation/scsi/ufs.rst
> +++ b/Documentation/scsi/ufs.rst
> @@ -19,6 +19,7 @@ Universal Flash Storage
> 3.4 SCSI Error handling
> 4. BSG Support
> 5. UFS Reference Clock Frequency configuration
> + 6. Testing with QEMU
>
>
> 1. Overview
> @@ -208,3 +209,35 @@ the UFS specification. UFS subsystem will attempt to read
> the value when
> executing common controller initialization. If the value is available, UFS
> subsystem will ensure the bRefClkFreq attribute of the UFS storage device is
> set accordingly and will modify it if there is a mismatch.
> +
> +6. Testing with QEMU
> +====================
> +
> +QEMU emulates a UFS host controller as a PCI device named "ufs" and
> +logical units named "ufs-lu". This can be used to test changes to the
> +UFS core and to ufshcd-pci without UFS hardware.
> +
should here state the minimum QEMU version for the ufs device, and for mcq=on,
since the older version QEMU may not have them or one of them.
> +Enable the following kernel options on top of the architecture
> +defconfig::
> +
> + CONFIG_SCSI_UFSHCD=y
> + CONFIG_SCSI_UFSHCD_PCI=y
> + CONFIG_BLK_DEV_SD=y
> +
> +Example for an arm64 guest with one 1 GiB logical unit::
> +
> + qemu-img create -f raw ufs.img 1G
> + qemu-system-aarch64 -M virt -cpu max -smp 4 -m 2G -nographic \
> + -kernel arch/arm64/boot/Image -initrd rootfs.cpio.gz \
> + -append "console=ttyAMA0" \
> + -drive file=ufs.img,if=none,id=lu0,format=raw \
> + -device ufs,id=ufs0,serial=0001,mcq=on \
> + -device ufs-lu,drive=lu0,bus=ufs0,lun=0
> +
> +The logical unit appears as a SCSI disk (/dev/sda).
maybe here adds "for example"-> The logical unit appears as a SCSI disk (for
example /dev/sda)
> Drop "mcq=on" to
> +test the single doorbell mode instead of MCQ. The same -device options
> +work with qemu-system-x86_64.
> +
> +The emulation does not model UniPro, M-PHY, power mode changes,
I am cconfused by this statement, since I checked QEMU, the latest QEMU accepts
some UIC commands such as hibern8 enter/exit, if I am correct, here "accepts but
does not model" would be more precise, you can check hw/ufs/ufs.c:
static void ufs_process_uiccmd(UfsHc *u, uint32_t val)
> +hibernation or clock gating hardware, and vendor host drivers are not
> +exercised. Changes in those areas still need testing on real hardware.
Kind regards,
Bean
prev parent reply other threads:[~2026-10-12 11:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20261011103324epcas5p3005f6e64695166fb2d5fd2f788f7f47c@epcas5p3.samsung.com>
2026-10-11 10:33 ` Stanley Jhu
2026-10-12 5:04 ` Alim Akhtar
2026-10-12 11:09 ` Bean Huo [this message]
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=91cc71e731252e372d6cbfddf6a9f6ebbdf7bcca.camel@iokpp.de \
--to=beanhuo@iokpp.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=bvanassche@acm.org \
--cc=corbet@lwn.net \
--cc=jeuk20.kim@samsung.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mkp@kernel.org \
--cc=rdunlap@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=stanleyjhu@google.com \
/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
all inboxes | Powered by JetHome®