From mboxrd@z Thu Jan 1 00:00:00 1970 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 97502C433FE for ; Wed, 16 Nov 2022 16:40:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233827AbiKPQky (ORCPT ); Wed, 16 Nov 2022 11:40:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233835AbiKPQkc (ORCPT ); Wed, 16 Nov 2022 11:40:32 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41C2359FE1; Wed, 16 Nov 2022 08:35:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id AE729CE1BEE; Wed, 16 Nov 2022 16:35:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A776C433D6; Wed, 16 Nov 2022 16:35:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668616550; bh=1LClxwUAcxcGg9RYaMS193dGrPwe4Z1td8cOVcfeWag=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=soFXB/rOcartSTwim78D5rdUrrkfhIbxlgaLe0Q0VThuPWOeAyFmufi38hbCt3EU/ vmOLP4TlH69jfkSxIUDxC7+rMYL7nmIRM7mk93NxmlBvsFTOkpInTTubJ9ngnEhFu+ u3QzHyVWlu1ghCsfrSnvw/HNlthbluvx0nZP6BquZ4ynOy4jrgtT7ur/Bwgi/Y/gd2 g2u6IgsxJFLTI1Ssz7WGGdhsfoeBzp17hEl9aviKs/Z1EFNfbfzMAKmtbk44YijNjD /lvGgFrRV02L3fA6rQ4Pvo3LunZwU7DYBt0ntMuZaz/+F2aufqvxNhObf+B9WIvKwu uLuUI+nZ3jypg== Date: Wed, 16 Nov 2022 10:35:49 -0600 From: Bjorn Helgaas To: Thomas Gleixner Cc: LKML , x86@kernel.org, Joerg Roedel , Will Deacon , linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Marc Zyngier , Greg Kroah-Hartman , Jason Gunthorpe , Dave Jiang , Alex Williamson , Kevin Tian , Dan Williams , Logan Gunthorpe , Ashok Raj , Jon Mason , Allen Hubbe , Michael Ellerman , Christophe Leroy , linuxppc-dev@lists.ozlabs.org, "Ahmed S. Darwish" , Reinette Chatre Subject: Re: [patch 01/39] PCI/MSI: Check for MSI enabled in __pci_msix_enable() Message-ID: <20221116163549.GA1116921@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221111122013.653556720@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Fri, Nov 11, 2022 at 02:54:15PM +0100, Thomas Gleixner wrote: > PCI/MSI and PCI/MSI-X are mutually exclusive, but the MSI-X enable code > lacks a check for already enabled MSI. > > Signed-off-by: Thomas Gleixner Acked-by: Bjorn Helgaas > --- > drivers/pci/msi/msi.c | 5 +++++ > 1 file changed, 5 insertions(+) > > --- a/drivers/pci/msi/msi.c > +++ b/drivers/pci/msi/msi.c > @@ -935,6 +935,11 @@ static int __pci_enable_msix_range(struc > if (maxvec < minvec) > return -ERANGE; > > + if (dev->msi_enabled) { > + pci_info(dev, "can't enable MSI-X (MSI already enabled)\n"); > + return -EINVAL; > + } > + > if (WARN_ON_ONCE(dev->msix_enabled)) > return -EINVAL; > >