STRUCT PVR_DEVICE(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’– NAME ๐Ÿ’–

struct pvr_device โ€” the powervr-specific wrapper for &struct drm_device โœจ (yes bestie, this is the struct pvr_device(9) page straight out of the Kernel API Manual, and we're gonna get through it together ๐Ÿซถ)

๐ŸŒธ SYNOPSIS ๐ŸŒธ

okay so here's the whole struct, and ngl it's giving main character energy with this many members โ€” but don't panic, we go through every single one below:

struct pvr_device {
    struct drm_device base;
    struct pvr_gpu_id gpu_id;
    struct pvr_device_features features;
    struct pvr_device_quirks quirks;
    struct pvr_device_enhancements enhancements;
    struct pvr_fw_version fw_version;
    const struct pvr_device_data *device_data;
    struct resource *regs_resource;
    void __iomem *regs;
    struct clk *core_clk;
    struct clk *sys_clk;
    struct clk *mem_clk;
    struct pvr_device_power {
      struct dev_pm_domain_list *domains;
      struct device_link **domain_links;
    } power;
    struct reset_control *reset;
    struct pwrseq_desc *pwrseq;
    int irq;
    struct pvr_ccb fwccb;
    struct pvr_vm_context *kernel_vm_ctx;
    struct pvr_fw_device fw_dev;
    u32 stream_musthave_quirks[PVR_STREAM_TYPE_MAX][PVR_STREAM_EXTHDR_TYPE_MAX];
    atomic_t mmu_flush_cache_flags;
    struct xarray ctx_ids;
    struct xarray free_list_ids;
    struct xarray job_ids;
    struct {
      struct list_head active;
      struct list_head idle;
      struct mutex lock;
    } queues;
    struct {
      struct delayed_work work;
      u32 old_kccb_cmds_executed;
      u32 kccb_stall_count;
    } watchdog;
    struct {
      struct pvr_ccb ccb;
      wait_queue_head_t rtn_q;
      struct pvr_fw_object *rtn_obj;
      u32 *rtn;
      u32 slot_count;
      u32 reserved_count;
      struct list_head waiters;
      struct {
        u64 id;
        atomic_t seqno;
        spinlock_t lock;
      } fence_ctx;
    } kccb;
    bool lost;
    struct rw_semaphore reset_sem;
    struct workqueue_struct *sched_wq;
    spinlock_t ctx_list_lock;
    bool has_safety_events;
 };

๐ŸŽ€ Members ๐ŸŽ€

  • base โ€” the underlying struct drm_device. ๐Ÿ’…
๐Ÿšจ Do not touch this member directly, bestie โ€” call from_pvr_device instead. iykyk.
  • gpu_id โ€” GPU ID, detected at runtime. ๐Ÿ”
  • features โ€” hardware feature info.
๐Ÿ™ˆ Do not access this member directly โ€” use the PVR_HAS_FEATURE or PVR_FEATURE_VALUE macros instead.
  • quirks โ€” hardware quirk info.
๐Ÿ™ˆ Do not access this directly โ€” use PVR_HAS_QUIRK instead.
  • enhancements โ€” hardware enhancement info.
๐Ÿ™ˆ Do not access this directly โ€” use PVR_HAS_ENHANCEMENT instead.
  • fw_version โ€” firmware version, detected at runtime. ๐Ÿงš
  • device_data โ€” pointer to platform-specific data.
  • regs_resource โ€” the resource representing the device control registers.
  • regs โ€” the device control registers themselves. These get mapped into memory when the device is initialized, and that mapped location is exactly where this pointer points. ๐Ÿ“
  • core_clk โ€” the general core clock. This is the primary clock used by the entire GPU core. ๐Ÿ‘‘
  • sys_clk โ€” an optional system bus clock. Some platforms use this to give the SoC Interface (SOCIF) an independent clock. If it's present, it needs to be enabled/disabled together with core_clk โ€” they're a package deal fr fr. ๐Ÿซถ
  • mem_clk โ€” an optional memory clock. Some platforms use this to give the Memory Interface (MEMIF) an independent clock. If it's present, it also needs to be enabled/disabled together with core_clk. โœจ
  • power โ€” optional power domain devices. On platforms where the GPU has more than one power domain, they live here in domains, along with the links between them in domain_links. And heads up: the size of domain_links is one less than struct dev_pm_domain_list->num_pds in domains. ๐Ÿงฎ
  • reset โ€” an optional reset line. Some platforms use this to provide a reset line that needs to be de-asserted after the power-up procedure. It would also need to be asserted after the power-down procedure. โšก
  • pwrseq โ€” pointer to a power sequencer, if one is used.
  • irq โ€” the IRQ number. ๐Ÿ””
  • fwccb โ€” the firmware CCB.
  • kernel_vm_ctx โ€” the virtual memory context used for kernel mappings. This is used for mappings in the firmware address region when a META firmware processor is in use. ๐Ÿง  When a MIPS firmware processor is in use, this will be NULL. ๐Ÿ’€
  • fw_dev โ€” firmware-related data.
  • stream_musthave_quirks โ€” bit array of "must-have" quirks for stream commands.
  • mmu_flush_cache_flags โ€” records which MMU caches require flushing before the next job gets submitted. ๐Ÿงน
  • ctx_ids โ€” array of contexts belonging to this device. The array members are of type struct pvr_context *. This array is used to allocate IDs used by the firmware. ๐Ÿ†”
  • free_list_ids โ€” array of free lists belonging to this device. The array members are of type struct pvr_free_list *. This array is used to allocate IDs used by the firmware. ๐Ÿ†”
  • job_ids โ€” array of jobs belonging to this device. The array members are of type struct pvr_job *.
  • queues โ€” queue-related fields. ๐Ÿ“š
    • queues.active โ€” the active queue list.
    • queues.idle โ€” the idle queue list.
  • watchdog โ€” watchdog for communications with firmware. ๐Ÿ•
    • watchdog.work โ€” work item for the watchdog callback.
    • watchdog.old_kccb_cmds_executed โ€” KCCB command execution count at the last watchdog poll.
    • watchdog.kccb_stall_count โ€” number of watchdog polls KCCB has been stalled for.
  • kccb โ€” circular buffer for communications with firmware. ๐Ÿ”„
    • kccb.ccb โ€” the kernel CCB.
    • kccb.rtn_q โ€” waitqueue for KCCB command return waiters.
    • kccb.rtn_obj โ€” object representing KCCB return slots.
    • kccb.rtn โ€” pointer to the CPU mapping of the KCCB return slots. Must be accessed by READ_ONCE/WRITE_ONCE. โš ๏ธ
    • kccb.slot_count โ€” total number of KCCB slots available.
    • kccb.waiters โ€” list of KCCB slot waiters.
    • kccb.fence_ctx โ€” the KCCB fence context.
      • kccb.fence_ctx.lock โ€” lock used to synchronize access to fences allocated by this context.
  • lost โ€” true if the device has been lost. ๐Ÿ˜ญ This variable is set if the device has become irretrievably unavailable โ€” like, say, if the firmware processor has stopped responding and can't be revived via a hard reset. Gone gone.
  • reset_sem โ€” the reset semaphore. GPU reset code will lock this for writing. Any code that submits commands to the firmware that isn't in an IRQ handler or on the scheduler workqueue must lock this for reading.
๐Ÿšจ Once this has been successfully locked, pvr_dev->lost _must_ be checked, and -EIO must be returned if it is set. no cap, this one is not optional.
  • sched_wq โ€” workqueue for schedulers.
  • ctx_list_lock โ€” lock to be held when accessing the context list in struct pvr_file.
  • has_safety_events โ€” whether this device can raise safety events. ๐Ÿฆบ

๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

Go check out the kernel file ./drivers/gpu/drm/imagination/pvr_device.h, plus all these icons:


and that's the whole vibe check, bestie โ€” you ate that ๐Ÿ’…โœจ this page lives in ./drivers/gpu/drm/imagination, dated October 2026, and it's forever gonna be struct pvr_device(9) in the Kernel API Manual. mwah ๐ŸŽ€๐Ÿฆ‹๐Ÿ’œ

๐Ÿ“ฆ where this page comes from