All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Corneliu ZUZU <czuzu@bitdefender.com>
Cc: Tamas K Lengyel <tamas@tklengyel.com>, Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Razvan Cojocaru <rcojocaru@bitdefender.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xen.org,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH] arm/monitor vm-events: Implement guest-request support
Date: Fri, 19 Feb 2016 13:49:54 +0000	[thread overview]
Message-ID: <alpine.DEB.2.02.1602191324120.17248@kaball.uk.xensource.com> (raw)
In-Reply-To: <1455824116-13783-1-git-send-email-czuzu@bitdefender.com>

On Thu, 18 Feb 2016, Corneliu ZUZU wrote:
> diff --git a/MAINTAINERS b/MAINTAINERS
> index cd4da04..768ad32 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -356,6 +356,7 @@ M:	Tamas K Lengyel <tamas@tklengyel.com>
>  S:	Supported
>  F:	xen/common/vm_event.c
>  F:	xen/common/mem_access.c
> +F:	xen/common/hvm/event.c
>  F:	xen/common/monitor.c
>  F:	xen/arch/x86/hvm/event.c
>  F:	xen/arch/x86/monitor.c

This needs an Ack from Tamas or Razvan



> diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c
> index 056db1a..767edd1 100644
> --- a/xen/arch/arm/hvm.c
> +++ b/xen/arch/arm/hvm.c
> @@ -22,6 +22,7 @@
>  #include <xen/errno.h>
>  #include <xen/guest_access.h>
>  #include <xen/sched.h>
> +#include <xen/hvm/event.h>
>  
>  #include <xsm/xsm.h>
>  
> @@ -72,6 +73,13 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
>          break;
>      }
>  
> +    case HVMOP_guest_request_vm_event:
> +        if ( guest_handle_is_null(arg) )
> +            hvm_event_guest_request();
> +        else
> +            rc = -EINVAL;
> +        break;
> +
>      default:
>      {
>          gdprintk(XENLOG_DEBUG, "HVMOP op=%lu: not implemented\n", op);
> diff --git a/xen/common/Makefile b/xen/common/Makefile
> index 0d76efe..703faa5 100644
> --- a/xen/common/Makefile
> +++ b/xen/common/Makefile
> @@ -67,7 +67,7 @@ obj-$(xenoprof)    += xenoprof.o
>  
>  obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall.o tmem_xen.o xlat.o)
>  
> -subdir-$(CONFIG_X86) += hvm
> +subdir-y += hvm
>  
>  subdir-$(coverage) += gcov
>  
> diff --git a/xen/common/hvm/Makefile b/xen/common/hvm/Makefile
> index a464a57..11e109d 100644
> --- a/xen/common/hvm/Makefile
> +++ b/xen/common/hvm/Makefile
> @@ -1 +1,2 @@
> -obj-y += save.o
> +obj-$(CONFIG_X86) += save.o
> +obj-y += event.o
> diff --git a/xen/common/hvm/event.c b/xen/common/hvm/event.c
> new file mode 100644
> index 0000000..28ceadc
> --- /dev/null
> +++ b/xen/common/hvm/event.c
> @@ -0,0 +1,96 @@
> +/*
> + * xen/common/hvm/event.c
> + *
> + * Common hardware virtual machine event abstractions.
> + *
> + * Copyright (c) 2004, Intel Corporation.
> + * Copyright (c) 2005, International Business Machines Corporation.
> + * Copyright (c) 2008, Citrix Systems, Inc.
> + * Copyright (c) 2016, Bitdefender S.R.L.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program; If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <xen/hvm/event.h>
> +#include <xen/vm_event.h>
> +#include <asm/hvm/event.h>
> +#if CONFIG_X86
> +#include <asm/altp2m.h>
> +#endif
> +
> +int hvm_event_traps(struct vcpu *v, uint8_t sync, vm_event_request_t *req)
> +{
> +    int rc;
> +    struct domain *d = v->domain;
> +
> +    rc = vm_event_claim_slot(d, &d->vm_event->monitor);
> +    switch ( rc )
> +    {
> +    case 0:
> +        break;
> +    case -ENOSYS:
> +        /*
> +         * If there was no ring to handle the event, then
> +         * simply continue executing normally.
> +         */
> +        return 1;
> +    default:
> +        return rc;
> +    };
> +
> +    if ( sync )
> +    {
> +        req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
> +        vm_event_vcpu_pause(v);
> +    }
> +
> +#if CONFIG_X86
> +    if ( altp2m_active(d) )

I would rather

#define altp2m_active(d) (0)

on ARM, removing the two ifdefs in this file.


> +    {
> +        req->flags |= VM_EVENT_FLAG_ALTERNATE_P2M;
> +        req->altp2m_idx = vcpu_altp2m(v).p2midx;
> +    }
> +#endif
> +
> +    arch_hvm_event_fill_regs(req);
> +
> +    vm_event_put_request(d, &d->vm_event->monitor, req);
> +
> +    return 1;
> +}
> +
> +void hvm_event_guest_request(void)
> +{
> +    struct vcpu *curr = current;
> +    struct domain *d = curr->domain;
> +
> +    if ( d->monitor.guest_request_enabled )
> +    {
> +        vm_event_request_t req = {
> +            .reason = VM_EVENT_REASON_GUEST_REQUEST,
> +            .vcpu_id = curr->vcpu_id,
> +        };
> +
> +        hvm_event_traps(curr, d->monitor.guest_request_sync, &req);
> +    }
> +}
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * tab-width: 4
> + * indent-tabs-mode: nil
> + * End:
> + */

  parent reply	other threads:[~2016-02-19 13:49 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 19:35 [PATCH] arm/monitor vm-events: Implement guest-request support Corneliu ZUZU
2016-02-18 20:08 ` Razvan Cojocaru
2016-02-18 21:25   ` Tamas K Lengyel
2016-02-19  5:44     ` Corneliu ZUZU
2016-02-19 13:49 ` Stefano Stabellini [this message]
2016-02-19 13:56   ` Razvan Cojocaru
2016-02-19 15:56   ` Corneliu ZUZU
2016-02-19 16:00     ` Stefano Stabellini
2016-02-19 16:05       ` Andrew Cooper
2016-02-19 16:10         ` Corneliu ZUZU
2016-02-19 17:47           ` Stefano Stabellini
2016-02-19 17:54             ` Tamas K Lengyel
2016-02-19 18:11               ` Corneliu ZUZU
2016-02-19 18:27                 ` Tamas K Lengyel
2016-02-19 18:33                   ` Corneliu ZUZU
2016-02-19 18:42                     ` Tamas K Lengyel
2016-02-19 20:46                       ` Corneliu ZUZU
2016-02-19 14:26 ` Jan Beulich
2016-02-19 16:02   ` Tamas K Lengyel
2016-02-19 16:35     ` Corneliu ZUZU
2016-02-19 16:25   ` Corneliu ZUZU
2016-02-19 17:15     ` Jan Beulich
2016-02-19 18:01       ` Corneliu ZUZU
2016-02-22 10:14         ` Jan Beulich
2016-02-22 11:26           ` Corneliu ZUZU
2016-02-22 11:38             ` Jan Beulich
2016-02-22 11:40               ` Razvan Cojocaru
2016-02-23  9:09 ` Corneliu ZUZU
2016-02-23 10:54   ` Razvan Cojocaru
2016-02-23 11:00     ` Corneliu ZUZU
2016-02-23 11:06       ` Razvan Cojocaru
2016-02-23 14:28         ` Tamas K Lengyel
2016-02-23 14:30   ` Tamas K Lengyel
2016-02-23 14:57     ` Corneliu ZUZU

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=alpine.DEB.2.02.1602191324120.17248@kaball.uk.xensource.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=czuzu@bitdefender.com \
    --cc=ian.campbell@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=rcojocaru@bitdefender.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tamas@tklengyel.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.