On Fri, May 20, 2011 at 05:03:34PM +0200, Paolo Bonzini wrote: > This allows passthrough of devices with LUN != 0, by redirecting them to > LUN0 in the emulated target.
I'm not quite sure what this code is for. Each /dev/sg device reresents a LUN. So if we want to suport multiple LUNs in qemu for devices that are backed by scsi-generic devices we need to take REPORT_LUNs emulation into the core scsi code, as any qemu target is completely independent of the underlying scsi device topology. In fact we could easily mix generic and scsi-disk LUNs on a single target. > + case INQUIRY: > + if (req->lun != s->lun) { This seems odd. I'd expect the SCSI core to handle the LUN addressing. For now that is just rejecting wrongs ones, and if multiple LUN support is added dispatching it to the correct drivers instance.