From patchwork Fri Dec 4 08:30:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Fedin X-Patchwork-Id: 7766001 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 35A82BEEE1 for ; Fri, 4 Dec 2015 08:32:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4EE97204A0 for ; Fri, 4 Dec 2015 08:32:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1DA5204AF for ; Fri, 4 Dec 2015 08:32:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a4llA-0008EX-At; Fri, 04 Dec 2015 08:30:32 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a4ll6-0008AP-P3 for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2015 08:30:30 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NYT00AZ3RM4VD50@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2015 08:30:04 +0000 (GMT) X-AuditID: cbfec7f5-f79b16d000005389-73-56614f0cb491 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 49.6F.21385.C0F41665; Fri, 4 Dec 2015 08:30:04 +0000 (GMT) Received: from fedinw7x64 ([106.109.131.169]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NYT00CE7RM30R70@eusync3.samsung.com>; Fri, 04 Dec 2015 08:30:04 +0000 (GMT) From: Pavel Fedin To: 'Tyler Baker' References: <1448624071-9552-1-git-send-email-p.fedin@samsung.com> <00a101d12e6c$aa073600$fe15a200$@samsung.com> In-reply-to: <00a101d12e6c$aa073600$fe15a200$@samsung.com> Subject: RE: [PATCH v2] ARM: Enable GICv2m on 32-bit virt machine Date: Fri, 04 Dec 2015 11:30:03 +0300 Message-id: <00a901d12e6d$f953b2a0$ebfb17e0$@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-index: AQLcu/1x91vtDRJS19KDBA0hj/mA7ACU8MaaAjZ6ESKcjQeOsA== Content-language: ru X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGLMWRmVeSWpSXmKPExsVy+t/xq7o8/olhBrOXiFg83fyYyWLT42us Frcv81r8vfOPzeLjjnssDqwea+atYfRoae5h89i0qpPN4861PWwem5fUB7BGcdmkpOZklqUW 6dslcGX8mjqBveCIWMXER0ENjMcEuxg5OSQETCTOTO9jgbDFJC7cW8/WxcjFISSwlFHix9sF rBDOd0aJWbe/sIJUsQmoS5z++gGsQ0RAS+LZsjawImaBPYwSu5e3M0F07GSU2LBnHjtIFaeA lUTbmefMILawgKPE1vbjjCA2i4CqxNP/09hAbF4BS4nve55C2YISPybfA9vADLRh/c7jTBC2 vMTmNW+ZIW5VkNhx9jUjxBVOEo/nzmWDqBGRmPbvHvMERqFZSEbNQjJqFpJRs5C0LGBkWcUo mlqaXFCclJ5rpFecmFtcmpeul5yfu4kREhtfdzAuPWZ1iFGAg1GJh5dhU0KYEGtiWXFl7iFG CQ5mJRFeZpnEMCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8M3e9DxESSE8sSc1OTS1ILYLJMnFw SjUwZmzv4euK+BVQpso/R8Pk1o0JRpuTZksHvRXlzk84+szeyHWz0Z7ujafez9v26Upef83f 81LFCaYHfU7r27Bv3J4TIvfc7uJBny45tvXXoisMi9gY/x8rNRX67x0xs2n9KtWSLAGZZvFt 2a6Spxn+vrjxwPnNVdWsiZ9fLb99efMtHvMZc3y4lFiKMxINtZiLihMBlAEl14kCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151204_003029_004377_2DA62BAE X-CRM114-Status: GOOD ( 14.43 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 'Marc Zyngier' , 'Russell King' , 'linux-arm-kernel' , 'Kevin's boot bot' Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello! > Proposed solution > ----------------- > > I have studied the code a bit more, and i see that proper MSI domains should have domain->ops > == &msi_domain_ops. Based on this, i > can suggest the following fix (copypasted from console, so tabs lost, don't pay attention > please): Damn, sorry, stupid me, pushed "send" before looking at test build results, and overlooked a stupid typo (struct irq_domain, not struct irqdomain). The proper patch is (ignore spaces again plz, if confirmed good and working, i'll post it as appropriate): $ git diff Actually this looks very similar to Marc's fix, just method of checking is different. Feel free to use whatever you like more. Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 53e4632..8531f89 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -43,10 +43,10 @@ static struct irq_domain *pci_msi_get_domain(struct pci_dev *dev) struct irq_domain *domain; domain = dev_get_msi_domain(&dev->dev); - if (domain) - return domain; + if (!domain) + domain = arch_get_pci_msi_domain(dev); - return arch_get_pci_msi_domain(dev); + return irq_domain_is_generic_msi(domain) ? domain : NULL; } static int pci_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) diff --git a/include/linux/msi.h b/include/linux/msi.h index f71a25e..c8591a2 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -268,6 +268,7 @@ int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask, struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode, struct msi_domain_info *info, struct irq_domain *parent); +bool irq_domain_is_generic_msi(struct irq_domain *domain); int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev, int nvec); void msi_domain_free_irqs(struct irq_domain *domain, struct device *dev); diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index 6b0c0b7..3182aa1 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -253,6 +253,17 @@ struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode, } /** + * irq_domain_is_generic_msi - Check whether the irqdomain belongs to us + * @domain: The domain to check + * + * Returns: test result (true or false) + */ +bool irq_domain_is_generic_msi(struct irq_domain *domain) +{ + return domain && (domain->ops == &msi_domain_ops); +} + +/** * msi_domain_alloc_irqs - Allocate interrupts from a MSI interrupt domain * @domain: The domain to allocate from * @dev: Pointer to device struct of the device for which the interrupts