From patchwork Mon Sep 4 12:26:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 111590 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp1492056qge; Mon, 4 Sep 2017 05:56:21 -0700 (PDT) X-Google-Smtp-Source: ADKCNb6yzEnUZH2K4/w8sdC2tvIzyGgPK7jLKkr9gUDwpRiZM5tH9gwTvPKguazH6l+oxdSCxDDY X-Received: by 10.200.23.236 with SMTP id r41mr529268qtk.258.1504529781013; Mon, 04 Sep 2017 05:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504529781; cv=none; d=google.com; s=arc-20160816; b=r/LuyfhMJkaiHSVRqvNlkmMEf6mxEgD8fLdPDM2H9BPVUhA+KXwiacXhiEj6sexhjW pzYdJd2FJXZmXCy8Uc3CxZG+t7q5dtDdgHnWXoHX2G8xbxwG6gLKwOK0r7ZB3PVU7WPM DICf4DCOoBpj2mNMdTZqzlomRwY/c2zQMM397Xi/6+Yv0jLzKzSzHsRy4w/OhA/z+WK2 gL0zEQ3JlDjIegiHyDUuU1xrqe4cQyJxdQQ9QK+tp6aqzMmFaadqLsZqaB5OXoNah1In LxHvJ8Ff/lhM7Lpp6MmlJcGhaCPgyaXOBNJrvNXsIxKqaeeOkRU8qFa9mSajUzzn+cVQ kzuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=2hZ4/+gSr5++lUrr16fodZacO0hjyiD4584hAcEXYJs=; b=hBVL/BV0F/5c/IKq77WkouWR33XbV4yZxM22d7XqQdxP8lGXzqvCLVlO5EYmu2sbR6 bmcErYKSp+ZLmSazopHAEgfgWp3EF3LN8TE/uRUPKPud8Fw8VHM4y4La9ggHxUPkdIVg 4sOi4Uzm5EqBsCEpRMEEbsRpdiAFLPFo4yAw0mityM/NJGMB1qBcAX4VIkj2xEfuKOeW A3zkjEp71wE2lZXWmW/MghvQ8vjwoUVkJ8wg27maiPHqVQH11ds2ApCBtGnMnUyFcIjT idtGGvlfWPHU/PZpG1pgpk0VXoO+WvVVS/1TgOstkMfPMEuUswLkOg0zPjnMPkpIFsyw AyPQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n5si5439960qkf.251.2017.09.04.05.56.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 04 Sep 2017 05:56:21 -0700 (PDT) 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; 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]:59893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1doqvK-0002sY-Ro for patch@linaro.org; Mon, 04 Sep 2017 08:56:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1doqSh-0005Da-3s for qemu-devel@nongnu.org; Mon, 04 Sep 2017 08:26:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doqSU-0004xg-6N for qemu-devel@nongnu.org; Mon, 04 Sep 2017 08:26:43 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:37136) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1doqST-0004xA-VI for qemu-devel@nongnu.org; Mon, 04 Sep 2017 08:26:30 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1doqSS-0005cg-UN for qemu-devel@nongnu.org; Mon, 04 Sep 2017 13:26:28 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 4 Sep 2017 13:26:02 +0100 Message-Id: <1504527967-29248-32-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504527967-29248-1-git-send-email-peter.maydell@linaro.org> References: <1504527967-29248-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 31/36] target/arm: Allow deliver_fault() caller to specify EA bit 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For external aborts, we will want to be able to specify the EA (external abort type) bit in the syndrome field. Allow callers of deliver_fault() to do that by adding a field to ARMMMUFaultInfo which we use when constructing the syndrome values. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Edgar E. Iglesias --- target/arm/internals.h | 2 ++ target/arm/op_helper.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/target/arm/internals.h b/target/arm/internals.h index bb06946..461f558 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -448,12 +448,14 @@ void arm_handle_psci_call(ARMCPU *cpu); * @s2addr: Address that caused a fault at stage 2 * @stage2: True if we faulted at stage 2 * @s1ptw: True if we faulted at stage 2 while doing a stage 1 page-table walk + * @ea: True if we should set the EA (external abort type) bit in syndrome */ typedef struct ARMMMUFaultInfo ARMMMUFaultInfo; struct ARMMMUFaultInfo { target_ulong s2addr; bool stage2; bool s1ptw; + bool ea; }; /* Do a page table walk and add page to TLB if possible */ diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 6114597..8f6db80 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -80,7 +80,7 @@ uint32_t HELPER(neon_tbl)(CPUARMState *env, uint32_t ireg, uint32_t def, static inline uint32_t merge_syn_data_abort(uint32_t template_syn, unsigned int target_el, - bool same_el, + bool same_el, bool ea, bool s1ptw, bool is_write, int fsc) { @@ -99,7 +99,7 @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, */ if (!(template_syn & ARM_EL_ISV) || target_el != 2 || s1ptw) { syn = syn_data_abort_no_iss(same_el, - 0, 0, s1ptw, is_write, fsc); + ea, 0, s1ptw, is_write, fsc); } else { /* Fields: IL, ISV, SAS, SSE, SRT, SF and AR come from the template * syndrome created at translation time. @@ -107,7 +107,7 @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, */ syn = syn_data_abort_with_iss(same_el, 0, 0, 0, 0, 0, - 0, 0, s1ptw, is_write, fsc, + ea, 0, s1ptw, is_write, fsc, false); /* Merge the runtime syndrome with the template syndrome. */ syn |= template_syn; @@ -141,11 +141,11 @@ static void deliver_fault(ARMCPU *cpu, vaddr addr, MMUAccessType access_type, } if (access_type == MMU_INST_FETCH) { - syn = syn_insn_abort(same_el, 0, fi->s1ptw, fsc); + syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc); exc = EXCP_PREFETCH_ABORT; } else { syn = merge_syn_data_abort(env->exception.syndrome, target_el, - same_el, fi->s1ptw, + same_el, fi->ea, fi->s1ptw, access_type == MMU_DATA_STORE, fsc); if (access_type == MMU_DATA_STORE