On Mon, Jun 19, 2023 at 08:16:27PM +0900, Jeuk Kim wrote: > On Fri, Jun 19, 2023, Stefan Hajnoczi wrote: > >On Fri, Jun 16, 2023 at 03:58:27PM +0900, Jeuk Kim wrote: > >> This commit adds support for ufs logical unit. > >> The LU handles processing for the SCSI command, > >> unit descriptor query request. > >> > >> This commit enables the UFS device to process > >> IO requests. > > > >Is UFS a SCSI Host Bus Adapter capable of exposing any SCSI device? The > >code is written as if UFS was a special-purpose SCSI bus that cannot > >handle regular SCSI devices already emulated by QEMU (like scsi-hd). As > >a result, it duplicates a lot of SCSI device code instead of just > >focussing on unwrapping/wrapping the SCSI commands and responses from > >the UFS interface. > > > >Would it be possible to have: > > > > --device ufs,id=<bus-name> > > --device scsi-hd,bus=<bus-name> > > > >? > > > >I think that would involve less code and be more flexible. > > > > Unfortunately, UFS is not a generic SCSI Host Bus Adapter. > UFS uses the SCSI specification to communicate with the driver, > but its behaviour is very different from that of a typical SCSI device. > (So it's intentional that UFS looks like a special-purpose SCSI bus.) > > For example, UFS has the well-known lu. > Unlike typical SCSI devices, where each lu is independent, > UFS can control other lu's through the well-known lu. > > Therefore, UFS can only work properly with ufs-lu, and not with > other scsi devices such as scsi-hd. :'( > > That's why I made the UFS bus and added the ufs_bus_check_address() > to prevent normal scsi devices and UFS from connecting to each other. > > Also, in the future, I will add more ufs-specific features > like hibernation and zoned, which are different from normal SCSI devices. > > So personally, I think we should define ufs-lu separately as we do now. > Is that okay?
Yes, I think that makes sense. Thanks for explaining. Paolo Bonzini is the QEMU SCSI emulation maintainer. He might have more thoughts about this. I have CCed him, but I think you can continue with the current approach unless Paolo decides to get involved in this patch series. Stefan
signature.asc
Description: PGP signature