aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2023-09-05 09:21:42 -0400
committerStefan Hajnoczi <stefanha@redhat.com>2023-09-05 09:21:42 -0400
commita9c17e9a21af9c4bf9c08dedf0f0df4a6566cf52 (patch)
tree792d01a8ce85035d9cdcc587a82b03c939c59bb0 /hw
parent17780edd81d27fcfdb7a802efc870a99788bd2fc (diff)
parent2fc36530dec61eb83c73f5684a0e8f55a0b9a4d1 (diff)
downloadqemu-a9c17e9a21af9c4bf9c08dedf0f0df4a6566cf52.zip
qemu-a9c17e9a21af9c4bf9c08dedf0f0df4a6566cf52.tar.gz
qemu-a9c17e9a21af9c4bf9c08dedf0f0df4a6566cf52.tar.bz2
Merge tag 'misc-20230831' of https://github.com/philmd/qemu into staging
Misc patches queue Build fixes: - Only define OS_OBJECT_USE_OBJC with gcc Overall cleanups: - Do not declare function prototypes using 'extern' keyword - Remove unmaintained HAX accelerator - Have FEWatchFunc handlers return G_SOURCE_CONTINUE/REMOVE instead of boolean - Avoid modifying QOM class internals from instance in pmbus_device - Avoid variable-length array in xhci_get_port_bandwidth - Remove unuseful kvmclock_create() stub - Style: permit inline loop variables - Various header cleanups - Various spelling fixes # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmTw0oUACgkQ4+MsLN6t # wN7nZQ/+Jyrw1TnHiKV8nS5NKtQIszMTcAbrcuV8YCk0XgwprmrLzxOsOcVOU+MN # C9SHOhGGcu8NKho73CDrsKqye/IKm8rumMm0hcZrtqGS+3MX9RQzDBUgRgihgD9b # 78Pmiz/91mrsV4zjXBkWLILipjDUwAL0oXh+MLfkmkTdzJMVfllF5KfF+hdOipwq # +ECOzwEAFUtCWQk51aLGfrg9SarKC2jtRBEvd1RhwfvXAMCdGP9+pfXJQqkT7ZTK # Hf4TuOHkzZjHumHGGcJn+P1WHM6W3ILdocG7AAl+/0Jwkx4vhR+6MENJGLxqg4pa # VTnOpJiL/HsY8319mTswTmlxqmotEDakGjdaRm4ClWPxPksF7zQkdTspBx0/Qayu # SPr7U5gFLPXMhCpMnrznvjCS+C/dqLYrJAczs9Ecv6KawOIwMiPRzc0SyimCV4DI # kcpL88Vn4unoBCF7AdiDluPoY2Q41TZ6gRa7B1/nI/4j9Y+Gs/gWQxYHjMlDso+O # sNgMJ+sqIPW9n1vhl9s6AQweBYnMRW34A5iok9MV0HyFTxNKMoCoR8Ssfk9YzT+L # mK5a9AfgT8FrhtQXQz6ojIPFM8Q4zGcAQOMudpPiDICDAJaPuUpzL3XVwStT6Rfc # YL0+Nb+Ja5hPh0fAhgX3BH0EsqruW+DA8rEZfIgAIXDbOC5QFIo= # =SVsZ # -----END PGP SIGNATURE----- # gpg: Signature made Thu 31 Aug 2023 13:48:53 EDT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * tag 'misc-20230831' of https://github.com/philmd/qemu: (39 commits) build: Only define OS_OBJECT_USE_OBJC with gcc tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc ui: spelling fixes util: spelling fixes util/fifo8: Fix typo in fifo8_push_all() description hw/i386: Rename 'hw/kvm/clock.h' -> 'hw/i386/kvm/clock.h' hw/i386: Remove unuseful kvmclock_create() stub hw/usb/hcd-xhci: Avoid variable-length array in xhci_get_port_bandwidth() hw/usb: spelling fixes hw/sd: spelling fixes hw/mips: spelling fixes hw/display: spelling fixes hw/ide: spelling fixes hw/i2c: spelling fixes hw/i2c/pmbus_device: Fix modifying QOM class internals from instance hw/char/pl011: Replace magic values by register field definitions hw/char/pl011: Remove duplicated PL011_INT_[RT]X definitions hw/char/pl011: Display register name in trace events hw/char/pl011: Restrict MemoryRegionOps implementation access sizes hw/char: Have FEWatchFunc handlers return G_SOURCE_CONTINUE/REMOVE ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/char/cadence_uart.c8
-rw-r--r--hw/char/cmsdk-apb-uart.c6
-rw-r--r--hw/char/ibex_uart.c8
-rw-r--r--hw/char/nrf51_uart.c4
-rw-r--r--hw/char/pl011.c58
-rw-r--r--hw/char/serial.c2
-rw-r--r--hw/char/trace-events4
-rw-r--r--hw/char/virtio-console.c2
-rw-r--r--hw/display/bochs-display.c2
-rw-r--r--hw/display/qxl.c2
-rw-r--r--hw/display/ssd0303.c2
-rw-r--r--hw/display/ssd0323.c2
-rw-r--r--hw/display/xlnx_dp.c2
-rw-r--r--hw/dma/etraxfs_dma.c1
-rw-r--r--hw/i2c/pm_smbus.c2
-rw-r--r--hw/i2c/pmbus_device.c19
-rw-r--r--hw/i2c/smbus_slave.c2
-rw-r--r--hw/i386/kvm/clock.c6
-rw-r--r--hw/i386/kvm/clock.h18
-rw-r--r--hw/i386/microvm.c6
-rw-r--r--hw/i386/pc_piix.c4
-rw-r--r--hw/i386/pc_q35.c6
-rw-r--r--hw/ide/ahci_internal.h4
-rw-r--r--hw/ide/cmd646.c2
-rw-r--r--hw/ide/core.c2
-rw-r--r--hw/intc/apic_common.c3
-rw-r--r--hw/mips/malta.c2
-rw-r--r--hw/net/i82596.c1
-rw-r--r--hw/sd/sd.c2
-rw-r--r--hw/sd/sdhci.c2
-rw-r--r--hw/sensor/isl_pmbus_vr.c2
-rw-r--r--hw/sensor/max34451.c2
-rw-r--r--hw/usb/ccid-card-emulated.c2
-rw-r--r--hw/usb/hcd-ehci.c6
-rw-r--r--hw/usb/hcd-ohci.c2
-rw-r--r--hw/usb/hcd-xhci.c10
-rw-r--r--hw/usb/quirks.h2
-rw-r--r--hw/usb/redirect.c4
-rw-r--r--hw/usb/trace-events2
-rw-r--r--hw/usb/xen-usb.c2
-rw-r--r--hw/xen/xen_pt.h8
-rw-r--r--hw/xtensa/pic_cpu.c1
42 files changed, 139 insertions, 88 deletions
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index 807e398..eff0304 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -307,11 +307,11 @@ static gboolean cadence_uart_xmit(void *do_not_use, GIOCondition cond,
/* instant drain the fifo when there's no back-end */
if (!qemu_chr_fe_backend_connected(&s->chr)) {
s->tx_count = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
if (!s->tx_count) {
- return FALSE;
+ return G_SOURCE_REMOVE;
}
ret = qemu_chr_fe_write(&s->chr, s->tx_fifo, s->tx_count);
@@ -326,12 +326,12 @@ static gboolean cadence_uart_xmit(void *do_not_use, GIOCondition cond,
cadence_uart_xmit, s);
if (!r) {
s->tx_count = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
}
uart_update_status(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void uart_write_tx_fifo(CadenceUARTState *s, const uint8_t *buf,
diff --git a/hw/char/cmsdk-apb-uart.c b/hw/char/cmsdk-apb-uart.c
index f8dc89e..d466cd9 100644
--- a/hw/char/cmsdk-apb-uart.c
+++ b/hw/char/cmsdk-apb-uart.c
@@ -199,7 +199,7 @@ static gboolean uart_transmit(void *do_not_use, GIOCondition cond, void *opaque)
s->watch_tag = 0;
if (!(s->ctrl & R_CTRL_TX_EN_MASK) || !(s->state & R_STATE_TXFULL_MASK)) {
- return FALSE;
+ return G_SOURCE_REMOVE;
}
ret = qemu_chr_fe_write(&s->chr, &s->txbuf, 1);
@@ -215,7 +215,7 @@ static gboolean uart_transmit(void *do_not_use, GIOCondition cond, void *opaque)
}
/* Transmit pending */
trace_cmsdk_apb_uart_tx_pending();
- return FALSE;
+ return G_SOURCE_REMOVE;
}
buffer_drained:
@@ -227,7 +227,7 @@ buffer_drained:
s->intstatus |= R_INTSTATUS_TX_MASK;
}
cmsdk_apb_uart_update(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void uart_cancel_transmit(CMSDKAPBUART *s)
diff --git a/hw/char/ibex_uart.c b/hw/char/ibex_uart.c
index f70adb5..51708c0 100644
--- a/hw/char/ibex_uart.c
+++ b/hw/char/ibex_uart.c
@@ -147,7 +147,7 @@ static gboolean ibex_uart_xmit(void *do_not_use, GIOCondition cond,
/* instant drain the fifo when there's no back-end */
if (!qemu_chr_fe_backend_connected(&s->chr)) {
s->tx_level = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
if (!s->tx_level) {
@@ -156,7 +156,7 @@ static gboolean ibex_uart_xmit(void *do_not_use, GIOCondition cond,
s->uart_intr_state |= R_INTR_STATE_TX_EMPTY_MASK;
s->uart_intr_state &= ~R_INTR_STATE_TX_WATERMARK_MASK;
ibex_uart_update_irqs(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
ret = qemu_chr_fe_write(&s->chr, s->tx_fifo, s->tx_level);
@@ -171,7 +171,7 @@ static gboolean ibex_uart_xmit(void *do_not_use, GIOCondition cond,
ibex_uart_xmit, s);
if (!r) {
s->tx_level = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
}
@@ -192,7 +192,7 @@ static gboolean ibex_uart_xmit(void *do_not_use, GIOCondition cond,
}
ibex_uart_update_irqs(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void uart_write_tx_fifo(IbexUartState *s, const uint8_t *buf,
diff --git a/hw/char/nrf51_uart.c b/hw/char/nrf51_uart.c
index 3c6f982..dfe2276 100644
--- a/hw/char/nrf51_uart.c
+++ b/hw/char/nrf51_uart.c
@@ -93,13 +93,13 @@ static gboolean uart_transmit(void *do_not_use, GIOCondition cond, void *opaque)
*/
goto buffer_drained;
}
- return FALSE;
+ return G_SOURCE_REMOVE;
}
buffer_drained:
s->reg[R_UART_TXDRDY] = 1;
s->pending_tx_byte = false;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void uart_cancel_transmit(NRF51UARTState *s)
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index 77bbc2a..58edeb9 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -48,14 +48,15 @@ DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr)
return dev;
}
-#define PL011_INT_TX 0x20
-#define PL011_INT_RX 0x10
-
+/* Flag Register, UARTFR */
#define PL011_FLAG_TXFE 0x80
#define PL011_FLAG_RXFF 0x40
#define PL011_FLAG_TXFF 0x20
#define PL011_FLAG_RXFE 0x10
+/* Data Register, UARTDR */
+#define DR_BE (1 << 10)
+
/* Interrupt status bits in UARTRIS, UARTMIS, UARTIMSC */
#define INT_OE (1 << 10)
#define INT_BE (1 << 9)
@@ -71,11 +72,33 @@ DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr)
#define INT_E (INT_OE | INT_BE | INT_PE | INT_FE)
#define INT_MS (INT_RI | INT_DSR | INT_DCD | INT_CTS)
+/* Line Control Register, UARTLCR_H */
+#define LCR_FEN (1 << 4)
+#define LCR_BRK (1 << 0)
+
static const unsigned char pl011_id_arm[8] =
{ 0x11, 0x10, 0x14, 0x00, 0x0d, 0xf0, 0x05, 0xb1 };
static const unsigned char pl011_id_luminary[8] =
{ 0x11, 0x00, 0x18, 0x01, 0x0d, 0xf0, 0x05, 0xb1 };
+static const char *pl011_regname(hwaddr offset)
+{
+ static const char *const rname[] = {
+ [0] = "DR", [1] = "RSR", [6] = "FR", [8] = "ILPR", [9] = "IBRD",
+ [10] = "FBRD", [11] = "LCRH", [12] = "CR", [13] = "IFLS", [14] = "IMSC",
+ [15] = "RIS", [16] = "MIS", [17] = "ICR", [18] = "DMACR",
+ };
+ unsigned idx = offset >> 2;
+
+ if (idx < ARRAY_SIZE(rname) && rname[idx]) {
+ return rname[idx];
+ }
+ if (idx >= 0x3f8 && idx <= 0x400) {
+ return "ID";
+ }
+ return "UNKN";
+}
+
/* Which bits in the interrupt status matter for each outbound IRQ line ? */
static const uint32_t irqmask[] = {
INT_E | INT_MS | INT_RT | INT_TX | INT_RX, /* combined IRQ */
@@ -100,7 +123,7 @@ static void pl011_update(PL011State *s)
static bool pl011_is_fifo_enabled(PL011State *s)
{
- return (s->lcr & 0x10) != 0;
+ return (s->lcr & LCR_FEN) != 0;
}
static inline unsigned pl011_get_fifo_depth(PL011State *s)
@@ -138,7 +161,7 @@ static uint64_t pl011_read(void *opaque, hwaddr offset,
s->flags |= PL011_FLAG_RXFE;
}
if (s->read_count == s->read_trigger - 1)
- s->int_level &= ~ PL011_INT_RX;
+ s->int_level &= ~ INT_RX;
trace_pl011_read_fifo(s->read_count);
s->rsr = c >> 8;
pl011_update(s);
@@ -191,7 +214,7 @@ static uint64_t pl011_read(void *opaque, hwaddr offset,
break;
}
- trace_pl011_read(offset, r);
+ trace_pl011_read(offset, r, pl011_regname(offset));
return r;
}
@@ -202,7 +225,7 @@ static void pl011_set_read_trigger(PL011State *s)
the threshold. However linux only reads the FIFO in response to an
interrupt. Triggering the interrupt when the FIFO is non-empty seems
to make things work. */
- if (s->lcr & 0x10)
+ if (s->lcr & LCR_FEN)
s->read_trigger = (s->ifl >> 1) & 0x1c;
else
#endif
@@ -234,7 +257,7 @@ static void pl011_write(void *opaque, hwaddr offset,
PL011State *s = (PL011State *)opaque;
unsigned char ch;
- trace_pl011_write(offset, value);
+ trace_pl011_write(offset, value, pl011_regname(offset));
switch (offset >> 2) {
case 0: /* UARTDR */
@@ -243,7 +266,7 @@ static void pl011_write(void *opaque, hwaddr offset,
/* XXX this blocks entire thread. Rewrite to use
* qemu_chr_fe_write and background I/O callbacks */
qemu_chr_fe_write_all(&s->chr, &ch, 1);
- s->int_level |= PL011_INT_TX;
+ s->int_level |= INT_TX;
pl011_update(s);
break;
case 1: /* UARTRSR/UARTECR */
@@ -252,7 +275,7 @@ static void pl011_write(void *opaque, hwaddr offset,
case 6: /* UARTFR */
/* Writes to Flag register are ignored. */
break;
- case 8: /* UARTUARTILPR */
+ case 8: /* UARTILPR */
s->ilpr = value;
break;
case 9: /* UARTIBRD */
@@ -265,11 +288,11 @@ static void pl011_write(void *opaque, hwaddr offset,
break;
case 11: /* UARTLCR_H */
/* Reset the FIFO state on FIFO enable or disable */
- if ((s->lcr ^ value) & 0x10) {
+ if ((s->lcr ^ value) & LCR_FEN) {
pl011_reset_fifo(s);
}
- if ((s->lcr ^ value) & 0x1) {
- int break_enable = value & 0x1;
+ if ((s->lcr ^ value) & LCR_BRK) {
+ int break_enable = value & LCR_BRK;
qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_BREAK,
&break_enable);
}
@@ -331,7 +354,7 @@ static void pl011_put_fifo(void *opaque, uint32_t value)
s->flags |= PL011_FLAG_RXFF;
}
if (s->read_count == s->read_trigger) {
- s->int_level |= PL011_INT_RX;
+ s->int_level |= INT_RX;
pl011_update(s);
}
}
@@ -343,8 +366,9 @@ static void pl011_receive(void *opaque, const uint8_t *buf, int size)
static void pl011_event(void *opaque, QEMUChrEvent event)
{
- if (event == CHR_EVENT_BREAK)
- pl011_put_fifo(opaque, 0x400);
+ if (event == CHR_EVENT_BREAK) {
+ pl011_put_fifo(opaque, DR_BE);
+ }
}
static void pl011_clock_update(void *opaque, ClockEvent event)
@@ -358,6 +382,8 @@ static const MemoryRegionOps pl011_ops = {
.read = pl011_read,
.write = pl011_write,
.endianness = DEVICE_NATIVE_ENDIAN,
+ .impl.min_access_size = 4,
+ .impl.max_access_size = 4,
};
static bool pl011_clock_needed(void *opaque)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 270e1b1..f3094f8 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -226,7 +226,7 @@ static gboolean serial_watch_cb(void *do_not_use, GIOCondition cond,
SerialState *s = opaque;
s->watch_tag = 0;
serial_xmit(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void serial_xmit(SerialState *s)
diff --git a/hw/char/trace-events b/hw/char/trace-events
index 2ecb362..babf4d3 100644
--- a/hw/char/trace-events
+++ b/hw/char/trace-events
@@ -54,9 +54,9 @@ escc_sunmouse_event(int dx, int dy, int buttons_state) "dx=%d dy=%d buttons=0x%0
# pl011.c
pl011_irq_state(int level) "irq state %d"
-pl011_read(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
+pl011_read(uint32_t addr, uint32_t value, const char *regname) "addr 0x%03x value 0x%08x reg %s"
pl011_read_fifo(int read_count) "FIFO read, read_count now %d"
-pl011_write(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
+pl011_write(uint32_t addr, uint32_t value, const char *regname) "addr 0x%03x value 0x%08x reg %s"
pl011_can_receive(uint32_t lcr, int read_count, int r) "LCR 0x%08x read_count %d returning %d"
pl011_put_fifo(uint32_t c, int read_count) "new char 0x%x read_count now %d"
pl011_put_fifo_full(void) "FIFO now full, RXFF set"
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index dd5a02e..dbe0b28 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -45,7 +45,7 @@ static gboolean chr_write_unblocked(void *do_not_use, GIOCondition cond,
vcon->watch = 0;
virtio_serial_throttle_port(VIRTIO_SERIAL_PORT(vcon), false);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
/* Callback function that's called when the guest sends us data */
diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c
index e7ec268..9138e98 100644
--- a/hw/display/bochs-display.c
+++ b/hw/display/bochs-display.c
@@ -164,7 +164,7 @@ static int bochs_display_get_mode(BochsDisplayState *s,
memset(mode, 0, sizeof(*mode));
switch (vbe[VBE_DISPI_INDEX_BPP]) {
case 16:
- /* best effort: support native endianess only */
+ /* best effort: support native endianness only */
mode->format = PIXMAN_r5g6b5;
mode->bytepp = 2;
break;
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index f1c0eb7..af941fb 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -1544,7 +1544,7 @@ static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm,
}
}
-/* return 1 if surface destoy was initiated (in QXL_ASYNC case) or
+/* return 1 if surface destroy was initiated (in QXL_ASYNC case) or
* done (in QXL_SYNC case), 0 otherwise. */
static int qxl_destroy_primary(PCIQXLDevice *d, qxl_async_io async)
{
diff --git a/hw/display/ssd0303.c b/hw/display/ssd0303.c
index d67b0ad..32b32a3 100644
--- a/hw/display/ssd0303.c
+++ b/hw/display/ssd0303.c
@@ -8,7 +8,7 @@
*/
/* The controller can support a variety of different displays, but we only
- implement one. Most of the commends relating to brightness and geometry
+ implement one. Most of the commands relating to brightness and geometry
setup are ignored. */
#include "qemu/osdep.h"
diff --git a/hw/display/ssd0323.c b/hw/display/ssd0323.c
index ab229d3..09b1bbe 100644
--- a/hw/display/ssd0323.c
+++ b/hw/display/ssd0323.c
@@ -8,7 +8,7 @@
*/
/* The controller can support a variety of different displays, but we only
- implement one. Most of the commends relating to brightness and geometry
+ implement one. Most of the commands relating to brightness and geometry
setup are ignored. */
#include "qemu/osdep.h"
diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
index b0828d6..822355e 100644
--- a/hw/display/xlnx_dp.c
+++ b/hw/display/xlnx_dp.c
@@ -380,7 +380,7 @@ static inline void xlnx_dp_audio_mix_buffer(XlnxDPState *s)
static void xlnx_dp_audio_callback(void *opaque, int avail)
{
/*
- * Get some data from the DPDMA and compute these datas.
+ * Get some data from the DPDMA and compute these data.
* Then wait for QEMU's audio subsystem to call this callback.
*/
XlnxDPState *s = XLNX_DP(opaque);
diff --git a/hw/dma/etraxfs_dma.c b/hw/dma/etraxfs_dma.c
index a1068b1..9c0003d 100644
--- a/hw/dma/etraxfs_dma.c
+++ b/hw/dma/etraxfs_dma.c
@@ -28,6 +28,7 @@
#include "qemu/main-loop.h"
#include "sysemu/runstate.h"
#include "exec/address-spaces.h"
+#include "exec/memory.h"
#include "hw/cris/etraxfs_dma.h"
diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c
index d7eae54..9ad6a47 100644
--- a/hw/i2c/pm_smbus.c
+++ b/hw/i2c/pm_smbus.c
@@ -1,6 +1,6 @@
/*
* PC SMBus implementation
- * splitted from acpi.c
+ * split from acpi.c
*
* Copyright (c) 2006 Fabrice Bellard
*
diff --git a/hw/i2c/pmbus_device.c b/hw/i2c/pmbus_device.c
index 44fe4ed..cef5166 100644
--- a/hw/i2c/pmbus_device.c
+++ b/hw/i2c/pmbus_device.c
@@ -190,15 +190,18 @@ static void pmbus_quick_cmd(SMBusDevice *smd, uint8_t read)
}
}
-static void pmbus_pages_alloc(PMBusDevice *pmdev)
+static uint8_t pmbus_pages_num(PMBusDevice *pmdev)
{
+ const PMBusDeviceClass *k = PMBUS_DEVICE_GET_CLASS(pmdev);
+
/* some PMBus devices don't use the PAGE command, so they get 1 page */
- PMBusDeviceClass *k = PMBUS_DEVICE_GET_CLASS(pmdev);
- if (k->device_num_pages == 0) {
- k->device_num_pages = 1;
- }
- pmdev->num_pages = k->device_num_pages;
- pmdev->pages = g_new0(PMBusPage, k->device_num_pages);
+ return k->device_num_pages ? : 1;
+}
+
+static void pmbus_pages_alloc(PMBusDevice *pmdev)
+{
+ pmdev->num_pages = pmbus_pages_num(pmdev);
+ pmdev->pages = g_new0(PMBusPage, pmdev->num_pages);
}
void pmbus_check_limits(PMBusDevice *pmdev)
@@ -1623,7 +1626,7 @@ static int pmbus_write_data(SMBusDevice *smd, uint8_t *buf, uint8_t len)
break;
passthrough:
- /* Unimplimented registers get passed to the device */
+ /* Unimplemented registers get passed to the device */
default:
if (pmdc->write_data) {
ret = pmdc->write_data(pmdev, buf, len);
diff --git a/hw/i2c/smbus_slave.c b/hw/i2c/smbus_slave.c
index feb3ec6..2ef2c7c 100644
--- a/hw/i2c/smbus_slave.c
+++ b/hw/i2c/smbus_slave.c
@@ -2,7 +2,7 @@
* QEMU SMBus device emulation.
*
* This code is a helper for SMBus device emulation. It implements an
- * I2C device inteface and runs the SMBus protocol from the device
+ * I2C device interface and runs the SMBus protocol from the device
* point of view and maps those to simple calls to emulate.
*
* Copyright (c) 2007 CodeSourcery.
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index df70b4a..34348a3 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -22,7 +22,7 @@
#include "kvm/kvm_i386.h"
#include "migration/vmstate.h"
#include "hw/sysbus.h"
-#include "hw/kvm/clock.h"
+#include "hw/i386/kvm/clock.h"
#include "hw/qdev-properties.h"
#include "qapi/error.h"
@@ -332,8 +332,10 @@ void kvmclock_create(bool create_always)
{
X86CPU *cpu = X86_CPU(first_cpu);
- if (!kvm_enabled() || !kvm_has_adjust_clock())
+ assert(kvm_enabled());
+ if (!kvm_has_adjust_clock()) {
return;
+ }
if (create_always ||
cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
diff --git a/hw/i386/kvm/clock.h b/hw/i386/kvm/clock.h
new file mode 100644
index 0000000..401c7e4
--- /dev/null
+++ b/hw/i386/kvm/clock.h
@@ -0,0 +1,18 @@
+/*
+ * QEMU KVM support, paravirtual clock device
+ *
+ * Copyright (C) 2011 Siemens AG
+ *
+ * Authors:
+ * Jan Kiszka <jan.kiszka@siemens.com>
+ *
+ * This work is licensed under the terms of the GNU GPL version 2.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef HW_I386_KVM_CLOCK_H
+#define HW_I386_KVM_CLOCK_H
+
+void kvmclock_create(bool create_always);
+
+#endif
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 7227a21..8deeb62 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -32,7 +32,7 @@
#include "hw/loader.h"
#include "hw/irq.h"
-#include "hw/kvm/clock.h"
+#include "hw/i386/kvm/clock.h"
#include "hw/i386/microvm.h"
#include "hw/i386/x86.h"
#include "target/i386/cpu.h"
@@ -180,7 +180,9 @@ static void microvm_devices_init(MicrovmMachineState *mms)
x86ms->ioapic2 = ioapic_init_secondary(gsi_state);
}
- kvmclock_create(true);
+ if (kvm_enabled()) {
+ kvmclock_create(true);
+ }
mms->virtio_irq_base = 5;
mms->virtio_num_transports = 8;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index ce1ac95..5cbad6a 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -46,7 +46,7 @@
#include "hw/ide/piix.h"
#include "hw/irq.h"
#include "sysemu/kvm.h"
-#include "hw/kvm/clock.h"
+#include "hw/i386/kvm/clock.h"
#include "hw/sysbus.h"
#include "hw/i2c/smbus_eeprom.h"
#include "exec/memory.h"
@@ -192,7 +192,7 @@ static void pc_init1(MachineState *machine,
pc_machine_init_sgx_epc(pcms);
x86_cpus_init(x86ms, pcmc->default_cpu_version);
- if (pcmc->kvmclock_enabled) {
+ if (kvm_enabled() && pcmc->kvmclock_enabled) {
kvmclock_create(pcmc->kvmclock_create_always);
}
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 37c4814..0bd6869 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -35,7 +35,7 @@
#include "hw/i2c/smbus_eeprom.h"
#include "hw/rtc/mc146818rtc.h"
#include "sysemu/kvm.h"
-#include "hw/kvm/clock.h"
+#include "hw/i386/kvm/clock.h"
#include "hw/pci-host/q35.h"
#include "hw/pci/pcie_port.h"
#include "hw/qdev-properties.h"
@@ -183,7 +183,9 @@ static void pc_q35_init(MachineState *machine)
pc_machine_init_sgx_epc(pcms);
x86_cpus_init(x86ms, pcmc->default_cpu_version);
- kvmclock_create(pcmc->kvmclock_create_always);
+ if (kvm_enabled()) {
+ kvmclock_create(pcmc->kvmclock_create_always);
+ }
/* pci enabled */
if (pcmc->pci_enabled) {
diff --git a/hw/ide/ahci_internal.h b/hw/ide/ahci_internal.h
index 2480455..c244bbd 100644
--- a/hw/ide/ahci_internal.h
+++ b/hw/ide/ahci_internal.h
@@ -61,13 +61,13 @@ enum AHCIHostReg {
AHCI_HOST_REG_CTL = 1, /* GHC: global host control */
AHCI_HOST_REG_IRQ_STAT = 2, /* IS: interrupt status */
AHCI_HOST_REG_PORTS_IMPL = 3, /* PI: bitmap of implemented ports */
- AHCI_HOST_REG_VERSION = 4, /* VS: AHCI spec. version compliancy */
+ AHCI_HOST_REG_VERSION = 4, /* VS: AHCI spec. version compliance */
AHCI_HOST_REG_CCC_CTL = 5, /* CCC_CTL: CCC Control */
AHCI_HOST_REG_CCC_PORTS = 6, /* CCC_PORTS: CCC Ports */
AHCI_HOST_REG_EM_LOC = 7, /* EM_LOC: Enclosure Mgmt Location */
AHCI_HOST_REG_EM_CTL = 8, /* EM_CTL: Enclosure Mgmt Control */
AHCI_HOST_REG_CAP2 = 9, /* CAP2: host capabilities, extended */
- AHCI_HOST_REG_BOHC = 10, /* BOHC: firmare/os handoff ctrl & status */
+ AHCI_HOST_REG_BOHC = 10, /* BOHC: firmware/os handoff ctrl & status */
AHCI_HOST_REG__COUNT = 11
};
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index cabe904..c0bcfa4 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -257,7 +257,7 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp)
pci_conf[CNTRL] = CNTRL_EN_CH0; // enable IDE0
if (d->secondary) {
- /* XXX: if not enabled, really disable the seconday IDE controller */
+ /* XXX: if not enabled, really disable the secondary IDE controller */
pci_conf[CNTRL] |= CNTRL_EN_CH1; /* enable IDE1 */
}
diff --git a/hw/ide/core.c b/hw/ide/core.c
index de48ff9..ee11689 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1698,7 +1698,7 @@ static bool cmd_set_features(IDEState *s, uint8_t cmd)
put_le16(identify_data + 63, 0x07);
put_le16(identify_data + 88, 0x3f);
break;
- case 0x02: /* sigle word dma mode*/
+ case 0x02: /* single word dma mode */
put_le16(identify_data + 62, 0x07 | (1 << (val + 8)));
put_le16(identify_data + 63, 0x07);
put_le16(identify_data + 88, 0x3f);
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
index 4a34f03..68ad30e 100644
--- a/hw/intc/apic_common.c
+++ b/hw/intc/apic_common.c
@@ -28,7 +28,6 @@
#include "hw/intc/kvm_irqcount.h"
#include "trace.h"
#include "hw/boards.h"
-#include "sysemu/hax.h"
#include "sysemu/kvm.h"
#include "hw/qdev-properties.h"
#include "hw/sysbus.h"
@@ -271,7 +270,7 @@ static void apic_common_realize(DeviceState *dev, Error **errp)
/* Note: We need at least 1M to map the VAPIC option ROM */
if (!vapic && s->vapic_control & VAPIC_ENABLE_MASK &&
- !hax_enabled() && current_machine->ram_size >= 1024 * 1024) {
+ current_machine->ram_size >= 1024 * 1024) {
vapic = sysbus_create_simple("kvmvapic", -1, NULL);
}
s->vapic = vapic;
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index f9618fa..16e9c47 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -627,7 +627,7 @@ static void bl_setup_gt64120_jump_kernel(void **p, uint64_t run_addr,
10, 10, 11, 11 /* PIIX IRQRC[A:D] */
};
- /* Bus endianess is always reversed */
+ /* Bus endianness is always reversed */
#if TARGET_BIG_ENDIAN
#define cpu_to_gt32(x) (x)
#else
diff --git a/hw/net/i82596.c b/hw/net/i82596.c
index ab26f8b..6defa9d 100644
--- a/hw/net/i82596.c
+++ b/hw/net/i82596.c
@@ -15,6 +15,7 @@
#include "hw/irq.h"
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
+#include "exec/address-spaces.h"
#include "qemu/module.h"
#include "trace.h"
#include "i82596.h"
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 77a717d..43c374e 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1224,7 +1224,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
}
break;
- /* Block read commands (Classs 2) */
+ /* Block read commands (Class 2) */
case 16: /* CMD16: SET_BLOCKLEN */
switch (sd->state) {
case sd_transfer_state:
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 362c2c8..5564765 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1811,7 +1811,7 @@ usdhc_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
* on i.MX, but since it is not used by QEMU we do not care.
*
* We don't want to call sdhci_write(.., SDHC_TRNMOD, ...)
- * here becuase it will result in a call to
+ * here because it will result in a call to
* sdhci_send_command(s) which we don't want.
*
*/
diff --git a/hw/sensor/isl_pmbus_vr.c b/hw/sensor/isl_pmbus_vr.c
index eb344dd..e51269f 100644
--- a/hw/sensor/isl_pmbus_vr.c
+++ b/hw/sensor/isl_pmbus_vr.c
@@ -101,7 +101,7 @@ static void isl_pmbus_vr_exit_reset(Object *obj)
}
}
-/* The raa228000 uses different direct mode coefficents from most isl devices */
+/* The raa228000 uses different direct mode coefficients from most isl devices */
static void raa228000_exit_reset(Object *obj)
{
PMBusDevice *pmdev = PMBUS_DEVICE(obj);
diff --git a/hw/sensor/max34451.c b/hw/sensor/max34451.c
index a91d8bd..9db52ef 100644
--- a/hw/sensor/max34451.c
+++ b/hw/sensor/max34451.c
@@ -734,7 +734,7 @@ static void max34451_init(Object *obj)
/*
* get and set the temperature of the internal temperature sensor in
- * centidegrees Celcius i.e.: 2500 -> 25.00 C, max is 327.67 C
+ * centidegrees Celsius i.e.: 2500 -> 25.00 C, max is 327.67 C
*/
for (int i = 0; i < MAX34451_NUM_TEMP_DEVICES; i++) {
object_property_add(obj, "temperature[*]", "uint16",
diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c
index c328660..3ee9c73 100644
--- a/hw/usb/ccid-card-emulated.c
+++ b/hw/usb/ccid-card-emulated.c
@@ -518,7 +518,7 @@ static void emulated_realize(CCIDCardState *base, Error **errp)
goto out2;
}
- /* TODO: a passthru backened that works on local machine. third card type?*/
+ /* TODO: a passthru backend that works on local machine. third card type?*/
if (card->backend == BACKEND_CERTIFICATES) {
if (card->cert1 != NULL && card->cert2 != NULL && card->cert3 != NULL) {
ret = emulated_initialize_vcard_from_certificates(card);
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index c930c60..19b4534 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1464,7 +1464,7 @@ static int ehci_process_itd(EHCIState *ehci,
usb_handle_packet(dev, &ehci->ipacket);
usb_packet_unmap(&ehci->ipacket, &ehci->isgl);
} else {
- DPRINTF("ISOCH: attempt to addess non-iso endpoint\n");
+ DPRINTF("ISOCH: attempt to address non-iso endpoint\n");
ehci->ipacket.status = USB_RET_NAK;
ehci->ipacket.actual_length = 0;
}
@@ -1513,7 +1513,7 @@ static int ehci_process_itd(EHCIState *ehci,
/* This state is the entry point for asynchronous schedule
- * processing. Entry here consitutes a EHCI start event state (4.8.5)
+ * processing. Entry here constitutes a EHCI start event state (4.8.5)
*/
static int ehci_state_waitlisthead(EHCIState *ehci, int async)
{
@@ -2458,7 +2458,7 @@ static void usb_ehci_vm_state_change(void *opaque, bool running, RunState state)
/*
* The schedule rebuilt from guest memory could cause the migration dest
* to miss a QH unlink, and fail to cancel packets, since the unlinked QH
- * will never have existed on the destination. Therefor we must flush the
+ * will never have existed on the destination. Therefore we must flush the
* async schedule on savevm to catch any not yet noticed unlinks.
*/
if (state == RUN_STATE_SAVE_VM) {
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index cc5cde6..7ff1b65 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1355,7 +1355,7 @@ static uint32_t ohci_get_frame_remaining(OHCIState *ohci)
if ((ohci->ctl & OHCI_CTL_HCFS) != OHCI_USB_OPERATIONAL) {
return ohci->frt << 31;
}
- /* Being in USB operational state guarnatees sof_time was set already. */
+ /* Being in USB operational state guarantees sof_time was set already. */
tks = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ohci->sof_time;
if (tks < 0) {
tks = 0;
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index b89b618..324177a 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -2434,7 +2434,6 @@ static void xhci_detach_slot(XHCIState *xhci, USBPort *uport)
static TRBCCode xhci_get_port_bandwidth(XHCIState *xhci, uint64_t pctx)
{
dma_addr_t ctx;
- uint8_t bw_ctx[xhci->numports+1];
DPRINTF("xhci_get_port_bandwidth()\n");
@@ -2442,11 +2441,10 @@ static TRBCCode xhci_get_port_bandwidth(XHCIState *xhci, uint64_t pctx)
DPRINTF("xhci: bandwidth context at "DMA_ADDR_FMT"\n", ctx);
- /* TODO: actually implement real values here */
- bw_ctx[0] = 0;
- memset(&bw_ctx[1], 80, xhci->numports); /* 80% */
- if (dma_memory_write(xhci->as, ctx, bw_ctx, sizeof(bw_ctx),
- MEMTXATTRS_UNSPECIFIED) != MEMTX_OK) {
+ /* TODO: actually implement real values here. This is 80% for all ports. */
+ if (stb_dma(xhci->as, ctx, 0, MEMTXATTRS_UNSPECIFIED) != MEMTX_OK ||
+ dma_memory_set(xhci->as, ctx + 1, 80, xhci->numports,
+ MEMTXATTRS_UNSPECIFIED) != MEMTX_OK) {
qemu_log_mask(LOG_GUEST_ERROR, "%s: DMA memory write failed!\n",
__func__);
return CC_TRB_ERROR;
diff --git a/hw/usb/quirks.h b/hw/usb/quirks.h
index c3e595f..94b2c95 100644
--- a/hw/usb/quirks.h
+++ b/hw/usb/quirks.h
@@ -67,7 +67,7 @@ static const struct usb_device_id usbredir_raw_serial_ids[] = {
{ USB_DEVICE(0x10C4, 0x800A) }, /* SPORTident BSM7-D-USB main station */
{ USB_DEVICE(0x10C4, 0x803B) }, /* Pololu USB-serial converter */
{ USB_DEVICE(0x10C4, 0x8044) }, /* Cygnal Debug Adapter */
- { USB_DEVICE(0x10C4, 0x804E) }, /* Software Bisque Paramount ME build-in converter */
+ { USB_DEVICE(0x10C4, 0x804E) }, /* Software Bisque Paramount ME built-in converter */
{ USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */
{ USB_DEVICE(0x10C4, 0x8054) }, /* Enfora GSM2228 */
{ USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 39fbaaa..c9893df 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -278,7 +278,7 @@ static gboolean usbredir_write_unblocked(void *do_not_use, GIOCondition cond,
dev->watch = 0;
usbredirparser_do_write(dev->parser);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static int usbredir_write(void *priv, uint8_t *data, int count)
@@ -471,7 +471,7 @@ static int bufp_alloc(USBRedirDevice *dev, uint8_t *data, uint16_t len,
DPRINTF("bufpq overflow, dropping packets ep %02X\n", ep);
dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 1;
}
- /* Since we're interupting the stream anyways, drop enough packets to get
+ /* Since we're interrupting the stream anyways, drop enough packets to get
back to our target buffer size */
if (dev->endpoint[EP2I(ep)].bufpq_dropping_packets) {
if (dev->endpoint[EP2I(ep)].bufpq_size >
diff --git a/hw/usb/trace-events b/hw/usb/trace-events
index 6bb9655..ed7dc21 100644
--- a/hw/usb/trace-events
+++ b/hw/usb/trace-events
@@ -248,7 +248,7 @@ usb_set_device_feature(int addr, int feature, int ret) "dev %d, feature %d, ret
# dev-hub.c
usb_hub_reset(int addr) "dev %d"
-usb_hub_control(int addr, int request, int value, int index, int length) "dev %d, req 0x%x, value %d, index %d, langth %d"
+usb_hub_control(int addr, int request, int value, int index, int length) "dev %d, req 0x%x, value %d, index %d, length %d"
usb_hub_get_port_status(int addr, int nr, int status, int changed) "dev %d, port %d, status 0x%x, changed 0x%x"
usb_hub_set_port_feature(int addr, int nr, const char *f) "dev %d, port %d, feature %s"
usb_hub_clear_port_feature(int addr, int nr, const char *f) "dev %d, port %d, feature %s"
diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c
index 38ee660..09ec326 100644
--- a/hw/usb/xen-usb.c
+++ b/hw/usb/xen-usb.c
@@ -451,7 +451,7 @@ static int usbback_check_and_submit(struct usbback_req *usbback_req)
wValue = le16_to_cpu(ctrl->wValue);
/*
- * When the device is first connected or resetted, USB device has no
+ * When the device is first connected or reset, USB device has no
* address. In this initial state, following requests are sent to device
* address (#0),
*
diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h
index b20744f..31bcfdf 100644
--- a/hw/xen/xen_pt.h
+++ b/hw/xen/xen_pt.h
@@ -340,11 +340,9 @@ static inline bool xen_pt_has_msix_mapping(XenPCIPassthroughState *s, int bar)
return s->msix && s->msix->bar_index == bar;
}
-extern void *pci_assign_dev_load_option_rom(PCIDevice *dev,
- int *size,
- unsigned int domain,
- unsigned int bus, unsigned int slot,
- unsigned int function);
+void *pci_assign_dev_load_option_rom(PCIDevice *dev, int *size,
+ unsigned int domain, unsigned int bus,
+ unsigned int slot, unsigned int function);
static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev)
{
return (xen_igd_gfx_pt_enabled()
diff --git a/hw/xtensa/pic_cpu.c b/hw/xtensa/pic_cpu.c
index 6c94475..8cef88c 100644
--- a/hw/xtensa/pic_cpu.c
+++ b/hw/xtensa/pic_cpu.c
@@ -30,6 +30,7 @@
#include "hw/irq.h"
#include "qemu/log.h"
#include "qemu/timer.h"
+#include "qemu/atomic.h"
void check_interrupts(CPUXtensaState *env)
{