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 10670C433ED for ; Fri, 14 May 2021 13:33:52 +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 901796145D for ; Fri, 14 May 2021 13:33:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 901796145D 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=yv2Tyxkd7ku+1sxzCmB+8DgcYmVAFz2wQqr1SWldL+I=; b=HGTTf6S1fdYLm/Tc0coVkWRW6 +vyhXmMUKRo9S+qtavy5/XDx73yF5gbBu11ybk+kEOQKZRk6XOxYfhSoecX9+9FKYu2Mlv3CP2Xu7 hUOHeLzouj5H5XtDF1rraMMDHNM+s45EoSX3vJhkBKAwvu5d3vMNKYNc3wTxIDcmch9g0DEKIyM7t xvh6e7XocICs2iqOiz2wztU8rBHro+4aXYf3kbDVkwPVyi9+IUAWplIgDry6FUceqCI1rBL9uzQ5m IZOCAtaCRaxOf8FYwBpDfF5txy2JdsRbhYvuwo+e05YeuQCHWelA3sFwQ2Ld5Ogd/FZB41QOA5xxq 2i1wETAsQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lhXuy-0088qa-Gb; Fri, 14 May 2021 13:31:52 +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 1lhXuv-0088qN-49 for linux-arm-kernel@desiato.infradead.org; Fri, 14 May 2021 13:31:49 +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=oibZ2encQTXVcTS46xz1aln4vXwMiQRn+5Ve6HidmyY=; b=YJ0JtZqSFympo3YQt8SWGmg7Cd Eo4XYcKiQ+QSGQIdEXgyQ6mNIdkWcevP4/3APhOjDCvjeE6GRyclaBU36DP8n8Ce1mZGQxiIqnwxo wuQZ3bg07Fwz29WGLO9a3jMnffmyfoVQr6IzxfBQylhUEv+6wJPOidrt4yVDwKKM05DKJHggM9Nyb ij1JRupAlQt7W/zTlAOhMfn+nA24WTIgucwKuUQsFssMRp9ndT/p7hLsgoMivom23/DUswr8CjRNC tANqEVPZLcIIq25i3iZm1+tPrTGiBeaiylzDB5R1z8Q4cW4kTq+tnM+WPhizv8ajO//fcBJW8JxtP RU/Wd+kg==; Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhXus-00C0G7-0b for linux-arm-kernel@lists.infradead.org; Fri, 14 May 2021 13:31:47 +0000 Received: by mail-qv1-xf30.google.com with SMTP id o59so2202617qva.1 for ; Fri, 14 May 2021 06:31:45 -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=oibZ2encQTXVcTS46xz1aln4vXwMiQRn+5Ve6HidmyY=; b=P01L9ipF0WXXprGU/TPHMse5/2JNa5KJigLzB+MgLrkiRFpKV1d2TmruEIRGE/O2rT iiF42kQ3dw4/Ch/XtfZOpwpxPBgVZKlZepQw/F1pT5ms+OVjo7ydBxwBFLOD4pFck3pX f/NebrrJv+SMBUTHk3L2av0vieMiDpXGBAKiDs5U2/zXF1qRjy2armYsx39Ght5EFKH2 d91amYNGXarhYvHIiJ3JkLOljk4RqMqWPMXK+okMlwkVyKMoLFmm5GfL7XMQtlV2jACI 37Vdw6Mcy5n9S1ZpNBhtDgbvyBrqIrFPqfhlZc44jM/ZWDIhGcb0mFlhmSHuVzBytMpF on1A== 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=oibZ2encQTXVcTS46xz1aln4vXwMiQRn+5Ve6HidmyY=; b=tzd5u+5sf3JpYDKdVf5kpUnLA74ml1xdUwi8TxlN2MNTO2WPK2OJvIZUH9357H3wtn SFgOCyBr0Nll0vc10nnOQZphAAOqpP9Lqk6UeQWAyfQ9PnxxZVvcqsEVSOvDshsodCTb HWR/xUcutAvyjJ212q1zsFkYFHOdW2dKM5Py+D5LFe9bud6VlS8N3pNm/DpbxVHl19bp AHVaOjXrZC+vORGxbEDvbJBWxeUHLZusQ1aFhiZTJiMJgUN06YGn+FOCXP0D9zr3KLol 3eXUercE0MJ45jsAmeEgWjDCb+/upxAEbP6h4FYx2Re1MQClyIEJEIApwavIDudRUPoL 9Plw== X-Gm-Message-State: AOAM530o9jkTWSXKJx9689LiNxWOv12BGEoyyPUTV62qWh+dB6stJ5KS +tI0d8lTE5ssSX9dA8RTkS3LUA== X-Google-Smtp-Source: ABdhPJz/Gqut1q/aFEFJ4dhIoQHY99jUDAFFC+RcHlUQEp277wF1zYHdBA3LTZbkkjtOGNdQocIJpQ== X-Received: by 2002:a0c:c488:: with SMTP id u8mr45442908qvi.47.1620999104308; Fri, 14 May 2021 06:31:44 -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 y1sm4582720qkp.21.2021.05.14.06.31.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 06:31:43 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lhXup-007RZ1-4c; Fri, 14 May 2021 10:31:43 -0300 Date: Fri, 14 May 2021 10:31:43 -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: <20210514133143.GK1096940@ziepe.ca> References: <20210510065405.2334771-1-hch@lst.de> <20210510065405.2334771-4-hch@lst.de> <20210510155454.GA1096940@ziepe.ca> <20210513120058.GG1096940@ziepe.ca> <20210514121925.GI1096940@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_063146_228132_0990FECF X-CRM114-Status: GOOD ( 20.94 ) 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 12:58:10PM +0000, Tian, Kevin wrote: > This avoids changing every iommu ops to include a PASID and forcing > the upper-layer drivers to do it differently between pdev and mdev. > Actually this was a main motivation when working out aux domain > proposal with Joerg two years ago. Well, usually when people say stuff like that it means it is a hack.. Oh, this does look like a big hack, yes. /dev/ioasid is focused on IOASIDs. As an API you have to be able to use it to create all kinds of IOASID's *against a single HW struct device*. In this world you can't create domains for every struct device as hack to pass in the PASID. The IOASID itself must be an object that contains the HW struct device and the PASID. IOASID must be a first class object in the entire API. Remember, when a driver wants to connect to an IOASID it wants to make some very simple calls like: iommu_attach_ioasid_rid(&pci_device->dev, ioasid_ptr); iommu_attach_ioasid_pasid(&pci_device->dev, ioasid_ptr); Which is based *only* on what the PCI device does. If the device issues TLPs without PASID then the driver must use the first. If the device issues TLPs with a PASID then the driver must use the latter. There is no place for "domain as a carrier of PASID" there. mdev_device should NOT participate in the IOMMU layer because it is NOT a HW device. Trying to warp mdev_device into an IOMMU presence is already the source of a lot of this hacky code. To juggle multiple IOASID per HW device the IOMMU API obviously has to be made IOASID aware. It can't just blindly assume that a struct device implies the single IOASID to use and hope for the best. > The reason is that iommu domain represents an IOVA address > space shareable by multiple devices. It should be created at the > point where the address space is managed. IOASID represents the IOVA address space. Two concepts that represent the same thing is not great :) Jason _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel