From patchwork Mon Nov 21 14:36:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 23790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1626328wrr; Mon, 21 Nov 2022 06:37:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Gf9L1Zb+luvXCojKhDwOeUtimJDqROeK7RtodwUORnD/m7n5RK9mesQ3Bhwv499mpK3tt X-Received: by 2002:a05:6a00:27ab:b0:56c:71a4:efe with SMTP id bd43-20020a056a0027ab00b0056c71a40efemr3515297pfb.84.1669041449524; Mon, 21 Nov 2022 06:37:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669041449; cv=none; d=google.com; s=arc-20160816; b=1LgKVl/KSxmMTzkSQtIMqydnm3up+ZNfva+XS1lD/ylWEZDGnABI6noTAdJNfGwoim BuAjZuDhsXefl6BfjVxNcEJou3STQRLDwGbh3yJHvQFMjfnLDQ5pNKcDTAdiJvxJeE8m GfCyN06d58nqidYw6/fRXWb8vXf8h2tW09t1XvpSWdALUyPt92sfFo4OWZi5D3dIiyq7 SHY7KVSBGxym8li4meZKZY7MTAvt5gFfNyErE7pUXj4HKTCuqUl1H6njN+Thvk3FS/p/ Jlh2Zgb+tMo/Kbr5iMHQjkiEM6zc0cCk044YDr+Cy61X18p+BtQ/P5dlipCpO1lwGFhh 2dQw== 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=XzEU6xpUtYERldMqsji8DXGQ2kRnY83P6uKMpYacBXc=; b=GgfdRvaMR56y3cJAslVT1/FIE2VHJznfO/6DU4ejUe9mpiVVJl6f41zVZcPdNe13q5 AEWZVOGDwc/ePla0v58xhWpp1CxRUIwwRdQiCfR8rqtIgwA4qUhtAb9Mk1jhrn3tN66L 0jPo4jhPQwMaS7m8Ron1a8gIJhTs/peE5oRlVgkoWbJp+ICeNUGJtKXvZQAvbT0z7AIZ 5U2nBhCmW7UvehkyHk8KYOtdf042RODVxNNeoCWCld2MEWi+iwy6YjAJbvmOGcrj38It 8ACXFj+D4Y+fGxPGb1oAIe2wSuCMRwFF+IsNRrzQZ9MUko7k4scSZIIvWmUQc3b6aLWK NZNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dU8Pv1A3; dkim=neutral (no key) header.i=@linutronix.de header.b=9Rk1Rpr8; 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 z6-20020a1709027e8600b0018867e3182esi11057218pla.335.2022.11.21.06.37.13; Mon, 21 Nov 2022 06:37:29 -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=dU8Pv1A3; dkim=neutral (no key) header.i=@linutronix.de header.b=9Rk1Rpr8; 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 S229985AbiKUOgu (ORCPT + 99 others); Mon, 21 Nov 2022 09:36:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231200AbiKUOgh (ORCPT ); Mon, 21 Nov 2022 09:36:37 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16BEBC80EF; Mon, 21 Nov 2022 06:36:21 -0800 (PST) Message-ID: <20221121083325.573428885@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669041379; 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=XzEU6xpUtYERldMqsji8DXGQ2kRnY83P6uKMpYacBXc=; b=dU8Pv1A3KUHAjBDxJCqRcuMbTTS80Mc9lLCZK9YTQfwuRkQG4KnB7JSpzEEgcazLqmhi+l GFCfaHXM2ER96zq2r0Xi+UM6H83wimW9tR1zE0vhzqSSi4NafFsz5bXbM6dGdsJjKUdiPx rxgIb4NqlHDYu0592wWnTFdv4mbSy03cWeWNDvBL+pvlybHGuLYmN0vhriVCH3Xs2/BNkJ h8wQunObOJceMdqn2Welwg5gVQdLuBmt6tqUdE4sHj1l8SVXSLRtVlvtBJyViyV7+vsfdP dXdBwDLc/hp01ZyPTMzJPIOV6fandAXVQhzMthGzYTDX3Cs8eh6S5AS4/cVfDw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669041379; 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=XzEU6xpUtYERldMqsji8DXGQ2kRnY83P6uKMpYacBXc=; b=9Rk1Rpr8yUYA05RyCHr0jXkegrQlwrh5f3aqgh5NaQ1HphRHReVuGD6lvPq8XCdKSk5c6w mIaWKFsPb4X/QqDA== From: Thomas Gleixner To: 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 , Dave Jiang , Alex Williamson , Kevin Tian , Dan Williams , Logan Gunthorpe , Ashok Raj , Jon Mason , Allen Hubbe , Jason Gunthorpe Subject: [patch V2 01/21] genirq/msi: Move IRQ_DOMAIN_MSI_NOMASK_QUIRK to MSI flags References: <20221121083210.309161925@linutronix.de> MIME-Version: 1.0 Date: Mon, 21 Nov 2022 15:36:19 +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?1750116807091737668?= X-GMAIL-MSGID: =?utf-8?q?1750116807091737668?= It's truly a MSI only flag and for the upcoming per device MSI domains this must be in the MSI flags so it can be set during domain setup without exposing this quirk outside of x86. Signed-off-by: Thomas Gleixner Reviewed-by: Jason Gunthorpe Acked-by: Marc Zyngier --- arch/x86/kernel/apic/msi.c | 5 ++--- include/linux/irqdomain.h | 9 +-------- include/linux/msi.h | 6 ++++++ kernel/irq/msi.c | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) --- a/arch/x86/kernel/apic/msi.c +++ b/arch/x86/kernel/apic/msi.c @@ -176,7 +176,8 @@ static struct msi_domain_ops pci_msi_dom static struct msi_domain_info pci_msi_domain_info = { .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | - MSI_FLAG_PCI_MSIX, + MSI_FLAG_PCI_MSIX | MSI_FLAG_NOMASK_QUIRK, + .ops = &pci_msi_domain_ops, .chip = &pci_msi_controller, .handler = handle_edge_irq, @@ -200,8 +201,6 @@ struct irq_domain * __init native_create if (!d) { irq_domain_free_fwnode(fn); pr_warn("Failed to initialize PCI-MSI irqdomain.\n"); - } else { - d->flags |= IRQ_DOMAIN_MSI_NOMASK_QUIRK; } return d; } --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -186,15 +186,8 @@ enum { /* Irq domain implements MSI remapping */ IRQ_DOMAIN_FLAG_MSI_REMAP = (1 << 5), - /* - * Quirk to handle MSI implementations which do not provide - * masking. Currently known to affect x86, but partially - * handled in core code. - */ - IRQ_DOMAIN_MSI_NOMASK_QUIRK = (1 << 6), - /* Irq domain doesn't translate anything */ - IRQ_DOMAIN_FLAG_NO_MAP = (1 << 7), + IRQ_DOMAIN_FLAG_NO_MAP = (1 << 6), /* * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -399,6 +399,12 @@ enum { MSI_FLAG_ALLOC_SIMPLE_MSI_DESCS = (1 << 9), /* Free MSI descriptors */ MSI_FLAG_FREE_MSI_DESCS = (1 << 10), + /* + * Quirk to handle MSI implementations which do not provide + * masking. Currently known to affect x86, but has to be partially + * handled in the core MSI code. + */ + MSI_FLAG_NOMASK_QUIRK = (1 << 11), }; int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask, --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -875,7 +875,7 @@ static int __msi_domain_alloc_irqs(struc * MSI affinity setting requires a special quirk (X86) when * reservation mode is active. */ - if (domain->flags & IRQ_DOMAIN_MSI_NOMASK_QUIRK) + if (info->flags & MSI_FLAG_NOMASK_QUIRK) vflags |= VIRQ_NOMASK_QUIRK; }