All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: "Helge Deller" <deller@gmx.de>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Fam Zheng" <fam@euphon.net>,
	"Keith Monahan" <keith@techtravels.org>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Subject: [RFC PATCH-for-11.2 v4 03/14] hw/scsi/scsi-disk: Add quirk_mode_page_no_flexible_disk, use it on the 715
Date: Fri, 20 Nov 2026 18:12:23 +0100	[thread overview]
Message-ID: <20261120171235.61325-4-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20261120171235.61325-1-philmd@oss.qualcomm.com>

From: Keith Monahan <keith@techtravels.org>

scsi-disk answers MODE SENSE for page 05h (flexible disk geometry)
for every disk. Per the commit author, real SCSI hard disks of that era
reject this page with CHECK CONDITION, ILLEGAL REQUEST, INVALID FIELD IN
CDB, as only floppy drives implement it. This has not been verified
against real hardware or a datasheet here.

Per the commit author, HP-UX 9 on the HP 715 probes page 05h on the open
root disk and, when the page is returned, treats the disk as a floppy
and leaves it out of the ioscan listing, so SAM shows no hard disk.
This guest behaviour has not been reproduced here.

Add the quirk_mode_page_no_flexible_disk property, which makes page 05h
an invalid field in the CDB, and enable it for scsi-hd on the HP 715
machine through its compat properties. The property is also defined for
scsi-cd, like the other mode page quirks, as both device types share
mode_sense_page() and the same quirks bitmap; the 715 does not enable
it there.

The array name hw_compat_715 suggested a versioned machine compat
table, which it is not; call it hp_715_scsi_quirks.

AI-used-for: Patch series decomposition (commit splitting and ordering)
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
 include/hw/scsi/scsi.h |  1 +
 hw/hppa/machine.c      | 10 ++++++++++
 hw/scsi/scsi-disk.c    | 13 +++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
index a2f6f0be7fce..0efa62554d50 100644
--- a/include/hw/scsi/scsi.h
+++ b/include/hw/scsi/scsi.h
@@ -264,5 +264,6 @@ bool scsi_generic_pr_state_cleanup(SCSIDevice *s, Error **errp);
 #define SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE    2
 #define SCSI_DISK_QUIRK_MODE_PAGE_TRUNCATED                3
 #define SCSI_DISK_QUIRK_MODE_PAGE_SET_BLOCK_SIZE           4
+#define SCSI_DISK_QUIRK_MODE_PAGE_NO_FLEXIBLE_DISK         5
 
 #endif
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 8a3f673daf75..2c9114995aad 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -1024,6 +1024,14 @@ static void HP_A400_machine_init_class_init(ObjectClass *oc, const void *data)
     mc->default_ram_size = 1024 * MiB;
 }
 
+/*
+ * HP-UX 9 ioscan sends MODE SENSE page 5 to the open root disk and leaves
+ * the disk out of its listing if the page is returned.
+ */
+static GlobalProperty hp_715_scsi_quirks[] = {
+    { "scsi-hd", "quirk_mode_page_no_flexible_disk", "on" },
+};
+
 static void HP_715_machine_init_class_init(ObjectClass *oc, const void *data)
 {
     static const char * const valid_cpu_types[] = {
@@ -1045,6 +1053,8 @@ static void HP_715_machine_init_class_init(ObjectClass *oc, const void *data)
     mc->max_cpus = MIN_CONST(HPPA_MAX_CPUS, 8);
     mc->default_ram_size = 256 * MiB;
     mc->default_nic = TYPE_LASI_82596;
+    compat_props_add(mc->compat_props, hp_715_scsi_quirks,
+                     G_N_ELEMENTS(hp_715_scsi_quirks));
 }
 
 
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index a2df3a4ec464..ce43ddf6c062 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -1156,6 +1156,15 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
         return -1;
     }
 
+    /*
+     * The flexible disk page is only implemented by floppy drives.  Some
+     * guests (HP-UX 9 ioscan) take a disk that returns it for a floppy.
+     */
+    if (page == MODE_PAGE_FLEXIBLE_DISK_GEOMETRY &&
+        (s->quirks & (1 << SCSI_DISK_QUIRK_MODE_PAGE_NO_FLEXIBLE_DISK))) {
+        return -1;
+    }
+
     /*
      * If Changeable Values are requested, a mask denoting those mode parameters
      * that are changeable shall be returned. As we currently don't support
@@ -3293,6 +3302,8 @@ static const Property scsi_hd_properties[] = {
                     0),
     DEFINE_PROP_BIT("quirk_mode_page_set_block_size", SCSIDiskState,
                     quirks, SCSI_DISK_QUIRK_MODE_PAGE_SET_BLOCK_SIZE, 0),
+    DEFINE_PROP_BIT("quirk_mode_page_no_flexible_disk", SCSIDiskState,
+                    quirks, SCSI_DISK_QUIRK_MODE_PAGE_NO_FLEXIBLE_DISK, 0),
     DEFINE_BLOCK_CHS_PROPERTIES(SCSIDiskState, qdev.conf),
 };
 
@@ -3401,6 +3412,8 @@ static const Property scsi_cd_properties[] = {
                     SCSI_DISK_QUIRK_MODE_PAGE_TRUNCATED, 0),
     DEFINE_PROP_BIT("quirk_mode_page_set_block_size", SCSIDiskState,
                     quirks, SCSI_DISK_QUIRK_MODE_PAGE_SET_BLOCK_SIZE, 0),
+    DEFINE_PROP_BIT("quirk_mode_page_no_flexible_disk", SCSIDiskState,
+                    quirks, SCSI_DISK_QUIRK_MODE_PAGE_NO_FLEXIBLE_DISK, 0),
 };
 
 static void scsi_cd_class_initfn(ObjectClass *klass, const void *data)
-- 
2.55.0



  parent reply	other threads:[~2026-11-20 17:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 17:12 [RFC PATCH-for-11.2 v4 00/14] nc53c710 rewrite Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2 v4 01/14] hw/scsi/ncr53c710: Cancel the in-flight request on soft reset Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2 v4 02/14] hw/scsi/ncr53c710: Do not load SBCL from DBC after a SCRIPTS phase move Philippe Mathieu-Daudé
2026-11-20 17:12 ` Philippe Mathieu-Daudé [this message]
2026-11-20 17:12 ` [RFC PATCH-for-11.2 v4 04/14] hw/scsi/lasi_ncr710: Limit max_target and max_lun to 7 Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2 v4 05/14] hw/scsi/ncr53c710: Keep DCNTL.EA and DMODE.FC1 across an ISTAT.RST reset Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 06/14] hw/scsi: Move shared LSI/NCR definitions to lsi_scsi.h Philippe Mathieu-Daudé
2026-11-20 22:10   ` BALATON Zoltan
2026-11-20 17:12 ` [RFC PATCH-for-11.2??? v4 07/14] hw/scsi/ncr53c710: Rewrite the 53C710 SCRIPTS engine Philippe Mathieu-Daudé
2026-11-20 22:13   ` BALATON Zoltan
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 08/14] hw/scsi/ncr53c710: Deliver completions from bottom halves Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 09/14] hw/scsi/ncr53c710: Drain asynchronous transfers in the register write Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 10/14] hw/scsi/ncr53c710: Append SAVE DATA POINTERS after MESSAGE REJECT for HP-UX Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 11/14] hw/scsi/ncr53c710: Guard SCRIPTS reentrancy and cancel requests on soft reset Philippe Mathieu-Daudé
2026-11-20 22:17   ` BALATON Zoltan
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 12/14] hw/scsi/lasi_ncr710: Map the full LASI SCSI module page Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 13/14] hw/scsi/ncr53c710: Document the SIGP latch deviation Philippe Mathieu-Daudé
2026-11-20 17:12 ` [RFC PATCH-for-11.2? v4 14/14] hw/scsi/ncr53c710: Bump the migration version Philippe Mathieu-Daudé
2026-11-20 22:21   ` BALATON Zoltan
2026-11-20 17:20 ` [RFC PATCH-for-11.2 v4 00/14] nc53c710 rewrite Philippe Mathieu-Daudé
2026-11-20 22:09   ` BALATON Zoltan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261120171235.61325-4-philmd@oss.qualcomm.com \
    --to=philmd@oss.qualcomm.com \
    --cc=balaton@eik.bme.hu \
    --cc=deller@gmx.de \
    --cc=fam@euphon.net \
    --cc=keith@techtravels.org \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.