Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2379313rdg; Mon, 16 Oct 2023 02:32:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUPGW2aXT0I4S3Cx6ms43Lx46Us0Myr6oYXRCJW4Lklls25KIdBLkBuzHQZUVJo+p1KIBH X-Received: by 2002:a9d:6215:0:b0:6c4:9fda:a1e2 with SMTP id g21-20020a9d6215000000b006c49fdaa1e2mr32646532otj.4.1697448749675; Mon, 16 Oct 2023 02:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697448749; cv=none; d=google.com; s=arc-20160816; b=H2J/N9gThDjuWDLnFpCr8B+mTFmHKJZ5AFznPrUlJS9cZ6vxWFrjAYB78jQFZOQLMG bFqeI4DMKy7xFs7MH+Da3HMCMRz15oPuLNPHylz56APRhNUkr4FdCiSDLSuznVx2nILL OP0EZxTRgXHsf6QC5I49p0c1BcwxkJIPRvMVv9/LhEqZkitWy7MPuChq8UpEussfo3AV CCPNHAXg5S7N/yIvsS/BTfIAPHAa1ZwAaVyyrq5Bvwv9tD1wM2G/7QBPdA7kN4DgLjnx 7S7aNyzR79LOaybMTXNrodEzsKvRvn0CiMv9c9JVKQfAaaQ7cxOHO16JG9ipsaL2chhK jp9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=L94mDRkvQpJ/aUOtgfBsFiug0dX94SviFwkld9ssOfk=; fh=Q7Y3k0vAvuhMzR6WuZHERlOBYrUfVCKnvt18fBLoEfs=; b=ZQUjPEQVtJo6SihN92As7c/cu2DAN18kG2vNtl3h+DxtjBU06f4McPisgjMYYvirMa ci6yN6iangXXx3Lt0asUKsbZWS0mvaqtV4D+Yd69dXAItarxv77C0T+tE5GuzJgZ9ECy G3G7W8e88yAgSmobBrGFrXiaFnH2zCefaf83gHW5ejA7+Fd0PLjlUbdXJREkxrQzeD4B 6tWaw2ANZMxaa0jhUwpEG8+FR6EXZFZfxtsl7Cyd+QKSEVYTWr605F0+Hu5si4r5Xt/G Rr3iz1NxEunoBItHZLenAjTbdSoxLHpJijc9YFyaOStV7gPgMQo2uT8OR6SjOOkny5uL 4q1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id w8-20020a63f508000000b00563d791d978si10415263pgh.750.2023.10.16.02.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 02:32:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 29D8E8040EAC; Mon, 16 Oct 2023 02:32:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231162AbjJPJcQ (ORCPT + 99 others); Mon, 16 Oct 2023 05:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbjJPJcP (ORCPT ); Mon, 16 Oct 2023 05:32:15 -0400 Received: from bmailout2.hostsharing.net (bmailout2.hostsharing.net [83.223.78.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33F5497; Mon, 16 Oct 2023 02:32:13 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id 8AC352800A290; Mon, 16 Oct 2023 11:32:10 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 7C3D82ED8B5; Mon, 16 Oct 2023 11:32:10 +0200 (CEST) Date: Mon, 16 Oct 2023 11:32:10 +0200 From: Lukas Wunner To: Kai-Heng Feng Cc: bhelgaas@google.com, linux-pm@vger.kernel.org, linux-mmc@vger.kernel.org, Ricky Wu , Kees Cook , Tony Luck , "Guilherme G. Piccoli" , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH] PCI: pciehp: Prevent child devices from doing RPM on PCIe Link Down Message-ID: <20231016093210.GA22952@wunner.de> References: <20231016040132.23824-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231016040132.23824-1-kai.heng.feng@canonical.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 02:32:28 -0700 (PDT) On Mon, Oct 16, 2023 at 12:01:31PM +0800, Kai-Heng Feng wrote: > When inserting an SD7.0 card to Realtek card reader, it can trigger PCI > slot Link down and causes the following error: Why does *inserting* a card cause a Link Down? > [ 63.898861] pcieport 0000:00:1c.0: pciehp: Slot(8): Link Down > [ 63.912118] BUG: unable to handle page fault for address: ffffb24d403e5010 [...] > [ 63.912198] ? asm_exc_page_fault+0x27/0x30 > [ 63.912203] ? ioread32+0x2e/0x70 > [ 63.912206] ? rtsx_pci_write_register+0x5b/0x90 [rtsx_pci] > [ 63.912217] rtsx_set_l1off_sub+0x1c/0x30 [rtsx_pci] > [ 63.912226] rts5261_set_l1off_cfg_sub_d0+0x36/0x40 [rtsx_pci] > [ 63.912234] rtsx_pci_runtime_idle+0xc7/0x160 [rtsx_pci] > [ 63.912243] ? __pfx_pci_pm_runtime_idle+0x10/0x10 > [ 63.912246] pci_pm_runtime_idle+0x34/0x70 > [ 63.912248] rpm_idle+0xc4/0x2b0 > [ 63.912251] pm_runtime_work+0x93/0xc0 > [ 63.912254] process_one_work+0x21a/0x430 > [ 63.912258] worker_thread+0x4a/0x3c0 This looks like pcr->remap_addr is accessed after it has been iounmap'ed in rtsx_pci_remove() or before it has been iomap'ed in rtsx_pci_probe(). Is the card reader itself located below a hotplug port and unplugged here? Or is this about the card being removed from the card reader? Having full dmesg output and lspci -vvv output attached to a bugzilla would help to understand what is going on. Thanks, Lukas