From mboxrd@z Thu Jan 1 00:00:00 1970 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=ahVtlEtNnvTiENMZf3CyESCabXD1Kw5/+ApTANgxaWYiIUKkLWH0TKa+V+gJoOvvykvX rRc3fa9jQzEdTxRs4mDoHm3qpzZNQokvxdjA84Wemm7ZKORKUB0fKmgZx42o6hVxF77ky bcvkSyvsEm8LC7XYmZR8vH3Id+tSnXv3AZGw/8T+BA5TcHpjmT/MyYVT03O7OyTsxWK+O Cw4ySGHUrH6WRBywU/9j0PN3IUOzvbh+OB36t8WWBI4RZ7uxbdTozOay2PMCmGH4KPcmY OgBs5Wu3F6plBnPFIhYipY9bb5TL9HCZ+rNgsxkNb7VeWBG3jCQ3gUkrRgp5BX/QCqQ== 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=2Buf7jb1MOpnohid/FEe2o4GCvjzFbKNsS1GkgCnnPJy1QEkryZ3Z9dqZEnNdalFQCzo A9MGuHpnUcY6F1vYoPOE5YdcluTMdhjtOGvQCCyqnAsGHlOV+U6fHc5UUkzxSRcrWjnGz NWiUqStdFzelSVJ8NA+n1+xh3UcmPUIzaKQWJJT3AgXk3fOrOO04riYe0j4Q9OWMC/uHb HyKN3ZkDMSTb7KD1gI98PWoFs1dbnOfRaaOUwx1NPoja8zcbWZdPnYPKBxeI+EQf1Dc26 PT5wU3WB+A3Vma7Mb4yaZDInw+D7gd2ol+FxvUs6CxKK/lz2PkIk1OY6gBAH7EEWHvw== 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 A000560A3838 for ; Wed, 2 Dec 2026 00:40:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A000560A3838 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-57ea02bd004so3450100b6e.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=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=BXSlfVupwwK57La4drkK39TWAXMfnjY1capFtdmu59wnoaFNIAawyH3CY5lMC6TY13 EdBek6qs/fnhWhJbxsfutmOmbe2tufd7f16USaBUNCEBXVzxO/3xpzv36+xxPUr5KR1I PbAtpOfOC4un1oGgRjtkmDzbt6BCU+Kdy8Ozu3SUkVZKdSXEotqi0/0sTerXdpicLFop xJpq17W+zrphWIkkIZc0isXDjJlmjT4WDwuRtjPdRYWL10fzPE7+9kFkrnjnM4X95bnE vrp9FGXFvvidEbe98Mgu5gQ1kb1DQvLaWuXVFEpn69MfZa4V0nK43vaipg75nUxiB+jT zwWg== X-Forwarded-Encrypted: i=1; AL+hErEsiY4sD2cEeHQCwUp+lQyvuBa+6L7SBUHDvYMbaodvXDa0G/LC6CpDBeAPaQyrWaLO2/ZCzxjlZFU=@vger.kernel.org X-Gm-Message-State: APuU4Z+rlnqRiEojyjMdla0KE8X+jlBbu+Tm3kSLzplVBAuZ4A0Fv5z+ SXHhAsIKe3x9ssOTVFJWsXlRwbb7lZV+EsR3i9bmN9BroBKWUj9UNSaa5zbzsUCugPTVHJOLEJ0 grVPf+nqodWANHg== 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-pci@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