From 2c0062bde59d82c0f47dbeb917b89dc047764bfc Mon Sep 17 00:00:00 2001
From: Geri <42678694+GeriGeriGeriGeri@users.noreply.github.com>
Date: Sat, 8 May 2021 11:20:10 +0200
Subject: [PATCH] Update amdctl.c
Linux 5.9 and 5.10 started to remove msr support.
Maybe a fopen / fgets / strstr at "Write to unrecognized MSR" would be required on /var/log/kern.log, to detect if the operation was succesfull, or the kernel blocked the call alltogether.
---
amdctl.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/amdctl.c b/amdctl.c
index 4588db4..e7b551a 100644
--- a/amdctl.c
+++ b/amdctl.c
@@ -14,6 +14,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
+
+#pragma GCC diagnostic ignored "-Wwrite-strings"
+
#define _XOPEN_SOURCE 500
#include
#include
@@ -23,6 +26,11 @@
#include
#include
+#include
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
+ #warning Incompatible kernel! MSR access deprecated by your Linux kernel! To use this program, you must set GRUB_CMDLINE_LINUX="msr.allow_writes=on" kernel parameter in the file /etc/default/grub and run upgrade-grub.
+#endif
+
void printBaseFmt(const int);
int getDec(const char *);
void getReg(const uint32_t);