Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3134094pxj; Mon, 17 May 2021 18:41:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYHwqg8eodv3YkrKPFUXiPSyozpAgpF92TQZh7ysLe2er3HAIbMT1yDkzIjIGeWttauRhI X-Received: by 2002:a05:6638:2643:: with SMTP id n3mr2881346jat.104.1621302064813; Mon, 17 May 2021 18:41:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621302064; cv=none; d=google.com; s=arc-20160816; b=i7TA2w40yMxu6IcJF6SpxQo2y5VRlKQzHc7uYAIxLpRpDqdjUBmZBLyD/CKQkRc7m1 EX+CZSPF0xlqS6W9mqyuT+bc+Ef/Ahor+/zQDCI1UINIdYk6p3Bvzho6kUgIL610NBrw hJ51WXKJtgO7xDAu9+we6xlqygIP07HOfNz9TwL93XW5QsCdjF4rlTmyQzAoAOcO/7DZ iQg4yImNvvD3vVRoC5igSmj/waywS8J1qOn0ASgTtiv54xaC5gz+Czl6uyG6aMY2kqEL 2XCmwn5iS0XiQ8ASq4qAxAPvxsPoaK/oZD3+9pksjM7IX5kxEpr0rAa75Ay1eSOCpBrU Au9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t0OxMK99vr1cGD8uD5C2b9z3L3tbedddaheW0UDs07E=; b=xUlt24gCyWQ2jvb2GOxFSyMuJS37aXdyvCno8KRMx8KiyweNG1Qq1hSP2SpZH//uTi wk9t64qb78/kWiraXtMBKEWC9NQK6w1/mZ08/JDX1zor18VczvXbek3mEBF2DCp4H8WM IHIJVD8enc9L9Is5OaDyWa1J90ejfv9YrEF8d4ELh82XTUSB5UhDTHL67w5Ja1zmsB+F xsVdVImFQNgG7VOmE7/XfbgNc5rZLW5CNXdf9WEK/eZVhxqner/BwIkT3M68Iq1/DmpD D16HpzCJgij1X7ikYSdxWSWSM4H9Fjic4jsi62WiNOepHEMiBhMRRM3iOZ+qc2omMjtR PRtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FbFGVFQl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si21838944jaj.66.2021.05.17.18.40.52; Mon, 17 May 2021 18:41:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FbFGVFQl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239887AbhEQOgM (ORCPT + 99 others); Mon, 17 May 2021 10:36:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:43402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240170AbhEQObo (ORCPT ); Mon, 17 May 2021 10:31:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3C28D613EB; Mon, 17 May 2021 14:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260939; bh=kdX7mJYRpiW3a974hLhtcX8/+XKPNW8rnJbVxtLqfLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FbFGVFQlszPIOFDBtwNrmqDcyPcE8I6uywX3mNLbVAQDQE/d7xRC1MWTqEfS78mE5 3fW62lhm5JqHWKj6FE2meGw70DlBO3Q8BDxsiajsSkaNJHFMPmmzQAMJEmCSaCyVxU HdMBV0ui5FMG1nCSoiS+MhKfdvsT3A+9NImabKhk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula Subject: [PATCH 5.12 271/363] drm/i915: Avoid div-by-zero on gen2 Date: Mon, 17 May 2021 16:02:17 +0200 Message-Id: <20210517140311.775282233@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ville Syrjälä commit 4819d16d91145966ce03818a95169df1fd56b299 upstream. Gen2 tiles are 2KiB in size so i915_gem_object_get_tile_row_size() can in fact return <4KiB, which leads to div-by-zero here. Avoid that. Not sure i915_gem_object_get_tile_row_size() is entirely sane anyway since it doesn't account for the different tile layouts on i8xx/i915... I'm not able to hit this before commit 6846895fde05 ("drm/i915: Replace PIN_NONFAULT with calls to PIN_NOEVICT") and it looks like I also need to run recent version of Mesa. With those in place xonotic trips on this quite easily on my 85x. Cc: stable@vger.kernel.org Reviewed-by: Chris Wilson Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20210421153401.13847-2-ville.syrjala@linux.intel.com (cherry picked from commit ed52c62d386f764194e0184fdb905d5f24194cae) Signed-off-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c @@ -189,7 +189,7 @@ compute_partial_view(const struct drm_i9 struct i915_ggtt_view view; if (i915_gem_object_is_tiled(obj)) - chunk = roundup(chunk, tile_row_pages(obj)); + chunk = roundup(chunk, tile_row_pages(obj) ?: 1); view.type = I915_GGTT_VIEW_PARTIAL; view.partial.offset = rounddown(page_offset, chunk);