Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp571837pxj; Tue, 18 May 2021 09:28:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7i1sfL28eSsprja90ey8nEL3nBSTTumBXK5kNC4cEaanLwpvG1pIlhUcDtw6NStDFSYYs X-Received: by 2002:a05:6402:1518:: with SMTP id f24mr7979670edw.217.1621355326979; Tue, 18 May 2021 09:28:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621355326; cv=none; d=google.com; s=arc-20160816; b=OwCLzs1WAjI8jqTEm26vqch1NUR6vALkLdHA+pBwGEAiLH4pEpaePwjGAACIir3kCi xCEYd8XhrEk0oM7RRE/1+BPSx4uZL63mZvbRiu3LyaRQrRtQW+Hx2WE87SzfxzZlA1iQ fRn3V2V2WodV/lagGE7dXwrttKNzOcsTIgIJ2dWkgx3Ofz3olB7ey5gAYwti40KIr6EX wmI1qCmtLzsKc7ytTZczwX6b7LdlumhNlpYSQ4fy++CldjX8esvEmWkgZCEccirqNHwg nRAhFqU4/6kq17HAZjK7ZsfRvlSWkW02W+2iklY260/wup7rHIn8PqRl+6AATRN/S9ZV /Jtg== 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=rZKYkpFrvrkxjuhfl5LPxli7WwCOD/gz3dV94FMkvlZA2EjttmwEHOvFFLStS1Q/A0 2R4Lz/O/Ru+e3WjRYTtyXcd9X1z5ohbKZURSVlOFMRorh7Jv7SLiK6/QihibbbfEBjAo 4zHLnCc5YbaQQYaeUdL+8K4878oNmITW5f5e2eY+bHP4Rpmu6SNX1nhHg+ZoF6pBhSH9 bkJad+irPLZ57FL8LlFlY9ewCeQpXx5tyk7Re2mOwqFWWCILt7PXIm4GHRX3KVFa8iyR Q0FHZbG73oucmqnF1pE76md+YzdG3fWQi9I5MuMp0QXtWUsPy32g373ZjDqNknDlTsa5 bXbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vG12uPyG; 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 eb8si20117724edb.103.2021.05.18.09.28.23; Tue, 18 May 2021 09:28:46 -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=vG12uPyG; 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 S1343558AbhEQQCV (ORCPT + 99 others); Mon, 17 May 2021 12:02:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:52062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243385AbhEQPmB (ORCPT ); Mon, 17 May 2021 11:42:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6919961968; Mon, 17 May 2021 14:42:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262542; bh=kdX7mJYRpiW3a974hLhtcX8/+XKPNW8rnJbVxtLqfLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vG12uPyGvtg6CRBn+8fknG9zn45ARIyN4eyW5+jtPEd5QfwLITSA5yxdTc5vF1RgX YevnVNsVJ8g1En1HFSsAL7SwNMqrTYV4iaSdmMUC5of5MSiatURYtxv67jCjLrN6p7 8xStr5tkGkRsl2FIsURT68h6hcEVT/CJUYaxR0QU= 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.10 210/289] drm/i915: Avoid div-by-zero on gen2 Date: Mon, 17 May 2021 16:02:15 +0200 Message-Id: <20210517140312.195450034@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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);