platform/x86/intel/tpmi: Use 32 bit aligned address for debugfs mem write

JIRA: https://redhat.atlassian.net/browse/RHEL-241103

Upstream status: v7.1

commit 8e0a2fc68ec369f2b6755994da1d318d0898a9d9
Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date:   Thu Mar 26 11:24:46 2026 -0700

    platform/x86/intel/tpmi: Use 32 bit aligned address for debugfs mem write

    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>
    Link: https://patch.msgid.link/20260326182446.3478672-1-srinivas.pandruvada@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: Dennis Chen <dechen@redhat.com>
This commit is contained in:
Dennis Chen
2026-08-24 22:42:57 -04:00
parent 6d21a43d3a
commit e46c974df0
+4
View File
@@ -46,6 +46,7 @@
* provided by the Intel VSEC driver. * provided by the Intel VSEC driver.
*/ */
#include <linux/align.h>
#include <linux/auxiliary_bus.h> #include <linux/auxiliary_bus.h>
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
@@ -479,6 +480,9 @@ static ssize_t mem_write(struct file *file, const char __user *userbuf, size_t l
addr = array[2]; addr = array[2];
value = array[3]; value = array[3];
if (!IS_ALIGNED(addr, sizeof(u32)))
return -EINVAL;
if (punit >= pfs->pfs_header.num_entries) { if (punit >= pfs->pfs_header.num_entries) {
ret = -EINVAL; ret = -EINVAL;
goto exit_write; goto exit_write;