drivers/gpu/drm/i915/gvt/handlers.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gvt/handlers.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gvt/handlers.c- Extension
.c- Size
- 98654 bytes
- Lines
- 3256
- 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/vmalloc.hdrm/display/drm_dp.hdrm/drm_print.hdrm/intel/intel_pcode_regs.hdrm/intel/intel_gmd_interrupt_regs.hdisplay/bxt_dpio_phy_regs.hdisplay/i9xx_plane_regs.hdisplay/intel_crt_regs.hdisplay/intel_cursor_regs.hdisplay/intel_display_regs.hdisplay/intel_dmc_regs.hdisplay/intel_dp_aux_regs.hdisplay/intel_dpio_phy.hdisplay/intel_dpll_mgr.hdisplay/intel_fbc.hdisplay/intel_fdi_regs.hdisplay/intel_pps_regs.hdisplay/intel_psr_regs.hdisplay/intel_sbi_regs.hdisplay/intel_sprite_regs.hdisplay/intel_vga_regs.hdisplay/skl_universal_plane_regs.hdisplay/skl_watermark_regs.hdisplay/vlv_dsi_pll_regs.hgt/intel_engine_regs.hgt/intel_gt_regs.hdisplay_helpers.hgvt.hi915_drv.hi915_pvinfo.hi915_reg.hsched_policy.h
Detected Declarations
function Copyrightfunction intel_gvt_match_devicefunction read_vregfunction write_vregfunction hash_for_each_possiblefunction setup_mmio_infofunction intel_gvt_render_mmio_to_enginefunction enter_failsafe_modefunction sanitize_fence_mmio_accessfunction gamw_echo_dev_rw_ia_writefunction fence_mmio_readfunction fence_mmio_writefunction mul_force_wake_writefunction gdrst_mmio_writefunction gmbus_mmio_readfunction gmbus_mmio_writefunction pch_pp_control_mmio_writefunction transconf_mmio_writefunction lcpll_ctl_mmio_writefunction dpy_reg_mmio_readfunction setup_virtual_dp_monitorfunction bxt_vgpu_get_dp_bitratefunction skl_vgpu_get_dp_bitratefunction DPLL_CTRL1_LINK_RATE_MASKfunction vgpu_update_refresh_ratefunction pipeconf_mmio_writefunction in_whitelistfunction force_nonpriv_writefunction ddi_buf_ctl_mmio_writefunction fdi_rx_iir_mmio_writefunction fdi_auto_training_startedfunction check_fdi_rx_train_statusfunction calc_indexfunction update_fdi_rx_iir_statusfunction dp_tp_ctl_mmio_writefunction dp_tp_status_mmio_writefunction pch_adpa_mmio_writefunction south_chicken2_mmio_writefunction pri_surf_mmio_writefunction spr_surf_mmio_writefunction reg50080_mmio_writefunction trigger_aux_channel_interruptfunction dp_aux_ch_ctl_trans_donefunction dp_aux_ch_ctl_link_trainingfunction dp_aux_ch_ctl_mmio_writefunction PCH_DP_AUX_CH_CTLfunction intel_dp_aux_transferfunction mbctl_write
Annotated Snippet
if (!p) {
WARN(1, "assign a handler to a non-tracked mmio %x\n",
i);
return -ENODEV;
}
p->ro_mask = ro_mask;
gvt->mmio.mmio_attribute[i / 4] = flags;
if (read)
p->read = read;
if (write)
p->write = write;
}
return 0;
}
/**
* intel_gvt_render_mmio_to_engine - convert a mmio offset into the engine
* @gvt: a GVT device
* @offset: register offset
*
* Returns:
* The engine containing the offset within its mmio page.
*/
const struct intel_engine_cs *
intel_gvt_render_mmio_to_engine(struct intel_gvt *gvt, unsigned int offset)
{
struct intel_engine_cs *engine;
enum intel_engine_id id;
offset &= ~GENMASK(11, 0);
for_each_engine(engine, gvt->gt, id)
if (engine->mmio_base == offset)
return engine;
return NULL;
}
#define offset_to_fence_num(offset) \
((offset - i915_mmio_reg_offset(FENCE_REG_GEN6_LO(0))) >> 3)
#define fence_num_to_offset(num) \
(num * 8 + i915_mmio_reg_offset(FENCE_REG_GEN6_LO(0)))
void enter_failsafe_mode(struct intel_vgpu *vgpu, int reason)
{
switch (reason) {
case GVT_FAILSAFE_UNSUPPORTED_GUEST:
pr_err("Detected your guest driver doesn't support GVT-g.\n");
break;
case GVT_FAILSAFE_INSUFFICIENT_RESOURCE:
pr_err("Graphics resource is not enough for the guest\n");
break;
case GVT_FAILSAFE_GUEST_ERR:
pr_err("GVT Internal error for the guest\n");
break;
default:
break;
}
pr_err("Now vgpu %d will enter failsafe mode.\n", vgpu->id);
vgpu->failsafe = true;
}
static int sanitize_fence_mmio_access(struct intel_vgpu *vgpu,
unsigned int fence_num, void *p_data, unsigned int bytes)
{
unsigned int max_fence = vgpu_fence_sz(vgpu);
if (fence_num >= max_fence) {
gvt_vgpu_err("access oob fence reg %d/%d\n",
fence_num, max_fence);
/* When guest access oob fence regs without access
* pv_info first, we treat guest not supporting GVT,
* and we will let vgpu enter failsafe mode.
*/
if (!vgpu->pv_notified)
enter_failsafe_mode(vgpu,
GVT_FAILSAFE_UNSUPPORTED_GUEST);
memset(p_data, 0, bytes);
return -EINVAL;
}
return 0;
}
static int gamw_echo_dev_rw_ia_write(struct intel_vgpu *vgpu,
unsigned int offset, void *p_data, unsigned int bytes)
{
u32 ips = (*(u32 *)p_data) & GAMW_ECO_ENABLE_64K_IPS_FIELD;
Annotation
- Immediate include surface: `linux/vmalloc.h`, `drm/display/drm_dp.h`, `drm/drm_print.h`, `drm/intel/intel_pcode_regs.h`, `drm/intel/intel_gmd_interrupt_regs.h`, `display/bxt_dpio_phy_regs.h`, `display/i9xx_plane_regs.h`, `display/intel_crt_regs.h`.
- Detected declarations: `function Copyright`, `function intel_gvt_match_device`, `function read_vreg`, `function write_vreg`, `function hash_for_each_possible`, `function setup_mmio_info`, `function intel_gvt_render_mmio_to_engine`, `function enter_failsafe_mode`, `function sanitize_fence_mmio_access`, `function gamw_echo_dev_rw_ia_write`.
- 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.