From patchwork Thu Jan 18 20:06:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1888244 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=kvd3tq+e; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TGDRV3rdtz1yQ0 for ; Fri, 19 Jan 2024 07:11:50 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQYgn-0006YM-Gh; Thu, 18 Jan 2024 15:08:37 -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 1rQYgj-0006Ia-4W for qemu-devel@nongnu.org; Thu, 18 Jan 2024 15:08:33 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQYgh-00077S-HB for qemu-devel@nongnu.org; Thu, 18 Jan 2024 15:08:32 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40e884ac5c8so255615e9.2 for ; Thu, 18 Jan 2024 12:08:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705608510; x=1706213310; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zozAuekXsv7RqlLM4guzPZsrXewV7KaaXnf3wtjaQAU=; b=kvd3tq+eapbpCngaN3Dko77VjREW5ZPXaosP/QTIDOmgoBt3YR3tgtI7OUedWpZhF9 9bYMjM/oqfkt09JPJwj7ixwubDMpIs1x23TeW/2c/3R/bvCXJkPscf81yGC7C5/AlU3Z Y+ycgmlPCfKRbWcAfVE9e+uLUUaTH4XAF4YgVVIgl2zOa6MdHh2Fmg1SwYkhBAd1xZOb gUOJGPG87pj8rRY41DYNReCGm0QoFr3L07GsBirJD2POAmixXh+sc1vCY7jCX5FIULR0 Jn5Jz9l/55feaw1kkHPj6hFHW2TKuBB/jXlgVzJjC5p6RzD2gjj0uMkp42Pha0iF7BzV tVZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705608510; x=1706213310; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zozAuekXsv7RqlLM4guzPZsrXewV7KaaXnf3wtjaQAU=; b=qswuxycYzjV9GfTPISR044z9jkGR/br7clUSqwu2A+LdrC6ViCYRSduWCzQ5VXNcFd xpSGwVJeE1gEpjDMLLCHY+LLSS2WS24hDuZ+MNGKaBgufnkbu8i3LeWMySshzoYNcIR+ 54FQyaUQ7N+Mrep+yqlA3oQ4IqaJFfyGM+kufI5zI250gyQ1UPZBq+vDMO51gRDvNoF1 e1UJTV0B+2O802wTdf0QHhqAKA4ZndYZ+jIRkZzHThR6A+Z6Ep8+LDCxf2x+SnOhxuZ+ d3A5pnyGL0/K+gPAXRdbzpjzKyD1sZKlyyAABw53PpGQVzlD8XFlS/kSL5+Z4UfjYzyN 7cXA== X-Gm-Message-State: AOJu0YyKAYi2ooUB/sQ+y1OLWpeyo2PWmo9q3rHPEZwtCxKBl0N3CZ4v jWXiEye1pSr7duro0+XFmuFeug32y9t5HoHivpOTL5Vxyrblfoz242hAMRq5887CgvHZEHPbNjE 6x1fE/mGO X-Google-Smtp-Source: AGHT+IHAXWZlDPgGCKUoszcIliwZOjZQQesvvlbj+f+1ULrIP3kcqYXjYGbM42jIhneojIogmfSl3g== X-Received: by 2002:a05:600c:4216:b0:40e:4a71:e140 with SMTP id x22-20020a05600c421600b0040e4a71e140mr430671wmh.342.1705608509862; Thu, 18 Jan 2024 12:08:29 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id jg1-20020a05600ca00100b0040d4e1393dcsm30281752wmb.20.2024.01.18.12.08.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 18 Jan 2024 12:08:29 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Igor Mitsyanko , qemu-arm@nongnu.org, Strahinja Jankovic , "Edgar E. Iglesias" , Igor Mammedov , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Eric Auger , Niek Linnenbank , "Michael S. Tsirkin" , Jan Kiszka , Marcin Juszkiewicz , Alistair Francis , Radoslaw Biernacki , Andrew Jeffery , Andrey Smirnov , Rob Herring , Shannon Zhao , Tyrone Ting , Beniamino Galvani , Alexander Graf , Leif Lindholm , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Paolo Bonzini , Jean-Christophe Dubois , Joel Stanley , Hao Wu , kvm@vger.kernel.org Subject: [PATCH 18/20] target/arm: Move e2h_access() helper around Date: Thu, 18 Jan 2024 21:06:39 +0100 Message-ID: <20240118200643.29037-19-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240118200643.29037-1-philmd@linaro.org> References: <20240118200643.29037-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org e2h_access() was added in commit bb5972e439 ("target/arm: Add VHE timer register redirection and aliasing") close to the generic_timer_cp_reginfo[] array, but isn't used until vhe_reginfo[] definition. Move it closer to the other e2h helpers. Signed-off-by: Philippe Mathieu-Daudé --- target/arm/helper.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index dc8f14f433..1ef00e50e4 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -3342,20 +3342,6 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { }, }; -static CPAccessResult e2h_access(CPUARMState *env, const ARMCPRegInfo *ri, - bool isread) -{ - if (arm_current_el(env) == 1) { - /* This must be a FEAT_NV access */ - /* TODO: FEAT_ECV will need to check CNTHCTL_EL2 here */ - return CP_ACCESS_OK; - } - if (!(arm_hcr_el2_eff(env) & HCR_E2H)) { - return CP_ACCESS_TRAP; - } - return CP_ACCESS_OK; -} - #else /* @@ -6543,6 +6529,21 @@ static const ARMCPRegInfo el3_cp_reginfo[] = { }; #ifndef CONFIG_USER_ONLY + +static CPAccessResult e2h_access(CPUARMState *env, const ARMCPRegInfo *ri, + bool isread) +{ + if (arm_current_el(env) == 1) { + /* This must be a FEAT_NV access */ + /* TODO: FEAT_ECV will need to check CNTHCTL_EL2 here */ + return CP_ACCESS_OK; + } + if (!(arm_hcr_el2_eff(env) & HCR_E2H)) { + return CP_ACCESS_TRAP; + } + return CP_ACCESS_OK; +} + /* Test if system register redirection is to occur in the current state. */ static bool redirect_for_e2h(CPUARMState *env) {