qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for-2.4 0/2] Ide patches
@ 2015-07-31 22:27 John Snow
  2015-07-31 22:27 ` [Qemu-devel] [PULL for-2.4 1/2] macio: re-add TRIM support John Snow
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: John Snow @ 2015-07-31 22:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, jsnow

The following changes since commit cb48f67ad8c7b33c617d4f8144a27706e69fd688:

  bsd-user: Fix operand to cpu_x86_exec (2015-07-30 12:38:49 +0100)

are available in the git repository at:

  https://github.com/jnsnow/qemu.git tags/ide-pull-request

for you to fetch changes up to 91ced514461e1a533bfb9e2eea32bd7df678b1cd:

  ahci: fix ICC mask definition (2015-07-31 16:39:20 -0400)

----------------------------------------------------------------

 Hopefully the last two minor fixes from me for 2.4.
 There's a mapping leak in MacIO, but I think given the timeframe
 that this is 2.4.1/2.5 work.

 The first fixes TRIM support for MacIO which we accidentally
 culled, and the second quiets a Clang analysis warning.

----------------------------------------------------------------

Aurelien Jarno (1):
  macio: re-add TRIM support

John Snow (1):
  ahci: fix ICC mask definition

 hw/ide/ahci.h  |  2 +-
 hw/ide/macio.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL for-2.4 1/2] macio: re-add TRIM support
  2015-07-31 22:27 [Qemu-devel] [PULL for-2.4 0/2] Ide patches John Snow
@ 2015-07-31 22:27 ` John Snow
  2015-07-31 22:27 ` [Qemu-devel] [PULL for-2.4 2/2] ahci: fix ICC mask definition John Snow
  2015-08-03 10:43 ` [Qemu-devel] [PULL for-2.4 0/2] Ide patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: John Snow @ 2015-07-31 22:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Mark Cave-Ayland, jsnow, Aurelien Jarno

From: Aurelien Jarno <aurelien@aurel32.net>

Commit bd4214fc dropped TRIM support by mistake. Given it is still
advertised to the host when using a drive with discard=on, this cause
the IDE bus to hang when the host issues a TRIM command.

This patch fixes that by re-adding the TRIM code, ported to the new
new DMA implementation.

Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: John Snow <jsnow@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-id: 1438198068-32428-1-git-send-email-aurelien@aurel32.net
Signed-off-by: John Snow <jsnow@redhat.com>
---
 hw/ide/macio.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index a55a479..66ac2ba 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -208,6 +208,33 @@ static void pmac_dma_write(BlockBackend *blk,
                               cb, io);
 }
 
