From patchwork Thu Aug 18 13:51:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 12947149 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 B2BA3C00140 for ; Thu, 18 Aug 2022 14:00:10 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WMnTdEvwKDnWAPOH3B9c5e0WnahPM0Eo35xkgv0xGPU=; b=vDkY/kx+zm+LHl vusBX3HVna9i8QYxsZmByCXPAIMsXJqQ/u3Hu0Wub/RKyv7aCoEce22RvLP0Kk5nOd+cOio2XcpPw yb53n4J1aIdSGtn7dlQ13lH+Jlfh6VJhMWT8WlBila3TDcGLfxgPC5xKg71gWIOFr8DtQdiG+ViDZ yJXPve9hTdrKs87dRmueCOPVywpn68/iHyVCTo/wbcwFV1S2v1sqGtVhXLSBN4BxqanYJ7bcrzPhA sk3wUw3gs10z7/bbklsHnO6pcKmwBOhq0piPlwd+Wok1Xfq3Mbbz/5vajih98Yb2FsplqDtfttJai 7MBYGRAqCam0elwvfjIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOg2w-005n2O-Lv; Thu, 18 Aug 2022 13:58:55 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOfw6-005iOL-Ln for linux-arm-kernel@lists.infradead.org; Thu, 18 Aug 2022 13:51:52 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F0919616DC; Thu, 18 Aug 2022 13:51:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D13AC43470; Thu, 18 Aug 2022 13:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660830709; bh=C2D3Jj4PCvtjMZxe3v8o6HA9+SpgibNASF4uxV6GlWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I+w0ABLf/nmw/TzhnhwhryYvr9P7ecUwG2oa/2kO2pw8fYBClPt27lOIgtra1q2Bj 64lmFqYVUkOrnr6XujLONoa0XHuTUU7lTTaZM5SJ+CPmkQYlmtW5juiUJ9peXQ5x+C RcIT+NWTY1Yz5grVTzC3Ades2TS/THY985cTq/W0GDt54qEmJYsWH79t1RL8Y/t8Lv 6RX2fWsaiV56joBzLX52jxZKXbuarRMxXAzpleF2Xtf6vuV0G8T/oc+r/ODuBdaL6a Xf32Fls9Md9pg1eZOLoTuaEbxunie8a/HforQU8c/EGye/l7M5b3Z+E1aj/lsT+BDG NxezwjkdqUggQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Lorenzo Pieralisi , Bjorn Helgaas , Lukas Wunner Cc: =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , pali@kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH 02/11] PCI: pciehp: Enable Command Completed Interrupt only if supported Date: Thu, 18 Aug 2022 15:51:31 +0200 Message-Id: <20220818135140.5996-3-kabel@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220818135140.5996-1-kabel@kernel.org> References: <20220818135140.5996-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220818_065150_834062_08614CDF X-CRM114-Status: GOOD ( 14.31 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Pali Rohár The No Command Completed Support bit in the Slot Capabilities register indicates whether Command Completed Interrupt Enable is unsupported. We already check whether No Command Completed Support bit is set in pcie_wait_cmd(), and do not wait in this case. Let's not enable this Command Completed Interrupt at all if NCCS is set, so that when users dump configuration space from userspace, the dump does not confuse them by saying that Command Completed Interrupt is not supported, but it is enabled. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún --- Changes since batch 5: - changed commit message, previously we wrote that the change is needed to fix a bug where kernel was waiting for an event which did not come. This turns out to be false. See https://lore.kernel.org/linux-pci/20220818142243.4c046c59@dellmb/T/#u --- drivers/pci/hotplug/pciehp_hpc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 373bb396fe22..838eb6cc3ec7 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -817,7 +817,9 @@ static void pcie_enable_notification(struct controller *ctrl) else cmd |= PCI_EXP_SLTCTL_PDCE; if (!pciehp_poll_mode) - cmd |= PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE; + cmd |= PCI_EXP_SLTCTL_HPIE; + if (!pciehp_poll_mode && !NO_CMD_CMPL(ctrl)) + cmd |= PCI_EXP_SLTCTL_CCIE; mask = (PCI_EXP_SLTCTL_PDCE | PCI_EXP_SLTCTL_ABPE | PCI_EXP_SLTCTL_PFDE |