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] Modify for compiling PV-on-HVM and following ca

To: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-ia64-devel] [Patch] Modify for compiling PV-on-HVM and following callback_via
From: DOI Tsunehisa <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Date: Mon, 05 Feb 2007 14:22:46 +0900
Delivery-date: Sun, 04 Feb 2007 21:23:34 -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.9 (Windows/20061207)
Hi all,

  I modified to fix for compiling PV-on-HVM driver on IPF, and follow
to allow PV-on-HVM callback irq to be identified by PCI device.

  In x86 code, callback irq spec was appended few weeks ago. The purpose
of appended spec was same with that we had introduced using RID for
callback irq. So, I modified to follow this change on IPF.

  * comp-fix.patch
    - Modify for compiling PV-on-HVM on IPF with latest changeset
      (cs:13837)
  * follow-pciintx.patch
    - Follow to allow PV-on-HVM callback irq to be identifyed by
      PCI device.

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

Thanks,
- Tsunehisa Doi
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Date 1170649150 -32400
# Node ID 46d5f4863cfd4016b216f9ae5e1446b00a4ccc8e
# Parent  fbc128aafdeb9c3726495211e0b017951672912a
Fix for compiling PV-on-HVM driver on IPF

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>
Signed-off-by: Anthony Xu <anthony.xu@xxxxxxxxx>

diff -r fbc128aafdeb -r 46d5f4863cfd unmodified_drivers/linux-2.6/overrides.mk
--- a/unmodified_drivers/linux-2.6/overrides.mk Sun Feb 04 12:24:53 2007 -0700
+++ b/unmodified_drivers/linux-2.6/overrides.mk Mon Feb 05 13:19:10 2007 +0900
@@ -6,3 +6,6 @@
 # a Xen kernel to find the right headers)
 EXTRA_CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030202
 EXTRA_CFLAGS += -I$(M)/include -I$(M)/compat-include 
-DHAVE_XEN_PLATFORM_COMPAT_H
+ifeq ($(ARCH),ia64)
+  EXTRA_CFLAGS += -DCONFIG_VMX_GUEST
+endif
diff -r fbc128aafdeb -r 46d5f4863cfd 
unmodified_drivers/linux-2.6/platform-pci/xen_support.c
--- a/unmodified_drivers/linux-2.6/platform-pci/xen_support.c   Sun Feb 04 
12:24:53 2007 -0700
+++ b/unmodified_drivers/linux-2.6/platform-pci/xen_support.c   Mon Feb 05 
13:19:10 2007 +0900
@@ -30,6 +30,23 @@
 #include <xen/platform-compat.h>
 #endif
 
+#if defined (__ia64__)
+unsigned long __hypercall(unsigned long a1, unsigned long a2,
+                        unsigned long a3, unsigned long a4,
+                        unsigned long a5, unsigned long cmd)
+{
+       unsigned long __res;
+       __asm__ __volatile__ (";;\n"
+               "mov r2=%1\n"
+               "break 0x1000 ;;\n"
+               "mov %0=r8 ;;\n"
+               : "=r"(__res) : "r"(cmd) : "r2", "r8", "memory");
+
+       return __res;
+}
+EXPORT_SYMBOL(__hypercall);
+#endif
+
 void xen_machphys_update(unsigned long mfn, unsigned long pfn)
 {
        BUG();
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Date 1170649248 -32400
# Node ID 69ded6c4860a3ab4e83179bda048c536d21af679
# Parent  46d5f4863cfd4016b216f9ae5e1446b00a4ccc8e
Follow to allow PV-on-HVM callback irq to be identified by PCI device.

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

diff -r 46d5f4863cfd -r 69ded6c4860a 
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Mon Feb 05 
13:19:10 2007 +0900
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Mon Feb 05 
13:20:48 2007 +0900
@@ -181,23 +181,26 @@ static int get_hypercall_stubs(void)
 
 static uint64_t get_callback_via(struct pci_dev *pdev)
 {
+       u8 pin;
 #ifdef __ia64__
        int irq, rid;
        for (irq = 0; irq < 16; irq++) {
                if (isa_irq_to_vector(irq) == pdev->irq)
-                       return irq;
-       }
+                       return irq; /* ISA IRQ */
+       }
+#ifdef IA64_CALLBACK_IRQ_RID
        /* use Requester-ID as callback_irq */
        /* RID: '<#bus(8)><#dev(5)><#func(3)>' (cf. PCI-Express spec) */
        rid = ((pdev->bus->number & 0xff) << 8) | pdev->devfn;
        printk(KERN_INFO DRV_NAME ":use Requester-ID(%04x) as callback irq\n",
               rid);
        return rid | IA64_CALLBACK_IRQ_RID;
+#endif /* IA64_CALLBACK_IRQ_RID */
 #else /* !__ia64__ */
-       u8 pin;
 
        if (pdev->irq < 16)
                return pdev->irq; /* ISA IRQ */
+#endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
        pin = pdev->pin;
@@ -211,7 +214,6 @@ static uint64_t get_callback_via(struct 
                ((uint64_t)pdev->bus->number << 16) |
                ((uint64_t)(pdev->devfn & 0xff) << 8) |
                ((uint64_t)(pin - 1) & 3));
-#endif
 }
 
 /* Invalidate foreign mappings (e.g., in qemu-based device model). */
