Skip to contentSkip to conversation

Add Qemu to SeaBIOS LCHS interface

PATCH Superseded Sam Eiderman via Qemu-devel 6 participants 20 messages Aug 27, 2019 – Sep 25, 2019

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add Qemu to SeaBIOS LCHS interface

v1:

Non-standard logical geometries break under QEMU.

A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEMU/SeaBIOS if it has non-standard logical geometries - for example 56 SPT (sectors per track). No matter what QEMU will guess - SeaBIOS, for large enough disks - will use LBA translation, which will report 63 SPT instead.

In addition we can not enforce SeaBIOS to rely on phyiscal geometries at all. A virtio-blk-pci virtual disk with 255 phyiscal heads can not report more than 16 physical heads when moved to an IDE controller, the ATA spec allows a maximum of 16 heads - this is an artifact of virtualization.

By supplying the logical geometies directly we are able to support such "exotic" disks.

We will use fw_cfg to do just that.

v2:

Fix missing parenthesis check in
"hd-geo-test: Add tests for lchs override"

v3:

* Rename fw_cfg key to "bios-geometry".
* Remove "extendible" interface.
* Add cpu_to_le32 fix as Laszlo suggested or big endian hosts
* Fix last qtest commit - automatic docker tester for some reason does not have qemu-img set

v4:

* Change fw_cfg interface from mixed textual/binary to textual only

v5:

* Fix line > 80 chars in tests/hd-geo-test.c

v6:

* Small fixes for issues pointed by Max
* (&conf->conf)->lcyls to conf->conf.lcyls and so on
* Remove scsi_unrealize from everything other than scsi-hd
* Add proper include to sysemu.h
* scsi_device_unrealize() after scsi_device_purge_requests()

Sam Eiderman (8):
block: Refactor macros - fix tabbing
block: Support providing LCHS from user
bootdevice: Add interface to gather LCHS
scsi: Propagate unrealize() callback to scsi-hd
bootdevice: Gather LCHS from all relevant devices
bootdevice: Refactor get_boot_devices_list
bootdevice: FW_CFG interface for LCHS values
hd-geo-test: Add tests for lchs override

 bootdevice.c             | 148 ++++++++--
 hw/block/virtio-blk.c    |   6 +
 hw/ide/qdev.c            |   7 +-
 hw/nvram/fw_cfg.c        |  14 +-
 hw/scsi/scsi-bus.c       |  16 ++
 hw/scsi/scsi-disk.c      |  12 +
 include/hw/block/block.h |  22 +-
 include/hw/scsi/scsi.h   |   1 +
 include/sysemu/sysemu.h  |   4 +
 tests/Makefile.include   |   2 +-
 tests/hd-geo-test.c      | 582 +++++++++++++++++++++++++++++++++++++++
 11 files changed, 773 insertions(+), 41 deletions(-)
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
#1 lore raw

PATCH v6 1/8 block: Refactor macros - fix tabbing

From: Sam Eiderman <[email protected]>

Fixing tabbing in block related macros.

---
 hw/ide/qdev.c            |  2 +-
 include/hw/block/block.h | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)
hw/ide/qdev.c +1 -1
index 6fba6b62b8..6dd219944f 100644
@@ -290,7 +290,7 @@ static void ide_drive_realize(IDEDevice *dev, Error **errp)
     DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf),        \
     DEFINE_BLOCK_ERROR_PROPERTIES(IDEDrive, dev.conf),  \
     DEFINE_PROP_STRING("ver",  IDEDrive, dev.version),  \
-    DEFINE_PROP_UINT64("wwn",  IDEDrive, dev.wwn, 0),    \
+    DEFINE_PROP_UINT64("wwn",  IDEDrive, dev.wwn, 0),   \
     DEFINE_PROP_STRING("serial",  IDEDrive, dev.serial),\
     DEFINE_PROP_STRING("model", IDEDrive, dev.model)
 
include/hw/block/block.h +8 -8
index 607539057a..fd55a30bca 100644
@@ -50,21 +50,21 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
                           _conf.logical_block_size),                    \
     DEFINE_PROP_BLOCKSIZE("physical_block_size", _state,                \
                           _conf.physical_block_size),                   \
-    DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0),  \
+    DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0),    \
     DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0),    \
-    DEFINE_PROP_UINT32("discard_granularity", _state, \
-                       _conf.discard_granularity, -1), \
-    DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce, \
-                            ON_OFF_AUTO_AUTO), \
+    DEFINE_PROP_UINT32("discard_granularity", _state,                   \
+                       _conf.discard_granularity, -1),                  \
+    DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce,           \
+                            ON_OFF_AUTO_AUTO),                          \
     DEFINE_PROP_BOOL("share-rw", _state, _conf.share_rw, false)
 
 #define DEFINE_BLOCK_PROPERTIES(_state, _conf)                          \
     DEFINE_PROP_DRIVE("drive", _state, _conf.blk),                      \
     DEFINE_BLOCK_PROPERTIES_BASE(_state, _conf)
 
-#define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf)      \
-    DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0),  \
-    DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0), \
+#define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf)                      \
+    DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0),                  \
+    DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0),                \
     DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0)
 
 #define DEFINE_BLOCK_ERROR_PROPERTIES(_state, _conf)                    \
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
#2 lore raw

PATCH v6 2/8 block: Support providing LCHS from user

In reply to Sam Eiderman via Qemu-devel

From: Sam Eiderman <[email protected]>

Add logical geometry variables to BlockConf.

A user can now supply "lcyls", "lheads" & "lsecs" for any HD device that supports CHS ("cyls", "heads", "secs").

These devices include:
* ide-hd
* scsi-hd
* virtio-blk-pci

In future commits we will use the provided LCHS and pass it to the BIOS through fw_cfg to be supplied using INT13 routines.

---
 include/hw/block/block.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/hw/block/block.h +5 -1
index fd55a30bca..d7246f3862 100644
@@ -26,6 +26,7 @@ typedef struct BlockConf {
     uint32_t discard_granularity;
     /* geometry, not all devices use this */
     uint32_t cyls, heads, secs;
+    uint32_t lcyls, lheads, lsecs;
     OnOffAuto wce;
     bool share_rw;
     BlockdevOnError rerror;
@@ -65,7 +66,10 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
 #define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf)                      \
     DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0),                  \
     DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0),                \
-    DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0)
+    DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0),                  \
+    DEFINE_PROP_UINT32("lcyls", _state, _conf.lcyls, 0),                \
+    DEFINE_PROP_UINT32("lheads", _state, _conf.lheads, 0),              \
+    DEFINE_PROP_UINT32("lsecs", _state, _conf.lsecs, 0)
 
 #define DEFINE_BLOCK_ERROR_PROPERTIES(_state, _conf)                    \
     DEFINE_PROP_BLOCKDEV_ON_ERROR("rerror", _state, _conf.rerror,       \
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
#3 lore raw

PATCH v6 3/8 bootdevice: Add interface to gather LCHS

In reply to Sam Eiderman via Qemu-devel

From: Sam Eiderman <[email protected]>

Add an interface to provide direct logical CHS values for boot devices. We will use this interface in the next commits.

---
 bootdevice.c            | 55 +++++++++++++++++++++++++++++++++++++++++
 include/sysemu/sysemu.h |  3 +++
 2 files changed, 58 insertions(+)
bootdevice.c +55 -0
index 1d225202f9..bc5e1c2de4 100644
@@ -343,3 +343,58 @@ void device_add_bootindex_property(Object *obj, int32_t *bootindex,
     /* initialize devices' bootindex property to -1 */
     object_property_set_int(obj, -1, name, NULL);
 }
+
+typedef struct FWLCHSEntry FWLCHSEntry;
+
+struct FWLCHSEntry {
+    QTAILQ_ENTRY(FWLCHSEntry) link;
+    DeviceState *dev;
+    char *suffix;
+    uint32_t lcyls;
+    uint32_t lheads;
+    uint32_t lsecs;
+};
+
+static QTAILQ_HEAD(, FWLCHSEntry) fw_lchs =
+    QTAILQ_HEAD_INITIALIZER(fw_lchs);
+
+void add_boot_device_lchs(DeviceState *dev, const char *suffix,
+                          uint32_t lcyls, uint32_t lheads, uint32_t lsecs)
+{
+    FWLCHSEntry *node;
+
+    if (!lcyls && !lheads && !lsecs) {
+        return;
+    }
+
+    assert(dev != NULL || suffix != NULL);
+
+    node = g_malloc0(sizeof(FWLCHSEntry));
+    node->suffix = g_strdup(suffix);
+    node->dev = dev;
+    node->lcyls = lcyls;
+    node->lheads = lheads;
+    node->lsecs = lsecs;
+
+    QTAILQ_INSERT_TAIL(&fw_lchs, node, link);
+}
+
+void del_boot_device_lchs(DeviceState *dev, const char *suffix)
+{
+    FWLCHSEntry *i;
+
+    if (dev == NULL) {
+        return;
+    }
+
+    QTAILQ_FOREACH(i, &fw_lchs, link) {
+        if ((!suffix || !g_strcmp0(i->suffix, suffix)) &&
+             i->dev == dev) {
+            QTAILQ_REMOVE(&fw_lchs, i, link);
+            g_free(i->suffix);
+            g_free(i);
+
+            break;
+        }
+    }
+}
include/sysemu/sysemu.h +3 -0
index d2c38f611a..1a33f25a5a 100644
@@ -105,6 +105,9 @@ void device_add_bootindex_property(Object *obj, int32_t *bootindex,
                                    DeviceState *dev, Error **errp);
 void restore_boot_order(void *opaque);
 void validate_bootdevices(const char *devices, Error **errp);
+void add_boot_device_lchs(DeviceState *dev, const char *suffix,
+                          uint32_t lcyls, uint32_t lheads, uint32_t lsecs);
+void del_boot_device_lchs(DeviceState *dev, const char *suffix);
 
 /* handler to set the boot_device order for a specific type of MachineClass */
 typedef void QEMUBootSetHandler(void *opaque, const char *boot_order,
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
#4 lore raw

PATCH v6 4/8 scsi: Propagate unrealize() callback to scsi-hd

In reply to Sam Eiderman via Qemu-devel

From: Sam Eiderman <[email protected]>

We will need to add LCHS removal logic to scsi-hd's unrealize() in the next commit.

---
 hw/scsi/scsi-bus.c     | 16 ++++++++++++++++
 include/hw/scsi/scsi.h |  1 +
 2 files changed, 17 insertions(+)
hw/scsi/scsi-bus.c +16 -0
index bccb7cc4c6..359d50d6d0 100644
@@ -59,6 +59,14 @@ static void scsi_device_realize(SCSIDevice *s, Error **errp)
     }
 }
 
+static void scsi_device_unrealize(SCSIDevice *s, Error **errp)
+{
+    SCSIDeviceClass *sc = SCSI_DEVICE_GET_CLASS(s);
+    if (sc->unrealize) {
+        sc->unrealize(s, errp);
+    }
+}
+
 int scsi_bus_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf,
                        void *hba_private)
 {
@@ -217,12 +225,20 @@ static void scsi_qdev_realize(DeviceState *qdev, Error **errp)
 static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)
 {
     SCSIDevice *dev = SCSI_DEVICE(qdev);
+    Error *local_err = NULL;
 
     if (dev->vmsentry) {
         qemu_del_vm_change_state_handler(dev->vmsentry);
     }
 
     scsi_device_purge_requests(dev, SENSE_CODE(NO_SENSE));
+
+    scsi_device_unrealize(dev, &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
+        return;
+    }
+
     blockdev_mark_auto_del(dev->conf.blk);
 }
 
include/hw/scsi/scsi.h +1 -0
index d77a92361b..332ef602f4 100644
@@ -59,6 +59,7 @@ struct SCSIRequest {
 typedef struct SCSIDeviceClass {
     DeviceClass parent_class;
     void (*realize)(SCSIDevice *dev, Error **errp);
+    void (*unrealize)(SCSIDevice *dev, Error **errp);
     int (*parse_cdb)(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf,
                      void *hba_private);
     SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun,
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
#5 lore raw

PATCH v6 5/8 bootdevice: Gather LCHS from all relevant devices

In reply to Sam Eiderman via Qemu-devel

From: Sam Eiderman <[email protected]>

Relevant devices are:
* ide-hd (and ide-cd, ide-drive)
* scsi-hd (and scsi-cd, scsi-disk, scsi-block)
* virtio-blk-pci

We do not call del_boot_device_lchs() for ide-* since we don't need to - IDE block devices do not support unplugging.

---
 hw/block/virtio-blk.c |  6 ++++++
 hw/ide/qdev.c         |  5 +++++
 hw/scsi/scsi-disk.c   | 12 ++++++++++++
 3 files changed, 23 insertions(+)
hw/block/virtio-blk.c +6 -0
index 18851601cb..6d8ff34a16 100644
@@ -1186,6 +1186,11 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
     blk_set_guest_block_size(s->blk, s->conf.conf.logical_block_size);
 
     blk_iostatus_enable(s->blk);
+
+    add_boot_device_lchs(dev, "/disk@0,0",
+                         conf->conf.lcyls,
+                         conf->conf.lheads,
+                         conf->conf.lsecs);
 }
 
 static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)
@@ -1193,6 +1198,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)
     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
     VirtIOBlock *s = VIRTIO_BLK(dev);
 
+    del_boot_device_lchs(dev, "/disk@0,0");
     virtio_blk_data_plane_destroy(s->dataplane);
     s->dataplane = NULL;
     qemu_del_vm_change_state_handler(s->change);
hw/ide/qdev.c +5 -0
index 6dd219944f..2ffd387a73 100644
@@ -220,6 +220,11 @@ static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp)
 
     add_boot_device_path(dev->conf.bootindex, &dev->qdev,
                          dev->unit ? "/disk@1" : "/disk@0");
+
+    add_boot_device_lchs(&dev->qdev, dev->unit ? "/disk@1" : "/disk@0",
+                         dev->conf.lcyls,
+                         dev->conf.lheads,
+                         dev->conf.lsecs);
 }
 
 static void ide_dev_get_bootindex(Object *obj, Visitor *v, const char *name,
hw/scsi/scsi-disk.c +12 -0
index 915641a0f1..d19896fe4d 100644
@@ -35,6 +35,7 @@
 #include "hw/block/block.h"
 #include "hw/qdev-properties.h"
 #include "sysemu/dma.h"
+#include "sysemu/sysemu.h"
 #include "qemu/cutils.h"
 #include "trace.h"
 
@@ -2402,6 +2403,16 @@ static void scsi_realize(SCSIDevice *dev, Error **errp)
     blk_set_guest_block_size(s->qdev.conf.blk, s->qdev.blocksize);
 
     blk_iostatus_enable(s->qdev.conf.blk);
+
+    add_boot_device_lchs(&dev->qdev, NULL,
+                         dev->conf.lcyls,
+                         dev->conf.lheads,
+                         dev->conf.lsecs);
+}
+
+static void scsi_unrealize(SCSIDevice *dev, Error **errp)
+{
+    del_boot_device_lchs(&dev->qdev, NULL);
 }
 
 static void scsi_hd_realize(SCSIDevice *dev, Error **errp)
@@ -3006,6 +3017,7 @@ static void scsi_hd_class_initfn(ObjectClass *klass, void *data)
     SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass);
 
     sc->realize      = scsi_hd_realize;
+    sc->unrealize    = scsi_unrealize;
     sc->alloc_req    = scsi_new_request;
     sc->unit_attention_reported = scsi_disk_unit_attention_reported;
     dc->desc = "virtual SCSI disk";
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
Acked-by on v6 5/8
#6 lore raw

Re: [Qemu-block] [PATCH v6 5/8] bootdevice: Gather LCHS from all relevant devices

Quoted 7 lines · Sam Eiderman via Qemu-block

From: Sam Eiderman <[email protected]>

Relevant devices are:
* ide-hd (and ide-cd, ide-drive)
* scsi-hd (and scsi-cd, scsi-disk, scsi-block)
* virtio-blk-pci

Quoted 7 lines

We do not call del_boot_device_lchs() for ide-* since we don't need to - IDE block devices do not support unplugging.

Quoted 84 lines
---
 hw/block/virtio-blk.c |  6 ++++++
 hw/ide/qdev.c         |  5 +++++
 hw/scsi/scsi-disk.c   | 12 ++++++++++++
 3 files changed, 23 insertions(+)
hw/block/virtio-blk.c +6 -0
index 18851601cb..6d8ff34a16 100644
@@ -1186,6 +1186,11 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
     blk_set_guest_block_size(s->blk, s->conf.conf.logical_block_size);
 
     blk_iostatus_enable(s->blk);
+
+    add_boot_device_lchs(dev, "/disk@0,0",
+                         conf->conf.lcyls,
+                         conf->conf.lheads,
+                         conf->conf.lsecs);
 }
 
 static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)
@@ -1193,6 +1198,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)
     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
     VirtIOBlock *s = VIRTIO_BLK(dev);
 
+    del_boot_device_lchs(dev, "/disk@0,0");
     virtio_blk_data_plane_destroy(s->dataplane);
     s->dataplane = NULL;
     qemu_del_vm_change_state_handler(s->change);
hw/ide/qdev.c +5 -0
index 6dd219944f..2ffd387a73 100644
@@ -220,6 +220,11 @@ static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp)
 
     add_boot_device_path(dev->conf.bootindex, &dev->qdev,
                          dev->unit ? "/disk@1" : "/disk@0");
+
+    add_boot_device_lchs(&dev->qdev, dev->unit ? "/disk@1" : "/disk@0",
+                         dev->conf.lcyls,
+                         dev->conf.lheads,
+                         dev->conf.lsecs);
 }
 
 static void ide_dev_get_bootindex(Object *obj, Visitor *v, const char *name,
hw/scsi/scsi-disk.c +12 -0
index 915641a0f1..d19896fe4d 100644
@@ -35,6 +35,7 @@
 #include "hw/block/block.h"
 #include "hw/qdev-properties.h"
 #include "sysemu/dma.h"
+#include "sysemu/sysemu.h"
 #include "qemu/cutils.h"
 #include "trace.h"
 
@@ -2402,6 +2403,16 @@ static void scsi_realize(SCSIDevice *dev, Error **errp)
     blk_set_guest_block_size(s->qdev.conf.blk, s->qdev.blocksize);
 
     blk_iostatus_enable(s->qdev.conf.blk);
+
+    add_boot_device_lchs(&dev->qdev, NULL,
+                         dev->conf.lcyls,
+                         dev->conf.lheads,
+                         dev->conf.lsecs);
+}
+
+static void scsi_unrealize(SCSIDevice *dev, Error **errp)
+{
+    del_boot_device_lchs(&dev->qdev, NULL);
 }
 
 static void scsi_hd_realize(SCSIDevice *dev, Error **errp)
@@ -3006,6 +3017,7 @@ static void scsi_hd_class_initfn(ObjectClass *klass, void *data)
     SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass);
 
     sc->realize      = scsi_hd_realize;
+    sc->unrealize    = scsi_unrealize;
     sc->alloc_req    = scsi_new_request;
     sc->unit_attention_reported = scsi_disk_unit_attention_reported;
     dc->desc = "virtual SCSI disk";
#7 lore raw

PATCH v6 6/8 bootdevice: Refactor get_boot_devices_list

In reply to Sam Eiderman via Qemu-devel

From: Sam Eiderman <[email protected]>

Move device name construction to a separate function.

We will reuse this function in the following commit to pass logical CHS parameters through fw_cfg much like we currently pass bootindex.

---
 bootdevice.c | 61 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 27 deletions(-)
bootdevice.c +34 -27
index bc5e1c2de4..2b12fb85a4 100644
@@ -202,6 +202,39 @@ DeviceState *get_boot_device(uint32_t position)
     return res;
 }
 
+static char *get_boot_device_path(DeviceState *dev, bool ignore_suffixes,
+                                  char *suffix)
+{
+    char *devpath = NULL, *s = NULL, *d, *bootpath;
+
+    if (dev) {
+        devpath = qdev_get_fw_dev_path(dev);
+        assert(devpath);
+    }
+
+    if (!ignore_suffixes) {
+        if (dev) {
+            d = qdev_get_own_fw_dev_path_from_handler(dev->parent_bus, dev);
+            if (d) {
+                assert(!suffix);
+                s = d;
+            } else {
+                s = g_strdup(suffix);
+            }
+        } else {
+            s = g_strdup(suffix);
+        }
+    }
+
+    bootpath = g_strdup_printf("%s%s",
+                               devpath ? devpath : "",
+                               s ? s : "");
+    g_free(devpath);
+    g_free(s);
+
+    return bootpath;
+}
+
 /*
  * This function returns null terminated string that consist of new line
  * separated device paths.
@@ -218,36 +251,10 @@ char *get_boot_devices_list(size_t *size)
     bool ignore_suffixes = mc->ignore_boot_device_suffixes;
 
     QTAILQ_FOREACH(i, &fw_boot_order, link) {
-        char *devpath = NULL,  *suffix = NULL;
         char *bootpath;
-        char *d;
         size_t len;
 
-        if (i->dev) {
-            devpath = qdev_get_fw_dev_path(i->dev);
-            assert(devpath);
-        }
-
-        if (!ignore_suffixes) {
-            if (i->dev) {
-                d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus,
-                                                          i->dev);
-                if (d) {
-                    assert(!i->suffix);
-                    suffix = d;
-                } else {
-                    suffix = g_strdup(i->suffix);
-                }
-            } else {
-                suffix = g_strdup(i->suffix);
-            }
-        }
-
-        bootpath = g_strdup_printf("%s%s",
-                                   devpath ? devpath : "",
-                                   suffix ? suffix : "");
-        g_free(devpath);
-        g_free(suffix);
+        bootpath = get_boot_device_path(i->dev, ignore_suffixes, i->suffix);
 
         if (total) {
             list[total-1] = '\n';
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
#8 lore raw

PATCH v6 7/8 bootdevice: FW_CFG interface for LCHS values

In reply to Sam Eiderman via Qemu-devel

From: Sam Eiderman <[email protected]>

Using fw_cfg, supply logical CHS values directly from QEMU to the BIOS.

Non-standard logical geometries break under QEMU.

A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEMU/SeaBIOS if it has non-standard logical geometries - for example 56 SPT (sectors per track). No matter what QEMU will report - SeaBIOS, for large enough disks - will use LBA translation, which will report 63 SPT instead.

In addition we cannot force SeaBIOS to rely on physical geometries at all. A virtio-blk-pci virtual disk with 255 phyiscal heads cannot report more than 16 physical heads when moved to an IDE controller, since the ATA spec allows a maximum of 16 heads - this is an artifact of virtualization.

By supplying the logical geometries directly we are able to support such "exotic" disks.

We serialize this information in a similar way to the "bootorder" interface.
The new fw_cfg entry is "bios-geometry".

---
 bootdevice.c            | 32 ++++++++++++++++++++++++++++++++
 hw/nvram/fw_cfg.c       | 14 +++++++++++---
 include/sysemu/sysemu.h |  1 +
 3 files changed, 44 insertions(+), 3 deletions(-)
bootdevice.c +32 -0
index 2b12fb85a4..b034ad7bdc 100644
@@ -405,3 +405,35 @@ void del_boot_device_lchs(DeviceState *dev, const char *suffix)
         }
     }
 }
+
+/* Serialized as: (device name\0 + lchs struct) x devices */
+char *get_boot_devices_lchs_list(size_t *size)
+{
+    FWLCHSEntry *i;
+    size_t total = 0;
+    char *list = NULL;
+
+    QTAILQ_FOREACH(i, &fw_lchs, link) {
+        char *bootpath;
+        char *chs_string;
+        size_t len;
+
+        bootpath = get_boot_device_path(i->dev, false, i->suffix);
+        chs_string = g_strdup_printf("%s %" PRIu32 " %" PRIu32 " %" PRIu32,
+                                     bootpath, i->lcyls, i->lheads, i->lsecs);
+
+        if (total) {
+            list[total - 1] = '\n';
+        }
+        len = strlen(chs_string) + 1;
+        list = g_realloc(list, total + len);
+        memcpy(&list[total], chs_string, len);
+        total += len;
+        g_free(chs_string);
+        g_free(bootpath);
+    }
+
+    *size = total;
+
+    return list;
+}
hw/nvram/fw_cfg.c +11 -3
index 7dc3ac378e..18aff658c0 100644
@@ -920,13 +920,21 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename,
 
 static void fw_cfg_machine_reset(void *opaque)
 {
+    MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
+    FWCfgState *s = opaque;
     void *ptr;
     size_t len;
-    FWCfgState *s = opaque;
-    char *bootindex = get_boot_devices_list(&len);
+    char *buf;
 
-    ptr = fw_cfg_modify_file(s, "bootorder", (uint8_t *)bootindex, len);
+    buf = get_boot_devices_list(&len);
+    ptr = fw_cfg_modify_file(s, "bootorder", (uint8_t *)buf, len);
     g_free(ptr);
+
+    if (!mc->legacy_fw_cfg_order) {
+        buf = get_boot_devices_lchs_list(&len);
+        ptr = fw_cfg_modify_file(s, "bios-geometry", (uint8_t *)buf, len);
+        g_free(ptr);
+    }
 }
 
 static void fw_cfg_machine_ready(struct Notifier *n, void *data)
