[PATCH 4/8] HACK: Hard code in mapped tracing buffer address

From: Steven Rostedt
Date: Tue Mar 05 2024 - 20:58:35 EST


From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

Do not submit!

This is for testing purposes only. It hard codes an address that I was
using to store the ring buffer range. How the memory actually gets mapped
will be another project.

Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
arch/x86/kernel/setup.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 84201071dfac..dcba729349d3 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -26,6 +26,8 @@
#include <linux/swiotlb.h>
#include <linux/random.h>

+#include <linux/trace.h>
+
#include <uapi/linux/mount.h>

#include <xen/xen.h>
@@ -1106,6 +1108,24 @@ void __init setup_arch(char **cmdline_p)
*/
arch_reserve_crashkernel();

+ trace_buffer_size = 12582912;
+ {
+ phys_addr_t ftrace_addr;
+ unsigned long phys_start = 0x285400000;
+ unsigned long phys_end = phys_start + trace_buffer_size + 1024*1024;
+
+ ftrace_addr = memblock_phys_alloc_range(trace_buffer_size, 4096,
+ phys_start, phys_end);
+ if (ftrace_addr) {
+ printk("MEMORY ALLOC %lx-%lx\n", (long)ftrace_addr,
+ (long)ftrace_addr + trace_buffer_size);
+ trace_buffer_start = (unsigned long)__va(ftrace_addr);
+ printk("MEMORY ADDR %lx-%lx\n", trace_buffer_start,
+ trace_buffer_start + trace_buffer_size);
+ } else
+ printk("MEMORY FAILED\n");
+ }
+
memblock_find_dma_reserve();

if (!early_xdbc_setup_hardware())
--
2.43.0