From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQE9u-0007hH-Ue for qemu-devel@nongnu.org; Fri, 04 May 2012 04:46:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SQE9o-0007NB-B7 for qemu-devel@nongnu.org; Fri, 04 May 2012 04:46:38 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:40984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQE9o-0007G0-27 for qemu-devel@nongnu.org; Fri, 04 May 2012 04:46:32 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so4505829pbb.4 for ; Fri, 04 May 2012 01:46:31 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 4 May 2012 10:45:47 +0200 Message-Id: <1336121154-26517-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1336121154-26517-1-git-send-email-pbonzini@redhat.com> References: <1336121154-26517-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 07/14] scsi-disk: add dpofua property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Linux expects REQ_FUA to be advertised only if WRITE+FUA is faster than WRITE+SYNCHRONIZE CACHE, so we should not set the DPOFUA bit. However, it is useful to have it for testing purposes, so add a qdev property to set it. Signed-off-by: Paolo Bonzini --- hw/scsi-disk.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index e04b469..e0f1821 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -62,6 +62,7 @@ typedef struct SCSIDiskReq { } SCSIDiskReq; #define SCSI_DISK_F_REMOVABLE 0 +#define SCSI_DISK_F_DPOFUA 1 struct SCSIDiskState { @@ -1103,7 +1104,7 @@ static int scsi_disk_emulate_mode_sense(SCSIDiskReq *r, uint8_t *outbuf) p = outbuf; if (s->qdev.type == TYPE_DISK) { - dev_specific_param = 0x10; /* DPOFUA */ + dev_specific_param = s->features & (1 << SCSI_DISK_F_DPOFUA) ? 0x10 : 0; if (bdrv_is_read_only(s->qdev.conf.bs)) { dev_specific_param |= 0x80; /* Readonly. */ } @@ -1935,6 +1936,8 @@ static Property scsi_hd_properties[] = { DEFINE_SCSI_DISK_PROPERTIES(), DEFINE_PROP_BIT("removable", SCSIDiskState, features, SCSI_DISK_F_REMOVABLE, false), + DEFINE_PROP_BIT("dpofua", SCSIDiskState, features, + SCSI_DISK_F_DPOFUA, false), DEFINE_PROP_END_OF_LIST(), }; @@ -2038,6 +2041,8 @@ static Property scsi_disk_properties[] = { DEFINE_SCSI_DISK_PROPERTIES(), DEFINE_PROP_BIT("removable", SCSIDiskState, features, SCSI_DISK_F_REMOVABLE, false), + DEFINE_PROP_BIT("dpofua", SCSIDiskState, features, + SCSI_DISK_F_DPOFUA, false), DEFINE_PROP_END_OF_LIST(), }; -- 1.7.9.3