Skip to contentSkip to conversation

Fixup for DASD geometry detection

PATCH Applied Christian Borntraeger 4 participants 6 messages Dec 14, 2015 – Jan 12, 2016 Block layer

lore
Share & tools
lore
#0 lore raw

cover Fixup for DASD geometry detection

Kevin,

here is a fixup for the geometry detection. We tried to be overly clever and calculate the cyclinder size for devices > 64k cyls. Now this is wrong for the cyls parameter as the interface only has 16bit. Large DASD devices have a special token (0xfffe) that indicate to the DASD related code, that you have to calculate the cyls size yourself.

Without this patch QEMU cannot pass through bigger DASD disks and complains "cyls must be between 1 and 65535"

Christian Borntraeger (1):
block/raw-posix: avoid bogus fixup for cylinders on DASD disks

 block/raw-posix.c | 7 -------
 1 file changed, 7 deletions(-)
Signature · 1 line
2.3.0
#1 lore raw

PATCH 1/1 block/raw-posix: avoid bogus fixup for cylinders on DASD disks

large volume DASD that have > 64k cylinders do claim to have 0xFFFE cylinders as special value in the old 16 bit field. We want to pass this "token" along to the guest, instead of calculating the real number. Otherwise qemu might fail with "cyls must be between 1 and 65535"

---
 block/raw-posix.c | 7 -------
 1 file changed, 7 deletions(-)
block/raw-posix.c +0 -7
index d9162fd..2fff184 100644
@@ -783,7 +783,6 @@ static int hdev_probe_geometry(BlockDriverState *bs, HDGeometry *geo)
 {
     BDRVRawState *s = bs->opaque;
     struct hd_geometry ioctl_geo = {0};
-    uint32_t blksize;
 
     /* If DASD, get its geometry */
     if (check_for_dasd(s->fd) < 0) {
@@ -803,12 +802,6 @@ static int hdev_probe_geometry(BlockDriverState *bs, HDGeometry *geo)
     }
     geo->heads = ioctl_geo.heads;
     geo->sectors = ioctl_geo.sectors;
-    if (!probe_physical_blocksize(s->fd, &blksize)) {
-        /* overwrite cyls: HDIO_GETGEO result is incorrect for big drives */
-        geo->cylinders = bdrv_nb_sectors(bs) / (blksize / BDRV_SECTOR_SIZE)
-                                             / (geo->heads * geo->sectors);
-        return 0;
-    }
     geo->cylinders = ioctl_geo.cylinders;
 
     return 0;
Signature · 1 line
2.3.0
Reviewed-by on v1 1/1
#2 lore raw

Re: [Qemu-devel] [PATCH 1/1] block/raw-posix: avoid bogus fixup for cylinders on DASD disks

Quoted 8 lines · Christian Borntraeger

large volume DASD that have > 64k cylinders do claim to have 0xFFFE cylinders as special value in the old 16 bit field. We want to pass this "token" along to the guest, instead of calculating the real number. Otherwise qemu might fail with "cyls must be between 1 and 65535"

#3 lore raw

Re: [Qemu-devel] [PATCH 1/1] block/raw-posix: avoid bogus fixup for cylinders on DASD disks

In reply to Christian Borntraeger
Quoted 11 lines · On Mon, 14 Dec 2015 16:41:19 +0100 Christian Borntraeger…

large volume DASD that have > 64k cylinders do claim to have 0xFFFE cylinders as special value in the old 16 bit field. We want to pass this "token" along to the guest, instead of calculating the real number. Otherwise qemu might fail with "cyls must be between 1 and 65535"

---
 block/raw-posix.c | 7 -------
 1 file changed, 7 deletions(-)

Maybe add cc:stable?

#4 lore raw

Re: [Qemu-devel] [PATCH 1/1] block/raw-posix: avoid bogus fixup for cylinders on DASD disks

Quoted 9 lines · Cornelia Huck
Quoted 6 lines · On Mon, 14 Dec 2015 16:41:19 +0100 Christian Borntraeger…

large volume DASD that have > 64k cylinders do claim to have 0xFFFE cylinders as special value in the old 16 bit field. We want to pass this "token" along to the guest, instead of calculating the real number. Otherwise qemu might fail with "cyls must be between 1 and 65535"

Quoted 7 lines
Quoted 5 lines
---
 block/raw-posix.c | 7 -------
 1 file changed, 7 deletions(-)

Maybe add cc:stable?

Yes.

Kevin, ping. I assume this goes via your tree?

Applied
#5 lore raw
In reply to Christian Borntraeger

Am 14.12.2015 um 16:41 hat Christian Borntraeger geschrieben:

Quoted 11 lines

Kevin,

here is a fixup for the geometry detection. We tried to be overly clever and calculate the cyclinder size for devices > 64k cyls. Now this is wrong for the cyls parameter as the interface only has 16bit. Large DASD devices have a special token (0xfffe) that indicate to the DASD related code, that you have to calculate the cyls size yourself.

Without this patch QEMU cannot pass through bigger DASD disks and complains "cyls must be between 1 and 65535"

Thanks, applied to the block branch.

Kevin