Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7381623rwb; Wed, 23 Nov 2022 06:00:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf7gdtI77/J5KTPMvq/URcLe/H4uudyIWY5zwGOoD5LlBnJMfMAAkRBILRj3g1vgNQTjD58M X-Received: by 2002:aa7:d999:0:b0:461:7f5a:e04e with SMTP id u25-20020aa7d999000000b004617f5ae04emr9584145eds.389.1669212028837; Wed, 23 Nov 2022 06:00:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669212028; cv=none; d=google.com; s=arc-20160816; b=szZnW+Sm7sbs+OASfajThzSQkXxpoFIM6mR4c7cUYgh/PMZWvyupAZgxYp4/xju7J+ Jqa/sUfXAzA1z6F+76ZzPyEMc09PSo9rdVrfqx8w2OfoiaAZWEr8s1LM6xqU6Vcvsb9f S0pqG8EFXDK2MCBPe3+oL7J+XF9dXxviIFZuPrweQ/xAclSGIwggzhwOHnQr1nBqcegk YswgcYvR/yaUtXk8FACAdiWbIyMslpvQKM7AjCDpSI5rLnPMmKnV1tGSVoNnk6DIp91c 5v0ezXzRyBOymqPBHjcOEVgzNyR4NFcwswX5nsAnD3fxazPCPU45kQUONXIDP16OA+GI 2xxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=3w3v4/UzR7fUI27II1khhAoE3yCMnYi0dCnXEjA/Pt0=; b=Z3U2XXxH7GHF8eaHbIP5WYZd+icX7YkTaKoBpxx63TDYCKL58ljnhX0DcW1q2cQkW5 ZzJqBiOzBSqqbsd6C8V3q6GHdOk2Rb8JFV5k5p5wp87IcWtD7bgX7UBCxed/B2dSKVPy tk4ZJ4UkpOYa8aN35d+UvmsgN12APA06Tfpo76qMMrBW/2spRDLObOU+v4uQFOP4aPQy EqAZ796L2wBKdl6L0+KKBLXGRATCx/PIG4kcCqR5EQcTlIaPwdkhYPtq75E6C7PrnWxh AuVnoZVH5rXJJHEaOduMdrKlRgnW3IWmtXmJnmZ73JmiziFhIIK6sii436BL+lPHPtd/ P2cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QymXP1Pf; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w16-20020a05640234d000b004619867344csi5808737edc.0.2022.11.23.06.00.05; Wed, 23 Nov 2022 06:00:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QymXP1Pf; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237049AbiKWNvs (ORCPT + 89 others); Wed, 23 Nov 2022 08:51:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236618AbiKWNvS (ORCPT ); Wed, 23 Nov 2022 08:51:18 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32D572181D; Wed, 23 Nov 2022 05:42:13 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669210931; 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=3w3v4/UzR7fUI27II1khhAoE3yCMnYi0dCnXEjA/Pt0=; b=QymXP1PfA635NFW9W28ggBDHxu7s38hd04fusJX8sm5j7x+P1R+au45E4fMe8yib9E/YAL W56eUNygUmzDIu9e9pEIfgmvvZXDl5V2dDX9xQwj5Om1clHLvl12pJBCszscS9cwqysIeB 9iQ310MaxjcPg22AJr/u28F5Vz6yILIz/lnLKEiBwy+IjzM52/6E0P3fPHPpnSMyAJJlQW V3uT0wtcoDfqosln8wBR9rR3tY3zyB3UHPINmgNH+Y1qPJPkGg0CRKIg3j8I3nTX196ZJS TgEPnwgrUthIahonWcrnRYJ96RzkpoOw2yk8Dm9pIr6IzTHcFp5nsiNa/0WeUg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669210931; 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=3w3v4/UzR7fUI27II1khhAoE3yCMnYi0dCnXEjA/Pt0=; b=8lxeHUvSB1L6YbyJW9i+pEva3FYbsyr5CgAYvhxaDO46eruMuk68rr6WBYoJdecnntzVx+ lmvqYnvE57EUwGAA== 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 Subject: RE: [patch V2 13/33] x86/apic/vector: Provide MSI parent domain In-Reply-To: References: <20221121083657.157152924@linutronix.de> <20221121091327.217466288@linutronix.de> Date: Wed, 23 Nov 2022 14:42:10 +0100 Message-ID: <87tu2peqj1.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 23 2022 at 08:16, Kevin Tian wrote: >> From: Thomas Gleixner >> Sent: Monday, November 21, 2022 10:38 PM >> >> +bool pci_dev_has_default_msi_parent_domain(struct pci_dev *dev) >> +{ >> + struct irq_domain *domain = dev_get_msi_domain(&dev->dev); >> >> -int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec, >> - msi_alloc_info_t *arg) >> + if (!domain) >> + domain = dev_get_msi_domain(&dev->bus->dev); >> + if (!domain) >> + return false; >> + >> + return domain == x86_vector_domain; > > the function name is about parent domain but there is no check on > the parent flag. Probably just remove 'parent'? No. This checks whether the device has the default MSI parent domain, which _IS_ the vector domain. I really don't have to check whether the vector domain has the MSI parent flag set or not. It _IS_ set. If that gets lost later then the result of the above function is the least of our problems. >> +/** >> + * x86_init_dev_msi_info - Domain info setup for MSI domains >> + * @dev: The device for which the domain should be created >> + * @domain: The (root) domain providing this callback > > what is the purpose of '(root)'? it's also used by intermediate domain > i.e. IR. It _can_ be used, yes. But the way I implemented IR MSI parents it is not used by it. >> + >> + /* >> + * Mask out the domain specific MSI feature flags which are not >> + * supported by the real parent. >> + */ >> + info->flags &= pops->supported_flags; >> + /* Enforce the required flags */ >> + info->flags |= >> X86_VECTOR_MSI_FLAGS_REQUIRED; >> + >> + /* This is always invoked from the top level MSI domain! */ >> + info->ops->msi_prepare = x86_msi_prepare; >> + >> + info->chip->irq_ack = irq_chip_ack_parent; >> + info->chip->irq_retrigger = irq_chip_retrigger_hierarchy; >> + info->chip->flags |= IRQCHIP_SKIP_SET_WAKE | >> + IRQCHIP_AFFINITY_PRE_STARTUP; > > Above are executed twice for both IR and vector after next patch comes. > Could skip it for IR. How so? +static const struct msi_parent_ops dmar_msi_parent_ops = { + .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI, + .prefix = "IR-", + .init_dev_msi_info = msi_parent_init_dev_msi_info, +}; IR delegates the init to its parent domain, i.e. the vector domain. So there is no double invocation. Thanks, tglx