From patchwork Mon Jan 27 12:01:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 314376 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id F1FE22C0092 for ; Mon, 27 Jan 2014 23:04:39 +1100 (EST) Received: from localhost ([::1]:59096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7kvc-0004EY-Vn for incoming@patchwork.ozlabs.org; Mon, 27 Jan 2014 07:04:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7ksj-0008BR-E0 for qemu-devel@nongnu.org; Mon, 27 Jan 2014 07:01:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7ksX-00080O-Rz for qemu-devel@nongnu.org; Mon, 27 Jan 2014 07:01:37 -0500 Received: from smtp.citrix.com ([66.165.176.89]:8988) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7ksX-0007zr-LB for qemu-devel@nongnu.org; Mon, 27 Jan 2014 07:01:25 -0500 X-IronPort-AV: E=Sophos;i="4.95,728,1384300800"; d="scan'208";a="96770439" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 27 Jan 2014 12:01:16 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.2.342.4; Mon, 27 Jan 2014 07:01:16 -0500 Received: from dt47.uk.xensource.com ([10.80.229.47] helo=dt47.uk.xensource.com.) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1W7ksN-0000QC-1x; Mon, 27 Jan 2014 12:01:15 +0000 From: Wei Liu To: , Date: Mon, 27 Jan 2014 12:01:13 +0000 Message-ID: <1390824074-21006-6-git-send-email-wei.liu2@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1390824074-21006-1-git-send-email-wei.liu2@citrix.com> References: <1390824074-21006-1-git-send-email-wei.liu2@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Cc: anthony.perard@citrix.com, peter.maydell@linaro.org, pbonzini@redhat.com, Wei Liu , stefano.stabellini@eu.citrix.com Subject: [Qemu-devel] [PATCH RFC V2 5/6] xen: implement Xen PV target X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Basically it's a dummy CPU that doens't do anything. This patch contains necessary hooks to make QEMU compile. Signed-off-by: Wei Liu --- arch_init.c | 2 ++ cpu-exec.c | 2 ++ include/sysemu/arch_init.h | 1 + target-xenpv/Makefile.objs | 1 + target-xenpv/cpu-qom.h | 64 ++++++++++++++++++++++++++++++++++++++++++ target-xenpv/cpu.h | 66 ++++++++++++++++++++++++++++++++++++++++++++ target-xenpv/helper.c | 32 +++++++++++++++++++++ target-xenpv/translate.c | 27 ++++++++++++++++++ 8 files changed, 195 insertions(+) create mode 100644 target-xenpv/Makefile.objs create mode 100644 target-xenpv/cpu-qom.h create mode 100644 target-xenpv/cpu.h create mode 100644 target-xenpv/helper.c create mode 100644 target-xenpv/helper.h create mode 100644 target-xenpv/translate.c diff --git a/arch_init.c b/arch_init.c index e0acbc5..a15de61 100644 --- a/arch_init.c +++ b/arch_init.c @@ -101,6 +101,8 @@ int graphic_depth = 32; #define QEMU_ARCH QEMU_ARCH_XTENSA #elif defined(TARGET_UNICORE32) #define QEMU_ARCH QEMU_ARCH_UNICORE32 +#elif defined(TARGET_XENPV) +#define QEMU_ARCH QEMU_ARCH_XENPV #endif const uint32_t arch_type = QEMU_ARCH; diff --git a/cpu-exec.c b/cpu-exec.c index 30cfa2a..531e92a 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -258,6 +258,7 @@ int cpu_exec(CPUArchState *env) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) #elif defined(TARGET_XTENSA) +#elif defined(TARGET_XENPV) /* XXXXX */ #else #error unsupported target CPU @@ -713,6 +714,7 @@ int cpu_exec(CPUArchState *env) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) #elif defined(TARGET_XTENSA) +#elif defined(TARGET_XENPV) /* XXXXX */ #else #error unsupported target CPU diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h index be71bca..66ea63f 100644 --- a/include/sysemu/arch_init.h +++ b/include/sysemu/arch_init.h @@ -22,6 +22,7 @@ enum { QEMU_ARCH_OPENRISC = 8192, QEMU_ARCH_UNICORE32 = 0x4000, QEMU_ARCH_MOXIE = 0x8000, + QEMU_ARCH_XENPV = 0x10000, }; extern const uint32_t arch_type; diff --git a/target-xenpv/Makefile.objs b/target-xenpv/Makefile.objs new file mode 100644 index 0000000..8a60866 --- /dev/null +++ b/target-xenpv/Makefile.objs @@ -0,0 +1 @@ +obj-y += helper.o translate.o diff --git a/target-xenpv/cpu-qom.h b/target-xenpv/cpu-qom.h new file mode 100644 index 0000000..61135a6 --- /dev/null +++ b/target-xenpv/cpu-qom.h @@ -0,0 +1,64 @@ +/* + * QEMU XenPV CPU + * + * Copyright (c) 2014 Citrix Systems UK Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see + * + */ +#ifndef QEMU_XENPV_CPU_QOM_H +#define QEMU_XENPV_CPU_QOM_H + +#include "qom/cpu.h" +#include "cpu.h" +#include "qapi/error.h" + +#define TYPE_XENPV_CPU "xenpv-cpu" + +/** + * XenPVCPUClass: + * @parent_realize: The parent class' realize handler. + * @parent_reset: The parent class' reset handler. + * + */ +typedef struct XenPVCPUClass { + /*< private >*/ + CPUClass parent_class; + /*< public >*/ + + DeviceRealize parent_realize; + void (*parent_reset)(CPUState *cpu); +} XenPVCPUClass; + +/** + * XenPVCPU: + * @env: #CPUXenPVState + * + */ +typedef struct XenPVCPU { + /*< private >*/ + CPUState parent_obj; + /*< public >*/ + CPUXenPVState env; +} XenPVCPU; + +static inline XenPVCPU *noarch_env_get_cpu(CPUXenPVState *env) +{ + return container_of(env, XenPVCPU, env); +} + +#define ENV_GET_CPU(e) CPU(noarch_env_get_cpu(e)) + +#endif + diff --git a/target-xenpv/cpu.h b/target-xenpv/cpu.h new file mode 100644 index 0000000..0e65707 --- /dev/null +++ b/target-xenpv/cpu.h @@ -0,0 +1,66 @@ +/* + * XenPV virtual CPU header + * + * Copyright (c) 2014 Citrix Systems UK Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ +#ifndef CPU_XENPV_H +#define CPU_XENPV_H + +#include "config.h" +#include "qemu-common.h" + +#define TARGET_LONG_BITS 64 +#define TARGET_PAGE_BITS 12 +#define TARGET_PHYS_ADDR_SPACE_BITS 52 +#define TARGET_VIRT_ADDR_SPACE_BITS 47 +#define NB_MMU_MODES 1 + +#define CPUArchState struct CPUXenPVState + +#include "exec/cpu-defs.h" + +typedef struct CPUXenPVState { + CPU_COMMON +} CPUXenPVState; + +#include "cpu-qom.h" + +static inline int cpu_mmu_index (CPUXenPVState *env) +{ + abort(); +} + +static inline void cpu_get_tb_cpu_state(CPUXenPVState *env, target_ulong *pc, + target_ulong *cs_base, int *flags) +{ + abort(); +} + +static inline bool cpu_has_work(CPUState *cs) +{ + abort(); + return false; +} + +int cpu_xenpv_exec(CPUXenPVState *s); +#define cpu_exec cpu_xenpv_exec + +#include "exec/cpu-all.h" + +#include "exec/exec-all.h" + +#endif /* CPU_XENPV_H */ + diff --git a/target-xenpv/helper.c b/target-xenpv/helper.c new file mode 100644 index 0000000..225a063 --- /dev/null +++ b/target-xenpv/helper.c @@ -0,0 +1,32 @@ +#include "cpu.h" +#include "helper.h" +#if !defined(CONFIG_USER_ONLY) +#include "exec/softmmu_exec.h" +#endif + +#if !defined(CONFIG_USER_ONLY) + +#define MMUSUFFIX _mmu + +#define SHIFT 0 +#include "exec/softmmu_template.h" + +#define SHIFT 1 +#include "exec/softmmu_template.h" + +#define SHIFT 2 +#include "exec/softmmu_template.h" + +#define SHIFT 3 +#include "exec/softmmu_template.h" + +#endif + +#if !defined(CONFIG_USER_ONLY) +void tlb_fill(CPUXenPVState *env, target_ulong addr, int is_write, + int mmu_idx, uintptr_t retaddr) +{ + abort(); +} +#endif + diff --git a/target-xenpv/helper.h b/target-xenpv/helper.h new file mode 100644 index 0000000..e69de29 diff --git a/target-xenpv/translate.c b/target-xenpv/translate.c new file mode 100644 index 0000000..4bc84e5 --- /dev/null +++ b/target-xenpv/translate.c @@ -0,0 +1,27 @@ +#include +#include "qemu/host-utils.h" +#include "cpu.h" +#include "disas/disas.h" +#include "tcg-op.h" + +#include "helper.h" +#define GEN_HELPER 1 +#include "helper.h" + +void gen_intermediate_code(CPUXenPVState *env, TranslationBlock *tb) +{ + abort(); +} + +void gen_intermediate_code_pc(CPUXenPVState *env, TranslationBlock *tb) +{ + abort(); +} + +void restore_state_to_opc(CPUXenPVState *env, TranslationBlock *tb, + int pc_pos) +{ + abort(); +} + +