]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
7 months agoesp.c: don't raise INTR_BS interrupt in DATA IN phase until TI command issued
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:56 +0000 (12:53 +0000)]
esp.c: don't raise INTR_BS interrupt in DATA IN phase until TI command issued

In the case where a SCSI command with a DATA IN phase has been issued, the host
may preload the FIFO with unaligned bytes before issuing the main DMA transfer.

When accumulating data in the FIFO don't raise the INTR_BS interrupt until the
TI command is issued, otherwise the unexpected interrupt can confuse the host.
In particular this is needed to prevent the MacOS Disk Utility from failing
when switching non-DMA transfers to use esp_do_nodma().

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-65-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove unneeded ti_cmd field
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:55 +0000 (12:53 +0000)]
esp.c: remove unneeded ti_cmd field

According to the datasheet the previous ESP command remains in the ESP_CMD
register, which caused a problem when consecutive TI commands were issued as
it becomes impossible for the state machine to know when the first TI
command finishes.

This was the original reason for introducing the ti_cmd field which kept
track of the last written command for this purpose. However closer reading
of the datasheet shows that a TI command that terminates due to a change of
SCSI target phase resets the ESP_CMD register to zero which solves this
problem.

Now that this has been fixed in the previous commit, remove the unneeded
ti_cmd field and access the ESP_CMD register directly instead. Bump the
vmstate_esp version to indicate that the ti_cmd field is no longer included.

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-64-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: zero command register when TI command terminates due to phase change
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:54 +0000 (12:53 +0000)]
esp.c: zero command register when TI command terminates due to phase change

This is the behaviour documented in the datasheet and allows the state machine
to correctly process multiple consecutive TI commands.

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-63-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove DATA IN phase logic when reading from FIFO
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:53 +0000 (12:53 +0000)]
esp.c: remove DATA IN phase logic when reading from FIFO

Whilst the FIFO is used a storage buffer for both DMA and non-DMA requests, the
loading and unloading is managed directly issuing commands to the ESP. As a
result there is no need to manually invoke the non-DMA command handler.

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-62-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: use deferred interrupts for both DATA IN and DATA OUT phases
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:52 +0000 (12:53 +0000)]
esp.c: use deferred interrupts for both DATA IN and DATA OUT phases

This brings DATA OUT transfers in line with DATA IN transfers by ensuring that
the guest visible function complete interrupt is only set once the SCSI layer
has returned.

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-61-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: separate logic based upon ESP command in esp_transfer_data()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:51 +0000 (12:53 +0000)]
esp.c: separate logic based upon ESP command in esp_transfer_data()

The handling of the INTR_FC and INTR_BS bits is different depending upon the
last command executed by the ESP. Note that currently INTR_FC is managed
elsewhere, but that will change soon.

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-60-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: separate logic based upon ESP command in esp_command_complete()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:50 +0000 (12:53 +0000)]
esp.c: separate logic based upon ESP command in esp_command_complete()

The handling of the INTR_FC and INTR_BS bits is different depending upon the
last command executed by the ESP. Note that currently INTR_FC is managed
elsewhere, but that will change soon.

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-59-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: rename data_in_ready to to data_ready
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:49 +0000 (12:53 +0000)]
esp.c: rename data_in_ready to to data_ready

This field is currently used to handle deferred interrupts for the DATA IN phase
but the code will soon be updated to do the same for the DATA OUT phase.

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-58-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove unused PDMA callback implementation
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:48 +0000 (12:53 +0000)]
esp.c: remove unused PDMA callback implementation

Note that this is a migration break for the q800 machine because the extra PDMA
information is no longer included.

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-57-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: always use esp_do_dma() in pdma_cb()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:47 +0000 (12:53 +0000)]
esp.c: always use esp_do_dma() in pdma_cb()

There is now only a single implementation contained within esp_do_dma() so
call it directly.

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-56-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: move CMD_ICCS command logic to esp_do_dma()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:46 +0000 (12:53 +0000)]
esp.c: move CMD_ICCS command logic to esp_do_dma()

The special logic in write_response_pdma_cb() is now no longer required since
esp_do_dma() can be used as a direct replacement.

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-55-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: replace do_dma_pdma_cb() with esp_do_dma()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:45 +0000 (12:53 +0000)]
esp.c: replace do_dma_pdma_cb() with esp_do_dma()

Now that the DMA logic is identical between do_dma_pdma_cb() and esp_do_dma()
we can replace do_dma_pdma_cb() with esp_do_dma().

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-54-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: move CMD_SELATNS end of command logic to esp_do_dma() and do_dma_pdma_cb()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:44 +0000 (12:53 +0000)]
esp.c: move CMD_SELATNS end of command logic to esp_do_dma() and do_dma_pdma_cb()

The special logic in satn_stop_pdma_cb() is now no longer required since
esp_do_dma() can be used as a direct replacement.

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-53-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: don't use get_cmd() for CMD_SEL DMA commands
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:43 +0000 (12:53 +0000)]
esp.c: don't use get_cmd() for CMD_SEL DMA commands

This can now be done using the existing logic in esp_do_dma() and do_dma_pdma_cb().

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-52-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: move CMD_TI end of message phase detection to esp_do_dma() and do_dma_pdma_cb()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:42 +0000 (12:53 +0000)]
esp.c: move CMD_TI end of message phase detection to esp_do_dma() and do_dma_pdma_cb()

The existing check for TC == 0 is only valid during a TI command.

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-51-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: move CMD_SELATN end of message phase detection to esp_do_dma() and do_dma_pdma...
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:41 +0000 (12:53 +0000)]
esp.c: move CMD_SELATN end of message phase detection to esp_do_dma() and do_dma_pdma_cb()

The special logic in satn_pdma_cb() is now no longer required since esp_do_dma()
can be used as a direct replacement.

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-50-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: untangle MESSAGE OUT and COMMAND phase logic in esp_do_nodma()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:40 +0000 (12:53 +0000)]
esp.c: untangle MESSAGE OUT and COMMAND phase logic in esp_do_nodma()

This makes it clearer that ATN is asserted until the end of the next TI command
in the MESSAGE OUT phase.

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-49-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: untangle MESSAGE OUT and COMMAND phase logic in do_dma_pdma_cb()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:39 +0000 (12:53 +0000)]
esp.c: untangle MESSAGE OUT and COMMAND phase logic in do_dma_pdma_cb()

