[PATCH v8 0/8] Add Qemu to SeaBIOS LCHS interface

Sam Eiderman posted 8 patches 3 weeks ago
Failed in applying to current master (apply log)
bootdevice.c             | 147 +++++++++--
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      | 551 +++++++++++++++++++++++++++++++++++++++
11 files changed, 741 insertions(+), 41 deletions(-)

[PATCH v8 0/8] Add Qemu to SeaBIOS LCHS interface

Posted by Sam Eiderman 3 weeks ago
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()

v7:

* Adapted last commit (tests) to changes in qtest

v8:

* Fixed BE issue with tests by using qfw_cfg_get_file() instead of
  read_fw_cfg_file(), thanks Laszlo.
* Removed incorrect comment in 7/8.

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             | 147 +++++++++--
 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      | 551 +++++++++++++++++++++++++++++++++++++++
 11 files changed, 741 insertions(+), 41 deletions(-)

-- 
2.23.0.700.g56cf767bdb-goog


Re: [PATCH v8 0/8] Add Qemu to SeaBIOS LCHS interface

Posted by no-reply@patchew.org 3 weeks ago
Patchew URL: https://patchew.org/QEMU/20191016164145.115898-1-sameid@google.com/



Hi,

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

Subject: [PATCH v8 0/8] Add Qemu to SeaBIOS LCHS interface
Type: series
Message-id: 20191016164145.115898-1-sameid@google.com

=== 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 ===

Switched to a new branch 'test'
c45edbb bootdevice: FW_CFG interface for LCHS values
729ce76 bootdevice: Refactor get_boot_devices_list
46853bd bootdevice: Gather LCHS from all relevant devices
4f9e597 scsi: Propagate unrealize() callback to scsi-hd
50179a7 bootdevice: Add interface to gather LCHS
968cf33 block: Support providing LCHS from user
ccb1747 hd-geo-test: Add tests for lchs override
538dbd3 block: Refactor macros - fix tabbing

=== OUTPUT BEGIN ===
1/8 Checking commit 538dbd328a6b (block: Refactor macros - fix tabbing)
ERROR: Macros with complex values should be enclosed in parenthesis
#57: 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 ccb1747f11c5 (hd-geo-test: Add tests for lchs override)
WARNING: Block comments use a leading /* on a separate line
#606: FILE: tests/hd-geo-test.c:965:
+                       "skipping hd-geo/override/* tests");

total: 0 errors, 1 warnings, 578 lines checked

Patch 2/8 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/8 Checking commit 968cf330ecbc (block: Support providing LCHS from user)
4/8 Checking commit 50179a7c4473 (bootdevice: Add interface to gather LCHS)
5/8 Checking commit 4f9e597a32b8 (scsi: Propagate unrealize() callback to scsi-hd)
6/8 Checking commit 46853bd0b7bf (bootdevice: Gather LCHS from all relevant devices)
7/8 Checking commit 729ce765a499 (bootdevice: Refactor get_boot_devices_list)
8/8 Checking commit c45edbb64fde (bootdevice: FW_CFG interface for LCHS values)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20191016164145.115898-1-sameid@google.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

[SeaBIOS] Re: [PATCH v8 0/8] Add Qemu to SeaBIOS LCHS interface

Posted by John Snow 3 weeks ago

On 10/16/19 12:41 PM, Sam Eiderman 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()
> 
> v7:
> 
> * Adapted last commit (tests) to changes in qtest
> 
> v8:
> 
> * Fixed BE issue with tests by using qfw_cfg_get_file() instead of
>   read_fw_cfg_file(), thanks Laszlo.
> * Removed incorrect comment in 7/8.
> 
> 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             | 147 +++++++++--
>  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      | 551 +++++++++++++++++++++++++++++++++++++++
>  11 files changed, 741 insertions(+), 41 deletions(-)
> 

Thanks, applied to my IDE tree:

https://github.com/jnsnow/qemu/commits/ide
https://github.com/jnsnow/qemu.git

--js


(Philippe, you have a few days to check that I didn't snub your reviews
if you want to look ...!)
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org