xcp-1.6-updates/xen-4.1.hg

changeset 23273:b574b8b6bb10

xen: introduce PHYSDEVOP_pirq_eoi_gmfn_v2

PHYSDEVOP_pirq_eoi_gmfn changes the semantics of PHYSDEVOP_eoi.
In order to improve the interface this patch:

- renames PHYSDEVOP_pirq_eoi_gmfn to PHYSDEVOP_pirq_eoi_gmfn_v1;

- introduces PHYSDEVOP_pirq_eoi_gmfn_v2, that is like
PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't modify the behaviour of
another hypercall;

- #define PHYSDEVOP_pirq_eoi_gmfn to PHYSDEVOP_pirq_eoi_gmfn_v1

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 24616:3bd3949854ef
xen-unstable date: Sat Jan 28 13:45:13 2012 +0000
author Stefano Stabellini <stefano.stabellini@eu.citrix.com>
date Fri Mar 30 17:19:18 2012 +0100 (2012-03-30)
parents 54b4ae0dfb60
children 98dbb195d270
files xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/hypercall.c xen/arch/x86/domain.c xen/arch/x86/physdev.c xen/include/asm-ia64/domain.h xen/include/asm-x86/domain.h xen/include/public/physdev.h
line diff
     1.1 --- a/xen/arch/ia64/xen/domain.c	Thu Mar 29 17:31:49 2012 +0100
     1.2 +++ b/xen/arch/ia64/xen/domain.c	Fri Mar 30 17:19:18 2012 +0100
     1.3 @@ -1729,6 +1729,7 @@ int domain_relinquish_resources(struct d
     1.4  		if (d->arch.pirq_eoi_map != NULL) {
     1.5  			put_page(virt_to_page(d->arch.pirq_eoi_map));
     1.6  			d->arch.pirq_eoi_map = NULL;
     1.7 +			d->arch.auto_unmask = 0;
     1.8  		}
     1.9  
    1.10  		/* Tear down shadow mode stuff. */
     2.1 --- a/xen/arch/ia64/xen/hypercall.c	Thu Mar 29 17:31:49 2012 +0100
     2.2 +++ b/xen/arch/ia64/xen/hypercall.c	Fri Mar 30 17:19:18 2012 +0100
     2.3 @@ -65,7 +65,7 @@ static long __do_pirq_guest_eoi(struct d
     2.4  {
     2.5  	if ( pirq < 0 || pirq >= NR_IRQS )
     2.6  		return -EINVAL;
     2.7 -	if ( d->arch.pirq_eoi_map )
     2.8 +	if ( d->arch.auto_unmask ) {
     2.9  		evtchn_unmask(d->pirq_to_evtchn[pirq]);
    2.10  	return pirq_guest_eoi(d, pirq);
    2.11  }
    2.12 @@ -504,7 +504,8 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
    2.13          break;
    2.14      }
    2.15  
    2.16 -    case PHYSDEVOP_pirq_eoi_gmfn: {
    2.17 +    case PHYSDEVOP_pirq_eoi_gmfn_v1:
    2.18 +    case PHYSDEVOP_pirq_eoi_gmfn_v2: {
    2.19          struct physdev_pirq_eoi_gmfn info;
    2.20          unsigned long mfn;
    2.21  
    2.22 @@ -527,6 +528,8 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
    2.23          }
    2.24  
    2.25          current->domain->arch.pirq_eoi_map = mfn_to_virt(mfn);
    2.26 +        if ( cmd == PHYSDEVOP_pirq_eoi_gmfn_v1 )
    2.27 +            current->domain->arch.auto_unmask = 1;
    2.28          ret = 0;
    2.29          break;
    2.30      }
     3.1 --- a/xen/arch/x86/domain.c	Thu Mar 29 17:31:49 2012 +0100
     3.2 +++ b/xen/arch/x86/domain.c	Fri Mar 30 17:19:18 2012 +0100
     3.3 @@ -1981,6 +1981,7 @@ int domain_relinquish_resources(struct d
     3.4              unmap_domain_page_global(d->arch.pirq_eoi_map);
     3.5              put_page_and_type(mfn_to_page(d->arch.pirq_eoi_map_mfn));
     3.6              d->arch.pirq_eoi_map = NULL;
     3.7 +            d->arch.auto_unmask = 0;
     3.8          }
     3.9  
    3.10          d->arch.relmem = RELMEM_xen;
     4.1 --- a/xen/arch/x86/physdev.c	Thu Mar 29 17:31:49 2012 +0100
     4.2 +++ b/xen/arch/x86/physdev.c	Fri Mar 30 17:19:18 2012 +0100
     4.3 @@ -271,7 +271,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
     4.4          ret = -EINVAL;
     4.5          if ( eoi.irq >= v->domain->nr_pirqs )
     4.6              break;
     4.7 -        if ( v->domain->arch.pirq_eoi_map )
     4.8 +        if ( v->domain->arch.auto_unmask )
     4.9              evtchn_unmask(v->domain->pirq_to_evtchn[eoi.irq]);
    4.10          if ( !is_hvm_domain(v->domain) ||
    4.11               domain_pirq_to_irq(v->domain, eoi.irq) > 0 )
    4.12 @@ -295,7 +295,8 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
    4.13          break;
    4.14      }
    4.15  
    4.16 -    case PHYSDEVOP_pirq_eoi_gmfn: {
    4.17 +    case PHYSDEVOP_pirq_eoi_gmfn_v2:
    4.18 +    case PHYSDEVOP_pirq_eoi_gmfn_v1: {
    4.19          struct physdev_pirq_eoi_gmfn info;
    4.20          unsigned long mfn;
    4.21  
    4.22 @@ -325,6 +326,8 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
    4.23              ret = -ENOSPC;
    4.24              break;
    4.25          }
    4.26 +        if ( cmd == PHYSDEVOP_pirq_eoi_gmfn_v1 )
    4.27 +            v->domain->arch.auto_unmask = 1;
    4.28  
    4.29          ret = 0;
    4.30          break;
     5.1 --- a/xen/include/asm-ia64/domain.h	Thu Mar 29 17:31:49 2012 +0100
     5.2 +++ b/xen/include/asm-ia64/domain.h	Fri Mar 30 17:19:18 2012 +0100
     5.3 @@ -182,6 +182,9 @@ struct arch_domain {
     5.4      /* Shared page for notifying that explicit PIRQ EOI is required. */
     5.5      unsigned long *pirq_eoi_map;
     5.6      unsigned long pirq_eoi_map_mfn;
     5.7 +    /* set auto_unmask to 1 if you want PHYSDEVOP_eoi to automatically
     5.8 +     * unmask the event channel */
     5.9 +    bool_t auto_unmask;
    5.10  
    5.11      /* Address of efi_runtime_services_t (placed in domain memory)  */
    5.12      void *efi_runtime;
     6.1 --- a/xen/include/asm-x86/domain.h	Thu Mar 29 17:31:49 2012 +0100
     6.2 +++ b/xen/include/asm-x86/domain.h	Fri Mar 30 17:19:18 2012 +0100
     6.3 @@ -268,6 +268,9 @@ struct arch_domain
     6.4      /* Shared page for notifying that explicit PIRQ EOI is required. */
     6.5      unsigned long *pirq_eoi_map;
     6.6      unsigned long pirq_eoi_map_mfn;
     6.7 +    /* set auto_unmask to 1 if you want PHYSDEVOP_eoi to automatically
     6.8 +     * unmask the event channel */
     6.9 +    bool_t auto_unmask;
    6.10  
    6.11      /* Pseudophysical e820 map (XENMEM_memory_map).  */
    6.12      spinlock_t e820_lock;
     7.1 --- a/xen/include/public/physdev.h	Thu Mar 29 17:31:49 2012 +0100
     7.2 +++ b/xen/include/public/physdev.h	Fri Mar 30 17:19:18 2012 +0100
     7.3 @@ -49,7 +49,15 @@ DEFINE_XEN_GUEST_HANDLE(physdev_eoi_t);
     7.4   * will automatically get unmasked. The page registered is used as a bit
     7.5   * array indexed by Xen's PIRQ value.
     7.6   */
     7.7 -#define PHYSDEVOP_pirq_eoi_gmfn         17
     7.8 +#define PHYSDEVOP_pirq_eoi_gmfn_v1       17
     7.9 +/*
    7.10 + * Register a shared page for the hypervisor to indicate whether the
    7.11 + * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to
    7.12 + * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of
    7.13 + * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by
    7.14 + * Xen's PIRQ value.
    7.15 + */
    7.16 +#define PHYSDEVOP_pirq_eoi_gmfn_v2       28
    7.17  struct physdev_pirq_eoi_gmfn {
    7.18      /* IN */
    7.19      xen_pfn_t gmfn;
    7.20 @@ -276,6 +284,8 @@ DEFINE_XEN_GUEST_HANDLE(physdev_get_free
    7.21  #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
    7.22  #define PHYSDEVOP_IRQ_SHARED             XENIRQSTAT_shared
    7.23  
    7.24 +#define PHYSDEVOP_pirq_eoi_gmfn PHYSDEVOP_pirq_eoi_gmfn_v1
    7.25 +
    7.26  #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
    7.27  
    7.28  /*