From patchwork Thu Nov 5 06:35:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 540277 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 959B0140E3B for ; Thu, 5 Nov 2015 17:36:31 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756418AbbKEGfh (ORCPT ); Thu, 5 Nov 2015 01:35:37 -0500 Received: from mga11.intel.com ([192.55.52.93]:47705 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756174AbbKEGfg (ORCPT ); Thu, 5 Nov 2015 01:35:36 -0500 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 04 Nov 2015 22:35:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,246,1444719600"; d="scan'208,223";a="678720845" Received: from jliu23-mobl.ccr.corp.intel.com (HELO [10.238.131.64]) ([10.238.131.64]) by orsmga003.jf.intel.com with ESMTP; 04 Nov 2015 22:35:34 -0800 Subject: Re: [RFC PATCHv3 3/4] x86/pci: Initial commit for new VMD device driver To: Thomas Gleixner , Keith Busch References: <1445967247-24310-1-git-send-email-keith.busch@intel.com> <1445967247-24310-4-git-send-email-keith.busch@intel.com> <20151103001552.GE13904@localhost.localdomain> <20151104144905.GI13904@localhost.localdomain> Cc: LKML , x86@kernel.org, linux-pci@vger.kernel.org, Dan Williams , Bjorn Helgaas , Bryan Veal , Ingo Molnar , "H. Peter Anvin" , Martin Mares , Jon Derrick , Peter Zijlstra From: Jiang Liu Organization: Intel Message-ID: <563AF8B3.8030907@linux.intel.com> Date: Thu, 5 Nov 2015 14:35:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On 2015/11/4 23:14, Thomas Gleixner wrote: > On Wed, 4 Nov 2015, Keith Busch wrote: > >> On Tue, Nov 03, 2015 at 12:42:02PM +0100, Thomas Gleixner wrote: >>> On Tue, 3 Nov 2015, Keith Busch wrote: >>>>>> + msi_irqdomain = pci_msi_create_irq_domain(NULL, &pci_chained_msi_domain_info, >>>>>> + vmd_irqdomain); >>> >>> But that parent limitation does not matter simply because your >>> msi_irqdomain does not follow down the hierarchy in the allocation >>> path. >>> >>> So we can avoid the vmd_irqdomain creation completely. It's just >>> wasting memory and has no value at all. Creating the msi domain with a >>> NULL parent is possible. >> >> I'm having trouble following the hierarchy and didn't understand the >> connection between the parent and msi comain. It's still new to me, >> but I don't think a NULL parent is allowable with msi domains: >> >> pci_msi_setup_msi_irqs() >> pci_msi_domain_alloc_irqs() >> msi_domain_alloc_irqs() >> __irq_domain_alloc_irqs() >> irq_domain_alloc_irqs_recursive() >> msi_domain_alloc() >> irq_domain_alloc_irqs_parent() >> >> The last call returns -ENOSYS since there parent is NULL. Was the >> intension to allow no parent, or do I still need to allocate one to >> achieve the desired chaining? > > Hmm, seems I missed that part. But that's a fixable problem. Jiang? Hi Keith, Could you please try the attached patch? Thanks! Gerry > > Thanks, > > tglx > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > From 6db1568564f8edee626d1c168b22ed5502abc6eb Mon Sep 17 00:00:00 2001 From: Liu Jiang Date: Thu, 5 Nov 2015 11:25:07 +0800 Subject: [PATCH] msi: Relax msi_domain_alloc() to support parentless MSI irqdomains Previously msi_domain_alloc() assumes MSI irqdomains always have parent irqdomains, but that's not true for the new Intel VMD devices. So relax msi_domain_alloc() to support parentless MSI irqdomains. Signed-off-by: Jiang Liu Signed-off-by: Liu Jiang --- kernel/irq/msi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index 7e6512b9dc1f..e4d3d707efff 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -109,9 +109,11 @@ static int msi_domain_alloc(struct irq_domain *domain, unsigned int virq, if (irq_find_mapping(domain, hwirq) > 0) return -EEXIST; - ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, arg); - if (ret < 0) - return ret; + if (domain->parent) { + ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, arg); + if (ret < 0) + return ret; + } for (i = 0; i < nr_irqs; i++) { ret = ops->msi_init(domain, info, virq + i, hwirq + i, arg); -- 1.7.10.4