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 B6B98606A32E for ; Wed, 2 Dec 2026 00:40:46 +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=b21wQfWQ; 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=hX55z/lN 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=jxNfDckdLLKGEh7HCEO0kZEgVDRovmoUfiKPkbbkTo0=; b=b21wQfWQM0jR5nrCMzhvXSf5vH QO5nL+raubkCLhXMgeNYyENUhok9VhDPY+z1LZELzxWDoFpJpa0pf879RmSGJ5u2zJkkloLiZ788q S1jAkwmOuyiW1mUn76o6za2Prx5ix5uvnZZL1AgygauLTapuKZKrqc/kyXzBACBtfjk65nIPqsq// p4jk1A2YR3WusjX3/RqO1Hq/sl0HqRxWgrGCBFGHK/H8isai2IEFXL9UxjHZ63kiv0fGaPazikCx0 tMl2zvKs1m21jqQqBD+Fk5tXW7YYK27oOKwd5yRnNoeN05GdGUg4NfkXFU+zH5n4/5Mpz3sV9eaiB v/z3zv8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYOn-00000009mtB-0GeF; Wed, 02 Dec 2026 00:40:41 +0000 Received: from mail-ot1-x347.google.com ([2607:f8b0:4864:20::347]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYOO-00000009m7R-0Wro for linux-riscv@lists.infradead.org; Wed, 02 Dec 2026 00:40:19 +0000 Received: by mail-ot1-x347.google.com with SMTP id 46e09a7af769-862a543c4bcso12705891a34.0 for ; Tue, 01 Dec 2026 16:40:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796172015; x=1796776815; 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=gu0LIhw6D/dcchGaIz3/X0Mmd3W5kZ2V4EslCoJR1YQ=; b=hX55z/lN7iO1slmRGITi9aqwzkWYdH95qTQ+t+pwf+u9aNIzPsmeYoALtI6P7oUxnU tQclDpCCitdv9wBANe+/KKZ0L4yKN7xbT/2ID09yn/2cPgYvgsruVrn8dnR2XnwIPP77 GKe4Ic59wR05iqiEqNlbG35NLHlrsAwdn7DqcccGSiNib4aTJLSwMqJxJW6rzWbdiNJo YKD75aGgScHVVx/2/8QNH4o8yR+0ZXJ0iMTFdQ82mI4L3U6HEL4wovOJ/pbx048Kgvh8 5IPDuLya+Q79iknN5dWG64gUFUAUbTh6e/nPXGR18OmKv+bw7ibLlAPdub5q7sRDKavJ FvBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796172015; x=1796776815; 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=gu0LIhw6D/dcchGaIz3/X0Mmd3W5kZ2V4EslCoJR1YQ=; b=V8r62nAAXOx12hFK+BXlSpkNzWJ4rLwkkE0O845jdTtGCn2urxYnPfBBnLjdoPPyws Y4zMdsLyc++NPhF7FUBpX+h30INNzqFwxsaxJv1kav5hVPqnJxQ4/SLHeTA7dKk/R6Ik EzSGu/4aH89RqD5oUTonLZN9ahJBsZF3SJQHxk6Wed/sv/K08Y4EVan0PrRw4lhuKMW7 TjT4neBzcnU6b7DNdVvlH0nexGgVAFMizCe8xfhm9V1J5iwERr2wy+QYo039E3yjv0IY k4S3hN1XmwkhC4ORlx7Qhp1jaempQ6DgwTNj1PlcGqnwEPVKedptkq6tUoVVl3426THi KWEw== X-Forwarded-Encrypted: i=1; AL+hErFmtu7p9I15IqNq5cVmPROB6y9kd/gl+geog97Xul1InP5Sq1oDcTjF6qZTNxOORhlFPmOSnGcrQFJosA==@lists.infradead.org X-Gm-Message-State: APuU4Z/PCJY+jlCVNwKfF7/Km0vmFVMSFU7rmtycfHgU7T26ZZVjITYI wScY5spe/rD8TSixTyS42hyNGDivOMWCY22T59INmNUABWZW9ZJd8EEAc7W8g+c7GEBFcvgggnb a2tyTVQ+enPtiaQ== X-Received: from ilei19-n2.prod.google.com ([2002:a05:6e02:61d3:20b0:527:6c83:1a6d]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6808:c166:b0:523:dee6:7ae0 with SMTP id 5614622812f47-57a0be9d81emr36354074b6e.58.1796172014503; Tue, 01 Dec 2026 16:40:14 -0800 (PST) Date: Wed, 2 Dec 2026 00:39:51 +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-15-dmatlack@google.com> Subject: [PATCH 14/18] selftests/liveupdate: pci: Add a test with an endpoint below a switch 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_164016_270247_DB2E8FD5 X-CRM114-Status: GOOD ( 14.37 ) 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 preserves an endpoint below a PCIe switch, next to a control endpoint below another downstream port of the same switch. The root port and the switch's upstream port are shared between the preserved and the control endpoint, and so must be preserved. Add pci_switch to build switches, and pci_topology_switch for this topology, which later tests reuse. Signed-off-by: David Matlack --- .../liveupdate/pci/pci_vmtest_lib.sh | 29 +++++++++++++++++++ .../selftests/liveupdate/pci/switch.vmtest.sh | 8 +++++ 2 files changed, 37 insertions(+) create mode 100644 tools/testing/selftests/liveupdate/pci/switch.vmtest.sh diff --git a/tools/testing/selftests/liveupdate/pci/pci_vmtest_lib.sh b/tools/testing/selftests/liveupdate/pci/pci_vmtest_lib.sh index 5babeb19fbc1..3038cc4ca53f 100644 --- a/tools/testing/selftests/liveupdate/pci/pci_vmtest_lib.sh +++ b/tools/testing/selftests/liveupdate/pci/pci_vmtest_lib.sh @@ -47,6 +47,22 @@ function pci_root_port() { TEST_QEMU_ARGS+=(-device "pcie-root-port,id=$1,bus=pcie.0,addr=$2,chassis=$PCI_CHASSIS") } +# pci_switch ... +# Add a switch below , with one downstream port per . The +# downstream ports are devices 0, 1, ... on the switch's internal bus. +function pci_switch() { + local id=$1 bus=$2 i=0 dsp + shift 2 + + TEST_QEMU_ARGS+=(-device "x3130-upstream,id=$id,bus=$bus,addr=0") + for dsp in "$@"; do + PCI_CHASSIS=$((PCI_CHASSIS + 1)) + TEST_QEMU_ARGS+=(-device + "xio3130-downstream,id=$dsp,bus=$id,addr=$i,chassis=$PCI_CHASSIS,slot=0") + i=$((i + 1)) + done +} + # pci_igb [] # Add an IGB endpoint at device (default 0) on . function pci_igb() { @@ -80,6 +96,19 @@ function pci_topology_root_ports() { pci_control 0000:00:03.0/00.0 } +# pci_topology_switch +# A switch below a root port, with an endpoint to preserve and a control +# endpoint below different downstream ports. +function pci_topology_switch() { + pci_root_port rp1 0x2 + pci_switch sw1 rp1 dsp1 dsp2 + pci_igb igb1 dsp1 + pci_igb igb2 dsp2 + + pci_preserve 0000:00:02.0/00.0/00.0/00.0 + pci_control 0000:00:02.0/00.0/01.0/00.0 +} + function test_check() { python3 "$test_dir/pci/check_cfg_trace.py" \ --serial "$workspace_dir/qemu.serial" --trace "$PCI_TRACE" diff --git a/tools/testing/selftests/liveupdate/pci/switch.vmtest.sh b/tools/testing/selftests/liveupdate/pci/switch.vmtest.sh new file mode 100644 index 000000000000..5b851ddf0b2b --- /dev/null +++ b/tools/testing/selftests/liveupdate/pci/switch.vmtest.sh @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Preserve an endpoint below a switch, next to a control endpoint below another +# downstream port of the same switch. + +source "$test_dir/pci/pci_vmtest_lib.sh" + +pci_topology_switch -- 2.56.1.911.g883d8bcb20-goog _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv