unicorn/qemu
Bharata B Rao 309b85548f
cpu: Convert cpu_index into a bitmap
Currently CPUState::cpu_index is monotonically increasing and a newly
created CPU always gets the next higher index. The next available
index is calculated by counting the existing number of CPUs. This is
fine as long as we only add CPUs, but there are architectures which
are starting to support CPU removal, too. For an architecture like PowerPC
which derives its CPU identifier (device tree ID) from cpu_index, the
existing logic of generating cpu_index values causes problems.

With the currently proposed method of handling vCPU removal by parking
the vCPU fd in QEMU
(Ref: http://lists.gnu.org/archive/html/qemu-devel/2015-02/msg02604.html),
generating cpu_index this way will not work for PowerPC.

This patch changes the way cpu_index is handed out by maintaining
a bit map of the CPUs that tracks both addition and removal of CPUs.

The CPU bitmap allocation logic is part of cpu_exec_init(), which is
called by instance_init routines of various CPU targets. Newly added
cpu_exec_exit() API handles the deallocation part and this routine is
called from generic CPU instance_finalize.

Note: This new CPU enumeration is for !CONFIG_USER_ONLY only.
CONFIG_USER_ONLY continues to have the old enumeration logic.

Backports commit b7bca7333411bd19c449147e8202ae6b0e4a8e09 from qemu
2018-03-21 08:06:07 -04:00
..
accel cpu-exec: fix exception_index handling 2018-03-17 19:33:05 -04:00
crypto
default-configs
docs
fpu
hw Use cpu_create(type) instead of cpu_init(cpu_model) 2018-03-20 14:20:30 -04:00
include cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
qapi qapi: Make more of qobject_to() 2018-03-20 11:05:44 -04:00
qobject qobject: introduce qobject_get_try_str() 2018-03-20 11:10:03 -04:00
qom cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
scripts
target cpu: Add Error argument to cpu_exec_init() 2018-03-21 07:50:33 -04:00
tcg tcg/i386: Perform comparison pass against qemu 2018-03-20 06:29:06 -04:00
util membarrier: add --enable-membarrier 2018-03-17 19:30:43 -04:00
aarch64.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
aarch64eb.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
accel.c
arm.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
armeb.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
CODING_STYLE
configure use _Static_assert in QEMU_BUILD_BUG_ON 2018-03-20 10:42:20 -04:00
COPYING
COPYING.LIB
cpus.c
exec.c cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
gen_all_header.sh
glib_compat.c Use cpu_create(type) instead of cpu_init(cpu_model) 2018-03-20 14:20:30 -04:00
HACKING
header_gen.py cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
ioport.c
LICENSE
m68k.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
Makefile
Makefile.objs
Makefile.target tcg: move tcg backend files into accel/tcg/ 2018-03-13 11:48:15 -04:00
memory_ldst.inc.c exec: Drop unnecessary code for unicorn 2018-03-12 10:11:46 -04:00
memory_mapping.c
memory.c
mips64.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
mips64el.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
mips.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
mipsel.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
powerpc.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
qemu-timer.c
rules.mak
sparc64.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
sparc.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
unicorn_common.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
VERSION
vl.c Use cpu_create(type) instead of cpu_init(cpu_model) 2018-03-20 14:20:30 -04:00
vl.h
x86_64.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00