26 changes: 13 additions & 13 deletions hw/sh4/sh7750_regs.h
Expand Up @@ -113,7 +113,7 @@
#define SH7750_TTB SH7750_P4_REG32(SH7750_TTB_REGOFS)
#define SH7750_TTB_A7 SH7750_A7_REG32(SH7750_TTB_REGOFS)

/* TLB exeption address register - TEA */
/* TLB exception address register - TEA */
#define SH7750_TEA_REGOFS 0x00000c /* offset */
#define SH7750_TEA SH7750_P4_REG32(SH7750_TEA_REGOFS)
#define SH7750_TEA_A7 SH7750_A7_REG32(SH7750_TEA_REGOFS)
Expand Down Expand Up @@ -183,19 +183,19 @@
#define SH7750_TRA_IMM 0x000003fd /* Immediate data operand */
#define SH7750_TRA_IMM_S 2

/* Exeption event register - EXPEVT */
/* Exception event register - EXPEVT */
#define SH7750_EXPEVT_REGOFS 0x000024
#define SH7750_EXPEVT SH7750_P4_REG32(SH7750_EXPEVT_REGOFS)
#define SH7750_EXPEVT_A7 SH7750_A7_REG32(SH7750_EXPEVT_REGOFS)

#define SH7750_EXPEVT_EX 0x00000fff /* Exeption code */
#define SH7750_EXPEVT_EX 0x00000fff /* Exception code */
#define SH7750_EXPEVT_EX_S 0

/* Interrupt event register */
#define SH7750_INTEVT_REGOFS 0x000028
#define SH7750_INTEVT SH7750_P4_REG32(SH7750_INTEVT_REGOFS)
#define SH7750_INTEVT_A7 SH7750_A7_REG32(SH7750_INTEVT_REGOFS)
#define SH7750_INTEVT_EX 0x00000fff /* Exeption code */
#define SH7750_INTEVT_EX 0x00000fff /* Exception code */
#define SH7750_INTEVT_EX_S 0

/*
Expand Down Expand Up @@ -1274,15 +1274,15 @@
/*
* User Break Controller registers
*/
#define SH7750_BARA 0x200000 /* Break address regiser A */
#define SH7750_BAMRA 0x200004 /* Break address mask regiser A */
#define SH7750_BBRA 0x200008 /* Break bus cycle regiser A */
#define SH7750_BARB 0x20000c /* Break address regiser B */
#define SH7750_BAMRB 0x200010 /* Break address mask regiser B */
#define SH7750_BBRB 0x200014 /* Break bus cycle regiser B */
#define SH7750_BASRB 0x000018 /* Break ASID regiser B */
#define SH7750_BDRB 0x200018 /* Break data regiser B */
#define SH7750_BDMRB 0x20001c /* Break data mask regiser B */
#define SH7750_BARA 0x200000 /* Break address register A */
#define SH7750_BAMRA 0x200004 /* Break address mask register A */
#define SH7750_BBRA 0x200008 /* Break bus cycle register A */
#define SH7750_BARB 0x20000c /* Break address register B */
#define SH7750_BAMRB 0x200010 /* Break address mask register B */
#define SH7750_BBRB 0x200014 /* Break bus cycle register B */
#define SH7750_BASRB 0x000018 /* Break ASID register B */
#define SH7750_BDRB 0x200018 /* Break data register B */
#define SH7750_BDMRB 0x20001c /* Break data mask register B */
#define SH7750_BRCR 0x200020 /* Break control register */

#define SH7750_BRCR_UDBE 0x0001 /* User break debug enable bit */
Expand Down
2 changes: 1 addition & 1 deletion hw/smbios/smbios.c
Expand Up @@ -1110,7 +1110,7 @@ void smbios_get_tables(MachineState *ms,
dimm_cnt = QEMU_ALIGN_UP(current_machine->ram_size, MAX_DIMM_SZ) / MAX_DIMM_SZ;

/*
* The offset determines if we need to keep additional space betweeen
* The offset determines if we need to keep additional space between
* table 17 and table 19 header handle numbers so that they do
* not overlap. For example, for a VM with larger than 8 TB guest
* memory and DIMM like chunks of 16 GiB, the default space between
Expand Down
6 changes: 3 additions & 3 deletions hw/ssi/xilinx_spips.c
Expand Up @@ -163,7 +163,7 @@
FIELD(GQSPI_CNFG, ENDIAN, 26, 1)
/* Poll timeout not implemented */
FIELD(GQSPI_CNFG, EN_POLL_TIMEOUT, 20, 1)
/* QEMU doesnt care about any of these last three */
/* QEMU doesn't care about any of these last three */
FIELD(GQSPI_CNFG, BR, 3, 3)
FIELD(GQSPI_CNFG, CPH, 2, 1)
FIELD(GQSPI_CNFG, CPL, 1, 1)
Expand Down Expand Up @@ -469,7 +469,7 @@ static void xlnx_zynqmp_qspips_flush_fifo_g(XlnxZynqMPQSPIPS *s)

imm = ARRAY_FIELD_EX32(s->regs, GQSPI_GF_SNAPSHOT, IMMEDIATE_DATA);
if (!ARRAY_FIELD_EX32(s->regs, GQSPI_GF_SNAPSHOT, DATA_XFER)) {
/* immedate transfer */
/* immediate transfer */
if (ARRAY_FIELD_EX32(s->regs, GQSPI_GF_SNAPSHOT, TRANSMIT) ||
ARRAY_FIELD_EX32(s->regs, GQSPI_GF_SNAPSHOT, RECIEVE)) {
s->regs[R_GQSPI_DATA_STS] = 1;
Expand Down Expand Up @@ -768,7 +768,7 @@ static void xilinx_spips_check_zero_pump(XilinxSPIPS *s)
*/
while (s->regs[R_TRANSFER_SIZE] &&
s->rx_fifo.num + s->tx_fifo.num < RXFF_A_Q - 3) {
/* endianess just doesn't matter when zero pumping */
/* endianness just doesn't matter when zero pumping */
tx_data_bytes(&s->tx_fifo, 0, 4, false);
s->regs[R_TRANSFER_SIZE] &= ~0x03ull;
s->regs[R_TRANSFER_SIZE] -= 4;
Expand Down
2 changes: 1 addition & 1 deletion hw/ssi/xlnx-versal-ospi.c
Expand Up @@ -837,7 +837,7 @@ static void ospi_do_ind_read(XlnxVersalOspi *s)
/* Continue to read flash until we run out of space in sram */
while (!ospi_ind_op_completed(op) &&
!fifo8_is_full(&s->rx_sram)) {
/* Read reqested number of bytes, max bytes limited to size of sram */
/* Read requested number of bytes, max bytes limited to size of sram */
next_b = ind_op_next_byte(op);
end_b = next_b + fifo8_num_free(&s->rx_sram);
end_b = MIN(end_b, ind_op_end_byte(op));
Expand Down
2 changes: 1 addition & 1 deletion hw/timer/etraxfs_timer.c
Expand Up @@ -236,7 +236,7 @@ static void watchdog_hit(void *opaque)
{
ETRAXTimerState *t = opaque;
if (t->wd_hits == 0) {
/* real hw gives a single tick before reseting but we are
/* real hw gives a single tick before resetting but we are
a bit friendlier to compensate for our slower execution. */
ptimer_set_count(t->ptimer_wd, 10);
ptimer_run(t->ptimer_wd, 1);
Expand Down
2 changes: 1 addition & 1 deletion hw/timer/renesas_tmr.c
Expand Up @@ -115,7 +115,7 @@ static int elapsed_time(RTMRState *tmr, int ch, int64_t delta)
et = tmr->div_round[ch] / divrate;
tmr->div_round[ch] %= divrate;
} else {
/* disble clock. so no update */
/* disable clock. so no update */
et = 0;
}
return et;
Expand Down
2 changes: 1 addition & 1 deletion hw/tpm/tpm_tis.h
Expand Up @@ -19,7 +19,7 @@
* specification.
*
* TPM TIS for TPM 2 implementation following TCG PC Client Platform
* TPM Profile (PTP) Specification, Familiy 2.0, Revision 00.43
* TPM Profile (PTP) Specification, Family 2.0, Revision 00.43
*/
#ifndef TPM_TPM_TIS_H
#define TPM_TPM_TIS_H
Expand Down
2 changes: 1 addition & 1 deletion hw/tpm/tpm_tis_common.c
Expand Up @@ -20,7 +20,7 @@
* specification.
*
* TPM TIS for TPM 2 implementation following TCG PC Client Platform
* TPM Profile (PTP) Specification, Familiy 2.0, Revision 00.43
* TPM Profile (PTP) Specification, Family 2.0, Revision 00.43
*/
#include "qemu/osdep.h"
#include "hw/irq.h"
Expand Down
4 changes: 2 additions & 2 deletions hw/tpm/tpm_tis_i2c.c
Expand Up @@ -13,7 +13,7 @@
* Family 2.0, Level 00, Revision 1.00
*
* TPM TIS for TPM 2 implementation following TCG PC Client Platform
* TPM Profile (PTP) Specification, Familiy 2.0, Revision 00.43
* TPM Profile (PTP) Specification, Family 2.0, Revision 00.43
*
*/

Expand Down Expand Up @@ -507,7 +507,7 @@ static void tpm_tis_i2c_realizefn(DeviceState *dev, Error **errp)
}

/*
* Get the backend pointer. It is not initialized propery during
* Get the backend pointer. It is not initialized properly during
* device_class_set_props
*/
s->be_driver = qemu_find_tpm_be("tpm0");
Expand Down
2 changes: 1 addition & 1 deletion hw/tpm/tpm_tis_isa.c
Expand Up @@ -19,7 +19,7 @@
* specification.
*
* TPM TIS for TPM 2 implementation following TCG PC Client Platform
* TPM Profile (PTP) Specification, Familiy 2.0, Revision 00.43
* TPM Profile (PTP) Specification, Family 2.0, Revision 00.43
*/

#include "qemu/osdep.h"
Expand Down
2 changes: 1 addition & 1 deletion hw/tpm/tpm_tis_sysbus.c
Expand Up @@ -19,7 +19,7 @@
* specification.
*
* TPM TIS for TPM 2 implementation following TCG PC Client Platform
* TPM Profile (PTP) Specification, Familiy 2.0, Revision 00.43
* TPM Profile (PTP) Specification, Family 2.0, Revision 00.43
*/

#include "qemu/osdep.h"
Expand Down
4 changes: 2 additions & 2 deletions hw/virtio/virtio-crypto.c
Expand Up @@ -655,7 +655,7 @@ virtio_crypto_sym_op_helper(VirtIODevice *vdev,
op_info->len_to_hash = len_to_hash;
op_info->cipher_start_src_offset = cipher_start_src_offset;
op_info->len_to_cipher = len_to_cipher;
/* Handle the initilization vector */
/* Handle the initialization vector */
if (op_info->iv_len > 0) {
DPRINTF("iv_len=%" PRIu32 "\n", op_info->iv_len);
op_info->iv = op_info->data + curr_size;
Expand Down Expand Up @@ -1278,7 +1278,7 @@ static void virtio_crypto_instance_init(Object *obj)

/*
* The default config_size is sizeof(struct virtio_crypto_config).
* Can be overriden with virtio_crypto_set_config_size.
* Can be overridden with virtio_crypto_set_config_size.
*/
vcrypto->config_size = sizeof(struct virtio_crypto_config);
}
Expand Down
2 changes: 1 addition & 1 deletion hw/virtio/virtio-mem.c
Expand Up @@ -1119,7 +1119,7 @@ static int virtio_mem_mig_sanity_checks_post_load(void *opaque, int version_id)
return -EINVAL;
}
/*
* Note: Preparation for resizeable memory regions. The maximum size
* Note: Preparation for resizable memory regions. The maximum size
* of the memory region must not change during migration.
*/
if (tmp->region_size != new_region_size) {
Expand Down
2 changes: 1 addition & 1 deletion hw/virtio/virtio.c
Expand Up @@ -2096,7 +2096,7 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index)
* being converted to LOG_GUEST_ERROR.
*
if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
error_report("queue_enable is only suppported in devices of virtio "
error_report("queue_enable is only supported in devices of virtio "
"1.0 or later.");
}
*/
Expand Down
3 changes: 1 addition & 2 deletions include/block/aio.h
Expand Up @@ -31,7 +31,6 @@ typedef void BlockCompletionFunc(void *opaque, int ret);

typedef struct AIOCBInfo {
void (*cancel_async)(BlockAIOCB *acb);
AioContext *(*get_aio_context)(BlockAIOCB *acb);
size_t aiocb_size;
} AIOCBInfo;

Expand Down Expand Up @@ -468,7 +467,7 @@ void aio_dispatch(AioContext *ctx);
* or more AIO events have completed, to ensure something has moved
* before returning.
*/
bool aio_poll(AioContext *ctx, bool blocking);
bool no_coroutine_fn aio_poll(AioContext *ctx, bool blocking);

/* Register a file descriptor and associated callbacks. Behaves very similarly
* to qemu_set_fd_handler. Unlike qemu_set_fd_handler, these callbacks will
Expand Down
7 changes: 7 additions & 0 deletions include/block/block-common.h
Expand Up @@ -66,10 +66,14 @@
* function. The coroutine yields after scheduling the BH and is reentered when
* the wrapped function returns.
*
* A no_co_wrapper_bdrv_wrlock function is a no_co_wrapper function that
* automatically takes the graph wrlock when calling the wrapped function.
*
* If the first parameter of the function is a BlockDriverState, BdrvChild or
* BlockBackend pointer, the AioContext lock for it is taken in the wrapper.
*/
#define no_co_wrapper
#define no_co_wrapper_bdrv_wrlock

#include "block/blockjob.h"

Expand Down Expand Up @@ -287,6 +291,8 @@ typedef enum {
* layer rather than any backing, set by block layer
* BDRV_BLOCK_EOF: the returned pnum covers through end of file for this
* layer, set by block layer
* BDRV_BLOCK_COMPRESSED: the underlying data is compressed; only valid for
* the formats supporting compression: qcow, qcow2
*
* Internal flags:
* BDRV_BLOCK_RAW: for use by passthrough drivers, such as raw, to request
Expand Down Expand Up @@ -322,6 +328,7 @@ typedef enum {
#define BDRV_BLOCK_ALLOCATED 0x10
#define BDRV_BLOCK_EOF 0x20
#define BDRV_BLOCK_RECURSE 0x40
#define BDRV_BLOCK_COMPRESSED 0x80

typedef QTAILQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue;

Expand Down
32 changes: 22 additions & 10 deletions include/block/block-global-state.h
Expand Up @@ -185,6 +185,8 @@ void bdrv_drain_all_begin_nopoll(void);
void bdrv_drain_all_end(void);
void bdrv_drain_all(void);

void bdrv_aio_cancel(BlockAIOCB *acb);

int bdrv_has_zero_init_1(BlockDriverState *bs);
int bdrv_has_zero_init(BlockDriverState *bs);
BlockDriverState *bdrv_find_node(const char *node_name);
Expand Down Expand Up @@ -224,13 +226,21 @@ void bdrv_img_create(const char *filename, const char *fmt,
void bdrv_ref(BlockDriverState *bs);
void no_coroutine_fn bdrv_unref(BlockDriverState *bs);
void coroutine_fn no_co_wrapper bdrv_co_unref(BlockDriverState *bs);
void bdrv_unref_child(BlockDriverState *parent, BdrvChild *child);
BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs,
BlockDriverState *child_bs,
const char *child_name,
const BdrvChildClass *child_class,
BdrvChildRole child_role,
Error **errp);
void GRAPH_WRLOCK bdrv_schedule_unref(BlockDriverState *bs);

void GRAPH_WRLOCK
bdrv_unref_child(BlockDriverState *parent, BdrvChild *child);

void coroutine_fn no_co_wrapper_bdrv_wrlock
bdrv_co_unref_child(BlockDriverState *parent, BdrvChild *child);

BdrvChild * GRAPH_WRLOCK
bdrv_attach_child(BlockDriverState *parent_bs,
BlockDriverState *child_bs,
const char *child_name,
const BdrvChildClass *child_class,
BdrvChildRole child_role,
Error **errp);

bool bdrv_op_is_blocked(BlockDriverState *bs, BlockOpType op, Error **errp);
void bdrv_op_block(BlockDriverState *bs, BlockOpType op, Error *reason);
Expand Down Expand Up @@ -268,9 +278,11 @@ int bdrv_try_change_aio_context(BlockDriverState *bs, AioContext *ctx,
int bdrv_probe_blocksizes(BlockDriverState *bs, BlockSizes *bsz);
int bdrv_probe_geometry(BlockDriverState *bs, HDGeometry *geo);

void bdrv_add_child(BlockDriverState *parent, BlockDriverState *child,
Error **errp);
void bdrv_del_child(BlockDriverState *parent, BdrvChild *child, Error **errp);
void GRAPH_WRLOCK
bdrv_add_child(BlockDriverState *parent, BlockDriverState *child, Error **errp);

void GRAPH_WRLOCK
bdrv_del_child(BlockDriverState *parent, BdrvChild *child, Error **errp);

/**
*
Expand Down
1 change: 0 additions & 1 deletion include/block/block-io.h
Expand Up @@ -101,7 +101,6 @@ bdrv_co_delete_file_noerr(BlockDriverState *bs);


/* async block I/O */
void bdrv_aio_cancel(BlockAIOCB *acb);
void bdrv_aio_cancel_async(BlockAIOCB *acb);

/* sg packet commands */
Expand Down
34 changes: 18 additions & 16 deletions include/block/block_int-common.h
Expand Up @@ -311,7 +311,7 @@ struct BlockDriver {
*/
void (*bdrv_cancel_in_flight)(BlockDriverState *bs);

int (*bdrv_inactivate)(BlockDriverState *bs);
int GRAPH_RDLOCK_PTR (*bdrv_inactivate)(BlockDriverState *bs);

int (*bdrv_snapshot_create)(BlockDriverState *bs,
QEMUSnapshotInfo *sn_info);
Expand Down Expand Up @@ -393,10 +393,11 @@ struct BlockDriver {
*/
int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo);

void (*bdrv_add_child)(BlockDriverState *parent, BlockDriverState *child,
Error **errp);
void (*bdrv_del_child)(BlockDriverState *parent, BdrvChild *child,
Error **errp);
void GRAPH_WRLOCK_PTR (*bdrv_add_child)(
BlockDriverState *parent, BlockDriverState *child, Error **errp);

void GRAPH_WRLOCK_PTR (*bdrv_del_child)(
BlockDriverState *parent, BdrvChild *child, Error **errp);

/**
* Informs the block driver that a permission change is intended. The
Expand All @@ -413,8 +414,8 @@ struct BlockDriver {
* If both conditions are met, 0 is returned. Otherwise, -errno is returned
* and errp is set to an error describing the conflict.
*/
int (*bdrv_check_perm)(BlockDriverState *bs, uint64_t perm,
uint64_t shared, Error **errp);
int GRAPH_RDLOCK_PTR (*bdrv_check_perm)(BlockDriverState *bs, uint64_t perm,
uint64_t shared, Error **errp);

/**
* Called to inform the driver that the set of cumulative set of used
Expand All @@ -426,7 +427,8 @@ struct BlockDriver {
* This function is only invoked after bdrv_check_perm(), so block drivers
* may rely on preparations made in their .bdrv_check_perm implementation.
*/
void (*bdrv_set_perm)(BlockDriverState *bs, uint64_t perm, uint64_t shared);
void GRAPH_RDLOCK_PTR (*bdrv_set_perm)(
BlockDriverState *bs, uint64_t perm, uint64_t shared);

/*
* Called to inform the driver that after a previous bdrv_check_perm()
Expand All @@ -436,7 +438,7 @@ struct BlockDriver {
* This function can be called even for nodes that never saw a
* bdrv_check_perm() call. It is a no-op then.
*/
void (*bdrv_abort_perm_update)(BlockDriverState *bs);
void GRAPH_RDLOCK_PTR (*bdrv_abort_perm_update)(BlockDriverState *bs);

/**
* Returns in @nperm and @nshared the permissions that the driver for @bs
Expand All @@ -450,11 +452,11 @@ struct BlockDriver {
* permissions, but those that will be needed after applying the
* @reopen_queue.
*/
void (*bdrv_child_perm)(BlockDriverState *bs, BdrvChild *c,
BdrvChildRole role,
BlockReopenQueue *reopen_queue,
uint64_t parent_perm, uint64_t parent_shared,
uint64_t *nperm, uint64_t *nshared);
void GRAPH_RDLOCK_PTR (*bdrv_child_perm)(
BlockDriverState *bs, BdrvChild *c, BdrvChildRole role,
BlockReopenQueue *reopen_queue,
uint64_t parent_perm, uint64_t parent_shared,
uint64_t *nperm, uint64_t *nshared);

/**
* Register/unregister a buffer for I/O. For example, when the driver is
Expand Down Expand Up @@ -944,8 +946,8 @@ struct BdrvChildClass {
* when migration is completing) and it can start/stop requesting
* permissions and doing I/O on it.
*/
void (*activate)(BdrvChild *child, Error **errp);
int (*inactivate)(BdrvChild *child);
void GRAPH_RDLOCK_PTR (*activate)(BdrvChild *child, Error **errp);
int GRAPH_RDLOCK_PTR (*inactivate)(BdrvChild *child);

void GRAPH_WRLOCK_PTR (*attach)(BdrvChild *child);
void GRAPH_WRLOCK_PTR (*detach)(BdrvChild *child);
Expand Down
14 changes: 8 additions & 6 deletions include/block/block_int-global-state.h
Expand Up @@ -202,18 +202,19 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
BdrvChildRole child_role,
uint64_t perm, uint64_t shared_perm,
void *opaque, Error **errp);
void bdrv_root_unref_child(BdrvChild *child);
void GRAPH_WRLOCK bdrv_root_unref_child(BdrvChild *child);

void bdrv_get_cumulative_perm(BlockDriverState *bs, uint64_t *perm,
uint64_t *shared_perm);
void GRAPH_RDLOCK bdrv_get_cumulative_perm(BlockDriverState *bs, uint64_t *perm,
uint64_t *shared_perm);

/**
* Sets a BdrvChild's permissions. Avoid if the parent is a BDS; use
* bdrv_child_refresh_perms() instead and make the parent's
* .bdrv_child_perm() implementation return the correct values.
*/
int bdrv_child_try_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared,
Error **errp);
int GRAPH_RDLOCK
bdrv_child_try_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared,
Error **errp);

/**
* Calls bs->drv->bdrv_child_perm() and updates the child's permission
Expand All @@ -223,7 +224,8 @@ int bdrv_child_try_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared,
* values than before, but which will not result in the block layer
* automatically refreshing the permissions.
*/
int bdrv_child_refresh_perms(BlockDriverState *bs, BdrvChild *c, Error **errp);
int GRAPH_RDLOCK
bdrv_child_refresh_perms(BlockDriverState *bs, BdrvChild *c, Error **errp);

bool GRAPH_RDLOCK bdrv_recurse_can_replace(BlockDriverState *bs,
BlockDriverState *to_replace);
Expand Down
6 changes: 3 additions & 3 deletions include/block/throttle-groups.h
Expand Up @@ -37,7 +37,7 @@ typedef struct ThrottleGroupMember {
AioContext *aio_context;
/* throttled_reqs_lock protects the CoQueues for throttled requests. */
CoMutex throttled_reqs_lock;
CoQueue throttled_reqs[2];
CoQueue throttled_reqs[THROTTLE_MAX];

/* Nonzero if the I/O limits are currently being ignored; generally
* it is zero. Accessed with atomic operations.
Expand All @@ -54,7 +54,7 @@ typedef struct ThrottleGroupMember {
* throttle_state tells us if I/O limits are configured. */
ThrottleState *throttle_state;
ThrottleTimers throttle_timers;
unsigned pending_reqs[2];
unsigned pending_reqs[THROTTLE_MAX];
QLIST_ENTRY(ThrottleGroupMember) round_robin;

} ThrottleGroupMember;
Expand All @@ -78,7 +78,7 @@ void throttle_group_restart_tgm(ThrottleGroupMember *tgm);

void coroutine_fn throttle_group_co_io_limits_intercept(ThrottleGroupMember *tgm,
int64_t bytes,
bool is_write);
ThrottleDirection direction);
void throttle_group_attach_aio_context(ThrottleGroupMember *tgm,
AioContext *new_context);
void throttle_group_detach_aio_context(ThrottleGroupMember *tgm);
Expand Down
2 changes: 1 addition & 1 deletion include/hw/cxl/cxl.h
Expand Up @@ -29,7 +29,7 @@ typedef struct PXBCXLDev PXBCXLDev;
typedef struct CXLFixedWindow {
uint64_t size;
char **targets;
PXBCXLDev *target_hbs[8];
PXBCXLDev *target_hbs[16];
uint8_t num_targets;
uint8_t enc_int_ways;
uint8_t enc_int_gran;
Expand Down
2 changes: 1 addition & 1 deletion include/hw/cxl/cxl_device.h
Expand Up @@ -300,7 +300,7 @@ REG64(CXL_MEM_DEV_STS, 0)
typedef struct CXLError {
QTAILQ_ENTRY(CXLError) node;
int type; /* Error code as per FE definition */
uint32_t header[32];
uint32_t header[CXL_RAS_ERR_HEADER_NUM];
} CXLError;

typedef QTAILQ_HEAD(, CXLError) CXLErrorList;
Expand Down
2 changes: 1 addition & 1 deletion include/hw/i386/topology.h
Expand Up @@ -31,7 +31,7 @@
*
* This code should be compatible with AMD's "Extended Method" described at:
* AMD CPUID Specification (Publication #25481)
* Section 3: Multiple Core Calcuation
* Section 3: Multiple Core Calculation
* as long as:
* nr_threads is set to 1;
* OFFSET_IDX is assumed to be 0;
Expand Down
2 changes: 1 addition & 1 deletion include/hw/ppc/openpic.h
Expand Up @@ -14,7 +14,7 @@ enum {
OPENPIC_OUTPUT_INT = 0, /* IRQ */
OPENPIC_OUTPUT_CINT, /* critical IRQ */
OPENPIC_OUTPUT_MCK, /* Machine check event */
OPENPIC_OUTPUT_DEBUG, /* Inconditional debug event */
OPENPIC_OUTPUT_DEBUG, /* Unconditional debug event */
OPENPIC_OUTPUT_RESET, /* Core reset event */
OPENPIC_OUTPUT_NB,
};
Expand Down
2 changes: 1 addition & 1 deletion include/hw/ppc/spapr.h
Expand Up @@ -193,7 +193,7 @@ struct SpaprMachineState {
SpaprResizeHpt resize_hpt;
void *htab;
uint32_t htab_shift;
uint64_t patb_entry; /* Process tbl registed in H_REGISTER_PROC_TBL */
uint64_t patb_entry; /* Process tbl registered in H_REGISTER_PROC_TBL */
SpaprPendingHpt *pending_hpt; /* in-progress resize */

hwaddr rma_size;
Expand Down
16 changes: 11 additions & 5 deletions include/qemu/throttle.h
Expand Up @@ -99,13 +99,18 @@ typedef struct ThrottleState {
int64_t previous_leak; /* timestamp of the last leak done */
} ThrottleState;

typedef enum {
THROTTLE_READ = 0,
THROTTLE_WRITE,
THROTTLE_MAX
} ThrottleDirection;

typedef struct ThrottleTimers {
QEMUTimer *timers[2]; /* timers used to do the throttling */
QEMUTimer *timers[THROTTLE_MAX]; /* timers used to do the throttling */
QEMUClockType clock_type; /* the clock used */

/* Callbacks */
QEMUTimerCB *read_timer_cb;
QEMUTimerCB *write_timer_cb;
QEMUTimerCB *timer_cb[THROTTLE_MAX];
void *timer_opaque;
} ThrottleTimers;

Expand Down Expand Up @@ -149,9 +154,10 @@ void throttle_config_init(ThrottleConfig *cfg);
/* usage */
bool throttle_schedule_timer(ThrottleState *ts,
ThrottleTimers *tt,
bool is_write);
ThrottleDirection direction);

void throttle_account(ThrottleState *ts, bool is_write, uint64_t size);
void throttle_account(ThrottleState *ts, ThrottleDirection direction,
uint64_t size);
void throttle_limits_to_config(ThrottleLimits *arg, ThrottleConfig *cfg,
Error **errp);
void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var);
Expand Down
4 changes: 2 additions & 2 deletions include/sysemu/block-backend-global-state.h
Expand Up @@ -61,8 +61,8 @@ int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp);
int blk_replace_bs(BlockBackend *blk, BlockDriverState *new_bs, Error **errp);
bool bdrv_has_blk(BlockDriverState *bs);
bool bdrv_is_root_node(BlockDriverState *bs);
int blk_set_perm(BlockBackend *blk, uint64_t perm, uint64_t shared_perm,
Error **errp);
int GRAPH_UNLOCKED blk_set_perm(BlockBackend *blk, uint64_t perm,
uint64_t shared_perm, Error **errp);
void blk_get_perm(BlockBackend *blk, uint64_t *perm, uint64_t *shared_perm);

void blk_iostatus_enable(BlockBackend *blk);
Expand Down
19 changes: 19 additions & 0 deletions python/qemu/machine/machine.py
Expand Up @@ -191,6 +191,7 @@ def __init__(self,
self.sock_dir, f"{self._name}.con"
)
self._console_socket: Optional[socket.socket] = None
self._console_file: Optional[socket.SocketIO] = None
self._remove_files: List[str] = []
self._user_killed = False
self._quit_issued = False
Expand Down Expand Up @@ -509,6 +510,11 @@ def _early_cleanup(self) -> None:
# If we keep the console socket open, we may deadlock waiting
# for QEMU to exit, while QEMU is waiting for the socket to
# become writable.
if self._console_file is not None:
LOG.debug("Closing console file")
self._console_file.close()
self._console_file = None

if self._console_socket is not None:
LOG.debug("Closing console socket")
self._console_socket.close()
Expand Down Expand Up @@ -874,12 +880,25 @@ def console_socket(self) -> socket.socket:
Returns a socket connected to the console
"""
if self._console_socket is None:
LOG.debug("Opening console socket")
self._console_socket = console_socket.ConsoleSocket(
self._console_address,
file=self._console_log_path,
drain=self._drain_console)
return self._console_socket

@property
def console_file(self) -> socket.SocketIO:
"""
Returns a file associated with the console socket
"""
if self._console_file is None:
LOG.debug("Opening console file")
self._console_file = self.console_socket.makefile(mode='rb',
buffering=0,
encoding='utf-8')
return self._console_file

@property
def temp_dir(self) -> str:
"""
Expand Down
6 changes: 4 additions & 2 deletions qapi/block-core.json
Expand Up @@ -409,6 +409,8 @@
#
# @zero: whether the virtual blocks read as zeroes
#
# @compressed: true if the data is stored compressed (since 8.2)
#
# @depth: number of layers (0 = top image, 1 = top image's backing
# file, ..., n - 1 = bottom image (where n is the number of images
# in the chain)) before reaching one for which the range is
Expand All @@ -426,8 +428,8 @@
##
{ 'struct': 'MapEntry',
'data': {'start': 'int', 'length': 'int', 'data': 'bool',
'zero': 'bool', 'depth': 'int', 'present': 'bool',
'*offset': 'int', '*filename': 'str' } }
'zero': 'bool', 'compressed': 'bool', 'depth': 'int',
'present': 'bool', '*offset': 'int', '*filename': 'str' } }

##
# @BlockdevCacheInfo:
Expand Down
8 changes: 6 additions & 2 deletions qemu-img.c
Expand Up @@ -3108,10 +3108,12 @@ static int dump_map_entry(OutputFormat output_format, MapEntry *e,
case OFORMAT_JSON:
printf("{ \"start\": %"PRId64", \"length\": %"PRId64","
" \"depth\": %"PRId64", \"present\": %s, \"zero\": %s,"
" \"data\": %s", e->start, e->length, e->depth,
" \"data\": %s, \"compressed\": %s",
e->start, e->length, e->depth,
e->present ? "true" : "false",
e->zero ? "true" : "false",
e->data ? "true" : "false");
e->data ? "true" : "false",
e->compressed ? "true" : "false");
if (e->has_offset) {
printf(", \"offset\": %"PRId64"", e->offset);
}
Expand Down Expand Up @@ -3172,6 +3174,7 @@ static int get_block_status(BlockDriverState *bs, int64_t offset,
.length = bytes,
.data = !!(ret & BDRV_BLOCK_DATA),
.zero = !!(ret & BDRV_BLOCK_ZERO),
.compressed = !!(ret & BDRV_BLOCK_COMPRESSED),
.offset = map,
.has_offset = has_offset,
.depth = depth,
Expand All @@ -3189,6 +3192,7 @@ static inline bool entry_mergeable(const MapEntry *curr, const MapEntry *next)
}
if (curr->zero != next->zero ||
curr->data != next->data ||
curr->compressed != next->compressed ||
curr->depth != next->depth ||
curr->present != next->present ||
!curr->filename != !next->filename ||
Expand Down
18 changes: 15 additions & 3 deletions scripts/block-coroutine-wrapper.py
Expand Up @@ -71,10 +71,13 @@ def __init__(self, wrapper_type: str, return_type: str, name: str,
self.args = [ParamDecl(arg.strip()) for arg in args.split(',')]
self.create_only_co = 'mixed' not in variant
self.graph_rdlock = 'bdrv_rdlock' in variant
self.graph_wrlock = 'bdrv_wrlock' in variant

self.wrapper_type = wrapper_type

if wrapper_type == 'co':
if self.graph_wrlock:
raise ValueError(f"co function can't be wrlock: {self.name}")
subsystem, subname = self.name.split('_', 1)
self.target_name = f'{subsystem}_co_{subname}'
else:
Expand Down Expand Up @@ -102,12 +105,13 @@ def __init__(self, wrapper_type: str, return_type: str, name: str,

def gen_ctx(self, prefix: str = '') -> str:
t = self.args[0].type
name = self.args[0].name
if t == 'BlockDriverState *':
return f'bdrv_get_aio_context({prefix}bs)'
return f'bdrv_get_aio_context({prefix}{name})'
elif t == 'BdrvChild *':
return f'bdrv_get_aio_context({prefix}child->bs)'
return f'bdrv_get_aio_context({prefix}{name}->bs)'
elif t == 'BlockBackend *':
return f'blk_get_aio_context({prefix}blk)'
return f'blk_get_aio_context({prefix}{name})'
else:
return 'qemu_get_aio_context()'

Expand Down Expand Up @@ -250,6 +254,12 @@ def gen_no_co_wrapper(func: FuncDecl) -> str:
name = func.target_name
struct_name = func.struct_name

graph_lock=''
graph_unlock=''
if func.graph_wrlock:
graph_lock=' bdrv_graph_wrlock(NULL);'
graph_unlock=' bdrv_graph_wrunlock();'

return f"""\
/*
* Wrappers for {name}
Expand All @@ -266,9 +276,11 @@ def gen_no_co_wrapper(func: FuncDecl) -> str:
{struct_name} *s = opaque;
AioContext *ctx = {func.gen_ctx('s->')};
{graph_lock}
aio_context_acquire(ctx);
{func.get_result}{name}({ func.gen_list('s->{name}') });
aio_context_release(ctx);
{graph_unlock}
aio_co_wake(s->co);
}}
Expand Down
8 changes: 0 additions & 8 deletions softmmu/dma-helpers.c
Expand Up @@ -206,17 +206,9 @@ static void dma_aio_cancel(BlockAIOCB *acb)
}
}

static AioContext *dma_get_aio_context(BlockAIOCB *acb)
{
DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common);

return dbs->ctx;
}

static const AIOCBInfo dma_aiocb_info = {
.aiocb_size = sizeof(DMAAIOCB),
.cancel_async = dma_aio_cancel,
.get_aio_context = dma_get_aio_context,
};

BlockAIOCB *dma_blk_io(AioContext *ctx,
Expand Down
2 changes: 1 addition & 1 deletion subprojects/berkeley-softfloat-3.wrap
@@ -1,5 +1,5 @@
[wrap-git]
url = https://gitlab.com/qemu-project/berkeley-softfloat-3
url = https://gitlab.com/qemu-project/berkeley-softfloat-3.git
revision = b64af41c3276f97f0e181920400ee056b9c88037
patch_directory = berkeley-softfloat-3
depth = 1
2 changes: 1 addition & 1 deletion subprojects/berkeley-testfloat-3.wrap
@@ -1,5 +1,5 @@
[wrap-git]
url = https://gitlab.com/qemu-project/berkeley-testfloat-3
url = https://gitlab.com/qemu-project/berkeley-testfloat-3.git
revision = e7af9751d9f9fd3b47911f51a5cfd08af256a9ab
patch_directory = berkeley-testfloat-3
depth = 1
2 changes: 1 addition & 1 deletion subprojects/slirp.wrap
@@ -1,5 +1,5 @@
[wrap-git]
url = https://gitlab.freedesktop.org/slirp/libslirp
url = https://gitlab.freedesktop.org/slirp/libslirp.git
revision = 26be815b86e8d49add8c9a8b320239b9594ff03d

[provide]
Expand Down
4 changes: 2 additions & 2 deletions target/i386/cpu.c
Expand Up @@ -5340,7 +5340,7 @@ static const char *x86_cpu_feature_name(FeatureWord w, int bitnr)
return name;
}

/* Compatibily hack to maintain legacy +-feat semantic,
/* Compatibility hack to maintain legacy +-feat semantic,
* where +-feat overwrites any feature set by
* feat=on|feat even if the later is parsed after +-feat
* (i.e. "-x2apic,x2apic=on" will result in x2apic disabled)
Expand Down Expand Up @@ -6303,7 +6303,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
* The initial value of xcr0 and ebx == 0, On host without kvm
* commit 412a3c41(e.g., CentOS 6), the ebx's value always == 0
* even through guest update xcr0, this will crash some legacy guest
* (e.g., CentOS 6), So set ebx == ecx to workaroud it.
* (e.g., CentOS 6), So set ebx == ecx to workaround it.
*/
*ebx = kvm_enabled() ? *ecx : xsave_area_size(env->xcr0, false);
} else if (count == 1) {
Expand Down
4 changes: 2 additions & 2 deletions target/i386/cpu.h
Expand Up @@ -728,7 +728,7 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w,
#define CPUID_EXT2_3DNOWEXT (1U << 30)
#define CPUID_EXT2_3DNOW (1U << 31)

/* CPUID[8000_0001].EDX bits that are aliase of CPUID[1].EDX bits on AMD CPUs */
/* CPUID[8000_0001].EDX bits that are aliases of CPUID[1].EDX bits on AMD CPUs */
#define CPUID_EXT2_AMD_ALIASES (CPUID_EXT2_FPU | CPUID_EXT2_VME | \
CPUID_EXT2_DE | CPUID_EXT2_PSE | \
CPUID_EXT2_TSC | CPUID_EXT2_MSR | \
Expand Down Expand Up @@ -2071,7 +2071,7 @@ hwaddr x86_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
MemTxAttrs *attrs);
int cpu_get_pic_interrupt(CPUX86State *s);

/* MSDOS compatibility mode FPU exception support */
/* MS-DOS compatibility mode FPU exception support */
void x86_register_ferr_irq(qemu_irq irq);
void fpu_check_raise_ferr_irq(CPUX86State *s);
void cpu_set_ignne(void);
Expand Down
4 changes: 2 additions & 2 deletions target/i386/kvm/kvm.c
Expand Up @@ -4729,7 +4729,7 @@ int kvm_arch_put_registers(CPUState *cpu, int level)
/*
* Put MSR_IA32_FEATURE_CONTROL first, this ensures the VM gets out of VMX
* root operation upon vCPU reset. kvm_put_msr_feature_control() should also
* preceed kvm_put_nested_state() when 'real' nested state is set.
* precede kvm_put_nested_state() when 'real' nested state is set.
*/
if (level >= KVM_PUT_RESET_STATE) {
ret = kvm_put_msr_feature_control(x86_cpu);
Expand Down Expand Up @@ -5653,7 +5653,7 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
}

/*
* Handled untranslated compatibilty format interrupt with
* Handled untranslated compatibility format interrupt with
* extended destination ID in the low bits 11-5. */
dst.address = kvm_swizzle_msi_ext_dest_id(dst.address);

Expand Down
2 changes: 1 addition & 1 deletion target/i386/kvm/xen-emu.c
Expand Up @@ -1033,7 +1033,7 @@ static int do_set_periodic_timer(CPUState *target, uint64_t period_ns)
#define MILLISECS(_ms) ((int64_t)((_ms) * 1000000ULL))
#define MICROSECS(_us) ((int64_t)((_us) * 1000ULL))
#define STIME_MAX ((time_t)((int64_t)~0ull >> 1))
/* Chosen so (NOW() + delta) wont overflow without an uptime of 200 years */
/* Chosen so (NOW() + delta) won't overflow without an uptime of 200 years */
#define STIME_DELTA_MAX ((int64_t)((uint64_t)~0ull >> 2))

static int vcpuop_set_periodic_timer(CPUState *cs, CPUState *target,
Expand Down
4 changes: 2 additions & 2 deletions target/i386/machine.c
Expand Up @@ -282,12 +282,12 @@ static int cpu_pre_save(void *opaque)
* hypervisor, its exception payload (CR2/DR6 on #PF/#DB)
* should not be set yet in the respective vCPU register.
* Thus, in case an exception is pending, it is
* important to save the exception payload seperately.
* important to save the exception payload separately.
*
* Therefore, if an exception is not in a pending state
* or vCPU is not in guest-mode, it is not important to
* distinguish between a pending and injected exception
* and we don't need to store seperately the exception payload.
* and we don't need to store separately the exception payload.
*
* In order to preserve better backwards-compatible migration,
* convert a pending exception to an injected exception in
Expand Down
8 changes: 4 additions & 4 deletions target/i386/tcg/translate.c
Expand Up @@ -1069,7 +1069,7 @@ static CCPrepare gen_prepare_eflags_z(DisasContext *s, TCGv reg)
}

/* perform a conditional store into register 'reg' according to jump opcode
value 'b'. In the fast case, T0 is guaranted not to be used. */
value 'b'. In the fast case, T0 is guaranteed not to be used. */
static CCPrepare gen_prepare_cc(DisasContext *s, int b, TCGv reg)
{
int inv, jcc_op, cond;
Expand Down Expand Up @@ -1202,7 +1202,7 @@ static inline void gen_compute_eflags_c(DisasContext *s, TCGv reg)
}

/* generate a conditional jump to label 'l1' according to jump opcode
value 'b'. In the fast case, T0 is guaranted not to be used. */
value 'b'. In the fast case, T0 is guaranteed not to be used. */
static inline void gen_jcc1_noeob(DisasContext *s, int b, TCGLabel *l1)
{
CCPrepare cc = gen_prepare_cc(s, b, s->T0);
Expand All @@ -1219,7 +1219,7 @@ static inline void gen_jcc1_noeob(DisasContext *s, int b, TCGLabel *l1)
}

/* Generate a conditional jump to label 'l1' according to jump opcode
value 'b'. In the fast case, T0 is guaranted not to be used.
value 'b'. In the fast case, T0 is guaranteed not to be used.
A translation block must end soon. */
static inline void gen_jcc1(DisasContext *s, int b, TCGLabel *l1)
{
Expand Down Expand Up @@ -5355,7 +5355,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
if (s->prefix & PREFIX_LOCK) {
switch (op) {
case 0: /* bt */
/* Needs no atomic ops; we surpressed the normal
/* Needs no atomic ops; we suppressed the normal
memory load for LOCK above so do it now. */
gen_op_ld_v(s, ot, s->T0, s->A0);
break;
Expand Down
4 changes: 2 additions & 2 deletions target/ppc/cpu-models.h
Expand Up @@ -44,7 +44,7 @@ enum {
/* PowerPC 405 cores */
CPU_POWERPC_405D2 = 0x20010000,
CPU_POWERPC_405D4 = 0x41810000,
/* PowerPC 405 microcontrolers */
/* PowerPC 405 microcontrollers */
/* XXX: missing 0x200108a0 */
CPU_POWERPC_405CRa = 0x40110041,
CPU_POWERPC_405CRb = 0x401100C5,
Expand Down Expand Up @@ -74,7 +74,7 @@ enum {
#define CPU_POWERPC_440 CPU_POWERPC_440GXf
/* PowerPC 440 cores */
CPU_POWERPC_440_XILINX = 0x7ff21910,
/* PowerPC 440 microcontrolers */
/* PowerPC 440 microcontrollers */
CPU_POWERPC_440EPa = 0x42221850,
CPU_POWERPC_440EPb = 0x422218D3,
CPU_POWERPC_440GPb = 0x40120440,
Expand Down
2 changes: 1 addition & 1 deletion target/ppc/cpu.h
Expand Up @@ -428,7 +428,7 @@ FIELD(MSR, LE, MSR_LE, 1)

/* PMU bits */
#define MMCR0_FC PPC_BIT(32) /* Freeze Counters */
#define MMCR0_PMAO PPC_BIT(56) /* Perf Monitor Alert Ocurred */
#define MMCR0_PMAO PPC_BIT(56) /* Perf Monitor Alert Occurred */
#define MMCR0_PMAE PPC_BIT(37) /* Perf Monitor Alert Enable */
#define MMCR0_EBE PPC_BIT(43) /* Perf Monitor EBB Enable */
#define MMCR0_FCECE PPC_BIT(38) /* FC on Enabled Cond or Event */
Expand Down
4 changes: 2 additions & 2 deletions target/ppc/cpu_init.c
Expand Up @@ -5347,7 +5347,7 @@ static void register_970_lpar_sprs(CPUPPCState *env)
static void register_power5p_lpar_sprs(CPUPPCState *env)
{
#if !defined(CONFIG_USER_ONLY)
/* Logical partitionning */
/* Logical partitioning */
spr_register_kvm_hv(env, SPR_LPCR, "LPCR",
SPR_NOACCESS, SPR_NOACCESS,
SPR_NOACCESS, SPR_NOACCESS,
Expand Down Expand Up @@ -5760,7 +5760,7 @@ static void register_power9_mmu_sprs(CPUPPCState *env)
static void register_power10_hash_sprs(CPUPPCState *env)
{
/*
* it's the OS responsability to generate a random value for the registers
* it's the OS responsibility to generate a random value for the registers
* in each process' context. So, initialize it with 0 here.
*/
uint64_t hashkeyr_initial_value = 0, hashpkeyr_initial_value = 0;
Expand Down
14 changes: 7 additions & 7 deletions target/ppc/excp_helper.c
Expand Up @@ -455,7 +455,7 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int excp)

/*
* new interrupt handler msr preserves existing ME unless
* explicitly overriden.
* explicitly overridden.
*/
new_msr = env->msr & (((target_ulong)1 << MSR_ME));

Expand Down Expand Up @@ -578,7 +578,7 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp)

/*
* new interrupt handler msr preserves existing ME unless
* explicitly overriden
* explicitly overridden
*/
new_msr = env->msr & ((target_ulong)1 << MSR_ME);

Expand Down Expand Up @@ -739,7 +739,7 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp)

/*
* new interrupt handler msr preserves existing ME unless
* explicitly overriden
* explicitly overridden
*/
new_msr = env->msr & ((target_ulong)1 << MSR_ME);

Expand Down Expand Up @@ -911,7 +911,7 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int excp)

/*
* new interrupt handler msr preserves existing ME unless
* explicitly overriden
* explicitly overridden
*/
new_msr = env->msr & ((target_ulong)1 << MSR_ME);

Expand Down Expand Up @@ -1075,7 +1075,7 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int excp)

/*
* new interrupt handler msr preserves existing ME unless
* explicitly overriden
* explicitly overridden
*/
new_msr = env->msr & ((target_ulong)1 << MSR_ME);

Expand Down Expand Up @@ -1288,7 +1288,7 @@ static bool books_vhyp_handles_hcall(PowerPCCPU *cpu)
/*
* When running a nested KVM HV guest under vhyp, HV exceptions are not
* delivered to the guest (because there is no concept of HV support), but
* rather they are sent tothe vhyp to exit from the L2 back to the L1 and
* rather they are sent to the vhyp to exit from the L2 back to the L1 and
* return from the H_ENTER_NESTED hypercall.
*/
static bool books_vhyp_handles_hv_excp(PowerPCCPU *cpu)
Expand Down Expand Up @@ -1377,7 +1377,7 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int excp)

/*
* new interrupt handler msr preserves existing HV and ME unless
* explicitly overriden
* explicitly overridden
*/
new_msr = env->msr & (((target_ulong)1 << MSR_ME) | MSR_HVB);

Expand Down
4 changes: 2 additions & 2 deletions target/ppc/power8-pmu-regs.c.inc
Expand Up @@ -16,7 +16,7 @@
* Checks whether the Group A SPR (MMCR0, MMCR2, MMCRA, and the
* PMCs) has problem state read access.
*
* Read acccess is granted for all PMCC values but 0b01, where a
* Read access is granted for all PMCC values but 0b01, where a
* Facility Unavailable Interrupt will occur.
*/
static bool spr_groupA_read_allowed(DisasContext *ctx)
Expand All @@ -33,7 +33,7 @@ static bool spr_groupA_read_allowed(DisasContext *ctx)
* Checks whether the Group A SPR (MMCR0, MMCR2, MMCRA, and the
* PMCs) has problem state write access.
*
* Write acccess is granted for PMCC values 0b10 and 0b11. Userspace
* Write access is granted for PMCC values 0b10 and 0b11. Userspace
* writing with PMCC 0b00 will generate a Hypervisor Emulation
* Assistance Interrupt. Userspace writing with PMCC 0b01 will
* generate a Facility Unavailable Interrupt.
Expand Down
6 changes: 3 additions & 3 deletions target/ppc/translate/vmx-impl.c.inc
Expand Up @@ -119,15 +119,15 @@ static void gen_stve##name(DisasContext *ctx) \
}

GEN_VR_LDX(lvx, 0x07, 0x03);
/* As we don't emulate the cache, lvxl is stricly equivalent to lvx */
/* As we don't emulate the cache, lvxl is strictly equivalent to lvx */
GEN_VR_LDX(lvxl, 0x07, 0x0B);

GEN_VR_LVE(bx, 0x07, 0x00, 1);
GEN_VR_LVE(hx, 0x07, 0x01, 2);
GEN_VR_LVE(wx, 0x07, 0x02, 4);

GEN_VR_STX(svx, 0x07, 0x07);
/* As we don't emulate the cache, stvxl is stricly equivalent to stvx */
/* As we don't emulate the cache, stvxl is strictly equivalent to stvx */
GEN_VR_STX(svxl, 0x07, 0x0F);

GEN_VR_STVE(bx, 0x07, 0x04, 1);
Expand Down Expand Up @@ -1526,7 +1526,7 @@ static void gen_vprtyb_vec(unsigned vece, TCGv_vec t, TCGv_vec b)
{
int i;
TCGv_vec tmp = tcg_temp_new_vec_matching(b);
/* MO_32 is 2, so 2 iteractions for MO_32 and 3 for MO_64 */
/* MO_32 is 2, so 2 iterations for MO_32 and 3 for MO_64 */
for (i = 0; i < vece; i++) {
tcg_gen_shri_vec(vece, tmp, b, (4 << (vece - i)));
tcg_gen_xor_vec(vece, b, tmp, b);
Expand Down
2 changes: 1 addition & 1 deletion tests/avocado/avocado_qemu/__init__.py
Expand Up @@ -137,7 +137,7 @@ def _console_interaction(test, success_message, failure_message,
assert not keep_sending or send_string
if vm is None:
vm = test.vm
console = vm.console_socket.makefile(mode='rb', encoding='utf-8')
console = vm.console_file
console_logger = logging.getLogger('console')
while True:
if send_string:
Expand Down
7 changes: 7 additions & 0 deletions tests/avocado/boot_linux_console.py
Expand Up @@ -116,6 +116,7 @@ def test_x86_64_pc(self):
console_pattern = 'Kernel command line: %s' % kernel_command_line
self.wait_for_console_pattern(console_pattern)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips_malta(self):
"""
:avocado: tags=arch:mips
Expand All @@ -138,6 +139,7 @@ def test_mips_malta(self):
console_pattern = 'Kernel command line: %s' % kernel_command_line
self.wait_for_console_pattern(console_pattern)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips64el_malta(self):
"""
This test requires the ar tool to extract "data.tar.gz" from
Expand Down Expand Up @@ -191,6 +193,7 @@ def test_mips64el_fuloong2e(self):
console_pattern = 'Kernel command line: %s' % kernel_command_line
self.wait_for_console_pattern(console_pattern)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips_malta_cpio(self):
"""
:avocado: tags=arch:mips
Expand Down Expand Up @@ -232,6 +235,7 @@ def test_mips_malta_cpio(self):
# Wait for VM to shut down gracefully
self.vm.wait()

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
@skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
def test_mips64el_malta_5KEc_cpio(self):
"""
Expand Down Expand Up @@ -292,6 +296,7 @@ def do_test_mips_malta32el_nanomips(self, kernel_url, kernel_hash):
console_pattern = 'Kernel command line: %s' % kernel_command_line
self.wait_for_console_pattern(console_pattern)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips_malta32el_nanomips_4k(self):
"""
:avocado: tags=arch:mipsel
Expand All @@ -305,6 +310,7 @@ def test_mips_malta32el_nanomips_4k(self):
kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6'
self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips_malta32el_nanomips_16k_up(self):
"""
:avocado: tags=arch:mipsel
Expand All @@ -318,6 +324,7 @@ def test_mips_malta32el_nanomips_16k_up(self):
kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc'
self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips_malta32el_nanomips_64k_dbg(self):
"""
:avocado: tags=arch:mipsel
Expand Down
6 changes: 6 additions & 0 deletions tests/avocado/machine_mips_malta.py
Expand Up @@ -11,6 +11,7 @@
import gzip
import logging

from avocado import skip
from avocado import skipIf
from avocado import skipUnless
from avocado.utils import archive
Expand Down Expand Up @@ -93,6 +94,7 @@ def do_test_i6400_framebuffer_logo(self, cpu_cores_count):
cv2.imwrite(debug_png, screendump_bgr)
self.assertGreaterEqual(tuxlogo_count, cpu_cores_count)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips_malta_i6400_framebuffer_logo_1core(self):
"""
:avocado: tags=arch:mips64el
Expand All @@ -101,6 +103,7 @@ def test_mips_malta_i6400_framebuffer_logo_1core(self):
"""
self.do_test_i6400_framebuffer_logo(1)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
def test_mips_malta_i6400_framebuffer_logo_7cores(self):
"""
Expand All @@ -111,6 +114,7 @@ def test_mips_malta_i6400_framebuffer_logo_7cores(self):
"""
self.do_test_i6400_framebuffer_logo(7)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
def test_mips_malta_i6400_framebuffer_logo_8cores(self):
"""
Expand Down Expand Up @@ -142,6 +146,7 @@ def do_test_yamon(self):
wait_for_console_pattern(self, prompt)
self.vm.shutdown()

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mipsel_malta_yamon(self):
"""
:avocado: tags=arch:mipsel
Expand All @@ -150,6 +155,7 @@ def test_mipsel_malta_yamon(self):
"""
self.do_test_yamon()

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips64el_malta_yamon(self):
"""
:avocado: tags=arch:mips64el
Expand Down
7 changes: 7 additions & 0 deletions tests/avocado/replay_kernel.py
Expand Up @@ -98,6 +98,7 @@ def test_x86_64_pc(self):

self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips_malta(self):
"""
:avocado: tags=arch:mips
Expand All @@ -116,6 +117,7 @@ def test_mips_malta(self):

self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips64el_malta(self):
"""
This test requires the ar tool to extract "data.tar.gz" from
Expand Down Expand Up @@ -431,6 +433,7 @@ class ReplayKernelSlow(ReplayKernelBase):
# making it very slow.
timeout = 180

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips_malta_cpio(self):
"""
:avocado: tags=arch:mips
Expand Down Expand Up @@ -460,6 +463,7 @@ def test_mips_malta_cpio(self):
self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5,
args=('-initrd', initrd_path))

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
@skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
def test_mips64el_malta_5KEc_cpio(self):
"""
Expand Down Expand Up @@ -502,6 +506,7 @@ def do_test_mips_malta32el_nanomips(self, kernel_path_xz):
console_pattern = 'Kernel command line: %s' % kernel_command_line
self.run_rr(kernel_path, kernel_command_line, console_pattern, shift=5)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips_malta32el_nanomips_4k(self):
"""
:avocado: tags=arch:mipsel
Expand All @@ -516,6 +521,7 @@ def test_mips_malta32el_nanomips_4k(self):
kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
self.do_test_mips_malta32el_nanomips(kernel_path_xz)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips_malta32el_nanomips_16k_up(self):
"""
:avocado: tags=arch:mipsel
Expand All @@ -530,6 +536,7 @@ def test_mips_malta32el_nanomips_16k_up(self):
kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
self.do_test_mips_malta32el_nanomips(kernel_path_xz)

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips_malta32el_nanomips_64k_dbg(self):
"""
:avocado: tags=arch:mipsel
Expand Down
4 changes: 4 additions & 0 deletions tests/avocado/tuxrun_baselines.py
Expand Up @@ -352,6 +352,7 @@ def test_i386(self):

self.common_tuxrun(csums=sums, drive="virtio-blk-pci")

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips32(self):
"""
:avocado: tags=arch:mips
Expand All @@ -370,6 +371,7 @@ def test_mips32(self):

self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips32el(self):
"""
:avocado: tags=arch:mipsel
Expand All @@ -387,6 +389,7 @@ def test_mips32el(self):

self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips64(self):
"""
:avocado: tags=arch:mips64
Expand All @@ -404,6 +407,7 @@ def test_mips64(self):

self.common_tuxrun(csums=sums, drive="driver=ide-hd,bus=ide.0,unit=0")

@skip('https://gitlab.com/qemu-project/qemu/-/issues/1884')
def test_mips64el(self):
"""
:avocado: tags=arch:mips64el
Expand Down
9 changes: 3 additions & 6 deletions tests/docker/dockerfiles/debian-amd64-cross.docker
@@ -1,10 +1,10 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool dockerfile --layers all --cross-arch x86_64 debian-11 qemu
# $ lcitool dockerfile --layers all --cross-arch x86_64 debian-12 qemu
#
# https://gitlab.com/libvirt/libvirt-ci

FROM docker.io/library/debian:11-slim
FROM docker.io/library/debian:12-slim

RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
Expand Down Expand Up @@ -47,11 +47,9 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3-opencv \
python3-pillow \
python3-pip \
python3-setuptools \
python3-sphinx \
python3-sphinx-rtd-theme \
python3-venv \
python3-wheel \
python3-yaml \
rpm2cpio \
sed \
Expand All @@ -67,8 +65,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales

RUN /usr/bin/pip3 install tomli

ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
Expand Down Expand Up @@ -146,6 +142,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libvdeplug-dev:amd64 \
libvirglrenderer-dev:amd64 \
libvte-2.91-dev:amd64 \
libxdp-dev:amd64 \
libxen-dev:amd64 \
libzstd-dev:amd64 \
nettle-dev:amd64 \
Expand Down
9 changes: 3 additions & 6 deletions tests/docker/dockerfiles/debian-amd64.docker
@@ -1,10 +1,10 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool dockerfile --layers all debian-11 qemu
# $ lcitool dockerfile --layers all debian-12 qemu
#
# https://gitlab.com/libvirt/libvirt-ci

FROM docker.io/library/debian:11-slim
FROM docker.io/library/debian:12-slim

RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
Expand Down Expand Up @@ -97,6 +97,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libvdeplug-dev \
libvirglrenderer-dev \
libvte-2.91-dev \
libxdp-dev \
libxen-dev \
libzstd-dev \
llvm \
Expand All @@ -115,11 +116,9 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3-opencv \
python3-pillow \
python3-pip \
python3-setuptools \
python3-sphinx \
python3-sphinx-rtd-theme \
python3-venv \
python3-wheel \
python3-yaml \
rpm2cpio \
sed \
Expand All @@ -145,8 +144,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc

RUN /usr/bin/pip3 install tomli

ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
Expand Down
9 changes: 3 additions & 6 deletions tests/docker/dockerfiles/debian-arm64-cross.docker
@@ -1,10 +1,10 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool dockerfile --layers all --cross-arch aarch64 debian-11 qemu
# $ lcitool dockerfile --layers all --cross-arch aarch64 debian-12 qemu
#
# https://gitlab.com/libvirt/libvirt-ci

FROM docker.io/library/debian:11-slim
FROM docker.io/library/debian:12-slim

RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
Expand Down Expand Up @@ -47,11 +47,9 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3-opencv \
python3-pillow \
python3-pip \
python3-setuptools \
python3-sphinx \
python3-sphinx-rtd-theme \
python3-venv \
python3-wheel \
python3-yaml \
rpm2cpio \
sed \
Expand All @@ -67,8 +65,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales

RUN /usr/bin/pip3 install tomli

ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
Expand Down Expand Up @@ -145,6 +141,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libvdeplug-dev:arm64 \
libvirglrenderer-dev:arm64 \
libvte-2.91-dev:arm64 \
libxdp-dev:arm64 \
libxen-dev:arm64 \
libzstd-dev:arm64 \
nettle-dev:arm64 \
Expand Down
9 changes: 3 additions & 6 deletions tests/docker/dockerfiles/debian-armhf-cross.docker
@@ -1,10 +1,10 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool dockerfile --layers all --cross-arch armv7l debian-11 qemu
# $ lcitool dockerfile --layers all --cross-arch armv7l debian-12 qemu
#
# https://gitlab.com/libvirt/libvirt-ci

FROM docker.io/library/debian:11-slim
FROM docker.io/library/debian:12-slim

RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
Expand Down Expand Up @@ -47,11 +47,9 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3-opencv \
python3-pillow \
python3-pip \
python3-setuptools \
python3-sphinx \
python3-sphinx-rtd-theme \
python3-venv \
python3-wheel \
python3-yaml \
rpm2cpio \
sed \
Expand All @@ -67,8 +65,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales

RUN /usr/bin/pip3 install tomli

ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
Expand Down Expand Up @@ -145,6 +141,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libvdeplug-dev:armhf \
libvirglrenderer-dev:armhf \
libvte-2.91-dev:armhf \
libxdp-dev:armhf \
libxen-dev:armhf \
libzstd-dev:armhf \
nettle-dev:armhf \
Expand Down
2 changes: 1 addition & 1 deletion tests/docker/dockerfiles/debian-loongarch-cross.docker
Expand Up @@ -20,7 +20,7 @@ RUN apt-get update && \
git \
python3-minimal

RUN curl -#SL https://github.com/loongson/build-tools/releases/download/2022.05.29/loongarch64-clfs-5.0-cross-tools-gcc-glibc.tar.xz \
RUN curl -#SL https://github.com/loongson/build-tools/releases/download/2023.08.08/CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz \
| tar -xJC /opt

ENV PATH $PATH:/opt/cross-tools/bin
Expand Down
9 changes: 3 additions & 6 deletions tests/docker/dockerfiles/debian-ppc64el-cross.docker
@@ -1,10 +1,10 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool dockerfile --layers all --cross-arch ppc64le debian-11 qemu
# $ lcitool dockerfile --layers all --cross-arch ppc64le debian-12 qemu
#
# https://gitlab.com/libvirt/libvirt-ci

FROM docker.io/library/debian:11-slim
FROM docker.io/library/debian:12-slim

RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
Expand Down Expand Up @@ -47,11 +47,9 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3-opencv \
python3-pillow \
python3-pip \
python3-setuptools \
python3-sphinx \
python3-sphinx-rtd-theme \
python3-venv \
python3-wheel \
python3-yaml \
rpm2cpio \
sed \
Expand All @@ -67,8 +65,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales

RUN /usr/bin/pip3 install tomli

ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
Expand Down Expand Up @@ -145,6 +141,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libvdeplug-dev:ppc64el \
libvirglrenderer-dev:ppc64el \
libvte-2.91-dev:ppc64el \
libxdp-dev:ppc64el \
libzstd-dev:ppc64el \
nettle-dev:ppc64el \
systemtap-sdt-dev:ppc64el \
Expand Down
9 changes: 3 additions & 6 deletions tests/docker/dockerfiles/debian-s390x-cross.docker
@@ -1,10 +1,10 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool dockerfile --layers all --cross-arch s390x debian-11 qemu
# $ lcitool dockerfile --layers all --cross-arch s390x debian-12 qemu
#
# https://gitlab.com/libvirt/libvirt-ci

FROM docker.io/library/debian:11-slim
FROM docker.io/library/debian:12-slim

RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
Expand Down Expand Up @@ -47,11 +47,9 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3-opencv \
python3-pillow \
python3-pip \
python3-setuptools \
python3-sphinx \
python3-sphinx-rtd-theme \
python3-venv \
python3-wheel \
python3-yaml \
rpm2cpio \
sed \
Expand All @@ -67,8 +65,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales

RUN /usr/bin/pip3 install tomli

ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
Expand Down Expand Up @@ -144,6 +140,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libvdeplug-dev:s390x \
libvirglrenderer-dev:s390x \
libvte-2.91-dev:s390x \
libxdp-dev:s390x \
libzstd-dev:s390x \
nettle-dev:s390x \
systemtap-sdt-dev:s390x \
Expand Down
2 changes: 1 addition & 1 deletion tests/lcitool/libvirt-ci
Submodule libvirt-ci updated from 5f84a2 to e3ed1e
17 changes: 9 additions & 8 deletions tests/lcitool/refresh
Expand Up @@ -93,7 +93,7 @@ def generate_pkglist(vm, target):
# Netmap still needs to be manually built as it is yet to be packaged
# into a distro. We also add cscope and gtags which are used in the CI
# test
debian11_extras = [
debian12_extras = [
"# netmap/cscope/global\n",
"RUN DEBIAN_FRONTEND=noninteractive eatmydata \\\n",
" apt install -y --no-install-recommends \\\n",
Expand Down Expand Up @@ -123,8 +123,8 @@ try:
#
generate_dockerfile("alpine", "alpine-318")
generate_dockerfile("centos8", "centos-stream-8")
generate_dockerfile("debian-amd64", "debian-11",
trailer="".join(debian11_extras))
generate_dockerfile("debian-amd64", "debian-12",
trailer="".join(debian12_extras))
generate_dockerfile("fedora", "fedora-38")
generate_dockerfile("opensuse-leap", "opensuse-leap-15")
generate_dockerfile("ubuntu2004", "ubuntu-2004")
Expand All @@ -133,24 +133,25 @@ try:
#
# Cross compiling builds
#
generate_dockerfile("debian-amd64-cross", "debian-11",
generate_dockerfile("debian-amd64-cross", "debian-12",
cross="x86_64",
trailer=cross_build("x86_64-linux-gnu-",
"x86_64-softmmu,"
"x86_64-linux-user,"
"i386-softmmu,i386-linux-user"))

generate_dockerfile("debian-arm64-cross", "debian-11",
generate_dockerfile("debian-arm64-cross", "debian-12",
cross="aarch64",
trailer=cross_build("aarch64-linux-gnu-",
"aarch64-softmmu,aarch64-linux-user"))

# migration to bookworm stalled: https://lists.debian.org/debian-arm/2023/09/msg00006.html
generate_dockerfile("debian-armel-cross", "debian-11",
cross="armv6l",
trailer=cross_build("arm-linux-gnueabi-",
"arm-softmmu,arm-linux-user,armeb-linux-user"))

generate_dockerfile("debian-armhf-cross", "debian-11",
generate_dockerfile("debian-armhf-cross", "debian-12",
cross="armv7l",
trailer=cross_build("arm-linux-gnueabihf-",
"arm-softmmu,arm-linux-user"))
Expand All @@ -165,7 +166,7 @@ try:
trailer=cross_build("mipsel-linux-gnu-",
"mipsel-softmmu,mipsel-linux-user"))

generate_dockerfile("debian-ppc64el-cross", "debian-11",
generate_dockerfile("debian-ppc64el-cross", "debian-12",
cross="ppc64le",
trailer=cross_build("powerpc64le-linux-gnu-",
"ppc64-softmmu,ppc64-linux-user"))
Expand All @@ -176,7 +177,7 @@ try:
trailer=cross_build("riscv64-linux-gnu-",
"riscv64-softmmu,riscv64-linux-user"))

generate_dockerfile("debian-s390x-cross", "debian-11",
generate_dockerfile("debian-s390x-cross", "debian-12",
cross="s390x",
trailer=cross_build("s390x-linux-gnu-",
"s390x-softmmu,s390x-linux-user"))
Expand Down
6 changes: 3 additions & 3 deletions tests/qemu-iotests/051.pc.out
Expand Up @@ -169,11 +169,11 @@ QEMU_PROG: -device scsi-hd,drive=disk: Device needs media, but drive is empty

Testing: -drive file=TEST_DIR/t.qcow2,if=none,node-name=disk -object iothread,id=thread0 -device virtio-scsi,iothread=thread0,id=virtio-scsi0 -device scsi-hd,bus=virtio-scsi0.0,drive=disk,share-rw=on -device ide-hd,drive=disk,share-rw=on
QEMU X.Y.Z monitor - type 'help' for more information
QEMU_PROG: -device ide-hd,drive=disk,share-rw=on: Cannot change iothread of active block backend
(qemu) QEMU_PROG: -device ide-hd,drive=disk,share-rw=on: Cannot change iothread of active block backend

Testing: -drive file=TEST_DIR/t.qcow2,if=none,node-name=disk -object iothread,id=thread0 -device virtio-scsi,iothread=thread0,id=virtio-scsi0 -device scsi-hd,bus=virtio-scsi0.0,drive=disk,share-rw=on -device virtio-blk-pci,drive=disk,share-rw=on
QEMU X.Y.Z monitor - type 'help' for more information
QEMU_PROG: -device virtio-blk-pci,drive=disk,share-rw=on: Cannot change iothread of active block backend
(qemu) QEMU_PROG: -device virtio-blk-pci,drive=disk,share-rw=on: Cannot change iothread of active block backend

Testing: -drive file=TEST_DIR/t.qcow2,if=none,node-name=disk -object iothread,id=thread0 -device virtio-scsi,iothread=thread0,id=virtio-scsi0 -device scsi-hd,bus=virtio-scsi0.0,drive=disk,share-rw=on -device lsi53c895a,id=lsi0 -device scsi-hd,bus=lsi0.0,drive=disk,share-rw=on
QEMU X.Y.Z monitor - type 'help' for more information
Expand All @@ -185,7 +185,7 @@ QEMU X.Y.Z monitor - type 'help' for more information

Testing: -drive file=TEST_DIR/t.qcow2,if=none,node-name=disk -object iothread,id=thread0 -device virtio-scsi,iothread=thread0,id=virtio-scsi0 -device scsi-hd,bus=virtio-scsi0.0,drive=disk,share-rw=on -device virtio-blk-pci,drive=disk,iothread=thread0,share-rw=on
QEMU X.Y.Z monitor - type 'help' for more information
QEMU_PROG: -device virtio-blk-pci,drive=disk,iothread=thread0,share-rw=on: Cannot change iothread of active block backend
(qemu) QEMU_PROG: -device virtio-blk-pci,drive=disk,iothread=thread0,share-rw=on: Cannot change iothread of active block backend

Testing: -drive file=TEST_DIR/t.qcow2,if=none,node-name=disk -object iothread,id=thread0 -device virtio-scsi,iothread=thread0,id=virtio-scsi0 -device scsi-hd,bus=virtio-scsi0.0,drive=disk,share-rw=on -device virtio-scsi,id=virtio-scsi1,iothread=thread0 -device scsi-hd,bus=virtio-scsi1.0,drive=disk,share-rw=on
QEMU X.Y.Z monitor - type 'help' for more information
Expand Down
84 changes: 42 additions & 42 deletions tests/qemu-iotests/122.out
Expand Up @@ -67,12 +67,12 @@ read 65536/65536 bytes at offset 4194304
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 65536/65536 bytes at offset 8388608
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
[{ "start": 0, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 65536, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false},
{ "start": 4194304, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 4259840, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false},
{ "start": 8388608, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 8454144, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false}]
[{ "start": 0, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 65536, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
{ "start": 4194304, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 4259840, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
{ "start": 8388608, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 8454144, "length": 4128768, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
read 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 65536/65536 bytes at offset 4194304
Expand All @@ -94,12 +94,12 @@ wrote 1024/1024 bytes at offset 1046528
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1024/1024 bytes at offset 0
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
[{ "start": 0, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 65536, "length": 65536, "depth": 0, "present": false, "zero": true, "data": false},
{ "start": 131072, "length": 196608, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 327680, "length": 655360, "depth": 0, "present": false, "zero": true, "data": false},
{ "start": 983040, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 1048576, "length": 1046528, "depth": 0, "present": false, "zero": true, "data": false}]
[{ "start": 0, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 65536, "length": 65536, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
{ "start": 131072, "length": 196608, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 327680, "length": 655360, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
{ "start": 983040, "length": 65536, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 1048576, "length": 1046528, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]
read 16384/16384 bytes at offset 0
16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 16384/16384 bytes at offset 16384
Expand Down Expand Up @@ -130,14 +130,14 @@ read 3145728/3145728 bytes at offset 0
3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 63963136/63963136 bytes at offset 3145728
61 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET}]
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET}]

convert -c -S 0:
read 3145728/3145728 bytes at offset 0
3 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 63963136/63963136 bytes at offset 3145728
61 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true}]
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true}]
Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864
wrote 33554432/33554432 bytes at offset 0
32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Expand All @@ -152,7 +152,7 @@ read 30408704/30408704 bytes at offset 3145728
29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 33554432/33554432 bytes at offset 33554432
32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET}]
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET}]

convert -c -S 0 with source backing file:
read 3145728/3145728 bytes at offset 0
Expand All @@ -161,7 +161,7 @@ read 30408704/30408704 bytes at offset 3145728
29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 33554432/33554432 bytes at offset 33554432
32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true}]
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true}]

convert -S 0 -B ...
read 3145728/3145728 bytes at offset 0
Expand All @@ -170,7 +170,7 @@ read 30408704/30408704 bytes at offset 3145728
29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 33554432/33554432 bytes at offset 33554432
32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET}]
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET}]

convert -c -S 0 -B ...
read 3145728/3145728 bytes at offset 0
Expand All @@ -179,7 +179,7 @@ read 30408704/30408704 bytes at offset 3145728
29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 33554432/33554432 bytes at offset 33554432
32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true}]
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true}]

=== Non-zero -S ===

Expand All @@ -196,32 +196,32 @@ wrote 1024/1024 bytes at offset 66560
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)

convert -S 4k
[{ "start": 0, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET},
{ "start": 4096, "length": 4096, "depth": 0, "present": false, "zero": true, "data": false},
{ "start": 8192, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET},
{ "start": 12288, "length": 4096, "depth": 0, "present": false, "zero": true, "data": false},
{ "start": 16384, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET},
{ "start": 20480, "length": 67088384, "depth": 0, "present": false, "zero": true, "data": false}]
[{ "start": 0, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET},
{ "start": 4096, "length": 4096, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
{ "start": 8192, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET},
{ "start": 12288, "length": 4096, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
{ "start": 16384, "length": 4096, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET},
{ "start": 20480, "length": 67088384, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]

convert -c -S 4k
[{ "start": 0, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 1024, "length": 7168, "depth": 0, "present": false, "zero": true, "data": false},
{ "start": 8192, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 9216, "length": 8192, "depth": 0, "present": false, "zero": true, "data": false},
{ "start": 17408, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 18432, "length": 67090432, "depth": 0, "present": false, "zero": true, "data": false}]
[{ "start": 0, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 1024, "length": 7168, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
{ "start": 8192, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 9216, "length": 8192, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
{ "start": 17408, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 18432, "length": 67090432, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]

convert -S 8k
[{ "start": 0, "length": 24576, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET},
{ "start": 24576, "length": 67084288, "depth": 0, "present": false, "zero": true, "data": false}]
[{ "start": 0, "length": 24576, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": OFFSET},
{ "start": 24576, "length": 67084288, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]

convert -c -S 8k
[{ "start": 0, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 1024, "length": 7168, "depth": 0, "present": false, "zero": true, "data": false},
{ "start": 8192, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 9216, "length": 8192, "depth": 0, "present": false, "zero": true, "data": false},
{ "start": 17408, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true},
{ "start": 18432, "length": 67090432, "depth": 0, "present": false, "zero": true, "data": false}]
[{ "start": 0, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 1024, "length": 7168, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
{ "start": 8192, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 9216, "length": 8192, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false},
{ "start": 17408, "length": 1024, "depth": 0, "present": true, "zero": false, "data": true, "compressed": true},
{ "start": 18432, "length": 67090432, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]

=== -n to a non-zero image ===

Expand All @@ -235,18 +235,18 @@ Images are identical.

Formatting 'TEST_DIR/t.IMGFMT.orig', fmt=IMGFMT size=67108864
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": true, "data": false}]
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false}]
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
[{ "start": 0, "length": 67108864, "depth": 0, "present": false, "zero": true, "data": false}]
[{ "start": 0, "length": 67108864, "depth": 0, "present": false, "zero": true, "data": false, "compressed": false}]

=== -n to an empty image with a backing file ===

Formatting 'TEST_DIR/t.IMGFMT.orig', fmt=IMGFMT size=67108864
Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": true, "data": false}]
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": true, "data": false, "compressed": false}]
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "offset": 327680}]
[{ "start": 0, "length": 67108864, "depth": 0, "present": true, "zero": false, "data": true, "compressed": false, "offset": 327680}]

=== -n -B to an image without a backing file ===

Expand Down
52 changes: 52 additions & 0 deletions tests/qemu-iotests/131
Expand Up @@ -74,6 +74,58 @@ poke_file "$TEST_IMG" "$inuse_offset" "\x59\x6e\x6f\x74"
echo "== read corrupted image with repairing =="
{ $QEMU_IO -c "read -P 0x11 $CLUSTER_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir

echo "== check discard =="

# Clear image
_make_test_img $size

{ $QEMU_IO -c "write -P 0x11 0 $CLUSTER_DBL_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IMG map "$TEST_IMG"; } 2>&1 | _filter_qemu_img_map
{ $QEMU_IO -c "discard 0 $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IMG map "$TEST_IMG"; } 2>&1 | _filter_qemu_img_map
{ $QEMU_IO -c "read -P 0 0 $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir

echo "== check simple allocation over the discarded hole =="

{ $QEMU_IO -c "write -P 0x11 $CLUSTER_DBL_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IMG map "$TEST_IMG"; } 2>&1 | _filter_qemu_img_map
{ $QEMU_IO -c "read -P 0x11 $CLUSTER_DBL_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir

echo "== check more complex allocation over the discard hole =="

# Clear image
_make_test_img $size

{ $QEMU_IO -c "write -P 0x11 $CLUSTER_DBL_SIZE $CLUSTER_DBL_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IO -c "discard $CLUSTER_DBL_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
# There is 1 cluster hole. Fill it fully and allocate 1 cluster at the end
{ $QEMU_IO -c "write -P 0x12 $CLUSTER_HALF_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IMG map "$TEST_IMG"; } 2>&1 | _filter_qemu_img_map
{ $QEMU_IO -c "read -P 0x12 $CLUSTER_HALF_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IO -c "read -P 0 0 $CLUSTER_HALF_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IO -c "read -P 0 $((CLUSTER_SIZE + CLUSTER_HALF_SIZE)) $CLUSTER_HALF_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir

echo "== check write-zeroes =="

# Clear image
_make_test_img $size

{ $QEMU_IO -c "write -P 0x11 0 $CLUSTER_DBL_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IO -c "write -z 0 $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IMG map "$TEST_IMG"; } 2>&1 | _filter_qemu_img_map
{ $QEMU_IO -c "read -P 0 0 $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IO -c "read -P 0x11 $CLUSTER_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir

echo "== check cluster-partial write-zeroes =="

# Clear image
_make_test_img $size

{ $QEMU_IO -c "write -P 0x11 0 $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IO -c "write -z 0 $CLUSTER_HALF_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IO -c "read -P 0 0 $CLUSTER_HALF_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir
{ $QEMU_IO -c "read -P 0x11 $CLUSTER_HALF_SIZE $CLUSTER_HALF_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir

echo "== allocate with backing =="
# Verify that allocating clusters works fine even when there is a backing image.
# Regression test for a bug where we would pass a buffer read from the backing
Expand Down
60 changes: 60 additions & 0 deletions tests/qemu-iotests/131.out
Expand Up @@ -26,6 +26,66 @@ read 524288/524288 bytes at offset 0
Repairing image was not closed correctly
read 1048576/1048576 bytes at offset 1048576
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== check discard ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
wrote 2097152/2097152 bytes at offset 0
2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Offset Length File
0 0x200000 TEST_DIR/t.IMGFMT
discard 1048576/1048576 bytes at offset 0
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Offset Length File
0x100000 0x100000 TEST_DIR/t.IMGFMT
read 1048576/1048576 bytes at offset 0
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== check simple allocation over the discarded hole ==
wrote 1048576/1048576 bytes at offset 2097152
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Offset Length File
0x100000 0x100000 TEST_DIR/t.IMGFMT
0x200000 0x100000 TEST_DIR/t.IMGFMT
read 1048576/1048576 bytes at offset 2097152
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== check more complex allocation over the discard hole ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
wrote 2097152/2097152 bytes at offset 2097152
2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
discard 1048576/1048576 bytes at offset 2097152
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset 524288
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Offset Length File
0 0x100000 TEST_DIR/t.IMGFMT
0x100000 0x100000 TEST_DIR/t.IMGFMT
0x300000 0x100000 TEST_DIR/t.IMGFMT
read 1048576/1048576 bytes at offset 524288
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 524288/524288 bytes at offset 0
512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 524288/524288 bytes at offset 1572864
512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== check write-zeroes ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
wrote 2097152/2097152 bytes at offset 0
2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 1048576/1048576 bytes at offset 0
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Offset Length File
0x100000 0x100000 TEST_DIR/t.IMGFMT
read 1048576/1048576 bytes at offset 0
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 1048576/1048576 bytes at offset 1048576
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== check cluster-partial write-zeroes ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
wrote 1048576/1048576 bytes at offset 0
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 524288/524288 bytes at offset 0
512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 524288/524288 bytes at offset 0
512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 524288/524288 bytes at offset 524288
512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== allocate with backing ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864
Expand Down