From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.200 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796172019; b=TGF/xbtXBrVid3fwNr1oXBmVUhGTqp57BGePLZ6WWrBLU41NLzFaZ1wE2biIc4CzaYbY diJMeAXAa4kGFeoyWk+jJZ4+5LDEanQejH/g1lNStQ1s16J7ZgKe8Led2G3RgUVFeOK2d 8tq98r5NnlvcVw08rkhQ5X1LcDLxTZBNYDPEAnjl3PqfARcBVUha4KwuDBv/T7WLEUvvY Rkw1bjmHTlUpf9BshGwOXVuMu2B2/UDYo93canOpUfuztEKEBweSGKS98ddJhayOYFyQd 6Go8H5/yrh0QIg/DHBvxh/7rqgzDpCLsYEwjLfdSRioUlxdGrse4U79EpHrJwriMsOA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796172019; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=2QKx4qxrU9yMcBPcsh/FMuZsgvFum41qsAx/MDe4nd8=; b=szL76yVklbRBe9STYhsriq7rgK/lkv7FqHyQgt8qeP6EDbo4jwleTy5gCGbZE1et0BPb pgunV/h9PyU3svVdR94SoyEi3iB7tS6YYtRI+LfmFszd1x1C0Jzjm1uD34WUDFj5HYpa0 xh31rUMTabkxB07bBXNS2GtslKHA5re1NA34heF1oI0BouCSeFfKQEOen/c+8YbGuJytk s5K7emTlyjpgAE5o022o8EEUo6AUIkQOlphZuzwMvo7QSXoI8M8iwpE97raK8cnWvfSCW bVqH1o5Fc6oVzec+SznPzVMLJ3jPM6dkgNnsRxnsUXEnPUME2VDSsUmYpvB9xT8RlaA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=bXODR1Sk; arc=none smtp.remote-ip=209.85.167.200 Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AA76606A327 for ; Wed, 2 Dec 2026 00:40:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3AA76606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=bXODR1Sk Received: by mail-oi1-f200.google.com with SMTP id 5614622812f47-4dab94dc3e7so24694325b6e.0 for ; Tue, 01 Dec 2026 16:40:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796172018; x=1796776818; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=2QKx4qxrU9yMcBPcsh/FMuZsgvFum41qsAx/MDe4nd8=; b=bXODR1SkMgCYef1NdeF0xpfT76SdJwCGbXTEqX0haFS3BoAHimCbFcMpvADgvQszYR YsJi1YS524Ebo0WfIEcsgif4rL+xy/kTl0c2T4+k5Fla+AZT48Bp/wwHRmz46WvSaSlR NWIYOmjVpUyBXWm2A9RL7A0GqsOCqkn9CVfRQXFbMxHw0D0cqLInXKUPWzMsjsn23xDc yhgWuOek8qnpmu0It6T6VIn/ps2dOuM3cYfZPmzYvK9l+gih+72sFP8FWCmdKGLAsEPV 6amHpLDVYQMXsvRLQcv6TdGbN8RdQiVrMDeSG8qBMcOXOA5QIdpN91Aj6vHQ5Mv8fUwL 7kGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796172018; x=1796776818; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=2QKx4qxrU9yMcBPcsh/FMuZsgvFum41qsAx/MDe4nd8=; b=n08I1jKjtTmadk7lf0OVxOYijZ7QJYaH1sxi3M4YyKJiNKQIpA2Un2UUBFl0RQObaC O/2CqVIH+HHL2zJsnf7yaLrkSpQYuBbqUgvbE66ZlcfNmfvFoNk1tMo+3sqK4Cq/4JBY 2BajXtqwEDAYI9XoNDmIoyjKBbv8RgX+tXphVkzjaJfDZRr6lThO1XSjgcIl9PLgeqWp gMPdoDTHTStgCu9kwZ581yei1hMVLTlFRTqfEkX69YQvYWNum25Sl8nib208LR2YkzLZ jalq1G/mqJOY3uoVOMUHc2fod9zqaCyLZQU7vw5VstZNmQkR+aComJ9sNzRgQq7qxDfa pmVg== X-Forwarded-Encrypted: i=1; AL+hErG6aQddt9TEqUq8L9Wj1f+gAT5KeQM9Mpxj521K7MqH8HWSiJtO0tODRDWk3J4uihsWBWnjeajCW2tRDzg=@vger.kernel.org X-Gm-Message-State: APuU4Z8AeXX4YCB5HeEQ3v5AK44ibqgXvuDXUNXsj4mg8YU/bYQqv59q E5tU+88JV5Vl0vPVa6akW6o6VXZB+ZNKvLwQ/uLykU42rpqSX8nInklhjGbVZTlUXG6xclXpej8 ESKCUsTJpG+wnFQ== X-Received: from oigs4-n1.prod.google.com ([2002:a05:6808:68c4:10b0:4e4:5217:b276]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6808:bc9:b0:564:3fe1:2f95 with SMTP id 5614622812f47-57a0c7c26a2mr43062005b6e.56.1796172017946; Tue, 01 Dec 2026 16:40:17 -0800 (PST) Date: Wed, 2 Dec 2026 00:39:54 +0000 In-Reply-To: <20261202003955.3607156-1-dmatlack@google.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261202003955.3607156-1-dmatlack@google.com> X-Mailer: git-send-email 2.56.1.911.g883d8bcb20-goog Message-ID: <20261202003955.3607156-18-dmatlack@google.com> Subject: [PATCH 17/18] selftests/liveupdate: pci: Test ARI Forwarding with pci=noari From: David Matlack To: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Albert Ou , Alexandre Ghiti , Alex Williamson , Bjorn Helgaas , David Matlack , Jacob Pan , Jason Gunthorpe , Josh Hilke , Lukas Wunner , Mike Rapoport , Palmer Dabbelt , Parav Pandit , Pasha Tatashin , Paul Walmsley , Pranjal Shrivastava , Pratyush Yadav , Samiullah Khawaja , Shuah Khan , Vipin Sharma Content-Type: text/plain; charset="UTF-8" Add a PCI Live Update test that boots the first kernel with pci=noari, so that it leaves ARI Forwarding disabled on the root ports. IGB implements ARI, so the next kernel would normally enable ARI Forwarding on the root ports above the IGB endpoints, but it must leave it alone on the root port above the preserved endpoint. Add a -x option to the test so that it can also check that the next kernel does enable ARI Forwarding on the root port above the control endpoint, i.e. that pci=noari took effect. Signed-off-by: David Matlack --- .../selftests/liveupdate/pci/luo_pci_test.c | 35 ++++++++++++++++++- .../selftests/liveupdate/pci/noari.vmtest.sh | 13 +++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/liveupdate/pci/noari.vmtest.sh diff --git a/tools/testing/selftests/liveupdate/pci/luo_pci_test.c b/tools/testing/selftests/liveupdate/pci/luo_pci_test.c index 177562d65e64..4ee6f3a5f307 100644 --- a/tools/testing/selftests/liveupdate/pci/luo_pci_test.c +++ b/tools/testing/selftests/liveupdate/pci/luo_pci_test.c @@ -10,6 +10,10 @@ * -p Endpoint to preserve. * -c Optional. Endpoint to bind to the test driver but not * preserve. + * -x [,...] Optional. Registers that must change across the Live + * Update on bridges above the control endpoint (and not + * above the preserved endpoint): "ari" for ARI Forwarding + * Enable. * -m Optional device whose config space is written to mark the * phases of the test in a QEMU trace of config writes. * @@ -95,6 +99,7 @@ static int nr_before; static const char *opt_preserve = ""; static const char *opt_control = ""; static const char *opt_marker = ""; +static const char *opt_control_changes = ""; /* strcspn(), which nolibc lacks. */ static size_t span_until(const char *s, const char *reject) @@ -112,7 +117,7 @@ static int parse_args(int argc, char *argv[]) int stage = 1; int opt; - while ((opt = getopt(argc, argv, "s:p:c:m:")) != -1) { + while ((opt = getopt(argc, argv, "s:p:c:x:m:")) != -1) { switch (opt) { case 's': stage = atoi(optarg); @@ -123,6 +128,9 @@ static int parse_args(int argc, char *argv[]) case 'c': opt_control = optarg; break; + case 'x': + opt_control_changes = optarg; + break; case 'm': opt_marker = optarg; break; @@ -480,6 +488,24 @@ static uint16_t get_status(int fd, const char *bdf) static int nr_failures; +/* Whether @reg is listed in -x. */ +static bool control_changes(const char *reg) +{ + const char *p = opt_control_changes; + size_t len; + + while (*p) { + len = span_until(p, ","); + if (len == strlen(reg) && !strncmp(p, reg, len)) + return true; + p += len; + if (*p == ',') + p++; + } + + return false; +} + #define check(cond, fmt, ...) do { \ if (!(cond)) { \ ksft_print_msg("FAIL: " fmt "\n", ##__VA_ARGS__); \ @@ -520,6 +546,13 @@ static void check_devices(const char *when, const struct pci_snapshot *taken) check(!(now.command & PCI_COMMAND_MASTER), "%s: Bus Master still enabled on control device", dev->bdf); + if (dev->bridge && control_changes("ari")) { + check(dev->pcie, "%s: Not a PCIe device", dev->bdf); + check(!dev->pcie || + ((now.devctl2 ^ dev->devctl2) & PCI_EXP_DEVCTL2_ARI), + "%s: ARI Forwarding Enable did not change (DEVCTL2 0x%04x)", + dev->bdf, now.devctl2); + } continue; } diff --git a/tools/testing/selftests/liveupdate/pci/noari.vmtest.sh b/tools/testing/selftests/liveupdate/pci/noari.vmtest.sh new file mode 100644 index 000000000000..f72d8add83be --- /dev/null +++ b/tools/testing/selftests/liveupdate/pci/noari.vmtest.sh @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Disable ARI in the first kernel only. IGB implements ARI, so the next kernel +# enables ARI Forwarding on the root port above the control endpoint, but must +# adopt it (i.e. leave it disabled) on the root port above the preserved +# endpoint. + +source "$test_dir/pci/pci_vmtest_lib.sh" + +pci_topology_root_ports + +TEST_ARGS+=(-x ari) +TEST_CMDLINE_STAGE1="pci=noari" -- 2.56.1.911.g883d8bcb20-goog From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7532F606A31A for ; Wed, 2 Dec 2026 00:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=NVRh5puj; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=KgRZMRzn 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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Unsubscribe-Post:List-Owner; bh=ml9BalDW1F9NvDy+6OWbCTYDfPQKUdGcz2Ch5xuxZg8=; b=NVRh5pujOn9jA7qZgi66asbg1A c7prGah0BOKP4lT+uA+bb5Wo5+kBdBMGQ4zPrTBpiltgTYqcUeng/G6W0/MhwDiYrl8qpHbSr+/qa ImcXvuKKjz9sWTebGX7XZRukC1AzHu6zwf0OSI5rhksFB3J+lXv9eKVV2OhQPuMn6wNF2jwVn7kMG JQJ/hpSujZdEcLAL3QUjLwhzAEKmzUlzwFuUn+22FKKgKaIDzf816sglJQKwYqChoEg0+rOjlAMtx OuQUYY0LhRW7nTurKic4jmrOacLWZNoj5y5fk03JZhTTQI1nNVtG4UpgS4U+B6ug8Ij4pKRKugAYb h4wgmpDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYTa-00000009od9-28EC; Wed, 02 Dec 2026 00:45:38 +0000 Received: from mail-qv1-xf46.google.com ([2607:f8b0:4864:20::f46]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYTP-00000009oaB-2YI5 for linux-riscv@lists.infradead.org; Wed, 02 Dec 2026 00:45:36 +0000 Received: by mail-qv1-xf46.google.com with SMTP id 6a1803df08f44-921246186bfso241872596d6.0 for ; Tue, 01 Dec 2026 16:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796172325; x=1796777125; darn=lists.infradead.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=2QKx4qxrU9yMcBPcsh/FMuZsgvFum41qsAx/MDe4nd8=; b=KgRZMRznrWur4shMJAiDjRF7vk845Hjd/u7e91qTR7Olx9VVB2ytCfgRdP+n9Wx/or wra2tSfGsYF1Qibjm5UNU/6yimrCu5zZz6ElVSd4mCirLknVua++jy1/aJrp0g15SxCr U/IwxoCleZOysVM5MPQHkO9Lm7/GxwbubhKebr8xSBXjD40aXhb+l+s0mFahhEDf3hB6 88gTpsHdGG/yuFGcKncdhVny54Uw8CqZA64B1rk7/DSY//JvtXKEB8riu6T4x2uHLRLb GPWawAJFu88Amflj1Br+Ddr9HYbR/QoW8fqRqC6QLfPSrpqDDGtwRGNAbuDO/6vvHpQq 1eVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796172325; x=1796777125; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=2QKx4qxrU9yMcBPcsh/FMuZsgvFum41qsAx/MDe4nd8=; b=mhjWFoacLHwNCM6HS9YUEMNSL3SpaaRDVASLz7KqBKaesjTC/U7Qg7b0ng+xa5LCGX L46LVmEMDNnCkgnxnCYrdUFKCAcvSq9I/NpngtrtyyFCWtgKHwRjSKTAhpQ1s1oAd2h+ vwYThXrcE0yAZkeRPVqmJiYlHp9oiSCj/XFQm7Zmf2HVDy+V9aZTaKNBFIvIUCgmmlRB VTBZYDMoxoOSRZH7B2YteD8CYRfIDwQEkJcwFhjaNx2isPGBD7fKJ/3clvNeOSmEOooD gGT39Le3N3y4AcZQELoxpwE/wTuN8L5muLmiAaQFP24dM2wbf2g2G+gkqN4X+Lm0mlq5 nv1w== X-Forwarded-Encrypted: i=1; AL+hErHiSakIsalRiUdQDo11MGoFqMqod86/rsELlEJRW19dRzUXQwLOowfbi3Lzw0Q0kLkqIu9Cv9s04N373w==@lists.infradead.org X-Gm-Message-State: APuU4Z/TezJzp9v5ZZtNbFtI4HkuX0nhnpx4/godKUZPB7xnBcDn5r46 vYCWn5/uFngkgsMIp6wzYB0sa0ZkH05zUPzk11mL29t51sylwAjmVkyIvI53GHyLSB1yuYj/Dw2 56YFdJj9j6wGS7Q== X-Received: from oigs4-n1.prod.google.com ([2002:a05:6808:68c4:10b0:4e4:5217:b276]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6808:bc9:b0:564:3fe1:2f95 with SMTP id 5614622812f47-57a0c7c26a2mr43062005b6e.56.1796172017946; Tue, 01 Dec 2026 16:40:17 -0800 (PST) Date: Wed, 2 Dec 2026 00:39:54 +0000 In-Reply-To: <20261202003955.3607156-1-dmatlack@google.com> X-Archived-By: Mime-Version: 1.0 References: <20261202003955.3607156-1-dmatlack@google.com> X-Mailer: git-send-email 2.56.1.911.g883d8bcb20-goog Message-ID: <20261202003955.3607156-18-dmatlack@google.com> Subject: [PATCH 17/18] selftests/liveupdate: pci: Test ARI Forwarding with pci=noari From: David Matlack To: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Albert Ou , Alexandre Ghiti , Alex Williamson , Bjorn Helgaas , David Matlack , Jacob Pan , Jason Gunthorpe , Josh Hilke , Lukas Wunner , Mike Rapoport , Palmer Dabbelt , Parav Pandit , Pasha Tatashin , Paul Walmsley , Pranjal Shrivastava , Pratyush Yadav , Samiullah Khawaja , Shuah Khan , Vipin Sharma X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_164527_677988_AC55B134 X-CRM114-Status: GOOD ( 20.84 ) X-Spam-Score: -9.5 (---------) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Add a PCI Live Update test that boots the first kernel with pci=noari, so that it leaves ARI Forwarding disabled on the root ports. IGB implements ARI, so the next kernel would normally enable ARI Forwarding on the root ports above the IGB endpoints, but it must leave it alone on the root port above the preserved endpoint. Add a -x option to the test so that it can also check that the next kernel does enable ARI Forwarding on the root port above the control endpoint, i.e. that pci=noari took effect. Signed-off-by: David Matlack --- .../selftests/liveupdate/pci/luo_pci_test.c | 35 ++++++++++++++++++- .../selftests/liveupdate/pci/noari.vmtest.sh | 13 +++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/liveupdate/pci/noari.vmtest.sh diff --git a/tools/testing/selftests/liveupdate/pci/luo_pci_test.c b/tools/testing/selftests/liveupdate/pci/luo_pci_test.c index 177562d65e64..4ee6f3a5f307 100644 --- a/tools/testing/selftests/liveupdate/pci/luo_pci_test.c +++ b/tools/testing/selftests/liveupdate/pci/luo_pci_test.c @@ -10,6 +10,10 @@ * -p Endpoint to preserve. * -c Optional. Endpoint to bind to the test driver but not * preserve. + * -x [,...] Optional. Registers that must change across the Live + * Update on bridges above the control endpoint (and not + * above the preserved endpoint): "ari" for ARI Forwarding + * Enable. * -m Optional device whose config space is written to mark the * phases of the test in a QEMU trace of config writes. * @@ -95,6 +99,7 @@ static int nr_before; static const char *opt_preserve = ""; static const char *opt_control = ""; static const char *opt_marker = ""; +static const char *opt_control_changes = ""; /* strcspn(), which nolibc lacks. */ static size_t span_until(const char *s, const char *reject) @@ -112,7 +117,7 @@ static int parse_args(int argc, char *argv[]) int stage = 1; int opt; - while ((opt = getopt(argc, argv, "s:p:c:m:")) != -1) { + while ((opt = getopt(argc, argv, "s:p:c:x:m:")) != -1) { switch (opt) { case 's': stage = atoi(optarg); @@ -123,6 +128,9 @@ static int parse_args(int argc, char *argv[]) case 'c': opt_control = optarg; break; + case 'x': + opt_control_changes = optarg; + break; case 'm': opt_marker = optarg; break; @@ -480,6 +488,24 @@ static uint16_t get_status(int fd, const char *bdf) static int nr_failures; +/* Whether @reg is listed in -x. */ +static bool control_changes(const char *reg) +{ + const char *p = opt_control_changes; + size_t len; + + while (*p) { + len = span_until(p, ","); + if (len == strlen(reg) && !strncmp(p, reg, len)) + return true; + p += len; + if (*p == ',') + p++; + } + + return false; +} + #define check(cond, fmt, ...) do { \ if (!(cond)) { \ ksft_print_msg("FAIL: " fmt "\n", ##__VA_ARGS__); \ @@ -520,6 +546,13 @@ static void check_devices(const char *when, const struct pci_snapshot *taken) check(!(now.command & PCI_COMMAND_MASTER), "%s: Bus Master still enabled on control device", dev->bdf); + if (dev->bridge && control_changes("ari")) { + check(dev->pcie, "%s: Not a PCIe device", dev->bdf); + check(!dev->pcie || + ((now.devctl2 ^ dev->devctl2) & PCI_EXP_DEVCTL2_ARI), + "%s: ARI Forwarding Enable did not change (DEVCTL2 0x%04x)", + dev->bdf, now.devctl2); + } continue; } diff --git a/tools/testing/selftests/liveupdate/pci/noari.vmtest.sh b/tools/testing/selftests/liveupdate/pci/noari.vmtest.sh new file mode 100644 index 000000000000..f72d8add83be --- /dev/null +++ b/tools/testing/selftests/liveupdate/pci/noari.vmtest.sh @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Disable ARI in the first kernel only. IGB implements ARI, so the next kernel +# enables ARI Forwarding on the root port above the control endpoint, but must +# adopt it (i.e. leave it disabled) on the root port above the preserved +# endpoint. + +source "$test_dir/pci/pci_vmtest_lib.sh" + +pci_topology_root_ports + +TEST_ARGS+=(-x ari) +TEST_CMDLINE_STAGE1="pci=noari" -- 2.56.1.911.g883d8bcb20-goog _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv