From patchwork Mon Jan 24 15:34:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 80183 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 AEEBD1007D1 for ; Tue, 25 Jan 2011 02:36:53 +1100 (EST) Received: from localhost ([127.0.0.1]:49955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhOTK-0000u8-Mr for incoming@patchwork.ozlabs.org; Mon, 24 Jan 2011 10:36:50 -0500 Received: from [140.186.70.92] (port=38409 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhORv-0000rb-V1 for qemu-devel@nongnu.org; Mon, 24 Jan 2011 10:35:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhORu-00022L-IW for qemu-devel@nongnu.org; Mon, 24 Jan 2011 10:35:23 -0500 Received: from mtagate2.uk.ibm.com ([194.196.100.162]:40906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhORu-000225-B4 for qemu-devel@nongnu.org; Mon, 24 Jan 2011 10:35:22 -0500 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate2.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p0OFZKFe012776 for ; Mon, 24 Jan 2011 15:35:20 GMT Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p0OFZN7O1491138 for ; Mon, 24 Jan 2011 15:35:23 GMT Received: from d06av08.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0OFZKah021773 for ; Mon, 24 Jan 2011 15:35:20 GMT Received: from stefanha-thinkpad.manchester-maybrook.uk.ibm.com (dyn-9-174-219-24.manchester-maybrook.uk.ibm.com [9.174.219.24]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p0OFZJUs021764; Mon, 24 Jan 2011 15:35:19 GMT From: Stefan Hajnoczi To: Date: Mon, 24 Jan 2011 15:34:58 +0000 Message-Id: <1295883301-7278-2-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1295883301-7278-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1295883301-7278-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 , Stefan Hajnoczi , Christoph Hellwig , "Justin M. Forbes" , Markus Armbruster Subject: [Qemu-devel] [PATCH v4 1/4] 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..488eedd 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, 0, false), DEFINE_PROP_END_OF_LIST(), }, };