{"id":2233109,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2233109/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260505170010.3414074-4-marcin.bernatowicz@linux.intel.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.2/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260505170010.3414074-4-marcin.bernatowicz@linux.intel.com>","list_archive_url":null,"date":"2026-05-05T17:00:10","name":"[3/3] PCI/IOV: Restore initial VF ReBAR sizes on PF release","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"71a2f6a7c1f345287cc92ea26e2c24af78a039f5","submitter":{"id":93334,"url":"http://patchwork.ozlabs.org/api/1.2/people/93334/?format=json","name":"Marcin Bernatowicz","email":"marcin.bernatowicz@linux.intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260505170010.3414074-4-marcin.bernatowicz@linux.intel.com/mbox/","series":[{"id":502868,"url":"http://patchwork.ozlabs.org/api/1.2/series/502868/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=502868","date":"2026-05-05T17:00:08","name":"PCI/IOV: Restore initial VF BAR sizing after VF ReBAR","version":1,"mbox":"http://patchwork.ozlabs.org/series/502868/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2233109/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2233109/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-pci+bounces-53761-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=nfp46g39;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-53761-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=\"nfp46g39\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=192.198.163.19","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.intel.com"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g94bG456Wz1yJ0\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 03:03:22 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 91BA23076A11\n\tfor <incoming@patchwork.ozlabs.org>; Tue,  5 May 2026 17:00:57 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 7C117492515;\n\tTue,  5 May 2026 17:00:56 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [192.198.163.19])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B542492195;\n\tTue,  5 May 2026 17:00:54 +0000 (UTC)","from fmviesa002.fm.intel.com ([10.60.135.142])\n  by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 05 May 2026 10:00:46 -0700","from soc-5cg43972f8.clients.intel.com (HELO localhost)\n ([172.28.182.189])\n  by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 05 May 2026 10:00:43 -0700"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1778000456; cv=none;\n b=hVpP6z21AGqvSUU8W+nta5jF9KyS/E/E3iCUt3PBXvtQjKrVBnH+ovR4WDS8EVB7oz8/RRYfGW9d9kcJudoaxZsl2yEPtysNqM5vPbagNRrBoZfndrOjzwcbFNqzaaDrQRiTs3/wB/ZJbeVg2XX8I0fLMGCJBFXZ1TG53P8U96Y=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1778000456; c=relaxed/simple;\n\tbh=okVOvgMCxSHoJPtegYQ6LZ+tfsRvJYRXGSCdZrkPhto=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=JGbGo0EFcc6se46MW/VZ+ZMg/Ua5KtzWEzZFVu0gnux+hsS/wRJNgmlPXxP7mNghXRN/tEAS7wXOYW0LgijdN6E1C6Fp/SptEpcgkhd8Oe4QDpgqtj/j11YuOlxtUg7iDZbDYjJdjZ+TO1yq0611uJuAT1m6R1pGDSXyxRlKRF0=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com;\n spf=pass smtp.mailfrom=linux.intel.com;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=nfp46g39; arc=none smtp.client-ip=192.198.163.19","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n  t=1778000455; x=1809536455;\n  h=from:to:cc:subject:date:message-id:in-reply-to:\n   references:mime-version:content-transfer-encoding;\n  bh=okVOvgMCxSHoJPtegYQ6LZ+tfsRvJYRXGSCdZrkPhto=;\n  b=nfp46g39wlvJts0/9d55+3FKx+0sfwA2vzFP003hhbZcK67cq+uF+ywV\n   tinWW4YGqgXGeXKZ3dy8/5R9IzXWqxvrZxUZ0KcVB/h1kBtxVATm9XJLv\n   yncRtycviaIMHOK1kwL+YYCIuSIQ9GQqd6+yQ1BkMMbfVb+ZoIpkeTWeH\n   4MsEts+mTjC4LiN7ZxpWKvG0BRfafaUuulgzev43TMPRXjPZgyqbpjhbC\n   VZlzLonsvoxNe0CfCl1DMh9E7Jp9xcqJcWqzF4KE2dPGisoEe209UdyUD\n   zrNPHv6cGVktrajqvSaGdtvZjPiI9x5By37K3TAkvMxqBMFkGB/3/p3CD\n   Q==;","X-CSE-ConnectionGUID":["NnZHVmqvRBWRK/540r5aFA==","dAGCgkHvS4OVuSEubfOTFQ=="],"X-CSE-MsgGUID":["I5xTxPOeQUy3Y8HnGdwhEw==","5sltCDfjT9O/rjMBlKNOzw=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11777\"; a=\"77900557\"","E=Sophos;i=\"6.23,217,1770624000\";\n   d=\"scan'208\";a=\"77900557\"","E=Sophos;i=\"6.23,217,1770624000\";\n   d=\"scan'208\";a=\"259211534\""],"X-ExtLoop1":"1","From":"Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>","To":"Bjorn Helgaas <bhelgaas@google.com>,\n\tlinux-pci@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org","Cc":"Michal Wajdeczko <michal.wajdeczko@intel.com>, =?utf-8?q?Micha=C5=82_Win?=\n\t=?utf-8?q?iarski?= <michal.winiarski@intel.com>, =?utf-8?q?Ilpo_J=C3=A4rvin?=\n\t=?utf-8?q?en?= <ilpo.jarvinen@linux.intel.com>, =?utf-8?q?Krzysztof_Wilczy?=\n\t=?utf-8?q?=C5=84ski?= <kwilczynski@kernel.org>, =?utf-8?q?Thomas_Hellstr?=\n\t=?utf-8?q?=C3=B6m?= <thomas.hellstrom@linux.intel.com>,\n Rodrigo Vivi <rodrigo.vivi@intel.com>, intel-xe@lists.freedesktop.org,\n Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>","Subject":"[PATCH 3/3] PCI/IOV: Restore initial VF ReBAR sizes on PF release","Date":"Tue,  5 May 2026 19:00:10 +0200","Message-ID":"<20260505170010.3414074-4-marcin.bernatowicz@linux.intel.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20260505170010.3414074-1-marcin.bernatowicz@linux.intel.com>","References":"<20260505170010.3414074-1-marcin.bernatowicz@linux.intel.com>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"sriov_disable() and sriov_enable() error paths restore the per-VF BAR\nsizes saved at probe time. They do not cover the case where the PF\ndriver is unbound while VF BARs were resized but SR-IOV was never\nenabled (or was already disabled).\n\nOn the next bind, sriov_init() re-reads the SR-IOV capability and\ncaptures the current (inflated) BAR registers as the new initial sizes\nin iov->barsz_orig[]. The restore logic becomes a no-op for that boot\nand the kernel may reserve MMIO for the inflated VF aperture multiplied\nby TotalVFs.\n\nRestore the initial sizes from sriov_release() as well. At this point\nnum_VFs is 0 (BUG_ON enforces it) and VF Memory Space is therefore\ndisabled, satisfying the precondition of pci_iov_vf_bar_set_size().\n\nSigned-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>\n---\n drivers/pci/iov.c | 2 ++\n 1 file changed, 2 insertions(+)","diff":"diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c\nindex 42b935265b3c..d9e745e23add 100644\n--- a/drivers/pci/iov.c\n+++ b/drivers/pci/iov.c\n@@ -969,6 +969,8 @@ static void sriov_release(struct pci_dev *dev)\n {\n \tBUG_ON(dev->sriov->num_VFs);\n \n+\tsriov_restore_vf_rebar_initial_sizes(dev);\n+\n \tif (dev != dev->sriov->dev)\n \t\tpci_dev_put(dev->sriov->dev);\n \n","prefixes":["3/3"]}