From: Julien Grall <julien.grall@arm.com>
To: Tamas K Lengyel <tamas@tklengyel.com>, xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Razvan Cojocaru <rcojocaru@bitdefender.com>
Subject: Re: [PATCH v3 3/9] monitor: ARM SMC events
Date: Mon, 16 May 2016 10:56:35 +0100 [thread overview]
Message-ID: <57399953.3070505@arm.com> (raw)
In-Reply-To: <1462373480-20206-3-git-send-email-tamas@tklengyel.com>
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@tklengyel.com>
> ---
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Julien Grall <julien.grall@arm.com>
> Cc: Razvan Cojocaru <rcojocaru@bitdefender.com>
>
> 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@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-05-16 9:56 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-04 14:51 [PATCH v3 1/9] monitor: Rename vm_event_monitor_get_capabilities Tamas K Lengyel
2016-05-04 14:51 ` [PATCH v3 2/9] monitor: Don't call vm_event_fill_regs from common Tamas K Lengyel
2016-05-05 9:34 ` Razvan Cojocaru
2016-05-16 9:48 ` Julien Grall
2016-05-27 18:58 ` Tamas K Lengyel
2016-05-04 14:51 ` [PATCH v3 3/9] monitor: ARM SMC events Tamas K Lengyel
2016-05-05 9:36 ` Razvan Cojocaru
2016-05-16 9:56 ` Julien Grall [this message]
2016-05-04 14:51 ` [PATCH v3 4/9] arm/vm_event: get/set registers Tamas K Lengyel
2016-05-16 10:14 ` Julien Grall
2016-05-16 15:37 ` Tamas K Lengyel
2016-05-16 15:58 ` Julien Grall
2016-05-16 16:26 ` Tamas K Lengyel
2016-05-16 17:18 ` Julien Grall
2016-05-04 14:51 ` [PATCH v3 5/9] tools/libxc: add xc_monitor_privileged_call Tamas K Lengyel
2016-05-04 20:08 ` Konrad Rzeszutek Wilk
2016-05-04 22:12 ` Tamas K Lengyel
2016-05-04 14:51 ` [PATCH v3 6/9] tools/xen-access: add test-case for ARM SMC Tamas K Lengyel
2016-05-04 15:35 ` Jan Beulich
2016-05-04 17:16 ` Tamas K Lengyel
2016-05-04 17:33 ` Wei Liu
2016-05-04 17:42 ` Tamas K Lengyel
2016-05-05 16:25 ` Jan Beulich
[not found] ` <CABfawh=gWOs3AtsTdYaDj61ph2jumjX6Q=0uFVeahPH99DY9qg@mail.gmail.com>
[not found] ` <CABfawhknB62vZJFvcJv6VAGzw0toZUCXBHyEnzm99+N1ZLBYEg@mail.gmail.com>
2016-05-05 18:25 ` Tamas K Lengyel
2016-05-05 9:37 ` Razvan Cojocaru
2016-05-04 14:51 ` [PATCH v3 7/9] x86/hvm: Rename hvm/event to hvm/monitor Tamas K Lengyel
2016-05-05 9:39 ` Razvan Cojocaru
2016-05-04 14:51 ` [PATCH v3 8/9] x86/hvm: Add debug exception vm_events Tamas K Lengyel
2016-05-05 9:56 ` Razvan Cojocaru
2016-05-04 14:51 ` [PATCH v3 9/9] MAINTAINERS: Update monitor/vm_event covered code Tamas K Lengyel
2016-05-05 9:53 ` Razvan Cojocaru
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57399953.3070505@arm.com \
--to=julien.grall@arm.com \
--cc=rcojocaru@bitdefender.com \
--cc=sstabellini@kernel.org \
--cc=tamas@tklengyel.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).