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-ia64-devel

[Xen-ia64-devel] [Patch] Issue about interrupt for PV-on-HVM on IPF

To: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-ia64-devel] [Patch] Issue about interrupt for PV-on-HVM on IPF
From: DOI Tsunehisa <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Date: Thu, 16 Nov 2006 18:22:51 +0900
Delivery-date: Thu, 16 Nov 2006 01:21:28 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.8 (Windows/20061025)
Hi all,

  We found some issues about interrupt for PV-on-HVM on IPF.

  1) IRQ number issue
    - In IPF-Linux, IRQ is abstruct value, not hardware IRQ.
      (IRQ in IPF-Linux is external interrupt vector indeed.)
      * We had implemented PV-on-HVM feature as this semantic.
    - In other OS (like Windows), we can't get external interrupt
      vector with the driver interface.

  2) Ignoring interrupt mask of interrupt controller issue
    - We had implemented that the interrupt for event channel handling
      was injected without checking interrupt mask of virtual interrupt
      controller.
    - IPF-Linux make to mask the interrupt with psr.i. But other OSs
      make to mask it with IMR(interrupt mask register) of interrupt
      controller, thus the interrupt come during to mask interrupt.

  3) Interrupt delivery issue
    - We had implemented that the interrupt was delivered to only VCPU
      0.
    - Linux can handle the interrupt on any CPU, but other OS might be
      able to handle it on only CPU specified with interrupt controller.

  We discussed methods to modify for issue, thus ...

  1) We have to change the spec of callback IRQ.
     - Currently, it is external interrupt vector, but it has to be
       hardware IRQ id.
     - In PV-driver code for IPF-Linux, we can get hardware IRQ from
       isa_irq_vector_map.

  2) We have to modify the interrupt injector of hypervisor.
     - Currently, it ignores interrupt mask register of virtual
       interrupt controller, but it has to refer the mask.

  3) We have to modify that the interrupt is delivered a CPU specified
     with virtual interrupt controller
     - Currently, it is delivered only VCPU 0, but it has to be
       delivered a CPU specified with virtual interrupt controller

  I'll send patches to modify the issues.

  * pvdrv.patch
    - Modify to change the spec of callback IRQ in PV-driver side.
    - This patch brakes compatibility with previous version.
  * follow-ic.patch
    - Follow to change a method of interrupt handling in latest
      changeset.
    - Modify to change the spec of callback IRQ in hypervisor side.
    - Modify to follow status of interrupt mask register of virtual
      interupt controller.
    - Modify to deliver interupts to a CPU specified with virtual
      interrupt controller.

  I tested with our simple test of PV-on-HVM on RHEL4 U2.

Thanks,
- Tsunehisa Doi
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Node ID 1fa4ce7c60125319243add108604a066e4fe6b0c
# Parent  ac5330d4945a6eb388424ba8cf76f494ad9df47a
Change callback_irq spec of PV-on-HVM for IPF

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Signed-off-by: Kouya SHIMURA <kouya@xxxxxxxxxxxxxx>

diff -r ac5330d4945a -r 1fa4ce7c6012 
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Wed Nov 15 
12:15:34 2006 -0700
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Thu Nov 16 
15:29:28 2006 +0900
@@ -179,10 +179,24 @@ static int get_hypercall_stubs(void)
 #define get_hypercall_stubs()  (0)
 #endif
 
