From patchwork Wed Jun 8 12:52:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9164523 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 12CF260467 for ; Wed, 8 Jun 2016 12:55:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03E822823D for ; Wed, 8 Jun 2016 12:55:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECEB828294; Wed, 8 Jun 2016 12:55:02 +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 7C4112823D for ; Wed, 8 Jun 2016 12:55:02 +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 1bAcyr-0007TR-Gh; Wed, 08 Jun 2016 12:53:09 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bAcyq-0007Sp-93 for xen-devel@lists.xenproject.org; Wed, 08 Jun 2016 12:53:08 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id E2/41-25713-33518575; Wed, 08 Jun 2016 12:53:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRWlGSWpSXmKPExsXS6fjDS9dINCL c4NFybYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPOljbGgm8yFQteT2ZsYJwo0cXIySEkkCfx pOsHE4jNK2An8frCFVYQW0LAUGLf/FVsXYwcHCwCqhJnz0WDhNkE1CXanm1nBQmLCBhInDuaB GIyC+hLbFvHAlIhLOAq8XvjJyaI4XYSnaf6mUFsTgF7iZ+tqxlBynkFBCX+7hAGCTMDlazduI t5AiPPLITMLCQZCFtL4uGvWywQtrbEsoWvmWeB7ZWWWP6PAyJsI7Fg3g1GVCUgtrvEohWrmBc wcqxiVC9OLSpLLdI11ksqykzPKMlNzMzRNTQw08tNLS5OTE/NSUwq1kvOz93ECAxTBiDYwdjx z+kQoyQHk5Ior6J7eLgQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCd5ykYhwIcGi1PTUirTMHGDEw KQlOHiURHhlQNK8xQWJucWZ6RCpU4yKUuK8f4SBEgIgiYzSPLg2WJReYpSVEuZlBDpEiKcgtS g3swRV/hWjOAejkjBvMch4nsy8Erjpr4AWMwEtXn4kHGRxSSJCSqqBcUnQ7NmH1u9qsyxuPps qM+OW2cNGT+EVChnhvh63Gv5PPl013faX643AyldRa/jSHaxW353LzXnnbU/ehc5NH879Oc6h p5T7+r+2/+tcYe8tjRFc7Wy10hvF3X1tL8SsfffGQ/n61ZC7uU/0HsscPvDIcbGlIncR+/YYf mYTgYmrYnIND5zVVmIpzkg01GIuKk4EAIFN4//NAgAA X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-14.tower-21.messagelabs.com!1465390384!17915401!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64776 invoked from network); 8 Jun 2016 12:53:06 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-14.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 8 Jun 2016 12:53:06 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Wed, 08 Jun 2016 06:53:01 -0600 Message-Id: <5758314A02000078000F30A2@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Wed, 08 Jun 2016 06:52:58 -0600 From: "Jan Beulich" To: "xen-devel" References: <5758302D02000078000F3087@prv-mh.provo.novell.com> In-Reply-To: <5758302D02000078000F3087@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Andrew Cooper Subject: [Xen-devel] [PATCH 1/4] x86/vMSI-X: defer intercept handler registration 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 There's no point in registering the internal MSI-X table intercept functions on all domains - it is sufficient to do so once a domain gets an MSI-X capable device assigned. Signed-off-by: Jan Beulich x86/vMSI-X: defer intercept handler registration There's no point in registering the internal MSI-X table intercept functions on all domains - it is sufficient to do so once a domain gets an MSI-X capable device assigned. Signed-off-by: Jan Beulich --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -644,8 +644,6 @@ int hvm_domain_initialise(struct domain rtc_init(d); - msixtbl_init(d); - register_portio_handler(d, 0xe9, 1, hvm_print_line); if ( hvm_tsc_scaling_supported ) --- a/xen/arch/x86/hvm/vmsi.c +++ b/xen/arch/x86/hvm/vmsi.c @@ -553,7 +553,8 @@ found: void msixtbl_init(struct domain *d) { - if ( !has_vlapic(d) ) + if ( !has_hvm_container_domain(d) || !has_vlapic(d) || + d->arch.hvm_domain.msixtbl_list.next ) return; INIT_LIST_HEAD(&d->arch.hvm_domain.msixtbl_list); @@ -567,7 +568,7 @@ void msixtbl_pt_cleanup(struct domain *d struct msixtbl_entry *entry, *temp; unsigned long flags; - if ( !has_vlapic(d) ) + if ( !d->arch.hvm_domain.msixtbl_list.next ) return; /* msixtbl_list_lock must be acquired with irq_disabled for check_lock() */ --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -1380,6 +1380,9 @@ static int assign_device(struct domain * goto done; } + if ( pdev->msix ) + msixtbl_init(d); + pdev->fault.count = 0; if ( (rc = hd->platform_ops->assign_device(d, devfn, pci_to_dev(pdev), flag)) ) Reviewed-by: Andrew Cooper --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -644,8 +644,6 @@ int hvm_domain_initialise(struct domain rtc_init(d); - msixtbl_init(d); - register_portio_handler(d, 0xe9, 1, hvm_print_line); if ( hvm_tsc_scaling_supported ) --- a/xen/arch/x86/hvm/vmsi.c +++ b/xen/arch/x86/hvm/vmsi.c @@ -553,7 +553,8 @@ found: void msixtbl_init(struct domain *d) { - if ( !has_vlapic(d) ) + if ( !has_hvm_container_domain(d) || !has_vlapic(d) || + d->arch.hvm_domain.msixtbl_list.next ) return; INIT_LIST_HEAD(&d->arch.hvm_domain.msixtbl_list); @@ -567,7 +568,7 @@ void msixtbl_pt_cleanup(struct domain *d struct msixtbl_entry *entry, *temp; unsigned long flags; - if ( !has_vlapic(d) ) + if ( !d->arch.hvm_domain.msixtbl_list.next ) return; /* msixtbl_list_lock must be acquired with irq_disabled for check_lock() */ --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -1380,6 +1380,9 @@ static int assign_device(struct domain * goto done; } + if ( pdev->msix ) + msixtbl_init(d); + pdev->fault.count = 0; if ( (rc = hd->platform_ops->assign_device(d, devfn, pci_to_dev(pdev), flag)) )