From patchwork Mon Dec 5 18:25:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 29829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2408693wrr; Mon, 5 Dec 2022 10:26:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf6woyR8HYKwvetGApEW7Qekw5OagzpbdjGaNzGk/6zqWBBmcEvkzL/nZ50f/tM7uE7niuRU X-Received: by 2002:a05:6402:b8e:b0:46c:8ed1:132b with SMTP id cf14-20020a0564020b8e00b0046c8ed1132bmr7502705edb.183.1670264801055; Mon, 05 Dec 2022 10:26:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670264801; cv=none; d=google.com; s=arc-20160816; b=gD0AHdT7G4mYTeRyQPGM8oXC4CVQZicyIei6/bn3hXzyDm8FkmPSEhmYuENltVs9yN ubFaKefl3mzxjyHTa01DNcFLTbTCPQ4z3ZxJCYfBj31Hg6MbVs1ws0D2igpw8wJTLNgj i3OafIba6ophZ0x8QNMic3zYk9PIf3DaZ9VTyMe5fFhy7CMwCut/+2xHuZKyXCETv7Qj zE1c3mPcVqQDcwI5ljC4pfQPuTwWPyTfOeaDl/OczculpOv0AC4/wz83VloK3alK2BH+ 1hzXoVzaHm6Kgl9OHz7L4hdDglRU7Cxssl0T2mA/btPRc4KNkIdYlU+8lfli5bJPYOoO 3exg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=QpCdO9FRNd4C/C92Gqyt7WAp0J4mSYopV4Hm0MGrgoo=; b=q8Kv6KxFGNlOSgHVgcPoIkO3eYggi8GYF+EnF0dzsezzDAcN9Zie57f3YIIrwmm2d1 Ta2Wv8RYvK347fzAkYQyWFrh/MCUz+zAfsU8q/fsUJJ62j8O7VF6vcI99in70kCUBeNO xNcMaJfERiuz3LAAih/NmsLafg5V8BeIzjb2RDBl/YLUOqM2V9V1Lk4Pn/K5tgbmMKav 8ALEEmU6AF5nFt/+gR3a2ehoG9S3ZrKrilntzQtSs6vim4akehPvkVhybCV5UBVYiDd8 wcPkThCnOYlHwHy3ujnPOJJabY7jKE+pqIr432xKBx6TQ7VTQ0ivpDIjGCO4f2wo+ivk SQUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DhATBISC; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="ELKW/XRR"; 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 ds15-20020a170907724f00b007ae165c79c8si13099979ejc.940.2022.12.05.10.26.11; Mon, 05 Dec 2022 10:26:41 -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=DhATBISC; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="ELKW/XRR"; 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 S233008AbiLESZt (ORCPT + 99 others); Mon, 5 Dec 2022 13:25:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232261AbiLESZQ (ORCPT ); Mon, 5 Dec 2022 13:25:16 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59F0D20BD2; Mon, 5 Dec 2022 10:25:15 -0800 (PST) Date: Mon, 05 Dec 2022 18:25:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1670264712; 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=QpCdO9FRNd4C/C92Gqyt7WAp0J4mSYopV4Hm0MGrgoo=; b=DhATBISCsw7QKP2FQPEOfaMkle/6b7cCUotOpy1wIRGuu0bfq7gRVSE7vLRCHdomYU0DhK DV2Soo9/TJbYG/y/Z7BdQyo9V+2urbRswIQ6LisRXSiGrfEbYGmH6XH2koezFOXe2mvE2l 1g0wMljHrYsxWn58sWXb47nlIG3yh9IdXnoymZOTUWyYAZdSs1N8COE+18ZbgnoutYuLwt dBinsB0YoIZRKZBP5R75WF0mk/Rr/mS7ZjZ+MOO8/bGADGe8cuuSkFarSM230Mds3EKKzM PZ6+ufon0Zo16X4hH35mJBCEuXDod2G5eOwPyLAfkDKfTwlAYShmXoWP5WRd1w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1670264712; 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=QpCdO9FRNd4C/C92Gqyt7WAp0J4mSYopV4Hm0MGrgoo=; b=ELKW/XRRhUWM0vSlMDajJJKW+gO81rAy1NR7shRYH38Zgua+BA/8IhxWeVY/oYa27HkxRv JTqys2gUecRCmYCg== 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/core] PCI/MSI: Provide prepare_desc() MSI domain op Cc: Thomas Gleixner , Jason Gunthorpe , Kevin Tian , Bjorn Helgaas , Marc Zyngier , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221124232326.673658806@linutronix.de> References: <20221124232326.673658806@linutronix.de> MIME-Version: 1.0 Message-ID: <167026471199.4906.4942492414600624989.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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?1750426022928142676?= X-GMAIL-MSGID: =?utf-8?q?1751399583857130023?= The following commit has been merged into the irq/core branch of tip: Commit-ID: d9abbfee95e4a80dfbdf7030d0541a315ee2879b Gitweb: https://git.kernel.org/tip/d9abbfee95e4a80dfbdf7030d0541a315ee2879b Author: Thomas Gleixner AuthorDate: Fri, 25 Nov 2022 00:26:23 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 05 Dec 2022 19:21:04 +01:00 PCI/MSI: Provide prepare_desc() MSI domain op The setup of MSI descriptors for PCI/MSI-X interrupts depends partially on the MSI index for which the descriptor is initialized. Dynamic MSI-X vector allocation post MSI-X enablement allows to allocate vectors at a given index or at any free index in the available table range. The latter requires that the descriptor is initialized after the MSI core has chosen an index. Implement the prepare_desc() op in the PCI/MSI-X specific msi_domain_ops which is invoked before the core interrupt descriptor and the associated Linux interrupt number is allocated. That callback is also provided for the upcoming PCI/IMS implementations so the implementation specific interrupt domain can do their domain specific initialization of the MSI descriptors. Signed-off-by: Thomas Gleixner Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian Acked-by: Bjorn Helgaas Acked-by: Marc Zyngier Link: https://lore.kernel.org/r/20221124232326.673658806@linutronix.de --- drivers/pci/msi/irqdomain.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c index 4736403..8afaef1 100644 --- a/drivers/pci/msi/irqdomain.c +++ b/drivers/pci/msi/irqdomain.c @@ -202,6 +202,14 @@ static void pci_irq_unmask_msix(struct irq_data *data) pci_msix_unmask(irq_data_get_msi_desc(data)); } +static void pci_msix_prepare_desc(struct irq_domain *domain, msi_alloc_info_t *arg, + struct msi_desc *desc) +{ + /* Don't fiddle with preallocated MSI descriptors */ + if (!desc->pci.mask_base) + msix_prepare_msi_desc(to_pci_dev(desc->dev), desc); +} + static const struct msi_domain_template pci_msix_template = { .chip = { .name = "PCI-MSIX", @@ -212,6 +220,7 @@ static const struct msi_domain_template pci_msix_template = { }, .ops = { + .prepare_desc = pci_msix_prepare_desc, .set_desc = pci_device_domain_set_desc, },