From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F264FC3A5A9 for ; Mon, 4 May 2020 16:29:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C6773206D9 for ; Mon, 4 May 2020 16:29:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NKn+K0RC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="s6Hn20ig" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6773206D9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yV4R7g6rnutC02FIKVt1mQlcTjzOicaBHXDq+lk1VhE=; b=NKn+K0RC5A/DAD nACzkD5CN3cgfH90PssGH5APqgKr5m/1rbGJuaT7rEmlb7HRY9b/OosjDJ+1gdd0z/9CJGFwH90Db t5uW00+ktUFl9SKyOw2lgE0d4mWgMWZ2AHEzd7Y/iFmIAItfDeDa22Ovsy/HtewLfMH2fbjMsqC3F bVcLQABUKRRLRZc6cqjHgUTWwHrUf+ayxiU6uJ96QDYMBJ1hk+/TIOC3LREF+p5zI/vNncGa8+dIW +15bVE5zAff5BB3KZf6GidqXSsGfwGdxdl1q3vGSs/K3oXLXFIe2CA5lmSsLsiblN1BkLA96qK2EF khByT+xjrS3CDjktyvPQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVdy2-0000dN-Er; Mon, 04 May 2020 16:29:18 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVdy0-0000cO-2i for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 16:29:17 +0000 Received: by mail-wr1-x443.google.com with SMTP id i10so21698525wrv.10 for ; Mon, 04 May 2020 09:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/BYU4Om8WCi34VBttwlHwqi6sY2A9tyjvz9dkBW4YR0=; b=s6Hn20ig/1KbhienjCm7bWbYtxGwNnasjezCMNITDVyM/NfgWs1dMhB2gCybX/gMQM 3PvzgyisZ2pcL/5UM64ddSx6TGvAftzzX2OE4x2ldSBevHUIJbL1Lh1SiucuLKAInJzC JyGj2737261kvOO484ymYbWd/jxHFDiMYcTkvLmUpxHi1Y6R9OGmzwL+SyZduBlcfchC yt06HQpOncV1dier8AcJ71lobnxArlTYPJOBYmytmIEueWGSRW/a8lt5bEx+1Kv93NkY QrDTWiKqlp5t4HiJUdr0nvqoLZypO0n42pp908ZiZk6LUi9G3Qz27wXfntChz79dBe0/ HgwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/BYU4Om8WCi34VBttwlHwqi6sY2A9tyjvz9dkBW4YR0=; b=QxnBNUPtXTrXzXrAeU1EhE/Meyiw8PTvFgATYJiUAqqxauSkit7VTmbGqrijFHMqAu f7SKuX/qpeB94oOeAOLtrqi+5WqO9XqqXLT8BqxAzuLsVKgN7aP9Y7lPmeBW/4ljCGml iSAnwttVl2D0qkeFEhfgKsIMtwYicTnsrUXefY5UfMtPXy0PDo0quybaX4TUO16Rf3BR eDQ0XDbIuDEgQur1hz9+gwS3g4NcRv3avTPud/exdxLdpS9lyeQ9lzrXYJze9Sorjw7n BAF84WnYVkdsleiJ0pb6Ld1Znbu/db4V9avkrPwZetIVkrfx8OEDHLmlxqhQpnmOzWZ2 3cbg== X-Gm-Message-State: AGi0PuY6LhggpzZLv70G2OIe8UKDu+LWp6SIJyivgz6B2/A5ex8WYVbE wv6ckhsjYiDKB43r9ur/ox7C3A== X-Google-Smtp-Source: APiQypIHji+0UmZIp3eRiES/RsK7nvGgkSn0DrHKmgTnip/V9mOn0fBeB0vJOAU40Okt9fYQT7236g== X-Received: by 2002:adf:ed86:: with SMTP id c6mr159739wro.124.1588609753958; Mon, 04 May 2020 09:29:13 -0700 (PDT) Received: from myrica ([2001:171b:226e:c200:c43b:ef78:d083:b355]) by smtp.gmail.com with ESMTPSA id l5sm13656680wmi.22.2020.05.04.09.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 09:29:13 -0700 (PDT) Date: Mon, 4 May 2020 18:29:03 +0200 From: Jean-Philippe Brucker To: Xu Zaibo Subject: Re: [PATCH v6 01/25] mm: Add a PASID field to mm_struct Message-ID: <20200504162903.GH170104@myrica> References: <20200430143424.2787566-1-jean-philippe@linaro.org> <20200430143424.2787566-2-jean-philippe@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_092916_124035_D3D637AE X-CRM114-Status: GOOD ( 16.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, kevin.tian@intel.com, jacob.jun.pan@linux.intel.com, jgg@ziepe.ca, linux-pci@vger.kernel.org, joro@8bytes.org, Jonathan.Cameron@huawei.com, robin.murphy@arm.com, fenghua.yu@intel.com, hch@infradead.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, zhangfei.gao@linaro.org, catalin.marinas@arm.com, felix.kuehling@amd.com, will@kernel.org, christian.koenig@amd.com, linux-arm-kernel@lists.infradead.org, baolu.lu@linux.intel.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, May 04, 2020 at 09:52:44AM +0800, Xu Zaibo wrote: > > On 2020/4/30 22:34, Jean-Philippe Brucker wrote: > > Some devices can tag their DMA requests with a 20-bit Process Address > > Space ID (PASID), allowing them to access multiple address spaces. In > > combination with recoverable I/O page faults (for example PCIe PRI), > > PASID allows the IOMMU to share page tables with the MMU. > > > > To make sure that a single PASID is allocated for each address space, as > > required by Intel ENQCMD, store the PASID in the mm_struct. The IOMMU > > driver is in charge of serializing modifications to the PASID field. > > > > Signed-off-by: Jean-Philippe Brucker > > --- > > For the field's validity I'm thinking invalid PASID = 0. In ioasid.h we > > define INVALID_IOASID as ~0U, but I think we can now change it to 0, > > since Intel is now also reserving PASID #0 for Transactions without > > PASID and AMD IOMMU uses GIoV for this too. > > --- > > include/linux/mm_types.h | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > > index 4aba6c0c2ba80..8db6472758175 100644 > > --- a/include/linux/mm_types.h > > +++ b/include/linux/mm_types.h > > @@ -534,6 +534,10 @@ struct mm_struct { > > atomic_long_t hugetlb_usage; > > #endif > > struct work_struct async_put_work; > > +#ifdef CONFIG_IOMMU_SUPPORT > > + /* Address space ID used by device DMA */ > > + unsigned int pasid; > > +#endif > Maybe '#ifdef CONFIG_IOMMU_SVA ... #endif' is more reasonable? CONFIG_IOMMU_SVA enables a few helpers but IOMMU drivers don't have to use them, so I think IOMMU_SUPPORT is more appropriate. Thanks, Jean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel