1 /* 2 * QEMU support -- ARM Power Control specific functions. 3 * 4 * Copyright (c) 2016 Jean-Christophe Dubois 5 * 6 * This work is licensed under the terms of the GNU GPL, version 2 or later. 7 * See the COPYING file in the top-level directory. 8 * 9 */ 10 11 #ifndef QEMU_ARM_POWERCTL_H 12 #define QEMU_ARM_POWERCTL_H 13 14 #include "kvm-consts.h" 15 16 #define QEMU_ARM_POWERCTL_RET_SUCCESS QEMU_PSCI_RET_SUCCESS 17 #define QEMU_ARM_POWERCTL_INVALID_PARAM QEMU_PSCI_RET_INVALID_PARAMS 18 #define QEMU_ARM_POWERCTL_ALREADY_ON QEMU_PSCI_RET_ALREADY_ON 19 #define QEMU_ARM_POWERCTL_IS_OFF QEMU_PSCI_RET_DENIED 20 21 /* 22 * arm_get_cpu_by_id: 23 * @cpuid: the id of the CPU we want to retrieve the state 24 * 25 * Retrieve a CPUState object from its CPU ID provided in @cpuid. 26 * 27 * Returns: a pointer to the CPUState structure of the requested CPU. 28 */ 29 CPUState *arm_get_cpu_by_id(uint64_t cpuid); 30 31 /* 32 * arm_set_cpu_on: 33 * @cpuid: the id of the CPU we want to start/wake up. 34 * @entry: the address the CPU shall start from. 35 * @context_id: the value to put in r0/x0. 36 * @target_el: The desired exception level. 37 * @target_aa64: 1 if the requested mode is AArch64. 0 otherwise. 38 * 39 * Start the cpu designated by @cpuid in @target_el exception level. The mode 40 * shall be AArch64 if @target_aa64 is set to 1. Otherwise the mode is 41 * AArch32. The CPU shall start at @entry with @context_id in r0/x0. 42 * 43 * Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success. 44 * QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided. 45 * QEMU_ARM_POWERCTL_ALREADY_ON if the CPU was already started. 46 */ 47 int arm_set_cpu_on(uint64_t cpuid, uint64_t entry, uint64_t context_id, 48 uint32_t target_el, bool target_aa64); 49 50 /* 51 * arm_set_cpu_off: 52 * @cpuid: the id of the CPU we want to stop/shut down. 53 * 54 * Stop the cpu designated by @cpuid. 55 * 56 * Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success. 57 * QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided. 58 * QEMU_ARM_POWERCTL_IS_OFF if CPU is already off 59 */ 60 61 int arm_set_cpu_off(uint64_t cpuid); 62 63 /* 64 * arm_reset_cpu: 65 * @cpuid: the id of the CPU we want to reset. 66 * 67 * Reset the cpu designated by @cpuid. 68 * 69 * Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success. 70 * QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided. 71 * QEMU_ARM_POWERCTL_IS_OFF if CPU is off 72 */ 73 int arm_reset_cpu(uint64_t cpuid); 74 75 #endif 76