mirror of
https://github.com/revyos/thead-kernel.git
synced 2026-09-17 21:02:13 +02:00
Linux_SDK_V1.5.4
Signed-off-by: thead_admin <occ_thead@service.alibaba.com>
This commit is contained in:
@@ -197,12 +197,12 @@ _DmaAlloc(
|
||||
#if gcdENABLE_BUFFERABLE_VIDEO_MEMORY
|
||||
if (set_memory_wc((unsigned long)(mdlPriv->kvaddr), NumPages) != 0)
|
||||
{
|
||||
printk("%s(%d): failed to set_memory_wc\n", __func__, __LINE__);
|
||||
pr_debug("%s(%d): failed to set_memory_wc\n", __func__, __LINE__);
|
||||
}
|
||||
#else
|
||||
if (set_memory_uc((unsigned long)(mdlPriv->kvaddr), NumPages) != 0)
|
||||
{
|
||||
printk("%s(%d): failed to set_memory_uc\n", __func__, __LINE__);
|
||||
pr_debug("%s(%d): failed to set_memory_uc\n", __func__, __LINE__);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -591,12 +591,12 @@ _GFPAlloc(
|
||||
#if gcdENABLE_BUFFERABLE_VIDEO_MEMORY
|
||||
if (set_memory_wc((unsigned long)page_address(mdlPriv->contiguousPages), NumPages) != 0)
|
||||
{
|
||||
printk("%s(%d): failed to set_memory_wc\n", __func__, __LINE__);
|
||||
pr_debug("%s(%d): failed to set_memory_wc\n", __func__, __LINE__);
|
||||
}
|
||||
#else
|
||||
if (set_memory_uc((unsigned long)page_address(mdlPriv->contiguousPages), NumPages) != 0)
|
||||
{
|
||||
printk("%s(%d): failed to set_memory_uc\n", __func__, __LINE__);
|
||||
pr_debug("%s(%d): failed to set_memory_uc\n", __func__, __LINE__);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -665,12 +665,12 @@ _GFPAlloc(
|
||||
#if gcdENABLE_BUFFERABLE_VIDEO_MEMORY
|
||||
if (set_pages_array_wc(mdlPriv->nonContiguousPages, NumPages))
|
||||
{
|
||||
printk("%s(%d): failed to set_pages_array_wc\n", __func__, __LINE__);
|
||||
pr_debug("%s(%d): failed to set_pages_array_wc\n", __func__, __LINE__);
|
||||
}
|
||||
#else
|
||||
if (set_pages_array_uc(mdlPriv->nonContiguousPages, NumPages))
|
||||
{
|
||||
printk("%s(%d): failed to set_pages_array_uc\n", __func__, __LINE__);
|
||||
pr_debug("%s(%d): failed to set_pages_array_uc\n", __func__, __LINE__);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -195,7 +195,7 @@ reserved_mem_attach(
|
||||
|
||||
if (!region)
|
||||
{
|
||||
printk("request mem %s(0x%lx - 0x%lx) failed\n",
|
||||
pr_debug("request mem %s(0x%lx - 0x%lx) failed\n",
|
||||
res->name, res->start, res->start + res->size - 1);
|
||||
|
||||
kfree(res);
|
||||
@@ -314,13 +314,13 @@ reserved_mem_unmap_user(
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
|
||||
if (vm_munmap((unsigned long)MdlMap->vmaAddr - res->offset_in_page, res->size) < 0)
|
||||
{
|
||||
printk("%s: vm_munmap failed\n", __func__);
|
||||
pr_debug("%s: vm_munmap failed\n", __func__);
|
||||
}
|
||||
#else
|
||||
down_write(¤t_mm_mmap_sem);
|
||||
if (do_munmap(current->mm, (unsigned long)MdlMap->vmaAddr - res->offset_in_page, res->size) < 0)
|
||||
{
|
||||
printk("%s: do_munmap failed\n", __func__);
|
||||
pr_debug("%s: do_munmap failed\n", __func__);
|
||||
}
|
||||
up_write(¤t_mm_mmap_sem);
|
||||
#endif
|
||||
|
||||
@@ -225,14 +225,14 @@ static int import_page_map(gckOS Os, struct um_desc *um,
|
||||
#endif
|
||||
if (unlikely(result < 0))
|
||||
{
|
||||
printk("[galcore]: %s: sg_alloc_table_from_pages failed\n", __FUNCTION__);
|
||||
pr_debug("[galcore]: %s: sg_alloc_table_from_pages failed\n", __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
result = dma_map_sg(galcore_device, um->sgt.sgl, um->sgt.nents, DMA_TO_DEVICE);
|
||||
if (unlikely(result != um->sgt.nents))
|
||||
{
|
||||
printk("[galcore]: %s: dma_map_sg failed\n", __FUNCTION__);
|
||||
pr_debug("[galcore]: %s: dma_map_sg failed\n", __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ static int import_pfn_map(gckOS Os, struct um_desc *um,
|
||||
#endif
|
||||
if (unlikely(result < 0))
|
||||
{
|
||||
printk("[galcore]: %s: sg_alloc_table_from_pages failed\n", __FUNCTION__);
|
||||
pr_debug("[galcore]: %s: sg_alloc_table_from_pages failed\n", __FUNCTION__);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ static int import_pfn_map(gckOS Os, struct um_desc *um,
|
||||
#else
|
||||
kfree(um->sgt.sgl);
|
||||
#endif
|
||||
printk("[galcore]: %s: dma_map_sg failed\n", __FUNCTION__);
|
||||
pr_debug("[galcore]: %s: dma_map_sg failed\n", __FUNCTION__);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ gckOS_ImportAllocators(
|
||||
|
||||
if (gcmIS_ERROR(status))
|
||||
{
|
||||
gcmkPRINT("["DEVICE_NAME"]: Can't construct allocator(%s)",
|
||||
pr_err("["DEVICE_NAME"]: Can't construct allocator(%s)",
|
||||
allocatorArray[i].name);
|
||||
|
||||
continue;
|
||||
|
||||
@@ -1288,7 +1288,7 @@ gckOS_DumpBuffer(
|
||||
/* memory dump below. */
|
||||
if (Type >= gcvDUMP_BUFFER_TYPE_COUNT)
|
||||
{
|
||||
gcmkPRINT("#[ERROR: invalid buffer type]\n");
|
||||
pr_err("#[ERROR: invalid buffer type]\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,13 +72,24 @@
|
||||
#include <linux/export.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/utsname.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#define _GC_OBJ_ZONE gcvZONE_DEVICE
|
||||
|
||||
#define MAX_TIMESTAMPS 10
|
||||
#define MAX_HW_PROCESS_TIME 90000000
|
||||
|
||||
static struct timer_list my_timer;
|
||||
static struct workqueue_struct *my_workqueue;
|
||||
static struct work_struct my_work;
|
||||
|
||||
static gckGALDEVICE galDevice;
|
||||
|
||||
extern gcTA globalTA[gcdMAX_GPU_COUNT];
|
||||
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
#if defined(CONFIG_CPU_CSKYV2) && LINUX_VERSION_CODE <= KERNEL_VERSION(3,0,8)
|
||||
static void
|
||||
@@ -323,9 +334,9 @@ int gc_load_show(void* m, void* data)
|
||||
{
|
||||
int len = 0;
|
||||
gctUINT32 i = 0;
|
||||
|
||||
|
||||
gckGALDEVICE device = galDevice;
|
||||
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
void* ptr = m;
|
||||
#else
|
||||
@@ -335,8 +346,8 @@ int gc_load_show(void* m, void* data)
|
||||
if (!device) {
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (i = 0; i <= gcvCORE_2D_MAX; i++)
|
||||
{
|
||||
@@ -1251,7 +1262,7 @@ static int set_clk(const char* buf)
|
||||
}
|
||||
else
|
||||
{
|
||||
printk("Error: command format must be this: echo \"0 32 32\" > /sys/kernel/debug/gc/clk\n");
|
||||
pr_err("Error: command format must be this: echo \"0 32 32\" > /sys/kernel/debug/gc/clk\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1264,10 +1275,10 @@ static int set_clk(const char* buf)
|
||||
}
|
||||
|
||||
if (3 == sscanf(data, "%d %d %d", &dumpCore, &clkScale[0], &clkScale[1])) {
|
||||
printk("Change core:%d MC scale:%d SH scale:%d\n",
|
||||
pr_err("Change core:%d MC scale:%d SH scale:%d\n",
|
||||
dumpCore, clkScale[0], clkScale[1]);
|
||||
} else {
|
||||
printk("usage: echo \"0 32 32\" > clk\n");
|
||||
pr_err("usage: echo \"0 32 32\" > clk\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1279,7 +1290,7 @@ static int set_clk(const char* buf)
|
||||
}
|
||||
else
|
||||
{
|
||||
printk("Error: invalid core\n");
|
||||
pr_err("Error: invalid core\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1354,7 +1365,7 @@ static int debugfs_copy_from_user(char *k_buf, const char __user *buf, size_t co
|
||||
ret = copy_from_user(k_buf, buf, count);
|
||||
if (ret != 0)
|
||||
{
|
||||
printk("Error: lost data: %d\n", (int)ret);
|
||||
pr_err("Error: lost data: %d\n", (int)ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1844,7 +1855,7 @@ _SetupContiguousVidMem(
|
||||
|
||||
if (Args->showArgs)
|
||||
{
|
||||
gcmkPRINT("Galcore Info: ContiguousBase=0x%llx ContiguousSize=0x%zx\n", device->contiguousBase, device->contiguousSize);
|
||||
pr_warn("Galcore Info: ContiguousBase=0x%llx ContiguousSize=0x%zx\n", device->contiguousBase, device->contiguousSize);
|
||||
}
|
||||
|
||||
OnError:
|
||||
@@ -2068,7 +2079,7 @@ _SetupIsr(
|
||||
gcmkONERROR(gcvSTATUS_GENERIC_IO);
|
||||
}
|
||||
|
||||
gcmkPRINT("galcore: polling core%d int state\n", Core);
|
||||
pr_err("galcore: polling core%d int state\n", Core);
|
||||
|
||||
Device->isrThread[Core] = task;
|
||||
Device->isrInitializeds[Core] = gcvTRUE;
|
||||
@@ -2332,7 +2343,7 @@ _StopPreemptThread(
|
||||
/******************************************************************************\
|
||||
******************************* G2D Devfreq support START***********************
|
||||
\******************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM_DEVFREQ
|
||||
static int gc_df_target(struct device * dev, unsigned long *freq, u32 flags) {
|
||||
|
||||
int i = 0;
|
||||
@@ -2369,7 +2380,7 @@ static int gc_df_target(struct device * dev, unsigned long *freq, u32 flags) {
|
||||
for(i = 0; i < gcvCORE_2D_MAX; i++) {
|
||||
if(device->kernels[i]) {
|
||||
hardware = device->kernels[i]->hardware;
|
||||
if(hardware->clockState) {
|
||||
if(hardware->os->clockStates[i]) {
|
||||
gckHARDWARE_SetClock(hardware, i, _freq, _freq);
|
||||
device->kernels[i]->cur_freq = *freq;
|
||||
}
|
||||
@@ -2425,7 +2436,7 @@ static int gc_df_get_cur_freq(struct device *dev, unsigned long *freq) {
|
||||
struct devfreq_simple_ondemand_data galcore_gov_data;
|
||||
|
||||
static struct devfreq_dev_profile gc_df_profile = {
|
||||
.polling_ms = 500,
|
||||
.polling_ms = 50,
|
||||
.target = gc_df_target,
|
||||
.get_dev_status = gc_df_status,
|
||||
.get_cur_freq = gc_df_get_cur_freq,
|
||||
@@ -2441,7 +2452,7 @@ g2d_EnableDevfreq(void) {
|
||||
|
||||
ret = dev_pm_opp_of_add_table(galcore_device);
|
||||
if(ret) {
|
||||
gcmkPRINT("add table failed \n");
|
||||
pr_err("add table failed \n");
|
||||
}
|
||||
|
||||
new_clk = devm_clk_get(galcore_device, "cclk");
|
||||
@@ -2465,17 +2476,255 @@ g2d_EnableDevfreq(void) {
|
||||
galDevice->g2d_devfreq = devm_devfreq_add_device(galcore_device, &gc_df_profile, DEVFREQ_GOV_SIMPLE_ONDEMAND, &galcore_gov_data);
|
||||
|
||||
if(IS_ERR(galDevice->g2d_devfreq)) {
|
||||
gcmkPRINT("Errot: init devgreq %lx\n", (unsigned long)galcore_device);
|
||||
pr_err("Errot: init devgreq %lx\n", (unsigned long)galcore_device);
|
||||
status = gcvSTATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************\
|
||||
******************************* G2D Devfreq support END ************************
|
||||
******************************* Driver status query ****************************
|
||||
\******************************************************************************/
|
||||
|
||||
gctUINT64 cur_on = 0, cur_idle = 0, cur_suspend = 0, cur_off = 0,
|
||||
busy_time = 0, total_time = 0, freq = 396000000;
|
||||
gctUINT64 on = 0;
|
||||
gctUINT64 off = 0;
|
||||
gctUINT64 idle = 0;
|
||||
gctUINT64 suspend = 0;
|
||||
int dev_loading_percent;
|
||||
int dev_loading_max_percent;
|
||||
int updatePeriod_ms = 50;
|
||||
|
||||
static ssize_t log_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
ssize_t len = 0;
|
||||
gctINT i, j,ct, pid, id = 0;
|
||||
gctINT devIncenum = 0;
|
||||
char name[24];
|
||||
gceSTATUS status;
|
||||
gckVIDMEM memory;
|
||||
gctUINT32 free = 0, used = 0, total = 0, minFree = 0, maxUsed = 0;
|
||||
gckGALDEVICE device = galDevice;
|
||||
gcsDATABASE_PTR database;
|
||||
gcsDATABASE_COUNTERS virtualCounter = {0, 0, 0};
|
||||
gckKERNEL kernel = _GetValidKernel(device);
|
||||
ktime_t result;
|
||||
|
||||
status = gckKERNEL_GetVideoMemoryPool(kernel, gcvPOOL_SYSTEM, &memory);
|
||||
|
||||
if (gcmIS_SUCCESS(status))
|
||||
{
|
||||
gcmkVERIFY_OK(
|
||||
gckOS_AcquireMutex(memory->os, memory->mutex, gcvINFINITE));
|
||||
|
||||
free = memory->freeBytes;
|
||||
minFree = memory->minFreeBytes;
|
||||
used = memory->bytes - memory->freeBytes;
|
||||
maxUsed = memory->bytes - memory->minFreeBytes;
|
||||
total = memory->bytes;
|
||||
|
||||
gcmkVERIFY_OK(gckOS_ReleaseMutex(memory->os, memory->mutex));
|
||||
}
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"[G2D] Version: %s\n"
|
||||
"Build Time【%s,%s,%s,%s】\n"
|
||||
"-------------------------------------------MODULE PARAM----------------------------------\n"
|
||||
"updatePeriod_ms\n"
|
||||
" %d\n",
|
||||
gcvVERSION_STRING, utsname()->sysname, utsname()->release, utsname()->version, utsname()->machine,
|
||||
updatePeriod_ms
|
||||
);
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"-------------------------------------------INSTANCE INFO---------------------------------\n");
|
||||
|
||||
if (!kernel)
|
||||
return -ENXIO;
|
||||
|
||||
gcmkVERIFY_OK(gckOS_AcquireMutex(kernel->os, kernel->db->dbMutex, gcvINFINITE));
|
||||
if (kernel->db->idleTime)
|
||||
{
|
||||
/* Record idle time if DB upated. */
|
||||
kernel->db->idleTime = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < gcmCOUNTOF(kernel->db->db); ++i)
|
||||
{
|
||||
for (database = kernel->db->db[i];
|
||||
database != gcvNULL;
|
||||
database = database->next)
|
||||
{
|
||||
static const char * otherCounterNames[] = {
|
||||
"AllocContiguous",
|
||||
"MapMemory",
|
||||
};
|
||||
gcsDATABASE_COUNTERS * otherCounters[] = {
|
||||
&database->contiguous,
|
||||
&database->mapMemory,
|
||||
};
|
||||
gcsDATABASE_COUNTERS * counter;
|
||||
pid = database->processID;
|
||||
|
||||
|
||||
for(j = 0; j < MAX_TIMESTAMPS; j++) {
|
||||
if(database->start_times[j] == 0) continue;
|
||||
if(database->end_times[j] - database->start_times[j] > result &&
|
||||
database->end_times[j] - database->start_times[j] < MAX_HW_PROCESS_TIME) {
|
||||
result = database->end_times[j] - database->start_times[j];
|
||||
if(result > database->max_hw_time) {
|
||||
database->max_hw_time = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gcmkVERIFY_OK(gckOS_GetProcessNameByPid(pid, gcmSIZEOF(name), name));
|
||||
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"ID: %d ProId: %-8d NAME: %s\n"
|
||||
"\n",
|
||||
id, pid, name
|
||||
);
|
||||
id++;
|
||||
devIncenum++;
|
||||
|
||||
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
" Current Maximum Total\n");
|
||||
for (ct = 0; ct < gcmCOUNTOF(otherCounterNames); ct++)
|
||||
{
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"%-16s %16lld %16lld %16lld\n",
|
||||
otherCounterNames[ct],
|
||||
otherCounters[ct]->bytes,
|
||||
otherCounters[ct]->maxBytes,
|
||||
otherCounters[ct]->totalBytes);
|
||||
|
||||
}
|
||||
counter = &database->vidMemPool[gcvPOOL_VIRTUAL];
|
||||
virtualCounter.bytes += counter->bytes;
|
||||
virtualCounter.maxBytes += counter->maxBytes;
|
||||
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"HwProcNs %lld %lld \n",
|
||||
result,database->max_hw_time);
|
||||
result = 0;
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"\n");
|
||||
|
||||
memset(database->start_times, 0, sizeof(database->start_times));
|
||||
memset(database->end_times, 0, sizeof(database->end_times));
|
||||
database->st = 0;
|
||||
|
||||
}
|
||||
}
|
||||
gcmkVERIFY_OK(gckOS_ReleaseMutex(kernel->os, kernel->db->dbMutex));
|
||||
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"-------------------------------------------MODULE STATUS---------------------------------\n"
|
||||
"DevInstanceNum DevLoading_%% DevLoadingMax_%%\n"
|
||||
"%d %d %d\n",
|
||||
devIncenum, dev_loading_percent, dev_loading_max_percent
|
||||
);
|
||||
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"-----------------------------------------VIDEO MEMORY INFO-------------------------------\n"
|
||||
" POOL SYSTEM:\n"
|
||||
" Free Minfree Used MaxUsed Total\n"
|
||||
"%10u B %10u B %10u B %10u B %10u B\n"
|
||||
"\n"
|
||||
" POOL VIRTUAL:\n"
|
||||
" Used MaxUsed\n"
|
||||
"%10llu B %10llu B\n",
|
||||
free, minFree, used, maxUsed,total,
|
||||
virtualCounter.bytes, virtualCounter.maxBytes);
|
||||
|
||||
gckHARDWARE_QueryStateTimer(kernel->hardware, &on, &off, &idle, &suspend);
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"--------------------------------------------IDLE INFO------------------------------------\n"
|
||||
" On Off Suspend\n"
|
||||
"%lld ns %lld ns %lld ns",
|
||||
on, off, suspend);
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"\n\n");
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t log_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
dev_loading_max_percent = 0;
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t updatePeriod_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
return sprintf(buf,"%u\n",updatePeriod_ms);
|
||||
}
|
||||
|
||||
static void timer_callback(struct timer_list *t) {
|
||||
queue_work(my_workqueue, &my_work);
|
||||
mod_timer(t, jiffies + msecs_to_jiffies(updatePeriod_ms));
|
||||
}
|
||||
|
||||
static void my_work_func(struct work_struct *work)
|
||||
{
|
||||
gckGALDEVICE device = galDevice;
|
||||
gckKERNEL kernel = _GetValidKernel(device);
|
||||
int i;
|
||||
|
||||
gckHARDWARE_QueryStateTimer(kernel->hardware, &on, &off, &idle, &suspend);
|
||||
|
||||
for(i = 0; i < gcvCORE_2D_MAX; i++) {
|
||||
if(device->kernels[i]) {
|
||||
freq = device->kernels[i]->cur_freq;
|
||||
}
|
||||
}
|
||||
|
||||
busy_time = on - cur_on;
|
||||
total_time = on - cur_on + idle - cur_idle + suspend - cur_suspend + off - cur_off;
|
||||
dev_loading_percent = busy_time * 100 / total_time / (396000000 / freq);
|
||||
if(dev_loading_max_percent < dev_loading_percent) {
|
||||
dev_loading_max_percent = dev_loading_percent;
|
||||
}
|
||||
cur_on = on;
|
||||
cur_idle = idle;
|
||||
cur_suspend = suspend;
|
||||
cur_off = off;
|
||||
}
|
||||
|
||||
static ssize_t updatePeriod_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
char *start = (char *)buf;
|
||||
updatePeriod_ms = simple_strtoul(start, &start, 0);
|
||||
if(updatePeriod_ms <= 0) {
|
||||
del_timer(&my_timer);
|
||||
if (my_workqueue)
|
||||
destroy_workqueue(my_workqueue);
|
||||
} else {
|
||||
my_workqueue = create_workqueue("my_workqueue");
|
||||
INIT_WORK(&my_work, my_work_func);
|
||||
timer_setup(&my_timer, timer_callback, 0);
|
||||
mod_timer(&my_timer, jiffies + msecs_to_jiffies(updatePeriod_ms));
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct kobj_attribute log_attr = __ATTR(log, 0664, log_show, log_store);
|
||||
|
||||
static struct kobj_attribute updatePeriod_attr = __ATTR(updatePeriod_ms, 0664, updatePeriod_show, updatePeriod_store);
|
||||
|
||||
static struct attribute *attrs[] = {
|
||||
&log_attr.attr,
|
||||
&updatePeriod_attr.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct attribute_group xrp_dev_attr_group = {
|
||||
.name = "info",
|
||||
.attrs = attrs,
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -2502,7 +2751,7 @@ gckGALDEVICE_Construct(
|
||||
gckGALDEVICE device;
|
||||
gceSTATUS status = gcvSTATUS_OK;
|
||||
gctUINT64 isrPolling = -1;
|
||||
gctINT32 i;
|
||||
gctINT32 i, ret;
|
||||
|
||||
gcmkHEADER_ARG("Platform=%p Args=%p", Platform, Args);
|
||||
|
||||
@@ -2553,7 +2802,7 @@ gckGALDEVICE_Construct(
|
||||
else
|
||||
{
|
||||
#if USE_LINUX_PCIE
|
||||
gcmkPRINT("register should be mapped in platform layer");
|
||||
pr_warn("register should be mapped in platform layer");
|
||||
#endif
|
||||
if (!request_mem_region(physical,
|
||||
device->requestedRegisterMemSizes[i],
|
||||
@@ -2846,8 +3095,21 @@ gckGALDEVICE_Construct(
|
||||
|
||||
/* Return pointer to the device. */
|
||||
*Device = galDevice = device;
|
||||
#ifdef CONFIG_PM_DEVFREQ
|
||||
g2d_EnableDevfreq();
|
||||
devfreq_suspend_device(galDevice->g2d_devfreq);
|
||||
#endif
|
||||
ret = sysfs_create_group(&galcore_device->kobj, &xrp_dev_attr_group);
|
||||
if (ret) {
|
||||
dev_err(galcore_device, "Failed to create xrp dev sysfs.\n");
|
||||
goto OnError;
|
||||
}
|
||||
my_workqueue = create_workqueue("my_workqueue");
|
||||
|
||||
INIT_WORK(&my_work, my_work_func);
|
||||
timer_setup(&my_timer, timer_callback, 0);
|
||||
|
||||
mod_timer(&my_timer, jiffies + msecs_to_jiffies(100));
|
||||
|
||||
OnError:
|
||||
if (gcmIS_ERROR(status))
|
||||
@@ -2886,7 +3148,12 @@ gckGALDEVICE_Destroy(
|
||||
gckKERNEL kernel = gcvNULL;
|
||||
|
||||
gcmkHEADER_ARG("Device=%p", Device);
|
||||
|
||||
|
||||
sysfs_remove_group(&galcore_device->kobj, &xrp_dev_attr_group);
|
||||
del_timer(&my_timer);
|
||||
if (my_workqueue) {
|
||||
destroy_workqueue(my_workqueue);
|
||||
}
|
||||
if (Device != gcvNULL)
|
||||
{
|
||||
/* Grab the first available kernel */
|
||||
|
||||
@@ -150,11 +150,12 @@ typedef struct _gckGALDEVICE
|
||||
/* gctsOs object for trust application. */
|
||||
gctaOS taos;
|
||||
|
||||
/*Number of devices opened*/
|
||||
/*Number of devices opened*/
|
||||
atomic_t openNum;
|
||||
/*object of devfreq add device*/
|
||||
#ifdef CONFIG_PM_DEVFREQ
|
||||
struct devfreq *g2d_devfreq;
|
||||
|
||||
#endif
|
||||
#if gcdENABLE_DRM
|
||||
void * drm;
|
||||
#endif
|
||||
|
||||
@@ -645,7 +645,7 @@ gckOS_DumpParam(
|
||||
{
|
||||
gctINT i;
|
||||
|
||||
printk("Galcore options:\n");
|
||||
gcmkPRINT("Galcore options:\n");
|
||||
|
||||
#if USE_LINUX_PCIE
|
||||
if (bar != -1)
|
||||
@@ -822,8 +822,10 @@ static int drv_open(
|
||||
filp->private_data = data;
|
||||
|
||||
/* Success. */
|
||||
#ifdef CONFIG_PM_DEVFREQ
|
||||
atomic_inc_return(&galDevice->openNum);
|
||||
devfreq_resume_device(galDevice->g2d_devfreq);
|
||||
#endif
|
||||
gcmkFOOTER_NO();
|
||||
return 0;
|
||||
}
|
||||
@@ -889,10 +891,12 @@ static int drv_release(
|
||||
|
||||
kfree(data);
|
||||
filp->private_data = NULL;
|
||||
|
||||
#ifdef CONFIG_PM_DEVFREQ
|
||||
if(atomic_dec_return(&galDevice->openNum) == 0) {
|
||||
devfreq_suspend_device(galDevice->g2d_devfreq);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Success. */
|
||||
ret = 0;
|
||||
|
||||
@@ -1160,7 +1164,7 @@ static int drv_init(void)
|
||||
|
||||
gcmkHEADER();
|
||||
|
||||
printk(KERN_INFO "Galcore version %s\n", gcvVERSION_STRING);
|
||||
pr_info("Galcore version %s\n", gcvVERSION_STRING);
|
||||
|
||||
if (showArgs)
|
||||
{
|
||||
@@ -1385,11 +1389,11 @@ static int __devinit gpu_probe(struct platform_device *pdev)
|
||||
contiguousBaseCap = platform->params.contiguousBase;
|
||||
contiguousSizeCap = platform->params.contiguousSize;
|
||||
|
||||
gcmkPRINT("Capture only mode is enabled in Hal Kernel.");
|
||||
pr_warn("Capture only mode is enabled in Hal Kernel.");
|
||||
|
||||
if ((contiguousBaseCap + contiguousSizeCap) > 0x80000000)
|
||||
{
|
||||
gcmkPRINT("Capture only mode: contiguousBase + contiguousSize > 2G, there is error in CModel and old MMU version RTL simulation.");
|
||||
pr_err("Capture only mode: contiguousBase + contiguousSize > 2G, there is error in CModel and old MMU version RTL simulation.");
|
||||
}
|
||||
|
||||
for (i = 0; i < gcvCORE_COUNT; i++)
|
||||
@@ -1438,7 +1442,7 @@ static int __devinit gpu_probe(struct platform_device *pdev)
|
||||
|
||||
if (powerManagement == 0)
|
||||
{
|
||||
gcmkPRINT("[galcore warning]: power saveing is disabled.");
|
||||
pr_err("[galcore warning]: power saveing is disabled.");
|
||||
}
|
||||
|
||||
ret = drv_init();
|
||||
@@ -1462,14 +1466,14 @@ static int __devinit gpu_probe(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
gcmkFOOTER_ARG(KERN_INFO "Failed to register gpu driver: %d\n", ret);
|
||||
pr_info("Failed to register gpu driver: %d\n", ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
gcmkFOOTER_NO();
|
||||
}
|
||||
|
||||
gcmkFOOTER_ARG(KERN_INFO "Success ret=%d", ret);
|
||||
pr_info("Success ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1650,7 +1654,7 @@ static int __init gpu_init(void)
|
||||
|
||||
if (ret || !platform)
|
||||
{
|
||||
printk(KERN_ERR "galcore: Soc platform init failed.\n");
|
||||
pr_err("galcore: Soc platform init failed.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -1658,7 +1662,7 @@ static int __init gpu_init(void)
|
||||
|
||||
if (ret)
|
||||
{
|
||||
printk(KERN_ERR "galcore: gpu_init() failed to register driver!\n");
|
||||
pr_err("galcore: gpu_init() failed to register driver!\n");
|
||||
gckPLATFORM_Terminate(platform);
|
||||
platform = NULL;
|
||||
return -ENODEV;
|
||||
|
||||
@@ -905,7 +905,7 @@ OnError:
|
||||
{
|
||||
drm_dev_unref(drm);
|
||||
}
|
||||
printk(KERN_ERR "galcore: Failed to setup drm device.\n");
|
||||
pr_err("galcore: Failed to setup drm device.\n");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ gckIOMMU_Construct(
|
||||
|
||||
*Iommu = iommu;
|
||||
|
||||
gcmkPRINT("[galcore]: Enable IOMMU\n");
|
||||
pr_debug("[galcore]: Enable IOMMU\n");
|
||||
OnError:
|
||||
if (gcmIS_ERROR(status))
|
||||
{
|
||||
|
||||
@@ -1664,7 +1664,7 @@ gckOS_RequestReservedMemory(
|
||||
allocator = _FindAllocator(Os, gcvALLOC_FLAG_LINUX_RESERVED_MEM);
|
||||
if (!allocator)
|
||||
{
|
||||
gcmkPRINT("reserved-mem allocator not integrated!");
|
||||
pr_err("reserved-mem allocator not integrated!");
|
||||
gcmkONERROR(gcvSTATUS_GENERIC_IO);
|
||||
}
|
||||
|
||||
@@ -1913,7 +1913,7 @@ gckOS_ReadRegisterEx(
|
||||
* 2. In non-irq context, register access should not be called,
|
||||
* otherwise it's driver bug.
|
||||
*/
|
||||
printk(KERN_ERR "[galcore]: %s(%d) GPU[%d] external clock off",
|
||||
pr_err("[galcore]: %s(%d) GPU[%d] external clock off",
|
||||
__func__, __LINE__, Core);
|
||||
gcmkBUG_ON(1);
|
||||
return gcvSTATUS_GENERIC_IO;
|
||||
@@ -1924,7 +1924,7 @@ gckOS_ReadRegisterEx(
|
||||
|
||||
#if gcdDUMP_AHB_ACCESS
|
||||
/* Dangerous to print in interrupt context, skip. */
|
||||
gcmkPRINT("@[RD %d] %08x %08x", Core, Address, *Data);
|
||||
pr_warn("@[RD %d] %08x %08x", Core, Address, *Data);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1954,7 +1954,7 @@ _WriteRegisterEx(
|
||||
{
|
||||
spin_unlock(&Os->registerAccessLock);
|
||||
|
||||
printk(KERN_ERR "[galcore]: %s(%d) GPU[%d] external clock off",
|
||||
pr_err("[galcore]: %s(%d) GPU[%d] external clock off",
|
||||
__func__, __LINE__, Core);
|
||||
|
||||
/* Driver bug: register write when clock off. */
|
||||
@@ -1980,7 +1980,7 @@ _WriteRegisterEx(
|
||||
{
|
||||
spin_unlock_irqrestore(&Os->registerAccessLock, flags);
|
||||
|
||||
printk(KERN_ERR "[galcore]: %s(%d) GPU[%d] external clock off",
|
||||
pr_err("[galcore]: %s(%d) GPU[%d] external clock off",
|
||||
__func__, __LINE__, Core);
|
||||
|
||||
/* Driver bug: register write when clock off. */
|
||||
@@ -1993,7 +1993,7 @@ _WriteRegisterEx(
|
||||
|
||||
#if gcdDUMP_AHB_ACCESS
|
||||
/* Dangerous to print in interrupt context, skip. */
|
||||
gcmkPRINT("@[WR %d] %08x %08x", Core, Address, Data);
|
||||
pr_warn("@[WR %d] %08x %08x", Core, Address, Data);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -4462,7 +4462,7 @@ _CacheOperation(
|
||||
|
||||
if (!mdl || !mdl->allocator)
|
||||
{
|
||||
gcmkPRINT("[galcore]: %s: Logical=%p no mdl", __FUNCTION__, Logical);
|
||||
pr_err("[galcore]: %s: Logical=%p no mdl", __FUNCTION__, Logical);
|
||||
return gcvSTATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -7600,7 +7600,7 @@ gckOS_WrapMemory(
|
||||
{
|
||||
/* Won't enter here currently, the caller confirms the dmabuf is valid. */
|
||||
|
||||
gcmkPRINT("Wrap memory: invalid dmabuf.\n");
|
||||
pr_err("Wrap memory: invalid dmabuf.\n");
|
||||
gcmkONERROR(gcvSTATUS_INVALID_ARGUMENT);
|
||||
}
|
||||
|
||||
|
||||
@@ -584,7 +584,7 @@ _QueryBarInfo(
|
||||
return;
|
||||
}
|
||||
|
||||
gcmkPRINT("Bar%d addr=0x%x size=0x%x", BarNum, addr, size);
|
||||
pr_warn("Bar%d addr=0x%x size=0x%x", BarNum, addr, size);
|
||||
|
||||
*BarAddr = addr;
|
||||
*BarSize = size;
|
||||
@@ -613,31 +613,31 @@ static int gpu_sub_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
static u64 dma_mask = DMA_40BIT_MASK;
|
||||
#endif
|
||||
|
||||
gcmkPRINT("PCIE DRIVER PROBED");
|
||||
pr_debug("PCIE DRIVER PROBED");
|
||||
if (pci_enable_device(pdev)) {
|
||||
printk(KERN_ERR "galcore: pci_enable_device() failed.\n");
|
||||
pr_err("galcore: pci_enable_device() failed.\n");
|
||||
}
|
||||
|
||||
if (pci_set_dma_mask(pdev, dma_mask)) {
|
||||
printk(KERN_ERR "galcore: Failed to set DMA mask.\n");
|
||||
pr_err("galcore: Failed to set DMA mask.\n");
|
||||
}
|
||||
|
||||
pci_set_master(pdev);
|
||||
|
||||
if (pci_request_regions(pdev, "galcore")) {
|
||||
printk(KERN_ERR "galcore: Failed to get ownership of BAR region.\n");
|
||||
pr_err("galcore: Failed to get ownership of BAR region.\n");
|
||||
}
|
||||
|
||||
#if USE_MSI
|
||||
if (pci_enable_msi(pdev)) {
|
||||
printk(KERN_ERR "galcore: Failed to enable MSI.\n");
|
||||
pr_err("galcore: Failed to enable MSI.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PPC)
|
||||
/* On PPC platform, enable bus master, enable irq. */
|
||||
if (pci_write_config_word(pdev, 0x4, 0x0006) < 0) {
|
||||
printk(KERN_ERR "galcore: Failed to enable bus master on PPC.\n");
|
||||
pr_err("galcore: Failed to enable bus master on PPC.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -824,14 +824,14 @@ int gckPLATFORM_Init(struct platform_driver *pdrv,
|
||||
struct platform_device *default_dev = platform_device_alloc(pdrv->driver.name, -1);
|
||||
|
||||
if (!default_dev) {
|
||||
printk(KERN_ERR "galcore: platform_device_alloc failed.\n");
|
||||
pr_err("galcore: platform_device_alloc failed.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Add device */
|
||||
ret = platform_device_add(default_dev);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "galcore: platform_device_add failed.\n");
|
||||
pr_err("galcore: platform_device_add failed.\n");
|
||||
platform_device_put(default_dev);
|
||||
return ret;
|
||||
}
|
||||
@@ -848,7 +848,7 @@ int gckPLATFORM_Init(struct platform_driver *pdrv,
|
||||
pdrv->driver.of_match_table = gpu_dt_ids;
|
||||
ret = gpu_power_domain_init();
|
||||
if (ret) {
|
||||
printk(KERN_ERR "galcore: gpu_gpc_init failed.\n");
|
||||
pr_err("galcore: gpu_gpc_init failed.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user