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
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
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, [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
On Thu, 06 Jan 2005 16:57:57 -0500,
Brian Gerst <[email protected]> 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.
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
[email protected]
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, [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.
>
> --
> Jon Smirl
> [email protected]
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
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
On Mon, 24 Jan 2005 14:36:10 -0800,
David Mosberger <[email protected]> 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_*.
>>>>> On Tue, 25 Jan 2005 09:44:18 +1100, Keith Owens <[email protected]> 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
>>>>> On Mon, 24 Jan 2005 18:19:05 -0500, Jon Smirl <[email protected]> said:
Jon> On Mon, 24 Jan 2005 14:52:06 -0800, David Mosberger
Jon> <[email protected]> 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
On Mon, 24 Jan 2005 14:52:06 -0800, David Mosberger
<[email protected]> 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
[email protected]
On Mon, 24 Jan 2005 14:52:06 -0800,
David Mosberger <[email protected]> wrote:
>>>>>> On Tue, 25 Jan 2005 09:44:18 +1100, Keith Owens <[email protected]> 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.
On Mon, 24 Jan 2005 14:58:29 -0800,
David Mosberger <[email protected]> wrote:
>>>>>> On Tue, 25 Jan 2005 09:54:36 +1100, Keith Owens <[email protected]> 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.
>>>>> On Tue, 25 Jan 2005 09:54:36 +1100, Keith Owens <[email protected]> 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
On Tue, 25 Jan 2005 10:03:01 +1100, Keith Owens <[email protected]> wrote:
> On Mon, 24 Jan 2005 14:58:29 -0800,
> David Mosberger <[email protected]> wrote:
> >>>>>> On Tue, 25 Jan 2005 09:54:36 +1100, Keith Owens <[email protected]> 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
[email protected]
>>>>> On Tue, 25 Jan 2005 10:03:01 +1100, Keith Owens <[email protected]> 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;
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
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
On 2005.01.25, David Mosberger wrote:
> >>>>> On Tue, 25 Jan 2005 10:03:01 +1100, Keith Owens <[email protected]> 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
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 <[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. :)
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
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
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 <[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