]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
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>
7 months agoqapi/block-core: Fix BlockLatencyHistogramInfo doc markup
Markus Armbruster [Mon, 5 Feb 2024 07:46:57 +0000 (08:46 +0100)]
qapi/block-core: Fix BlockLatencyHistogramInfo doc markup

The description of @bins ends with a literal block:

    # @bins: list of io request counts corresponding to histogram
    #     intervals, one more element than @boundaries has.  For the
    #     example above, @bins may be something like [3, 1, 5, 2], and
    #     corresponding histogram looks like:
    #
    # ::
    #
    #        5|           *

Except it actually ends *before* the block: the unindented '::' line
starts a new section.  Makes no sense.

We could fix this by indenting the '::' line.  Instead, double the
colon at the end of the preceding paragraph, and drop the '::' line.

This shifts the box for the literal block right in generated
documentation, so it lines up with the description.

Fixes: commit a0fcff383b34 (qapi: Use rST markup for literal blocks)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-4-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agodocs/devel/qapi-code-gen: Tweak doc comment whitespace
Markus Armbruster [Mon, 5 Feb 2024 07:46:56 +0000 (08:46 +0100)]
docs/devel/qapi-code-gen: Tweak doc comment whitespace

Missed in commit a937b6aa739 (qapi: Reformat doc comments to conform
to current conventions).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-3-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agodocs/devel/qapi-code-gen: Normalize version refs x.y.0 to just x.y
Markus Armbruster [Mon, 5 Feb 2024 07:46:55 +0000 (08:46 +0100)]
docs/devel/qapi-code-gen: Normalize version refs x.y.0 to just x.y

Missed in commit 9bc6e893b72 (qapi: Normalize version references x.y.0
to just x.y).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240205074709.3613229-2-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 months agotarget/hppa: Update SeaBIOS-hppa to version 16
Helge Deller [Sun, 11 Feb 2024 12:24:30 +0000 (13:24 +0100)]
target/hppa: Update SeaBIOS-hppa to version 16

SeaBIOS-hppa version 16 news & enhancements:

- Initial 64-bit firmware release
- Added fault handler to catch and report firmware bugs
- Use Qemu's builtin_console_out() via diag 0x101
- parisc-qemu-install Makefile target to install firmware in qemu
- Added -fw_cfg opt/OS64,string=3 option

Fixes:

- Avoid crash when booting without SCSI controller
- Avoid possible crashes while detecting LASI LAN & graphics
- Don't check layers in PDC_MEM_MAP_HPA, fixes NetBSD
- Ensure cache definition does not trigger endless loops
- Mark B160L as 32-bit machine in inventory

Signed-off-by: Helge Deller <deller@gmx.de>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
7 months agohw/net/tulip: add chip status register values
Sven Schnelle [Mon, 5 Feb 2024 19:47:17 +0000 (20:47 +0100)]
hw/net/tulip: add chip status register values

Netbsd isn't able to detect a link on the emulated tulip card. That's
because netbsd reads the Chip Status Register of the Phy (address
0x14). The default phy data in the qemu tulip driver is all zero,
which means no link is established and autonegotation isn't complete.

Therefore set the register to 0x3b40, which means:

Link is up, Autonegotation complete, Full Duplex, 100MBit/s Link
speed.

Also clear the mask because this register is read only.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Helge Deller <deller@gmx.de>
Tested-by: Helge Deller <deller@gmx.de>
Signed-off-by: Helge Deller <deller@gmx.de>
7 months agotarget/hppa: PDC_BTLB_INFO uses 32-bit ints
Helge Deller [Tue, 6 Feb 2024 23:49:28 +0000 (00:49 +0100)]
target/hppa: PDC_BTLB_INFO uses 32-bit ints

The BTLB helper function stores the BTLB info (four 32-bit ints) into
the memory of the guest. They are only available when emulating a 32-bit
CPU in the guest, so use "uint32_t" instead of "target_ulong" here.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7 months agotarget/hppa: Allow read-access to PSW with rsm 0,reg instruction
Helge Deller [Tue, 6 Feb 2024 23:49:28 +0000 (00:49 +0100)]
target/hppa: Allow read-access to PSW with rsm 0,reg instruction

HP-UX 11 and HP ODE tools use the "rsm 0,%reg" instruction in not priviledged
code paths to get the current PSW flags. The constant 0 means that no bits of
the PSW shall be reset, so this is effectively a read-only access to the PSW.
Allow this read-only access even for not privileged code.

Signed-off-by: Helge Deller <deller@gmx.de>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
7 months agolasi: Add reset I/O ports for LASI audio and FDC
Helge Deller [Sat, 3 Feb 2024 00:04:45 +0000 (01:04 +0100)]
lasi: Add reset I/O ports for LASI audio and FDC

Linux writes zeroes at bootup into the default ports for LASI audio and
LASI floppy controller to reset those devices.  Allow writing to those
registers to avoid HPMCs.

Signed-off-by: Helge Deller <deller@gmx.de>
7 months agotarget/hppa: Implement do_transaction_failed handler for I/O errors
Helge Deller [Fri, 2 Feb 2024 23:04:30 +0000 (00:04 +0100)]
target/hppa: Implement do_transaction_failed handler for I/O errors

Add the do_transaction_failed() handler to tigger a HPMC to the CPU
in case of I/O transaction errors.

This is a preparation commit.
We still lack implementation for some registers, so do not yet enable sending
HPMCs.  Having this hunk here now nevertheless helps for the further
development, so that it can easily be enabled later on.

Signed-off-by: Helge Deller <deller@gmx.de>
7 months agolasi: allow access to LAN MAC address registers
Helge Deller [Fri, 2 Feb 2024 21:53:08 +0000 (22:53 +0100)]
lasi: allow access to LAN MAC address registers

Firmware and qemu reads and writes the MAC address for the LASI LAN via
registers in LASI. Allow those accesses and return zero even if LASI
LAN isn't enabled to avoid HPMCs (=crashes).

Signed-off-by: Helge Deller <deller@gmx.de>
7 months agohw/pci-host/astro: Implement Hard Fail and Soft Fail mode
Helge Deller [Fri, 2 Feb 2024 20:28:50 +0000 (21:28 +0100)]
hw/pci-host/astro: Implement Hard Fail and Soft Fail mode

The Astro/Elroy chip can work in either Hard-Fail or Soft-Fail mode.

Hard fail means the system bus will send an HPMC (=crash) to the
processor, soft fail means the system bus will ignore timeouts of
MMIO-reads or MMIO-writes and return -1ULL.

The HF mode is controlled by a bit in the status register and is usually
programmed by the OS. Return the corresponing values based on the current
value of that bit.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7 months agohw/pci-host/astro: Avoid aborting on access failure
Helge Deller [Fri, 2 Feb 2024 20:05:56 +0000 (21:05 +0100)]
hw/pci-host/astro: Avoid aborting on access failure

Instead of stopping the emulation, report a MEMTX_DECODE_ERROR if the OS
tries to access non-existent registers.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7 months agotarget/hppa: Add "diag 0x101" for console output support
Helge Deller [Fri, 2 Feb 2024 10:57:11 +0000 (11:57 +0100)]
target/hppa: Add "diag 0x101" for console output support

For debugging purposes at the early stage of the bootup process,
the SeaBIOS-hppa firmware sometimes needs to output characters to the
serial console. Note that the serial console is the default output
method for parisc machines.

At this stage PCI busses and other devices haven't been initialized
yet. So, SeaBIOS-hppa will not be able to find the correct I/O ports
for the serial ports yet.

Instead, add an emulation for the "diag 0x101" opcode to assist here.
Without any other dependencies, SeaBIOS-hppa can then load the character
to be printed in register %r26 and issue the diag assembly instruction.

The qemu diag_console_output() helper function will then print
that character to the first serial port.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7 months agodisas/hppa: Add disassembly for qemu specific instructions
Helge Deller [Fri, 2 Feb 2024 10:08:57 +0000 (11:08 +0100)]
disas/hppa: Add disassembly for qemu specific instructions

Add disassembly of opcodes for "HALT QEMU", "RESET QEMU" and
"RESTORE SHR" (restore shadow registers).

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7 months agotests/tcg: Add the syscall catchpoint gdbstub test
Ilya Leoshkevich [Wed, 7 Feb 2024 16:38:12 +0000 (16:38 +0000)]
tests/tcg: Add the syscall catchpoint gdbstub test

Check that adding/removing syscall catchpoints works.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20240202152506.279476-6-iii@linux.ibm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240207163812.3231697-15-alex.bennee@linaro.org>

7 months agogdbstub: Implement catching syscalls
Ilya Leoshkevich [Wed, 7 Feb 2024 16:38:11 +0000 (16:38 +0000)]
gdbstub: Implement catching syscalls

GDB supports stopping on syscall entry and exit using the "catch
syscall" command. It relies on 3 packets, which are currently not
supported by QEMU:

* qSupported:QCatchSyscalls+ [1]
* QCatchSyscalls: [2]
* T05syscall_entry: and T05syscall_return: [3]

Implement generation and handling of these packets.

[1] https://sourceware.org/gdb/current/onlinedocs/gdb.html/General-Query-Packets.html#qSupported
[2] https://sourceware.org/gdb/current/onlinedocs/gdb.html/General-Query-Packets.html#QCatchSyscalls
[3] https://sourceware.org/gdb/current/onlinedocs/gdb.html/Stop-Reply-Packets.html

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20240202152506.279476-5-iii@linux.ibm.com>
[AJB: GString -> g_strdup_printf]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240207163812.3231697-14-alex.bennee@linaro.org>

7 months agogdbstub: Add syscall entry/return hooks
Ilya Leoshkevich [Wed, 7 Feb 2024 16:38:10 +0000 (16:38 +0000)]
gdbstub: Add syscall entry/return hooks

The upcoming syscall catchpoint support needs to get control on syscall
entry and return. Provide the necessary hooks for that, which are
no-ops for now.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20240202152506.279476-4-iii@linux.ibm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240207163812.3231697-13-alex.bennee@linaro.org>

7 months agogdbstub: Allow specifying a reason in stop packets
Ilya Leoshkevich [Wed, 7 Feb 2024 16:38:09 +0000 (16:38 +0000)]
gdbstub: Allow specifying a reason in stop packets

The upcoming syscall catchpoint support needs to send stop packets with
an associated reason to GDB. Add an extra parameter to gdb_handlesig()
for that, and rename it to gdb_handlesig_reason(). Provide a
compatibility wrapper with an old name.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20240202152506.279476-3-iii@linux.ibm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240207163812.3231697-12-alex.bennee@linaro.org>

7 months agogdbstub: Expose TARGET_SIGTRAP in a target-agnostic way
Ilya Leoshkevich [Wed, 7 Feb 2024 16:38:08 +0000 (16:38 +0000)]
gdbstub: Expose TARGET_SIGTRAP in a target-agnostic way

The upcoming syscall catchpoint support needs to send SIGTRAP stop
packets to GDB. Being able to compile this support only once for all
targets is a good thing, and it requires hiding TARGET_SIGTRAP behind
a function call.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20240202152506.279476-2-iii@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240207163812.3231697-11-alex.bennee@linaro.org>

7 months agokconfig: use "select" to enable semihosting
Paolo Bonzini [Wed, 7 Feb 2024 16:38:07 +0000 (16:38 +0000)]
kconfig: use "select" to enable semihosting

Just like all other dependencies, these can be expressed in Kconfig
files rather than in the default configurations.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20240129115809.1039924-1-pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240207163812.3231697-10-alex.bennee@linaro.org>

7 months agoRevert "hw/elf_ops: Ignore loadable segments with zero size"
Alex Bennée [Wed, 7 Feb 2024 16:38:02 +0000 (16:38 +0000)]
Revert "hw/elf_ops: Ignore loadable segments with zero size"

This regressed qemu-system-xtensa:

    TEST    test_load_store on xtensa
  qemu-system-xtensa: Some ROM regions are overlapping
  These ROM regions might have been loaded by direct user request or by default.
  They could be BIOS/firmware images, a guest kernel, initrd or some other file loaded into guest memory.
  Check whether you intended to load all this guest code, and whether it has been built to load to the correct addresses.

  The following two regions overlap (in the memory address space):
    test_load_store ELF program header segment 1 (addresses 0x0000000000001000 - 0x0000000000001f26)
    test_load_store ELF program header segment 2 (addresses 0x0000000000001ab8 - 0x0000000000001ab8)
  make[1]: *** [Makefile:187: run-test_load_store] Error 1

This reverts commit 62570f1434160d356311e1c217537e24a4ac85cd.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240207163812.3231697-5-alex.bennee@linaro.org>

7 months agoconfigure: run plugin TCG tests again
Paolo Bonzini [Wed, 7 Feb 2024 16:38:01 +0000 (16:38 +0000)]
configure: run plugin TCG tests again

Commit 39fb3cfc28b ("configure: clean up plugin option handling", 2023-10-18)
dropped the CONFIG_PLUGIN line from tests/tcg/config-host.mak, due to confusion
caused by the shadowing of $config_host_mak.  However, TCG tests were still
expecting it.  Oops.

Put it back, in the meanwhile the shadowing is gone so it's clear that it goes
in the tests/tcg configuration.

Cc: <alex.bennee@linaro.org>
Fixes: 39fb3cfc28b ("configure: clean up plugin option handling", 2023-10-18)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20240124115332.612162-1-pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240207163812.3231697-4-alex.bennee@linaro.org>