Skip to contentSkip to conversation

inter_module_get and __symbol_get

DISCUSSION Terence Ripperda 8 participants 24 messages Jan 6, 2005 – Jan 26, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 7 lines · Terence Ripperda

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.

Quoted 7 lines

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

#2 lore raw

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

Quoted 5 lines · On Thu, Jan 06, 2005 at 04:57:57PM -0500, [email protected] 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

#3 lore raw

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.

Signature · 2 lines
Jon Smirl
[email protected]
#4 lore raw

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

Quoted 12 lines · On Fri, Jan 07, 2005 at 11:00:09PM -0500, [email protected] 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.

Signature · 2 lines
Jon Smirl
[email protected]
#5 lore raw
Quoted 5 lines · Terence Ripperda

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.

Quoted 5 lines

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

#6 lore raw
In reply to Brian Gerst
Quoted 13 lines · Brian Gerst
Quoted 12 lines · Terence Ripperda

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?

Quoted 5 lines
Quoted 2 lines

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.

#7 lore raw

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
#8 lore raw
Quoted 12 lines · David Mosberger

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.

Quoted 6 lines

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_*.

#9 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Keith Owens

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
#10 lore raw
Quoted 8 lines · David Mosberger
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Keith Owens

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_*.

Quoted 4 lines

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.

#11 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Keith Owens

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
#12 lore raw
Quoted 8 lines · David Mosberger
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Keith Owens

Keith> Does DRM support this model?

Keith> * Start DRM without AGP.
Keith> * AGP is loaded.
Keith> * DRM continues but now using AGP.

Quoted 5 lines

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.

#13 lore raw

patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Keith Owens

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
usr/src/nv/Makefile.kbuild +2 -2
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
@@ -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; \
usr/src/nv/conftest.sh +1 -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
@@ -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
usr/src/nv/nv-linux.h +17 -20
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
@@ -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
usr/src/nv/nv.c +26 -13
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
@@ -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;
 
usr/src/nv/os-agp.c +18 -24

139 lines not on this page · raw message

usr/src/nv/os-interface.c +2 -2
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
@@ -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;
#14 lore raw

Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get)

Quoted 10 lines · David Mosberger
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Keith Owens

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

#15 lore raw

Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get)

On Tue, Jan 25, 2005 at 12:56:25PM +0000, J.A. Magallon wrote:
<snip>

Quoted 11 lines

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.

Quoted 2 lines

Ah, just a ton of workarounds....

Signature · 7 lines
	1024D/E65A7801 Zephaniah E. Hull <[email protected]>
	   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. :)
nvidia-kernel/nv/nv-linux.h +3 -0
diff -ur modules/nvidia-kernel/nv/nv-linux.h modules_new/nvidia-kernel/nv/nv-linux.h
@@ -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;
 
 
nvidia-kernel/nv/os-agp.c +9 -6
diff -ur modules/nvidia-kernel/nv/os-agp.c modules_new/nvidia-kernel/nv/os-agp.c
@@ -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;
#16 lore raw

Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get)

Quoted 14 lines · Zephaniah E. Hull

On Tue, Jan 25, 2005 at 12:56:25PM +0000, J.A. Magallon wrote:
<snip>

Quoted 11 lines

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...).

Quoted 11 lines

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.

Quoted 2 lines

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....

src/nv/nv-linux.h +3 -0
diff -ruN nv-6629-jam/src/nv/nv-linux.h nv-6629-jam-2/src/nv/nv-linux.h
@@ -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;
 
 
src/nv/nv.c +4 -3
diff -ruN nv-6629-jam/src/nv/nv.c nv-6629-jam-2/src/nv/nv.c
@@ -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;
src/nv/os-agp.c +33 -28

152 lines not on this page · raw message

--
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

#17 lore raw

Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get)

Quoted 28 lines · J.A. Magallon
Quoted 14 lines · Zephaniah E. Hull

On Tue, Jan 25, 2005 at 12:56:25PM +0000, J.A. Magallon wrote:
<snip>

Quoted 11 lines

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...).

Quoted 11 lines

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.

Quoted 2 lines

Ah, just a ton of workarounds....

Quoted 7 lines

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.

Quoted 203 lines

diff -ruN nv-6629-jam/src/nv/nv-linux.h nv-6629-jam-2/src/nv/nv-linux.h

src/nv/nv-linux.h +3 -0
@@ -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

src/nv/nv.c +4 -3
@@ -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

src/nv/os-agp.c +33 -28
@@ -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);
Signature · 7 lines
	1024D/E65A7801 Zephaniah E. Hull <[email protected]>
	   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
#18 lore raw

Re: patch to enable Nvidia v5336 on v2.6.11 kernel (was Re: inter_module_get and __symbol_get)

In reply to Zephaniah E. Hull
Quoted 8 lines · Zephaniah E. Hull

On Tue, Jan 25, 2005 at 12:56:25PM +0000, J.A. Magallon wrote:
<snip>

Quoted 6 lines

You can use the latest drivers (6629) with this patches:

http://www.minion.de/files/1.0-6629/

They work fine up to -rc2.

Quoted 8 lines
Quoted 5 lines

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

src/nv/nv-linux.h +3 -0
diff -ruN nv-6629-jam/src/nv/nv-linux.h nv-6629-jam-2/src/nv/nv-linux.h
@@ -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;
 
 
src/nv/nv.c +4 -3
diff -ruN nv-6629-jam/src/nv/nv.c nv-6629-jam-2/src/nv/nv.c
@@ -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;
src/nv/os-agp.c +33 -28

152 lines not on this page · raw message

#19 lore raw
In reply to Keith Owens
Quoted 5 lines · Keith Owens
Quoted 3 lines · David Mosberger
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Keith Owens

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.

Signature · 2 lines
Jon Smirl
[email protected]
#20 lore raw
In reply to David Mosberger
Quoted 2 lines · David Mosberger

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.

Signature · 2 lines
Jon Smirl
[email protected]
#21 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Jon Smirl

Jon> On Mon, 24 Jan 2005 14:52:06 -0800, David Mosberger

Quoted 3 lines · Jon> <[email protected]> wrote:
Quoted 3 lines

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
#22 lore raw
In reply to Keith Owens
Quoted 4 lines · On Tue, Jan 25, 2005 at 09:44:18AM +1100, [email protected] 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

#23 lore raw
Quoted 2 lines · Terence Ripperda

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