[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/11] hw/ide/ahci: map cmd_fis as DMA_DIRECTION_TO_DEVICE
From: |
Kevin Wolf |
Subject: |
[PULL 04/11] hw/ide/ahci: map cmd_fis as DMA_DIRECTION_TO_DEVICE |
Date: |
Mon, 15 Feb 2021 16:00:53 +0100 |
From: Alexander Bulekov <alxndr@bu.edu>
cmd_fis is mapped as DMA_DIRECTION_FROM_DEVICE, however, it is read
from, and not written to anywhere. Fix the DMA_DIRECTION and mark
cmd_fis as read-only in the code.
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20210119164051.89268-1-alxndr@bu.edu>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
hw/ide/ahci.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 6d50482b8d..f2c5157483 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -700,7 +700,7 @@ static void ahci_reset_port(AHCIState *s, int port)
}
/* Buffer pretty output based on a raw FIS structure. */
-static char *ahci_pretty_buffer_fis(uint8_t *fis, int cmd_len)
+static char *ahci_pretty_buffer_fis(const uint8_t *fis, int cmd_len)
{
int i;
GString *s = g_string_new("FIS:");
@@ -1100,11 +1100,11 @@ static void execute_ncq_command(NCQTransferState
*ncq_tfs)
}
-static void process_ncq_command(AHCIState *s, int port, uint8_t *cmd_fis,
+static void process_ncq_command(AHCIState *s, int port, const uint8_t *cmd_fis,
uint8_t slot)
{
AHCIDevice *ad = &s->dev[port];
- NCQFrame *ncq_fis = (NCQFrame*)cmd_fis;
+ const NCQFrame *ncq_fis = (NCQFrame *)cmd_fis;
uint8_t tag = ncq_fis->tag >> 3;
NCQTransferState *ncq_tfs = &ad->ncq_tfs[tag];
size_t size;
@@ -1185,7 +1185,7 @@ static AHCICmdHdr *get_cmd_header(AHCIState *s, uint8_t
port, uint8_t slot)
}
static void handle_reg_h2d_fis(AHCIState *s, int port,
- uint8_t slot, uint8_t *cmd_fis)
+ uint8_t slot, const uint8_t *cmd_fis)
{
IDEState *ide_state = &s->dev[port].port.ifs[0];
AHCICmdHdr *cmd = get_cmd_header(s, port, slot);
@@ -1301,7 +1301,7 @@ static int handle_cmd(AHCIState *s, int port, uint8_t
slot)
tbl_addr = le64_to_cpu(cmd->tbl_addr);
cmd_len = 0x80;
cmd_fis = dma_memory_map(s->as, tbl_addr, &cmd_len,
- DMA_DIRECTION_FROM_DEVICE);
+ DMA_DIRECTION_TO_DEVICE);
if (!cmd_fis) {
trace_handle_cmd_badfis(s, port);
return -1;
@@ -1326,7 +1326,7 @@ static int handle_cmd(AHCIState *s, int port, uint8_t
slot)
}
out:
- dma_memory_unmap(s->as, cmd_fis, cmd_len, DMA_DIRECTION_FROM_DEVICE,
+ dma_memory_unmap(s->as, cmd_fis, cmd_len, DMA_DIRECTION_TO_DEVICE,
cmd_len);
if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
--
2.29.2
- [PULL 00/11] Block layer patches, Kevin Wolf, 2021/02/15
- [PULL 01/11] qemu-storage-daemon: Enable object-add, Kevin Wolf, 2021/02/15
- [PULL 05/11] xen-block: fix reporting of discard feature, Kevin Wolf, 2021/02/15
- [PULL 04/11] hw/ide/ahci: map cmd_fis as DMA_DIRECTION_TO_DEVICE,
Kevin Wolf <=
- [PULL 02/11] iotests: Consistent $IMGOPTS boundary matching, Kevin Wolf, 2021/02/15
- [PULL 03/11] blockjob: Fix crash with IOthread when block commit after snapshot, Kevin Wolf, 2021/02/15
- [PULL 06/11] tests/qemu-iotests: Remove test 259 from the "auto" group, Kevin Wolf, 2021/02/15
- [PULL 10/11] monitor: Fix assertion failure on shutdown, Kevin Wolf, 2021/02/15
- [PULL 07/11] crypto: luks: Fix tiny memory leak, Kevin Wolf, 2021/02/15
- [PULL 08/11] block: add bdrv_co_delete_file_noerr, Kevin Wolf, 2021/02/15
- [PULL 11/11] monitor/qmp: Stop processing requests when shutdown is requested, Kevin Wolf, 2021/02/15
- [PULL 09/11] block: qcow2: remove the created file on initialization error, Kevin Wolf, 2021/02/15
- Re: [PULL 00/11] Block layer patches, Peter Maydell, 2021/02/15