mbox series

[v7,0/8] Add Qemu to SeaBIOS LCHS interface

Message ID 20190925110639.100699-1-sameid@google.com (mailing list archive)
Headers show
Series Add Qemu to SeaBIOS LCHS interface | expand

Message

Denis V. Lunev" via Sept. 25, 2019, 11:06 a.m. UTC
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

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      | 589 +++++++++++++++++++++++++++++++++++++++
 11 files changed, 780 insertions(+), 41 deletions(-)

Comments

John Snow Sept. 25, 2019, 8:38 p.m. UTC | #1
On 9/25/19 7:06 AM, Sam Eiderman via 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
> 
> 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      | 589 +++++++++++++++++++++++++++++++++++++++
>  11 files changed, 780 insertions(+), 41 deletions(-)
> 

Thanks, applied to my IDE tree:

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

--js

Is that the right tree? Nope, but time's marching on without us. If any
other maintainer has an objection, you have until Friday before I send
the PR!
no-reply@patchew.org Sept. 27, 2019, 5:02 p.m. UTC | #2
Patchew URL: https://patchew.org/QEMU/20190925110639.100699-1-sameid@google.com/



Hi,

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

Type: series
Message-id: 20190925110639.100699-1-sameid@google.com
Subject: [PATCH v7 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
From https://github.com/patchew-project/qemu
   deee6ff..c6f5012  master     -> master
 - [tag update]      patchew/1569590461-12562-1-git-send-email-mjrosato@linux.ibm.com -> patchew/1569590461-12562-1-git-send-email-mjrosato@linux.ibm.com
 - [tag update]      patchew/1569591203-15258-1-git-send-email-imbrenda@linux.ibm.com -> patchew/1569591203-15258-1-git-send-email-imbrenda@linux.ibm.com
 * [new tag]         patchew/20190927101110.25581-1-berrange@redhat.com -> patchew/20190927101110.25581-1-berrange@redhat.com
 * [new tag]         patchew/20190927134224.14550-1-marcandre.lureau@redhat.com -> patchew/20190927134224.14550-1-marcandre.lureau@redhat.com
 * [new tag]         patchew/20190927134639.4284-1-armbru@redhat.com -> patchew/20190927134639.4284-1-armbru@redhat.com
 * [new tag]         patchew/20190927141728.7137-1-crosa@redhat.com -> patchew/20190927141728.7137-1-crosa@redhat.com
Switched to a new branch 'test'
3d14890 hd-geo-test: Add tests for lchs override
8db970f bootdevice: FW_CFG interface for LCHS values
f73e65a8 bootdevice: Refactor get_boot_devices_list
d1d97ec bootdevice: Gather LCHS from all relevant devices
31221f5 scsi: Propagate unrealize() callback to scsi-hd
6422c6a bootdevice: Add interface to gather LCHS
b2360f7 block: Support providing LCHS from user
1c43be6 block: Refactor macros - fix tabbing

=== OUTPUT BEGIN ===
1/8 Checking commit 1c43be6de15d (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 b2360f718807 (block: Support providing LCHS from user)
3/8 Checking commit 6422c6acc42a (bootdevice: Add interface to gather LCHS)
4/8 Checking commit 31221f5a0d4d (scsi: Propagate unrealize() callback to scsi-hd)
5/8 Checking commit d1d97eca7de2 (bootdevice: Gather LCHS from all relevant devices)
6/8 Checking commit f73e65a879c8 (bootdevice: Refactor get_boot_devices_list)
7/8 Checking commit 8db970f739ad (bootdevice: FW_CFG interface for LCHS values)
8/8 Checking commit 3d148902136a (hd-geo-test: Add tests for lchs override)
WARNING: Block comments use a leading /* on a separate line
#648: FILE: tests/hd-geo-test.c:1003:
+                       "skipping hd-geo/override/* tests");

total: 0 errors, 1 warnings, 616 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/20190925110639.100699-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