qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PATCH 2/3] scsi-disk: export rotational q


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 2/3] scsi-disk: export rotational qdev property
Date: Sat, 6 May 2017 13:11:16 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 05/06/2017 09:43 AM, Aurelien Jarno wrote:
Export the rotational qdev property to the block device characteristics
VPD page.

Signed-off-by: Aurelien Jarno <address@hidden>

Reviewed-by: Philippe Mathieu-Daudé <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;




reply via email to

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