diff --git a/MAINTAINERS b/MAINTAINERS index 9cb181e1da..38325e0617 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -547,7 +547,8 @@ F: include/system/hvf.h F: include/system/hvf_int.h WHPX CPUs -M: Sunil Muthuswamy +M: Pedro Barbuda +M: Mohamed Mediouni S: Supported F: target/i386/whpx/ F: accel/stubs/whpx-stub.c diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index 745441bd79..bf711c49c0 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -15,6 +15,7 @@ #include "qemu/osdep.h" #include "hw/hw.h" +#include "qemu/log.h" #include "qemu/audio.h" #include "lm4549.h" #include "migration/vmstate.h" @@ -179,9 +180,23 @@ void lm4549_write(lm4549_state *s, break; case LM4549_PCM_Front_DAC_Rate: - regfile[LM4549_PCM_Front_DAC_Rate] = value; DPRINTF("DAC rate change = %i\n", value); + /* + * Valid sample rates are 4kHz to 48kHz. + * The datasheet doesn't say what happens if you try to + * set the frequency to zero. AUD_open_out() will print + * a bug message if we pass it a zero frequency, so just + * ignore attempts to set the DAC frequency to zero. + */ + if (value < 4000 || value > 48000) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: DAC sample rate %d Hz is invalid, ignoring it\n", + __func__, value); + break; + } + regfile[LM4549_PCM_Front_DAC_Rate] = value; + /* Re-open a voice with the new sample rate */ struct audsettings as; as.freq = value; diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 68c7cc9891..6cfdd98168 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -7,9 +7,9 @@ * COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include -#include "qemu/osdep.h" #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "hw/cxl/cxl.h" diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index 96cbb1b3a7..a248b943a5 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -435,7 +435,18 @@ static void xlnx_dp_aux_clear_rx_fifo(XlnxDPState *s) static void xlnx_dp_aux_push_rx_fifo(XlnxDPState *s, uint8_t *buf, size_t len) { + size_t avail = fifo8_num_free(&s->rx_fifo); DPRINTF("Push %u data in rx_fifo\n", (unsigned)len); + if (len > avail) { + /* + * Data sheet doesn't specify behaviour here: we choose to ignore + * the excess data. + */ + qemu_log_mask(LOG_GUEST_ERROR, + "%s: ignoring %zu bytes pushed to full RX_FIFO\n", + __func__, len - avail); + len = avail; + } fifo8_push_all(&s->rx_fifo, buf, len); } @@ -466,7 +477,18 @@ static void xlnx_dp_aux_clear_tx_fifo(XlnxDPState *s) static void xlnx_dp_aux_push_tx_fifo(XlnxDPState *s, uint8_t *buf, size_t len) { + size_t avail = fifo8_num_free(&s->tx_fifo); DPRINTF("Push %u data in tx_fifo\n", (unsigned)len); + if (len > avail) { + /* + * Data sheet doesn't specify behaviour here: we choose to ignore + * the excess data. + */ + qemu_log_mask(LOG_GUEST_ERROR, + "%s: ignoring %zu bytes pushed to full TX_FIFO\n", + __func__, len - avail); + len = avail; + } fifo8_push_all(&s->tx_fifo, buf, len); } @@ -475,8 +497,10 @@ static uint8_t xlnx_dp_aux_pop_tx_fifo(XlnxDPState *s) uint8_t ret; if (fifo8_is_empty(&s->tx_fifo)) { - error_report("%s: TX_FIFO underflow", __func__); - abort(); + /* Data sheet doesn't specify behaviour here: we choose to return 0 */ + qemu_log_mask(LOG_GUEST_ERROR, "%s: attempt to read empty TX_FIFO\n", + __func__); + return 0; } ret = fifo8_pop(&s->tx_fifo); DPRINTF("pop 0x%2.2X from tx_fifo.\n", ret); @@ -641,14 +665,28 @@ static void xlnx_dp_change_graphic_fmt(XlnxDPState *s) case DP_GRAPHIC_BGR888: s->g_plane.format = PIXMAN_b8g8r8; break; + case DP_GRAPHIC_RGBA5551: + case DP_GRAPHIC_RGBA4444: + case DP_GRAPHIC_8BPP: + case DP_GRAPHIC_4BPP: + case DP_GRAPHIC_2BPP: + case DP_GRAPHIC_1BPP: + qemu_log_mask(LOG_UNIMP, "%s: unimplemented graphic format %u", + __func__, + s->avbufm_registers[AV_BUF_FORMAT] & DP_GRAPHIC_MASK); + s->g_plane.format = PIXMAN_r8g8b8a8; + break; default: - error_report("%s: unsupported graphic format %u", __func__, - s->avbufm_registers[AV_BUF_FORMAT] & DP_GRAPHIC_MASK); - abort(); + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid graphic format %u", + __func__, + s->avbufm_registers[AV_BUF_FORMAT] & DP_GRAPHIC_MASK); + s->g_plane.format = PIXMAN_r8g8b8a8; + break; } switch (s->avbufm_registers[AV_BUF_FORMAT] & DP_NL_VID_FMT_MASK) { case 0: + /* This is DP_NL_VID_CB_Y0_CR_Y1 ??? */ s->v_plane.format = PIXMAN_x8b8g8r8; break; case DP_NL_VID_Y0_CB_Y1_CR: @@ -657,10 +695,39 @@ static void xlnx_dp_change_graphic_fmt(XlnxDPState *s) case DP_NL_VID_RGBA8880: s->v_plane.format = PIXMAN_x8b8g8r8; break; + case DP_NL_VID_CR_Y0_CB_Y1: + case DP_NL_VID_Y0_CR_Y1_CB: + case DP_NL_VID_YV16: + case DP_NL_VID_YV24: + case DP_NL_VID_YV16CL: + case DP_NL_VID_MONO: + case DP_NL_VID_YV16CL2: + case DP_NL_VID_YUV444: + case DP_NL_VID_RGB888: + case DP_NL_VID_RGB888_10BPC: + case DP_NL_VID_YUV444_10BPC: + case DP_NL_VID_YV16CL2_10BPC: + case DP_NL_VID_YV16CL_10BPC: + case DP_NL_VID_YV16_10BPC: + case DP_NL_VID_YV24_10BPC: + case DP_NL_VID_Y_ONLY_10BPC: + case DP_NL_VID_YV16_420: + case DP_NL_VID_YV16CL_420: + case DP_NL_VID_YV16CL2_420: + case DP_NL_VID_YV16_420_10BPC: + case DP_NL_VID_YV16CL_420_10BPC: + case DP_NL_VID_YV16CL2_420_10BPC: + qemu_log_mask(LOG_UNIMP, "%s: unimplemented video format %u", + __func__, + s->avbufm_registers[AV_BUF_FORMAT] & DP_NL_VID_FMT_MASK); + s->v_plane.format = PIXMAN_x8b8g8r8; + break; default: - error_report("%s: unsupported video format %u", __func__, - s->avbufm_registers[AV_BUF_FORMAT] & DP_NL_VID_FMT_MASK); - abort(); + qemu_log_mask(LOG_UNIMP, "%s: invalid video format %u", + __func__, + s->avbufm_registers[AV_BUF_FORMAT] & DP_NL_VID_FMT_MASK); + s->v_plane.format = PIXMAN_x8b8g8r8; + break; } xlnx_dp_recreate_surface(s); diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index be609ff9d0..4f3688a71b 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -8,9 +8,9 @@ * * SPDX-License-Identifier: GPL-v2-only */ +#include "qemu/osdep.h" #include -#include "qemu/osdep.h" #include "qemu/units.h" #include "qemu/error-report.h" #include "qapi/qapi-commands-cxl.h" diff --git a/hw/misc/npcm_clk.c b/hw/misc/npcm_clk.c index c48d40b446..e202a8a299 100644 --- a/hw/misc/npcm_clk.c +++ b/hw/misc/npcm_clk.c @@ -212,13 +212,14 @@ static void npcm7xx_clk_update_pll(void *opaque) { NPCM7xxClockPLLState *s = opaque; uint32_t con = s->clk->regs[s->reg]; - uint64_t freq; + uint64_t freq, freq_div; /* The PLL is grounded if it is not locked yet. */ if (con & PLLCON_LOKI) { freq = clock_get_hz(s->clock_in); freq *= PLLCON_FBDV(con); - freq /= PLLCON_INDV(con) * PLLCON_OTDV1(con) * PLLCON_OTDV2(con); + freq_div = PLLCON_INDV(con) * PLLCON_OTDV1(con) * PLLCON_OTDV2(con); + freq = freq_div ? freq / freq_div : 0; } else { freq = 0; } diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c index e45192fef6..dab7a23224 100644 --- a/hw/vfio-user/container.c +++ b/hw/vfio-user/container.c @@ -6,9 +6,9 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "qemu/osdep.h" #include #include -#include "qemu/osdep.h" #include "hw/vfio-user/container.h" #include "hw/vfio-user/device.h" diff --git a/hw/vfio-user/container.h b/hw/vfio-user/container.h index a2b42e3169..c952e09063 100644 --- a/hw/vfio-user/container.h +++ b/hw/vfio-user/container.h @@ -7,7 +7,6 @@ #ifndef HW_VFIO_USER_CONTAINER_H #define HW_VFIO_USER_CONTAINER_H -#include "qemu/osdep.h" #include "hw/vfio/vfio-container.h" #include "hw/vfio-user/proxy.h" diff --git a/hw/vfio-user/device.h b/hw/vfio-user/device.h index d183a3950e..49c05848f1 100644 --- a/hw/vfio-user/device.h +++ b/hw/vfio-user/device.h @@ -9,7 +9,6 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ -#include "qemu/osdep.h" #include "linux/vfio.h" #include "hw/vfio-user/proxy.h" diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c index b53ed3b456..353d07e781 100644 --- a/hw/vfio-user/pci.c +++ b/hw/vfio-user/pci.c @@ -6,8 +6,8 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ -#include #include "qemu/osdep.h" +#include #include "qapi-visit-sockets.h" #include "qemu/error-report.h" diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index 7719f24579..3368ac8915 100644 --- a/hw/vfio/ap.c +++ b/hw/vfio/ap.c @@ -10,7 +10,6 @@ * directory. */ -#include #include "qemu/osdep.h" #include CONFIG_DEVICES /* CONFIG_IOMMUFD */ #include diff --git a/hw/vfio/container.c b/hw/vfio/container.c index 9ddec300e3..013a691bc5 100644 --- a/hw/vfio/container.c +++ b/hw/vfio/container.c @@ -10,10 +10,10 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "qemu/osdep.h" #include #include -#include "qemu/osdep.h" #include "system/tcg.h" #include "system/ram_addr.h" #include "qapi/error.h" diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c index 86c943158e..7c03ddb961 100644 --- a/hw/vfio/cpr-legacy.c +++ b/hw/vfio/cpr-legacy.c @@ -4,9 +4,9 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "qemu/osdep.h" #include #include -#include "qemu/osdep.h" #include "hw/vfio/vfio-container-legacy.h" #include "hw/vfio/vfio-device.h" #include "hw/vfio/vfio-listener.h" diff --git a/hw/vfio/pci-quirks.h b/hw/vfio/pci-quirks.h index d1532e379b..a6282e063a 100644 --- a/hw/vfio/pci-quirks.h +++ b/hw/vfio/pci-quirks.h @@ -12,7 +12,6 @@ #ifndef HW_VFIO_VFIO_PCI_QUIRKS_H #define HW_VFIO_VFIO_PCI_QUIRKS_H -#include "qemu/osdep.h" #include "exec/memop.h" /* diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index f81cfd0113..ae84d8e420 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -34,7 +34,6 @@ #include "hw/qdev-properties.h" #include "internals.h" #include "cpu-features.h" -#include "cpregs.h" /* convert between _IDX and SYS_ */ #define DEF(NAME, OP0, OP1, CRN, CRM, OP2) \ diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index 5f64fed220..63735d9789 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -303,20 +303,23 @@ TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs) marked as dead. */ void store_reg(DisasContext *s, int reg, TCGv_i32 var) { + uint32_t mask = 0; + if (reg == 15) { - /* In Thumb mode, we must ignore bit 0. + /* + * In Thumb mode, we must ignore bit 0. * In ARM mode, for ARMv4 and ARMv5, it is UNPREDICTABLE if bits [1:0] * are not 0b00, but for ARMv6 and above, we must ignore bits [1:0]. * We choose to ignore [1:0] in ARM mode for all architecture versions. */ - tcg_gen_andi_i32(var, var, s->thumb ? ~1 : ~3); + mask = s->thumb ? 1 : 3; s->base.is_jmp = DISAS_JUMP; s->pc_save = -1; } else if (reg == 13 && arm_dc_feature(s, ARM_FEATURE_M)) { /* For M-profile SP bits [1:0] are always zero */ - tcg_gen_andi_i32(var, var, ~3); + mask = 3; } - tcg_gen_mov_i32(cpu_R[reg], var); + tcg_gen_andi_i32(cpu_R[reg], var, ~mask); } /* diff --git a/tests/qtest/aspeed-hace-utils.h b/tests/qtest/aspeed-hace-utils.h index c8b2ec45af..27ab2bb975 100644 --- a/tests/qtest/aspeed-hace-utils.h +++ b/tests/qtest/aspeed-hace-utils.h @@ -8,7 +8,6 @@ #ifndef TESTS_ASPEED_HACE_UTILS_H #define TESTS_ASPEED_HACE_UTILS_H -#include "qemu/osdep.h" #include "libqtest.h" #include "qemu/bitops.h" diff --git a/tests/qtest/aspeed-smc-utils.h b/tests/qtest/aspeed-smc-utils.h index b07870f3b8..e2fd8ff1bd 100644 --- a/tests/qtest/aspeed-smc-utils.h +++ b/tests/qtest/aspeed-smc-utils.h @@ -26,7 +26,6 @@ #ifndef TESTS_ASPEED_SMC_UTILS_H #define TESTS_ASPEED_SMC_UTILS_H -#include "qemu/osdep.h" #include "qemu/bswap.h" #include "libqtest-single.h" #include "qemu/bitops.h" diff --git a/tests/qtest/aspeed_gpio-test.c b/tests/qtest/aspeed_gpio-test.c index c2f9ca2298..decbba23c8 100644 --- a/tests/qtest/aspeed_gpio-test.c +++ b/tests/qtest/aspeed_gpio-test.c @@ -27,7 +27,6 @@ #include "qemu/timer.h" #include "qobject/qdict.h" #include "libqtest-single.h" -#include "qemu/typedefs.h" #define AST2600_GPIO_BASE 0x1E780000 diff --git a/tests/qtest/dbus-display-test.c b/tests/qtest/dbus-display-test.c index f7fc873bfb..1d5951b711 100644 --- a/tests/qtest/dbus-display-test.c +++ b/tests/qtest/dbus-display-test.c @@ -7,9 +7,6 @@ #include #include #include "libqtest.h" -#ifndef WIN32 -#include -#endif #include "ui/dbus-display1.h" static GDBusConnection* diff --git a/tests/qtest/pnv-spi-seeprom-test.c b/tests/qtest/pnv-spi-seeprom-test.c index 600493c425..8033261758 100644 --- a/tests/qtest/pnv-spi-seeprom-test.c +++ b/tests/qtest/pnv-spi-seeprom-test.c @@ -5,7 +5,6 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ -#include #include "qemu/osdep.h" #include "libqtest.h" #include "qemu/bswap.h" diff --git a/tests/unit/test-cutils.c b/tests/unit/test-cutils.c index 227acc5995..75fae29003 100644 --- a/tests/unit/test-cutils.c +++ b/tests/unit/test-cutils.c @@ -25,9 +25,9 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include -#include "qemu/osdep.h" #include "qemu/cutils.h" #include "qemu/units.h" diff --git a/tests/unit/test-error-report.c b/tests/unit/test-error-report.c index 0cbde3c4cf..a8532fc58f 100644 --- a/tests/unit/test-error-report.c +++ b/tests/unit/test-error-report.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include "glib-compat.h" #include #include "qemu/error-report.h" diff --git a/tests/unit/test-io-channel-command.c b/tests/unit/test-io-channel-command.c index 4f022617df..964418b5cd 100644 --- a/tests/unit/test-io-channel-command.c +++ b/tests/unit/test-io-channel-command.c @@ -20,8 +20,6 @@ #include "qemu/osdep.h" #include -#include -#include #include "io/channel-command.h" #include "io-channel-helpers.h" #include "qapi/error.h"