Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp51517rwj; Thu, 22 Dec 2022 04:57:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXtdutB41qIAtXPebeom9CfvDMJqmtHBDkh/Vpw1X+VYez70sk3VvZ2WB95fJ6ALz/c14Vak X-Received: by 2002:a17:906:9be4:b0:7c0:e99a:e353 with SMTP id de36-20020a1709069be400b007c0e99ae353mr4330655ejc.56.1671713837649; Thu, 22 Dec 2022 04:57:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671713837; cv=none; d=google.com; s=arc-20160816; b=HnhsD9HCrpM0u2mKhY67PyngdJ3+38aoksQdB9KbWxK/wG9iada6/Ekxlx36nqCUCb ugAEQk9/MuBaNqpeYpomOrqOLzc2xVpGokp46XX85sD5U2+ZqEB32lJnJgp9UdCM3iHt CX2u6i1e+yRDR/V84X+1Cg3sRzD/F0AcHgCDX5I5nNuYkA/h8DhRkFv7NVIrasQqkV7z 1oGF7UW7IBVDsXQoqiO+4dJ5LQ38tNPUAwxJH54NjlYm9HBIz3bbHZyJW7CumG37RC/H nk7G7vJBz4HsPQUYaz9nCnu6UrkNw6MW8MsKkbO+JrjDRaeKgzvoFw0fDM+EW476aUHx mGKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=dTf9jOaeR3qaSQotuRN+VHb4a8lt/kVZhtQkQDGihIE=; b=w0i20ZK1J71T8WFd/yO5HBPzg5mghT0ViktttEr9EP1ABgPjjc2VEEuF4qlSch9ATP E0mKG33tBaaI8AFBHjdb2Kf+GFAfJlg/Bip7Drt+dqhInzGveEvz4ruZ/Ef0REsLu/Sw 5qONOYSoHtjy+tVUeCGwtkOTWx6tOqblU/mYS5Uaw9XhcFq8wkAzlZjGPJbHB5G5JpzY Z/lv53LHNZR4gYSLmEFlu10p6/Rzkyq5NEBMJeWrK/SYOxq/M5x8txUbcByJROl/Nh4k W+GN4/bCs2YLznDdOG9w6fvOJAASTg5ETrqLCoSuuM7avbqx49oUQnW2EnhClSRPJEQm T8OA== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a1709064fd000b0073d8ccd37c2si446914ejw.107.2022.12.22.04.57.01; Thu, 22 Dec 2022 04:57:17 -0800 (PST) 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235508AbiLVMlO (ORCPT + 67 others); Thu, 22 Dec 2022 07:41:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229620AbiLVMlL (ORCPT ); Thu, 22 Dec 2022 07:41:11 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4400A2BF5; Thu, 22 Dec 2022 04:41:08 -0800 (PST) Received: from kwepemi500002.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Nd8vz62qNzJpGc; Thu, 22 Dec 2022 20:37:19 +0800 (CST) Received: from shaphisprc00214.huawei.com (100.108.184.173) by kwepemi500002.china.huawei.com (7.221.188.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 22 Dec 2022 20:41:05 +0800 From: Jiantao Zhang To: , , , CC: , , , , Subject: [PATCH] PCI: Exit restore process when device is still powerdown Date: Thu, 22 Dec 2022 12:41:04 +0000 Message-ID: <20221222124104.69607-1-water.zhangjiantao@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [100.108.184.173] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500002.china.huawei.com (7.221.188.171) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 We get this stack when the rp doesn't power up in resume noirq: dump_backtrace.cfi_jt+0x0/0x4 dump_stack_lvl+0xb4/0x10c show_regs_before_dump_stack+0x1c/0x30 arm64_serror_panic+0x110/0x1a8 do_serror+0x16c/0x1cc el1_error+0x8c/0x10c do_raw_spin_unlock+0x74/0xdc pci_bus_read_config_word+0xdc/0x1dc pci_restore_msi_state+0x2f4/0x36c pci_restore_state+0x13f0/0x1444 pci_pm_resume_noirq+0x158/0x318 dpm_run_callback+0x178/0x5e8 device_resume_noirq+0x250/0x264 async_resume_noirq+0x20/0xf8 async_run_entry_fn+0xfc/0x364 process_one_work+0x37c/0x7f4 worker_thread+0x3e8/0x754 kthread+0x168/0x204 ret_from_fork+0x10/0x18 The ep device uses msix, the restore process will write bar space in __pci_msix_desc_mask_irq, which will result in accessing the powerdown area when the rp doesn't power on. It makes sense we should do nothing when the device is still powerdown. Signed-off-by: Jianrong Zhang Signed-off-by: Jiantao Zhang --- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index fba95486caaf..279f6e8c5a00 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1764,7 +1764,7 @@ static void pci_restore_rebar_state(struct pci_dev *pdev) */ void pci_restore_state(struct pci_dev *dev) { - if (!dev->state_saved) + if (!dev->state_saved || dev->current_state == PCI_UNKNOWN) return; /* -- 2.17.1