All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@kernel.org>
To: qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>, Helge Deller <deller@gmx.de>,
	Fam Zheng <fam@euphon.net>, BALATON Zoltan <balaton@eik.bme.hu>,
	Keith Monahan <keith@techtravels.org>
Subject: [PATCH v3 5/6] hw/scsi/scsi-disk: add quirk_mode_page_no_flexible_disk, use it on the 715
Date: Fri, 20 Nov 2026 00:32:34 +0100	[thread overview]
Message-ID: <20261119233235.32808-6-deller@kernel.org> (raw)
In-Reply-To: <20261119233235.32808-1-deller@kernel.org>

From: Keith Monahan <keith@techtravels.org>

scsi-hd returns MODE SENSE page 5 (flexible disk geometry) for every
disk.  Real SCSI hard disks do not implement it; only floppy drives do.
HP-UX 9 ioscan sends MODE SENSE page 5 to the open root disk and leaves
the disk out of its listing when the page comes back, so SAM's disk
manager shows no hard disk.  Add quirk_mode_page_no_flexible_disk,
which makes page 5 an invalid field in the CDB, and turn it on for
scsi-hd on the HP 715 machine.

Signed-off-by: Keith Monahan <keith@techtravels.org>
Signed-off-by: Helge Deller <deller@gmx.de>
---
 hw/hppa/machine.c      | 10 ++++++++++
 hw/scsi/scsi-disk.c    | 13 +++++++++++++
 include/hw/scsi/scsi.h |  1 +
 3 files changed, 24 insertions(+)

diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 8a3f673daf..004cb4b5df 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 hw_compat_715[] = {
+    { "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, hw_compat_715,
+                     G_N_ELEMENTS(hw_compat_715));
 }
 
 
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index a2df3a4ec4..ce43ddf6c0 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)
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
index a2f6f0be7f..0efa62554d 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
-- 
2.54.0



  parent reply	other threads:[~2026-11-19 23:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 23:32 [PATCH v3 0/6] nc53c710 rewrite Helge Deller
2026-11-19 23:32 ` [PATCH v3 1/6] hw/scsi/ncr53c710: rewrite the 53C710 SCRIPTS engine Helge Deller
2026-11-19 23:32 ` [PATCH v3 2/6] hw/scsi: share NCR/LSI definitions in lsi_scsi.h Helge Deller
2026-11-20  0:58   ` BALATON Zoltan
2026-11-20  8:43     ` Helge Deller
2026-11-20 10:37       ` BALATON Zoltan
2026-11-19 23:32 ` [PATCH v3 3/6] hw/scsi/lasi_ncr710: map the full LASI SCSI module page Helge Deller
2026-11-19 23:32 ` [PATCH v3 4/6] hw/scsi/ncr53c710: move to COMMAND on CLEAR ACK after MESSAGE REJECT Helge Deller
2026-11-19 23:32 ` Helge Deller [this message]
2026-11-19 23:32 ` [PATCH v3 6/6] hw/scsi/ncr53c710: Comment cleanup, reduce verbosity, repetition Helge Deller
2026-11-19 23:39 ` [PATCH v3 0/6] nc53c710 rewrite Philippe Mathieu-Daudé
2026-11-20  8:25   ` Helge Deller
2026-11-20  9:59     ` Mark Cave-Ayland
2026-11-20 16:34       ` Philippe Mathieu-Daudé
2026-11-20 16:43         ` Mark Cave-Ayland
2026-11-20 17:18           ` Philippe Mathieu-Daudé
2026-11-20  1:12 ` 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=20261119233235.32808-6-deller@kernel.org \
    --to=deller@kernel.org \
    --cc=balaton@eik.bme.hu \
    --cc=deller@gmx.de \
    --cc=fam@euphon.net \
    --cc=keith@techtravels.org \
    --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.