This makes it clearer that ATN is asserted until the end of the next TI command
in the MESSAGE OUT phase.

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-48-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: untangle MESSAGE OUT and COMMAND phase logic in esp_do_dma()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:38 +0000 (12:53 +0000)]
esp.c: untangle MESSAGE OUT and COMMAND phase logic in esp_do_dma()

This makes it clearer that ATN is asserted until the end of the next TI command
in the MESSAGE OUT phase.

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-47-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove do_cmd from ESPState
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:37 +0000 (12:53 +0000)]
esp.c: remove do_cmd from ESPState

Now that the accumulation of the CDB is handled by SCSI phase, there is no need
for a separate variable to control it.

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-46-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: convert esp_reg_write() do_cmd path to check for SCSI phase instead
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:36 +0000 (12:53 +0000)]
esp.c: convert esp_reg_write() do_cmd path to check for SCSI phase instead

Currently do_cmd is used to determine whether MESSAGE OUT and COMMAND phase data
is being accumulated in cmdfifo. Update esp_do_dma() to check directly for these
two SCSI phases instead.

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-45-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: convert esp_do_nodma() do_cmd path to check for SCSI phase instead
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:35 +0000 (12:53 +0000)]
esp.c: convert esp_do_nodma() do_cmd path to check for SCSI phase instead

Currently do_cmd is used to determine whether MESSAGE OUT and COMMAND phase data
is being accumulated in cmdfifo. Update esp_do_dma() to check directly for these
two SCSI phases instead.

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-44-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: convert do_dma_pdma_cb() do_cmd path to check for SCSI phase instead
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:34 +0000 (12:53 +0000)]
esp.c: convert do_dma_pdma_cb() do_cmd path to check for SCSI phase instead

Currently do_cmd is used to determine whether MESSAGE OUT and COMMAND phase data
is being accumulated in cmdfifo. Update esp_do_dma() to check directly for these
two SCSI phases instead.

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-43-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: convert esp_do_dma() do_cmd path to check for SCSI phase instead
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:33 +0000 (12:53 +0000)]
esp.c: convert esp_do_dma() do_cmd path to check for SCSI phase instead

Currently do_cmd is used to determine whether MESSAGE OUT and COMMAND phase data
is being accumulated in cmdfifo. Update esp_do_dma() to check directly for these
two SCSI phases instead.

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-42-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: convert esp_do_nodma() to switch statement based upon SCSI phase
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:32 +0000 (12:53 +0000)]
esp.c: convert esp_do_nodma() to switch statement based upon SCSI phase

Currently only the DATA IN and DATA OUT phases are supported.

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-41-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: convert do_dma_pdma_db() to switch statement based upon SCSI phase
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:31 +0000 (12:53 +0000)]
esp.c: convert do_dma_pdma_db() to switch statement based upon SCSI phase

Currently only the DATA IN and DATA OUT phases are supported.

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-40-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: convert esp_do_dma() to switch statement based upon SCSI phase
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:30 +0000 (12:53 +0000)]
esp.c: convert esp_do_dma() to switch statement based upon SCSI phase

Currently only the DATA IN and DATA OUT phases are supported.

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-39-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: introduce esp_get_phase() function
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:29 +0000 (12:53 +0000)]
esp.c: introduce esp_get_phase() function

Make use of this new function in all places where the SCSI phase bits are
manually masked from the ESP_RSTAT register.

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>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20240112125420.514425-38-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove s_without_satn_pdma_cb() PDMA callback
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:28 +0000 (12:53 +0000)]
esp.c: remove s_without_satn_pdma_cb() PDMA callback

This can now be handled by the existing do_dma_pdma_cb() function.

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-37-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: move end of SCSI transfer check after TC adjustment in do_dma_pdma_cb()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:27 +0000 (12:53 +0000)]
esp.c: move end of SCSI transfer check after TC adjustment in do_dma_pdma_cb()

Now it is possible to move the end of SCSI transfer check to after the TC
adjustment in do_dma_pdma_cb() when transferring data from the device
without triggering an assert() in the SCSI code. This brings this check in
line with all the others in esp_do_dma() and do_dma_pdma_cb().

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-36-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: update esp_do_dma() bypass if async_len is zero to include non-zero transfer...
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:26 +0000 (12:53 +0000)]
esp.c: update esp_do_dma() bypass if async_len is zero to include non-zero transfer check

In the PDMA case the last transfer from the device to the FIFO has occurred
(async_len is zero) but esp_do_dma() is still being called to drain the
remaining FIFO contents.

The additional non-zero transfer check ensures that we still defer the SCSI
layer in the case where we are waiting for data for a TI command or a DMA
enable signal.

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-35-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: copy logic for do_cmd transfers from do_dma_pdma_cb() to esp_do_dma()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:25 +0000 (12:53 +0000)]
esp.c: copy logic for do_cmd transfers from do_dma_pdma_cb() to esp_do_dma()

This is so that PDMA transfers can be performend by esp_do_dma() as well as
do_dma_pdma_cb().

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-34-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: copy PDMA logic for transfers to device from do_dma_pdma_cb() to esp_do_dma()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:24 +0000 (12:53 +0000)]
esp.c: copy PDMA logic for transfers to device from do_dma_pdma_cb() to esp_do_dma()

This is so that PDMA transfers can be performend by esp_do_dma() as well as
do_dma_pdma_cb().

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-33-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: rename esp_dma_done() to esp_dma_ti_check()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:23 +0000 (12:53 +0000)]
esp.c: rename esp_dma_done() to esp_dma_ti_check()

This is because a single DMA request can be transferred using multiple TI
commands, and so a TC equal to zero may not represent the completion of
the SCSI DMA command.

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-32-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: move TC and FIFO check logic into esp_dma_done()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:22 +0000 (12:53 +0000)]
esp.c: move TC and FIFO check logic into esp_dma_done()

This helps simplify the existing implementation.

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-31-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: fix premature end of phase logic esp_command_complete
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:21 +0000 (12:53 +0000)]
esp.c: fix premature end of phase logic esp_command_complete

There are two cases here: the first is when the TI command underflows, in which
case we raise INTR_BS to indicate an early change of phase, and the second is
when the TI command overflows because the host requested a transfer for more
data than is available. In the latter case force TC to zero so that the TI
completion logic executes correctly.

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-30-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: consolidate async_len and TC == 0 checks in do_dma_pdma_cb() and esp_do_dma()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:20 +0000 (12:53 +0000)]
esp.c: consolidate async_len and TC == 0 checks in do_dma_pdma_cb() and esp_do_dma()

Ensure that the async_len checks for requesting data from the SCSI layer and
the TC == 0 checks to detect the end of the DMA transfer are consistent in both
do_dma_pdma_cb() and esp_do_dma(). In particular this involves adding the check
to see if the FIFO is at its low threshold since PDMA and mixed DMA and non-DMA
requests can leave data remaining in the FIFO.

At the same time update all the comments so that they are also consistent between
all similar code paths.

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-29-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: update end of transfer logic at the end of esp_transfer_data()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:19 +0000 (12:53 +0000)]
esp.c: update end of transfer logic at the end of esp_transfer_data()

Since esp_dma_done() is called in both cases, and ti_size cannot be zero
(otherwise esp_command_complete() would have been called instead), replace
the conditional logic with a single call to esp_dma_done().

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-28-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove unneeded if() check in esp_transfer_data()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:18 +0000 (12:53 +0000)]
esp.c: remove unneeded if() check in esp_transfer_data()

The following ti_cmd checks ensure that only DMA and non-DMA TI commmands will
can call into the esp_do_dma() and esp_do_nodma() callbacks.

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-27-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove unaligned adjustment in do_dma_pdma_cb() to device path
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:17 +0000 (12:53 +0000)]
esp.c: remove unaligned adjustment in do_dma_pdma_cb() to device path

With the latest changes this condition cannot occur anymore and so the logic
can be completely removed.

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-26-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove TC adjustment in esp_do_dma() from device path
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:16 +0000 (12:53 +0000)]
esp.c: remove TC adjustment in esp_do_dma() from device path

Now that the TC is updated for each PDMA access (rather than once the FIFO is
full) there is no need to adjust the TC at start of each DMA transfer if the
FIFO is not empty.

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-25-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: don't immediately raise INTR_BS if SCSI data needed in esp_do_dma()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:15 +0000 (12:53 +0000)]
esp.c: don't immediately raise INTR_BS if SCSI data needed in esp_do_dma()

In the case when more data is requested from the SCSI layer during a DMA data
transfer from a device, don't immediately fall through to the TC check logic.
Otherwise when TC is zero INTR_BS will be raised immediately rather than when
the next set of SCSI data is ready.

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-24-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: ensure that the PDMA callback is called for every device read
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:14 +0000 (12:53 +0000)]
esp.c: ensure that the PDMA callback is called for every device read

Rather than wait for the FIFO to fill up before calling the PDMA callback, push
that logic directly into the from_device logic in do_dma_pdma_cb().

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-23-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: update condition for esp_dma_done() in esp_do_dma() to device path
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:13 +0000 (12:53 +0000)]
esp.c: update condition for esp_dma_done() in esp_do_dma() to device path

Ensure that esp_dma_done() is only called when TC is zero, which is currently
always the case for DMA transfers.

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-22-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: update condition for esp_dma_done() in esp_do_dma() from device path
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:12 +0000 (12:53 +0000)]
esp.c: update condition for esp_dma_done() in esp_do_dma() from device path

No change to the condition itself, other than to clarify that esp_dma_done()
must be called when TC is zero.

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-21-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove zero transfer size check from esp_do_dma()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:11 +0000 (12:53 +0000)]
esp.c: remove zero transfer size check from esp_do_dma()

The TI end of transfer interrupt only occurs when the TC reaches zero and is
not related to the SCSI layer transfer.

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-20-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: don't clear RFLAGS register when DMA is complete
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:10 +0000 (12:53 +0000)]
esp.c: don't clear RFLAGS register when DMA is complete

The internal state of the ESP sequencer is not affected when raising an interrupt
to indicate the end of a DMA transfer.

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-19-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: don't reset the TC and ESP_RSEQ state when executing a SCSI command
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:09 +0000 (12:53 +0000)]
esp.c: don't reset the TC and ESP_RSEQ state when executing a SCSI command

There is no need to manually reset these values as the ESP emulation now
correctly handles them within its existing logic.

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-18-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove MacOS TI workaround that pads FIFO transfers to ESP_FIFO_SZ
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:08 +0000 (12:53 +0000)]
esp.c: remove MacOS TI workaround that pads FIFO transfers to ESP_FIFO_SZ

This workaround is no longer required with the current code and so can be
removed.

[Note: whilst MacOS itself can boot correctly, removing this hack prevents
a bootable EMILE CDROM from working. This is caused by a separate bug which
will be fixed by a subsequent patch]

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-17-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove another set of manual STAT_TC updates
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:07 +0000 (12:53 +0000)]
esp.c: remove another set of manual STAT_TC updates

Following on from the recent changes to when the TC is updated, it is now
possible to remove another set of manual STAT_TC updates so that its state
is now managed within esp_set_tc().

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-16-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: introduce esp_set_phase() helper function
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:06 +0000 (12:53 +0000)]
esp.c: introduce esp_set_phase() helper function

This function is used to set the current SCSI bus phase in the ESP_RSTAT register
without affecting any of flag bits.

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-15-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: decrement the TC during MESSAGE OUT and COMMAND phases
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:05 +0000 (12:53 +0000)]
esp.c: decrement the TC during MESSAGE OUT and COMMAND phases

This is to ensure that STAT_TC is triggered during the right parts of the
transfer when it is controlled exclusively by the TC.

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-14-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: don't accumulate directly into cmdfifo
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:04 +0000 (12:53 +0000)]
esp.c: don't accumulate directly into cmdfifo

Instead accumulate in the real FIFO as done in real hardware, and then transfer
to cmdfifo when we're ready to process the MESSAGE OUT and COMMAND phase data.

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-13-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove unused case from esp_pdma_read()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:03 +0000 (12:53 +0000)]
esp.c: remove unused case from esp_pdma_read()

The do_cmd variable is only set for the MESSAGE OUT and COMMAND phases i.e.
those which involve transfers from the host to the SCSI bus, and so the unused
case can be removed.

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-12-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: move buffer and TC logic into separate to/from device paths in esp_do_dma()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:02 +0000 (12:53 +0000)]
esp.c: move buffer and TC logic into separate to/from device paths in esp_do_dma()

The ultimate aim is to for esp_do_dma() behaviour to be determined by the SCSI
bus phase, in which case it is necessary to have separate to/from device paths.

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-11-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: update TC check logic in do_dma_pdma_cb() to check for TC == 0
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:01 +0000 (12:53 +0000)]
esp.c: update TC check logic in do_dma_pdma_cb() to check for TC == 0

Invert the logic so that the end of DMA transfer check becomes one that checks
for TC == 0 in the from device path in do_dma_pdma_cb().

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-10-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: move command execution logic to new esp_run_cmd() function
Mark Cave-Ayland [Fri, 12 Jan 2024 12:53:00 +0000 (12:53 +0000)]
esp.c: move command execution logic to new esp_run_cmd() function

This helps to simplify esp_reg_write() and potentially allows for a 2-level
deep FIFO to be implemented in future.

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-9-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: start removal of manual STAT_TC setting when transfer counter reaches zero
Mark Cave-Ayland [Fri, 12 Jan 2024 12:52:59 +0000 (12:52 +0000)]
esp.c: start removal of manual STAT_TC setting when transfer counter reaches zero

This should be exclusively managed by esp_set_tc() rather than being manually
set in multiple places. Start by removing the occurrences exclusive to PDMA
and command completion which are those that can be currently removed without
affecting any test images.

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-8-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: update esp_set_tc() to set STAT_TC flag
Mark Cave-Ayland [Fri, 12 Jan 2024 12:52:58 +0000 (12:52 +0000)]
esp.c: update esp_set_tc() to set STAT_TC flag

This flag is set once the transfer counter counts down to zero.

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-7-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: move esp_select() to ESP selection commands from get_cmd()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:52:57 +0000 (12:52 +0000)]
esp.c: move esp_select() to ESP selection commands from get_cmd()

Since the DREQ value depends upon the result of the selection process, add a
workaround to each esp_select() to manually assert DREQ durring the MESSAGE OUT
and COMMAND phases.

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-6-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: remove FIFO clear from esp_select()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:52:56 +0000 (12:52 +0000)]
esp.c: remove FIFO clear from esp_select()

The FIFO contents should not be affected by performing SCSI target selection.

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-5-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: add FIFO wraparound support to esp_fifo_pop_buf()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:52:55 +0000 (12:52 +0000)]
esp.c: add FIFO wraparound support to esp_fifo_pop_buf()

The fifo8_pop_buf() function returns a pointer to the FIFO buffer up to the
specified length. Since the FIFO buffer is modelled as an array then once
the FIFO wraps around, only the continuous portion of the buffer can be
returned.

In future the use of continuous and unaligned accesses will advance the
internal FIFO head pointer, so modify esp_fifo_pop_buf() to ensure that
any wraparound content is also returned up to the requested length.

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-4-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: move existing request cancel check into esp_select()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:52:54 +0000 (12:52 +0000)]
esp.c: move existing request cancel check into esp_select()

Since get_cmd() can be called multiple times during a mixed FIFO/DMA request,
move the existing request cancel check into esp_select() which always occurs
at the start of new SCSI request.

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-3-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoesp.c: don't clear cmdfifo when esp_select() fails in get_cmd()
Mark Cave-Ayland [Fri, 12 Jan 2024 12:52:53 +0000 (12:52 +0000)]
esp.c: don't clear cmdfifo when esp_select() fails in get_cmd()

The FIFO contents should not be affected if the target selection fails.

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-2-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7 months agoMerge tag 'hppa64-pull-request' of https://github.com/hdeller/qemu-hppa into staging
Peter Maydell [Tue, 13 Feb 2024 13:56:46 +0000 (13:56 +0000)]
Merge tag 'hppa64-pull-request' of https://github.com/hdeller/qemu-hppa into staging

target/hppa: Enhancements and fixes

Some enhancements and fixes for the hppa target.

The major change is, that this patchset adds a new SeaBIOS-hppa firmware
which is built as 32- and 64-bit firmware.
The new 64-bit firmware is necessary to fully support 64-bit operating systems
(HP-UX, Linux, NetBSD,...).

# -----BEGIN PGP SIGNATURE-----
#
# iHUEABYKAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCZcquAQAKCRD3ErUQojoP
# X9pjAQCVsWyuYlGCW2paIGVWKV0vsOpwetUrbhRtFUZGqZxb4AD9FbMsXRcCN/oq
# CotBPY/a8MEzIQcwYl5QbcI5nNW4ygs=
# =RA0B
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 12 Feb 2024 23:47:13 GMT
# gpg:                using EDDSA key BCE9123E1AD29F07C049BBDEF712B510A23A0F5F
# gpg: Good signature from "Helge Deller <deller@gmx.de>" [unknown]
# gpg:                 aka "Helge Deller <deller@kernel.org>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 4544 8228 2CD9 10DB EF3D  25F8 3E5F 3D04 A7A2 4603
#      Subkey fingerprint: BCE9 123E 1AD2 9F07 C049  BBDE F712 B510 A23A 0F5F

* tag 'hppa64-pull-request' of https://github.com/hdeller/qemu-hppa:
  hw/hppa/machine: Load 64-bit firmware on 64-bit machines
  target/hppa: Update SeaBIOS-hppa to version 16
  hw/net/tulip: add chip status register values
  target/hppa: PDC_BTLB_INFO uses 32-bit ints
  target/hppa: Allow read-access to PSW with rsm 0,reg instruction
  lasi: Add reset I/O ports for LASI audio and FDC
  target/hppa: Implement do_transaction_failed handler for I/O errors
  lasi: allow access to LAN MAC address registers
  hw/pci-host/astro: Implement Hard Fail and Soft Fail mode
  hw/pci-host/astro: Avoid aborting on access failure
  target/hppa: Add "diag 0x101" for console output support
  disas/hppa: Add disassembly for qemu specific instructions

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 months agoMerge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging
Peter Maydell [Tue, 13 Feb 2024 13:56:29 +0000 (13:56 +0000)]
Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging

trivial patches for 2024-02-13

# -----BEGIN PGP SIGNATURE-----
#
# iQFDBAABCAAtFiEEe3O61ovnosKJMUsicBtPaxppPlkFAmXLIcgPHG1qdEB0bHMu
# bXNrLnJ1AAoJEHAbT2saaT5Z2lMIAKBuoLX48bbaFsU3dHzPKtB3kVbBpsWJgkGd
# EovqkDTEDiX3+bvPkosUUkuZzRF3STTZx5jSQ5iKHYtwQ6ZnHOLALe/L6JCOHIs2
# DMeet0gacwB5sBDfXJAPDDETDLwaYv3MlQrxb2ok9ouDR4EJXFs8K7444BilhNHt
# nLE+Xtfm7oQBMgzivHSN6/6Y4DTU6mFLt6o+772EVfu6wrI07kOGZ1s/VCeLhqyZ
# 6gppVAx5nbBAryndi6lVvqfo+1mReAIKpreslWgsBb5H1IpXKimG1wd7mrqHFpva
# OLmBuNySe0plvjIkGKM72rPR15MPn7UmHNmnyq6qFzVjLetV2i0=
# =f4L7
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 13 Feb 2024 08:01:12 GMT
# gpg:                using RSA key 7B73BAD68BE7A2C289314B22701B4F6B1A693E59
# gpg:                issuer "mjt@tls.msk.ru"
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" [full]
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>" [full]
# gpg:                 aka "Michael Tokarev <mjt@debian.org>" [full]
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 7B73 BAD6 8BE7 A2C2 8931  4B22 701B 4F6B 1A69 3E59

* tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu:
  monitor/target: Include missing 'exec/memory.h' header
  cpu-target: Include missing 'exec/memory.h' header
  system: Move memory_ldst.c.inc to system
  qemu-options.hx: Add zoom-to-fit to option summary for gtk
  qemu-options.hx: document that tftp=dir is readonly
  iothread: Simplify expression in qemu_in_iothread()
  qemu-nbd: mention --tls-hostname option in qemu-nbd --help
  MAINTAINERS: Cover qapi/stats.json
  MAINTAINERS: Cover qapi/cxl.json
  hw/smbios: Fix port connector option validation
  hw/smbios: Fix OEM strings table option validation
  hw/arm/smmuv3: Consolidate the use of device_class_set_parent_realize()
  hw/intc/s390_flic: Consolidate the use of device_class_set_parent_realize()
  hw/isa/pc87312: Consolidate the use of device_class_set_parent_realize()
  hw/isa/vt82c686: Consolidate the use of device_class_set_parent_realize()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 months agoMerge tag 'pull-qapi-2024-02-12' of https://repo.or.cz/qemu/armbru into staging
Peter Maydell [Tue, 13 Feb 2024 10:54:59 +0000 (10:54 +0000)]
Merge tag 'pull-qapi-2024-02-12' of https://repo.or.cz/qemu/armbru into staging

QAPI patches patches for 2024-02-12

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmXJ4PsSHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZTDwsP/iEdmZmjoxMedTzec+GGl5QxfMkqLn14
# eX2jXtzLGZMjGMh4lvMaAdn0AJ3VnBOqxly14sMK6TMWGZkNKJpKF+2Cj8IKte1o
# MlpS1N/7rZxew+B9HkulhS+6UFB3Jndsflm2ot4g+rRjohJCw0v0GapEqjQg6CKp
# efJhiPuBSImm2MSx+n4dj8gkcFOMrgo6oc2ZpN0ypvGb4mupPpnNj6v12yZL8FUM
# Enwsk+pBLQWoYxI9MFDGc0gW9ZBlEdP/nVq/PbglD06Urc241AHGYqT7XLT0oHLl
# 6NA4v3N4GPdSe6oJdOHDFVR+/uPKiiyrseTdYTSGgAN8gcRtHam4WWhqSDIN3Afl
# y41A9ZKkW51TpdszQ6wCdrgbTH5z6K5vnwWfVTwIgdI0mrDcAGWnc2Yr7m6c3fS8
# /Vz00J7OC0P1nXh0IeRxXExXSmaGUUgS3T/KBXPYr0PQPe7Qd+1eTQN6LaliEMRH
# dRpXQabjLmztMhc5VXCv8ihwa7mNVaEn++uRrdKoWOvIQEp0ZeZfxCzp+/2mGPJ0
# YKJc7Ja260h2Y00/Zu2XiwjdzgG+h+QuJO/3OFsZIV5ftFqSBRMCHiGEfANHidld
# Cpo0efeWWTPdV8BQOirGGr0qtDTmgFMFCZTJMsI/g0m9sMCv0WbTtmWNThwaI3uD
# MKnEGG+KX7vD
# =nhrQ
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 12 Feb 2024 09:12:27 GMT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* tag 'pull-qapi-2024-02-12' of https://repo.or.cz/qemu/armbru:
  MAINTAINERS: Cover qapi/stats.json
  MAINTAINERS: Cover qapi/cxl.json
  qapi/migration: Add missing tls-authz documentation
  qapi: Add missing union tag documentation
  qapi: Move @String out of common.json to discourage reuse
  qapi: Improve documentation of file descriptor socket addresses
  qapi: Plug trivial documentation holes around former simple unions
  qapi/dump: Clean up documentation of DumpGuestMemoryCapability
  qapi/yank: Clean up documentaion of yank
  qga/qapi-schema: Plug trivial documentation holes
  qga/qapi-schema: Clean up documentation of guest-set-vcpus
  qga/qapi-schema: Clean up documentation of guest-set-memory-blocks
  qapi: Require member documentation (with loophole)
  sphinx/qapidoc: Drop code to generate doc for simple union tag
  qapi: Indent tagged doc comment sections properly
  qapi/block-core: Fix BlockLatencyHistogramInfo doc markup
  docs/devel/qapi-code-gen: Tweak doc comment whitespace
  docs/devel/qapi-code-gen: Normalize version refs x.y.0 to just x.y

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 months agomonitor/target: Include missing 'exec/memory.h' header
Philippe Mathieu-Daudé [Fri, 9 Feb 2024 15:00:38 +0000 (16:00 +0100)]
monitor/target: Include missing 'exec/memory.h' header

Include "exec/memory.h" in order to avoid:

  monitor/hmp-cmds-target.c:263:10: error: call to undeclared function 'memory_region_is_ram';
  ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      if (!memory_region_is_ram(mrs.mr) && !memory_region_is_romd(mrs.mr)) {
           ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agocpu-target: Include missing 'exec/memory.h' header
Philippe Mathieu-Daudé [Fri, 9 Feb 2024 15:00:37 +0000 (16:00 +0100)]
cpu-target: Include missing 'exec/memory.h' header

Include "exec/memory.h" in order to avoid:

  cpu-target.c:201:50: error: use of undeclared identifier 'TYPE_MEMORY_REGION'
      DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION,
                                                   ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agosystem: Move memory_ldst.c.inc to system
BALATON Zoltan [Fri, 9 Feb 2024 00:05:05 +0000 (01:05 +0100)]
system: Move memory_ldst.c.inc to system

This file is only used by system/physmem.c so move them together.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agoqemu-options.hx: Add zoom-to-fit to option summary for gtk
BALATON Zoltan [Fri, 9 Feb 2024 00:05:06 +0000 (01:05 +0100)]
qemu-options.hx: Add zoom-to-fit to option summary for gtk

The detailed help lists zoom-to-fit as valid option but it is missing
from the short option summary. Add it there too.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agoqemu-options.hx: document that tftp=dir is readonly
Michael Tokarev [Thu, 8 Feb 2024 06:00:50 +0000 (09:00 +0300)]
qemu-options.hx: document that tftp=dir is readonly

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1286
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agoiothread: Simplify expression in qemu_in_iothread()
Kevin Wolf [Thu, 8 Feb 2024 10:16:57 +0000 (11:16 +0100)]
iothread: Simplify expression in qemu_in_iothread()

'a == b ? false : true' is a rather convoluted way of writing 'a != b'.
Use the more obvious way to write it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agoqemu-nbd: mention --tls-hostname option in qemu-nbd --help
Michael Tokarev [Wed, 7 Feb 2024 07:29:40 +0000 (10:29 +0300)]
qemu-nbd: mention --tls-hostname option in qemu-nbd --help

This option was not documented.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1240
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agoMAINTAINERS: Cover qapi/stats.json
Markus Armbruster [Mon, 5 Feb 2024 08:47:47 +0000 (09:47 +0100)]
MAINTAINERS: Cover qapi/stats.json

Commit aa09b3d5f8e (stats: Move QMP commands from monitor/ to stats/)
created section Stats, but neglected to add qapi/stats.json to it.
Fix that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agoMAINTAINERS: Cover qapi/cxl.json
Markus Armbruster [Mon, 5 Feb 2024 08:47:46 +0000 (09:47 +0100)]
MAINTAINERS: Cover qapi/cxl.json

Commit 415442a1b4a (hw/mem/cxl_type3: Add CXL RAS Error Injection
Support.) created qapi/cxl.json without adding it to MAINTAINERS.  Fix
that.

Cc: Ben Widawsky <ben.widawsky@intel.com>
Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
Cc: Fan Ni <fan.ni@samsung.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agohw/smbios: Fix port connector option validation
Akihiko Odaki [Mon, 29 Jan 2024 08:03:08 +0000 (17:03 +0900)]
hw/smbios: Fix port connector option validation

qemu_smbios_type8_opts did not have the list terminator and that
resulted in out-of-bound memory access. It also needs to have an element
for the type option.

Cc: qemu-stable@nongnu.org
Fixes: fd8caa253c56 ("hw/smbios: support for type 8 (port connector)")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agohw/smbios: Fix OEM strings table option validation
Akihiko Odaki [Mon, 29 Jan 2024 08:03:07 +0000 (17:03 +0900)]
hw/smbios: Fix OEM strings table option validation

qemu_smbios_type11_opts did not have the list terminator and that
resulted in out-of-bound memory access. It also needs to have an element
for the type option.

Cc: qemu-stable@nongnu.org
Fixes: 2d6dcbf93fb0 ("smbios: support setting OEM strings table")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agohw/arm/smmuv3: Consolidate the use of device_class_set_parent_realize()
Zhao Liu [Thu, 1 Feb 2024 08:40:27 +0000 (16:40 +0800)]
hw/arm/smmuv3: Consolidate the use of device_class_set_parent_realize()

Use device_class_set_parent_realize() to set parent realize() directly.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agohw/intc/s390_flic: Consolidate the use of device_class_set_parent_realize()
Zhao Liu [Thu, 1 Feb 2024 08:40:26 +0000 (16:40 +0800)]
hw/intc/s390_flic: Consolidate the use of device_class_set_parent_realize()

Use device_class_set_parent_realize() to set parent realize() directly.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agohw/isa/pc87312: Consolidate the use of device_class_set_parent_realize()
Zhao Liu [Thu, 1 Feb 2024 08:40:25 +0000 (16:40 +0800)]
hw/isa/pc87312: Consolidate the use of device_class_set_parent_realize()

Use device_class_set_parent_realize() to set parent realize() directly.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agohw/isa/vt82c686: Consolidate the use of device_class_set_parent_realize()
Zhao Liu [Thu, 1 Feb 2024 08:40:24 +0000 (16:40 +0800)]
hw/isa/vt82c686: Consolidate the use of device_class_set_parent_realize()

Use device_class_set_parent_realize() to set parent realize() directly.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 months agohw/hppa/machine: Load 64-bit firmware on 64-bit machines
Helge Deller [Fri, 2 Feb 2024 15:22:38 +0000 (16:22 +0100)]
hw/hppa/machine: Load 64-bit firmware on 64-bit machines

Load the 64-bit SeaBIOS-hppa firmware by default when running on a 64-bit
machine. This will enable us to later support more than 4GB of RAM and is
required that the OS (or PALO bootloader) will start or install a 64-bit kernel
instead of a 32-bit kernel.

Note that SeaBIOS-hppa v16 provides the "-fw_cfg opt/OS64,string=3" option with
which the user can control what the firmware shall report back to the OS:
Support of 32-bit OS, support of a 64-bit OS, or support for both (default).

Wrap firmware loading inside !qtest_enabled() to avoid this warning with
qtest: "qemu-system-hppa: no firmware provided".

Signed-off-by: Helge Deller <deller@gmx.de>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
7 months agoMerge tag 'pull-maintainer-updates-090224-1' of https://gitlab.com/stsquad/qemu into...
Peter Maydell [Mon, 12 Feb 2024 14:14:10 +0000 (14:14 +0000)]
Merge tag 'pull-maintainer-updates-090224-1' of https://gitlab.com/stsquad/qemu into staging

testing, doc and gdbstub updates:

  - add sqlite3 to openSUSE image
  - mark CRIS as deprecated
  - re-enable the TCG plugin tests
  - use select for semihosting
  - implement syscall catching in gdbstub

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmXGZtQACgkQ+9DbCVqe
# KkTegAgAg7Kkd0Pa2cgkPfNPYR5yT4hYurjVSfi/69cOpj/Vadsav4WWFsuUiQMI
# FfKWCNDo5lmNcWIPKgC0oeWVwxal4IhqhO8f9lRIYqg9z4bRkZbdsrvh8J52Q6Xh
# Bu9UAEk5KBGrMfEdsAwHnVDg435c7IGdJZnE/iKBK1aKljS5LOiX1J6ZxrqUoMsJ
# keTAcdXyvs/BIz68c87AHrW/HKO9KKLgHA2n7T/l2N5KJdoa3p8La9py+v1SGUh8
# 6JlDRYR1H16mITS8tm6ZffPqcOpfHXp7DRquu7obVS5+CVTJ2H9w8TICw56rqMg7
# cVnysNLhdS18cMNKD2Jx3zgd5Nq/cg==
# =deHm
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 09 Feb 2024 17:54:28 GMT
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* tag 'pull-maintainer-updates-090224-1' of https://gitlab.com/stsquad/qemu:
  tests/tcg: Add the syscall catchpoint gdbstub test
  gdbstub: Implement catching syscalls
  gdbstub: Add syscall entry/return hooks
  gdbstub: Allow specifying a reason in stop packets
  gdbstub: Expose TARGET_SIGTRAP in a target-agnostic way
  kconfig: use "select" to enable semihosting
  Revert "hw/elf_ops: Ignore loadable segments with zero size"
  configure: run plugin TCG tests again
  docs: mark CRIS support as deprecated
  tests/docker: Add sqlite3 module to openSUSE Leap container

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 months agoMerge tag 'misc-fixes-pull-request' of https://gitlab.com/berrange/qemu into staging
Peter Maydell [Mon, 12 Feb 2024 14:13:58 +0000 (14:13 +0000)]
Merge tag 'misc-fixes-pull-request' of https://gitlab.com/berrange/qemu into staging

 - LUKS support for detached headers
 - Update x86 CPU model docs and script
 - Add missing close of chardev QIOChannel
 - More trace events o nTKS handshake
 - Drop unsafe VNC constants
 - Increase NOFILE limit during startup

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE2vOm/bJrYpEtDo4/vobrtBUQT98FAmXGMNUACgkQvobrtBUQ
# T998JQ//SqQ3L/AZmhE5cIwZ1XipSMMZ/yEoVIyniA3tL41S7Oimj3O9XvY68TEG
# nnj9Oh+zOlVLxauTHAczveJ7z+XfonQZS3HrbGRUTHU+ezGVjyM618e/h9pSQtYI
# +CCkrjtey1NoT42/um4D/bKg/B2XQeulS+pD12Z9l5zbqEZiw0R9+UwVIJ52G811
# 5UQgIjJ7GNFzalxqiMCkGc0nTyU8keEXQJcdZ4droo42DnU4pZeQWGDimzP61JnW
# 1Crm6aZSuUriUbVmxJde+2eEdPSR4rr/yQ4Pw06hoi1QJALSgGYtOTo8+qsyumHd
# us/2ouMrxOMdsIk4ViAkSTiaje9agPj84VE1Z229Y/uqZcEAuX572n730/kkzqUv
# ZDKxMz0v3rzpkjFmsgj5D4yqJaQp4zn1zYm98ld7HWJVIOf3GSvpaNg9J6jwN7Gi
# HKKkvYns9pxg3OSx++gqnM32HV6nnMDFiddipl/hTiUsnNlnWyTDSvJoNxIUU5+l
# /uEbbdt8xnxx1JP0LiOhgmz6N6FU7oOpaPuJ5CD8xO2RO8D1uBRvmpFcdOTDAfv0
# uYdjhKBI+quKjE64p7gNWYCoqZtipRIJ6AY2VaPU8XHx8GvGFwBLX64oLYiYtrBG
# gkv3NTHRkMhQw9cGQcZIgZ+OLU+1eNF+m9EV7LUjuKl0HWC3Vjs=
# =61zI
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 09 Feb 2024 14:04:05 GMT
# gpg:                using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full]
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>" [full]
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* tag 'misc-fixes-pull-request' of https://gitlab.com/berrange/qemu:
  tests: Add case for LUKS volume with detached header
  crypto: Introduce 'detached-header' field in QCryptoBlockInfoLUKS
  block: Support detached LUKS header creation using qemu-img
  block: Support detached LUKS header creation using blockdev-create
  crypto: Modify the qcrypto_block_create to support creation flags
  qapi: Make parameter 'file' optional for BlockdevCreateOptionsLUKS
  crypto: Support LUKS volume with detached header
  io: add trace event when cancelling TLS handshake
  chardev: close QIOChannel before unref'ing
  docs: re-generate x86_64 ABI compatibility CSV
  docs: fix highlighting of CPU ABI header rows
  scripts: drop comment about autogenerated CPU API file
  softmmu: remove obsolete comment about libvirt timeouts
  ui: drop VNC feature _MASK constants
  qemu_init: increase NOFILE soft limit on POSIX
  crypto: Introduce SM4 symmetric cipher algorithm
  meson: sort C warning flags alphabetically

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 months agoMAINTAINERS: Cover qapi/stats.json
Markus Armbruster [Mon, 5 Feb 2024 08:47:47 +0000 (09:47 +0100)]
MAINTAINERS: Cover qapi/stats.json

Commit aa09b3d5f8e (stats: Move QMP commands from monitor/ to stats/)
created section Stats, but neglected to add qapi/stats.json to it.
Fix that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205084747.3623569-3-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 months agoMAINTAINERS: Cover qapi/cxl.json
Markus Armbruster [Mon, 5 Feb 2024 08:47:46 +0000 (09:47 +0100)]
MAINTAINERS: Cover qapi/cxl.json

Commit 415442a1b4a (hw/mem/cxl_type3: Add CXL RAS Error Injection
Support.) created qapi/cxl.json without adding it to MAINTAINERS.  Fix
that.

Cc: Ben Widawsky <ben.widawsky@intel.com>
Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
Cc: Fan Ni <fan.ni@samsung.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205084747.3623569-2-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 months agoqapi/migration: Add missing tls-authz documentation
Peter Xu [Wed, 7 Feb 2024 03:28:36 +0000 (11:28 +0800)]
qapi/migration: Add missing tls-authz documentation

As reported in Markus's recent enforcement series on qapi doc [1], we
accidentally miss one entry for tls-authz.  Add it.

[1] https://lore.kernel.org/r/20240205074709.3613229-1-armbru@redhat.com

Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Fabiano Rosas <farosas@suse.de>
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-ID: <20240207032836.268183-1-peterx@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Update of qapi/pragma.json squashed in, commit message adjusted]

7 months agoqapi: Add missing union tag documentation
Markus Armbruster [Mon, 5 Feb 2024 07:47:09 +0000 (08:47 +0100)]
qapi: Add missing union tag documentation

Low-hanging fruit, and except for StatsFilter, the only members of
these unions lacking documentation.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-16-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoqapi: Move @String out of common.json to discourage reuse
Markus Armbruster [Mon, 5 Feb 2024 07:47:08 +0000 (08:47 +0100)]
qapi: Move @String out of common.json to discourage reuse

Use of String is problematic, because it results in awkward interface
documentation.  The previous commit cleaned up one instance.

Move String out of common.json next to its remaining users in net.json
to discourage reuse elsewhere.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-15-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoqapi: Improve documentation of file descriptor socket addresses
Markus Armbruster [Mon, 5 Feb 2024 07:47:07 +0000 (08:47 +0100)]
qapi: Improve documentation of file descriptor socket addresses

SocketAddress branch @fd is documented in enum SocketAddressType,
unlike the other branches.  That's because the branch's type is String
from common.json.

Use a local copy of String, so we can put the documentation in the
usual place.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-14-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoqapi: Plug trivial documentation holes around former simple unions
Markus Armbruster [Mon, 5 Feb 2024 07:47:06 +0000 (08:47 +0100)]
qapi: Plug trivial documentation holes around former simple unions

