From patchwork Mon Nov 21 14:40:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 23881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1647459wrr; Mon, 21 Nov 2022 07:13:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf7jr1ln4lVHyl0byUJOxrmgQWWRk0O+oSUILv96viTcpF/PuBVhzLDrWwUX2EcB8TyAyfZe X-Received: by 2002:a63:145e:0:b0:473:c377:b82 with SMTP id 30-20020a63145e000000b00473c3770b82mr18873949pgu.113.1669043613131; Mon, 21 Nov 2022 07:13:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669043613; cv=none; d=google.com; s=arc-20160816; b=ccF2bdfQbsc15m6pbZCR52EwvgKOyMKlTqxbff5YIEVVaEL/6zYL/SnngYcmga4yoB DsodeheZqExCihi2yOp+/a9iVWYnhtlAq/+aWHur3X7yBMVksmrh0s/2WfrYqQoZllaC FrKOM+IkhJ3iiUTsyDF9VlrUAgQCD6JIhi7eayMXtLuUdDsl7/XyFTmh4NoSU+lkHteF fJ4Gg2f3v2uidAIqmICVCluJUrTqpeZOqoUqcha5fYNjYVfmbw6GDizCYNThkHFVd1Yq Su1mjgjFILgFhbGu9wjYZt9FNhtgiGNrUTPK6nIII1As5cePGxD68iHGB5DN+CRGq9D9 koEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=MWbome5dgm/wPYmMLcr+2vFNZotgfJG19zwD6ENHzgY=; b=Dsy6bVwIgzsHuKHfVnDUFI8bEiLdGa2+IU6b/oj2Hdyp1YeDbbss4VfhCw3tp8tTze e/DiERSFjSSXZ8FjSumvrSP0KvIej5ZXTavl0rtIhYDPg+mt7kFZ5IInJ+A6GUu7xac+ k7XSWyKQrIQjYr1Im9T/CHlOG9GLdF+k+Yy5MZgAjlBRP67oPHh0kM9ux9lWTygX3WrE pPeXLWD2095pKETBug0izgk+RjBt9gB/1U0TO60BfdeV0pChvYBYJMPEgpOxMl0F2MhE mVwMLVKqVWNzN4w+x1AjKQaZgwBjLVMuS9+Mv+MSgptHw800MBBid/eGHwozAgt+yt5O 4Kew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=HWoN44Km; dkim=neutral (no key) header.i=@linutronix.de header.b=aS68KBaR; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h16-20020a056a001a5000b0056c92bd3c48si11006843pfv.242.2022.11.21.07.13.12; Mon, 21 Nov 2022 07:13:33 -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=HWoN44Km; dkim=neutral (no key) header.i=@linutronix.de header.b=aS68KBaR; 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 S231683AbiKUO6b (ORCPT + 99 others); Mon, 21 Nov 2022 09:58:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231959AbiKUO4i (ORCPT ); Mon, 21 Nov 2022 09:56:38 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE77CD14E1; Mon, 21 Nov 2022 06:47:22 -0800 (PST) Message-ID: <20221121140050.514874045@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669041612; 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: references:references; bh=MWbome5dgm/wPYmMLcr+2vFNZotgfJG19zwD6ENHzgY=; b=HWoN44KmyafpTrxe6ukQ35xbvm2lQnIatKWOJR3CwzpHyHqEYi9TXM7ThjDPAcL9JTQN9d GJ5JUinAXVGHRQ5+Q/N7VLn0f5O9V8ziXYy3EvYUXzKbOZm5hfaWP0bvefbsXcRdm1O1VM crxRUVEGA6HTVP18CgeaMRijMvzn4mDrmSTkrq3t8FmkJj6UWMBp2p/ibCZWDtTNig3odc UjAG1XojBBej4P4fDiBC+Qbyhrz1os+epccZTyxiPWvmd+w2APnl/iFXaK9bq+4HD78h/T Dbh4W2Dya68SQqxY5hBVMPu+/rxic19kP4fW9Kn5xIZY0h7zGC18GqToNhpuFg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669041612; 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: references:references; bh=MWbome5dgm/wPYmMLcr+2vFNZotgfJG19zwD6ENHzgY=; b=aS68KBaR83xW3NNx1pE5zTjxAqACHvln9C6Du58Up/9KL0ohcWRLbx3uCul7Y6Dp0o8dYC g64BrRAEntnflfBA== From: Thomas Gleixner To: LKML Cc: Will Deacon , linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Marc Zyngier , Greg Kroah-Hartman , Jason Gunthorpe , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Ammar Faizi , Robin Murphy , Lorenzo Pieralisi , Nishanth Menon , Tero Kristo , Santosh Shilimkar , linux-arm-kernel@lists.infradead.org, Vinod Koul , Sinan Kaya , Andy Gross , Bjorn Andersson , Mark Rutland , Shameerali Kolothum Thodi , Zenghui Yu , Shawn Guo , Sascha Hauer , Fabio Estevam Subject: [patch V2 35/40] irqchip/mvebu-gicp: Switch to MSI parent References: <20221121135653.208611233@linutronix.de> MIME-Version: 1.0 Date: Mon, 21 Nov 2022 15:40:12 +0100 (CET) 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750119075566980611?= X-GMAIL-MSGID: =?utf-8?q?1750119075566980611?= All platform MSI users and the PCI/MSI code handle per device MSI domains when the irqdomain associated to the device provides MSI parent functionality. Remove the "global" platform domain related code and provide the MSI parent functionality by filling in msi_parent_ops. Signed-off-by: Thomas Gleixner Cc: Andrew Lunn Cc: Gregory Clement Cc: Sebastian Hesselbarth --- drivers/irqchip/Kconfig | 1 drivers/irqchip/irq-mvebu-gicp.c | 44 ++++++++++++++++----------------------- 2 files changed, 20 insertions(+), 25 deletions(-) --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -373,6 +373,7 @@ config MSCC_OCELOT_IRQ select GENERIC_IRQ_CHIP config MVEBU_GICP + select ARM_GIC_MSI_LIB bool config MVEBU_ICU --- a/drivers/irqchip/irq-mvebu-gicp.c +++ b/drivers/irqchip/irq-mvebu-gicp.c @@ -17,6 +17,8 @@ #include #include +#include "irq-gic-msi-lib.h" + #include #define GICP_SETSPI_NSR_OFFSET 0x0 @@ -145,32 +147,32 @@ static void gicp_irq_domain_free(struct } static const struct irq_domain_ops gicp_domain_ops = { + .select = gic_msi_lib_irq_domain_select, .alloc = gicp_irq_domain_alloc, .free = gicp_irq_domain_free, }; -static struct irq_chip gicp_msi_irq_chip = { - .name = "GICP", - .irq_set_type = irq_chip_set_type_parent, - .flags = IRQCHIP_SUPPORTS_LEVEL_MSI, -}; +#define GICP_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ + MSI_FLAG_USE_DEF_CHIP_OPS) -static struct msi_domain_ops gicp_msi_ops = { -}; +#define GICP_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \ + MSI_FLAG_LEVEL_CAPABLE) -static struct msi_domain_info gicp_msi_domain_info = { - .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | - MSI_FLAG_LEVEL_CAPABLE), - .ops = &gicp_msi_ops, - .chip = &gicp_msi_irq_chip, +static const struct msi_parent_ops gicp_msi_parent_ops = { + .supported_flags = GICP_MSI_FLAGS_SUPPORTED, + .required_flags = GICP_MSI_FLAGS_REQUIRED, + .bus_select_token = DOMAIN_BUS_GENERIC_MSI, + .bus_select_mask = MATCH_PLATFORM_MSI, + .prefix = "GICP-", + .init_dev_msi_info = gic_msi_lib_init_dev_msi_info, }; static int mvebu_gicp_probe(struct platform_device *pdev) { - struct mvebu_gicp *gicp; - struct irq_domain *inner_domain, *plat_domain, *parent_domain; + struct irq_domain *inner_domain, *parent_domain; struct device_node *node = pdev->dev.of_node; struct device_node *irq_parent_dn; + struct mvebu_gicp *gicp; int ret, i; gicp = devm_kzalloc(&pdev->dev, sizeof(*gicp), GFP_KERNEL); @@ -233,17 +235,9 @@ static int mvebu_gicp_probe(struct platf if (!inner_domain) return -ENOMEM; - - plat_domain = platform_msi_create_irq_domain(of_node_to_fwnode(node), - &gicp_msi_domain_info, - inner_domain); - if (!plat_domain) { - irq_domain_remove(inner_domain); - return -ENOMEM; - } - - platform_set_drvdata(pdev, gicp); - + irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI); + inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; + inner_domain->msi_parent_ops = &gicp_msi_parent_ops; return 0; }