Block layer patches
- scsi-generic: Fix I/O errors due to wrong block limits -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmME3eARHGt3b2xmQHJl ZGhhdC5jb20ACgkQfwmycsiPL9avDA//YIJPQDOwiaDaVPY9aqAsnHPvxv/KWwcY mNluOhIluRDcXaOuFRNZsL4L69oc7n1dqV1CkKgaYZOLaq0gk6Vt/RyENo5faCoq IkGD9PjRoa6heAD0r/xzFUCCszYs2W2xrmK9yX1R9xCtKZ+jbygCNBiDbdigBfi/ HWL8OZYpnyVXeKmNeqvYHPnfCuCCNpIz0PkyaJ3jE/nsTefrmBHpdyLC0xa953tN VaTERnHQyMfFybtri2nTDQgARztRi+3ph1bFV6moxLOpwMb49hdU+2g1VZdcsedL XgYWXEJyBRq0KRz1qUbtXO5SRTFpsZFo9cOvWoHA5IrcEHeDpsrZzQ5RsZRoQENx GV4DAI3unrwsqSWk682UHHVfIFW1qV1BvueT6MsiobL2pV6+uYPHI1A9XnOzoTRg syUoiqvsKDcXATkszxQV+DSRWDsIHo1LS3kSokxwUDp3HhHWhvnUBUww8HkUXxlE 7GkMFXkjygAxBekkzIaxNgF7AnGqwrrSUESX+j2S4V5xGFoaZGSWIZIjEyyEBtjc YZZoVEPAK3Gg7RMfSsM0obIXZpuiS1okxfb0cm6nHP+VKBdmaa12wFaCkC0TAEzy IcZf7Midq/Is5O3uSlreWeFWEyaRDRWe7v4NnZ2qXFqch7Gi3QWDaCDtjnOu+78S X/FK3RH+E38= =cj4W -----END PGP SIGNATURE----- Merge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging Block layer patches - scsi-generic: Fix I/O errors due to wrong block limits # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmME3eARHGt3b2xmQHJl # ZGhhdC5jb20ACgkQfwmycsiPL9avDA//YIJPQDOwiaDaVPY9aqAsnHPvxv/KWwcY # mNluOhIluRDcXaOuFRNZsL4L69oc7n1dqV1CkKgaYZOLaq0gk6Vt/RyENo5faCoq # IkGD9PjRoa6heAD0r/xzFUCCszYs2W2xrmK9yX1R9xCtKZ+jbygCNBiDbdigBfi/ # HWL8OZYpnyVXeKmNeqvYHPnfCuCCNpIz0PkyaJ3jE/nsTefrmBHpdyLC0xa953tN # VaTERnHQyMfFybtri2nTDQgARztRi+3ph1bFV6moxLOpwMb49hdU+2g1VZdcsedL # XgYWXEJyBRq0KRz1qUbtXO5SRTFpsZFo9cOvWoHA5IrcEHeDpsrZzQ5RsZRoQENx # GV4DAI3unrwsqSWk682UHHVfIFW1qV1BvueT6MsiobL2pV6+uYPHI1A9XnOzoTRg # syUoiqvsKDcXATkszxQV+DSRWDsIHo1LS3kSokxwUDp3HhHWhvnUBUww8HkUXxlE # 7GkMFXkjygAxBekkzIaxNgF7AnGqwrrSUESX+j2S4V5xGFoaZGSWIZIjEyyEBtjc # YZZoVEPAK3Gg7RMfSsM0obIXZpuiS1okxfb0cm6nHP+VKBdmaa12wFaCkC0TAEzy # IcZf7Midq/Is5O3uSlreWeFWEyaRDRWe7v4NnZ2qXFqch7Gi3QWDaCDtjnOu+78S # X/FK3RH+E38= # =cj4W # -----END PGP SIGNATURE----- # gpg: Signature made Tue 23 Aug 2022 07:02:08 AM PDT # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] * tag 'for-upstream' of git://repo.or.cz/qemu/kevin: scsi-generic: Fix emulated block limits VPD page Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
commit
a8cc5842b5
@ -147,6 +147,18 @@ static int execute_command(BlockBackend *blk,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint64_t calculate_max_transfer(SCSIDevice *s)
|
||||
{
|
||||
uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk);
|
||||
uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk);
|
||||
|
||||
assert(max_transfer);
|
||||
max_transfer = MIN_NON_ZERO(max_transfer,
|
||||
max_iov * qemu_real_host_page_size());
|
||||
|
||||
return max_transfer / s->blocksize;
|
||||
}
|
||||
|
||||
static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len)
|
||||
{
|
||||
uint8_t page, page_idx;
|
||||
@ -179,12 +191,7 @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len)
|
||||
(r->req.cmd.buf[1] & 0x01)) {
|
||||
page = r->req.cmd.buf[2];
|
||||
if (page == 0xb0) {
|
||||
uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk);
|
||||
uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk);
|
||||
|
||||
assert(max_transfer);
|
||||
max_transfer = MIN_NON_ZERO(max_transfer, max_iov * qemu_real_host_page_size())
|
||||
/ s->blocksize;
|
||||
uint64_t max_transfer = calculate_max_transfer(s);
|
||||
stl_be_p(&r->buf[8], max_transfer);
|
||||
/* Also take care of the opt xfer len. */
|
||||
stl_be_p(&r->buf[12],
|
||||
@ -230,7 +237,7 @@ static int scsi_generic_emulate_block_limits(SCSIGenericReq *r, SCSIDevice *s)
|
||||
uint8_t buf[64];
|
||||
|
||||
SCSIBlockLimits bl = {
|
||||
.max_io_sectors = blk_get_max_transfer(s->conf.blk) / s->blocksize
|
||||
.max_io_sectors = calculate_max_transfer(s),
|
||||
};
|
||||
|
||||
memset(r->buf, 0, r->buflen);
|
||||
|
Loading…
Reference in New Issue
Block a user