qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@gmail.com, aliguori@us.ibm.com,
	prerna@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH 3/4] ide: wire up setfeatures cache control
Date: Tue, 15 Mar 2011 15:11:42 +0100	[thread overview]
Message-ID: <20110315141142.GC30710@lst.de> (raw)
In-Reply-To: <20110315141132.GB30710@lst.de>

Wire up the ATA SETFEATURES subcalls that control the volatile write cache
to the new bdrv_change_cache helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: qemu/hw/ide/core.c
===================================================================
--- qemu.orig/hw/ide/core.c	2011-03-15 11:47:18.569636140 +0100
+++ qemu/hw/ide/core.c	2011-03-15 13:07:21.464634347 +0100
@@ -1700,6 +1700,19 @@ void ide_ioport_write(void *opaque, uint
     }
 }
 
+static void ide_setcache(IDEState *s, bool enable)
+{
+    if (bdrv_change_cache(s->bs, enable)) {
+        ide_abort_command(s);
+        ide_set_irq(s->bus);
+        return;
+    }
+
+    s->identify_set = 0;
+
+    s->status = READY_STAT | SEEK_STAT;
+    ide_set_irq(s->bus);
+}
 
 void ide_exec_cmd(IDEBus *bus, uint32_t val)
 {
@@ -1855,7 +1868,11 @@ void ide_exec_cmd(IDEBus *bus, uint32_t
         case 0xcc: /* reverting to power-on defaults enable */
         case 0x66: /* reverting to power-on defaults disable */
         case 0x02: /* write cache enable */
+            ide_setcache(s, true);
+            break;
         case 0x82: /* write cache disable */
+            ide_setcache(s, false);
+            break;
         case 0xaa: /* read look-ahead enable */
         case 0x55: /* read look-ahead disable */
         case 0x05: /* set advanced power management mode */

  reply	other threads:[~2011-03-15 14:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-15 14:10 [Qemu-devel] [PATCH, RFC 0/4] allow guest control of the volatile write cache Christoph Hellwig
2011-03-15 14:11 ` [Qemu-devel] [PATCH 1/4] block: clarify the meaning of BDRV_O_NOCACHE Christoph Hellwig
2011-03-16  9:42   ` [Qemu-devel] " Stefan Hajnoczi
2011-03-16  9:55     ` Kevin Wolf
2011-03-16 14:08     ` Christoph Hellwig
2011-03-16 17:00       ` Stefan Hajnoczi
2011-03-17  9:07         ` Kevin Wolf
2011-03-17  9:18           ` Stefan Hajnoczi
2011-03-15 14:11 ` [Qemu-devel] [PATCH 2/4] block: add a helper to change writeback mode on the fly Christoph Hellwig
2011-03-15 14:11   ` Christoph Hellwig [this message]
2011-03-15 14:11   ` [Qemu-devel] [PATCH 4/4] virtio-blk: add runtime cache control Christoph Hellwig
2011-03-16  9:49   ` [Qemu-devel] Re: [PATCH 2/4] block: add a helper to change writeback mode on the fly Stefan Hajnoczi
2011-03-16  9:59     ` Kevin Wolf
2011-03-17 14:44   ` [Qemu-devel] " Daniel P. Berrange
2011-03-17 15:11     ` Kevin Wolf
2011-03-17 16:44       ` Stefan Hajnoczi
2011-03-19  8:28         ` Blue Swirl
2011-03-15 14:16 ` [Qemu-devel] [PATCH, RFC] virtio_blk: add cache control support Christoph Hellwig
2011-03-16  4:09   ` [Qemu-devel] " Rusty Russell
2011-03-16 14:09     ` Christoph Hellwig
2011-03-17  5:06       ` Rusty Russell
2011-03-17 14:21         ` Christoph Hellwig
2011-03-24  0:11           ` Rusty Russell
2011-03-24  3:11           ` Anthony Liguori
2011-03-24  3:05         ` Anthony Liguori
2011-03-24  9:54           ` Christian Borntraeger
2011-03-25  5:08             ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110315141142.GC30710@lst.de \
    --to=hch@lst.de \
    --cc=aliguori@us.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=prerna@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).