mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-04-17 16:41:44 +00:00
ARM: Factor out ARM on/off PSCI control functions
Split ARM on/off function from PSCI support code. This will allow to reuse these functions in other code. Backports commit 825482adde1f971cbddf27e15fb4453ab3fae994 from qemu
This commit is contained in:
parent
468e2849cd
commit
0aa0b849c2
|
@ -22,6 +22,7 @@
|
|||
<ClInclude Include="..\..\..\qemu\fpu\softfloat-macros.h" />
|
||||
<ClInclude Include="..\..\..\qemu\fpu\softfloat-specialize.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm_ldst.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm-powerctl.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu-qom.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\helper-a64.h" />
|
||||
|
@ -54,6 +55,7 @@
|
|||
<ClCompile Include="..\..\..\qemu\ioport.c" />
|
||||
<ClCompile Include="..\..\..\qemu\memory.c" />
|
||||
<ClCompile Include="..\..\..\qemu\memory_mapping.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\arm-powerctl.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\cpu.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\cpu64.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\crypto_helper.c" />
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
<ClInclude Include="..\..\..\qemu\target\arm\arm_ldst.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm-powerctl.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu-qom.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
|
@ -92,6 +95,9 @@
|
|||
<ClCompile Include="..\..\..\qemu\hw\arm\virt.c">
|
||||
<Filter>hw\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\arm-powerctl.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\cpu.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<ClInclude Include="..\..\..\qemu\fpu\softfloat-macros.h" />
|
||||
<ClInclude Include="..\..\..\qemu\fpu\softfloat-specialize.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm_ldst.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm-powerctl.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu-qom.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\helper-a64.h" />
|
||||
|
@ -54,6 +55,7 @@
|
|||
<ClCompile Include="..\..\..\qemu\ioport.c" />
|
||||
<ClCompile Include="..\..\..\qemu\memory.c" />
|
||||
<ClCompile Include="..\..\..\qemu\memory_mapping.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\arm-powerctl.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\cpu.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\cpu64.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\crypto_helper.c" />
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
<ClInclude Include="..\..\..\qemu\target\arm\arm_ldst.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm-powerctl.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu-qom.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
|
@ -92,6 +95,9 @@
|
|||
<ClCompile Include="..\..\..\qemu\hw\arm\virt.c">
|
||||
<Filter>hw\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\arm-powerctl.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\cpu.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<ClInclude Include="..\..\..\qemu\fpu\softfloat-macros.h" />
|
||||
<ClInclude Include="..\..\..\qemu\fpu\softfloat-specialize.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm_ldst.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm-powerctl.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu-qom.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\helper.h" />
|
||||
|
@ -53,6 +54,7 @@
|
|||
<ClCompile Include="..\..\..\qemu\ioport.c" />
|
||||
<ClCompile Include="..\..\..\qemu\memory.c" />
|
||||
<ClCompile Include="..\..\..\qemu\memory_mapping.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\arm-powerctl.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\cpu.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\crypto_helper.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\helper.c" />
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<Filter Include="hw\arm">
|
||||
<UniqueIdentifier>{76f837ed-af45-43bf-9ee7-193dbdec1cd5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="target-arm">
|
||||
<Filter Include="target\arm">
|
||||
<UniqueIdentifier>{1f03d4ae-6433-4037-a347-993db1a315e6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="tcg">
|
||||
|
@ -48,32 +48,35 @@
|
|||
<ClInclude Include="..\..\..\qemu\tcg\i386\tcg-target.h">
|
||||
<Filter>tcg\i386</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\arm_ldst.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm_ldst.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\cpu.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm-powerctl.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\cpu-qom.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\helper.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu-qom.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\internals.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\helper.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\kvm-consts.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\internals.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\op_addsub.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\kvm-consts.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\translate.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\op_addsub.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\unicorn.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\translate.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\unicorn.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\arm.h" />
|
||||
<ClInclude Include="..\config-host.h" />
|
||||
|
@ -111,32 +114,35 @@
|
|||
<ClCompile Include="..\..\..\qemu\hw\arm\virt.c">
|
||||
<Filter>hw\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\translate.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\translate.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\cpu.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\arm-powerctl.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\crypto_helper.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\cpu.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\helper.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\crypto_helper.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\iwmmxt_helper.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\helper.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\neon_helper.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\iwmmxt_helper.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\op_helper.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\neon_helper.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\psci.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\op_helper.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\unicorn_arm.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\psci.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\unicorn_arm.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -21,6 +21,7 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\qemu\fpu\softfloat-macros.h" />
|
||||
<ClInclude Include="..\..\..\qemu\fpu\softfloat-specialize.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm-powerctl.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\arm_ldst.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu-qom.h" />
|
||||
<ClInclude Include="..\..\..\qemu\target\arm\cpu.h" />
|
||||
|
@ -53,6 +54,7 @@
|
|||
<ClCompile Include="..\..\..\qemu\ioport.c" />
|
||||
<ClCompile Include="..\..\..\qemu\memory.c" />
|
||||
<ClCompile Include="..\..\..\qemu\memory_mapping.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\arm-powerctl.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\cpu.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\crypto_helper.c" />
|
||||
<ClCompile Include="..\..\..\qemu\target\arm\helper.c" />
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<Filter Include="hw\arm">
|
||||
<UniqueIdentifier>{2f89d71a-2c88-497f-960b-42c3ac537df4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="target-arm">
|
||||
<Filter Include="target\arm">
|
||||
<UniqueIdentifier>{31088e8b-a2b5-4e0a-a288-4f9c537c350a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="tcg">
|
||||
|
@ -28,31 +28,34 @@
|
|||
<Filter>fpu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\arm_ldst.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\arm-powerctl.h">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\cpu-qom.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\cpu.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\helper.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\internals.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\kvm-consts.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\op_addsub.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\translate.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\target-arm\unicorn.h">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\tcg\tcg-be-ldst.h">
|
||||
<Filter>tcg</Filter>
|
||||
|
@ -89,32 +92,35 @@
|
|||
<ClCompile Include="..\..\..\qemu\hw\arm\virt.c">
|
||||
<Filter>hw\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\arm-powerctl.c">
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\cpu.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\crypto_helper.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\helper.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\iwmmxt_helper.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\neon_helper.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\op_helper.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\psci.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\translate.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\target-arm\unicorn_arm.c">
|
||||
<Filter>target-arm</Filter>
|
||||
<Filter>target\arm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\qemu\tcg\optimize.c">
|
||||
<Filter>tcg</Filter>
|
||||
|
|
|
@ -3430,6 +3430,9 @@
|
|||
#define arm_regime_tbi0 arm_regime_tbi0_aarch64
|
||||
#define arm_regime_tbi1 arm_regime_tbi1_aarch64
|
||||
#define arm_register_el_change_hook arm_register_el_change_hook_aarch64
|
||||
#define arm_reset_cpu arm_reset_cpu_aarch64
|
||||
#define arm_set_cpu_off arm_set_cpu_off_aarch64
|
||||
#define arm_set_cpu_on arm_set_cpu_on_aarch64
|
||||
#define gen_a64_set_pc_im gen_a64_set_pc_im_aarch64
|
||||
#define helper_crc32_64 helper_crc32_64_aarch64
|
||||
#define helper_crc32c_64 helper_crc32c_64_aarch64
|
||||
|
|
|
@ -3430,6 +3430,9 @@
|
|||
#define arm_regime_tbi0 arm_regime_tbi0_aarch64eb
|
||||
#define arm_regime_tbi1 arm_regime_tbi1_aarch64eb
|
||||
#define arm_register_el_change_hook arm_register_el_change_hook_aarch64eb
|
||||
#define arm_reset_cpu arm_reset_cpu_aarch64eb
|
||||
#define arm_set_cpu_off arm_set_cpu_off_aarch64eb
|
||||
#define arm_set_cpu_on arm_set_cpu_on_aarch64eb
|
||||
#define gen_a64_set_pc_im gen_a64_set_pc_im_aarch64eb
|
||||
#define helper_crc32_64 helper_crc32_64_aarch64eb
|
||||
#define helper_crc32c_64 helper_crc32c_64_aarch64eb
|
||||
|
|
|
@ -3424,4 +3424,7 @@
|
|||
#define arm_regime_tbi0 arm_regime_tbi0_arm
|
||||
#define arm_regime_tbi1 arm_regime_tbi1_arm
|
||||
#define arm_register_el_change_hook arm_register_el_change_hook_arm
|
||||
#define arm_reset_cpu arm_reset_cpu_arm
|
||||
#define arm_set_cpu_off arm_set_cpu_off_arm
|
||||
#define arm_set_cpu_on arm_set_cpu_on_arm
|
||||
#endif
|
||||
|
|
|
@ -3424,4 +3424,7 @@
|
|||
#define arm_regime_tbi0 arm_regime_tbi0_armeb
|
||||
#define arm_regime_tbi1 arm_regime_tbi1_armeb
|
||||
#define arm_register_el_change_hook arm_register_el_change_hook_armeb
|
||||
#define arm_reset_cpu arm_reset_cpu_armeb
|
||||
#define arm_set_cpu_off arm_set_cpu_off_armeb
|
||||
#define arm_set_cpu_on arm_set_cpu_on_armeb
|
||||
#endif
|
||||
|
|
|
@ -3433,6 +3433,9 @@ arm_symbols = (
|
|||
'arm_regime_tbi0',
|
||||
'arm_regime_tbi1',
|
||||
'arm_register_el_change_hook',
|
||||
'arm_reset_cpu',
|
||||
'arm_set_cpu_off',
|
||||
'arm_set_cpu_on',
|
||||
)
|
||||
|
||||
aarch64_symbols = (
|
||||
|
@ -3446,6 +3449,9 @@ aarch64_symbols = (
|
|||
'arm_regime_tbi0',
|
||||
'arm_regime_tbi1',
|
||||
'arm_register_el_change_hook',
|
||||
'arm_reset_cpu',
|
||||
'arm_set_cpu_off',
|
||||
'arm_set_cpu_on',
|
||||
'gen_a64_set_pc_im',
|
||||
'helper_crc32_64',
|
||||
'helper_crc32c_64',
|
||||
|
|
|
@ -4,3 +4,4 @@ obj-$(CONFIG_SOFTMMU) += psci.o
|
|||
obj-$(TARGET_AARCH64) += cpu64.o translate-a64.o helper-a64.o unicorn_aarch64.o
|
||||
obj-$(TARGET_ARM) += unicorn_arm.o
|
||||
obj-y += crypto_helper.o
|
||||
obj-y += arm-powerctl.o
|
||||
|
|
234
qemu/target/arm/arm-powerctl.c
Normal file
234
qemu/target/arm/arm-powerctl.c
Normal file
|
@ -0,0 +1,234 @@
|
|||
/*
|
||||
* QEMU support -- ARM Power Control specific functions.
|
||||
*
|
||||
* Copyright (c) 2016 Jean-Christophe Dubois
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/log.h"
|
||||
#include "cpu.h"
|
||||
#include "cpu-qom.h"
|
||||
#include "internals.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "arm-powerctl.h"
|
||||
#include "uc_priv.h"
|
||||
|
||||
#ifndef DEBUG_ARM_POWERCTL
|
||||
#define DEBUG_ARM_POWERCTL 0
|
||||
#endif
|
||||
|
||||
#define DPRINTF(fmt, args...) \
|
||||
do { \
|
||||
if (DEBUG_ARM_POWERCTL) { \
|
||||
fprintf(stderr, "[ARM]%s: " fmt , __func__, ##args); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Unicorn: commented out
|
||||
#if 0
|
||||
CPUState *arm_get_cpu_by_id(uint64_t id)
|
||||
{
|
||||
CPUState *cpu;
|
||||
|
||||
DPRINTF("cpu %" PRId64 "\n", id);
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
ARMCPU *armcpu = ARM_CPU(cpu);
|
||||
|
||||
if (armcpu->mp_affinity == id) {
|
||||
return cpu;
|
||||
}
|
||||
}
|
||||
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"[ARM]%s: Requesting unknown CPU %" PRId64 "\n",
|
||||
__func__, id);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
int arm_set_cpu_on(struct uc_struct *uc,
|
||||
uint64_t cpuid, uint64_t entry, uint64_t context_id,
|
||||
uint32_t target_el, bool target_aa64)
|
||||
{
|
||||
CPUState *target_cpu_state = uc->cpu;
|
||||
ARMCPU *target_cpu;
|
||||
|
||||
DPRINTF("cpu %" PRId64 " (EL %d, %s) @ 0x%" PRIx64 " with R0 = 0x%" PRIx64
|
||||
"\n", cpuid, target_el, target_aa64 ? "aarch64" : "aarch32", entry,
|
||||
context_id);
|
||||
|
||||
/* requested EL level need to be in the 1 to 3 range */
|
||||
assert((target_el > 0) && (target_el < 4));
|
||||
|
||||
if (target_aa64 && (entry & 3)) {
|
||||
/*
|
||||
* if we are booting in AArch64 mode then "entry" needs to be 4 bytes
|
||||
* aligned.
|
||||
*/
|
||||
return QEMU_ARM_POWERCTL_INVALID_PARAM;
|
||||
}
|
||||
|
||||
/* Retrieve the cpu we are powering up */
|
||||
// Unicorn: commented out
|
||||
//target_cpu_state = arm_get_cpu_by_id(cpuid);
|
||||
if (!target_cpu_state) {
|
||||
/* The cpu was not found */
|
||||
return QEMU_ARM_POWERCTL_INVALID_PARAM;
|
||||
}
|
||||
|
||||
target_cpu = ARM_CPU(uc, target_cpu_state);
|
||||
if (!target_cpu->powered_off) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"[ARM]%s: CPU %" PRId64 " is already on\n",
|
||||
__func__, cpuid);
|
||||
return QEMU_ARM_POWERCTL_ALREADY_ON;
|
||||
}
|
||||
|
||||
/*
|
||||
* The newly brought CPU is requested to enter the exception level
|
||||
* "target_el" and be in the requested mode (AArch64 or AArch32).
|
||||
*/
|
||||
|
||||
if (((target_el == 3) && !arm_feature(&target_cpu->env, ARM_FEATURE_EL3)) ||
|
||||
((target_el == 2) && !arm_feature(&target_cpu->env, ARM_FEATURE_EL2))) {
|
||||
/*
|
||||
* The CPU does not support requested level
|
||||
*/
|
||||
return QEMU_ARM_POWERCTL_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (!target_aa64 && arm_feature(&target_cpu->env, ARM_FEATURE_AARCH64)) {
|
||||
/*
|
||||
* For now we don't support booting an AArch64 CPU in AArch32 mode
|
||||
* TODO: We should add this support later
|
||||
*/
|
||||
qemu_log_mask(LOG_UNIMP,
|
||||
"[ARM]%s: Starting AArch64 CPU %" PRId64
|
||||
" in AArch32 mode is not supported yet\n",
|
||||
__func__, cpuid);
|
||||
return QEMU_ARM_POWERCTL_INVALID_PARAM;
|
||||
}
|
||||
|
||||
/* Initialize the cpu we are turning on */
|
||||
cpu_reset(target_cpu_state);
|
||||
target_cpu->powered_off = false;
|
||||
target_cpu_state->halted = 0;
|
||||
|
||||
if (target_aa64) {
|
||||
if ((target_el < 3) && arm_feature(&target_cpu->env, ARM_FEATURE_EL3)) {
|
||||
/*
|
||||
* As target mode is AArch64, we need to set lower
|
||||
* exception level (the requested level 2) to AArch64
|
||||
*/
|
||||
target_cpu->env.cp15.scr_el3 |= SCR_RW;
|
||||
}
|
||||
|
||||
if ((target_el < 2) && arm_feature(&target_cpu->env, ARM_FEATURE_EL2)) {
|
||||
/*
|
||||
* As target mode is AArch64, we need to set lower
|
||||
* exception level (the requested level 1) to AArch64
|
||||
*/
|
||||
target_cpu->env.cp15.hcr_el2 |= HCR_RW;
|
||||
}
|
||||
|
||||
target_cpu->env.pstate = aarch64_pstate_mode(target_el, true);
|
||||
} else {
|
||||
/* We are requested to boot in AArch32 mode */
|
||||
static uint32_t mode_for_el[] = { 0,
|
||||
ARM_CPU_MODE_SVC,
|
||||
ARM_CPU_MODE_HYP,
|
||||
ARM_CPU_MODE_SVC };
|
||||
|
||||
cpsr_write(&target_cpu->env, mode_for_el[target_el], CPSR_M,
|
||||
CPSRWriteRaw);
|
||||
}
|
||||
|
||||
if (target_el == 3) {
|
||||
/* Processor is in secure mode */
|
||||
target_cpu->env.cp15.scr_el3 &= ~SCR_NS;
|
||||
} else {
|
||||
/* Processor is not in secure mode */
|
||||
target_cpu->env.cp15.scr_el3 |= SCR_NS;
|
||||
}
|
||||
|
||||
/* We check if the started CPU is now at the correct level */
|
||||
assert(target_el == arm_current_el(&target_cpu->env));
|
||||
|
||||
if (target_aa64) {
|
||||
target_cpu->env.xregs[0] = context_id;
|
||||
target_cpu->env.thumb = false;
|
||||
} else {
|
||||
target_cpu->env.regs[0] = context_id;
|
||||
target_cpu->env.thumb = entry & 1;
|
||||
entry &= 0xfffffffe;
|
||||
}
|
||||
|
||||
/* Start the new CPU at the requested address */
|
||||
cpu_set_pc(target_cpu_state, entry);
|
||||
|
||||
/* We are good to go */
|
||||
return QEMU_ARM_POWERCTL_RET_SUCCESS;
|
||||
}
|
||||
|
||||
int arm_set_cpu_off(struct uc_struct *uc, uint64_t cpuid)
|
||||
{
|
||||
CPUState *target_cpu_state = uc->cpu;
|
||||
ARMCPU *target_cpu;
|
||||
|
||||
DPRINTF("cpu %" PRId64 "\n", cpuid);
|
||||
|
||||
/* change to the cpu we are powering up */
|
||||
// Unicorn: commented out
|
||||
//target_cpu_state = arm_get_cpu_by_id(cpuid);
|
||||
if (!target_cpu_state) {
|
||||
return QEMU_ARM_POWERCTL_INVALID_PARAM;
|
||||
}
|
||||
target_cpu = ARM_CPU(uc, target_cpu_state);
|
||||
if (target_cpu->powered_off) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"[ARM]%s: CPU %" PRId64 " is already off\n",
|
||||
__func__, cpuid);
|
||||
return QEMU_ARM_POWERCTL_IS_OFF;
|
||||
}
|
||||
|
||||
target_cpu->powered_off = true;
|
||||
target_cpu_state->halted = 1;
|
||||
target_cpu_state->exception_index = EXCP_HLT;
|
||||
cpu_loop_exit(target_cpu_state);
|
||||
/* notreached */
|
||||
|
||||
return QEMU_ARM_POWERCTL_RET_SUCCESS;
|
||||
}
|
||||
|
||||
int arm_reset_cpu(struct uc_struct *uc, uint64_t cpuid)
|
||||
{
|
||||
CPUState *target_cpu_state = uc->cpu;
|
||||
ARMCPU *target_cpu;
|
||||
|
||||
DPRINTF("cpu %" PRId64 "\n", cpuid);
|
||||
|
||||
/* change to the cpu we are resetting */
|
||||
// Unicorn: commented out
|
||||
//target_cpu_state = arm_get_cpu_by_id(cpuid);
|
||||
if (!target_cpu_state) {
|
||||
return QEMU_ARM_POWERCTL_INVALID_PARAM;
|
||||
}
|
||||
target_cpu = ARM_CPU(uc, target_cpu_state);
|
||||
if (target_cpu->powered_off) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"[ARM]%s: CPU %" PRId64 " is off\n",
|
||||
__func__, cpuid);
|
||||
return QEMU_ARM_POWERCTL_IS_OFF;
|
||||
}
|
||||
|
||||
/* Reset the cpu */
|
||||
cpu_reset(target_cpu_state);
|
||||
|
||||
return QEMU_ARM_POWERCTL_RET_SUCCESS;
|
||||
}
|
79
qemu/target/arm/arm-powerctl.h
Normal file
79
qemu/target/arm/arm-powerctl.h
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* QEMU support -- ARM Power Control specific functions.
|
||||
*
|
||||
* Copyright (c) 2016 Jean-Christophe Dubois
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef QEMU_ARM_POWERCTL_H
|
||||
#define QEMU_ARM_POWERCTL_H
|
||||
|
||||
#include "kvm-consts.h"
|
||||
|
||||
#define QEMU_ARM_POWERCTL_RET_SUCCESS QEMU_PSCI_RET_SUCCESS
|
||||
#define QEMU_ARM_POWERCTL_INVALID_PARAM QEMU_PSCI_RET_INVALID_PARAMS
|
||||
#define QEMU_ARM_POWERCTL_ALREADY_ON QEMU_PSCI_RET_ALREADY_ON
|
||||
#define QEMU_ARM_POWERCTL_IS_OFF QEMU_PSCI_RET_DENIED
|
||||
|
||||
// Unicorn: Commented out
|
||||
#if 0
|
||||
/*
|
||||
* arm_get_cpu_by_id:
|
||||
* @cpuid: the id of the CPU we want to retrieve the state
|
||||
*
|
||||
* Retrieve a CPUState object from its CPU ID provided in @cpuid.
|
||||
*
|
||||
* Returns: a pointer to the CPUState structure of the requested CPU.
|
||||
*/
|
||||
CPUState *arm_get_cpu_by_id(uint64_t cpuid);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* arm_set_cpu_on:
|
||||
* @cpuid: the id of the CPU we want to start/wake up.
|
||||
* @entry: the address the CPU shall start from.
|
||||
* @context_id: the value to put in r0/x0.
|
||||
* @target_el: The desired exception level.
|
||||
* @target_aa64: 1 if the requested mode is AArch64. 0 otherwise.
|
||||
*
|
||||
* Start the cpu designated by @cpuid in @target_el exception level. The mode
|
||||
* shall be AArch64 if @target_aa64 is set to 1. Otherwise the mode is
|
||||
* AArch32. The CPU shall start at @entry with @context_id in r0/x0.
|
||||
*
|
||||
* Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success.
|
||||
* QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided.
|
||||
* QEMU_ARM_POWERCTL_ALREADY_ON if the CPU was already started.
|
||||
*/
|
||||
int arm_set_cpu_on(struct uc_struct *uc,
|
||||
uint64_t cpuid, uint64_t entry, uint64_t context_id,
|
||||
uint32_t target_el, bool target_aa64);
|
||||
|
||||
/*
|
||||
* arm_set_cpu_off:
|
||||
* @cpuid: the id of the CPU we want to stop/shut down.
|
||||
*
|
||||
* Stop the cpu designated by @cpuid.
|
||||
*
|
||||
* Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success.
|
||||
* QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided.
|
||||
* QEMU_ARM_POWERCTL_IS_OFF if CPU is already off
|
||||
*/
|
||||
|
||||
int arm_set_cpu_off(struct uc_struct *uc, uint64_t cpuid);
|
||||
|
||||
/*
|
||||
* arm_reset_cpu:
|
||||
* @cpuid: the id of the CPU we want to reset.
|
||||
*
|
||||
* Reset the cpu designated by @cpuid.
|
||||
*
|
||||
* Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success.
|
||||
* QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided.
|
||||
* QEMU_ARM_POWERCTL_IS_OFF if CPU is off
|
||||
*/
|
||||
int arm_reset_cpu(struct uc_struct *uc, uint64_t cpuid);
|
||||
|
||||
#endif
|
|
@ -23,6 +23,7 @@
|
|||
#include "sysemu/sysemu.h"
|
||||
#include "internals.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "arm-powerctl.h"
|
||||
|
||||
bool arm_is_psci_call(ARMCPU *cpu, int excp_type)
|
||||
{
|
||||
|
@ -84,7 +85,6 @@ void arm_handle_psci_call(ARMCPU *cpu)
|
|||
* Additional information about the calling convention used is available in
|
||||
* the document 'SMC Calling Convention' (ARM DEN 0028)
|
||||
*/
|
||||
CPUState *cs = CPU(cpu);
|
||||
CPUARMState *env = &cpu->env;
|
||||
uint64_t param[4];
|
||||
uint64_t context_id, mpidr;
|
||||
|
@ -109,7 +109,6 @@ void arm_handle_psci_call(ARMCPU *cpu)
|
|||
switch (param[0]) {
|
||||
CPUState *target_cpu_state;
|
||||
ARMCPU *target_cpu;
|
||||
CPUClass *target_cpu_class;
|
||||
|
||||
case QEMU_PSCI_0_2_FN_PSCI_VERSION:
|
||||
ret = QEMU_PSCI_0_2_RET_VERSION_0_2;
|
||||
|
@ -154,51 +153,13 @@ void arm_handle_psci_call(ARMCPU *cpu)
|
|||
entry = param[2];
|
||||
context_id = param[3];
|
||||
|
||||
/* change to the cpu we are powering up */
|
||||
target_cpu_state = qemu_get_cpu(env->uc, mpidr & 0xff);
|
||||
if (!target_cpu_state) {
|
||||
ret = QEMU_PSCI_RET_INVALID_PARAMS;
|
||||
break;
|
||||
}
|
||||
target_cpu = ARM_CPU(env->uc, target_cpu_state);
|
||||
if (!target_cpu->powered_off) {
|
||||
ret = QEMU_PSCI_RET_ALREADY_ON;
|
||||
break;
|
||||
}
|
||||
target_cpu_class = CPU_GET_CLASS(env->uc, target_cpu);
|
||||
|
||||
/* Initialize the cpu we are turning on */
|
||||
cpu_reset(target_cpu_state);
|
||||
target_cpu->powered_off = false;
|
||||
target_cpu_state->halted = 0;
|
||||
|
||||
/*
|
||||
* The PSCI spec mandates that newly brought up CPUs enter the
|
||||
* exception level of the caller in the same execution mode as
|
||||
* the caller, with context_id in x0/r0, respectively.
|
||||
*
|
||||
* For now, it is sufficient to assert() that CPUs come out of
|
||||
* reset in the same mode as the calling CPU, since we only
|
||||
* implement EL1, which means that
|
||||
* (a) there is no EL2 for the calling CPU to trap into to change
|
||||
* its state
|
||||
* (b) the newly brought up CPU enters EL1 immediately after coming
|
||||
* out of reset in the default state
|
||||
*/
|
||||
assert(is_a64(env) == is_a64(&target_cpu->env));
|
||||
if (is_a64(env)) {
|
||||
if (entry & 1) {
|
||||
ret = QEMU_PSCI_RET_INVALID_PARAMS;
|
||||
break;
|
||||
}
|
||||
target_cpu->env.xregs[0] = context_id;
|
||||
} else {
|
||||
target_cpu->env.regs[0] = context_id;
|
||||
target_cpu->env.thumb = entry & 1;
|
||||
}
|
||||
target_cpu_class->set_pc(target_cpu_state, entry);
|
||||
|
||||
ret = 0;
|
||||
ret = arm_set_cpu_on(env->uc, mpidr, entry, context_id, arm_current_el(env),
|
||||
is_a64(env));
|
||||
break;
|
||||
case QEMU_PSCI_0_1_FN_CPU_OFF:
|
||||
case QEMU_PSCI_0_2_FN_CPU_OFF:
|
||||
|
@ -236,9 +197,8 @@ err:
|
|||
return;
|
||||
|
||||
cpu_off:
|
||||
cpu->powered_off = true;
|
||||
cs->halted = 1;
|
||||
cs->exception_index = EXCP_HLT;
|
||||
cpu_loop_exit(cs);
|
||||
ret = arm_set_cpu_off(env->uc, cpu->mp_affinity);
|
||||
/* notreached */
|
||||
/* sanity check in case something failed */
|
||||
assert(ret == QEMU_ARM_POWERCTL_RET_SUCCESS);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue