From patchwork Wed Jul 31 20:38:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 170262 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4478665ile; Wed, 31 Jul 2019 13:48:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCCy1h3daLNAPLm18vNoPn4AkjAoIHmrw/ez60fEoa5P1yY77GjhEi4MPmHFgkQ7pjJfFF X-Received: by 2002:ab0:6881:: with SMTP id t1mr11383434uar.65.1564606123282; Wed, 31 Jul 2019 13:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564606123; cv=none; d=google.com; s=arc-20160816; b=NlSqSpnpYTU2nJ6B3Tq7QnKG9ZSXbbNvRWD2iserBNtuAKisrRN7FflyhXosYp9huc OPurSp3apMP4wPSul3rA7ASfrty/tzpr4inQOFAwN5Lnf7pBBcW8iBo0PnG8lTJd9AHI 42vGggVvWmSaCEzBJ4pmAYgvM6/GsI8Qb1Y3J6hnd1P4oPKoK17N5daNcRR0vQ0xN8RX 2seISsB5riX7+b5zCqbSQnhZzH+OeoramehPjuq+Vl+9vm7GGZ6N3wfRtoPSjen3VKd+ /MEVAj5mp/X4KGlih41eJ7frcTDwzy6disSGB1X7JREG5HshLr13ix1j6IGs1TBMeYEB nORA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=+7keF6G5xzpT4+93ObrzwUEEy1FTEHDioAfRG1ABjog=; b=MRHA3D8OKKn2dh8FAfyfkre9OxFSFVfymc70yY1EkHHCfQ0xMdm9HX57aCuzsUz53p okIC6QZjdeZqcgRYmZmc924M5fMBbY9L2Wa6I6M57q57Glt5FfOU1+zh9kmCyOX59VWN lacshKtGPgOjpH26IzQRwPiSC/3Y+6TOG8pRDdFm5NJBAcspI5lAFzk5etsF5JA2jmqC DdA5wrzMV2m2W0p2UlZSb1NDOqoQJhDjqznAehaaQ1SWP5LMLqb5d+sTyLqPOHBrfhAJ FPghFFArqtEeOE9CH2tLIiQTFckjHiJBJAOe8sPBiRje48/zbO7wTIELwPB2Zhwcp9Mo bmRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Hb+iG6hi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id 89si15771459uak.44.2019.07.31.13.48.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 13:48:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Hb+iG6hi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:44436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsvWb-0002lJ-R2 for patch@linaro.org; Wed, 31 Jul 2019 16:48:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33157) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsvN9-0005Ui-1Q for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsvN7-0003o4-Mu for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:54 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:46213) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsvN7-0003lg-FO for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:53 -0400 Received: by mail-pl1-x644.google.com with SMTP id c2so30962335plz.13 for ; Wed, 31 Jul 2019 13:38:51 -0700 (PDT) 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; bh=+7keF6G5xzpT4+93ObrzwUEEy1FTEHDioAfRG1ABjog=; b=Hb+iG6hikB6nHFx/0MT8WzAVyCuE4kWuAO6EzmOEnNm3pFGP9rMfaa1afO3UPUFGnv 17DQ2LWK+1yBpJTJLNPFOiJwODFNOF90nLDcIgpHG0kwEYnRZjq0JXk/KkvqdwvJg/CK pQch3+YjbwCiE2BwPmod0uoZT2TyuP7J2F6c4Z4mvkyo8QnjfDok7IReDNPNkQlp/tXw oDzcFFZZ2bb7UBYwaidmj5/YQClk1pXg8m0qIr38dxZrN1k3QhnzeXRXJcsfiLRAhSic fSiROngHfmDmaEwU3JQik0jKTVpRd//AbtSbbZk+IY1/siAwrNC1xfGOGTP91M302qm7 9SKA== 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; bh=+7keF6G5xzpT4+93ObrzwUEEy1FTEHDioAfRG1ABjog=; b=HRP24J1xQU9UBJRzVh5jWdnC86Uiklpb5veBqUwO+lL9bJkDZI5jiyryr3ZqPf/PVJ BsNmPi2DmBA3qAh2HwrxPOVQ63dIdsYnS6miRjUo8Ju8LK0fJqyAS8LM16x1Vvq5ZeNA DzO2wH00fNLTjH2o+0y/f2lrXCBm/cmx9V46shcI6z2hOEGPu899sZGV+Xuq9UQRXRfu F+wjeWggF+tIDDqh3WN4PjmL05OUtbLsx5dUlHBA51P5R7jn+4d8PICyColeCo5LkqxB WHqbIN3WqW0eN+Dh9v3x9mx/3Q3SK5VDvTsVnTepT5bGb2YmuJoqpfkNWusMYj7X0KsY wCQw== X-Gm-Message-State: APjAAAUPO8TzugB+Crq24qqQU6ZwehHAaEIvHSiFgDrw8OCkeVuP5PIx Yx0/Dio3VY0ORmuQZAVRaKPZUrBpdZY= X-Received: by 2002:a17:902:f81:: with SMTP id 1mr27243792plz.191.1564605530692; Wed, 31 Jul 2019 13:38:50 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id g4sm84054164pfo.93.2019.07.31.13.38.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 13:38:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 13:38:10 -0700 Message-Id: <20190731203813.30765-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190731203813.30765-1-richard.henderson@linaro.org> References: <20190731203813.30765-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 Subject: [Qemu-devel] [PATCH v2 29/32] target/arm: Update {fp, sve}_exception_el for VHE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When TGE+E2H are both set, CPACR_EL1 is ignored. Signed-off-by: Richard Henderson --- target/arm/helper.c | 53 ++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 25 deletions(-) -- 2.17.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index 15a054a141..b29717edb6 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5507,7 +5507,9 @@ static const ARMCPRegInfo debug_lpae_cp_reginfo[] = { int sve_exception_el(CPUARMState *env, int el) { #ifndef CONFIG_USER_ONLY - if (el <= 1) { + uint64_t hcr_el2 = arm_hcr_el2_eff(env); + + if (el <= 1 && (hcr_el2 & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { bool disabled = false; /* The CPACR.ZEN controls traps to EL1: @@ -5522,8 +5524,7 @@ int sve_exception_el(CPUARMState *env, int el) } if (disabled) { /* route_to_el2 */ - return (arm_feature(env, ARM_FEATURE_EL2) - && (arm_hcr_el2_eff(env) & HCR_TGE) ? 2 : 1); + return hcr_el2 & HCR_TGE ? 2 : 1; } /* Check CPACR.FPEN. */ @@ -11221,8 +11222,6 @@ uint32_t HELPER(crc32c)(uint32_t acc, uint32_t val, uint32_t bytes) int fp_exception_el(CPUARMState *env, int cur_el) { #ifndef CONFIG_USER_ONLY - int fpen; - /* CPACR and the CPTR registers don't exist before v6, so FP is * always accessible */ @@ -11250,30 +11249,34 @@ int fp_exception_el(CPUARMState *env, int cur_el) * 0, 2 : trap EL0 and EL1/PL1 accesses * 1 : trap only EL0 accesses * 3 : trap no accesses + * This register is ignored if E2H+TGE are both set. */ - fpen = extract32(env->cp15.cpacr_el1, 20, 2); - switch (fpen) { - case 0: - case 2: - if (cur_el == 0 || cur_el == 1) { - /* Trap to PL1, which might be EL1 or EL3 */ - if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) { + if ((arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { + int fpen = extract32(env->cp15.cpacr_el1, 20, 2); + + switch (fpen) { + case 0: + case 2: + if (cur_el == 0 || cur_el == 1) { + /* Trap to PL1, which might be EL1 or EL3 */ + if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) { + return 3; + } + return 1; + } + if (cur_el == 3 && !is_a64(env)) { + /* Secure PL1 running at EL3 */ return 3; } - return 1; + break; + case 1: + if (cur_el == 0) { + return 1; + } + break; + case 3: + break; } - if (cur_el == 3 && !is_a64(env)) { - /* Secure PL1 running at EL3 */ - return 3; - } - break; - case 1: - if (cur_el == 0) { - return 1; - } - break; - case 3: - break; } /*