From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 852AB364045 for ; Thu, 30 Apr 2026 17:24:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777569854; cv=none; b=cJe6AQBisuMpyTx7v00LeerfQ7114MxLIe/Cz0lSixKowfMG+586zYDeyREPdrY+TivbgX2xzIOmaf0W7rjvgtndRD1JKmmRGQQrYQl7M9v8qrR/YbglbSEwvNLPcGpb8ivR7/YP6432RDGlAx2BUW2MkPOSTyVTiikAQdHmd2o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777569854; c=relaxed/simple; bh=W7KvrmKSH/47VlzRFv8Cr8zhERDW09ttFcIbgy5m6ms=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z116So9l5v88wVg4Fx5dp9GyHQwr66m301zsyGLzOzcR9Rl8LUVaLwcLFx/EqWizwee8Fhr0/7ZlJzIQ9RBipqPpqZTfnX8noQ5P5FKbui535Liu8PKumAx8RzwilTvSCo2PsJmaQwIf8+l8RfOUjru8oL7aiT6sJdVHgZYI7AE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=nDZ9kgd1; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="nDZ9kgd1" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7CB14175D; Thu, 30 Apr 2026 10:24:07 -0700 (PDT) Received: from localhost (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 71E4C3FAF5; Thu, 30 Apr 2026 10:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1777569852; bh=W7KvrmKSH/47VlzRFv8Cr8zhERDW09ttFcIbgy5m6ms=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nDZ9kgd1F2APSzB4Aua15VI9jJrw/jMur9hBOzS7MCaouFEP545stFEuv4itmTQzi ErhOzQ4FERb+ZpAAW9xHtzY6Nl1ESRLGkZWdWReEYb9DQY53byWglKs0PDklgwwiXi n7oJ1ALc2Jz55ruKtzrsPvOUInBdFnsgRsxxEX28= Date: Thu, 30 Apr 2026 18:24:10 +0100 From: Leo Yan To: James Clark Cc: Suzuki K Poulose , Mike Leach , Alexander Shishkin , Mathieu Poirier , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] coresight: etm4x: Refactor pm_save_enable handling Message-ID: <20260430172410.GG16537@e132581.arm.com> References: <20260428-james-cs-ete-pm_save_enable-v1-0-c7a90ca6f43b@linaro.org> <20260428-james-cs-ete-pm_save_enable-v1-2-c7a90ca6f43b@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260428-james-cs-ete-pm_save_enable-v1-2-c7a90ca6f43b@linaro.org> On Tue, Apr 28, 2026 at 01:18:12PM +0100, James Clark wrote: [...] > static int etm4_init_pm_save(struct device *dev, struct etmv4_drvdata *drvdata) > { > if (etm4x_is_ete(drvdata)) { > + if (pm_save_enable) > + dev_warn_once(dev, "pm_save_enable module option is only for ETM4\n"); > + > /* > * Always do PM save for ETE. It always uses system registers > * which will be lost on CPU power down. > */ > - pm_save_enable = PARAM_PM_SAVE_SELF_HOSTED; > + drvdata->pm_save = true; > } else if (pm_save_enable == PARAM_PM_SAVE_FIRMWARE) { > - pm_save_enable = coresight_loses_context_with_cpu(dev) ? > - PARAM_PM_SAVE_SELF_HOSTED : PARAM_PM_SAVE_NEVER; > + drvdata->pm_save = coresight_loses_context_with_cpu(dev); > + } else if (pm_save_enable == PARAM_PM_SAVE_SELF_HOSTED) { > + drvdata->pm_save = true; > + } else { > + drvdata->pm_save = false; > } Could we separate ETE and ETM a bit? int cpu_pm; cpu_pm = coresight_loses_context_with_cpu(dev) ? PARAM_PM_SAVE_SELF_HOSTED : PARAM_PM_SAVE_NEVER; if (etm4x_is_ete(drvdata)) goto alloc_out; /* Now this is only for ETM case */ /* Do consistency check */ if ((cpu_fw_pm == PARAM_PM_SAVE_SELF_HOSTED && pm_save_enable == PARAM_PM_SAVE_NEVER) || (cpu_fw_pm == PARAM_PM_SAVE_NEVER && pm_save_enable == PARAM_PM_SAVE_SELF_HOSTED)) dev_warn(dev, "inconsistent setting ...\n"); /* Force to use the global setting */ if (pm_save_enable != PARAM_PM_SAVE_FIRMWARE) cpu_pm = pm_save_enable; > > - if (pm_save_enable != PARAM_PM_SAVE_NEVER) { > + if (drvdata->pm_save) { would be: if (cpu_pm == PARAM_PM_SAVE_SELF_HOSTED) > drvdata->save_state = devm_kmalloc(dev, > sizeof(struct etmv4_save_state), > GFP_KERNEL); > @@ -2037,7 +2047,7 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) > { > int ret = 0; > > - if (pm_save_enable != PARAM_PM_SAVE_SELF_HOSTED) > + if (!drvdata->pm_save) Drop "pm_save" and directly use drvdata->save_state ? We don't need "pm_save" anyway after we apply the patch [1]. [1] http://listhost.cambridge.arm.com/pipermail/linux-eng/2026-April/030289.html