Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932945AbaFQF37 (ORCPT ); Tue, 17 Jun 2014 01:29:59 -0400 Received: from mga11.intel.com ([192.55.52.93]:64039 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932856AbaFQF3G (ORCPT ); Tue, 17 Jun 2014 01:29:06 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,492,1400050800"; d="scan'208";a="549015480" From: Jiang Liu To: Benjamin Herrenschmidt , Thomas Gleixner , Grant Likely , Ingo Molnar , "H. Peter Anvin" , "Rafael J. Wysocki" , Bjorn Helgaas , Randy Dunlap , Yinghai Lu , x86@kernel.org, Len Brown , Pavel Machek , Jiang Liu Cc: 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, Ingo Molnar , linux-pm@vger.kernel.org Subject: [RFC Patch V2 14/16] x86, irq: introduce helper to check whether an IOAPIC has been registered Date: Tue, 17 Jun 2014 13:29:53 +0800 Message-Id: <1402982995-13747-15-git-send-email-jiang.liu@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402982995-13747-1-git-send-email-jiang.liu@linux.intel.com> References: <1402982995-13747-1-git-send-email-jiang.liu@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce acpi_ioapic_registered() to check whether an IOAPIC has already been registered, it will be used when enabling IOAPIC hotplug. Signed-off-by: Jiang Liu --- arch/x86/include/asm/io_apic.h | 1 + arch/x86/kernel/acpi/boot.c | 11 +++++++++++ arch/x86/kernel/apic/io_apic.c | 11 +++++++++++ include/linux/acpi.h | 1 + 4 files changed, 24 insertions(+) diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index ce63cf34c93c..0db2b7037e4b 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -191,6 +191,7 @@ extern void mp_unmap_irq(int irq); extern int mp_register_ioapic(int id, u32 address, u32 gsi_base, struct ioapic_domain_cfg *cfg); extern int mp_unregister_ioapic(u32 gsi_base); +extern int mp_ioapic_registered(u32 gsi_base); extern int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq, irq_hw_number_t hwirq); extern void mp_irqdomain_unmap(struct irq_domain *domain, unsigned int virq); diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 8a1b25d2aa4c..bab37bd6296a 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -820,6 +820,17 @@ int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base) } EXPORT_SYMBOL(acpi_unregister_ioapic); +int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base) +{ + int ret; + + down_write(&acpi_ioapic_rwsem); + ret = mp_ioapic_registered(gsi_base); + up_write(&acpi_ioapic_rwsem); + + return ret; +} + static int __init acpi_parse_sbf(struct acpi_table_header *table) { struct acpi_table_boot *sb; diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 22bbecb05345..176433c03cf5 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -4001,6 +4001,17 @@ int mp_unregister_ioapic(u32 gsi_base) return 0; } +int mp_ioapic_registered(u32 gsi_base) +{ + int ioapic; + + for_each_ioapic(ioapic) + if (ioapics[ioapic].gsi_config.gsi_base == gsi_base) + return 1; + + return 0; +} + int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq, irq_hw_number_t hwirq) { diff --git a/include/linux/acpi.h b/include/linux/acpi.h index f478af87f575..7cf20a2e29cc 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -154,6 +154,7 @@ int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr); int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); +int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base); void acpi_irq_stats_init(void); extern u32 acpi_irq_handled; extern u32 acpi_irq_not_handled; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/