Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915/vga: Don't touch VGA registers if VGA decode is fully disabled

On some systems the BIOS will disable the VGA decode logic in the
iGPU (via GMCH_CTRL) when an external GPU is used as the primary
VGA device. In that case the iGPU will never claim any VGA register
accesses, and any access we do will in fact end up on the external
GPU. Don't go poking around in the other GPUs' registers.

Note that (at least on the g4x board where I tested this) the BIOS
forgets to set the VGACNTR VGA_DISP_DISABLE bit, and the reset
value for said bit is 0. That apparently prevents the pipes from
running, so we must still remember to set the bit, despite the VGA
plane was never actually enabled. On more modern platforms (hsw+
maybe?) the reset value for VGACNTR was changed to have
VGA_DISP_DISABLE already set.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20251208182637.334-6-ville.syrjala@linux.intel.com
Acked-by: Jani Nikula <jani.nikula@intel.com>

+24
+24
drivers/gpu/drm/i915/display/intel_vga.c
··· 23 23 return DISPLAY_VER(display) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL; 24 24 } 25 25 26 + static bool intel_vga_decode_is_enabled(struct intel_display *display) 27 + { 28 + struct pci_dev *pdev = to_pci_dev(display->drm->dev); 29 + u16 gmch_ctrl = 0; 30 + 31 + if (pci_bus_read_config_word(pdev->bus, PCI_DEVFN(0, 0), 32 + intel_gmch_ctrl_reg(display), &gmch_ctrl)) 33 + return false; 34 + 35 + return !(gmch_ctrl & INTEL_GMCH_VGA_DISABLE); 36 + } 37 + 26 38 static i915_reg_t intel_vga_cntrl_reg(struct intel_display *display) 27 39 { 28 40 if (display->platform.valleyview || display->platform.cherryview) ··· 66 54 enum pipe pipe; 67 55 u8 msr, sr1; 68 56 u32 tmp; 57 + 58 + if (!intel_vga_decode_is_enabled(display)) { 59 + drm_dbg_kms(display->drm, "VGA decode is disabled\n"); 60 + 61 + /* 62 + * On older hardware VGA_DISP_DISABLE defaults to 0, but 63 + * it *must* be set or else the pipe will be completely 64 + * stuck (at least on g4x). 65 + */ 66 + goto reset_vgacntr; 67 + } 69 68 70 69 tmp = intel_de_read(display, vga_reg); 71 70 if (tmp & VGA_DISP_DISABLE) ··· 119 96 120 97 udelay(300); 121 98 99 + reset_vgacntr: 122 100 intel_de_write(display, vga_reg, VGA_DISP_DISABLE); 123 101 intel_de_posting_read(display, vga_reg); 124 102 }