Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1022616yba; Thu, 4 Apr 2019 02:38:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxq6X3mXQWeoUqFjHqMQH3iDRW1cMkdflCIA9ArUx/pvsF+CzEzgPjq3M/POWdDWyseOv9/ X-Received: by 2002:a63:dc50:: with SMTP id f16mr4788062pgj.396.1554370704183; Thu, 04 Apr 2019 02:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554370704; cv=none; d=google.com; s=arc-20160816; b=VSIYi8QJz8haahcJUIKKaqQQa9pt1mohnLZDnjdimP3k1ION04tJ2q6c6IVZlNNkJa v7xsICmXNRE7VscBtFzZJNWm3eRdGHJf5KWE7ARtIhyNepkvLCMFLUtaPuSqVfdEJp5u iQoagZO6VrBKR/d7Aay3l545FkOYXzau8JLQLF1vyLJfB2LagPOpdyv8P65xybgFawmV hPiV4avBpjBg0uNUrMMyGByLsD1siMVvxB6BBkSeAbkg4T+UgMeJgwl1udKE6m9pUnY9 k820KPLpzLA3VTI4xMscTKnscVgdVd2NETNH+PE4oUhpM9PSXwYEIvrNrJzUjqvalcNE iDog== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=abjDSZnB9LBSWoiU+K0GSCGBqGiqTEtYnYOMDzrLsK4=; b=wIngpgt/2BvI7JczZzCFJIyy9RoBSX5khCpF8dRDcE7aeooQyB+PG024ZmUEOdVhnL 0ZOQVtU4kkPZb9uUT1ecLw/51aEz3DMjQyt0/fOAmd0gfkVV59LpxKp18cziCbRgkA81 M378jP0snHdQxP6P4YEJrpJMZYADUOAI8EMv/MUDUR3TmapJqskvOg+T7CkyyY6mJzqa EasDci5U00/B4av+oLmBYZGctamNxIEI1X+1FUdv3atf/D4H5CFQ3/CoAgeMj9MLEXa9 RhOSpkNLWx55lhRfJqGduSLXWEvYLp+iTkyfPxyoyMMJpEUD/tNQ5GtWUvwX+ru8S8uI /DFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AXKMH2SK; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si15423879pfa.87.2019.04.04.02.38.09; Thu, 04 Apr 2019 02:38:24 -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=AXKMH2SK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732392AbfDDJhB (ORCPT + 99 others); Thu, 4 Apr 2019 05:37:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:43296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732109AbfDDJFR (ORCPT ); Thu, 4 Apr 2019 05:05:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8DB69214AF; Thu, 4 Apr 2019 09:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368717; bh=26CJLkFUWaQHEhOCX4hhbPn19xu/Hjo/OikKmOyssm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AXKMH2SKhuy1TUmIWKYiMNA6raI03fsfohty8S2XwQn01JJmyzA0B8qfrpMhJZ6nK SLu3Y1bkRTZffEfnQkYt8BZWwNmUNeoC0AFMHTIf0gX2hbgnZoxwvzB0Xt9b3H1oQ6 /jh5l0QPjS3TPPInNCcu+WnlOeKZ4C3r+aBjlHNw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David E. Box" , Srinivas Pandruvada , Rajneesh Bhardwaj , Andy Shevchenko , Sasha Levin Subject: [PATCH 4.19 127/187] platform/x86: intel_pmc_core: Fix PCH IP sts reading Date: Thu, 4 Apr 2019 10:47:44 +0200 Message-Id: <20190404084609.204267332@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 2d272a3e0176..e0dcdb3cc070 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -333,7 +333,8 @@ static int pmc_core_ppfear_sts_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 93a7e99e1f8b..3f9711b03cb4 100644 --- a/drivers/platform/x86/intel_pmc_core.h +++ b/drivers/platform/x86/intel_pmc_core.h @@ -39,7 +39,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