From patchwork Wed Dec 13 08:26:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev\" via" X-Patchwork-Id: 10109499 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D08C960327 for ; Wed, 13 Dec 2017 08:28:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFD192903F for ; Wed, 13 Dec 2017 08:28:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B11CA29090; Wed, 13 Dec 2017 08:28:00 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 1E8692903F for ; Wed, 13 Dec 2017 08:27:58 +0000 (UTC) Received: from localhost ([::1]:34303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eP2OT-0005xO-N3 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 13 Dec 2017 03:27:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eP2Ns-0004v6-J0 for qemu-devel@nongnu.org; Wed, 13 Dec 2017 03:27:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eP2Np-0004Jh-ES for qemu-devel@nongnu.org; Wed, 13 Dec 2017 03:27:20 -0500 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:37284) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eP2Np-0004IC-78 for qemu-devel@nongnu.org; Wed, 13 Dec 2017 03:27:17 -0500 Received: by mail-pg0-x242.google.com with SMTP id y6so966384pgp.4 for ; Wed, 13 Dec 2017 00:27:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skyportsystems.com; s=google; h=from:to:cc:subject:date:message-id; bh=agPZDrA/UWWvhFwL3iplZQ4592ZGZgN7HiK+RjaMcaI=; b=lxLPQUC9F1po0ZlPctdzaymTMpzfSnm5M7gIgAAAZTe3j0av5tw2l8wEUV96l9W7Qa 63ac7YOvoMatPp+MylNNYX5lwZC+eMkpNIj9vUdqwLuoW9pOv5dWFhg8v2GQgQbemfWK P3sA50ku4+AR6bgjtG34wj2gxVC6Wl7o/ER/E= 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; bh=agPZDrA/UWWvhFwL3iplZQ4592ZGZgN7HiK+RjaMcaI=; b=eVoEjkXvmbqw+Ns0kOAd+30uSy6Xb36PCnCpCU+5NIZg3LBFeOtNWhucNI9Q0zFrxu 45Qnu14NCw+qXg8OpeyqqefP8alGXtefJU5Dj6Q4vqc8PnXPFJfujJJ2unPqUdA6r6gI 58PlGsIna4U7cashIMrTOJ4nXWL/BcVQco89ll/MIh0Vs+fqwI9abveqzq7tS8qZB3cy nc19TqQ0REL7bEMnEHlDkQJeOLWXfFoJlrjP9zRWiysbBvgZlNqvJ3gW0dKV9eybaScC 4vF2wgIvOMx1JkmOfQaaKJey3KdKU+quUokGjZv93YeWo89uajcKkRBr8wI56Dl9JRJc HVLg== X-Gm-Message-State: AKGB3mJDUFWFh6ruMf4M3BLISQR7SBTHQ0zP482X5InMwMA6Np+4LwB0 nrDxYozHdgUyXpT3DvOBTjsmYg== X-Google-Smtp-Source: ACJfBotRf5p1LM38qsOpxwOwIUFIOgz+Ccgpj+9D5HkvKv18v+mDXwrTszTvhh0kPfl70T5FME8NVA== X-Received: by 10.101.101.73 with SMTP id a9mr4654999pgw.148.1513153635834; Wed, 13 Dec 2017 00:27:15 -0800 (PST) Received: from Arrow.com (67-207-112-138.static.wiline.com. [67.207.112.138]) by smtp.gmail.com with ESMTPSA id b78sm2276917pfc.21.2017.12.13.00.27.13 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 13 Dec 2017 00:27:14 -0800 (PST) To: mst@redhat.com, qemu-devel@nongnu.org Date: Wed, 13 Dec 2017 00:26:44 -0800 Message-Id: <20171213082644.83113-1-ben@skyportsystems.com> X-Mailer: git-send-email 2.14.3 (Apple Git-98) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::242 Subject: [Qemu-devel] [PATCH] virtio-pci: Add subsystem-vendor-id property 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: , X-Patchwork-Original-From: Ben Warren via Qemu-devel From: "Denis V. Lunev\" via" Reply-To: ben@skyportsystems.com Cc: yan@daynix.com, eswierk@skyportsystems.com, lprosek@redhat.com, Ben Warren Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Warren Now that virtio-win guest drivers provided by non-Redhat vendors need to use a different Subsystem Vendor ID value, a way is needed to set this parameter on the host. This works with all of the PCI-based devices, such as NetKVM, viostor, vioscsi, vioserial and balloon. Signed-off-by: Ben Warren --- hw/virtio/virtio-pci.c | 5 +++++ hw/virtio/virtio-pci.h | 1 + 2 files changed, 6 insertions(+) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index e92837c..b5c86e3 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1757,6 +1757,9 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) if (proxy->disable_legacy == ON_OFF_AUTO_AUTO) { proxy->disable_legacy = pcie_port ? ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF; } + /* Set the PCI Subsystem Vendor ID */ + k->parent_class.subsystem_vendor_id = proxy->subsystem_vendor_id; + pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID, proxy->subsystem_vendor_id); if (!virtio_pci_modern(proxy) && !virtio_pci_legacy(proxy)) { error_setg(errp, "device cannot work as neither modern nor legacy mode" @@ -1876,6 +1879,8 @@ static Property virtio_pci_properties[] = { VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true), DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_INIT_PM_BIT, true), + DEFINE_PROP_UINT16("subsystem-vendor-id", VirtIOPCIProxy, + subsystem_vendor_id, PCI_VENDOR_ID_REDHAT_QUMRANET), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 12d3a90..8a897ea 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -186,6 +186,7 @@ struct VirtIOPCIProxy { VirtIOIRQFD *vector_irqfd; int nvqs_with_notifiers; VirtioBusState bus; + uint16_t subsystem_vendor_id; }; static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy)