From patchwork Tue Dec 3 02:28:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 180659 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp937201ile; Mon, 2 Dec 2019 18:34:20 -0800 (PST) X-Google-Smtp-Source: APXvYqx4YH23VUhqOSUhBzSO5a6mJa/D/bWEGuZCjL5wCgmTG9NS1swgMKLhSWNt9kTHM9obQldA X-Received: by 2002:a50:8a04:: with SMTP id i4mr540950edi.150.1575340460788; Mon, 02 Dec 2019 18:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575340460; cv=none; d=google.com; s=arc-20160816; b=JiLlMKa8lYIfMw7AoKlQatOnv9Ba1Ds7RFtSn2P1f19xt8yzSNojrend4mxA+rqk+E BlZ6nSgBPL0mrH6JyIo0xAVR9VIbmh78XXaP0zIaa+rCOb+trMyvPPuteObao8dkuu6J 3Iu2bn0G46hqJSjCg+n/ohMYrvPUbyuNziUA5pb9ajTj+qbX7FolAN41qgrBD1hj4PpE +YhhFYWYoY+4vxLp/ZqrOeG5WRF23FwMZiUddxVENVrCFJD+jlqi5g8uRoKaC9OIh1cU 6MP6sIrHq9Fib5gE6x2Xsqpre/tZmgE4O22Qy7YWSFYahCH05fCTFmqH/fgJhVtZ26b3 KL3w== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=6+PxY8SIDMEG7zwbqXLvGydymJLf+U0upJ2ABich2l0=; b=zw9qWNjs+uczvJe5MvXF5GENbm8qHgh25UVFyw3pTbmVgxZ+k/etCw3wJoLexFVxHb Wg/ACsfMNC8jsRMhxFwRuzGnzu/322qC+1BdPFCk0UCmLY68FkO9qeNHBnyXD7wAQ1XM tz8pl8vzInVbhSN9l1r5ZA1SWoWk8LCNIRbS6pvT1UnjIoF3cPkR2k6lpTXD2oMjPfYH DnflY/kB5vvehgPOmPSvfHeD0lmxPHhFRkGOAijuYrpdalrgULTWsKwFC7c2k1UAvOrQ vT5zJUjJ6ntvEQYF3jfNT2rU1W0qlFzpxBll88+GgOciW1sRRkPAsebToPKy9r48aF58 IxYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=al9UUL+m; 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 s21si1255378edw.140.2019.12.02.18.34.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Dec 2019 18:34:20 -0800 (PST) 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=al9UUL+m; 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]:47156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iby15-0006xp-1Z for patch@linaro.org; Mon, 02 Dec 2019 21:34:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59047) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibxwe-0002y2-Ge for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:29:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibxwd-0007wm-Bj for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:29:44 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:33599) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibxwd-0007vP-5m for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:29:43 -0500 Received: by mail-pl1-x643.google.com with SMTP id ay6so1015793plb.0 for ; Mon, 02 Dec 2019 18:29:43 -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=6+PxY8SIDMEG7zwbqXLvGydymJLf+U0upJ2ABich2l0=; b=al9UUL+mkN/6t8YLEzPqgmKq3KP+bXg/GqpsiXjwJmVI+m/fqSe72I8bDU4VWRzNCZ Eul2lGK362EcZWctjX90DzRcqJuNG737U57oIIN9U5diQYdD9dQRTclXicOSOQSrwkFE IfTxWobn6+Vi8QL9+6bpzH/28SACDKLtEQTOg7AOk3XY3VOpn0mkl5ldz1mukWyK8oV+ aS1N101hwbXfl/Z3Ff228RkUmlRculRB6r/C03EyfzqWLp8WIM/bulJrcr3gowplq1F2 r212Xqnydt3DPhjS/+mCh5khYI4qYc3dHZTPASCsKOvJrBlrV+M66stql0t2hs8VqSBM e9Xg== 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=6+PxY8SIDMEG7zwbqXLvGydymJLf+U0upJ2ABich2l0=; b=GBGSDYMMy4x9LWZAnXA6O83iF0a4T9wETy3ujC+RFvEndhhGNR1igv2U6aesDOZWfR q5O+4opndlVCDD4EOq/T3YVf7wpQ/UgvLV/kTql/5ZvoCG7I9wukD/JYRtqqj035aV7v 6AMoG2wdMSXspdSEuaxK0G4P6M/QaI7BUifY2wbQwrs38vy13kI60DOhSv3njyJt7TJu tlXefHAmrnl5s8PUpeYtpNWyPP6rsVkt0yYl7FHeEkkIrcueAm3bBECswBRIZRkey/EE XLXCAQyJoOCFlOTjvVTl27MWC+xHSrf0O1y4jAknhzd3W0FhiwTyivsRlyssTjwStC02 pjHw== X-Gm-Message-State: APjAAAWXn5XuUr8Y3BFnIpoK4DpKODFojTcLq+rM4T7m8lreYZrw7Wse J9SJsH6kRvcaxZLn1iqBsQV2EUbg2FE= X-Received: by 2002:a17:90a:c592:: with SMTP id l18mr2810677pjt.69.1575340181879; Mon, 02 Dec 2019 18:29:41 -0800 (PST) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id q22sm873695pfg.170.2019.12.02.18.29.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2019 18:29:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 02/40] target/arm: Enable HCR_E2H for VHE Date: Mon, 2 Dec 2019 18:28:59 -0800 Message-Id: <20191203022937.1474-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191203022937.1474-1-richard.henderson@linaro.org> References: <20191203022937.1474-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 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, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- target/arm/cpu.h | 7 ------- target/arm/helper.c | 6 +++++- 2 files changed, 5 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 994cad2014..9729e62d2c 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1387,13 +1387,6 @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) #define HCR_ATA (1ULL << 56) #define HCR_DCT (1ULL << 57) -/* - * When we actually implement ARMv8.1-VHE we should add HCR_E2H to - * HCR_MASK and then clear it again if the feature bit is not set in - * hcr_write(). - */ -#define HCR_MASK ((1ULL << 34) - 1) - #define SCR_NS (1U << 0) #define SCR_IRQ (1U << 1) #define SCR_FIQ (1U << 2) diff --git a/target/arm/helper.c b/target/arm/helper.c index 0bf8f53d4b..d81daadf45 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4672,7 +4672,8 @@ static const ARMCPRegInfo el3_no_el2_v8_cp_reginfo[] = { static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { ARMCPU *cpu = env_archcpu(env); - uint64_t valid_mask = HCR_MASK; + /* Begin with bits defined in base ARMv8.0. */ + uint64_t valid_mask = MAKE_64BIT_MASK(0, 34); if (arm_feature(env, ARM_FEATURE_EL3)) { valid_mask &= ~HCR_HCD; @@ -4686,6 +4687,9 @@ static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) */ valid_mask &= ~HCR_TSC; } + if (cpu_isar_feature(aa64_vh, cpu)) { + valid_mask |= HCR_E2H; + } if (cpu_isar_feature(aa64_lor, cpu)) { valid_mask |= HCR_TLOR; }