From nobody Tue Feb 10 04:55:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1735977281; cv=none; d=zohomail.com; s=zohoarc; b=RZ36iDijaXEdq+s9aeLGJAZW1AB5oKcielVK+5qfQIWA96ENACMxISdFUh2iOA3YA6oEnWR0meIhb83xHP0WCcvC//zkmpmndJxVorlGYbaCIlogi65AAQEJfZya/aPUTY0SvE4R1uH8f6xBIrI51CSd/4UrM9MgoCofp5TLwrw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1735977281; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Nq5kA+rAx2s39hfKGaHhph3umAuBYnelbLPjqvJGEKM=; b=dAjvnxS5RwYu7uxWl2zZPql71q/U4zNQmsqvLQZ7OX9k5dfdFRsJyDDm8E/U349vd1KllL/Ry6zxYK996YQh6cLvPB1Oc3reol0MtEaLm+8z+Ktp9YgfBZHOJ/owQdKF9iTd0buXv4XocJIUwB8QqvOGP+5MbnL0PDOQsPAIciM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1735977281309666.3087814838325; Fri, 3 Jan 2025 23:54:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTyz9-000368-J5; Sat, 04 Jan 2025 02:54:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTyym-0002f5-6d for qemu-devel@nongnu.org; Sat, 04 Jan 2025 02:53:52 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTyyk-0003AF-Hs for qemu-devel@nongnu.org; Sat, 04 Jan 2025 02:53:51 -0500 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-21628b3fe7dso176373105ad.3 for ; Fri, 03 Jan 2025 23:53:50 -0800 (PST) Received: from localhost ([157.82.207.107]) by smtp.gmail.com with UTF8SMTPSA id 41be03b00d2f7-8427ab7830asm25218874a12.0.2025.01.03.23.53.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Jan 2025 23:53:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1735977229; x=1736582029; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Nq5kA+rAx2s39hfKGaHhph3umAuBYnelbLPjqvJGEKM=; b=AaPG9Ly90LO2wr8OeF904FAJvUeJD+CrSq+lNJAIhSxa+ucNRY8FT81VuqJ9OMNevM 5qwf8u+0wUQEWOrgWuW7M+GKwWP/8MR322u0x69SUIJGB2xuok8mixcbptWnjmeZWXYu cYl04Dq7/lB78hhMU6/TRv1Xt8I/fOvizW29Nis+OiTozoc9cttsDFi7kgALPgzws5a4 iZ+XU3ETg7eg0OrBozkNH3AkSvk6EZJFjdKEHx9P93wtN321R6kj4B6SY0xq0v0T35uG zaW22WemfWzLwgY8CCh8kzP7RTuRhlPMIqc2K7YcFF7LrgBr6ntuvmttCEb+qZ25kWmi pKvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735977229; x=1736582029; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nq5kA+rAx2s39hfKGaHhph3umAuBYnelbLPjqvJGEKM=; b=iikJNvwaqRiWZf9aCMd4Ny7lOUp8jbMjfrjpTrnEAw7pTWHD2Gh2iIRUOSMhcAEHBK EO0k9gTj9fOzkuHakSE2XsDXB4tQQzLJtFfFXqjGUV2NKXuGShlbZtMARo4rAI0h6eYk l56tPjrWSLVr7N+tsk4wao5b21GW70PhIK7icovfqp2ysUxU3UZE+6n+M4RbPDpkrdtL R+8I4w6PnR29GLToH7A1NEshZa4TlhkSD4o9k6kVu9AZkcJmTcbKnqGvQm+vlQ7p9wKl wykDR82cNaadcjEVUPcaUcBSWGvc25p6ceF1RP1tUm5mbF7MG7J/3IEScp0IDSzPh9tZ hEIQ== X-Gm-Message-State: AOJu0YzAKMyK6uCYMFaEOmwnzth268BriwJEveRWq7vTkaSCdS4NCzYc fbd1b/p1Mip5o98YKG7P4SIAOl4XzJ3GoJWtUmz/Ytnjc7G6Uc7FoTQBSkgVJ5o= X-Gm-Gg: ASbGnctiI/lNnhhDaRyS6kONYZgNhwRFmhjyNknus6pnE5bZJeCzq0Vl+WKvhvnqCRG N6IFts7AQK5nwV3sTy569qXwEZjWbfuAgEy0uM/xl40b0WVZiSCDBmDY75ZPTxHj404kRRE1nWq wI3T0tTCAHo7lEck4VYVe4e1aiV58CrNj/RgBvOplpfI/2JGc0OEttDiU11OwdmjXt0Qz53mscJ J38YA3J7O4in1vYKWPaWzY3sC1c+D8uSKKbosogYPFjdtrMWFJ+39dHxl+x X-Google-Smtp-Source: AGHT+IFSA0Cm91Hfo2b9s3W0fbZslWaAHdr0O3a3oYlX+TrKRpvIcZwgspbGH3vxth818ttd96wsDA== X-Received: by 2002:a17:902:fc44:b0:218:a5a8:431a with SMTP id d9443c01a7336-219e6f26013mr809481215ad.49.1735977229290; Fri, 03 Jan 2025 23:53:49 -0800 (PST) From: Akihiko Odaki Date: Sat, 04 Jan 2025 16:52:32 +0900 Subject: [PATCH v18 12/14] pcie_sriov: Register VFs after migration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250104-reuse-v18-12-c349eafd8673@daynix.com> References: <20250104-reuse-v18-0-c349eafd8673@daynix.com> In-Reply-To: <20250104-reuse-v18-0-c349eafd8673@daynix.com> To: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Sriram Yagnaraman , Jason Wang , Keith Busch , Klaus Jensen , Markus Armbruster , Matthew Rosato , Eric Farman , Harsh Prateek Bora , Shivaprasad G Bhat Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, devel@daynix.com, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1735977282449116600 pcie_sriov doesn't have code to restore its state after migration, but igb, which uses pcie_sriov, naively claimed its migration capability. Add code to register VFs after migration and fix igb migration. Fixes: 3a977deebe6b ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki --- include/hw/pci/pcie_sriov.h | 2 ++ hw/pci/pci.c | 7 +++++++ hw/pci/pcie_sriov.c | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 5148c5b77dd1..c5d2d318d330 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -57,6 +57,8 @@ void pcie_sriov_pf_add_sup_pgsize(PCIDevice *dev, uint16_= t opt_sup_pgsize); void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, uint32_t val, int len); =20 +void pcie_sriov_pf_post_load(PCIDevice *dev); + /* Reset SR/IOV */ void pcie_sriov_pf_reset(PCIDevice *dev); =20 diff --git a/hw/pci/pci.c b/hw/pci/pci.c index d769952e89ba..2724297ea43c 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -803,10 +803,17 @@ static bool migrate_is_not_pcie(void *opaque, int ver= sion_id) return !pci_is_express((PCIDevice *)opaque); } =20 +static int pci_post_load(void *opaque, int version_id) +{ + pcie_sriov_pf_post_load(opaque); + return 0; +} + const VMStateDescription vmstate_pci_device =3D { .name =3D "PCIDevice", .version_id =3D 2, .minimum_version_id =3D 1, + .post_load =3D pci_post_load, .fields =3D (const VMStateField[]) { VMSTATE_INT32_POSITIVE_LE(version_id, PCIDevice), VMSTATE_BUFFER_UNSAFE_INFO_TEST(config, PCIDevice, diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 69609c112e31..1eb4358256de 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -248,6 +248,13 @@ void pcie_sriov_config_write(PCIDevice *dev, uint32_t = address, } } =20 +void pcie_sriov_pf_post_load(PCIDevice *dev) +{ + if (dev->exp.sriov_cap) { + register_vfs(dev); + } +} + =20 /* Reset SR/IOV */ void pcie_sriov_pf_reset(PCIDevice *dev) --=20 2.47.1