[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 3/9] monitor: ARM SMC events
Hi Tamas, On 04/05/16 15:51, Tamas K Lengyel wrote: Add support for monitoring ARM SMC events. This patch only adds the required bits to enable/disable monitoring and forwarding the event through vm_event. Signed-off-by: Tamas K Lengyel <tamas@xxxxxxxxxxxxx> --- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx> Cc: Julien Grall <julien.grall@xxxxxxx> Cc: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx> v3: Split parts off as separate patches Union for arm32/64 register structs in vm_event Cosmetic fixes --- xen/arch/arm/monitor.c | 49 +++++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/traps.c | 16 ++++++++++++-- xen/include/asm-arm/domain.h | 5 +++++ xen/include/asm-arm/monitor.h | 24 ++++++--------------- xen/include/public/domctl.h | 1 + xen/include/public/vm_event.h | 2 ++ 6 files changed, 77 insertions(+), 20 deletions(-) diff --git a/xen/arch/arm/monitor.c b/xen/arch/arm/monitor.c index f957257..9c481ac 100644 --- a/xen/arch/arm/monitor.c +++ b/xen/arch/arm/monitor.c @@ -22,6 +22,55 @@ #include <asm/vm_event.h> #include <public/vm_event.h> +int arch_monitor_domctl_event(struct domain *d, + struct xen_domctl_monitor_op *mop) +{ + struct arch_domain *ad = &d->arch; + bool_t requested_status = (XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op); + + switch ( mop->event ) + { + case XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL: + { + bool_t old_status = ad->monitor.privileged_call_enabled; + + if ( unlikely(old_status == requested_status) ) + return -EEXIST; + + domain_pause(d); + ad->monitor.privileged_call_enabled = requested_status; + domain_unpause(d); + break; + } + + default: + /* + * Should not be reached unless arch_monitor_get_capabilities() is + * not properly implemented. + */ + ASSERT_UNREACHABLE(); + return -EOPNOTSUPP; + } + + return 0; +} + +bool_t monitor_smc(const struct cpu_user_regs *regs) { Coding style, the brace should be on a separate line. + struct vcpu *curr = current; + vm_event_request_t req = { 0 }; + + if ( !curr->domain->arch.monitor.privileged_call_enabled ) + return 0; + + req.reason = VM_EVENT_REASON_PRIVILEGED_CALL; + req.vcpu_id = curr->vcpu_id; + + if ( vm_event_monitor_traps(curr, 1, &req) <= 0 ) + return 0; + else + return 1; +} + void monitor_guest_request(void) { struct vcpu *curr = current; diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 9abfc3c..f26e12e 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -41,6 +41,7 @@ #include <asm/mmio.h> #include <asm/cpufeature.h> #include <asm/flushtlb.h> +#include <asm/monitor.h> #include "decode.h" #include "vtimer.h" @@ -2491,6 +2492,17 @@ bad_data_abort: inject_dabt_exception(regs, info.gva, hsr.len); } +static void do_trap_smc(struct cpu_user_regs *regs, const union hsr hsr) +{ + bool_t handled = 0; + + if ( current->domain->arch.monitor.privileged_call_enabled ) + handled = monitor_smc(regs); + + if ( handled != 1 ) handled is a boolean. So if ( !handled ) Regards, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |