Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4582066pxj; Wed, 12 May 2021 08:38:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuKB89Xw84av/ZKzfUDi3Tf3Oace4/Dfvb9bt+ZBrINq4aD49Vc0k+GOD7uy/3B6sm3ZQ7 X-Received: by 2002:a17:907:62a7:: with SMTP id nd39mr38445014ejc.502.1620833900580; Wed, 12 May 2021 08:38:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620833900; cv=none; d=google.com; s=arc-20160816; b=a8vFkb/mzTwvHL/z+wIrkxSsT1bH446jtEuf1oi+42MZvoripr7mctoDoxlB3rGX5/ PfYNBCjj+fClJkP2kZNkHtqgj/BqCoXZb0Cg7mH6iFBZtzAj7x88mpIQu0mT7/EMEifF 145es8Yd3Pq5qs6vty+2ftjPlInpKKkcUtXQWUK0MF9O4NGxruv+heI1y7uATBGN/qnN 1XwJ3VzGqQoVbct5UZKSmle+6VqUTC2/P1ryQMq5E4wabLo/CZMuiCtK2S7mWULamDIf 3E1i4WPk+INv1ElTjWRfJiKj9h7oPPMw8kvBawHmqj1nLHNDFOVa51AqPE+6CZpltSJs XkDQ== 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=RRYFxuszFn4yGzGbmOQWLL4GOxzqoqttykiYZbog7XM=; b=NZIwReztJ2p0jr4bYRKpQVh4HuxY3jwgRdZjIPlowFhp0XoHf/KiStCcycF6OnU26I /tarj3Y8+1r9UqxmHP43x1j5N4MCVaosH8HzNkpsz0pyIa7JzoJsI0DGUWGVYGtk/be7 HkrInpJNZpxG+94bjYlTPPgTbxzozcTzlI0Px8XbeMijP0PzvD4S+PXM+00YNEfhy5zu M5tQ/L/oD28GRsxSNLuiceZ7eZNgIZjKHyESyvoWgo41guGEW+7fGyfnUEmaXebD5Sg6 x6+TI27TERE9OLkotYl1HfcuGh9nu+PUlMHLRh8UygAb7J5r8rmsdqYmaIa10J18EC3a wkVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sH9uiYpX; 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 a19si250814eje.138.2021.05.12.08.37.56; Wed, 12 May 2021 08:38:20 -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=sH9uiYpX; 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 S234979AbhELPfC (ORCPT + 99 others); Wed, 12 May 2021 11:35:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:50144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234177AbhELPQM (ORCPT ); Wed, 12 May 2021 11:16:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E14A36194C; Wed, 12 May 2021 15:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620831937; bh=g3z/VwvYcWPvXsOl/h0/INg1UucPJtQvm4R8DOaBu5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sH9uiYpXF4XCnqfgTpONhUkunmO7iNst4iXV+/LSlbD6SqNzD6o7hlTOPudu2Wlhp 9Pe3qHgYe0LmkT4eCqkil05nWvGRKOZpSfIoGMjRxfDLd1xq/Fp0qzxm5o5Y2PTG1d wDkWraiw7QXPGLJ2m4P4ADjum+gROFxLpZCB43bE= 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.10 068/530] drm/amd/display: Reject non-zero src_y and src_x for video planes Date: Wed, 12 May 2021 16:42:58 +0200 Message-Id: <20210512144821.996286372@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 d89f6048bdcb6a56abb396c584747d5eeae650db 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 Cc: stable@vger.kernel.org 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 @@ -3685,6 +3685,23 @@ static int fill_dc_scaling_info(const st scaling_info->src_rect.x = state->src_x >> 16; scaling_info->src_rect.y = state->src_y >> 16; + /* + * 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;