WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] xen: implement vector callback for evtchn delive

To: Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xen: implement vector callback for evtchn delivery
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Mon, 24 May 2010 19:59:42 +0100
Cc:
Delivery-date: Mon, 24 May 2010 12:01:39 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.1005181124100.11380@kaball-desktop>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acr2dpZbV+XiWzr6RryvkCqBlG69fQE/K3+5
Thread-topic: [Xen-devel] [PATCH] xen: implement vector callback for evtchn delivery
User-agent: Microsoft-Entourage/12.24.0.100205
Please add documentation to include/public/hvm/param.h about how to specify
the new callback method, and detect when it is available. Move the new
is_hvm_pv_blah macros out into an appropriate include/asm-x86 header file --
They are not arch independent.

 -- Keir

On 18/05/2010 11:31, "Stefano Stabellini" <Stefano.Stabellini@xxxxxxxxxxxxx>
wrote:

> Hi all,
> this patch implements the vector callback mechanism in Xen and it is based
> on Sheng's work so he should be considered the original author.
> 
> This update addresses Jan's comment about the test v->vcpu_id != 0 in
> hvm_assert_evtchn_irq.
> 
> Signed-off-by: Sheng Yang <sheng@xxxxxxxxxxxxxxx>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> 
> ---
> 
> 
> diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
> --- a/xen/arch/x86/hvm/irq.c
> +++ b/xen/arch/x86/hvm/irq.c
> @@ -185,16 +185,16 @@
>  
>  void hvm_assert_evtchn_irq(struct vcpu *v)
>  {
> -    if ( v->vcpu_id != 0 )
> -        return;
> -
>      if ( unlikely(in_irq() || !local_irq_is_enabled()) )
>      {
>          tasklet_schedule(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
>          return;
>      }
>  
> -    hvm_set_callback_irq_level(v);
> +    if ( is_hvm_pv_evtchn_vcpu(v) )
> +        vcpu_kick(v);
> +    else if ( v->vcpu_id == 0 )
> +        hvm_set_callback_irq_level(v);
>  }
>  
>  void hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq)
> @@ -251,7 +251,7 @@
>  
>      via_type = (uint8_t)(via >> 56) + 1;
>      if ( ((via_type == HVMIRQ_callback_gsi) && (via == 0)) ||
> -         (via_type > HVMIRQ_callback_pci_intx) )
> +         (via_type > HVMIRQ_callback_vector) )
>          via_type = HVMIRQ_callback_none;
>  
>      spin_lock(&d->arch.hvm_domain.irq_lock);
> @@ -297,6 +297,9 @@
>          if ( hvm_irq->callback_via_asserted )
>               __hvm_pci_intx_assert(d, pdev, pintx);
>          break;
> +    case HVMIRQ_callback_vector:
> +        hvm_irq->callback_via.vector = (uint8_t)via;
> +        break;
>      default:
>          break;
>      }
> @@ -312,6 +315,10 @@
>      case HVMIRQ_callback_pci_intx:
>          printk("PCI INTx Dev 0x%02x Int%c\n", pdev, 'A' + pintx);
>          break;
> +    case HVMIRQ_callback_vector:
> +        printk("Set HVMIRQ_callback_vector to %u\n",
> +               hvm_irq->callback_via.vector);
> +        break;
>      default:
>          printk("None\n");
>          break;
> @@ -323,6 +330,10 @@
>      struct hvm_domain *plat = &v->domain->arch.hvm_domain;
>      int vector;
>  
> +    if (plat->irq.callback_via_type == HVMIRQ_callback_vector &&
> +            vcpu_info(v, evtchn_upcall_pending))
> +        return hvm_intack_vector(plat->irq.callback_via.vector);
> + 
>      if ( unlikely(v->nmi_pending) )
>          return hvm_intack_nmi;
>  
> @@ -363,6 +374,8 @@
>      case hvm_intsrc_lapic:
>          if ( !vlapic_ack_pending_irq(v, intack.vector) )
>              intack = hvm_intack_none;
> +        break;
> +    case hvm_intsrc_vector:
>          break;
>      default:
>          intack = hvm_intack_none;
> diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c
> --- a/xen/arch/x86/hvm/vmx/intr.c
> +++ b/xen/arch/x86/hvm/vmx/intr.c
> @@ -164,7 +164,8 @@
>      {
>          HVMTRACE_2D(INJ_VIRQ, intack.vector, /*fake=*/ 0);
>          vmx_inject_extint(intack.vector);
> -        pt_intr_post(v, intack);
> +        if (intack.source != hvm_intsrc_vector)
> +             pt_intr_post(v, intack);
>      }
>  
>      /* Is there another IRQ to queue up behind this one? */
> diff --git a/xen/common/kernel.c b/xen/common/kernel.c
> --- a/xen/common/kernel.c
> +++ b/xen/common/kernel.c
> @@ -260,7 +260,10 @@
>                               (1U << XENFEAT_highmem_assist) |
>                               (1U << XENFEAT_gnttab_map_avail_bits);
>              else
> +            {
>                  fi.submap |= (1U << XENFEAT_hvm_safe_pvclock);
> +                fi.submap |= (1U << XENFEAT_hvm_callback_vector);
> +            }
>  #endif
>              break;
>          default:
> diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
> --- a/xen/include/asm-x86/hvm/hvm.h
> +++ b/xen/include/asm-x86/hvm/hvm.h
> @@ -33,7 +33,8 @@
>      hvm_intsrc_pic,
>      hvm_intsrc_lapic,
>      hvm_intsrc_nmi,
> -    hvm_intsrc_mce
> +    hvm_intsrc_mce,
> +    hvm_intsrc_vector
>  };
>  struct hvm_intack {
>      uint8_t source; /* enum hvm_intsrc */
> @@ -44,6 +45,7 @@
>  #define hvm_intack_lapic(vec) ( (struct hvm_intack) { hvm_intsrc_lapic, vec }
> )
>  #define hvm_intack_nmi        ( (struct hvm_intack) { hvm_intsrc_nmi,   2 } )
>  #define hvm_intack_mce        ( (struct hvm_intack) { hvm_intsrc_mce,   18 }
> )
> +#define hvm_intack_vector(vec)( (struct hvm_intack) { hvm_intsrc_vector, vec
> } )
>  enum hvm_intblk {
>      hvm_intblk_none,      /* not blocked (deliverable) */
>      hvm_intblk_shadow,    /* MOV-SS or STI shadow */
> diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
> --- a/xen/include/asm-x86/hvm/irq.h
> +++ b/xen/include/asm-x86/hvm/irq.h
> @@ -54,12 +54,14 @@
>          enum {
>              HVMIRQ_callback_none,
>              HVMIRQ_callback_gsi,
> -            HVMIRQ_callback_pci_intx
> +            HVMIRQ_callback_pci_intx,
> +            HVMIRQ_callback_vector
>          } callback_via_type;
>      };
>      union {
>          uint32_t gsi;
>          struct { uint8_t dev, intx; } pci;
> +        uint32_t vector;
>      } callback_via;
>  
>      /* Number of INTx wires asserting each PCI-ISA link. */
> diff --git a/xen/include/public/features.h b/xen/include/public/features.h
> --- a/xen/include/public/features.h
> +++ b/xen/include/public/features.h
> @@ -68,6 +68,9 @@
>   */
>  #define XENFEAT_gnttab_map_avail_bits      7
>  
> +/* x86: Does this Xen host support the HVM callback vector type? */
> +#define XENFEAT_hvm_callback_vector        8
> +
>  /* x86: pvclock algorithm is safe to use on HVM */
>  #define XENFEAT_hvm_safe_pvclock           9
>  
> diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
> --- a/xen/include/xen/sched.h
> +++ b/xen/include/xen/sched.h
> @@ -606,6 +606,9 @@
>  #define VM_ASSIST(_d,_t) (test_bit((_t), &(_d)->vm_assist))
>  
>  #define is_hvm_domain(d) ((d)->is_hvm)
> +#define is_hvm_pv_evtchn_domain(d) (is_hvm_domain(d) && \
> +     d->arch.hvm_domain.irq.callback_via_type == HVMIRQ_callback_vector)
> +#define is_hvm_pv_evtchn_vcpu(v) (is_hvm_pv_evtchn_domain(v->domain))
>  #define is_hvm_vcpu(v)   (is_hvm_domain(v->domain))
>  #define need_iommu(d)    ((d)->need_iommu)
>  
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel