From patchwork Thu Jun 9 20:28:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 580330 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp1144798max; Thu, 9 Jun 2022 14:02:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyytwv4zL1dhSWB1JC3PJARK1Uo8dfHCpART8+JSjfm0Et4Vb1+45fG7qKfzYFBaqdT75f0 X-Received: by 2002:a05:6214:f09:b0:46a:83fc:6a93 with SMTP id gw9-20020a0562140f0900b0046a83fc6a93mr22806269qvb.123.1654808532479; Thu, 09 Jun 2022 14:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654808532; cv=none; d=google.com; s=arc-20160816; b=Sh/KlWm03lOJt+fFWfmalnYmpgKjts57tuuZwEMf9pHUFlqeUyoSgjGygr2UdnHI8e XEr2MV20fGtT1aXpiOWJBmJdBl6y/Z9B9uPPEOC32FhZ7wPZN12lCQa4DdEoP9GUzgUg lugQDrFzj8CRWRdXo+6ln6KKeVTKh93cCSwM7hOBAxxHZpRSlALkIP5Ls0Oybzt0lsVD t8+h0maCDwmvQFfOBHnapng784bbrb7WiKA1ucNvtS8QEry3yJXfbws1ME5r41/W6ogz Xzimpy4WL07QJWZmzli1Yqlue64RD4I3FRYan2sMlTONjD7qG36Cl0tltBBs9XhtfxXt h9ZA== 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=BCzxefNxcQpSTLu01BysmYqWqiN0wU9rTXU9xeYcYo4=; b=MFpXVwGfa/gk13r1x22rFSfRsqD0CKsqLhu7nQShvTK/wKsxiiXGnRTbaS9yvW3qLI qZDLnAJ1gPXYZLkZ+PupYPAuNE2ZxDjaFUuOYvcoayay0mkqMMZr2ITTeWHaQ4YjUu/f g2HHmrVO58WuLvHNKjDrWZq4d9NGk9c4M/2DgvuHAxTt1HnS1QWKoFiKo+lpuIuxDvwe GNlR6V7EtMivkJFhy6HdSGXfRngURJwcHq3xr0Dms4xHxHx8FP1OBntKwWnrO9hbrY8k IxV0Z/xEOKVDYTuLDS1kyJ9+KirNmrM8hfJ0Fwm+JLnSfhN/rlW0SE9NX2Hc6F0+x81P yhww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I0oSIx0k; 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 g130-20020a379d88000000b006a3759e3b1fsi9897958qke.445.2022.06.09.14.02.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jun 2022 14:02:12 -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=I0oSIx0k; 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]:51740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPIC-0003a5-2z for patch@linaro.org; Thu, 09 Jun 2022 17:02:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmH-0003hI-08 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:13 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:46701) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmF-0008Sc-8W for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:12 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d13so5474678plh.13 for ; Thu, 09 Jun 2022 13:29:10 -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=BCzxefNxcQpSTLu01BysmYqWqiN0wU9rTXU9xeYcYo4=; b=I0oSIx0klTiW3S4pgqntyDI0vnJqmBCJfakF7r0jgq2+dVNp9oQWP8l5oLBMNtXWrh 544RdYEnW0eOJxadDliU16Ib4J8GDV9y1NJ+lXi2lkhjdBkTLDuOMoi4eyJSz0jdGEuR wq8z7CJuKzuZmgOtr/cblqG5z/IPzckzPG2oAImTIl+rXG97MsovcpU6XkjyFS0poiXH gzLrigs05uAZD5LbxxhhxIw9idKtRDVX3qdWpZBg2wOliSRZ33F/gMNV8qttAkE1pnTE ertdmkg6fHo8mmhYE5DZRICiWPtslOXqLmRA9GURK16I9LtLFxfaHXnXkrDi30KCCUk0 jE9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BCzxefNxcQpSTLu01BysmYqWqiN0wU9rTXU9xeYcYo4=; b=pyOdW/X5QD3QWWg/djGRT0vkEb2U4hlQXYzx5EbFwZ4gH9ouZuuFfiZGQjrlEEXUSc ij+UO4yglLMRX1sZGzar/amQYd9XxmlypwYhbA8G/LRmcDqp0BdqCLx+7e5AETGuVDJ3 In9JzksXxwP70rCrELNMvp96y8LFfFGSD6R/pr+Zklk4BxUEmZlZn+wfsJ8MSBQasqX+ 0nz2l3rs0Qv6B/kmxlAsKDfFtjoK3f1ancqrZIGc54bw1UtHg32ZEoMRGdM0Nkqa1j2a hc5c4O0hAnZreiVEAajTFD2Cuh6aHnqDwOq8Ni+psXZxaecXi0AjoXm+mVPEtkgHMC75 o+Ug== X-Gm-Message-State: AOAM533ATAFy1hFxFGrnAE2BP0ABagvgiwGSTc8Mm+BoCMkyhcm1ZIpN kI0D+LFb6LHHzPXowiUA99moyn4ZA9T74A== X-Received: by 2002:a17:902:c945:b0:163:c3c3:aff8 with SMTP id i5-20020a170902c94500b00163c3c3aff8mr41494569pla.56.1654806549951; Thu, 09 Jun 2022 13:29:09 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 08/23] target/arm: Move arm_debug_exception_fsr to debug_helper.c Date: Thu, 9 Jun 2022 13:28:46 -0700 Message-Id: <20220609202901.1177572-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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=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" This function now now only used in debug_helper.c, so there is no reason to have a declaration in a header. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/internals.h | 25 ------------------------- target/arm/debug_helper.c | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 02fa70f75a..6f94f3019d 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -793,31 +793,6 @@ static inline TCR *regime_tcr(CPUARMState *env, ARMMMUIdx mmu_idx) return &env->cp15.tcr_el[regime_el(env, mmu_idx)]; } -/* Return the FSR value for a debug exception (watchpoint, hardware - * breakpoint or BKPT insn) targeting the specified exception level. - */ -static inline uint32_t arm_debug_exception_fsr(CPUARMState *env) -{ - ARMMMUFaultInfo fi = { .type = ARMFault_Debug }; - int target_el = arm_debug_target_el(env); - bool using_lpae = false; - - if (target_el == 2 || arm_el_is_aa64(env, target_el)) { - using_lpae = true; - } else { - if (arm_feature(env, ARM_FEATURE_LPAE) && - (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) { - using_lpae = true; - } - } - - if (using_lpae) { - return arm_fi_to_lfsc(&fi); - } else { - return arm_fi_to_sfsc(&fi); - } -} - /** * arm_num_brps: Return number of implemented breakpoints. * Note that the ID register BRPS field is "number of bps - 1", diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 80dff0788b..a743061e89 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -379,6 +379,32 @@ bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp) return check_watchpoints(cpu); } +/* + * Return the FSR value for a debug exception (watchpoint, hardware + * breakpoint or BKPT insn) targeting the specified exception level. + */ +static uint32_t arm_debug_exception_fsr(CPUARMState *env) +{ + ARMMMUFaultInfo fi = { .type = ARMFault_Debug }; + int target_el = arm_debug_target_el(env); + bool using_lpae = false; + + if (target_el == 2 || arm_el_is_aa64(env, target_el)) { + using_lpae = true; + } else { + if (arm_feature(env, ARM_FEATURE_LPAE) && + (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) { + using_lpae = true; + } + } + + if (using_lpae) { + return arm_fi_to_lfsc(&fi); + } else { + return arm_fi_to_sfsc(&fi); + } +} + void arm_debug_excp_handler(CPUState *cs) { /*