general protection fault on ttm_init()

2012-07-07 Thread Fengguang Wu
On Sat, Jul 07, 2012 at 10:08:47AM +0800, Fengguang Wu wrote:
> On Fri, Jul 06, 2012 at 06:09:20PM +0100, Dave Airlie wrote:
> > On Fri, Jul 6, 2012 at 5:49 PM, Dave Airlie  wrote:
> > > On Fri, Jul 6, 2012 at 3:48 PM, Fengguang Wu  
> > > wrote:
> > >> ... The missed kconfig.
> > >>
> > >> On Fri, Jul 06, 2012 at 10:46:22PM +0800, Fengguang Wu wrote:
> > >>> Hi Thomas,
> > >
> > > Wierd, I'm sorta tempted to just depend drm on CONFIG_PROC_FS, but it
> > > looks like the error path is failing to dtrt.
> > 
> > I've attached a patch that should fix it, let me know if it works.
> 
> It does not work.. The dmesg (attached) remains the same.

I got more interesting back traces in a clean kernel:

device class 'drm': registering
kobject: 'drm' (88000f07f050): kobject_add_internal: parent: 'class', set: 
'class'
kobject: 'drm' (88000f07f050): kobject_uevent_env
kobject: 'drm' (88000f07f050): fill_kobj_path: path = '/class/drm'
[drm:drm_core_init] *ERROR* Cannot create /proc/dri
device class 'drm': unregistering
kobject: 'drm' (88000f07f050): kobject_cleanup
kobject: 'drm' (88000f07f050): auto cleanup 'remove' event
kobject: 'drm' (88000f07f050): kobject_uevent_env
kobject: 'drm' (88000f07f050): fill_kobj_path: path = '/class/drm'
kobject: 'drm' (88000f07f050): auto cleanup kobject_del
kobject: 'drm' (88000f07f050): calling ktype release
class 'drm': release.
class_create_release called for drm
kobject: 'drm': free name
kobject: 'drm' (88000f080070): kobject_cleanup
kobject: 'drm' (88000f080070): calling ktype release
kobject: 'drm': free name
device: 'ttm': device_add
kobject: '(null)' (88000f080230): kobject_add_internal: parent: 'virtual', 
set: '(null)'
kobject: 'ttm' (824709b0): kobject_add_internal: parent: '(null)', set: 
'devices'
general protection fault:  [#1] SMP
CPU 1
Pid: 1, comm: swapper/0 Not tainted 3.5.0-rc5-bisect #207
RIP: 0010:[]  [] 
sysfs_do_create_link+0x59/0x1c0
RSP: 0018:88107db0  EFLAGS: 00010206
RAX: 8810 RBX: 00cc RCX: dad9
RDX: d9d9 RSI:  RDI: 8243b320
RBP: 88107e00 R08: 88100580 R09: fe80
R10: 8810 R11: 0200 R12: 821622db
R13: 88000f080150 R14: 0001 R15: 88000f080308
FS:  () GS:88000df0() knlGS:
CS:  0010 DS:  ES:  CR0: 8005003b
CR2:  CR3: 02411000 CR4: 06a0
DR0:  DR1:  DR2: 
DR3:  DR6: 0ff0 DR7: 0400
Process swapper/0 (pid: 1, threadinfo 88106000, task 8810)
Stack:
 88000f080308  824709b0 02ec
   824709b0 02ec
  824709a0 88107e10 8115ecce
Call Trace:
 [] sysfs_create_link+0xe/0x10
 [] device_add+0x289/0x610
 [] ? drm_core_init+0xca/0xca
 [] ? device_pm_init+0x69/0x90
 [] ? drm_core_init+0xca/0xca
 [] device_register+0x19/0x20
 [] drm_class_device_register+0x17/0x20
 [] ttm_init+0x37/0x62
 [] do_one_initcall+0x7a/0x139
 [] kernel_init+0x103/0x187
 [] ? do_early_param+0x8c/0x8c
 [] kernel_thread_helper+0x4/0x10
 [] ? retint_restore_args+0x13/0x13
 [] ? do_one_initcall+0x139/0x139
 [] ? gs_change+0x13/0x13
Code: 4c 8b 7f 30 bb f2 ff ff ff 4d 85 ff 0f 84 a2 00 00 00 48 c7 c7 20 b3 43 
82 e8 c4 e2 b6 00 49 8b 5d 30 48 85 db 0f 84 27 01 00 00 <8b> 03 f0 ff 03 48 c7 
c7 20 b3 43 82 e8 d6 e3 b6 00 4c 89 e7 ba
RIP  [] sysfs_do_create_link+0x59/0x1c0
 RSP 


and:


kobject: 'drm': free name
device: 'ttm': device_add
BUG: unable to handle kernel paging request at 00010001
IP: [] strnlen+0xd/0x40
PGD 0
Oops:  [#1] SMP
CPU 1
Pid: 1, comm: swapper/0 Not tainted 3.5.0-rc5-bisect #207
RIP: 0010:[]  [] strnlen+0xd/0x40
RSP: 0018:88107c30  EFLAGS: 00010286
RAX: 8210a8fc RBX:  RCX: fffe
RDX: 00010001 RSI:  RDI: 00010001
RBP: 88107c30 R08:  R09: 
R10: 88000f0750f0 R11: 824384e0 R12: 00010001
R13:  R14:  R15: 
FS:  () GS:88000df0() knlGS:
CS:  0010 DS:  ES:  CR0: 8005003b
CR2: 00010001 CR3: 02411000 CR4: 06a0
DR0:  DR1:  DR2: 
DR3:  DR6: 0ff0 DR7: 0400
Process swapper/0 (pid: 1, threadinfo 88106000, task 8810)
Stack:
 88107c70 8137cc3e 82ff88a0 
  88107d08 8222f3dc 8222f3dc
 88107cf0 8137d719 0007 0006
Call Trace:
 [] string.isra.4+0x3e/0xd0
 [] vs

Re: Tegra DRM device tree bindings

2012-07-07 Thread Thierry Reding
On Fri, Jul 06, 2012 at 01:59:13PM -0600, Stephen Warren wrote:
> On 07/05/2012 06:15 AM, Thierry Reding wrote:
> > Here's a new proposal that should address all issues collected
> > during the discussion of the previous one:
> > 
> > From tegra20.dtsi:
> ...
> 
> At a quick glance, that all seems pretty reasonable now.
> 
> > One problem I've come across when trying to get some rudimentary
> > code working with this is that there's no longer a device which the
> > DRM driver can bind to, because the top-level device (host1x) now
> > has a separate driver.
> 
> Can't you just have the host1x driver trigger the instantiation of the
> DRM driver? In other words, the host1x node is both the plain host1x
> driver and the DRM driver. So, after initializing anything for host1x
> itself, just end host1x's probe() with something a call to
> drm_platform_init(), passing in host1x's own pdev.
> 
> After all, it seems like the whole point of representing host1x in the
> DT is to expose the graphics HW, so you'd need the DRM device in that
> case.

The reason that I've been hesitating is that host1x isn't related only
to graphics HW but is also required to make f.e. video input work. So I
can imagine a setup where for instance you need only video input and
send captured data via the network. If host1x registered the DRM driver
it would imply that setups that don't require any output would still
have the whole DRM initialized.

I did post a proposal to solve this problem, which doesn't seem Tegra
specific, to dri-devel last week. But if nobody else thinks it's a
problem to use host1x then I'll just use that as the easy way out. If
this happens to cause problems at some point in the future we can always
address it then. If host1x is tightly coupled to DRM then I think we can
also keep the driver with the rest of the DRM code.

Thierry


pgpRdiZzQIp5W.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/mgag200: fix null pointer dereference

2012-07-07 Thread Devendra Naga
we are referencing the pointer after doing alloc_apertures,
as alloc_apertures kzallocs, the kzalloc may fail and we get a NULL.

so we need to check for NULL before we dereference this pointer

Signed-off-by: Devendra Naga 
---
 drivers/gpu/drm/mgag200/mgag200_drv.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c 
b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 93e832d..ea1024d 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -47,6 +47,9 @@ static void mgag200_kick_out_firmware_fb(struct pci_dev *pdev)
bool primary = false;

ap = alloc_apertures(1);
+   if (!ap)
+   return;
+
ap->ranges[0].base = pci_resource_start(pdev, 0);
ap->ranges[0].size = pci_resource_len(pdev, 0);

-- 
1.7.9.5



[PATCH 2/2] drm/radeon: Make sure the correct TA bit is used for R700

2012-07-07 Thread Lauri Kasanen

The declarations were moved around because of a GCC warning,
"ISO C90 forbids mixed declarations and code". (why so strict?)

Signed-off-by: Lauri Kasanen 
---
 drivers/gpu/drm/radeon/r600.c |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index bff6272..c77cdba 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1278,15 +1278,24 @@ void r600_vram_scratch_fini(struct radeon_device *rdev)
 int r600_gpu_soft_reset(struct radeon_device *rdev)
 {
struct rv515_mc_save save;
-   u32 grbm_busy_mask = S_008010_VC_BUSY(1) | S_008010_VGT_BUSY_NO_DMA(1) |
-   S_008010_VGT_BUSY(1) | S_008010_TA03_BUSY(1) |
+   u32 grbm_busy_mask;
+   u32 grbm2_busy_mask;
+   u32 tmp;
+
+   u32 ta_busy = S_008010_TA03_BUSY(1);
+
+   if (rdev->family >= CHIP_RV770)
+   ta_busy = S_008010_R700_TA03_BUSY(1);
+
+   grbm_busy_mask = S_008010_VC_BUSY(1) | S_008010_VGT_BUSY_NO_DMA(1) |
+   S_008010_VGT_BUSY(1) | ta_busy |
S_008010_TC_BUSY(1) | S_008010_SX_BUSY(1) |
S_008010_SH_BUSY(1) | S_008010_SPI03_BUSY(1) |
S_008010_SMX_BUSY(1) | S_008010_SC_BUSY(1) |
S_008010_PA_BUSY(1) | S_008010_DB03_BUSY(1) |
S_008010_CR_BUSY(1) | S_008010_CB03_BUSY(1) |
S_008010_GUI_ACTIVE(1);
-   u32 grbm2_busy_mask = S_008014_SPI0_BUSY(1) | S_008014_SPI1_BUSY(1) |
+   grbm2_busy_mask = S_008014_SPI0_BUSY(1) | S_008014_SPI1_BUSY(1) |
S_008014_SPI2_BUSY(1) | S_008014_SPI3_BUSY(1) |
S_008014_TA0_BUSY(1) | S_008014_TA1_BUSY(1) |
S_008014_TA2_BUSY(1) | S_008014_TA3_BUSY(1) |
@@ -1294,7 +1303,6 @@ int r600_gpu_soft_reset(struct radeon_device *rdev)
S_008014_DB2_BUSY(1) | S_008014_DB3_BUSY(1) |
S_008014_CB0_BUSY(1) | S_008014_CB1_BUSY(1) |
S_008014_CB2_BUSY(1) | S_008014_CB3_BUSY(1);
-   u32 tmp;

if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))
return 0;
-- 
1.7.2.1



[PATCH 1/2] drm/radeon: Document that R700 has a different TA status bit than R600

2012-07-07 Thread Lauri Kasanen
Hi

This info comes from r600_demo, and was confirmed correct on a RV710.

Signed-off-by: Lauri Kasanen 
---
 drivers/gpu/drm/radeon/r600d.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index 025fd5b..b818a5c 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -1192,6 +1192,7 @@
 #defineS_008010_VC_BUSY(x) (((x) & 1) << 
11)
 #defineS_008010_DB03_CLEAN(x)  (((x) & 1) << 
