arch/powerpc/platforms/pseries/vas-sysfs.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/pseries/vas-sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/pseries/vas-sysfs.c- Extension
.c- Size
- 7355 bytes
- Lines
- 283
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/miscdevice.hlinux/kobject.hlinux/slab.hlinux/sysfs.hlinux/mm.hvas.h
Detected Declarations
struct vas_caps_entrystruct vas_sysfs_entryfunction update_total_credits_storefunction vas_type_showfunction vas_type_storefunction vas_type_releasefunction sysfs_add_vas_capsfunction VasCapsfunction sysfs_add_vas_capsfunction sysfs_pseries_vas_init
Annotated Snippet
struct vas_caps_entry {
struct kobject kobj;
struct vas_cop_feat_caps *caps;
};
#define to_caps_entry(entry) container_of(entry, struct vas_caps_entry, kobj)
/*
* This function is used to get the notification from the drmgr when
* QoS credits are changed.
*/
static ssize_t update_total_credits_store(struct vas_cop_feat_caps *caps,
const char *buf, size_t count)
{
int err;
u16 creds;
err = kstrtou16(buf, 0, &creds);
/*
* The user space interface from the management console
* notifies OS with the new QoS credits and then the
* hypervisor. So OS has to use this new credits value
* and reconfigure VAS windows (close or reopen depends
* on the credits available) instead of depending on VAS
* QoS capabilities from the hypervisor.
*/
if (!err)
err = vas_reconfig_capabilties(caps->win_type, creds);
if (err)
return -EINVAL;
pr_info("Set QoS total credits %u\n", creds);
return count;
}
#define sysfs_caps_entry_read(_name) \
static ssize_t _name##_show(struct vas_cop_feat_caps *caps, char *buf) \
{ \
return sysfs_emit(buf, "%d\n", atomic_read(&caps->_name)); \
}
struct vas_sysfs_entry {
struct attribute attr;
ssize_t (*show)(struct vas_cop_feat_caps *, char *);
ssize_t (*store)(struct vas_cop_feat_caps *, const char *, size_t);
};
#define VAS_ATTR_RO(_name) \
sysfs_caps_entry_read(_name); \
static struct vas_sysfs_entry _name##_attribute = __ATTR(_name, \
0444, _name##_show, NULL);
/*
* Create sysfs interface:
* /sys/devices/virtual/misc/vas/vas0/gzip/default_capabilities
* This directory contains the following VAS GZIP capabilities
* for the default credit type.
* /sys/devices/virtual/misc/vas/vas0/gzip/default_capabilities/nr_total_credits
* Total number of default credits assigned to the LPAR which
* can be changed with DLPAR operation.
* /sys/devices/virtual/misc/vas/vas0/gzip/default_capabilities/nr_used_credits
* Number of credits used by the user space. One credit will
* be assigned for each window open.
*
* /sys/devices/virtual/misc/vas/vas0/gzip/qos_capabilities
* This directory contains the following VAS GZIP capabilities
* for the Quality of Service (QoS) credit type.
* /sys/devices/virtual/misc/vas/vas0/gzip/qos_capabilities/nr_total_credits
* Total number of QoS credits assigned to the LPAR. The user
* has to define this value using HMC interface. It can be
* changed dynamically by the user.
* /sys/devices/virtual/misc/vas/vas0/gzip/qos_capabilities/nr_used_credits
* Number of credits used by the user space.
* /sys/devices/virtual/misc/vas/vas0/gzip/qos_capabilities/update_total_credits
* Update total QoS credits dynamically
*/
VAS_ATTR_RO(nr_total_credits);
VAS_ATTR_RO(nr_used_credits);
static struct vas_sysfs_entry update_total_credits_attribute =
__ATTR(update_total_credits, 0200, NULL, update_total_credits_store);
static struct attribute *vas_def_capab_attrs[] = {
&nr_total_credits_attribute.attr,
&nr_used_credits_attribute.attr,
NULL,
};
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/miscdevice.h`, `linux/kobject.h`, `linux/slab.h`, `linux/sysfs.h`, `linux/mm.h`, `vas.h`.
- Detected declarations: `struct vas_caps_entry`, `struct vas_sysfs_entry`, `function update_total_credits_store`, `function vas_type_show`, `function vas_type_store`, `function vas_type_release`, `function sysfs_add_vas_caps`, `function VasCaps`, `function sysfs_add_vas_caps`, `function sysfs_pseries_vas_init`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.