* [PATCH] platform/x86/intel/tpmi: Use 32 bit aligned address for debugfs mem write
@ 2026-03-25 19:30 Srinivas Pandruvada
2026-03-26 10:28 ` Ilpo Järvinen
0 siblings, 1 reply; 3+ messages in thread
From: Srinivas Pandruvada @ 2026-03-25 19:30 UTC (permalink / raw)
To: hansg, ilpo.jarvinen
Cc: platform-driver-x86, linux-kernel, Srinivas Pandruvada
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))
+ return -EINVAL;
+
if (punit >= pfs->pfs_header.num_entries) {
ret = -EINVAL;
goto exit_write;
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86/intel/tpmi: Use 32 bit aligned address for debugfs mem write
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
2026-03-26 15:13 ` srinivas pandruvada
0 siblings, 1 reply; 3+ messages in thread
From: Ilpo Järvinen @ 2026-03-26 10:28 UTC (permalink / raw)
To: Srinivas Pandruvada; +Cc: Hans de Goede, platform-driver-x86, LKML
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86/intel/tpmi: Use 32 bit aligned address for debugfs mem write
2026-03-26 10:28 ` Ilpo Järvinen
@ 2026-03-26 15:13 ` srinivas pandruvada
0 siblings, 0 replies; 3+ messages in thread
From: srinivas pandruvada @ 2026-03-26 15:13 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: Hans de Goede, platform-driver-x86, LKML
On Thu, 2026-03-26 at 12:28 +0200, Ilpo Järvinen wrote:
> 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).
Good point.
Thanks,
Srinivas
>
> > + return -EINVAL;
> > +
> > if (punit >= pfs->pfs_header.num_entries) {
> > ret = -EINVAL;
> > goto exit_write;
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-26 15:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-03-26 15:13 ` srinivas pandruvada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox