Commit 608fb0a7 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-intel-next-fixes-2026-01-29' of...

Merge tag 'drm-intel-next-fixes-2026-01-29' of https://gitlab.freedesktop.org/drm/i915/kernel

 into drm-next

- Prevent u64 underflow in intel_fbc_stolen_end

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patch.msgid.link/aXsWGWjacEJ03rTs@jlahtine-mobl
parents 15392f76 ad3ebcc2
Loading
Loading
Loading
Loading
+21 −8
Original line number Diff line number Diff line
@@ -809,19 +809,32 @@ static u64 intel_fbc_cfb_base_max(struct intel_display *display)

static u64 intel_fbc_stolen_end(struct intel_display *display)
{
	u64 end;
	u64 end = intel_fbc_cfb_base_max(display);

	/* The FBC hardware for BDW/SKL doesn't have access to the stolen
	/*
	 * The FBC hardware for BDW/SKL doesn't have access to the stolen
	 * reserved range size, so it always assumes the maximum (8mb) is used.
	 * If we enable FBC using a CFB on that memory range we'll get FIFO
	 * underruns, even if that range is not reserved by the BIOS. */
	 * underruns, even if that range is not reserved by the BIOS.
	 */
	if (display->platform.broadwell ||
	    (DISPLAY_VER(display) == 9 && !display->platform.broxton))
		end = intel_parent_stolen_area_size(display) - 8 * 1024 * 1024;
	else
		end = U64_MAX;
	    (DISPLAY_VER(display) == 9 && !display->platform.broxton)) {
		u64 stolen_area_size = intel_parent_stolen_area_size(display);

		/*
		 * If stolen_area_size is less than SZ_8M, use
		 * intel_fbc_cfb_base_max instead.  This should not happen,
		 * so warn if it does.
		 */
		if (drm_WARN_ON(display->drm,
				check_sub_overflow(stolen_area_size,
						   SZ_8M, &stolen_area_size)))
			return end;

		return min(end, stolen_area_size);
	}

	return min(end, intel_fbc_cfb_base_max(display));
	return end;
}

static int intel_fbc_min_limit(const struct intel_plane_state *plane_state)