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=-8.3 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,USER_AGENT_SANE_1 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 76B4BC28CBC for ; Mon, 4 May 2020 01:53:14 +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 48BEA20735 for ; Mon, 4 May 2020 01:53:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GXgpKAGA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48BEA20735 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com 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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oHcjlM1arstwIsxsjdq62SEYozfN8+Mnw0pQoek/sTc=; b=GXgpKAGAZNYjZXp5coJJC93Tr LTxHg3dHvuQPJpPoiMJIzVtcNF3RfsE9Sm7s3fJIkie8CNdVW+Ea/x1Ngzs1dH7zSftg0tg7grON1 SLFX5/+UBCJzVFLrMRwfKnqiv3U4jyGFAN+y5eZHX3AbtwJ+3trciJRhi4V1MLW+G7Puvh7sWvYZQ lYqCIsfgby89TtOHY1oCFtqVsYawbMr5HqqNhKPAUAWPI4t8YqeMkcAtb+SfY9pcKzSKIYX/hnuCP 8yTS+mPAoSFvXBs5ond4/RWfg9y1Ek5R3vePCoaD+vJXwf2Km/HIKBriULSm/Hfqi5ZJgmWSDN8HZ PdBtr9CxQ==; 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 1jVQIB-0001eS-7o; Mon, 04 May 2020 01:53:11 +0000 Received: from szxga06-in.huawei.com ([45.249.212.32] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVQI7-0001cH-TZ for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 01:53:09 +0000 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 9683FB5E5B4FEA773DF0; Mon, 4 May 2020 09:52:54 +0800 (CST) Received: from [127.0.0.1] (10.67.101.242) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Mon, 4 May 2020 09:52:45 +0800 Subject: Re: [PATCH v6 01/25] mm: Add a PASID field to mm_struct To: Jean-Philippe Brucker , , , , , References: <20200430143424.2787566-1-jean-philippe@linaro.org> <20200430143424.2787566-2-jean-philippe@linaro.org> From: Xu Zaibo Message-ID: Date: Mon, 4 May 2020 09:52:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20200430143424.2787566-2-jean-philippe@linaro.org> X-Originating-IP: [10.67.101.242] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200503_185308_130925_513A4506 X-CRM114-Status: GOOD ( 14.20 ) 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: fenghua.yu@intel.com, kevin.tian@intel.com, jacob.jun.pan@linux.intel.com, jgg@ziepe.ca, catalin.marinas@arm.com, joro@8bytes.org, robin.murphy@arm.com, hch@infradead.org, zhangfei.gao@linaro.org, Jonathan.Cameron@huawei.com, felix.kuehling@amd.com, will@kernel.org, christian.koenig@amd.com, baolu.lu@linux.intel.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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? Thanks, Zaibo . > } __randomize_layout; > > /* _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel