Skip to contentSkip to conversation

2.6.20-rc6-mm3 BUG in drm_ioctl with Rage 128 card

PATCH New Eric Buddington 5 participants 13 messages Feb 3, 2007 – Feb 5, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

While repeatedly recompiling and restarting xorg-server-1.1.1, I managed to generate the following BUG. Kernel is 2.6.20-rc6-mm3, video card is

01:00.0 VGA compatible controller: ATI Technologies Inc Rage 128 Pro Ultra TF (prog-if 00 [VGA])

-Eric

----------------------------------

BUG: unable to handle kernel NULL pointer dereference at virtual address 0000000

0
printing eip:
00000000
*pde = 18cdb067
*pte = 00000000

Oops: 0000 [#1]
last sysfs file: /devices/pci0000:00/0000:00:00.0/class
Modules linked in: ppp_synctty ppp_async crc_ccitt ppp_generic slhc r128 drm sof

tdog keyspan_pda usbserial sch_tbf raw1394 dv1394 ohci1394 ieee1394 snd_ice1712 snd_ice17xx_ak4xxx snd_ak4xxx_adda snd_cs8427 snd_i2c snd_mpu401_uart snd_rawmid i usbnet snd_intel8x0 snd_ac97_codec ac97_bus ipt_tos ipt_owner iptable_nat nf_c onntrack_ipv4 ipt_MASQUERADE nf_nat nf_conntrack nfnetlink ipt_TOS iptable_filte r iptable_mangle ip_tables x_tables 8139too sis900 sis5595 hwmon i2c_isa i2c_cor e sis_agp agpgart ide_scsi

CPU:    0
EIP:    0060:[<00000000>]    Tainted: G   M   VLI
EFLAGS: 00013246   (2.6.20-rc6-mm3 #1)

EIP is at 0x0
eax: f7a3ec60 ebx: 00000000 ecx: f928eda0 edx: 00000000
esi: f7a3ec60 edi: c3c399e0 ebp: 00004000 esp: f355feb0
ds: 007b es: 007b fs: 00d8 gs: 0033 ss: 0068
Process X (pid: 30162, ti=f355e000 task=f7932030 task.ti=f355e000)

Stack: f9299ccc 00000800 000006d0 00000003 c1b36570 00000000 00000000 0040ee73 
       f928eda0 c3c399e0 00000000 f56d2800 f929928c bf94831c 00000000 f52bf1e0 
       00000000 f51c8860 f93e77bf f93f1800 c029926f 00000000 f93f1810 f56d2800 
Call Trace:
 [<f9299ccc>] agp_generic_insert_memory+0x5f/0x147 [agpgart]
 [<f929928c>] agp_bind_memory+0x53/0x64 [agpgart]
 [<f93e77bf>] drm_agp_bind+0x49/0x9f [drm]
 [<c029926f>] copy_to_user+0x2d/0x42
 [<f93e7845>] drm_agp_bind_ioctl+0x30/0x39 [drm]
 [<f93e7815>] drm_agp_bind_ioctl+0x0/0x39 [drm]
 [<f93e3f10>] drm_ioctl+0x14b/0x193 [drm]
 [<f93e3dc5>] drm_ioctl+0x0/0x193 [drm]
 [<c015b94a>] do_ioctl+0x3e/0x4d
 [<c015bb60>] vfs_ioctl+0x207/0x21e
 [<c015bbaa>] sys_ioctl+0x33/0x4d
 [<c0104b30>] sysenter_past_esp+0x5d/0x81
 =======================
Code:  Bad EIP value.

EIP: [<00000000>] 0x0 SS:ESP 0068:f355feb0
[drm:drm_release] *ERROR* Device busy: 1 0

#1 lore raw
Quoted 2 lines · Eric Buddington
EIP:    0060:[<00000000>]    Tainted: G   M   VLI
EFLAGS: 00013246   (2.6.20-rc6-mm3 #1)

The "M" taint flag indicates that a machine check exception has occured. Check your logs for the MCE and make sure the hardware is OK.

Lee

#2 lore raw
Quoted 7 lines · Lee Revell
Quoted 2 lines · Eric Buddington
EIP:    0060:[<00000000>]    Tainted: G   M   VLI
EFLAGS: 00013246   (2.6.20-rc6-mm3 #1)

The "M" taint flag indicates that a machine check exception has occured. Check your logs for the MCE and make sure the hardware is OK.

Lee,

Thanks for pointing that out; I didn't know about that flag. I *think* there had meen an exception that Google suggested was an ECC-corrected memory problem (which is suspect, since I don't have ECC RAM).

Anyway, here's a non-tainted one I got after a reboot:

---------------------------------------
agpgart: Found an AGP 3.5 compliant device at 0000:00:00.0.
agpgart: Device is in legacy mode, falling back to 2.x
agpgart: Putting AGP V2 device at 0000:00:00.0 into 1x mode
agpgart: Putting AGP V2 device at 0000:01:00.0 into 1x mode

BUG: unable to handle kernel NULL pointer dereference at virtual address 00000000
 printing eip:
00000000
*pde = 48057067
Oops: 0000 [#1]
last sysfs file: /devices/pci0000:00/0000:00:00.0/class
Modules linked in: ppp_synctty ppp_async crc_ccitt ppp_generic slhc r128 drm softdog keyspan_pda usbserial sch_tbf raw1394 dv1394 ohci1394 ieee1394 snd_ice1712 snd_ice17xx_ak4xxx snd_ak4xxx_adda snd_cs8427 snd_i2c snd_mpu401_uart snd_rawmidi usbnet snd_intel8x0 snd_ac97_codec ac97_bus ipt_tos ipt_owner iptable_nat nf_conntrack_ipv4 ipt_MASQUERADE nf_nat nf_conntrack nfnetlink ipt_TOS iptable_filter iptable_mangle ip_tables x_tables 8139too sis900 sis5595 hwmon i2c_isa i2c_core sis_agp agpgart ide_scsi
CPU:    0
EIP:    0060:[<00000000>]    Not tainted VLI
EFLAGS: 00013246   (2.6.20-rc6-mm3 #1)

EIP is at 0x0
eax: f5e6f2e0 ebx: 00000000 ecx: f928eda0 edx: 00000000
esi: f5e6f2e0 edi: f3604be0 ebp: 00004000 esp: f2c2feb0
ds: 007b es: 007b fs: 00d8 gs: 0033 ss: 0068
Process X (pid: 3465, ti=f2c2e000 task=f2c10ab0 task.ti=f2c2e000)

Stack: f9299ccc 00003292 f2401f10 00000010 c164f880 00000000 00000000 00000163 
       f928eda0 f3604be0 00000000 f3bfb000 f929928c f5e6f2e0 00000000 f37113e0 
       00000000 f3604160 f93e77bf f93f1800 c029926f 00000000 f93f1810 f3bfb000 
Call Trace:
 [<f9299ccc>] agp_generic_insert_memory+0x5f/0x147 [agpgart]
 [<f929928c>] agp_bind_memory+0x53/0x64 [agpgart]
 [<f93e77bf>] drm_agp_bind+0x49/0x9f [drm]
 [<c029926f>] copy_to_user+0x2d/0x42
 [<f93e7845>] drm_agp_bind_ioctl+0x30/0x39 [drm]
 [<f93e7815>] drm_agp_bind_ioctl+0x0/0x39 [drm]
 [<f93e3f10>] drm_ioctl+0x14b/0x193 [drm]
 [<f93e3dc5>] drm_ioctl+0x0/0x193 [drm]
 [<c015b94a>] do_ioctl+0x3e/0x4d
 [<c015bb60>] vfs_ioctl+0x207/0x21e
 [<c015bbaa>] sys_ioctl+0x33/0x4d
 [<c0104b30>] sysenter_past_esp+0x5d/0x81
 =======================
Code:  Bad EIP value.

EIP: [<00000000>] 0x0 SS:ESP 0068:f2c2feb0 [drm:drm_release] *ERROR* Device busy: 1 0 pool-71-161-133-234$ dmesg | grep excep Enabling unmasked SIMD FPU exception support... done. Machine check exception polling timer started. pool-71-161-133-234$ dmesg | grep ank pool-71-161-133-234$ dmesg | grep -i excep Enabling unmasked SIMD FPU exception support... done. Machine check exception polling timer started.

#3 lore raw
Quoted 37 lines

agpgart: Found an AGP 3.5 compliant device at 0000:00:00.0.
agpgart: Device is in legacy mode, falling back to 2.x
agpgart: Putting AGP V2 device at 0000:00:00.0 into 1x mode
agpgart: Putting AGP V2 device at 0000:01:00.0 into 1x mode

BUG: unable to handle kernel NULL pointer dereference at virtual address 00000000
 printing eip:
00000000
*pde = 48057067
Oops: 0000 [#1]
last sysfs file: /devices/pci0000:00/0000:00:00.0/class
Modules linked in: ppp_synctty ppp_async crc_ccitt ppp_generic slhc r128 drm softdog keyspan_pda usbserial sch_tbf raw1394 dv1394 ohci1394 ieee1394 snd_ice1712 snd_ice17xx_ak4xxx snd_ak4xxx_adda snd_cs8427 snd_i2c snd_mpu401_uart snd_rawmidi usbnet snd_intel8x0 snd_ac97_codec ac97_bus ipt_tos ipt_owner iptable_nat nf_conntrack_ipv4 ipt_MASQUERADE nf_nat nf_conntrack nfnetlink ipt_TOS iptable_filter iptable_mangle ip_tables x_tables 8139too sis900 sis5595 hwmon i2c_isa i2c_core sis_agp agpgart ide_scsi
CPU:    0
EIP:    0060:[<00000000>]    Not tainted VLI
EFLAGS: 00013246   (2.6.20-rc6-mm3 #1)

EIP is at 0x0
eax: f5e6f2e0 ebx: 00000000 ecx: f928eda0 edx: 00000000
esi: f5e6f2e0 edi: f3604be0 ebp: 00004000 esp: f2c2feb0
ds: 007b es: 007b fs: 00d8 gs: 0033 ss: 0068
Process X (pid: 3465, ti=f2c2e000 task=f2c10ab0 task.ti=f2c2e000)

Stack: f9299ccc 00003292 f2401f10 00000010 c164f880 00000000 00000000 00000163
       f928eda0 f3604be0 00000000 f3bfb000 f929928c f5e6f2e0 00000000 f37113e0
       00000000 f3604160 f93e77bf f93f1800 c029926f 00000000 f93f1810 f3bfb000
Call Trace:
 [<f9299ccc>] agp_generic_insert_memory+0x5f/0x147 [agpgart]
 [<f929928c>] agp_bind_memory+0x53/0x64 [agpgart]
 [<f93e77bf>] drm_agp_bind+0x49/0x9f [drm]
 [<c029926f>] copy_to_user+0x2d/0x42
 [<f93e7845>] drm_agp_bind_ioctl+0x30/0x39 [drm]
 [<f93e7815>] drm_agp_bind_ioctl+0x0/0x39 [drm]
 [<f93e3f10>] drm_ioctl+0x14b/0x193 [drm]
 [<f93e3dc5>] drm_ioctl+0x0/0x193 [drm]
 [<c015b94a>] do_ioctl+0x3e/0x4d
 [<c015bb60>] vfs_ioctl+0x207/0x21e
 [<c015bbaa>] sys_ioctl+0x33/0x4d
 [<c0104b30>] sysenter_past_esp+0x5d/0x81
 =======================
Code:  Bad EIP value.
Quoted 2 lines

EIP: [<00000000>] 0x0 SS:ESP 0068:f2c2feb0
[drm:drm_release] *ERROR* Device busy: 1 0

What AGP chipset do you have? it looks like it might be caused by the AGP changes for TTM..

Dave.

#4 lore raw
Quoted 2 lines · Dave Airlie

What AGP chipset do you have? it looks like it might be caused by the AGP changes for TTM..

lspci:

00:00.0 Host bridge: Silicon Integrated Systems [SiS] 741/741GX/M741 Host (rev 03) 00:01.0 PCI bridge: Silicon Integrated Systems [SiS] SiS AGP Port (virtual PCI-to-PCI bridge) 00:02.0 ISA bridge: Silicon Integrated Systems [SiS] SiS963 [MuTIOL Media IO] (rev 25) 00:02.1 SMBus: Silicon Integrated Systems [SiS] SiS961/2 SMBus Controller 00:02.5 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE]
...

-Eric

#5 lore raw
Quoted 10 lines · Eric Buddington
Quoted 4 lines · Dave Airlie

What AGP chipset do you have? it looks like it might be caused by the AGP changes for TTM..

lspci:

Quoted 10 lines

00:00.0 Host bridge: Silicon Integrated Systems [SiS] 741/741GX/M741 Host (rev 03) 00:01.0 PCI bridge: Silicon Integrated Systems [SiS] SiS AGP Port (virtual PCI-to-PCI bridge) 00:02.0 ISA bridge: Silicon Integrated Systems [SiS] SiS963 [MuTIOL Media IO] (rev 25) 00:02.1 SMBus: Silicon Integrated Systems [SiS] SiS961/2 SMBus Controller 00:02.5 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE]
...

-Eric

Eric,
Sorry for the breakage. Can you try the attached patch and see if it fixes the problem.

/Thomas

Quoted 1 line

From 531c7dc4e9d26a9a2c7a64d52cf73951c7c03ee8 Mon Sep 17 00:00:00 2001

From: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date: Sun, 4 Feb 2007 10:53:17 +0100
Subject: [PATCH] Add missing .agp_type_to_mask_type entries.

---
 drivers/char/agp/parisc-agp.c |    1 +
 drivers/char/agp/sis-agp.c    |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
drivers/char/agp/parisc-agp.c +1 -0
index 17c50b0..b7b4590 100644
@@ -228,6 +228,7 @@ struct agp_bridge_driver parisc_agp_driv
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 	.cant_use_aperture	= 1,
 };
 
drivers/char/agp/sis-agp.c +1 -0
index a00fd48..60342b7 100644
@@ -140,6 +140,7 @@ static struct agp_bridge_driver sis_driv
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 static struct agp_device_ids sis_agp_device_ids[] __devinitdata =
Signature · 1 line
1.4.1
#6 lore raw
Quoted 5 lines · Thomas Hellstr?m

Eric,
Sorry for the breakage. Can you try the attached patch and see if it fixes the problem.

/Thomas

Thomas,

Thanks! That seems to fix it:

[drm] Initialized drm 1.1.0 20060810
ACPI: PCI Interrupt 0000:01:00.0[A] -> GSI 16 (level, low) -> IRQ 16 [drm] Initialized r128 2.5.0 20030725 on minor 0

-Eric

#7 lore raw
Quoted 10 lines · Eric Buddington
Quoted 5 lines · Thomas Hellstr?m

Eric,
Sorry for the breakage. Can you try the attached patch and see if it fixes the problem.

/Thomas

Thomas,

Thanks! That seems to fix it:

Great. Thomas, can you resend me that patch with a description & Signed-off-by ? (Also for some reason that one looks like it was MIME damaged, git-am wouldn't eat it)

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#8 lore raw
Quoted 8 lines · Dave Jones
Quoted 7 lines · Eric Buddington
Quoted 5 lines · Thomas Hellstr?m

Eric,
Sorry for the breakage. Can you try the attached patch and see if it fixes the problem.

/Thomas

Quoted 10 lines
Quoted 3 lines

Thomas,

Thanks! That seems to fix it:

Great. Thomas, can you resend me that patch with a description & Signed-off-by ? (Also for some reason that one looks like it was MIME damaged, git-am wouldn't eat it)

Dave

Dave,
I'll post an updated complete patch. The previous one was really only for Eric to try.

/Thomas

#9 lore raw

PATCH 1/1 agpgart: Allow drm-populated agp memory types update2

From: Thomas Hellstrom <[email protected]>

This patch allows drm to populate an agpgart structure with pages of its own. It's needed for the new drm memory manager which dynamically flips pages in and out of AGP.

The patch modifies the generic functions as well as the intel agp driver. The intel drm driver is currently the only one supporting the new memory manager.

Other agp drivers may need some minor fixing up once they have a corresponding memory manager enabled drm driver.

AGP memory types >= AGP_USER_TYPES are not populated by the agpgart driver, but the drm is expected to do that, as well as taking care of cache- and tlb flushing when needed.

It's not possible to request these types from user space using agpgart ioctls.

The Intel driver also gets a new memory type for pages that can be bound cached to the intel GTT.

---
 drivers/char/agp/agp.h          |   10 ++
 drivers/char/agp/ali-agp.c      |    2 
 drivers/char/agp/alpha-agp.c    |    4 +
 drivers/char/agp/amd-k7-agp.c   |    1 
 drivers/char/agp/amd64-agp.c    |   11 ++
 drivers/char/agp/ati-agp.c      |    1 
 drivers/char/agp/backend.c      |    2 
 drivers/char/agp/efficeon-agp.c |    1 
 drivers/char/agp/frontend.c     |    3 +
 drivers/char/agp/generic.c      |  130 ++++++++++++++++++++++++++-
 drivers/char/agp/hp-agp.c       |    1 
 drivers/char/agp/i460-agp.c     |    7 +
 drivers/char/agp/intel-agp.c    |  186 +++++++++++++++++++++++++--------------
 drivers/char/agp/nvidia-agp.c   |    1 
 drivers/char/agp/parisc-agp.c   |    1 
 drivers/char/agp/sgi-agp.c      |    1 
 drivers/char/agp/sis-agp.c      |    1 
 drivers/char/agp/sworks-agp.c   |    1 
 drivers/char/agp/uninorth-agp.c |    2 
 drivers/char/agp/via-agp.c      |    2 
 include/linux/agp_backend.h     |    5 +
 21 files changed, 298 insertions(+), 75 deletions(-)
drivers/char/agp/agp.h +10 -0
index 1d59e2a..f821243 100644
@@ -114,6 +114,7 @@ struct agp_bridge_driver {
 	void (*free_by_type)(struct agp_memory *);
 	void *(*agp_alloc_page)(struct agp_bridge_data *);
 	void (*agp_destroy_page)(void *);
+        int (*agp_type_to_mask_type) (struct agp_bridge_data *, int);
 };
 
 struct agp_bridge_data {
@@ -218,6 +219,7 @@ #define I810_PTE_BASE		0x10000
 #define I810_PTE_MAIN_UNCACHED	0x00000000
 #define I810_PTE_LOCAL		0x00000002
 #define I810_PTE_VALID		0x00000001
+#define I830_PTE_SYSTEM_CACHED  0x00000006
 #define I810_SMRAM_MISCC	0x70
 #define I810_GFX_MEM_WIN_SIZE	0x00010000
 #define I810_GFX_MEM_WIN_32M	0x00010000
@@ -270,8 +272,16 @@ void global_cache_flush(void);
 void get_agp_version(struct agp_bridge_data *bridge);
 unsigned long agp_generic_mask_memory(struct agp_bridge_data *bridge,
 	unsigned long addr, int type);
+int agp_generic_type_to_mask_type(struct agp_bridge_data *bridge,
+				  int type);
 struct agp_bridge_data *agp_generic_find_bridge(struct pci_dev *pdev);
 
+/* generic functions for user-populated AGP memory types */
+struct agp_memory *agp_generic_alloc_user(size_t page_count, int type);
+void agp_alloc_page_array(size_t size, struct agp_memory *mem);
+void agp_free_page_array(struct agp_memory *mem);
+
+
 /* generic routines for agp>=3 */
 int agp3_generic_fetch_size(void);
 void agp3_generic_tlbflush(struct agp_memory *mem);
drivers/char/agp/ali-agp.c +2 -0
index 5a31ec7..98177a9 100644
@@ -214,6 +214,7 @@ static struct agp_bridge_driver ali_gene
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= ali_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 static struct agp_bridge_driver ali_m1541_bridge = {
@@ -237,6 +238,7 @@ static struct agp_bridge_driver ali_m154
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= m1541_alloc_page,
 	.agp_destroy_page	= m1541_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 
drivers/char/agp/alpha-agp.c +4 -0
index b4e00a3..b0acf41 100644
@@ -91,6 +91,9 @@ static int alpha_core_agp_insert_memory(
 	int num_entries, status;
 	void *temp;
 
+	if (type >= AGP_USER_TYPES || mem->type >= AGP_USER_TYPES)
+		return -EINVAL;
+
 	temp = agp_bridge->current_size;
 	num_entries = A_SIZE_FIX(temp)->num_entries;
 	if ((pg_start + mem->page_count) > num_entries)
@@ -142,6 +145,7 @@ struct agp_bridge_driver alpha_core_agp_
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 struct agp_bridge_data *alpha_bridge;
drivers/char/agp/amd-k7-agp.c +1 -0
index 51d0d56..9c129bd 100644
@@ -376,6 +376,7 @@ static struct agp_bridge_driver amd_iron
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 static struct agp_device_ids amd_agp_device_ids[] __devinitdata =
drivers/char/agp/amd64-agp.c +9 -2
index 9793004..0e749f6 100644
@@ -62,12 +62,18 @@ static int amd64_insert_memory(struct ag
 {
 	int i, j, num_entries;
 	long long tmp;
+	int mask_type;
+	struct agp_bridge_data *bridge = mem->bridge;
 	u32 pte;
 
 	num_entries = agp_num_entries();
 
-	if (type != 0 || mem->type != 0)
+	if (type != mem->type)
 		return -EINVAL;
+	mask_type = bridge->driver->agp_type_to_mask_type(bridge, type);
+	if (mask_type != 0)
+		return -EINVAL;
+
 
 	/* Make sure we can fit the range in the gatt table. */
 	/* FIXME: could wrap */
@@ -90,7 +96,7 @@ static int amd64_insert_memory(struct ag
 
 	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
 		tmp = agp_bridge->driver->mask_memory(agp_bridge,
-			mem->memory[i], mem->type);
+			mem->memory[i], mask_type);
 
 		BUG_ON(tmp & 0xffffff0000000ffcULL);
 		pte = (tmp & 0x000000ff00000000ULL) >> 28;
@@ -247,6 +253,7 @@ static struct agp_bridge_driver amd_8151
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 /* Some basic sanity checks for the aperture. */
drivers/char/agp/ati-agp.c +1 -0
index f244c66..d4f7b75 100644
@@ -431,6 +431,7 @@ static struct agp_bridge_driver ati_gene
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 
drivers/char/agp/backend.c +1 -1
index d59e037..ebdd6dd 100644
@@ -43,7 +43,7 @@ #include "agp.h"
  * fix some real stupidity. It's only by chance we can bump
  * past 0.99 at all due to some boolean logic error. */
 #define AGPGART_VERSION_MAJOR 0
-#define AGPGART_VERSION_MINOR 101
+#define AGPGART_VERSION_MINOR 102
 static const struct agp_version agp_current_version =
 {
 	.major = AGPGART_VERSION_MAJOR,
drivers/char/agp/efficeon-agp.c +1 -0
index 30f730f..658cb1a 100644
@@ -335,6 +335,7 @@ static struct agp_bridge_driver efficeon
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 static int __devinit agp_efficeon_probe(struct pci_dev *pdev,
drivers/char/agp/frontend.c +3 -0
index 0f2ed2a..e21a319 100644
@@ -892,6 +892,9 @@ static int agpioc_allocate_wrap(struct a
 	if (copy_from_user(&alloc, arg, sizeof(struct agp_allocate)))
 		return -EFAULT;
 
+	if (alloc.type >= AGP_USER_TYPES)
+		return -EINVAL;
+
 	memory = agp_allocate_memory_wrap(alloc.pg_count, alloc.type);
 
 	if (memory == NULL)
drivers/char/agp/generic.c +124 -6

213 lines not on this page · raw message

drivers/char/agp/hp-agp.c +1 -0
index 907fb66..847deab 100644
@@ -438,6 +438,7 @@ struct agp_bridge_driver hp_zx1_driver =
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 	.cant_use_aperture	= 1,
 };
 
drivers/char/agp/i460-agp.c +7 -0
index 9176944..3e76186 100644
@@ -293,6 +293,9 @@ static int i460_insert_memory_small_io_p
 	pr_debug("i460_insert_memory_small_io_page(mem=%p, pg_start=%ld, type=%d, paddr0=0x%lx)\n",
 		 mem, pg_start, type, mem->memory[0]);
 
+	if (type >= AGP_USER_TYPES || mem->type >= AGP_USER_TYPES)
+		return -EINVAL;
+
 	io_pg_start = I460_IOPAGES_PER_KPAGE * pg_start;
 
 	temp = agp_bridge->current_size;
@@ -396,6 +399,9 @@ static int i460_insert_memory_large_io_p
 	struct lp_desc *start, *end, *lp;
 	void *temp;
 
+	if (type >= AGP_USER_TYPES || mem->type >= AGP_USER_TYPES)
+		return -EINVAL;
+
 	temp = agp_bridge->current_size;
 	num_entries = A_SIZE_8(temp)->num_entries;
 
@@ -572,6 +578,7 @@ #else
 #endif
 	.alloc_by_type		= agp_generic_alloc_by_type,
 	.free_by_type		= agp_generic_free_by_type,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 	.cant_use_aperture	= 1,
 };
 
drivers/char/agp/intel-agp.c +120 -66

395 lines not on this page · raw message

drivers/char/agp/nvidia-agp.c +1 -0
index df7f37b..2563286 100644
@@ -310,6 +310,7 @@ static struct agp_bridge_driver nvidia_d
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 static int __devinit agp_nvidia_probe(struct pci_dev *pdev,
drivers/char/agp/parisc-agp.c +1 -0
index 17c50b0..b7b4590 100644
@@ -228,6 +228,7 @@ struct agp_bridge_driver parisc_agp_driv
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 	.cant_use_aperture	= 1,
 };
 
drivers/char/agp/sgi-agp.c +1 -0
index 902648d..92d1dc4 100644
@@ -265,6 +265,7 @@ struct agp_bridge_driver sgi_tioca_drive
 	.free_by_type = agp_generic_free_by_type,
 	.agp_alloc_page = sgi_tioca_alloc_page,
 	.agp_destroy_page = agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 	.cant_use_aperture = 1,
 	.needs_scratch_page = 0,
 	.num_aperture_sizes = 1,
drivers/char/agp/sis-agp.c +1 -0
index a00fd48..60342b7 100644
@@ -140,6 +140,7 @@ static struct agp_bridge_driver sis_driv
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 static struct agp_device_ids sis_agp_device_ids[] __devinitdata =
drivers/char/agp/sworks-agp.c +1 -0
index 4f2d7d9..9f5ae77 100644
@@ -444,6 +444,7 @@ static struct agp_bridge_driver sworks_d
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 static int __devinit agp_serverworks_probe(struct pci_dev *pdev,
drivers/char/agp/uninorth-agp.c +2 -0
index dffc193..6c45702 100644
@@ -510,6 +510,7 @@ struct agp_bridge_driver uninorth_agp_dr
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 	.cant_use_aperture	= 1,
 };
 
@@ -534,6 +535,7 @@ struct agp_bridge_driver u3_agp_driver =
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 	.cant_use_aperture	= 1,
 	.needs_scratch_page	= 1,
 };
drivers/char/agp/via-agp.c +2 -0
index c149ac9..143d3fa 100644
@@ -191,6 +191,7 @@ static struct agp_bridge_driver via_agp3
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 static struct agp_bridge_driver via_driver = {
@@ -214,6 +215,7 @@ static struct agp_bridge_driver via_driv
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 static struct agp_device_ids via_agp_device_ids[] __devinitdata =
include/linux/agp_backend.h +5 -0
index a5c8bb5..abc521c 100644
@@ -87,10 +87,15 @@ struct agp_memory {
 	u32 physical;
 	u8 is_bound;
 	u8 is_flushed;
+        u8 vmalloc_flag;
 };
 
 #define AGP_NORMAL_MEMORY 0
 
+#define AGP_USER_TYPES (1 << 16)
+#define AGP_USER_MEMORY (AGP_USER_TYPES)
+#define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1)
+
 extern struct agp_bridge_data *agp_bridge;
 extern struct list_head agp_bridges;
 
Signature · 1 line
1.4.1
#10 lore raw
In reply to Thomas Hellström
Quoted 16 lines · Thomas Hellström
Quoted 15 lines · Dave Jones
Quoted 10 lines · Eric Buddington
Quoted 5 lines · Thomas Hellstr?m

Eric,
Sorry for the breakage. Can you try the attached patch and see if it fixes the problem.

/Thomas

Thomas,

Thanks! That seems to fix it:

Great. Thomas, can you resend me that patch with a description & Signed-off-by ? (Also for some reason that one looks like it was MIME damaged, git-am wouldn't eat it)

Quoted 6 lines
Quoted 3 lines

Dave

Dave,
I'll post an updated complete patch. The previous one was really only for Eric to try.

Can you send just an incremental against what's in agpgart.git right now?

Thanks,

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#11 lore raw
Quoted 24 lines · Dave Jones
Quoted 16 lines · Thomas Hellström
Quoted 15 lines · Dave Jones
Quoted 10 lines · Eric Buddington
Quoted 5 lines · Thomas Hellstr?m

Eric,
Sorry for the breakage. Can you try the attached patch and see if it fixes the problem.

/Thomas

Thomas,

Thanks! That seems to fix it:

Great. Thomas, can you resend me that patch with a description & Signed-off-by ? (Also for some reason that one looks like it was MIME damaged, git-am wouldn't eat it)

Quoted 6 lines
Quoted 3 lines

Dave

Dave,
I'll post an updated complete patch. The previous one was really only for Eric to try.

Quoted 7 lines

Can you send just an incremental against what's in agpgart.git right now?

Thanks,

Dave

Ok.

Coming right away,

/Thomas

#12 lore raw

PATCH 1/1 Add agp-type-to-mask-type method missing from some drivers.

In reply to Dave Jones

From: Thomas Hellstrom <[email protected]>

drivers/char/agp/parisc-agp.c +1 -0
index 17c50b0..b7b4590 100644
@@ -228,6 +228,7 @@ struct agp_bridge_driver parisc_agp_driv
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 	.cant_use_aperture	= 1,
 };
 
drivers/char/agp/sis-agp.c +1 -0
index a00fd48..60342b7 100644
@@ -140,6 +140,7 @@ static struct agp_bridge_driver sis_driv
 	.free_by_type		= agp_generic_free_by_type,
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
+	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
 static struct agp_device_ids sis_agp_device_ids[] __devinitdata =
Signature · 1 line
1.4.1