+static void pmac_dma_trim(BlockBackend *blk,
+                        int64_t offset, int bytes,
+                        void (*cb)(void *opaque, int ret), void *opaque)
+{
+    DBDMA_io *io = opaque;
+    MACIOIDEState *m = io->opaque;
+    IDEState *s = idebus_active_if(&m->bus);
+    dma_addr_t dma_addr, dma_len;
+    void *mem;
+
+    qemu_iovec_destroy(&io->iov);
+    qemu_iovec_init(&io->iov, io->len / MACIO_PAGE_SIZE + 1);
+
+    dma_addr = io->addr;
+    dma_len = io->len;
+    mem = dma_memory_map(&address_space_memory, dma_addr, &dma_len,
+                         DMA_DIRECTION_TO_DEVICE);
+
+    qemu_iovec_add(&io->iov, mem, io->len);
+    s->io_buffer_size -= io->len;
+    s->io_buffer_index += io->len;
+    io->len = 0;
+
+    m->aiocb = ide_issue_trim(blk, (offset >> 9), &io->iov, (bytes >> 9),
+                              cb, io);
+}
+
 static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
 {
     DBDMA_io *io = opaque;
@@ -313,6 +340,7 @@ static void pmac_ide_transfer_cb(void *opaque, int ret)
         pmac_dma_write(s->blk, offset, io->len, pmac_ide_transfer_cb, io);
         break;
     case IDE_DMA_TRIM:
+        pmac_dma_trim(s->blk, offset, io->len, pmac_ide_transfer_cb, io);
         break;
     }
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL for-2.4 2/2] ahci: fix ICC mask definition
  2015-07-31 22:27 [Qemu-devel] [PULL for-2.4 0/2] Ide patches John Snow
  2015-07-31 22:27 ` [Qemu-devel] [PULL for-2.4 1/2] macio: re-add TRIM support John Snow
@ 2015-07-31 22:27 ` John Snow
  2015-08-03 10:43 ` [Qemu-devel] [PULL for-2.4 0/2] Ide patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: John Snow @ 2015-07-31 22:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, jsnow

There are likely others that could be updated, but we'll
go with a light touch for 2.4 for now.

Without the Unsigned specifier, this shifts bits into the
signed bit, which makes clang unhappy and could cause
unwanted behavior.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1437501721-24495-1-git-send-email-jsnow@redhat.com
---
 hw/ide/ahci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ide/ahci.h b/hw/ide/ahci.h
index 68d5074..79a463d 100644
--- a/hw/ide/ahci.h
+++ b/hw/ide/ahci.h
@@ -127,7 +127,7 @@
 #define PORT_CMD_SPIN_UP          (1 << 1) /* Spin up device */
 #define PORT_CMD_START            (1 << 0) /* Enable port DMA engine */
 
-#define PORT_CMD_ICC_MASK         (0xf << 28) /* i/f ICC state mask */
+#define PORT_CMD_ICC_MASK        (0xfU << 28) /* i/f ICC state mask */
 #define PORT_CMD_ICC_ACTIVE       (0x1 << 28) /* Put i/f in active state */
 #define PORT_CMD_ICC_PARTIAL      (0x2 << 28) /* Put i/f in partial state */
 #define PORT_CMD_ICC_SLUMBER      (0x6 << 28) /* Put i/f in slumber state */
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PULL for-2.4 0/2] Ide patches
  2015-07-31 22:27 [Qemu-devel] [PULL for-2.4 0/2] Ide patches John Snow
  2015-07-31 22:27 ` [Qemu-devel] [PULL for-2.4 1/2] macio: re-add TRIM support John Snow
  2015-07-31 22:27 ` [Qemu-devel] [PULL for-2.4 2/2] ahci: fix ICC mask definition John Snow
@ 2015-08-03 10:43 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2015-08-03 10:43 UTC (permalink / raw)
  To: John Snow; +Cc: QEMU Developers

On 31 July 2015 at 23:27, John Snow <jsnow@redhat.com> wrote:
> The following changes since commit cb48f67ad8c7b33c617d4f8144a27706e69fd688:
>
>   bsd-user: Fix operand to cpu_x86_exec (2015-07-30 12:38:49 +0100)
>
> are available in the git repository at:
>
>   https://github.com/jnsnow/qemu.git tags/ide-pull-request
>
> for you to fetch changes up to 91ced514461e1a533bfb9e2eea32bd7df678b1cd:
>
>   ahci: fix ICC mask definition (2015-07-31 16:39:20 -0400)
>
> ----------------------------------------------------------------
>
>  Hopefully the last two minor fixes from me for 2.4.
>  There's a mapping leak in MacIO, but I think given the timeframe
>  that this is 2.4.1/2.5 work.
>
>  The first fixes TRIM support for MacIO which we accidentally
>  culled, and the second quiets a Clang analysis warning.
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-03 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-31 22:27 [Qemu-devel] [PULL for-2.4 0/2] Ide patches John Snow
2015-07-31 22:27 ` [Qemu-devel] [PULL for-2.4 1/2] macio: re-add TRIM support John Snow
2015-07-31 22:27 ` [Qemu-devel] [PULL for-2.4 2/2] ahci: fix ICC mask definition John Snow
2015-08-03 10:43 ` [Qemu-devel] [PULL for-2.4 0/2] Ide patches Peter Maydell

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).