xref: /linux/arch/arm64/kvm/hyp/nvhe/events.c (revision 0fc8f6200d2313278fbf4539bbab74677c685531)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (C) 2025 Google LLC
4  * Author: Vincent Donnefort <vdonnefort@google.com>
5  */
6 
7 #include <nvhe/mm.h>
8 #include <nvhe/trace.h>
9 
10 #include <nvhe/define_events.h>
11 
12 int __tracing_enable_event(unsigned short id, bool enable)
13 {
14 	struct hyp_event_id *event_id = &__hyp_event_ids_start[id];
15 	atomic_t *enabled;
16 
17 	if (event_id >= __hyp_event_ids_end)
18 		return -EINVAL;
19 
20 	enabled = hyp_fixmap_map(__hyp_pa(&event_id->enabled));
21 	atomic_set(enabled, enable);
22 	hyp_fixmap_unmap();
23 
24 	return 0;
25 }
26