[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 20/64] esp: only set ESP_RSEQ at the start of the select sequence
From: |
Michael Roth |
Subject: |
[PATCH 20/64] esp: only set ESP_RSEQ at the start of the select sequence |
Date: |
Tue, 19 Oct 2021 09:09:00 -0500 |
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
When processing a command to select a target and send a CDB, the ESP device
maintains a sequence step register so that if an error occurs the host can
determine which part of the selection/CDB submission sequence failed.
The old Linux 2.6 driver is really pedantic here: it checks the sequence step
register even if a command succeeds and complains loudly on the console if the
sequence step register doesn't match the expected bus phase and interrupt flags.
This reason this mismatch occurs is because the ESP emulation currently doesn't
update the bus phase until the next TI (Transfer Information) command and so the
cleared sequence step register is considered invalid for the stale bus phase.
Normally this isn't an issue as the host only checks the sequence step register
if an error occurs but the old Linux 2.6 driver does this in several places
causing a large stream of "esp0: STEP_ASEL for tgt 0" messages to appear on the
console during the boot process.
Fix this by not clearing the sequence step register when reading the interrupt
register and clearing the DMA status, so the guest sees a valid sequence step
and bus phase combination at the end of the command phase. No other change is
required since the sequence step register is correctly updated throughout the
selection/CDB submission sequence once one of the select commands is issued.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: 1b9e48a5bd ("esp: implement non-DMA transfers in PDMA mode")
Message-Id: <20210518212511.21688-3-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit af947a3d853a235943681a00f07f3081f5143cc3)
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
hw/scsi/esp.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 000e45a624..18d4d56392 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -481,7 +481,6 @@ static void esp_dma_done(ESPState *s)
{
s->rregs[ESP_RSTAT] |= STAT_TC;
s->rregs[ESP_RINTR] |= INTR_BS;
- s->rregs[ESP_RSEQ] = 0;
s->rregs[ESP_RFLAGS] = 0;
esp_set_tc(s, 0);
esp_raise_irq(s);
@@ -917,7 +916,15 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
val = s->rregs[ESP_RINTR];
s->rregs[ESP_RINTR] = 0;
s->rregs[ESP_RSTAT] &= ~STAT_TC;
- s->rregs[ESP_RSEQ] = SEQ_0;
+ /*
+ * According to the datasheet ESP_RSEQ should be cleared, but as the
+ * emulation currently defers information transfers to the next TI
+ * command leave it for now so that pedantic guests such as the old
+ * Linux 2.6 driver see the correct flags before the next SCSI phase
+ * transition.
+ *
+ * s->rregs[ESP_RSEQ] = SEQ_0;
+ */
esp_lower_irq(s);
break;
case ESP_TCHI:
--
2.25.1
- [PATCH 10/64] qemu-option: support accept-any QemuOptsList in qemu_opts_absorb_qdict, (continued)
- [PATCH 10/64] qemu-option: support accept-any QemuOptsList in qemu_opts_absorb_qdict, Michael Roth, 2021/10/19
- [PATCH 11/64] qemu-config: load modules when instantiating option groups, Michael Roth, 2021/10/19
- [PATCH 12/64] qemu-config: parse configuration files to a QDict, Michael Roth, 2021/10/19
- [PATCH 13/64] vl: plumb keyval-based options into -readconfig, Michael Roth, 2021/10/19
- [PATCH 14/64] vl: plug -object back into -readconfig, Michael Roth, 2021/10/19
- [PATCH 15/64] sockets: update SOCKET_ADDRESS_TYPE_FD listen(2) backlog, Michael Roth, 2021/10/19
- [PATCH 16/64] hmp: Fix loadvm to resume the VM on success instead of failure, Michael Roth, 2021/10/19
- [PATCH 17/64] configure: fix detection of gdbus-codegen, Michael Roth, 2021/10/19
- [PATCH 18/64] vhost-vdpa: don't initialize backend_features, Michael Roth, 2021/10/19
- [PATCH 19/64] esp: only assert INTR_DC interrupt flag if selection fails, Michael Roth, 2021/10/19
- [PATCH 20/64] esp: only set ESP_RSEQ at the start of the select sequence,
Michael Roth <=
- [PATCH 01/64] multi-process: Initialize variables declared with g_auto*, Michael Roth, 2021/10/19
- [PATCH 21/64] runstate: Initialize Error * to NULL, Michael Roth, 2021/10/19
- [PATCH 22/64] vfio: Fix unregister SaveVMHandler in vfio_migration_finalize, Michael Roth, 2021/10/19
- [PATCH 23/64] vl: Fix an assert failure in error path, Michael Roth, 2021/10/19
- [PATCH 24/64] tcg/sparc: Fix temp_allocate_frame vs sparc stack bias, Michael Roth, 2021/10/19
- [PATCH 25/64] tcg: Allocate sufficient storage in temp_allocate_frame, Michael Roth, 2021/10/19
- [PATCH 26/64] hw/pci-host/q35: Ignore write of reserved PCIEXBAR LENGTH field, Michael Roth, 2021/10/19
- [PATCH 27/64] block/nvme: Fix VFIO_MAP_DMA failed: No space left on device, Michael Roth, 2021/10/19
- [PATCH 28/64] crypto/tlscreds: Introduce qcrypto_tls_creds_check_endpoint() helper, Michael Roth, 2021/10/19
- [PATCH 29/64] block/nbd: Use qcrypto_tls_creds_check_endpoint(), Michael Roth, 2021/10/19