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