From patchwork Mon May 19 16:23:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 4203811 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 89F8B9F369 for ; Mon, 19 May 2014 16:28:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 89B8320172 for ; Mon, 19 May 2014 16:28:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AAEAF200F2 for ; Mon, 19 May 2014 16:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932551AbaESQZZ (ORCPT ); Mon, 19 May 2014 12:25:25 -0400 Received: from mga01.intel.com ([192.55.52.88]:15881 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932548AbaESQZW (ORCPT ); Mon, 19 May 2014 12:25:22 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 19 May 2014 09:25:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,868,1392192000"; d="scan'208";a="534296754" Received: from gerry-dev.bj.intel.com ([10.238.158.74]) by fmsmga001.fm.intel.com with ESMTP; 19 May 2014 09:24:15 -0700 From: Jiang Liu To: Benjamin Herrenschmidt , Thomas Gleixner , Grant Likely , Ingo Molnar , "H. Peter Anvin" , "Rafael J. Wysocki" , Bjorn Helgaas , Randy Dunlap , Yinghai Lu , Len Brown , Pavel Machek , x86@kernel.org Cc: Jiang Liu , Konrad Rzeszutek Wilk , Andrew Morton , Tony Luck , Joerg Roedel , Paul Gortmaker , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org Subject: [Patch Part1 V2 20/29] x86, ACPI, irq: provide basic irqdomain support Date: Tue, 20 May 2014 00:23:04 +0800 Message-Id: <1400516594-11544-21-git-send-email-jiang.liu@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1400516594-11544-1-git-send-email-jiang.liu@linux.intel.com> References: <1400516594-11544-1-git-send-email-jiang.liu@linux.intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 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 Enhance ACPI driver to provide basic irqdomain support for IOAPIC. Signed-off-by: Jiang Liu --- arch/x86/kernel/acpi/boot.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 66c8feea15a7..4e8566b071c1 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -331,6 +332,23 @@ static void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity); +static struct irq_domain_ops acpi_irqdomain_ops; + +static struct irq_domain *acpi_create_irqdomain(int idx, void *arg) +{ + struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(idx); + + /* + * Statically allocate IRQ number for legacy IRQs and all pins on the + * first IOAPIC. + */ + if (gsi_cfg->gsi_base < NR_IRQS_LEGACY && + ioapic_dynirq_base < gsi_cfg->gsi_end) + ioapic_dynirq_base = gsi_cfg->gsi_end + 1; + + return mp_irqdomain_create(idx, NULL, &acpi_irqdomain_ops); +} + static int __init acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) { @@ -345,7 +363,7 @@ acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) mp_register_ioapic(ioapic->id, ioapic->address, ioapic->global_irq_base, - NULL, NULL); + acpi_create_irqdomain, NULL); return 0; }