From ae6cc482cff568ff812a5e34aa9254d802ce44eb Mon Sep 17 00:00:00 2001 From: Matt Sealey Date: Wed, 28 Nov 2012 10:35:08 -0800 Subject: [PATCH] amd-gpu: initialize the command stream before allocating any sharedmem Move some code up like Qualcomm's so that the command stream is initialized before any sharedmem is allocated. This only causes a panic when fine grained locking is enabled, but it showed up a big difference in code order. A little research shows the different order in the code path makes no difference whatsoever (cmdstream does not depend on the memstore pointer) but it does solve that first panic. To solve: similar problem with Z160 regwrite call from device_init which assumes cmdwindow is all set up when it isn't.. Qualcomm's code is MUCH simpler in this regard and may solve it by simply being so. --- drivers/mxc/amd-gpu/kgsl_device.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/mxc/amd-gpu/kgsl_device.c b/drivers/mxc/amd-gpu/kgsl_device.c index 4177f433ca0..43d2de218d0 100644 --- a/drivers/mxc/amd-gpu/kgsl_device.c +++ b/drivers/mxc/amd-gpu/kgsl_device.c @@ -100,6 +100,21 @@ kgsl_device_init(struct kgsl_device *device, unsigned int device_id) status = GSL_FAILURE_NOTINITIALIZED; } + // init memqueue + device->memqueue.head = NULL; + device->memqueue.tail = NULL; + + // init cmdstream + status = kgsl_cmdstream_init(device); + if (status != GSL_SUCCESS) + { + kgsl_device_stop(device->id); + return (status); + } + + // Create timestamp wait queue + init_waitqueue_head(&device->timestamp_waitq); + // allocate memory store status = kgsl_sharedmem_alloc0(device->id, GSL_MEMFLAGS_ALIGNPAGE | GSL_MEMFLAGS_CONPHYS, sizeof(struct kgsl_devmemstore), &device->memstore); @@ -117,21 +132,6 @@ kgsl_device_init(struct kgsl_device *device, unsigned int device_id) } kgsl_sharedmem_set0(&device->memstore, 0, 0, device->memstore.size); - // init memqueue - device->memqueue.head = NULL; - device->memqueue.tail = NULL; - - // init cmdstream - status = kgsl_cmdstream_init(device); - if (status != GSL_SUCCESS) - { - kgsl_device_stop(device->id); - return (status); - } - - // Create timestamp wait queue - init_waitqueue_head(&device->timestamp_waitq); - // // Read the chip ID after the device has been initialized. //