include/sysemu/sysemu.h +1 -0
index 1a33f25a5a..150fe8c0e2 100644
@@ -108,6 +108,7 @@ void validate_bootdevices(const char *devices, Error **errp);
 void add_boot_device_lchs(DeviceState *dev, const char *suffix,
                           uint32_t lcyls, uint32_t lheads, uint32_t lsecs);
 void del_boot_device_lchs(DeviceState *dev, const char *suffix);
+char *get_boot_devices_lchs_list(size_t *size);
 
 /* handler to set the boot_device order for a specific type of MachineClass */
 typedef void QEMUBootSetHandler(void *opaque, const char *boot_order,
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
#9 lore raw

PATCH v6 8/8 hd-geo-test: Add tests for lchs override

In reply to Sam Eiderman via Qemu-devel

From: Sam Eiderman <[email protected]>

Add QTest tests to check the logical geometry override option.

The tests in hd-geo-test are out of date - they only test IDE and do not test interesting MBRs.

I added a few helper functions which will make adding more tests easier.

QTest's fw_cfg helper functions support only legacy fw_cfg, so I had to read the new fw_cfg layout on my own.

Creating qcow2 disks with specific size and MBR layout is currently unused - we only use a default empty MBR.

---
 tests/Makefile.include |   2 +-
 tests/hd-geo-test.c    | 582 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 583 insertions(+), 1 deletion(-)
tests/Makefile.include +1 -1
index 39bed753b3..bd385e2150 100644
@@ -781,7 +781,7 @@ tests/ide-test$(EXESUF): tests/ide-test.o $(libqos-pc-obj-y)
 tests/ahci-test$(EXESUF): tests/ahci-test.o $(libqos-pc-obj-y) qemu-img$(EXESUF)
 tests/ipmi-kcs-test$(EXESUF): tests/ipmi-kcs-test.o
 tests/ipmi-bt-test$(EXESUF): tests/ipmi-bt-test.o
-tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
+tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o $(libqos-obj-y)
 tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y)
 tests/boot-serial-test$(EXESUF): tests/boot-serial-test.o $(libqos-obj-y)
 tests/bios-tables-test$(EXESUF): tests/bios-tables-test.o \
tests/hd-geo-test.c +582 -0

601 lines not on this page · raw message

Signature · 1 line
2.23.0.187.g17f5b7556c-goog
#10 lore raw
In reply to Sam Eiderman via Qemu-devel
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Message-id: [email protected]
Type: series
Subject: [Qemu-devel] [PATCH v6 0/8] Add Qemu to SeaBIOS LCHS interface

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test'
4c35c4b hd-geo-test: Add tests for lchs override 94fe50a bootdevice: FW_CFG interface for LCHS values feb142b bootdevice: Refactor get_boot_devices_list d0d1b0a bootdevice: Gather LCHS from all relevant devices 47aaba7 scsi: Propagate unrealize() callback to scsi-hd c15a6ef bootdevice: Add interface to gather LCHS 5ee6a57 block: Support providing LCHS from user 7058d32 block: Refactor macros - fix tabbing

=== OUTPUT BEGIN ===
1/8 Checking commit 7058d3229d71 (block: Refactor macros - fix tabbing)
ERROR: Macros with complex values should be enclosed in parenthesis #55: FILE: include/hw/block/block.h:65:

+#define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf)                      \
+    DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0),                  \
+    DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0),                \
     DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0)

total: 1 errors, 0 warnings, 37 lines checked

Patch 1/8 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