12)
 #defineS_008010_CB03_CLEAN(x)  (((x) & 1) << 
13)
+#defineS_008010_R700_TA03_BUSY(x)  (((x) & 1) << 
14)
 #defineS_008010_VGT_BUSY_NO_DMA(x) (((x) & 1) << 
16)
 #defineS_008010_VGT_BUSY(x)(((x) & 1) << 
17)
 #defineS_008010_TA03_BUSY(x)   (((x) & 1) << 
18)
-- 
1.7.2.1



[PATCH 1/2] video: drm: exynos: Add device tree support

2012-07-07 Thread Kyungmin Park
Hi,

On Fri, Jul 6, 2012 at 9:28 PM, Leela Krishna Amudala
 wrote:
> Add device tree based discovery support for DRM-FIMD driver.
>
> Signed-off-by: Leela Krishna Amudala 
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 29fdbfe..37769cf 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -18,6 +18,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include 
>  #include 
> @@ -788,12 +789,84 @@ static int fimd_power_on(struct fimd_context *ctx, bool 
> enable)
> return 0;
>  }
>
> +#ifdef CONFIG_OF
> +static struct exynos_drm_fimd_pdata *drm_fimd_dt_parse_pdata(struct device 
> *dev)
> +{
> +   struct device_node *np = dev->of_node;
> +   struct device_node *disp_np;
> +   struct exynos_drm_fimd_pdata *pd;
> +   u32 data[4];
> +
> +   pd = kzalloc(sizeof(*pd), GFP_KERNEL);
> +   if (!pd) {
> +   dev_err(dev, "memory allocation for pdata failed\n");
> +   return ERR_PTR(-ENOMEM);
> +   }
> +
> +   if (of_get_property(np, "samsung,fimd-vidout-rgb", NULL))
> +   pd->vidcon0 |= VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB;
> +   if (of_get_property(np, "samsung,fimd-vidout-tv", NULL))
> +   pd->vidcon0 |= VIDCON0_VIDOUT_TV;
> +   if (of_get_property(np, "samsung,fimd-inv-hsync", NULL))
> +   pd->vidcon1 |= VIDCON1_INV_HSYNC;
> +   if (of_get_property(np, "samsung,fimd-inv-vsync", NULL))
> +   pd->vidcon1 |= VIDCON1_INV_VSYNC;
> +   if (of_get_property(np, "samsung,fimd-inv-vclk", NULL))
> +   pd->vidcon1 |= VIDCON1_INV_VCLK;
> +   if (of_get_property(np, "samsung,fimd-inv-vden", NULL))
> +   pd->vidcon1 |= VIDCON1_INV_VDEN;
> +
> +   disp_np = of_parse_phandle(np, "samsung,fimd-display", 0);
> +   if (!disp_np) {
> +   dev_err(dev, "unable to find display panel info\n");
> +   return ERR_PTR(-EINVAL);
> +   }
> +
> +   if (of_property_read_u32_array(disp_np, "lcd-htiming", data, 4)) {
> +   dev_err(dev, "invalid horizontal timing\n");
> +   return ERR_PTR(-EINVAL);
> +   }
> +   pd->panel.timing.left_margin = data[0];
> +   pd->panel.timing.right_margin = data[1];
> +   pd->panel.timing.hsync_len = data[2];
> +   pd->panel.timing.xres = data[3];
> +
> +   if (of_property_read_u32_array(disp_np, "lcd-vtiming", data, 4)) {
> +   dev_err(dev, "invalid vertical timing\n");
> +   return ERR_PTR(-EINVAL);
> +   }
> +   pd->panel.timing.upper_margin = data[0];
> +   pd->panel.timing.lower_margin = data[1];
> +   pd->panel.timing.vsync_len = data[2];
> +   pd->panel.timing.yres = data[3];
> +
> +   of_property_read_u32(disp_np, "lcd-panel-type", &pd->panel_type);
> +
> +   of_property_read_u32(np, "samsung,fimd-frame-rate",
> +   &pd->panel.timing.refresh);
> +
> +   of_property_read_u32(np, "samsung, defalut-window", &pd->default_win);
No space between after comma.
> +
> +   of_property_read_u32(np, "samsung,fimd-win-bpp", &pd->bpp);
> +
> +   return pd;
> +}
> +#else
> +static int drm_fimd_dt_parse_pdata(struct device *dev,
> +   struct exynos_drm_fimd_pdata **pdata)
> +{
> +   return 0;
> +}
> +#endif /* CONFIG_OF */
> +
> +static const struct of_device_id drm_fimd_dt_match[];
> +
>  static int __devinit fimd_probe(struct platform_device *pdev)
>  {
> struct device *dev = &pdev->dev;
> struct fimd_context *ctx;
> struct exynos_drm_subdrv *subdrv;
> -   struct exynos_drm_fimd_pdata *pdata;
> +   struct exynos_drm_fimd_pdata *pdata = pdev->dev.platform_data;
> struct exynos_drm_panel_info *panel;
> struct resource *res;
> int win;
> @@ -801,7 +874,11 @@ static int __devinit fimd_probe(struct platform_device 
> *pdev)
>
> DRM_DEBUG_KMS("%s\n", __FILE__);
>
> -   pdata = pdev->dev.platform_data;
> +   if (pdev->dev.of_node) {
> +   pdata = drm_fimd_dt_parse_pdata(&pdev->dev);
> +   if (IS_ERR(pdata))
> +   return PTR_ERR(pdata);
> +   }
> if (!pdata) {
> dev_err(dev, "no platform data specified\n");
> return -EINVAL;
> @@ -1006,6 +1083,15 @@ static int fimd_runtime_resume(struct device *dev)
>  }
>  #endif
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id drm_fimd_dt_match[] = {
> +   { .compatible = "samsung,exynos5-fb",
It's ambiguous. it's better to use "samsung,exynos5-drm".
Yes I know, previous it uses exynos4-fb to reduce the modification
with mainline. but correct name is exynoxX-drm.

Thank you,
Kyungmin Park
> +   .data = (void *)NULL },
> +   {},
> +};
> +MODULE_DEVICE_TABLE(of, drm_fimd_dt_match);
> +#endif
> +
>  static const st

general protection fault on ttm_init()

2012-07-07 Thread Fengguang Wu
On Fri, Jul 06, 2012 at 06:09:20PM +0100, Dave Airlie wrote:
> On Fri, Jul 6, 2012 at 5:49 PM, Dave Airlie  wrote:
> > On Fri, Jul 6, 2012 at 3:48 PM, Fengguang Wu  
> > wrote:
> >> ... The missed kconfig.
> >>
> >> On Fri, Jul 06, 2012 at 10:46:22PM +0800, Fengguang Wu wrote:
> >>> Hi Thomas,
> >
> > Wierd, I'm sorta tempted to just depend drm on CONFIG_PROC_FS, but it
> > looks like the error path is failing to dtrt.
> 
> I've attached a patch that should fix it, let me know if it works.

It does not work.. The dmesg (attached) remains the same.

> though since the drm fails on proc not being there I wonder should we
> just enforce proc being there if you pick drm.

Yeah, enabling PROC_FS does fix the error :)

Thanks,
Fengguang
-- next part --
[0.00] Linux version 3.5.0-rc2-00059-gc5fb75a-dirty (wfg at wfg-t420) 
(gcc version 4.7.0 (Debian 4.7.0-10) ) #3 PREEMPT Sat Jul 7 09:42:37 CST 2012
[0.00] Command line: console=ttyS0,115200 console=tty nokeymap 
root=/dev/ram0 rw
[0.00] e820: BIOS-provided physical RAM map:
[0.00] BIOS-e820: [mem 0x-0x0009f3ff] usable
[0.00] BIOS-e820: [mem 0x0009f400-0x0009] reserved
[0.00] BIOS-e820: [mem 0x000f-0x000f] reserved
[0.00] BIOS-e820: [mem 0x0010-0x1fffcfff] usable
[0.00] BIOS-e820: [mem 0x1fffd000-0x1fff] reserved
[0.00] BIOS-e820: [mem 0xfeffc000-0xfeff] reserved
[0.00] BIOS-e820: [mem 0xfffc-0x] reserved
[0.00] NX (Execute Disable) protection: active
[0.00] DMI 2.4 present.
[0.00] e820: last_pfn = 0x1fffd max_arch_pfn = 0x4
[0.00] x86 PAT enabled: cpu 0, old 0x70406, new 0x7010600070106
[0.00] init_memory_mapping: [mem 0x-0x1fffcfff]
[0.00] RAMDISK: [mem 0x1e8d6000-0x1ffe]
[0.00] ACPI: RSDP 000fd9a0 00014 (v00 BOCHS )
[0.00] ACPI: RSDT 1fffd7b0 00034 (v01 BOCHS  BXPCRSDT 0001 
BXPC 0001)
[0.00] ACPI: FACP 1f80 00074 (v01 BOCHS  BXPCFACP 0001 
BXPC 0001)
[0.00] ACPI: DSDT 1fffd9b0 02589 (v01   BXPC   BXDSDT 0001 
INTL 20100528)
[0.00] ACPI: FACS 1f40 00040
[0.00] ACPI: SSDT 1fffd910 0009E (v01 BOCHS  BXPCSSDT 0001 
BXPC 0001)
[0.00] ACPI: APIC 1fffd830 00072 (v01 BOCHS  BXPCAPIC 0001 
BXPC 0001)
[0.00] ACPI: HPET 1fffd7f0 00038 (v01 BOCHS  BXPCHPET 0001 
BXPC 0001)
[0.00] kvm-clock: Using msrs 4b564d01 and 4b564d00
[0.00] kvm-clock: cpu 0, msr 0:1a2cc81, boot clock
[0.00] Zone ranges:
[0.00]   DMA32[mem 0x0001-0x]
[0.00]   Normal   empty
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x0001-0x0009efff]
[0.00]   node   0: [mem 0x0010-0x1fffcfff]
[0.00] ACPI: PM-Timer IO Port: 0xb008
[0.00] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[0.00] ACPI: IOAPIC (id[0x01] address[0xfec0] gsi_base[0])
[0.00] IOAPIC[0]: apic_id 1, version 17, address 0xfec0, GSI 0-23
[0.00] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[0.00] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[0.00] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[0.00] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[0.00] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[0.00] Using ACPI (MADT) for SMP configuration information
[0.00] ACPI: HPET id: 0x8086a201 base: 0xfed0
[0.00] KVM setup async PF for cpu 0
[0.00] kvm-stealtime: cpu 0, msr 1a2cc00
[0.00] e820: [mem 0x2000-0xfeffbfff] available for PCI devices
[0.00] Booting paravirtualized kernel on KVM
[0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total 
pages: 128902
[0.00] Kernel command line: 
[0.00] PID hash table entries: 2048 (order: 2, 16384 bytes)
[0.00] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
[0.00] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes)
[0.00] __ex_table already sorted, skipping sort
[0.00] Memory: 469120k/524276k available (5504k kernel code, 452k 
absent, 54704k reserved, 7636k data, 820k init)
[0.00] SLUB: Genslabs=15, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, 
Nodes=1
[0.00] NR_IRQS:4352 nr_irqs:256 16
[0.00] console [ttyS0] enabled
[0.00] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., 
Ingo Molnar
[0.00] ... MAX_LOCKDEP_SUBCLASSES:  8
[0.00] ... MAX_LOCK_DEPTH:  48
[0.00] ... MAX_LOCKDEP_KEYS:8191

Re: general protection fault on ttm_init()

2012-07-07 Thread Fengguang Wu
On Sat, Jul 07, 2012 at 10:08:47AM +0800, Fengguang Wu wrote:
> On Fri, Jul 06, 2012 at 06:09:20PM +0100, Dave Airlie wrote:
> > On Fri, Jul 6, 2012 at 5:49 PM, Dave Airlie  wrote:
> > > On Fri, Jul 6, 2012 at 3:48 PM, Fengguang Wu  
> > > wrote:
> > >> ... The missed kconfig.
> > >>
> > >> On Fri, Jul 06, 2012 at 10:46:22PM +0800, Fengguang Wu wrote:
> > >>> Hi Thomas,
> > >
> > > Wierd, I'm sorta tempted to just depend drm on CONFIG_PROC_FS, but it
> > > looks like the error path is failing to dtrt.
> > 
> > I've attached a patch that should fix it, let me know if it works.
> 
> It does not work.. The dmesg (attached) remains the same.

I got more interesting back traces in a clean kernel:

device class 'drm': registering
kobject: 'drm' (88000f07f050): kobject_add_internal: parent: 'class', set: 
'class'
kobject: 'drm' (88000f07f050): kobject_uevent_env
kobject: 'drm' (88000f07f050): fill_kobj_path: path = '/class/drm'
[drm:drm_core_init] *ERROR* Cannot create /proc/dri
device class 'drm': unregistering
kobject: 'drm' (88000f07f050): kobject_cleanup
kobject: 'drm' (88000f07f050): auto cleanup 'remove' event
kobject: 'drm' (88000f07f050): kobject_uevent_env
kobject: 'drm' (88000f07f050): fill_kobj_path: path = '/class/drm'
kobject: 'drm' (88000f07f050): auto cleanup kobject_del
kobject: 'drm' (88000f07f050): calling ktype release
class 'drm': release.
class_create_release called for drm
kobject: 'drm': free name
kobject: 'drm' (88000f080070): kobject_cleanup
kobject: 'drm' (88000f080070): calling ktype release
kobject: 'drm': free name
device: 'ttm': device_add
kobject: '(null)' (88000f080230): kobject_add_internal: parent: 'virtual', 
set: '(null)'
kobject: 'ttm' (824709b0): kobject_add_internal: parent: '(null)', set: 
'devices'
general protection fault:  [#1] SMP
CPU 1
Pid: 1, comm: swapper/0 Not tainted 3.5.0-rc5-bisect #207
RIP: 0010:[]  [] 
sysfs_do_create_link+0x59/0x1c0
RSP: 0018:88107db0  EFLAGS: 00010206
RAX: 8810 RBX: 00cc RCX: dad9
RDX: d9d9 RSI:  RDI: 8243b320
RBP: 88107e00 R08: 88100580 R09: fe80
R10: 8810 R11: 0200 R12: 821622db
R13: 88000f080150 R14: 0001 R15: 88000f080308
FS:  () GS:88000df0() knlGS:
CS:  0010 DS:  ES:  CR0: 8005003b
CR2:  CR3: 02411000 CR4: 06a0
DR0:  DR1:  DR2: 
DR3:  DR6: 0ff0 DR7: 0400
Process swapper/0 (pid: 1, threadinfo 88106000, task 8810)
Stack:
 88000f080308  824709b0 02ec
   824709b0 02ec
  824709a0 88107e10 8115ecce
Call Trace:
 [] sysfs_create_link+0xe/0x10
 [] device_add+0x289/0x610
 [] ? drm_core_init+0xca/0xca
 [] ? device_pm_init+0x69/0x90
 [] ? drm_core_init+0xca/0xca
 [] device_register+0x19/0x20
 [] drm_class_device_register+0x17/0x20
 [] ttm_init+0x37/0x62
 [] do_one_initcall+0x7a/0x139
 [] kernel_init+0x103/0x187
 [] ? do_early_param+0x8c/0x8c
 [] kernel_thread_helper+0x4/0x10
 [] ? retint_restore_args+0x13/0x13
 [] ? do_one_initcall+0x139/0x139
 [] ? gs_change+0x13/0x13
Code: 4c 8b 7f 30 bb f2 ff ff ff 4d 85 ff 0f 84 a2 00 00 00 48 c7 c7 20 b3 43 
82 e8 c4 e2 b6 00 49 8b 5d 30 48 85 db 0f 84 27 01 00 00 <8b> 03 f0 ff 03 48 c7 
c7 20 b3 43 82 e8 d6 e3 b6 00 4c 89 e7 ba
RIP  [] sysfs_do_create_link+0x59/0x1c0
 RSP 


and:


kobject: 'drm': free name
device: 'ttm': device_add
BUG: unable to handle kernel paging request at 00010001
IP: [] strnlen+0xd/0x40
PGD 0
Oops:  [#1] SMP
CPU 1
Pid: 1, comm: swapper/0 Not tainted 3.5.0-rc5-bisect #207
RIP: 0010:[]  [] strnlen+0xd/0x40
RSP: 0018:88107c30  EFLAGS: 00010286
RAX: 8210a8fc RBX:  RCX: fffe
RDX: 00010001 RSI:  RDI: 00010001
RBP: 88107c30 R08:  R09: 
R10: 88000f0750f0 R11: 824384e0 R12: 00010001
R13:  R14:  R15: 
FS:  () GS:88000df0() knlGS:
CS:  0010 DS:  ES:  CR0: 8005003b
CR2: 00010001 CR3: 02411000 CR4: 06a0
DR0:  DR1:  DR2: 
DR3:  DR6: 0ff0 DR7: 0400
Process swapper/0 (pid: 1, threadinfo 88106000, task 8810)
Stack:
 88107c70 8137cc3e 82ff88a0 
  88107d08 8222f3dc 8222f3dc
 88107cf0 8137d719 0007 0006
Call Trace:
 [] string.isra.4+0x3e/0xd0
 [] vs

[PATCH 2/2] drm/radeon: Make sure the correct TA bit is used for R700

2012-07-07 Thread Lauri Kasanen

The declarations were moved around because of a GCC warning,
"ISO C90 forbids mixed declarations and code". (why so strict?)

Signed-off-by: Lauri Kasanen 
---
 drivers/gpu/drm/radeon/r600.c |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index bff6272..c77cdba 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1278,15 +1278,24 @@ void r600_vram_scratch_fini(struct radeon_device *rdev)
 int r600_gpu_soft_reset(struct radeon_device *rdev)
 {
struct rv515_mc_save save;
-   u32 grbm_busy_mask = S_008010_VC_BUSY(1) | S_008010_VGT_BUSY_NO_DMA(1) |
-   S_008010_VGT_BUSY(1) | S_008010_TA03_BUSY(1) |
+   u32 grbm_busy_mask;
+   u32 grbm2_busy_mask;
+   u32 tmp;
+
+   u32 ta_busy = S_008010_TA03_BUSY(1);
+
+   if (rdev->family >= CHIP_RV770)
+   ta_busy = S_008010_R700_TA03_BUSY(1);
+
+   grbm_busy_mask = S_008010_VC_BUSY(1) | S_008010_VGT_BUSY_NO_DMA(1) |
+   S_008010_VGT_BUSY(1) | ta_busy |
S_008010_TC_BUSY(1) | S_008010_SX_BUSY(1) |
S_008010_SH_BUSY(1) | S_008010_SPI03_BUSY(1) |
S_008010_SMX_BUSY(1) | S_008010_SC_BUSY(1) |
S_008010_PA_BUSY(1) | S_008010_DB03_BUSY(1) |
S_008010_CR_BUSY(1) | S_008010_CB03_BUSY(1) |
S_008010_GUI_ACTIVE(1);
-   u32 grbm2_busy_mask = S_008014_SPI0_BUSY(1) | S_008014_SPI1_BUSY(1) |
+   grbm2_busy_mask = S_008014_SPI0_BUSY(1) | S_008014_SPI1_BUSY(1) |
S_008014_SPI2_BUSY(1) | S_008014_SPI3_BUSY(1) |
S_008014_TA0_BUSY(1) | S_008014_TA1_BUSY(1) |
S_008014_TA2_BUSY(1) | S_008014_TA3_BUSY(1) |
@@ -1294,7 +1303,6 @@ int r600_gpu_soft_reset(struct radeon_device *rdev)
S_008014_DB2_BUSY(1) | S_008014_DB3_BUSY(1) |
S_008014_CB0_BUSY(1) | S_008014_CB1_BUSY(1) |
S_008014_CB2_BUSY(1) | S_008014_CB3_BUSY(1);
-   u32 tmp;
 
if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))
return 0;
-- 
1.7.2.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] drm/radeon: Document that R700 has a different TA status bit than R600

