On 11/1/22 07:47, Bart Van Assche wrote: > From ZBC-1: > * RC BASIS = 0: The RETURNED LOGICAL BLOCK ADDRESS field indicates the > highest LBA of a contiguous range of zones that are not sequential write > required zones starting with the first zone. > * RC BASIS = 1: The RETURNED LOGICAL BLOCK ADDRESS field indicates the LBA > of the last logical block on the logical unit. > > The current scsi_debug READ CAPACITY response does not comply with the above > if there are one or more sequential write required zones. SCSI initiators > need a way to retrieve the largest valid LBA from SCSI devices. Reporting > the largest valid LBA if there are one or more sequential zones requires to > set the RC BASIS field in the READ CAPACITY response to one. Hence this > patch. > > Cc: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> > Cc: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx> > Suggested-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx> > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > --- > drivers/scsi/scsi_debug.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c > index 697fc57bc711..fec87296cf06 100644 > --- a/drivers/scsi/scsi_debug.c > +++ b/drivers/scsi/scsi_debug.c > @@ -1899,6 +1899,10 @@ static int resp_readcap16(struct scsi_cmnd *scp, > arr[14] |= 0x40; > } > > + /* Set RC BASIS = 1 for host-managed devices. */ No it is not necessarily set. It is up to the device vendor to choose if RC_BASIS is set or not, based on the device implementation. Applicability of RC = 0 or RC = 1 depends on the presence of conventional zones. so: 1) If there are conventional zones, then using RC_BASIS = 1 or = 0 are both OK with HM devices. In the case of RC_BASIS = 0, the host can issue a report zones and get the device max lba from the report header (sd_zbc.c does that). 2) If there are no conventional zones, then using RC_BASIS = 0 does not make much sense, but nothing in the ZBC text prevent it either... So we should refine this and maybe add an option to allow specifying rc basis ? > + if (devip->zmodel == BLK_ZONED_HM) > + arr[12] |= 1 << 4; > + > arr[15] = sdebug_lowest_aligned & 0xff; > > if (have_dif_prot) { -- Damien Le Moal Western Digital Research