From patchwork Mon Oct 10 14:27:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 613733 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2013649pvb; Mon, 10 Oct 2022 07:33:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44/1KWIByGMn+5dR3Y9VdswbWkShwzL51OHs+xSyUg218sRRBMeWqVQwSBYWaIi5QUf3Ip X-Received: by 2002:ac8:5a16:0:b0:391:8800:a78e with SMTP id n22-20020ac85a16000000b003918800a78emr15260010qta.273.1665412405258; Mon, 10 Oct 2022 07:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665412405; cv=none; d=google.com; s=arc-20160816; b=GzPG6F8wNhYk1wwFyS6zhNfzzV9iIt3N18YW7jPw8Vmu6K6ns7bZcPjg/F5C234qgV Mkc8cPiTmGVxyLdqHYO5gDSIuXTOeXGsqTtpfLLZ+G/XSXMSFbyu5JoAgpI6Kdq/IKtO LxFsu3b6bUv0CeeVT6ItpL7EMQu4iZNFwjjAYSKj+dYvbU5dbLqz73egtQ8CajE3pOv/ YqVZWP5BzESDBTbjcYaf5eDnGXNAs65Fxu1QBUfrnpqLILJHawXkQcE/29chCYKdd61g /+4zxbPglwlq5XcedegMqvkHsOB1n68Rhm5MvSEhy4REhOYuKgHzrTG/y8FYoidYCeHI M7Ug== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=SPGKioIMb/pLJ3nk36JFfL1iYwx+YE1iQzeuzMVhTD4=; b=XQkXCzwCHaY351DQK9tDCJpSQLXWC/I6QZ7RRZWNsRe6/rUk98/0TxqQEn+rQVyper XWz9q/WK7disyUFjOSsmFo+qzn7q7yTVMLK2C0CI9kkHie7C25j9+1o2F25vkWKdzYtp XEcn4/HSyMhQTuPPREcWklXaBH+QHxiLb6UVOMAmgQtkI4SR8LWQnuzeJ6yVXIMy3Gmc HnNIZsBc2BQdqCxYosZFkPY+TzzcIGHSwSJ4Tz9i/ftYSxXphBeyWYC7ok7ndGGzykaf V9e71MqhGgEISYChF03YLDVBljLortcaPXC1iUcfU3JGEzvc9whSQ5VqozemZskvfInu coSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=liOLPdDz; 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=pass (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 ew5-20020a05622a514500b0035bb4a0075bsi5497138qtb.597.2022.10.10.07.33.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Oct 2022 07:33:25 -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=pass header.i=@linaro.org header.s=google header.b=liOLPdDz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohtqO-0003A2-O1 for patch@linaro.org; Mon, 10 Oct 2022 10:33:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohtkp-0005p1-5U for qemu-devel@nongnu.org; Mon, 10 Oct 2022 10:27:39 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:44814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohtkn-0005XQ-1t for qemu-devel@nongnu.org; Mon, 10 Oct 2022 10:27:38 -0400 Received: by mail-wr1-x42b.google.com with SMTP id r13so17288311wrj.11 for ; Mon, 10 Oct 2022 07:27:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=SPGKioIMb/pLJ3nk36JFfL1iYwx+YE1iQzeuzMVhTD4=; b=liOLPdDz8dt4fXuPesosHu8ICaqstKBVP208nXbghsJJxnAkBjfjIIFvdLynsauF3w dbHaMW/I4r89NlAJFTId+Iggci0imZGjhjI+ihor2Ou/C0M5KikFq6AI/uVvyfT4UZtJ JQCpnxTum2SwVsFtWbMEil6hkCywCKCR207jm/YM0VrgMIvw0CHeReK/mtcFKeAvddJ+ p5dogAy6Y6vrua1yqwHRwhtSC3HMXgd++CIiVY/3D5+0u4wjfNZUU99/NJAUwpdJ2HYA yAJcxQNSgAXx0Tj6gfGtgw6swGdSc0sqqp1Zs/OVrUZLiY9rQ6TYXLvedKtqbflF+ME+ IToA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SPGKioIMb/pLJ3nk36JFfL1iYwx+YE1iQzeuzMVhTD4=; b=DblB++5gFrL/b+/hB0BvQMz8x1SIDLCpBEB5v4+1vEE/t8ZgRM3vHm1Uj1R/sDBpK2 v3CYivgkzCcxFQ6hM88r8w2tO3UpUTAvoNGfv97uzKaS3ogkVOy+Nxleh+NPFtmoA3ys wOMZZ0HMFIgiCX/jS8A/WJAd3ei70DDmnyN89jOPneDUGVw5lPcx8adbyg5VsV2Fknga ZHzW2wI+Il/CycukSsXus52Oqi2Mdj1dOYuUhVfGqjHCj8hJIo0ZFtY5JkxUrfjLY6XQ +MIoCRgoR+ZgLMZ1bM7wmhHzGFvLl4Lf9HEgyMtgp5RIkgjCffN6mzS58ft+zss3WY2t qw0A== X-Gm-Message-State: ACrzQf0KkQUY9qnJaFT7TImIkM36yj697rfGj/At98mvqfKd2UpWYzdX WcD/1m7dPnPaxL/rrpF+kpYaXu7xNFx7gQ== X-Received: by 2002:a5d:648c:0:b0:22e:63be:be09 with SMTP id o12-20020a5d648c000000b0022e63bebe09mr11553549wri.159.1665412055437; Mon, 10 Oct 2022 07:27:35 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfed46000000b0022e04bfa661sm9037054wro.59.2022.10.10.07.27.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 07:27:34 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/28] target/arm: allow setting SCR_EL3.EnTP2 when FEAT_SME is implemented Date: Mon, 10 Oct 2022 15:27:04 +0100 Message-Id: <20221010142730.502083-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221010142730.502083-1-peter.maydell@linaro.org> References: <20221010142730.502083-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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" From: Jerome Forissier Updates write_scr() to allow setting SCR_EL3.EnTP2 when FEAT_SME is implemented. SCR_EL3 being a 64-bit register, valid_mask is changed to uint64_t and the SCR_* constants in target/arm/cpu.h are extended to 64-bit so that masking and bitwise not (~) behave as expected. This enables booting Linux with Trusted Firmware-A at EL3 with "-M virt,secure=on -cpu max". Cc: qemu-stable@nongnu.org Fixes: 78cb9776662a ("target/arm: Enable SME for -cpu max") Signed-off-by: Jerome Forissier Reviewed-by: Andre Przywara Reviewed-by: Richard Henderson Message-id: 20221004072354.27037-1-jerome.forissier@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 54 ++++++++++++++++++++++----------------------- target/arm/helper.c | 5 ++++- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 429ed42eece..68d99565ac4 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1664,33 +1664,33 @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) #define HPFAR_NS (1ULL << 63) -#define SCR_NS (1U << 0) -#define SCR_IRQ (1U << 1) -#define SCR_FIQ (1U << 2) -#define SCR_EA (1U << 3) -#define SCR_FW (1U << 4) -#define SCR_AW (1U << 5) -#define SCR_NET (1U << 6) -#define SCR_SMD (1U << 7) -#define SCR_HCE (1U << 8) -#define SCR_SIF (1U << 9) -#define SCR_RW (1U << 10) -#define SCR_ST (1U << 11) -#define SCR_TWI (1U << 12) -#define SCR_TWE (1U << 13) -#define SCR_TLOR (1U << 14) -#define SCR_TERR (1U << 15) -#define SCR_APK (1U << 16) -#define SCR_API (1U << 17) -#define SCR_EEL2 (1U << 18) -#define SCR_EASE (1U << 19) -#define SCR_NMEA (1U << 20) -#define SCR_FIEN (1U << 21) -#define SCR_ENSCXT (1U << 25) -#define SCR_ATA (1U << 26) -#define SCR_FGTEN (1U << 27) -#define SCR_ECVEN (1U << 28) -#define SCR_TWEDEN (1U << 29) +#define SCR_NS (1ULL << 0) +#define SCR_IRQ (1ULL << 1) +#define SCR_FIQ (1ULL << 2) +#define SCR_EA (1ULL << 3) +#define SCR_FW (1ULL << 4) +#define SCR_AW (1ULL << 5) +#define SCR_NET (1ULL << 6) +#define SCR_SMD (1ULL << 7) +#define SCR_HCE (1ULL << 8) +#define SCR_SIF (1ULL << 9) +#define SCR_RW (1ULL << 10) +#define SCR_ST (1ULL << 11) +#define SCR_TWI (1ULL << 12) +#define SCR_TWE (1ULL << 13) +#define SCR_TLOR (1ULL << 14) +#define SCR_TERR (1ULL << 15) +#define SCR_APK (1ULL << 16) +#define SCR_API (1ULL << 17) +#define SCR_EEL2 (1ULL << 18) +#define SCR_EASE (1ULL << 19) +#define SCR_NMEA (1ULL << 20) +#define SCR_FIEN (1ULL << 21) +#define SCR_ENSCXT (1ULL << 25) +#define SCR_ATA (1ULL << 26) +#define SCR_FGTEN (1ULL << 27) +#define SCR_ECVEN (1ULL << 28) +#define SCR_TWEDEN (1ULL << 29) #define SCR_TWEDEL MAKE_64BIT_MASK(30, 4) #define SCR_TME (1ULL << 34) #define SCR_AMVOFFEN (1ULL << 35) diff --git a/target/arm/helper.c b/target/arm/helper.c index db3b1ea72da..c08a7b35a04 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1752,7 +1752,7 @@ static void vbar_write(CPUARMState *env, const ARMCPRegInfo *ri, static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { /* Begin with base v8.0 state. */ - uint32_t valid_mask = 0x3fff; + uint64_t valid_mask = 0x3fff; ARMCPU *cpu = env_archcpu(env); /* @@ -1789,6 +1789,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) if (cpu_isar_feature(aa64_doublefault, cpu)) { valid_mask |= SCR_EASE | SCR_NMEA; } + if (cpu_isar_feature(aa64_sme, cpu)) { + valid_mask |= SCR_ENTP2; + } } else { valid_mask &= ~(SCR_RW | SCR_ST); if (cpu_isar_feature(aa32_ras, cpu)) {