2012-07-07 Thread Lauri Kasanen
Hi

This info comes from r600_demo, and was confirmed correct on a RV710.

Signed-off-by: Lauri Kasanen 
---
 drivers/gpu/drm/radeon/r600d.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index 025fd5b..b818a5c 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -1192,6 +1192,7 @@
 #defineS_008010_VC_BUSY(x) (((x) & 1) << 
11)
 #defineS_008010_DB03_CLEAN(x)  (((x) & 1) << 
12)
 #defineS_008010_CB03_CLEAN(x)  (((x) & 1) << 
13)
+#defineS_008010_R700_TA03_BUSY(x)  (((x) & 1) << 
14)
 #defineS_008010_VGT_BUSY_NO_DMA(x) (((x) & 1) << 
16)
 #defineS_008010_VGT_BUSY(x)(((x) & 1) << 
17)
 #defineS_008010_TA03_BUSY(x)   (((x) & 1) << 
18)
-- 
1.7.2.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/mgag200: fix null pointer dereference

2012-07-07 Thread Devendra Naga
we are referencing the pointer after doing alloc_apertures,
as alloc_apertures kzallocs, the kzalloc may fail and we get a NULL.

so we need to check for NULL before we dereference this pointer

Signed-off-by: Devendra Naga 
---
 drivers/gpu/drm/mgag200/mgag200_drv.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c 
b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 93e832d..ea1024d 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -47,6 +47,9 @@ static void mgag200_kick_out_firmware_fb(struct pci_dev *pdev)
bool primary = false;
 
ap = alloc_apertures(1);
+   if (!ap)
+   return;
+
ap->ranges[0].base = pci_resource_start(pdev, 0);
ap->ranges[0].size = pci_resource_len(pdev, 0);
 
-- 
1.7.9.5

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] gma500: move the ASLE enable

2012-07-07 Thread Alan Cox
From: Alan Cox 

Otherwise we end up getting the masks wrong, can get events before we are
doing power control and other ungood things.

Signed-off-by: Alan Cox 
---

 drivers/gpu/drm/gma500/opregion.c |8 +++-
 drivers/gpu/drm/gma500/opregion.h |5 +
 drivers/gpu/drm/gma500/psb_drv.c  |1 +
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/gma500/opregion.c 
b/drivers/gpu/drm/gma500/opregion.c
index 4f186ec..c430bd4 100644
--- a/drivers/gpu/drm/gma500/opregion.c
+++ b/drivers/gpu/drm/gma500/opregion.c
@@ -144,6 +144,8 @@ struct opregion_asle {

 #define ASLE_CBLV_VALID (1<<31)

+static struct psb_intel_opregion *system_opregion;
+
 static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
struct drm_psb_private *dev_priv = dev->dev_private;
@@ -205,7 +207,7 @@ void psb_intel_opregion_enable_asle(struct drm_device *dev)
struct drm_psb_private *dev_priv = dev->dev_private;
struct opregion_asle *asle = dev_priv->opregion.asle;

-   if (asle) {
+   if (asle && system_opregion ) {
/* Don't do this on Medfield or other non PC like devices, they
   use the bit for something different altogether */
psb_enable_pipestat(dev_priv, 0, PIPE_LEGACY_BLC_EVENT_ENABLE);
@@ -221,7 +223,6 @@ void psb_intel_opregion_enable_asle(struct drm_device *dev)
 #define ACPI_EV_LID(1<<1)
 #define ACPI_EV_DOCK   (1<<2)

-static struct psb_intel_opregion *system_opregion;

 static int psb_intel_opregion_video_event(struct notifier_block *nb,
  unsigned long val, void *data)
@@ -266,9 +267,6 @@ void psb_intel_opregion_init(struct drm_device *dev)
system_opregion = opregion;
register_acpi_notifier(&psb_intel_opregion_notifier);
}
-
-   if (opregion->asle)
-   psb_intel_opregion_enable_asle(dev);
 }

 void psb_intel_opregion_fini(struct drm_device *dev)
diff --git a/drivers/gpu/drm/gma500/opregion.h 
b/drivers/gpu/drm/gma500/opregion.h
index 72dc6b9..4a90f8b 100644
--- a/drivers/gpu/drm/gma500/opregion.h
+++ b/drivers/gpu/drm/gma500/opregion.h
@@ -27,6 +27,7 @@ extern void psb_intel_opregion_asle_intr(struct drm_device 
*dev);
 extern void psb_intel_opregion_init(struct drm_device *dev);
 extern void psb_intel_opregion_fini(struct drm_device *dev);
 extern int psb_intel_opregion_setup(struct drm_device *dev);
+extern void psb_intel_opregion_enable_asle(struct drm_device *dev);

 #else

@@ -46,4 +47,8 @@ extern inline int psb_intel_opregion_setup(struct drm_device 
*dev)
 {
return 0;
 }
+
+extern inline void psb_intel_opregion_enable_asle(struct drm_device *dev)
+{
+}
 #endif
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index caba6e0..a8858a9 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -374,6 +374,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned 
long chipset)

if (ret)
return ret;
+   psb_intel_opregion_enable_asle(dev);
 #if 0
/*enable runtime pm at last*/
pm_runtime_enable(&dev->pdev->dev);