From patchwork Wed Jul 31 20:37:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 170246 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4473765ile; Wed, 31 Jul 2019 13:42:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvb/fVDs7LUI2vhk9X38KU+4uqNF5T4F4KCgKHlbWyX5lDNzyAlPJ4DcCEIk/KRNB4Slku X-Received: by 2002:a17:906:b6c6:: with SMTP id ec6mr97928523ejb.183.1564605751851; Wed, 31 Jul 2019 13:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564605751; cv=none; d=google.com; s=arc-20160816; b=WVzNr4YO+bsyz428ITkjCk4E3sOJCNJ5a6KaFoT8vyel6qnfCuFgLMDH6T1hf2UIZO E2dnOVg6xVj9342WK6RSKPFduYtz3hudmLoUuTVo6djjirbwomUstuNZD2r8iTjmBYnL LK5+p7HxXA50qNiHZVR7YOY6Vdb10xXbI1aqpeo5RF1/Xg1qsAGHG8oCLQon0HKfvl14 9JMkrbz8Mso2bYx2lS6kB4Nq9lk11zBNwBFU8o8eVC73sN6yvn8pn+TvtBo5SRd8v6Px FCzMR0uARe+bbPrRpdZM9B6Cl+f4r5ohPxPtX1PRhbVX/29tjghQn1bvpwNXdwJL//B7 PhIw== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=VC440BcwSuqOKz+Fo7ui0w+dupEF68UzkVylEVc+WDs=; b=x0tg96WPpP0ZpkbVdRBbsYRWsYK3CajrhqyKyRfJeylwQLGYRMN4lUxam9+wATFovH 1SrUBCkQ5qPwQoeC4iqlbYofTQkTNjwAS5emvyhXmzgvbLbuqZ5iU8ZqlJmHN9cTEGNR VoWg3YJZHyzO4gBKDBcAovN+Geneidae0sO/IMOvJOHbCiyZwnuM7X9EdNXnObh4qOwK rXMrBRzVzSN9X56Lx5sDKK7k2xCAddfKcnmQ+ue+7pbdXU0L6oHZAbGdtbTc7Nt8R4eB cfZCdRb1R3YozfdYfrT2YqIVwLSGo1MNMB/PpNzmsImtxF95YGpwqUdGl1U3uZory1ND wGYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=I9uyMOU3; 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 g6si21505566edc.90.2019.07.31.13.42.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 13:42:31 -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=I9uyMOU3; 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]:44274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsvQc-0002zw-Q6 for patch@linaro.org; Wed, 31 Jul 2019 16:42:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60763) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsvMg-0004ES-FT for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsvMf-0003NM-Ep for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:26 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:42595) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsvMf-0003Mt-9Y for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:25 -0400 Received: by mail-pg1-x541.google.com with SMTP id t132so32632353pgb.9 for ; Wed, 31 Jul 2019 13:38:25 -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 :mime-version:content-transfer-encoding; bh=VC440BcwSuqOKz+Fo7ui0w+dupEF68UzkVylEVc+WDs=; b=I9uyMOU3oEdwC4uca/HtLL2zKp2V2rvHGUrb1UsT+oOlm1DEvz2TAK+0wpTiyUukX+ BBfUCM+XSFoCKDZwKc0WTIlFyX4mk7eziMk3HgGDslZ3yQTRDf0zrVxE7hldTwZ4q6Zl Nwb8wjypqFtUFir+gZ2lbYle8UY09BKUXUxuJbSImbMnzznNPUjkGdOODCOkHwPVv17L ZKz5VWjIortAYA6H3X6Vrw73ZG9kbrScFVshp7eSCsM6mc5GSWG3PMhg0+mttZLRmP/9 OeozOhiGC1hOjujJZz7LAg1mqcjBRxUIe6W5k10hgcsFdxEquKzjsL6ooDvAEqphzXVq aUDQ== 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=VC440BcwSuqOKz+Fo7ui0w+dupEF68UzkVylEVc+WDs=; b=QMPRt0qFk6Sm9uXlnSVh9mvmHyjN8TE/ElqqZbenZVYPrJtDv7Fc3788BAG0V6r+Db dHQxIuiFT0Pq3150sPYPWldL5YLmMhCbXkrfAOmubPNKGFmjwicZe2xg0aDSfkIdRN/A JDQUN95U/qp8dMlH4aKQqynEcUnwD7BnYKaztJ7W0zbNV8vDs0RX/6IRWKyBzHOC/BpZ CX3ZWpcgHM7ktmYK26n7rgy8hAZmDLNQHo3hwYaQOMizPTu+FeQ6YYWDYZvtAAfwM3Gh Ig40Mv+dyzGagWKEhvrHa3kew8wiKKPrZZ/uD+MYAKsq0LagQ9nkfTi4FNctfh7ax4Fx U10Q== X-Gm-Message-State: APjAAAWDnfST4Xrc0HiYXP7uSlZS8CYIPJGOXfxTrIjHTAEyngS3ucYT YCRsnFcoEWcXLcGCG2CTTp20eDceGO0= X-Received: by 2002:aa7:91cc:: with SMTP id z12mr49207441pfa.76.1564605504020; Wed, 31 Jul 2019 13:38:24 -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.22 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 13:38:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 13:37:48 -0700 Message-Id: <20190731203813.30765-8-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> 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::541 Subject: [Qemu-devel] [PATCH v2 07/32] target/arm: Enable HCR_E2H 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" 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 e6a76d14c6..e37008a4f7 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1366,13 +1366,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 65e3ffbb43..9a18ecf8f6 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4623,7 +4623,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; @@ -4637,6 +4638,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; }