Fix SCSI target off-by-one with vioscsi Assign max_target as the controller ID instead of zero, so that it does not obscure the device located at SCSI ID zero (like a disk) from being probed by scsi_probe_bus(). Copy the target requested onto the wire without decrementing it by one. Index: pci/vioscsi.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/vioscsi.c,v retrieving revision 1.21 diff -u -p -r1.21 vioscsi.c --- pci/vioscsi.c 13 Apr 2019 06:17:33 -0000 1.21 +++ pci/vioscsi.c 11 Jul 2020 23:22:37 -0000 @@ -194,7 +194,7 @@ vioscsi_attach(device_t parent, device_t chan->chan_channel = 0; chan->chan_ntargets = MIN(max_target, 16); /* cap reasonably */ chan->chan_nluns = MIN(max_lun, 1024); /* cap reasonably */ - chan->chan_id = 0; + chan->chan_id = max_target; chan->chan_flags = SCSIPI_CHAN_NOSETTLE; config_found(self, &sc->sc_channel, scsiprint); @@ -318,7 +318,7 @@ vioscsi_scsipi_request(struct scsipi_cha } req->lun[0] = 1; - req->lun[1] = periph->periph_target - 1; + req->lun[1] = periph->periph_target; req->lun[2] = 0x40 | ((periph->periph_lun >> 8) & 0x3F); req->lun[3] = periph->periph_lun & 0xFF; memset(req->lun + 4, 0, 4);