drivers/gpu/drm/i915/intel_uncore.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/intel_uncore.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/intel_uncore.c- Extension
.c- Size
- 91692 bytes
- Lines
- 2929
- 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.
- 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/pm_runtime.hdrm/drm_managed.hdrm/drm_print.hdisplay/intel_display_core.hgt/intel_engine_regs.hgt/intel_gt.hgt/intel_gt_regs.hi915_drv.hi915_iosf_mbi.hi915_reg.hi915_vgpu.hi915_wait_util.hi915_mmio_range.hintel_uncore_trace.hselftests/mock_uncore.cselftests/intel_uncore.c
Detected Declarations
enum ack_typefunction filesfunction fw_domains_getfunction intel_uncore_mmio_debug_init_earlyfunction mmio_debug_suspendfunction mmio_debug_resumefunction intel_uncore_forcewake_domain_to_strfunction fw_domain_resetfunction fw_domain_arm_timerfunction __wait_for_ackfunction wait_ack_clearfunction wait_ack_setfunction fw_domain_wait_ack_clearfunction fw_domain_wait_ack_with_fallbackfunction fw_domain_wait_ack_clear_fallbackfunction fw_domain_getfunction fw_domain_wait_ack_setfunction fw_domain_wait_ack_set_fallbackfunction fw_domain_putfunction fw_domains_get_normalfunction for_each_fw_domain_maskedfunction fw_domains_get_with_fallbackfunction for_each_fw_domain_maskedfunction fw_domains_putfunction fw_domains_resetfunction gt_thread_statusfunction __gen6_gt_wait_for_thread_c0function fw_domains_get_with_thread_statusfunction gen6_check_for_fifo_debugfunction fw_domains_get_normal_fifofunction fw_domains_get_with_thread_status_fifofunction fifo_free_entriesfunction __gen6_gt_wait_for_fifofunction intel_uncore_fw_release_timerfunction intel_uncore_forcewake_resetfunction for_each_fw_domainfunction for_each_fw_domainfunction fpga_check_for_unclaimed_mmiofunction vlv_check_for_unclaimed_mmiofunction check_for_unclaimed_mmiofunction forcewake_early_sanitizefunction intel_uncore_suspendfunction intel_uncore_resume_earlyfunction intel_uncore_runtime_resumefunction __intel_uncore_forcewake_getfunction for_each_fw_domain_maskedfunction intel_unforce_forcewake_putfunction intel_uncore_forcewake_get
Annotated Snippet
for_each_fw_domain(domain, uncore, tmp) {
smp_store_mb(domain->active, false);
if (hrtimer_cancel(&domain->timer) == 0)
continue;
intel_uncore_fw_release_timer(&domain->timer);
}
spin_lock_irqsave(&uncore->lock, irqflags);
for_each_fw_domain(domain, uncore, tmp) {
if (hrtimer_active(&domain->timer))
active_domains |= domain->mask;
}
if (active_domains == 0)
break;
if (--retry_count == 0) {
drm_err(&uncore->i915->drm, "Timed out waiting for forcewake timers to finish\n");
break;
}
spin_unlock_irqrestore(&uncore->lock, irqflags);
cond_resched();
}
drm_WARN_ON(&uncore->i915->drm, active_domains);
fw = uncore->fw_domains_active;
if (fw)
fw_domains_put(uncore, fw);
fw_domains_reset(uncore, uncore->fw_domains);
assert_forcewakes_inactive(uncore);
spin_unlock_irqrestore(&uncore->lock, irqflags);
return fw; /* track the lost user forcewake domains */
}
static bool
fpga_check_for_unclaimed_mmio(struct intel_uncore *uncore)
{
u32 dbg;
dbg = __raw_uncore_read32(uncore, FPGA_DBG);
if (likely(!(dbg & FPGA_DBG_RM_NOCLAIM)))
return false;
/*
* Bugs in PCI programming (or failing hardware) can occasionally cause
* us to lose access to the MMIO BAR. When this happens, register
* reads will come back with 0xFFFFFFFF for every register and things
* go bad very quickly. Let's try to detect that special case and at
* least try to print a more informative message about what has
* happened.
*
* During normal operation the FPGA_DBG register has several unused
* bits that will always read back as 0's so we can use them as canaries
* to recognize when MMIO accesses are just busted.
*/
if (unlikely(dbg == ~0))
drm_err(&uncore->i915->drm,
"Lost access to MMIO BAR; all registers now read back as 0xFFFFFFFF!\n");
__raw_uncore_write32(uncore, FPGA_DBG, FPGA_DBG_RM_NOCLAIM);
return true;
}
static bool
vlv_check_for_unclaimed_mmio(struct intel_uncore *uncore)
{
u32 cer;
cer = __raw_uncore_read32(uncore, CLAIM_ER);
if (likely(!(cer & (CLAIM_ER_OVERFLOW | CLAIM_ER_CTR_MASK))))
return false;
__raw_uncore_write32(uncore, CLAIM_ER, CLAIM_ER_CLR);
return true;
}
static bool
check_for_unclaimed_mmio(struct intel_uncore *uncore)
{
bool ret = false;
Annotation
- Immediate include surface: `linux/pm_runtime.h`, `drm/drm_managed.h`, `drm/drm_print.h`, `display/intel_display_core.h`, `gt/intel_engine_regs.h`, `gt/intel_gt.h`, `gt/intel_gt_regs.h`, `i915_drv.h`.
- Detected declarations: `enum ack_type`, `function files`, `function fw_domains_get`, `function intel_uncore_mmio_debug_init_early`, `function mmio_debug_suspend`, `function mmio_debug_resume`, `function intel_uncore_forcewake_domain_to_str`, `function fw_domain_reset`, `function fw_domain_arm_timer`, `function __wait_for_ack`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.