From nobody Sat Nov 23 17:54:47 2024 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=1731924961; cv=none; d=zohomail.com; s=zohoarc; b=M6cPEIPSFYkgG6WKhspIGQKG9FxEH2iLMh5V4ie9jXKBBK0riFEmytKGrtawILuYE4tJdYL4gU6xoVr4qxzO5FdBf9U5N/7J7781/EBHLlsadLrSKXoQz2GGAj4/Y6futJLJ+Addc/dwC4TpkL3Nzzt77FCxORY5z1NehQqioIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731924961; 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=eoIJIsnvFSmFZxfkto+eSSz3zEqn6zFD3WOe+enxcsk=; b=KP8Qc0a0LY0S0TuwbH5ApUIecrSYk+GTp6m6Rm2jufvVEqs+Rvn4TYzu8zlC4lryXtYrBxjfgS4DFX+enN8WJCizP42TBfJPantfg3VGj9m0vmcSmqKwH+PYvDgBdS6DOqmCXG1W45gVvH7BRvcWUmo5JV4/BqytmiSUwlRVkaM= 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 1731924961211952.7267708528029; Mon, 18 Nov 2024 02:16:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCymt-0005MQ-Oo; Mon, 18 Nov 2024 05:15:21 -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 1tCyml-0005KH-0c; Mon, 18 Nov 2024 05:15:11 -0500 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCymj-0008JJ-0E; Mon, 18 Nov 2024 05:15:10 -0500 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id D84AE114019B; Mon, 18 Nov 2024 05:15:06 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Mon, 18 Nov 2024 05:15:07 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 18 Nov 2024 05:15:05 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1731924906; x=1732011306; bh=eoIJIsnvFSmFZxfkto+eSSz3zEqn6zFD 3WOe+enxcsk=; b=AbI5Eh5gsxlXDeeJxVLVe8MqoKTBLKSlM2F347mvpNLAtDMS g0aBQjUOYn2IdGXY6vj9bmun2xzoDnqqiMNPWfSG1twKdPa2Hz1PEG8M+twbQ8NB L9KgvhmWnsUThvEV8yE1dtbPoTthnSbCbCOh2AA65Ewi2Txwu0sdXlCXp9fVsUCd N87r8dF0Yx0bkNdOqfV6CvRHwLzWd373E+LeBiiTIWoc3aYqnbMZxghLWie+6NV2 U/MZAQy9YrCvUy0C1/9GFChuu8S2yAjnOoNDug0pKOwC5yjja5wTWlCqkjisBVBN 5LixriF+Yxhc4tK51d/4fmESEzSY4n1Z+Qj4MA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1731924906; x= 1732011306; bh=eoIJIsnvFSmFZxfkto+eSSz3zEqn6zFD3WOe+enxcsk=; b=N vTVA9TvHGCI7Il99oiyx1jQC9Yzt4u6Kdp+PQp8dTbWwEmvDDmgR6Sqa+FlxbEfx yutUu2ZofJBEhbGrR031JLsGmjzWeaS2opAPdnfvr4kHtJPVYFrNR2SG/8ps4EV+ r7AeVwCa9rHluWOelfSM5ooZ5ZoxWf0Alg5fIwY4mwvKhgVgiiq7XTD4rLObRNjl wXDXmpzPke2ugbHqQCT3Mq18wg7qrl/Z1tgGv96H3h/wtnMsmAPlRMu2Vl6naV7k YoX6aVoTseJ7Hem7Oymzmy+zgs27QgGwZTLaJr3S8YLZauCRKqDqUAzeGozY5HOH XTq3rtk0oqT5mNwBzsagA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrfedtgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeen ucfhrhhomhepmfhlrghushculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrd gukheqnecuggftrfgrthhtvghrnhepkeeivddtueehffefuddtleefkefhiedttdduveeg gfffieetveffhfehgfeghfffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepihhtshesihhrrhgvlhgvvhgrnhhtrdgukhdpnhgspghrtghpthht ohepjedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepfhhoshhsseguvghfmhgrtg hrohdrihhtpdhrtghpthhtohepihhtshesihhrrhgvlhgvvhgrnhhtrdgukhdprhgtphht thhopehqvghmuhdqshhtrggslhgvsehnohhnghhnuhdrohhrghdprhgtphhtthhopehqvg hmuhdqsghlohgtkhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepkhgsuhhstghhsehk vghrnhgvlhdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurd horhhgpdhrtghpthhtohepkhdrjhgvnhhsvghnsehsrghmshhunhhgrdgtohhm X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen Date: Mon, 18 Nov 2024 11:14:17 +0100 Subject: [PATCH for-9.2 1/4] hw/nvme: fix msix_uninit with exclusive bar MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241118-nvme-fixes-v1-1-02d107dbdcc0@samsung.com> References: <20241118-nvme-fixes-v1-0-02d107dbdcc0@samsung.com> In-Reply-To: <20241118-nvme-fixes-v1-0-02d107dbdcc0@samsung.com> To: Keith Busch , Klaus Jensen , Jesper Devantier , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: Klaus Jensen , qemu-stable@nongnu.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1120; i=k.jensen@samsung.com; h=from:subject:message-id; bh=luAZmVRl988Fk2UCy4nTP3G7adYdvITDIx52Hx/vg+M=; b=LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpvd0o0bkFGdEFaTCtrQTBEQUFvQlRlR3ZNV zFQRGVrQnl5WmlBR2M3RTZUaHFKYzZRcnRWV1BDWnNlby9sQVVDCjFtdjllS3gxNTUwd3JkNFVG UlIrZzRrQk13UUFBUW9BSFJZaEJGSW9NNnAxNHR6bW9rZG13RTNocnpGdFR3M3AKQlFKbk94T2t BQW9KRUUzaHJ6RnRUdzNwTEtzSUFMSUs4QWZ0ME9pTGh4bzhRazI3RWxhWXVqK2JLdnpNaE14bw pNZnhIRjV6TFJjRXNNVTB0cHZTYUpaMnF5UktmQ2FzdGtETFB0OUtPb2MvNWdjK1lmZk9TSlhuN 0tFQW9qVC9jClY3Rlg0ZCtxZVR1Uk1saUQ1bGY1V1B3QWk5OW15M01pVzV6MzB5dGEzRjdWQWtN WkswYVBBNkU1S0dkTy9aNTcKcHVzV1FLazNOUG9CUzlPRGM3eGpkZjkvM2xwNVpscnRKNGxJSit KZTd5OGFDUmgwTlJyUWt4S2pUZGVmUDNnVAoxd0QyNldlVE9lZGhvbVVFQzlXT2NGN3JlQVNocW F2OWF3Z0pMVGIwdmJCODFoOVhZaVpsWHV1d3ZMcmVOWkFsCkxNMVlQVDZkZGpsSWp6U1Q0MTF0d FpKNy8vZlRGbDlXV3JNU2wwUzQ3TlZ6Z2hacFRLZW9wS1pVCj04cGgzCi0tLS0tRU5EIFBHUCBN RVNTQUdFLS0tLS0K X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 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=202.12.124.147; envelope-from=its@irrelevant.dk; helo=fout-b4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 @irrelevant.dk) X-ZM-MESSAGEID: 1731924964508116600 From: Klaus Jensen Commit fa905f65c554 introduced a machine compatibility parameter to enable an exclusive bar for msix. It failed to account for this when cleaning up. Make sure that if an exclusive bar is enabled, we use the proper cleanup routine. Cc: qemu-stable@nongnu.org Fixes: fa905f65c554 ("hw/nvme: add machine compatibility parameter to enabl= e msix exclusive bar") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 69bce20f6692b48ae162ad948b1a3eef31d69ebd..13898d58278ed2155d45a9120fc= 07ea60bc64a32 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8904,7 +8904,12 @@ static void nvme_exit(PCIDevice *pci_dev) pcie_sriov_pf_exit(pci_dev); } =20 - msix_uninit(pci_dev, &n->bar0, &n->bar0); + if (n->params.msix_exclusive_bar && !pci_is_vf(pci_dev)) { + msix_uninit_exclusive_bar(pci_dev); + } else { + msix_uninit(pci_dev, &n->bar0, &n->bar0); + } + memory_region_del_subregion(&n->bar0, &n->iomem); } =20 --=20 2.45.2 From nobody Sat Nov 23 17:54:47 2024 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=1731925015; cv=none; d=zohomail.com; s=zohoarc; b=JV+hHM8ax9TQpn8ibvryjD6HKrG0sWxybeL1wR8x5FiESz36IZTtSFbhzeRFWFPejbJpdyUSUirIwLi67VKIKZbw1YNHM/1hp5cU8Smc5yObNkzuZbdDAmjo2lu6ESoeWU3tBf/kklQngY/ztZ3U4sCeD7ljbrvAsIVtANpcEqg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731925015; 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=wn0FDtj1v/m1iBQtnIW92oDW3NoKo76q4MrOju+Mbr0=; b=NDN0nYrk8pu7JSzLLVjQixbWhvgYnGuIKvcvGMguKOaUrlUSkE0qK4Q/90MmIzfYXOxHoLK3Olbv8E42EIZ8YAvGDA33jagyWedAZF8udsK2S6WCWR2T73f3qm7POD/g/J58lfAQj0W0MnkPZNccqvsmSD2dSxkNNW/GIWMg+cw= 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 1731925015862676.9009666901568; Mon, 18 Nov 2024 02:16:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCynT-0005Xp-3u; Mon, 18 Nov 2024 05:15:55 -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 1tCymm-0005LQ-GE; Mon, 18 Nov 2024 05:15:12 -0500 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCymk-0008Jf-OC; Mon, 18 Nov 2024 05:15:12 -0500 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id F0DE32540169; Mon, 18 Nov 2024 05:15:08 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Mon, 18 Nov 2024 05:15:09 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 18 Nov 2024 05:15:07 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1731924908; x=1732011308; bh=wn0FDtj1v/m1iBQtnIW92oDW3NoKo76q 4MrOju+Mbr0=; b=JzQ9NbbT8OW0x+wdQFqnyESdyyVXe6iR+fp7HVhbHxdtw8ar 8/97tqEq+xqEHn2/Pn/9TmiWuvAo74fEu7MiFjEj004D/MiIhEfM6HHLFzhLTVyP dX87Mf7HkHNcmoHRZ5Qq7Xsy6vrJ2GnA49/xnG2LLbgDWTkBOOpnwX9htEA4zPzq P2z+lg6uS7vSzspYQtQUEtTPTSE/3J3rnu/TeskfWM36hKyKr3NMzOsYfn1VIUHw jQrenlr5IOec1P3jVgyChrIoFthU26RKAFIAB7d00yuZL9p88H8bB3gt/CHuVmJW nruOb/xSMvbsHXTGbMVzqojmIACoI8qINv6ljw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1731924908; x= 1732011308; bh=wn0FDtj1v/m1iBQtnIW92oDW3NoKo76q4MrOju+Mbr0=; b=c HsS0V70ytWvozQpu8jobdBhl2fvPs6OZgrmALwP4OZC9N39OapauRoiNi77ZyABk 2rwRMWjTfX4s18hk6K2MiRMvlg8lVycRQFBH0xgbDY9ZvlHB3+YyzQ2v8fAMDvvd V8LQ/DyS0gZK285NRU2m/qIdT7zhgAurJsws/rhaZo6l9FA3OnLJI01lOt6/BqDW UEZwT3cwNOumCR9j7xs/LFRdsnfQekguvQdR+KrBABJ5ptlm3oH7tf2nM4BSIZI4 biC2LwrN5Hc8AyV3ZEZkU1tjJ/wXXb5sJ1pzjAPltrkA7dhTPm4QJDTJNB727Nyw D9lptUfR8Nvp4fn+y+HPA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrfedtgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeen ucfhrhhomhepmfhlrghushculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrd gukheqnecuggftrfgrthhtvghrnhepkeeivddtueehffefuddtleefkefhiedttdduveeg gfffieetveffhfehgfeghfffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepihhtshesihhrrhgvlhgvvhgrnhhtrdgukhdpnhgspghrtghpthht ohepiedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepfhhoshhsseguvghfmhgrtg hrohdrihhtpdhrtghpthhtohepihhtshesihhrrhgvlhgvvhgrnhhtrdgukhdprhgtphht thhopehqvghmuhdqsghlohgtkhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepkhgsuh hstghhsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhho nhhgnhhurdhorhhgpdhrtghpthhtohepkhdrjhgvnhhsvghnsehsrghmshhunhhgrdgtoh hm X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen Date: Mon, 18 Nov 2024 11:14:18 +0100 Subject: [PATCH for-9.2 2/4] hw/nvme: fix use/unuse of msix vectors MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241118-nvme-fixes-v1-2-02d107dbdcc0@samsung.com> References: <20241118-nvme-fixes-v1-0-02d107dbdcc0@samsung.com> In-Reply-To: <20241118-nvme-fixes-v1-0-02d107dbdcc0@samsung.com> To: Keith Busch , Klaus Jensen , Jesper Devantier , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: Klaus Jensen X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1122; i=k.jensen@samsung.com; h=from:subject:message-id; bh=On2tnR5FtbLyphu7V88G7B3jZ5QwBKDAjv+OiR4JC0E=; b=LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpvd0o0bkFGdEFaTCtrQTBEQUFvQlRlR3ZNV zFQRGVrQnl5WmlBR2M3RTZYZnhubUJhUnBIU0lmVEZIa3VnSGd6CmRFQzFQendibXBWdGc1OHBa cjcxVzRrQk13UUFBUW9BSFJZaEJGSW9NNnAxNHR6bW9rZG13RTNocnpGdFR3M3AKQlFKbk94T2x BQW9KRUUzaHJ6RnRUdzNwQi9jSUFKYWdoUEFyb3FCRllyc3Qwb0d2SVpWakowUWR4S2RxdVZtVw pHZ1BJOXFpMmNHd1YwT2FqNXRRcitKUEJrMHJLM0pZQkhqNVVMR3NtVUlRUHdxMkVqd2w1b3VMR XNJbi9FVDZwCkNhVGtsTHRtd1lDenVob3YzNDZuQTVtOE9lZU9EUnZtMlBqZGxIMlR4Smh4RWph cU9meUlyTkx3NDBMdzB0YzgKTEpESTlJbFJLYmVQYXprY3NRdUl0N0VJeTBzWkgzdTYwUTN1czh TaE0wcjR3OWNhdW5EQ1ZYb0VTc2pJdmVUTApLSUY0T1Jqdi9xTVE0OU8yVHdab1c0S0NTbVh1QT lEbTZXNEtDb01EOEY1V1N2LzE0YlR3blo0bGN2K2RnTlYxClkxRnZ2SHRYdWs1NTJTNVNaSWx6S TdQTkNDTGNrVzlOYmxUeFFRN21tTmVWVEpoQkhyT0FSS3daCj12SFp6Ci0tLS0tRU5EIFBHUCBN RVNTQUdFLS0tLS0K X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 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=202.12.124.157; envelope-from=its@irrelevant.dk; helo=fhigh-b6-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 @irrelevant.dk) X-ZM-MESSAGEID: 1731925017903116600 From: Klaus Jensen Only call msix_{un,}use_vector() when interrupts are actually enabled for a completion queue. Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 13898d58278ed2155d45a9120fc07ea60bc64a32..a38f460a78599bc191c17a2a376= e865a74744e58 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -5423,7 +5423,7 @@ static void nvme_free_cq(NvmeCQueue *cq, NvmeCtrl *n) event_notifier_set_handler(&cq->notifier, NULL); event_notifier_cleanup(&cq->notifier); } - if (msix_enabled(pci)) { + if (msix_enabled(pci) && cq->irq_enabled) { msix_vector_unuse(pci, cq->vector); } if (cq->cqid) { @@ -5464,9 +5464,10 @@ static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n= , uint64_t dma_addr, { PCIDevice *pci =3D PCI_DEVICE(n); =20 - if (msix_enabled(pci)) { + if (msix_enabled(pci) && irq_enabled) { msix_vector_use(pci, vector); } + cq->ctrl =3D n; cq->cqid =3D cqid; cq->size =3D size; --=20 2.45.2 From nobody Sat Nov 23 17:54:47 2024 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=1731924997; cv=none; d=zohomail.com; s=zohoarc; b=Ak5KKkMhqLMWaLvl2wpP+4I/RJIxJqfLZhjcruMHcMzRmmNboMzOCxtlIi7FKXaTS5x0fD/hDK6XMXD44bswApNnIA1L0zjrZ2gOBJrEmkuuYHWsgeMIohFtRDbdPibn9NhlRzyD8WK8oVCMZcSfaKWTTAMekQveH7SJYcms6ag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731924997; 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=eKPdc+0xnhbS9XwqwCCdNQo8FgV2Dtc/tstz7c+G7PI=; b=OqM/IB0k0cJr5qSTLufrOJsriMfajZdhkF25LVlhZddsmy7xd37cuY+cEK+hfD2/+CS03t5ejIAek+qi9CmFs0qLZES0KRambyfXf9Syqtx+yTaYA6siEqrtGiRnnFcW69PcC7cUSybr0J2UNgGIRXvpcmVUC9FSvVmUTZ0CH9I= 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 1731924997606616.8207068222629; Mon, 18 Nov 2024 02:16:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCync-0005pr-35; Mon, 18 Nov 2024 05:16:04 -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 1tCymq-0005M4-Jq; Mon, 18 Nov 2024 05:15:17 -0500 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCyml-0008K5-UB; Mon, 18 Nov 2024 05:15:13 -0500 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id B5AC925400B8; Mon, 18 Nov 2024 05:15:10 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Mon, 18 Nov 2024 05:15:10 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 18 Nov 2024 05:15:09 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1731924910; x=1732011310; bh=eKPdc+0xnhbS9XwqwCCdNQo8FgV2Dtc/ tstz7c+G7PI=; b=frESxbxM3N9pCMrmmoqERJizZG+wlAVdG1mqNOOiy0PbvUsW /ieidBnBVaDcJzMMBxFrAmOqCWvf1ZpyN4lDjGLhkQiE/ODHSZxQ9EzsdiP3VoJg YGh88IpiudOAKZdTTrUxnph9R0ZTIFnZaDfcVHRS2Ot6HliSjQ3OetUAH4qcrIl2 dCPv3w9V2g3hWAfZgg/5YwxvhMc8VJMFb5/HO878iXrB33IQYBlOtBAfUwApBRPJ 0PDcsK6jarzYS+oa8kfY/5UvaP0k3lRnOypNquR3mlmxBXYngAq4CHmn4q0wvyv3 19oTdq0ICFYIrGJWu3tgeY9hOnTY5Spa2xptBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1731924910; x= 1732011310; bh=eKPdc+0xnhbS9XwqwCCdNQo8FgV2Dtc/tstz7c+G7PI=; b=J Z5LOCcbkjXV7YB2/F9AIHUAXJuGQt5GFlq6ArmeWQDsT3QcxenbdtcbapQQ39NY8 v3fXx6mdQACMsYCZemjj0Wd5fgyrpp1wjI5qTx5QPBZPmXq0clT4JX5noHh7VGOG IkNY5CXIEsJ450ColAthPmpK7CuVAe5bCmLBYb8co4fEKs6VDsHa2wdQ2LPGqa7B LX3UQ/9S9LX3s9xRKUg5WwqtQ/UJwV3ujxUXDU31C3U4gsJmSziQ57oV21hGAjwj fesN8yjb0B1MRFhbK6WJ9WBAf2YaVXUnz/sD9rg3MrkJ6rJQueWACfyiKnzB+5Hw 5STUoJ1vaMMnsHqPqZmmQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrfedtgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeen ucfhrhhomhepmfhlrghushculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrd gukheqnecuggftrfgrthhtvghrnhepkeeivddtueehffefuddtleefkefhiedttdduveeg gfffieetveffhfehgfeghfffnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpe hmrghilhhfrhhomhepihhtshesihhrrhgvlhgvvhgrnhhtrdgukhdpnhgspghrtghpthht ohepiedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepfhhoshhsseguvghfmhgrtg hrohdrihhtpdhrtghpthhtohepihhtshesihhrrhgvlhgvvhgrnhhtrdgukhdprhgtphht thhopehqvghmuhdqsghlohgtkhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepkhgsuh hstghhsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhho nhhgnhhurdhorhhgpdhrtghpthhtohepkhdrjhgvnhhsvghnsehsrghmshhunhhgrdgtoh hm X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen Date: Mon, 18 Nov 2024 11:14:19 +0100 Subject: [PATCH for-9.2 3/4] hw/nvme: SR-IOV VFs must hardwire pci interrupt pin register to zero MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241118-nvme-fixes-v1-3-02d107dbdcc0@samsung.com> References: <20241118-nvme-fixes-v1-0-02d107dbdcc0@samsung.com> In-Reply-To: <20241118-nvme-fixes-v1-0-02d107dbdcc0@samsung.com> To: Keith Busch , Klaus Jensen , Jesper Devantier , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: Klaus Jensen X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1121; i=k.jensen@samsung.com; h=from:subject:message-id; bh=8FsyptW+qB1cLIkS6SNQ7iw7y55WO0Fxsme0yttl0wY=; b=LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpvd0o0bkFGdEFaTCtrQTBEQUFvQlRlR3ZNV zFQRGVrQnl5WmlBR2M3RTZYSnZ6S2NueXdRN1pEemJsY3A1RDg2Cld0YS9xbEgyTEtWYy9xVlMy SThhd1lrQk13UUFBUW9BSFJZaEJGSW9NNnAxNHR6bW9rZG13RTNocnpGdFR3M3AKQlFKbk94T2x BQW9KRUUzaHJ6RnRUdzNweURrSC8wNnJidlhQcC9OV3BBTmhOVVU4NkNVVGRFSUVKWUk3a25TWg pGb1FWd2toWmRsV05sZ1doTXVibGZmK0RwVHRUSlJ6VVlIOWRxUmFnb1BPc0RZaWJEMUhLTmtJN zhWaVR1UUtaCnlMZ0lzU0hmdkZVZ0lsV3Q0Q3ZvcVo4NHM4eVZiNk5OZzQ1RFo4ckg2SXQxQ2xU N1VqcTRobnlua1ZkYkU2QVAKUUoxRUlMWWpNTFFxT3EzZ2JtamFKMXBXbWFuejNLVzBjcDZmWVN nQUZNa0xKY1RqZ0pvaGg3c2xZcmJZMHZkVAowR05RYzZmUWZvVHlnZUNkMkpqTng2ck1iN3pQc3 hjTUpqd1RPd3E5WVcrTzRZYm1iMHRWS0k4Qi9sMnJMQWZaCjN6SXJRNkMrRjAzZ0NNa1BzMUVyY lFWcWJyVHB4cDBvckJneUlBbXBacnZnQ1ltN2NDdjhFNlNSCj1kU1pSCi0tLS0tRU5EIFBHUCBN RVNTQUdFLS0tLS0K X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 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=202.12.124.157; envelope-from=its@irrelevant.dk; helo=fhigh-b6-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 @irrelevant.dk) X-ZM-MESSAGEID: 1731925000422116600 From: Klaus Jensen The PCI Interrupt Pin Register does not apply to VFs and MUST be hardwired to zero. Fixes: 44c2c09488db ("hw/nvme: Add support for SR-IOV") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index a38f460a78599bc191c17a2a376e865a74744e58..61c114c66d1565696430589aeb2= 7d7c4a5d2220a 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -656,6 +656,12 @@ static void nvme_irq_check(NvmeCtrl *n) if (msix_enabled(pci)) { return; } + + /* vfs does not implement intx */ + if (pci_is_vf(pci)) { + return; + } + if (~intms & n->irq_status) { pci_irq_assert(pci); } else { @@ -8544,7 +8550,7 @@ static bool nvme_init_pci(NvmeCtrl *n, PCIDevice *pci= _dev, Error **errp) unsigned nr_vectors; int ret; =20 - pci_conf[PCI_INTERRUPT_PIN] =3D 1; + pci_conf[PCI_INTERRUPT_PIN] =3D pci_is_vf(pci_dev) ? 0 : 1; pci_config_set_prog_interface(pci_conf, 0x2); =20 if (n->params.use_intel_id) { --=20 2.45.2 From nobody Sat Nov 23 17:54:47 2024 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=1731925015; cv=none; d=zohomail.com; s=zohoarc; b=awnMbvMtQ6ONa35NIQJ5pnRBPE0ju7qLLfDf5e1iI5EF7X6EiOn0X83rfCdUUiGAdJchxBt4Qgz/DWxO7lGRYzWGo5/Q76Q1cvHD8040b1TrBInqEyZX49dt+REWiw0NDSEsp0Aid5PntsBXnMAtQrpgjhkbbJjYZ6bdpXuPZP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731925015; 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=fIdnaVMp0/2z9dMrnCl/TLqQ5Ylu2ihkckUe2/tOJXs=; b=XA817KXf1iFVNw55Nd9J9NYPr+ILODXiD/fL6tvHCMAqh9JCrxgiKqMkK++rFHhxp7XaBR4ngbdQRhH5KaFcs38xf1341dU0xAXAJSp8kAZoZnPMeAgZFc7nuti89KKTqkXMcU0lLm/+VUQFeegGb03eY/6sO6z5umGF8VmpmOM= 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 1731925015485835.9244740318807; Mon, 18 Nov 2024 02:16:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCynb-0005oG-Sx; Mon, 18 Nov 2024 05:16:03 -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 1tCyms-0005MU-BF; Mon, 18 Nov 2024 05:15:19 -0500 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCymq-0008KU-PA; Mon, 18 Nov 2024 05:15:18 -0500 Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.stl.internal (Postfix) with ESMTP id 96C59114019B; Mon, 18 Nov 2024 05:15:12 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Mon, 18 Nov 2024 05:15:12 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 18 Nov 2024 05:15:11 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1731924912; x=1732011312; bh=fIdnaVMp0/2z9dMrnCl/TLqQ5Ylu2ihk ckUe2/tOJXs=; b=ZFsYwbLSHD9xCLvCe9b7tqn9R9Zq1K70VKhXc5WG/o90fcWy R+b9T58FTIuEy+DR2N/Hqf9wd+gT3Tpob9Y14/IDeQBo1DcruLRLurjBt68EO4Kv ZL4BDJEgGDmZXHe19GpyPPvTFu5DYlDGjf9Evj6w+drwPm2bvRySAUW0a2crSm+k QQmDojha0YUvASzkc1XM3ELK/Z44LLtBIub9OiI8mdDhM+7UL3+eGk09AN5reBPy 19FWb4Sj/K0d/gnNtTAMnBm9I41pIWKm3EMCe9+5P9Z4FDg4YB/6KOKvWTfQchbr jy92QYEMoU3i43AmpU7nwg+q3WdjxUIKpjZ9Yg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1731924912; x= 1732011312; bh=fIdnaVMp0/2z9dMrnCl/TLqQ5Ylu2ihkckUe2/tOJXs=; b=I Qh9kPxKrFxOCHpzilOnolWCgAl+UwMvUUNHxymWWzVgHvy8MJBBS0SSOQ7CBOJZm R+OyQCkcDXqJoKAFvYEdePx78BPFdXGJtmOGkmwidT+plIKkpvKgWC2ol8eO0cq2 AC7HIfYb9pu6gAY+pHf9FBCdGfv722ihOarkh9wVqQAIMKvrgeQrkwYKkq1JLWFQ 4VLT3aso4vchSjqtE5msYhqkrRSMfW5dwngNHSxJsi3itM2YxcQ+3PtNiPjflQHx YvawEHWDiMoTU8fhiYxcxWbkKv7Mny7LlaMcZ4RTnvcdWJnkNMJCSMRRYJpd12XF 4jcMx87spLSHIzBaIH3RQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrfedtgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeen ucfhrhhomhepmfhlrghushculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrd gukheqnecuggftrfgrthhtvghrnhepkeeivddtueehffefuddtleefkefhiedttdduveeg gfffieetveffhfehgfeghfffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepihhtshesihhrrhgvlhgvvhgrnhhtrdgukhdpnhgspghrtghpthht ohepjedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepfhhoshhsseguvghfmhgrtg hrohdrihhtpdhrtghpthhtohepihhtshesihhrrhgvlhgvvhgrnhhtrdgukhdprhgtphht thhopehqvghmuhdqshhtrggslhgvsehnohhnghhnuhdrohhrghdprhgtphhtthhopehqvg hmuhdqsghlohgtkhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepkhgsuhhstghhsehk vghrnhgvlhdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurd horhhgpdhrtghpthhtohepkhdrjhgvnhhsvghnsehsrghmshhunhhgrdgtohhm X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen Date: Mon, 18 Nov 2024 11:14:20 +0100 Subject: [PATCH for-9.2 4/4] hw/nvme: take a reference on the subsystem on vf realization MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241118-nvme-fixes-v1-4-02d107dbdcc0@samsung.com> References: <20241118-nvme-fixes-v1-0-02d107dbdcc0@samsung.com> In-Reply-To: <20241118-nvme-fixes-v1-0-02d107dbdcc0@samsung.com> To: Keith Busch , Klaus Jensen , Jesper Devantier , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: Klaus Jensen , qemu-stable@nongnu.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1430; i=k.jensen@samsung.com; h=from:subject:message-id; bh=U8nYbfifAWFGsbALmvnqAi+L4a04ZKCu8fQJt4ne/+0=; b=LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpvd0o0bkFGdEFaTCtrQTBEQUFvQlRlR3ZNV zFQRGVrQnl5WmlBR2M3RTZaVUFtLzI4eG9NMHlNaEZkUE8zb0ZpCk04Z29PYzJ6Mk9hMERWTkNP dVpPSllrQk13UUFBUW9BSFJZaEJGSW9NNnAxNHR6bW9rZG13RTNocnpGdFR3M3AKQlFKbk94T21 BQW9KRUUzaHJ6RnRUdzNwclBVSC9SeUV1bUx6b0hkUllUakl6bUdpSlphU0RFQWV3LzA2RnJ0OA pYWEdUaFhHTlNVWU13VjRDMTJYKzNPaDhQa0hhOVgzTEFlWXZ2VU0rRUx2MWRJeVBYeGF4ZmNCU GFNalJUTlp5CkVlM3ZESUNmMnV2aGQxT0dlM3dxODFDYmtZVGcxTVNaMkxsdDB6cHMya2N0UnNa ZW9CZmM4U2R1UHhKbk41UTIKbHFpaUpiTjNhWVY2cUwwT1ROQ0h0bG9wcnhqdGlEV3lqK0syNFE 1Nkh5T0phVTBFMGJwUDNncmQrWmN4VGVIVwo2ZDZER3ZKMDNNWitIS0owQXlhQkxPRWxFd2JWb1 pjaUM3ZjAwS2F4Tm8yYmt6eVU4WTVEU3orWjBVV0VESytICkcwdEhkZ0NmZHRpVTdXM05tMnVLc m1rKzFMWDlvZFUyZDlBOU5iZnk5dkZ3MEdma3N4MEsxSzBKCj1vKzdnCi0tLS0tRU5EIFBHUCBN RVNTQUdFLS0tLS0K X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 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=202.12.124.147; envelope-from=its@irrelevant.dk; helo=fout-b4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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 @irrelevant.dk) X-ZM-MESSAGEID: 1731925015776116600 From: Klaus Jensen Make sure we grab a reference on the subsystem when a VF is realized. Otherwise, the subsytem will be unrealized automatically when the VFs are unregistered and unreffed. This fixes a latent bug but was not exposed until commit 08f632848008 ("pcie: Release references of virtual functions"). This was then fixed (or rather, hidden) by commit c613ad25125b ("pcie_sriov: Do not manually unrealize"), but that was then reverted (due to other issues) in commit b0fdaee5d1ed, exposing the bug yet again. Cc: qemu-stable@nongnu.org Fixes: 08f632848008 ("pcie: Release references of virtual functions") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 61c114c66d1565696430589aeb27d7c4a5d2220a..ec754195669598082dd573ff123= 7dbbfb9b8aff5 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8841,6 +8841,13 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) */ n->params.serial =3D g_strdup(pn->params.serial); n->subsys =3D pn->subsys; + + /* + * Assigning this link (strong link) causes an `object_unref` late= r in + * `object_release_link_property`. Increment the refcount to balan= ce + * this out. + */ + object_ref(OBJECT(pn->subsys)); } =20 if (!nvme_check_params(n, errp)) { --=20 2.45.2