From nobody Fri Nov 14 02:14:10 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584475204; cv=none; d=zohomail.com; s=zohoarc; b=b+FHP1ezrtys6Y8DxDGVB+6IRpOqlkMxd1233L9/+4K056xy4D3Ynj22vcs5MVgY4JJbSUWcL3m+ifs/1zA4PTh3ZxScSwwhPDqtqzhrsMkoaRvwxEoCaWH2W+1Z1yjigmrXrLCHn1Qi1O/PUWQ+jaTX4MPnNjirK/q0EzfuteQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584475204; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=BA84pH+14KS8+bfqCP+c8HyMoCF0oKGQM9994HMIP0Q=; b=Xwd4MY83BIxdVkZ6V+jyaUQZAziWuo98IMV83lxm90DGnXvSD9ft9XGBSou/RQLfW1W6FOEYFlYZXqs/r+iyhyYcMveugxc37ThODpmc8+ZZNRs2gq20gDO6QgKL6lYk8MzD4lzWd/7nHWcjHqk2CVk4PWkFf6ZT9zuBMu3tlE8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584475204942602.5901441040872; Tue, 17 Mar 2020 13:00:04 -0700 (PDT) Received: from localhost ([::1]:40552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEINc-0005Rd-19 for importer@patchew.org; Tue, 17 Mar 2020 16:00:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42930) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEIMz-00051k-7J for qemu-devel@nongnu.org; Tue, 17 Mar 2020 15:59:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEIMx-0001A0-Ts for qemu-devel@nongnu.org; Tue, 17 Mar 2020 15:59:21 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:50698) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jEIMx-00011n-Mw for qemu-devel@nongnu.org; Tue, 17 Mar 2020 15:59:19 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-55-e_kLb3F4OMenGt4SbT3qxg-1; Tue, 17 Mar 2020 15:59:15 -0400 Received: by mail-wr1-f71.google.com with SMTP id o9so11195942wrw.14 for ; Tue, 17 Mar 2020 12:59:14 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id u17sm5110637wra.63.2020.03.17.12.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 12:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584475158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BA84pH+14KS8+bfqCP+c8HyMoCF0oKGQM9994HMIP0Q=; b=HtOr78qjV5QRNWQ7qFg7tghWoDYQfBstuNo7OQwutyLFWteYcHBVfV5Etxr/R+0YmDVWT6 6qXp+naNK61BDB24j8O0YkgRAM1zsJlN2kAvPfQdhq2pXS2p6yyIGO9hzcWWvRxkTAiVlZ cKQGViHaqO2gkslGe0JBVEgxH34bZik= X-MC-Unique: e_kLb3F4OMenGt4SbT3qxg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=q4pIB0ZPgJnM9CP3l8CIAYxfpkuox9s63qSN3wKNTTE=; b=hQFPKBNSCcJtJ0gbuYYFYJJTk4PIesU3/bqGTc1XRbuNUFRrEk2DQgKFvEgw82L3fH TuhaDKqQpeZH0kaP/vk2GotR1+GiN/ajuO+5OWb3Xshq7QLCS79BfElbQiYtC18XuslU Kv9u5i1cdisAMTllmdjdv0HzV5h12yUhNVpzB67wgR63xJ6Yy3CPUifQ7pOo+qEKNUoq lKORF8xaxDTvjpJ4wfQb7nSuLZx/CdftUErfbLjfFnSVez0EcwHeGftnQ2NyMTE4IIYm iJI16VmYUzqRTOLGmWedSvQk1UfCCN2wB4fczYD/04pkhBWjGY2rf513nFfbXMSzucEg iXaw== X-Gm-Message-State: ANhLgQ2oKDWWEHyU53RlA/t13JBUdIHD17QKEtuxxYM40vIAkVGb6abI STmwNzEIoqrYJdFgIJx2h5xpJ6YdV8oLRfFqyDyLAd1WQuy1DmKJ3dIO86O6KoRomAIW9Ksw4wc IN4N2PTmdDzqIQR4= X-Received: by 2002:a7b:cdfa:: with SMTP id p26mr709701wmj.39.1584475153570; Tue, 17 Mar 2020 12:59:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvEuQOBjaw+JZfxvYjLOATQReNb8VZNHd39Qord262DPup+xXNRkDQY340AFncNpKYvg089Ng== X-Received: by 2002:a7b:cdfa:: with SMTP id p26mr709675wmj.39.1584475153207; Tue, 17 Mar 2020 12:59:13 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH] pci: Display PCI IRQ pin in "info pci" Date: Tue, 17 Mar 2020 15:59:08 -0400 Message-Id: <20200317195908.283800-1-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S . Tsirkin" , Julia Suvorova , "Dr . David Alan Gilbert" , peterx@redhat.com, Markus Armbruster , Alex Williamson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Sometimes it would be good to be able to read the pin number along with the IRQ number allocated. Since we'll dump the IRQ number, no reason to not dump the pin information. For example, the vfio-pci device will overwrite the pin with the hardware pin number. It would be nice to know the pin number of one assigned device from QMP/HMP. CC: Dr. David Alan Gilbert CC: Alex Williamson CC: Michael S. Tsirkin CC: Marcel Apfelbaum CC: Julia Suvorova CC: Markus Armbruster Signed-off-by: Peter Xu Acked-by: Dr. David Alan Gilbert Acked-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- This helped me to debug an IRQ sharing issue, so may good to have it in master too. --- hw/pci/pci.c | 1 + monitor/hmp-cmds.c | 3 ++- qapi/misc.json | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e1ed6677e1..7ebf532ac9 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1769,6 +1769,7 @@ static PciDeviceInfo *qmp_query_pci_device(PCIDevice = *dev, PCIBus *bus, info->regions =3D qmp_query_pci_regions(dev); info->qdev_id =3D g_strdup(dev->qdev.id ? dev->qdev.id : ""); =20 + info->irq_pin =3D dev->config[PCI_INTERRUPT_PIN]; if (dev->config[PCI_INTERRUPT_PIN] !=3D 0) { info->has_irq =3D true; info->irq =3D dev->config[PCI_INTERRUPT_LINE]; diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 58724031ea..04c86bbb03 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -680,7 +680,8 @@ static void hmp_info_pci_device(Monitor *mon, const Pci= DeviceInfo *dev) } =20 if (dev->has_irq) { - monitor_printf(mon, " IRQ %" PRId64 ".\n", dev->irq); + monitor_printf(mon, " IRQ %" PRId64 ", pin %c\n", + dev->irq, (char)('A' + dev->irq_pin - 1)); } =20 if (dev->has_pci_bridge) { diff --git a/qapi/misc.json b/qapi/misc.json index c18fe681fb..f8d33ddb4e 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -403,6 +403,8 @@ # # @irq: if an IRQ is assigned to the device, the IRQ number # +# @irq_pin: the IRQ pin, zero means no IRQ (since 5.1) +# # @qdev_id: the device name of the PCI device # # @pci_bridge: if the device is a PCI bridge, the bridge information @@ -417,8 +419,8 @@ { 'struct': 'PciDeviceInfo', 'data': {'bus': 'int', 'slot': 'int', 'function': 'int', 'class_info': 'PciDeviceClass', 'id': 'PciDeviceId', - '*irq': 'int', 'qdev_id': 'str', '*pci_bridge': 'PciBridgeInfo', - 'regions': ['PciMemoryRegion']} } + '*irq': 'int', 'irq_pin': 'int', 'qdev_id': 'str', + '*pci_bridge': 'PciBridgeInfo', 'regions': ['PciMemoryRegion'] = }} =20 ## # @PciInfo: --=20 2.24.1