The conversion of simple to flat unions left the @data members
undocumented.  Add documentation where it's trivial.  Copy verbatim
from the wrapped type's description where possible.

Leftovers: String (to be taken care of in the next commit), and
TransActionAction (left for another day).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-13-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoqapi/dump: Clean up documentation of DumpGuestMemoryCapability
Markus Armbruster [Mon, 5 Feb 2024 07:47:05 +0000 (08:47 +0100)]
qapi/dump: Clean up documentation of DumpGuestMemoryCapability

The type's doc comment describes its member, but it's not marked up as
such.  Easy enough to fix.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-12-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoqapi/yank: Clean up documentaion of yank
Markus Armbruster [Mon, 5 Feb 2024 07:47:04 +0000 (08:47 +0100)]
qapi/yank: Clean up documentaion of yank

The command's doc comment describes the argument, but it's not marked
up as such.  Easy enough to fix.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-11-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoqga/qapi-schema: Plug trivial documentation holes
Markus Armbruster [Mon, 5 Feb 2024 07:47:03 +0000 (08:47 +0100)]
qga/qapi-schema: Plug trivial documentation holes

Add missing return member documentation of guest-get-disks,
guest-get-devices, guest-get-diskstats, and guest-get-cpustats.

The NVMe SMART information returned by guest-getdisks remains
undocumented.  Add a TODO there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-10-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoqga/qapi-schema: Clean up documentation of guest-set-vcpus
Markus Armbruster [Mon, 5 Feb 2024 07:47:02 +0000 (08:47 +0100)]
qga/qapi-schema: Clean up documentation of guest-set-vcpus

The command's doc comment describes the argument, but it's not marked
up as such.  Easy enough to fix.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-9-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoqga/qapi-schema: Clean up documentation of guest-set-memory-blocks
Markus Armbruster [Mon, 5 Feb 2024 07:47:01 +0000 (08:47 +0100)]
qga/qapi-schema: Clean up documentation of guest-set-memory-blocks

The command's doc comment describes the argument, but it's not marked
up as such.  Easy enough to fix.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-8-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoqapi: Require member documentation (with loophole)
Markus Armbruster [Mon, 5 Feb 2024 07:47:00 +0000 (08:47 +0100)]
qapi: Require member documentation (with loophole)

The QAPI generator forces you to document your stuff.  Except for
command arguments, event data, and members of enum and object types:
these the generator silently "documents" as "Not documented".

We can't require proper documentation there without first fixing all
the offenders.  We've always had too many offenders to pull that off.
Right now, we have more than 500.  Worse, we seem to fix old ones no
faster than we add new ones: in the past year, we fixed 22 ones, but
added 26 new ones.

To help arrest the backsliding, make missing documentation an error
unless the command, type, or event is in listed in new pragma
documentation-exceptions.

List all the current offenders: 117 commands and types in qapi/, and 9
in qga/.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-7-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agosphinx/qapidoc: Drop code to generate doc for simple union tag
Markus Armbruster [Mon, 5 Feb 2024 07:46:59 +0000 (08:46 +0100)]
sphinx/qapidoc: Drop code to generate doc for simple union tag

QAPISchemaGenRSTVisitor._nodes_for_members() has a special case to
auto-generate documentation for a union tag member of implicit (enum)
type that lacks documentation.

This was useful for simple unions, where the tag member's type was
implicitly.  The only implicit enum type left today is 'QType'.  Not
worth a special case.  Drop.  No change to generated documentation.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-6-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agoqapi: Indent tagged doc comment sections properly
Markus Armbruster [Mon, 5 Feb 2024 07:46:58 +0000 (08:46 +0100)]
qapi: Indent tagged doc comment sections properly

docs/devel/qapi-code-gen demands that the "second and subsequent lines
of sections other than "Example"/"Examples" should be indented".
Commit a937b6aa739q (qapi: Reformat doc comments to conform to current
conventions) missed a few instances, and messed up a few others.
Clean that up.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-5-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>