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=-3.8 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS 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 4C3C9ECDE30 for ; Wed, 17 Oct 2018 14:22:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1EA221526 for ; Wed, 17 Oct 2018 14:22:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="DHhkb6x2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1EA221526 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-pci-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727095AbeJQWR5 (ORCPT ); Wed, 17 Oct 2018 18:17:57 -0400 Received: from mail-eopbgr40062.outbound.protection.outlook.com ([40.107.4.62]:26912 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726974AbeJQWR4 (ORCPT ); Wed, 17 Oct 2018 18:17:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nyLikbyNt9nqptay8fNa5Wi197JVCg2TNYUQvw4QGu4=; b=DHhkb6x2juKpaSq0K7MKEit5hzwu6ZN+PscGAsQbl1YhZZ6F83Z5WK3vtwsJTiMzLx20mh/M+4M469ZqxlGgsGKL0Un3c4MfHILUnTFokn8O44TklAE+3BromJlyeZtanmMYEsa5ov3UaYAuOyAOAo6TD7ODXlr59PTQCLexpoE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jean-Philippe.Brucker@arm.com; Received: from [10.1.196.78] (217.140.106.50) by AM6PR08MB3046.eurprd08.prod.outlook.com (2603:10a6:209:45::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23; Wed, 17 Oct 2018 14:21:56 +0000 Subject: Re: [RFC PATCH v3 10/10] iommu/sva: Add support for private PASIDs To: iommu@lists.linux-foundation.org, joro@8bytes.org, linux-pci@vger.kernel.org, alex.williamson@redhat.com, Jonathan.Cameron@huawei.com, jacob.jun.pan@linux.intel.com, christian.koenig@amd.com, eric.auger@redhat.com, kevin.tian@intel.com, yi.l.liu@intel.com, andrew.murray@arm.com, will.deacon@arm.com, robin.murphy@arm.com, ashok.raj@intel.com, baolu.lu@linux.intel.com, xuzaibo@huawei.com, liguozhu@hisilicon.com, okaya@codeaurora.org, bharatku@xilinx.com, ilias.apalodimas@linaro.org, shunyong.yang@hxt-semitech.com References: <20180920170046.20154-1-jean-philippe.brucker@arm.com> <20180920170046.20154-11-jean-philippe.brucker@arm.com> <20181012143229.GI9977@jcrouse-lnx.qualcomm.com> From: Jean-Philippe Brucker Message-ID: <3e1b58bb-eb16-5855-2922-2b15b37ba971@arm.com> Date: Wed, 17 Oct 2018 15:21:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20181012143229.GI9977@jcrouse-lnx.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Originating-IP: [217.140.106.50] X-ClientProxiedBy: CWLP265CA0282.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:5c::30) To AM6PR08MB3046.eurprd08.prod.outlook.com (2603:10a6:209:45::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ccbf26b4-a96e-4556-8885-08d6343be4e0 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:AM6PR08MB3046; X-Microsoft-Exchange-Diagnostics: 1;AM6PR08MB3046;3:+WIzm1PWy7U8xqpeq8f6xKZzVz779eXqiql0FksedAAGmDw4DX+5Ms2WrbiQDhcSVjjJ2vR0zMQhV5TtT5BO4eGDEsK6UgsXE9X6/Tc7xRjLLzWSPPeGfPZUE04JetT9wAqGnsOdTm7ENirSLxCK3KYf0ymyailQpsEVglZF9AUpFRPGiOHl+JKrAMIx8MuMma+Shi4CEU/nlie9m/cvl2fGS7784meaC8YumWbhw8f6sDaZ8mmFUbtW80b/ambq;25:RxxdKsHRZ+RryLhXsRz7BWeQrQUuODpgfFDTDqkQdEJL26nfQr81Klu+wIM03dmKRTvSA0DE3nHRYLTyXW8A0WPZiW8ExgMZLEA+xRNX9MJdUWUmTf8+7qwhwVmvk73cVXGC6gp1DDz1hdsTBrIdfvlZbx3ZQOzK5zgWB79fzTLE1YQzjXP9GcR5EV65PLhUVyPWCEZw+sUAcd8Kj/wot6oZsl1VC5hPvs/LXf5bviQPX+PblXryYK21o68Fm1rUkgvG/r8tmXcraiJ9IQ8jMsSJuqs4ExVqAtiv7+f9sFY+DlWbu6dgBp0qA9xHAzcCpgcDR95RFGi1OuVuQCGQkA==;31:SQDmrW7xBR1TWmlISPkiiBB/payvKZaBKZ7BvMmOIs6OxREqamtKajwfGnPYtnd62O66LIigBVhaOSMAfrQnV52v5/9YXrUqkncEAts7YM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Ob58ssXz14iSS+4nPjstjH/akQjIkM3GEAWXmRP2AZcEBwK1TsyLzuJr5A2g/ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(788757137089)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:AM6PR08MB3046;BCL:0;PCL:0;RULEID:;SRVR:AM6PR08MB3046; X-Forefront-PRVS: 08286A0BE2 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(136003)(346002)(376002)(39860400002)(366004)(396003)(40434004)(189003)(199004)(305945005)(31696002)(476003)(53546011)(486006)(386003)(6306002)(86362001)(6116002)(2906002)(478600001)(3846002)(65826007)(8676002)(8936002)(5660300001)(53936002)(16576012)(52116002)(8746002)(81166006)(58126008)(7736002)(81156014)(2616005)(23676004)(11346002)(956004)(446003)(6246003)(76176011)(52146003)(6666004)(2486003)(64126003)(50466002)(72206003)(47776003)(36756003)(66066001)(26005)(65956001)(65806001)(25786009)(106356001)(77096007)(5024004)(14444005)(186003)(97736004)(16526019)(316002)(105586002)(31686004)(68736007)(6486002)(229853002)(7416002)(217873002)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR08MB3046;H:[10.1.196.78];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBTTZQUjA4TUIzMDQ2OzIzOld1KzVIbWdvcTR1WGJxazcranYrUFdhUWxM?= =?utf-8?B?bFg2QTcyd3JoZjI0TEZu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L1CRTeDUuqMhqtePjXvrcs7WUwAamWwmJVaUwqYNvQbuM2i4MgFaE0w/EssA6r7AkDWjbw1H8jD4GGxH72IVcWxlgtcQPCVXWxTZYqGWQQ==;5:8X9GvZFgpA30Xuc7Ar2BURxOvYH5wLkpjdtCeZJY31YclxPolzxG05TETLCAtb5To88lDRqMljo6xZNaWr2qWaTGO2Nx0Fz+sIOXbPILxjLoswRrFB7iFuLs2WqO8CEVKnH8Bzhsd5QNp80e2fZr29nm8oOaBZ7YC0IxWT7ig64=;7:JokRtERsWULy48llSysznyXDrK4s/eiTFmNd9HzvKve0EEq4B3TZZUQnZHKiWx+k9KkC7eakAUyCAW+ys2w1VD5P3e/SQ9Z8Bh/e1RRdaVomUokTIRNZR0Eaww2NCqHu5ibLuBpFErt+A8w89z01UvUDxz2RuKvBP/kSltMZImYdMVVWsk7g6DiHXAax6Kq6FkohI0QGf58qj26+e9LLlMkfIYbgACfSV8vf+4nrsgCtCP3QGLVtC3jJScdbqLEU SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2018 14:21:56.2635 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ccbf26b4-a96e-4556-8885-08d6343be4e0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3046 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Hi Jordan, On 12/10/2018 15:32, Jordan Crouse wrote: > On Thu, Sep 20, 2018 at 06:00:46PM +0100, Jean-Philippe Brucker wrote: >> Provide an API for allocating PASIDs and populating them manually. To ea= se >> cleanup and factor allocation code, reuse the io_mm structure for privat= e >> PASID. Private io_mm has a NULL mm_struct pointer, and cannot be bound t= o >> multiple devices. The mm_alloc() IOMMU op must now check if the mm >> argument is NULL, in which case it should allocate io_pgtables instead o= f >> binding to an mm. >> >> Signed-off-by: Jordan Crouse >> Signed-off-by: Jean-Philippe Brucker >> --- >> Sadly this probably won't be the final thing. The API in this patch is >> used like this: >> >> iommu_sva_alloc_pasid(dev, &io_mm) -> PASID >> iommu_sva_map(io_mm, ...) >> iommu_sva_unmap(io_mm, ...) >> iommu_sva_free_pasid(dev, io_mm) >> >> The proposed API for auxiliary domains is in an early stage but might >> replace this patch and could be used like this: >> >> iommu_enable_aux_domain(dev) >> d =3D iommu_domain_alloc() >> iommu_attach_aux(dev, d) >> iommu_aux_id(d) -> PASID >> iommu_map(d, ...) >> iommu_unmap(d, ...) >> iommu_detach_aux(dev, d) >> iommu_domain_free(d) >> >> The advantage being that the driver doesn't have to use a special >> version of map/unmap/etc. > > Hi Jean-Phillippe - > > Have you thought about this any more? I want to send out a > refresh for the per-context pagetables for arm-smmu so if we want to chan= ge > the underlying assumptions this would be a great time. > > For my part I'm okay with either model. In fact the second one is closer > to the original implementation that I sent out so I have a clear developm= ent > path in mind for either option depending on what the community decides. We'll probably go with the second model. I'm trying to make the latest version work with SMMUv3 (https://lwn.net/ml/linux-kernel/20181012051632.26064-1-baolu.lu@linux.inte= l.com/) and I'd like to send an RFC soon Thanks, Jean IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean-Philippe Brucker Subject: Re: [RFC PATCH v3 10/10] iommu/sva: Add support for private PASIDs Date: Wed, 17 Oct 2018 15:21:43 +0100 Message-ID: <3e1b58bb-eb16-5855-2922-2b15b37ba971@arm.com> References: <20180920170046.20154-1-jean-philippe.brucker@arm.com> <20180920170046.20154-11-jean-philippe.brucker@arm.com> <20181012143229.GI9977@jcrouse-lnx.qualcomm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20181012143229.GI9977-9PYrDHPZ2Orvke4nUoYGnHL1okKdlPRT@public.gmane.org> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, Jonathan.Cameron-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, christian.koenig-5C7GfCeVMHo@public.gmane.org, eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, kevin.tian-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, yi.l.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, andrew.murray-5wv7dgnIgG8@public.gmane.org, will.deacon-5wv7dgnIgG8@public.gmane.org, robin.murphy-5wv7dgnIgG8@public.gmane.org, ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, xuzaibo-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, liguozhu-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org, okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org, bharatku-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org, ilias.apalodimas-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, shunyong.yang-PT9Dzx9SjPiXmMXjJBpWqg@public.gmane.org List-Id: iommu@lists.linux-foundation.org Hi Jordan, On 12/10/2018 15:32, Jordan Crouse wrote: > On Thu, Sep 20, 2018 at 06:00:46PM +0100, Jean-Philippe Brucker wrote: >> Provide an API for allocating PASIDs and populating them manually. To ease >> cleanup and factor allocation code, reuse the io_mm structure for private >> PASID. Private io_mm has a NULL mm_struct pointer, and cannot be bound to >> multiple devices. The mm_alloc() IOMMU op must now check if the mm >> argument is NULL, in which case it should allocate io_pgtables instead of >> binding to an mm. >> >> Signed-off-by: Jordan Crouse >> Signed-off-by: Jean-Philippe Brucker >> --- >> Sadly this probably won't be the final thing. The API in this patch is >> used like this: >> >> iommu_sva_alloc_pasid(dev, &io_mm) -> PASID >> iommu_sva_map(io_mm, ...) >> iommu_sva_unmap(io_mm, ...) >> iommu_sva_free_pasid(dev, io_mm) >> >> The proposed API for auxiliary domains is in an early stage but might >> replace this patch and could be used like this: >> >> iommu_enable_aux_domain(dev) >> d = iommu_domain_alloc() >> iommu_attach_aux(dev, d) >> iommu_aux_id(d) -> PASID >> iommu_map(d, ...) >> iommu_unmap(d, ...) >> iommu_detach_aux(dev, d) >> iommu_domain_free(d) >> >> The advantage being that the driver doesn't have to use a special >> version of map/unmap/etc. > > Hi Jean-Phillippe - > > Have you thought about this any more? I want to send out a > refresh for the per-context pagetables for arm-smmu so if we want to change > the underlying assumptions this would be a great time. > > For my part I'm okay with either model. In fact the second one is closer > to the original implementation that I sent out so I have a clear development > path in mind for either option depending on what the community decides. We'll probably go with the second model. I'm trying to make the latest version work with SMMUv3 (https://lwn.net/ml/linux-kernel/20181012051632.26064-1-baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org/) and I'd like to send an RFC soon Thanks, Jean IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.