[PATCH 1/5] platform/x86/amd/pmf: Inline !AMD_PMF_DEBUG stub
From: Rong Zhang
Date: Tue Sep 01 2026 - 11:29:43 EST
A !CONFIG_AMD_PMF_DEBUG build compiles amd_pmf_dump_ta_inputs() as a
stub. However, the stub is implemented as a global function and becomes
a symbol against linkage. This bloats the size of the module.
As a best practice, convert the stub into a static inline function to
get rid of the overhead of function outlining and linkage, and shrink
the module (!CONFIG_AMD_PMF_DEBUG && CONFIG_AMD_PMF_UTIL_SUPPORT) size
by 65 Bytes (GCC 16 -O2):
text data bss total filename (before)
26810 31672 2768 61250 amd-pmf.ko
text data bss total filename (after)
26781 31636 2768 61185 amd-pmf.ko
Signed-off-by: Rong Zhang <i@xxxxxxxx>
---
drivers/platform/x86/amd/pmf/pmf.h | 7 ++++++-
drivers/platform/x86/amd/pmf/spc.c | 2 --
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h
index 07ec00684233..4da2ef1abb50 100644
--- a/drivers/platform/x86/amd/pmf/pmf.h
+++ b/drivers/platform/x86/amd/pmf/pmf.h
@@ -1137,10 +1137,15 @@ int amd_pmf_smartpc_apply_bios_output(struct amd_pmf_dev *dev, u32 val, u32 preq
/* Smart PC - TA interfaces */
void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in);
-void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in);
int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev);
u32 amd_pmf_get_ta_custom_bios_inputs(struct ta_pmf_enact_table *in, int index);
+#ifdef CONFIG_AMD_PMF_DEBUG
+void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in);
+#else
+static inline void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in) {}
+#endif
+
int amd_pmf_tee_init(struct amd_pmf_dev *dev, const uuid_t *uuid);
void amd_pmf_tee_deinit(struct amd_pmf_dev *dev);
int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev);
diff --git a/drivers/platform/x86/amd/pmf/spc.c b/drivers/platform/x86/amd/pmf/spc.c
index 592ba4de4c7f..ea11d29633c8 100644
--- a/drivers/platform/x86/amd/pmf/spc.c
+++ b/drivers/platform/x86/amd/pmf/spc.c
@@ -60,8 +60,6 @@ void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *
amd_pmf_get_ta_custom_bios_inputs(in, i));
dev_dbg(dev->dev, "==== TA inputs END ====\n");
}
-#else
-void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in) {}
#endif
/*
--
2.55.0