Received: from eggs.gnu.org ([2001:4830:134:3::10]:38434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6z3S-0004K9-Md for qemu-devel@nongnu.org; Sat, 06 May 2017 08:43:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6z3R-0003WV-SV for qemu-devel@nongnu.org; Sat, 06 May 2017 08:43:22 -0400 From: Aurelien Jarno Date: Sat, 6 May 2017 14:43:13 +0200 Message-Id: <20170506124314.23354-2-aurelien@aurel32.net> In-Reply-To: <20170506124314.23354-1-aurelien@aurel32.net> References: <20170506124314.23354-1-aurelien@aurel32.net> Subject: [Qemu-devel] [PATCH 2/3] scsi-disk: export rotational qdev property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Markus Armbruster , Paolo Bonzini , John Snow , Max Reitz , Kevin Wolf , qemu-block@nongnu.org, Aurelien Jarno Export the rotational qdev property to the block device characteristics VPD page. Signed-off-by: Aurelien Jarno --- hw/scsi/scsi-disk.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index a53f058621..21b7e21a23 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -597,6 +597,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) outbuf[buflen++] = 0x83; // device identification if (s->qdev.type == TYPE_DISK) { outbuf[buflen++] = 0xb0; // block limits + outbuf[buflen++] = 0xb1; /* block device characteristics */ outbuf[buflen++] = 0xb2; // thin provisioning } break; @@ -739,6 +740,19 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) outbuf[43] = max_io_sectors & 0xff; break; } + case 0xb1: /* block device characteristics */ + { + buflen = 0x40; + memset(outbuf + 4, 0, buflen - 4); + + /* medium rotation rate: 0 = not reported, 1 = non-rotating */ + outbuf[4] = 0; + outbuf[5] = s->qdev.conf.rotational ? 0 : 1; + + /* nominal form factor */ + outbuf[7] = 0; /* not reported */ + break; + } case 0xb2: /* thin provisioning */ { buflen = 8; -- 2.11.0