Skip to content

Commit

Permalink
qemu-common: Move tcg_enabled() etc. to sysemu/tcg.h
Browse files Browse the repository at this point in the history
Other accelerators have their own headers: sysemu/hax.h, sysemu/hvf.h,
sysemu/kvm.h, sysemu/whpx.h.  Only tcg_enabled() & friends sit in
qemu-common.h.  This necessitates inclusion of qemu-common.h into
headers, which is against the rules spelled out in qemu-common.h's
file comment.

Move tcg_enabled() & friends into their own header sysemu/tcg.h, and
adjust #include directives.

Cc: Richard Henderson <rth@twiddle.net>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190523143508.25387-2-armbru@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[Rebased with conflicts resolved automatically, except for
accel/tcg/tcg-all.c]
  • Loading branch information
Markus Armbruster committed Jun 11, 2019
1 parent a578cdf commit 14a48c1
Show file tree
Hide file tree
Showing 33 changed files with 56 additions and 18 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Expand Up @@ -125,6 +125,7 @@ F: include/exec/exec-all.h
F: include/exec/helper*.h
F: include/exec/tb-hash.h
F: include/sysemu/cpus.h
F: include/sysemu/tcg.h

FPU emulation
M: Aurelien Jarno <aurelien@aurel32.net>
Expand Down
1 change: 1 addition & 0 deletions accel/tcg/cpu-exec-common.c
Expand Up @@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "sysemu/cpus.h"
#include "sysemu/tcg.h"
#include "exec/exec-all.h"

bool tcg_allowed;
Expand Down
2 changes: 1 addition & 1 deletion accel/tcg/tcg-all.c
Expand Up @@ -26,8 +26,8 @@
#include "qemu/osdep.h"
#include "sysemu/accel.h"
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "qom/object.h"
#include "qemu-common.h"
#include "cpu.h"
#include "sysemu/cpus.h"
#include "qemu/main-loop.h"
Expand Down
3 changes: 2 additions & 1 deletion accel/tcg/translate-all.c
Expand Up @@ -16,9 +16,9 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/

#include "qemu/osdep.h"

#include "qemu-common.h"
#define NO_CPU_IO_DEFS
#include "cpu.h"
#include "trace.h"
Expand Down Expand Up @@ -55,6 +55,7 @@
#include "qemu/main-loop.h"
#include "exec/log.h"
#include "sysemu/cpus.h"
#include "sysemu/tcg.h"

/* #define DEBUG_TB_INVALIDATE */
/* #define DEBUG_TB_FLUSH */
Expand Down
2 changes: 2 additions & 0 deletions bsd-user/main.c
Expand Up @@ -16,8 +16,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/

#include "qemu/osdep.h"
#include "qemu/units.h"
#include "sysemu/tcg.h"
#include "qemu-version.h"
#include <machine/trap.h>

Expand Down
1 change: 1 addition & 0 deletions cpus.c
Expand Up @@ -33,6 +33,7 @@
#include "qemu/error-report.h"
#include "qemu/qemu-print.h"
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "sysemu/block-backend.h"
#include "exec/gdbstub.h"
#include "sysemu/dma.h"
Expand Down
2 changes: 2 additions & 0 deletions exec.c
Expand Up @@ -16,6 +16,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/

#include "qemu/osdep.h"
#include "qapi/error.h"

Expand All @@ -32,6 +33,7 @@
#endif
#include "sysemu/kvm.h"
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "qemu/timer.h"
#include "qemu/config-file.h"
#include "qemu/error-report.h"
Expand Down
1 change: 1 addition & 0 deletions hw/i386/pc.c
Expand Up @@ -50,6 +50,7 @@
#include "hw/pci/msi.h"
#include "hw/sysbus.h"
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "sysemu/numa.h"
#include "sysemu/kvm.h"
#include "sysemu/qtest.h"
Expand Down
2 changes: 2 additions & 0 deletions hw/ppc/spapr_caps.c
Expand Up @@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
Expand All @@ -32,6 +33,7 @@
#include "cpu-models.h"
#include "kvm_ppc.h"
#include "sysemu/qtest.h"
#include "sysemu/tcg.h"

#include "hw/ppc/spapr.h"

Expand Down
1 change: 1 addition & 0 deletions hw/s390x/ipl.c
Expand Up @@ -14,6 +14,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "cpu.h"
#include "elf.h"
#include "hw/loader.h"
Expand Down
1 change: 1 addition & 0 deletions include/exec/ram_addr.h
Expand Up @@ -21,6 +21,7 @@

#ifndef CONFIG_USER_ONLY
#include "hw/xen/xen.h"
#include "sysemu/tcg.h"
#include "exec/ramlist.h"

struct RAMBlock {
Expand Down
8 changes: 0 additions & 8 deletions include/qemu-common.h
Expand Up @@ -77,14 +77,6 @@ int qemu_openpty_raw(int *aslave, char *pty_name);
sendto(sockfd, buf, len, flags, destaddr, addrlen)
#endif

extern bool tcg_allowed;
void tcg_exec_init(unsigned long tb_size);
#ifdef CONFIG_TCG
#define tcg_enabled() (tcg_allowed)
#else
#define tcg_enabled() 0
#endif

void cpu_exec_init_all(void);
void cpu_exec_step_atomic(CPUState *cpu);

Expand Down
19 changes: 19 additions & 0 deletions include/sysemu/tcg.h
@@ -0,0 +1,19 @@
/*
* QEMU TCG support
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/

#ifndef SYSEMU_TCG_H
#define SYSEMU_TCG_H

extern bool tcg_allowed;
void tcg_exec_init(unsigned long tb_size);
#ifdef CONFIG_TCG
#define tcg_enabled() (tcg_allowed)
#else
#define tcg_enabled() 0
#endif

#endif
2 changes: 2 additions & 0 deletions linux-user/main.c
Expand Up @@ -16,8 +16,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/

#include "qemu/osdep.h"
#include "qemu/units.h"
#include "sysemu/tcg.h"
#include "qemu-version.h"
#include <sys/syscall.h>
#include <sys/resource.h>
Expand Down
2 changes: 1 addition & 1 deletion memory.c
Expand Up @@ -15,7 +15,6 @@

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "cpu.h"
#include "exec/memory.h"
#include "exec/address-spaces.h"
Expand All @@ -30,6 +29,7 @@
#include "exec/ram_addr.h"
#include "sysemu/kvm.h"
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"

Expand Down
1 change: 1 addition & 0 deletions monitor.c
Expand Up @@ -53,6 +53,7 @@
#include "sysemu/hw_accel.h"
#include "authz/list.h"
#include "qapi/util.h"
#include "sysemu/tcg.h"
#include "sysemu/tpm.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
Expand Down
1 change: 1 addition & 0 deletions qemu-nbd.c
Expand Up @@ -21,6 +21,7 @@
#include <libgen.h>
#include <pthread.h>

#include "qemu-common.h"
#include "qapi/error.h"
#include "qemu/cutils.h"
#include "sysemu/block-backend.h"
Expand Down
2 changes: 1 addition & 1 deletion qom/cpu.c
Expand Up @@ -20,7 +20,6 @@

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qom/cpu.h"
#include "sysemu/hw_accel.h"
#include "qemu/notify.h"
Expand All @@ -30,6 +29,7 @@
#include "qemu/error-report.h"
#include "qemu/qemu-print.h"
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "hw/boards.h"
#include "hw/qdev-properties.h"
#include "trace-root.h"
Expand Down
2 changes: 1 addition & 1 deletion target/arm/cpu.c
Expand Up @@ -24,13 +24,13 @@
#include "qapi/visitor.h"
#include "cpu.h"
#include "internals.h"
#include "qemu-common.h"
#include "exec/exec-all.h"
#include "hw/qdev-properties.h"
#if !defined(CONFIG_USER_ONLY)
#include "hw/loader.h"
#endif
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "sysemu/hw_accel.h"
#include "kvm_arm.h"
#include "disas/capstone.h"
Expand Down
1 change: 1 addition & 0 deletions target/i386/cpu.c
Expand Up @@ -47,6 +47,7 @@
#include "standard-headers/asm-x86/kvm_para.h"

#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "hw/qdev-properties.h"
#include "hw/i386/topology.h"
#ifndef CONFIG_USER_ONLY
Expand Down
2 changes: 1 addition & 1 deletion target/i386/cpu.h
Expand Up @@ -20,7 +20,7 @@
#ifndef I386_CPU_H
#define I386_CPU_H

#include "qemu-common.h"
#include "sysemu/tcg.h"
#include "cpu-qom.h"
#include "hyperv-proto.h"
#include "exec/cpu-defs.h"
Expand Down
1 change: 1 addition & 0 deletions target/i386/helper.c
Expand Up @@ -25,6 +25,7 @@
#include "kvm_i386.h"
#ifndef CONFIG_USER_ONLY
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "sysemu/hw_accel.h"
#include "monitor/monitor.h"
#include "hw/i386/apic_internal.h"
Expand Down
2 changes: 1 addition & 1 deletion target/i386/machine.c
@@ -1,5 +1,4 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "cpu.h"
#include "exec/exec-all.h"
#include "hw/hw.h"
Expand All @@ -10,6 +9,7 @@
#include "hyperv.h"

#include "sysemu/kvm.h"
#include "sysemu/tcg.h"

#include "qemu/error-report.h"

Expand Down
1 change: 1 addition & 0 deletions target/ppc/translate_init.inc.c
Expand Up @@ -24,6 +24,7 @@
#include "sysemu/arch_init.h"
#include "sysemu/cpus.h"
#include "sysemu/hw_accel.h"
#include "sysemu/tcg.h"
#include "cpu-models.h"
#include "mmu-hash32.h"
#include "mmu-hash64.h"
Expand Down
2 changes: 1 addition & 1 deletion target/s390x/cpu.c
Expand Up @@ -26,7 +26,6 @@
#include "internal.h"
#include "kvm_s390x.h"
#include "sysemu/kvm.h"
#include "qemu-common.h"
#include "qemu/timer.h"
#include "qemu/error-report.h"
#include "trace.h"
Expand All @@ -39,6 +38,7 @@
#include "hw/hw.h"
#include "sysemu/arch_init.h"
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#endif
#include "fpu/softfloat.h"

Expand Down
1 change: 1 addition & 0 deletions target/s390x/cpu_models.c
Expand Up @@ -15,6 +15,7 @@
#include "internal.h"
#include "kvm_s390x.h"
#include "sysemu/kvm.h"
#include "sysemu/tcg.h"
#include "qapi/error.h"
#include "qapi/visitor.h"
#include "qemu/error-report.h"
Expand Down
3 changes: 2 additions & 1 deletion target/s390x/gdbstub.c
Expand Up @@ -17,14 +17,15 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/

#include "qemu/osdep.h"
#include "qemu-common.h"
#include "cpu.h"
#include "internal.h"
#include "exec/exec-all.h"
#include "exec/gdbstub.h"
#include "qemu/bitops.h"
#include "sysemu/hw_accel.h"
#include "sysemu/tcg.h"

int s390_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
{
Expand Down
1 change: 1 addition & 0 deletions target/s390x/helper.c
Expand Up @@ -28,6 +28,7 @@
#include "sysemu/hw_accel.h"
#ifndef CONFIG_USER_ONLY
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#endif

#ifndef CONFIG_USER_ONLY
Expand Down
1 change: 1 addition & 0 deletions target/s390x/interrupt.c
Expand Up @@ -14,6 +14,7 @@
#include "internal.h"
#include "exec/exec-all.h"
#include "sysemu/kvm.h"
#include "sysemu/tcg.h"
#include "hw/s390x/ioinst.h"
#include "tcg_s390x.h"
#if !defined(CONFIG_USER_ONLY)
Expand Down
1 change: 1 addition & 0 deletions target/s390x/machine.c
Expand Up @@ -21,6 +21,7 @@
#include "kvm_s390x.h"
#include "tcg_s390x.h"
#include "sysemu/kvm.h"
#include "sysemu/tcg.h"

static int cpu_post_load(void *opaque, int version_id)
{
Expand Down
1 change: 1 addition & 0 deletions target/s390x/mmu_helper.c
Expand Up @@ -22,6 +22,7 @@
#include "internal.h"
#include "kvm_s390x.h"
#include "sysemu/kvm.h"
#include "sysemu/tcg.h"
#include "exec/exec-all.h"
#include "trace.h"
#include "hw/s390x/storage-keys.h"
Expand Down
2 changes: 1 addition & 1 deletion target/s390x/sigp.c
Expand Up @@ -9,13 +9,13 @@
*/

#include "qemu/osdep.h"
#include "qemu-common.h"
#include "cpu.h"
#include "internal.h"
#include "sysemu/hw_accel.h"
#include "exec/address-spaces.h"
#include "exec/exec-all.h"
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "trace.h"
#include "qapi/qapi-types-misc.h"

Expand Down
1 change: 1 addition & 0 deletions vl.c
Expand Up @@ -30,6 +30,7 @@
#include "qemu/help_option.h"
#include "qemu/uuid.h"
#include "sysemu/seccomp.h"
#include "sysemu/tcg.h"

#ifdef CONFIG_SDL
#if defined(__APPLE__) || defined(main)
Expand Down

0 comments on commit 14a48c1

Please sign in to comment.