All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Jithu Joseph <jithu.joseph@intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	markgross@kernel.org,  tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de,  dave.hansen@linux.intel.com, x86@kernel.org,
	hpa@zytor.com,  rostedt@goodmis.org, ashok.raj@intel.com,
	tony.luck@intel.com,  LKML <linux-kernel@vger.kernel.org>,
	platform-driver-x86@vger.kernel.org,  patches@lists.linux.dev,
	ravi.v.shankar@intel.com, pengfei.xu@intel.com
Subject: Re: [PATCH v2 4/9] platform/x86/intel/ifs: Gen2 Scan test support
Date: Mon, 25 Sep 2023 18:39:39 +0300 (EEST)	[thread overview]
Message-ID: <c390bdaf-ab5c-bf1f-bd64-29e2827d01f@linux.intel.com> (raw)
In-Reply-To: <20230922232606.1928026-5-jithu.joseph@intel.com>

On Fri, 22 Sep 2023, Jithu Joseph wrote:

> Width of chunk related bitfields is ACTIVATE_SCAN and SCAN_STATUS MSRs
> are different in newer IFS generation compared to gen0.
> 
> Make changes to scan test flow such that MSRs are populated
> appropriately based on the generation supported by hardware.
> 
> Account for the 8/16 bit MSR bitfield width differences between gen0 and
> newer generations for the scan test trace event too.
> 
> Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
> Reviewed-by: Tony Luck <tony.luck@intel.com>
> Tested-by: Pengfei Xu <pengfei.xu@intel.com>
> ---
>  drivers/platform/x86/intel/ifs/ifs.h     | 28 +++++++++++++++++++-----
>  include/trace/events/intel_ifs.h         | 16 +++++++-------
>  drivers/platform/x86/intel/ifs/runtest.c | 26 ++++++++++++++++------
>  3 files changed, 49 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h
> index 43281d456a09..cd213b89d278 100644
> --- a/drivers/platform/x86/intel/ifs/ifs.h
> +++ b/drivers/platform/x86/intel/ifs/ifs.h
> @@ -199,9 +199,17 @@ union ifs_chunks_auth_status_gen2 {
>  union ifs_scan {
>  	u64	data;
>  	struct {
> -		u32	start	:8;
> -		u32	stop	:8;
> -		u32	rsvd	:16;
> +		union {
> +			struct {
> +				u8	start;
> +				u8	stop;
> +				u16	rsvd;
> +			} gen0;
> +			struct {
> +				u16	start;
> +				u16	stop;
> +			} gen2;
> +		};
>  		u32	delay	:31;
>  		u32	sigmce	:1;
>  	};
> @@ -211,9 +219,17 @@ union ifs_scan {
>  union ifs_status {
>  	u64	data;
>  	struct {
> -		u32	chunk_num		:8;
> -		u32	chunk_stop_index	:8;
> -		u32	rsvd1			:16;
> +		union {
> +			struct {
> +				u8	chunk_num;
> +				u8	chunk_stop_index;
> +				u16	rsvd1;
> +			} gen0;
> +			struct {
> +				u16	chunk_num;
> +				u16	chunk_stop_index;
> +			} gen2;
> +		};
>  		u32	error_code		:8;
>  		u32	rsvd2			:22;
>  		u32	control_error		:1;
> diff --git a/include/trace/events/intel_ifs.h b/include/trace/events/intel_ifs.h
> index d7353024016c..af0af3f1d9b7 100644
> --- a/include/trace/events/intel_ifs.h
> +++ b/include/trace/events/intel_ifs.h
> @@ -10,25 +10,25 @@
>  
>  TRACE_EVENT(ifs_status,
>  
> -	TP_PROTO(int cpu, union ifs_scan activate, union ifs_status status),
> +	TP_PROTO(int cpu, int start, int stop, u64 status),
>  
> -	TP_ARGS(cpu, activate, status),
> +	TP_ARGS(cpu, start, stop, status),
>  
>  	TP_STRUCT__entry(
>  		__field(	u64,	status	)
>  		__field(	int,	cpu	)
> -		__field(	u8,	start	)
> -		__field(	u8,	stop	)
> +		__field(	u16,	start	)
> +		__field(	u16,	stop	)
>  	),
>  
>  	TP_fast_assign(
>  		__entry->cpu	= cpu;
> -		__entry->start	= activate.start;
> -		__entry->stop	= activate.stop;
> -		__entry->status	= status.data;
> +		__entry->start	= start;
> +		__entry->stop	= stop;
> +		__entry->status	= status;
>  	),
>  
> -	TP_printk("cpu: %d, start: %.2x, stop: %.2x, status: %llx",
> +	TP_printk("cpu: %d, start: %.4x, stop: %.4x, status: %.16llx",
>  		__entry->cpu,
>  		__entry->start,
>  		__entry->stop,
> diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c
> index 1061eb7ec399..94d486e5d263 100644
> --- a/drivers/platform/x86/intel/ifs/runtest.c
> +++ b/drivers/platform/x86/intel/ifs/runtest.c
> @@ -171,21 +171,30 @@ static void ifs_test_core(int cpu, struct device *dev)
>  	union ifs_status status;
>  	unsigned long timeout;
>  	struct ifs_data *ifsd;
> +	int to_start, to_stop;
> +	int status_chunk;
>  	u64 msrvals[2];
>  	int retries;
>  
>  	ifsd = ifs_get_data(dev);
>  
> -	activate.rsvd = 0;
>  	activate.delay = IFS_THREAD_WAIT;
>  	activate.sigmce = 0;
> -	activate.start = 0;
> -	activate.stop = ifsd->valid_chunks - 1;
> +	to_start = 0;
> +	to_stop = ifsd->valid_chunks - 1;
> +
> +	if (ifsd->generation) {
> +		activate.gen2.start = to_start;
> +		activate.gen2.stop = to_stop;
> +	} else {
> +		activate.gen0.start = to_start;
> +		activate.gen0.stop = to_stop;
> +	}

Is it okay to not do activate.gen0.rsvd = 0 anymore? If you know it is, it 
would be nice to record that fact into the changelog so that it can be 
found in the history.

>  
>  	timeout = jiffies + HZ / 2;
>  	retries = MAX_IFS_RETRIES;
>  
> -	while (activate.start <= activate.stop) {
> +	while (to_start <= to_stop) {
>  		if (time_after(jiffies, timeout)) {
>  			status.error_code = IFS_SW_TIMEOUT;
>  			break;
> @@ -196,13 +205,14 @@ static void ifs_test_core(int cpu, struct device *dev)
>  
>  		status.data = msrvals[1];
>  
> -		trace_ifs_status(cpu, activate, status);
> +		trace_ifs_status(cpu, to_start, to_stop, status.data);
>  
>  		/* Some cases can be retried, give up for others */
>  		if (!can_restart(status))
>  			break;
>  
> -		if (status.chunk_num == activate.start) {
> +		status_chunk = ifsd->generation ? status.gen2.chunk_num : status.gen0.chunk_num;
> +		if (status_chunk == to_start) {
>  			/* Check for forward progress */
>  			if (--retries == 0) {
>  				if (status.error_code == IFS_NO_ERROR)
> @@ -211,7 +221,9 @@ static void ifs_test_core(int cpu, struct device *dev)
>  			}
>  		} else {
>  			retries = MAX_IFS_RETRIES;
> -			activate.start = status.chunk_num;
> +			ifsd->generation ? (activate.gen2.start = status_chunk) :
> +			(activate.gen0.start = status_chunk);

The alignment of the second line is still not correct but now I notice how 
the left-hand side is hidden within those expressions. Just do a normal if 
instead so that it is simpler to understand, please.

> +			to_start = status_chunk;
>  		}
>  	}
>  
> 

-- 
 i.


  reply	other threads:[~2023-09-25 15:39 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13 18:33 [PATCH 00/10] IFS support for GNR and SRF Jithu Joseph
2023-09-13 18:33 ` [PATCH 01/10] platform/x86/intel/ifs: Store IFS generation number Jithu Joseph
2023-09-15 16:22   ` Ilpo Järvinen
2023-09-15 17:12     ` Joseph, Jithu
2023-09-13 18:33 ` [PATCH 02/10] platform/x86/intel/ifs: Refactor image loading code Jithu Joseph
2023-09-13 18:33 ` [PATCH 03/10] platform/x86/intel/ifs: Image loading for new generations Jithu Joseph
2023-09-15 16:46   ` Ilpo Järvinen
2023-09-15 17:20     ` Joseph, Jithu
2023-09-18  8:49       ` Ilpo Järvinen
2023-09-18 15:25         ` Luck, Tony
2023-09-18 15:46           ` Ilpo Järvinen
2023-09-18 16:09             ` Luck, Tony
2023-09-18 16:29               ` Ilpo Järvinen
2023-09-18 16:51                 ` Joseph, Jithu
2023-09-18 16:58                   ` Dave Hansen
2023-09-18 17:45                     ` Joseph, Jithu
2023-09-13 18:33 ` [PATCH 04/10] platform/x86/intel/ifs: Scan test " Jithu Joseph
2023-09-15 16:51   ` Ilpo Järvinen
2023-09-15 20:10     ` Joseph, Jithu
2023-09-19  7:44       ` Ilpo Järvinen
2023-09-19 16:22         ` Joseph, Jithu
2023-09-13 18:33 ` [PATCH 05/10] trace: platform/x86/intel/ifs: Modify scan trace Jithu Joseph
2023-09-13 18:33 ` [PATCH 06/10] platform/x86/intel/ifs: Validate image size Jithu Joseph
2023-09-15 16:57   ` Ilpo Järvinen
2023-09-15 18:06     ` Joseph, Jithu
2023-09-13 18:33 ` [PATCH 07/10] platform/x86/intel/ifs: Metadata validation for start_chunk Jithu Joseph
2023-09-15 16:59   ` Ilpo Järvinen
2023-09-15 18:07     ` Joseph, Jithu
2023-09-13 18:33 ` [PATCH 08/10] platform/x86/intel/ifs: Add new CPU support Jithu Joseph
2023-09-13 18:33 ` [PATCH 09/10] platform/x86/intel/ifs: Add new error code Jithu Joseph
2023-09-13 18:33 ` [PATCH 10/10] platform/x86/intel/ifs: ARRAY BIST for Sierra Forest Jithu Joseph
2023-09-15 17:04   ` Ilpo Järvinen
2023-09-15 20:13     ` Joseph, Jithu
2023-09-18 12:32 ` [PATCH 00/10] IFS support for GNR and SRF Hans de Goede
2023-09-18 16:53   ` Joseph, Jithu
2023-09-22 23:25 ` [PATCH v2 0/9] " Jithu Joseph
2023-09-22 23:25   ` [PATCH v2 1/9] platform/x86/intel/ifs: Store IFS generation number Jithu Joseph
2023-09-25 15:08     ` Ilpo Järvinen
2023-09-22 23:25   ` [PATCH v2 2/9] platform/x86/intel/ifs: Refactor image loading code Jithu Joseph
2023-09-25 15:20     ` Ilpo Järvinen
2023-09-22 23:26   ` [PATCH v2 3/9] platform/x86/intel/ifs: Gen2 scan image loading Jithu Joseph
2023-09-25 15:23     ` Ilpo Järvinen
2023-09-22 23:26   ` [PATCH v2 4/9] platform/x86/intel/ifs: Gen2 Scan test support Jithu Joseph
2023-09-25 15:39     ` Ilpo Järvinen [this message]
2023-09-25 16:08       ` Joseph, Jithu
2023-09-26 10:20         ` Ilpo Järvinen
2023-09-26 23:26           ` Joseph, Jithu
2023-09-22 23:26   ` [PATCH v2 5/9] platform/x86/intel/ifs: Validate image size Jithu Joseph
2023-09-25 15:43     ` Ilpo Järvinen
2023-09-25 18:24       ` Joseph, Jithu
2023-09-22 23:26   ` [PATCH v2 6/9] platform/x86/intel/ifs: Metadata validation for start_chunk Jithu Joseph
2023-09-25 15:45     ` Ilpo Järvinen
2023-09-25 18:25       ` Joseph, Jithu
2023-09-22 23:26   ` [PATCH v2 7/9] platform/x86/intel/ifs: Add new CPU support Jithu Joseph
2023-09-25 15:51     ` Ilpo Järvinen
2023-09-22 23:26   ` [PATCH v2 8/9] platform/x86/intel/ifs: Add new error code Jithu Joseph
2023-09-25 15:51     ` Ilpo Järvinen
2023-09-22 23:26   ` [PATCH v2 9/9] platform/x86/intel/ifs: ARRAY BIST for Sierra Forest Jithu Joseph
2023-09-29 20:24   ` [PATCH v3 0/9] IFS support for GNR and SRF Jithu Joseph
2023-09-29 20:24     ` [PATCH v3 1/9] platform/x86/intel/ifs: Store IFS generation number Jithu Joseph
2023-09-29 20:24     ` [PATCH v3 2/9] platform/x86/intel/ifs: Refactor image loading code Jithu Joseph
2023-09-29 20:24     ` [PATCH v3 3/9] platform/x86/intel/ifs: Gen2 scan image loading Jithu Joseph
2023-09-29 20:24     ` [PATCH v3 4/9] platform/x86/intel/ifs: Gen2 Scan test support Jithu Joseph
2023-10-02 11:45       ` Ilpo Järvinen
2023-09-29 20:24     ` [PATCH v3 5/9] platform/x86/intel/ifs: Validate image size Jithu Joseph
2023-10-02 11:45       ` Ilpo Järvinen
2023-10-02 11:50         ` Ilpo Järvinen
2023-10-02 22:56           ` Joseph, Jithu
2023-10-04 18:56           ` Jithu Joseph
2023-09-29 20:24     ` [PATCH v3 6/9] platform/x86/intel/ifs: Metadata validation for start_chunk Jithu Joseph
2023-10-02 11:47       ` Ilpo Järvinen
2023-10-02 22:58         ` Joseph, Jithu
2023-10-04 19:00         ` Jithu Joseph
2023-09-29 20:24     ` [PATCH v3 7/9] platform/x86/intel/ifs: Add new CPU support Jithu Joseph
2023-09-29 20:24     ` [PATCH v3 8/9] platform/x86/intel/ifs: Add new error code Jithu Joseph
2023-09-29 20:24     ` [PATCH v3 9/9] platform/x86/intel/ifs: ARRAY BIST for Sierra Forest Jithu Joseph
2023-10-02 11:59       ` Ilpo Järvinen
2023-10-02 23:01         ` Joseph, Jithu
2023-10-04 19:04         ` Jithu Joseph
2023-10-04 18:57     ` [PATCH v3 0/9] IFS support for GNR and SRF Joseph, Jithu
2023-10-05 10:51       ` Ilpo Järvinen
2023-10-05 19:57         ` Joseph, Jithu
2023-10-05 19:51     ` [PATCH v4 " Jithu Joseph
2023-10-05 19:51       ` [PATCH v4 1/9] platform/x86/intel/ifs: Store IFS generation number Jithu Joseph
2023-10-05 19:51       ` [PATCH v4 2/9] platform/x86/intel/ifs: Refactor image loading code Jithu Joseph
2023-10-05 19:51       ` [PATCH v4 3/9] platform/x86/intel/ifs: Gen2 scan image loading Jithu Joseph
2023-10-05 19:51       ` [PATCH v4 4/9] platform/x86/intel/ifs: Gen2 Scan test support Jithu Joseph
2023-10-05 19:51       ` [PATCH v4 5/9] platform/x86/intel/ifs: Validate image size Jithu Joseph
2023-10-05 19:51       ` [PATCH v4 6/9] platform/x86/intel/ifs: Metadata validation for start_chunk Jithu Joseph
2023-10-05 19:51       ` [PATCH v4 7/9] platform/x86/intel/ifs: Add new CPU support Jithu Joseph
2023-10-05 19:51       ` [PATCH v4 8/9] platform/x86/intel/ifs: Add new error code Jithu Joseph
2023-10-05 19:51       ` [PATCH v4 9/9] platform/x86/intel/ifs: ARRAY BIST for Sierra Forest Jithu Joseph
2023-10-06 10:30         ` Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c390bdaf-ab5c-bf1f-bd64-29e2827d01f@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jithu.joseph@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=mingo@redhat.com \
    --cc=patches@lists.linux.dev \
    --cc=pengfei.xu@intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=ravi.v.shankar@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.