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=-5.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 C95DBC47092 for ; Tue, 1 Jun 2021 04:28:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A43D461364 for ; Tue, 1 Jun 2021 04:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231607AbhFAE3v (ORCPT ); Tue, 1 Jun 2021 00:29:51 -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 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=-5.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 C41E9C4708F for ; Tue, 1 Jun 2021 04:28:14 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 2E07B6136E for ; Tue, 1 Jun 2021 04:28:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E07B6136E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id D927F4044B; Tue, 1 Jun 2021 04:28:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TnKNzxr6s5Xb; Tue, 1 Jun 2021 04:28:13 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTP id 6905B40440; Tue, 1 Jun 2021 04:28:12 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3128EC000E; Tue, 1 Jun 2021 04:28:12 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 96696C0001 for ; Tue, 1 Jun 2021 04:28:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6E87640153 for ; Tue, 1 Jun 2021 04:28:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gbEsXDX4kOcy for ; Tue, 1 Jun 2021 04:28:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by smtp2.osuosl.org (Postfix) with ESMTPS id D6B9D400E8 for ; Tue, 1 Jun 2021 04:28:08 +0000 (UTC) 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 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-Language: en-US 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 Cc: "Tian, Kevin" , "Alex Williamson \(alex.williamson@redhat.com\)\"" , "kvm@vger.kernel.org" , Jonathan Corbet , LKML , "iommu@lists.linux-foundation.org" , Jason Gunthorpe , "wanghaibin.wang@huawei.com" , David Woodhouse X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" T24gMjAyMS82LzEgMTA6MzYsIEphc29uIFdhbmcgd3JvdGU6Cj4gCj4g5ZyoIDIwMjEvNS8zMSDk uIvljYg0OjQxLCBMaXUgWWkgTCDlhpnpgZM6Cj4+PiBJIGd1ZXNzIFZGSU9fQVRUQUNIX0lPQVNJ RCB3aWxsIGZhaWwgaWYgdGhlIHVuZGVybGF5ZXIgZG9lc24ndCBzdXBwb3J0Cj4+PiBoYXJkd2Fy ZSBuZXN0aW5nLiBPciBpcyB0aGVyZSB3YXkgdG8gZGV0ZWN0IHRoZSBjYXBhYmlsaXR5IGJlZm9y ZT8KPj4gSSB0aGluayBpdCBjb3VsZCBmYWlsIGluIHRoZSBJT0FTSURfQ1JFQVRFX05FU1RJTkcu IElmIHRoZSBncGFfa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