From patchwork Wed Jul 29 10:08:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 51633 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 64D6C22DB5 for ; Wed, 29 Jul 2015 10:11:01 +0000 (UTC) Received: by wixh2 with SMTP id h2sf5365003wix.0 for ; Wed, 29 Jul 2015 03:11:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=h2D+KUq804bsmQsQdjqqhGzw5JNJK+noVqrWSJKwW1Q=; b=FHmxJ0mWIaLFfYQkZnG1NHEhhkz0Vr1J1/40QwJ+6LihjKYafpWy1xn6FjIxNiPY/W 8d71sm4xmzEsBLjPQ6FqHhdmdue+yoG6xgOrElgCss5LchM8flhnZOhNDZNNL9ysXLJ6 XxKW/znu0chZISYQv3KgAQgsedneQxOIDlqmeGtEsQM30J7ygL4L1QXNbbMYN9BUqob+ jk2vOpkcT12V0nzaoY3lSVshbc/0RuhisOnQRBenfvJMqgVtMXu1b+PfSWTTvBowFYqx AHFzUoT4h6HwMuT8uHqJiMbAQpyu+dwAvGYZ44kT8YLc4mIeUOd2GNrACcMQ4WrxEJpF 5udQ== X-Gm-Message-State: ALoCoQk+3IlhM6rUd5ABXsVyd81R9nkT8539tKbr7N+zfJs7VymVfh3w47pU8TNfsS0rmusEMqYE X-Received: by 10.180.79.10 with SMTP id f10mr794954wix.3.1438164660604; Wed, 29 Jul 2015 03:11:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.195 with SMTP id ao3ls25129lac.53.gmail; Wed, 29 Jul 2015 03:11:00 -0700 (PDT) X-Received: by 10.152.18.194 with SMTP id y2mr37402630lad.5.1438164660302; Wed, 29 Jul 2015 03:11:00 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id n5si21084824laf.168.2015.07.29.03.10.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2015 03:10:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lblf12 with SMTP id f12so3589332lbl.2 for ; Wed, 29 Jul 2015 03:10:59 -0700 (PDT) X-Received: by 10.112.125.34 with SMTP id mn2mr34305067lbb.76.1438164659875; Wed, 29 Jul 2015 03:10:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp2653010lba; Wed, 29 Jul 2015 03:10:58 -0700 (PDT) X-Received: by 10.70.20.5 with SMTP id j5mr91438703pde.40.1438164656949; Wed, 29 Jul 2015 03:10:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ob4si60687820pdb.122.2015.07.29.03.10.55; Wed, 29 Jul 2015 03:10:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752541AbbG2KKv (ORCPT + 6 others); Wed, 29 Jul 2015 06:10:51 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:35792 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752540AbbG2KKt (ORCPT ); Wed, 29 Jul 2015 06:10:49 -0400 Received: by pdrg1 with SMTP id g1so3511478pdr.2 for ; Wed, 29 Jul 2015 03:10:48 -0700 (PDT) X-Received: by 10.70.103.145 with SMTP id fw17mr93037464pdb.1.1438164648694; Wed, 29 Jul 2015 03:10:48 -0700 (PDT) Received: from localhost ([180.150.157.4]) by smtp.googlemail.com with ESMTPSA id br14sm35253868pdb.47.2015.07.29.03.10.46 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 29 Jul 2015 03:10:47 -0700 (PDT) From: Hanjun Guo To: Marc Zyngier , Jason Cooper , Will Deacon , Catalin Marinas , "Rafael J. Wysocki" Cc: Thomas Gleixner , Jiang Liu , Bjorn Helgaas , Lorenzo Pieralisi , Suravee Suthikulpanit , Timur Tabi , Tomasz Nowicki , Grant Likely , Mark Brown , Wei Huang , linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Hanjun Guo Subject: [PATCH v4 09/10] PCI: ACPI: Bind GIC MSI frame to PCI host bridge Date: Wed, 29 Jul 2015 18:08:58 +0800 Message-Id: <1438164539-29256-10-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438164539-29256-1-git-send-email-hanjun.guo@linaro.org> References: <1438164539-29256-1-git-send-email-hanjun.guo@linaro.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Suravee Suthikulpanit This patch introduces pci_host_bridge_acpi_msi_domain(), which queries a GIC MSI irq-domain token and use it to retrieve an irq_domain with DOMAIN_BUS_PCI_MSI bus type, and bind it to PCI host-bridge. Signed-off-by: Suravee Suthikulpanit Signed-off-by: Hanjun Guo --- drivers/pci/pci-acpi.c | 18 ++++++++++++++++++ drivers/pci/probe.c | 3 +++ include/linux/pci-acpi.h | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 314a625..5f11653 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -16,6 +17,7 @@ #include #include #include +#include #include "pci.h" /* @@ -681,6 +683,22 @@ static bool pci_acpi_bus_match(struct device *dev) return dev_is_pci(dev); } +#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN +struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) +{ + struct irq_domain *d = NULL; + void *token = acpi_gic_get_msi_token(&bus->dev); + + if (token) + d = irq_find_matching_host(token, DOMAIN_BUS_PCI_MSI); + + if (!d) + pr_debug("Fail to find domain for MSI\n"); + + return d; +} +#endif /*CONFIG_GENERIC_MSI_IRQ_DOMAIN*/ + static struct acpi_bus_type acpi_pci_bus = { .name = "PCI", .match = pci_acpi_bus_match, diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index a7afeac..8c1204c 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "pci.h" @@ -670,6 +671,8 @@ static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus) * should be called from here. */ d = pci_host_bridge_of_msi_domain(bus); + if (!d) + d = pci_host_bridge_acpi_msi_domain(bus); return d; } diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index a965efa..766d045 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h @@ -77,6 +77,8 @@ static inline void acpiphp_remove_slots(struct pci_bus *bus) { } static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { } #endif +struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus); + extern const u8 pci_acpi_dsm_uuid[]; #define DEVICE_LABEL_DSM 0x07 #define RESET_DELAY_DSM 0x08 @@ -85,6 +87,8 @@ extern const u8 pci_acpi_dsm_uuid[]; #else /* CONFIG_ACPI */ static inline void acpi_pci_add_bus(struct pci_bus *bus) { } static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } +static inline struct irq_domain * +pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) { return NULL; } #endif /* CONFIG_ACPI */ #ifdef CONFIG_ACPI_APEI