From patchwork Wed Sep 16 13:59:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 53743 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 8410522A0D for ; Wed, 16 Sep 2015 14:00:07 +0000 (UTC) Received: by lamf6 with SMTP id f6sf39207243lam.1 for ; Wed, 16 Sep 2015 07:00:06 -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=RtK3jkfV8/tUAjY7UWuUSzp2KR6FtlWtPqn559d4MBg=; b=RRHTFEd6xsMGpXaTY6OO+zPsY0Oh9IjPZSc7Sm1n+XW36LGKfviDfCFt920oouSZgu gzxRTZmbJD6L6xhUaCjOqBKHdgrjT6q1TtTmuecbrrxslswdUNVy/t1i0yhxE/v69OII IPyd4WWv4XQsEWZJJJC7lq2XzeVXxzHqFnWAu8+G1+CmT+lmG39CObTd3nZvcCzmmiAd YUG0Km/Ze88o0frHqAtxm6qbmvQ5y5Vfd21t07+YTA/zVuyy7mv+tuFEJIFWe5pPaUXL vXzHDJl2I6F5CtiCiTdXcf4/+UxeAMhsy9kB7+CMwNrH5mDmLV8yfh9SoPmpNMUn3rqP M5tg== X-Gm-Message-State: ALoCoQmVXzzQV2WQHVuK+ElcxnnN4wOz5ZueF7PAFKEV4Wk44cbMx2/VnD+YDDfIYUCowc2lg6wr X-Received: by 10.112.158.202 with SMTP id ww10mr5596748lbb.13.1442412006013; Wed, 16 Sep 2015 07:00:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.10.7 with SMTP id e7ls863676lab.70.gmail; Wed, 16 Sep 2015 07:00:05 -0700 (PDT) X-Received: by 10.152.37.198 with SMTP id a6mr29333065lak.27.1442412005824; Wed, 16 Sep 2015 07:00:05 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id z2si18303454lag.36.2015.09.16.07.00.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Sep 2015 07:00:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbvu2 with SMTP id vu2so31855646lbb.0 for ; Wed, 16 Sep 2015 07:00:05 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr29322027lbb.112.1442412005631; Wed, 16 Sep 2015 07:00:05 -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.59.35 with SMTP id w3csp2472307lbq; Wed, 16 Sep 2015 07:00:04 -0700 (PDT) X-Received: by 10.68.193.163 with SMTP id hp3mr59940787pbc.136.1442412000235; Wed, 16 Sep 2015 07:00:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4si40896935pap.165.2015.09.16.06.59.59; Wed, 16 Sep 2015 07:00:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 S1754097AbbIPN7n (ORCPT + 29 others); Wed, 16 Sep 2015 09:59:43 -0400 Received: from foss.arm.com ([217.140.101.70]:36589 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754014AbbIPN7j (ORCPT ); Wed, 16 Sep 2015 09:59:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 92C775DD; Wed, 16 Sep 2015 06:59:39 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DF8603F23A; Wed, 16 Sep 2015 06:59:37 -0700 (PDT) From: Sudeep Holla To: linux-acpi@vger.kernel.org, "Rafael J. Wysocki" Cc: Sudeep Holla , linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, x86@kernel.org, Al Stone , Lorenzo Pieralisi , Mahesh Sivasubramanian , Ashwin Chaugule Subject: [PATCH v2 4/5] ACPI / processor_idle : introduce ARCH_SUPPORTS_ACPI_PROCESSOR_CSTATE Date: Wed, 16 Sep 2015 14:59:22 +0100 Message-Id: <1442411963-14398-5-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442411963-14398-1-git-send-email-sudeep.holla@arm.com> References: <1438710406-3822-1-git-send-email-sudeep.holla@arm.com> <1442411963-14398-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sudeep.holla@arm.com 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.176 as permitted sender) smtp.mailfrom=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: , ACPI 6.0 adds a new method to specify the CPU idle states(C-states) called Low Power Idle(LPI) states. Since new architectures like ARM64 use only LPIs, introduce ARCH_SUPPORTS_ACPI_PROCESSOR_CSTATE to encapsulate all the code supporting the old style C-states(_CST) This patch will help to extend the processor_idle module to support LPI. Cc: "Rafael J. Wysocki" Signed-off-by: Sudeep Holla --- arch/ia64/Kconfig | 1 + arch/x86/Kconfig | 1 + drivers/acpi/Kconfig | 3 +++ drivers/acpi/processor_idle.c | 57 +++++++++++++++++++++++++++++++------------ include/acpi/processor.h | 3 ++- 5 files changed, 49 insertions(+), 16 deletions(-) diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index eb0249e37981..dbfa3c3a49e1 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -16,6 +16,7 @@ config IA64 select PCI if (!IA64_HP_SIM) select ACPI if (!IA64_HP_SIM) select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI + select ARCH_SUPPORTS_ACPI_PROCESSOR_CSTATE if ACPI select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI select HAVE_UNSTABLE_SCHED_CLOCK select HAVE_IDE diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 7aef2d52daa0..173075c48df8 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -34,6 +34,7 @@ config X86 select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO + select ARCH_SUPPORTS_ACPI_PROCESSOR_CSTATE if ACPI select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT select ARCH_SUPPORTS_INT128 if X86_64 diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 5d1015c26ff4..1eb0b8a84a65 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -48,6 +48,9 @@ config ACPI_LEGACY_TABLES_LOOKUP config ARCH_MIGHT_HAVE_ACPI_PDC bool +config ARCH_SUPPORTS_ACPI_PROCESSOR_CSTATE + bool + config ACPI_GENERIC_GSI bool diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index fadce354d2b7..9ca840c88f48 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -59,6 +59,12 @@ module_param(latency_factor, uint, 0644); static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device); +struct cpuidle_driver acpi_idle_driver = { + .name = "acpi_idle", + .owner = THIS_MODULE, +}; + +#ifdef CONFIG_ARCH_SUPPORTS_ACPI_PROCESSOR_CSTATE static DEFINE_PER_CPU(struct acpi_processor_cx * [CPUIDLE_STATE_MAX], acpi_cstate); @@ -804,11 +810,6 @@ static void acpi_idle_enter_freeze(struct cpuidle_device *dev, acpi_idle_do_entry(cx); } -struct cpuidle_driver acpi_idle_driver = { - .name = "acpi_idle", - .owner = THIS_MODULE, -}; - /** * acpi_processor_setup_cpuidle_cx - prepares and configures CPUIDLE * device i.e. per-cpu data @@ -925,6 +926,41 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) return 0; } +static inline void acpi_processor_cstate_first_run_checks(void) +{ + static int first_run; + + if (first_run) + return; + dmi_check_system(processor_power_dmi_table); + max_cstate = acpi_processor_cstate_check(max_cstate); + if (max_cstate < ACPI_C_STATES_MAX) + pr_notice("ACPI: processor limited to max C-state %d\n", + max_cstate); + first_run++; +} +#else + +static inline int disabled_by_idle_boot_param(void) { return 0; } +static inline void acpi_processor_cstate_first_run_checks(void) { } +static int acpi_processor_get_power_info(struct acpi_processor *pr) +{ + return -ENODEV; +} + +static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr, + struct cpuidle_device *dev) +{ + return -EINVAL; +} + +static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) +{ + return -EINVAL; +} + +#endif + int acpi_processor_hotplug(struct acpi_processor *pr) { int ret = 0; @@ -1018,20 +1054,11 @@ int acpi_processor_power_init(struct acpi_processor *pr) acpi_status status; int retval; struct cpuidle_device *dev; - static int first_run; if (disabled_by_idle_boot_param()) return 0; - if (!first_run) { - dmi_check_system(processor_power_dmi_table); - max_cstate = acpi_processor_cstate_check(max_cstate); - if (max_cstate < ACPI_C_STATES_MAX) - printk(KERN_NOTICE - "ACPI: processor limited to max C-state %d\n", - max_cstate); - first_run++; - } + acpi_processor_cstate_first_run_checks(); if (acpi_gbl_FADT.cst_control && !nocst) { status = diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 0abcab53dbe5..b447952f8236 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -242,7 +242,8 @@ extern int acpi_processor_get_performance_info(struct acpi_processor *pr); DECLARE_PER_CPU(struct acpi_processor *, processors); extern struct acpi_processor_errata errata; -#ifdef ARCH_HAS_POWER_INIT +#if defined(ARCH_HAS_POWER_INIT) && \ + defined(CONFIG_ARCH_SUPPORTS_ACPI_PROCESSOR_CSTATE) void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, unsigned int cpu); int acpi_processor_ffh_cstate_probe(unsigned int cpu,