From patchwork Thu Mar 10 11:26:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 550114 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp921457mag; Thu, 10 Mar 2022 04:00:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1CHU6S//UR8o+FzN+bg+S0yTABW0dCBcG19q04CC+4qg9ONBSs8eKWlMC7suM5KMFsxLW X-Received: by 2002:a25:403:0:b0:628:920b:155c with SMTP id 3-20020a250403000000b00628920b155cmr3659285ybe.377.1646913639455; Thu, 10 Mar 2022 04:00:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646913639; cv=none; d=google.com; s=arc-20160816; b=WD76Juzz/CSqsesp0L40K0Wv73kjgINXe0/QMxaR4lciOpTS/AmLVz0zmQ47K1jTyi oiP/SH91gnzVTXr0aF2VB3vYBR/PLDceutYiMxLXNhw05oiwlsVD5ADAu4HzSHaDNbQo J7d/HElC5uyPEz3Z3sTv2PKqPvRXwvLDVth9KhKVIF2JLceFmbqPZAQEVuF/oT1UyoHP 0J8xZ1GtXIXBwfGKcpO0unT3weeuCpZijMbNQCnAg+CPl9W1EoKWeTMsX13+CE3OB89u 24qPnCdiDV5TTFTLITcYUkjTfyqSWN5PpjSdhXfW/heJXnppjhgTPTuuiZv5vlXHOniK BElA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=CrZNI1SxmaS+Q1Ja/qtDT6B5V9ddvf4cp0nG/uUGkSI=; b=gEceNSaPI8DKVwRKRDYFDKJsl1UwI1LahmX/nvwbSy3iG+uO/ILU5Ode+Asj8WIbG4 BW51omNLUNMMA1KUD/0lhWepmP8v+YW8V8HQsHNYprHFVP1JdVzxrDdkr78+wX8FPIJf 8T+BHkGrVdV1vYJPKEgFQs3i/y3kAT988al4uoXFJ3BJ3N7oh+qEHL0pbO7j1B8IfEt4 +HIG3JcMxSwXJzfIXnQ4FQtPz8n9Dv01X4GMr9Pn9p0IY7C1PEV17hG2k2DBkU31GHaT iOyMXyr1OJ47EPLU4o4Yo88xs1TjcND4V24WbfQ6FiGNDVbAME704+V6QC+1tKXbADQA nzfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vYrEtOkZ; 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=fail (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 e65-20020a25d344000000b006294876653dsi3373456ybf.474.2022.03.10.04.00.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Mar 2022 04:00:39 -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=fail header.i=@linaro.org header.s=google header.b=vYrEtOkZ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nSHTC-0006h6-Tm for patch@linaro.org; Thu, 10 Mar 2022 07:00:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSGxV-0005kO-TO for qemu-devel@nongnu.org; Thu, 10 Mar 2022 06:27:53 -0500 Received: from [2607:f8b0:4864:20::102f] (port=56234 helo=mail-pj1-x102f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nSGxU-0007zH-AD for qemu-devel@nongnu.org; Thu, 10 Mar 2022 06:27:53 -0500 Received: by mail-pj1-x102f.google.com with SMTP id e3so4812671pjm.5 for ; Thu, 10 Mar 2022 03:27:51 -0800 (PST) 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=CrZNI1SxmaS+Q1Ja/qtDT6B5V9ddvf4cp0nG/uUGkSI=; b=vYrEtOkZvnsHvUObs23VxdT1EAqQKFFhCaHLdLJn540Cz4BByKl70igKU5xKjPk9AE VMBIzgJcTSEwOOIi6Wy6DyU8wVt96Hxye3Q70uaOnnAFMtISzwaustld1rpfAUhKwNKD 0JAr2xIM/SaofA2XXLR1JWepPRjyW6bpQQafKPfdUFVInQ7HrwS16Xb+2I/zLtKh640Z vlcbsc200a4DnoIpL+c11XcSew5x+QEUiTNAp7DFhsvmVqA2PAepziQTKk5yUullIkFs meZdpaBFfI6OIbd2oDtsencypQlXYhw89rBbfaebXM0QIYpyaC6yawKPel6dvJ00amkX rJuA== 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=CrZNI1SxmaS+Q1Ja/qtDT6B5V9ddvf4cp0nG/uUGkSI=; b=C1pNl7ri2W9k6SX9RLXhm2G0hR7HDEec+2KyI6GJNHA6SVMJ5uDNqRUfoDduH2ZoDL 2oCPiVJf6qdxdV6fSCAOxumZy3HR+iZzuew/7LrWN8YlvsZO6zLcycD4BhNysdotHcwu zkIq2YV4182qX8Vju0uyr9wkqXfL8/Tdp3olBuyChtQTKmrmCurasmYis78Eqzrt8XH5 DleOKnNIMEGmGEBaWNgc/+ZTBDr1NARuHiTEpuKOclxLvci2ADR1S1DDsf0txadZIbTr vaAUcqiNK+R9crwcgDrdO25JZQcWxKPU+W1tQ1QfnfUMlRmtg+JcYV5F5zJZvemJo7ic j9yA== X-Gm-Message-State: AOAM530kqcv7+Ue0L4qUikg9D97Zopr/3bIJ3FoCtO6Ftzo7oj1/kqZ4 xb/qbt64TgayTzyff9pHNseLa0hNzvYSLw== X-Received: by 2002:a17:902:e74e:b0:151:c46f:6e18 with SMTP id p14-20020a170902e74e00b00151c46f6e18mr4491481plf.32.1646911670987; Thu, 10 Mar 2022 03:27:50 -0800 (PST) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id js15-20020a17090b148f00b001bfc8614b93sm3114977pjb.1.2022.03.10.03.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Mar 2022 03:27:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 22/48] target/nios2: Hoist CPU_LOG_INT logging Date: Thu, 10 Mar 2022 03:26:59 -0800 Message-Id: <20220310112725.570053-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220310112725.570053-1-richard.henderson@linaro.org> References: <20220310112725.570053-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102f (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: marex@denx.de, peter.maydell@linaro.org, amir.gonnen@neuroblade.ai Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Performing this early means that we can merge more cases within the non-logging switch statement. Signed-off-by: Richard Henderson --- target/nios2/helper.c | 58 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/target/nios2/helper.c b/target/nios2/helper.c index 6019e2443b..285f3aae1d 100644 --- a/target/nios2/helper.c +++ b/target/nios2/helper.c @@ -90,20 +90,64 @@ void nios2_cpu_do_interrupt(CPUState *cs) Nios2CPU *cpu = NIOS2_CPU(cs); CPUNios2State *env = &cpu->env; + if (qemu_loglevel_mask(CPU_LOG_INT)) { + const char *name = NULL; + + switch (cs->exception_index) { + case EXCP_IRQ: + name = "interrupt"; + break; + case EXCP_TLBD: + if (env->ctrl[CR_STATUS] & CR_STATUS_EH) { + name = "TLB MISS (double)"; + } else { + name = "TLB MISS (fast)"; + } + break; + case EXCP_TLBR: + case EXCP_TLBW: + case EXCP_TLBX: + name = "TLB PERM"; + break; + case EXCP_SUPERA: + case EXCP_SUPERD: + name = "SUPERVISOR (address)"; + break; + case EXCP_SUPERI: + name = "SUPERVISOR (insn)"; + break; + case EXCP_ILLEGAL: + name = "ILLEGAL insn"; + break; + case EXCP_TRAP: + name = "TRAP insn"; + break; + case EXCP_BREAK: + name = "TRAP insn"; + break; + case EXCP_SEMIHOST: + name = "SEMIHOST insn"; + break; + } + if (name) { + qemu_log("%s at pc=0x%08x\n", name, env->pc); + } else { + qemu_log("Unknown exception %d at pc=0x%08x\n", + cs->exception_index, env->pc); + } + } + switch (cs->exception_index) { case EXCP_IRQ: - qemu_log_mask(CPU_LOG_INT, "interrupt at pc=%x\n", env->pc); do_iic_irq(cpu); break; case EXCP_TLBD: if ((env->ctrl[CR_STATUS] & CR_STATUS_EH) == 0) { - qemu_log_mask(CPU_LOG_INT, "TLB MISS (fast) at pc=%x\n", env->pc); env->ctrl[CR_TLBMISC] &= ~CR_TLBMISC_DBL; env->ctrl[CR_TLBMISC] |= CR_TLBMISC_WE; do_exception(cpu, cpu->fast_tlb_miss_addr, false); } else { - qemu_log_mask(CPU_LOG_INT, "TLB MISS (double) at pc=%x\n", env->pc); env->ctrl[CR_TLBMISC] |= CR_TLBMISC_DBL; do_exception(cpu, cpu->exception_addr, false); } @@ -112,7 +156,6 @@ void nios2_cpu_do_interrupt(CPUState *cs) case EXCP_TLBR: case EXCP_TLBW: case EXCP_TLBX: - qemu_log_mask(CPU_LOG_INT, "TLB PERM at pc=%x\n", env->pc); if ((env->ctrl[CR_STATUS] & CR_STATUS_EH) == 0) { env->ctrl[CR_TLBMISC] |= CR_TLBMISC_WE; } @@ -122,23 +165,16 @@ void nios2_cpu_do_interrupt(CPUState *cs) case EXCP_SUPERA: case EXCP_SUPERI: case EXCP_SUPERD: - qemu_log_mask(CPU_LOG_INT, "SUPERVISOR exception at pc=%x\n", env->pc); - do_exception(cpu, cpu->exception_addr, false); - break; - case EXCP_ILLEGAL: case EXCP_TRAP: - qemu_log_mask(CPU_LOG_INT, "TRAP exception at pc=%x\n", env->pc); do_exception(cpu, cpu->exception_addr, false); break; case EXCP_BREAK: - qemu_log_mask(CPU_LOG_INT, "BREAK exception at pc=%x\n", env->pc); do_exception(cpu, cpu->exception_addr, true); break; case EXCP_SEMIHOST: - qemu_log_mask(CPU_LOG_INT, "BREAK semihosting at pc=%x\n", env->pc); env->pc += 4; do_nios2_semihosting(env); break;