mirror of
https://github.com/genesi/linux-legacy.git
synced 2026-09-24 07:34:24 +00:00
amd-gpu: rename module from "gpu" to "kgsl" partially to prevent loading
Some of our userspace scripts autoload gpu on boot and rather than mess with those, it seems prudent to rename the module to kgsl instead. This will go awry if we get too close to Qualcomm's code, since they have a kgsl.c which compiles to kgsl.o which may conflict with the intermediate module object. Be warned :) Also makes several changes to the GPU config names to match those in Qualcomm's driver and remove such config options from gsl_buildconfig.h which is an obtuse way to configure the driver in the Linux kernel.. Logging is disabled until it can be tested. Please don't enable per process page tables or mmu page fault stuff since it will go absolutely batshit.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version: 2.6.31.14.27
|
||||
# Tue Nov 20 12:15:11 2012
|
||||
# Mon Nov 26 16:52:27 2012
|
||||
#
|
||||
CONFIG_ARM=y
|
||||
CONFIG_HAVE_PWM=y
|
||||
@@ -2158,8 +2158,10 @@ CONFIG_MXC_VPU=y
|
||||
#
|
||||
# MXC GPU support
|
||||
#
|
||||
CONFIG_MXC_AMD_GPU=m
|
||||
# CONFIG_MXC_AMD_GPU_LOGGING is not set
|
||||
CONFIG_MXC_KGSL=m
|
||||
CONFIG_KGSL_MMU_ENABLE=y
|
||||
# CONFIG_KGSL_PER_PROCESS_PAGE_TABLE is not set
|
||||
# CONFIG_KGSL_MMU_PAGE_FAULT is not set
|
||||
|
||||
#
|
||||
# File systems
|
||||
|
||||
@@ -15,4 +15,4 @@ obj-$(CONFIG_MXC_BLUETOOTH) += bt/
|
||||
obj-$(CONFIG_GPS_IOCTRL) += gps_ioctrl/
|
||||
obj-$(CONFIG_MXC_MLB) += mlb/
|
||||
obj-$(CONFIG_IMX_ADC) += adc/
|
||||
obj-$(CONFIG_MXC_AMD_GPU) += amd-gpu/
|
||||
obj-$(CONFIG_MXC_KGSL) += amd-gpu/
|
||||
|
||||
@@ -4,16 +4,35 @@
|
||||
|
||||
menu "MXC GPU support"
|
||||
|
||||
config MXC_AMD_GPU
|
||||
tristate "MXC GPU support"
|
||||
config MXC_KGSL
|
||||
tristate "i.MX35/50/51/53 KGSL GPU Support"
|
||||
depends on ARCH_MX35 || ARCH_MX51 || ARCH_MX53 || ARCH_MX50
|
||||
---help---
|
||||
Say Y to get the GPU driver support.
|
||||
Say Y to get the KGSL (AMD Imageon Z160/Z430) GPU driver support.
|
||||
|
||||
config MXC_AMD_GPU_LOGGING
|
||||
bool "Enable Logging"
|
||||
depends on MXC_AMD_GPU
|
||||
#config KGSL_LOGGING
|
||||
# bool "Enable Logging"
|
||||
# depends on MXC_KGSL
|
||||
# ---help---
|
||||
# Enable logging to kernel messages for GPU kernel module
|
||||
|
||||
config KGSL_MMU_ENABLE
|
||||
bool "Enable the GPU MMU in the KGSL driver"
|
||||
depends on MXC_KGSL && MMU
|
||||
default y
|
||||
|
||||
config KGSL_PER_PROCESS_PAGE_TABLE
|
||||
bool "Enable Per Process page tables for the KGSL driver"
|
||||
default n
|
||||
depends on KGSL_MMU_ENABLE
|
||||
---help---
|
||||
Enable logging to kernel messages for GPU kernel module
|
||||
This is probably a terrible idea... please say N
|
||||
|
||||
config KGSL_MMU_PAGE_FAULT
|
||||
bool "Force the GPU MMU to page fault for unmapped regions"
|
||||
default n
|
||||
depends on KGSL_MMU_ENABLE
|
||||
---help---
|
||||
This is probably a terrible idea... please say N
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -2,8 +2,8 @@ EXTRA_CFLAGS := \
|
||||
-I$(obj)/include \
|
||||
-I$(obj)/include/api
|
||||
|
||||
obj-$(CONFIG_MXC_AMD_GPU) += gpu.o
|
||||
gpu-objs += kgsl_cmdstream.o \
|
||||
obj-$(CONFIG_MXC_KGSL) += kgsl.o
|
||||
kgsl-objs += kgsl_cmdstream.o \
|
||||
kgsl_cmdwindow.o \
|
||||
kgsl_context.o \
|
||||
kgsl_device.o \
|
||||
@@ -22,7 +22,6 @@ gpu-objs += kgsl_cmdstream.o \
|
||||
kgsl_kmod_cleanup.o \
|
||||
kgsl_pwrctrl.o
|
||||
|
||||
ifdef CONFIG_MXC_AMD_GPU_LOGGING
|
||||
gpu-objs += kgsl_log.o
|
||||
EXTRA_CFLAGS += -DGSL_LOG
|
||||
ifdef CONFIG_KGSL_LOGGING
|
||||
kgsl-objs += kgsl_log.o
|
||||
endif
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
#define GSL_RB_TIMESTAMP_INTERUPT
|
||||
/* #define GSL_RB_USE_WPTR_POLLING */
|
||||
|
||||
/* #define GSL_MMU_PAGETABLE_PERPROCESS */
|
||||
|
||||
#define GSL_CALLER_PROCESS_MAX 64
|
||||
#define GSL_SHMEM_MAX_APERTURES 2
|
||||
|
||||
|
||||
@@ -79,9 +79,9 @@ struct kgsl_device {
|
||||
unsigned int memstoreshadow[GSL_CALLER_PROCESS_MAX];
|
||||
#endif // GSL_DEVICE_SHADOW_MEMSTORE_TO_USER
|
||||
|
||||
#ifndef GSL_NO_MMU
|
||||
#ifdef CONFIG_KGSL_MMU_ENABLE
|
||||
struct kgsl_mmu mmu;
|
||||
#endif // GSL_NO_MMU
|
||||
#endif
|
||||
|
||||
struct kgsl_memregion gmemspace;
|
||||
gsl_ringbuffer_t ringbuffer;
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#define KGSL_LOG_THREAD_ID 0x00020000
|
||||
#define KGSL_LOG_PROCESS_ID 0x00040000
|
||||
|
||||
#ifdef GSL_LOG
|
||||
#ifdef CONFIG_KGSL_LOGGING
|
||||
|
||||
int kgsl_log_finish(void);
|
||||
int kgsl_log_start( unsigned int log_flags );
|
||||
@@ -61,6 +61,6 @@ static __inline int kgsl_log_finish(void) { return GSL_SUCCESS; }
|
||||
static __inline int kgsl_log_start( unsigned int log_flags ) { (void)log_flags; return GSL_SUCCESS; }
|
||||
static __inline int kgsl_log_write( unsigned int log_flags, char* format, ... ) { (void)log_flags; (void)format; return GSL_SUCCESS; }
|
||||
|
||||
#endif
|
||||
#endif // CONFIG_KGSL_LOGGING
|
||||
|
||||
#endif // __GSL_LOG_H
|
||||
|
||||
@@ -39,11 +39,11 @@
|
||||
#define GSL_MMU_STATS(x)
|
||||
#endif // GSL_STATS_MMU
|
||||
|
||||
#ifdef GSL_MMU_PAGETABLE_PERPROCESS
|
||||
#ifdef CONFIG_KGSL_PER_PROCESS_PAGE_TABLE
|
||||
#define GSL_MMU_PAGETABLE_MAX GSL_CALLER_PROCESS_MAX // all device mmu's share a single page table per process
|
||||
#else
|
||||
#define GSL_MMU_PAGETABLE_MAX 1 // all device mmu's share a single global page table
|
||||
#endif // GSL_MMU_PAGETABLE_PERPROCESS
|
||||
#endif
|
||||
|
||||
#define GSL_PT_SUPER_PTE 8
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ kgsl_cmdwindow_write0(unsigned int device_id, enum kgsl_cmdwindow_type target, u
|
||||
// set command stream
|
||||
if (target == GSL_CMDWINDOW_MMU)
|
||||
{
|
||||
#ifdef GSL_NO_MMU
|
||||
#ifndef CONFIG_KGSL_MMU_ENABLE
|
||||
return (GSL_SUCCESS);
|
||||
#endif
|
||||
cmdstream = ADDR_VGC_MMUCOMMANDSTREAM;
|
||||
@@ -94,7 +94,7 @@ kgsl_cmdwindow_write0(unsigned int device_id, enum kgsl_cmdwindow_type target, u
|
||||
|
||||
mutex_lock(device->cmdwindow_mutex);
|
||||
|
||||
#ifndef GSL_NO_MMU
|
||||
#ifdef CONFIG_KGSL_MMU_ENABLE
|
||||
// set mmu pagetable
|
||||
kgsl_mmu_setpagetable(device, current->tgid);
|
||||
#endif
|
||||
|
||||
@@ -83,7 +83,7 @@ kgsl_device_init(struct kgsl_device *device, unsigned int device_id)
|
||||
device->refcnt = 0;
|
||||
device->id = device_id;
|
||||
|
||||
#ifndef GSL_NO_MMU
|
||||
#ifdef CONFIG_KGSL_MMU_ENABLE
|
||||
device->mmu.config = config.mmu_config;
|
||||
device->mmu.mpu_base = config.mpu_base;
|
||||
device->mmu.mpu_range = config.mpu_range;
|
||||
@@ -220,7 +220,7 @@ kgsl_device_attachcallback(struct kgsl_device *device, unsigned int pid)
|
||||
int status = GSL_SUCCESS;
|
||||
int pindex;
|
||||
|
||||
#ifndef GSL_NO_MMU
|
||||
#ifdef CONFIG_KGSL_MMU_ENABLE
|
||||
|
||||
kgsl_log_write( KGSL_LOG_GROUP_MEMORY | KGSL_LOG_LEVEL_TRACE, "--> int kgsl_device_attachcallback(struct kgsl_device *device=0x%08x, unsigned int pid=0x%08x)\n", device, pid );
|
||||
|
||||
@@ -252,7 +252,7 @@ kgsl_device_detachcallback(struct kgsl_device *device, unsigned int pid)
|
||||
int status = GSL_SUCCESS;
|
||||
int pindex;
|
||||
|
||||
#ifndef GSL_NO_MMU
|
||||
#ifdef CONFIG_KGSL_MMU_ENABLE
|
||||
|
||||
kgsl_log_write( KGSL_LOG_GROUP_MEMORY | KGSL_LOG_LEVEL_TRACE, "--> int kgsl_device_detachcallback(struct kgsl_device *device=0x%08x, unsigned int pid=0x%08x)\n", device, pid );
|
||||
|
||||
@@ -556,7 +556,7 @@ kgsl_device_regread(unsigned int device_id, unsigned int offsetwords, unsigned i
|
||||
struct kgsl_device *device;
|
||||
|
||||
|
||||
#ifdef GSL_LOG
|
||||
#ifdef CONFIG_KGSL_LOGGING
|
||||
if( offsetwords != mmRBBM_STATUS && offsetwords != mmCP_RB_RPTR ) // Would otherwise flood the log
|
||||
kgsl_log_write( KGSL_LOG_GROUP_DEVICE | KGSL_LOG_LEVEL_TRACE,
|
||||
"--> int kgsl_device_regread(unsigned int device_id=%D, unsigned int offsetwords=%R, unsigned int *value=0x%08x)\n", device_id, offsetwords, value );
|
||||
@@ -576,7 +576,7 @@ kgsl_device_regread(unsigned int device_id, unsigned int offsetwords, unsigned i
|
||||
|
||||
mutex_unlock(&gsl_driver.lock);
|
||||
|
||||
#ifdef GSL_LOG
|
||||
#ifdef CONFIG_KGSL_LOGGING
|
||||
if( offsetwords != mmRBBM_STATUS && offsetwords != mmCP_RB_RPTR )
|
||||
kgsl_log_write( KGSL_LOG_GROUP_DEVICE | KGSL_LOG_LEVEL_TRACE, "<-- kgsl_device_regread. Return value %B\n", status );
|
||||
#endif
|
||||
|
||||
@@ -54,7 +54,7 @@ kgsl_driver_init0(gsl_flags_t flags, gsl_flags_t flags_debug)
|
||||
|
||||
if (!(gsl_driver_initialized & GSL_FLAGS_INITIALIZED0))
|
||||
{
|
||||
#ifdef GSL_LOG
|
||||
#ifdef CONFIG_KGSL_LOGGING
|
||||
kgsl_log_start( KGSL_LOG_GROUP_ALL | KGSL_LOG_LEVEL_ALL | KGSL_LOG_TIMESTAMP
|
||||
| KGSL_LOG_THREAD_ID | KGSL_LOG_PROCESS_ID );
|
||||
#endif
|
||||
@@ -111,7 +111,7 @@ kgsl_driver_close0(gsl_flags_t flags)
|
||||
status = kgsl_hal_close();
|
||||
mutex_unlock(&gsl_driver.lock);
|
||||
|
||||
#ifdef GSL_LOG
|
||||
#ifdef CONFIG_KGSL_LOGGING
|
||||
kgsl_log_finish();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ kgsl_g12_isr(struct kgsl_device *device)
|
||||
int
|
||||
kgsl_g12_tlbinvalidate(struct kgsl_device *device, unsigned int reg_invalidate, unsigned int pid)
|
||||
{
|
||||
#ifndef GSL_NO_MMU
|
||||
#ifdef CONFIG_KGSL_MMU_ENABLE
|
||||
unsigned int mh_mmu_invalidate = 0x00000003L; // invalidate all and tc
|
||||
|
||||
// unreferenced formal parameter
|
||||
@@ -223,7 +223,7 @@ kgsl_g12_setpagetable(struct kgsl_device *device, unsigned int reg_ptbase, uint3
|
||||
{
|
||||
// unreferenced formal parameter
|
||||
(void) pid;
|
||||
#ifndef GSL_NO_MMU
|
||||
#ifdef CONFIG_KGSL_MMU_ENABLE
|
||||
device->ftbl.idle(device, GSL_TIMEOUT_DEFAULT);
|
||||
device->ftbl.regwrite(device, reg_ptbase, ptbase);
|
||||
#else
|
||||
@@ -294,7 +294,7 @@ kgsl_g12_init(struct kgsl_device *device)
|
||||
// enable irq
|
||||
device->ftbl.regwrite(device, (ADDR_VGC_IRQENABLE >> 2), 0x3);
|
||||
|
||||
#ifndef GSL_NO_MMU
|
||||
#ifdef CONFIG_KGSL_MMU_ENABLE
|
||||
// enable master interrupt for G12 MH
|
||||
kgsl_intr_attach(&device->intr, GSL_INTR_G12_MH, kgsl_g12_intrcallback, (void *) device);
|
||||
kgsl_intr_enable(&device->intr, GSL_INTR_G12_MH);
|
||||
@@ -347,7 +347,7 @@ kgsl_g12_close(struct kgsl_device *device)
|
||||
// shutdown command window
|
||||
kgsl_cmdwindow_close(device);
|
||||
|
||||
#ifndef GSL_NO_MMU
|
||||
#ifdef CONFIG_KGSL_MMU_ENABLE
|
||||
// shutdown mmu
|
||||
kgsl_mmu_close(device);
|
||||
#endif
|
||||
@@ -468,7 +468,7 @@ kgsl_g12_getproperty(struct kgsl_device *device, gsl_property_type_t type, void
|
||||
|
||||
devinfo->device_id = device->id;
|
||||
devinfo->chip_id = (unsigned int)device->chip_id;
|
||||
#ifndef GSL_NO_MMU
|
||||
#ifdef CONFIG_KGSL_MMU_ENABLE
|
||||
devinfo->mmu_enabled = kgsl_mmu_isenabled(&device->mmu);
|
||||
#endif
|
||||
if (z160_version == 1)
|
||||
|
||||
@@ -309,10 +309,17 @@ kgsl_hal_getshmemconfig(gsl_shmemconfig_t *config)
|
||||
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef CONFIG_KGSL_MMU_PAGE_FAULT
|
||||
/* page fault when a mapping fails. Not ideal! */
|
||||
#define MMU_CONFIG 2
|
||||
#else
|
||||
/* when a mapping fails, assume PA=VA and continue */
|
||||
#define MMU_CONFIG 1
|
||||
#endif
|
||||
|
||||
KGSLHAL_API int
|
||||
kgsl_hal_getdevconfig(unsigned int device_id, struct kgsl_devconfig *config)
|
||||
{
|
||||
#define MMU_CONFIG 1 // set to 2 if you want any mistranslations to page fault instead of just doing PA=VA
|
||||
int status = GSL_FAILURE_DEVICEERROR;
|
||||
gsl_hal_t *hal = (gsl_hal_t *) gsl_driver.hal;
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ static __inline int
|
||||
kgsl_mmu_getprocessindex(unsigned int pid, int *pindex)
|
||||
{
|
||||
int status = GSL_SUCCESS;
|
||||
#ifdef GSL_MMU_PAGETABLE_PERPROCESS
|
||||
#ifdef CONFIG_KGSL_PER_PROCESS_PAGE_TABLE
|
||||
if (kgsl_driver_getcallerprocessindex(pid, pindex) != GSL_SUCCESS)
|
||||
{
|
||||
status = GSL_FAILURE;
|
||||
@@ -108,7 +108,7 @@ kgsl_mmu_getprocessindex(unsigned int pid, int *pindex)
|
||||
#else
|
||||
(void) pid; // unreferenced formal parameter
|
||||
*pindex = 0;
|
||||
#endif // GSL_MMU_PAGETABLE_PERPROCESS
|
||||
#endif
|
||||
return (status);
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ kgsl_mmu_setpagetable(struct kgsl_device *device, unsigned int pid)
|
||||
|
||||
if (mmu->flags & GSL_FLAGS_STARTED)
|
||||
{
|
||||
#ifdef GSL_MMU_PAGETABLE_PERPROCESS
|
||||
#ifdef CONFIG_KGSL_PER_PROCESS_PAGE_TABLE
|
||||
// page table not current, then setup mmu to use new specified page table
|
||||
if (mmu->hwpagetable->pid != pid)
|
||||
{
|
||||
@@ -403,7 +403,7 @@ kgsl_mmu_setpagetable(struct kgsl_device *device, unsigned int pid)
|
||||
{
|
||||
mmu->hwpagetable = pagetable;
|
||||
|
||||
// flag tlb flush
|
||||
// flag tlb flush
|
||||
mmu->flags |= GSL_MMUFLAGS_TLBFLUSH;
|
||||
|
||||
status = mmu->device->ftbl.mmu_setpagetable(mmu->device, gsl_cfg_mmu_reg[devindex].PT_BASE, pagetable->base.gpuaddr, pid);
|
||||
@@ -415,7 +415,7 @@ kgsl_mmu_setpagetable(struct kgsl_device *device, unsigned int pid)
|
||||
status = GSL_FAILURE;
|
||||
}
|
||||
}
|
||||
#endif // GSL_MMU_PAGETABLE_PERPROCESS
|
||||
#endif
|
||||
|
||||
// if needed, invalidate device specific tlb
|
||||
if ((mmu->flags & GSL_MMUFLAGS_TLBFLUSH) && status == GSL_SUCCESS)
|
||||
|
||||
Reference in New Issue
Block a user