From patchwork Thu Feb 4 17:29:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 8226621 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 B4267BEEE5 for ; Thu, 4 Feb 2016 17:42:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C832E2039D for ; Thu, 4 Feb 2016 17:42:14 +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 991CB20395 for ; Thu, 4 Feb 2016 17:42:13 +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 1aRNtJ-00032i-AX; Thu, 04 Feb 2016 17:40:25 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aRNjL-00070z-GU for linux-arm-kernel@lists.infradead.org; Thu, 04 Feb 2016 17:30:10 +0000 Received: by mail-wm0-x22f.google.com with SMTP id r129so222673389wmr.0 for ; Thu, 04 Feb 2016 09:29:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YUN1zLvppOHs8fSzT07nuOiM2CfS0aAOP0759wCfQP0=; b=gIOMgQIam5TxNX0I9B9qBtvlzqZejctz6NBAlLrK9uXDVurzmFkYJQPZLtXio1Hrr7 +YtNIX26LBP6kfMtbrMHNOJdC2uDjikBkycXUiNe7A5eK9lGWHOm4O43M4fYJxuKZpl1 NLDs2rvjx02Zox3eVAwdeSw5WrjOgaokMZpfuhwt5fPJtTG/9gqKfblfmgz3up/1cXbr E++E7DroG6h+XE1zv4vxXGByOVMYi919pQipjWwmYBXaF6tEoPmh62IiZZWXFDJJb8SS AKEeO+KNBZmJB7QU/Kp+3ooIjw3I4VKAOrYtldT4t7/4FJRu0FmU/uisXbhtvYAOccJx QBhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YUN1zLvppOHs8fSzT07nuOiM2CfS0aAOP0759wCfQP0=; b=g0js12pdhHQpv5r1o/1vkGQX2tbSkcxOmZ6ssFfsXxaQYJF8RNx+Xld0bEwAh3mqyq +sSxDbNewSqraISQpw+d1mjhTMF3wqW9A/n61Y+N825wDRj3AJFnMU+WB8C/3k6BEtH1 fbPF1QESz+lJJBu3S0lNnvao3QQ6OU845vVJdIC4SOIod9W9qoPVROxR2BNvkP0QYBHv 2Vq5NWueiyJGlJZ3gev1ydk9IbvWvDL6OYD/PNV34OBWreKyTchpCRs40Hu3uuPSslHf JkCFs7O5iWnzmj3dDchRhrjWThexQzKYDVRtE8Ol7RlVKnnc2A4Dn2u8gzFB7gG8f8o4 QGWg== X-Gm-Message-State: AG10YOQWs7ic8BcFHbtJqaWXNqsnCFmXj2YSiHbQE+PvaBV/3ZanLCxSVEuNwJ6S7QhQxQ== X-Received: by 10.28.1.196 with SMTP id 187mr8627923wmb.68.1454606986235; Thu, 04 Feb 2016 09:29:46 -0800 (PST) Received: from tn-HP-4.semihalf.local (cardhu.semihalf.com. [213.17.239.108]) by smtp.gmail.com with ESMTPSA id w8sm12238889wjx.21.2016.02.04.09.29.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Feb 2016 09:29:45 -0800 (PST) From: Tomasz Nowicki To: bhelgaas@google.com, arnd@arndb.de, will.deacon@arm.com, catalin.marinas@arm.com, rjw@rjwysocki.net, hanjun.guo@linaro.org, Lorenzo.Pieralisi@arm.com, okaya@codeaurora.org, jiang.liu@linux.intel.com, Stefano.Stabellini@eu.citrix.com Subject: [PATCH V4 22/23] arm64, pci, acpi: Assign legacy IRQs once device is enable. Date: Thu, 4 Feb 2016 18:29:00 +0100 Message-Id: <1454606941-9523-23-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454606941-9523-1-git-send-email-tn@semihalf.com> References: <1454606941-9523-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160204_093008_147286_BC6012B3 X-CRM114-Status: GOOD ( 13.42 ) X-Spam-Score: -2.6 (--) 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: jchandra@broadcom.com, jcm@redhat.com, linaro-acpi@lists.linaro.org, linux-pci@vger.kernel.org, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, robert.richter@caviumnetworks.com, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, wangyijing@huawei.com, Tomasz Nowicki , mw@semihalf.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 This is the last step before enabling generic ACPI PCI host controller for ARM64. We need to take care of legacy IRQ mapping for non-MSI(X) PCI devices. pcibios_enable_device() boot order is not sensitive to ACPI device enumeration, so it is the best place to assign device's IRQs. NOTE: *This is going to be temporary solution*. There is ongoing work which aims for cleaning legacy IRQ allocation, see [1]. We can consider this patch as the necessary evil which will be removed once [1] series hits mailnline in the near future. 1. http://comments.gmane.org/gmane.linux.kernel.pci/46461 Signed-off-by: Tomasz Nowicki --- arch/arm64/kernel/pci.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 023b983..d1a701f 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -39,16 +39,26 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, } /** - * pcibios_enable_device - Enable I/O and memory. + * pcibios_enable_device - Enable I/O, memory and legacy IRQs for ACPI. * @dev: PCI device to be enabled * @mask: bitmask of BARs to enable */ int pcibios_enable_device(struct pci_dev *dev, int mask) { + int ret; + if (pci_has_flag(PCI_PROBE_ONLY)) return 0; - return pci_enable_resources(dev, mask); + ret = pci_enable_resources(dev, mask); + if (ret < 0) + return ret; + +#ifdef CONFIG_ACPI + if (!pci_dev_msi_enabled(dev)) + return acpi_pci_irq_enable(dev); +#endif + return 0; } /*