From patchwork Mon Jun 13 14:41:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9173253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 692B660573 for ; Mon, 13 Jun 2016 14:42:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BEE425EF7 for ; Mon, 13 Jun 2016 14:42:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5090426861; Mon, 13 Jun 2016 14:42:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3C2B2040D for ; Mon, 13 Jun 2016 14:42:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424366AbcFMOmH (ORCPT ); Mon, 13 Jun 2016 10:42:07 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:33360 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424291AbcFMOmD (ORCPT ); Mon, 13 Jun 2016 10:42:03 -0400 Received: by mail-lf0-f47.google.com with SMTP id f6so64934079lfg.0 for ; Mon, 13 Jun 2016 07:42:02 -0700 (PDT) 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=h3xF5QdJJGZAZFuM/4QZBzcM9EpAfuiAPQw8ENviY5I=; b=TmG7Cy8dbhBQLQfQw0P5byTSh8MA3qZ1VLshk1KJGQtJ71EXpw3cRfvJAYxRgEwt7D xWPMwsW4cnUZV2N56KXYnWTblsDJQWepgACLyqDDy7PQzonoH9CNagFlH+A3Fd6LuoA1 yTaHZXAm+U6yKZ1ZPXWsaraBhcEIVdBTEFkv/tFK2YPIZy4JMQ73I7rSlJ5WYd/sA3mK 0gPHvS1oqpMNPCjabX454PzM+cb2YBUxLG20Ll1sU5F3kihNLTyplH/3JGLndlg5p9xz N6Xc68Seu+KRT1i1CiFkvsoo3dmUAP4isNc+vzZv8T0KQ4e1MHfQegmSYTaF5V6rPQqk vgYw== 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=h3xF5QdJJGZAZFuM/4QZBzcM9EpAfuiAPQw8ENviY5I=; b=WzNL2rOGrKNnl0TNa8jMimTJiGQX2rdsA1P3i7zf9D856+68o5FL21w/JzUf0XuEzy GZ2Tfp1zq/pHbNMUAA05pECCCj7vNdlMtgShNp0s0t/+xZ4ndYPUNdbzuX3fBj2HgsEN a3Znjok01PhdL3+1bBdLOcTTo74HnLB3So+VWuC8WRRDzVeqx3OEDSaP2w0xby8CWrPT bj8/61u85LUjoTsppeOSWfCOmbvzz2OyU6n7/zk1/kQ50J1gm0bngwQGWai1Bk7qI0iZ MfT/wxT0Di4bLyoLlS8pKRjTQjR3FRKYN40kRGIHaewSmUbZyJ+awWHliQy6xWajuB+0 boFg== X-Gm-Message-State: ALyK8tKhZd7emziJkoLCgExZWq8NQt9DgwxDSmn5Bv3sIfyIBwG2FouE44YxxkD217ttrQ== X-Received: by 10.25.149.75 with SMTP id x72mr357134lfd.156.1465828920969; Mon, 13 Jun 2016 07:42:00 -0700 (PDT) Received: from tn-HP-4.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id l79sm394242lfi.40.2016.06.13.07.41.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jun 2016 07:41:59 -0700 (PDT) From: Tomasz Nowicki To: marc.zyngier@arm.com, tglx@linutronix.de, jason@lakedaemon.net, rjw@rjwysocki.net, bhelgaas@google.com, lorenzo.pieralisi@arm.com, robert.richter@caviumnetworks.com, shijie.huang@arm.com, Suravee.Suthikulpanit@amd.com, hanjun.guo@linaro.org Cc: al.stone@linaro.org, mw@semihalf.com, graeme.gregory@linaro.org, Catalin.Marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ddaney.cavm@gmail.com, okaya@codeaurora.org, andrea.gallo@linaro.org, linux-pci@vger.kernel.org, Tomasz Nowicki Subject: [PATCH V6 7/7] irqchip/gicv3-its: Use MADT ITS subtable to do PCI/MSI domain initialization Date: Mon, 13 Jun 2016 16:41:13 +0200 Message-Id: <1465828873-23498-8-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465828873-23498-1-git-send-email-tn@semihalf.com> References: <1465828873-23498-1-git-send-email-tn@semihalf.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Let ACPI build ITS PCI MSI domain. ACPI is responsible for retrieving inner domain token and passing it on to its_pci_msi_init_one generic init call. We have now full PCI MSI domain stack, thus we can enable ITS initialization from GICv3 core driver for ACPI scenario. Signed-off-by: Tomasz Nowicki Acked-by: Marc Zyngier --- drivers/irqchip/irq-gic-v3-its-pci-msi.c | 46 +++++++++++++++++++++++++++++++- drivers/irqchip/irq-gic-v3.c | 3 +-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c index 23679ae..ae7221c 100644 --- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c @@ -15,6 +15,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -144,10 +145,53 @@ static int __init its_pci_of_msi_init(void) return 0; } +#ifdef CONFIG_ACPI + +static int __init +its_pci_msi_parse_madt(struct acpi_subtable_header *header, + const unsigned long end) +{ + struct acpi_madt_generic_translator *its_entry; + struct fwnode_handle *dom_handle; + const char *node_name; + int err = -ENXIO; + + its_entry = (struct acpi_madt_generic_translator *)header; + node_name = kasprintf(GFP_KERNEL, "ITS@0x%lx", + (long)its_entry->base_address); + dom_handle = iort_find_domain_token(its_entry->translation_id); + if (!dom_handle) { + pr_err("%s: Unable to locate ITS domain handle\n", node_name); + goto out; + } + + err = its_pci_msi_init_one(dom_handle, node_name); + if (!err) + pr_info("PCI/MSI: %s domain created\n", node_name); + +out: + kfree(node_name); + return err; +} + +static int __init its_pci_acpi_msi_init(void) +{ + acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, + its_pci_msi_parse_madt, 0); + return 0; +} +#else +static int __init its_pci_acpi_msi_init(void) +{ + return 0; +} +#endif + static int __init its_pci_msi_init(void) { its_pci_of_msi_init(); + its_pci_acpi_msi_init(); + return 0; } - early_initcall(its_pci_msi_init); diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 019b442..2a8b2e1 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -951,8 +951,7 @@ static int __init gic_init_bases(void __iomem *dist_base, set_handle_irq(gic_handle_irq); - if (IS_ENABLED(CONFIG_ARM_GIC_V3_ITS) && gic_dist_supports_lpis() && - to_of_node(handle)) /* Temp hack to prevent ITS init for ACPI */ + if (IS_ENABLED(CONFIG_ARM_GIC_V3_ITS) && gic_dist_supports_lpis()) its_init(handle, &gic_data.rdists, gic_data.domain); gic_smp_init();