PRM handler direct call interface
Subsystems (5)
v2 cover PRM handler direct call interface
Platform Runtime Mechanism (PRM) introduces a means for the AML interpreter and OS drivers to invoke runtime handlers from platform firmware in order to remove the need for certain classes of SMIs. Further details can be seen in the PRM specification[1].
Future AMD platforms will implement a PRM module in firmware that will include handlers for performing various types of address translation. The address translation PRM module is documented in chapter 22 of the publicly available "AMD Family 1Ah Models 00h–0Fh and Models 10h–1Fh ACPI v6.5 Porting Guide"[2].
While the kernel currently has support for calling PRM handlers from the AML interpreter, it does not support calling PRM handlers directly from OS drivers. This series implements the direct call interface and uses it for translating normalized addresses to system physical addresses.
Thanks,
John
[1]:
https://uefi.org/sites/default/files/resources/Platform%20Runtime%20Mechanism%20-%20with%20legal%20notice.pdf
[2]:
https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/programmer-references/58088-0.75-pub.pdf
Tree: git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Base commit: 4cece764965020c22cff7665b18a012006359095
John Allen (2):
ACPI: PRM: Add PRM handler direct call support RAS/AMD/ATL: Translate normalized to system physical addresses using
PRM
drivers/acpi/prmt.c | 24 +++++++++++++ drivers/ras/amd/atl/Makefile | 1 + drivers/ras/amd/atl/internal.h | 2 ++ drivers/ras/amd/atl/prm.c | 61 ++++++++++++++++++++++++++++++++++ drivers/ras/amd/atl/umc.c | 5 +++ include/linux/prmt.h | 5 +++ 6 files changed, 98 insertions(+) create mode 100644 drivers/ras/amd/atl/prm.c
Signature · 1 line
2.34.1
PATCH v2 1/2 ACPI: PRM: Add PRM handler direct call support
Platform Runtime Mechanism (PRM) handlers can be invoked from either the AML interpreter or directly by an OS driver. Implement the direct call method.
Export the symbol as this will be used by modules such as the AMD Address Translation Library and likely others in the future.
---
v2:
- Align statements setting fields in context buffer on '='
--- drivers/acpi/prmt.c | 24 ++++++++++++++++++++++++ include/linux/prmt.h | 5 +++++ 2 files changed, 29 insertions(+)
drivers/acpi/prmt.c +24 -0
@@ -214,6 +214,30 @@ static struct prm_handler_info *find_prm_handler(const guid_t *guid)#define UPDATE_LOCK_ALREADY_HELD 4#define UPDATE_UNLOCK_WITHOUT_LOCK 5 +int acpi_call_prm_handler (guid_t handler_guid,void *param_buffer) +{ +struct prm_handler_info *handler =find_prm_handler (&handler_guid); +struct prm_module_info *module =find_prm_module (&handler_guid); +struct prm_context_buffer context; +efi_status_t status; + +if (!module || !handler) +return -ENODEV ; + +memset (&context,0 ,sizeof (context)); +ACPI_COPY_NAMESEG (context.signature,"PRMC" ); + context.identifier = handler->guid; + context.static_data_buffer = handler->static_data_buffer_addr; + context.mmio_ranges = module->mmio_info; + + status =efi_call_acpi_prm_handler (handler->handler_addr, + (u64 )param_buffer, + &context); + +return efi_status_to_err (status); +} +EXPORT_SYMBOL_GPL (acpi_call_prm_handler); +/* * This is the PlatformRtMechanism opregion space handler. * @function: indicates the read/write. In fact as the PlatformRtMechanism
include/linux/prmt.h +5 -0
@@ -2,6 +2,11 @@#ifdef CONFIG_ACPI_PRMT void init_prmt (void ); +int acpi_call_prm_handler (guid_t handler_guid,void *param_buffer);#else static inline void init_prmt (void ) { } +static inline int acpi_call_prm_handler (guid_t handler_guid,void *param_buffer) +{ +return -EOPNOTSUPP ; +}#endif
Signature · 1 line
2.34.1
PATCH v2 2/2 RAS/AMD/ATL: Translate normalized to system physical addresses using PRM
In reply to John AllenFuture AMD platforms will provide a UEFI PRM module that implements a number of address translation PRM handlers. This will provide an interface for the OS to call platform specific code without requiring the use of SMM or other heavy firmware operations.
AMD Zen-based systems report memory error addresses through Machine Check banks representing Unified Memory Controllers (UMCs) in the form of UMC relative "normalized" addresses. A normalized address must be converted to a system physical address to be usable by the OS.
Add support for the normalized to system physical address translation PRM handler in the AMD Address Translation Library and prefer it over native code if available. The GUID and parameter buffer structure are specific to the normalized to system physical address handler provided by the address translation PRM module included in future AMD systems.
The address translation PRM module is documented in chapter 22 of the publicly available "AMD Family 1Ah Models 00h–0Fh and Models 10h–1Fh ACPI v6.5 Porting Guide":
https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/programmer-references/58088-0.75-pub.pdf
---
v2:
- Make norm_to_sys_prm_handler_guid static.
- Change pr_info statements to more appropriate pr_debug and pr_info_once statements.
--- drivers/ras/amd/atl/Makefile | 1 + drivers/ras/amd/atl/internal.h | 2 ++ drivers/ras/amd/atl/prm.c | 61 ++++++++++++++++++++++++++++++++++ drivers/ras/amd/atl/umc.c | 5 +++ 4 files changed, 69 insertions(+) create mode 100644 drivers/ras/amd/atl/prm.c
drivers/ras/amd/atl/Makefile +1 -0
@@ -14,5 +14,6 @@ amd_atl-y += denormalize.o amd_atl-y += map.o amd_atl-y += system.o amd_atl-y += umc.o +amd_atl-y += prm.o obj-$(CONFIG_AMD_ATL) += amd_atl.o
drivers/ras/amd/atl/internal.h +2 -0
@@ -234,6 +234,8 @@ int dehash_address(struct addr_ctx *ctx);unsigned long norm_to_sys_addr (u8 socket_id,u8 die_id,u8 coh_st_inst_id,unsigned long addr);unsigned long convert_umc_mca_addr_to_sys_addr (struct atl_err *err); +unsigned long prm_umc_norm_to_sys_addr (u8 socket_id,u64 umc_bank_inst_id,unsigned long addr); +/* * Make a gap in @data that is @num_bits long starting at @bit_num. * e.g. data = 11111111'b
drivers/ras/amd/atl/prm.c new file +61 -0
61 lines not on this page · raw message
drivers/ras/amd/atl/umc.c +5 -0
@@ -333,9 +333,14 @@ unsigned long convert_umc_mca_addr_to_sys_addr(struct atl_err *err)u8 coh_st_inst_id =get_coh_st_inst_id (err);unsigned long addr =get_addr (err->addr);u8 die_id =get_die_id (err); +unsigned long ret_addr;pr_debug ("socket_id=0x%x die_id=0x%x coh_st_inst_id=0x%x addr=0x%016lx" , socket_id, die_id, coh_st_inst_id, addr); + ret_addr =prm_umc_norm_to_sys_addr (socket_id, err->ipid, addr); +if (!IS_ERR_VALUE (ret_addr)) +return ret_addr; +return norm_to_sys_addr (socket_id, die_id, coh_st_inst_id, addr); }
Signature · 1 line
2.34.1
Re: [PATCH v2 1/2] ACPI: PRM: Add PRM handler direct call support
In reply to John AllenQuoted 5 lines · John Allen
Platform Runtime Mechanism (PRM) handlers can be invoked from either the AML interpreter or directly by an OS driver. Implement the direct call method.
Quoted 8 lines
Export the symbol as this will be used by modules such as the AMD Address Translation Library and likely others in the future.
Signed-off-by John Allen <[email protected]>Reviewed-by Yazen Ghannam <[email protected]>---
v2:
- Align statements setting fields in context buffer on '='
I would actually prefer spaces around the "=" there, but anyway
Quoted 59 lines
--- drivers/acpi/prmt.c | 24 ++++++++++++++++++++++++ include/linux/prmt.h | 5 +++++ 2 files changed, 29 insertions(+)drivers/acpi/prmt.c +24
-0@@ -214,6 +214,30 @@ static struct prm_handler_info *find_prm_handler(const guid_t *guid)#define UPDATE_LOCK_ALREADY_HELD 4#define UPDATE_UNLOCK_WITHOUT_LOCK 5 +int acpi_call_prm_handler (guid_t handler_guid,void *param_buffer) +{ +struct prm_handler_info *handler =find_prm_handler (&handler_guid); +struct prm_module_info *module =find_prm_module (&handler_guid); +struct prm_context_buffer context; +efi_status_t status; + +if (!module || !handler) +return -ENODEV ; + +memset (&context,0 ,sizeof (context)); +ACPI_COPY_NAMESEG (context.signature,"PRMC" ); + context.identifier = handler->guid; + context.static_data_buffer = handler->static_data_buffer_addr; + context.mmio_ranges = module->mmio_info; + + status =efi_call_acpi_prm_handler (handler->handler_addr, + (u64 )param_buffer, + &context); + +return efi_status_to_err (status); +} +EXPORT_SYMBOL_GPL (acpi_call_prm_handler); +/* * This is the PlatformRtMechanism opregion space handler. * @function: indicates the read/write. In fact as the PlatformRtMechanism include/linux/prmt.h +5
-1@@ -2,6 +2,11 @@#ifdef CONFIG_ACPI_PRMT void init_prmt (void ); +int acpi_call_prm_handler (guid_t handler_guid,void *param_buffer);#else static inline void init_prmt (void ) { } +static inline int acpi_call_prm_handler (guid_t handler_guid,void *param_buffer) +{ +return -EOPNOTSUPP ; +}#endif --2.34.1
Borislav Petkov
maintainerRe: [PATCH v2 1/2] ACPI: PRM: Add PRM handler direct call support
In reply to John AllenQuoted 37 lines · John Allen
Platform Runtime Mechanism (PRM) handlers can be invoked from either the AML interpreter or directly by an OS driver. Implement the direct call method.
Export the symbol as this will be used by modules such as the AMD Address Translation Library and likely others in the future.
Signed-off-by John Allen <[email protected]>Reviewed-by Yazen Ghannam <[email protected]>---
v2:
- Align statements setting fields in context buffer on '='--- drivers/acpi/prmt.c | 24 ++++++++++++++++++++++++ include/linux/prmt.h | 5 +++++ 2 files changed, 29 insertions(+)drivers/acpi/prmt.c +12
-0@@ -214,6 +214,30 @@ static struct prm_handler_info *find_prm_handler(const guid_t *guid)#define UPDATE_LOCK_ALREADY_HELD 4#define UPDATE_UNLOCK_WITHOUT_LOCK 5 +int acpi_call_prm_handler (guid_t handler_guid,void *param_buffer) +{ +struct prm_handler_info *handler =find_prm_handler (&handler_guid); +struct prm_module_info *module =find_prm_module (&handler_guid); +struct prm_context_buffer context; +efi_status_t status; + +if (!module || !handler) +return -ENODEV ; + +memset (&context,0 ,sizeof (context)); +ACPI_COPY_NAMESEG (context.signature,"PRMC" );
drivers/acpi/prmt.c static struct prm_handler_info *find_prm_handler(const guid_t *guid) · line 238
Quoted 10 lines
drivers/acpi/prmt.c +10
-0+ context.identifier = handler->guid; + context.static_data_buffer = handler->static_data_buffer_addr; + context.mmio_ranges = module->mmio_info; + + status =efi_call_acpi_prm_handler (handler->handler_addr, + (u64 )param_buffer, + &context); + +return efi_status_to_err (status); +}
+ linux-efi as Rafael wanted to make sure the environment is created properly for the EFI runtime services call...
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteBorislav Petkov
maintainerRe: [PATCH v2 2/2] RAS/AMD/ATL: Translate normalized to system physical addresses using PRM
In reply to John AllenQuoted 9 lines · John Allen
Future AMD platforms will provide a UEFI PRM module that implements a number of address translation PRM handlers. This will provide an interface for the OS to call platform specific code without requiring the use of SMM or other heavy firmware operations.
AMD Zen-based systems report memory error addresses through Machine Check banks representing Unified Memory Controllers (UMCs) in the form of UMC relative "normalized" addresses. A normalized address must be converted to a system physical address to be usable by the OS.
This should be your first paragraph.
Quoted 10 lines
Add support for the normalized to system physical address translation PRM handler in the AMD Address Translation Library and prefer it over native code if available. The GUID and parameter buffer structure are specific to the normalized to system physical address handler provided by the address translation PRM module included in future AMD systems.
The address translation PRM module is documented in chapter 22 of the publicly available "AMD Family 1Ah Models 00h–0Fh and Models 10h–1Fh ACPI v6.5 Porting Guide":
https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/programmer-references/58088-0.75-pub.pdf
Those URLs are flaky and become invalid over time. When you quote a document, quote it in such a way so that searching for it on the web, can find it. The name above works for me so that's good.
drivers/ras/amd/atl/prm.c line 15
Quoted 3 lines
drivers/ras/amd/atl/prm.c new file +3
-0+#include "internal.h" + +#if defined(CONFIG_ACPI_PRMT )
Instead of that ifdeffery you could do:
config AMD_ATL_PRM
depends on AMD_ATL && ACPI_PRMT
and it'll get enabled automatically and then you don't need the empty stub either.
drivers/ras/amd/atl/prm.c line 19
Quoted 3 lines
drivers/ras/amd/atl/prm.c new file +3
-0+#include <linux/prmt.h> + +struct prm_umc_param_buffer_norm {
What's a prm_umc_param_buffer_norm?
drivers/ras/amd/atl/prm.c line 23
Quoted 4 lines
drivers/ras/amd/atl/prm.c new file +4
-0+u64 norm_addr; +u8 socket; +u64 umc_bank_inst_id; +void *output_buffer;
Use the usual short versions for such standard names: "out_buf"
drivers/ras/amd/atl/prm.c line 29
Quoted 6 lines
drivers/ras/amd/atl/prm.c new file +6
-0+} __packed; + +static const guid_t norm_to_sys_prm_handler_guid =GUID_INIT (0xE7180659 ,0xA65D , +0x451D ,0x92 ,0xCD , +0x2B ,0x56 ,0xF1 ,0x2B , +0xEB ,0xA6 );
When you define such long variable names, your lines stick out unnecessarily. Shorten pls.
Quoted 1 line
+unsigned long
prm_umc_norm_to_sys_addr(u8 socket_id, u64 umc_bank_inst_id, unsigned long addr)
bank_id is fine.
drivers/ras/amd/atl/prm.c line 33
Quoted 2 lines
drivers/ras/amd/atl/prm.c new file +2
-0+{ +struct prm_umc_param_buffer_norm param_buffer;
... p_buf;
Quoted 19 lines
drivers/ras/amd/atl/prm.c new file +19
-0+unsigned long ret_addr; +int ret; + + param_buffer.norm_addr = addr; + param_buffer.socket = socket_id; + param_buffer.umc_bank_inst_id = umc_bank_inst_id; + param_buffer.output_buffer = &ret_addr; + + ret =acpi_call_prm_handler (norm_to_sys_prm_handler_guid, ¶m_buffer); +if (!ret) +return ret_addr; + +if (ret == -ENODEV ) +pr_debug ("PRM module/handler not available\n" ); +else +pr_notice_once ("PRM address translation failed\n" ); + +return ret; +}
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v2 2/2] RAS/AMD/ATL: Translate normalized to system physical addresses using PRM
Quoted 37 lines · Borislav Petkov
Quoted 9 lines · John Allen
Future AMD platforms will provide a UEFI PRM module that implements a number of address translation PRM handlers. This will provide an interface for the OS to call platform specific code without requiring the use of SMM or other heavy firmware operations.
AMD Zen-based systems report memory error addresses through Machine Check banks representing Unified Memory Controllers (UMCs) in the form of UMC relative "normalized" addresses. A normalized address must be converted to a system physical address to be usable by the OS.
This should be your first paragraph.
Quoted 10 lines
Add support for the normalized to system physical address translation PRM handler in the AMD Address Translation Library and prefer it over native code if available. The GUID and parameter buffer structure are specific to the normalized to system physical address handler provided by the address translation PRM module included in future AMD systems.
The address translation PRM module is documented in chapter 22 of the publicly available "AMD Family 1Ah Models 00h–0Fh and Models 10h–1Fh ACPI v6.5 Porting Guide":
https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/programmer-references/58088-0.75-pub.pdfThose URLs are flaky and become invalid over time. When you quote a document, quote it in such a way so that searching for it on the web, can find it. The name above works for me so that's good.
drivers/ras/amd/atl/prm.c line 15
Quoted 3 lines
drivers/ras/amd/atl/prm.c new file +3
-0+#include "internal.h" + +#if defined(CONFIG_ACPI_PRMT )Instead of that ifdeffery you could do:
config
AMD_ATL_PRMdepends on AMD_ATL && ACPI_PRMT
Quoted 8 lines
and it'll get enabled automatically and then you don't need the empty stub either.
drivers/ras/amd/atl/prm.c line 19
Quoted 3 lines
drivers/ras/amd/atl/prm.c new file +3
-0+#include <linux/prmt.h> + +struct prm_umc_param_buffer_norm {What's a
prm_umc_param_buffer_norm?
This is the param buffer struct used for norm -> X tranlations. I can shorten and clarify this along with the others you pointed out. Maybe "param_buffer_norm" instead and a comment explaining the purpose?
Thanks,
John
Quoted 52 lines
drivers/ras/amd/atl/prm.c line 23
Quoted 5 lines
drivers/ras/amd/atl/prm.c new file +4
-0+u64 norm_addr; +u8 socket; +u64 umc_bank_inst_id; +void *output_buffer;Use the usual short versions for such standard names: "
out_buf"drivers/ras/amd/atl/prm.c line 29
Quoted 6 lines
drivers/ras/amd/atl/prm.c new file +6
-0+} __packed; + +static const guid_t norm_to_sys_prm_handler_guid =GUID_INIT (0xE7180659 ,0xA65D , +0x451D ,0x92 ,0xCD , +0x2B ,0x56 ,0xF1 ,0x2B , +0xEB ,0xA6 );When you define such long variable names, your lines stick out unnecessarily. Shorten pls.
Quoted 1 line
+unsigned long
prm_umc_norm_to_sys_addr(u8 socket_id, u64 umc_bank_inst_id, unsigned long addr)
bank_idis fine.drivers/ras/amd/atl/prm.c line 33
Quoted 2 lines
drivers/ras/amd/atl/prm.c new file +2
-0+{ +struct prm_umc_param_buffer_norm param_buffer;...
p_buf;Quoted 19 lines
drivers/ras/amd/atl/prm.c new file +19
-0+unsigned long ret_addr; +int ret; + + param_buffer.norm_addr = addr; + param_buffer.socket = socket_id; + param_buffer.umc_bank_inst_id = umc_bank_inst_id; + param_buffer.output_buffer = &ret_addr; + + ret =acpi_call_prm_handler (norm_to_sys_prm_handler_guid, ¶m_buffer); +if (!ret) +return ret_addr; + +if (ret == -ENODEV ) +pr_debug ("PRM module/handler not available\n" ); +else +pr_notice_once ("PRM address translation failed\n" ); + +return ret; +}Signature · 4 lines
Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette
Borislav Petkov
maintainerRe: [PATCH v2 2/2] RAS/AMD/ATL: Translate normalized to system physical addresses using PRM
Quoted 3 lines · John Allen
This is the param buffer struct used for norm -> X tranlations. I can shorten and clarify this along with the others you pointed out. Maybe "
param_buffer_norm" instead and a comment explaining the purpose?
What's wrong with
struct param_buffer
simply?
It is obvious from the code that it is used in the normalized -> physical address translation.
Btw, pls do me a favor and trim your replies like I just did.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v2 2/2] RAS/AMD/ATL: Translate normalized to system physical addresses using PRM
Quoted 5 lines · Borislav Petkov
Quoted 3 lines · John Allen
This is the param buffer struct used for norm -> X tranlations. I can shorten and clarify this along with the others you pointed out. Maybe "
param_buffer_norm" instead and a comment explaining the purpose?
Quoted 8 lines
What's wrong with
struct
param_buffersimply?
It is obvious from the code that it is used in the normalized -> physical address translation.
This is because the spec defines different param buffer structures for different types of translation. We can call this just param_buffer for now, but would need to be renamed if/when we add use cases for the other translation handlers. My preference would be to sort of future-proof the name now, but I don't have an issue calling it param_buffer now and changing it later if that's what you'd prefer.
Quoted 1 line
Btw, pls do me a favor and trim your replies like I just did.
Sure, sorry about that.
Thanks,
John
Borislav Petkov
maintainerRe: [PATCH v2 2/2] RAS/AMD/ATL: Translate normalized to system physical addresses using PRM
Quoted 6 lines · John Allen
This is because the spec defines different param buffer structures for different types of translation. We can call this just
param_bufferfor now, but would need to be renamed if/when we add use cases for the other translation handlers. My preference would be to sort of future-proof the name now, but I don't have an issue calling itparam_buffernow and changing it later if that's what you'd prefer.
Sure:
/*
* PRM parameter buffer - normalized to system physical address, as described
* in the section "PRM Parameter Buffer" in the aforementioned spec. */
struct norm_to_spa_param_buf {
...
} __packed;and you'll have to mention the spec in the prm.c file, at the top.
This way readers can immediately map it to the place in the spec.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH v2 1/2] ACPI: PRM: Add PRM handler direct call support
In reply to Borislav PetkovQuoted 44 lines · Borislav Petkov
Quoted 42 lines · John Allen
Platform Runtime Mechanism (PRM) handlers can be invoked from either the AML interpreter or directly by an OS driver. Implement the direct call method.
Export the symbol as this will be used by modules such as the AMD Address Translation Library and likely others in the future.
Signed-off-by John Allen <[email protected]>Reviewed-by Yazen Ghannam <[email protected]>---
v2:
- Align statements setting fields in context buffer on '='--- drivers/acpi/prmt.c | 24 ++++++++++++++++++++++++ include/linux/prmt.h | 5 +++++ 2 files changed, 29 insertions(+)drivers/acpi/prmt.c +17
-0@@ -214,6 +214,30 @@ static struct prm_handler_info *find_prm_handler(const guid_t *guid)#define UPDATE_LOCK_ALREADY_HELD 4#define UPDATE_UNLOCK_WITHOUT_LOCK 5 +int acpi_call_prm_handler (guid_t handler_guid,void *param_buffer) +{ +struct prm_handler_info *handler =find_prm_handler (&handler_guid); +struct prm_module_info *module =find_prm_module (&handler_guid); +struct prm_context_buffer context; +efi_status_t status; + +if (!module || !handler) +return -ENODEV ; + +memset (&context,0 ,sizeof (context)); +ACPI_COPY_NAMESEG (context.signature,"PRMC" ); + context.identifier = handler->guid; + context.static_data_buffer = handler->static_data_buffer_addr; + context.mmio_ranges = module->mmio_info; + + status = efi_call_acpi_prm_handler(handler->handler_addr,
Quoted 9 lines
drivers/acpi/prmt.c static struct prm_handler_info *find_prm_handler(const guid_t *guid) · line 238
Quoted 5 lines
drivers/acpi/prmt.c +5
-0+ (u64 )param_buffer, + &context); + +return efi_status_to_err (status); +}+ linux-efi as Rafael wanted to make sure the environment is created properly for the EFI runtime services call...
This looks fine to me.
Re: [PATCH v2 2/2] RAS/AMD/ATL: Translate normalized to system physical addresses using PRM
In reply to Borislav PetkovQuoted 7 lines · Borislav Petkov
drivers/ras/amd/atl/prm.c line 15
Quoted 3 lines · John Allen
drivers/ras/amd/atl/prm.c new file +3
-0+#include "internal.h" + +#if defined(CONFIG_ACPI_PRMT )Instead of that ifdeffery you could do:
Quoted 5 lines
config
AMD_ATL_PRMdepends on AMD_ATL && ACPI_PRMTand it'll get enabled automatically and then you don't need the empty stub either.
I'm not sure this works the way we need it to. If ACPI_PRMT is not enabled, then the norm to sys translation function will be referenced by the base AMD ATL, but will the symbol will not be found since the the PRM file doesn't get compiled.
I added the AMD_ATL_PRM config and added the following to the ATL Makefile:
amd_atl-$(CONFIG_AMD_ATL_PRM) += prm.o
instead of:
amd_atl-y += prm.o
Is there another way you had in mind to make the additional config option work as expected?
Thanks,
John
Borislav Petkov
maintainerRe: [PATCH v2 2/2] RAS/AMD/ATL: Translate normalized to system physical addresses using PRM
Quoted 4 lines · John Allen
I'm not sure this works the way we need it to. If
ACPI_PRMTis not enabled, then the norm to sys translation function will be referenced by the base AMD ATL, but will the symbol will not be found since the the PRM file doesn't get compiled.
So you don't delete the stub but you put it in the internal.h header:
#ifndef CONFIG_AMD_ATL_PRM
+unsigned long prm_umc_norm_to_sys_addr(u8 socket_id, u64 umc_bank_inst_id, unsigned long addr) +{
+ return -ENODEV;
+}
+
+#endif
Don't be afraid to grep the tree - there are gazillion examples how stuff like that is usually done.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette