qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] scsi-disk: export rotational qdev property


From: Aurelien Jarno
Subject: [Qemu-devel] [PATCH 2/3] scsi-disk: export rotational qdev property
Date: Sat, 6 May 2017 14:43:13 +0200

Export the rotational qdev property to the block device characteristics
VPD page.

Signed-off-by: Aurelien Jarno <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]