2/8 Checking commit 5ee6a57a8e93 (block: Support providing LCHS from user) 3/8 Checking commit c15a6ef42266 (bootdevice: Add interface to gather LCHS) 4/8 Checking commit 47aaba7c960c (scsi: Propagate unrealize() callback to scsi-hd) 5/8 Checking commit d0d1b0a500c3 (bootdevice: Gather LCHS from all relevant devices) 6/8 Checking commit feb142b1966b (bootdevice: Refactor get_boot_devices_list) 7/8 Checking commit 94fe50a2c30f (bootdevice: FW_CFG interface for LCHS values) 8/8 Checking commit 4c35c4b69cae (hd-geo-test: Add tests for lchs override)
WARNING: Block comments use a leading /* on a separate line
#641: FILE: tests/hd-geo-test.c:996:
+ "skipping hd-geo/override/* tests");

total: 0 errors, 1 warnings, 609 lines checked

Patch 8/8 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#11 lore raw
In reply to Sam Eiderman via Qemu-devel
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Message-id: [email protected]
Type: series
Subject: [Qemu-devel] [PATCH v6 0/8] Add Qemu to SeaBIOS LCHS interface

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test'
ae278de hd-geo-test: Add tests for lchs override 715cfa8 bootdevice: FW_CFG interface for LCHS values 54cd6e4 bootdevice: Refactor get_boot_devices_list 381ba9d bootdevice: Gather LCHS from all relevant devices f16e5f7 scsi: Propagate unrealize() callback to scsi-hd 12bf34c bootdevice: Add interface to gather LCHS fa36200 block: Support providing LCHS from user 3acc0a3 block: Refactor macros - fix tabbing

=== OUTPUT BEGIN ===
1/8 Checking commit 3acc0a31ae55 (block: Refactor macros - fix tabbing)
ERROR: Macros with complex values should be enclosed in parenthesis #55: FILE: include/hw/block/block.h:65:

+#define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf)                      \
+    DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0),                  \
+    DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0),                \
     DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0)

total: 1 errors, 0 warnings, 37 lines checked

Patch 1/8 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

2/8 Checking commit fa36200c8ceb (block: Support providing LCHS from user) 3/8 Checking commit 12bf34c38eb5 (bootdevice: Add interface to gather LCHS) 4/8 Checking commit f16e5f7d73f7 (scsi: Propagate unrealize() callback to scsi-hd) 5/8 Checking commit 381ba9d8d879 (bootdevice: Gather LCHS from all relevant devices) 6/8 Checking commit 54cd6e409022 (bootdevice: Refactor get_boot_devices_list) 7/8 Checking commit 715cfa8c4ab1 (bootdevice: FW_CFG interface for LCHS values) 8/8 Checking commit ae278de99d62 (hd-geo-test: Add tests for lchs override)
WARNING: Block comments use a leading /* on a separate line
#641: FILE: tests/hd-geo-test.c:996:
+ "skipping hd-geo/override/* tests");

total: 0 errors, 1 warnings, 609 lines checked

Patch 8/8 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#12 lore raw
In reply to Sam Eiderman via Qemu-devel

Gentle ping

Quoted 78 lines · On Tue, Aug 27, 2019, 11:24 Sam Eiderman <[email protected]> wrote:

v1:

Non-standard logical geometries break under QEMU.

A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEMU/SeaBIOS if it has non-standard logical geometries - for example 56 SPT (sectors per track). No matter what QEMU will guess - SeaBIOS, for large enough disks - will use LBA translation, which will report 63 SPT instead.

In addition we can not enforce SeaBIOS to rely on phyiscal geometries at all. A virtio-blk-pci virtual disk with 255 phyiscal heads can not report more than 16 physical heads when moved to an IDE controller, the ATA spec allows a maximum of 16 heads - this is an artifact of virtualization.

By supplying the logical geometies directly we are able to support such "exotic" disks.

We will use fw_cfg to do just that.

v2:

Fix missing parenthesis check in
"hd-geo-test: Add tests for lchs override"

v3:

* Rename fw_cfg key to "bios-geometry".
* Remove "extendible" interface.
* Add cpu_to_le32 fix as Laszlo suggested or big endian hosts
* Fix last qtest commit - automatic docker tester for some reason does not have qemu-img set

v4:

* Change fw_cfg interface from mixed textual/binary to textual only

v5:

* Fix line > 80 chars in tests/hd-geo-test.c

v6:

* Small fixes for issues pointed by Max
* (&conf->conf)->lcyls to conf->conf.lcyls and so on
* Remove scsi_unrealize from everything other than scsi-hd
* Add proper include to sysemu.h
* scsi_device_unrealize() after scsi_device_purge_requests()

Sam Eiderman (8):
block: Refactor macros - fix tabbing
block: Support providing LCHS from user
bootdevice: Add interface to gather LCHS
scsi: Propagate unrealize() callback to scsi-hd
bootdevice: Gather LCHS from all relevant devices
bootdevice: Refactor get_boot_devices_list
bootdevice: FW_CFG interface for LCHS values
hd-geo-test: Add tests for lchs override

 bootdevice.c             | 148 ++++++++--
 hw/block/virtio-blk.c    |   6 +
 hw/ide/qdev.c            |   7 +-
 hw/nvram/fw_cfg.c        |  14 +-
 hw/scsi/scsi-bus.c       |  16 ++
 hw/scsi/scsi-disk.c      |  12 +
 include/hw/block/block.h |  22 +-
 include/hw/scsi/scsi.h   |   1 +
 include/sysemu/sysemu.h  |   4 +
 tests/Makefile.include   |   2 +-
 tests/hd-geo-test.c      | 582 +++++++++++++++++++++++++++++++++++++++
 11 files changed, 773 insertions(+), 41 deletions(-)

--
2.23.0.187.g17f5b7556c-goog

#13 lore raw

Gentle ping

Quoted 81 lines · Sam Eiderman

Gentle ping

Quoted 77 lines · On Tue, Aug 27, 2019, 11:24 Sam Eiderman <[email protected]> wrote:

v1:

Non-standard logical geometries break under QEMU.

A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEMU/SeaBIOS if it has non-standard logical geometries - for example 56 SPT (sectors per track). No matter what QEMU will guess - SeaBIOS, for large enough disks - will use LBA translation, which will report 63 SPT instead.

In addition we can not enforce SeaBIOS to rely on phyiscal geometries at all. A virtio-blk-pci virtual disk with 255 phyiscal heads can not report more than 16 physical heads when moved to an IDE controller, the ATA spec allows a maximum of 16 heads - this is an artifact of virtualization.

By supplying the logical geometies directly we are able to support such "exotic" disks.

We will use fw_cfg to do just that.

v2:

Fix missing parenthesis check in
"hd-geo-test: Add tests for lchs override"

v3:

* Rename fw_cfg key to "bios-geometry".
* Remove "extendible" interface.
* Add cpu_to_le32 fix as Laszlo suggested or big endian hosts
* Fix last qtest commit - automatic docker tester for some reason does not have qemu-img set

v4:

* Change fw_cfg interface from mixed textual/binary to textual only

v5:

* Fix line > 80 chars in tests/hd-geo-test.c

v6:

* Small fixes for issues pointed by Max
* (&conf->conf)->lcyls to conf->conf.lcyls and so on
* Remove scsi_unrealize from everything other than scsi-hd
* Add proper include to sysemu.h
* scsi_device_unrealize() after scsi_device_purge_requests()

Sam Eiderman (8):
block: Refactor macros - fix tabbing
block: Support providing LCHS from user
bootdevice: Add interface to gather LCHS
scsi: Propagate unrealize() callback to scsi-hd
bootdevice: Gather LCHS from all relevant devices
bootdevice: Refactor get_boot_devices_list
bootdevice: FW_CFG interface for LCHS values
hd-geo-test: Add tests for lchs override

 bootdevice.c             | 148 ++++++++--
 hw/block/virtio-blk.c    |   6 +
 hw/ide/qdev.c            |   7 +-
 hw/nvram/fw_cfg.c        |  14 +-
 hw/scsi/scsi-bus.c       |  16 ++
 hw/scsi/scsi-disk.c      |  12 +
 include/hw/block/block.h |  22 +-
 include/hw/scsi/scsi.h   |   1 +
 include/sysemu/sysemu.h  |   4 +
 tests/Makefile.include   |   2 +-
 tests/hd-geo-test.c      | 582 +++++++++++++++++++++++++++++++++++++++
 11 files changed, 773 insertions(+), 41 deletions(-)

--
2.23.0.187.g17f5b7556c-goog

Acked-by on the v6 series
#14 lore raw
In reply to Sam Eiderman via Qemu-devel
Quoted 60 lines · Sam Eiderman via Qemu-devel

v1:

Non-standard logical geometries break under QEMU.

A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEMU/SeaBIOS if it has non-standard logical geometries - for example 56 SPT (sectors per track). No matter what QEMU will guess - SeaBIOS, for large enough disks - will use LBA translation, which will report 63 SPT instead.

In addition we can not enforce SeaBIOS to rely on phyiscal geometries at all. A virtio-blk-pci virtual disk with 255 phyiscal heads can not report more than 16 physical heads when moved to an IDE controller, the ATA spec allows a maximum of 16 heads - this is an artifact of virtualization.

By supplying the logical geometies directly we are able to support such "exotic" disks.

We will use fw_cfg to do just that.

v2:

Fix missing parenthesis check in
"hd-geo-test: Add tests for lchs override"

v3:

* Rename fw_cfg key to "bios-geometry".
* Remove "extendible" interface.
* Add cpu_to_le32 fix as Laszlo suggested or big endian hosts
* Fix last qtest commit - automatic docker tester for some reason does not have qemu-img set

v4:

* Change fw_cfg interface from mixed textual/binary to textual only

v5:

* Fix line > 80 chars in tests/hd-geo-test.c

v6:

* Small fixes for issues pointed by Max
* (&conf->conf)->lcyls to conf->conf.lcyls and so on
* Remove scsi_unrealize from everything other than scsi-hd
* Add proper include to sysemu.h
* scsi_device_unrealize() after scsi_device_purge_requests()

Sam Eiderman (8):
block: Refactor macros - fix tabbing
block: Support providing LCHS from user
bootdevice: Add interface to gather LCHS
scsi: Propagate unrealize() callback to scsi-hd
bootdevice: Gather LCHS from all relevant devices
bootdevice: Refactor get_boot_devices_list
bootdevice: FW_CFG interface for LCHS values
hd-geo-test: Add tests for lchs override

Quoted 12 lines
 bootdevice.c             | 148 ++++++++--
 hw/block/virtio-blk.c    |   6 +
 hw/ide/qdev.c            |   7 +-
 hw/nvram/fw_cfg.c        |  14 +-
 hw/scsi/scsi-bus.c       |  16 ++
 hw/scsi/scsi-disk.c      |  12 +
 include/hw/block/block.h |  22 +-
 include/hw/scsi/scsi.h   |   1 +
 include/sysemu/sysemu.h  |   4 +
 tests/Makefile.include   |   2 +-
 tests/hd-geo-test.c      | 582 +++++++++++++++++++++++++++++++++++++++
 11 files changed, 773 insertions(+), 41 deletions(-)
#15 lore raw
In reply to Sam Eiderman via Qemu-devel

Nobody was making movement on this patch series, and in response to Max acking the whole series, I was just going to send a pull request for the whole thing and see who barked, because nobody likes or hates this series enough to offer any feedback.

Unfortunately, it's rotted on the vine a bit and has some conflicts with the testing infrastructure now:

/home/jhuston/src/qemu.git/ide/tests/hd-geo-test.c: In function ‘test_override’:
/home/jhuston/src/qemu.git/ide/tests/hd-geo-test.c:732:5: error:
implicit declaration of function ‘qtest_start’ [-Werror=implicit-function-declaration]
732 | qtest_start(joined_args);

You can jump right to the test by invoking it like this:

Quoted 2 lines

export QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 make tests/hd-geo-test

It looks like some definitions got moved out from under our feet, but hopefully it won't take long to rectify.

--js

Quoted 73 lines · Sam Eiderman via Qemu-block

v1:

Non-standard logical geometries break under QEMU.

A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEMU/SeaBIOS if it has non-standard logical geometries - for example 56 SPT (sectors per track). No matter what QEMU will guess - SeaBIOS, for large enough disks - will use LBA translation, which will report 63 SPT instead.

In addition we can not enforce SeaBIOS to rely on phyiscal geometries at all. A virtio-blk-pci virtual disk with 255 phyiscal heads can not report more than 16 physical heads when moved to an IDE controller, the ATA spec allows a maximum of 16 heads - this is an artifact of virtualization.

By supplying the logical geometies directly we are able to support such "exotic" disks.

We will use fw_cfg to do just that.

v2:

Fix missing parenthesis check in
"hd-geo-test: Add tests for lchs override"

v3:

* Rename fw_cfg key to "bios-geometry".
* Remove "extendible" interface.
* Add cpu_to_le32 fix as Laszlo suggested or big endian hosts
* Fix last qtest commit - automatic docker tester for some reason does not have qemu-img set

v4:

* Change fw_cfg interface from mixed textual/binary to textual only

v5:

* Fix line > 80 chars in tests/hd-geo-test.c

v6:

* Small fixes for issues pointed by Max
* (&conf->conf)->lcyls to conf->conf.lcyls and so on
* Remove scsi_unrealize from everything other than scsi-hd
* Add proper include to sysemu.h
* scsi_device_unrealize() after scsi_device_purge_requests()

Sam Eiderman (8):
block: Refactor macros - fix tabbing
block: Support providing LCHS from user
bootdevice: Add interface to gather LCHS
scsi: Propagate unrealize() callback to scsi-hd
bootdevice: Gather LCHS from all relevant devices
bootdevice: Refactor get_boot_devices_list
bootdevice: FW_CFG interface for LCHS values
hd-geo-test: Add tests for lchs override

 bootdevice.c             | 148 ++++++++--
 hw/block/virtio-blk.c    |   6 +
 hw/ide/qdev.c            |   7 +-
 hw/nvram/fw_cfg.c        |  14 +-
 hw/scsi/scsi-bus.c       |  16 ++
 hw/scsi/scsi-disk.c      |  12 +
 include/hw/block/block.h |  22 +-
 include/hw/scsi/scsi.h   |   1 +
 include/sysemu/sysemu.h  |   4 +
 tests/Makefile.include   |   2 +-
 tests/hd-geo-test.c      | 582 +++++++++++++++++++++++++++++++++++++++
 11 files changed, 773 insertions(+), 41 deletions(-)
#16 lore raw
Quoted 16 lines · John Snow

Nobody was making movement on this patch series, and in response to Max acking the whole series, I was just going to send a pull request for the whole thing and see who barked, because nobody likes or hates this series enough to offer any feedback.

Unfortunately, it's rotted on the vine a bit and has some conflicts with the testing infrastructure now:

/home/jhuston/src/qemu.git/ide/tests/hd-geo-test.c: In function ‘test_override’:
/home/jhuston/src/qemu.git/ide/tests/hd-geo-test.c:732:5: error:
implicit declaration of function ‘qtest_start’ [-Werror=implicit-function-declaration]
732 | qtest_start(joined_args);

Quoted 7 lines

You can jump right to the test by invoking it like this:

Quoted 2 lines

export QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 make tests/hd-geo-test

It looks like some definitions got moved out from under our feet, but hopefully it won't take long to rectify.

Please replace qtest_start() with qts = qtest_init() and qtest_end() with qtest_quit(qts).

See this commit for some more details:

https://git.qemu.org/?p=qemu.git;a=commitdiff;h=44c2364aaa5e366c4

Thomas

#17 lore raw

Thanks Thomas,

Resubmitting the tests, all other code will remain the same.

Sam

Quoted 34 lines · Thomas Huth
Quoted 16 lines · John Snow

Nobody was making movement on this patch series, and in response to Max acking the whole series, I was just going to send a pull request for the whole thing and see who barked, because nobody likes or hates this series enough to offer any feedback.

Unfortunately, it's rotted on the vine a bit and has some conflicts with the testing infrastructure now:

/home/jhuston/src/qemu.git/ide/tests/hd-geo-test.c: In function ‘test_override’:
/home/jhuston/src/qemu.git/ide/tests/hd-geo-test.c:732:5: error:
implicit declaration of function ‘qtest_start’ [-Werror=implicit-function-declaration]
732 | qtest_start(joined_args);

Quoted 7 lines

You can jump right to the test by invoking it like this:

Quoted 2 lines

export QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 make tests/hd-geo-test

It looks like some definitions got moved out from under our feet, but hopefully it won't take long to rectify.

Please replace qtest_start() with qts = qtest_init() and qtest_end() with qtest_quit(qts).

See this commit for some more details:

https://git.qemu.org/?p=qemu.git;a=commitdiff;h=44c2364aaa5e366c4

Thomas

#18 lore raw

Hi Sam Eiderman via!

We received your email, but were unable to deliver it because it contains HTML. HTML emails are not permitted. The following guide can help you configure your client to send in plain text instead:

https://useplaintext.email

If you have any questions, please reply to this email to reach the mail admin. We apologise for the inconvenience.

#19 lore raw
In reply to Sam Eiderman via
Quoted 6 lines · Sam Eiderman

Thanks Thomas,

Resubmitting the tests, all other code will remain the same.

Sam

OK, feel free to just send the test by itself if only patch 8/8 changes.

--js