Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752280AbdHGHid (ORCPT ); Mon, 7 Aug 2017 03:38:33 -0400 Received: from ozlabs.ru ([107.173.13.209]:52696 "EHLO ozlabs.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752241AbdHGHia (ORCPT ); Mon, 7 Aug 2017 03:38:30 -0400 From: Alexey Kardashevskiy To: linuxppc-dev@lists.ozlabs.org Cc: Alexey Kardashevskiy , David Gibson , kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, Yongji Xie , Eric Auger , Kyle Mahlkuch , Alex Williamson , Jike Song , Bjorn Helgaas , Robin Murphy , Joerg Roedel , Arvind Yadav , Benjamin Herrenschmidt , David Woodhouse , Kirti Wankhede , Mauricio Faria de Oliveira , Neo Jia , Paul Mackerras , Vlad Tsyrklevich , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v5 2/5] iommu: Set IOMMU_GROUP_CAP_ISOLATE_MSIX if MSI controller enables IRQ remapping Date: Mon, 7 Aug 2017 17:25:45 +1000 Message-Id: <20170807072548.3023-3-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170807072548.3023-1-aik@ozlabs.ru> References: <20170807072548.3023-1-aik@ozlabs.ru> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1203 Lines: 43 This sets IOMMU_GROUP_CAP_ISOLATE_MSIX to a group if MSI remapping is enabled on an IRQ domain; this is expected to set the capability on ARM. Signed-off-by: Alexey Kardashevskiy --- drivers/iommu/iommu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 6b2c34fe2c3d..e720e90fa93c 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -32,6 +32,7 @@ #include #include #include +#include #include static struct kset *iommu_group_kset; @@ -1028,6 +1029,7 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev) const struct iommu_ops *ops = dev->bus->iommu_ops; struct iommu_group *group; int ret; + struct irq_domain *d = dev_get_msi_domain(dev); group = iommu_group_get(dev); if (group) @@ -1070,6 +1072,11 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev) return ERR_PTR(ret); } + if (d && irq_domain_is_msi(d) && + irq_domain_hierarchical_is_msi_remap(d)) + iommu_group_set_caps(group, 0, + IOMMU_GROUP_CAP_ISOLATE_MSIX); + return group; } -- 2.11.0