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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 A8E98C43460 for ; Fri, 14 May 2021 12:19:32 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.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 312036145A for ; Fri, 14 May 2021 12:19:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 312036145A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id E7AB64045B; Fri, 14 May 2021 12:19:31 +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 wZIjX2TMbJ-I; Fri, 14 May 2021 12:19:31 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTP id DE4114011D; Fri, 14 May 2021 12:19:30 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B6F87C000E; Fri, 14 May 2021 12:19:30 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8A02CC0001 for ; Fri, 14 May 2021 12:19:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8570C60ABC for ; Fri, 14 May 2021 12:19:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=ziepe.ca Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BKe26KJuQipg for ; Fri, 14 May 2021 12:19:27 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by smtp3.osuosl.org (Postfix) with ESMTPS id ADB0A605FF for ; Fri, 14 May 2021 12:19:27 +0000 (UTC) Received: by mail-qk1-x732.google.com with SMTP id a22so27876272qkl.10 for ; Fri, 14 May 2021 05:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2orjcu+bFDK+ZSi8hWNlQqJx3e5HbNzAGaAd0cCLl7g=; b=bQUUjd0Y4a6jO+AmWs9nTp7PcXEayvZpEcpTja9XAf9f0gsuBo2iiJ+6gx+jk0U5kd weeVe+O5yPXANFk4bakBZ9VR+fQKl4ro6ucLBeC6rI1RoJ5zH5sj6bWeq13jzOvHJ2zW J/Nf0mMevGfLVFlcO+zybm8dCCfdx7uIYkH032E20HlRF+iVy4bB1b9NujfatCC/tKHr d7Cv6bttrnbKHyUJ9ksPbW1NNCVlgMUAQefzPXc+ZpDeAfvx9+q5INdn+Bm5+o+ngwMP GUyS7asnsIhk3K1BqpI1SFN+oq2oKy/e6KVLu9NSbj3c7oNMm8ghfeq84QzlZv2AQNbS x0iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2orjcu+bFDK+ZSi8hWNlQqJx3e5HbNzAGaAd0cCLl7g=; b=AMaVs11J8EuSb6KLObsClt9eLZKLHBRIFylnZ1xaFwRAupKYomx7GH+Gaww5sQv9n6 em9cNxmiKfxhhSsjTTarlEG+VJnPdnGfS8cZ4GemecaS/VENSg5k4E/+ogqOfh82phNH ZTIjoskiybHx3Y8/uX6FCVU7EskCM9M2MDctbX9LlWb64LIEj5rqLB+UbyVyKWzc+Eyj PNyAiUL03rfm1DXhmrWnsVIrHTuppJmr/ryTgyb1Iup8uaQPwsNk9g3k8VjP1eXOa4up G4YXgotmghfFCufQy4D/aRT+gi4Ib1Dmw98HS6stTAoJqxFaBNeEF0+1Rh7ynyFvIjrM 5SQw== X-Gm-Message-State: AOAM530eFQzevwRWMv5z7Jjh7B00HMTNPw6PHV/9SyUFVAWGXRRLkO5G JFQ2s0UTpSP+Cr1deUek015TeQ== X-Google-Smtp-Source: ABdhPJxGyNQCvNGQGAHGa/24dlS2hhEnAClK5ht9t3tJrdkRDG96uMryqbLbGHeLVVgSRnKW4/+s6A== X-Received: by 2002:a37:7246:: with SMTP id n67mr41596564qkc.71.1620994766455; Fri, 14 May 2021 05:19:26 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-47-55-113-94.dhcp-dynamic.fibreop.ns.bellaliant.net. [47.55.113.94]) by smtp.gmail.com with ESMTPSA id i9sm4807353qtg.18.2021.05.14.05.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 05:19:25 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lhWmr-007OI8-0o; Fri, 14 May 2021 09:19:25 -0300 Date: Fri, 14 May 2021 09:19:25 -0300 From: Jason Gunthorpe To: "Tian, Kevin" Subject: Re: [PATCH 3/6] vfio: remove the unused mdev iommu hook Message-ID: <20210514121925.GI1096940@ziepe.ca> References: <20210510065405.2334771-1-hch@lst.de> <20210510065405.2334771-4-hch@lst.de> <20210510155454.GA1096940@ziepe.ca> <20210513120058.GG1096940@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Cc: "kvm@vger.kernel.org" , Will Deacon , Kirti Wankhede , "iommu@lists.linux-foundation.org" , Alex Williamson , David Woodhouse , Christoph Hellwig , "linux-arm-kernel@lists.infradead.org" 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="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Fri, May 14, 2021 at 06:54:16AM +0000, Tian, Kevin wrote: > > From: Tian, Kevin > > Sent: Friday, May 14, 2021 2:28 PM > > > > > From: Jason Gunthorpe > > > Sent: Thursday, May 13, 2021 8:01 PM > > > > > > On Thu, May 13, 2021 at 03:28:52AM +0000, Tian, Kevin wrote: > > > > > > > Are you specially concerned about this iommu_device hack which > > > > directly connects mdev_device to iommu layer or the entire removed > > > > logic including the aux domain concept? For the former we are now > > > > following up the referred thread to find a clean way. But for the latter > > > > we feel it's still necessary regardless of how iommu interface is > > redesigned > > > > to support device connection from the upper level driver. The reason is > > > > that with mdev or subdevice one physical device could be attached to > > > > multiple domains now. there could be a primary domain with DOMAIN_ > > > > DMA type for DMA_API use by parent driver itself, and multiple auxiliary > > > > domains with DOMAIN_UNMANAGED types for subdevices assigned to > > > > different VMs. > > > > > > Why do we need more domains than just the physical domain for the > > > parent? How does auxdomain appear in /dev/ioasid? > > > > > > > Say the parent device has three WQs. WQ1 is used by parent driver itself, > > while WQ2/WQ3 are assigned to VM1/VM2 respectively. > > > > WQ1 is attached to domain1 for an IOVA space to support DMA API > > operations in parent driver. More specifically WQ1 uses a PASID that is represented by an IOASID to userspace. > > WQ2 is attached to domain2 for the GPA space of VM1. Domain2 is > > created when WQ2 is assigned to VM1 as a mdev. > > > > WQ3 is attached to domain3 for the GPA space of VM2. Domain3 is > > created when WQ3 is assigned to VM2 as a mdev. > > > > In this case domain1 is the primary while the other two are auxiliary > > to the parent. > > > > auxdomain represents as a normal domain in /dev/ioasid, with only > > care required when doing attachment. > > > > e.g. VM1 is assigned with both a pdev and mdev. Qemu creates > > gpa_ioasid which is associated with a single domain for VM1's > > GPA space and this domain is shared by both pdev and mdev. > > Here pdev/mdev are just conceptual description. Following your > earlier suggestion /dev/ioasid will not refer to explicit mdev_device. > Instead, each vfio device attached to an ioasid is represented by either > "struct device" for pdev or "struct device + pasid" for mdev. The > presence of pasid decides which iommu_attach api should be used. But you still haven't explained what an aux domain is to /dev/ioasid. Why do I need more public kernel objects to represent a PASID IOASID? Are you creating a domain for every IOASID? Why? Jason _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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=-4.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 316C8C433ED for ; Fri, 14 May 2021 12:21:23 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 B375D6144C for ; Fri, 14 May 2021 12:21:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B375D6144C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KQxBYNyTOCudO2X6R45MMbSI7hnB39gTKllwdaueN2E=; b=Uc34p3BoEjyd/L3YqEk8VNpC+ vuwz9f50abfyjhfKVTWc8xsXdfBsSw6PJ/sWn3SXOqRaIIMLmNuLGr0t/+peanCRQJnV4TF8DqXUJ UYEr7sFfhZJScNE/S0N1qgr9zMxl4uAqE6KGvZLdWdILoHFYjL/m9VQP7fgn+Z1xY5RczuDbwSq9i d6o1C4xAfUOD6d7GaEzjV1UWWB3BhrUdbe33ZlqGWqVTWUETGG8Em0OSKv9gpuvqJIZSHqTubUumu Eb1p7mKjOi13GVJ9AUQENbQUHeEnyOUeXQe5wq1U1hYZfUpyCrY3+E9yI4LPw4BU1AcQPZj/sGEJO h4L3diaQA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lhWn2-0080St-OI; Fri, 14 May 2021 12:19:37 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhWmx-0080SS-Th for linux-arm-kernel@desiato.infradead.org; Fri, 14 May 2021 12:19:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=2orjcu+bFDK+ZSi8hWNlQqJx3e5HbNzAGaAd0cCLl7g=; b=Z7ghFcC1+gWeU8i4xpvaf5VUvx ioL1RaeJRhHqDhV0T5QkqP35mRKpSSqjMQN4fBUEw4cEa/figVCOoBWZnqZzEGJS3UzbpgCzGepcy BJFvTXi/CS2Jeez25anr8alrQzQPEeWKM+XJ7a/RILXuOgrpDravUNBymalMwwBpD/qehr7wRlNFJ J17v8XGpgo7BeVgs8mg+bqR7pIwNC/10rUyGsb9SgR4euP/klciQoGwnqwWnFv1Z6fXn0pG7i0jIQ 0XBjLgumm5F0P3jkN5FuWb6ao0NW+T8nkIbKBNob8Hykk82yM9LAOTeynrfTXfdohPS6eoMKf1JUV +h+2X0iA==; Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhWmu-00By1F-O6 for linux-arm-kernel@lists.infradead.org; Fri, 14 May 2021 12:19:30 +0000 Received: by mail-qk1-x732.google.com with SMTP id x8so28461063qkl.2 for ; Fri, 14 May 2021 05:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2orjcu+bFDK+ZSi8hWNlQqJx3e5HbNzAGaAd0cCLl7g=; b=bQUUjd0Y4a6jO+AmWs9nTp7PcXEayvZpEcpTja9XAf9f0gsuBo2iiJ+6gx+jk0U5kd weeVe+O5yPXANFk4bakBZ9VR+fQKl4ro6ucLBeC6rI1RoJ5zH5sj6bWeq13jzOvHJ2zW J/Nf0mMevGfLVFlcO+zybm8dCCfdx7uIYkH032E20HlRF+iVy4bB1b9NujfatCC/tKHr d7Cv6bttrnbKHyUJ9ksPbW1NNCVlgMUAQefzPXc+ZpDeAfvx9+q5INdn+Bm5+o+ngwMP GUyS7asnsIhk3K1BqpI1SFN+oq2oKy/e6KVLu9NSbj3c7oNMm8ghfeq84QzlZv2AQNbS x0iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2orjcu+bFDK+ZSi8hWNlQqJx3e5HbNzAGaAd0cCLl7g=; b=YXDKKa4NNo24XRtuMFc6tviPGelOcxut/2dffIqAxf3tu77nHCBSempFtWm5Gs9+vB aTMygEmUX+/nP0Cyb32xfXhRjbS4JgVyUnC2czagKVE3dgGj96EpbpdSMUDu1NMKCEAe R29ploSzBQ1oG1jjg3ixzRjvEbq1kBmqfPy09wiTYkf1aiyYW+Uuyj0XAPIJXGzYlFCw nuxe7/yHvDE1B9arRao2zyxdS3U1/5PQv7Ge9uuFmfCIcQIQUj7e2xVMGCIkNEK8V6us j3VQ213hjuxtlQ+e5VfVIWzfWB+kaAjNBXyRTpXobMGFOrHOzZAWWPTX1aPqizBB7qCl +wgQ== X-Gm-Message-State: AOAM533XqJ+nU74z+w1bRLdgHj5dbiX7ZYnofkLDhTOajECgcOvRJs8A w57doJ6X4H19HWkZV0t7qG4zNQ== X-Google-Smtp-Source: ABdhPJxGyNQCvNGQGAHGa/24dlS2hhEnAClK5ht9t3tJrdkRDG96uMryqbLbGHeLVVgSRnKW4/+s6A== X-Received: by 2002:a37:7246:: with SMTP id n67mr41596564qkc.71.1620994766455; Fri, 14 May 2021 05:19:26 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-47-55-113-94.dhcp-dynamic.fibreop.ns.bellaliant.net. [47.55.113.94]) by smtp.gmail.com with ESMTPSA id i9sm4807353qtg.18.2021.05.14.05.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 05:19:25 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lhWmr-007OI8-0o; Fri, 14 May 2021 09:19:25 -0300 Date: Fri, 14 May 2021 09:19:25 -0300 From: Jason Gunthorpe To: "Tian, Kevin" Cc: Christoph Hellwig , Joerg Roedel , Alex Williamson , David Woodhouse , Lu Baolu , Will Deacon , Kirti Wankhede , "linux-arm-kernel@lists.infradead.org" , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" Subject: Re: [PATCH 3/6] vfio: remove the unused mdev iommu hook Message-ID: <20210514121925.GI1096940@ziepe.ca> References: <20210510065405.2334771-1-hch@lst.de> <20210510065405.2334771-4-hch@lst.de> <20210510155454.GA1096940@ziepe.ca> <20210513120058.GG1096940@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210514_051929_228764_7D5D0760 X-CRM114-Status: GOOD ( 29.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 14, 2021 at 06:54:16AM +0000, Tian, Kevin wrote: > > From: Tian, Kevin > > Sent: Friday, May 14, 2021 2:28 PM > > > > > From: Jason Gunthorpe > > > Sent: Thursday, May 13, 2021 8:01 PM > > > > > > On Thu, May 13, 2021 at 03:28:52AM +0000, Tian, Kevin wrote: > > > > > > > Are you specially concerned about this iommu_device hack which > > > > directly connects mdev_device to iommu layer or the entire removed > > > > logic including the aux domain concept? For the former we are now > > > > following up the referred thread to find a clean way. But for the latter > > > > we feel it's still necessary regardless of how iommu interface is > > redesigned > > > > to support device connection from the upper level driver. The reason is > > > > that with mdev or subdevice one physical device could be attached to > > > > multiple domains now. there could be a primary domain with DOMAIN_ > > > > DMA type for DMA_API use by parent driver itself, and multiple auxiliary > > > > domains with DOMAIN_UNMANAGED types for subdevices assigned to > > > > different VMs. > > > > > > Why do we need more domains than just the physical domain for the > > > parent? How does auxdomain appear in /dev/ioasid? > > > > > > > Say the parent device has three WQs. WQ1 is used by parent driver itself, > > while WQ2/WQ3 are assigned to VM1/VM2 respectively. > > > > WQ1 is attached to domain1 for an IOVA space to support DMA API > > operations in parent driver. More specifically WQ1 uses a PASID that is represented by an IOASID to userspace. > > WQ2 is attached to domain2 for the GPA space of VM1. Domain2 is > > created when WQ2 is assigned to VM1 as a mdev. > > > > WQ3 is attached to domain3 for the GPA space of VM2. Domain3 is > > created when WQ3 is assigned to VM2 as a mdev. > > > > In this case domain1 is the primary while the other two are auxiliary > > to the parent. > > > > auxdomain represents as a normal domain in /dev/ioasid, with only > > care required when doing attachment. > > > > e.g. VM1 is assigned with both a pdev and mdev. Qemu creates > > gpa_ioasid which is associated with a single domain for VM1's > > GPA space and this domain is shared by both pdev and mdev. > > Here pdev/mdev are just conceptual description. Following your > earlier suggestion /dev/ioasid will not refer to explicit mdev_device. > Instead, each vfio device attached to an ioasid is represented by either > "struct device" for pdev or "struct device + pasid" for mdev. The > presence of pasid decides which iommu_attach api should be used. But you still haven't explained what an aux domain is to /dev/ioasid. Why do I need more public kernel objects to represent a PASID IOASID? Are you creating a domain for every IOASID? Why? Jason _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 006C3C433B4 for ; Fri, 14 May 2021 12:19:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D8C3A6144C for ; Fri, 14 May 2021 12:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232354AbhENMUl (ORCPT ); Fri, 14 May 2021 08:20:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233148AbhENMUi (ORCPT ); Fri, 14 May 2021 08:20:38 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C6CBC061574 for ; Fri, 14 May 2021 05:19:27 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id 76so28424539qkn.13 for ; Fri, 14 May 2021 05:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2orjcu+bFDK+ZSi8hWNlQqJx3e5HbNzAGaAd0cCLl7g=; b=bQUUjd0Y4a6jO+AmWs9nTp7PcXEayvZpEcpTja9XAf9f0gsuBo2iiJ+6gx+jk0U5kd weeVe+O5yPXANFk4bakBZ9VR+fQKl4ro6ucLBeC6rI1RoJ5zH5sj6bWeq13jzOvHJ2zW J/Nf0mMevGfLVFlcO+zybm8dCCfdx7uIYkH032E20HlRF+iVy4bB1b9NujfatCC/tKHr d7Cv6bttrnbKHyUJ9ksPbW1NNCVlgMUAQefzPXc+ZpDeAfvx9+q5INdn+Bm5+o+ngwMP GUyS7asnsIhk3K1BqpI1SFN+oq2oKy/e6KVLu9NSbj3c7oNMm8ghfeq84QzlZv2AQNbS x0iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2orjcu+bFDK+ZSi8hWNlQqJx3e5HbNzAGaAd0cCLl7g=; b=giQgl8MNIGg+mqmci7QA6IzN26Bvr019tAcgzz+20Yn61rAuVFBn8DgDdMiBEdoTXA LsVAvtDwXVxWserGy3F+r/UpK7Xau//HFb7ZwSl89BjqZFo8vZbAS2Bniq000sl5PBnB uQICh2L4SsZKM+jlnDCMhxGeTr8JxA5dw17FPr/owqI94J3lVhXvW52gp5VCgfj9NxMb vRrBfrZmSLe2OeHuN+zyiLiBAMtPCMRtgvieyxbBncB3GKNgwqLmbKLQI7qIx8NqXzGA eDpUZ2/9FpBQgcIaukA/FP+0uzV1DdhDlKkVxrOQHnbfYhjLDuqmWbTj1e5cFcQML3Um PWOg== X-Gm-Message-State: AOAM532bfmsG/CKNKVslynhD1HbtpLt2D3vqNcgBQ1QS0AM9uBFeEMar cWpzzKScDfogYhzVtmeIPmGhqU2FoYjhjrY4 X-Google-Smtp-Source: ABdhPJxGyNQCvNGQGAHGa/24dlS2hhEnAClK5ht9t3tJrdkRDG96uMryqbLbGHeLVVgSRnKW4/+s6A== X-Received: by 2002:a37:7246:: with SMTP id n67mr41596564qkc.71.1620994766455; Fri, 14 May 2021 05:19:26 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-47-55-113-94.dhcp-dynamic.fibreop.ns.bellaliant.net. [47.55.113.94]) by smtp.gmail.com with ESMTPSA id i9sm4807353qtg.18.2021.05.14.05.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 05:19:25 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lhWmr-007OI8-0o; Fri, 14 May 2021 09:19:25 -0300 Date: Fri, 14 May 2021 09:19:25 -0300 From: Jason Gunthorpe To: "Tian, Kevin" Cc: Christoph Hellwig , Joerg Roedel , Alex Williamson , David Woodhouse , Lu Baolu , Will Deacon , Kirti Wankhede , "linux-arm-kernel@lists.infradead.org" , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" Subject: Re: [PATCH 3/6] vfio: remove the unused mdev iommu hook Message-ID: <20210514121925.GI1096940@ziepe.ca> References: <20210510065405.2334771-1-hch@lst.de> <20210510065405.2334771-4-hch@lst.de> <20210510155454.GA1096940@ziepe.ca> <20210513120058.GG1096940@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Fri, May 14, 2021 at 06:54:16AM +0000, Tian, Kevin wrote: > > From: Tian, Kevin > > Sent: Friday, May 14, 2021 2:28 PM > > > > > From: Jason Gunthorpe > > > Sent: Thursday, May 13, 2021 8:01 PM > > > > > > On Thu, May 13, 2021 at 03:28:52AM +0000, Tian, Kevin wrote: > > > > > > > Are you specially concerned about this iommu_device hack which > > > > directly connects mdev_device to iommu layer or the entire removed > > > > logic including the aux domain concept? For the former we are now > > > > following up the referred thread to find a clean way. But for the latter > > > > we feel it's still necessary regardless of how iommu interface is > > redesigned > > > > to support device connection from the upper level driver. The reason is > > > > that with mdev or subdevice one physical device could be attached to > > > > multiple domains now. there could be a primary domain with DOMAIN_ > > > > DMA type for DMA_API use by parent driver itself, and multiple auxiliary > > > > domains with DOMAIN_UNMANAGED types for subdevices assigned to > > > > different VMs. > > > > > > Why do we need more domains than just the physical domain for the > > > parent? How does auxdomain appear in /dev/ioasid? > > > > > > > Say the parent device has three WQs. WQ1 is used by parent driver itself, > > while WQ2/WQ3 are assigned to VM1/VM2 respectively. > > > > WQ1 is attached to domain1 for an IOVA space to support DMA API > > operations in parent driver. More specifically WQ1 uses a PASID that is represented by an IOASID to userspace. > > WQ2 is attached to domain2 for the GPA space of VM1. Domain2 is > > created when WQ2 is assigned to VM1 as a mdev. > > > > WQ3 is attached to domain3 for the GPA space of VM2. Domain3 is > > created when WQ3 is assigned to VM2 as a mdev. > > > > In this case domain1 is the primary while the other two are auxiliary > > to the parent. > > > > auxdomain represents as a normal domain in /dev/ioasid, with only > > care required when doing attachment. > > > > e.g. VM1 is assigned with both a pdev and mdev. Qemu creates > > gpa_ioasid which is associated with a single domain for VM1's > > GPA space and this domain is shared by both pdev and mdev. > > Here pdev/mdev are just conceptual description. Following your > earlier suggestion /dev/ioasid will not refer to explicit mdev_device. > Instead, each vfio device attached to an ioasid is represented by either > "struct device" for pdev or "struct device + pasid" for mdev. The > presence of pasid decides which iommu_attach api should be used. But you still haven't explained what an aux domain is to /dev/ioasid. Why do I need more public kernel objects to represent a PASID IOASID? Are you creating a domain for every IOASID? Why? Jason