From patchwork Fri Nov 11 13:56:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 18796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp755501wru; Fri, 11 Nov 2022 06:02:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf4apKxY6xO29iFHhBjZ7WZ0p37LlaAHCsLpfgo43JN9jGlAauI1z14rwAjOOiWMnOFZ3wDE X-Received: by 2002:a17:906:c082:b0:7ad:f43a:cb0a with SMTP id f2-20020a170906c08200b007adf43acb0amr1828449ejz.560.1668175316852; Fri, 11 Nov 2022 06:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668175316; cv=none; d=google.com; s=arc-20160816; b=iNa3nWgeznuh3GRDef5gNz5of1T6F2frm6K6QvjBttwSIWvJyBbKmGopF6/gfB4320 Ds2vR8c3XyA/b6AQWTMGFcLU1VvWHyV8YgvX9SaSgZVNthh6zpR4XIG5uFoO2MWnDoRx +OqLaCmYeTfXoEIe2B58LQcPydIpHVd+HmIW1LPqmeYgnXtU6cqre76eZArvX/06Eani pQUpRjF4Kw9STocJOU7tKdpD8UOXqNscFiR0KIxP0XM4rcGV1zE/HEp1OHchj7kZJ4aS m8Myu75vxqgivL1yehQSO+stCEa4bY+MoCgy5kfYCN555aueK0YSquUNoOHzbHzuNXOM OoIg== 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=AJ8ukewK1Vm9sMuQ8J9M/D1xUb59WLt5C0IKQaGN9eI=; b=pYf5DX+x85ZwtTDOoSxAQG2BKg5NOZw22f9fOgs1arHpqsVhFzDztj7p57kR2W0h18 yVDX8B/GOBGoblOv4lrDWNpI1H7arasp7+fKzt1UcWAOmnbRD8VBBwoL/WiOXgi0yQDV uh+sFAtW3VrVp2vylewaEI2PUl6xAZGdJ9o43LLPH9+cGLrF9ElL94vkUC4ibzxssDBD 37K+ihrtCazYFhlvvo3VuY+kECX/Zxf+PlaAtJfWwKRdWlzyimdBczeKdcBYyMk7gx/f A48/0HLL8dI7saJZWC/pz0XB0AXXWHPUhuJlY5Uxv8msEJQFFl/wecn81iyZAtoj3Rpm s/iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=nQh29gwW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 dn17-20020a17090794d100b00797670441desi2028131ejc.911.2022.11.11.06.01.31; Fri, 11 Nov 2022 06:01:56 -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=nQh29gwW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S234131AbiKKOAl (ORCPT + 99 others); Fri, 11 Nov 2022 09:00:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234173AbiKKOAO (ORCPT ); Fri, 11 Nov 2022 09:00:14 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F313391C5; Fri, 11 Nov 2022 05:56:41 -0800 (PST) Message-ID: <20221111132706.104870257@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668174999; 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=AJ8ukewK1Vm9sMuQ8J9M/D1xUb59WLt5C0IKQaGN9eI=; b=nQh29gwWm+mp9adZ3XnFqZww6hDJZUArAFgW9DLxJ58tiv3rjxKjGS28S3LLejO0X1RYiF ujFOqd1MgCxdHFGOM04FZBbCC0goBivqH06V4EE8P4dFkOZPIKEP19hPgZJ9OCn25oN1rC tCM3GVTfL8UsM4IOIXfSvv8XMNh6AVjTpNBWx3jWcq5zMdtgNhn8NFAzoaTf5d4iZwqxns dYCWNQFMqkn7zvgRgvaYUxoHRVwfUgLAVaytq36O9SdC+zPnQvsZ3MX3e59xHTc4HO7lna 2Vp3WjJCbFzt1spSfRA1RbK3Mgw6wn5gAVDXBiWZ+oobxvkXGzgphhVw/nblog== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668174999; 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=AJ8ukewK1Vm9sMuQ8J9M/D1xUb59WLt5C0IKQaGN9eI=; b=HQtH4ThXuPL/qsID3YXyZfhFETiPGyK/Ea/QVJX0HE4KqZFZQsfNyTlKIEOa8bsCYJIy5r A3W2Mpv1WtQCl2Bw== 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 , "Ahmed S. Darwish" , Reinette Chatre Subject: [patch 01/20] genirq/msi: Move IRQ_DOMAIN_MSI_NOMASK_QUIRK to MSI flags References: <20221111131813.914374272@linutronix.de> MIME-Version: 1.0 Date: Fri, 11 Nov 2022 14:56:39 +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?1749208600821149597?= X-GMAIL-MSGID: =?utf-8?q?1749208600821149597?= 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 --- 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 @@ -395,6 +395,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; }