Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3130708pxj; Mon, 31 May 2021 21:29:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzVpz0BZO5Y1P8YkelEekf8YFKxOG2I6eYUFXMh+w0a10JZX7a9pVUj0FElnQNu+fP1WvE X-Received: by 2002:a92:cd85:: with SMTP id r5mr19772875ilb.294.1622521767855; Mon, 31 May 2021 21:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622521767; cv=none; d=google.com; s=arc-20160816; b=Wcb8QdHLVvDF1elafjxFjEmFU6NjDcpdvKMA37nYn0cHRPNRpNuZOabNSC3742YFO7 oguWtsvsL63cNkCJoFeDiORnRfMHfl3dYrpqrc3Amj5Up0WeF+hYbYOvZBkZZ6LZc8n8 LSldpds5Cj/WSCu7hLgYtp2mKEVtLc2xBTOc35EAYzrCnfQ0Mn+QNqFK9159s7e49pVX Qh0hte71pli5N9KqRiYZGXk7egY2K7ZN5jti9ikSPGXJNbajcBv8+J5qUFoCJrpcph7G VwMBxtLp9Q3PaMno2r59WP5OtKDAMsQmSADEwsPGmc94Zx/caHYO09X507t2UpkKq3U1 ZTMA== 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=fsWSdfl1/pBLftI2AscxEa+nSBP68ES/Ti7569vl4QM=; b=QMscacEEJYFF3BsHzMdLSF4jWYiKO388bQvARaWdwOjVMeK+iKJBWwh6+Eqzh/o48P o3S/d7Iig/xVRDyG8s7xsfkn0mSfa0hiZUCu3u1AZyWhT52Sf16wVn/u3I9N+RvBITJl qU8FPwXZ15GnEX9iB1p+jzbfxJnndoByZBDzeQAFnzWOt2JOF9EmFfZzFYXM1xuWaqoU OpyO/X8U8NfpkVXo/f60AIRV3j1/sY9d3S66lxHM7USQKeyWgI1J/RagX6GAppKLeQ+k ZI/QJau8XDKwpjqf7yWw5y4kD03DEjD99vTnNN9UD50FW7HcEDWPE/t02Vtdg2xgK5y1 dbUQ== 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 f13si5489559iox.20.2021.05.31.21.29.14; Mon, 31 May 2021 21:29:27 -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 S231140AbhFAE3u (ORCPT + 99 others); Tue, 1 Jun 2021 00:29:50 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:6101 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbhFAE3s (ORCPT ); Tue, 1 Jun 2021 00:29:48 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FvJww3HQczYnKJ; Tue, 1 Jun 2021 12:25:20 +0800 (CST) Received: from dggpemm500022.china.huawei.com (7.185.36.162) by dggemv704-chm.china.huawei.com (10.3.19.47) 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:28:03 +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:28:02 +0800 Subject: Re: [RFC] /dev/ioasid uAPI proposal To: Jason Wang , Liu Yi L CC: , "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)\"" , Eric Auger , "Jonathan Corbet" , Zenghui Yu , "wanghaibin.wang@huawei.com" References: <20210531164118.265789ee@yiliu-dev> <78ee2638-1a03-fcc8-50a5-81040f677e69@redhat.com> From: Shenming Lu Message-ID: <1fedcd93-1a8a-884f-d0c8-3e2c21ed7654@huawei.com> Date: Tue, 1 Jun 2021 12:27:51 +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: <78ee2638-1a03-fcc8-50a5-81040f677e69@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.185.220] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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/6/1 10:36, Jason Wang wrote: > > 在 2021/5/31 下午4:41, Liu Yi L 写道: >>> I guess VFIO_ATTACH_IOASID will fail if the underlayer doesn't support >>> hardware nesting. Or is there way to detect the capability before? >> I think it could fail in the IOASID_CREATE_NESTING. If the gpa_ioasid >> is not able to support nesting, then should fail it. >> >>> I think GET_INFO only works after the ATTACH. >> yes. After attaching to gpa_ioasid, userspace could GET_INFO on the >> gpa_ioasid and check if nesting is supported or not. right? > > > Some more questions: > > 1) Is the handle returned by IOASID_ALLOC an fd? > 2) If yes, what's the reason for not simply use the fd opened from /dev/ioas. (This is the question that is not answered) and what happens if we call GET_INFO for the ioasid_fd? > 3) If not, how GET_INFO work? It seems that the return value from IOASID_ALLOC is an IOASID number in the ioasid_data struct, then when calling GET_INFO, we should convey this IOASID number to get the associated I/O address space attributes (depend on the physical IOMMU, which could be discovered when attaching a device to the IOASID fd or number), right? Thanks, Shenming