arm: Handle SiP Service Calls
RFC 1/1 arm: Handle SiP Service Calls
Support ARM SiP (Silicon Provider) services.
- Import arm-smccc.h from Linux Kernel ca122fe376fc ("Merge tag 'arc-4.15-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc")
- Introudce a new callback function in platform_desc
- Add do_trap_hvccc to handle non xen specific hypercalls
Platforms that want to use SiP service could use platform specific sip implementation.
---
In my Dom0 kernel, there is SiP smccc call. Without xen, the call will trap to ATF. With xen, I use hvccc to replace smccc, but xen still report error, because xen does not handle SiP calls. Not sure this is the best way. Since SiP is silicon provider service, so I put it into platform code.
xen/arch/arm/platform.c | 8 +++ xen/arch/arm/traps.c | 18 +++++- xen/include/asm-arm/arm-smccc.h | 137 ++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/platform.h | 3 + 4 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 xen/include/asm-arm/arm-smccc.h
xen/arch/arm/platform.c +8 -0
@@ -115,6 +115,14 @@ int __init platform_smp_init(void) }#endif +void platform_sip (struct cpu_user_regs *regs) +{ +if ( platform && platform->sip ) + platform->sip (regs); +else +domain_crash_synchronous (); +} +void platform_reset (void ) {if ( platform && platform->reset )
xen/arch/arm/traps.c +16 -2
@@ -35,6 +35,7 @@#include <xen/iocap.h> #include <public/sched.h> #include <public/xen.h> +#include <asm/arm-smccc.h> #include <asm/debugger.h> #include <asm/event.h> #include <asm/regs.h>
@@ -44,6 +45,7 @@#include <asm/cpufeature.h> #include <asm/flushtlb.h> #include <asm/monitor.h> +#include <asm/platform.h> #include "decode.h" #include "vtimer.h"
@@ -1453,10 +1455,12 @@ static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code)#define PSCI_RESULT_REG (reg) (reg)->x0#define PSCI_ARG (reg,n) (reg)->x##n#define PSCI_ARG32 (reg,n) (uint32_t)( (reg)->x##n & 0x00000000FFFFFFFF ) +#define HVCCC_ARG (reg,n) (reg)->x##n#else #define PSCI_RESULT_REG (reg) (reg)->r0#define PSCI_ARG (reg,n) (reg)->r##n#define PSCI_ARG32 (reg,n) PSCI_ARG(reg,n) +#define HVCCC_ARG (reg,n) (reg)->r##n#endif /* helper function for checking arm mode 32/64 bit */
@@ -1566,6 +1570,16 @@ static void do_trap_psci(struct cpu_user_regs *regs) } } +static void do_trap_hvccc (struct cpu_user_regs *regs) +{ +register_t fid =HVCCC_ARG (regs,0 ); + +if (ARM_SMCCC_OWNER_NUM (fid) ==ARM_SMCCC_OWNER_SIP ) +return platform_sip (regs); + +return do_trap_psci (regs); +} +#ifdef CONFIG_ARM_64 #define HYPERCALL_RESULT_REG (r) (r)->x0#define HYPERCALL_ARG1 (r) (r)->x0
@@ -2884,7 +2898,7 @@ asmlinkage void do_trap_guest_sync(struct cpu_user_regs *regs)return do_debug_trap (regs, hsr.iss &0x00ff );#endif if ( hsr.iss ==0 ) -return do_trap_psci (regs); +return do_trap_hvccc (regs);do_trap_hypercall (regs, (register_t *)®s->r12, hsr.iss);break ;#ifdef CONFIG_ARM_64
@@ -2896,7 +2910,7 @@ asmlinkage void do_trap_guest_sync(struct cpu_user_regs *regs)return do_debug_trap (regs, hsr.iss &0x00ff );#endif if ( hsr.iss ==0 ) -return do_trap_psci (regs); +return do_trap_hvccc (regs);do_trap_hypercall (regs, ®s->x16, hsr.iss);break ;case HSR_EC_SMC64 :
xen/include/asm-arm/arm-smccc.h new file +137 -0
137 lines not on this page · raw message
xen/include/asm-arm/platform.h +3 -0
@@ -26,6 +26,8 @@ struct platform_desc {void (*reset)(void );/* Platform power-off */ void (*poweroff)(void ); +/* Platform SIP service */ +void (*sip)(struct cpu_user_regs *regs);/* * Platform quirks * Defined has a function because a platform can support multiple
@@ -53,6 +55,7 @@ int __init platform_specific_mapping(struct domain *d);int platform_smp_init (void );int platform_cpu_up (int cpu);#endif +void platform_sip (struct cpu_user_regs *regs);void platform_reset (void );void platform_poweroff (void );bool_t platform_has_quirk (uint32_t quirk);
Signature · 7 lines
2.14.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hello,
Quoted 9 lines · Peng Fan
Support ARM SiP (Silicon Provider) services.
- Importarm-smccc.hfrom Linux Kernelca122fe376fc ("Merge tag 'arc-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc")- Introudce a new callback function in
platform_desc
- Adddo_trap_hvcccto handle non xen specific hypercallsPlatforms that want to use SiP service could use platform specific sip implementation.
It looks like to me that this patch is based on an older version of Xen. 3 months ago, a framework to support SMC Calling Convention for guest was added.
In general, patch sent upstream should be based on latest Xen. So please rebase your code.
Quoted 9 lines
Signed-off-by Peng Fan <[email protected]>---
In my Dom0 kernel, there is SiP smccc call. Without xen, the call will trap to ATF. With xen, I use hvccc to replace smccc, but xen still report error, because xen does not handle SiP calls. Not sure this is the best way. Since SiP is silicon provider service, so I put it into platform code.
When I see a new callback added, I would expect to see a user in the series. So what is the expected behavior of this callback? Who is going to be allowed to access to the SiP services?
Guessing from your description, the callback would just be implemented as "forward SiP call". In that case, I don't see a reason to have a callback implemented.
However, you would need to know whether the platform support SMCCC. How do you recognize that on yours?
Now the next question, is it safe to let the hardware domain to access all SiP service? Can you explain the kind of service present in SiP for your platform?
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel