From patchwork Mon Oct 4 13:29:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 66669 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 3E499B6F07 for ; Tue, 5 Oct 2010 00:53:46 +1100 (EST) Received: from localhost ([127.0.0.1]:40684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P2lU7-0000yz-9x for incoming@patchwork.ozlabs.org; Mon, 04 Oct 2010 09:53:43 -0400 Received: from [140.186.70.92] (port=49760 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P2lHT-0005SB-UI for qemu-devel@nongnu.org; Mon, 04 Oct 2010 09:40:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P2l6z-00023E-R8 for qemu-devel@nongnu.org; Mon, 04 Oct 2010 09:29:51 -0400 Received: from verein.lst.de ([213.95.11.210]:46896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P2l6z-00020H-G2 for qemu-devel@nongnu.org; Mon, 04 Oct 2010 09:29:49 -0400 Received: from verein.lst.de (localhost [127.0.0.1]) by verein.lst.de (8.12.3/8.12.3/Debian-7.1) with ESMTP id o94DTf88026859 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 4 Oct 2010 15:29:41 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-7.2) id o94DTfnL026858 for qemu-devel@nongnu.org; Mon, 4 Oct 2010 15:29:41 +0200 Date: Mon, 4 Oct 2010 15:29:41 +0200 From: Christoph Hellwig To: qemu-devel@nongnu.org Message-ID: <20101004132941.GA26834@lst.de> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Scanned-By: MIMEDefang 2.39 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH] ide: set WCACHE supported in IDENTIFY data 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 ATA does not only have the WCACHE enabled bit in identify word 85, but also a WCACHE supported bit in word 82. While the Linux kernel is fine with the latter at least hdparm also needs the former before correctly displaying the cache settings. There's also a non-zero chance other operating systems are more picky in their volatile write cache detection. Signed-off-by: Christoph Hellwig Index: qemu/hw/ide/core.c =================================================================== --- qemu.orig/hw/ide/core.c 2010-10-04 15:22:26.848003542 +0200 +++ qemu/hw/ide/core.c 2010-10-04 15:24:11.900255468 +0200 @@ -146,8 +146,8 @@ static void ide_identify(IDEState *s) put_le16(p + 68, 120); put_le16(p + 80, 0xf0); /* ata3 -> ata6 supported */ put_le16(p + 81, 0x16); /* conforms to ata5 */ - /* 14=NOP supported, 0=SMART supported */ - put_le16(p + 82, (1 << 14) | 1); + /* 14=NOP supported, 5=WCACHE supported, 0=SMART supported */ + put_le16(p + 82, (1 << 14) | (1 << 5) | 1); /* 13=flush_cache_ext,12=flush_cache,10=lba48 */ put_le16(p + 83, (1 << 14) | (1 << 13) | (1 <<12) | (1 << 10)); /* 14=set to 1, 1=SMART self test, 0=SMART error logging */