From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Roessner Subject: Re: Powernow-k8 support Date: Tue, 13 Jun 2006 14:20:10 +0200 Message-ID: <448EAD7A.2020402@roessner-net.com> References: <84EA05E2CA77634C82730353CBE3A84303218DB7@SAUSEXMB1.amd.com> <7323ccafa3d18675107a67105b9a7469@cl.cam.ac.uk> <448D9D3A.8070502@roessner-net.com> <5b1471b1f6e8a778f13b5785eed389aa@cl.cam.ac.uk> <448E7C04.5000907@roessner-net.com> <85598d5553ec6d3b82d75eb1e889a396@cl.cam.ac.uk> <448E8436.6090309@roessner-net.com> <89593ac4e4b1ffd9a19cf1bda5c600c7@cl.cam.ac.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0715106829==" Return-path: In-Reply-To: <89593ac4e4b1ffd9a19cf1bda5c600c7@cl.cam.ac.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --===============0715106829== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig40503E3CF6AB7007212BED33" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig40503E3CF6AB7007212BED33 Content-Type: multipart/mixed; boundary="------------000201000602010008020702" This is a multi-part message in MIME format. --------------000201000602010008020702 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi, > It really depends what is hidden inside the binary-only portion. If the= y > 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. Lookin= g > 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 --------------000201000602010008020702 Content-Type: text/plain; name="patch-2.6-xen-sparse-nv.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="patch-2.6-xen-sparse-nv.diff" diff -urN linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c linux-2.6-xen-sp= arse-nv/arch/i386/mm/hypervisor.c --- linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c 2006-04-13 19:48:37.00= 0000000 +0200 +++ linux-2.6-xen-sparse-nv/arch/i386/mm/hypervisor.c 2006-04-16 15:34:51= =2E000000000 +0200 @@ -133,6 +133,7 @@ op.cmd =3D MMUEXT_TLB_FLUSH_LOCAL; BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); } +EXPORT_SYMBOL(xen_tlb_flush); =20 void xen_invlpg(unsigned long ptr) { diff -urN linux-2.6-xen-sparse/drivers/xen/core/evtchn.c linux-2.6-xen-sp= arse-nv/drivers/xen/core/evtchn.c --- linux-2.6-xen-sparse/drivers/xen/core/evtchn.c 2006-04-13 19:48:37.00= 0000000 +0200 +++ linux-2.6-xen-sparse-nv/drivers/xen/core/evtchn.c 2006-04-16 15:34:04= =2E000000000 +0200 @@ -188,7 +188,7 @@ { (void)HYPERVISOR_xen_version(0, NULL); } -EXPORT_SYMBOL_GPL(force_evtchn_callback); +EXPORT_SYMBOL(force_evtchn_callback); =20 /* 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 =20 u8 xen_features[XENFEAT_NR_SUBMAPS * 32] __read_mostly; -EXPORT_SYMBOL_GPL(xen_features); +EXPORT_SYMBOL(xen_features); =20 void setup_xen_features(void) { --------------000201000602010008020702 Content-Type: text/plain; name="patch-nv-1.0-8756-xen-3.0.2-2.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="patch-nv-1.0-8756-xen-3.0.2-2.diff" 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" =20 +#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 @@ =20 int nv_pat_enabled =3D 0; =20 +#ifdef CONFIG_XEN +static int nv_disable_pat =3D 1; +#else static int nv_disable_pat =3D 0; +#endif NV_MODULE_PARAMETER(nv_disable_pat); =20 #if defined(NVCPU_X86) || defined(NVCPU_X86_64) @@ -2087,7 +2094,11 @@ return -ENXIO; } =20 +#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 @@ } } =20 +#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); =20 +#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 +020= 0 @@ -19,8 +19,8 @@ #include =20 =20 -#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 @@ =20 #include #include +#include #include =20 #ifdef CONFIG_PROC_FS @@ -225,9 +226,13 @@ * tiny, and the kernel panics when it is exhausted. try to warn the use= r 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 =20 /* * 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 =3D phys_addr; page_ptr->page_count =3D NV_GET_PAGE_COUNT(page_ptr); page_ptr->virt_addr =3D virt_addr; +#ifdef CONFIG_XEN + page_ptr->dma_addr =3D phys_to_machine(page_ptr->phys_addr); +#else page_ptr->dma_addr =3D page_ptr->phys_addr; +#endif =20 /* 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 @@ =20 page_ptr->phys_addr =3D (ptr->memory[i] & PAGE_MASK); page_ptr->virt_addr =3D (unsigned long) __va(page_ptr->phys_add= r); +#ifdef CONFIG_XEN + page_ptr->dma_addr =3D phys_to_machine(page_ptr->phys_addr); +#else page_ptr->dma_addr =3D page_ptr->phys_addr; +#endif } =20 return RM_OK; diff -urN nv-1.0-8756/os-interface.c nv-1.0-8756-xen-3.0.2-2/os-interface= =2Ec --- 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; =20 // @@ -81,7 +81,7 @@ return rmStatus; =20 os_sema =3D (os_sema_t *)*ppSema; - sema_init(&os_sema->wait, 0); + init_completion(&os_sema->completion); spin_lock_init(&os_sema->lock); os_sema->count =3D 1; =20 @@ -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); =20 if (doWakeup) - up(&os_sema->wait); + complete(&os_sema->completion); =20 return RM_OK; } @@ -554,6 +554,8 @@ } =20 MicroSeconds =3D MilliSeconds * 1000; + +#if 0 tm_end.tv_usec =3D MicroSeconds; tm_end.tv_sec =3D 0; timeradd(&tm_aux, &tm_end, &tm_end); @@ -593,6 +595,7 @@ MicroSeconds =3D 0; } while ((jiffies =3D NV_USECS_TO_JIFFIES(MicroSeconds)) !=3D 0)= ; } +#endif =20 if (MicroSeconds > 1000) { --------------000201000602010008020702-- --------------enig40503E3CF6AB7007212BED33 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEjq17ZzAxnGuSmZcRAn2YAJ0bJoOIX4W5UBQ8IoqOU/z5fxdqlQCfbDgs FL+ESS/gSssZAxxEjfpqHI8= =TPYf -----END PGP SIGNATURE----- --------------enig40503E3CF6AB7007212BED33-- --===============0715106829== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0715106829==--