Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp178504imd; Wed, 31 Oct 2018 16:54:22 -0700 (PDT) X-Google-Smtp-Source: AJdET5fPMY+5PBJMYvVwJs6Ykt1MBuNrVAg3Xw6v+vjFztkpbvqNM4ev7fme6miI+02eEnnXISIg X-Received: by 2002:a17:902:aa:: with SMTP id a39-v6mr5463483pla.296.1541030062056; Wed, 31 Oct 2018 16:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541030062; cv=none; d=google.com; s=arc-20160816; b=N7qyhlKmhVfgk1JyO4kHQ2gSFDTTcQGVMwz/x6A+rJQfv79BDvOCRCcGd3bUe2Ad9B lgxCsjJ58oJh325DVROBd7Hr2eT12oC7auOdzpcg064Jp7OHBcxhwHz2DzFwikTXmFdt Au0w25/StOuFAet5HlyDpNhHX8ymfpEgNN8HTwCzJSQWVGqo/lnDy83rQDLfbXSgjIUd U0cHyqhORhnMvXEUj1KPCarM05//kBpj0iNqZ8KoTo6gDKQCoGUpP0gzvFA3OmqFDNAR Bd88GwlPz/TPaT3S6H71ovjRHTf1F2AGsa5cQBCYskYiEXzIsW7BQB6wKfFCybz0st+X pu+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=GhH5QHwjhTb9ff4tfBEEaOlwIVrpXne264ThxJIdJtM=; b=bDs0o3xcTTiY3R7d0eYBnC8tX1qOpo0sSYzs6nhsO14PpoPGawfUPOvuf4w7E6nerL MWAjdENt664Tt2GKQ2vHD6ZqY+3UdxDvD/XgkgFCH3BVwrWvPzH0S28aZG0SVDQwLWpc 5H+t5C8EH56nEtGVhMP0ay5djSy0iK/w2fPseXsKWJFguP7tPdv9aIVZVpil8Ng1/K0H wYS5ho+RGCXPJevWZgGO4NWI/xKEx3ze3APKr/y77XnIZqX8s9GXnPY6vlWTQO4QW9QK u/w2Z/ByBY4wGjgrdt0uCE0ilYeWhvyMm4T4kI7topaeDgomVzaLxizFpG7nlw+1Wa3A uZTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U00klvfp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s64-v6si29407974pfi.134.2018.10.31.16.54.06; Wed, 31 Oct 2018 16:54:22 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U00klvfp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727829AbeKAIGY (ORCPT + 99 others); Thu, 1 Nov 2018 04:06:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:53130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727814AbeKAIGX (ORCPT ); Thu, 1 Nov 2018 04:06:23 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CA4C22087A; Wed, 31 Oct 2018 23:06:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027173; bh=PHDIRm6hp2QCsYTEK/cuqnxSlQuwnnP/wqY9JYN4K/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U00klvfpCu9vwKH8fLaHtgT3+3i5gRIr0C6vuRUwCjDFYVMotd503CzaTsMHFKVGy cTvEGNRj41dn4ei66crAbM28bqi68dWTGza0fb01R8nYdl85MABxFaaed+R1BGIsIS QqJF4ifKom9w9i+GMnDkXltBvNZofMRoRxpwZsTU= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Rajneesh Bhardwaj , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 034/146] ACPI / PM: LPIT: Register sysfs attributes based on FADT Date: Wed, 31 Oct 2018 19:03:49 -0400 Message-Id: <20181031230541.28822-34-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rajneesh Bhardwaj [ Upstream commit 1cdda9486f5103fb133f88e662e48c504adbb779 ] ACPI Low Power S0 Idle capabilities are announced via FADT table and can be used to inform the kernel about the presence of one or more Low Power Idle (LPI) entries as descried in LPIT table. LPIT table can exist independently even if the FADT S0 Idle flag is not set and thus it could confuse user since the following cpuidle attributes are created. /sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us Presence or absence of above attributes could mean that the given platform supports S0ix state or not. This change allows to create the above cpuidle attributes only if FADT table supports Low Power S0 Idle. Signed-off-by: Rajneesh Bhardwaj Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_lpit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c index cf4fc0161164..e43cb71b6972 100644 --- a/drivers/acpi/acpi_lpit.c +++ b/drivers/acpi/acpi_lpit.c @@ -117,11 +117,17 @@ static void lpit_update_residency(struct lpit_residency_info *info, if (!info->iomem_addr) return; + if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) + return; + /* Silently fail, if cpuidle attribute group is not present */ sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj, &dev_attr_low_power_idle_system_residency_us.attr, "cpuidle"); } else if (info->gaddr.space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) { + if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) + return; + /* Silently fail, if cpuidle attribute group is not present */ sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj, &dev_attr_low_power_idle_cpu_residency_us.attr, -- 2.17.1