Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.198 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796172016; b=jYgeWxvQJXMNIFxTMqRcp8YMc8aEQC8rRbFQ6SGmv9ftPCtHN7tK2el0Fkk/3kY3q9PJ YZq4KOrGGOkRtlhQiULvW8t0ZS0KNm8qvO9L51ZJRTx79zm6Ic7u5kCnAeTyGdNC+TesU B3n8DN1EQ2vegcyHHqDCXlcv50eG/9R+W3gsSXfEbPoud+W5j0f5rXK3T7A0NyPvcs2EZ tzwHGOKTRLraZD98hnYebVmRU47OZ0nv2GK5DhC2mOzXs8OOgIKp0zUaeJABLAql3qq9R l0p5fAx0i754qXY2Gy8oy1LstyQpQeVJZ/D7KXlOnrHIQFT/OW3WBEbTt17W1hlkGBQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796172016; 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=gu0LIhw6D/dcchGaIz3/X0Mmd3W5kZ2V4EslCoJR1YQ=; b=BsIgDG88LW84xWkLo7602xX8sIdVvsdxfMg+DeaJx8Mt7wik4+eui+x6Hh6JslFrP73X qI8S/EEJurEpG/wg4RaS4D+23o/2nAAnlE9UgMfYx/WEaPsL1hUeAzdKuq0+IQWQlIOt1 Ss3IGVXQ9Oqbqek+iQ5hgpHlUuKEGjeZiGnfd2ue09BSBDEXrDA6PVbA9FVnVXAWutvDG vYY/Z4UGEcnLK4khLAp0vjVkUE1ZxHGUnfQhCY3hueGBX410+XCPw2Ev+cuPX8L91ecjm eAVlkwHhcBfeJigHJSyAQrCiXfxSy94Um31KJ3IRzHBoGjxZgrBGcqvQdu4KcdaozWQ== 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=iBZvDG2W; arc=none smtp.remote-ip=209.85.167.198 Received: from mail-oi1-f198.google.com (mail-oi1-f198.google.com [209.85.167.198]) (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 C412860A3837 for ; Wed, 2 Dec 2026 00:40:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C412860A3837 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=iBZvDG2W Received: by mail-oi1-f198.google.com with SMTP id 5614622812f47-4c467e19391so17401046b6e.3 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=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=gu0LIhw6D/dcchGaIz3/X0Mmd3W5kZ2V4EslCoJR1YQ=; b=iBZvDG2WTRIyoitmunftuSzMigDMBye+q9fCzXFwh3IG19BJQqHCRjfs2ZCl5yrvfJ 8gSPvhl0RvRfaAp+lPv8/Tpbx8vBJwmMlOrFb6EOzfkvPOLc9U91byGUIY/FzsYBSbyE SGZFoDcHyq2OIO2JSicH4Y0y/IEEKQayUIYQn7BsoebYmKOlTKrQugFCb7Erd75uQobm RjxcTVJmK0FG6faMGeTSQKLIEkyDKT9iM+2G7+XcOzZEkkSGU+Xy6eJe7ra9x/A+RXn7 iNbT3VuNBWXOGOpcCIm+2348qABDAJN7U4Ze9O5odSQvK0vmcb/v1PQDxbkf2s5ijKiq NQFg== 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=gVYyj2qqijDVzZdGSpyy1MyAIMn6bV8aor1Eomj70Lft89v0TOHtGXhqw+sbsJB/vF NGfPRGA9bHbJkdlzl2Id9mQS6ncozoXEQK01Q2GtVlGUAWHhHRRRgNHUpL+ogiK16cY4 PmQPqVDB5iJNeSqtNQA+r3Ynu1vP52O0Sksg6pc0S2y07lbADleUGtOeZ/guP9x4IJ2e WEEWcdvdF/JD3KADmP8aKhO/TDgoImXFjrTUiG8Qd6wTc2Xb+yo7jDDhRBy+DBkvz67o sjDKNxApz5WjlaPEDljMIYs2rJs1YZ/scc1e46yo3tAPRjUdAps3IVInuiGakRPtLNBp R7+Q== X-Forwarded-Encrypted: i=1; AL+hErG7bLdSk/cj9i/Svoc0W+I32pWOEkjMZBLoWcq39CcJnkHi9UzPA695+FPJVw1pIq7TlzTLbWQpEZt1xF+3gSk=@vger.kernel.org X-Gm-Message-State: APuU4Z+QWj5YKLIxF25cu5QL9IlqdL4iLN7VUnhl0jGdPm7gGbD2Ve1x chGhRHhk9UYjm/7VgIWm0LtecwqWDWo2lWCOLwnla2VtBWqkdrW/wKaRGFLm8Ugf/fIjOM+atsj xs80B3LdlRg7h8g== 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-Mailing-List: linux-kselftest@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-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 Content-Type: text/plain; charset="UTF-8" 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