958e1b
From 466d66e193341115f2a48e27997d61d8fddc811e Mon Sep 17 00:00:00 2001
958e1b
From: Markus Armbruster <armbru@redhat.com>
958e1b
Date: Fri, 31 Oct 2014 16:29:56 +0100
958e1b
Subject: [PATCH 19/19] ide: only constrain read/write requests to drive size,
958e1b
 not other types
958e1b
958e1b
Message-id: <1414772996-17272-6-git-send-email-armbru@redhat.com>
958e1b
Patchwork-id: 62017
958e1b
O-Subject: [PATCH RHEL-7.1 qemu-kvm 5/5] ide: only constrain read/write requests to drive size, not other types
958e1b
Bugzilla: 1085232
958e1b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
958e1b
RH-Acked-by: Fam Zheng <famz@redhat.com>
958e1b
958e1b
From: Michael Tokarev <mjt@tls.msk.ru>
958e1b
958e1b
Commit 58ac321135a introduced a check to ide dma processing which
958e1b
constrains all requests to drive size.  However, apparently, some
958e1b
valid requests (like TRIM) does not fit in this constraint, and
958e1b
fails in 2.1.  So check the range only for reads and writes.
958e1b
958e1b
Cc: qemu-stable@nongnu.org
958e1b
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
958e1b
Signed-off-by: Markus Armbruster <armbru@redhat.com>
958e1b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
(cherry picked from commit d66168ed687325aa6d338ce3a3cff18ce3098ed6)
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 hw/ide/core.c | 3 ++-
958e1b
 1 file changed, 2 insertions(+), 1 deletion(-)
958e1b
958e1b
diff --git a/hw/ide/core.c b/hw/ide/core.c
958e1b
index 4c36f52..24a1708 100644
958e1b
--- a/hw/ide/core.c
958e1b
+++ b/hw/ide/core.c
958e1b
@@ -702,7 +702,8 @@ void ide_dma_cb(void *opaque, int ret)
958e1b
            sector_num, n, s->dma_cmd);
958e1b
 #endif
958e1b
 
958e1b
-    if (!ide_sect_range_ok(s, sector_num, n)) {
958e1b
+    if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) &&
958e1b
+        !ide_sect_range_ok(s, sector_num, n)) {
958e1b
         dma_buf_commit(s);
958e1b
         ide_dma_error(s);
958e1b
         return;
958e1b
-- 
958e1b
1.8.3.1
958e1b