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: 763656 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a08:0:b0:337:62d3:c6d5 with SMTP id m8csp110470wrq; Thu, 18 Jan 2024 12:11:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFusJJ4DFyojJ42uelQ8IVVx9CAUFvW3znLM5djU4NfKJgqG1QkZmLghAYeI2AXVjTovG5s X-Received: by 2002:a05:6830:11cb:b0:6dd:e199:b5d2 with SMTP id v11-20020a05683011cb00b006dde199b5d2mr1246554otq.76.1705608709340; Thu, 18 Jan 2024 12:11:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705608709; cv=none; d=google.com; s=arc-20160816; b=wJmCgByjfYhet7tQjxV3tX9ezYTVJZa/4++5XYPive4M0e9eToxEallA2GxAgxEQa+ Ug5ZImoyY89O/fPTtSuBEFwEr5Bc1FXVO1+Y9FYnGu3ReDG5CJ20QNBmuMlkGW/dKW1V RkgNJaNGk9tG5dWN9y59wMPxjrbdty7sZpMXqb9AHJRsO0Vc/mXP4i3GKFUDL7skDDok wY1mJGK6SgYGulawVtlG664oJXJaeC3/Wzr00Fg1sjJixqvSDt1yneklYbUOjPBQbs/Y 3ZzX2sVI8itvhBpzPfW8brf1rZ3NJwTQDbo5LXh+wN0cCaZhdTPrJkiSrdKp3lI1hOWD sOgg== 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:cc:to :from:dkim-signature; bh=zozAuekXsv7RqlLM4guzPZsrXewV7KaaXnf3wtjaQAU=; fh=cUgEM3TMHOIH70RmHTmTZxZmItZJnKfBWHSaci49aLY=; b=xDKdN/6VgdAFfHHHKAS6NDYkdl2ZXhk1O7oUbBZRarOVChlcudzaLBZx32pKoFOoMo JHXcdvofo4MsP3pHdkrQLHBIXsWVJy5s4uMNo7IC9ttIrHIzBRTFCaIcvQCuKD7Df48K R0+e0t6zY/nnruYAGFwsRPp1TeW/A2P6DT8ZPlGx7lZW2LYYgaHeSsUoV5Yk1b5h+Lu6 nyIKJTAGTJ+dA+c4+s/zUuzFetPergq34zqptxk9L5V/kIzb2GEuDIx6+pjsqzqsDLYC TL9zcUUQhgqm3SQ/iGqOVTBPG+gc5urj3O7ZaUa/HzBWBtXTfA9ZUjGuIAp+Dq9DrDCg 3rIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kvd3tq+e; 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 i9-20020ac85e49000000b0042a0938f940si5331919qtx.191.2024.01.18.12.11.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2024 12:11:49 -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=kvd3tq+e; 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 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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) {