From patchwork Tue Aug 12 11:11:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 4712301 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 50B9CC0338 for ; Tue, 12 Aug 2014 11:17:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9BB1920170 for ; Tue, 12 Aug 2014 11:17:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BFCF20127 for ; Tue, 12 Aug 2014 11:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751562AbaHLLRp (ORCPT ); Tue, 12 Aug 2014 07:17:45 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:62155 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751506AbaHLLRo (ORCPT ); Tue, 12 Aug 2014 07:17:44 -0400 Received: from 172.24.2.119 (EHLO szxeml410-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BYA83371; Tue, 12 Aug 2014 19:12:16 +0800 (CST) Received: from [127.0.0.1] (10.177.27.212) by szxeml410-hub.china.huawei.com (10.82.67.137) with Microsoft SMTP Server id 14.3.158.1; Tue, 12 Aug 2014 19:11:58 +0800 Message-ID: <53E9F679.8060302@huawei.com> Date: Tue, 12 Aug 2014 19:11:53 +0800 From: Yijing Wang User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: David Vrabel , Bjorn Helgaas CC: , , , Xinwei Hu , "H. Peter Anvin" , , , Russell King , "Joerg Roedel" , , Sebastian Ott , Benjamin Herrenschmidt , , , Arnd Bergmann , Marc Zyngier , Chris Metcalf , Thomas Gleixner , , Tony Luck , , , Wuyun , , "David S. Miller" Subject: Re: [Xen-devel] [RFC PATCH 01/20] x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq() References: <1407828373-24322-1-git-send-email-wangyijing@huawei.com> <1407828373-24322-2-git-send-email-wangyijing@huawei.com> <53E9D9DD.3060901@citrix.com> In-Reply-To: <53E9D9DD.3060901@citrix.com> X-Originating-IP: [10.177.27.212] X-CFilter-Loop: Reflected Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 On 2014/8/12 17:09, David Vrabel wrote: > On 12/08/14 08:25, Yijing Wang wrote: >> Commit 0e4ccb150 added two __weak arch functions arch_msix_mask_irq() >> and arch_msi_mask_irq() to fix a bug found when running xen in x86. >> Introduced these two funcntions make MSI code complex. This patch >> reverted commit 0e4ccb150 and add #ifdef for x86 msi_chip to fix this >> bug for simplicity. Also this is preparation for using struct >> msi_chip instead of weak arch MSI functions in all platforms. > [...] >> static struct irq_chip msi_chip = { >> .name = "PCI-MSI", >> +#ifdef CONFIG_XEN >> + .irq_unmask = nop_unmask_msi_irq, >> + .irq_mask = nop_mask_msi_irq, >> +#else >> .irq_unmask = unmask_msi_irq, >> .irq_mask = mask_msi_irq, >> +#endif > > No. CONFIG_XEN kernels can run on Xen and bare metal so this must be a > runtime option. Hi David, that's my mistake, what about export struct irq_chip msi_chip, then change the msi_chip->irq_mask/irq_unmask() in xen init functions. Eg. - return 0; } #endif @@ -424,8 +423,8 @@ int __init pci_xen_init(void) x86_msi.setup_msi_irqs = xen_setup_msi_irqs; x86_msi.teardown_msi_irq = xen_teardown_msi_irq; x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs; - x86_msi.msi_mask_irq = xen_nop_msi_mask_irq; - x86_msi.msix_mask_irq = xen_nop_msix_mask_irq; + msi_chip.irq_mask = xen_nop_msi_mask; + msi_chip.irq_unmask = xen_nop_msi_mask; #endif return 0; } @@ -505,8 +504,8 @@ int __init pci_xen_initial_domain(void) x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs; x86_msi.teardown_msi_irq = xen_teardown_msi_irq; x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs; - x86_msi.msi_mask_irq = xen_nop_msi_mask_irq; - x86_msi.msix_mask_irq = xen_nop_msix_mask_irq; + msi_chip.irq_mask = xen_nop_msi_mask; + msi_chip.irq_unmask = xen_nop_msi_mask; #endif xen_setup_acpi_sci(); > > David > > . > diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 19b0eba..bb6af00 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -43,6 +43,10 @@ static inline void generic_apic_probe(void) } #endif +#ifdef CONFIG_PCI_MSI +extern struct irq_chip msi_chip; +#endif + #ifdef CONFIG_X86_LOCAL_APIC [...] + +#ifdef CONFIG_PCI_MSI +void xen_nop_msi_mask(struct irq_data *data) {