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 crypto: Clean up includes 2018-02-19 00:47:40 -05:00
default-configs arm64eb: add support for ARM64 big endian. 2017-04-24 23:30:01 +08:00
docs docs: clarify memory region lifecycle 2018-02-12 15:11:21 -05:00
fpu softfloat: fix crash on int conversion of SNaN 2018-03-09 11:40:17 -05:00
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 qapi: Move qapi-schema.json to qapi/, rename generated files 2018-03-09 11:35:11 -05:00
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 clean-up: removed duplicate #includes 2018-02-28 08:51:56 -05:00
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 Include qapi/error.h exactly where needed 2018-03-07 12:26:38 -05:00
exec.c cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
gen_all_header.sh arm64eb: add support for ARM64 big endian. 2017-04-24 23:30:01 +08:00
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 hw: remove pio_addr_t 2018-02-24 02:43:16 -05:00
LICENSE
m68k.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
Makefile qapi: Don't create useless directory qapi-generated 2018-03-09 11:36:49 -05:00
Makefile.objs qapi: Move qapi-schema.json to qapi/, rename generated files 2018-03-09 11:35:11 -05:00
Makefile.target tcg: move tcg backend files into accel/tcg/ 2018-03-13 11:48:15 -04:00
memory.c memory: Share special empty FlatView 2018-03-11 22:34:28 -04:00
memory_ldst.inc.c exec: Drop unnecessary code for unicorn 2018-03-12 10:11:46 -04:00
memory_mapping.c include/qemu/osdep.h: Don't include qapi/error.h 2018-02-21 23:08:18 -05:00
mips.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
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
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 timer/cpus: fix some typos and update some comments 2018-02-25 23:21:57 -05:00
rules.mak build-sys: silence make by default or V=0 2018-03-06 08:58:03 -05:00
sparc.h cpu: Convert cpu_index into a bitmap 2018-03-21 08:06:07 -04:00
sparc64.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