public inbox for platform-driver-x86@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Hans de Goede <hansg@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	 LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] platform/x86/intel/tpmi: Use 32 bit aligned address for debugfs mem write
Date: Thu, 26 Mar 2026 12:28:29 +0200 (EET)	[thread overview]
Message-ID: <dc63e2ae-0773-8ee0-6b73-55eec4bbd673@linux.intel.com> (raw)
In-Reply-To: <20260325193048.3417349-1-srinivas.pandruvada@linux.intel.com>

On Wed, 25 Mar 2026, Srinivas Pandruvada wrote:

> The memory write feature supports 32-bit writes to any TPMI offset.
> However, future hardware generations may not allow writes to non-32-bit
> aligned addresses due to hardware optimizations.
> 
> Since all TPMI addresses are 64-bit aligned and correspond to 64-bit
> registers, enforce 32-bit alignment for write operations.
> 
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
>  drivers/platform/x86/intel/vsec_tpmi.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/platform/x86/intel/vsec_tpmi.c b/drivers/platform/x86/intel/vsec_tpmi.c
> index 98846e88d3d0..b70232d8ba58 100644
> --- a/drivers/platform/x86/intel/vsec_tpmi.c
> +++ b/drivers/platform/x86/intel/vsec_tpmi.c
> @@ -479,6 +479,9 @@ static ssize_t mem_write(struct file *file, const char __user *userbuf, size_t l
>  	addr = array[2];
>  	value = array[3];
>  
> +	if (addr % sizeof(u32))

Please use !IS_ALIGNED() instead (remember to check if you also need to 
add an include).

> +		return -EINVAL;
> +
>  	if (punit >= pfs->pfs_header.num_entries) {
>  		ret = -EINVAL;
>  		goto exit_write;
> 

-- 
 i.


  reply	other threads:[~2026-03-26 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25 19:30 [PATCH] platform/x86/intel/tpmi: Use 32 bit aligned address for debugfs mem write Srinivas Pandruvada
2026-03-26 10:28 ` Ilpo Järvinen [this message]
2026-03-26 15:13   ` srinivas pandruvada

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=dc63e2ae-0773-8ee0-6b73-55eec4bbd673@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox