Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3132849pxj; Mon, 31 May 2021 21:33:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7huUQXKLJCM2PxE4oHEzUbdElbK0vLVnn4nNE73iv9wlHdSnlvnQe9bWVCchKEqZtSRJL X-Received: by 2002:a92:700a:: with SMTP id l10mr19671085ilc.44.1622521990745; Mon, 31 May 2021 21:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622521990; cv=none; d=google.com; s=arc-20160816; b=vx9ANYdnHm9y5OPm/nYSMxi1mAQWRXxIzZlsFnszp4a0FPZkIcd1mBhNxki85cw/0Q QbBDENI7quz5EZqpHTfGmMKzQ3nGlB3pFwQC4KvtKJMihKpq8kUwMrlntAFUwUYLWrco hwb2huiGOSo8lsrMRu2GHA9DY3asTdlqWcYbE+DF9eOJSWVxujY980PqV2VWbItIALdc GifmZ8WrLC243WyjLHcXY5BUIrWeYAieaUkplYx6KoNJMfJDQ/Ih+crFAIYBi120boLi CT6wpU4eCMgUCbxks5rgrg8lKphJYavTqEfBAHa01ce6Y7uRWjPvE1+aFm+IBPsrxKEe uzig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=fH24PSw/wWoSeVZ2MEHHDTgae9eZJn2tOADGxnatN94=; b=zrDGwkaAb2AdKk3ifvvHkZsTR3NJXP3nuAVF1OlK0lQFS5Ms1S9piZxjzF++5kRiIH Xq/L7WLlsRut8UVkdCqSEE662TJHbpnjJqFK8/CU2fopFSHCPtDJxowsAfkrupB8CIQw yIHKDrUeTqNE0psymvJ58L8G/etgzBeHiYSak4P1RUB2ae/yfOGw4aDGhhd9ec4+27TX he6rDvwRkq6PJTeGwZQQYj3TuUiMKJhE0q+2MPPha4wySsKLZ7xJNP2weMI4vEcB0SbL euHeAKXr9H4wxDHv5YVsMA17anunJG9krSrcZxbPCX1IGJ4d6frVOD0qb6SJViGQzzhI d7Cw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v12si5945632ilg.36.2021.05.31.21.32.57; Mon, 31 May 2021 21:33:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230009AbhFAEda (ORCPT + 99 others); Tue, 1 Jun 2021 00:33:30 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:2808 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbhFAEd3 (ORCPT ); Tue, 1 Jun 2021 00:33:29 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FvJyx5fcLzWqK0; Tue, 1 Jun 2021 12:27:05 +0800 (CST) Received: from dggpemm500022.china.huawei.com (7.185.36.162) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 1 Jun 2021 12:31:47 +0800 Received: from [10.174.185.220] (10.174.185.220) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 1 Jun 2021 12:31:46 +0800 Subject: Re: [RFC] /dev/ioasid uAPI proposal To: "Tian, Kevin" , LKML , Joerg Roedel , Jason Gunthorpe , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "Alex Williamson (alex.williamson@redhat.com)" , Jason Wang CC: Eric Auger , Jonathan Corbet , "Raj, Ashok" , "Liu, Yi L" , "Wu, Hao" , "Jiang, Dave" , Jacob Pan , Jean-Philippe Brucker , David Gibson , "Kirti Wankhede" , Robin Murphy , "Zenghui Yu" , "wanghaibin.wang@huawei.com" References: From: Shenming Lu Message-ID: Date: Tue, 1 Jun 2021 12:31:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.185.220] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500022.china.huawei.com (7.185.36.162) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/5/27 15:58, Tian, Kevin wrote: > /dev/ioasid provides an unified interface for managing I/O page tables for > devices assigned to userspace. Device passthrough frameworks (VFIO, vDPA, > etc.) are expected to use this interface instead of creating their own logic to > isolate untrusted device DMAs initiated by userspace. > > This proposal describes the uAPI of /dev/ioasid and also sample sequences > with VFIO as example in typical usages. The driver-facing kernel API provided > by the iommu layer is still TBD, which can be discussed after consensus is > made on this uAPI. > > It's based on a lengthy discussion starting from here: > https://lore.kernel.org/linux-iommu/20210330132830.GO2356281@nvidia.com/ > > It ends up to be a long writing due to many things to be summarized and > non-trivial effort required to connect them into a complete proposal. > Hope it provides a clean base to converge. > [..] > > /* > * Page fault report and response > * > * This is TBD. Can be added after other parts are cleared up. Likely it > * will be a ring buffer shared between user/kernel, an eventfd to notify > * the user and an ioctl to complete the fault. > * > * The fault data is per I/O address space, i.e.: IOASID + faulting_addr > */ Hi, It seems that the ioasid has different usage in different situation, it could be directly used in the physical routing, or just a virtual handle that indicates a page table or a vPASID table (such as the GPA address space, in the simple passthrough case, the DMA input to IOMMU will just contain a Stream ID, no Substream ID), right? And Baolu suggested that since one device might consume multiple page tables, it's more reasonable to have one fault handler per page table. By this, do we have to maintain such an ioasid info list in the IOMMU layer? Then if we add host IOPF support (for the GPA address space) in the future (I have sent a series for this but it aimed for VFIO, I will convert it for IOASID later [1] :-)), how could we find the handler for the received fault event which only contains a Stream ID... Do we also have to maintain a dev(vPASID)->ioasid mapping in the IOMMU layer? [1] https://lore.kernel.org/patchwork/cover/1410223/ Thanks, Shenming