Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp243479imj; Wed, 13 Feb 2019 07:38:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IaqgSl8q5jsaw764yUsBMHNvqtMYMXiiYRb+XWHIfkUctcyT8p/kd89Opd7Y22kyxv/yn+a X-Received: by 2002:a17:902:9b90:: with SMTP id y16mr1176437plp.0.1550072296485; Wed, 13 Feb 2019 07:38:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550072296; cv=none; d=google.com; s=arc-20160816; b=YZXTDHO4ZVcK6NO3FkNxa4nvSDCj7N92gnzvhHHcrlP8g+XOjhaxtCERFgIzZllGOM zhL39E5hmJw6lEdzedqU0dsifaS9OdFKHM2kT4DTvp1sm+5aBRcmfxPL7OmzjCHzESnX mLjUhFnYjerUVpzpDg/6UibjdzT1X1Yt+mjlV/yDMRMtS+m6Dkdr9kP2WtWsp4FZdGa1 wXPPjRmBRU3s5yaYGIKxM64z0AZ4BuoIlEQl6AfxMGoi9dnNzXCimpLcXH478Un0E6Ec ludQNXlLECa8txWtgR1IG4OCJ+1jAv7h4Dq+306ZWzE3mnuRtMYEA350z6dYtZTQUeb8 4RCQ== 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=zDY+s/LmH5vYVz4dTruTT0Y8Fa60UKaRhb3pxyPkZkJY+bl65tGWTK+fKDHxgg6IAO Z/O1v3c6M3w8uQlcmCV0LqwDbBymvv1vS0tpnVxbaFyCPVzbDAZLQ+dXkdm1ZXbd9v4L SG3f+aFPXn1ORVo5GP+mV8NMNZVL1GE8RX6QVDBvKT0OK/HkZR/25IAUKSotbmKhNup5 znQ7f0Z75LEGtfoarEQtAz0lSUWrncFvDoF418xJNZ1uYj8UL5hdDRAJ0u4l016xNFuG r2eY2CQX07scMEybSW3rCDyUoRoKa3xHEwmVPDEZoNex3+6Uwr+qZJW3QsvtdR/oV7fP 7+Yw== 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 e68si16548901pfb.101.2019.02.13.07.37.59; Wed, 13 Feb 2019 07:38:16 -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 S2392404AbfBMPIA (ORCPT + 99 others); Wed, 13 Feb 2019 10:08:00 -0500 Received: from mga06.intel.com ([134.134.136.31]:11815 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfBMPH7 (ORCPT ); Wed, 13 Feb 2019 10:07:59 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2019 07:07:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,365,1544515200"; d="scan'208";a="299437276" Received: from rajneesh-desk.iind.intel.com ([10.223.86.34]) by orsmga005.jf.intel.com with ESMTP; 13 Feb 2019 07:07:56 -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 v2 02/10] platform/x86: intel_pmc_core: Fix PCH IP sts reading Date: Wed, 13 Feb 2019 20:38:02 +0530 Message-Id: <20190213150810.32750-3-rajneesh.bhardwaj@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190213150810.32750-1-rajneesh.bhardwaj@linux.intel.com> References: <20190213150810.32750-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