From: Jeuk Kim <jeuk20.kim@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
qemu-devel@nongnu.org
Cc: "Jeuk Kim" <jeuk20.kim@samsung.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
qemu-block@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Thomas Huth" <thuth@redhat.com>, "Fam Zheng" <fam@euphon.net>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PULL 4/5] hw/ufs: Support for UFS logical unit
Date: Thu, 21 Sep 2023 17:38:43 +0900 [thread overview]
Message-ID: <9a8f1e6e-edcf-416d-9508-8af666db4263@gmail.com> (raw)
In-Reply-To: <86ebcc33-491c-8820-2ca0-51d46b0b7375@redhat.com>
On 2023-09-15 4:59 PM, Paolo Bonzini wrote:
> On 9/15/23 00:19, Jeuk Kim wrote:
>> First, ufs-lu has a feature called "unit descriptor". This feature
>> shows the status of the ufs-lu
>>
>> and only works with UFS-specific "query request" commands, not SCSI
>> commands.
>
> This looks like something that can be implemented in the UFS subsystem.
>
>> UFS also has something called a well-known lu. Unlike typical SCSI
>> devices, where each lu is independent,
>> UFS can control other lu's through the well-known lu.
>
> This can also be implemented in UfsBus.
>
>> Finally, UFS-LU will have features that SCSI-HD does not have, such
>> as the zone block command.
>
> These should be implemented in scsi-hd as well.
>
>> In addition to this, I wanted some scsi commands to behave
>> differently from scsi-hd, for example,
>> the Inquiry command should read "QEMU UFS" instead of "QEMU HARDDISK",
>> and the mode_sense_page command should have a different result.
>
> Some of these don't have much justification, and others (such as the
> control page) could be done in scsi-hd as well.
>
> We should look into cleaning this up and making ufs-lu share a lot
> more code with scsi-hd; possibly even supporting -device scsi-hd with
> UFS devices. I am not going to ask you for a revert, but if this is
> not done before 8.2 is out, I will ask you to disable it by default in
> hw/ufs/Kconfig.
>
> In the future, please Cc the SCSI maintainers for UFS patches.
>
> Paolo
>
Dear Paolo
Hi. I've been looking into how ufs-lu can share code with scsi-hd.
I have verified that ufs-lu can use scsi-hd's code, and I would like to modify it to do so.
I've validated two possible fixes.
I'd like to hear your thoughts.
Option1.
As you mentioned, using ufsbus, which inherits from scsibus, removes the ufs-lu device type and use scsi-hd. (like -device ufs,id=ufs0 -device scsi-hd,bus=ufs0)
I've verified that this method is implementable, except for one problem.
Because we are using the scsi-hd type instead of the ufs-lu type, the ufs has to manage all the ufs-lu specific data (such as the unit descriptor).
However, since there is no ufs_lu_realize() function, we need a way to notify the ufs when a new scsi-hd device is added.
Would there be a way to let the ufs know that a new scsi-hd has been added at scsi_hd_realize() time?
Option 2.
Use qdev_new() & qdev_realize() to make ufs-lu have a virtual scsi bus and scsi-hd.
The ufs-lu can pass through SCSI commands to the virtual scsi-hd.
This is similar to the method used by the device "usb-storage".
With this method, I can keep the ufs-lu device type (ufs_lu_realize() makes it convenient to manage ufs-lu related data) and avoid duplicating code with scsi-hd.
So I prefer this approach, but the annotation for "usb-storage" is marked with a "Hack alert", so I'm not sure if this is the right way.
The code can be found in usb_msd_storage_realize() (hw/usb/dev-storage-classic.c:51).
I am wondering if you could give me some advice on this and your preferred direction for fixing it.
Thank you so much.
Jeuk
next prev parent reply other threads:[~2023-09-21 8:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 18:16 [PULL 0/5] Block patches Stefan Hajnoczi
2023-09-07 18:16 ` [PULL 1/5] iothread: Set the GSource "name" field Stefan Hajnoczi
2023-09-07 18:16 ` [PULL 2/5] hw/ufs: Initial commit for emulated Universal-Flash-Storage Stefan Hajnoczi
2023-09-07 18:16 ` [PULL 3/5] hw/ufs: Support for Query Transfer Requests Stefan Hajnoczi
2023-09-14 14:40 ` Peter Maydell
2023-09-14 22:28 ` Jeuk Kim
2023-09-07 18:16 ` [PULL 4/5] hw/ufs: Support for UFS logical unit Stefan Hajnoczi
2023-09-14 14:27 ` Peter Maydell
2023-09-14 14:47 ` Peter Maydell
2023-09-14 17:31 ` Paolo Bonzini
2023-09-14 22:19 ` Jeuk Kim
2023-09-15 7:59 ` Paolo Bonzini
2023-09-18 4:41 ` Jeuk Kim
2023-09-18 4:52 ` Jeuk Kim
2023-09-21 8:38 ` Jeuk Kim [this message]
2023-10-04 1:18 ` Ping: " Jeuk Kim
2023-09-07 18:16 ` [PULL 5/5] tests/qtest: Introduce tests for UFS Stefan Hajnoczi
2023-09-08 15:55 ` [PULL 0/5] Block patches Stefan Hajnoczi
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=9a8f1e6e-edcf-416d-9508-8af666db4263@gmail.com \
--to=jeuk20.kim@gmail.com \
--cc=berrange@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=jeuk20.kim@samsung.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.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;
as well as URLs for NNTP newsgroup(s).