Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BCECC433F5 for ; Thu, 16 Dec 2021 21:41:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242114AbhLPVlK (ORCPT ); Thu, 16 Dec 2021 16:41:10 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:56996 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241786AbhLPVkb (ORCPT ); Thu, 16 Dec 2021 16:40:31 -0500 Date: Thu, 16 Dec 2021 21:40:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1639690830; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0mE7/8/GjbgPhEDVlCMkfFO4dan/TZEA3ARXtIYTrj0=; b=pSwXgS3fyP2pFiFzhKAOWS9rdFF+kbxFoKHsjYzH8MfD0Hqr8bkb+lJlvYv4yspyxghHop dzhzPcuuKAxFqODHxxkIBGnbqA8b+QbrN2g8DDsZDAtcdX5ebRsePW6m8HmLXEWGbo0mXA qYOtf8P0hZFYPQXCdM231LYhaMv/oy3nE1UxgJ2TZ0vf6DU956aRcLAA77nVBPdN03px93 WBOPBb1w4kuyUtvOxzgzLXSyUYEFR99+qBGr2/2jJCcUOfCioRNG6dx5SR9CwPtB6ZPCuO k9Jz7F6KeGO+doFmJ2ZfiplazxRBtAFk7RAvL0dL7eAOqAsPxw1DzBirnD6ZkQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1639690830; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0mE7/8/GjbgPhEDVlCMkfFO4dan/TZEA3ARXtIYTrj0=; b=3YyY+89XK2IiRR8zOi3f00rQg7HLW5N3gGUkGuKLooq/7/nslnA00fWWACi6gra9qfzfF2 S/u0DKmqPsLgZaBw== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/msi] PCI: hv: Rework MSI handling Cc: Thomas Gleixner , Michael Kelley , Jason Gunthorpe , Bjorn Helgaas , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20211206210748.629363944@linutronix.de> References: <20211206210748.629363944@linutronix.de> MIME-Version: 1.0 Message-ID: <163969082914.23020.17844916634086326034.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/msi branch of tip: Commit-ID: dc2b453290c471266a2d56d7ead981e3c5cea05e Gitweb: https://git.kernel.org/tip/dc2b453290c471266a2d56d7ead981e3c5cea05e Author: Thomas Gleixner AuthorDate: Mon, 06 Dec 2021 23:51:33 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 16 Dec 2021 22:22:19 +01:00 PCI: hv: Rework MSI handling Replace the about to vanish iterators and make use of the filtering. Take the descriptor lock around the iterators. Signed-off-by: Thomas Gleixner Tested-by: Michael Kelley Reviewed-by: Jason Gunthorpe Acked-by: Bjorn Helgaas Link: https://lore.kernel.org/r/20211206210748.629363944@linutronix.de --- drivers/pci/controller/pci-hyperv.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 6733cb1..45b6ff8 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -3445,18 +3445,23 @@ static int hv_pci_suspend(struct hv_device *hdev) static int hv_pci_restore_msi_msg(struct pci_dev *pdev, void *arg) { - struct msi_desc *entry; struct irq_data *irq_data; + struct msi_desc *entry; + int ret = 0; - for_each_pci_msi_entry(entry, pdev) { + msi_lock_descs(&pdev->dev); + msi_for_each_desc(entry, &pdev->dev, MSI_DESC_ASSOCIATED) { irq_data = irq_get_irq_data(entry->irq); - if (WARN_ON_ONCE(!irq_data)) - return -EINVAL; + if (WARN_ON_ONCE(!irq_data)) { + ret = -EINVAL; + break; + } hv_compose_msi_msg(irq_data, &entry->msg); } + msi_unlock_descs(&pdev->dev); - return 0; + return ret; } /*