Commit d3cb06e0 authored by Anshuman Khandual's avatar Anshuman Khandual Committed by Michael Ellerman

powerpc/dscr: Add some in-code documentation

This patch adds some in-code documentation to the DSCR related code to
make it more readable without having any functional change to it.
Signed-off-by: default avatarAnshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 1db36525
...@@ -295,6 +295,15 @@ struct thread_struct { ...@@ -295,6 +295,15 @@ struct thread_struct {
#endif #endif
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
unsigned long dscr; unsigned long dscr;
/*
* This member element dscr_inherit indicates that the process
* has explicitly attempted and changed the DSCR register value
* for itself. Hence kernel wont use the default CPU DSCR value
* contained in the PACA structure anymore during process context
* switch. Once this variable is set, this behaviour will also be
* inherited to all the children of this process from that point
* onwards.
*/
int dscr_inherit; int dscr_inherit;
unsigned long ppr; /* used to save/restore SMT priority */ unsigned long ppr; /* used to save/restore SMT priority */
#endif #endif
......
...@@ -496,13 +496,34 @@ static DEVICE_ATTR(spurr, 0400, show_spurr, NULL); ...@@ -496,13 +496,34 @@ static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
static DEVICE_ATTR(purr, 0400, show_purr, store_purr); static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
static DEVICE_ATTR(pir, 0400, show_pir, NULL); static DEVICE_ATTR(pir, 0400, show_pir, NULL);
/*
* This is the system wide DSCR register default value. Any
* change to this default value through the sysfs interface
* will update all per cpu DSCR default values across the
* system stored in their respective PACA structures.
*/
static unsigned long dscr_default; static unsigned long dscr_default;
/**
* read_dscr() - Fetch the cpu specific DSCR default
* @val: Returned cpu specific DSCR default value
*
* This function returns the per cpu DSCR default value
* for any cpu which is contained in it's PACA structure.
*/
static void read_dscr(void *val) static void read_dscr(void *val)
{ {
*(unsigned long *)val = get_paca()->dscr_default; *(unsigned long *)val = get_paca()->dscr_default;
} }
/**
* write_dscr() - Update the cpu specific DSCR default
* @val: New cpu specific DSCR default value to update
*
* This function updates the per cpu DSCR default value
* for any cpu which is contained in it's PACA structure.
*/
static void write_dscr(void *val) static void write_dscr(void *val)
{ {
get_paca()->dscr_default = *(unsigned long *)val; get_paca()->dscr_default = *(unsigned long *)val;
...@@ -520,12 +541,29 @@ static void add_write_permission_dev_attr(struct device_attribute *attr) ...@@ -520,12 +541,29 @@ static void add_write_permission_dev_attr(struct device_attribute *attr)
attr->attr.mode |= 0200; attr->attr.mode |= 0200;
} }
/**
* show_dscr_default() - Fetch the system wide DSCR default
* @dev: Device structure
* @attr: Device attribute structure
* @buf: Interface buffer
*
* This function returns the system wide DSCR default value.
*/
static ssize_t show_dscr_default(struct device *dev, static ssize_t show_dscr_default(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return sprintf(buf, "%lx\n", dscr_default); return sprintf(buf, "%lx\n", dscr_default);
} }
/**
* store_dscr_default() - Update the system wide DSCR default
* @dev: Device structure
* @attr: Device attribute structure
* @buf: Interface buffer
* @count: Size of the update
*
* This function updates the system wide DSCR default value.
*/
static ssize_t __used store_dscr_default(struct device *dev, static ssize_t __used store_dscr_default(struct device *dev,
struct device_attribute *attr, const char *buf, struct device_attribute *attr, const char *buf,
size_t count) size_t count)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment