From patchwork Tue Sep 27 15:57:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 9352179 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 0F42D60757 for ; Tue, 27 Sep 2016 16:00:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01A792927A for ; Tue, 27 Sep 2016 16:00:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9D4C2928E; Tue, 27 Sep 2016 16:00:46 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 555AA2927A for ; Tue, 27 Sep 2016 16:00:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1boumJ-0008LS-OV; Tue, 27 Sep 2016 15:58:43 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1boumH-0008HQ-U3 for xen-devel@lists.xenproject.org; Tue, 27 Sep 2016 15:58:42 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id F0/B7-09160-1379AE75; Tue, 27 Sep 2016 15:58:41 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRWlGSWpSXmKPExsXitHSDva7B9Ff hBkdfmVl83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBknW5cyFrziqth7/j9rA2MbRxcjJ4eEgL/E hH2bmUBsNgEdiYtzd7J1MXJwiAioSNzea9DFyMXBLLCBUWL649usIDXCAi4Sr99/ALNZBFQlJ p3+ywZi8wq4SixZd4kNYqauxMNzv8FqOIHivW0LwOYLAfXenfmRFaJeUOLkzCcsIDazgKZE6/ bf7BC2vETz1tnMEPWKEv3zHkDN5Ja4fXoq8wRG/llI2mchaZ+FpH0BI/MqRvXi1KKy1CJdQ72 kosz0jJLcxMwcXUMDY73c1OLixPTUnMSkYr3k/NxNjMAQZACCHYzLPzodYpTkYFIS5dVofxUu xJeUn1KZkVicEV9UmpNafIhRg4NDYPPa1RcYpVjy8vNSlSR4PaYC1QkWpaanVqRl5gCjBKZUg oNHSYSXZxpQmre4IDG3ODMdInWKUVFKnLcBpE8AJJFRmgfXBovMS4yyUsK8jEBHCfEUpBblZp agyr9iFOdgVBLmVQAZz5OZVwI3/RXQYiagxUtPvABZXJKIkJJqYHzmW+h4vaaS6eK77ClBr14 lLKhtCZrZfULF3F+owP5F45OZG9WENFKF7utL1TQbZD2pedewI/zd4sJfGX5N2fFak/ZnMS/+ ZH7VwlDMaUVPxu0rrZqeYVuWNZkUFIfeSO5gOXpIwsFQZV3bjq+sFndeKx9juzu1Ubg+R+1vc Z5I2NJXQeemKrEUZyQaajEXFScCALWAbJjHAgAA X-Env-Sender: prvs=071b8e69e=roger.pau@citrix.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1474991908!46201907!5 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19008 invoked from network); 27 Sep 2016 15:58:40 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-12.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 27 Sep 2016 15:58:40 -0000 X-IronPort-AV: E=Sophos;i="5.30,405,1470700800"; d="scan'208";a="389169847" From: Roger Pau Monne To: Date: Tue, 27 Sep 2016 17:57:20 +0200 Message-ID: <1474991845-27962-26-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.7.4 (Apple Git-66) In-Reply-To: <1474991845-27962-1-git-send-email-roger.pau@citrix.com> References: <1474991845-27962-1-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Andrew Cooper , boris.ostrovsky@oracle.com, Roger Pau Monne , Jan Beulich Subject: [Xen-devel] [PATCH v2 25/30] xen/x86: add all PCI devices to PVHv2 Dom0 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Roger Pau Monné --- Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/domain_build.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c index 407f742..b4a14a3 100644 --- a/xen/arch/x86/domain_build.c +++ b/xen/arch/x86/domain_build.c @@ -2378,6 +2378,25 @@ static int __init hvm_setup_acpi(struct domain *d) return 0; } +static int __init hvm_setup_pci(struct domain *d) +{ + struct pci_dev *pdev; + int rc; + + printk("** Adding PCI devices **\n"); + + pcidevs_lock(); + list_for_each_entry( pdev, &d->arch.pdev_list, domain_list ) + { + rc = hwdom_add_device(pdev); + if ( rc ) + return rc; + } + pcidevs_unlock(); + + return 0; +} + static int __init construct_dom0_hvm(struct domain *d, const module_t *image, unsigned long image_headroom, module_t *initrd, @@ -2426,6 +2445,13 @@ static int __init construct_dom0_hvm(struct domain *d, const module_t *image, return rc; } + rc = hvm_setup_pci(d); + if ( rc ) + { + printk("Failed to add PCI devices: %d\n", rc); + return rc; + } + return 0; }