Skip to content

Commit 71119ed

Browse files
committed
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
* exec/cpu-all: remove BSWAP_NEEDED * pl011: pad C PL011State struct to same size as Rust struct * rust: hpet: fix type of "timers" property * rust: hpet: fix functional tests (and really everything that uses it) * rust: Kconfig: Factor out whether devices are Rust or C * rust: vmstate: Fixes and tests # -----BEGIN PGP SIGNATURE----- # # iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmfdsUsUHHBib256aW5p # QHJlZGhhdC5jb20ACgkQv/vSX3jHroOGpwf/Qk4bAcLX7A1/nOmYT+DtWzZ9V/VS # hSOe6BruzW8rzwMyn/d7oR+aUpk3sL+v2iPBWqoZ/wh0w8kcABcUfWsqqGI8ln/K # pnTdiC+hra5z0AFH1tmjjtOI50WDOeSjh5SFvoPJtGzhEbo89QvsUWgy98HiHOMm # YFPDuhg3Pfd1XDcdoaa85sOHO1vDsj45fCEJhx6Ktib4vOlEm2I4Z9YR/JxNMT33 # vy/y09HG4cpc6bWKLPL3nqR9RchUSI+YRDZ8rlaXUowiZzH2K/wi0qJOsvG6oJF5 # awni0YWuwyFi16jmUub8NFnWk6NKjbACqw74AwoVPbNbDoCrrogXzIF2Lw== # =NzCN # -----END PGP SIGNATURE----- # gpg: Signature made Fri 21 Mar 2025 14:34:51 EDT # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "[email protected]" # gpg: Good signature from "Paolo Bonzini <[email protected]>" [full] # gpg: aka "Paolo Bonzini <[email protected]>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * tag 'for-upstream' of https://gitlab.com/bonzini/qemu: (24 commits) rust: hpet: fix decoding of timer registers rust/vmstate: Include complete crate path of VMStateFlags in vmstate_clock rust/vmstate: Add unit test for vmstate_validate rust/vmstate: Add unit test for pointer case rust/vmstate: Add unit test for vmstate_{of|struct} macro rust/vmstate: Add unit test for vmstate_of macro rust/vmstate: Support vmstate_validate rust/vmstate: Re-implement VMState trait for timer binding rust/vmstate: Relax array check when build varray in vmstate_struct rust/vmstate: Fix unnecessary VMState bound of with_varray_flag() rust/vmstate: Fix "cannot infer type" error in vmstate_struct rust/vmstate: Fix type check for varray in vmstate_struct rust/vmstate: Fix size field of VMStateField with VMS_ARRAY_OF_POINTER flag rust/vmstate: Fix num field when varray flags are set rust/vmstate: Fix num_offset in vmstate macros rust/vmstate: Remove unnecessary unsafe exec/cpu-all: remove BSWAP_NEEDED load_aout: replace bswap_needed with big_endian rust: pl011: Check size of state struct at compile time hw/char/pl011: Pad PL011State struct to same size as Rust impl ... Signed-off-by: Stefan Hajnoczi <[email protected]>
2 parents cea9dfb + 64acc23 commit 71119ed

File tree

33 files changed

+705
-109
lines changed

33 files changed

+705
-109
lines changed

bsd-user/elfload.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static inline void memcpy_fromfs(void *to, const void *from, unsigned long n)
4444
memcpy(to, from, n);
4545
}
4646

47-
#ifdef BSWAP_NEEDED
47+
#if HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN
4848
static void bswap_ehdr(struct elfhdr *ehdr)
4949
{
5050
bswap16s(&ehdr->e_type); /* Object file type */
@@ -111,15 +111,15 @@ static void bswap_note(struct elf_note *en)
111111
bswap32s(&en->n_type);
112112
}
113113

114-
#else /* ! BSWAP_NEEDED */
114+
#else
115115

116116
static void bswap_ehdr(struct elfhdr *ehdr) { }
117117
static void bswap_phdr(struct elf_phdr *phdr, int phnum) { }
118118
static void bswap_shdr(struct elf_shdr *shdr, int shnum) { }
119119
static void bswap_sym(struct elf_sym *sym) { }
120120
static void bswap_note(struct elf_note *en) { }
121121

122-
#endif /* ! BSWAP_NEEDED */
122+
#endif /* HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN */
123123

124124
#include "elfcore.c"
125125

configs/devices/i386-softmmu/default.mak

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#CONFIG_APPLESMC=n
77
#CONFIG_FDC=n
88
#CONFIG_HPET=n
9-
#CONFIG_X_HPET_RUST=n
109
#CONFIG_HYPERV=n
1110
#CONFIG_ISA_DEBUG=n
1211
#CONFIG_ISA_IPMI_BT=n

hw/arm/Kconfig

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ config ARM_VIRT
2121
select PCI_EXPRESS
2222
select PCI_EXPRESS_GENERIC_BRIDGE
2323
select PFLASH_CFI01
24-
select PL011 if !HAVE_RUST # UART
25-
select X_PL011_RUST if HAVE_RUST # UART
24+
select PL011 # UART
2625
select PL031 # RTC
2726
select PL061 # GPIO
2827
select GPIO_PWR
@@ -75,8 +74,7 @@ config HIGHBANK
7574
select AHCI_SYSBUS
7675
select ARM_TIMER # sp804
7776
select ARM_V7M
78-
select PL011 if !HAVE_RUST # UART
79-
select X_PL011_RUST if HAVE_RUST # UART
77+
select PL011 # UART
8078
select PL022 # SPI
8179
select PL031 # RTC
8280
select PL061 # GPIO
@@ -89,8 +87,7 @@ config INTEGRATOR
8987
depends on TCG && ARM
9088
select ARM_TIMER
9189
select INTEGRATOR_DEBUG
92-
select PL011 if !HAVE_RUST # UART
93-
select X_PL011_RUST if HAVE_RUST # UART
90+
select PL011 # UART
9491
select PL031 # RTC
9592
select PL041 # audio
9693
select PL050 # keyboard/mouse
@@ -108,8 +105,7 @@ config MUSCA
108105
default y
109106
depends on TCG && ARM
110107
select ARMSSE
111-
select PL011 if !HAVE_RUST # UART
112-
select X_PL011_RUST if HAVE_RUST # UART
108+
select PL011 # UART
113109
select PL031
114110
select SPLIT_IRQ
115111
select UNIMP
@@ -173,8 +169,7 @@ config REALVIEW
173169
select WM8750 # audio codec
174170
select LSI_SCSI_PCI
175171
select PCI
176-
select PL011 if !HAVE_RUST # UART
177-
select X_PL011_RUST if HAVE_RUST # UART
172+
select PL011 # UART
178173
select PL031 # RTC
179174
select PL041 # audio codec
180175
select PL050 # keyboard/mouse
@@ -199,8 +194,7 @@ config SBSA_REF
199194
select PCI_EXPRESS
200195
select PCI_EXPRESS_GENERIC_BRIDGE
201196
select PFLASH_CFI01
202-
select PL011 if !HAVE_RUST # UART
203-
select X_PL011_RUST if HAVE_RUST # UART
197+
select PL011 # UART
204198
select PL031 # RTC
205199
select PL061 # GPIO
206200
select USB_XHCI_SYSBUS
@@ -224,8 +218,7 @@ config STELLARIS
224218
select ARM_V7M
225219
select CMSDK_APB_WATCHDOG
226220
select I2C
227-
select PL011 if !HAVE_RUST # UART
228-
select X_PL011_RUST if HAVE_RUST # UART
221+
select PL011 # UART
229222
select PL022 # SPI
230223
select PL061 # GPIO
231224
select SSD0303 # OLED display
@@ -285,8 +278,7 @@ config VEXPRESS
285278
select ARM_TIMER # sp804
286279
select LAN9118
287280
select PFLASH_CFI01
288-
select PL011 if !HAVE_RUST # UART
289-
select X_PL011_RUST if HAVE_RUST # UART
281+
select PL011 # UART
290282
select PL041 # audio codec
291283
select PL181 # display
292284
select REALVIEW
@@ -371,8 +363,7 @@ config RASPI
371363
default y
372364
depends on TCG && ARM
373365
select FRAMEBUFFER
374-
select PL011 if !HAVE_RUST # UART
375-
select X_PL011_RUST if HAVE_RUST # UART
366+
select PL011 # UART
376367
select SDHCI
377368
select USB_DWC2
378369
select BCM2835_SPI
@@ -448,8 +439,7 @@ config XLNX_VERSAL
448439
select ARM_GIC
449440
select CPU_CLUSTER
450441
select DEVICE_TREE
451-
select PL011 if !HAVE_RUST # UART
452-
select X_PL011_RUST if HAVE_RUST # UART
442+
select PL011 # UART
453443
select CADENCE
454444
select VIRTIO_MMIO
455445
select UNIMP

hw/char/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ config PARALLEL
1111

1212
config PL011
1313
bool
14+
# The PL011 has both a Rust and a C implementation
15+
select PL011_C if !HAVE_RUST
16+
select X_PL011_RUST if HAVE_RUST
17+
18+
config PL011_C
19+
bool
1420

1521
config SERIAL
1622
bool

hw/char/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ system_ss.add(when: 'CONFIG_ISA_BUS', if_true: files('parallel-isa.c'))
99
system_ss.add(when: 'CONFIG_ISA_DEBUG', if_true: files('debugcon.c'))
1010
system_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_uart.c'))
1111
system_ss.add(when: 'CONFIG_PARALLEL', if_true: files('parallel.c'))
12-
system_ss.add(when: 'CONFIG_PL011', if_true: files('pl011.c'))
12+
system_ss.add(when: 'CONFIG_PL011_C', if_true: files('pl011.c'))
1313
system_ss.add(when: 'CONFIG_SCLPCONSOLE', if_true: files('sclpconsole.c', 'sclpconsole-lm.c'))
1414
system_ss.add(when: 'CONFIG_SERIAL', if_true: files('serial.c'))
1515
system_ss.add(when: 'CONFIG_SERIAL_ISA', if_true: files('serial-isa.c'))

hw/core/loader.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static void bswap_ahdr(struct exec *e)
226226

227227

228228
ssize_t load_aout(const char *filename, hwaddr addr, int max_sz,
229-
int bswap_needed, hwaddr target_page_size)
229+
bool big_endian, hwaddr target_page_size)
230230
{
231231
int fd;
232232
ssize_t size, ret;
@@ -241,7 +241,7 @@ ssize_t load_aout(const char *filename, hwaddr addr, int max_sz,
241241
if (size < 0)
242242
goto fail;
243243

244-
if (bswap_needed) {
244+
if (big_endian != HOST_BIG_ENDIAN) {
245245
bswap_ahdr(&e);
246246
}
247247

hw/core/qdev-properties.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,43 @@ const PropertyInfo qdev_prop_uint64_checkmask = {
442442
.set = set_uint64_checkmask,
443443
};
444444

445+
/* --- pointer-size integer --- */
446+
447+
static void get_usize(Object *obj, Visitor *v, const char *name, void *opaque,
448+
Error **errp)
449+
{
450+
const Property *prop = opaque;
451+
452+
#if HOST_LONG_BITS == 32
453+
uint32_t *ptr = object_field_prop_ptr(obj, prop);
454+
visit_type_uint32(v, name, ptr, errp);
455+
#else
456+
uint64_t *ptr = object_field_prop_ptr(obj, prop);
457+
visit_type_uint64(v, name, ptr, errp);
458+
#endif
459+
}
460+
461+
static void set_usize(Object *obj, Visitor *v, const char *name, void *opaque,
462+
Error **errp)
463+
{
464+
const Property *prop = opaque;
465+
466+
#if HOST_LONG_BITS == 32
467+
uint32_t *ptr = object_field_prop_ptr(obj, prop);
468+
visit_type_uint32(v, name, ptr, errp);
469+
#else
470+
uint64_t *ptr = object_field_prop_ptr(obj, prop);
471+
visit_type_uint64(v, name, ptr, errp);
472+
#endif
473+
}
474+
475+
const PropertyInfo qdev_prop_usize = {
476+
.type = "usize",
477+
.get = get_usize,
478+
.set = set_usize,
479+
.set_default_value = qdev_propinfo_set_default_value_uint,
480+
};
481+
445482
/* --- string --- */
446483

447484
static void release_string(Object *obj, const char *name, void *opaque)

hw/i386/fw_cfg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include CONFIG_DEVICES
2727
#include "target/i386/cpu.h"
2828

29-
#if !defined(CONFIG_HPET) && !defined(CONFIG_X_HPET_RUST)
29+
#if !defined(CONFIG_HPET)
3030
struct hpet_fw_config hpet_fw_cfg = {.count = UINT8_MAX};
3131
#endif
3232

hw/i386/pc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,7 @@ static void pc_machine_initfn(Object *obj)
17041704
pcms->sata_enabled = true;
17051705
pcms->i8042_enabled = true;
17061706
pcms->max_fw_size = 8 * MiB;
1707-
#if defined(CONFIG_HPET) || defined(CONFIG_X_HPET_RUST)
1707+
#if defined(CONFIG_HPET)
17081708
pcms->hpet_enabled = true;
17091709
#endif
17101710
pcms->fd_bootchk = true;

hw/ppc/mac_newworld.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,14 @@ static void ppc_core99_init(MachineState *machine)
197197
}
198198

199199
if (machine->kernel_filename) {
200-
int bswap_needed = 0;
201-
202-
#ifdef BSWAP_NEEDED
203-
bswap_needed = 1;
204-
#endif
205200
kernel_base = KERNEL_LOAD_ADDR;
206201
kernel_size = load_elf(machine->kernel_filename, NULL,
207202
translate_kernel_address, NULL, NULL, NULL,
208203
NULL, NULL, ELFDATA2MSB, PPC_ELF_MACHINE, 0, 0);
209204
if (kernel_size < 0) {
210205
kernel_size = load_aout(machine->kernel_filename, kernel_base,
211206
machine->ram_size - kernel_base,
212-
bswap_needed, TARGET_PAGE_SIZE);
207+
true, TARGET_PAGE_SIZE);
213208
}
214209
if (kernel_size < 0) {
215210
kernel_size = load_image_targphys(machine->kernel_filename,

0 commit comments

Comments
 (0)