Subject: Re: i915drm: uvm_fault() in i915_initialize()
To: None <tech-x11@netbsd.org>
From: Yorick Hardy <yhardy@uj.ac.za>
List: tech-x11
Date: 05/14/2007 13:02:19
This is a multi-part message in MIME format.
--------------090801060704090401000900
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
I suspect this is related to:
http://mail-index.netbsd.org/source-changes/2007/03/24/0039.html
The attached patch might fix it for you
(I have not tried it for a while).
I must still work out a proper solution,
apologies for the wait.
--
Kind regards,
Yorick Hardy
--------------090801060704090401000900
Content-Type: text/plain;
name="drm.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="drm.patch"
diff -u sys/dev/pci/agp_i810.c.orig sys/dev/pci/agp_i810.c
--- sys/dev/pci/agp_i810.c.orig 2007-03-26 16:10:19.000000000 +0200
+++ sys/dev/pci/agp_i810.c 2007-03-26 15:58:57.000000000 +0200
@@ -71,28 +71,6 @@
} \
} while (0)
-#define CHIP_I810 0 /* i810/i815 */
-#define CHIP_I830 1 /* 830M/845G */
-#define CHIP_I855 2 /* 852GM/855GM/865G */
-#define CHIP_I915 3 /* 915G/915GM/945G/945GM */
-
-struct agp_i810_softc {
- u_int32_t initial_aperture; /* aperture size at startup */
- struct agp_gatt *gatt;
- int chiptype; /* i810-like or i830 */
- u_int32_t dcache_size; /* i810 only */
- u_int32_t stolen; /* number of i830/845 gtt entries
- for stolen memory */
- bus_space_tag_t bst; /* register bus_space tag */
- bus_space_handle_t bsh; /* register bus_space handle */
- bus_space_tag_t gtt_bst; /* GTT bus_space tag */
- bus_space_handle_t gtt_bsh; /* GTT bus_space handle */
- struct pci_attach_args vga_pa;
-
- void *sc_powerhook;
- struct pci_conf_state sc_pciconf;
-};
-
static u_int32_t agp_i810_get_aperture(struct agp_softc *);
static int agp_i810_set_aperture(struct agp_softc *, u_int32_t);
static int agp_i810_bind_page(struct agp_softc *, off_t, bus_addr_t);
@@ -725,7 +707,7 @@
* Until the issue is solved, simply restore it.
*/
-#if 0
+#if 1
regval = bus_space_read_4(isc->bst, isc->bsh, AGP_I810_PGTBL_CTL);
if (regval != (isc->gatt->ag_physical | 1)) {
printf("agp_i810_bind_memory: PGTBL_CTL is 0x%x - fixing\n",
diff -u sys/dev/pci/agpvar.h.orig sys/dev/pci/agpvar.h
--- sys/dev/pci/agpvar.h.orig 2007-03-26 16:05:44.000000000 +0200
+++ sys/dev/pci/agpvar.h 2007-03-26 16:03:33.000000000 +0200
@@ -161,6 +161,28 @@
size_t ag_size;
};
+#define CHIP_I810 0 /* i810/i815 */
+#define CHIP_I830 1 /* 830M/845G */
+#define CHIP_I855 2 /* 852GM/855GM/865G */
+#define CHIP_I915 3 /* 915G/915GM/945G/945GM */
+
+struct agp_i810_softc {
+ u_int32_t initial_aperture; /* aperture size at startup */
+ struct agp_gatt *gatt;
+ int chiptype; /* i810-like or i830 */
+ u_int32_t dcache_size; /* i810 only */
+ u_int32_t stolen; /* number of i830/845 gtt entries
+ for stolen memory */
+ bus_space_tag_t bst; /* register bus_space tag */
+ bus_space_handle_t bsh; /* register bus_space handle */
+ bus_space_tag_t gtt_bst; /* GTT bus_space tag */
+ bus_space_handle_t gtt_bsh; /* GTT bus_space handle */
+ struct pci_attach_args vga_pa;
+
+ void *sc_powerhook;
+ struct pci_conf_state sc_pciconf;
+};
+
int agpbusprint(void *, const char *);
/*
diff -u sys/dev/drm/drm_drv.c.orig sys/dev/drm/drm_drv.c
--- sys/dev/drm/drm_drv.c.orig 2007-03-21 18:35:41.000000000 +0200
+++ sys/dev/drm/drm_drv.c 2007-03-26 17:28:22.000000000 +0200
@@ -521,7 +521,7 @@
}
for(i = 0; i<DRM_MAX_PCI_RESOURCE; i++) {
- if (dev->pci_map_data[i].mapped > 1) {
+ if (dev->pci_map_data[i].mapped > 0) {
bus_space_unmap(dev->pci_map_data[i].maptype,
dev->pci_map_data[i].bsh,
dev->pci_map_data[i].size);
@@ -682,7 +682,7 @@
i = 0;
for (i = 0; i < DRM_MAX_PCI_RESOURCE; i++)
- if (dev->pci_map_data[i].mapped != 0)
+ if (dev->pci_map_data[i].mapped > 0)
{
bus_space_unmap(dev->pa.pa_memt,
dev->pci_map_data[i].bsh,
diff -ur sys/dev/drm/drm_memory.c.orig sys/dev/drm/drm_memory.c
--- sys/dev/drm/drm_memory.c.orig 2007-03-21 18:35:41.000000000 +0200
+++ sys/dev/drm/drm_memory.c 2007-03-26 15:55:23.000000000 +0200
@@ -97,8 +97,9 @@
map->bst = dev->pa.pa_memt;
map->cnt = &(dev->pci_map_data[i].mapped);
map->mapsize = dev->pci_map_data[i].size;
- dev->pci_map_data[i].mapped++;
- if (dev->pci_map_data[i].mapped > 1)
+ if (dev->pci_map_data[i].mapped >= 0)
+ dev->pci_map_data[i].mapped++;
+ if (dev->pci_map_data[i].mapped != 1)
{
map->bsh = dev->pci_map_data[i].bsh;
return dev->pci_map_data[i].vaddr;
diff -u sys/dev/pci/drm/i915_drv.c.orig sys/dev/pci/drm/i915_drv.c
--- sys/dev/pci/drm/i915_drv.c.orig 2007-03-21 18:35:41.000000000 +0200
+++ sys/dev/pci/drm/i915_drv.c 2007-03-26 17:26:03.000000000 +0200
@@ -39,6 +39,7 @@
#include "i915_drm.h"
#include "i915_drv.h"
#include "drm_pciids.h"
+#include "agp_i810.h"
/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
static drm_pci_id_list_t i915_pciidlist[] = {
@@ -133,10 +134,32 @@
{
struct pci_attach_args *pa = aux;
drm_device_t *dev = (drm_device_t *)self;
+#if NAGP_I810 > 0
+ struct agp_softc *agpsc;
+ struct agp_i810_softc *agpi810sc;
+ int reg;
+#endif
i915_configure(dev);
drm_attach(self, pa, i915_pciidlist);
+
+#if NAGP_I810 > 0
+ agpsc = (struct agp_softc *)agp_find_device(0);
+ if(agpsc == NULL || agpsc->as_chipc == NULL)
+ return;
+
+ agpi810sc = agpsc->as_chipc;
+ if(agpi810sc->chiptype == CHIP_I915)
+ reg = 0;
+ else
+ reg = 1;
+
+ dev->pci_map_data[reg].bsh = agpi810sc->bsh;
+ dev->pci_map_data[reg].mapped = -1; /* never unmap */
+ dev->pci_map_data[reg].vaddr =
+ bus_space_vaddr(agpi810sc->bst, agpi810sc->bsh);
+#endif
}
CFATTACH_DECL(i915drm, sizeof(drm_device_t), i915drm_probe, i915drm_attach,
--------------090801060704090401000900--