From: Grabber Subject: Patch NVIDIA 100.14.11-1 Date: Tue, 17 Jul 2007 14:53:34 -0300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0804172475==" Return-path: 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: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0804172475== Content-Type: multipart/alternative; boundary="----=_Part_24340_1296959.1184694814491" ------=_Part_24340_1296959.1184694814491 Content-Type: text/plain; charset=ISO-2022-JP; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Yeah, I modify some xen-nvidia patches to run with 10.14.11-1! diff -Nur modules/nvidia-kernel/nv/conftest.sh modules-patched-working/nvidia-kernel/nv/conftest.sh ― modules/nvidia-kernel/nv/conftest.sh 2007-07-02 21:57:14.000000000 -0300 +++ modules-patched-working/nvidia-kernel/nv/conftest.sh 2007-07-07 23:12: 39.000000000 -0300 @@ -896,65 +896,6 @@ fi ;; - xen_sanity_check) - # - # Check if the target kernel is a Xen kernel. If so, then exit, since - # the driver doesn't currently work with Xen. - # - RET=1 - VERBOSE=$6 - FILE="linux/autoconf.h" - - if [ -n "$IGNORE_XEN_PRESENCE" ]; then - exit 0 - fi - - if [ -f $HEADERS/$FILE -o -f $OUTPUT/include/$FILE ]; then - # - # We are looking at a configured source tree; verify - # that it's not a Xen kernel. - # - echo "#include - #ifdef CONFIG_XEN - #error CONFIG_XEN defined!! - #endif - " > conftest$$.c - - $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1 - rm -f conftest$$.c - - if [ -f conftest$$.o ]; then - rm -f conftest$$.o - RET=0 - fi - else - CONFIG=$HEADERS/../.config - if [ -f $CONFIG ]; then - if [ -z "$(grep "^CONFIG_XEN=y" $CONFIG)" ]; then - RET=0 - fi - fi - fi - - if [ "$RET" != "0″ ]; then - echo "The kernel you are installing for is a Xen kernel!"; - echo ""; - echo "The NVIDIA driver does not currently work on Xen kernels. If "; - echo "you are using a stock distribution kernel, please install "; - echo "a variant of this kernel without Xen support; if this is a "; - echo "custom kernel, please install a standard Linux kernel. Then "; - echo "try installing the NVIDIA kernel module again."; - echo ""; - if [ "$VERBOSE" = "full_output" ]; then - echo "*** Failed Xen sanity check. Bailing out! ***"; - echo ""; - fi - exit 1 - else - exit 0 - fi - ;; - acpi_device_ops_match) # # Determine if the acpi_device_ops data structure has diff -Nur modules/nvidia-kernel/nv/nv.c modules-patched-working/nvidia-kernel/nv/nv.c ― modules/nvidia-kernel/nv/nv.c 2007-07-02 21:57:15.000000000 -0300 +++ modules-patched-working/nvidia-kernel/nv/nv.c 2007-07-07 23:11: 42.000000000 -0300 @@ -39,20 +39,21 @@ #if defined(NV_PM_SUPPORT_OLD_STYLE_APM) static struct pm_dev *apm_nv_dev[NV_MAX_DEVICES] = { 0 }; #endif - int nv_pat_enabled = 0; -#if !defined(NV_BUILD_NV_PAT_SUPPORT) +#if defined(CONFIG_XEN) || defined(CONFIG_PREEMPT_RT) static int nv_disable_pat = 1; #else static int nv_disable_pat = 0; +#endif + +#if !defined(CONFIG_XEN) NV_MODULE_PARAMETER(nv_disable_pat); #endif #if defined(NVCPU_X86) || defined(NVCPU_X86_64) NvU64 __nv_supported_pte_mask = ~_PAGE_NX; #endif - /* * And one for the control device */ diff -Nur modules/nvidia-kernel/nv/nv-linux.hmodules-patched-working/nvidia-kernel/nv/nv- linux.h ― modules/nvidia-kernel/nv/nv-linux.h 2007-07-02 21:57:15.000000000 -0300 +++ modules-patched-working/nvidia-kernel/nv/nv-linux.h 2007-07-07 23:19: 50.000000000 -0300 @@ -261,7 +261,7 @@ * 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_SWIOTLB) && !defined(GFP_DMA32) +#if defined(CONFIG_SWIOTLB) && !defined(GFP_DMA32) && !defined(CONFIG_XEN) #define NV_SWIOTLB 1 #endif @@ -821,7 +821,10 @@ #define NV_VM_INSERT_PAGE(vma, addr, page) \ vm_insert_page(vma, addr, page) #endif -#if defined(NV_REMAP_PFN_RANGE_PRESENT) +#if defined(CONFIG_XEN) +#define NV_REMAP_PAGE_RANGE(from, offset, x…) \ + io_remap_pfn_range(vma, from, ((offset) >> PAGE_SHIFT), x) +#elif defined(NV_REMAP_PFN_RANGE_PRESENT) #define NV_REMAP_PAGE_RANGE(from, offset, x…) \ remap_pfn_range(vma, from, ((offset) >> PAGE_SHIFT), x) #elif defined(NV_REMAP_PAGE_RANGE_5_PRESENT) @@ -833,6 +836,7 @@ #define NV_REMAP_PAGE_RANGE(x…) remap_page_range(x) #endif #if !defined(CONFIG_XEN) +#define phys_to_machine(x) x #define NV_IO_REMAP_PAGE_RANGE(from, offset, x…) \ NV_REMAP_PAGE_RANGE(from, offset, x) #else diff -Nur modules/nvidia-kernel/nv/nv-vm.cmodules-patched-working/nvidia-kernel/nv/nv- vm.c ― modules/nvidia-kernel/nv/nv-vm.c 2007-07-02 21:57:15.000000000 -0300 +++ modules-patched-working/nvidia-kernel/nv/nv-vm.c 2007-07-07 23:22: 04.000000000 -0300 @@ -352,6 +352,9 @@ static void nv_flush_caches(void) { +#if defined(CONFIG_PREEMPT_RT) + if(!nv_pat_enabled) return; +#endif #if defined(KERNEL_2_4) // for 2.4 kernels, just automatically flush the caches and invalidate tlbs nv_execute_on_all_cpus(cache_flush, NULL); diff -Nur modules/nvidia-kernel/nv/os-agp.cmodules-patched-working/nvidia-kernel/nv/os- agp.c ― modules/nvidia-kernel/nv/os-agp.c 2007-07-02 21:57:15.000000000 -0300 +++ modules-patched-working/nvidia-kernel/nv/os-agp.c 2007-07-07 23:11: 42.000000000 -0300 @@ -295,7 +295,7 @@ page_ptr->phys_addr = (ptr->memory[i] & PAGE_MASK); page_ptr->virt_addr = (unsigned long) __va(page_ptr->phys_addr); - page_ptr->dma_addr = page_ptr->phys_addr; + page_ptr->dma_addr = phys_to_machine(page_ptr->phys_addr); } return RM_OK; diff -Nur modules/nvidia-kernel/nv/os-interface.cmodules-patched-working/nvidia-kernel/nv/os- interface.c ― modules/nvidia-kernel/nv/os-interface.c 2007-07-02 21:57:15.000000000-0300 +++ modules-patched-working/nvidia-kernel/nv/os-interface.c 2007-07-07 23:11:42.000000000 -0300 @@ -552,6 +552,7 @@ MicroSeconds = MilliSeconds * 1000; tm_end.tv_usec = MicroSeconds; tm_end.tv_sec = 0; +#if !defined(CONFIG_XEN) NV_TIMERADD(&tm_aux, &tm_end, &tm_end); /* do we have a full jiffie to wait? */ @@ -599,7 +600,7 @@ MicroSeconds = 0; } while ((jiffies = NV_USECS_TO_JIFFIES(MicroSeconds)) != 0); } - +#endif if (MicroSeconds > 1000) { mdelay_safe_msec = MicroSeconds / 1000; -- Regards, Luiz Vitor Martinez Cardoso [Grabber] ------=_Part_24340_1296959.1184694814491 Content-Type: text/html; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Content-Disposition: inline

Yeah,


I modify some xen-nvidia patches to run with 10.14.11-1!


diff -Nur modules/nvidia-kernel/nv/conftest.sh modules-patched-working/nvidia-kernel/nv/conftest.sh
― modules/nvidia-kernel/nv/conftest.sh 2007-07-02 21:57:14.000000000 -0300
+++ modules-patched-working/nvidia-kernel/nv/conftest.sh 2007-07-07 23:12:39.000000000 -0300
@@ -896,65 +896,6 @@
fi
;;

- xen_sanity_check)
- #
- # Check if the target kernel is a Xen kernel. If so, then exit, since
- # the driver doesn't currently work with Xen.
- #
- RET=1
- VERBOSE=$6
- FILE="linux/autoconf.h"
-
- if [ -n "$IGNORE_XEN_PRESENCE" ]; then
- exit 0
- fi
-
- if [ -f $HEADERS/$FILE -o -f $OUTPUT/include/$FILE ]; then
- #
- # We are looking at a configured source tree; verify
- # that it's not a Xen kernel.
- #
- echo "#include - #ifdef CONFIG_XEN
- #error CONFIG_XEN defined!!
- #endif
- " > conftest$$.c
-
- $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
- rm -f conftest$$.c
-
- if [ -f conftest$$.o ]; then
- rm -f conftest$$.o
- RET=0
- fi
- else
- CONFIG=$HEADERS/../.config
- if [ -f $CONFIG ]; then
- if [ -z "$(grep "^CONFIG_XEN=y" $CONFIG)" ]; then
- RET=0
- fi
- fi
- fi
-
- if [ "$RET" != "0″ ]; then
- echo "The kernel you are installing for is a Xen kernel!";
- echo "";
- echo "The NVIDIA driver does not currently work on Xen kernels. If ";
- echo "you are using a stock distribution kernel, please install ";
- echo "a variant of this kernel without Xen support; if this is a ";
- echo "custom kernel, please install a standard Linux kernel. Then ";
- echo "try installing the NVIDIA kernel module again.";
- echo "";
- if [ "$VERBOSE" = "full_output" ]; then
- echo "*** Failed Xen sanity check. Bailing out! ***";
- echo "";
- fi
- exit 1
- else
- exit 0
- fi
- ;;
-
acpi_device_ops_match)
#
# Determine if the acpi_device_ops data structure has
diff -Nur modules/nvidia-kernel/nv/nv.c modules-patched-working/nvidia-kernel/nv/nv.c
― modules/nvidia-kernel/nv/nv.c 2007-07-02 21:57:15.000000000 -0300
+++ modules-patched-working/nvidia-kernel/nv/nv.c 2007-07-07 23:11:42.000000000 -0300
@@ -39,20 +39,21 @@
#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
static struct pm_dev *apm_nv_dev[NV_MAX_DEVICES] = { 0 };
#endif
-
int nv_pat_enabled = 0;

-#if !defined(NV_BUILD_NV_PAT_SUPPORT)
+#if defined(CONFIG_XEN) || defined(CONFIG_PREEMPT_RT)
static int nv_disable_pat = 1;
#else
static int nv_disable_pat = 0;
+#endif
+
+#if !defined(CONFIG_XEN)
NV_MODULE_PARAMETER(nv_disable_pat);
#endif

#if defined(NVCPU_X86) || defined(NVCPU_X86_64)
NvU64 __nv_supported_pte_mask = ~_PAGE_NX;
#endif
-
/*
* And one for the control device
*/
diff -Nur modules/nvidia-kernel/nv/nv-linux.h modules-patched-working/nvidia-kernel/nv/nv-linux.h
― modules/nvidia-kernel/nv/nv-linux.h 2007-07-02 21:57:15.000000000 -0300
+++ modules-patched-working/nvidia-kernel/nv/nv-linux.h 2007-07-07 23:19:50.000000000 -0300
@@ -261,7 +261,7 @@
* 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_SWIOTLB) && !defined(GFP_DMA32)
+#if defined(CONFIG_SWIOTLB) && !defined(GFP_DMA32) && !defined(CONFIG_XEN)
#define NV_SWIOTLB 1
#endif

@@ -821,7 +821,10 @@
#define NV_VM_INSERT_PAGE(vma, addr, page) \
vm_insert_page(vma, addr, page)
#endif
-#if defined(NV_REMAP_PFN_RANGE_PRESENT)
+#if defined(CONFIG_XEN)
+#define NV_REMAP_PAGE_RANGE(from, offset, x…) \
+ io_remap_pfn_range(vma, from, ((offset) >> PAGE_SHIFT), x)
+#elif defined(NV_REMAP_PFN_RANGE_PRESENT)
#define NV_REMAP_PAGE_RANGE(from, offset, x…) \
remap_pfn_range(vma, from, ((offset) >> PAGE_SHIFT), x)
#elif defined(NV_REMAP_PAGE_RANGE_5_PRESENT)
@@ -833,6 +836,7 @@
#define NV_REMAP_PAGE_RANGE(x…) remap_page_range(x)
#endif
#if !defined(CONFIG_XEN)
+#define phys_to_machine(x) x
#define NV_IO_REMAP_PAGE_RANGE(from, offset, x…) \
NV_REMAP_PAGE_RANGE(from, offset, x)
#else
diff -Nur modules/nvidia-kernel/nv/nv-vm.c modules-patched-working/nvidia-kernel/nv/nv-vm.c
― modules/nvidia-kernel/nv/nv-vm.c 2007-07-02 21:57:15.000000000 -0300
+++ modules-patched-working/nvidia-kernel/nv/nv-vm.c 2007-07-07 23:22:04.000000000 -0300
@@ -352,6 +352,9 @@

static void nv_flush_caches(void)
{
+#if defined(CONFIG_PREEMPT_RT)
+ if(!nv_pat_enabled) return;
+#endif
#if defined(KERNEL_2_4)
// for 2.4 kernels, just automatically flush the caches and invalidate tlbs
nv_execute_on_all_cpus(cache_flush, NULL);
diff -Nur modules/nvidia-kernel/nv/os-agp.c modules-patched-working/nvidia-kernel/nv/os-agp.c
― modules/nvidia-kernel/nv/os-agp.c 2007-07-02 21:57:15.000000000 -0300
+++ modules-patched-working/nvidia-kernel/nv/os-agp.c 2007-07-07 23:11:42.000000000 -0300
@@ -295,7 +295,7 @@

page_ptr->phys_addr = (ptr->memory[i] & PAGE_MASK);
page_ptr->virt_addr = (unsigned long) __va(page_ptr->phys_addr);
- page_ptr->dma_addr = page_ptr->phys_addr;
+ page_ptr->dma_addr = phys_to_machine(page_ptr->phys_addr);
}

return RM_OK;
diff -Nur modules/nvidia-kernel/nv/os-interface.c modules-patched-working/nvidia-kernel/nv/os-interface.c
― modules/nvidia-kernel/nv/os-interface.c 2007-07-02 21:57:15.000000000 -0300
+++ modules-patched-working/nvidia-kernel/nv/os-interface.c 2007-07-07 23:11:42.000000000 -0300
@@ -552,6 +552,7 @@
MicroSeconds = MilliSeconds * 1000;
tm_end.tv_usec = MicroSeconds;
tm_end.tv_sec = 0;
+#if !defined(CONFIG_XEN)
NV_TIMERADD(&tm_aux, &tm_end, &tm_end);

/* do we have a full jiffie to wait? */
@@ -599,7 +600,7 @@
MicroSeconds = 0;
} while ((jiffies = NV_USECS_TO_JIFFIES(MicroSeconds)) != 0);
}
-
+#endif
if (MicroSeconds > 1000)
{
mdelay_safe_msec = MicroSeconds / 1000;


--

Regards,
Luiz Vitor Martinez Cardoso [Grabber]
------=_Part_24340_1296959.1184694814491-- --===============0804172475== 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 --===============0804172475==--