From patchwork Mon Feb 5 12:02:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gowans, James" X-Patchwork-Id: 13545362 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7A15C48291 for ; Mon, 5 Feb 2024 12:06:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 821BD6B00A6; Mon, 5 Feb 2024 07:06:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D06D6B00A7; Mon, 5 Feb 2024 07:06:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 699A66B00A8; Mon, 5 Feb 2024 07:06:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 55B296B00A6 for ; Mon, 5 Feb 2024 07:06:06 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 343D5A1CF6 for ; Mon, 5 Feb 2024 12:06:06 +0000 (UTC) X-FDA: 81757621932.04.7D553AE Received: from smtp-fw-52004.amazon.com (smtp-fw-52004.amazon.com [52.119.213.154]) by imf04.hostedemail.com (Postfix) with ESMTP id 3F9CE4001A for ; Mon, 5 Feb 2024 12:06:04 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=amazon.com header.s=amazon201209 header.b="U/ckuN0e"; dmarc=pass (policy=quarantine) header.from=amazon.com; spf=pass (imf04.hostedemail.com: domain of "prvs=75897cb1d=jgowans@amazon.com" designates 52.119.213.154 as permitted sender) smtp.mailfrom="prvs=75897cb1d=jgowans@amazon.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707134764; a=rsa-sha256; cv=none; b=o59rgJZ7fApBe5f9aUb/S/UAzx0V9uQ33EC2wWHxfcOlAutcIASkj0v68Y+gAER4HUqdbg Ce/z7A6jP1LuYh8AlX9PXgM83uT9imLc6CeCcCyF7oNIMuB4Albobi24T1gkZ/3WY4mmh8 WpRgfjt0n2ZAgF5SRrdspBd4bDT7xXc= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=amazon.com header.s=amazon201209 header.b="U/ckuN0e"; dmarc=pass (policy=quarantine) header.from=amazon.com; spf=pass (imf04.hostedemail.com: domain of "prvs=75897cb1d=jgowans@amazon.com" designates 52.119.213.154 as permitted sender) smtp.mailfrom="prvs=75897cb1d=jgowans@amazon.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707134764; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PZz9j1l+xmnCAt/gSMnG+c7uMbg+JDxTUK6mJnmY1gY=; b=IeW4Try0rLVlABrXj9M6xXGBORHCD6qswgB253BboPxbTr9vea3B9Mx9NNbp6qYcUjf/Nt o4Ywzz67ilvcYFA53vw4yIAYu0uzZH1O1sciI8w1PrtsBIL8cEdHM7uNtN5Omz1G2H+Wa+ sxqcJMuMrUemYT446Jcy/0cp3jQSM54= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1707134764; x=1738670764; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PZz9j1l+xmnCAt/gSMnG+c7uMbg+JDxTUK6mJnmY1gY=; b=U/ckuN0efPirCZOhg0jyhphmPGDn1IRr2LwtDRkRQrbeEPzEH/weHts0 YorB72I59IZN2MAX3ID5nYprUDZrZXdTGi5vEM9OQ86aEqJ/1XC0FI3SJ tUE++vkfb1i2+c74YrOeZMtCEQPg8DChdCuFjpne0BfHmvsXSSpti5eCb g=; X-IronPort-AV: E=Sophos;i="6.05,245,1701129600"; d="scan'208";a="182633597" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO smtpout.prod.us-east-1.prod.farcaster.email.amazon.dev) ([10.43.8.2]) by smtp-border-fw-52004.iad7.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2024 12:06:04 +0000 Received: from EX19MTAEUB002.ant.amazon.com [10.0.17.79:57869] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.28.144:2525] with esmtp (Farcaster) id 1dbb430b-a9a2-4718-957f-9c92058f05d9; Mon, 5 Feb 2024 12:06:02 +0000 (UTC) X-Farcaster-Flow-ID: 1dbb430b-a9a2-4718-957f-9c92058f05d9 Received: from EX19D014EUC004.ant.amazon.com (10.252.51.182) by EX19MTAEUB002.ant.amazon.com (10.252.51.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 5 Feb 2024 12:06:02 +0000 Received: from dev-dsk-jgowans-1a-a3faec1f.eu-west-1.amazon.com (172.19.112.191) by EX19D014EUC004.ant.amazon.com (10.252.51.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 5 Feb 2024 12:05:56 +0000 From: James Gowans To: CC: Eric Biederman , , "Joerg Roedel" , Will Deacon , , Alexander Viro , "Christian Brauner" , , Paolo Bonzini , Sean Christopherson , , Andrew Morton , , Alexander Graf , David Woodhouse , "Jan H . Schoenherr" , Usama Arif , Anthony Yznaga , Stanislav Kinsburskii , , , Subject: [RFC 17/18] pci: Don't clear bus master is persistence enabled Date: Mon, 5 Feb 2024 12:02:02 +0000 Message-ID: <20240205120203.60312-18-jgowans@amazon.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240205120203.60312-1-jgowans@amazon.com> References: <20240205120203.60312-1-jgowans@amazon.com> MIME-Version: 1.0 X-Originating-IP: [172.19.112.191] X-ClientProxiedBy: EX19D042UWB002.ant.amazon.com (10.13.139.175) To EX19D014EUC004.ant.amazon.com (10.252.51.182) X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3F9CE4001A X-Stat-Signature: 6p31bmspbqhupgdx8kfxyancobefdyny X-HE-Tag: 1707134764-264053 X-HE-Meta: U2FsdGVkX19fU3H6dB6M7aABOOPTZOwTyZjp+EjJaqIJ8gVAXkqF3eZyluep4U24hQZkes1kVVjqKJkRYuGu3oVSGQHFkRBVmRlxBLWzyW+aVNt3Gm51fFMMoaTNvCVoUp3tBTLhQW8J8HdX3aflHp9tAl0O8YjvkfbfWjzRTm0SX/Ak1C7TnKwnizyf/l8b0XS/vjwKw8BC6hPPtklozaRrOk3l/oJbpya1yLj1ZLQe2gciMqTMBcwP4mRKjWlKzbZKbngA5ZdjaY+QSBEYfREKITcdC8JwyZFpa6jjU2sNI+SBXpwKe6ONUn+LcwqiAveerIWJ5bfutCEFF66MeupXk1KOeY+4Qakawo2Da0PBYrUwYse0c0pTX6qZPqpdosH2hsNY2I61dTfW1UYDQCBAdNnjMGpVBpYQjXnqinNqlYkOIXZeUQijAhw6vEpXfL6QEiarudPuiZ5axvACK4p4ZR6LeciRV+lFElcrNNAtvKAS0ywGotsD1I4b8kXsocr1yahI/WpM0QvkY83Hkaa+3v2Wi+StnOqIBGxbL4+U5+DhHLLgXl5BgBwLPeP0SbWpuNLenzuaTNXepn8gObTQmEaiPWb6514yqmUebxsMnUNsWItQ3KCxDrxk1EY8yXx2slnYeoxD4cCrOArB97psLmNpzWMy8fV6pMQrJ9ayNw8H+GuUqkAqLRsaaI7u9ZGXtePzzyyZkconWVfie7mpWpcnmIbGa16uNekbDdCLfyv178nAKt/SaAc7RUC2qMBeVakdtfWMcqJdpCKH34cO/jMDmK9GywuX2vM4/G+KqVrcspfW5+1v5gTlFIZ01fTLefMIs6HCi3ZpuKLVtJgE3UrU+jlTSj6+va3r9p0LrpSY5vzc2dIirq8CpSb0JEuac2zRlB0ykYtI5WAwI9CXv50intY3YAqCPiMw+8xr7KfbiVshPza+G/m5ofiyBbIBVBOs7DQ4LBTLpvd 5GCmTe2t pzNxmU1sR88xQt4GUXMZpzzOJ8JZHRLlbtImd6WHGqUff1lKywyf34YoCmI+M70K7nPZ+G032Gtkz1GHRbEIBjwuPBKozeuGDLwL/XuOewuw40oBS4gDZuRFV8BDnoq57vyWV6tLR3CRSRxhsNhF2wyISkb/qDoXKMD89/9eekVMxxaX8W4gNRZg7qYQ3kpaHMWLZJAjrDQyDPSiVCcYEEqax5In46JuRihOhrmSBIJ2Oq5GkQ8X4yIH9HFYqK2vF4D9amBAyzBnwyDm6uYsc+K5yMxMOmYGyG6ghO2AnybCgFY8xjxWFV2nQUCxXfObSmHqUQGz8u1HKYgnuMyUMkzT+0lAiChyKgJfUcrI7k4O3d5y7zBmUZjxoq/sKhaRCqYw8i4T035r/kkR1vSexKXmjqqUclVQUT0RJQMTW9gsXgd9kECyJiZDzpEFdhvNLKk3RCEKkbLMLnWT67BKmXbq5pAHIv6wXC3PrrF3rXMvuli+Wvmf1mOBsRseiHHShxkJK1VQHoPTwNJVXeuErNXhCXQueoKzgErySuPjPlLQUnlg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: In order for persistent devices to continue to DMA during kexec the bus mastering capability needs to remain on. Do not disable bus mastering if pkernfs is enabled, indicating that persistent devices are enabled. Only persistent devices should have bus mastering left on during kexec but this serves as a rough approximation of the functionality needed for this pkernfs RFC. --- drivers/pci/pci-driver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 51ec9e7e784f..131127967811 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -519,7 +520,8 @@ static void pci_device_shutdown(struct device *dev) * If it is not a kexec reboot, firmware will hit the PCI * devices with big hammer and stop their DMA any way. */ - if (kexec_in_progress && (pci_dev->current_state <= PCI_D3hot)) + if (kexec_in_progress && (pci_dev->current_state <= PCI_D3hot) + && !pkernfs_enabled()) pci_clear_master(pci_dev); }