plat.c not compiling
When I execute the make command in the and_hsmp directory. I get the following output/error:
I am running on Ubuntu:
cat /etc/os-release
PRETTY_NAME="Ubuntu 25.04"
NAME="Ubuntu"
VERSION_ID="25.04"
VERSION="25.04 (Plucky Puffin)"
VERSION_CODENAME=plucky
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=plucky
LOGO=ubuntu-logo
make
make -C /lib/modules/`uname -r`/build M=$PWD modules
make[1]: Entering directory '/usr/src/linux-headers-6.14.0-32-generic'
make[2]: Entering directory '/home/user1/amd_hsmp'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-14 (Ubuntu 14.2.0-19ubuntu2) 14.2.0
You are using: gcc-14 (Ubuntu 14.2.0-19ubuntu2) 14.2.0
CC [M] acpi.o
LD [M] hsmp_acpi.o
CC [M] hsmp.o
CC [M] hwmon.o
LD [M] hsmp_common.o
CC [M] plat.o
plat.c: In function ‘init_platform_device’:
plat.c:212:68: error: ‘struct amd_northbridge’ has no member named ‘root’
212 | sock->root = node_to_amd_nb(i)->root;
| ^~
make[4]: *** [/usr/src/linux-headers-6.14.0-32-generic/scripts/Makefile.build:207: plat.o] Error 1
make[3]: *** [/usr/src/linux-headers-6.14.0-32-generic/Makefile:1997: .] Error 2
make[2]: *** [/usr/src/linux-headers-6.14.0-32-generic/Makefile:251: __sub-make] Error 2
make[2]: Leaving directory '/home/user1/amd_hsmp'
make[1]: *** [Makefile:251: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.14.0-32-generic'
make: *** [Makefile:16: default] Error 2
Hi David,
Thank you for using HSMP driver. The "root" member of amd_northbridge got removed in 6.15 tag in git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6.14 kernel still has this root member. But looks 6.14.0-32-generic kernel has backported this patch. So please change the condition check to 6.14 as in below code segment
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0) if (!node_to_amd_nb(i)) return -ENODEV; sock->root = node_to_amd_nb(i)->root; #endif
static int amd_hsmp_pci_rdwr(struct hsmp_socket *sock, u32 offset, u32 *value, bool write) { #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0) int ret;
if (!sock->root)
return -ENODEV;
Thanks for the quick response, your suggestion worked and I am now able to build the module.However, when I install the module the file /dev/hsmp doesn't get created and I need that file to provide the power metrics. How do I create the /dev/hsmp file ?
Can you provide below information
- The platform which you are using. You can execute lscpu and provide the output here.
- which module you inserted?
- dmesg output
lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 52 bits physical, 57 bits virtual
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-127
Vendor ID: AuthenticAMD
Model name: AMD EPYC 9354 32-Core Processor
CPU family: 25
Model: 17
Thread(s) per core: 2
Core(s) per socket: 32
Socket(s): 2
Stepping: 1
Frequency boost: enabled
CPU(s) scaling MHz: 47%
CPU max MHz: 3250.0000
CPU min MHz: 1500.0000
BogoMIPS: 6490.01
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep
_good amd_lbr_v2 nopl xtopology nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f
16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc
mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba perfmon_v2 ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq
rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local use
r_shstk avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefil
ter pfthreshold avic v_vmsave_vmload vgif x2avic v_spec_ctrl vnmi avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpo
pcntdq la57 rdpid overflow_recov succor smca fsrm flush_l1d debug_swap
Virtualization features:
Virtualization: AMD-V
Caches (sum of all):
L1d: 2 MiB (64 instances)
L1i: 2 MiB (64 instances)
L2: 64 MiB (64 instances)
L3: 512 MiB (16 instances)
NUMA:
NUMA node(s): 2
NUMA node0 CPU(s): 0-31,64-95
NUMA node1 CPU(s): 32-63,96-127
Vulnerabilities:
Gather data sampling: Not affected
Ghostwrite: Not affected
Indirect target selection: Not affected
Itlb multihit: Not affected
L1tf: Not affected
Mds: Not affected
Meltdown: Not affected
Mmio stale data: Not affected
Reg file data sampling: Not affected
Retbleed: Not affected
Spec rstack overflow: Mitigation; Safe RET
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; STIBP always-on; PBRSB-eIBRS Not affected; BHI Not affected
Srbds: Not affected
Tsx async abort: Not affected
lsmod Module Size Used by amd_hsmp 20480 0 hsmp_common 16384 1 amd_hsmp cpuid 12288 0 mptcp_diag 12288 0 xsk_diag 12288 0 tcp_diag 12288 0 udp_diag 12288 0 raw_diag 12288 0 inet_diag 28672 4 tcp_diag,mptcp_diag,raw_diag,udp_diag unix_diag 12288 0 af_packet_diag 12288 0 netlink_diag 12288 0 tls 163840 2 qrtr 53248 2 cfg80211 1437696 0 binfmt_misc 24576 1 nls_iso8859_1 12288 1 amd_atl 73728 1 intel_rapl_msr 20480 0 intel_rapl_common 53248 1 intel_rapl_msr edac_mce_amd 28672 0 kvm_amd 245760 0 spd5118 12288 0 kvm 1429504 1 kvm_amd irqbypass 12288 1 kvm dax_hmem 16384 0 rapl 20480 0 cxl_acpi 24576 0 cxl_port 16384 0 ipmi_ssif 45056 0 cxl_core 331776 2 cxl_port,cxl_acpi ses 20480 0 mgag200 73728 0 enclosure 24576 1 ses einj 28672 1 cxl_core scsi_transport_sas 53248 1 ses hpilo 24576 0 i2c_algo_bit 20480 1 mgag200 ae4dma 12288 0 ccp 159744 1 kvm_amd ptdma 28672 1 ae4dma i2c_piix4 36864 0 k10temp 16384 0 i2c_smbus 20480 1 i2c_piix4 ipmi_si 90112 1 acpi_tad 20480 0 acpi_power_meter 20480 0 acpi_ipmi 24576 1 acpi_power_meter ipmi_devintf 16384 0 ipmi_msghandler 94208 4 ipmi_devintf,ipmi_si,acpi_ipmi,ipmi_ssif mac_hid 12288 0 sch_fq_codel 24576 33 msr 12288 0 dm_multipath 45056 0 efi_pstore 12288 0 nfnetlink 20480 2 dmi_sysfs 24576 0 ip_tables 36864 0 x_tables 65536 1 ip_tables autofs4 57344 2 btrfs 2121728 0 blake2b_generic 20480 0 raid10 73728 0 raid456 196608 0 async_raid6_recov 20480 1 raid456 async_memcpy 16384 2 raid456,async_raid6_recov async_pq 20480 2 raid456,async_raid6_recov async_xor 16384 3 async_pq,raid456,async_raid6_recov async_tx 16384 5 async_pq,async_memcpy,async_xor,raid456,async_raid6_recov xor 20480 2 async_xor,btrfs raid6_pq 126976 4 async_pq,btrfs,raid456,async_raid6_recov raid1 61440 0 raid0 24576 0 linear 16384 0 polyval_clmulni 12288 0 polyval_generic 12288 1 polyval_clmulni ghash_clmulni_intel 16384 0 sha256_ssse3 32768 1 sha1_ssse3 32768 0 ahci 49152 0 libahci 53248 1 ahci bnxt_en 466944 0 megaraid_sas 229376 2 wmi 28672 0 aesni_intel 122880 0 crypto_simd 16384 1 aesni_intel cryptd 24576 2 crypto_simd,ghash_clmulni_intel
sudo dmesg | grep amd
[ 0.000000] Linux version 6.14.0-32-generic (buildd@lcy02-amd64-103) (x86_64-linux-gnu-gcc-14 (Ubuntu 14.2.0-19ubuntu2) 14.2.0, GNU ld (GNU Binutils for Ubuntu) 2.44) #32-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 29 14:21:26 UTC 2025 (Ubuntu 6.14.0-32.32-generic 6.14.11)
[ 1.831205] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4 counters/bank).
[ 1.831222] perf/amd_iommu: Detected AMD IOMMU #1 (2 banks, 4 counters/bank).
[ 1.831237] perf/amd_iommu: Detected AMD IOMMU #2 (2 banks, 4 counters/bank).
[ 1.831253] perf/amd_iommu: Detected AMD IOMMU #3 (2 banks, 4 counters/bank).
[ 1.831268] perf/amd_iommu: Detected AMD IOMMU #4 (2 banks, 4 counters/bank).
[ 1.831283] perf/amd_iommu: Detected AMD IOMMU #5 (2 banks, 4 counters/bank).
[ 1.831299] perf/amd_iommu: Detected AMD IOMMU #6 (2 banks, 4 counters/bank).
[ 1.831315] perf/amd_iommu: Detected AMD IOMMU #7 (2 banks, 4 counters/bank).
[ 2.587322] amd_pstate: the _CPC object is not present in SBIOS or ACPI disabled
[ 8.648011] systemd[1]: Hostname set to
sudo dmesg | grep hsmp [328437.395761] hsmp_common: loading out-of-tree module taints kernel. [328437.395777] hsmp_common: module verification failed: signature and/or required key missing - tainting kernel [328437.410423] amd_hsmp amd_hsmp: Error -19 clearing mailbox status register [328437.410450] amd_hsmp amd_hsmp: HSMP test message failed on Fam:19 model:11 [328437.410470] amd_hsmp amd_hsmp: Is HSMP disabled in BIOS ? [328437.410481] amd_hsmp amd_hsmp: Failed to init HSMP mailbox
HSMP is disabled in BIOS by default. This needs to be enabled explicitly. Please enable it from BIOS menu, Advanced > AMD CBS > NBIO Common Options > SMU Common Options > HSMP Support > Auto to enabled Boot the system and load the hsmp_common.ko and amd_hsmp.ko modules. Hope fully HSMP works with this.
I've edited the bios to enable hsmp support then reboot. I then rebuilt the module using make clean; make I then I executed sudo make modules_install next I tried to load the module using sudo mod probe and_hsmp and got the error message sudo modprobe amd_hsmp
modprobe: ERROR: could not insert 'amd_hsmp': Invalid argument
There is no new directory created: ls -lrt /lib/modules total 28 drwxr-xr-x 2 root root 4096 Jul 25 14:33 6.14.0-15-generic drwxr-xr-x 3 root root 4096 Aug 19 06:45 6.14.0-24-generic drwxr-xr-x 2 root root 4096 Aug 28 06:03 6.14.0-28-generic drwxr-xr-x 2 root root 4096 Sep 24 06:24 6.14.0-29-generic drwxr-xr-x 6 root root 4096 Oct 2 01:32 6.14.0-32-generic drwxr-xr-x 6 root root 4096 Oct 2 07:12 6.14.0-33-generic drwxr-xr-x 2 root root 4096 Oct 2 07:12 6.14.0-27-generic
Any suggestions?
Can you copy paste dmesg | tail when you got this invalid argument error?