Message ID | 20221121091328.184455059@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1635440wrr; Mon, 21 Nov 2022 06:55:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf5wP65XTcwRMRMIRSfiqNEUsnzQ5D5eAo6PKs9Vq54OiOa8qNoF+Lb2mvrCyhFyPyEpDFYR X-Received: by 2002:a17:902:e807:b0:186:fb90:5774 with SMTP id u7-20020a170902e80700b00186fb905774mr112604plg.137.1669042524037; Mon, 21 Nov 2022 06:55:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669042524; cv=none; d=google.com; s=arc-20160816; b=qZB7jW8MXiCg3lu+OSEgGjDEC2sYPrUJYlzFlyAN+qYKqh93jvcu1lf4wHa9i4MEJe WNJakgD6woH6ReOlPk9MB6C/ow44Q2mVHp8QNu35zWosi3gu5QyS6HiS2Nsijr167sKC 9xcKM2pA0RQX85uUHcQCjaAYyM3eRU02rjvGNoJCJGKmkQ3RsqwkA1JDrUllkx7kIznU x5oPCJ7SdQCLduJWtROcEWmhAaNibcXqeceZ0jTk4Aep7m9Xln3hqfPJuKQ+b6UhnI9o g2xkSoWXN0GeGG9VRnf4Qbl6lL5fIvgn2KsM05fD0XJDjFGcjBSjzxlab3TQXgD4lAXx 7DpA== 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=SuhbIxDBU+pgQkYaRbDZDx3XYR1ZMR159u+r/p3oNuI=; b=hCgwQ3G1/KWP7MjRJlgPY9vV0zrJ7vrB0aHjx/W6QnC2ShFUlSPHK4ICE3qXirMZwo NgP+scJhQt1fAVn/d7rk348g+ElrBCT1kw0DNCUusX8XWJkZoBJwxpTuokIW7iVoI5jm cAhqnd9ebwrwbI//3geG3VRisZs7TtB37+uaE0Q6Vbo4fuwOy1HiCO8lbHNgsRG7KtSA 47UQVagCQn2Kl1+rDxyr+iT0nZYZbH7pA9cYUJFrETOXwO5VDvPnP7Z+KH4MwYG9XLZt 36xB9kE/UtwsOpGZiveuOp9/e9frXAdAtzkpGToXqjkzl+Y/nhxZt6T7NFG6L3MnZi/H RQJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1psr2+6P; dkim=neutral (no key) header.i=@linutronix.de header.b=Rn8pzIZk; 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 o23-20020a63fb17000000b0046f75b665b8si10898210pgh.757.2022.11.21.06.55.06; Mon, 21 Nov 2022 06:55:24 -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=1psr2+6P; dkim=neutral (no key) header.i=@linutronix.de header.b=Rn8pzIZk; 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 S231934AbiKUOlZ (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Mon, 21 Nov 2022 09:41:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231714AbiKUOjY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 21 Nov 2022 09:39:24 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F270EC846A; Mon, 21 Nov 2022 06:38:26 -0800 (PST) Message-ID: <20221121091328.184455059@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669041505; 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=SuhbIxDBU+pgQkYaRbDZDx3XYR1ZMR159u+r/p3oNuI=; b=1psr2+6PEXY3YBQmmhtpss+e/EXa3fcuidPDiz2U/W/zlXsB2qLo8iCUiCbS/WujW3vE+h OXmLxsn8RCKMB14O6J4EekalasMdPu5542sb/8pz9abolCY9H2piNBDYa6c0a7lp+hRzoz fDbLxngNyek74VO0HsgdxY8ojuKCW0YldMTPdi+egcKZDdPxJDvehtF4066jgo1+3juDb8 q2LDrF4ftSwgbcXMmFNKh1gZuUo4Qj8lh64UQF8VFe1V5J6cYYY91uAYV6zLY5eXU/8kZ3 V8wBr9qz0yqwUrtTI6VQ7A7IbugtHPhbhK8pcaAFQlE31nxaTvGPchh741n2TQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669041505; 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=SuhbIxDBU+pgQkYaRbDZDx3XYR1ZMR159u+r/p3oNuI=; b=Rn8pzIZk+L7xOktcHzTRG9gckCOFAhYH4n4XxaFboCMQqeHg4TQPOweQ7JbeSWvSySHefJ N4ipPb0kY1QPg9Aw== From: Thomas Gleixner <tglx@linutronix.de> To: LKML <linux-kernel@vger.kernel.org> Cc: x86@kernel.org, Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>, linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, Marc Zyngier <maz@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jason Gunthorpe <jgg@mellanox.com>, Dave Jiang <dave.jiang@intel.com>, Alex Williamson <alex.williamson@redhat.com>, Kevin Tian <kevin.tian@intel.com>, Dan Williams <dan.j.williams@intel.com>, Logan Gunthorpe <logang@deltatee.com>, Ashok Raj <ashok.raj@intel.com>, Jon Mason <jdmason@kudzu.us>, Allen Hubbe <allenbh@gmail.com> Subject: [patch V2 31/33] iommu/vt-d: Enable PCI/IMS References: <20221121083657.157152924@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Mon, 21 Nov 2022 15:38:24 +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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750117933708714565?= X-GMAIL-MSGID: =?utf-8?q?1750117933708714565?= |
Series |
genirq, PCI/MSI: Support for per device MSI and PCI/IMS - Part 3 implementation
|
|
Commit Message
Thomas Gleixner
Nov. 21, 2022, 2:38 p.m. UTC
PCI/IMS works like PCI/MSI-X in the remapping. Just add the feature flag.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/iommu/intel/irq_remapping.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
> From: Thomas Gleixner <tglx@linutronix.de> > Sent: Monday, November 21, 2022 10:38 PM > > PCI/IMS works like PCI/MSI-X in the remapping. Just add the feature flag. > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de> > --- > drivers/iommu/intel/irq_remapping.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > --- a/drivers/iommu/intel/irq_remapping.c > +++ b/drivers/iommu/intel/irq_remapping.c > @@ -1429,7 +1429,9 @@ static const struct irq_domain_ops intel > }; > > static const struct msi_parent_ops dmar_msi_parent_ops = { > - .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | > MSI_FLAG_MULTI_PCI_MSI, > + .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | > + MSI_FLAG_MULTI_PCI_MSI | > + MSI_FLAG_PCI_IMS, > .prefix = "IR-", > .init_dev_msi_info = msi_parent_init_dev_msi_info, > }; vIR is already available on vIOMMU today [1]. Fortunately both intel/amd IOMMU has a way to detect whether it's a vIOMMU. For intel it's cap_caching_mode(). For AMD it's amd_iommu_np_cache. Then MSI_FLAG_PCI_IMS should be set only on physical IOMMU. In the future once we have hypercall then it can be set on vIOMMU too. [1] https://lore.kernel.org/all/BL1PR11MB5271326D39DAB692F07587768C739@BL1PR11MB5271.namprd11.prod.outlook.com/
On Thu, Nov 24 2022 at 03:17, Kevin Tian wrote: >> static const struct msi_parent_ops dmar_msi_parent_ops = { >> - .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | >> MSI_FLAG_MULTI_PCI_MSI, >> + .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | >> + MSI_FLAG_MULTI_PCI_MSI | >> + MSI_FLAG_PCI_IMS, >> .prefix = "IR-", >> .init_dev_msi_info = msi_parent_init_dev_msi_info, >> }; > > vIR is already available on vIOMMU today [1]. > > Fortunately both intel/amd IOMMU has a way to detect whether it's a vIOMMU. > > For intel it's cap_caching_mode(). > > For AMD it's amd_iommu_np_cache. > > Then MSI_FLAG_PCI_IMS should be set only on physical IOMMU. Ok. Let me fix that then. But that made me read back some more. Jason said, that the envisioned Mellanox use case does not depend on the IOMMU because the card itself has one which takes care of the protections. How are we going to resolve that dilemma? Thanks, tglx
On Thu, Nov 24, 2022 at 10:37:53AM +0100, Thomas Gleixner wrote: > On Thu, Nov 24 2022 at 03:17, Kevin Tian wrote: > >> static const struct msi_parent_ops dmar_msi_parent_ops = { > >> - .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | > >> MSI_FLAG_MULTI_PCI_MSI, > >> + .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | > >> + MSI_FLAG_MULTI_PCI_MSI | > >> + MSI_FLAG_PCI_IMS, > >> .prefix = "IR-", > >> .init_dev_msi_info = msi_parent_init_dev_msi_info, > >> }; > > > > vIR is already available on vIOMMU today [1]. > > > > Fortunately both intel/amd IOMMU has a way to detect whether it's a vIOMMU. > > > > For intel it's cap_caching_mode(). > > > > For AMD it's amd_iommu_np_cache. > > > > Then MSI_FLAG_PCI_IMS should be set only on physical IOMMU. > > Ok. Let me fix that then. > > But that made me read back some more. > > Jason said, that the envisioned Mellanox use case does not depend on the > IOMMU because the card itself has one which takes care of the > protections. Right, but that doesn't mean we need the physical iommu turned off. Setting the mlx pci device to identity mode is usually enough to get back to full performance. > How are we going to resolve that dilemma? The outcome is we don't have a strategy right now to make IMS work in VMs. This series is all about making it work on physical machines, that has to be a good first step. I'm hoping the OCP work stream on SIOV will tackle how to fix the interrupt problems. Some of the ideas I've seen could be formed into something that would work in a VM. Jason
On Thu, Nov 24 2022 at 09:14, Jason Gunthorpe wrote: > On Thu, Nov 24, 2022 at 10:37:53AM +0100, Thomas Gleixner wrote: >> Jason said, that the envisioned Mellanox use case does not depend on the >> IOMMU because the card itself has one which takes care of the >> protections. > > Right, but that doesn't mean we need the physical iommu turned > off. Setting the mlx pci device to identity mode is usually enough to > get back to full performance. Ok. >> How are we going to resolve that dilemma? > > The outcome is we don't have a strategy right now to make IMS work in > VMs. This series is all about making it work on physical machines, > that has to be a good first step. > > I'm hoping the OCP work stream on SIOV will tackle how to fix the > interrupt problems. Some of the ideas I've seen could be formed into > something that would work in a VM. Fair enough. Let me put the limitation into effect then. Thanks, tglx
> From: Thomas Gleixner <tglx@linutronix.de> > Sent: Thursday, November 24, 2022 9:21 PM > > On Thu, Nov 24 2022 at 09:14, Jason Gunthorpe wrote: > > On Thu, Nov 24, 2022 at 10:37:53AM +0100, Thomas Gleixner wrote: > >> Jason said, that the envisioned Mellanox use case does not depend on the > >> IOMMU because the card itself has one which takes care of the > >> protections. > > > > Right, but that doesn't mean we need the physical iommu turned > > off. Setting the mlx pci device to identity mode is usually enough to > > get back to full performance. > > Ok. yes. IR can be enabled orthogonal to DMA mapping mode in IOMMU. > > >> How are we going to resolve that dilemma? > > > > The outcome is we don't have a strategy right now to make IMS work in > > VMs. This series is all about making it work on physical machines, > > that has to be a good first step. yes, that is the point. As long as IMS is disabled in the guest it's already a good first step for the moment. > > > > I'm hoping the OCP work stream on SIOV will tackle how to fix the > > interrupt problems. Some of the ideas I've seen could be formed into > > something that would work in a VM. > > Fair enough. > > Let me put the limitation into effect then. > > Thanks, > > tglx
--- a/drivers/iommu/intel/irq_remapping.c +++ b/drivers/iommu/intel/irq_remapping.c @@ -1429,7 +1429,9 @@ static const struct irq_domain_ops intel }; static const struct msi_parent_ops dmar_msi_parent_ops = { - .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | MSI_FLAG_MULTI_PCI_MSI, + .supported_flags = X86_VECTOR_MSI_FLAGS_SUPPORTED | + MSI_FLAG_MULTI_PCI_MSI | + MSI_FLAG_PCI_IMS, .prefix = "IR-", .init_dev_msi_info = msi_parent_init_dev_msi_info, };