From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D128C6FD1F for ; Tue, 14 Mar 2023 22:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YWEvP6TiCs76j9v06GyE0cntaGgxYF/RH9bWJssqnbo=; b=Dxl+onVfWbWDfB MWOm/2j3ZeRijU4F8rufYPTsGptopuh7+4n+6khykoER94qxYk3EavyypRiDpY4L8BBz13rDoDngg XakMawsNydvgCzjg3tq5mCqIqf5x0GCPzoTQiSHiu9Rcc7DyCxFmwsJrbC+icWIzRLDXnzPq+nMbK 4bC+AD+rTf2YBLS71EWdcgWePmAxpKYE7C/OVprggC64EfaHAXR1kKBKRtxS8Nm7aNJmrq8VKb11B KEGdXrZ0P9I4demBa5jLY/QOjf4VbWQXpYDaOXrgvQzA3KVwFAlQC32F3o7yryF/KlGaVVuObELkD 2Q5xSuW/3N4Iwcu/cS4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcDXH-00Bjon-1N; Tue, 14 Mar 2023 22:54:27 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcDXD-00Bjnd-1G for linux-arm-kernel@lists.infradead.org; Tue, 14 Mar 2023 22:54:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1678834463; x=1710370463; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=4mWBwFLpOe+3Lg11FkokGIfBuGEGGfu3AKmmd26Q/z8=; b=fY0gkrCQ8G64QdxXc9sgoBgZfhwjlM5hTlynn/zmJWbb8szspRrw6IB0 FEnwT6+EoG+aMZkme5Ukk1ZGcrgdZ18CGNvoXWPb/UPpqHo0zIxyV5mBI PWeWuQE0c9OzmixXpPyPpJFnxvmJOHV1HHZwQ1jYYIaqTQIdY6ogBggIr VcsvaI+G9HOHDBWEqnN+aiPs9Lt3HxvcyBmXnM6itjWIc+aFmiPSVgKZC jCT3eaHK46OCsjRXWAlhuCUYsC7BQDaKZWpiyjIr9U6cLi09+JvThufg2 b9zYO092eDNQIkVTi3CT/ox8uWrY24Vc6bNigxCYyYcug941nEOE54mN+ w==; X-IronPort-AV: E=Sophos;i="5.98,261,1673884800"; d="scan'208";a="225424642" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 Mar 2023 06:54:20 +0800 IronPort-SDR: ZI/4Ewh5zmxL+14R53qtFCNQB4IuBDkAoTRKH2+A6xnYLUgjnDsCPeEfC/kudhhkB7Xzesx3d/ 7eMjhAvjfWKzWLURlnSHVUgKMBH1khhrq+O3AMJko6VFFJJ2nVrPyoKdbPd6IbLHsXbEg1PMHT FlIM8b98w+Wgo3pZWhP/uFSoOYCgO01ivN1kvD0M5UecxmaPWqSpCHJTbBpmOF8QHeL4jgpZ8q UbybVbl5h+9SKzxOFWvQmzmUIf1MJjO7KyPE/DpdD0LBhtzr3tLDG7l+q1O7vjNpL2ABBG0HR0 U4Y= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 Mar 2023 15:10:48 -0700 IronPort-SDR: ywi4sKoVdosLig8NmWJW4TZfPD2FUrmsBxfByKoA794I5400+LSeedtWt5UcPuzK3dBk6Ov8sN yFLA9DjjnHOYdWqs0TJZHcyVkEfmn5jLBweQPQNdpISDA8i+d3/3TbrI6vnTSXiz1LJcPQ5Yga Rpz8lAhyChsRgBMChRKR+23ZN2vHe3CE9x1AKqqGgpwqoMGb/48XDtwskXSTUBOHhcGYzFpFz8 93RjIXRYpA0tM6ZxytRFr0MPL2vRznwS4mBAy0vtGuGAOvNVLsLc5+OGBbLTr95qMwl2Tg4ZSm LYE= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 Mar 2023 15:54:21 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4Pbpk40t59z1RtVx for ; Tue, 14 Mar 2023 15:54:20 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1678834458; x=1681426459; bh=4mWBwFLpOe+3Lg11FkokGIfBuGEGGfu3AKm md26Q/z8=; b=L3dZG1sWWAikqJiWmwg5q3YwNB+cbQ4rqZ2QbvfzfRdZou7SOQr 78lip1o4qHhDVm7kyyner0SSRoqWjsYLH9H8cgGIn5HxkY0fNeF5q6bUFTSAgg/e DPZL2Djv2bF9/ce4aFgHx8SmSBe0TKRUZB9OxwqgoCRBoPbxSSgMRDeY4pn1ERzd sXGtkzEQQXn6SWVRFRVXszUI6m9kkE8LHyn5nsakjNJrSdp30gZhwOW3BXQSiCEP kMmCQKFtfhvxidNbdVQdBS2wsBmdRiFhAvJWeU0f411vGq+h9zZb8TA/XTSEHcKL 7d3P0WxkB0lWqwQGWF9bdKC0o288HlyG3xw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ZXGniSrNSrwu for ; Tue, 14 Mar 2023 15:54:18 -0700 (PDT) Received: from [10.225.163.84] (unknown [10.225.163.84]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4Pbpjz2ZH9z1RtVm; Tue, 14 Mar 2023 15:54:15 -0700 (PDT) Message-ID: <8392a7de-666a-bce6-dc9f-b60d6dd93013@opensource.wdc.com> Date: Wed, 15 Mar 2023 07:54:14 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v2 0/9] PCI: rockchip: Fix RK3399 PCIe endpoint controller driver Content-Language: en-US To: Rick Wertenbroek Cc: alberto.dassatti@heig-vd.ch, xxm@rock-chips.com, rick.wertenbroek@heig-vd.ch, Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Shawn Lin , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Bjorn Helgaas , Jani Nikula , Rodrigo Vivi , Mikko Kovanen , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org References: <20230214140858.1133292-1-rick.wertenbroek@gmail.com> <3c4ed614-f088-928f-2807-deaa5e4b668a@opensource.wdc.com> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230314_155423_529716_31FDBD1B X-CRM114-Status: GOOD ( 38.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 3/14/23 23:53, Rick Wertenbroek wrote: > Hello Damien, > I also noticed random issues I suspect to be related to link status or power > state, in my case it sometimes happens that the BARs (0-6) in the config > space get reset to 0. This is not due to the driver because the driver never > ever accesses these registers (@0xfd80'0010 to 0xfd80'0024 TRM > 17.6.4.1.5-17.6.4.1.10). > I don't think the host rewrites them because lspci shows the BARs as > "[virtual]" which means they have been assigned by host but have 0 > value in the endpoint device (when lspci rereads the PCI config header). > See https://github.com/pciutils/pciutils/blob/master/lspci.c#L422 > > So I suspect the controller detects something related to link status or > power state and internally (in hardware) resets those registers. It's not > the kernel code, it never accesses these regs. The problem occurs > very randomly, sometimes in a few seconds, sometimes I cannot see > it for a whole day. > > Is this similar to what you are experiencing ? Yes. I sometimes get NMIs after starting the function driver, when my function driver starts probing the bar registers after seeing the host changing one register. And the link also comes up with 4 lanes or 2 lanes, random. > Do you have any idea as to what could make these registers to be reset > (I could not find anything in the TRM, also nothing in the driver seems to > cause it). My thinking is that since we do not have a linkup notifier, the function driver starts setting things up without the link established (e.g. when the host is still powered down). Once the host start booting and pic link is established, things may be reset in the hardware... That is the only thing I can think of. And yes, there are definitely something going on with the power states too I think: if I let things idle for a few minutes, everything stops working: no activity seen on the endpoint over the BARs. I tried enabling the sys and client interrupts to see if I can see power state changes, or if clearing the interrupts helps (they are masked by default), but no change. And booting the host with pci_aspm=off does not help either. Also tried to change all the capabilities related to link & power states to "off" (not supported), and no change either. So currently, I am out of ideas regarding that one. I am trying to make progress on my endpoint driver (nvme function) to be sure it is not a bug there that breaks things. I may still have something bad because when I enable the BIOS native NVMe driver on the host, either the host does not boot, or grub crashes with memory corruptions. Overall, not yet very stable and still trying to sort out the root cause of that. > Do you want me to include this patch in the V3 series or will you > submit another patch series for the changes you applied on the RK3399 PCIe > endpoint controller ? I don't know if you prefer to build the V3 > together or if you > prefer to submit another patch series on top of mine. Let me know. If it is no trouble, please include it with your series. Will be easier to retest everything together :) -- Damien Le Moal Western Digital Research _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel