Skip to contentSkip to conversation

xen: implement vector callback for evtchn delivery

PATCH In review Stefano Stabellini 3 participants 9 messages May 18, 2010 – May 26, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: implement vector callback for evtchn delivery

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.

---

xen/arch/x86/hvm/irq.c +18 -5
@@ -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;
xen/arch/x86/hvm/vmx/intr.c +2 -1
@@ -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? */
xen/common/kernel.c +3 -0
@@ -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:
xen/include/asm-x86/hvm/hvm.h +3 -1
@@ -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 */
xen/include/asm-x86/hvm/irq.h +3 -1
@@ -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. */
xen/include/public/features.h +3 -0
@@ -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
 
xen/include/xen/sched.h +3 -0
@@ -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)
#1 lore raw

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

Quoted 188 lines · Stefano Stabellini

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.

---

xen/arch/x86/hvm/irq.c +18 -5
@@ -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;
xen/arch/x86/hvm/vmx/intr.c +2 -1
@@ -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? */
xen/common/kernel.c +3 -0
@@ -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:
xen/include/asm-x86/hvm/hvm.h +3 -1
@@ -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 */

xen/include/asm-x86/hvm/irq.h +3 -1
@@ -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. */
xen/include/public/features.h +3 -0
@@ -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
 
xen/include/xen/sched.h +3 -0
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 4 lines · Keir Fraser

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.

Done.

---

xen/arch/x86/hvm/irq.c +18 -5
diff -r 12c79a476007 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;
xen/arch/x86/hvm/vmx/intr.c +2 -1
diff -r 12c79a476007 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? */
xen/common/kernel.c +2 -1
diff -r 12c79a476007 xen/common/kernel.c
@@ -260,7 +260,8 @@
                              (1U << XENFEAT_highmem_assist) |
                              (1U << XENFEAT_gnttab_map_avail_bits);
             else
-                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock);
+                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) |
+                             (1U << XENFEAT_hvm_callback_vector);
 #endif
             break;
         default:
xen/include/asm-x86/domain.h +4 -0
diff -r 12c79a476007 xen/include/asm-x86/domain.h
@@ -18,6 +18,10 @@
 #define is_pv_32on64_domain(d) (0)
 #endif
 #define is_pv_32on64_vcpu(v)   (is_pv_32on64_domain((v)->domain))
+
+#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 VCPU_TRAP_NMI          1
 #define VCPU_TRAP_MCE          2
xen/include/asm-x86/hvm/hvm.h +3 -1
diff -r 12c79a476007 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 */
xen/include/asm-x86/hvm/irq.h +3 -1
diff -r 12c79a476007 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. */
xen/include/public/features.h +3 -0
diff -r 12c79a476007 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
 
xen/include/public/hvm/params.h +3 -0
diff -r 12c79a476007 xen/include/public/hvm/params.h
@@ -33,6 +33,9 @@
  * val[63:56] == 1: val[55:0] is a delivery PCI INTx line, as follows:
  *                  Domain = val[47:32], Bus  = val[31:16],
  *                  DevFn  = val[15: 8], IntX = val[ 1: 0]
+ * val[63:56] == 2: val[7:0] is a vector number, check for
+ *                  XENFEAT_hvm_callback_vector to know if this delivery
+ *                  method is available.
  * If val == 0 then CPU0 event-channel notifications are not delivered.
  */
 #define HVM_PARAM_CALLBACK_IRQ 0
#3 lore raw

Patch bellow contains :-

xen/common/kernel.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/common/kernel.c    Tue May 25 09:08:34 2010 +0100 +0 -0
@@ -260,7 +260,8 @@

                              (1U << XENFEAT_highmem_assist) | (1U << XENFEAT_gnttab_map_avail_bits); else
-                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock); +                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) | +                             (1U << XENFEAT_hvm_callback_vector); #endif

However,  file xen/common/kernel.c under xen-4.0.0 doesn't contain entry

      fi.submap |= (1U << XENFEAT_hvm_safe_pvclock);

Boris.

--- On Tue, 5/25/10, Stefano Stabellini <[email protected]> wrote:

From: Stefano Stabellini <[email protected]>
Subject: Re: [Xen-devel] [PATCH] xen: implement vector callback for evtchn delivery
To: "Keir Fraser" <[email protected]>
Cc: "[email protected]" <[email protected]>, "Stefano Stabellini" <[email protected]>
Date: Tuesday, May 25, 2010, 5:55 AM

Quoted 4 lines · Keir Fraser

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.

Done.

---

xen/arch/x86/hvm/irq.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/arch/x86/hvm/irq.c    Tue May 25 09:08:34 2010 +0100 +0 -3
diff -r 12c79a476007 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;

xen/arch/x86/hvm/vmx/intr.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/arch/x86/hvm/vmx/intr.c    Tue May 25 09:08:34 2010 +0100 +0 -0
diff -r 12c79a476007 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? */

xen/common/kernel.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/common/kernel.c    Tue May 25 09:08:34 2010 +0100 +0 -0
diff -r 12c79a476007 xen/common/kernel.c
@@ -260,7 +260,8 @@

                              (1U << XENFEAT_highmem_assist) | (1U << XENFEAT_gnttab_map_avail_bits); else
-                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock); +                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) | +                             (1U << XENFEAT_hvm_callback_vector);
#endif
             break;
         default:

xen/include/asm-x86/domain.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/asm-x86/domain.h    Tue May 25 09:08:34 2010 +0100 +4 -0
diff -r 12c79a476007 xen/include/asm-x86/domain.h
@@ -18,6 +18,10 @@
 #define is_pv_32on64_domain(d) (0)
 #endif
 #define is_pv_32on64_vcpu(v)   (is_pv_32on64_domain((v)->domain))
+
+#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 VCPU_TRAP_NMI          1
 #define VCPU_TRAP_MCE          2
xen/include/asm-x86/hvm/hvm.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/asm-x86/hvm/hvm.h    Tue May 25 09:08:34 2010 +0100 +0 -0
diff -r 12c79a476007 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 */

xen/include/asm-x86/hvm/irq.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/asm-x86/hvm/irq.h    Tue May 25 09:08:34 2010 +0100 +0 -0
diff -r 12c79a476007 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. */

xen/include/public/features.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/public/features.h    Tue May 25 09:08:34 2010 +0100 +0 -0
diff -r 12c79a476007 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

xen/include/public/hvm/params.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/public/hvm/params.h    Tue May 25 09:08:34 2010 +0100 +0 -0
diff -r 12c79a476007 xen/include/public/hvm/params.h
@@ -33,6 +33,9 @@

  * val[63:56] == 1: val[55:0] is a delivery PCI INTx line, as follows:
  *                  Domain = val[47:32], Bus  = val[31:16], *                  DevFn  = val[15: 8], IntX = val[ 1: 0]
+ * val[63:56] == 2: val[7:0] is a vector number, check for
+ *                  XENFEAT_hvm_callback_vector to know if this delivery
+ *                  method is available.
  * If val == 0 then CPU0 event-channel notifications are not delivered. */
#define HVM_PARAM_CALLBACK_IRQ 0

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw

The patch isn't for 4.0. You can apply it by hand anyway. The missing hvm_safe_pvclock doesn't matter.

K.

Quoted 235 lines · Boris Derzhavets

Patch bellow contains :-

xen/common/kernel.c Tue May 25 10:44:07 2010 +0100 renamed from xen/common/kernel.c Tue May 25 09:08:34 2010 +0100 +2 -1
@@ -260,7 +260,8 @@
                              (1U << XENFEAT_highmem_assist) |
                              (1U << XENFEAT_gnttab_map_avail_bits);
             else
-                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock);
+                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) |
+                             (1U << XENFEAT_hvm_callback_vector);
 #endif
 

However, file xen/common/kernel.c under xen-4.0.0 doesn't contain entry

      fi.submap |= (1U << XENFEAT_hvm_safe_pvclock);

Boris.

--- On Tue, 5/25/10, Stefano Stabellini <[email protected]>

Quoted 212 lines · wrote:

From: Stefano Stabellini <[email protected]>
Subject: Re: [Xen-devel] [PATCH] xen: implement vector callback for evtchn delivery
To: "Keir Fraser" <[email protected]>
Cc: "[email protected]" <[email protected]>, "Stefano Stabellini" <[email protected]>
Date: Tuesday, May 25, 2010, 5:55 AM

Quoted 4 lines · Keir Fraser

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.

Done.

</mc/[email protected]> >

---

diff -r 12c79a476007 xen/arch/x86/hvm/irq.c

xen/arch/x86/hvm/irq.c Tue May 25 10:44:07 2010 +0100 renamed from xen/arch/x86/hvm/irq.c Tue May 25 09:08:34 2010 +0100 +18 -5
@@ -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 -r 12c79a476007 xen/arch/x86/hvm/vmx/intr.c

xen/arch/x86/hvm/vmx/intr.c Tue May 25 10:44:07 2010 +0100 renamed from xen/arch/x86/hvm/vmx/intr.c Tue May 25 09:08:34 2010 +0100 +2 -1
@@ -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 -r 12c79a476007 xen/common/kernel.c

xen/common/kernel.c Tue May 25 10:44:07 2010 +0100 renamed from xen/common/kernel.c Tue May 25 09:08:34 2010 +0100 +2 -1
@@ -260,7 +260,8 @@
                              (1U << XENFEAT_highmem_assist) |
                              (1U << XENFEAT_gnttab_map_avail_bits);
             else
-                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock);
+                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) |
+                             (1U << XENFEAT_hvm_callback_vector);
 #endif
             break;
         default:

diff -r 12c79a476007 xen/include/asm-x86/domain.h

xen/include/asm-x86/domain.h Tue May 25 10:44:07 2010 +0100 renamed from xen/include/asm-x86/domain.h Tue May 25 09:08:34 2010 +0100 +4 -0
@@ -18,6 +18,10 @@
 #define is_pv_32on64_domain(d) (0)
 #endif
 #define is_pv_32on64_vcpu(v)   (is_pv_32on64_domain((v)->domain))
+
+#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 VCPU_TRAP_NMI          1
 #define VCPU_TRAP_MCE          2

diff -r 12c79a476007 xen/include/asm-x86/hvm/hvm.h

xen/include/asm-x86/hvm/hvm.h Tue May 25 10:44:07 2010 +0100 renamed from xen/include/asm-x86/hvm/hvm.h Tue May 25 09:08:34 2010 +0100 +3 -1
@@ -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 -r 12c79a476007 xen/include/asm-x86/hvm/irq.h

xen/include/asm-x86/hvm/irq.h Tue May 25 10:44:07 2010 +0100 renamed from xen/include/asm-x86/hvm/irq.h Tue May 25 09:08:34 2010 +0100 +3 -1
@@ -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 -r 12c79a476007 xen/include/public/features.h

xen/include/public/features.h Tue May 25 10:44:07 2010 +0100 renamed from xen/include/public/features.h Tue May 25 09:08:34 2010 +0100 +3 -0
@@ -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 -r 12c79a476007 xen/include/public/hvm/params.h

xen/include/public/hvm/params.h Tue May 25 10:44:07 2010 +0100 renamed from xen/include/public/hvm/params.h Tue May 25 09:08:34 2010 +0100 +3 -0
@@ -33,6 +33,9 @@
  * val[63:56] == 1: val[55:0] is a delivery PCI INTx line, as follows:
  *                  Domain = val[47:32], Bus  = val[31:16],
  *                  DevFn  = val[15: 8], IntX = val[ 1: 0]
