From patchwork Fri Apr 23 05:21:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 1469476 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=irrelevant.dk header.i=@irrelevant.dk header.a=rsa-sha256 header.s=fm2 header.b=XqfplN4B; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm2 header.b=fyhbrKrw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FRNJf60zqz9sV5 for ; Fri, 23 Apr 2021 15:34:25 +1000 (AEST) Received: from localhost ([::1]:57476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZoSL-00015V-F2 for incoming@patchwork.ozlabs.org; Fri, 23 Apr 2021 01:34:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZoG4-0006X7-4Q; Fri, 23 Apr 2021 01:21:40 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:36375) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZoG0-0001Nj-Az; Fri, 23 Apr 2021 01:21:39 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id F2F4E146A; Fri, 23 Apr 2021 01:21:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 23 Apr 2021 01:21:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=rju6qta6bH78X Od8iphwu+FuWYddXyQN+ol4wb7fl7Q=; b=XqfplN4BEgnzgM/rUyorOj9OQw6Em R1KAaAQ48IXq/9jaxwBNXsXLCRqetKzSNpxovPhagARfnwYa0s/RViQVZqTHAAnB fa4/gI8+sbH1RidFcsKWxVJGJEt08qOKZ/FjwLGmskfJPCGI/SoW4TG3vkLE7Cte ra6UCQcU3HHHfG8Ak7dmfsdAGPVlXDEFfbWMvwr7c0HgD/jfsWNdPLPn4ib34GeH VU5g87L3Zjem4R+Dj7WqJN6RGgTjVCHZqsKfEbq4DzgGBce4PQVNc2zt+JMjx673 /rrX50KumvDWxV2LiQIIvqY8ffuNRy+bMg5GIk1nnN3XsDKC2hD6M/rIw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=rju6qta6bH78XOd8iphwu+FuWYddXyQN+ol4wb7fl7Q=; b=fyhbrKrw b+y/loECBrJ7x+u4SWzPJ+2rPx/zmTxEU/ulk/TtGg9kYjVsGqGR4xx0hU+B8Vk1 tkK8ON1t0pmDvbCClqKv0IUlN0RC3w5+dP3k1WjQtvcnm8tUXAhwno7uRdLs7drG EglglsLHx0n8O9XhWqFQZPT6qXbCuXj1uIKJtmepigKU0E1pVxOPtACAcadeaeh8 GuWS5JnulH0VKgddDBXT0gA+qj6ywd85Uv6jAfXxdTDG+MogbXAUncn3CtctHhrV bRzeKQQKKC9r5tAzB5kdeSXlrtlyn72cw/Fz6EUNQ3jb3pbBmcMTteuhDEW4NyIp Ki8u5704GfJt6g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdduuddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeeuleetgeeiuefhgfekfefgveejiefgteekiedtgfdtieefhfdthfefueffvefg keenucfkphepkedtrdduieejrdelkedrudeltdenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Received: from apples.local (80-167-98-190-cable.dk.customer.tdc.net [80.167.98.190]) by mail.messagingengine.com (Postfix) with ESMTPA id 70BDF108005F; Fri, 23 Apr 2021 01:21:31 -0400 (EDT) From: Klaus Jensen To: Peter Maydell , qemu-devel@nongnu.org Subject: [PATCH for-6.0 v2 1/2] hw/block/nvme: fix invalid msix exclusive uninit Date: Fri, 23 Apr 2021 07:21:26 +0200 Message-Id: <20210423052127.512489-2-its@irrelevant.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210423052127.512489-1-its@irrelevant.dk> References: <20210423052127.512489-1-its@irrelevant.dk> MIME-Version: 1.0 Received-SPF: pass client-ip=64.147.123.25; envelope-from=its@irrelevant.dk; helo=wout2-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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Klaus Jensen , Max Reitz , Klaus Jensen , Keith Busch Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Klaus Jensen Commit 1901b4967c3f changed the nvme device from using a bar exclusive for MSI-x to sharing it on bar0. Unfortunately, the msix_uninit_exclusive_bar() call remains in nvme_exit() which causes havoc when the device is removed with, say, device_del. Fix this. Additionally, a subregion is added but it is not removed on exit which causes a reference to linger and the drive to never be unlocked. Fixes: 1901b4967c3f ("hw/block/nvme: move msix table and pba to BAR 0") Signed-off-by: Klaus Jensen Reviewed-by: Michael S. Tsirkin --- hw/block/nvme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 624a1431d072..5fe082ec34c5 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -6235,7 +6235,8 @@ static void nvme_exit(PCIDevice *pci_dev) if (n->pmr.dev) { host_memory_backend_set_mapped(n->pmr.dev, false); } - msix_uninit_exclusive_bar(pci_dev); + msix_uninit(pci_dev, &n->bar0, &n->bar0); + memory_region_del_subregion(&n->bar0, &n->iomem); } static Property nvme_props[] = {