From patchwork Thu Mar 21 15:48:27 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: 781575 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp901260wrj; Thu, 21 Mar 2024 08:52:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX3sTEQlE/v49c5V3q2TqZItyYcMKMPV+PXvjbodkLsy6H7YZKX1OtpyH5zITSS4xEOn1DvSnG18Fpd+ePKRZQP X-Google-Smtp-Source: AGHT+IGJV1imgEgdhufE1NG959bN+SsWjZyp6BGjARMWiDztkcSZ9Vexuriq3eVSAulssTNp0sg8 X-Received: by 2002:adf:fec9:0:b0:341:84ec:fff8 with SMTP id q9-20020adffec9000000b0034184ecfff8mr1812187wrs.20.1711036326451; Thu, 21 Mar 2024 08:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711036326; cv=none; d=google.com; s=arc-20160816; b=GKVF1j4eeGs7zz+5RrtuCQt8XxwrRF56rxfFdaiOqMObtm+mTeIospKH74gyD++257 k1Y2dSCCBwKW67NxrhCVOZcKFEw3LHDfE5ZWrc2oUH86SxMcZm9BKH8OhrIiaBZP38Yi XzZZkXc78bvuOCLoVaHddFLY/qCCrfjvUtGAcxQ2GlH1a1L6g8L4B4cQa7NeRTKCHftR lbgtSp5QWhru7UxjrRs2gi4R7ypWyqW3TpAH+jDnunWg6VtuBIV3ocVR+W+MyPNRT+8+ Ksy2q+nJEnv4gDKzNUuDpA6ilWPs9VivWffP0fUP8v6zLqWd1zrB7wTwCoNzUyXTZi89 irOw== 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=kaYDCoOXgjCF3J0hi/NBXkeoqt0AB2bCPsQIdEK8J3A=; fh=T6rKnw5qbXdIf08MbaczezOCfCSVJgQaY05KIUhs/sE=; b=Wyr3966xZEaJIjBpoKad/bCnJykLWzd7t4oRscpbrAboOCSWArtX9I8eOnQtR/LSx3 dsexpDBjc+UbnpTkN6efwUPMsaul9iZVPFPi3L6AeAiglbBMH4OeLzATdyc9zLruxX1d IKagwfszTbf0VK822x6tkrB4T6RvqI6FgFxXUvzWetRxI1knPZZoNRU84GN1RZf0an1c zCDbFrsY87A1QF92BRCzSTeHFfQ6ruJaFrqppR7H9AYKjFd4Z6SbVc4OvPebGEJqkUCC SnYRfn/nPda/IM7wcyqk2Kom1RjMqXJjKhASium8qSB9ZuT5mvB+Svq+POfqko8X7CAi cecw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=beIQHEzs; 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 m8-20020a5d6a08000000b0033e9b918413si8507212wru.1037.2024.03.21.08.52.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Mar 2024 08:52:06 -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=beIQHEzs; 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 1rnKgZ-0007Qd-9V; Thu, 21 Mar 2024 11:50:31 -0400 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 1rnKgH-00070o-Qf for qemu-devel@nongnu.org; Thu, 21 Mar 2024 11:50:14 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rnKgE-0001ko-9V for qemu-devel@nongnu.org; Thu, 21 Mar 2024 11:50:12 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-414776775d3so2813905e9.3 for ; Thu, 21 Mar 2024 08:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711036207; x=1711641007; 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=kaYDCoOXgjCF3J0hi/NBXkeoqt0AB2bCPsQIdEK8J3A=; b=beIQHEzsMkZHTnO66WKDRpglA39EuEcATRPxx/Fj3DZJu4HCENmfm51036hrCVrwE8 AsAlRaA8tzvgRTYQfnoIer1h0cieAy4hhSTKS0DRoovqnJfuSPYjvtekA4GtDS9zs26n diolqu7sCCrxGs08ZAFhIb+U1tniflycdUlG2pSsNQUOUe2OssgFBC+Y1gtsdy6QwRla gkuR2XZZmDXvTN98qNJIj/t+LOWrmJBERq6L4sqS2uQlRRjXUGrluzsRWya/vRmU4xdn 3cQElUiPEdBCj94BdGVPCG0TtLcxrOH+XyCEG806Ng4/NOvSByKXUCI74yfJwMqNAIcr HaLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711036207; x=1711641007; 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=kaYDCoOXgjCF3J0hi/NBXkeoqt0AB2bCPsQIdEK8J3A=; b=XPueGN7nIHd+ReadXcacNWzyHF4T8KUqmOSvgRQaZogb5gWi1J08woWS4MT4Yl2zeb 4uU4gCAHl1sJSibG9Ptc5GHKXcbkxhC+JJNve6Mb1o/XT4nYxDSeAhJRh70Z2X+EbfJn Y+lS96rb9aCMFpR6Ob2f5xhF3OT2evvuCDzlYlsWfjfrEGJlSBBjt8c0tziB8/u2tPy/ 7cm02IsiOKiOmWZm9QanTjLqOANZOKSEOds/sqiixJ9UTKx+5xz0PdVj2cXiYCWFMU2r d+45c4iGv45tEOmyQTSgyU154LLpna/xrrKJYBI/TKkY1Xao8geNFA8a1OFH3q4A/dzk 4F7A== X-Gm-Message-State: AOJu0YxR8CpVeCrBdXr9YBNTnhVDxxnYJx3YH9zynwbWLfAV5gI/I3Kp iB+wjO4KB3oKmZUuYrfuHO9/Ge9Gr7nhLhtQJPE8qX9bfNq3jPbmGsfh/AoDmLinUBvidfULXRl mlas= X-Received: by 2002:a05:600c:1c20:b0:414:645c:33cd with SMTP id j32-20020a05600c1c2000b00414645c33cdmr1714797wms.32.1711036207350; Thu, 21 Mar 2024 08:50:07 -0700 (PDT) Received: from m1x-phil.lan ([176.187.206.222]) by smtp.gmail.com with ESMTPSA id n18-20020a05600c501200b004146bdce3fesm5885327wmr.4.2024.03.21.08.50.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 21 Mar 2024 08:50:06 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Artyom Tarasenko , Chris Wulff , "Edgar E. Iglesias" , Marek Vasut , Max Filippov , "Dr . David Alan Gilbert" , Jiaxun Yang , Nicholas Piggin , Paolo Bonzini , Daniel Henrique Barboza , Yoshinori Sato , Markus Armbruster , Richard Henderson , qemu-ppc@nongnu.org, Laurent Vivier , Mark Cave-Ayland , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH-for-9.1 11/21] target/nios2: Move monitor commands to monitor.c Date: Thu, 21 Mar 2024 16:48:27 +0100 Message-ID: <20240321154838.95771-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240321154838.95771-1-philmd@linaro.org> References: <20240321154838.95771-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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 Move 'info tlb' monitor commands to monitor.c, rename dump_mmu() as nios2_info_mmu(). Signed-off-by: Philippe Mathieu-Daudé --- target/nios2/cpu.h | 2 +- target/nios2/mmu.c | 27 --------------------------- target/nios2/monitor.c | 28 +++++++++++++++++++++++++++- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index 4164a3432e..27e835cf40 100644 --- a/target/nios2/cpu.h +++ b/target/nios2/cpu.h @@ -250,7 +250,7 @@ static inline void nios2_update_crs(CPUNios2State *env) void nios2_tcg_init(void); void nios2_cpu_do_interrupt(CPUState *cs); -void dump_mmu(CPUNios2State *env); +void nios2_info_mmu(Monitor *mon, CPUNios2State *env); void nios2_cpu_dump_state(CPUState *cpu, FILE *f, int flags); G_NORETURN void nios2_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, MMUAccessType access_type, int mmu_idx, diff --git a/target/nios2/mmu.c b/target/nios2/mmu.c index 272bd9fc6a..278eba1b0a 100644 --- a/target/nios2/mmu.c +++ b/target/nios2/mmu.c @@ -19,7 +19,6 @@ */ #include "qemu/osdep.h" -#include "qemu/qemu-print.h" #include "cpu.h" #include "exec/exec-all.h" #include "mmu.h" @@ -187,29 +186,3 @@ void nios2_mmu_init(CPUNios2State *env) mmu->tlb_entry_mask = (cpu->tlb_num_entries / cpu->tlb_num_ways) - 1; mmu->tlb = g_new0(Nios2TLBEntry, cpu->tlb_num_entries); } - -void dump_mmu(CPUNios2State *env) -{ - Nios2CPU *cpu = env_archcpu(env); - int i; - - qemu_printf("MMU: ways %d, entries %d, pid bits %d\n", - cpu->tlb_num_ways, cpu->tlb_num_entries, - cpu->pid_num_bits); - - for (i = 0; i < cpu->tlb_num_entries; i++) { - Nios2TLBEntry *entry = &env->mmu.tlb[i]; - qemu_printf("TLB[%d] = %08X %08X %c VPN %05X " - "PID %02X %c PFN %05X %c%c%c%c\n", - i, entry->tag, entry->data, - (entry->tag & (1 << 10)) ? 'V' : '-', - entry->tag >> 12, - entry->tag & ((1 << cpu->pid_num_bits) - 1), - (entry->tag & (1 << 11)) ? 'G' : '-', - FIELD_EX32(entry->data, CR_TLBACC, PFN), - (entry->data & CR_TLBACC_C) ? 'C' : '-', - (entry->data & CR_TLBACC_R) ? 'R' : '-', - (entry->data & CR_TLBACC_W) ? 'W' : '-', - (entry->data & CR_TLBACC_X) ? 'X' : '-'); - } -} diff --git a/target/nios2/monitor.c b/target/nios2/monitor.c index 0152dec3fa..c6043769e4 100644 --- a/target/nios2/monitor.c +++ b/target/nios2/monitor.c @@ -22,14 +22,40 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/qemu-print.h" #include "cpu.h" #include "monitor/monitor.h" #include "monitor/hmp-target.h" #include "monitor/hmp.h" +void nios2_info_mmu(Monitor *mon, CPUNios2State *env) +{ + Nios2CPU *cpu = env_archcpu(env); + + qemu_printf("MMU: ways %d, entries %d, pid bits %d\n", + cpu->tlb_num_ways, cpu->tlb_num_entries, + cpu->pid_num_bits); + + for (int i = 0; i < cpu->tlb_num_entries; i++) { + Nios2TLBEntry *entry = &env->mmu.tlb[i]; + qemu_printf("TLB[%d] = %08X %08X %c VPN %05X " + "PID %02X %c PFN %05X %c%c%c%c\n", + i, entry->tag, entry->data, + (entry->tag & (1 << 10)) ? 'V' : '-', + entry->tag >> 12, + entry->tag & ((1 << cpu->pid_num_bits) - 1), + (entry->tag & (1 << 11)) ? 'G' : '-', + FIELD_EX32(entry->data, CR_TLBACC, PFN), + (entry->data & CR_TLBACC_C) ? 'C' : '-', + (entry->data & CR_TLBACC_R) ? 'R' : '-', + (entry->data & CR_TLBACC_W) ? 'W' : '-', + (entry->data & CR_TLBACC_X) ? 'X' : '-'); + } +} + void hmp_info_tlb(Monitor *mon, const QDict *qdict) { CPUArchState *env1 = mon_get_cpu_env(mon); - dump_mmu(env1); + nios2_info_mmu(mon, env1); }