fix SCSI disk block sizes outside range of 256 to 32768 in qemu

This commit is contained in:
jakllsch 2020-09-27 21:29:57 +00:00
parent 76ee2f6cdd
commit 4e45fe1fcd
3 changed files with 54 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.251 2020/09/27 21:27:27 jakllsch Exp $
# $NetBSD: Makefile,v 1.252 2020/09/27 21:29:57 jakllsch Exp $
DISTNAME= qemu-5.1.0
PKGREVISION= 4
PKGREVISION= 5
CATEGORIES= emulators
MASTER_SITES= https://download.qemu.org/
EXTRACT_SUFX= .tar.xz

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.162 2020/08/12 18:31:27 ryoon Exp $
$NetBSD: distinfo,v 1.163 2020/09/27 21:29:57 jakllsch Exp $
SHA1 (qemu-5.1.0.tar.xz) = 8c70ce2b65349e9b42bd20c9dec2c90f8e7b960a
RMD160 (qemu-5.1.0.tar.xz) = f5e4a20c481d7e2bf822bf6bf41667b810c3cecd
@ -16,6 +16,7 @@ SHA1 (patch-hw_core_uboot__image.h) = 17eef02349343c5fcfb7a4069cb6f8fd11efcb59
SHA1 (patch-hw_display_omap__dss.c) = 6b13242f28e32346bc70548c216c578d98fd3420
SHA1 (patch-hw_net_etraxfs__eth.c) = e5dd1661d60dbcd27b332403e0843500ba9544bc
SHA1 (patch-hw_net_xilinx__axienet.c) = ebcd2676d64ce6f31e4a8c976d4fdf530ad5e8b7
SHA1 (patch-hw_scsi_scsi-disk.c) = fdbf2f962a6dcb1a115a7f8a5b8790ff9295fb33
SHA1 (patch-hw_usb_dev-mtp.c) = 0f9034fb3904e5d5e3b98d24b94e054181687d95
SHA1 (patch-include_sysemu_hw__accel.h) = 852bc031a1e065f614c5c913351f3e13183e00b7
SHA1 (patch-include_sysemu_kvm.h) = 9847abe3be70bd708a521310f5d5515e45a1a5a0

View file

@ -0,0 +1,50 @@
$NetBSD: patch-hw_scsi_scsi-disk.c,v 1.1 2020/09/27 21:29:57 jakllsch Exp $
Fill in more of SCSI disk block size reports to guest. Allows use of
sector sizes outside range of 256 to 32768.
--- hw/scsi/scsi-disk.c.orig 2020-08-11 19:17:15.000000000 +0000
+++ hw/scsi/scsi-disk.c
@@ -1293,9 +1293,9 @@ static int scsi_disk_emulate_mode_sense(
p[2] = (nb_sectors >> 8) & 0xff;
p[3] = nb_sectors & 0xff;
p[4] = 0; /* reserved */
- p[5] = 0; /* bytes 5-7 are the sector size in bytes */
- p[6] = s->qdev.blocksize >> 8;
- p[7] = 0;
+ p[5] = (s->qdev.blocksize >> 16) & 0xff; /* bytes 5-7 are the sector size in bytes */
+ p[6] = (s->qdev.blocksize >> 8) & 0xff;
+ p[7] = s->qdev.blocksize & 0xff;
p += 8;
}
@@ -1993,10 +1993,10 @@ static int32_t scsi_disk_emulate_command
outbuf[1] = (nb_sectors >> 16) & 0xff;
outbuf[2] = (nb_sectors >> 8) & 0xff;
outbuf[3] = nb_sectors & 0xff;
- outbuf[4] = 0;
- outbuf[5] = 0;
- outbuf[6] = s->qdev.blocksize >> 8;
- outbuf[7] = 0;
+ outbuf[4] = (s->qdev.blocksize >> 24) & 0xff;;
+ outbuf[5] = (s->qdev.blocksize >> 16) & 0xff;
+ outbuf[6] = (s->qdev.blocksize >> 8) & 0xff;
+ outbuf[7] = s->qdev.blocksize & 0xff;;
break;
case REQUEST_SENSE:
/* Just return "NO SENSE". */
@@ -2062,10 +2062,10 @@ static int32_t scsi_disk_emulate_command
outbuf[5] = (nb_sectors >> 16) & 0xff;
outbuf[6] = (nb_sectors >> 8) & 0xff;
outbuf[7] = nb_sectors & 0xff;
- outbuf[8] = 0;
- outbuf[9] = 0;
- outbuf[10] = s->qdev.blocksize >> 8;
- outbuf[11] = 0;
+ outbuf[8] = (s->qdev.blocksize >> 24) & 0xff;
+ outbuf[9] = (s->qdev.blocksize >> 16) & 0xff;
+ outbuf[10] = (s->qdev.blocksize >> 8) & 0xff;
+ outbuf[11] = s->qdev.blocksize & 0xff;
outbuf[12] = 0;
outbuf[13] = get_physical_block_exp(&s->qdev.conf);