[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Powernow-k8 support



Hi,

> It really depends what is hidden inside the binary-only portion. If they
> try to enable/disable interrupts in there, for example, then the driver
> is going to be unreliable. If they provide accessors for that kind of
> operation in their 'open source' wrapper, then that shouldn't be a
> problem as they will link against the versions modified for Xen. Looking
> at the functions exported by the source wrapper might give you a clue,
> or try 'objdump -d' on the binary-only portion and grep for things like
> cli, sti and popf.

I searched around inside the NVidia forum and I found 2 patches, which I
applied to the hypervisor and to nv.c. Now, CPUfreq is working fine here
and I successfully use the nvidia driver. I have attached both patches.
Maybe someone else may have the same problem, so in this thread he/she
may find all neccessary info, whatever.

Only one thing left ist the problem with the line

line 1058     /* __update_vcpu_system_time(current); */

But everything is working with this solution. What should this be for?

I have noticed one other interesting thing with Xen: openVPN is nomore
able to initialize any tunnels. Does this have something to do with the
__update_vcpu_system_time function?

Kind regards
Christian
diff -urN linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c 
linux-2.6-xen-sparse-nv/arch/i386/mm/hypervisor.c
--- linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c      2006-04-13 
19:48:37.000000000 +0200
+++ linux-2.6-xen-sparse-nv/arch/i386/mm/hypervisor.c   2006-04-16 
15:34:51.000000000 +0200
@@ -133,6 +133,7 @@
        op.cmd = MMUEXT_TLB_FLUSH_LOCAL;
        BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
 }
+EXPORT_SYMBOL(xen_tlb_flush);
 
 void xen_invlpg(unsigned long ptr)
 {
diff -urN linux-2.6-xen-sparse/drivers/xen/core/evtchn.c 
linux-2.6-xen-sparse-nv/drivers/xen/core/evtchn.c
--- linux-2.6-xen-sparse/drivers/xen/core/evtchn.c      2006-04-13 
19:48:37.000000000 +0200
+++ linux-2.6-xen-sparse-nv/drivers/xen/core/evtchn.c   2006-04-16 
15:34:04.000000000 +0200
@@ -188,7 +188,7 @@
 {
        (void)HYPERVISOR_xen_version(0, NULL);
 }
-EXPORT_SYMBOL_GPL(force_evtchn_callback);
+EXPORT_SYMBOL(force_evtchn_callback);
 
 /* NB. Interrupts are disabled on entry. */
 asmlinkage void evtchn_do_upcall(struct pt_regs *regs)
diff -urN linux-2.6-xen-sparse/drivers/xen/core/features.c 
linux-2.6-xen-sparse-nv/drivers/xen/core/features.c
--- linux-2.6-xen-sparse/drivers/xen/core/features.c    2006-04-13 
19:48:37.000000000 +0200
+++ linux-2.6-xen-sparse-nv/drivers/xen/core/features.c 2006-04-16 
15:33:03.000000000 +0200
@@ -12,7 +12,7 @@
 #include <xen/features.h>
 
 u8 xen_features[XENFEAT_NR_SUBMAPS * 32] __read_mostly;
-EXPORT_SYMBOL_GPL(xen_features);
+EXPORT_SYMBOL(xen_features);
 
 void setup_xen_features(void)
 {
diff -urN nv-1.0-8756/nv.c nv-1.0-8756-xen-3.0.2-2/nv.c
--- nv-1.0-8756/nv.c    2006-03-30 01:02:20.000000000 +0200
+++ nv-1.0-8756-xen-3.0.2-2/nv.c        2006-04-18 03:16:11.000000000 +0200
@@ -16,6 +16,9 @@
 #include "os-agp.h"
 #include "nv-vm.h"
 
+#define io_remap_page_range(vma, start, busaddr, size, prot)   \
+       io_remap_pfn_range(vma, start, busaddr>>PAGE_SHIFT, size, prot)
+
 #ifdef MODULE_ALIAS_CHARDEV_MAJOR
 MODULE_ALIAS_CHARDEV_MAJOR(NV_MAJOR_DEVICE_NUMBER);
 #endif
@@ -44,7 +47,11 @@
 
 int nv_pat_enabled = 0;
 
+#ifdef CONFIG_XEN
+static int nv_disable_pat = 1;
+#else
 static int nv_disable_pat = 0;
+#endif
 NV_MODULE_PARAMETER(nv_disable_pat);
 
 #if defined(NVCPU_X86) || defined(NVCPU_X86_64)
@@ -2087,7 +2094,11 @@
             return -ENXIO;
         }
 
+#ifdef CONFIG_XEN
+        if (io_remap_page_range(vma, vma->vm_start,
+#else
         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
+#endif
                              NV_VMA_OFFSET(vma),
                              NV_VMA_SIZE(vma),
                              vma->vm_page_prot))
@@ -2112,7 +2123,11 @@
             }
         }
 
+#ifdef CONFIG_XEN
+        if (io_remap_page_range(vma, vma->vm_start,
+#else
         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
+#endif
                              NV_VMA_OFFSET(vma),
                              NV_VMA_SIZE(vma),
                              vma->vm_page_prot))
@@ -2155,7 +2170,11 @@
         NV_ATOMIC_INC(at->usage_count);
         nv_up(nvl->at_lock);
 
+#ifdef CONFIG_XEN
+        if (io_remap_page_range(vma, vma->vm_start,
+#else
         if (NV_REMAP_PAGE_RANGE(vma->vm_start,
+#endif
                                 NV_VMA_OFFSET(vma),
                                 NV_VMA_SIZE(vma),
                                 vma->vm_page_prot))
diff -urN nv-1.0-8756/nv-linux.h nv-1.0-8756-xen-3.0.2-2/nv-linux.h
--- nv-1.0-8756/nv-linux.h      2006-03-30 01:02:20.000000000 +0200
+++ nv-1.0-8756-xen-3.0.2-2/nv-linux.h  2006-04-17 01:46:37.000000000 +0200
@@ -19,8 +19,8 @@
 #include <linux/utsname.h>
 
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
-#  error This driver does not support pre-2.4 kernels!
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 7)
+#  error This driver does not support 2.4 kernels older than 2.4.7!
 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
 #  define KERNEL_2_4
 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
@@ -94,6 +94,7 @@
 
 #include <linux/spinlock.h>
 #include <asm/semaphore.h>
+#include <linux/completion.h>
 #include <linux/highmem.h>
 
 #ifdef CONFIG_PROC_FS
@@ -225,9 +226,13 @@
  * tiny, and the kernel panics when it is exhausted. try to warn the user that
  * they need to boost the size of their pool.
  */
+#if defined(CONFIG_XEN)
+#undef CONFIG_SWIOTLB
+#else
 #if defined(CONFIG_SWIOTLB) && !defined(GFP_DMA32)
 #define NV_SWIOTLB 1
 #endif
+#endif
 
 /*
  * early 2.6 kernels changed their swiotlb codepath, running into a
diff -urN nv-1.0-8756/nv-vm.c nv-1.0-8756-xen-3.0.2-2/nv-vm.c
--- nv-1.0-8756/nv-vm.c 2006-03-30 01:02:20.000000000 +0200
+++ nv-1.0-8756-xen-3.0.2-2/nv-vm.c     2006-04-18 02:16:21.000000000 +0200
@@ -497,7 +497,11 @@
         page_ptr->phys_addr = phys_addr;
         page_ptr->page_count = NV_GET_PAGE_COUNT(page_ptr);
         page_ptr->virt_addr = virt_addr;
+#ifdef CONFIG_XEN
+        page_ptr->dma_addr = phys_to_machine(page_ptr->phys_addr);
+#else
         page_ptr->dma_addr = page_ptr->phys_addr;
+#endif
 
         /* lock the page for dma purposes */
         nv_lock_page(page_ptr);
diff -urN nv-1.0-8756/os-agp.c nv-1.0-8756-xen-3.0.2-2/os-agp.c
--- nv-1.0-8756/os-agp.c        2006-03-30 01:02:20.000000000 +0200
+++ nv-1.0-8756-xen-3.0.2-2/os-agp.c    2006-04-17 01:46:37.000000000 +0200
@@ -284,7 +284,11 @@
 
          page_ptr->phys_addr = (ptr->memory[i] & PAGE_MASK);
          page_ptr->virt_addr = (unsigned long) __va(page_ptr->phys_addr);
+#ifdef CONFIG_XEN
+         page_ptr->dma_addr  = phys_to_machine(page_ptr->phys_addr);
+#else
          page_ptr->dma_addr  = page_ptr->phys_addr;
+#endif
     }
 
     return RM_OK;
diff -urN nv-1.0-8756/os-interface.c nv-1.0-8756-xen-3.0.2-2/os-interface.c
--- nv-1.0-8756/os-interface.c  2006-03-30 01:02:20.000000000 +0200
+++ nv-1.0-8756-xen-3.0.2-2/os-interface.c      2006-04-17 01:46:37.000000000 
+0200
@@ -58,9 +58,9 @@
 //
 typedef struct os_sema_s
 {
-    struct semaphore wait;
-    spinlock_t       lock;
-    S032             count;
+    struct completion  completion;
+    spinlock_t         lock;
+    S032               count;
 } os_sema_t;
 
 //
@@ -81,7 +81,7 @@
         return rmStatus;
 
     os_sema = (os_sema_t *)*ppSema;
-    sema_init(&os_sema->wait, 0);
+    init_completion(&os_sema->completion);
     spin_lock_init(&os_sema->lock);
     os_sema->count = 1;
 
@@ -126,7 +126,7 @@
     {
         os_sema->count--;
         spin_unlock_irqrestore(&os_sema->lock, old_irq);
-        down(&os_sema->wait);
+        wait_for_completion(&os_sema->completion);
     }
     else
     {
@@ -203,7 +203,7 @@
     spin_unlock_irqrestore(&os_sema->lock, old_irq);
 
     if (doWakeup)
-        up(&os_sema->wait);
+        complete(&os_sema->completion);
 
     return RM_OK;
 }
@@ -554,6 +554,8 @@
     }
 
     MicroSeconds = MilliSeconds * 1000;
+
+#if 0
     tm_end.tv_usec = MicroSeconds;
     tm_end.tv_sec = 0;
     timeradd(&tm_aux, &tm_end, &tm_end);
@@ -593,6 +595,7 @@
                 MicroSeconds = 0;
         } while ((jiffies = NV_USECS_TO_JIFFIES(MicroSeconds)) != 0);
     }
+#endif
 
     if (MicroSeconds > 1000)
     {

Attachment: signature.asc
Description: OpenPGP digital signature

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.