Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp88041ima; Thu, 31 Jan 2019 23:34:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN7fC3Bittsp91wFWL3K+Lq8GWoLSITYhMfZ2WMa5sHwZaDn83uC8/LFgYbzJmBe84DAcLK/ X-Received: by 2002:a62:6f49:: with SMTP id k70mr37790846pfc.7.1549006468868; Thu, 31 Jan 2019 23:34:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549006468; cv=none; d=google.com; s=arc-20160816; b=Zrvc/hL28HHBQ6jNH1OKJgQrl2V9RS4G/qd7xWj19pfJUyyAZJSXq8sVL+3MCNTLHW NF943z28cjOzr40jwoDg8GY9OSB97/6oczBpfTTBl7BrdQsaNXPxBrFWNulCJQO6IBg8 zRq/ERg9ep4l5JtpSOTNFDr6PCQMCk+pNs8iehHXhPsRrFOJ1BKoWQLanuy4rTYzJYmA VcgvyiFNbcV6p29X909DnuJWJhF9DltcbPkaJqwCr53fPz3h9bk4zQkCkeH1pnNcp1RB 2HjatZaucoX8vEnG61hv8awpcQqJN53xxeoBgTU8BDIfhvJmcH8/tTGZH1ds5YJGf2Fe Tb6w== 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; bh=0SRlPwV8u5QMQfwLMKrjyLg46FFUaIuAN8pBenyVTMA=; b=YnvKipLQ4jPXbIpKWUS4EElex439w6lxQMVp2Ip6oCLBn9Aw6mrjGyID2sQKPp773K RCuoDhifeIPChNiPlm4N6dzDyXkDo+38Sl2cxQJkP4TuI69EEx6iTJdnxymt7OiMKyjQ 69/9OPgi4lG14YRBQ7wqkTtIJguqZ/njWAwa06xLzwub+nUWlbJscvHweAnXycJwHi5E hVbrnFUgTsTVnu5BfHSPkBf/CYqD6DOgPwFLh5hODrvGcVMf9FIMoL5hyVn120kPAg/n HhVxU/at++fppXTQLrpVZINLI2eJDYCj7r6Kx6pEyD3zNUJ8SkXF2lbWMJJzDIMptCjT NqmQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si6672334plp.167.2019.01.31.23.34.13; Thu, 31 Jan 2019 23:34:28 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727537AbfBAHci (ORCPT + 99 others); Fri, 1 Feb 2019 02:32:38 -0500 Received: from mga12.intel.com ([192.55.52.136]:57767 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726110AbfBAHch (ORCPT ); Fri, 1 Feb 2019 02:32:37 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2019 23:32:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,547,1539673200"; d="scan'208";a="114430693" Received: from rajneesh-desk.iind.intel.com ([10.223.86.34]) by orsmga008.jf.intel.com with ESMTP; 31 Jan 2019 23:32:33 -0800 From: Rajneesh Bhardwaj To: platform-driver-x86@vger.kernel.org Cc: dvhart@infradead.org, andy@infradead.org, linux-kernel@vger.kernel.org, Rajneesh Bhardwaj , "David E. Box" , Srinivas Pandruvada Subject: [PATCH 02/10] platform/x86: intel_pmc_core: Fix PCH IP sts reading Date: Fri, 1 Feb 2019 13:02:26 +0530 Message-Id: <20190201073234.13280-3-rajneesh.bhardwaj@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190201073234.13280-1-rajneesh.bhardwaj@linux.intel.com> References: <20190201073234.13280-1-rajneesh.bhardwaj@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 37f605da9333..9f143cdbea05 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.17.1