From patchwork Mon Jun 10 06:20:40 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: 802974 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp1799463wro; Sun, 9 Jun 2024 23:22:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUbuekewsoKeZhNjGDBxDx2CXxKlVNvD/q4yFQa0bTzI8jkDhKI12pNWmZIlmOAv9PfkoOxECqykifb8+SRzlqA X-Google-Smtp-Source: AGHT+IGsXvoQbHdvSk87WnY49HrIIldkm+rDYh3iR6m9K30hX7Ygr37hx3r2z7rGBKj/edLbKuFi X-Received: by 2002:a05:620a:3186:b0:797:a280:edc0 with SMTP id af79cd13be357-797a280ef76mr19863185a.16.1718000570181; Sun, 09 Jun 2024 23:22:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718000570; cv=none; d=google.com; s=arc-20160816; b=jAhU1xqFhKAW5m+uvvMJm0U5LdcDNQZ0kF/FzRjgbSTK6G7eo362qBAfrNI6Fcif2d yMwy5sWnqK4Vtssc+5ZKmEAzWarc0RuTpYdEarYsA/36qgqrUC7os2ER9n37zp9hGtJ2 gHLLYlbv5PRHaOSLU+gvsKZD9t6l2zw1EM11pUj4G/PUqAfwrpZ0g75yWdwjeG6qCp2s vqu9kTbT5ncYxiQxpXIu9K0U5czEp3d0nKbJVY/d3dBMU4g6zhTEcLmAqDFF3cnLwgAF Cw+EkWRt4qT+agvrzxoUftfrIx9QWke2BkfZMg0Vnb4aZEu7OzTDfrRVP1YXixGcQ0nE rHbg== 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=bRaRL501WvQ0swv15S662THilyXH6kAx9FOW+Jx2/Sg=; fh=hC5FiRCNiggiG2AJlogWERqCtylTs4whX75JZ3qP4Qc=; b=Wf95uE2do3XmdVV2k6rl770qfBOGLTqy2+exnI7JaJRqmzzfrH2bx+Jsk0KFm1Lax5 Bn+ekyq1T8/HvW4RnPKyQssIXJkphQeCZ8LMt6H70SO/LBwSxa+mGz0pAoNRPNHOIekB tZ4FhqRbHSYO6FzgcuhdHsuOo5ONgjicCy0iNu6ezn3ubV13KnJQHKHnAiZPwulGY+8J Zpqrti4SBW3DeVXhuapjW3rh0COrsSHuwQtw+JMiZx7oHffvk3lO4o56OiNGBBQEPpCm u0Rx+ASLeKQ76Y8PuNTxd8DYXbhEDHsiQe2RcSKrMikOUo8fS6V7stivPrcH35enR1sF GK/Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nn1nfKPY; 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 af79cd13be357-7955703b4d6si452841885a.24.2024.06.09.23.22.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jun 2024 23:22:50 -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=Nn1nfKPY; 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 1sGYPJ-0002On-Bt; Mon, 10 Jun 2024 02:21:29 -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 1sGYPE-0002NF-01 for qemu-devel@nongnu.org; Mon, 10 Jun 2024 02:21:24 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sGYPB-0004Jt-JZ for qemu-devel@nongnu.org; Mon, 10 Jun 2024 02:21:23 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-421d32fda86so5119205e9.0 for ; Sun, 09 Jun 2024 23:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718000479; x=1718605279; 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=bRaRL501WvQ0swv15S662THilyXH6kAx9FOW+Jx2/Sg=; b=Nn1nfKPYP3NxM3yM9Bj+MrQkjN+nMPYUgVfeDFkfOQBinbItZ87y8WdBc86g2U055G 6hVhPv7Alp+mlEoZb4aHwDHa03bS34xg0lKMkRoYdvWhV98BLpbaAPd0kxWvMf3+VhGs kVy/zHmJ5qVR/EN9e0jifUAsGKVc1cH75iBpBbLWY5NDwG8lTokg79mvgniUPlU28tXq zFEk9Ws0lPJQq4Ry0tAXdUEib5kvXCNi+1fVe2vyNnVdqhif2Oq8GSLsikXw+BPivIyx 1OlA+1Pd7m/4MS3lHSvDbmPNgkVV8htH+cSLWA4Em/N5eR/Vdpr5O1t7544p+xPg4Y9T u8zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718000479; x=1718605279; 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=bRaRL501WvQ0swv15S662THilyXH6kAx9FOW+Jx2/Sg=; b=C8Y8o3wtT8iz4snk74XKWkKX+0owbX/tL6cVDsXdqOWTQQpcA3JWhpzu2Si1SpmgzQ T4XnYy08lFW3DByh31vgm1aBEg25HZQIIr6g5g2NMzUNo95jw4xCC9MEnd4CCC6/yUUR CjWucg9eUT7v9p1BXJ1h4OM7jzWANenV5TEuJ54aKqQbPqL0NIDMi+nyLLxi+mAwiQvi Upgub+cvTUz4dUVmYeAsWVH2WXyelj9j3whz+lCTWuA/wLKhhULonU0OTxKg3ND2Llrl 8OMvqr9iQBj2DHtTjurHNaTRiVDak9gTNGywPQMorUSrot2t7KVwqYX0yw6jbjFL3W33 E+1g== X-Gm-Message-State: AOJu0Yz7iMvYsTB8m0yI7k36hC9YcqpvCH4WBP+aMOxB/abfdh/ZWrnV yk2YccaO3dR2GovP+sTUD7j1dIjx80vVOzU4lbQOitAhA20VQe6LTb9DGFstvd3ML+Obwf9IBdP Z X-Received: by 2002:a05:600c:510b:b0:421:5a2d:b7d9 with SMTP id 5b1f17b1804b1-42164a0adf6mr87329745e9.20.1718000479680; Sun, 09 Jun 2024 23:21:19 -0700 (PDT) Received: from m1x-phil.lan ([176.176.129.242]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c2c7396sm130025655e9.33.2024.06.09.23.21.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 09 Jun 2024 23:21:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Harsh Prateek Bora , qemu-ppc@nongnu.org, Nicholas Piggin , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= , David Gibson , =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 02/26] hw/ppc: Avoid using Monitor in icp_pic_print_info() Date: Mon, 10 Jun 2024 08:20:40 +0200 Message-ID: <20240610062105.49848-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240610062105.49848-1-philmd@linaro.org> References: <20240610062105.49848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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 Replace Monitor API by HumanReadableText one. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/ppc/xics.h | 2 +- hw/intc/xics.c | 8 ++++---- hw/intc/xics_spapr.c | 8 +++++++- hw/ppc/pnv.c | 8 +++++++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 95ead0dd7c..1116aa6953 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -171,7 +171,7 @@ static inline bool ics_irq_free(ICSState *ics, uint32_t srcno) } void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); -void icp_pic_print_info(ICPState *icp, Monitor *mon); +void icp_pic_print_info(ICPState *icp, GString *buf); void ics_pic_print_info(ICSState *ics, Monitor *mon); void ics_resend(ICSState *ics); diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 9b3b7abaea..039e10a0e4 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -42,7 +42,7 @@ #include "sysemu/reset.h" #include "target/ppc/cpu.h" -void icp_pic_print_info(ICPState *icp, Monitor *mon) +void icp_pic_print_info(ICPState *icp, GString *buf) { int cpu_index; @@ -63,9 +63,9 @@ void icp_pic_print_info(ICPState *icp, Monitor *mon) icp_synchronize_state(icp); } - monitor_printf(mon, "CPU %d XIRR=%08x (%p) PP=%02x MFRR=%02x\n", - cpu_index, icp->xirr, icp->xirr_owner, - icp->pending_priority, icp->mfrr); + g_string_append_printf(buf, "CPU %d XIRR=%08x (%p) PP=%02x MFRR=%02x\n", + cpu_index, icp->xirr, icp->xirr_owner, + icp->pending_priority, icp->mfrr); } void ics_pic_print_info(ICSState *ics, Monitor *mon) diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index 37b2d99977..bab9d88218 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -34,6 +34,8 @@ #include "hw/ppc/xics_spapr.h" #include "hw/ppc/fdt.h" #include "qapi/visitor.h" +#include "qapi/type-helpers.h" +#include "monitor/monitor.h" /* * Guest interfaces @@ -399,12 +401,16 @@ static void xics_spapr_print_info(SpaprInterruptController *intc, Monitor *mon) { ICSState *ics = ICS_SPAPR(intc); CPUState *cs; + g_autoptr(GString) buf = g_string_new(""); + g_autoptr(HumanReadableText) info = NULL; CPU_FOREACH(cs) { PowerPCCPU *cpu = POWERPC_CPU(cs); - icp_pic_print_info(spapr_cpu_state(cpu)->icp, mon); + icp_pic_print_info(spapr_cpu_state(cpu)->icp, buf); } + info = human_readable_text_from_str(buf); + monitor_puts(mon, info->human_readable_text); ics_pic_print_info(ics, mon); } diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 5356a4e295..fa23b27a2b 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1130,7 +1130,13 @@ static void pnv_chip_power8_intc_destroy(PnvChip *chip, PowerPCCPU *cpu) static void pnv_chip_power8_intc_print_info(PnvChip *chip, PowerPCCPU *cpu, Monitor *mon) { - icp_pic_print_info(ICP(pnv_cpu_state(cpu)->intc), mon); + g_autoptr(GString) buf = g_string_new(""); + g_autoptr(HumanReadableText) info = NULL; + + icp_pic_print_info(ICP(pnv_cpu_state(cpu)->intc), buf); + + info = human_readable_text_from_str(buf); + monitor_puts(mon, info->human_readable_text); } /*