+ * val[63:56] == 2: val[7:0] is a vector number, check for
+ *                  XENFEAT_hvm_callback_vector to know if this delivery
+ *                  method is available.
  * If val == 0 then CPU0 event-channel notifications are not delivered.
  */
 #define HVM_PARAM_CALLBACK_IRQ 0

_______________________________________________
Xen-devel mailing list
[email protected] </mc/[email protected]>
http://lists.xensource.com/xen-devel

#5 lore raw

When i run rpmbuild on F13 , i need pv-on-hvm.patch in SOURCES for xen-4.0.0.1.7.f12.src.rpm. That was a reason of my request yesterday.

Boris.

--- On Wed, 5/26/10, Keir Fraser <[email protected]> wrote:

From: Keir Fraser <[email protected]>
Subject: Re: [Xen-devel] [PATCH] xen: implement vector callback for evtchn delivery
To: "Boris Derzhavets" <[email protected]>, "Stefano Stabellini" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Wednesday, May 26, 2010, 3:31 AM

The patch isn't for 4.0. You can apply it by hand anyway. The missing hvm_safe_pvclock doesn't matter.

K.

Quoted 229 lines · Boris Derzhavets

Patch bellow contains :-

xen/common/kernel.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/common/kernel.c    Tue May 25 09:08:34 2010 +0100 +0 -0
@@ -260,7 +260,8 @@

                               (1U << XENFEAT_highmem_assist) | (1U << XENFEAT_gnttab_map_avail_bits); else
-                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock); +                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) | +                             (1U << XENFEAT_hvm_callback_vector); #endif

However,  file xen/common/kernel.c under xen-4.0.0 doesn't contain entry

       fi.submap |= (1U << XENFEAT_hvm_safe_pvclock);

Boris.

--- On Tue, 5/25/10, Stefano Stabellini <[email protected]>

Quoted 208 lines · wrote:

From: Stefano Stabellini <[email protected]>
Subject: Re: [Xen-devel] [PATCH] xen: implement vector callback for evtchn delivery
To: "Keir Fraser" <[email protected]>
Cc: "[email protected]" <[email protected]>, "Stefano Stabellini" <[email protected]>
Date: Tuesday, May 25, 2010, 5:55 AM

Quoted 4 lines · Keir Fraser

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.

Done.

</mc/[email protected]> >

---

diff -r 12c79a476007 xen/arch/x86/hvm/irq.c

xen/arch/x86/hvm/irq.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/arch/x86/hvm/irq.c    Tue May 25 09:08:34 2010 +0100 +0 -0
@@ -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)

xen/arch/x86/hvm/irq.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/arch/x86/hvm/irq.c    Tue May 25 09:08:34 2010 +0100 +0 -0
@@ -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);

xen/arch/x86/hvm/irq.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/arch/x86/hvm/irq.c    Tue May 25 09:08:34 2010 +0100 +3 -0
@@ -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;
      }

xen/arch/x86/hvm/irq.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/arch/x86/hvm/irq.c    Tue May 25 09:08:34 2010 +0100 +0 -0
@@ -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;

xen/arch/x86/hvm/irq.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/arch/x86/hvm/irq.c    Tue May 25 09:08:34 2010 +0100 +0 -0
@@ -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;

xen/arch/x86/hvm/irq.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/arch/x86/hvm/irq.c    Tue May 25 09:08:34 2010 +0100 +0 -0
@@ -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 -r 12c79a476007 xen/arch/x86/hvm/vmx/intr.c

xen/arch/x86/hvm/vmx/intr.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/arch/x86/hvm/vmx/intr.c    Tue May 25 09:08:34 2010 +0100 +2 -1
@@ -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 -r 12c79a476007 xen/common/kernel.c

xen/common/kernel.c    Tue May 25 10:44:07 2010 +0100 renamed from xen/common/kernel.c    Tue May 25 09:08:34 2010 +0100 +0 -0
@@ -260,7 +260,8 @@

                               (1U << XENFEAT_highmem_assist) | (1U << XENFEAT_gnttab_map_avail_bits); else
-                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock); +                fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) | +                             (1U << XENFEAT_hvm_callback_vector); #endif
              break;
          default:
diff -r 12c79a476007 xen/include/asm-x86/domain.h

xen/include/asm-x86/domain.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/asm-x86/domain.h    Tue May 25 09:08:34 2010 +0100 +4 -0
@@ -18,6 +18,10 @@
   #define is_pv_32on64_domain(d) (0)
   #endif
   #define is_pv_32on64_vcpu(v)   (is_pv_32on64_domain((v)->domain))
+
+#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 VCPU_TRAP_NMI          1
  #define VCPU_TRAP_MCE          2
diff -r 12c79a476007 xen/include/asm-x86/hvm/hvm.h

xen/include/asm-x86/hvm/hvm.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/asm-x86/hvm/hvm.h    Tue May 25 09:08:34 2010 +0100 +2 -1
@@ -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 */

xen/include/asm-x86/hvm/hvm.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/asm-x86/hvm/hvm.h    Tue May 25 09:08:34 2010 +0100 +1 -0
@@ -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 -r 12c79a476007 xen/include/asm-x86/hvm/irq.h

xen/include/asm-x86/hvm/irq.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/asm-x86/hvm/irq.h    Tue May 25 09:08:34 2010 +0100 +3 -1
@@ -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 -r 12c79a476007 xen/include/public/features.h

xen/include/public/features.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/public/features.h    Tue May 25 09:08:34 2010 +0100 +0 -0
@@ -68,6 +68,9 @@
    */
   #define XENFEAT_gnttab_map_avail_bits      7

xen/include/public/features.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/public/features.h    Tue May 25 09:08:34 2010 +0100 +3 -0
+/* 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 -r 12c79a476007 xen/include/public/hvm/params.h

xen/include/public/hvm/params.h    Tue May 25 10:44:07 2010 +0100 renamed from xen/include/public/hvm/params.h    Tue May 25 09:08:34 2010 +0100 +3 -0
@@ -33,6 +33,9 @@
    * val[63:56] == 1: val[55:0] is a delivery PCI INTx line, as follows:
    *                  Domain = val[47:32], Bus  = val[31:16],
    *                  DevFn  = val[15: 8], IntX = val[ 1: 0]
+ * val[63:56] == 2: val[7:0] is a vector number, check for
+ *                  XENFEAT_hvm_callback_vector to know if this delivery
+ *                  method is available.
    * If val == 0 then CPU0 event-channel notifications are not delivered.
    */
   #define HVM_PARAM_CALLBACK_IRQ 0
Quoted 6 lines
Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected] </mc/[email protected]>
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw
Quoted 3 lines · Boris Derzhavets

When i run rpmbuild on F13 , i need pv-on-hvm.patch in SOURCES for xen-4.0.0.1.7.f12.src.rpm. That was a reason of my request yesterday.

I am attaching to this email an untested port of the patch to 4.0.

xen/arch/x86/hvm/irq.c +18 -5
diff -r e9110e15235c 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;
xen/arch/x86/hvm/vmx/intr.c +2 -1
diff -r e9110e15235c 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? */
xen/common/kernel.c +2 -0
diff -r e9110e15235c xen/common/kernel.c
@@ -243,6 +243,8 @@
                 fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) |
                              (1U << XENFEAT_highmem_assist) |
                              (1U << XENFEAT_gnttab_map_avail_bits);
+            else
+                fi.submap |= (1U << XENFEAT_hvm_callback_vector);
 #endif
             break;
         default:
xen/include/asm-x86/domain.h +4 -0
diff -r e9110e15235c xen/include/asm-x86/domain.h
@@ -17,6 +17,10 @@
 #define is_pv_32on64_domain(d) (0)
 #endif
 #define is_pv_32on64_vcpu(v)   (is_pv_32on64_domain((v)->domain))
+
+#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 VCPU_TRAP_NMI          1
 #define VCPU_TRAP_MCE          2
xen/include/asm-x86/hvm/hvm.h +3 -1
diff -r e9110e15235c 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 */
xen/include/asm-x86/hvm/irq.h +3 -1
diff -r e9110e15235c 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. */
xen/include/public/features.h +3 -0
diff -r e9110e15235c 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
+
 #define XENFEAT_NR_SUBMAPS 1
 
 #endif /* __XEN_PUBLIC_FEATURES_H__ */
xen/include/public/hvm/params.h +3 -0
diff -r e9110e15235c xen/include/public/hvm/params.h
@@ -33,6 +33,9 @@
  * val[63:56] == 1: val[55:0] is a delivery PCI INTx line, as follows:
  *                  Domain = val[47:32], Bus  = val[31:16],
  *                  DevFn  = val[15: 8], IntX = val[ 1: 0]
+ * val[63:56] == 2: val[7:0] is a vector number, check for
+ *                  XENFEAT_hvm_callback_vector to know if this delivery
+ *                  method is available.
  * If val == 0 then CPU0 event-channel notifications are not delivered.
  */
 #define HVM_PARAM_CALLBACK_IRQ 0

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#7 lore raw

Per Keir's advice i removed hank

xen/common/kernel.c    Wed May 26 12:12:36 2010 +0100 renamed from xen/common/kernel.c    Wed May 26 08:29:15 2010 +0100 +0 -0
diff -r e9110e15235c xen/common/kernel.c
@@ -243,6 +243,8 @@

                 fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) | (1U << XENFEAT_highmem_assist) | (1U << XENFEAT_gnttab_map_avail_bits); +            else
+                fi.submap |= (1U << XENFEAT_hvm_callback_vector); #endif
             break;
         default:

Applied patch at rpmbuild run, rebuilt xen rpms , made hot hypervisor upgrade and reboot Xen Instance.
Now building F13 HVM to continue with test PV on HVM following yours the the most recent submission.

Boris.

--- On Wed, 5/26/10, Stefano Stabellini <[email protected]> wrote:

From: Stefano Stabellini <[email protected]>
Subject: Re: [Xen-devel] [PATCH] xen: implement vector callback for evtchn delivery
To: "Boris Derzhavets" <[email protected]>
Cc: "[email protected]" <[email protected]>, "Keir Fraser" <[email protected]>, "Stefano Stabellini" <[email protected]>
Date: Wednesday, May 26, 2010, 7:12 AM

Quoted 3 lines · Boris Derzhavets

When i run rpmbuild on F13 , i need pv-on-hvm.patch in SOURCES for xen-4.0.0.1.7.f12.src.rpm. That was a reason of my request yesterday.

I am attaching to this email an untested port of the patch to 4.0.

-----Inline Attachment Follows-----

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#8 lore raw
In reply to Stefano Stabellini

Sorry, i shouldn't remove hank. It's OK in the most recent submission. Will upgrade one more time.

Boris.

--- On Wed, 5/26/10, Stefano Stabellini <[email protected]> wrote:

From: Stefano Stabellini <[email protected]>
Subject: Re: [Xen-devel] [PATCH] xen: implement vector callback for evtchn delivery
To: "Boris Derzhavets" <[email protected]>
Cc: "[email protected]" <[email protected]>, "Keir Fraser" <[email protected]>, "Stefano Stabellini" <[email protected]>
Date: Wednesday, May 26, 2010, 7:12 AM

Quoted 3 lines · Boris Derzhavets

When i run rpmbuild on F13 , i need pv-on-hvm.patch in SOURCES for xen-4.0.0.1.7.f12.src.rpm. That was a reason of my request yesterday.

I am attaching to this email an untested port of the patch to 4.0.

-----Inline Attachment Follows-----

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel