Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp658180pxv; Thu, 15 Jul 2021 12:41:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztaV4ZRkc2uzqTFcWE9YeOZBpr+rgMfoCCMEZam6HbbBelclljiS1PgAQnr/P0f3EUX5Mb X-Received: by 2002:a17:906:b0d1:: with SMTP id bk17mr7257985ejb.59.1626378103353; Thu, 15 Jul 2021 12:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626378103; cv=none; d=google.com; s=arc-20160816; b=cS7H7BgiA+brqa0VELkg5PQKrYJCClA5eIto58r/bVXLWiYFDDJJhqD6m/zWD2VZUL igwqZVuTOr0T/twxDF4E4j9rC9+2dFGylCPevcsiPJnJGyQ3MnlNz64eU7W2bDcXFz2Q Uo5xBGkgVtfbGszI+WLKAxJdk7DJHydbwV+krk+9rARDKpRh9a9GeDWV/Entjw/cioBV FJqICBXhLJTTHIVBRsdVf/l2hGUY4e7c0a+8LW2br2Me+MMWJTj+eXNKyfXgwBiusn/n Thtzy3/DRw1HkprLIJFZfJv1qoqs847+RxIXBtyxv+s3jYYvJLnQN3FWLkC3CUxOrR1u p2Dg== 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=bxoIH5KRTjxnxSGWWP1I+op5XhWlwbekfHre8S6geQ8=; b=uLgaJ0prD8LL5fJbrQmMx18RKp6ndvBG5U6ogcHOkBs3za0o/Baupc6OtvVC52t00I gOSagvIN0D4zC1iWSq6lWqK5HlSmPKbUNH2Pv6KMyFHVQw6oCRpQvf5WjFVewMmcuvXD iSMW8PE82H6OPTsI0w1LvWQMoZIDBVVMfYDzI1O7ZZbwNHa5HZTHYFdoL/wTi1AVqBV7 6NjAdX00Y74EgjgX05Wp7rAjqaOjTLhMu2nbTWu1iHeePqgybPa7feSWeRU7Yd3MaC64 SSv0a62LS2y6hW5/FJf3eKLBawIS9SWOpnE+sGj//ttWrGdw7c0x5Uclh7VchHSaTlY+ KY4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zT5GnTMB; 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 a4si6459630ejy.269.2021.07.15.12.41.20; Thu, 15 Jul 2021 12:41:43 -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=zT5GnTMB; 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 S1343845AbhGOTnF (ORCPT + 99 others); Thu, 15 Jul 2021 15:43:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:50134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244673AbhGOTPC (ORCPT ); Thu, 15 Jul 2021 15:15:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0523161418; Thu, 15 Jul 2021 19:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376271; bh=rhRpncM7YAEI4dDuqLn6BK0a0nui5MB+JeBm0/VH770=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zT5GnTMBlVEftOU+4pg4BeoshJn6sxQFpyNI2Dmq1aasZIeYEYTdF+w0jfXzV1EUK UHPwdmExcjFBi3PJjtuUxMqtE+R3g8wrXwc3B1bMzJGhHWoydgSAYHK+opIRYU8inR JV5X2YOw6++g0FgbuCbY+MVCUgX1hiftzwiG7fgc= 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.13 199/266] drm/amd/display: Reject non-zero src_y and src_x for video planes Date: Thu, 15 Jul 2021 20:39:14 +0200 Message-Id: <20210715182645.487346639@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@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 @@ -4049,6 +4049,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;