Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5645579img; Wed, 27 Mar 2019 12:20:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqx39YYV26ysCiGoehzk6L3UAGxp42e9A8Iy5L5AJ/cD7eR7aF3tS+UjAEQG8F8pwNTwQhMy X-Received: by 2002:a17:902:9304:: with SMTP id bc4mr39286462plb.81.1553714450695; Wed, 27 Mar 2019 12:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714450; cv=none; d=google.com; s=arc-20160816; b=PdgKhRKrY6rj6oFiO7k/BgEaYsJruTcylfVtr9K4lQddhTwhnwhNZHdaY/M39m++d+ pQSkcFytfbpjRWqeYy7tSCXaUd9pbDxodT4SK9AyqjTnH97e5FRauzOxr+qAl9bgG09j 6xPeNyqZw0s1az24TmfSHzSF0lwj4McxqBb93fYn9O+Hdc3cawSYshtTohbyxzNIjj1u XmMWoY7pCWPM5KThJo79+LE0At3HxVA5HeFiJnTf0AAdUv2UyokE6fm9GB0xmqls1Y5G m9+LtSzi87sP0od2TzTdB5mxzYZsUjGFbWzpv2gbHWqmPl4DP789L23mZMagL9xMDoua jxyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=J3UuKEXxl7pH14yxhNWWrDKatBvNWRhdqriQs60Xsf8=; b=0Ou1T1GNmBBuY3SVH+GjxQWnQbFql0vHpA1yvP7wC1vr+YLHdihjfWt4/oQmE4wZ0n sNxqNAMqc6L85UY4k3N67/0r191Zw+tLzRItIVZLALRaA8P4JABL0pIGCVDBOeh3JyjT Rh3xV2HdtAoKL7eu6MX0gMZMJ6OVsSK+U6MeJvwF4AQJHjfF+s0hww3AUX/FrWGqrj/J bL0wRgEo23iV8qYS+fhH5qGgoi+rEUy1uqgCUko3PEF7KfRsYOQF/J/fyJUG6l4DZyO0 5oqPcpRBD6JbjaJCxGxt5zkLZBom/Nx4Kp6BSptVdYgryjIOJ+G3dfJoN9slc/BPeLHr 6c7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IUGr7sD8; 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 f7si15365313pgg.234.2019.03.27.12.20.35; Wed, 27 Mar 2019 12:20:50 -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=IUGr7sD8; 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 S1731380AbfC0SHp (ORCPT + 99 others); Wed, 27 Mar 2019 14:07:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:49558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387595AbfC0SHn (ORCPT ); Wed, 27 Mar 2019 14:07:43 -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 EBBF621734; Wed, 27 Mar 2019 18:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710061; bh=T2EEJeWaeg2bcZzdl6pMEHLRndjmxTcMyCbeco6TNfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IUGr7sD87QjDfhohs6X2A0vmjq2ev57Ks0mCSR9IhC4MUFQcTr9M8y0Di3SfXoN0+ jOPh3HuQY17msP6IOwZJ//1+kXXcQ+8QFXeXRiipSRdIpI7JWsyyKbnP5SkpGCrZvc jtweMHov911n3OZzAHa68ram0xu13n1DU3UUU0Qw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Rajneesh Bhardwaj , "David E. Box" , Srinivas Pandruvada , Andy Shevchenko , Sasha Levin , platform-driver-x86@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 179/262] platform/x86: intel_pmc_core: Fix PCH IP sts reading Date: Wed, 27 Mar 2019 14:00:34 -0400 Message-Id: <20190327180158.10245-179-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rajneesh Bhardwaj [ Upstream commit 0e68eeea9894feeba2edf7ec63e4551b87f39621 ] A previous commit "platform/x86: intel_pmc_core: Make the driver PCH family agnostic " provided better abstraction to this driver but has some fundamental issues. e.g. the following condition for (index = 0; index < pmcdev->map->ppfear_buckets && index < PPFEAR_MAX_NUM_ENTRIES; index++, iter++) is wrong because for CNL, PPFEAR_MAX_NUM_ENTRIES is hardcoded as 5 which is _wrong_ and even though ppfear_buckets is 8, the loop fails to read all eight registers needed for CNL PCH i.e. PPFEAR0 and PPFEAR1. This patch refactors the pfear show logic to correctly read PCH IP power gating status for Cannonlake and beyond. Cc: "David E. Box" Cc: Srinivas Pandruvada Fixes: c977b98bbef5 ("platform/x86: intel_pmc_core: Make the driver PCH family agnostic") Signed-off-by: Rajneesh Bhardwaj Signed-off-by: Andy Shevchenko Signed-off-by: Sasha Levin --- drivers/platform/x86/intel_pmc_core.c | 3 ++- drivers/platform/x86/intel_pmc_core.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c index 22dbf115782e..c37e74ee609d 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -380,7 +380,8 @@ static int pmc_core_ppfear_show(struct seq_file *s, void *unused) index < PPFEAR_MAX_NUM_ENTRIES; index++, iter++) pf_regs[index] = pmc_core_reg_read_byte(pmcdev, iter); - for (index = 0; map[index].name; index++) + for (index = 0; map[index].name && + index < pmcdev->map->ppfear_buckets * 8; index++) pmc_core_display_map(s, index, pf_regs[index / 8], map); return 0; diff --git a/drivers/platform/x86/intel_pmc_core.h b/drivers/platform/x86/intel_pmc_core.h index 89554cba5758..1a0104d2cbf0 100644 --- a/drivers/platform/x86/intel_pmc_core.h +++ b/drivers/platform/x86/intel_pmc_core.h @@ -32,7 +32,7 @@ #define SPT_PMC_SLP_S0_RES_COUNTER_STEP 0x64 #define PMC_BASE_ADDR_MASK ~(SPT_PMC_MMIO_REG_LEN - 1) #define MTPMC_MASK 0xffff0000 -#define PPFEAR_MAX_NUM_ENTRIES 5 +#define PPFEAR_MAX_NUM_ENTRIES 12 #define SPT_PPFEAR_NUM_ENTRIES 5 #define SPT_PMC_READ_DISABLE_BIT 0x16 #define SPT_PMC_MSG_FULL_STS_BIT 0x18 -- 2.19.1