+static int get_callback_irq(struct pci_dev *pdev)
+{
+#ifdef __ia64__
+       int irq;
+       for (irq = 0; irq < 16; irq++) {
+               if (isa_irq_to_vector_map[irq] == pdev->irq)
+                       return irq;
+       }
+       return 0;
+#else /* !__ia64__ */
+       return pdev->irq;
+#endif
+}
+
 static int __devinit platform_pci_init(struct pci_dev *pdev,
                                       const struct pci_device_id *ent)
 {
-       int i, ret;
+       int i, ret, callback_irq;
        long ioaddr, iolen;
        long mmio_addr, mmio_len;
 
@@ -196,7 +210,9 @@ static int __devinit platform_pci_init(s
        mmio_addr = pci_resource_start(pdev, 1);
        mmio_len = pci_resource_len(pdev, 1);
 
-       if (mmio_addr == 0 || ioaddr == 0) {
+       callback_irq = get_callback_irq(pdev);
+
+       if (mmio_addr == 0 || ioaddr == 0 || callback_irq == 0) {
                printk(KERN_WARNING DRV_NAME ":no resources found\n");
                return -ENOENT;
        }
@@ -231,7 +247,7 @@ static int __devinit platform_pci_init(s
                goto out;
        }
 
-       if ((ret = set_callback_irq(pdev->irq)))
+       if ((ret = set_callback_irq(callback_irq)))
                goto out;
 
  out:
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Node ID d14cfa228cc4d7b0622695d8136b16db85ff3e8a
# Parent  1fa4ce7c60125319243add108604a066e4fe6b0c
Modify to follow status of interrupt controller

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Signed-off-by: Kouya SHIMURA <kouya@xxxxxxxxxxxxxx>

diff -r 1fa4ce7c6012 -r d14cfa228cc4 xen/arch/ia64/vmx/vlsapic.c
--- a/xen/arch/ia64/vmx/vlsapic.c       Thu Nov 16 15:29:28 2006 +0900
+++ b/xen/arch/ia64/vmx/vlsapic.c       Thu Nov 16 16:26:13 2006 +0900
@@ -103,8 +103,10 @@ static int vmx_vcpu_unpend_interrupt(VCP
     ret = test_and_clear_bit(vector, &VCPU(vcpu, irr[0]));
     local_irq_restore(spsr);
 
-    if (ret)
+    if (ret) {
         vcpu->arch.irq_new_pending = 1;
+        wmb();
+    }
 
     return ret;
 }
@@ -514,8 +516,10 @@ int vmx_vcpu_pend_interrupt(VCPU *vcpu, 
     ret = test_and_set_bit(vector, &VCPU(vcpu, irr[0]));
     local_irq_restore(spsr);
 
-    if (!ret)
+    if (!ret) {
         vcpu->arch.irq_new_pending = 1;
+        wmb();
+    }
 
     return ret;
 }
@@ -537,6 +541,7 @@ void vmx_vcpu_pend_batch_interrupt(VCPU 
     }
     local_irq_restore(spsr);
     vcpu->arch.irq_new_pending = 1;
+    wmb();
 }
 
 /*
@@ -598,6 +603,7 @@ void guest_write_eoi(VCPU *vcpu)
     VLSAPIC_INSVC(vcpu,vec>>6) &= ~(1UL <<(vec&63));
     VCPU(vcpu, eoi)=0;    // overwrite the data
     vcpu->arch.irq_new_pending=1;
+    wmb();
 }
 
 int is_unmasked_irq(VCPU *vcpu)
diff -r 1fa4ce7c6012 -r d14cfa228cc4 xen/arch/ia64/vmx/vmx_process.c
--- a/xen/arch/ia64/vmx/vmx_process.c   Thu Nov 16 15:29:28 2006 +0900
+++ b/xen/arch/ia64/vmx/vmx_process.c   Thu Nov 16 16:26:13 2006 +0900
@@ -225,15 +225,15 @@ void leave_hypervisor_tail(struct pt_reg
         if (v->vcpu_id == 0) {
             int callback_irq =
                 d->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ];
-            if (callback_irq != 0 && local_events_need_delivery()) {
-                /*inject para-device call back irq*/
-                v->vcpu_info->evtchn_upcall_mask = 1;
-                vmx_vcpu_pend_interrupt(v, callback_irq);
-            }
-        }
-
-        if ( v->arch.irq_new_pending ) {
-            v->arch.irq_new_pending = 0;
+            if (callback_irq != 0) {
+                /* change level for para-device callback irq */
+                vmx_vioapic_set_irq(d, callback_irq,
+                                    local_events_need_delivery());
+            }
+        }
+
+        rmb();
+        if (xchg(&v->arch.irq_new_pending, 0)) {
             v->arch.irq_new_condition = 0;
             vmx_check_pending_irq(v);
             return;
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel