[PATCH v3 0/7] esp.c: only allow ESP commands permitted in the current mode

Mark Cave-Ayland posted 7 patches 5 months, 1 week ago
Failed in applying to current master (apply log)
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>
hw/scsi/esp.c         | 94 +++++++++++++++++++++++++++++++++++++------
hw/scsi/trace-events  |  1 +
include/hw/scsi/esp.h | 15 ++++++-
3 files changed, 96 insertions(+), 14 deletions(-)
[PATCH v3 0/7] esp.c: only allow ESP commands permitted in the current mode
Posted by Mark Cave-Ayland 5 months, 1 week ago
This series contains a few minor tidy-ups along with an implementation of the
logic to only allow ESP commands permitted in the current mode. The motivation
is to fix GitLab issue #2464 which causes Windows NT MIPS to bluescreen on
boot.

Patches 1 to 5 are simple tidy-ups from investigating the issue. Patch 6 adds
a new asc_mode variable to indicate the current ESP mode, whilst patch 7 implements
the feature which fixes GitLab issue #2464.

Note: this series is being reposted as both the SeaBIOS and SeaBIOS hppa binaries
currently distributed with QEMU have now been fixed so that they do not use an
illegal ESP command sequence.  

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

v3:
- Fix typo in comments for patches 4 and 5 as pointed out by Phil
- Add R-B tags from Phil

v2:
- Rebase onto master
- Add patches 4 and 5 to avoid calling the DMA functions for zero-length transfers


Mark Cave-Ayland (7):
  esp.c: only raise IRQ in esp_transfer_data() for CMD_SEL, CMD_SELATN
    and CMD_TI commands
  esp.c: improve comment in esp_transfer_data()
  esp.h: remove separate ESPState typedef
  esp.c: only call dma_memory_read function if transfer length is
    non-zero
  esp.c: only call dma_memory_write function if transfer length is
    non-zero
  esp.c: add asc_mode property to indicate the current ESP mode
  esp.c: only allow ESP commands permitted in the current asc_mode

 hw/scsi/esp.c         | 94 +++++++++++++++++++++++++++++++++++++------
 hw/scsi/trace-events  |  1 +
 include/hw/scsi/esp.h | 15 ++++++-
 3 files changed, 96 insertions(+), 14 deletions(-)

-- 
2.39.5
Re: [PATCH v3 0/7] esp.c: only allow ESP commands permitted in the current mode
Posted by Philippe Mathieu-Daudé 5 months, 1 week ago
On 11/7/25 22:46, Mark Cave-Ayland wrote:
> This series contains a few minor tidy-ups along with an implementation of the
> logic to only allow ESP commands permitted in the current mode. The motivation
> is to fix GitLab issue #2464 which causes Windows NT MIPS to bluescreen on
> boot.
> 
> Patches 1 to 5 are simple tidy-ups from investigating the issue. Patch 6 adds
> a new asc_mode variable to indicate the current ESP mode, whilst patch 7 implements
> the feature which fixes GitLab issue #2464.

Indeed, thanks for working on this!

Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> 
> Note: this series is being reposted as both the SeaBIOS and SeaBIOS hppa binaries
> currently distributed with QEMU have now been fixed so that they do not use an
> illegal ESP command sequence.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


Re: [PATCH v3 0/7] esp.c: only allow ESP commands permitted in the current mode
Posted by Michael Tokarev 5 months ago
On 11.07.2025 23:46, Mark Cave-Ayland wrote:
> This series contains a few minor tidy-ups along with an implementation of the
> logic to only allow ESP commands permitted in the current mode. The motivation
> is to fix GitLab issue #2464 which causes Windows NT MIPS to bluescreen on
> boot.
> 
> Patches 1 to 5 are simple tidy-ups from investigating the issue. Patch 6 adds
> a new asc_mode variable to indicate the current ESP mode, whilst patch 7 implements
> the feature which fixes GitLab issue #2464.
> 
> Note: this series is being reposted as both the SeaBIOS and SeaBIOS hppa binaries
> currently distributed with QEMU have now been fixed so that they do not use an
> illegal ESP command sequence.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> 
> v3:
> - Fix typo in comments for patches 4 and 5 as pointed out by Phil
> - Add R-B tags from Phil
> 
> v2:
> - Rebase onto master
> - Add patches 4 and 5 to avoid calling the DMA functions for zero-length transfers
> 
> 
> Mark Cave-Ayland (7):
>    esp.c: only raise IRQ in esp_transfer_data() for CMD_SEL, CMD_SELATN
>      and CMD_TI commands
>    esp.c: improve comment in esp_transfer_data()
>    esp.h: remove separate ESPState typedef
>    esp.c: only call dma_memory_read function if transfer length is
>      non-zero
>    esp.c: only call dma_memory_write function if transfer length is
>      non-zero
>    esp.c: add asc_mode property to indicate the current ESP mode
>    esp.c: only allow ESP commands permitted in the current asc_mode
> 
>   hw/scsi/esp.c         | 94 +++++++++++++++++++++++++++++++++++++------
>   hw/scsi/trace-events  |  1 +
>   include/hw/scsi/esp.h | 15 ++++++-
>   3 files changed, 96 insertions(+), 14 deletions(-)

I wonder if we can pick this up for qemu-stable (10.0).  It's a large
change, but a fairy focused one..  What do you think?

(10.0 is expected to be long-term support series).

Thanks,

/mjt
Re: [PATCH v3 0/7] esp.c: only allow ESP commands permitted in the current mode
Posted by Mark Cave-Ayland 5 months ago
On 16/07/2025 16:13, Michael Tokarev wrote:

> On 11.07.2025 23:46, Mark Cave-Ayland wrote:
>> This series contains a few minor tidy-ups along with an implementation of the
>> logic to only allow ESP commands permitted in the current mode. The motivation
>> is to fix GitLab issue #2464 which causes Windows NT MIPS to bluescreen on
>> boot.
>>
>> Patches 1 to 5 are simple tidy-ups from investigating the issue. Patch 6 adds
>> a new asc_mode variable to indicate the current ESP mode, whilst patch 7 implements
>> the feature which fixes GitLab issue #2464.
>>
>> Note: this series is being reposted as both the SeaBIOS and SeaBIOS hppa binaries
>> currently distributed with QEMU have now been fixed so that they do not use an
>> illegal ESP command sequence.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>
>> v3:
>> - Fix typo in comments for patches 4 and 5 as pointed out by Phil
>> - Add R-B tags from Phil
>>
>> v2:
>> - Rebase onto master
>> - Add patches 4 and 5 to avoid calling the DMA functions for zero-length transfers
>>
>>
>> Mark Cave-Ayland (7):
>>    esp.c: only raise IRQ in esp_transfer_data() for CMD_SEL, CMD_SELATN
>>      and CMD_TI commands
>>    esp.c: improve comment in esp_transfer_data()
>>    esp.h: remove separate ESPState typedef
>>    esp.c: only call dma_memory_read function if transfer length is
>>      non-zero
>>    esp.c: only call dma_memory_write function if transfer length is
>>      non-zero
>>    esp.c: add asc_mode property to indicate the current ESP mode
>>    esp.c: only allow ESP commands permitted in the current asc_mode
>>
>>   hw/scsi/esp.c         | 94 +++++++++++++++++++++++++++++++++++++------
>>   hw/scsi/trace-events  |  1 +
>>   include/hw/scsi/esp.h | 15 ++++++-
>>   3 files changed, 96 insertions(+), 14 deletions(-)
> 
> I wonder if we can pick this up for qemu-stable (10.0).  It's a large
> change, but a fairy focused one..  What do you think?
> 
> (10.0 is expected to be long-term support series).

Probably not in this case, because during testing I found that the drivers in 
SeaBIOS/OpenBIOS also used commands in the wrong ASC mode and needed corresponding 
updates first.


ATB,

Mark.


Re: [PATCH v3 0/7] esp.c: only allow ESP commands permitted in the current mode
Posted by Philippe Mathieu-Daudé 5 months, 1 week ago
On 11/7/25 22:46, Mark Cave-Ayland wrote:
> This series contains a few minor tidy-ups along with an implementation of the
> logic to only allow ESP commands permitted in the current mode. The motivation
> is to fix GitLab issue #2464 which causes Windows NT MIPS to bluescreen on
> boot.

Series queued, thanks a lot for solving this!

Phil.