Skip to content

Commit 5136598

Browse files
committed
Merge tag 'accel-cpus-20250309' of https://github.com/philmd/qemu into staging
Generic CPUs / accelerators patch queue - Reduce "exec/tb-flush.h" inclusion on linux-user - Consider alignment in bsd-user's mmap_find_vma() - Unify MMAP common user emulation API - Simplify cpu-target.c further - Prefer cached CpuClass over CPU_GET_CLASS() macro - Restrict CPU has_work() handlers to system emulation - Consolidate core exec/vCPU section in MAINTAINERS # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmfN1NgACgkQ4+MsLN6t # wN6BghAAr5WBteo7OiNRyTA0Ilg+nOcTf6Re08CgWf/3TIMljEPq8o/tLQOxiFke # AMktDlvYTyg4BWa5UdAKLpj7N7eyHcXrqv95A6Lg/xoGdlbqfYIpyX7/5h0pV70f # z8WUj2/YMpoyXxvvAjw4YtUqHIWZhSTIBsFqJ6jALl6T7fouo8y++AWn/L+zY4tO # /qqC6djJwufphPJWm2NvG+nvf+T60C+4JUc8CkjYQsyL3K3HpoAgzrgb/6VRtHob # nKfORPboKEVSE1Z52GnmM9eMsZjbWOz9bkEN69yfRbHHQNuvsicok+V59PnWWDYd # JX6cC5ukJUJlgYDKOj2jCg9OouoV4mRYRqYYWPtE8WkGLoeJu4mV1AEkVB7h3lTA # BtUu4ohsrk/krfyB89apu8SqDPya6F4TDqJpGmAqlAG2UWJwrECuJV82uTDZql0R # MqnCUYb7OQBkdb9CoqFi47jTYlqgdVLKekS8udXLCaqWggki8Nb1GVQ09LFyv3NF # JlQVNNQG3D2V7JIDd2aXgr4PmhmV2oPv+HYxW+SPxU2qDHIU93krkKyi0TRk0mSC # sWvJYBJcwbXlnMD5clad1bTLZrK5Csl5WkX8I0d0feqeRPSXC2YBTwL2/GgzT8qF # n/2dxB3Lf+1LUl6KAv3kT9lONtqic0J9oBBcPUjVog2ikAD7+Vo= # =TZua # -----END PGP SIGNATURE----- # gpg: Signature made Mon 10 Mar 2025 01:50:16 HKT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <[email protected]>" [full] # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * tag 'accel-cpus-20250309' of https://github.com/philmd/qemu: (38 commits) MAINTAINERS: Consolidate core exec/vCPU handling section cpus: Remove CPUClass::has_work() handler target/xtensa: Move has_work() from CPUClass to SysemuCPUOps target/tricore: Move has_work() from CPUClass to SysemuCPUOps target/sparc: Move has_work() from CPUClass to SysemuCPUOps target/sh4: Move has_work() from CPUClass to SysemuCPUOps target/s390x: Move has_work() from CPUClass to SysemuCPUOps target/s390x: Restrict I/O handler installers to system emulation target/rx: Move has_work() from CPUClass to SysemuCPUOps target/riscv: Move has_work() from CPUClass to SysemuCPUOps target/ppc: Move has_work() from CPUClass to SysemuCPUOps target/openrisc: Move has_work() from CPUClass to SysemuCPUOps target/mips: Move has_work() from CPUClass to SysemuCPUOps target/microblaze: Move has_work() from CPUClass to SysemuCPUOps target/m68k: Move has_work() from CPUClass to SysemuCPUOps target/loongarch: Move has_work() from CPUClass to SysemuCPUOps target/i386: Move has_work() from CPUClass to SysemuCPUOps target/hppa: Move has_work() from CPUClass to SysemuCPUOps target/hexagon: Remove CPUClass:has_work() handler target/avr: Move has_work() from CPUClass to SysemuCPUOps ... Signed-off-by: Stefan Hajnoczi <[email protected]>
2 parents 2e14ac3 + 8ff6ff0 commit 5136598

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+384
-406
lines changed

MAINTAINERS

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,7 @@ Overall TCG CPUs
152152
M: Richard Henderson <[email protected]>
153153
R: Paolo Bonzini <[email protected]>
154154
S: Maintained
155-
F: system/cpus.c
156155
F: system/watchpoint.c
157-
F: cpu-common.c
158-
F: cpu-target.c
159156
F: page-vary-target.c
160157
F: page-vary-common.c
161158
F: accel/tcg/
@@ -165,15 +162,11 @@ F: util/cacheflush.c
165162
F: scripts/decodetree.py
166163
F: docs/devel/decodetree.rst
167164
F: docs/devel/tcg*
168-
F: include/exec/cpu*.h
169-
F: include/exec/exec-all.h
170165
F: include/exec/tb-flush.h
171-
F: include/exec/target_long.h
172166
F: include/exec/helper*.h
173167
F: include/exec/helper*.h.inc
174168
F: include/exec/helper-info.c.inc
175169
F: include/exec/page-protection.h
176-
F: include/system/cpus.h
177170
F: include/system/tcg.h
178171
F: include/accel/tcg/cpu-ops.h
179172
F: host/include/*/host/cpuinfo.h
@@ -497,12 +490,19 @@ Overall
497490
M: Richard Henderson <[email protected]>
498491
R: Paolo Bonzini <[email protected]>
499492
S: Maintained
493+
F: include/exec/cpu*.h
494+
F: include/exec/exec-all.h
495+
F: include/exec/target_long.h
500496
F: include/qemu/accel.h
501497
F: include/system/accel-*.h
498+
F: include/system/cpus.h
502499
F: include/accel/accel-cpu-target.h
503500
F: accel/accel-*.c
504501
F: accel/Makefile.objs
505502
F: accel/stubs/Makefile.objs
503+
F: cpu-common.c
504+
F: cpu-target.c
505+
F: system/cpus.c
506506

507507
Apple Silicon HVF CPUs
508508
M: Alexander Graf <[email protected]>

accel/accel-target.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,20 @@ void accel_init_interfaces(AccelClass *ac)
113113

114114
void accel_cpu_instance_init(CPUState *cpu)
115115
{
116-
CPUClass *cc = CPU_GET_CLASS(cpu);
117-
118-
if (cc->accel_cpu && cc->accel_cpu->cpu_instance_init) {
119-
cc->accel_cpu->cpu_instance_init(cpu);
116+
if (cpu->cc->accel_cpu && cpu->cc->accel_cpu->cpu_instance_init) {
117+
cpu->cc->accel_cpu->cpu_instance_init(cpu);
120118
}
121119
}
122120

123121
bool accel_cpu_common_realize(CPUState *cpu, Error **errp)
124122
{
125-
CPUClass *cc = CPU_GET_CLASS(cpu);
126123
AccelState *accel = current_accel();
127124
AccelClass *acc = ACCEL_GET_CLASS(accel);
128125

129126
/* target specific realization */
130-
if (cc->accel_cpu && cc->accel_cpu->cpu_target_realize
131-
&& !cc->accel_cpu->cpu_target_realize(cpu, errp)) {
127+
if (cpu->cc->accel_cpu
128+
&& cpu->cc->accel_cpu->cpu_target_realize
129+
&& !cpu->cc->accel_cpu->cpu_target_realize(cpu, errp)) {
132130
return false;
133131
}
134132

accel/tcg/tcg-accel-ops.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,9 @@ static inline int xlat_gdb_type(CPUState *cpu, int gdbtype)
121121
[GDB_WATCHPOINT_ACCESS] = BP_GDB | BP_MEM_ACCESS,
122122
};
123123

124-
CPUClass *cc = CPU_GET_CLASS(cpu);
125124
int cputype = xlat[gdbtype];
126125

127-
if (cc->gdb_stop_before_watchpoint) {
126+
if (cpu->cc->gdb_stop_before_watchpoint) {
128127
cputype |= BP_STOP_BEFORE_ACCESS;
129128
}
130129
return cputype;

accel/tcg/translate-all.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
630630
* to account for the re-execution of the branch.
631631
*/
632632
n = 1;
633-
cc = CPU_GET_CLASS(cpu);
633+
cc = cpu->cc;
634634
if (cc->tcg_ops->io_recompile_replay_branch &&
635635
cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) {
636636
cpu->neg.icount_decr.u16.low++;

accel/tcg/watchpoint.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
6868
void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
6969
MemTxAttrs attrs, int flags, uintptr_t ra)
7070
{
71-
CPUClass *cc = CPU_GET_CLASS(cpu);
7271
CPUWatchpoint *wp;
7372

7473
assert(tcg_enabled());
@@ -84,9 +83,9 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
8483
return;
8584
}
8685

87-
if (cc->tcg_ops->adjust_watchpoint_address) {
86+
if (cpu->cc->tcg_ops->adjust_watchpoint_address) {
8887
/* this is currently used only by ARM BE32 */
89-
addr = cc->tcg_ops->adjust_watchpoint_address(cpu, addr, len);
88+
addr = cpu->cc->tcg_ops->adjust_watchpoint_address(cpu, addr, len);
9089
}
9190

9291
assert((flags & ~BP_MEM_ACCESS) == 0);
@@ -118,8 +117,8 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
118117
wp->hitattrs = attrs;
119118

120119
if (wp->flags & BP_CPU
121-
&& cc->tcg_ops->debug_check_watchpoint
122-
&& !cc->tcg_ops->debug_check_watchpoint(cpu, wp)) {
120+
&& cpu->cc->tcg_ops->debug_check_watchpoint
121+
&& !cpu->cc->tcg_ops->debug_check_watchpoint(cpu, wp)) {
123122
wp->flags &= ~BP_WATCHPOINT_HIT;
124123
continue;
125124
}

bsd-user/bsd-mem.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,11 @@ static inline abi_long do_bsd_shmat(int shmid, abi_ulong shmaddr, int shmflg)
370370
if (shmaddr) {
371371
host_raddr = shmat(shmid, (void *)g2h_untagged(shmaddr), shmflg);
372372
} else {
373+
abi_ulong alignment;
373374
abi_ulong mmap_start;
374375

375-
mmap_start = mmap_find_vma(0, shm_info.shm_segsz);
376+
alignment = 0; /* alignment above page size not required */
377+
mmap_start = mmap_find_vma(0, shm_info.shm_segsz, alignment);
376378

377379
if (mmap_start == -1) {
378380
return -TARGET_ENOMEM;

bsd-user/mmap.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,7 @@ static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size,
275275
* It must be called with mmap_lock() held.
276276
* Return -1 if error.
277277
*/
278-
static abi_ulong mmap_find_vma_aligned(abi_ulong start, abi_ulong size,
279-
abi_ulong alignment)
278+
abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size, abi_ulong alignment)
280279
{
281280
void *ptr, *prev;
282281
abi_ulong addr;
@@ -395,11 +394,6 @@ static abi_ulong mmap_find_vma_aligned(abi_ulong start, abi_ulong size,
395394
}
396395
}
397396

398-
abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
399-
{
400-
return mmap_find_vma_aligned(start, size, 0);
401-
}
402-
403397
/* NOTE: all the constants are the HOST ones */
404398
abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
405399
int flags, int fd, off_t offset)
@@ -489,13 +483,12 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
489483
* before we truncate the length for mapping files below.
490484
*/
491485
if (!(flags & MAP_FIXED)) {
486+
abi_ulong alignment;
487+
492488
host_len = len + offset - host_offset;
493489
host_len = HOST_PAGE_ALIGN(host_len);
494-
if ((flags & MAP_ALIGNMENT_MASK) != 0)
495-
start = mmap_find_vma_aligned(real_start, host_len,
496-
(flags & MAP_ALIGNMENT_MASK) >> MAP_ALIGNMENT_SHIFT);
497-
else
498-
start = mmap_find_vma(real_start, host_len);
490+
alignment = (flags & MAP_ALIGNMENT_MASK) >> MAP_ALIGNMENT_SHIFT;
491+
start = mmap_find_vma(real_start, host_len, alignment);
499492
if (start == (abi_ulong)-1) {
500493
errno = ENOMEM;
501494
goto fail;

bsd-user/qemu.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
extern char **environ;
3333

3434
#include "user/thunk.h"
35+
#include "user/mmap.h"
3536
#include "target_arch.h"
3637
#include "syscall_defs.h"
3738
#include "target_syscall.h"
@@ -233,19 +234,8 @@ void print_taken_signal(int target_signum, const target_siginfo_t *tinfo);
233234
extern int do_strace;
234235

235236
/* mmap.c */
236-
int target_mprotect(abi_ulong start, abi_ulong len, int prot);
237-
abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
238-
int flags, int fd, off_t offset);
239-
int target_munmap(abi_ulong start, abi_ulong len);
240-
abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
241-
abi_ulong new_size, unsigned long flags,
242-
abi_ulong new_addr);
243237
int target_msync(abi_ulong start, abi_ulong len, int flags);
244-
extern abi_ulong mmap_next_start;
245-
abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size);
246238
void mmap_reserve(abi_ulong start, abi_ulong size);
247-
void TSA_NO_TSA mmap_fork_start(void);
248-
void TSA_NO_TSA mmap_fork_end(int child);
249239

250240
/* main.c */
251241
extern char qemu_proc_pathname[];

bsd-user/signal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ void process_pending_signals(CPUArchState *env)
10341034
void cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr,
10351035
MMUAccessType access_type, bool maperr, uintptr_t ra)
10361036
{
1037-
const TCGCPUOps *tcg_ops = CPU_GET_CLASS(cpu)->tcg_ops;
1037+
const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;
10381038

10391039
if (tcg_ops->record_sigsegv) {
10401040
tcg_ops->record_sigsegv(cpu, addr, access_type, maperr, ra);
@@ -1050,7 +1050,7 @@ void cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr,
10501050
void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr,
10511051
MMUAccessType access_type, uintptr_t ra)
10521052
{
1053-
const TCGCPUOps *tcg_ops = CPU_GET_CLASS(cpu)->tcg_ops;
1053+
const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;
10541054

10551055
if (tcg_ops->record_sigbus) {
10561056
tcg_ops->record_sigbus(cpu, addr, access_type, ra);

cpu-common.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,10 @@ void process_queued_cpu_work(CPUState *cpu)
388388
int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
389389
CPUBreakpoint **breakpoint)
390390
{
391-
CPUClass *cc = CPU_GET_CLASS(cpu);
392391
CPUBreakpoint *bp;
393392

394-
if (cc->gdb_adjust_breakpoint) {
395-
pc = cc->gdb_adjust_breakpoint(cpu, pc);
393+
if (cpu->cc->gdb_adjust_breakpoint) {
394+
pc = cpu->cc->gdb_adjust_breakpoint(cpu, pc);
396395
}
397396

398397
bp = g_malloc(sizeof(*bp));
@@ -418,11 +417,10 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
418417
/* Remove a specific breakpoint. */
419418
int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags)
420419
{
421-
CPUClass *cc = CPU_GET_CLASS(cpu);
422420
CPUBreakpoint *bp;
423421

424-
if (cc->gdb_adjust_breakpoint) {
425-
pc = cc->gdb_adjust_breakpoint(cpu, pc);
422+
if (cpu->cc->gdb_adjust_breakpoint) {
423+
pc = cpu->cc->gdb_adjust_breakpoint(cpu, pc);
426424
}
427425

428426
QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {

0 commit comments

Comments
 (0)