From patchwork Tue Jun 18 15:59:52 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: 805223 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:144:b0:362:4979:7f74 with SMTP id r4csp271985wrx; Tue, 18 Jun 2024 09:04:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV+T9/I7wdu6+DQoRKYCol3iwEFn7cFEFgElprBN4g3HraJ0NeuA+vS4WSv3KFTuWDE6zXpEYEtHOWnve51VO3B X-Google-Smtp-Source: AGHT+IGxrMkETsZcRxghW1SuBdQm0MZkcRW+7LdohFsHlYYlru0j9rTOYIW+ELpUUBd33bzPh9bC X-Received: by 2002:ac8:590c:0:b0:441:56d2:6d0 with SMTP id d75a77b69052e-444a7a8960dmr2114661cf.68.1718726677851; Tue, 18 Jun 2024 09:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718726677; cv=none; d=google.com; s=arc-20160816; b=DaCEJPbSSq6ezNfbfcn3ObciJT7CgtLnlWvUwrHpAW55DbqtBp6HRcyB8Ux02C2Rgn dD4DhnGnAXDp1TyyeFERFNTuQT49ZB1LLTFwNgBLQhTpyi0lajQzdRcUUaKc9pqNEXMg IpcokyCxTJ59TgBU7Nd3K9dWo0nZg4Il5wuJXhSe5I9WrtlPXxNrAwy+BiBqYvp+50iT 7lqa55deGqbYzXTuyobru7EdRxwklSQzpBqDtYyQzIEYFgLDX5s+vqBfOvCnRHjRK4H7 SXUV9hqYbBmu791hIxh06hx+wjaO/or+BNAsJhZNv233ym4iMEF6H1DyR5fcEHWKEhaf i06g== 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=RbmmnCUJBjQWo1lmiofvPL4byDgdBrAqOfBylHKE/0k=; fh=Q+oQ03yQfuoTTxzUPDLJKoTd4xZYvGHM4rKHQJt4bQ4=; b=BdqVeKp6tq7kLsnYKIvgInP/Wm7Q8bXDJq9pPO4+NAkCHep7d747AjXQ6eKrdmoJeq Ski0W0R2biMeIhKu/Ck3rhN3NcCqMV9zu6/1gDGCH8QxAIVBEXqJc6dRiwtax+Wo7OAn CMLJtNrjAkaYv6i/QWprlbOJv3TONX9QOn47hcrzc/tlRHHp+e9hyIbjiPNp7SY7adjH KjJ7bowXV9FskAPL1OawR/DfiSX/raZ0QdovA2lU1JolOkj+ahcOaZZ4HVaSJc/YHGGc GrUjvm0bIB47jO+9Wg5vJvkg4qeHZYKcm/ZHFlPPPtEqjmg8ogyJEGJhM9fnNrArG7ox RJTg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oqNZLc/N"; 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 d75a77b69052e-441ef3bc7e9si122039491cf.126.2024.06.18.09.04.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jun 2024 09:04:37 -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="oqNZLc/N"; 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 1sJbJA-0008Fc-63; Tue, 18 Jun 2024 12:03:44 -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 1sJbJ7-0008AG-GL for qemu-devel@nongnu.org; Tue, 18 Jun 2024 12:03:41 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJbJ5-0007CW-JC for qemu-devel@nongnu.org; Tue, 18 Jun 2024 12:03:41 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a6f176c5c10so689472866b.2 for ; Tue, 18 Jun 2024 09:03:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718726618; x=1719331418; 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=RbmmnCUJBjQWo1lmiofvPL4byDgdBrAqOfBylHKE/0k=; b=oqNZLc/NhQz1X+mJbZsecpMWzGNcxBGSQkxsNbFMnftoS1wMSoblwQTqJNpVZ/0qZG sTsdPkTdLL+z7KHRYJeKntiDTvP+3YhmNcCAu9QH7WsdJTRCNGfqszaDKiTvfBsuzOPT qCHuwDW9I/QyHJXOQdZuooIop4HT+C5guTR0+KeQa0DxreuEYCPQYM4OJHfIlkKEteYj EO2xvqug3w+MRtRbyGQzsbhnYovg11OSaq6a3NNoi42gDcUgWcpRwg13Rlaiol/DUTO2 vMZCSy/SGYS0XjQ3lGen4VMnDYLosFS1q72e+iJ7cwQuiUoaVR71g5jjye9JiGOb54KO DenA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718726618; x=1719331418; 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=RbmmnCUJBjQWo1lmiofvPL4byDgdBrAqOfBylHKE/0k=; b=UedaKTOJ+1EEOamY3X100G5Eou6JDSnplCAX6IsR+EpjI9mII+b6QxwXQ3fC9sdaVm IioCcnMxAr4AAYcj1+DZQ0QGZYEjDlGTB/GvWTTi2AP6AEuFcEW/yJBuuD3NGWROSzhN hHu443zJBCHuW1qE8HKTP6uXy1EKc2dIN4HgHjDR+VenC1dodGlmdSWmOPXGBZtNkNqS SzlI9h4sJyuw8W2vSuA4FtJ2P91LZS7Ra9xgXmPAryEMb/+pMcHhNrJwgFoUDhgu/tBc coLyEXzdxAshh/dwuyj6BRzVyrOpYRzyU6KsK7sIvgO9TjkE1znMPHgy/4eivnASte0N guaQ== X-Gm-Message-State: AOJu0YxSPVYfCKLMfjWPWb1u2yj0NqZPhl1E4Wc0DrBC4oAsTkdNc/5k xUDAZPE/rlQgpJjT5Tms8zTtQAMR1eRRiq91sMGPlCbZT2yjQhrqXo1jD90byfFTEwvE1kHXUoa 2 X-Received: by 2002:a17:906:3693:b0:a6f:5318:b8f7 with SMTP id a640c23a62f3a-a6f60d420f5mr964758566b.43.1718726617915; Tue, 18 Jun 2024 09:03:37 -0700 (PDT) Received: from m1x-phil.lan ([176.187.212.55]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56db6182sm630018366b.51.2024.06.18.09.03.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 18 Jun 2024 09:03:37 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , =?utf-8?q?C=C3=A9dric?= =?utf-8?q?_Le_Goater?= , Harsh Prateek Bora Subject: [PULL 30/76] hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info() Date: Tue, 18 Jun 2024 17:59:52 +0200 Message-ID: <20240618160039.36108-31-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240618160039.36108-1-philmd@linaro.org> References: <20240618160039.36108-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.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-bounces+patch=linaro.org@nongnu.org Replace Monitor API by HumanReadableText one. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Cédric Le Goater Reviewed-by: Harsh Prateek Bora Message-Id: <20240610062105.49848-7-philmd@linaro.org> --- include/hw/ppc/xive_regs.h | 2 +- hw/intc/spapr_xive.c | 7 ++++++- hw/intc/xive.c | 17 +++++++++++------ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/include/hw/ppc/xive_regs.h b/include/hw/ppc/xive_regs.h index 4a3c9badd3..51e9a2152e 100644 --- a/include/hw/ppc/xive_regs.h +++ b/include/hw/ppc/xive_regs.h @@ -262,7 +262,7 @@ static inline uint64_t xive_end_qaddr(XiveEND *end) } void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, Monitor *mon); -void xive_end_queue_pic_print_info(XiveEND *end, uint32_t width, Monitor *mon); +void xive_end_queue_pic_print_info(XiveEND *end, uint32_t width, GString *buf); void xive_end_eas_pic_print_info(XiveEND *end, uint32_t end_idx, Monitor *mon); /* Notification Virtual Target (NVT) */ diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index b7c12aa432..3357f6325f 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -142,12 +142,17 @@ static void spapr_xive_end_pic_print_info(SpaprXive *xive, XiveEND *end, uint32_t qentries = 1 << (qsize + 10); uint32_t nvt = xive_get_field32(END_W6_NVT_INDEX, end->w6); uint8_t priority = xive_get_field32(END_W7_F0_PRIORITY, end->w7); + g_autoptr(GString) buf = g_string_new(""); + g_autoptr(HumanReadableText) info = NULL; monitor_printf(mon, "%3d/%d % 6d/%5d @%"PRIx64" ^%d", spapr_xive_nvt_to_target(0, nvt), priority, qindex, qentries, qaddr_base, qgen); - xive_end_queue_pic_print_info(end, 6, mon); + xive_end_queue_pic_print_info(end, 6, buf); + + info = human_readable_text_from_str(buf); + monitor_puts(mon, info->human_readable_text); } /* diff --git a/hw/intc/xive.c b/hw/intc/xive.c index a0d7e7ca67..260a94e2ca 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -11,6 +11,7 @@ #include "qemu/log.h" #include "qemu/module.h" #include "qapi/error.h" +#include "qapi/type-helpers.h" #include "target/ppc/cpu.h" #include "sysemu/cpus.h" #include "sysemu/dma.h" @@ -1323,7 +1324,7 @@ static const TypeInfo xive_source_info = { * XiveEND helpers */ -void xive_end_queue_pic_print_info(XiveEND *end, uint32_t width, Monitor *mon) +void xive_end_queue_pic_print_info(XiveEND *end, uint32_t width, GString *buf) { uint64_t qaddr_base = xive_end_qaddr(end); uint32_t qsize = xive_get_field32(END_W0_QSIZE, end->w0); @@ -1334,7 +1335,7 @@ void xive_end_queue_pic_print_info(XiveEND *end, uint32_t width, Monitor *mon) /* * print out the [ (qindex - (width - 1)) .. (qindex + 1)] window */ - monitor_printf(mon, " [ "); + g_string_append_printf(buf, " [ "); qindex = (qindex - (width - 1)) & (qentries - 1); for (i = 0; i < width; i++) { uint64_t qaddr = qaddr_base + (qindex << 2); @@ -1346,11 +1347,11 @@ void xive_end_queue_pic_print_info(XiveEND *end, uint32_t width, Monitor *mon) HWADDR_PRIx "\n", qaddr); return; } - monitor_printf(mon, "%s%08x ", i == width - 1 ? "^" : "", - be32_to_cpu(qdata)); + g_string_append_printf(buf, "%s%08x ", i == width - 1 ? "^" : "", + be32_to_cpu(qdata)); qindex = (qindex + 1) & (qentries - 1); } - monitor_printf(mon, "]"); + g_string_append_c(buf, ']'); } void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, Monitor *mon) @@ -1365,6 +1366,8 @@ void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, Monitor *mon) uint32_t nvt_idx = xive_get_field32(END_W6_NVT_INDEX, end->w6); uint8_t priority = xive_get_field32(END_W7_F0_PRIORITY, end->w7); uint8_t pq; + g_autoptr(GString) buf = g_string_new(""); + g_autoptr(HumanReadableText) info = NULL; if (!xive_end_is_valid(end)) { return; @@ -1389,8 +1392,10 @@ void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, Monitor *mon) if (qaddr_base) { monitor_printf(mon, " eq:@%08"PRIx64"% 6d/%5d ^%d", qaddr_base, qindex, qentries, qgen); - xive_end_queue_pic_print_info(end, 6, mon); + xive_end_queue_pic_print_info(end, 6, buf); } + info = human_readable_text_from_str(buf); + monitor_puts(mon, info->human_readable_text); monitor_printf(mon, "\n"); }