Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751834AbbK1MUI (ORCPT ); Sat, 28 Nov 2015 07:20:08 -0500 Received: from 8bytes.org ([81.169.241.247]:37105 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751091AbbK1MUD (ORCPT ); Sat, 28 Nov 2015 07:20:03 -0500 Date: Sat, 28 Nov 2015 13:19:58 +0100 From: Joerg Roedel To: chenfeng Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, devicetree@vger.kernel.org, puck.chen@aliyun.com, w.f@huawei.com, xuwei5@hisilicon.com, guodong.xu@linaro.org, arnd@linaro.org, haojian.zhuang@linaro.org Subject: Re: [PATCH V5 RESEND 2/3] iommu/hisilicon: Add hi6220-SoC smmu driver Message-ID: <20151128121958.GA18805@8bytes.org> References: <1447986309-47548-1-git-send-email-puck.chen@hisilicon.com> <1447986309-47548-3-git-send-email-puck.chen@hisilicon.com> <20151127120203.GI24300@8bytes.org> <56590F22.90105@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56590F22.90105@hisilicon.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1844 Lines: 42 On Sat, Nov 28, 2015 at 10:19:14AM +0800, chenfeng wrote: > On 2015/11/27 20:02, Joerg Roedel wrote: > > You need to create an iommu-group per smmu in your system and put all > > devices translated by this smmu in that group. And then you must change > > your code to allow attaching/detaching this iommu-group to different > > domains. > > > I read the code,I am confused about these concepts. > In my opinion, > IOMMU-Domain: The masters in one domain share the same iova space. Is that right? Yes, an iommu-domain is an abstraction of a single page-table and describes one iova address space. The SMMU in your hardware supports only on page-table, so all devices behind it share a single iova address space, und must be in the same domain. But the way you implemented it there could be only one domain per SMMU. With the IOMMU-API we must support to change the domain of an SMMU. Think of one domain for DMA-API usage and another for VFIO, for example. > IOMMU-GROUP: As you mentioned up,all devices translated by this smmu > should be into one group. I can do this. But if there is only on > domain in the system, how can I attaching/detaching the group to > different domains. IOMMU-groups describe the isolation capabilities of the IOMMU between devices. If devices are in a different IOMMU-group, this means that the hardware can isolate them from each other. Attaching the devices in a group to a new domain means in your case, that you set a different page-table for them. Since you can only do that for all devices behind a SMMU, these devices must be in on IOMMU-group. Joerg -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/