Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Linux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BayLibre
Linux
Commits
558d68d1
Commit
558d68d1
authored
2 years ago
by
Drew Fustini
Browse files
Options
Downloads
Patches
Plain Diff
DO_NOT_MERGE riscv: platform driver to set sqoscfg for current task
parent
84a6d21b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
drivers/platform/Makefile
+1
-0
1 addition, 0 deletions
drivers/platform/Makefile
drivers/platform/qoscfg/Makefile
+3
-0
3 additions, 0 deletions
drivers/platform/qoscfg/Makefile
drivers/platform/qoscfg/qoscfg.c
+86
-0
86 additions, 0 deletions
drivers/platform/qoscfg/qoscfg.c
with
90 additions
and
0 deletions
drivers/platform/Makefile
+
1
−
0
View file @
558d68d1
...
@@ -11,3 +11,4 @@ obj-$(CONFIG_OLPC_EC) += olpc/
...
@@ -11,3 +11,4 @@ obj-$(CONFIG_OLPC_EC) += olpc/
obj-$(CONFIG_GOLDFISH)
+=
goldfish/
obj-$(CONFIG_GOLDFISH)
+=
goldfish/
obj-$(CONFIG_CHROME_PLATFORMS)
+=
chrome/
obj-$(CONFIG_CHROME_PLATFORMS)
+=
chrome/
obj-$(CONFIG_SURFACE_PLATFORMS)
+=
surface/
obj-$(CONFIG_SURFACE_PLATFORMS)
+=
surface/
obj-y
+=
qoscfg/
This diff is collapsed.
Click to expand it.
drivers/platform/qoscfg/Makefile
0 → 100644
+
3
−
0
View file @
558d68d1
# SPDX-License-Identifier: GPL-2.0-only
#
obj-y
+=
qoscfg.o
This diff is collapsed.
Click to expand it.
drivers/platform/qoscfg/qoscfg.c
0 → 100644
+
86
−
0
View file @
558d68d1
/*
* DO NOT MERGE
* Simple test driver to set thread.sqoscfg for the current task
*/
#include
<linux/kernel.h>
#include
<linux/module.h>
#include
<linux/sysfs.h>
#include
<asm/qos.h>
static
struct
kobject
*
thread_qoscfg_kobj
;
/* Sysfs file read function */
static
ssize_t
thread_qoscfg_value_show
(
struct
kobject
*
kobj
,
struct
kobj_attribute
*
attr
,
char
*
buf
)
{
struct
task_struct
*
task
=
current
;
u32
thread_qoscfg
;
thread_qoscfg
=
READ_ONCE
(
task
->
thread
.
sqoscfg
);
trace_printk
(
"DEBUG %s(): task->pid=%d thread_qoscfg=%d"
,
__func__
,
task
->
pid
,
thread_qoscfg
);
return
sprintf
(
buf
,
"%d
\n
"
,
thread_qoscfg
);
}
/* Sysfs file write function */
static
ssize_t
thread_qoscfg_value_store
(
struct
kobject
*
kobj
,
struct
kobj_attribute
*
attr
,
const
char
*
buf
,
size_t
count
)
{
struct
task_struct
*
task
=
current
;
u32
thread_qoscfg
;
u32
old_thread_qoscfg
;
int
value
;
if
(
kstrtoint
(
buf
,
10
,
&
value
)
<
0
)
return
-
EINVAL
;
trace_printk
(
"DEBUG %s(): task->pid=%d value=%d"
,
__func__
,
task
->
pid
,
value
);
old_thread_qoscfg
=
READ_ONCE
(
task
->
thread
.
sqoscfg
);
trace_printk
(
"DEBUG %s(): old_thread.sqoscfg=0x%x"
,
__func__
,
old_thread_qoscfg
);
trace_printk
(
"DEBUG %s(): write value to thread.sqoscfg=0x%x for pid=%d"
,
__func__
,
value
,
task
->
pid
);
WRITE_ONCE
(
task
->
thread
.
sqoscfg
,
value
);
thread_qoscfg
=
READ_ONCE
(
task
->
thread
.
sqoscfg
);
trace_printk
(
"DEBUG %s(): read thread.sqoscfg=%d for pid=%d"
,
__func__
,
thread_qoscfg
,
task
->
pid
);
return
count
;
}
/* Sysfs attributes */
static
struct
kobj_attribute
thread_qoscfg_value_attr
=
__ATTR
(
thread_qoscfg_value
,
0660
,
thread_qoscfg_value_show
,
thread_qoscfg_value_store
);
/* Initialize the module */
static
int
__init
thread_qoscfg_init
(
void
)
{
int
error
=
0
;
/* Create a kobject */
thread_qoscfg_kobj
=
kobject_create_and_add
(
"thread_qoscfg"
,
kernel_kobj
);
if
(
!
thread_qoscfg_kobj
)
return
-
ENOMEM
;
/* Create sysfs file attributes */
error
=
sysfs_create_file
(
thread_qoscfg_kobj
,
&
thread_qoscfg_value_attr
.
attr
);
if
(
error
)
{
kobject_put
(
thread_qoscfg_kobj
);
return
error
;
}
return
0
;
}
/* Cleanup the module */
static
void
__exit
thread_qoscfg_exit
(
void
)
{
/* Remove sysfs file attributes */
sysfs_remove_file
(
thread_qoscfg_kobj
,
&
thread_qoscfg_value_attr
.
attr
);
/* Remove the kobject */
kobject_put
(
thread_qoscfg_kobj
);
}
MODULE_LICENSE
(
"GPL"
);
MODULE_AUTHOR
(
"Drew Fustini"
);
MODULE_DESCRIPTION
(
"Test sysfs module for RISC-V Ssqosid"
);
module_init
(
thread_qoscfg_init
);
module_exit
(
thread_qoscfg_exit
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment