From patchwork Tue Sep 18 09:58:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 10604025 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90610913 for ; Tue, 18 Sep 2018 09:59:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 812A229C91 for ; Tue, 18 Sep 2018 09:59:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7504C29CA9; Tue, 18 Sep 2018 09:59:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9F4C829C91 for ; Tue, 18 Sep 2018 09:59:17 +0000 (UTC) Received: from localhost ([::1]:39375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2Cmq-0005Lz-KN for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Sep 2018 05:59:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2CmF-00050q-3f for qemu-devel@nongnu.org; Tue, 18 Sep 2018 05:58:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2CmB-0003va-Rx for qemu-devel@nongnu.org; Tue, 18 Sep 2018 05:58:39 -0400 Received: from relay.sw.ru ([185.231.240.75]:38408) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2CmB-0003s1-KC for qemu-devel@nongnu.org; Tue, 18 Sep 2018 05:58:35 -0400 Received: from [172.16.24.44] (helo=iris.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1g2Cm6-0003NQ-Jq; Tue, 18 Sep 2018 12:58:30 +0300 From: "Denis V. Lunev" To: qemu-devel@nongnu.org Date: Tue, 18 Sep 2018 12:58:52 +0300 Message-Id: <20180918095852.28422-1-den@openvz.org> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 1/1] qmp, hmp: add PCI subsystem id and vendor id to PCI info X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: den@openvz.org, rkagan@virtuozzo.com, Markus Armbruster , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is a long story. RedHat has relicensed Windows KVM device drivers in 2018 and there was an agreement that to avoid WHQL driver conflict software manufacturers should set proper PCI subsystem vendor ID in their distributions. Thus PCI subsystem vendor id becomes actively used. The problem is that this field is applied by us via hardware compats. Thus technically it could be lost. This patch adds PCI susbsystem id and vendor id to exportable parameters for validation. Signed-off-by: Denis V. Lunev CC: "Dr. David Alan Gilbert" CC: Eric Blake CC: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Eric Blake --- hmp.c | 2 ++ hw/pci/pci.c | 3 +++ qapi-schema.json | 7 ++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hmp.c b/hmp.c index 2874bcd789..8fb0957cfd 100644 --- a/hmp.c +++ b/hmp.c @@ -803,6 +803,8 @@ static void hmp_info_pci_device(Monitor *mon, const PciDeviceInfo *dev) monitor_printf(mon, ": PCI device %04" PRIx64 ":%04" PRIx64 "\n", dev->id->vendor, dev->id->device); + monitor_printf(mon, " PCI subsystem %04" PRIx64 ":%04" PRIx64 "\n", + dev->id->subsystem_vendor, dev->id->subsystem); if (dev->has_irq) { monitor_printf(mon, " IRQ %" PRId64 ".\n", dev->irq); diff --git a/hw/pci/pci.c b/hw/pci/pci.c index f0c98cd0ae..be70dd425c 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1724,6 +1724,9 @@ static PciDeviceInfo *qmp_query_pci_device(PCIDevice *dev, PCIBus *bus, info->id = g_new0(PciDeviceId, 1); info->id->vendor = pci_get_word(dev->config + PCI_VENDOR_ID); info->id->device = pci_get_word(dev->config + PCI_DEVICE_ID); + info->id->subsystem = pci_get_word(dev->config + PCI_SUBSYSTEM_ID); + info->id->subsystem_vendor = + pci_get_word(dev->config + PCI_SUBSYSTEM_VENDOR_ID); info->regions = qmp_query_pci_regions(dev); info->qdev_id = g_strdup(dev->qdev.id ? dev->qdev.id : ""); diff --git a/qapi/misc.json b/qapi/misc.json index dfef6faf81..1704a8d437 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -2162,10 +2162,15 @@ # # @vendor: the PCI vendor id # +# @subsystem: the PCI subsystem id (since 3.1) +# +# @subsystem-vendor: the PCI subsystem vendor id (since 3.1) +# # Since: 2.4 ## { 'struct': 'PciDeviceId', - 'data': {'device': 'int', 'vendor': 'int'} } + 'data': {'device': 'int', 'vendor': 'int', 'subsystem': 'int', + 'subsystem-vendor': 'int'} } ## # @PciDeviceInfo: