#include <asm/kvm_asm.h>
#include <asm/kvm_hyp.h>
#include <asm/kvm_mmu.h>
#include <linux/arm-smccc.h>
#include <linux/kvm_host.h>
#include <uapi/linux/psci.h>
#include <nvhe/memory.h>
#include <nvhe/trap_handler.h>
Go to the source code of this file.
|
void | kvm_hyp_cpu_entry (unsigned long r0) |
|
void | kvm_hyp_cpu_resume (unsigned long r0) |
|
void __noreturn | __host_enter (struct kvm_cpu_context *host_ctxt) |
|
static | DEFINE_PER_CPU (struct psci_boot_args, cpu_on_args) |
|
static | DEFINE_PER_CPU (struct psci_boot_args, suspend_args) |
|
static bool | is_psci_0_1_call (u64 func_id) |
|
static bool | is_psci_0_2_call (u64 func_id) |
|
static unsigned long | psci_call (unsigned long fn, unsigned long arg0, unsigned long arg1, unsigned long arg2) |
|
static unsigned long | psci_forward (struct kvm_cpu_context *host_ctxt) |
|
static unsigned int | find_cpu_id (u64 mpidr) |
|
static __always_inline bool | try_acquire_boot_args (struct psci_boot_args *args) |
|
static __always_inline void | release_boot_args (struct psci_boot_args *args) |
|
static int | psci_cpu_on (u64 func_id, struct kvm_cpu_context *host_ctxt) |
|
static int | psci_cpu_suspend (u64 func_id, struct kvm_cpu_context *host_ctxt) |
|
static int | psci_system_suspend (u64 func_id, struct kvm_cpu_context *host_ctxt) |
|
asmlinkage void __noreturn | __kvm_host_psci_cpu_entry (bool is_cpu_on) |
|
static unsigned long | psci_0_1_handler (u64 func_id, struct kvm_cpu_context *host_ctxt) |
|
static unsigned long | psci_0_2_handler (u64 func_id, struct kvm_cpu_context *host_ctxt) |
|
static unsigned long | psci_1_0_handler (u64 func_id, struct kvm_cpu_context *host_ctxt) |
|
bool | kvm_host_psci_handler (struct kvm_cpu_context *host_ctxt, u32 func_id) |
|
◆ INVALID_CPU_ID
#define INVALID_CPU_ID UINT_MAX |
◆ is_psci_0_1
#define is_psci_0_1 |
( |
|
what, |
|
|
|
func_id |
|
) |
| |
Value:
struct kvm_host_psci_config __ro_after_init kvm_host_psci_config
Definition at line 44 of file psci-relay.c.
◆ PSCI_BOOT_ARGS_INIT
#define PSCI_BOOT_ARGS_INIT |
Value:
})
#define PSCI_BOOT_ARGS_UNLOCKED
Definition at line 36 of file psci-relay.c.
◆ PSCI_BOOT_ARGS_LOCKED
#define PSCI_BOOT_ARGS_LOCKED 1 |
◆ PSCI_BOOT_ARGS_UNLOCKED
#define PSCI_BOOT_ARGS_UNLOCKED 0 |
◆ __host_enter()
void __noreturn __host_enter |
( |
struct kvm_cpu_context * |
host_ctxt | ) |
|
◆ __kvm_host_psci_cpu_entry()
asmlinkage void __noreturn __kvm_host_psci_cpu_entry |
( |
bool |
is_cpu_on | ) |
|
Definition at line 203 of file psci-relay.c.
206 struct kvm_cpu_context *host_ctxt;
208 host_ctxt = &this_cpu_ptr(&kvm_host_data)->host_ctxt;
211 boot_args = this_cpu_ptr(&cpu_on_args);
213 boot_args = this_cpu_ptr(&suspend_args);
216 write_sysreg_el2(boot_args->
pc, SYS_ELR);
static __always_inline void release_boot_args(struct psci_boot_args *args)
void __noreturn __host_enter(struct kvm_cpu_context *host_ctxt)
◆ DEFINE_PER_CPU() [1/2]
◆ DEFINE_PER_CPU() [2/2]
◆ find_cpu_id()
static unsigned int find_cpu_id |
( |
u64 |
mpidr | ) |
|
|
static |
Definition at line 78 of file psci-relay.c.
83 if (mpidr & ~MPIDR_HWID_BITMASK)
86 for (i = 0; i < NR_CPUS; i++) {
u64 cpu_logical_map(unsigned int cpu)
◆ is_psci_0_1_call()
static bool is_psci_0_1_call |
( |
u64 |
func_id | ) |
|
|
static |
Definition at line 48 of file psci-relay.c.
#define is_psci_0_1(what, func_id)
◆ is_psci_0_2_call()
static bool is_psci_0_2_call |
( |
u64 |
func_id | ) |
|
|
static |
Definition at line 56 of file psci-relay.c.
59 return (PSCI_0_2_FN(0) <= func_id && func_id <= PSCI_0_2_FN(31)) ||
60 (PSCI_0_2_FN64(0) <= func_id && func_id <= PSCI_0_2_FN64(31));
◆ kvm_host_psci_handler()
bool kvm_host_psci_handler |
( |
struct kvm_cpu_context * |
host_ctxt, |
|
|
u32 |
func_id |
|
) |
| |
Definition at line 276 of file psci-relay.c.
281 case PSCI_VERSION(0, 1):
286 case PSCI_VERSION(0, 2):
static bool is_psci_0_2_call(u64 func_id)
static bool is_psci_0_1_call(u64 func_id)
static unsigned long psci_1_0_handler(u64 func_id, struct kvm_cpu_context *host_ctxt)
static unsigned long psci_0_2_handler(u64 func_id, struct kvm_cpu_context *host_ctxt)
static unsigned long psci_0_1_handler(u64 func_id, struct kvm_cpu_context *host_ctxt)
◆ kvm_hyp_cpu_entry()
void kvm_hyp_cpu_entry |
( |
unsigned long |
r0 | ) |
|
◆ kvm_hyp_cpu_resume()
void kvm_hyp_cpu_resume |
( |
unsigned long |
r0 | ) |
|
◆ psci_0_1_handler()
static unsigned long psci_0_1_handler |
( |
u64 |
func_id, |
|
|
struct kvm_cpu_context * |
host_ctxt |
|
) |
| |
|
static |
Definition at line 224 of file psci-relay.c.
233 return PSCI_RET_NOT_SUPPORTED;
static unsigned long psci_forward(struct kvm_cpu_context *host_ctxt)
static int psci_cpu_suspend(u64 func_id, struct kvm_cpu_context *host_ctxt)
static int psci_cpu_on(u64 func_id, struct kvm_cpu_context *host_ctxt)
◆ psci_0_2_handler()
static unsigned long psci_0_2_handler |
( |
u64 |
func_id, |
|
|
struct kvm_cpu_context * |
host_ctxt |
|
) |
| |
|
static |
Definition at line 236 of file psci-relay.c.
239 case PSCI_0_2_FN_PSCI_VERSION:
240 case PSCI_0_2_FN_CPU_OFF:
241 case PSCI_0_2_FN64_AFFINITY_INFO:
242 case PSCI_0_2_FN64_MIGRATE:
243 case PSCI_0_2_FN_MIGRATE_INFO_TYPE:
244 case PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU:
250 case PSCI_0_2_FN_SYSTEM_OFF:
251 case PSCI_0_2_FN_SYSTEM_RESET:
253 case PSCI_0_2_FN64_CPU_SUSPEND:
255 case PSCI_0_2_FN64_CPU_ON:
258 return PSCI_RET_NOT_SUPPORTED;
◆ psci_1_0_handler()
static unsigned long psci_1_0_handler |
( |
u64 |
func_id, |
|
|
struct kvm_cpu_context * |
host_ctxt |
|
) |
| |
|
static |
Definition at line 262 of file psci-relay.c.
265 case PSCI_1_0_FN_PSCI_FEATURES:
266 case PSCI_1_0_FN_SET_SUSPEND_MODE:
267 case PSCI_1_1_FN64_SYSTEM_RESET2:
269 case PSCI_1_0_FN64_SYSTEM_SUSPEND:
static int psci_system_suspend(u64 func_id, struct kvm_cpu_context *host_ctxt)
◆ psci_call()
static unsigned long psci_call |
( |
unsigned long |
fn, |
|
|
unsigned long |
arg0, |
|
|
unsigned long |
arg1, |
|
|
unsigned long |
arg2 |
|
) |
| |
|
static |
Definition at line 63 of file psci-relay.c.
66 struct arm_smccc_res res;
68 arm_smccc_1_1_smc(fn, arg0, arg1, arg2, &res);
◆ psci_cpu_on()
static int psci_cpu_on |
( |
u64 |
func_id, |
|
|
struct kvm_cpu_context * |
host_ctxt |
|
) |
| |
|
static |
Definition at line 107 of file psci-relay.c.
115 struct kvm_nvhe_init_params *init_params;
127 return PSCI_RET_INVALID_PARAMS;
129 boot_args = per_cpu_ptr(&cpu_on_args, cpu_id);
130 init_params = per_cpu_ptr(&kvm_init_params, cpu_id);
134 return PSCI_RET_ALREADY_ON;
142 __hyp_pa(init_params));
145 if (ret != PSCI_RET_SUCCESS)
static unsigned int find_cpu_id(u64 mpidr)
static unsigned long psci_call(unsigned long fn, unsigned long arg0, unsigned long arg1, unsigned long arg2)
static __always_inline bool try_acquire_boot_args(struct psci_boot_args *args)
void kvm_hyp_cpu_entry(unsigned long r0)
#define DECLARE_REG(type, name, ctxt, reg)
◆ psci_cpu_suspend()
static int psci_cpu_suspend |
( |
u64 |
func_id, |
|
|
struct kvm_cpu_context * |
host_ctxt |
|
) |
| |
|
static |
Definition at line 151 of file psci-relay.c.
158 struct kvm_nvhe_init_params *init_params;
160 boot_args = this_cpu_ptr(&suspend_args);
161 init_params = this_cpu_ptr(&kvm_init_params);
176 __hyp_pa(init_params));
void kvm_hyp_cpu_resume(unsigned long r0)
◆ psci_forward()
static unsigned long psci_forward |
( |
struct kvm_cpu_context * |
host_ctxt | ) |
|
|
static |
◆ psci_system_suspend()
static int psci_system_suspend |
( |
u64 |
func_id, |
|
|
struct kvm_cpu_context * |
host_ctxt |
|
) |
| |
|
static |
Definition at line 179 of file psci-relay.c.
185 struct kvm_nvhe_init_params *init_params;
187 boot_args = this_cpu_ptr(&suspend_args);
188 init_params = this_cpu_ptr(&kvm_init_params);
200 __hyp_pa(init_params), 0);
◆ release_boot_args()
static __always_inline void release_boot_args |
( |
struct psci_boot_args * |
args | ) |
|
|
static |
◆ try_acquire_boot_args()
static __always_inline bool try_acquire_boot_args |
( |
struct psci_boot_args * |
args | ) |
|
|
static |
Definition at line 94 of file psci-relay.c.
96 return atomic_cmpxchg_acquire(&args->
lock,
#define PSCI_BOOT_ARGS_LOCKED
◆ kvm_host_psci_config