From patchwork Thu Aug 1 10:07:42 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: 816034 Delivered-To: patch@linaro.org Received: by 2002:a5d:4acf:0:b0:367:895a:4699 with SMTP id y15csp1110343wrs; Thu, 1 Aug 2024 03:08:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXbx6iTLArTEgv00POBGs+XPGKr0atqGeoew05o/TW9i12MQhnd8E9UdFkOQFCAB5MOFrLGrPwn9r7m4sDhzeIS X-Google-Smtp-Source: AGHT+IGhm+GrEE4yx1zbaMh3f/sS/0xXMvi+VP1wLzTTpsdGsHHWQ2YfiHgIBw2A71iI0t7lKzt5 X-Received: by 2002:ac8:5793:0:b0:44f:f140:ceb8 with SMTP id d75a77b69052e-451567c448cmr24151171cf.53.1722506909298; Thu, 01 Aug 2024 03:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722506909; cv=none; d=google.com; s=arc-20160816; b=rMRFtVqL5ySSS9BqfkT3FPxnnJt3LVIEOjtdxHiP2+gyPOwqLYtYJ4QWuomeQVSEb/ A9n17kLjhQPqVma6Q86c2o9DzVVEcQIMp5hAYKOsfOg1FnvqsvxJm4vyigQgqHIewVVF 4jHw33UNKgbQ8/KTXKHE1TlzSymxKkBIVGZioJ3pkiDzizZarDo0kDYgF7iT13kn4k+t wn8bTjNwxU6JTjp1ArbYYQeeZYgZ6kVqyMfLTS/4YAft2DEK1s2z8m788dUSeZvvycSM RH/9sCVeI/8ifKvNR9R2QHn4a9Rms45KiDt7SLYYVHpWg56GP57xGSXWfpb1gPz6ztlq l1kQ== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=a6ArcVT1vup6+uuJoJ1ubNJgA9SGz0vY4xBKeQu+H+s=; fh=fp6H9X/sIpbR8UUHFRa3TTbpSsi8a6tizA99LS5EvQ0=; b=K9DPChUIyogkZNMGYiSvvIfOnafppCCm0wCkful79U+5m550zmchNAqx3RJOgDGUHz UauqJ1GsZ27kO8A+vAD3lKuzjG/B86T4yTtNGe1rqLhHrY2OTDO/50rXf4KxFwlOAu6p UjBxwHbV9YE3C04VZeRkj2LbkIagyfsk0B12G8tiSHa3ULbRTxxuc5xwbERMZUyhzMoF IApQ9Mu/SMvf1rM71X5t4jD6tublmAQvfpYtss9uU/a/HpwznbzJgJCdBPlyGHq55hkr ISrXREA1YHHR7KIe6IH8aE0Xz4cVaXGwgLfdNJ3xHs+kLzHU9pLM5QJYcUNi4YovZL+K oYjQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wg8Rf95a; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-44fe8423fd2si171827961cf.619.2024.08.01.03.08.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Aug 2024 03:08:29 -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=Wg8Rf95a; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZSit-000112-O5; Thu, 01 Aug 2024 06:07:51 -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 1sZSis-0000v4-1Q for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:07:50 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sZSiq-0006c3-AQ for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:07:49 -0400 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a7abe5aa9d5so781676766b.1 for ; Thu, 01 Aug 2024 03:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722506866; x=1723111666; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=a6ArcVT1vup6+uuJoJ1ubNJgA9SGz0vY4xBKeQu+H+s=; b=Wg8Rf95aKalsgQvpCS/MSR04pJymW/w+2uXctciVrHlH2mOH+avq5dETbdVqMZRPO0 v9FfynZU9P2t6ploJF9Ay7HiCVTEK0+bI8+qm6/U8stchSysGHLWsIMpSNLHF6ntjcQ2 kM2J6APh53qBlYOWhOdH6SNDroUkP8sfxqG5gStMZHEXN91pPde1dZRdCOj/zFUGt3hJ rs8yF4haKTZCRPEnZdJEr161Ou4wZPwZR2xeUYnRla3ksKPFMBrjrjEkq9BDhJ18b12i eyvsZha5DO6ry8Kb68Y/7ukD0m6E/OI3Lmiy+NPE8LwQwUk9im89nAPp/LrBAiihu3G1 mr2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722506866; x=1723111666; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a6ArcVT1vup6+uuJoJ1ubNJgA9SGz0vY4xBKeQu+H+s=; b=kOegMB8DRk3miVID7Gqd11MrNz+mtRRXzd6czEWES5+xvF3zuL24gOrfywmKVCQLdJ 0sae7N3ZkvQoWoEgYeTPPyKkgw7d6KHJnEzGv42tinQf/OWpHnEyhVEdu6t/TZZjDqfH 3vfOLQ8HdDn2iMjM7cpSoPtUZDT3lFZ+fu7tlIGeVXalhYD7iJpC621fTltTFfVnW0vc zC2idp35EBQXAITnt3Y9LqzEbgiZk8/mZDoxlJZrSaBmHMyx/2cjBjJpGdFyM3+JvoHf k/YOo9Esss3sCLds/hoBYAD6MjOvSwNaxFSzYxYKBjV7mCITXJ8Ug3UtvnAQJQRLXHqJ gFAg== X-Gm-Message-State: AOJu0YwtnukIASefspNe2wN6v45ygxGfnwA7QOl0NGp3qPm0hqTp33A8 u3eFvxb6h/c//3R5RSIIdevA7tFFpMXp8kcBv0bqy3fo56xlQQHC9Ac7qiBhEyvCcsHGzUhP/tj E X-Received: by 2002:a17:907:3909:b0:a7d:3cf6:48d1 with SMTP id a640c23a62f3a-a7daf56b6admr108148566b.32.1722506865968; Thu, 01 Aug 2024 03:07:45 -0700 (PDT) Received: from m1x-phil.lan ([176.176.130.148]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acad9026fsm891732966b.145.2024.08.01.03.07.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 01 Aug 2024 03:07:45 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH-for-9.1?] hw/pci/pci-hmp-cmds: Avoid displaying bogus size in 'info pci' Date: Thu, 1 Aug 2024 12:07:42 +0200 Message-ID: <20240801100742.50312-1-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=philmd@linaro.org; helo=mail-ej1-x62c.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 When BAR aren't configured, we get: (qemu) info pci Bus 0, device 0, function 0: Host bridge: PCI device dead:beef ... BAR4: 32 bit memory at 0xffffffffffffffff [0x00000ffe]. BAR5: I/O at 0xffffffffffffffff [0x0ffe]. Improve logging to not display bogus sizes: BAR4: 32 bit memory (not configured) BAR5: I/O (not configured) Remove trailing dot which is not used in other commands format. Signed-off-by: Philippe Mathieu-Daudé --- hw/pci/pci-hmp-cmds.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index b09fce9377..8421c3f74a 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -83,15 +83,25 @@ static void hmp_info_pci_device(Monitor *mon, const PciDeviceInfo *dev) monitor_printf(mon, " BAR%" PRId64 ": ", region->value->bar); if (!strcmp(region->value->type, "io")) { - monitor_printf(mon, "I/O at 0x%04" PRIx64 - " [0x%04" PRIx64 "].\n", - addr, addr + size - 1); + if (addr != UINT64_MAX) { + monitor_printf(mon, "I/O at 0x%04" PRIx64 + " [0x%04" PRIx64 "]\n", + addr, addr + size - 1); + } else { + monitor_printf(mon, "I/O (not configured)\n"); + } } else { - monitor_printf(mon, "%d bit%s memory at 0x%08" PRIx64 - " [0x%08" PRIx64 "].\n", - region->value->mem_type_64 ? 64 : 32, - region->value->prefetch ? " prefetchable" : "", - addr, addr + size - 1); + if (addr != UINT64_MAX) { + monitor_printf(mon, "%d bit%s memory at 0x%08" PRIx64 + " [0x%08" PRIx64 "]\n", + region->value->mem_type_64 ? 64 : 32, + region->value->prefetch ? " prefetchable" : "", + addr, addr + size - 1); + } else { + monitor_printf(mon, "%d bit%s memory (not configured)\n", + region->value->mem_type_64 ? 64 : 32, + region->value->prefetch ? " prefetchable" : ""); + } } }