From nobody Sat Sep 26 12:29:01 2026 Received: from sender6-op-o15.zoho.com (sender6-op-o15.zoho.com [165.173.180.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29A21422E24; Tue, 1 Sep 2026 15:03:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=165.173.180.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275033; cv=pass; b=Qd5fll++u/Vw45iH2jkAa+ZSy1SzxUhf2wPNthYO6O31I2+LWgne5toKfKV8acVs/4ZAB+iSR1ARG5VZXNt2fA7wOO8pU4S08wtFa51e0+93L63qxNuP7XNkN9oLhbP6P3ZTibbUoZ+BjFNwiOBwx2SYZw16TB1JaTnX5hfdF7I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275033; c=relaxed/simple; bh=mUpaf0raCV9B+PigKm8XLOQbTAqE74duSPsPL7NSSms=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oPAxiSKheEel2NtX4NWCJOqgfp4ApNtAlSPb/ncWGy+1BsVCRq7kkrVGGwCDe5DEVvnm49GLGGJZdLWBdoGjMW+OIZOJrIIZgmosJpCrwb0SRKeR4px7nIg9j4POm806JaCQZedtW5KEJLcoHDoMj0BOb97XhlTme0NjNCln7Pk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=iEbnTV3t; arc=pass smtp.client-ip=165.173.180.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="iEbnTV3t" ARC-Seal: i=1; a=rsa-sha256; t=1788275019; cv=none; d=zohomail.com; s=zohoarc; b=k+ZqaOD0y5AdfAcA9miiSnfAwaSMWOQGbC7/DIS/rnmOlk+bGROXmLq1vPs9gmADwYUtgH8E5rSSen96G7qNqyho+02mkZciZwAoqd3gzmGVBsgNZ4I0qVT0HQqnTgaJgvClQwfM1/HgwH/yREihOdospLd/fn4gEJnqBMcpTBQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788275019; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=28yVsE48nO1Rwm8Crw6x8vedbXiSJCnUdbmgKCm6es0=; b=M7qMbIe9kqkq2I6aatlZRGVOLk5oWRxv7qdyUOIsRTYb6dxfejEwET6IgHdybgJGIrpnu9L3ec1GEOREEp+S+8qZQSwbi6qzkXOnl5yK1sVlNGtsJwMWsx6qLIoe7MIIE98MH19Ahr/GnDTiJocoWuE++c37IgMMn95lXuU47Nw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1788275019; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=28yVsE48nO1Rwm8Crw6x8vedbXiSJCnUdbmgKCm6es0=; b=iEbnTV3tMxHzMZlxl+W6g+wIIdapeoUvD4WudPYzL0sN+w0DFIbNBqf/zwlqUvk3 G2rY7xnpz9vW83yIpgOFel89ZI+/n9ax9QEwb6FLogPOqGGq4OTubFivHvPJ0pwq7s3 G25faCtslw6SgZcKDiG/w8XcRV+M7l/1BIR0B/4zgOciAdDT/mRNDzj6DRLLU12tQ/a MkzUnC0Iox4M4LP0jZXSWUx1vGnNOCv8iWrE0GksSJISVLoSguUX0RM4sxdW2iBtkoU IqQpBej7UgpOR4kdxc5VQ2FAlAzyXUOo6m73/tUgW2lfTVAW0/6QmmRAT9tgo4An5uY VJ+nE5/cww== Received: by mx.zohomail.com with SMTPS id 1788275016990645.3035016759047; Tue, 1 Sep 2026 08:03:36 -0700 (PDT) From: Rong Zhang Date: Tue, 01 Sep 2026 23:02:11 +0800 Subject: [PATCH 1/5] platform/x86/amd/pmf: Inline !AMD_PMF_DEBUG stub Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260901-amd-pmf-fix-outlining-v1-1-b54ff94d3d45@rong.moe> References: <20260901-amd-pmf-fix-outlining-v1-0-b54ff94d3d45@rong.moe> In-Reply-To: <20260901-amd-pmf-fix-outlining-v1-0-b54ff94d3d45@rong.moe> To: Shyam Sundar S K , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Sanket Goswami , "Mario Limonciello (AMD)" Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-1f2f7 X-ZohoMailClient: External 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 Reviewed-by: Mario Limonciello (AMD) --- 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_pm= f_dev *dev, u32 val, u32 preq =20 /* Smart PC - TA interfaces */ void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_ena= ct_table *in); -void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_t= able *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 i= ndex); =20 +#ifdef CONFIG_AMD_PMF_DEBUG +void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_t= able *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, stru= ct ta_pmf_enact_table * amd_pmf_get_ta_custom_bios_inputs(in, i)); dev_dbg(dev->dev, "=3D=3D=3D=3D TA inputs END =3D=3D=3D=3D\n"); } -#else -void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_t= able *in) {} #endif =20 /* --=20 2.55.0 From nobody Sat Sep 26 12:29:01 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FF8643B4BD; Tue, 1 Sep 2026 15:03:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275041; cv=pass; b=emwqnR2iYPBdTDDldsb7kBt1V086XarzeiQL51J87fygMA0FCG4EimeLE66321kehWefeHak+rK7WH5VIXz1nXDCMj18ujTAheqZn6xQCPB95XFeFPHbwbXwfLVhO1UZbLwOgnzL6fBjdF/vwWnmZYhrMJ9yP6kGC9LI4TxhXF4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275041; c=relaxed/simple; bh=bsiX9TmU8yyJWunXTtk29c3Q4XxwYjJFWNna0AbGdLU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=O4HFT+S7hJo62bcq00srpEMSZYqpzulI9dCLE/ZQCLfQX0kbmoNqOM0Ml/PhRtoqsc2kRoCp6bme3/RQtmTiWoMP0+gURyCNpRfng9cnZs+1LHDz1/jrdWqkg6a/0PFNchm954TkYRbgqtYZKWngH4ntKoqLsOwVmVVN3djKUfc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=rC8KrlFG; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="rC8KrlFG" ARC-Seal: i=1; a=rsa-sha256; t=1788275023; cv=none; d=zohomail.com; s=zohoarc; b=JSvCwaDj7o5huU1KlCQpr8W6r1hZc80re2SoCuKreSLGQ7YfwppDhDSjynY+qmIP11N/gBOWD7WHpuVt32CTbBd9CphRW95wSr9AGHcD9jGH2a4aPiDENwiGYH+mmFHh3aGzAHLgnuMs1MVxbWD/2hpjIjGwlLGA6nYd+e+6fco= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788275023; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=cTnD9NEl02EgDePoGeEJ/9xidaKFbvUQBYGEhsD2/Lo=; b=IWEiIx6nDDSzr0LMgYPG2Ml/NXzOIDyO5dZ+fBkyTd9hvPd3UXJrolydjY9tK3YuiH4KjvVVK+7mQct0RupoDzR9b9Ls6iANDNZfr9bhpcYd0O9LufZfA7We144tbu7G1YwYH9Kcd59vGBL8ALBGcIePEXvcjXcSdjvij/PIWOI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1788275023; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=cTnD9NEl02EgDePoGeEJ/9xidaKFbvUQBYGEhsD2/Lo=; b=rC8KrlFGAVh0FSvRLHu/Qyjy9vbrycdxpMRr4NfhzP3w1DDz7qEihZ86wqQVwQSv BUoF0kEh4yGvajH2pjUGeNxo2sijDM8M70Cl3Ye9GA3tVL7Jwrqmi4v73ZgsT44R6gS +sfsPHbzWfH4JsA/IdYjRcVQIvqxGhD4iOyDfySZ5YtP2hAlhagefbOpohxiw9Gnj9T C9LYNqPFFFOidulTf26PrSnD/Tk8s8nkP5Rt88j+b3mAgFcnSAGAadI5hNqFSwqi0Ug 7HjpdsIA9XUe2gi+XJ9IZ13/yeVY1c/ngSPhPOhU/p2O7BpjiIdiaIkXABjHyOaR7eU lnQTxBYeIg== Received: by mx.zohomail.com with SMTPS id 1788275020278835.966605680935; Tue, 1 Sep 2026 08:03:40 -0700 (PDT) From: Rong Zhang Date: Tue, 01 Sep 2026 23:02:12 +0800 Subject: [PATCH 2/5] platform/x86/amd/pmf: Inline simple helper functions of Core Layer Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260901-amd-pmf-fix-outlining-v1-2-b54ff94d3d45@rong.moe> References: <20260901-amd-pmf-fix-outlining-v1-0-b54ff94d3d45@rong.moe> In-Reply-To: <20260901-amd-pmf-fix-outlining-v1-0-b54ff94d3d45@rong.moe> To: Shyam Sundar S K , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Sanket Goswami , "Mario Limonciello (AMD)" Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-1f2f7 X-ZohoMailClient: External The Core Layer has simple and dumb helper functions defined as global symbols, which are heavily used by other layers and become symbols against linkage. This bloats the size of the module. Convert them into static inline functions 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 432 Bytes (GCC 16 -O2): text data bss total filename (before) 26781 31636 2768 61185 amd-pmf.ko text data bss total filename (after) 26533 31452 2768 60753 amd-pmf.ko Signed-off-by: Rong Zhang Reviewed-by: Mario Limonciello (AMD) --- drivers/platform/x86/amd/pmf/acpi.c | 11 ----------- drivers/platform/x86/amd/pmf/core.c | 22 --------------------- drivers/platform/x86/amd/pmf/pmf.h | 39 +++++++++++++++++++++++++++++++++= ---- 3 files changed, 35 insertions(+), 37 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd= /pmf/acpi.c index 3d94b03cf794..6a2c11e75eea 100644 --- a/drivers/platform/x86/amd/pmf/acpi.c +++ b/drivers/platform/x86/amd/pmf/acpi.c @@ -158,17 +158,6 @@ static int apts_if_call_store_buffer(struct amd_pmf_de= v *pdev, return err; } =20 -int is_apmf_func_supported(struct amd_pmf_dev *pdev, unsigned long index) -{ - /* If bit-n is set, that indicates function n+1 is supported */ - return !!(pdev->supported_func & BIT(index - 1)); -} - -int is_apmf_bios_input_notifications_supported(struct amd_pmf_dev *pdev) -{ - return !!(pdev->notifications & CUSTOM_BIOS_INPUT_BITS); -} - int apts_get_static_slider_granular_v2(struct amd_pmf_dev *pdev, struct amd_pmf_apts_granular_output *data, u32 apts_idx) { diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd= /pmf/core.c index b4eae65e675b..ec2ce7fa3dee 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -138,14 +138,6 @@ static void amd_pmf_dbgfs_register(struct amd_pmf_dev = *dev) ¤t_power_limits_fops); } =20 -int amd_pmf_get_power_source(void) -{ - if (power_supply_is_system_supplied() > 0) - return POWER_SOURCE_AC; - else - return POWER_SOURCE_DC; -} - static inline u32 amd_pmf_reg_read(struct amd_pmf_dev *dev, int reg_offset) { return ioread32(dev->regbase + reg_offset); @@ -176,20 +168,6 @@ static void __maybe_unused amd_pmf_dump_registers(stru= ct amd_pmf_dev *dev) dev_dbg(dev->dev, "AMD_PMF_REGISTER_MESSAGE:%x\n", value); } =20 -/** - * fixp_q88_fromint: Convert integer to Q8.8 - * @val: input value - * - * Converts an integer into binary fixed point format where 8 bits - * are used for integer and 8 bits are used for the decimal. - * - * Return: unsigned integer converted to Q8.8 format - */ -u32 fixp_q88_fromint(u32 val) -{ - return val << 8; -} - int amd_pmf_send_cmd(struct amd_pmf_dev *dev, u8 message, bool get, u32 ar= g, u32 *data) { int rc; diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/= pmf/pmf.h index 4da2ef1abb50..024f20306e11 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -13,11 +13,13 @@ =20 #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -1073,18 +1075,47 @@ struct ta_pmf_shared_memory { /* Core Layer */ int apmf_acpi_init(struct amd_pmf_dev *pmf_dev); void apmf_acpi_deinit(struct amd_pmf_dev *pmf_dev); -int is_apmf_func_supported(struct amd_pmf_dev *pdev, unsigned long index); int amd_pmf_send_cmd(struct amd_pmf_dev *dev, u8 message, bool get, u32 ar= g, u32 *data); int amd_pmf_init_metrics_table(struct amd_pmf_dev *dev); -int amd_pmf_get_power_source(void); int apmf_install_handler(struct amd_pmf_dev *pmf_dev); int apmf_os_power_slider_update(struct amd_pmf_dev *dev, u8 flag); int amd_pmf_set_dram_addr(struct amd_pmf_dev *dev, bool alloc_buffer); int amd_pmf_notify_sbios_heartbeat_event_v2(struct amd_pmf_dev *dev, u8 fl= ag); -u32 fixp_q88_fromint(u32 val); -int is_apmf_bios_input_notifications_supported(struct amd_pmf_dev *pdev); void amd_pmf_set_device(struct device *p_device); =20 +static inline int is_apmf_func_supported(struct amd_pmf_dev *pdev, unsigne= d long index) +{ + /* If bit-n is set, that indicates function n+1 is supported */ + return !!(pdev->supported_func & BIT(index - 1)); +} + +static inline int is_apmf_bios_input_notifications_supported(struct amd_pm= f_dev *pdev) +{ + return !!(pdev->notifications & CUSTOM_BIOS_INPUT_BITS); +} + +static inline int amd_pmf_get_power_source(void) +{ + if (power_supply_is_system_supplied() > 0) + return POWER_SOURCE_AC; + else + return POWER_SOURCE_DC; +} + +/** + * fixp_q88_fromint: Convert integer to Q8.8 + * @val: input value + * + * Converts an integer into binary fixed point format where 8 bits + * are used for integer and 8 bits are used for the decimal. + * + * Return: unsigned integer converted to Q8.8 format + */ +static inline u32 fixp_q88_fromint(u32 val) +{ + return val << 8; +} + /* Metrics layer */ int amd_pmf_get_tbl_dram_addr(struct amd_pmf_dev *dev); =20 --=20 2.55.0 From nobody Sat Sep 26 12:29:01 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04C0A415B9D; Tue, 1 Sep 2026 15:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275051; cv=pass; b=ZNO+LQDVml6yapqo0jN3eeyvgdXe4RTgSotXnM0sgTtexpoYBzqDh8pAoL9j98tR8uipKABbZ4U3wwqaWeY0EMJ1YbldVrixiFVyZZeSW1CZembg5Opi3++XK4+0RqzNaH262LyPyILnvIA3hS4/ZX54FisC54Nfk0K3vsU9ua8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275051; c=relaxed/simple; bh=OMXZu3E3UxhcoQ57y1ryjrRYaclrOU+PFUDwxtbl0fo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M26NA4gdNaC8l+5cpmq8rH65bLOubqs3fNGL5HBiIa37qckPfQHDF95z+AarIoC1NQeuhZGidAqzXuYUSac9eEOBOquSH8E81qLdynXVYeFkzIAKcsk9McX0zpJGbtOWR0eNZ5DZCDa4WHs/YGXnlTskGAZ7+7mhO1VmCgbkhLk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=LW6q79MW; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="LW6q79MW" ARC-Seal: i=1; a=rsa-sha256; t=1788275025; cv=none; d=zohomail.com; s=zohoarc; b=BuZXoV2MgmIS4tzykeBupEj2o8NVwttlbwaxhfwOG4qbmBy8zksWYpk+A7h3bqxMsF1JgV9M56rxOVlfDccEVO1GqKjIPZ9jh7FfNm5hCLI/1qb2/is/mWtwwH5mAnsbil73GqsXbK2jrru6hISzaXFm1/+OLtO7UkstTjhAnAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788275025; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=kK2oWSrEsr0qP1KdXzPLSJ5VL3KbezLhv7IaZeT5Be4=; b=ce1xmQn8g0S4NXkLbZb8lcpNYJLa0UOermY6ZWMHsnBsDBUGkaOy6n/1puvI+S6zrTYbX2wOGoYgwd3dSrEAcFCE9FL1K7txj2qhG4GyQaV9zTpenk9w3fWqNqPe21QN8qUiqsLThUzrcOybdlo4TA8WVZXvEuyDNZ+Qp9JfsNg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1788275025; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=kK2oWSrEsr0qP1KdXzPLSJ5VL3KbezLhv7IaZeT5Be4=; b=LW6q79MWmuaI+nLqCwteMS+BJtWPwyx8pRfKdhtwv4cL5mshgn1K11VC89jh72eG pr7HqdFHP5oqqqn8LdAzKy+dGKuYDOVn1OQvXEVsRppZorQmWFM89GpzA/pCNWUOULf edsqDSZ3mAFDfd/zGYZG1imweMr17PQnrKphxnBXPVxK0iM2nHef+e44+2IJoNEDXoD jULYZSWBNyEOzb08/hzaegm3Hiw56brg8ZCkR43E5F5RKeqqEw8LvQZvqBRxA6K4kdr BcSpC5aSrJPInDEB43vDkoATOgv7tmTIqCeuvdPn0T/oLlFAAajVtbee+o34LNhNJ7s g0tX7Qoeog== Received: by mx.zohomail.com with SMTPS id 1788275023140997.9822206727858; Tue, 1 Sep 2026 08:03:43 -0700 (PDT) From: Rong Zhang Date: Tue, 01 Sep 2026 23:02:13 +0800 Subject: [PATCH 3/5] platform/x86/amd/pmf: Inline simple helper function of SPS Layer Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260901-amd-pmf-fix-outlining-v1-3-b54ff94d3d45@rong.moe> References: <20260901-amd-pmf-fix-outlining-v1-0-b54ff94d3d45@rong.moe> In-Reply-To: <20260901-amd-pmf-fix-outlining-v1-0-b54ff94d3d45@rong.moe> To: Shyam Sundar S K , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Sanket Goswami , "Mario Limonciello (AMD)" Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-1f2f7 X-ZohoMailClient: External The SPS Layer has a simple and dumb helper function defined as a global symbol, which is heavily used by other layers and becomes a symbol against linkage. This bloats the size of the module. Convert it 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 252 Bytes (GCC 16 -O2): text data bss total filename (before) 26533 31452 2768 60753 amd-pmf.ko text data bss total filename (after) 26341 31392 2768 60501 amd-pmf.ko There are also two duplicated prototypes, so remove one of them as well. Signed-off-by: Rong Zhang Reviewed-by: Mario Limonciello (AMD) --- drivers/platform/x86/amd/pmf/pmf.h | 8 +++++--- drivers/platform/x86/amd/pmf/sps.c | 5 ----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/= pmf/pmf.h index 024f20306e11..4a4c3aeadecc 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -1126,12 +1126,9 @@ void amd_pmf_update_slider(struct amd_pmf_dev *dev, = bool op, int idx, int amd_pmf_init_sps(struct amd_pmf_dev *dev); int apmf_get_static_slider_granular(struct amd_pmf_dev *pdev, struct apmf_static_slider_granular_output *output); -bool is_pprof_balanced(struct amd_pmf_dev *pmf); int amd_pmf_power_slider_update_event(struct amd_pmf_dev *dev); const char *amd_pmf_source_as_str(unsigned int state); =20 -const char *amd_pmf_source_as_str(unsigned int state); - int apmf_update_fan_idx(struct amd_pmf_dev *pdev, bool manual, u32 idx); int amd_pmf_set_sps_power_limits(struct amd_pmf_dev *pmf); int apmf_get_static_slider_granular_v2(struct amd_pmf_dev *dev, @@ -1139,6 +1136,11 @@ int apmf_get_static_slider_granular_v2(struct amd_pm= f_dev *dev, int apts_get_static_slider_granular_v2(struct amd_pmf_dev *pdev, struct amd_pmf_apts_granular_output *data, u32 apts_idx); =20 +static inline bool is_pprof_balanced(struct amd_pmf_dev *pmf) +{ + return pmf->current_profile =3D=3D PLATFORM_PROFILE_BALANCED; +} + /* Auto Mode Layer */ int apmf_get_auto_mode_def(struct amd_pmf_dev *pdev, struct apmf_auto_mode= *data); void amd_pmf_init_auto_mode(struct amd_pmf_dev *dev); diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/= pmf/sps.c index 0b70a5153f46..035272d37867 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -281,11 +281,6 @@ int amd_pmf_set_sps_power_limits(struct amd_pmf_dev *p= mf) return 0; } =20 -bool is_pprof_balanced(struct amd_pmf_dev *pmf) -{ - return pmf->current_profile =3D=3D PLATFORM_PROFILE_BALANCED; -} - static int amd_pmf_profile_get(struct device *dev, enum platform_profile_option *profile) { --=20 2.55.0 From nobody Sat Sep 26 12:29:01 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87AA74314AC; Tue, 1 Sep 2026 15:04:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275059; cv=pass; b=jpjqmHsL5yR270nna0G7Y0evM+WfoxMeSg7ZSn/T0cUP09A7rx4qbEZxodxI8vN4l0CTSUVgNZjq6A56s4wsCwZMMSlgF3LdpSu8FcIzo4HX9uo3kQWMot60N3rN00+kSbFEgQF4zVSNF5vZWwbOAodT303vRLEBT5p666Ed6fs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275059; c=relaxed/simple; bh=WIVrSCGubNS5SrdEUAu9E90widxgLFCniRl75K+uePI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jCffN9PsCOlKg6kcMhVWECvmicuk6nqoXmw6OoBJMyKQcLCzd5eRpJMKEQNPGJ/Bs2485/M/Ht75zQR8OcKZ7Kp1oBIvWahOa6XpR3vZVw9EfXaT5Cg0rB5/eAZdBTjM7wB0qMW4xs3OpkUON5gFUQpRHGcDnd8v1F6rkbx5srk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=KqV8dLGm; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="KqV8dLGm" ARC-Seal: i=1; a=rsa-sha256; t=1788275027; cv=none; d=zohomail.com; s=zohoarc; b=hUXOMyGiHsfrQ+fPiYrMalvmwLzgkveK/qE8knN5qaIw2dd2PImuQ2cE1aA2QtByfip0Meb5QB5qqygMwrbMGl+5uskl4uKQpXZPRar3TA7vPvzon0Jb5lEnYDpQW8AmR8jL6dJ2s3uUUGwvcR/P0trr0eZXGStZRG4/ToIGVTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788275027; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=pAhnomRGs0QwW1tbP+IFT6U4T6KEU9KEhOhzxjPrQtM=; b=cFuF6npcjshoiNWh/eG/7ob/F6hrllwnAYS/TQIg6/p/Dg3Fv23inyjXK7qwR6j4hMHsCNsB05IhYX60+mUEAtoHiJNm/jRI5pus1VA8IsgIzTqUHlLxQMoq/Y2CjMH/M11MqK4gvC+2FYINVzxVmRM9GI4RYn3ep2AOK5yMKDY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1788275027; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=pAhnomRGs0QwW1tbP+IFT6U4T6KEU9KEhOhzxjPrQtM=; b=KqV8dLGmCuYYYyvNtUUG3jKW0Uvo98c4ItuI4CvI8YMu5+SkGH1oURf03TWHc2PO u3E03xo6YHQKoaNy5QmVxJYtWjeUzlbVex8wJoPMh6fg+9yCoK0rl9B5S8v3hKs5dqh 3kAlqerRMD8eicIJY9ffXVO1iTHhFskOURPaUG4L/hIXbbpwLuZ+zvE+btJ/vabURGJ yap+6cEedRYCGfKgt/5wJCytT7Qz6QTwX1Z88BUYI7KBG6MU0hjJNzpAMthhdaPATpk iAsR4T5VLwehWNg/j+IR2ENsIv+jeSsaq0k6vrnIzSvoHXr4TNQuKpKByPWEInYqZhm 4sJVfnURhA== Received: by mx.zohomail.com with SMTPS id 1788275025848446.0862335774882; Tue, 1 Sep 2026 08:03:45 -0700 (PDT) From: Rong Zhang Date: Tue, 01 Sep 2026 23:02:14 +0800 Subject: [PATCH 4/5] platform/x86/amd/pmf: Inline simple helper function of Smart PC TA interfaces Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260901-amd-pmf-fix-outlining-v1-4-b54ff94d3d45@rong.moe> References: <20260901-amd-pmf-fix-outlining-v1-0-b54ff94d3d45@rong.moe> In-Reply-To: <20260901-amd-pmf-fix-outlining-v1-0-b54ff94d3d45@rong.moe> To: Shyam Sundar S K , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Sanket Goswami , "Mario Limonciello (AMD)" Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-1f2f7 X-ZohoMailClient: External The Smart PC TA interfaces have a simple and dumb helper function defined as a global symbol, which is used by other layers and becomes a symbol against linkage. This bloats the size of the module. Convert it 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 208 Bytes (GCC 16 -O2): text data bss total filename (before) 26341 31392 2768 60501 amd-pmf.ko text data bss total filename (after) 26261 31264 2768 60293 amd-pmf.ko Signed-off-by: Rong Zhang Reviewed-by: Mario Limonciello (AMD) --- drivers/platform/x86/amd/pmf/pmf.h | 13 ++++++++++++- drivers/platform/x86/amd/pmf/spc.c | 13 ------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/= pmf/pmf.h index 4a4c3aeadecc..6d9963677a46 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -1171,7 +1171,18 @@ 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_ena= ct_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 i= ndex); + +static inline u32 amd_pmf_get_ta_custom_bios_inputs(struct ta_pmf_enact_ta= ble *in, int index) +{ + switch (index) { + case 0 ... 1: + return in->ev_info.bios_input_1[index]; + case 2 ... 9: + return in->ev_info.bios_input_2[index - 2]; + default: + return 0; + } +} =20 #ifdef CONFIG_AMD_PMF_DEBUG void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_t= able *in); diff --git a/drivers/platform/x86/amd/pmf/spc.c b/drivers/platform/x86/amd/= pmf/spc.c index ea11d29633c8..c939c5379151 100644 --- a/drivers/platform/x86/amd/pmf/spc.c +++ b/drivers/platform/x86/amd/pmf/spc.c @@ -17,19 +17,6 @@ #include #include "pmf.h" =20 -u32 amd_pmf_get_ta_custom_bios_inputs(struct ta_pmf_enact_table *in, int i= ndex) -{ - switch (index) { - case 0 ... 1: - return in->ev_info.bios_input_1[index]; - case 2 ... 9: - return in->ev_info.bios_input_2[index - 2]; - default: - return 0; - } -} -EXPORT_SYMBOL(amd_pmf_get_ta_custom_bios_inputs); - #ifdef CONFIG_AMD_PMF_DEBUG void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_t= able *in) { --=20 2.55.0 From nobody Sat Sep 26 12:29:01 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BDFB43303A; Tue, 1 Sep 2026 15:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275066; cv=pass; b=XeJHUdD9w4LcF53edtzkdyllHSm8Dh3NjFiIjD3ae0Eh7zgPcWq1ioATletYIdTIl7dJse6+t7uwExejj/UM/PNRmvU0e1OQCeSigLpxkOZrJ2sOteDKd8DLdGS74iH+ulJnpKO29oPiyP9G12BYWg2YnQ4L8vXEt7Wy0udrl1o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275066; c=relaxed/simple; bh=F7moDRHmgcrCFaI31fq1GSro0n8+n/cL9R0OXgy96WA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iknDhLOGjXt2bht0PorydCL3pKFBB1XVKtTkGDGpJFXO6N7vhTseyhcspea4b0T+u/9GZI/pvpQOG+AvBgpGoW6NYtcqcN0Eqe207nFS3iEjhSFg5y7VsvRVK59Ki1wY6cj9Qkk73ZxEU2DdCsOMvwqxi8cXTPR4Fw+tKB+mJ8M= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=q3igSIie; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="q3igSIie" ARC-Seal: i=1; a=rsa-sha256; t=1788275031; cv=none; d=zohomail.com; s=zohoarc; b=ajbqiLrctn5kzUWPRbkT+jc9WUkXaVepbz3J3mU0L4xO6qzkv01KugvZpIlZf9lulqoUzJFOhYBKh7Thd5niyaWySRynqnHsHypCYWZpPbsDdQk69cDSqVSg5juB3MRlmQsBXWznJPMKiMmaC/Tg2TDa6Sz4SFnCcvoFy0OeDtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788275031; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=SUY6EOJnZnFcv1uEIhIP6eS4WTnuITEEM6F2QiUbMXs=; b=FtHAyMJPO20S7htXTHW2pPADQV7PIVbJ5hluAyj8cSai4BXQbIRlV1CFBxQdjo/vvc50Pp2PyvzHLTHgs6+BFjeQ14gmzS/bygymTsN8cbfeLbV2hR1lNjzJQDI1J5K98+O52C/UmjYGheMBWKFPnEcv+m6hyx/WRWEt9UMjm2Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1788275031; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=SUY6EOJnZnFcv1uEIhIP6eS4WTnuITEEM6F2QiUbMXs=; b=q3igSIie6WdXIzo7r+eNPV4Tn+Z3ZLBgQSQbAEBOwFRrWDQSKYeJX72QSPEHalUz rBPFMNrm4WEKrcxMn9R7fMuCp43Ht6pRuuuRFcTSEu7JUmDHMLuTF0cYljmkCql/X8h a0N4+bSlBYM3OELMJZ4VmAXWxWsFsKqAfIIf9Ye78NMQmC+wEwoSIGkB0c3Yp+X0+RL h4IVddwa28wWBDKU5FBjkRoBhlbqhwKANtYnpFF6CMrId68sY0kEUePU9PSXxFGTeQz wkfz3ykpNPywK4P6XRQVTpxjnby1JjiDckohnexGChK4F98SLCrOXqVh74B+BFOUOTr DAlNgwzuuw== Received: by mx.zohomail.com with SMTPS id 1788275028591684.5357465166041; Tue, 1 Sep 2026 08:03:48 -0700 (PDT) From: Rong Zhang Date: Tue, 01 Sep 2026 23:02:15 +0800 Subject: [PATCH 5/5] platform/x86/amd/pmf: Inline wrappers of ap{mf,ts}_if_call_store_buffer() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260901-amd-pmf-fix-outlining-v1-5-b54ff94d3d45@rong.moe> References: <20260901-amd-pmf-fix-outlining-v1-0-b54ff94d3d45@rong.moe> In-Reply-To: <20260901-amd-pmf-fix-outlining-v1-0-b54ff94d3d45@rong.moe> To: Shyam Sundar S K , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Sanket Goswami , "Mario Limonciello (AMD)" Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-1f2f7 X-ZohoMailClient: External There are several simple and dumb wrappers of ap{mf,ts}_if_call_store_buffer() defined as global symbols, which are heavily used by multiple layers and become symbols against linkage. This bloats the size of the module. Since is_apmf_func_supported() has been converted, convert the mentioned wrappers into static inline functions 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 515 Bytes (GCC 16 -O2): text data bss total filename (before) 26261 31264 2768 60293 amd-pmf.ko text data bss total filename (after) 26046 30964 2768 59778 amd-pmf.ko Signed-off-by: Rong Zhang Reviewed-by: Mario Limonciello (AMD) --- drivers/platform/x86/amd/pmf/acpi.c | 65 +---------------------------- drivers/platform/x86/amd/pmf/pmf.h | 83 +++++++++++++++++++++++++++++++--= ---- 2 files changed, 73 insertions(+), 75 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd= /pmf/acpi.c index 6a2c11e75eea..4392bf0bc0bf 100644 --- a/drivers/platform/x86/amd/pmf/acpi.c +++ b/drivers/platform/x86/amd/pmf/acpi.c @@ -50,7 +50,7 @@ static union acpi_object *apmf_if_call(struct amd_pmf_dev= *pdev, int fn, struct return buffer.pointer; } =20 -static int apmf_if_call_store_buffer(struct amd_pmf_dev *pdev, int fn, voi= d *dest, size_t out_sz) +int apmf_if_call_store_buffer(struct amd_pmf_dev *pdev, int fn, void *dest= , size_t out_sz) { union acpi_object *info; size_t size; @@ -121,8 +121,7 @@ static union acpi_object *apts_if_call(struct amd_pmf_d= ev *pdev, u32 state_index return buffer.pointer; } =20 -static int apts_if_call_store_buffer(struct amd_pmf_dev *pdev, - u32 index, void *data, size_t out_sz) +int apts_if_call_store_buffer(struct amd_pmf_dev *pdev, u32 index, void *d= ata, size_t out_sz) { union acpi_object *info; size_t size; @@ -158,35 +157,6 @@ static int apts_if_call_store_buffer(struct amd_pmf_de= v *pdev, return err; } =20 -int apts_get_static_slider_granular_v2(struct amd_pmf_dev *pdev, - struct amd_pmf_apts_granular_output *data, u32 apts_idx) -{ - if (!is_apmf_func_supported(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) - return -EINVAL; - - return apts_if_call_store_buffer(pdev, apts_idx, data, sizeof(*data)); -} - -int apmf_get_static_slider_granular_v2(struct amd_pmf_dev *pdev, - struct apmf_static_slider_granular_output_v2 *data) -{ - if (!is_apmf_func_supported(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) - return -EINVAL; - - return apmf_if_call_store_buffer(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR, - data, sizeof(*data)); -} - -int apmf_get_static_slider_granular(struct amd_pmf_dev *pdev, - struct apmf_static_slider_granular_output *data) -{ - if (!is_apmf_func_supported(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) - return -EINVAL; - - return apmf_if_call_store_buffer(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR, - data, sizeof(*data)); -} - int apmf_os_power_slider_update(struct amd_pmf_dev *pdev, u8 event) { struct os_power_slider args; @@ -302,27 +272,6 @@ static int apmf_notify_smart_pc_update(struct amd_pmf_= dev *pdev, u32 val, u32 pr return 0; } =20 -int apmf_get_auto_mode_def(struct amd_pmf_dev *pdev, struct apmf_auto_mode= *data) -{ - return apmf_if_call_store_buffer(pdev, APMF_FUNC_AUTO_MODE, data, sizeof(= *data)); -} - -int apmf_get_sbios_requests_v2(struct amd_pmf_dev *pdev, struct apmf_sbios= _req_v2 *req) -{ - return apmf_if_call_store_buffer(pdev, APMF_FUNC_SBIOS_REQUESTS, req, siz= eof(*req)); -} - -int apmf_get_sbios_requests_v1(struct amd_pmf_dev *pdev, struct apmf_sbios= _req_v1 *req) -{ - return apmf_if_call_store_buffer(pdev, APMF_FUNC_SBIOS_REQUESTS, req, siz= eof(*req)); -} - -int apmf_get_sbios_requests(struct amd_pmf_dev *pdev, struct apmf_sbios_re= q *req) -{ - return apmf_if_call_store_buffer(pdev, APMF_FUNC_SBIOS_REQUESTS, - req, sizeof(*req)); -} - /* Store custom BIOS inputs data in ring buffer */ static void amd_pmf_custom_bios_inputs_rb(struct amd_pmf_dev *pmf_dev) { @@ -484,16 +433,6 @@ static int apmf_get_system_params(struct amd_pmf_dev *= dev) return 0; } =20 -int apmf_get_dyn_slider_def_ac(struct amd_pmf_dev *pdev, struct apmf_dyn_s= lider_output *data) -{ - return apmf_if_call_store_buffer(pdev, APMF_FUNC_DYN_SLIDER_AC, data, siz= eof(*data)); -} - -int apmf_get_dyn_slider_def_dc(struct amd_pmf_dev *pdev, struct apmf_dyn_s= lider_output *data) -{ - return apmf_if_call_store_buffer(pdev, APMF_FUNC_DYN_SLIDER_DC, data, siz= eof(*data)); -} - static apmf_event_handler_t apmf_event_handlers[] =3D { [PMF_IF_V1] =3D apmf_event_handler_v1, [PMF_IF_V2] =3D apmf_event_handler_v2, diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/= pmf/pmf.h index 6d9963677a46..9f64ab833c08 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1075,6 +1076,8 @@ struct ta_pmf_shared_memory { /* Core Layer */ int apmf_acpi_init(struct amd_pmf_dev *pmf_dev); void apmf_acpi_deinit(struct amd_pmf_dev *pmf_dev); +int apmf_if_call_store_buffer(struct amd_pmf_dev *pdev, int fn, void *dest= , size_t out_sz); +int apts_if_call_store_buffer(struct amd_pmf_dev *pdev, u32 index, void *d= ata, size_t out_sz); int amd_pmf_send_cmd(struct amd_pmf_dev *dev, u8 message, bool get, u32 ar= g, u32 *data); int amd_pmf_init_metrics_table(struct amd_pmf_dev *dev); int apmf_install_handler(struct amd_pmf_dev *pmf_dev); @@ -1124,17 +1127,43 @@ int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf= ); void amd_pmf_update_slider(struct amd_pmf_dev *dev, bool op, int idx, struct amd_pmf_static_slider_granular *table); int amd_pmf_init_sps(struct amd_pmf_dev *dev); -int apmf_get_static_slider_granular(struct amd_pmf_dev *pdev, - struct apmf_static_slider_granular_output *output); int amd_pmf_power_slider_update_event(struct amd_pmf_dev *dev); const char *amd_pmf_source_as_str(unsigned int state); =20 int apmf_update_fan_idx(struct amd_pmf_dev *pdev, bool manual, u32 idx); int amd_pmf_set_sps_power_limits(struct amd_pmf_dev *pmf); -int apmf_get_static_slider_granular_v2(struct amd_pmf_dev *dev, - struct apmf_static_slider_granular_output_v2 *data); -int apts_get_static_slider_granular_v2(struct amd_pmf_dev *pdev, - struct amd_pmf_apts_granular_output *data, u32 apts_idx); + +static inline int +apts_get_static_slider_granular_v2(struct amd_pmf_dev *pdev, + struct amd_pmf_apts_granular_output *data, u32 apts_idx) +{ + if (!is_apmf_func_supported(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) + return -EINVAL; + + return apts_if_call_store_buffer(pdev, apts_idx, data, sizeof(*data)); +} + +static inline int +apmf_get_static_slider_granular_v2(struct amd_pmf_dev *pdev, + struct apmf_static_slider_granular_output_v2 *data) +{ + if (!is_apmf_func_supported(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) + return -EINVAL; + + return apmf_if_call_store_buffer(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR, + data, sizeof(*data)); +} + +static inline int +apmf_get_static_slider_granular(struct amd_pmf_dev *pdev, + struct apmf_static_slider_granular_output *data) +{ + if (!is_apmf_func_supported(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) + return -EINVAL; + + return apmf_if_call_store_buffer(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR, + data, sizeof(*data)); +} =20 static inline bool is_pprof_balanced(struct amd_pmf_dev *pmf) { @@ -1142,26 +1171,56 @@ static inline bool is_pprof_balanced(struct amd_pmf= _dev *pmf) } =20 /* Auto Mode Layer */ -int apmf_get_auto_mode_def(struct amd_pmf_dev *pdev, struct apmf_auto_mode= *data); void amd_pmf_init_auto_mode(struct amd_pmf_dev *dev); void amd_pmf_deinit_auto_mode(struct amd_pmf_dev *dev); void amd_pmf_trans_automode(struct amd_pmf_dev *dev, int socket_power, kti= me_t time_elapsed_ms); -int apmf_get_sbios_requests(struct amd_pmf_dev *pdev, struct apmf_sbios_re= q *req); -int apmf_get_sbios_requests_v1(struct amd_pmf_dev *pdev, struct apmf_sbios= _req_v1 *req); -int apmf_get_sbios_requests_v2(struct amd_pmf_dev *pdev, struct apmf_sbios= _req_v2 *req); =20 void amd_pmf_update_2_cql(struct amd_pmf_dev *dev, bool is_cql_event); int amd_pmf_reset_amt(struct amd_pmf_dev *dev); void amd_pmf_handle_amt(struct amd_pmf_dev *dev); =20 +static inline int apmf_get_auto_mode_def(struct amd_pmf_dev *pdev, struct = apmf_auto_mode *data) +{ + return apmf_if_call_store_buffer(pdev, APMF_FUNC_AUTO_MODE, data, sizeof(= *data)); +} + +static inline int apmf_get_sbios_requests_v2(struct amd_pmf_dev *pdev, + struct apmf_sbios_req_v2 *req) +{ + return apmf_if_call_store_buffer(pdev, APMF_FUNC_SBIOS_REQUESTS, req, siz= eof(*req)); +} + +static inline int apmf_get_sbios_requests_v1(struct amd_pmf_dev *pdev, + struct apmf_sbios_req_v1 *req) +{ + return apmf_if_call_store_buffer(pdev, APMF_FUNC_SBIOS_REQUESTS, req, siz= eof(*req)); +} + +static inline int apmf_get_sbios_requests(struct amd_pmf_dev *pdev, + struct apmf_sbios_req *req) +{ + return apmf_if_call_store_buffer(pdev, APMF_FUNC_SBIOS_REQUESTS, + req, sizeof(*req)); +} + /* CnQF Layer */ -int apmf_get_dyn_slider_def_ac(struct amd_pmf_dev *pdev, struct apmf_dyn_s= lider_output *data); -int apmf_get_dyn_slider_def_dc(struct amd_pmf_dev *pdev, struct apmf_dyn_s= lider_output *data); int amd_pmf_init_cnqf(struct amd_pmf_dev *dev); void amd_pmf_deinit_cnqf(struct amd_pmf_dev *dev); int amd_pmf_trans_cnqf(struct amd_pmf_dev *dev, int socket_power, ktime_t = time_lapsed_ms); extern const struct attribute_group cnqf_feature_attribute_group; =20 +static inline int apmf_get_dyn_slider_def_ac(struct amd_pmf_dev *pdev, + struct apmf_dyn_slider_output *data) +{ + return apmf_if_call_store_buffer(pdev, APMF_FUNC_DYN_SLIDER_AC, data, siz= eof(*data)); +} + +static inline int apmf_get_dyn_slider_def_dc(struct amd_pmf_dev *pdev, + struct apmf_dyn_slider_output *data) +{ + return apmf_if_call_store_buffer(pdev, APMF_FUNC_DYN_SLIDER_DC, data, siz= eof(*data)); +} + /* Smart PC builder Layer */ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev); void amd_pmf_deinit_smart_pc(struct amd_pmf_dev *dev); --=20 2.55.0