drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c- Extension
.c- Size
- 17889 bytes
- Lines
- 665
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- 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/kobject.hlinux/sysfs.hdrm/drm_managed.hxe_assert.hxe_device.hxe_pci_sriov.hxe_pm.hxe_sriov.hxe_sriov_pf.hxe_sriov_pf_control.hxe_sriov_pf_helpers.hxe_sriov_pf_provision.hxe_sriov_pf_sysfs.hxe_sriov_printk.h
Detected Declarations
struct xe_sriov_kobjstruct xe_sriov_dev_attrstruct xe_sriov_vf_attrfunction emit_choicefunction sched_priority_change_allowedfunction sched_priority_high_allowedfunction sched_priority_bulk_high_allowedfunction xe_sriov_dev_attr_sched_priority_storefunction profile_dev_attr_is_visiblefunction xe_sriov_vf_attr_sched_priority_showfunction xe_sriov_vf_attr_sched_priority_storefunction profile_vf_attr_is_visiblefunction control_vf_attr_is_visiblefunction action_put_kobjectfunction release_xe_sriov_kobjfunction xe_sriov_dev_attr_showfunction xe_sriov_dev_attr_storefunction xe_sriov_vf_attr_showfunction xe_sriov_vf_attr_storefunction pf_sysfs_errorfunction pf_sysfs_notefunction pf_setup_rootfunction pf_setup_treefunction action_rm_device_linkfunction pf_link_pf_devicefunction xe_sriov_pf_sysfs_initfunction xe_sriov_pf_sysfs_link_vfsfunction xe_sriov_pf_sysfs_unlink_vfs
Annotated Snippet
struct xe_sriov_kobj {
struct kobject base;
struct xe_device *xe;
unsigned int vfid;
};
#define to_xe_sriov_kobj(p) container_of_const((p), struct xe_sriov_kobj, base)
struct xe_sriov_dev_attr {
struct attribute attr;
ssize_t (*show)(struct xe_device *xe, char *buf);
ssize_t (*store)(struct xe_device *xe, const char *buf, size_t count);
};
#define to_xe_sriov_dev_attr(p) container_of_const((p), struct xe_sriov_dev_attr, attr)
#define XE_SRIOV_DEV_ATTR(NAME) \
struct xe_sriov_dev_attr xe_sriov_dev_attr_##NAME = \
__ATTR(NAME, 0644, xe_sriov_dev_attr_##NAME##_show, xe_sriov_dev_attr_##NAME##_store)
#define XE_SRIOV_DEV_ATTR_RO(NAME) \
struct xe_sriov_dev_attr xe_sriov_dev_attr_##NAME = \
__ATTR(NAME, 0444, xe_sriov_dev_attr_##NAME##_show, NULL)
#define XE_SRIOV_DEV_ATTR_WO(NAME) \
struct xe_sriov_dev_attr xe_sriov_dev_attr_##NAME = \
__ATTR(NAME, 0200, NULL, xe_sriov_dev_attr_##NAME##_store)
struct xe_sriov_vf_attr {
struct attribute attr;
ssize_t (*show)(struct xe_device *xe, unsigned int vfid, char *buf);
ssize_t (*store)(struct xe_device *xe, unsigned int vfid, const char *buf, size_t count);
};
#define to_xe_sriov_vf_attr(p) container_of_const((p), struct xe_sriov_vf_attr, attr)
#define XE_SRIOV_VF_ATTR(NAME) \
struct xe_sriov_vf_attr xe_sriov_vf_attr_##NAME = \
__ATTR(NAME, 0644, xe_sriov_vf_attr_##NAME##_show, xe_sriov_vf_attr_##NAME##_store)
#define XE_SRIOV_VF_ATTR_RO(NAME) \
struct xe_sriov_vf_attr xe_sriov_vf_attr_##NAME = \
__ATTR(NAME, 0444, xe_sriov_vf_attr_##NAME##_show, NULL)
#define XE_SRIOV_VF_ATTR_WO(NAME) \
struct xe_sriov_vf_attr xe_sriov_vf_attr_##NAME = \
__ATTR(NAME, 0200, NULL, xe_sriov_vf_attr_##NAME##_store)
/* device level attributes go here */
#define DEFINE_SIMPLE_BULK_PROVISIONING_SRIOV_DEV_ATTR_WO(NAME, ITEM, TYPE) \
\
static ssize_t xe_sriov_dev_attr_##NAME##_store(struct xe_device *xe, \
const char *buf, size_t count) \
{ \
TYPE value; \
int err; \
\
err = kstrto##TYPE(buf, 0, &value); \
if (err) \
return err; \
\
err = xe_sriov_pf_provision_bulk_apply_##ITEM(xe, value); \
return err ?: count; \
} \
\
static XE_SRIOV_DEV_ATTR_WO(NAME)
DEFINE_SIMPLE_BULK_PROVISIONING_SRIOV_DEV_ATTR_WO(exec_quantum_ms, eq, u32);
DEFINE_SIMPLE_BULK_PROVISIONING_SRIOV_DEV_ATTR_WO(preempt_timeout_us, pt, u32);
DEFINE_SIMPLE_BULK_PROVISIONING_SRIOV_DEV_ATTR_WO(vram_quota, vram, u64);
static const char * const sched_priority_names[] = {
[GUC_SCHED_PRIORITY_LOW] = "low",
[GUC_SCHED_PRIORITY_NORMAL] = "normal",
[GUC_SCHED_PRIORITY_HIGH] = "high",
};
static bool sched_priority_change_allowed(unsigned int vfid)
{
/* As of today GuC FW allows to selectively change only the PF priority. */
return vfid == PFID;
}
static bool sched_priority_high_allowed(unsigned int vfid)
{
/* As of today GuC FW allows to select 'high' priority only for the PF. */
return vfid == PFID;
}
static bool sched_priority_bulk_high_allowed(struct xe_device *xe)
{
/* all VFs are equal - it's sufficient to check VF1 only */
Annotation
- Immediate include surface: `linux/kobject.h`, `linux/sysfs.h`, `drm/drm_managed.h`, `xe_assert.h`, `xe_device.h`, `xe_pci_sriov.h`, `xe_pm.h`, `xe_sriov.h`.
- Detected declarations: `struct xe_sriov_kobj`, `struct xe_sriov_dev_attr`, `struct xe_sriov_vf_attr`, `function emit_choice`, `function sched_priority_change_allowed`, `function sched_priority_high_allowed`, `function sched_priority_bulk_high_allowed`, `function xe_sriov_dev_attr_sched_priority_store`, `function profile_dev_attr_is_visible`, `function xe_sriov_vf_attr_sched_priority_show`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.