From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756575AbbJUVwJ (ORCPT ); Wed, 21 Oct 2015 17:52:09 -0400 Received: from 8bytes.org ([81.169.241.247]:58956 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756522AbbJUVwC (ORCPT ); Wed, 21 Oct 2015 17:52:02 -0400 From: Joerg Roedel To: iommu@lists.linux-foundation.org Cc: Alex Williamson , Will Deacon , linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH 3/8] iommu: Add generic_device_group() function Date: Wed, 21 Oct 2015 23:51:38 +0200 Message-Id: <1445464303-18206-4-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445464303-18206-1-git-send-email-joro@8bytes.org> References: <1445464303-18206-1-git-send-email-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel This function can be used as a device_group call-back and just allocates one iommu-group per device. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 15 +++++++++++++++ include/linux/iommu.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index fdea700..a80c9c5 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -728,6 +728,21 @@ static int get_pci_alias_or_group(struct pci_dev *pdev, u16 alias, void *opaque) } /* + * Generic device_group call-back function. It just allocates one + * iommu-group per device. + */ +struct iommu_group *generic_device_group(struct device *dev) +{ + struct iommu_group *group; + + group = iommu_group_alloc(); + if (IS_ERR(group)) + return NULL; + + return group; +} + +/* * Use standard PCI bus topology, isolation features, and DMA alias quirks * to find or create an IOMMU group for a device. */ diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 8026e6a..c73824f 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -318,6 +318,8 @@ static inline size_t iommu_map_sg(struct iommu_domain *domain, /* PCI device grouping function */ extern struct iommu_group *pci_device_group(struct device *dev); +/* Generic device grouping function */ +extern struct iommu_group *generic_device_group(struct device *dev); #else /* CONFIG_IOMMU_API */ -- 1.9.1