From patchwork Tue Jan 18 10:10:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 79279 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A17EEB7128 for ; Tue, 18 Jan 2011 21:14:31 +1100 (EST) Received: from localhost ([127.0.0.1]:58837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pf8a3-0000kM-R5 for incoming@patchwork.ozlabs.org; Tue, 18 Jan 2011 05:14:27 -0500 Received: from [140.186.70.92] (port=44660 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pf8Wt-0008At-El for qemu-devel@nongnu.org; Tue, 18 Jan 2011 05:11:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pf8Ws-0003Vb-CR for qemu-devel@nongnu.org; Tue, 18 Jan 2011 05:11:11 -0500 Received: from mtagate3.uk.ibm.com ([194.196.100.163]:59829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pf8Ws-0003VB-54 for qemu-devel@nongnu.org; Tue, 18 Jan 2011 05:11:10 -0500 Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate3.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p0IAB7vs000577 for ; Tue, 18 Jan 2011 10:11:07 GMT Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p0IAB9bi1208498 for ; Tue, 18 Jan 2011 10:11:09 GMT Received: from d06av09.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0IAB52n012270 for ; Tue, 18 Jan 2011 03:11:06 -0700 Received: from stefanha-thinkpad.manchester-maybrook.uk.ibm.com (dyn-9-174-219-24.manchester-maybrook.uk.ibm.com [9.174.219.24]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p0IAB5tL012248; Tue, 18 Jan 2011 03:11:05 -0700 From: Stefan Hajnoczi To: Date: Tue, 18 Jan 2011 10:10:40 +0000 Message-Id: <1295345442-16218-2-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1295345442-16218-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1295345442-16218-1-git-send-email-stefanha@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Kevin Wolf , Christoph Hellwig , "Justin M. Forbes" , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH v2 1/3] scsi-disk: Allow overriding SCSI INQUIRY removable bit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Provide the "removable" qdev property bit to override the SCSI INQUIRY removable (RMB) bit for non-CDROM devices. This will be used by USB Mass Storage Devices, which sometimes have this guest-visible bit set and sometimes do not. They therefore requires a means for user configuration. Signed-off-by: Stefan Hajnoczi --- hw/scsi-disk.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 6cb317c..db423ca 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -72,6 +72,7 @@ struct SCSIDiskState /* The qemu block layer uses a fixed 512 byte sector size. This is the number of 512 byte blocks in a single scsi sector. */ int cluster_size; + uint32_t removable; uint64_t max_lba; QEMUBH *bh; char *version; @@ -552,6 +553,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) memcpy(&outbuf[16], "QEMU CD-ROM ", 16); } else { outbuf[0] = 0; + outbuf[1] = s->removable ? 0x80 : 0; memcpy(&outbuf[16], "QEMU HARDDISK ", 16); } memcpy(&outbuf[8], "QEMU ", 8); @@ -1295,6 +1297,7 @@ static SCSIDeviceInfo scsi_disk_info = { DEFINE_BLOCK_PROPERTIES(SCSIDiskState, qdev.conf), DEFINE_PROP_STRING("ver", SCSIDiskState, version), DEFINE_PROP_STRING("serial", SCSIDiskState, serial), + DEFINE_PROP_BIT("removable", SCSIDiskState, removable, 1, false), DEFINE_PROP_END_OF_LIST(), }, };