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 7AC1CC47088 for ; Wed, 23 Nov 2022 11:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235548AbiKWLlQ (ORCPT ); Wed, 23 Nov 2022 06:41:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237411AbiKWLlL (ORCPT ); Wed, 23 Nov 2022 06:41:11 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70A30109583; Wed, 23 Nov 2022 03:41:07 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669203666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=373bQ1nq+nl0rYtdJTO5Jt2zlt/TLiciMjBg/gptv3M=; b=KpEqNtPqfiJppK8AvzqtheMaPcoZmN8t/rFv6jjr6hTYoy40ftLFhpimHJ5jw8l6Va6aMw Hj8rFIEBDV55rsgKjpjmn7AIQVUNwC2gbZf1xfpahuw3LOSLh/LJheui3OO1y+1cm92f6x HQIXyX+ew/MZPbmSyWMukFU5yTJnHGzvmeRo4Z3KIKZfQvoGpIuFiGmWGU1jHalUcMt94Q UjDY8OCA77xKJVyyWjMTJG76mp6GpoVYrvAE002YCUD9t6HNkhsIHaymA3SxGTYalj768Y JPVHnOXR9BT/siy0wfNlaD21yUTYXDrgoxQ6VRkYoAyn0ji4clI4WvLn5hj9Hg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669203666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=373bQ1nq+nl0rYtdJTO5Jt2zlt/TLiciMjBg/gptv3M=; b=cQlKvLqRtjVxKMFF8O3YttItxpSP0whK6NO6CdL/nA66+knkQDkTy9kfdNkswueZtwmlSX vU8ev3zdRcFC1GBQ== To: "Tian, Kevin" , LKML Cc: "x86@kernel.org" , Joerg Roedel , Will Deacon , "linux-pci@vger.kernel.org" , Bjorn Helgaas , Lorenzo Pieralisi , Marc Zyngier , Greg Kroah-Hartman , Jason Gunthorpe , "Jiang, Dave" , Alex Williamson , "Williams, Dan J" , Logan Gunthorpe , "Raj, Ashok" , Jon Mason , Allen Hubbe , "Ahmed S. Darwish" Subject: RE: [patch V2 12/33] PCI/MSI: Add support for per device MSI[X] domains In-Reply-To: References: <20221121083657.157152924@linutronix.de> <20221121091327.163146917@linutronix.de> Date: Wed, 23 Nov 2022 12:41:05 +0100 Message-ID: <87zgchew4u.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 23 2022 at 08:08, Kevin Tian wrote: >> From: Thomas Gleixner > > pci_mask_msi() and pci_msi_mask() are confusing. > > Probably pci_irq_mask_msi() given the parameter is irq_data. maybe. >> +bool pci_setup_msi_device_domain(struct pci_dev *pdev) >> +{ >> + if (WARN_ON_ONCE(pdev->msix_enabled)) >> + return false; > > the check already exists in __pci_enable_msi_range() > >> +bool pci_setup_msix_device_domain(struct pci_dev *pdev, unsigned int >> hwsize) >> +{ >> + if (WARN_ON_ONCE(pdev->msix_enabled)) >> + return false; > > ditto. > > btw according to the comment this should check pdev->msi_enabled. Yeah, those are probably redundant. > >> @@ -152,13 +316,33 @@ bool pci_msi_domain_supports(struct pci_ >> { >> struct msi_domain_info *info; >> struct irq_domain *domain; >> + unsigned int supported; >> >> domain = dev_get_msi_domain(&pdev->dev); >> >> if (!domain || !irq_domain_is_hierarchy(domain)) >> return mode == ALLOW_LEGACY; >> - info = domain->host_data; >> - return (info->flags & feature_mask) == feature_mask; >> + >> + if (!irq_domain_is_msi_parent(domain)) { >> + /* >> + * For "global" PCI/MSI interrupt domains the associated >> + * msi_domain_info::flags is the authoritive source of >> + * information. >> + */ >> + info = domain->host_data; >> + supported = info->flags; >> + } else { >> + /* >> + * For MSI parent domains the supported feature set >> + * is avaliable in the parent ops. This makes checks >> + * possible before actually instantiating the >> + * per device domain because the parent is never >> + * expanding the PCI/MSI functionality. >> + */ >> + supported = domain->msi_parent_ops->supported_flags; > > This is general PCI MSI logic. So an open related to my rely to patch02, > is it correct for PCI core to assume that the real parent imposes all the > restrictions and there is no need to further go down the hierarchy? That was my working assumption and it turned out to be correct with both x86 and ARM. Thanks, tglx