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=1796172015; b=zO/ChkGYi4ANvwT1Ttj1w5+/mbncx6ly+kMaN8GG/BhjNztfC+Va4xH4PbnGIiq4BNRD fuV5DPt6lfz2g0QwPOWh//L8vPCAelcJQEi0n8MV5THVt3QLXUTROsT5RsJBRiLvJMejo rfO3cAPM6KveqZxcQ9lV4JqQDsHsGArkOTx7Uh+pPKLN9wGmkWIvfaQN5tUx4+KkMxOI7 F9Jsbx4QWgJ0t8i32XgiYvs3F7FHg+qkFKr1lrVufoaCzH7Yhp0rgaNiORFEWvtFPWLI5 W+armDw33p0KfkQ5QEadrpb3u3aRjf3CxR1ZdtuLc0x3CGYHToJH32pYAxf7lUoaTEQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796172015; 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=HjI6Glqo0C4hpJnF22y+ouH2IqeeVDKeE2smEtII5QE484nQDf4hXL/BOGCYMWr/+VOu Xrcqhh1nYfSkfxWb3eQ+z/uL/FLvgQX5HpDZbdm0xfJ7nQ5K+rpgTr97Ol28KO+UBAGHP hZRD2mJwMK1ZNU96G6Myio9napKsrXi9ryBz/ZzOUP+mOY/kg5LRU+zY4fhuxeFJICF0m DBucwBG9sIDz8egojNtll9O2J/Tu8tGeQ9YxdMelAX5HWuclTY5WSv86Dx5wFmVVVeN+/ AHEEhJ0Y3O/sc6HWnlQTS27oSYk2/nHTL06Owg9wRjWXH/2QDwwKsV8Ik437a9RAH8w== 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 8CBAE60A5BC7 for ; Wed, 2 Dec 2026 00:40:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8CBAE60A5BC7 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-4ea2c058e67so13272238b6e.1 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=xJ5RlnBr2ZMORNEhrMxh0NMq4jmGFoDjHWEYniKdw0cJHZdtaVdWzLK+c71hg6Z1ea EzLtf9/44FqCrIiGZu2J+2YNvYCZryKKgepDcis4R55yE5PuJ3dasbDtr+NxvaDxwuZV tWQoQrsjDc5eMfmMH1jY+aAib7U6gjiAqNQEfXYqxJAwNBtqvTMG4XI7bBfl3s3pR0W3 K0m5AIp5APM3cL1kuD+iqQKkbDkZ+2Ne71lf+KavvSkaV+xqnsMfCM+aoLpnarJIn1Hu lsOzrrJrX/TImHTenwQZOnIBUlKvsTW1PMbpiOBlHBN1232hMJrnCMBtKrd2rsWn346P ZF3Q== X-Forwarded-Encrypted: i=1; AL+hErEeHoG4PyoILDgX5RBE4NSzlYOekeyXmkP2iyEn7LY6z0XtlfLF29aDZ4GPlWffstJy20pno2lvVvFH3rA=@vger.kernel.org X-Gm-Message-State: APuU4Z84QbNBLm7iWprEx94CfDn++ladaNPZGta4qDuoS02M4DAfZIQc SR8upo8TDL7bCuBJq29XK8TzqSdpJ6CEgJ+No4D0hzcrv1vq/5O4gPLjIWEFXfy12X8GjOVOLo+ dEpOQnG2X4/Lsbw== 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-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-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