[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 86/88] esp.c: keep track of the DRQ state during DMA
From: |
Mark Cave-Ayland |
Subject: |
[PULL 86/88] esp.c: keep track of the DRQ state during DMA |
Date: |
Tue, 13 Feb 2024 19:40:50 +0000 |
Currently the DRQ IRQ is updated every time DMA data is sent/received which
is both inefficient and causes excessive logging of the DRQ state. Add a
new drq_state bool that only updates the DRQ IRQ if its state changes.
This commit adds the new drq_state bool to the migration state: since the
version number has already been increased earlier in the series, there is
no need to repeat it again here. The DRQ IRQ is (currently) only used for
PDMA transfers which already have a migration break in this series so
there are no problems setting its value post-load.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Tested-by: Helge Deller <deller@gmx.de>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20240112125420.514425-87-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp.c | 15 +++++++++++----
include/hw/scsi/esp.h | 1 +
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index fb68606f00..04615d8b5f 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -62,14 +62,20 @@ static void esp_lower_irq(ESPState *s)
static void esp_raise_drq(ESPState *s)
{
- qemu_irq_raise(s->drq_irq);
- trace_esp_raise_drq();
+ if (!(s->drq_state)) {
+ qemu_irq_raise(s->drq_irq);
+ trace_esp_raise_drq();
+ s->drq_state = true;
+ }
}
static void esp_lower_drq(ESPState *s)
{
- qemu_irq_lower(s->drq_irq);
- trace_esp_lower_drq();
+ if (s->drq_state) {
+ qemu_irq_lower(s->drq_irq);
+ trace_esp_lower_drq();
+ s->drq_state = false;
+ }
}
void esp_dma_enable(ESPState *s, int irq, int level)
@@ -1358,6 +1364,7 @@ const VMStateDescription vmstate_esp = {
VMSTATE_UINT8_TEST(mig_ti_cmd, ESPState,
esp_is_between_version_5_and_6),
VMSTATE_UINT8_TEST(lun, ESPState, esp_is_version_6),
+ VMSTATE_BOOL(drq_state, ESPState),
VMSTATE_END_OF_LIST()
},
};
diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h
index c6e8b64e20..533d856aa3 100644
--- a/include/hw/scsi/esp.h
+++ b/include/hw/scsi/esp.h
@@ -26,6 +26,7 @@ struct ESPState {
uint8_t wregs[ESP_REGS];
qemu_irq irq;
qemu_irq drq_irq;
+ bool drq_state;
uint8_t chip_id;
bool tchi_written;
int32_t ti_size;
--
2.39.2
- [PULL 83/88] esp.c: replace n variable with len in esp_do_nodma(), (continued)
- [PULL 83/88] esp.c: replace n variable with len in esp_do_nodma(), Mark Cave-Ayland, 2024/02/13
- [PULL 52/88] esp.c: move CMD_SELATNS end of command logic to esp_do_dma() and do_dma_pdma_cb(), Mark Cave-Ayland, 2024/02/13
- [PULL 62/88] esp.c: zero command register when TI command terminates due to phase change, Mark Cave-Ayland, 2024/02/13
- [PULL 77/88] esp.c: only transfer non-DMA MESSAGE OUT phase data for specific commands, Mark Cave-Ayland, 2024/02/13
- [PULL 55/88] esp.c: always use esp_do_dma() in pdma_cb(), Mark Cave-Ayland, 2024/02/13
- [PULL 85/88] esp.c: rename irq_data IRQ to drq_irq, Mark Cave-Ayland, 2024/02/13
- [PULL 76/88] esp.c: only transfer non-DMA COMMAND phase data for specific commands, Mark Cave-Ayland, 2024/02/13
- [PULL 66/88] esp.c: process non-DMA FIFO writes in esp_do_nodma(), Mark Cave-Ayland, 2024/02/13
- [PULL 63/88] esp.c: remove unneeded ti_cmd field, Mark Cave-Ayland, 2024/02/13
- [PULL 50/88] esp.c: move CMD_TI end of message phase detection to esp_do_dma() and do_dma_pdma_cb(), Mark Cave-Ayland, 2024/02/13
- [PULL 86/88] esp.c: keep track of the DRQ state during DMA,
Mark Cave-Ayland <=
- [PULL 61/88] esp.c: remove DATA IN phase logic when reading from FIFO, Mark Cave-Ayland, 2024/02/13
- [PULL 68/88] esp.c: move write_response() non-DMA logic to esp_do_nodma(), Mark Cave-Ayland, 2024/02/13
- [PULL 74/88] esp.c: handle non-DMA FIFO writes used to terminate DMA commands, Mark Cave-Ayland, 2024/02/13
- [PULL 59/88] esp.c: separate logic based upon ESP command in esp_transfer_data(), Mark Cave-Ayland, 2024/02/13
- [PULL 72/88] esp.c: handle TC underflow for DMA SCSI requests, Mark Cave-Ayland, 2024/02/13
- [PULL 75/88] esp.c: improve ESP_RSEQ logic consolidation, Mark Cave-Ayland, 2024/02/13
- [PULL 84/88] esp.c: implement DMA Transfer Pad command for DATA phases, Mark Cave-Ayland, 2024/02/13
- [PULL 60/88] esp.c: use deferred interrupts for both DATA IN and DATA OUT phases, Mark Cave-Ayland, 2024/02/13
- [PULL 82/88] esp.c: consolidate DMA and PDMA logic in STATUS and MESSAGE IN phases, Mark Cave-Ayland, 2024/02/13
- [PULL 56/88] esp.c: remove unused PDMA callback implementation, Mark Cave-Ayland, 2024/02/13