From patchwork Thu Jan 5 16:43:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 639280 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp324434pvb; Thu, 5 Jan 2023 08:54:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXuXqwwY8zAXN5xpihtqtlNhkGVv2SXBgmVmwRf2OuVbvcg5vDvTnvdONsWWcndt5fGPjE62 X-Received: by 2002:a05:622a:4d47:b0:3ab:5dc7:6be7 with SMTP id fe7-20020a05622a4d4700b003ab5dc76be7mr80896217qtb.27.1672937642704; Thu, 05 Jan 2023 08:54:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672937642; cv=none; d=google.com; s=arc-20160816; b=EBknoO9KCmdvVyxUlBI9IdSQP4jN3xTErNpcfND6HpC0rm2zLicjjLU+ysKstX5uoZ Qld736kPE0vilNQsbFzQ8ISGKH8CeJp9gDDkDBus5QpqjOzkFM5f4ZcQ7ZhrvNOKNP4G 4LCxEscBfa+sXv6KaG4S0WV8xyzjFBII0CwoAavK1eFv5MKhicOj8rONNi0BWo/Lziwy HW4/bEzfOhNppqGN8+3pfcPQMe7SEkaWicWolU7bggswzEUPhXbnr+pyr1umTxr0wtVy pyGDalVpHvzF3bHpncO/Hy7KaJO6yctzZf+7KU0ORTW1HR7cuScfwcmrpBnowX8SWdBB awLQ== 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=ucC6r0jcHK+UNQ8eQHcmxpwSVgcMH/k1pFOZLGUGlEY=; b=glNMFrN5E2Jr0XzWrP9hTSzqkhrAw8716l6te9DDuiHApKe/ZyFMNGuXdTbkG0/UDf 8MrUQF3sPUQ8o/qhWLxU0mtUCvOmHZrd5NEEe5xI+9BOZ+dcgqkUXCzN1YkHPEOJkho7 aVjfx4Lfd+wWuNlw4bBxt7u44kLv7WweduaE9RYRO633VXhT8lFEs7zVCUzPR3/apIqn YXIOeGY9PIh1LgI+BjWvfe0QTq3xsaf6VaGCWNHgHjHhT1qhwbjgRIEGNskvGnWF6nhS yLAiBLRIZGTU6wCDii2oezPrML3tmJs44ral0F8Nf5PwfIivh2Fu+vIsNF+a6VeoN7yf 1zuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E8DRv8Nu; 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 r184-20020ae9ddc1000000b006e07228ed51si17729534qkf.99.2023.01.05.08.54.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 08:54:02 -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=pass header.i=@linaro.org header.s=google header.b=E8DRv8Nu; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDTLv-0000Qa-EH; Thu, 05 Jan 2023 11:44:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDTLt-0000Jl-6v for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:25 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTLr-0007Lt-Di for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:44:24 -0500 Received: by mail-wm1-x334.google.com with SMTP id g10so14660734wmo.1 for ; Thu, 05 Jan 2023 08:44:22 -0800 (PST) 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=ucC6r0jcHK+UNQ8eQHcmxpwSVgcMH/k1pFOZLGUGlEY=; b=E8DRv8Nu4ixugWfK7FytBuxghTiwZxfIA8v2FkhXE8xQW7boVkVkF+ANXVyqrfEvS5 ubCGchzYN2aFeHm2tR8DMack6HoC4RTfYINzGn5FJbUIlsOgXpes59SFRZv8zLMu7r7M U/qGrPyF2LhtYeQpK0x8yey/snnryI4Zs+TGyyxvlV6OgaD3PHyO74AorODaxr+cwdZO 9pldvRk+3pujN/t0Bdaz0Uqx54ussUqGnGUAbaVhSJdWFcSd6oND7W6W6TX8AAUbXTra dqmmZd6URkVBFjRQW7ut8d64eXaLcogbiDEWfqeC1K7NM0O7rPzqfO7B8sSNHXNZN0jA GsFQ== 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=ucC6r0jcHK+UNQ8eQHcmxpwSVgcMH/k1pFOZLGUGlEY=; b=k6IFLW31DlujVtfe5jGPfK14UTSYonEHLMIix3qn1i95baCleqeskSwxvc9MXGqo+v Ai3iGlez4gmZT3OTwRXg/R1kYBQsyCr3kyJLtoLl+EYC/bklUvfEGJFY0GJOuKmQOOAF +mV/SVKmJZBR87Cv7VPPV1qk1hKtN9EQB0DnClDIm106MPFEjUO24v8uyQJ0C0s1V5sm IjMx8JB9Akn733dhF3FM/978fleK9vrqJ71tDNKGh4dX0R0NwULbtNZoWD33CqsMm7Ao fjg2h/n3+6+jVhZ8gIOmx6FFgpG3zndJlnfnf2DAZqkTue1mfjjLXnbwtd2whpmjE+SX FMtA== X-Gm-Message-State: AFqh2kp+qdvxEA8NMNqYA1yPlOgzfgLjUL1JaSvxVyl5rob8VMlvPrEm SvJElAPs49Z5cm8LVBrLcq9TG5bIU9Gt55vi X-Received: by 2002:a7b:ca4f:0:b0:3d3:56ce:5673 with SMTP id m15-20020a7bca4f000000b003d356ce5673mr39142433wml.6.1672937061813; Thu, 05 Jan 2023 08:44:21 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id hg9-20020a05600c538900b003cf71b1f66csm3055547wmb.0.2023.01.05.08.44.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:44:21 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/34] target/arm: Make RVBAR available for all ARMv8 CPUs Date: Thu, 5 Jan 2023 16:43:46 +0000 Message-Id: <20230105164417.3994639-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org> References: <20230105164417.3994639-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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-bounces+patch=linaro.org@nongnu.org From: Tobias Röhmel RVBAR shadows RVBAR_ELx where x is the highest exception level if the highest EL is not EL3. This patch also allows ARMv8 CPUs to change the reset address with the rvbar property. Signed-off-by: Tobias Röhmel Reviewed-by: Peter Maydell Message-id: 20221206102504.165775-3-tobias.roehmel@rwth-aachen.de Signed-off-by: Peter Maydell --- target/arm/cpu.c | 6 +++++- target/arm/helper.c | 21 ++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 2fa022f62ba..c107cbd7574 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -309,6 +309,10 @@ static void arm_cpu_reset_hold(Object *obj) env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1, CPACR, CP11, 3); #endif + if (arm_feature(env, ARM_FEATURE_V8)) { + env->cp15.rvbar = cpu->rvbar_prop; + env->regs[15] = cpu->rvbar_prop; + } } #if defined(CONFIG_USER_ONLY) @@ -1345,7 +1349,7 @@ void arm_cpu_post_init(Object *obj) qdev_property_add_static(DEVICE(obj), &arm_cpu_reset_hivecs_property); } - if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { + if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { object_property_add_uint64_ptr(obj, "rvbar", &cpu->rvbar_prop, OBJ_PROP_FLAG_READWRITE); diff --git a/target/arm/helper.c b/target/arm/helper.c index 090daf93c71..d8066fe97d3 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7896,7 +7896,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) if (!arm_feature(env, ARM_FEATURE_EL3) && !arm_feature(env, ARM_FEATURE_EL2)) { ARMCPRegInfo rvbar = { - .name = "RVBAR_EL1", .state = ARM_CP_STATE_AA64, + .name = "RVBAR_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 0, .opc2 = 1, .access = PL1_R, .fieldoffset = offsetof(CPUARMState, cp15.rvbar), @@ -7987,13 +7987,20 @@ void register_cp_regs_for_features(ARMCPU *cpu) } /* RVBAR_EL2 is only implemented if EL2 is the highest EL */ if (!arm_feature(env, ARM_FEATURE_EL3)) { - ARMCPRegInfo rvbar = { - .name = "RVBAR_EL2", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 1, - .access = PL2_R, - .fieldoffset = offsetof(CPUARMState, cp15.rvbar), + ARMCPRegInfo rvbar[] = { + { + .name = "RVBAR_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 1, + .access = PL2_R, + .fieldoffset = offsetof(CPUARMState, cp15.rvbar), + }, + { .name = "RVBAR", .type = ARM_CP_ALIAS, + .cp = 15, .opc1 = 0, .crn = 12, .crm = 0, .opc2 = 1, + .access = PL2_R, + .fieldoffset = offsetof(CPUARMState, cp15.rvbar), + }, }; - define_one_arm_cp_reg(cpu, &rvbar); + define_arm_cp_regs(cpu, rvbar); } }