* inter_module_get and __symbol_get @ 2005-01-06 21:32 Terence Ripperda 2005-01-06 21:57 ` Brian Gerst 0 siblings, 1 reply; 26+ messages in thread From: Terence Ripperda @ 2005-01-06 21:32 UTC (permalink / raw) To: Linux Kernel Mailing List; +Cc: tripperda Hello, we've noticed that in recent 2.6.10 kernels that the inter_module_ routines (such as inter_module_get) are marked deprecated. it appears that the __symbol_ routines (such as __symbol_get) are intended as the replacement routines. unfortunately, __symbol_get is only exported as a GPL symbol (I see a reference to a _gpl verion in module.h, but no definition). is this intentional? will there be a non-gpled version of an equivalent routine? Thanks, Terence ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-06 21:32 inter_module_get and __symbol_get Terence Ripperda @ 2005-01-06 21:57 ` Brian Gerst 2005-01-06 22:51 ` Terence Ripperda 2005-01-08 3:10 ` Keith Owens 0 siblings, 2 replies; 26+ messages in thread From: Brian Gerst @ 2005-01-06 21:57 UTC (permalink / raw) To: Terence Ripperda; +Cc: Linux Kernel Mailing List Terence Ripperda wrote: > Hello, > > we've noticed that in recent 2.6.10 kernels that the inter_module_ > routines (such as inter_module_get) are marked deprecated. it appears > that the __symbol_ routines (such as __symbol_get) are intended as the > replacement routines. > > unfortunately, __symbol_get is only exported as a GPL symbol (I see a > reference to a _gpl verion in module.h, but no definition). is this > intentional? will there be a non-gpled version of an equivalent > routine? > > Thanks, > Terence I believe there is an AGP/DRM rewrite in progress that should eliminate the need to use inter_module or symbol_get stuff. -- Brian Gerst ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-06 21:57 ` Brian Gerst @ 2005-01-06 22:51 ` Terence Ripperda 2005-01-08 4:00 ` Jon Smirl 2005-01-08 3:10 ` Keith Owens 1 sibling, 1 reply; 26+ messages in thread From: Terence Ripperda @ 2005-01-06 22:51 UTC (permalink / raw) To: Brian Gerst; +Cc: Terence Ripperda, Linux Kernel Mailing List we currently use inter_module_get_request to make sure the agpgart module is loaded when we initialize. does this mean we would no longer need to make sure agpgart is loaded, or that it would always be loaded? Thanks, Terence On Thu, Jan 06, 2005 at 04:57:57PM -0500, bgerst@didntduck.org wrote: > I believe there is an AGP/DRM rewrite in progress that should eliminate > the need to use inter_module or symbol_get stuff. > > -- > Brian Gerst ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-06 22:51 ` Terence Ripperda @ 2005-01-08 4:00 ` Jon Smirl 2005-01-12 19:37 ` Terence Ripperda 0 siblings, 1 reply; 26+ messages in thread From: Jon Smirl @ 2005-01-08 4:00 UTC (permalink / raw) To: Terence Ripperda; +Cc: Brian Gerst, Linux Kernel Mailing List, Dave Airlie The inter_module_xxx free DRM is already in Linus BK. Sooner or later the inter_module_xx exports in the AGP driver should disappear too. DRM now handles things at compile time. If AGP is enabled at compile time, AGP support gets built into the DRM module. If AGP is not enabled, AGP does not get compiled in. If you try to take a DRM that was built for AGP and move it to a system without, it's not going to load because it will need the AGP symbols. -- Jon Smirl jonsmirl@gmail.com ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-08 4:00 ` Jon Smirl @ 2005-01-12 19:37 ` Terence Ripperda 2005-01-12 22:21 ` Brian Gerst 0 siblings, 1 reply; 26+ messages in thread From: Terence Ripperda @ 2005-01-12 19:37 UTC (permalink / raw) To: Jon Smirl Cc: Terence Ripperda, Brian Gerst, Linux Kernel Mailing List, Dave Airlie it would seem like the old mechanism was preferable, but perhaps I'm missing something. in this particular case, there are times when a user wants to avoid using agp at all for testing purposes, but if I understand correctly, we'll be forced to load agpgart anyways due to unresolved symbols. but I think Keith Owens was correct in his larger picture view that this mechanism is useful for much more than just agp. I'm just confused why it was regressed from a non-gpl symbol to a gpl symbol (or more appropriately why the non-gpl symbol was regressed in favor of a gpl-only symbol). Thanks, Terence On Fri, Jan 07, 2005 at 11:00:09PM -0500, jonsmirl@gmail.com wrote: > The inter_module_xxx free DRM is already in Linus BK. Sooner or later > the inter_module_xx exports in the AGP driver should disappear too. > > DRM now handles things at compile time. If AGP is enabled at compile > time, AGP support gets built into the DRM module. If AGP is not > enabled, AGP does not get compiled in. If you try to take a DRM that > was built for AGP and move it to a system without, it's not going to > load because it will need the AGP symbols. > > -- > Jon Smirl > jonsmirl@gmail.com ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-12 19:37 ` Terence Ripperda @ 2005-01-12 22:21 ` Brian Gerst 0 siblings, 0 replies; 26+ messages in thread From: Brian Gerst @ 2005-01-12 22:21 UTC (permalink / raw) To: Terence Ripperda; +Cc: Jon Smirl, Linux Kernel Mailing List, Dave Airlie Terence Ripperda wrote: > it would seem like the old mechanism was preferable, but perhaps I'm > missing something. in this particular case, there are times when a user > wants to avoid using agp at all for testing purposes, but if I > understand correctly, we'll be forced to load agpgart anyways due to > unresolved symbols. In 2.6, the "agpgart" module is just the core. Without a gart driver loaded (via-agp for example), it does nothing. If you really don't want to have the hard dependency on agpgart, make the code using it conditionally compile on CONFIG_AGP or something. > but I think Keith Owens was correct in his larger picture view that > this mechanism is useful for much more than just agp. I'm just > confused why it was regressed from a non-gpl symbol to a gpl symbol > (or more appropriately why the non-gpl symbol was regressed in favor > of a gpl-only symbol). symbol_get in it's current form is hard-coded to look for GPL symbols, hence it is exported GPL only. I have a rough patch that will allow symbol_get to use the license status of its caller to determine which symbols it can find. However this depends on whether or not symbol_get() is removed like some people want. -- Brian Gerst ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-06 21:57 ` Brian Gerst 2005-01-06 22:51 ` Terence Ripperda @ 2005-01-08 3:10 ` Keith Owens 2005-01-24 22:36 ` David Mosberger 1 sibling, 1 reply; 26+ messages in thread From: Keith Owens @ 2005-01-08 3:10 UTC (permalink / raw) To: Brian Gerst; +Cc: Terence Ripperda, Linux Kernel Mailing List On Thu, 06 Jan 2005 16:57:57 -0500, Brian Gerst <bgerst@didntduck.org> wrote: >Terence Ripperda wrote: >> Hello, >> >> we've noticed that in recent 2.6.10 kernels that the inter_module_ >> routines (such as inter_module_get) are marked deprecated. it appears >> that the __symbol_ routines (such as __symbol_get) are intended as the >> replacement routines. >> >> unfortunately, __symbol_get is only exported as a GPL symbol (I see a >> reference to a _gpl verion in module.h, but no definition). is this >> intentional? will there be a non-gpled version of an equivalent >> routine? >> >> Thanks, >> Terence > >I believe there is an AGP/DRM rewrite in progress that should eliminate >the need to use inter_module or symbol_get stuff. inter_module_* and the replacement __symbol_* routines are designed to solve a generic problem, they are not only there for AGP/DRM. I am against removing these functions just because AGP/DRM no longer require the facility, other code can hit the same generic problem. inter_module_* and __symbol_* solve these class of problems: Module A can use module B if B is loaded, but A does not require module B to do its work. B is optional. The kernel can use code in module C is C is loaded, but the base kernel does not require module C. C is optional. The standard module loader already handles the "require" cases, via the unresolved symbol list and modules.dep. The module loader cannot handle the "optional" cases, because only the consumer of the optional resources knows what it needs and what to do if the optional resources are not available. The consumer uses inter_module_* or __symbol_* to detect and lock down the optional facilities. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-08 3:10 ` Keith Owens @ 2005-01-24 22:36 ` David Mosberger 2005-01-24 22:44 ` Keith Owens 0 siblings, 1 reply; 26+ messages in thread From: David Mosberger @ 2005-01-24 22:36 UTC (permalink / raw) To: kaos; +Cc: bgerst, Terence Ripperda, Linux Kernel Mailing List Keith, I didn't see any followup to your message. My apologies if I missed something. You wrote: Keith> inter_module_* and __symbol_* solve these class of problems: Keith> Module A can use module B if B is loaded, but A does not Keith> require module B to do its work. B is optional. Keith> The kernel can use code in module C is C is loaded, but the Keith> base kernel does not require module C. C is optional. Why isn't this handled via weak references? If the reference comes out as 0, you know the underlying module/facility isn't there and proceed accordingly. --david ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-24 22:36 ` David Mosberger @ 2005-01-24 22:44 ` Keith Owens 2005-01-24 22:52 ` David Mosberger 2005-01-25 5:31 ` Terence Ripperda 0 siblings, 2 replies; 26+ messages in thread From: Keith Owens @ 2005-01-24 22:44 UTC (permalink / raw) To: davidm; +Cc: bgerst, Terence Ripperda, Linux Kernel Mailing List On Mon, 24 Jan 2005 14:36:10 -0800, David Mosberger <davidm@napali.hpl.hp.com> wrote: >Keith, > >I didn't see any followup to your message. My apologies if I missed >something. > >You wrote: > > Keith> inter_module_* and __symbol_* solve these class of problems: > > Keith> Module A can use module B if B is loaded, but A does not > Keith> require module B to do its work. B is optional. > > Keith> The kernel can use code in module C is C is loaded, but the > Keith> base kernel does not require module C. C is optional. > >Why isn't this handled via weak references? If the reference comes >out as 0, you know the underlying module/facility isn't there and >proceed accordingly. Weak references are only done once, when the module is loaded. We already use weak references for static determination of symbol availability. inter_module_* and __symbol_* are aimed at the dynamic reference problem, not static. Module A can use module B if B is loaded, but A does not require module B to do its work. B can be loaded at any time, or even unloaded at any time, although that is much rarer. Dynamic references require a register/unregister style interface, thus inter_module_* and __symbol_*. Does the kernel code really need optional dynamic references between modules or kernel -> modules? That depends on how people code their modules. If the rest of the kernel no longer needs dynamic symbol reference then drop inter_module_* and __symbol_*. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-24 22:44 ` Keith Owens @ 2005-01-24 22:52 ` David Mosberger 2005-01-24 22:54 ` Keith Owens 2005-01-24 23:19 ` Jon Smirl 2005-01-25 5:31 ` Terence Ripperda 1 sibling, 2 replies; 26+ messages in thread From: David Mosberger @ 2005-01-24 22:52 UTC (permalink / raw) To: Keith Owens; +Cc: davidm, bgerst, Terence Ripperda, Linux Kernel Mailing List >>>>> On Tue, 25 Jan 2005 09:44:18 +1100, Keith Owens <kaos@ocs.com.au> said: Keith> Does the kernel code really need optional dynamic references Keith> between modules or kernel -> modules? That depends on how Keith> people code their modules. If the rest of the kernel no Keith> longer needs dynamic symbol reference then drop Keith> inter_module_* and __symbol_*. Well, the only place that I know of where I (have to) care about inter_module*() is because of the DRM/AGP dependency. I can't imagine DRM being overly happy if an AGP device suddenly disappeared, so I think static is fine (in fact, probably preferable). Of course, the trick is how to pull the backwards compatibility off giving that for the time being we're more or less stuck with Nvidia's 5336 release on ia64... ;-( --david ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-24 22:52 ` David Mosberger @ 2005-01-24 22:54 ` Keith Owens 2005-01-24 22:58 ` David Mosberger 2005-01-24 23:19 ` Jon Smirl 1 sibling, 1 reply; 26+ messages in thread From: Keith Owens @ 2005-01-24 22:54 UTC (permalink / raw) To: davidm; +Cc: bgerst, Terence Ripperda, Linux Kernel Mailing List On Mon, 24 Jan 2005 14:52:06 -0800, David Mosberger <davidm@napali.hpl.hp.com> wrote: >>>>>> On Tue, 25 Jan 2005 09:44:18 +1100, Keith Owens <kaos@ocs.com.au> said: > > Keith> Does the kernel code really need optional dynamic references > Keith> between modules or kernel -> modules? That depends on how > Keith> people code their modules. If the rest of the kernel no > Keith> longer needs dynamic symbol reference then drop > Keith> inter_module_* and __symbol_*. > >Well, the only place that I know of where I (have to) care about >inter_module*() is because of the DRM/AGP dependency. I can't imagine >DRM being overly happy if an AGP device suddenly disappeared, so I >think static is fine (in fact, probably preferable). Does DRM support this model? * Start DRM without AGP. * AGP is loaded. * DRM continues but now using AGP. If yes then it needs dynamic symbol resolution. ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-24 22:54 ` Keith Owens @ 2005-01-24 22:58 ` David Mosberger 2005-01-24 23:03 ` Keith Owens 0 siblings, 1 reply; 26+ messages in thread From: David Mosberger @ 2005-01-24 22:58 UTC (permalink / raw) To: Keith Owens; +Cc: davidm, bgerst, Terence Ripperda, Linux Kernel Mailing List >>>>> On Tue, 25 Jan 2005 09:54:36 +1100, Keith Owens <kaos@ocs.com.au> said: Keith> Does DRM support this model? Keith> * Start DRM without AGP. Keith> * AGP is loaded. Keith> * DRM continues but now using AGP. Keith> If yes then it needs dynamic symbol resolution. I think it does, but I don't see any advantages to it (not on the machines I'm using, at least). In fact, I'd rather have an explicit dependency on AGP. --david ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-24 22:58 ` David Mosberger @ 2005-01-24 23:03 ` Keith Owens 2005-01-25 0:51 ` patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get) David Mosberger 2005-01-25 1:01 ` inter_module_get and __symbol_get Jon Smirl 0 siblings, 2 replies; 26+ messages in thread From: Keith Owens @ 2005-01-24 23:03 UTC (permalink / raw) To: davidm; +Cc: bgerst, Terence Ripperda, Linux Kernel Mailing List On Mon, 24 Jan 2005 14:58:29 -0800, David Mosberger <davidm@napali.hpl.hp.com> wrote: >>>>>> On Tue, 25 Jan 2005 09:54:36 +1100, Keith Owens <kaos@ocs.com.au> said: > > Keith> Does DRM support this model? > > Keith> * Start DRM without AGP. > Keith> * AGP is loaded. > Keith> * DRM continues but now using AGP. > > Keith> If yes then it needs dynamic symbol resolution. > >I think it does, but I don't see any advantages to it (not on the >machines I'm using, at least). In fact, I'd rather have an explicit >dependency on AGP. No argument from me :). I have always hated the dynamic resolution model used by DRM/AGP and (originally) MTD. I have a very dim and distant memory from about 6 years ago that somebody wanted the ability to run DRM with and without AGP support. IOW, the decision about whether to load AGP or not was left to the user, instead of AGP always being automatically loaded by modprobe. Again this comes down to static vs. dynamic symbol resolution. ^ permalink raw reply [flat|nested] 26+ messages in thread
* patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get) 2005-01-24 23:03 ` Keith Owens @ 2005-01-25 0:51 ` David Mosberger 2005-01-25 12:56 ` J.A. Magallon 2005-01-25 1:01 ` inter_module_get and __symbol_get Jon Smirl 1 sibling, 1 reply; 26+ messages in thread From: David Mosberger @ 2005-01-25 0:51 UTC (permalink / raw) To: Keith Owens Cc: linux-ia64, davidm, tony.luck, bgerst, Terence Ripperda, Linux Kernel Mailing List >>>>> On Tue, 25 Jan 2005 10:03:01 +1100, Keith Owens <kaos@ocs.com.au> said: Keith> I have always hated the dynamic resolution model used by Keith> DRM/AGP and (originally) MTD. Well, the attached patch does the trick for me for Nvidia driver v5336 on ia64. It compiles with a minimum amount of fuss with gcc v3.4 (just a handful of warnings about deprecated pm_{un,}register() and inter_module_put()). I have only tried it against 2.6.11-rc2 (really: Linus' bk tree as of today) but I hope I didn't screw up backwards compatibility for older kernels too badly. Note: I removed the super-user sanity check---I hate that one since it prevents me from building the module on an NFS-mounted file-system. If you don't care for that bit, just omit the patch to conftest.sh. --david diff -urN -x nv_compiler.h -x '*.mod.c' -x '*.ko' -x '*.d' -x '*.o' -x '*~' -x build -x Makefile -x '.*' NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/Makefile.kbuild NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/Makefile.kbuild --- NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/Makefile.kbuild 2004-01-16 12:46:59.000000000 -0800 +++ NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/Makefile.kbuild 2005-01-24 15:49:37.000000000 -0800 @@ -73,7 +73,7 @@ # EXTRA_CFLAGS += -I$(src) -EXTRA_CFLAGS += -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wno-multichar -Werror -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error +EXTRA_CFLAGS += -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wno-multichar -Werror -O2 -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error # # We rely on these two definitions below; if they aren't set, we set them to @@ -199,7 +199,7 @@ # module: gcc-sanity-check - @make CC=$(CC) $(KBUILD_PARAMS) modules; \ + @make CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(KBUILD_PARAMS) modules; \ if ! [ -f $(MODULE_OBJECT) ]; then \ echo "$(MODULE_OBJECT) failed to build!"; \ exit 1; \ diff -urN -x nv_compiler.h -x '*.mod.c' -x '*.ko' -x '*.d' -x '*.o' -x '*~' -x build -x Makefile -x '.*' NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/conftest.sh NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/conftest.sh --- NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/conftest.sh 2004-01-16 12:46:59.000000000 -0800 +++ NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/conftest.sh 2005-01-24 15:49:33.000000000 -0800 @@ -129,7 +129,7 @@ echo -en "\033[1;31m"; echo -e "*** Failed super-user sanity check. Bailing out! ***"; echo -en "\033[0m"; - exit 1 + exit 0 else exit 0 fi diff -urN -x nv_compiler.h -x '*.mod.c' -x '*.ko' -x '*.d' -x '*.o' -x '*~' -x build -x Makefile -x '.*' NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/nv-linux.h NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/nv-linux.h --- NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/nv-linux.h 2004-01-16 12:46:59.000000000 -0800 +++ NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/nv-linux.h 2005-01-24 16:09:14.000000000 -0800 @@ -24,7 +24,7 @@ # define KERNEL_2_4 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) # error This driver does not support 2.5 kernels! -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0) && defined(NVCPU_X86) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0) # define KERNEL_2_6 #else # error This driver does not support development kernels! @@ -293,13 +293,13 @@ #if defined(NVCPU_IA64) #define NV_VMALLOC(ptr, size) \ { \ - (void *) (ptr) = vmalloc_dma(size); \ + (ptr) = __vmalloc(size, GFP_KERNEL|GFP_DMA, PAGE_KERNEL); \ VM_ALLOC_RECORD(ptr, size, "vm_alloc"); \ } #else #define NV_VMALLOC(ptr, size) \ { \ - (void *) (ptr) = vmalloc_32(size); \ + (ptr) = vmalloc_32(size); \ VM_ALLOC_RECORD(ptr, size, "vm_alloc"); \ } #endif @@ -333,13 +333,13 @@ */ #define NV_KMALLOC(ptr, size) \ { \ - (void *) (ptr) = kmalloc(size, GFP_KERNEL); \ + (ptr) = kmalloc(size, GFP_KERNEL); \ KM_ALLOC_RECORD(ptr, size, "km_alloc"); \ } #define NV_KMALLOC_ATOMIC(ptr, size) \ { \ - (void *) (ptr) = kmalloc(size, GFP_ATOMIC); \ + (ptr) = kmalloc(size, GFP_ATOMIC); \ KM_ALLOC_RECORD(ptr, size, "km_alloc_atomic"); \ } @@ -352,7 +352,7 @@ #define NV_GET_FREE_PAGES(ptr, order) \ { \ - (void *) (ptr) = __get_free_pages(NV_GFP_HW, order); \ + (ptr) = __get_free_pages(NV_GFP_HW, order); \ } #define NV_FREE_PAGES(ptr, order) \ @@ -454,14 +454,22 @@ * relevant releases to date use it. This version was backported to 2.4 * without means to identify the change, hence this hack. */ -#if defined(REMAP_PAGE_RANGE_5) -#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(vma, a, ## b) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) +#define NV_REMAP_PFN_RANGE(a,b,c,d) remap_pfn_range(vma, a, b, c, d) +#elif defined(REMAP_PAGE_RANGE_5) +#define NV_REMAP_PFN_RANGE(a, b...) remap_page_range(vma, a << PAGE_SHIFT, ## b) #elif defined(REMAP_PAGE_RANGE_4) -#define NV_REMAP_PAGE_RANGE(a, b...) remap_page_range(a, ## b) +#define NV_REMAP_PFN_RANGE(a, b...) remap_page_range(a << PAGE_SHIFT, ## b) #else #error "Couldn't determine number of arguments expected by remap_page_range!" #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11) +typedef pgd_t pud_t; +# define pud_offset(pg_dir, address) (pg_dir); +# define pud_none(pud) 0 +#endif + #if defined(pte_offset_atomic) #define NV_PTE_OFFSET(addres, pg_mid_dir, pte) \ { \ @@ -540,17 +548,6 @@ #define page_to_pfn(page) ((page) - mem_map) #endif -/* On IA64 physical memory is partitioned into a cached and an - * uncached view controlled by bit 63. Set this bit when remapping - * page ranges. - */ -#if defined(NVCPU_IA64) -#define phys_to_uncached(addr) ((addr) | ((unsigned long) 1<<63)) -#else -/* Some other scheme must be used on this platform */ -#define phys_to_uncached(addr) (addr) -#endif - /* * An allocated bit of memory using NV_MEMORY_ALLOCATION_OFFSET * looks like this in the driver diff -urN -x nv_compiler.h -x '*.mod.c' -x '*.ko' -x '*.d' -x '*.o' -x '*~' -x build -x Makefile -x '.*' NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/nv.c NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/nv.c --- NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/nv.c 2004-01-16 12:46:59.000000000 -0800 +++ NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/nv.c 2005-01-24 16:43:33.000000000 -0800 @@ -212,12 +212,15 @@ count = 0; dev = (struct pci_dev *) 0; - dev = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, dev); + dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev); while (dev) { if ((dev->vendor != 0x10de) || (dev->device < 0x20)) goto next; + if (pci_enable_device(dev)) + goto next; + /* initialize bus-dependent config state */ nvl = &nv_linux_devices[count]; nv = NV_STATE_PTR(nvl); @@ -303,7 +306,7 @@ } next: - dev = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, dev); + dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev); } nv_printf(NV_DBG_INFO, "NVRM: found %d device%s\n", count, count ? "" : "s"); @@ -620,7 +623,7 @@ u8 cap_ptr; int func, slot; - dev = pci_find_class(class << 8, NULL); + dev = pci_get_class(class << 8, NULL); do { for (func = 0; func < 8; func++) { slot = PCI_SLOT(dev->devfn); @@ -631,7 +634,7 @@ if (cap_ptr) return fn; } - dev = pci_find_class(class << 8, dev); + dev = pci_get_class(class << 8, dev); } while (dev); return NULL; @@ -1070,7 +1073,7 @@ * addresses by the CPU. This nopage handler will fault on CPU * accesses to AGP memory and map the address to the correct page. */ -struct page *nv_kern_vma_nopage(struct vm_area_struct *vma, unsigned long address, int write_access) +struct page *nv_kern_vma_nopage(struct vm_area_struct *vma, unsigned long address, int *write_accessp) { #if defined(NVCPU_IA64) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 9)) nv_alloc_t *at, *tmp; @@ -1201,6 +1204,7 @@ { nv_state_t *nv = (nv_state_t *) 0; nv_linux_state_t *nvl = (nv_linux_state_t *) 0; + nv_file_private_t *nv_private; int devnum; int rc = 0, status; @@ -1229,7 +1233,8 @@ nv_printf(NV_DBG_INFO, "nv_kern_open on device %d\n", devnum); nv_down(nvl->ldata_lock); - NVL_FROM_FILEP(file) = nvl; + nv_private = file->private_data; + nv_private->nvptr = nvl; /* * map the memory and allocate isr on first open @@ -1405,8 +1410,8 @@ pages = nv->regs->size / PAGE_SIZE; vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - if (NV_REMAP_PAGE_RANGE(vma->vm_start, - phys_to_uncached(NV_VMA_OFFSET(vma)), + if (NV_REMAP_PFN_RANGE(vma->vm_start, + NV_VMA_OFFSET(vma) >> PAGE_SHIFT, vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; @@ -1424,8 +1429,8 @@ pages = nv->fb->size / PAGE_SIZE; vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - if (NV_REMAP_PAGE_RANGE(vma->vm_start, - phys_to_uncached(NV_VMA_OFFSET(vma)), + if (NV_REMAP_PFN_RANGE(vma->vm_start, + NV_VMA_OFFSET(vma) >> PAGE_SHIFT, vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; @@ -1512,7 +1517,8 @@ while (pages--) { page = (unsigned long) at->page_table[i++].phys_addr; - if (NV_REMAP_PAGE_RANGE(start, page, PAGE_SIZE, PAGE_SHARED)) + if (NV_REMAP_PFN_RANGE(start, page >> PAGE_SHIFT, PAGE_SIZE, + PAGE_SHARED)) return -EAGAIN; start += PAGE_SIZE; pos += PAGE_SIZE; @@ -1863,6 +1869,7 @@ struct file *file ) { + nv_file_private_t *nv_private; nv_state_t *nv; nv_linux_state_t *nvl; int rc = 0; @@ -1877,7 +1884,8 @@ nv->device_number = NV_CONTROL_DEVICE_NUMBER; /* save the nv away in file->private_data */ - NVL_FROM_FILEP(file) = nvl; + nv_private = file->private_data; + nv_private->nvptr = nvl; if (nv->usage_count == 0) { @@ -2308,6 +2316,7 @@ ) { pgd_t *pg_dir; + pud_t *pud_dir; pmd_t *pg_mid_dir; pte_t pte; unsigned long retval; @@ -2318,7 +2327,11 @@ if (pgd_none(*pg_dir)) goto failed; - pg_mid_dir = pmd_offset(pg_dir, address); + pud_dir = pud_offset(pg_dir, address); + if (pud_none(*pud_dir)) + goto failed; + + pg_mid_dir = pmd_offset(pud_dir, address); if (pmd_none(*pg_mid_dir)) goto failed; diff -urN -x nv_compiler.h -x '*.mod.c' -x '*.ko' -x '*.d' -x '*.o' -x '*~' -x build -x Makefile -x '.*' NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/os-agp.c NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/os-agp.c --- NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/os-agp.c 2004-01-16 12:46:59.000000000 -0800 +++ NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/os-agp.c 2005-01-24 16:18:34.000000000 -0800 @@ -47,7 +47,6 @@ agp_kern_info agpinfo; agp_gart gart; -const drm_agp_t *drm_agp_p; #if defined(CONFIG_MTRR) #define MTRR_DEL(gart) if ((gart).mtrr > 0) mtrr_del((gart).mtrr, 0, 0); @@ -75,12 +74,7 @@ memset( (void *) &gart, 0, sizeof(agp_gart)); - if (!(drm_agp_p = inter_module_get_request("drm_agp", "agpgart"))) - { - nv_printf(NV_DBG_ERRORS, - "NVRM: AGPGART: unable to retrieve symbol table\n"); - return 1; - } + request_module("%s", "agpgart"); /* NOTE: from here down, return an error code of '-1' * that indicates that agpgart is loaded, but we failed to use it @@ -88,7 +82,7 @@ * the memory controller. */ - if (drm_agp_p->acquire()) + if (agp_backend_acquire()) { nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n"); return -1; @@ -113,10 +107,10 @@ * chipsets via this function. If this Linux 2.4 kernels behaves the same * way, we have no way to know. */ - drm_agp_p->copy_info(&agpinfo); + agp_copy_info(&agpinfo); #else - if (drm_agp_p->copy_info(&agpinfo)) { - drm_agp_p->release(); + if (agp_copy_info(&agpinfo)) { + agp_backend_release(); inter_module_put("drm_agp"); return -1; } @@ -134,7 +128,7 @@ */ nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to set MTRR write-combining\n"); - drm_agp_p->release(); + agp_backend_release(); inter_module_put("drm_agp"); return -1; } @@ -151,7 +145,7 @@ { nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap aperture\n"); MTRR_DEL(gart); - drm_agp_p->release(); + agp_backend_release(); inter_module_put("drm_agp"); return -1; } @@ -163,7 +157,7 @@ nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to allocate bitmap\n"); NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE); MTRR_DEL(gart); - drm_agp_p->release(); + agp_backend_release(); inter_module_put("drm_agp"); return -1; } @@ -175,7 +169,7 @@ os_free_mem(bitmap); NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE); MTRR_DEL(gart); - drm_agp_p->release(); + agp_backend_release(); inter_module_put("drm_agp"); return -1; } @@ -186,7 +180,7 @@ if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004; if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002; - drm_agp_p->enable(agpinfo.mode); + agp_enable(agpinfo.mode); *ap_phys_base = (void*) agpinfo.aper_base; *ap_mapped_base = (void*) gart.aperture; @@ -221,7 +215,7 @@ NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE); } - drm_agp_p->release(); + agp_backend_release(); inter_module_put("drm_agp"); @@ -270,7 +264,7 @@ return RM_ERROR; } - ptr = drm_agp_p->allocate_memory(PageCount, AGP_NORMAL_MEMORY); + ptr = agp_allocate_memory(PageCount, AGP_NORMAL_MEMORY); if (ptr == NULL) { *pAddress = (void*) 0; @@ -278,7 +272,7 @@ return RM_ERR_NO_FREE_MEM; } - err = drm_agp_p->bind_memory(ptr, *Offset); + err = agp_bind_memory(ptr, *Offset); if (err) { // this happens a lot when the aperture itself fills up.. @@ -295,7 +289,7 @@ if (status != RM_OK) { nv_printf(NV_DBG_ERRORS, "NVRM: memory allocation failed\n"); - drm_agp_p->unbind_memory(ptr); + agp_unbind_memory(ptr); goto fail; } @@ -310,7 +304,7 @@ return RM_OK; fail: - drm_agp_p->free_memory(ptr); + agp_free_memory(ptr); *pAddress = (void*) 0; return RM_ERROR; @@ -350,7 +344,7 @@ { nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n", (unsigned long)agp_data->num_pages); - drm_agp_p->unbind_memory(agp_data->ptr); + agp_unbind_memory(agp_data->ptr); goto fail; } @@ -449,8 +443,8 @@ { size_t pages = ptr->page_count; - drm_agp_p->unbind_memory(ptr); - drm_agp_p->free_memory(ptr); + agp_unbind_memory(ptr); + agp_free_memory(ptr); nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n", (unsigned long)pages); diff -urN -x nv_compiler.h -x '*.mod.c' -x '*.ko' -x '*.d' -x '*.o' -x '*~' -x build -x Makefile -x '.*' NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/os-interface.c NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/os-interface.c --- NVIDIA-Linux-ia64-1.0-5336-pkg1/usr/src/nv/os-interface.c 2004-01-16 12:46:59.000000000 -0800 +++ NVIDIA-Linux-ia64-1.0-5336-pkg1-davidm/usr/src/nv/os-interface.c 2005-01-24 16:18:10.000000000 -0800 @@ -913,8 +913,8 @@ vma = (struct vm_area_struct *) *priv; - if (NV_REMAP_PAGE_RANGE(vma->vm_start, - start & PAGE_MASK, size_bytes, PAGE_SHARED)) + if (NV_REMAP_PFN_RANGE(vma->vm_start, + start >> PAGE_SHIFT, size_bytes, PAGE_SHARED)) return NULL; return (void *)(NV_UINTPTR_T) vma->vm_start; ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get) 2005-01-25 0:51 ` patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get) David Mosberger @ 2005-01-25 12:56 ` J.A. Magallon 2005-01-25 20:50 ` Zephaniah E. Hull 0 siblings, 1 reply; 26+ messages in thread From: J.A. Magallon @ 2005-01-25 12:56 UTC (permalink / raw) To: davidm; +Cc: Lista Linux-Kernel [-- Attachment #1: Type: text/plain, Size: 1254 bytes --] On 2005.01.25, David Mosberger wrote: > >>>>> On Tue, 25 Jan 2005 10:03:01 +1100, Keith Owens <kaos@ocs.com.au> said: > > Keith> I have always hated the dynamic resolution model used by > Keith> DRM/AGP and (originally) MTD. > > Well, the attached patch does the trick for me for Nvidia driver v5336 > on ia64. It compiles with a minimum amount of fuss with gcc v3.4 > (just a handful of warnings about deprecated pm_{un,}register() and > inter_module_put()). > You can use the latest drivers (6629) with this patches: http://www.minion.de/files/1.0-6629/ They work fine up to -rc2. If you want to use the driver with -mm, you have to kill the support for AGPGART in nvidia driver, add -DNOAGPGART to EXTRA_CFLAGS in the makefile. It will require a big change to use the multi-agp patches in -mm. But you are restricted to those AGPs supported by nvidia (ah, and don't load any agp related module...). Ah, just a ton of workarounds.... -- J.A. Magallon <jamagallon()able!es> \ Software is like sex: werewolf!able!es \ It's better when it's free Mandrakelinux release 10.2 (Cooker) for i586 Linux 2.6.10-jam6 (gcc 3.4.3 (Mandrakelinux 10.2 3.4.3-3mdk)) #1 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get) 2005-01-25 12:56 ` J.A. Magallon @ 2005-01-25 20:50 ` Zephaniah E. Hull 2005-01-26 0:02 ` J.A. Magallon 2005-01-26 0:25 ` J.A. Magallon 0 siblings, 2 replies; 26+ messages in thread From: Zephaniah E. Hull @ 2005-01-25 20:50 UTC (permalink / raw) To: J.A. Magallon; +Cc: davidm, Lista Linux-Kernel [-- Attachment #1.1: Type: text/plain, Size: 1246 bytes --] On Tue, Jan 25, 2005 at 12:56:25PM +0000, J.A. Magallon wrote: <snip> > You can use the latest drivers (6629) with this patches: > > http://www.minion.de/files/1.0-6629/ > > They work fine up to -rc2. > > If you want to use the driver with -mm, you have to kill the support > for AGPGART in nvidia driver, add -DNOAGPGART to EXTRA_CFLAGS in the > makefile. It will require a big change to use the multi-agp patches > in -mm. But you are restricted to those AGPs supported by nvidia > (ah, and don't load any agp related module...). For values of big changes that equal the attached patch. I'm using it on 2.6.10-mm3. I sent it to Zander however since there is no way to detect the new multi-agp support barring some sick hacks it has not gone in. It may conflict with the support for the 2.6.11-rc kernels, in which case when I next upgrade I'll find out and write a new one. > > Ah, just a ton of workarounds.... -- 1024D/E65A7801 Zephaniah E. Hull <warp@babylon.d2dc.net> 92ED 94E4 B1E6 3624 226D 5727 4453 008B E65A 7801 CCs of replies from mailing lists are requested. <Mercury> Be warned, I have a keyboard I can use to beat luser's heads in, and then continue to use... (=:] <Deek> Mercury: Oh, an IBM. :) [-- Attachment #1.2: nvidia_multiagp.diff --] [-- Type: text/plain, Size: 2808 bytes --] diff -ur modules/nvidia-kernel/nv/nv-linux.h modules_new/nvidia-kernel/nv/nv-linux.h --- modules/nvidia-kernel/nv/nv-linux.h 2004-11-12 14:14:20.000000000 -0500 +++ modules_new/nvidia-kernel/nv/nv-linux.h 2005-01-18 23:25:03.000000000 -0500 @@ -854,6 +854,9 @@ /* lock for linux-specific alloc queue */ struct semaphore at_lock; + + /* AGP handle. */ + struct agp_bridge_data *agp_bridge; } nv_linux_state_t; diff -ur modules/nvidia-kernel/nv/os-agp.c modules_new/nvidia-kernel/nv/os-agp.c --- modules/nvidia-kernel/nv/os-agp.c 2004-11-12 14:14:20.000000000 -0500 +++ modules_new/nvidia-kernel/nv/os-agp.c 2005-01-18 23:22:51.000000000 -0500 @@ -70,6 +70,7 @@ U032 agp_fw; void *bitmap; U032 bitmap_size; + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); memset( (void *) &gart, 0, sizeof(agp_gart)); @@ -82,7 +83,7 @@ * the memory controller. */ - if (drm_agp_p->acquire()) + if (!(nvl->agp_bridge = drm_agp_p->acquire(nvl->dev))) { nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: backend in use\n"); inter_module_put("drm_agp"); @@ -110,7 +111,7 @@ */ drm_agp_p->copy_info(&agpinfo); #else - if (drm_agp_p->copy_info(&agpinfo)) { + if (drm_agp_p->copy_info(nvl->agp_bridge, &agpinfo)) { nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: kernel reports chipset as unsupported\n"); goto failed; @@ -170,7 +171,7 @@ if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004; if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002; - drm_agp_p->enable(agpinfo.mode); + drm_agp_p->enable(nvl->agp_bridge, agpinfo.mode); *ap_phys_base = (void*) agpinfo.aper_base; *ap_mapped_base = (void*) gart.aperture; @@ -182,7 +183,7 @@ failed: MTRR_DEL(gart); /* checks gart.mtrr */ - drm_agp_p->release(); + drm_agp_p->release(nvl->agp_bridge); inter_module_put("drm_agp"); return -1; @@ -198,6 +199,7 @@ return 1; #else void *bitmap; + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); /* sanity check to make sure we should actually be here. */ if (!gart.ready) @@ -213,7 +215,7 @@ NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE); } - drm_agp_p->release(); + drm_agp_p->release(nvl->agp_bridge); inter_module_put("drm_agp"); @@ -247,6 +249,7 @@ int err; agp_priv_data *data; RM_STATUS status; + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); if (!gart.ready) { @@ -262,7 +265,7 @@ return RM_ERROR; } - ptr = drm_agp_p->allocate_memory(PageCount, AGP_NORMAL_MEMORY); + ptr = drm_agp_p->allocate_memory(nvl->agp_bridge, PageCount, AGP_NORMAL_MEMORY); if (ptr == NULL) { *pAddress = (void*) 0; [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get) 2005-01-25 20:50 ` Zephaniah E. Hull @ 2005-01-26 0:02 ` J.A. Magallon 2005-01-26 0:25 ` Zephaniah E. Hull 2005-01-26 0:25 ` J.A. Magallon 1 sibling, 1 reply; 26+ messages in thread From: J.A. Magallon @ 2005-01-26 0:02 UTC (permalink / raw) To: Zephaniah E. Hull; +Cc: davidm, Lista Linux-Kernel [-- Attachment #1: Type: text/plain, Size: 9322 bytes --] On 2005.01.25, Zephaniah E. Hull wrote: > On Tue, Jan 25, 2005 at 12:56:25PM +0000, J.A. Magallon wrote: > <snip> > > You can use the latest drivers (6629) with this patches: > > > > http://www.minion.de/files/1.0-6629/ > > > > They work fine up to -rc2. > > > > If you want to use the driver with -mm, you have to kill the support > > for AGPGART in nvidia driver, add -DNOAGPGART to EXTRA_CFLAGS in the > > makefile. It will require a big change to use the multi-agp patches > > in -mm. But you are restricted to those AGPs supported by nvidia > > (ah, and don't load any agp related module...). > > For values of big changes that equal the attached patch. > > I'm using it on 2.6.10-mm3. I sent it to Zander however since there is > no way to detect the new multi-agp support barring some sick hacks it > has not gone in. > > It may conflict with the support for the 2.6.11-rc kernels, in which > case when I next upgrade I'll find out and write a new one. > > > > Ah, just a ton of workarounds.... > Hay, that gave me the clues I was missing !!! With patch below, I get 6629 working on 2.6.10-rc2-mm1. Apply it on top of all the patches in the link above. I know, it is ugly as hell (all those superfluos parameters in NV_AGPGART macros, unused drm_agp_p...), but perhaps someone will rework all that macro mesh. For the moment, it works.... diff -ruN nv-6629-jam/src/nv/nv-linux.h nv-6629-jam-2/src/nv/nv-linux.h --- nv-6629-jam/src/nv/nv-linux.h 2005-01-24 23:16:46.000000000 +0100 +++ nv-6629-jam-2/src/nv/nv-linux.h 2005-01-26 00:25:10.000000000 +0100 @@ -930,6 +930,9 @@ /* lock for linux-specific alloc queue */ struct semaphore at_lock; + + /* AGP bridge handle */ + struct agp_bridge_data *agp_bridge; } nv_linux_state_t; diff -ruN nv-6629-jam/src/nv/nv.c nv-6629-jam-2/src/nv/nv.c --- nv-6629-jam/src/nv/nv.c 2005-01-24 23:16:46.000000000 +0100 +++ nv-6629-jam-2/src/nv/nv.c 2005-01-26 00:47:14.000000000 +0100 @@ -3011,10 +3011,11 @@ return -1; } #elif defined(AGPGART) - int error; - if ((error = agp_backend_acquire()) != -EINVAL) + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); + nvl->agp_bridge = agp_backend_acquire(nvl->dev); + if (nvl->agp_bridge) { - if (!error) agp_backend_release(); + agp_backend_release(nvl->agp_bridge); nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, an AGPGART backend is loaded!\n"); return -1; diff -ruN nv-6629-jam/src/nv/os-agp.c nv-6629-jam-2/src/nv/os-agp.c --- nv-6629-jam/src/nv/os-agp.c 2005-01-24 23:16:46.000000000 +0100 +++ nv-6629-jam-2/src/nv/os-agp.c 2005-01-26 00:49:01.000000000 +0100 @@ -60,23 +60,23 @@ #endif #if defined(KERNEL_2_6) -#define NV_AGPGART_BACKEND_ACQUIRE(o) agp_backend_acquire() -#define NV_AGPGART_BACKEND_ENABLE(o,mode) agp_enable(mode) -#define NV_AGPGART_BACKEND_RELEASE(o) agp_backend_release() -#define NV_AGPGART_COPY_INFO(o,p) agp_copy_info(p) -#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) agp_allocate_memory(count,type) -#define NV_AGPGART_FREE_MEMORY(o,p) agp_free_memory(p) -#define NV_AGPGART_BIND_MEMORY(o,p,offset) agp_bind_memory(p,offset) -#define NV_AGPGART_UNBIND_MEMORY(o,p) agp_unbind_memory(p) +#define NV_AGPGART_BACKEND_ACQUIRE(nvl,o) ({ nvl->agp_bridge = agp_backend_acquire(nvl->dev); !nvl->agp_bridge; }) +#define NV_AGPGART_BACKEND_ENABLE(nvl,o,mode) agp_enable(nvl->agp_bridge,mode) +#define NV_AGPGART_BACKEND_RELEASE(nvl,o) agp_backend_release(nvl->agp_bridge) +#define NV_AGPGART_COPY_INFO(nvl,o,p) agp_copy_info(nvl->agp_bridge,p) +#define NV_AGPGART_ALLOCATE_MEMORY(nvl,o,count,type) agp_allocate_memory(nvl->agp_bridge,count,type) +#define NV_AGPGART_FREE_MEMORY(nvl,o,p) agp_free_memory(p) +#define NV_AGPGART_BIND_MEMORY(nvl,o,p,offset) agp_bind_memory(p,offset) +#define NV_AGPGART_UNBIND_MEMORY(nvl,o,p) agp_unbind_memory(p) #elif defined(KERNEL_2_4) -#define NV_AGPGART_BACKEND_ACQUIRE(o) ({ (o)->acquire(); 0; }) -#define NV_AGPGART_BACKEND_ENABLE(o,mode) (o)->enable(mode) -#define NV_AGPGART_BACKEND_RELEASE(o) ((o)->release()) -#define NV_AGPGART_COPY_INFO(o,p) ({ (o)->copy_info(p); 0; }) -#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) (o)->allocate_memory(count,type) -#define NV_AGPGART_FREE_MEMORY(o,p) (o)->free_memory(p) -#define NV_AGPGART_BIND_MEMORY(o,p,offset) (o)->bind_memory(p,offset) -#define NV_AGPGART_UNBIND_MEMORY(o,p) (o)->unbind_memory(p) +#define NV_AGPGART_BACKEND_ACQUIRE(nvl,o) ({ (o)->acquire(); 0; }) +#define NV_AGPGART_BACKEND_ENABLE(nvl,o,mode) (o)->enable(mode) +#define NV_AGPGART_BACKEND_RELEASE(nvl,o) ((o)->release()) +#define NV_AGPGART_COPY_INFO(nvl,o,p) ({ (o)->copy_info(p); 0; }) +#define NV_AGPGART_ALLOCATE_MEMORY(nvl,o,count,type) (o)->allocate_memory(count,type) +#define NV_AGPGART_FREE_MEMORY(nvl,o,p) (o)->free_memory(p) +#define NV_AGPGART_BIND_MEMORY(nvl,o,p,offset) (o)->bind_memory(p,offset) +#define NV_AGPGART_UNBIND_MEMORY(nvl,o,p) (o)->unbind_memory(p) #endif #endif /* AGPGART */ @@ -96,6 +96,7 @@ U032 agp_fw; void *bitmap; U032 bitmap_size; + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); memset( (void *) &gart, 0, sizeof(agp_gart)); @@ -110,7 +111,7 @@ * the memory controller. */ - if (NV_AGPGART_BACKEND_ACQUIRE(drm_agp_p)) + if (NV_AGPGART_BACKEND_ACQUIRE(nvl,drm_agp_p)) { nv_printf(NV_DBG_INFO, "NVRM: AGPGART: no backend available\n"); goto bailout; @@ -128,7 +129,7 @@ agp_fw = 1; agp_fw &= 0x00000001; - if (NV_AGPGART_COPY_INFO(drm_agp_p, &agpinfo)) + if (NV_AGPGART_COPY_INFO(nvl,drm_agp_p, &agpinfo)) { nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: kernel reports chipset as unsupported\n"); @@ -188,7 +189,7 @@ if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004; if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002; - NV_AGPGART_BACKEND_ENABLE(drm_agp_p, agpinfo.mode); + NV_AGPGART_BACKEND_ENABLE(nvl,drm_agp_p, agpinfo.mode); *ap_phys_base = (void*) agpinfo.aper_base; *ap_mapped_base = (void*) gart.aperture; @@ -200,7 +201,7 @@ failed: MTRR_DEL(gart); /* checks gart.mtrr */ - NV_AGPGART_BACKEND_RELEASE(drm_agp_p); + NV_AGPGART_BACKEND_RELEASE(nvl,drm_agp_p); bailout: #if defined(KERNEL_2_4) inter_module_put("drm_agp"); @@ -219,6 +220,7 @@ return 1; #else void *bitmap; + nv_linux_state_t *nvl; /* sanity check to make sure we should actually be here. */ if (!gart.ready) @@ -234,7 +236,8 @@ NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE); } - NV_AGPGART_BACKEND_RELEASE(drm_agp_p); + nvl = NV_GET_NVL_FROM_NV_STATE(nv); + NV_AGPGART_BACKEND_RELEASE(nvl,drm_agp_p); #if defined(KERNEL_2_4) inter_module_put("drm_agp"); #endif @@ -268,6 +271,7 @@ agp_memory *ptr; agp_priv_data *data; RM_STATUS status; + nv_linux_state_t *nvl; if (!gart.ready) { @@ -283,7 +287,8 @@ return RM_ERROR; } - ptr = NV_AGPGART_ALLOCATE_MEMORY(drm_agp_p, PageCount, AGP_NORMAL_MEMORY); + nvl = NV_GET_NVL_FROM_NV_STATE(nv); + ptr = NV_AGPGART_ALLOCATE_MEMORY(nvl,drm_agp_p, PageCount, AGP_NORMAL_MEMORY); if (ptr == NULL) { *pAddress = (void*) 0; @@ -291,7 +296,7 @@ return RM_ERR_NO_FREE_MEM; } - if (NV_AGPGART_BIND_MEMORY(drm_agp_p, ptr, *Offset)) + if (NV_AGPGART_BIND_MEMORY(nvl,drm_agp_p, ptr, *Offset)) { // this happens a lot when the aperture itself fills up.. // not a big deal, so don't alarm people with an error message @@ -304,7 +309,7 @@ if (status != RM_OK) { nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: memory allocation failed\n"); - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr); + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, ptr); goto fail; } @@ -319,7 +324,7 @@ return RM_OK; fail: - NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr); + NV_AGPGART_FREE_MEMORY(nvl,drm_agp_p, ptr); *pAddress = (void*) 0; return RM_ERROR; @@ -359,7 +364,7 @@ { nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n", (unsigned long)agp_data->num_pages); - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, agp_data->ptr); + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, agp_data->ptr); goto fail; } @@ -458,8 +463,8 @@ { size_t pages = ptr->page_count; - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr); - NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr); + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, ptr); + NV_AGPGART_FREE_MEMORY(nvl,drm_agp_p, ptr); nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n", (unsigned long)pages); -- J.A. Magallon <jamagallon()able!es> \ Software is like sex: werewolf!able!es \ It's better when it's free Mandrakelinux release 10.2 (Cooker) for i586 Linux 2.6.10-jam6 (gcc 3.4.3 (Mandrakelinux 10.2 3.4.3-3mdk)) #1 [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get) 2005-01-26 0:02 ` J.A. Magallon @ 2005-01-26 0:25 ` Zephaniah E. Hull 0 siblings, 0 replies; 26+ messages in thread From: Zephaniah E. Hull @ 2005-01-26 0:25 UTC (permalink / raw) To: J.A. Magallon; +Cc: davidm, Lista Linux-Kernel, zander [-- Attachment #1: Type: text/plain, Size: 10094 bytes --] On Wed, Jan 26, 2005 at 12:02:51AM +0000, J.A. Magallon wrote: > > On 2005.01.25, Zephaniah E. Hull wrote: > > On Tue, Jan 25, 2005 at 12:56:25PM +0000, J.A. Magallon wrote: > > <snip> > > > You can use the latest drivers (6629) with this patches: > > > > > > http://www.minion.de/files/1.0-6629/ > > > > > > They work fine up to -rc2. > > > > > > If you want to use the driver with -mm, you have to kill the support > > > for AGPGART in nvidia driver, add -DNOAGPGART to EXTRA_CFLAGS in the > > > makefile. It will require a big change to use the multi-agp patches > > > in -mm. But you are restricted to those AGPs supported by nvidia > > > (ah, and don't load any agp related module...). > > > > For values of big changes that equal the attached patch. > > > > I'm using it on 2.6.10-mm3. I sent it to Zander however since there is > > no way to detect the new multi-agp support barring some sick hacks it > > has not gone in. > > > > It may conflict with the support for the 2.6.11-rc kernels, in which > > case when I next upgrade I'll find out and write a new one. > > > > > > Ah, just a ton of workarounds.... > > > > Hay, that gave me the clues I was missing !!! > With patch below, I get 6629 working on 2.6.10-rc2-mm1. Apply it on top of > all the patches in the link above. > > I know, it is ugly as hell (all those superfluos parameters in NV_AGPGART > macros, unused drm_agp_p...), but perhaps someone will rework all that > macro mesh. For the moment, it works.... A better fix would be to move drm_agp_p over into nv_linux_state_t, then all we have to do is pass nvl and we get rid of some warnings. When I move to the -rc<n>-mm kernels I'll write up the larger patch, though with the multi-agp support controlled by an ifdef that's disabled by default for the sake of wider testing. Leaving the patch below and CCing zander just so he knows about the updated patch and such. > > diff -ruN nv-6629-jam/src/nv/nv-linux.h nv-6629-jam-2/src/nv/nv-linux.h > --- nv-6629-jam/src/nv/nv-linux.h 2005-01-24 23:16:46.000000000 +0100 > +++ nv-6629-jam-2/src/nv/nv-linux.h 2005-01-26 00:25:10.000000000 +0100 > @@ -930,6 +930,9 @@ > > /* lock for linux-specific alloc queue */ > struct semaphore at_lock; > + > + /* AGP bridge handle */ > + struct agp_bridge_data *agp_bridge; > } nv_linux_state_t; > > > diff -ruN nv-6629-jam/src/nv/nv.c nv-6629-jam-2/src/nv/nv.c > --- nv-6629-jam/src/nv/nv.c 2005-01-24 23:16:46.000000000 +0100 > +++ nv-6629-jam-2/src/nv/nv.c 2005-01-26 00:47:14.000000000 +0100 > @@ -3011,10 +3011,11 @@ > return -1; > } > #elif defined(AGPGART) > - int error; > - if ((error = agp_backend_acquire()) != -EINVAL) > + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); > + nvl->agp_bridge = agp_backend_acquire(nvl->dev); > + if (nvl->agp_bridge) > { > - if (!error) agp_backend_release(); > + agp_backend_release(nvl->agp_bridge); > nv_printf(NV_DBG_WARNINGS, > "NVRM: not using NVAGP, an AGPGART backend is loaded!\n"); > return -1; > diff -ruN nv-6629-jam/src/nv/os-agp.c nv-6629-jam-2/src/nv/os-agp.c > --- nv-6629-jam/src/nv/os-agp.c 2005-01-24 23:16:46.000000000 +0100 > +++ nv-6629-jam-2/src/nv/os-agp.c 2005-01-26 00:49:01.000000000 +0100 > @@ -60,23 +60,23 @@ > #endif > > #if defined(KERNEL_2_6) > -#define NV_AGPGART_BACKEND_ACQUIRE(o) agp_backend_acquire() > -#define NV_AGPGART_BACKEND_ENABLE(o,mode) agp_enable(mode) > -#define NV_AGPGART_BACKEND_RELEASE(o) agp_backend_release() > -#define NV_AGPGART_COPY_INFO(o,p) agp_copy_info(p) > -#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) agp_allocate_memory(count,type) > -#define NV_AGPGART_FREE_MEMORY(o,p) agp_free_memory(p) > -#define NV_AGPGART_BIND_MEMORY(o,p,offset) agp_bind_memory(p,offset) > -#define NV_AGPGART_UNBIND_MEMORY(o,p) agp_unbind_memory(p) > +#define NV_AGPGART_BACKEND_ACQUIRE(nvl,o) ({ nvl->agp_bridge = agp_backend_acquire(nvl->dev); !nvl->agp_bridge; }) > +#define NV_AGPGART_BACKEND_ENABLE(nvl,o,mode) agp_enable(nvl->agp_bridge,mode) > +#define NV_AGPGART_BACKEND_RELEASE(nvl,o) agp_backend_release(nvl->agp_bridge) > +#define NV_AGPGART_COPY_INFO(nvl,o,p) agp_copy_info(nvl->agp_bridge,p) > +#define NV_AGPGART_ALLOCATE_MEMORY(nvl,o,count,type) agp_allocate_memory(nvl->agp_bridge,count,type) > +#define NV_AGPGART_FREE_MEMORY(nvl,o,p) agp_free_memory(p) > +#define NV_AGPGART_BIND_MEMORY(nvl,o,p,offset) agp_bind_memory(p,offset) > +#define NV_AGPGART_UNBIND_MEMORY(nvl,o,p) agp_unbind_memory(p) > #elif defined(KERNEL_2_4) > -#define NV_AGPGART_BACKEND_ACQUIRE(o) ({ (o)->acquire(); 0; }) > -#define NV_AGPGART_BACKEND_ENABLE(o,mode) (o)->enable(mode) > -#define NV_AGPGART_BACKEND_RELEASE(o) ((o)->release()) > -#define NV_AGPGART_COPY_INFO(o,p) ({ (o)->copy_info(p); 0; }) > -#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) (o)->allocate_memory(count,type) > -#define NV_AGPGART_FREE_MEMORY(o,p) (o)->free_memory(p) > -#define NV_AGPGART_BIND_MEMORY(o,p,offset) (o)->bind_memory(p,offset) > -#define NV_AGPGART_UNBIND_MEMORY(o,p) (o)->unbind_memory(p) > +#define NV_AGPGART_BACKEND_ACQUIRE(nvl,o) ({ (o)->acquire(); 0; }) > +#define NV_AGPGART_BACKEND_ENABLE(nvl,o,mode) (o)->enable(mode) > +#define NV_AGPGART_BACKEND_RELEASE(nvl,o) ((o)->release()) > +#define NV_AGPGART_COPY_INFO(nvl,o,p) ({ (o)->copy_info(p); 0; }) > +#define NV_AGPGART_ALLOCATE_MEMORY(nvl,o,count,type) (o)->allocate_memory(count,type) > +#define NV_AGPGART_FREE_MEMORY(nvl,o,p) (o)->free_memory(p) > +#define NV_AGPGART_BIND_MEMORY(nvl,o,p,offset) (o)->bind_memory(p,offset) > +#define NV_AGPGART_UNBIND_MEMORY(nvl,o,p) (o)->unbind_memory(p) > #endif > > #endif /* AGPGART */ > @@ -96,6 +96,7 @@ > U032 agp_fw; > void *bitmap; > U032 bitmap_size; > + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); > > memset( (void *) &gart, 0, sizeof(agp_gart)); > > @@ -110,7 +111,7 @@ > * the memory controller. > */ > > - if (NV_AGPGART_BACKEND_ACQUIRE(drm_agp_p)) > + if (NV_AGPGART_BACKEND_ACQUIRE(nvl,drm_agp_p)) > { > nv_printf(NV_DBG_INFO, "NVRM: AGPGART: no backend available\n"); > goto bailout; > @@ -128,7 +129,7 @@ > agp_fw = 1; > agp_fw &= 0x00000001; > > - if (NV_AGPGART_COPY_INFO(drm_agp_p, &agpinfo)) > + if (NV_AGPGART_COPY_INFO(nvl,drm_agp_p, &agpinfo)) > { > nv_printf(NV_DBG_ERRORS, > "NVRM: AGPGART: kernel reports chipset as unsupported\n"); > @@ -188,7 +189,7 @@ > if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004; > if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002; > > - NV_AGPGART_BACKEND_ENABLE(drm_agp_p, agpinfo.mode); > + NV_AGPGART_BACKEND_ENABLE(nvl,drm_agp_p, agpinfo.mode); > > *ap_phys_base = (void*) agpinfo.aper_base; > *ap_mapped_base = (void*) gart.aperture; > @@ -200,7 +201,7 @@ > > failed: > MTRR_DEL(gart); /* checks gart.mtrr */ > - NV_AGPGART_BACKEND_RELEASE(drm_agp_p); > + NV_AGPGART_BACKEND_RELEASE(nvl,drm_agp_p); > bailout: > #if defined(KERNEL_2_4) > inter_module_put("drm_agp"); > @@ -219,6 +220,7 @@ > return 1; > #else > void *bitmap; > + nv_linux_state_t *nvl; > > /* sanity check to make sure we should actually be here. */ > if (!gart.ready) > @@ -234,7 +236,8 @@ > NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE); > } > > - NV_AGPGART_BACKEND_RELEASE(drm_agp_p); > + nvl = NV_GET_NVL_FROM_NV_STATE(nv); > + NV_AGPGART_BACKEND_RELEASE(nvl,drm_agp_p); > #if defined(KERNEL_2_4) > inter_module_put("drm_agp"); > #endif > @@ -268,6 +271,7 @@ > agp_memory *ptr; > agp_priv_data *data; > RM_STATUS status; > + nv_linux_state_t *nvl; > > if (!gart.ready) > { > @@ -283,7 +287,8 @@ > return RM_ERROR; > } > > - ptr = NV_AGPGART_ALLOCATE_MEMORY(drm_agp_p, PageCount, AGP_NORMAL_MEMORY); > + nvl = NV_GET_NVL_FROM_NV_STATE(nv); > + ptr = NV_AGPGART_ALLOCATE_MEMORY(nvl,drm_agp_p, PageCount, AGP_NORMAL_MEMORY); > if (ptr == NULL) > { > *pAddress = (void*) 0; > @@ -291,7 +296,7 @@ > return RM_ERR_NO_FREE_MEM; > } > > - if (NV_AGPGART_BIND_MEMORY(drm_agp_p, ptr, *Offset)) > + if (NV_AGPGART_BIND_MEMORY(nvl,drm_agp_p, ptr, *Offset)) > { > // this happens a lot when the aperture itself fills up.. > // not a big deal, so don't alarm people with an error message > @@ -304,7 +309,7 @@ > if (status != RM_OK) > { > nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: memory allocation failed\n"); > - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr); > + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, ptr); > goto fail; > } > > @@ -319,7 +324,7 @@ > return RM_OK; > > fail: > - NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr); > + NV_AGPGART_FREE_MEMORY(nvl,drm_agp_p, ptr); > *pAddress = (void*) 0; > > return RM_ERROR; > @@ -359,7 +364,7 @@ > { > nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n", > (unsigned long)agp_data->num_pages); > - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, agp_data->ptr); > + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, agp_data->ptr); > goto fail; > } > > @@ -458,8 +463,8 @@ > { > size_t pages = ptr->page_count; > > - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr); > - NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr); > + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, ptr); > + NV_AGPGART_FREE_MEMORY(nvl,drm_agp_p, ptr); > > nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n", > (unsigned long)pages); > -- 1024D/E65A7801 Zephaniah E. Hull <warp@babylon.d2dc.net> 92ED 94E4 B1E6 3624 226D 5727 4453 008B E65A 7801 CCs of replies from mailing lists are requested. Hey, if you've mlock'ed more than your available memory, there's nothing the VM layer can do. Except maybe a nice printk("Kiss your *ss goodbye"); -- Linus [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get) 2005-01-25 20:50 ` Zephaniah E. Hull 2005-01-26 0:02 ` J.A. Magallon @ 2005-01-26 0:25 ` J.A. Magallon 1 sibling, 0 replies; 26+ messages in thread From: J.A. Magallon @ 2005-01-26 0:25 UTC (permalink / raw) To: Zephaniah E. Hull; +Cc: davidm, Lista Linux-Kernel [-- Attachment #1.1: Type: text/plain, Size: 1022 bytes --] On 2005.01.25, Zephaniah E. Hull wrote: > On Tue, Jan 25, 2005 at 12:56:25PM +0000, J.A. Magallon wrote: > <snip> > > You can use the latest drivers (6629) with this patches: > > > > http://www.minion.de/files/1.0-6629/ > > > > They work fine up to -rc2. > > > > If you want to use the driver with -mm, you have to kill the support > > for AGPGART in nvidia driver, add -DNOAGPGART to EXTRA_CFLAGS in the > > makefile. It will require a big change to use the multi-agp patches > > in -mm. But you are restricted to those AGPs supported by nvidia > > (ah, and don't load any agp related module...). > > For values of big changes that equal the attached patch. > Opps, previous patch was wrapped. Correct one attached. -- J.A. Magallon <jamagallon()able!es> \ Software is like sex: werewolf!able!es \ It's better when it's free Mandrakelinux release 10.2 (Cooker) for i586 Linux 2.6.10-jam6 (gcc 3.4.3 (Mandrakelinux 10.2 3.4.3-3mdk)) #1 [-- Attachment #1.2: NVIDIA_kernel-multiagp.diff --] [-- Type: text/x-patch, Size: 7650 bytes --] diff -ruN nv-6629-jam/src/nv/nv-linux.h nv-6629-jam-2/src/nv/nv-linux.h --- nv-6629-jam/src/nv/nv-linux.h 2005-01-24 23:16:46.000000000 +0100 +++ nv-6629-jam-2/src/nv/nv-linux.h 2005-01-26 00:25:10.000000000 +0100 @@ -930,6 +930,9 @@ /* lock for linux-specific alloc queue */ struct semaphore at_lock; + + /* AGP bridge handle */ + struct agp_bridge_data *agp_bridge; } nv_linux_state_t; diff -ruN nv-6629-jam/src/nv/nv.c nv-6629-jam-2/src/nv/nv.c --- nv-6629-jam/src/nv/nv.c 2005-01-24 23:16:46.000000000 +0100 +++ nv-6629-jam-2/src/nv/nv.c 2005-01-26 00:47:14.000000000 +0100 @@ -3011,10 +3011,11 @@ return -1; } #elif defined(AGPGART) - int error; - if ((error = agp_backend_acquire()) != -EINVAL) + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); + nvl->agp_bridge = agp_backend_acquire(nvl->dev); + if (nvl->agp_bridge) { - if (!error) agp_backend_release(); + agp_backend_release(nvl->agp_bridge); nv_printf(NV_DBG_WARNINGS, "NVRM: not using NVAGP, an AGPGART backend is loaded!\n"); return -1; diff -ruN nv-6629-jam/src/nv/os-agp.c nv-6629-jam-2/src/nv/os-agp.c --- nv-6629-jam/src/nv/os-agp.c 2005-01-24 23:16:46.000000000 +0100 +++ nv-6629-jam-2/src/nv/os-agp.c 2005-01-26 00:49:01.000000000 +0100 @@ -60,23 +60,23 @@ #endif #if defined(KERNEL_2_6) -#define NV_AGPGART_BACKEND_ACQUIRE(o) agp_backend_acquire() -#define NV_AGPGART_BACKEND_ENABLE(o,mode) agp_enable(mode) -#define NV_AGPGART_BACKEND_RELEASE(o) agp_backend_release() -#define NV_AGPGART_COPY_INFO(o,p) agp_copy_info(p) -#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) agp_allocate_memory(count,type) -#define NV_AGPGART_FREE_MEMORY(o,p) agp_free_memory(p) -#define NV_AGPGART_BIND_MEMORY(o,p,offset) agp_bind_memory(p,offset) -#define NV_AGPGART_UNBIND_MEMORY(o,p) agp_unbind_memory(p) +#define NV_AGPGART_BACKEND_ACQUIRE(nvl,o) ({ nvl->agp_bridge = agp_backend_acquire(nvl->dev); !nvl->agp_bridge; }) +#define NV_AGPGART_BACKEND_ENABLE(nvl,o,mode) agp_enable(nvl->agp_bridge,mode) +#define NV_AGPGART_BACKEND_RELEASE(nvl,o) agp_backend_release(nvl->agp_bridge) +#define NV_AGPGART_COPY_INFO(nvl,o,p) agp_copy_info(nvl->agp_bridge,p) +#define NV_AGPGART_ALLOCATE_MEMORY(nvl,o,count,type) agp_allocate_memory(nvl->agp_bridge,count,type) +#define NV_AGPGART_FREE_MEMORY(nvl,o,p) agp_free_memory(p) +#define NV_AGPGART_BIND_MEMORY(nvl,o,p,offset) agp_bind_memory(p,offset) +#define NV_AGPGART_UNBIND_MEMORY(nvl,o,p) agp_unbind_memory(p) #elif defined(KERNEL_2_4) -#define NV_AGPGART_BACKEND_ACQUIRE(o) ({ (o)->acquire(); 0; }) -#define NV_AGPGART_BACKEND_ENABLE(o,mode) (o)->enable(mode) -#define NV_AGPGART_BACKEND_RELEASE(o) ((o)->release()) -#define NV_AGPGART_COPY_INFO(o,p) ({ (o)->copy_info(p); 0; }) -#define NV_AGPGART_ALLOCATE_MEMORY(o,count,type) (o)->allocate_memory(count,type) -#define NV_AGPGART_FREE_MEMORY(o,p) (o)->free_memory(p) -#define NV_AGPGART_BIND_MEMORY(o,p,offset) (o)->bind_memory(p,offset) -#define NV_AGPGART_UNBIND_MEMORY(o,p) (o)->unbind_memory(p) +#define NV_AGPGART_BACKEND_ACQUIRE(nvl,o) ({ (o)->acquire(); 0; }) +#define NV_AGPGART_BACKEND_ENABLE(nvl,o,mode) (o)->enable(mode) +#define NV_AGPGART_BACKEND_RELEASE(nvl,o) ((o)->release()) +#define NV_AGPGART_COPY_INFO(nvl,o,p) ({ (o)->copy_info(p); 0; }) +#define NV_AGPGART_ALLOCATE_MEMORY(nvl,o,count,type) (o)->allocate_memory(count,type) +#define NV_AGPGART_FREE_MEMORY(nvl,o,p) (o)->free_memory(p) +#define NV_AGPGART_BIND_MEMORY(nvl,o,p,offset) (o)->bind_memory(p,offset) +#define NV_AGPGART_UNBIND_MEMORY(nvl,o,p) (o)->unbind_memory(p) #endif #endif /* AGPGART */ @@ -96,6 +96,7 @@ U032 agp_fw; void *bitmap; U032 bitmap_size; + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); memset( (void *) &gart, 0, sizeof(agp_gart)); @@ -110,7 +111,7 @@ * the memory controller. */ - if (NV_AGPGART_BACKEND_ACQUIRE(drm_agp_p)) + if (NV_AGPGART_BACKEND_ACQUIRE(nvl,drm_agp_p)) { nv_printf(NV_DBG_INFO, "NVRM: AGPGART: no backend available\n"); goto bailout; @@ -128,7 +129,7 @@ agp_fw = 1; agp_fw &= 0x00000001; - if (NV_AGPGART_COPY_INFO(drm_agp_p, &agpinfo)) + if (NV_AGPGART_COPY_INFO(nvl,drm_agp_p, &agpinfo)) { nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: kernel reports chipset as unsupported\n"); @@ -188,7 +189,7 @@ if (!(agp_rate & 0x00000004)) agpinfo.mode &= ~0x00000004; if (!(agp_rate & 0x00000002)) agpinfo.mode &= ~0x00000002; - NV_AGPGART_BACKEND_ENABLE(drm_agp_p, agpinfo.mode); + NV_AGPGART_BACKEND_ENABLE(nvl,drm_agp_p, agpinfo.mode); *ap_phys_base = (void*) agpinfo.aper_base; *ap_mapped_base = (void*) gart.aperture; @@ -200,7 +201,7 @@ failed: MTRR_DEL(gart); /* checks gart.mtrr */ - NV_AGPGART_BACKEND_RELEASE(drm_agp_p); + NV_AGPGART_BACKEND_RELEASE(nvl,drm_agp_p); bailout: #if defined(KERNEL_2_4) inter_module_put("drm_agp"); @@ -219,6 +220,7 @@ return 1; #else void *bitmap; + nv_linux_state_t *nvl; /* sanity check to make sure we should actually be here. */ if (!gart.ready) @@ -234,7 +236,8 @@ NV_IOUNMAP(gart.aperture, RM_PAGE_SIZE); } - NV_AGPGART_BACKEND_RELEASE(drm_agp_p); + nvl = NV_GET_NVL_FROM_NV_STATE(nv); + NV_AGPGART_BACKEND_RELEASE(nvl,drm_agp_p); #if defined(KERNEL_2_4) inter_module_put("drm_agp"); #endif @@ -268,6 +271,7 @@ agp_memory *ptr; agp_priv_data *data; RM_STATUS status; + nv_linux_state_t *nvl; if (!gart.ready) { @@ -283,7 +287,8 @@ return RM_ERROR; } - ptr = NV_AGPGART_ALLOCATE_MEMORY(drm_agp_p, PageCount, AGP_NORMAL_MEMORY); + nvl = NV_GET_NVL_FROM_NV_STATE(nv); + ptr = NV_AGPGART_ALLOCATE_MEMORY(nvl,drm_agp_p, PageCount, AGP_NORMAL_MEMORY); if (ptr == NULL) { *pAddress = (void*) 0; @@ -291,7 +296,7 @@ return RM_ERR_NO_FREE_MEM; } - if (NV_AGPGART_BIND_MEMORY(drm_agp_p, ptr, *Offset)) + if (NV_AGPGART_BIND_MEMORY(nvl,drm_agp_p, ptr, *Offset)) { // this happens a lot when the aperture itself fills up.. // not a big deal, so don't alarm people with an error message @@ -304,7 +309,7 @@ if (status != RM_OK) { nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: memory allocation failed\n"); - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr); + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, ptr); goto fail; } @@ -319,7 +324,7 @@ return RM_OK; fail: - NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr); + NV_AGPGART_FREE_MEMORY(nvl,drm_agp_p, ptr); *pAddress = (void*) 0; return RM_ERROR; @@ -359,7 +364,7 @@ { nv_printf(NV_DBG_ERRORS, "NVRM: AGPGART: unable to remap %lu pages\n", (unsigned long)agp_data->num_pages); - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, agp_data->ptr); + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, agp_data->ptr); goto fail; } @@ -458,8 +463,8 @@ { size_t pages = ptr->page_count; - NV_AGPGART_UNBIND_MEMORY(drm_agp_p, ptr); - NV_AGPGART_FREE_MEMORY(drm_agp_p, ptr); + NV_AGPGART_UNBIND_MEMORY(nvl,drm_agp_p, ptr); + NV_AGPGART_FREE_MEMORY(nvl,drm_agp_p, ptr); nv_printf(NV_DBG_INFO, "NVRM: AGPGART: freed %ld pages\n", (unsigned long)pages); [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-24 23:03 ` Keith Owens 2005-01-25 0:51 ` patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get) David Mosberger @ 2005-01-25 1:01 ` Jon Smirl 1 sibling, 0 replies; 26+ messages in thread From: Jon Smirl @ 2005-01-25 1:01 UTC (permalink / raw) To: Keith Owens; +Cc: davidm, bgerst, Terence Ripperda, Linux Kernel Mailing List On Tue, 25 Jan 2005 10:03:01 +1100, Keith Owens <kaos@ocs.com.au> wrote: > On Mon, 24 Jan 2005 14:58:29 -0800, > David Mosberger <davidm@napali.hpl.hp.com> wrote: > >>>>>> On Tue, 25 Jan 2005 09:54:36 +1100, Keith Owens <kaos@ocs.com.au> said: > > > > Keith> Does DRM support this model? DRM will compile two different modules depending of the state of CONFIG_AGP. A module compiled for a system with AGP will not load into one without it. -- Jon Smirl jonsmirl@gmail.com ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-24 22:52 ` David Mosberger 2005-01-24 22:54 ` Keith Owens @ 2005-01-24 23:19 ` Jon Smirl 2005-01-24 23:23 ` David Mosberger 1 sibling, 1 reply; 26+ messages in thread From: Jon Smirl @ 2005-01-24 23:19 UTC (permalink / raw) To: davidm; +Cc: Keith Owens, bgerst, Terence Ripperda, Linux Kernel Mailing List On Mon, 24 Jan 2005 14:52:06 -0800, David Mosberger <davidm@napali.hpl.hp.com> wrote: > Well, the only place that I know of where I (have to) care about > inter_module*() is because of the DRM/AGP dependency. I can't imagine The DRM inter_module_XX dependency has been removed in 2.6.10. AGP still exports inter_module_XX so that things like Nvidia/ATI drivers will continue to work. The last big use of inter_module_xx is in drivers/mtd in the M-systems disk on a chip drivers. -- Jon Smirl jonsmirl@gmail.com ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-24 23:19 ` Jon Smirl @ 2005-01-24 23:23 ` David Mosberger 0 siblings, 0 replies; 26+ messages in thread From: David Mosberger @ 2005-01-24 23:23 UTC (permalink / raw) To: Jon Smirl Cc: davidm, Keith Owens, bgerst, Terence Ripperda, Linux Kernel Mailing List >>>>> On Mon, 24 Jan 2005 18:19:05 -0500, Jon Smirl <jonsmirl@gmail.com> said: Jon> On Mon, 24 Jan 2005 14:52:06 -0800, David Mosberger Jon> <davidm@napali.hpl.hp.com> wrote: >> Well, the only place that I know of where I (have to) care about >> inter_module*() is because of the DRM/AGP dependency. I can't >> imagine Jon> The DRM inter_module_XX dependency has been removed in Jon> 2.6.10. AGP still exports inter_module_XX so that things like Jon> Nvidia/ATI drivers will continue to work. Not anymore: http://linux.bkbits.net:8080/linux-2.5/cset@41ef3420VDdf4OFNUTaC9jUaz8gR1A --david ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-24 22:44 ` Keith Owens 2005-01-24 22:52 ` David Mosberger @ 2005-01-25 5:31 ` Terence Ripperda 2005-01-25 5:59 ` Chris Wedgwood 1 sibling, 1 reply; 26+ messages in thread From: Terence Ripperda @ 2005-01-25 5:31 UTC (permalink / raw) To: Keith Owens; +Cc: davidm, bgerst, Terence Ripperda, Linux Kernel Mailing List On Tue, Jan 25, 2005 at 09:44:18AM +1100, kaos@ocs.com.au wrote: > Weak references are only done once, when the module is loaded. We > already use weak references for static determination of symbol > availability. inter_module_* and __symbol_* are aimed at the dynamic > reference problem, not static. this is probably a stupid question, but how are weak references used? Usually if a symbol is referenced by a module, but isn't resolved at load time, the module refuses to load. dynamic references allow a way to work around this for some applications, but I'm unfamiliar with weak references being used in this regard. or does that statement really mean "if we supported weak references, they would only be done once..." Thanks, Terence ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-01-25 5:31 ` Terence Ripperda @ 2005-01-25 5:59 ` Chris Wedgwood 0 siblings, 0 replies; 26+ messages in thread From: Chris Wedgwood @ 2005-01-25 5:59 UTC (permalink / raw) To: Terence Ripperda; +Cc: Keith Owens, davidm, bgerst, Linux Kernel Mailing List On Mon, Jan 24, 2005 at 11:31:04PM -0600, Terence Ripperda wrote: > this is probably a stupid question, but how are weak references > used? the linker sets them to zero, so "if (foo) { ... }" works nicely it does mean if a module that set foo to non-zero is loaded, we need to zero it again when it's unloaded or else we have stale bogus pointers left around ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get @ 2005-07-31 4:27 D. ShadowWolf 2005-08-01 1:04 ` Alan Cox 0 siblings, 1 reply; 26+ messages in thread From: D. ShadowWolf @ 2005-07-31 4:27 UTC (permalink / raw) To: linux-kernel On this topic I have to weigh in that I just subscribed to the kernel list because I have had to undo a modification made to the kernel around version 2.6.10 that stopped the export of 'inter_module_get'. To me it appears that some kernel developers forget that there are those of us out there who do not have broadband connections and are shafted with low-end hardware. In this case I am currently stuck using a Lucent Winmodem to connect to the internet. The need to undo that patch arose when I upgraded to 2.6.12.3 and found that the drivers provided by the linmodem project were dependant on that function. If the new system has been targeted at only GPL symbols, then I am certain it is definately not something good for the kernel. I enjoy GPL'd software as much as the next guy, but forgetting that there are people in the world dependant on third-party drivers that may or may not have a non-GPL license attached to them shows short-sightedness on the part of the people involved. I have my own issues with the modem I'm currently using, and with the fact that Lucent sits behind a wall of NDA's and other legal documents and refuses to release the entire source of the driver, instead making us rely on a driver that has a precompiled binary as part of it's source. I'm certain there are people that could reverse engineer the binary (I could do it myself), but with the current state of the law in the US and abroad doing so could cause major legal troubles. Well... enough rambling. I've used too much bandwidth as it is. DRH ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: inter_module_get and __symbol_get 2005-07-31 4:27 D. ShadowWolf @ 2005-08-01 1:04 ` Alan Cox 0 siblings, 0 replies; 26+ messages in thread From: Alan Cox @ 2005-08-01 1:04 UTC (permalink / raw) To: D. ShadowWolf; +Cc: linux-kernel On Sul, 2005-07-31 at 00:27 -0400, D. ShadowWolf wrote: > On this topic I have to weigh in that I just subscribed to the kernel list > because I have had to undo a modification made to the kernel around version > 2.6.10 that stopped the export of 'inter_module_get'. To me it appears that > some kernel developers forget that there are those of us out there who do not > have broadband connections and are shafted with low-end hardware. inter_module_* are going away. It was always a badly designed interface and the new module code no longer requires it. Alan ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2005-08-01 0:40 UTC | newest] Thread overview: 26+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-01-06 21:32 inter_module_get and __symbol_get Terence Ripperda 2005-01-06 21:57 ` Brian Gerst 2005-01-06 22:51 ` Terence Ripperda 2005-01-08 4:00 ` Jon Smirl 2005-01-12 19:37 ` Terence Ripperda 2005-01-12 22:21 ` Brian Gerst 2005-01-08 3:10 ` Keith Owens 2005-01-24 22:36 ` David Mosberger 2005-01-24 22:44 ` Keith Owens 2005-01-24 22:52 ` David Mosberger 2005-01-24 22:54 ` Keith Owens 2005-01-24 22:58 ` David Mosberger 2005-01-24 23:03 ` Keith Owens 2005-01-25 0:51 ` patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get) David Mosberger 2005-01-25 12:56 ` J.A. Magallon 2005-01-25 20:50 ` Zephaniah E. Hull 2005-01-26 0:02 ` J.A. Magallon 2005-01-26 0:25 ` Zephaniah E. Hull 2005-01-26 0:25 ` J.A. Magallon 2005-01-25 1:01 ` inter_module_get and __symbol_get Jon Smirl 2005-01-24 23:19 ` Jon Smirl 2005-01-24 23:23 ` David Mosberger 2005-01-25 5:31 ` Terence Ripperda 2005-01-25 5:59 ` Chris Wedgwood -- strict thread matches above, loose matches on Subject: below -- 2005-07-31 4:27 D. ShadowWolf 2005-08-01 1:04 ` Alan Cox
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox