Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp7061958rdb; Fri, 15 Dec 2023 17:17:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFh+URb0syWgKSIGHSwzZwqE6J9Z6d7FxKv+rFLA7Xh90FvsbbrqYaHI6QF11JPOtHc3MdV X-Received: by 2002:a17:906:2207:b0:a1f:b467:9b93 with SMTP id s7-20020a170906220700b00a1fb4679b93mr4311339ejs.78.1702689425229; Fri, 15 Dec 2023 17:17:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702689425; cv=none; d=google.com; s=arc-20160816; b=WCg+MbZA7IsFxL/y+jyiQqckv45rOLrkM45AO5wLuH5ch3PDrF2AczjxRKMWE3KSTQ 6oRnKsyRXR/TwaBy9TMnlVR0RTpThocBsSwlmh3rBKxkCBqKRawLJoLzD6ost226/PDN wAHGyZC/AbKqKLA0mJq99QNTP1vl4dbyVerfO2G2o3CwcZSjynIvmyJ9TG3VpIGhROZZ TSey05JIYCcRUu+kvbwCuzDf+LeOd2cAijtxRDsYXj9cFa0SOMTd1Ayi9JxDSHOiM4Oe ztNfnthjqoZ246ZIPSOk80crzY0Oio0keHCknv0BI93BtkXeacwD5dhAEJCZJ5DA6n4T EXBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=MJ0Xdk74aJOYgK17d3WLv0iwiySMCKH8lg3dbzk75nM=; fh=oxRMXyy+mP0PgcGR2fL1jbEFGnlHS2LjPpSH0P/+rpo=; b=J+SLiU1jjyW8eoLt/Qc90Cxzjfk/+c/m90or6Xhnmwx683HeR8Fopz9L4+RHqvZV6y Txr3Vbm1MqLmuh9CzanGMgPzejKItnHDWVVikPHq5JoNyX+HwXuNOAzs7FjbyCYXqXT9 lmeGWc7T9fBq+tTSv32EblRfUHWbdUfZtc+y8tlJAiG07UAl01aMYRZmXVAAdalAL9ZN LRPN0UM4/YUO6WVfK+qlGlmxi4EF6KOD/cFeoeBk4GZz9ely8lLTndcUFtLlXilFxQRv uwa9y0CH+qXM30Q/nkcwRJjN18fpkRwQDIimIvftvccKe7XGNA1R1KWSnBJRoRwVMoCz I3QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P1+t8tUS; spf=pass (google.com: domain of linux-kernel+bounces-1922-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1922-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id oy10-20020a170907104a00b00a1c68c96a1dsi7520865ejb.743.2023.12.15.17.17.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 17:17:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1922-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P1+t8tUS; spf=pass (google.com: domain of linux-kernel+bounces-1922-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1922-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D614F1F25470 for ; Sat, 16 Dec 2023 01:17:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21490110D; Sat, 16 Dec 2023 01:16:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="P1+t8tUS" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7819A10FE; Sat, 16 Dec 2023 01:16:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702689415; x=1734225415; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Uu/DuVeOYQ8cy5ChNWdZWy4tzkcdqBmvZKljPoGxouA=; b=P1+t8tUSa6V8ChZpa8Peuf3IOdntlWwfnbbuiKlqmCPc2pchZphsCGIe NyV/s/gIzGPbgZ47WxogjnGcolzkqviyG2hYztwYmIzZdwaf+Pmb4cyJg HOgpxGMNUCA7ejcPOlLS+LBENpZ5wZjUAUVzlSHQPhMSnitz714olI68J 2v2/G42E1SvEboTiLak5UBYpubz1cq976waHB5qkjWcnRjFrSvfsuOWle 9X271oP9N60LPU3VWw0e/o6qnCl2dIEl2uKIAb87sTxb/sUrUvVexI2gI KIXwAE1VEvQiSFTX4lJD1lyBmx45eEf9PYcquNyZ3ZaU0VkvAgB/KFUcP w==; X-IronPort-AV: E=McAfee;i="6600,9927,10925"; a="392520044" X-IronPort-AV: E=Sophos;i="6.04,280,1695711600"; d="scan'208";a="392520044" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 17:16:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10925"; a="948139340" X-IronPort-AV: E=Sophos;i="6.04,280,1695711600"; d="scan'208";a="948139340" Received: from simmons1-mobl5.amr.corp.intel.com (HELO rjingar-desk5.intel.com) ([10.213.162.133]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 17:16:53 -0800 From: rjingar To: irenic.rajneesh@gmail.com, david.e.box@intel.com, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, markgross@kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: rajvi.jingar@linux.intel.com Subject: [PATCH 1/2] platform/x86/intel/pmc: Fix hang in pmc_core_send_ltr_ignore() Date: Fri, 15 Dec 2023 17:16:50 -0800 Message-Id: <20231216011650.1973941-1-rajvi.jingar@linux.intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Rajvi Jingar For input value 0, PMC stays unassigned which causes crash while trying to access PMC for register read/write. Include LTR index 0 in pmc_index and ltr_index calculation. Fixes: 2bcef4529222 ("platform/x86:intel/pmc: Enable debugfs multiple PMC support") Signed-off-by: Rajvi Jingar --- drivers/platform/x86/intel/pmc/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index 983e3a8f4910..55eb6a4683fb 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -474,7 +474,7 @@ int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value) * is based on the contiguous indexes from ltr_show output. * pmc index and ltr index needs to be calculated from it. */ - for (pmc_index = 0; pmc_index < ARRAY_SIZE(pmcdev->pmcs) && ltr_index > 0; pmc_index++) { + for (pmc_index = 0; pmc_index < ARRAY_SIZE(pmcdev->pmcs) && ltr_index >= 0; pmc_index++) { pmc = pmcdev->pmcs[pmc_index]; if (!pmc) -- 2.34.1