Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp710355pxv; Thu, 15 Jul 2021 14:07:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpRsPzUA1HFn3rIUIufvXv7CJ7nsMwMLyqKJImzUcEGWCv0EF4gyl/ynr8S6c9bmyVt6j2 X-Received: by 2002:a05:6402:22aa:: with SMTP id cx10mr9632471edb.0.1626383262827; Thu, 15 Jul 2021 14:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383262; cv=none; d=google.com; s=arc-20160816; b=dsuXmAEnqZvmijhiprbobZInxnn1IJ/UaMUn8QaiRssRAGgOg/aS2y3LN9OVPMIv+W SFl9vFyLkbKUXDo9GS4f3m1HSym0U7PD+wKc15AfoXK2lylhD0GCP5mVYbK4ZxolVyQB 0lGOLtZPuElzefiWiIzXjmjpitr5980r31pxBzIKHVGA9UDvtAA4A5Q+6RENA26Hub6X mnG9IYuu95yEdX1NvkM/z69+lYds6EKL8IecU7wkO8Nd+Qe8uIJx1knYNlFgjUzsZgx/ 1VySzfi8lVkZ4yXgjBCMHTwNHkMf/RKzNrHbeb7E/iIqgekraVizbfqsvky7BVAbyt7+ D5TQ== 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=yMAbNuw/o86LFfSibdQ3QZhzMjE6fhIRPrNv6FAL3rA=; b=l5MLPgbDDynirgxdApgmKUINPMmmTE+2LsyQbxUATt+6f1fG8NEMvBMpyhXyVroy8J H+0b6OveGWDq8HMCdSXLLeXQvWAU1ZGbueBjyzMy4hhxFv6NuJglEqUZT7n3rKvQLYNi 04MbdiKr7+gjJRiXGuy95r9MJZZb7xrrSd6cDgqOlLeHK6sW35TjCwOaRJeNnFqsYhad xgGb10aoCEWXuK6+QvGe9kaIKAprg+nBjdCMPRzKwEzdzVD9XLnFjFw7yHtDolLoNSpA 3ljq9zJyzuaJ3ZsyUcd+pZgi+4jGU1SImMX/qMKeLIg5UpYvVfEXQ8SQIMfhoS8jTMzK Ugvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tqL7l6Tx; 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 ka25si8857617ejc.354.2021.07.15.14.07.18; Thu, 15 Jul 2021 14:07:42 -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=tqL7l6Tx; 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 S245161AbhGOTTW (ORCPT + 99 others); Thu, 15 Jul 2021 15:19:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:39662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239531AbhGOTEl (ORCPT ); Thu, 15 Jul 2021 15:04:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2705D61411; Thu, 15 Jul 2021 19:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375642; bh=EGz4e5SLuBHfeNsdavJb+QjlZ8PNnhysJZHoaxwkzak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tqL7l6TxA6o13SX/ZigeZGVdvdJFeazHc/NXuBxz4H4mGIn9BreglHpD5r0qpyUND 5YLnZhQcMjOda4TV0UY0qsVTcZDWith7rXRQcvRbTMtjE9airuZoAo+/xlfVKnRvcO roV/TmIfVzI4EsAD0uSgPs8Z/f+zMOm11HFOwnKU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , nicholas.kazlauskas@amd.com, amd-gfx@lists.freedesktop.org, alexander.deucher@amd.com, Roman.Li@amd.com, hersenxs.wu@amd.com, danny.wang@amd.com, =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [PATCH 5.12 175/242] drm/amd/display: Reject non-zero src_y and src_x for video planes Date: Thu, 15 Jul 2021 20:38:57 +0200 Message-Id: <20210715182624.027757405@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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: Harry Wentland commit c6c6a712199ab355ce333fa5764a59506bb107c1 upstream. [Why] This hasn't been well tested and leads to complete system hangs on DCN1 based systems, possibly others. The system hang can be reproduced by gesturing the video on the YouTube Android app on ChromeOS into full screen. [How] Reject atomic commits with non-zero drm_plane_state.src_x or src_y values. v2: - Add code comment describing the reason we're rejecting non-zero src_x and src_y - Drop gerrit Change-Id - Add stable CC - Based on amd-staging-drm-next v3: removed trailing whitespace Signed-off-by: Harry Wentland Cc: stable@vger.kernel.org Cc: nicholas.kazlauskas@amd.com Cc: amd-gfx@lists.freedesktop.org Cc: alexander.deucher@amd.com Cc: Roman.Li@amd.com Cc: hersenxs.wu@amd.com Cc: danny.wang@amd.com Reviewed-by: Nicholas Kazlauskas Acked-by: Christian König Reviewed-by: Hersen Wu Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3884,6 +3884,23 @@ static int fill_dc_scaling_info(const st scaling_info->src_rect.y != 0)) return -EINVAL; + /* + * For reasons we don't (yet) fully understand a non-zero + * src_y coordinate into an NV12 buffer can cause a + * system hang. To avoid hangs (and maybe be overly cautious) + * let's reject both non-zero src_x and src_y. + * + * We currently know of only one use-case to reproduce a + * scenario with non-zero src_x and src_y for NV12, which + * is to gesture the YouTube Android app into full screen + * on ChromeOS. + */ + if (state->fb && + state->fb->format->format == DRM_FORMAT_NV12 && + (scaling_info->src_rect.x != 0 || + scaling_info->src_rect.y != 0)) + return -EINVAL; + scaling_info->src_rect.width = state->src_w >> 16; if (scaling_info->src_rect.width == 0) return -EINVAL;