From patchwork Thu Jan 19 17:05:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 92011 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp399985qgi; Thu, 19 Jan 2017 09:56:31 -0800 (PST) X-Received: by 10.55.80.65 with SMTP id e62mr9918325qkb.126.1484848590970; Thu, 19 Jan 2017 09:56:30 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f186si3086707qka.137.2017.01.19.09.56.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 19 Jan 2017 09:56:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUGwm-0001rW-I1 for patch@linaro.org; Thu, 19 Jan 2017 12:56:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUGGU-0005U0-RS for qemu-devel@nongnu.org; Thu, 19 Jan 2017 12:12:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUGGS-0001fJ-8i for qemu-devel@nongnu.org; Thu, 19 Jan 2017 12:12:46 -0500 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:38769) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cUGGS-0001ep-2A for qemu-devel@nongnu.org; Thu, 19 Jan 2017 12:12:44 -0500 Received: by mail-wm0-x236.google.com with SMTP id r144so3073015wme.1 for ; Thu, 19 Jan 2017 09:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mvF6T9Ti2bxpMYSrZa1lGtoKS/qouee7DTUS20UAtY4=; b=Q6mGeVRQ/H04YoXNmRLvvSBMt/GyLVK/0/OyYzs3k3vQrc4MAMfCHzaw3E481rMgwZ B1uJlCFzu8/4QVaSzNAprMYW5SGALsuVT/kAc5YV0ainXQC0VDjSd3j6MuEC19YXNTQ3 q8pneRhDJucSoHt2O6SAPNoAcDLQtIOqPDbKE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mvF6T9Ti2bxpMYSrZa1lGtoKS/qouee7DTUS20UAtY4=; b=c3EOKN24/e60oFq9xAnfwkIKH2PxlQMax+Q6xiAZBKWTuAszjPxdZgR7lEaqF0I8HJ +2r5eOAArMsZ18BPwaq9xo7SNWa4Tk8sUhxy5uO9E2nPk24tG24nDlXt9Skg+KW7PRD6 WD54S3wyelsICEAkJNV9FJeyEvYQuNc9bEZUMZBo95uif8s+gZ1R+GaeDO1sghbHzdYZ uuThk73vld/QoM5g9iDrCHFFgR2HcyF+8DcyviVkgR/qEOznWZ4hsVUPCXURRaEidWUO bkw0vGzEGMi0klDDcK/AAanJZcln0Onh13LSy2OJ6Ny/OX3Ty2xR2zFwL/KJkADxBS2r UunQ== X-Gm-Message-State: AIkVDXJdyQ0Q5wuia0HaoTu6Fuymr2UcB/g0DOQOraTtV5FdqkZkWvVmqtpR6Kgv5XH67Igm X-Received: by 10.223.151.99 with SMTP id r90mr8148278wrb.183.1484845963053; Thu, 19 Jan 2017 09:12:43 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id d14sm11969644wmd.19.2017.01.19.09.12.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jan 2017 09:12:42 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 8382F3E29F7; Thu, 19 Jan 2017 17:05:09 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: mttcg@listserver.greensocs.com, qemu-devel@nongnu.org, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, bobby.prani@gmail.com, nikunj@linux.vnet.ibm.com Date: Thu, 19 Jan 2017 17:05:04 +0000 Message-Id: <20170119170507.16185-25-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170119170507.16185-1-alex.bennee@linaro.org> References: <20170119170507.16185-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::236 Subject: [Qemu-devel] [PATCH v7 24/27] target-arm: introduce ARM_CP_EXIT_PC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, claudio.fontana@huawei.com, jan.kiszka@siemens.com, mark.burton@greensocs.com, "open list:ARM" , serge.fdrv@gmail.com, pbonzini@redhat.com, =?utf-8?q?Alex_Benn=C3=A9e?= , bamvor.zhangjian@linaro.org, rth@twiddle.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Some helpers may trigger an immediate exit of the cpu_loop. If this happens the PC need to be rectified to ensure the restart will begin on the next instruction. Signed-off-by: Alex Bennée --- target/arm/cpu.h | 3 ++- target/arm/translate-a64.c | 4 ++++ target/arm/translate.c | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 366b619b8a..29d15fc522 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1402,7 +1402,8 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid) #define ARM_CP_NZCV (ARM_CP_SPECIAL | (3 << 8)) #define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | (4 << 8)) #define ARM_CP_DC_ZVA (ARM_CP_SPECIAL | (5 << 8)) -#define ARM_LAST_SPECIAL ARM_CP_DC_ZVA +#define ARM_CP_EXIT_PC (ARM_CP_SPECIAL | (6 << 8)) +#define ARM_LAST_SPECIAL ARM_CP_EXIT_PC /* Used only as a terminator for ARMCPRegInfo lists */ #define ARM_CP_SENTINEL 0xffff /* Mask of only the flag bits in a type field */ diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 7e7131fe2f..98d4fac070 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1561,6 +1561,10 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, tcg_rt = cpu_reg(s, rt); gen_helper_dc_zva(cpu_env, tcg_rt); return; + case ARM_CP_EXIT_PC: + /* The helper may exit the cpu_loop so ensure PC is correct */ + gen_a64_set_pc_im(s->pc); + break; default: break; } diff --git a/target/arm/translate.c b/target/arm/translate.c index 4301562527..e9f46eb757 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7510,6 +7510,10 @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn) gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_WFI; return 0; + case ARM_CP_EXIT_PC: + /* The helper may exit the cpu_loop so ensure PC is correct */ + gen_set_pc_im(s, s->pc); + break; default: break; }