[RFC PATCH-for-11.2 v4 00/14] nc53c710 rewrite

Philippe Mathieu-Daudé posted 14 patches 2 days, 11 hours ago
MAINTAINERS            |    1 +
hw/scsi/lasi_ncr710.h  |   28 +-
hw/scsi/lsi_scsi.h     |  104 ++
hw/scsi/ncr53c710.h    |  279 ++--
include/hw/scsi/scsi.h |    1 +
hw/hppa/machine.c      |   10 +
hw/scsi/lasi_ncr710.c  |  135 +-
hw/scsi/lsi53c895a.c   |   79 +-
hw/scsi/ncr53c710.c    | 2981 +++++++++++++++-------------------------
hw/scsi/scsi-disk.c    |   13 +
hw/scsi/trace-events   |   43 +-
11 files changed, 1451 insertions(+), 2223 deletions(-)
create mode 100644 hw/scsi/lsi_scsi.h
[RFC PATCH-for-11.2 v4 00/14] nc53c710 rewrite
Posted by Philippe Mathieu-Daudé 2 days, 11 hours ago
Fourth attempt to replace the existing 53c710 driver by
a new driver based on the code of the lsi53c895a.c :)

Used LLM to decompose v3 as logical / atomic changes when
possible (didn't work well with the rewrite patch).

Fixes extracted first so could be merged for v11.2 (patches
1 to 5). The rest is the rewrite, so up to the maintainers
(Helge, Mark) and is probably OK as hobbyist-only code.

Since v3:
- header split, Suggested-by tag (Zoltan)
- I couldn't figure the "hw/misc/lasi.c" change so dropped
  the comment about it.
- Dropped "move to COMMAND on CLEAR ACK after MESSAGE REJECT"
- Split rewrite patch as separated commits:
   - base engine
   - asynchronous completions
   - synchronous drain
   - HP-UX MESSAGE REJECT quirk
   - reentrancy guard and reset-time request cancel

hw/scsi/ncr53c710.c is derived from hw/scsi/lsi53c895a.c which
is LGPL, the rewrite is now declared GPL-2.0-or-later.
hw/scsi/lsi_scsi.h, which is moved verbatim from lsi53c895a.c,
keeps the original terms: its header says "This code is licensed
under the LGPL." with SPDX-License-Identifier: LGPL-2.1-or-later.

Series reviewed against the NCR 53C710 data manual but totally
untested (I don't have guest code to run), thus compile-checked
only. I haven't tested whether the series is bisectable.

Keith Monahan (9):
  hw/scsi/scsi-disk: Add quirk_mode_page_no_flexible_disk, use it on the
    715
  hw/scsi: Move shared LSI/NCR definitions to lsi_scsi.h
  hw/scsi/ncr53c710: Rewrite the 53C710 SCRIPTS engine
  hw/scsi/ncr53c710: Deliver completions from bottom halves
  hw/scsi/ncr53c710: Drain asynchronous transfers in the register write
  hw/scsi/ncr53c710: Append SAVE DATA POINTERS after MESSAGE REJECT for
    HP-UX
  hw/scsi/ncr53c710: Guard SCRIPTS reentrancy and cancel requests on
    soft reset
  hw/scsi/lasi_ncr710: Map the full LASI SCSI module page
  hw/scsi/ncr53c710: Bump the migration version

Philippe Mathieu-Daudé (5):
  hw/scsi/ncr53c710: Cancel the in-flight request on soft reset
  hw/scsi/ncr53c710: Do not load SBCL from DBC after a SCRIPTS phase
    move
  hw/scsi/lasi_ncr710: Limit max_target and max_lun to 7
  hw/scsi/ncr53c710: Keep DCNTL.EA and DMODE.FC1 across an ISTAT.RST
    reset
  hw/scsi/ncr53c710: Document the SIGP latch deviation

 MAINTAINERS            |    1 +
 hw/scsi/lasi_ncr710.h  |   28 +-
 hw/scsi/lsi_scsi.h     |  104 ++
 hw/scsi/ncr53c710.h    |  279 ++--
 include/hw/scsi/scsi.h |    1 +
 hw/hppa/machine.c      |   10 +
 hw/scsi/lasi_ncr710.c  |  135 +-
 hw/scsi/lsi53c895a.c   |   79 +-
 hw/scsi/ncr53c710.c    | 2981 +++++++++++++++-------------------------
 hw/scsi/scsi-disk.c    |   13 +
 hw/scsi/trace-events   |   43 +-
 11 files changed, 1451 insertions(+), 2223 deletions(-)
 create mode 100644 hw/scsi/lsi_scsi.h

-- 
2.55.0


Re: [RFC PATCH-for-11.2 v4 00/14] nc53c710 rewrite
Posted by Philippe Mathieu-Daudé 2 days, 10 hours ago
On 20/11/26 18:12, Philippe Mathieu-Daudé wrote:
> Fourth attempt to replace the existing 53c710 driver by
> a new driver based on the code of the lsi53c895a.c :)
> 
> Used LLM to decompose v3 as logical / atomic changes when
> possible (didn't work well with the rewrite patch).
> 
> Fixes extracted first so could be merged for v11.2 (patches
> 1 to 5). The rest is the rewrite, so up to the maintainers
> (Helge, Mark) and is probably OK as hobbyist-only code.
> 
> Since v3:
> - header split, Suggested-by tag (Zoltan)
> - I couldn't figure the "hw/misc/lasi.c" change so dropped
>    the comment about it.
> - Dropped "move to COMMAND on CLEAR ACK after MESSAGE REJECT"
> - Split rewrite patch as separated commits:
>     - base engine
>     - asynchronous completions
>     - synchronous drain
>     - HP-UX MESSAGE REJECT quirk
>     - reentrancy guard and reset-time request cancel
> 
> hw/scsi/ncr53c710.c is derived from hw/scsi/lsi53c895a.c which
> is LGPL, the rewrite is now declared GPL-2.0-or-later.
> hw/scsi/lsi_scsi.h, which is moved verbatim from lsi53c895a.c,
> keeps the original terms: its header says "This code is licensed
> under the LGPL." with SPDX-License-Identifier: LGPL-2.1-or-later.
> 
> Series reviewed against the NCR 53C710 data manual but totally
> untested (I don't have guest code to run), thus compile-checked
> only. I haven't tested whether the series is bisectable.

This is only a split experiment if Helge/Keith/Mark/Zoltan want
to pursue, I'm not going to respin.

> Keith Monahan (9):
>    hw/scsi/scsi-disk: Add quirk_mode_page_no_flexible_disk, use it on the
>      715
>    hw/scsi: Move shared LSI/NCR definitions to lsi_scsi.h
>    hw/scsi/ncr53c710: Rewrite the 53C710 SCRIPTS engine
>    hw/scsi/ncr53c710: Deliver completions from bottom halves
>    hw/scsi/ncr53c710: Drain asynchronous transfers in the register write
>    hw/scsi/ncr53c710: Append SAVE DATA POINTERS after MESSAGE REJECT for
>      HP-UX
>    hw/scsi/ncr53c710: Guard SCRIPTS reentrancy and cancel requests on
>      soft reset
>    hw/scsi/lasi_ncr710: Map the full LASI SCSI module page
>    hw/scsi/ncr53c710: Bump the migration version
> 
> Philippe Mathieu-Daudé (5):

Oops here author should be Keith Monahan?

>    hw/scsi/ncr53c710: Cancel the in-flight request on soft reset
>    hw/scsi/ncr53c710: Do not load SBCL from DBC after a SCRIPTS phase
>      move
>    hw/scsi/lasi_ncr710: Limit max_target and max_lun to 7
>    hw/scsi/ncr53c710: Keep DCNTL.EA and DMODE.FC1 across an ISTAT.RST
>      reset
>    hw/scsi/ncr53c710: Document the SIGP latch deviation


Re: [RFC PATCH-for-11.2 v4 00/14] nc53c710 rewrite
Posted by Helge Deller 2 days, 5 hours ago
On 11/20/26 18:20, Philippe Mathieu-Daudé wrote:
> On 20/11/26 18:12, Philippe Mathieu-Daudé wrote:
>> Fourth attempt to replace the existing 53c710 driver by
>> a new driver based on the code of the lsi53c895a.c :)
>>
>> Used LLM to decompose v3 as logical / atomic changes when
>> possible (didn't work well with the rewrite patch).
>>
>> Fixes extracted first so could be merged for v11.2 (patches
>> 1 to 5). The rest is the rewrite, so up to the maintainers
>> (Helge, Mark) and is probably OK as hobbyist-only code.
>>
>> Since v3:
>> - header split, Suggested-by tag (Zoltan)
>> - I couldn't figure the "hw/misc/lasi.c" change so dropped
>>    the comment about it.
>> - Dropped "move to COMMAND on CLEAR ACK after MESSAGE REJECT"
>> - Split rewrite patch as separated commits:
>>     - base engine
>>     - asynchronous completions
>>     - synchronous drain
>>     - HP-UX MESSAGE REJECT quirk
>>     - reentrancy guard and reset-time request cancel
>>
>> hw/scsi/ncr53c710.c is derived from hw/scsi/lsi53c895a.c which
>> is LGPL, the rewrite is now declared GPL-2.0-or-later.
>> hw/scsi/lsi_scsi.h, which is moved verbatim from lsi53c895a.c,
>> keeps the original terms: its header says "This code is licensed
>> under the LGPL." with SPDX-License-Identifier: LGPL-2.1-or-later.
>>
>> Series reviewed against the NCR 53C710 data manual but totally
>> untested (I don't have guest code to run), thus compile-checked
>> only. I haven't tested whether the series is bisectable.
> 
> This is only a split experiment if Helge/Keith/Mark/Zoltan want
> to pursue, I'm not going to respin.

Thank you Philippe!
That was very good work.
The result is pretty much the original (and yours is actually a little bit nicer though).
I just gave it a runtime spin, and it booted Linux nicely up to a prompt.

>> Keith Monahan (9):
>>    hw/scsi/scsi-disk: Add quirk_mode_page_no_flexible_disk, use it on the
>>      715
>>    hw/scsi: Move shared LSI/NCR definitions to lsi_scsi.h
>>    hw/scsi/ncr53c710: Rewrite the 53C710 SCRIPTS engine
>>    hw/scsi/ncr53c710: Deliver completions from bottom halves
>>    hw/scsi/ncr53c710: Drain asynchronous transfers in the register write
>>    hw/scsi/ncr53c710: Append SAVE DATA POINTERS after MESSAGE REJECT for
>>      HP-UX
>>    hw/scsi/ncr53c710: Guard SCRIPTS reentrancy and cancel requests on
>>      soft reset
>>    hw/scsi/lasi_ncr710: Map the full LASI SCSI module page
>>    hw/scsi/ncr53c710: Bump the migration version
>>
>> Philippe Mathieu-Daudé (5):
> 
> Oops here author should be Keith Monahan?

That's easy to fix for me.

Thank you!
Helge
  
>>    hw/scsi/ncr53c710: Cancel the in-flight request on soft reset
>>    hw/scsi/ncr53c710: Do not load SBCL from DBC after a SCRIPTS phase
>>      move
>>    hw/scsi/lasi_ncr710: Limit max_target and max_lun to 7
>>    hw/scsi/ncr53c710: Keep DCNTL.EA and DMODE.FC1 across an ISTAT.RST
>>      reset
>>    hw/scsi/ncr53c710: Document the SIGP latch deviation
> 
Re: [RFC PATCH-for-11.2 v4 00/14] nc53c710 rewrite
Posted by BALATON Zoltan 2 days, 6 hours ago
On Fri, 20 Nov 2026, Philippe Mathieu-Daudé wrote:
> On 20/11/26 18:12, Philippe Mathieu-Daudé wrote:
>> Fourth attempt to replace the existing 53c710 driver by
>> a new driver based on the code of the lsi53c895a.c :)
>> 
>> Used LLM to decompose v3 as logical / atomic changes when
>> possible (didn't work well with the rewrite patch).
>> 
>> Fixes extracted first so could be merged for v11.2 (patches
>> 1 to 5). The rest is the rewrite, so up to the maintainers
>> (Helge, Mark) and is probably OK as hobbyist-only code.
>> 
>> Since v3:
>> - header split, Suggested-by tag (Zoltan)
>> - I couldn't figure the "hw/misc/lasi.c" change so dropped
>>    the comment about it.
>> - Dropped "move to COMMAND on CLEAR ACK after MESSAGE REJECT"
>> - Split rewrite patch as separated commits:
>>     - base engine
>>     - asynchronous completions
>>     - synchronous drain
>>     - HP-UX MESSAGE REJECT quirk
>>     - reentrancy guard and reset-time request cancel
>> 
>> hw/scsi/ncr53c710.c is derived from hw/scsi/lsi53c895a.c which
>> is LGPL, the rewrite is now declared GPL-2.0-or-later.
>> hw/scsi/lsi_scsi.h, which is moved verbatim from lsi53c895a.c,
>> keeps the original terms: its header says "This code is licensed
>> under the LGPL." with SPDX-License-Identifier: LGPL-2.1-or-later.
>> 
>> Series reviewed against the NCR 53C710 data manual but totally
>> untested (I don't have guest code to run), thus compile-checked
>> only. I haven't tested whether the series is bisectable.
>
> This is only a split experiment if Helge/Keith/Mark/Zoltan want
> to pursue, I'm not going to respin.

This helps reviewing but not perfect yet so if nobody is going to take it 
and make a v2 then it's a dead end. I added some comments nevertheless if 
somebody can do something about that.

Regards,
BALATON Zoltan

>> Keith Monahan (9):
>>    hw/scsi/scsi-disk: Add quirk_mode_page_no_flexible_disk, use it on the
>>      715
>>    hw/scsi: Move shared LSI/NCR definitions to lsi_scsi.h
>>    hw/scsi/ncr53c710: Rewrite the 53C710 SCRIPTS engine
>>    hw/scsi/ncr53c710: Deliver completions from bottom halves
>>    hw/scsi/ncr53c710: Drain asynchronous transfers in the register write
>>    hw/scsi/ncr53c710: Append SAVE DATA POINTERS after MESSAGE REJECT for
>>      HP-UX
>>    hw/scsi/ncr53c710: Guard SCRIPTS reentrancy and cancel requests on
>>      soft reset
>>    hw/scsi/lasi_ncr710: Map the full LASI SCSI module page
>>    hw/scsi/ncr53c710: Bump the migration version
>> 
>> Philippe Mathieu-Daudé (5):
>
> Oops here author should be Keith Monahan?
>
>>    hw/scsi/ncr53c710: Cancel the in-flight request on soft reset
>>    hw/scsi/ncr53c710: Do not load SBCL from DBC after a SCRIPTS phase
>>      move
>>    hw/scsi/lasi_ncr710: Limit max_target and max_lun to 7
>>    hw/scsi/ncr53c710: Keep DCNTL.EA and DMODE.FC1 across an ISTAT.RST
>>      reset
>>    hw/scsi/ncr53c710: Document the SIGP latch deviation
>
>