Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2362854pxf; Sat, 20 Mar 2021 13:13:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDCrFqgw081eHZMmlP9t8VlMYzEn8V4JHJw3PXEFetGyjGbxGxX/0PNT01pp1qpcMBBk1I X-Received: by 2002:aa7:dd97:: with SMTP id g23mr16992646edv.154.1616271214077; Sat, 20 Mar 2021 13:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616271214; cv=none; d=google.com; s=arc-20160816; b=1BhpD529orVYrLolBbR1vQzboLpv+2FzQ8j64vHiUGL9S9BTd/b18r1h3CABj2v0HY rAWkfYGGP372bkBRvZ+YWUQS9/8QL+GuZKC5sM6yLm/G9OpUYgAyysaE2PrTn4mu6l0F SszwQTMxDRoC5U+eDDOozwFQo0zv9mD4pwueMYRadSOfb3M50pUBfeXzFwBAgr76d8JD qpb9BRyqxG4gvnQRbobXucq3Flz6Ktp9LQXGUO7xm0T7UThzBW0FbV7AOlGxe/JRQLfx B8o27PLurG/ZHroMOUKxoh1agP1PCB1nRRxzcKN81fe8p0PO4w4OSeWTtp6EEQXI7oV4 H3MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SLQP1yY7eLvqFaf/Mzi/B18hgtW7+O48xQNVJLxJJ5w=; b=iW2OlP/cSMdz4Cu0Fh2cfL7JBaSTTJS5LL3y9HXkGXMLX+cTqH8SRmhLrXW2slUUnl TTwGOKPxuLIb51F/vctMAhdgSi+2zeEz4XYhKs6sa6/qojdn2/rQ2p4vCLwsuTN+fmuH MWj+KKcrg+R5NJvUC27tj5K0cWfp+vI2JTG58PV5hGXsgWoctJqLGUTFmpcjVj2vATNs zO1Rig9zoGYdCYulEqYIUwsOSCurGXF3IdcWLKKW5Y7W0j0s0Dqmz5ssQO55I0pyjitk chUXKuoqDE6ADwWgNzB1v6hlY0kxXN/dYpBLPfmKhPAwT2tE7dRQkyYhrMwdGwTVfsRq EvyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Eail8CqS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n18si7317251ejg.224.2021.03.20.13.13.12; Sat, 20 Mar 2021 13:13:34 -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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=Eail8CqS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229787AbhCTUJy (ORCPT + 99 others); Sat, 20 Mar 2021 16:09:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbhCTUJl (ORCPT ); Sat, 20 Mar 2021 16:09:41 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C747C061574 for ; Sat, 20 Mar 2021 13:09:41 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DB6908D3; Sat, 20 Mar 2021 21:09:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1616270980; bh=54YnA6l0786MMgUPy84Ruh3n0/JWV766Jm/XCuHtZkM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Eail8CqSdt10yknT3xISYwD++Hce7WTsNdJeFK6jv0EG5UdaNab56PMyp7aubFBSN Sa75AooJS4DIWWkk9l2OfIz05s6qcoRhxsIOjYJ0kvF7BIH5NKKvsqR2roKdHz4ZTK oBWbsRUmtbKfBTBwSonoD70beeIHxiLj1rYLpktg= Date: Sat, 20 Mar 2021 22:08:59 +0200 From: Laurent Pinchart To: quanyang.wang@windriver.com Cc: Hyun Kwon , David Airlie , Daniel Vetter , Michal Simek , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm: xlnx: zynqmp: release reset to DP controller before accessing DP registers Message-ID: References: <20210320083739.724246-1-quanyang.wang@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210320083739.724246-1-quanyang.wang@windriver.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Quanyang, Thank you for the patch. On Sat, Mar 20, 2021 at 04:37:39PM +0800, quanyang.wang@windriver.com wrote: > From: Quanyang Wang > > When insmod zynqmp-dpsub.ko after rmmod it, system will hang with the > error log as below: > > root@xilinx-zynqmp:~# insmod zynqmp-dpsub.ko > [ 88.391289] [drm] Initialized zynqmp-dpsub 1.0.0 20130509 for fd4a0000.display on minor 0 > [ 88.529906] Console: switching to colour frame buffer device 128x48 > [ 88.549402] zynqmp-dpsub fd4a0000.display: [drm] fb0: zynqmp-dpsubdrm frame buffer device > [ 88.571624] zynqmp-dpsub fd4a0000.display: ZynqMP DisplayPort Subsystem driver probed > root@xilinx-zynqmp:~# rmmod zynqmp_dpsub > [ 94.023404] Console: switching to colour dummy device 80x25 > root@xilinx-zynqmp:~# insmod zynqmp-dpsub.ko > > > This is because that in zynqmp_dp_probe it tries to access some DP > registers while the DP controller is still in the reset state. When > running "rmmod zynqmp_dpsub", zynqmp_dp_reset(dp, true) in > zynqmp_dp_phy_exit is called to force the DP controller into the reset > state. Then insmod will call zynqmp_dp_probe to write to the DP registers, > but at this moment the DP controller isn't brought out of the reset state > since the function zynqmp_dp_reset(dp, false) is called later and this > will result the system hang. > > Releasing the reset to DP controller before any read/write operation to it > will fix this issue. > > Signed-off-by: Quanyang Wang > --- > drivers/gpu/drm/xlnx/zynqmp_dp.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c > index 99158ee67d02..bb45b3663d6b 100644 > --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c > +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c > @@ -402,10 +402,6 @@ static int zynqmp_dp_phy_init(struct zynqmp_dp *dp) > } > } > > - ret = zynqmp_dp_reset(dp, false); > - if (ret < 0) > - return ret; > - > zynqmp_dp_clr(dp, ZYNQMP_DP_PHY_RESET, ZYNQMP_DP_PHY_RESET_ALL_RESET); > > /* > @@ -1682,6 +1678,10 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm) > return PTR_ERR(dp->reset); > } > > + ret = zynqmp_dp_reset(dp, false); > + if (ret < 0) > + return ret; > + This change looks good to me. > ret = zynqmp_dp_phy_probe(dp); > if (ret) > return ret; But shouldn't we call zynqmp_dp_reset(dp, true) here ? Or rather, call it in the error path at the end of the function, with a goto label. For symmetry, should we also move the zynqmp_dp_reset() call from zynqmp_dp_phy_exit() to zynqmp_dp_remove() ? -- Regards, Laurent Pinchart