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: handle failure from vga_get_uninterruptible()

The vga_get_uninterruptible() function can return an error if it fails to
set up VGA decoding for the requested device.

If VGA decoding is unavailable, we don't need to be careful to leave the
VGA emulation in a usable state, as vgacon will also be unable to get
access later on, so just skip over the VGA accesses and the vga_put() call
matching the failed vga_get_uninterruptible().

Signed-off-by: Simon Richter <Simon.Richter@hogyros.de>
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1824
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20260306151347.758836-1-Simon.Richter@hogyros.de

authored by

Simon Richter and committed by
Ville Syrjälä
cda15ff3 878004e2

+26 -7
+26 -7
drivers/gpu/drm/i915/display/intel_vga.c
··· 112 112 return old & PCI_BRIDGE_CTL_VGA; 113 113 } 114 114 115 - static bool intel_vga_get(struct intel_display *display, bool mmio) 115 + static int intel_vga_get(struct intel_display *display, bool mmio, 116 + bool *old_io_decode) 116 117 { 117 118 struct pci_dev *pdev = to_pci_dev(display->drm->dev); 119 + int err; 118 120 119 - if (mmio) 120 - return false; 121 + if (mmio) { 122 + *old_io_decode = false; 123 + return 0; 124 + } 121 125 122 126 /* 123 127 * Bypass the VGA arbiter on the iGPU and just enable ··· 134 130 * grab any VGA IO access when IO decode is enabled, regardless 135 131 * of how any other VGA routing bits are configured. 136 132 */ 137 - if (display->platform.dgfx) 138 - vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO); 133 + if (display->platform.dgfx) { 134 + err = vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO); 135 + if (err) 136 + return err; 137 + } 139 138 140 - return intel_pci_set_io_decode(pdev, true); 139 + *old_io_decode = intel_pci_set_io_decode(pdev, true); 140 + 141 + return 0; 141 142 } 142 143 143 144 static void intel_vga_put(struct intel_display *display, bool io_decode, bool mmio) ··· 184 175 bool io_decode; 185 176 u8 msr, sr1; 186 177 u32 tmp; 178 + int err; 187 179 188 180 if (!intel_vga_decode_is_enabled(display)) { 189 181 drm_dbg_kms(display->drm, "VGA decode is disabled\n"); ··· 226 216 goto reset_vgacntr; 227 217 } 228 218 229 - io_decode = intel_vga_get(display, mmio); 219 + /* 220 + * This should not fail, because the vga_get() family of functions 221 + * will only report errors for dGPUs that are unreachable via the 222 + * bridge, and cannot be made reachable either. We shouldn't even 223 + * get here for this case, but if we do, we assume that the bridge 224 + * will also refuse future requests to forward VGA accesses. 225 + */ 226 + err = intel_vga_get(display, mmio, &io_decode); 227 + if (err) 228 + goto reset_vgacntr; 230 229 231 230 drm_WARN_ON(display->drm, !mmio && !intel_pci_has_vga_io_decode(pdev)); 232 231