ANDROID: KVM: arm64: Rename nVHE hyp event ELF sections

The ELF sections and delimiters used by the hyp events were not
following the convention used by other hyp sections. Align them all.

Bug: 249050813
Change-Id: I7b3ee4915c8904cd531911df59c1fd1853bbbe9f
Signed-off-by: Will Deacon <willdeacon@google.com>
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
This commit is contained in:
Will Deacon
2023-02-17 15:19:56 +00:00
committed by Vincent Donnefort
parent a0371ac66a
commit 16d9a0f908
4 changed files with 22 additions and 28 deletions

View File

@@ -15,10 +15,10 @@
#ifdef CONFIG_TRACING
#define HYPERVISOR_EVENT_IDS \
. = ALIGN(PAGE_SIZE); \
__hyp_event_ids_start = .; \
*(HYP_SECTION_NAME(_hyp_event_ids)) \
__hyp_event_ids_end = .;
. = ALIGN(PAGE_SIZE); \
__hyp_event_ids_start = .; \
*(HYP_SECTION_NAME(.event_ids)) \
__hyp_event_ids_end = .;
#else
#define HYPERVISOR_EVENT_IDS
#endif
@@ -62,17 +62,6 @@
. = ALIGN(PAGE_SIZE); \
__hyp_bss_end = .;
#ifdef CONFIG_TRACING
#define HYPERVISOR_EVENTS \
.hyp.events : { \
__start_hyp_events = .; \
*(_hyp_events) \
__stop_hyp_events = .; \
}
#else
#define HYPERVISOR_EVENTS
#endif
/*
* We require that __hyp_bss_start and __bss_start are aligned, and enforce it
* with an assertion. But the BSS_SECTION macro places an empty .sbss section
@@ -214,10 +203,16 @@ SECTIONS
/* everything from this point to __init_begin will be marked RO NX */
RO_DATA(PAGE_SIZE)
HYPERVISOR_EVENTS
HYPERVISOR_RODATA_SECTIONS
#ifdef CONFIG_TRACING
.rodata.hyp_events : {
__hyp_events_start = .;
*(_hyp_events)
__hyp_events_end = .;
}
#endif
idmap_pg_dir = .;
. += IDMAP_DIR_SIZE;
idmap_pg_end = .;

View File

@@ -12,7 +12,7 @@ extern struct hyp_event_id __hyp_event_ids_end[];
#undef HYP_EVENT
#define HYP_EVENT(__name, __proto, __struct, __assign, __printk) \
atomic_t __ro_after_init __name##_enabled = ATOMIC_INIT(0); \
struct hyp_event_id hyp_event_id_##__name __section("_hyp_event_ids") = { \
struct hyp_event_id hyp_event_id_##__name __section(".hyp.event_ids") = { \
.data = (void *)&__name##_enabled, \
}

View File

@@ -18,7 +18,7 @@ SECTIONS {
HYP_SECTION(.rodata)
#ifdef CONFIG_TRACING
. = ALIGN(PAGE_SIZE);
HYP_SECTION(_hyp_event_ids)
HYP_SECTION(.event_ids)
#endif
/*

View File

@@ -82,8 +82,8 @@ struct hyp_event {
#undef __ARM64_KVM_HYPEVENTS_H_
#include <asm/kvm_hypevents.h>
extern struct hyp_event __start_hyp_events[];
extern struct hyp_event __stop_hyp_events[];
extern struct hyp_event __hyp_events_start[];
extern struct hyp_event __hyp_events_end[];
/* hyp_event section used by the hypervisor */
extern struct hyp_event_id __hyp_event_ids_start[];
@@ -91,9 +91,9 @@ extern struct hyp_event_id __hyp_event_ids_end[];
static struct hyp_event *find_hyp_event(const char *name)
{
struct hyp_event *event = __start_hyp_events;
struct hyp_event *event = __hyp_events_start;
for (; (unsigned long)event < (unsigned long)__stop_hyp_events;
for (; (unsigned long)event < (unsigned long)__hyp_events_end;
event++) {
if (!strncmp(name, event->name, HYP_EVENT_NAME_MAX))
return event;
@@ -319,7 +319,7 @@ bool kvm_hyp_events_enable_early(void)
void kvm_hyp_init_events_tracefs(struct dentry *parent)
{
struct hyp_event *event = __start_hyp_events;
struct hyp_event *event = __hyp_events_start;
struct dentry *d, *event_dir;
parent = tracefs_create_dir("events", parent);
@@ -333,8 +333,7 @@ void kvm_hyp_init_events_tracefs(struct dentry *parent)
if (!d)
pr_err("Failed to create events/header_page\n");
for (; (unsigned long)event < (unsigned long)__stop_hyp_events; event++) {
for (; (unsigned long)event < (unsigned long)__hyp_events_end; event++) {
event_dir = tracefs_create_dir(event->name, parent);
if (!event_dir) {
pr_err("Failed to create events/hyp/%s\n", event->name);
@@ -364,13 +363,13 @@ void kvm_hyp_init_events_tracefs(struct dentry *parent)
*/
int kvm_hyp_init_events(void)
{
struct hyp_event *event = __start_hyp_events;
struct hyp_event *event = __hyp_events_start;
struct hyp_event_id *hyp_event_id = __hyp_event_ids_start;
int ret, err = -ENODEV;
/* TODO: BUILD_BUG nr events host side / hyp side */
for (; (unsigned long)event < (unsigned long)__stop_hyp_events;
for (; (unsigned long)event < (unsigned long)__hyp_events_end;
event++, hyp_event_id++) {
event->call->name = event->name;
ret = register_trace_event(&event->call->event);