diff -r 46d5f4863cfd -r 69ded6c4860a xen/arch/ia64/vmx/vmx_process.c
--- a/xen/arch/ia64/vmx/vmx_process.c   Mon Feb 05 13:19:10 2007 +0900
+++ b/xen/arch/ia64/vmx/vmx_process.c   Mon Feb 05 13:20:48 2007 +0900
@@ -227,17 +227,33 @@ void leave_hypervisor_tail(void)
         local_irq_disable();
 
         if (v->vcpu_id == 0) {
-            int callback_irq =
+            unsigned long callback_irq =
                 d->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ];
+            /*
+             * val[63:56] == 1: val[55:0] is a delivery PCI INTx line:
+             *                  Domain = val[47:32], Bus  = val[31:16],
+             *                  DevFn  = val[15: 8], IntX = val[ 1: 0]
+             * val[63:56] == 0: val[55:0] is a delivery as follow:
+             *     if IA64_CALLBACK_IRQ_RID is set    : Requester-ID
+             *     if IA64_CALLBACK_IRQ_RID is not set: GSI
+             */
             if (callback_irq != 0 && local_events_need_delivery()) {
                 /* change level for para-device callback irq */
                 /* use level irq to send discrete event */
-                if (callback_irq & IA64_CALLBACK_IRQ_RID) {
+                if ((uint8_t)(callback_irq >> 56) == 1) {
+                    /* case of using PCI INTx line as callback irq */
+                    int pdev = (callback_irq >> 11) & 0x1f;
+                    int pintx = callback_irq & 3;
+                    viosapic_set_pci_irq(d, pdev, pintx, 1);
+                    viosapic_set_pci_irq(d, pdev, pintx, 0);
+#ifdef IA64_CALLBACK_IRQ_RID
+                } else if (callback_irq & IA64_CALLBACK_IRQ_RID) {
                     /* case of using Requester-ID as callback irq */
                     /* RID: '<#bus(8)><#dev(5)><#func(3)>' */
                     int dev = (callback_irq >> 3) & 0x1f;
                     viosapic_set_pci_irq(d, dev, 0, 1);
                     viosapic_set_pci_irq(d, dev, 0, 0);
+#endif /* IA64_CALLBACK_IRQ_RID */
                 } else {
                     /* case of using GSI as callback irq */
                     viosapic_set_irq(d, callback_irq, 1);
diff -r 46d5f4863cfd -r 69ded6c4860a xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Mon Feb 05 13:19:10 2007 +0900
+++ b/xen/include/public/arch-ia64.h    Mon Feb 05 13:20:48 2007 +0900
@@ -64,9 +64,11 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define VIRQ_MCA_CMC    VIRQ_ARCH_1 /* MCA cmc interrupt */
 #define VIRQ_MCA_CPE    VIRQ_ARCH_2 /* MCA cpe interrupt */
 
+#if 0
 /* Arch specific callback irq definition */
 /* using Requester-ID(RID) as callback irq */
 #define IA64_CALLBACK_IRQ_RID        (1 << 31)
+#endif
 
 /* Maximum number of virtual CPUs in multi-processor guests. */
 /* WARNING: before changing this, check that shared_info fits on a page */
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel