Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5163060rwd; Tue, 23 May 2023 19:48:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6OzX0Twn9pNuXWOgfTKUcFbvEQr7NW8zGDiBBIwkbV1q/l3VszYfZe+/tRZvzvmMMK/u1x X-Received: by 2002:a17:90b:2397:b0:255:c8e5:b736 with SMTP id mr23-20020a17090b239700b00255c8e5b736mr1793382pjb.0.1684896504578; Tue, 23 May 2023 19:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684896504; cv=none; d=google.com; s=arc-20160816; b=eDQv6No9jNqvyZds2yW95JD+1egoKSgi6+Snvx4aPhet4b2Y8BWoPsW6CokWVmkWJT nbpK/l1sFRzbDARdQ/+gW48c4ZHp39UjmSbnRpVGyPGJdmvfJFBbgVOaJpNqjfHyk5N9 lM0oa8e3ZFQTJHuCGEw+Vuh0AdOXI2zapRfxl3PMb5zs4yCqXFyPN2mUpbJbCdC80sJy PM7qBYGwXqkDcabFKO85Nz5uObgV1B5l/fpjh5TahDUvoDXCcbHNz7qqoPcvmhXIT/ng /g0RkbGfFD98i9xVpg4cKVr+WDmxXgVioypELHg2EZyWFZQW26LIQKGI1D1OgouXFL56 ooZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:from:subject:user-agent :mime-version:date:message-id; bh=1etFnPkTn0xmpLc8pi/5QlxEaikU8bubuK57+oE2oPQ=; b=Qitk/Zod/DHm7mWH3xIphFhWC7us4MhJ3TZIYbWXosZ198pMpTl3F5PZaTI6D2Izzo LHa5a2arspIpLgrxEXBx1t7dU6kScACAphSHSJndwErbmI/55ekNgynLHURAYtKyUgbF xtu8y3m73ZRHcjPCM4YZD+p5p3JsZ5HmLvTnUqa+OpO5lTBkmqEmCc/ZXHOTMiHn58q/ LL18wG38ePiXohe/dZ3sl8Xx8AzHf/SwnfpY5qWY71Bxh1/YujudbFZoxhHk0DTdGfUc Yu/QPjr4rcYGG7lWKorrNe0yqhv5j8Aacdq+F5LkX69n+vv5FYhr1W7SggA35BykAqTU V0cA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fs9-20020a17090af28900b0024de687d6e3si365331pjb.111.2023.05.23.19.48.10; Tue, 23 May 2023 19:48:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234984AbjEXCbG (ORCPT + 99 others); Tue, 23 May 2023 22:31:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbjEXCbF (ORCPT ); Tue, 23 May 2023 22:31:05 -0400 X-Greylist: delayed 64 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 23 May 2023 19:31:02 PDT Received: from mail.aspeedtech.com (mail.aspeedtech.com [211.20.114.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 521B6C2 for ; Tue, 23 May 2023 19:31:02 -0700 (PDT) Received: from [192.168.2.115] (192.168.2.115) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 24 May 2023 10:29:56 +0800 Message-ID: <1e4ca9bc-0e39-2708-8da8-b402139fe7ff@aspeedtech.com> Date: Wed, 24 May 2023 10:29:57 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] drm/ast: Fix modeset failed on DisplayPort From: Jammy Huang To: Thomas Zimmermann , CC: , References: <20230425070330.8520-1-jammy_huang@aspeedtech.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [192.168.2.115] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thomas, Do you have other suggestion for this patch?? Please kindly advise. On 2023/4/25 下午 03:39, Jammy Huang wrote: > Hi Thomas, > > I think DP501 is OK. It doesn't use ioregs in ast_dp501_read_edid(). > > On 2023/4/25 下午 03:27, Thomas Zimmermann wrote: >> Hi >> >> Am 25.04.23 um 09:03 schrieb Jammy Huang: >>> If we switch display and update cursor together, it could lead to >>> modeset failed because of concurrent access to IO registers. >>> >>> Add lock protection in DP's edid access to avoid this problem. >> >> Thanks for the patch. I thought I fixed this issue already, but that >> apparently only happened for SIL164 and VGA. >> >> What about ast_dp501_connector_helper_get_modes()? Does it require >> the locking as well? >> >>> >>> Signed-off-by: Jammy Huang >>> --- >>>   drivers/gpu/drm/ast/ast_mode.c | 11 +++++++++++ >>>   1 file changed, 11 insertions(+) >>> >>> diff --git a/drivers/gpu/drm/ast/ast_mode.c >>> b/drivers/gpu/drm/ast/ast_mode.c >>> index 984ec590a7e7..fe5f1fd61361 100644 >>> --- a/drivers/gpu/drm/ast/ast_mode.c >>> +++ b/drivers/gpu/drm/ast/ast_mode.c >>> @@ -1635,6 +1635,8 @@ static int ast_dp501_output_init(struct >>> ast_private *ast) >>>   static int ast_astdp_connector_helper_get_modes(struct >>> drm_connector *connector) >>>   { >>>       void *edid; >>> +    struct drm_device *dev = connector->dev; >>> +    struct ast_private *ast = to_ast_private(dev); >> >> We've meanwhile renamed ast_private to ast_device. Could you please >> provide an updated patch for the drm-misc-next tree? >> >> Best regards >> Thomas >> >>>         int succ; >>>       int count; >>> @@ -1643,10 +1645,18 @@ static int >>> ast_astdp_connector_helper_get_modes(struct drm_connector *connector) >>>       if (!edid) >>>           goto err_drm_connector_update_edid_property; >>>   +    /* >>> +     * Protect access to I/O registers from concurrent modesetting >>> +     * by acquiring the I/O-register lock. >>> +     */ >>> +    mutex_lock(&ast->ioregs_lock); >>> + >>>       succ = ast_astdp_read_edid(connector->dev, edid); >>>       if (succ < 0) >>>           goto err_kfree; >>>   +    mutex_unlock(&ast->ioregs_lock); >>> + >>>       drm_connector_update_edid_property(connector, edid); >>>       count = drm_add_edid_modes(connector, edid); >>>       kfree(edid); >>> @@ -1654,6 +1664,7 @@ static int >>> ast_astdp_connector_helper_get_modes(struct drm_connector *connector) >>>       return count; >>>     err_kfree: >>> +    mutex_unlock(&ast->ioregs_lock); >>>       kfree(edid); >>>   err_drm_connector_update_edid_property: >>>       drm_connector_update_edid_property(connector, NULL); >>> >>> base-commit: 61d325dcbc05d8fef88110d35ef7776f3ac3f68b >> -- Best Regards Jammy