Block layer patches
- ide/via: Fix BAR4 value in legacy mode - export/vhost-user-blk: Fix consecutive drains - vmdk: Don't corrupt desc file in vmdk_write_cid - iotests: fix default machine type detection -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmVl9GARHGt3b2xmQHJl ZGhhdC5jb20ACgkQfwmycsiPL9Y9KRAAx3ryUIdaVZX5RZbVC4ZmkgGIpSv+8dS+ e98H+accyyVTVXlMNYWy0s7tP6sxhhlmGqfGLx/hDynvjJRxyS8VSOXXNIqYcHqN wGXcgLEgb+qxu7+Y8g3UhMeSmDyRhanOE/MxhMqGOKd/5nxfY1XdD7nkRwCsPAAi Tud/Jd7t0CSV0wUDfvMtBsQZCBSQyoSu3S3TjZ8I2CPjBaoYojj3XM+LKrlJu+B5 zwgB5IURac1dOfsjYsX0M0zXxr6pTVNtkdNNwFoiNP+omoRjCXV3W9iTtyU+/zc3 cnVzQQRE6XufQ/Q7IWHNE3/U5LvM3m+sjB+YryrMTRVItjpGUCgYGsrgodjZp7aj 4hmwxyZ8PN3+o96d5RWqhRXnY9fy5hzJZOhUMQV6lV/Z14wt8YYsJoqgi4wryoYf 7VdyZP2Szt2Sgl4+n0uSfPBoR+qMEwni1AxO8iK9OZbpewv7aBO3In4tOAvP/eB8 VAoCZOfrILSXaR5aorlAPr6IOXanPvgOotmzNs0NaaqYnpfYr6KAH9FjyAm3DZqp b+/Ep+hrekq9XqnZGMblQsjlTFAc9mRWtqsHUrftl9FhRvSah4R+TyKov8lD23VZ bvw1etcc0p55Ws4RkUkGn8G5kRyhec3nkHdr4MODCR0s0uo0cBaITnoV0Ra9p7of K78WSodwZKQ= =ktlF -----END PGP SIGNATURE----- Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging Block layer patches - ide/via: Fix BAR4 value in legacy mode - export/vhost-user-blk: Fix consecutive drains - vmdk: Don't corrupt desc file in vmdk_write_cid - iotests: fix default machine type detection # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmVl9GARHGt3b2xmQHJl # ZGhhdC5jb20ACgkQfwmycsiPL9Y9KRAAx3ryUIdaVZX5RZbVC4ZmkgGIpSv+8dS+ # e98H+accyyVTVXlMNYWy0s7tP6sxhhlmGqfGLx/hDynvjJRxyS8VSOXXNIqYcHqN # wGXcgLEgb+qxu7+Y8g3UhMeSmDyRhanOE/MxhMqGOKd/5nxfY1XdD7nkRwCsPAAi # Tud/Jd7t0CSV0wUDfvMtBsQZCBSQyoSu3S3TjZ8I2CPjBaoYojj3XM+LKrlJu+B5 # zwgB5IURac1dOfsjYsX0M0zXxr6pTVNtkdNNwFoiNP+omoRjCXV3W9iTtyU+/zc3 # cnVzQQRE6XufQ/Q7IWHNE3/U5LvM3m+sjB+YryrMTRVItjpGUCgYGsrgodjZp7aj # 4hmwxyZ8PN3+o96d5RWqhRXnY9fy5hzJZOhUMQV6lV/Z14wt8YYsJoqgi4wryoYf # 7VdyZP2Szt2Sgl4+n0uSfPBoR+qMEwni1AxO8iK9OZbpewv7aBO3In4tOAvP/eB8 # VAoCZOfrILSXaR5aorlAPr6IOXanPvgOotmzNs0NaaqYnpfYr6KAH9FjyAm3DZqp # b+/Ep+hrekq9XqnZGMblQsjlTFAc9mRWtqsHUrftl9FhRvSah4R+TyKov8lD23VZ # bvw1etcc0p55Ws4RkUkGn8G5kRyhec3nkHdr4MODCR0s0uo0cBaITnoV0Ra9p7of # K78WSodwZKQ= # =ktlF # -----END PGP SIGNATURE----- # gpg: Signature made Tue 28 Nov 2023 09:08:32 EST # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * tag 'for-upstream' of https://repo.or.cz/qemu/kevin: ide/via: Fix BAR4 value in legacy mode export/vhost-user-blk: Fix consecutive drains vmdk: Don't corrupt desc file in vmdk_write_cid iotests: fix default machine type detection Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
commit
9155a938cf
@ -283,6 +283,7 @@ static void vu_blk_drained_begin(void *opaque)
|
|||||||
{
|
{
|
||||||
VuBlkExport *vexp = opaque;
|
VuBlkExport *vexp = opaque;
|
||||||
|
|
||||||
|
vexp->vu_server.quiescing = true;
|
||||||
vhost_user_server_detach_aio_context(&vexp->vu_server);
|
vhost_user_server_detach_aio_context(&vexp->vu_server);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,19 +292,23 @@ static void vu_blk_drained_end(void *opaque)
|
|||||||
{
|
{
|
||||||
VuBlkExport *vexp = opaque;
|
VuBlkExport *vexp = opaque;
|
||||||
|
|
||||||
|
vexp->vu_server.quiescing = false;
|
||||||
vhost_user_server_attach_aio_context(&vexp->vu_server, vexp->export.ctx);
|
vhost_user_server_attach_aio_context(&vexp->vu_server, vexp->export.ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensures that bdrv_drained_begin() waits until in-flight requests complete.
|
* Ensures that bdrv_drained_begin() waits until in-flight requests complete
|
||||||
|
* and the server->co_trip coroutine has terminated. It will be restarted in
|
||||||
|
* vhost_user_server_attach_aio_context().
|
||||||
*
|
*
|
||||||
* Called with vexp->export.ctx acquired.
|
* Called with vexp->export.ctx acquired.
|
||||||
*/
|
*/
|
||||||
static bool vu_blk_drained_poll(void *opaque)
|
static bool vu_blk_drained_poll(void *opaque)
|
||||||
{
|
{
|
||||||
VuBlkExport *vexp = opaque;
|
VuBlkExport *vexp = opaque;
|
||||||
|
VuServer *server = &vexp->vu_server;
|
||||||
|
|
||||||
return vhost_user_server_has_in_flight(&vexp->vu_server);
|
return server->co_trip || vhost_user_server_has_in_flight(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const BlockDevOps vu_blk_dev_ops = {
|
static const BlockDevOps vu_blk_dev_ops = {
|
||||||
|
28
block/vmdk.c
28
block/vmdk.c
@ -351,29 +351,41 @@ vmdk_write_cid(BlockDriverState *bs, uint32_t cid)
|
|||||||
BDRVVmdkState *s = bs->opaque;
|
BDRVVmdkState *s = bs->opaque;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
desc = g_malloc0(DESC_SIZE);
|
size_t desc_buf_size;
|
||||||
tmp_desc = g_malloc0(DESC_SIZE);
|
|
||||||
ret = bdrv_co_pread(bs->file, s->desc_offset, DESC_SIZE, desc, 0);
|
if (s->desc_offset == 0) {
|
||||||
|
desc_buf_size = bdrv_getlength(bs->file->bs);
|
||||||
|
if (desc_buf_size > 16ULL << 20) {
|
||||||
|
error_report("VMDK description file too big");
|
||||||
|
return -EFBIG;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
desc_buf_size = DESC_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
desc = g_malloc0(desc_buf_size);
|
||||||
|
tmp_desc = g_malloc0(desc_buf_size);
|
||||||
|
ret = bdrv_co_pread(bs->file, s->desc_offset, desc_buf_size, desc, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
desc[DESC_SIZE - 1] = '\0';
|
desc[desc_buf_size - 1] = '\0';
|
||||||
tmp_str = strstr(desc, "parentCID");
|
tmp_str = strstr(desc, "parentCID");
|
||||||
if (tmp_str == NULL) {
|
if (tmp_str == NULL) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
pstrcpy(tmp_desc, DESC_SIZE, tmp_str);
|
pstrcpy(tmp_desc, desc_buf_size, tmp_str);
|
||||||
p_name = strstr(desc, "CID");
|
p_name = strstr(desc, "CID");
|
||||||
if (p_name != NULL) {
|
if (p_name != NULL) {
|
||||||
p_name += sizeof("CID");
|
p_name += sizeof("CID");
|
||||||
snprintf(p_name, DESC_SIZE - (p_name - desc), "%" PRIx32 "\n", cid);
|
snprintf(p_name, desc_buf_size - (p_name - desc), "%" PRIx32 "\n", cid);
|
||||||
pstrcat(desc, DESC_SIZE, tmp_desc);
|
pstrcat(desc, desc_buf_size, tmp_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = bdrv_co_pwrite_sync(bs->file, s->desc_offset, DESC_SIZE, desc, 0);
|
ret = bdrv_co_pwrite_sync(bs->file, s->desc_offset, desc_buf_size, desc, 0);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
g_free(desc);
|
g_free(desc);
|
||||||
|
11
hw/ide/via.c
11
hw/ide/via.c
@ -163,15 +163,20 @@ static uint32_t via_ide_cfg_read(PCIDevice *pd, uint32_t addr, int len)
|
|||||||
uint32_t val = pci_default_read_config(pd, addr, len);
|
uint32_t val = pci_default_read_config(pd, addr, len);
|
||||||
uint8_t mode = pd->config[PCI_CLASS_PROG];
|
uint8_t mode = pd->config[PCI_CLASS_PROG];
|
||||||
|
|
||||||
if ((mode & 0xf) == 0xa && ranges_overlap(addr, len,
|
if ((mode & 0xf) == 0xa) {
|
||||||
PCI_BASE_ADDRESS_0, 16)) {
|
if (ranges_overlap(addr, len, PCI_BASE_ADDRESS_0, 16)) {
|
||||||
/* BARs always read back zero in legacy mode */
|
/* BARs 0-3 always read back zero in legacy mode */
|
||||||
for (int i = addr; i < addr + len; i++) {
|
for (int i = addr; i < addr + len; i++) {
|
||||||
if (i >= PCI_BASE_ADDRESS_0 && i < PCI_BASE_ADDRESS_0 + 16) {
|
if (i >= PCI_BASE_ADDRESS_0 && i < PCI_BASE_ADDRESS_0 + 16) {
|
||||||
val &= ~(0xffULL << ((i - addr) << 3));
|
val &= ~(0xffULL << ((i - addr) << 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (addr == PCI_BASE_ADDRESS_4 && val == PCI_BASE_ADDRESS_SPACE_IO) {
|
||||||
|
/* BAR4 default value if unset */
|
||||||
|
val = 0xcc00 | PCI_BASE_ADDRESS_SPACE_IO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ typedef struct {
|
|||||||
/* Protected by ctx lock */
|
/* Protected by ctx lock */
|
||||||
bool in_qio_channel_yield;
|
bool in_qio_channel_yield;
|
||||||
bool wait_idle;
|
bool wait_idle;
|
||||||
|
bool quiescing;
|
||||||
VuDev vu_dev;
|
VuDev vu_dev;
|
||||||
QIOChannel *ioc; /* The I/O channel with the client */
|
QIOChannel *ioc; /* The I/O channel with the client */
|
||||||
QIOChannelSocket *sioc; /* The underlying data channel with the client */
|
QIOChannelSocket *sioc; /* The underlying data channel with the client */
|
||||||
|
@ -84,6 +84,8 @@ echo
|
|||||||
echo "=== Testing big twoGbMaxExtentFlat ==="
|
echo "=== Testing big twoGbMaxExtentFlat ==="
|
||||||
_make_test_img -o "subformat=twoGbMaxExtentFlat" 1000G
|
_make_test_img -o "subformat=twoGbMaxExtentFlat" 1000G
|
||||||
_img_info --format-specific | _filter_img_info --format-specific
|
_img_info --format-specific | _filter_img_info --format-specific
|
||||||
|
$QEMU_IO -c "write 990G 512 -P 89" "$TEST_IMG" | _filter_qemu_io
|
||||||
|
$QEMU_IO -c "read 990G 512 -P 89" "$TEST_IMG" | _filter_qemu_io
|
||||||
_cleanup_test_img
|
_cleanup_test_img
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
@ -2032,6 +2032,10 @@ Format specific information:
|
|||||||
virtual size: 2147483648
|
virtual size: 2147483648
|
||||||
filename: TEST_DIR/t-f500.IMGFMT
|
filename: TEST_DIR/t-f500.IMGFMT
|
||||||
format: FLAT
|
format: FLAT
|
||||||
|
wrote 512/512 bytes at offset 1063004405760
|
||||||
|
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||||
|
read 512/512 bytes at offset 1063004405760
|
||||||
|
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||||
|
|
||||||
=== Testing malformed VMFS extent description line ===
|
=== Testing malformed VMFS extent description line ===
|
||||||
qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Invalid extent line: RW 12582912 VMFS "dummy.IMGFMT" 1
|
qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Invalid extent line: RW 12582912 VMFS "dummy.IMGFMT" 1
|
||||||
|
@ -40,7 +40,7 @@ def get_default_machine(qemu_prog: str) -> str:
|
|||||||
|
|
||||||
machines = outp.split('\n')
|
machines = outp.split('\n')
|
||||||
try:
|
try:
|
||||||
default_machine = next(m for m in machines if m.endswith(' (default)'))
|
default_machine = next(m for m in machines if ' (default)' in m)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
return ''
|
return ''
|
||||||
default_machine = default_machine.split(' ', 1)[0]
|
default_machine = default_machine.split(' ', 1)[0]
|
||||||
|
@ -132,8 +132,7 @@ vu_message_read(VuDev *vu_dev, int conn_fd, VhostUserMsg *vmsg)
|
|||||||
qio_channel_yield(ioc, G_IO_IN);
|
qio_channel_yield(ioc, G_IO_IN);
|
||||||
server->in_qio_channel_yield = false;
|
server->in_qio_channel_yield = false;
|
||||||
} else {
|
} else {
|
||||||
/* Wait until attached to an AioContext again */
|
return false;
|
||||||
qemu_coroutine_yield();
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
@ -201,8 +200,16 @@ static coroutine_fn void vu_client_trip(void *opaque)
|
|||||||
VuServer *server = opaque;
|
VuServer *server = opaque;
|
||||||
VuDev *vu_dev = &server->vu_dev;
|
VuDev *vu_dev = &server->vu_dev;
|
||||||
|
|
||||||
while (!vu_dev->broken && vu_dispatch(vu_dev)) {
|
while (!vu_dev->broken) {
|
||||||
/* Keep running */
|
if (server->quiescing) {
|
||||||
|
server->co_trip = NULL;
|
||||||
|
aio_wait_kick();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* vu_dispatch() returns false if server->ctx went away */
|
||||||
|
if (!vu_dispatch(vu_dev) && server->ctx) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vhost_user_server_has_in_flight(server)) {
|
if (vhost_user_server_has_in_flight(server)) {
|
||||||
@ -353,8 +360,7 @@ static void vu_accept(QIONetListener *listener, QIOChannelSocket *sioc,
|
|||||||
|
|
||||||
qio_channel_set_follow_coroutine_ctx(server->ioc, true);
|
qio_channel_set_follow_coroutine_ctx(server->ioc, true);
|
||||||
|
|
||||||
server->co_trip = qemu_coroutine_create(vu_client_trip, server);
|
/* Attaching the AioContext starts the vu_client_trip coroutine */
|
||||||
|
|
||||||
aio_context_acquire(server->ctx);
|
aio_context_acquire(server->ctx);
|
||||||
vhost_user_server_attach_aio_context(server, server->ctx);
|
vhost_user_server_attach_aio_context(server, server->ctx);
|
||||||
aio_context_release(server->ctx);
|
aio_context_release(server->ctx);
|
||||||
@ -413,8 +419,25 @@ void vhost_user_server_attach_aio_context(VuServer *server, AioContext *ctx)
|
|||||||
NULL, NULL, vu_fd_watch);
|
NULL, NULL, vu_fd_watch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (server->co_trip) {
|
||||||
|
/*
|
||||||
|
* The caller didn't fully shut down co_trip (this can happen on
|
||||||
|
* non-polling drains like in bdrv_graph_wrlock()). This is okay as long
|
||||||
|
* as it no longer tries to shut it down and we're guaranteed to still
|
||||||
|
* be in the same AioContext as before.
|
||||||
|
*
|
||||||
|
* co_ctx can still be NULL if we get multiple calls and only just
|
||||||
|
* scheduled a new coroutine in the else branch.
|
||||||
|
*/
|
||||||
|
AioContext *co_ctx = qemu_coroutine_get_aio_context(server->co_trip);
|
||||||
|
|
||||||
|
assert(!server->quiescing);
|
||||||
|
assert(!co_ctx || co_ctx == ctx);
|
||||||
|
} else {
|
||||||
|
server->co_trip = qemu_coroutine_create(vu_client_trip, server);
|
||||||
assert(!server->in_qio_channel_yield);
|
assert(!server->in_qio_channel_yield);
|
||||||
aio_co_schedule(ctx, server->co_trip);
|
aio_co_schedule(ctx, server->co_trip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called with server->ctx acquired */
|
/* Called with server->ctx acquired */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user