Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1778051pxj; Fri, 18 Jun 2021 15:28:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzI54gr9x7JnoT8GJ+8XdUb6ils23I7YZI5qjHiwUa33y4OHziU/OrXS4IJaNTzGE5Ig3ZX X-Received: by 2002:a05:6e02:84:: with SMTP id l4mr8769276ilm.288.1624055313111; Fri, 18 Jun 2021 15:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624055313; cv=none; d=google.com; s=arc-20160816; b=XpT1DdUXoFiMaV1ynNteMqjJZSAOjmk8bc531c1TVqBHM/1nb7oQy3MXiuaOBNOlt7 6UqwS314K00b7dTm7grVtIamm9x9gpOMaWyzHkKYm6bOf9Bu9UTYMnkuT88XK1BSvVGf chQpqtcYnx9cZJ9PyGJgojj/MaAbw3hB+6T5KRHl24riRpv6ide/sTYLyEPHhvO4O5cx d7hc29XIUNkBGzp/WwCB/UpQtpIqH0hEqgwJw89o1Yka0mEbJDjFnBVAsLXEih65vAig tpvoQIvsq4z3PrHdCV98bd9l46AmCbpQJNiI4hf4JzLswmyK3jcPu8xoy0CygQ6ZFAdN 4Cpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=2JEl/D8fElGUs5qE1bIG8tGOHlH8JDuVtFpyPtPAcRM=; b=LBWzKL0a/zMwf8CtMQN2V5bFedv+LRQBZRTys5QizV3EtZmqvqxy2uErf7NHLB/b8l G8w3+R+nMu2PpmLfv2yUuaXd7L2ro8D+RJ1K3wf+7agnS7UaLCOcw2tEshg/bmwsySHd GGx4U/qySJd8XootiLBiMSYSce0+0SvOdqPgNAb0dbj0I6kpSgZ4EQw9XrhKjXwZd2HO HXfHKAiNw84HPfzAb0O5kYc9+UPZLf7z4RffqrOS17+G+cf0tgZ6emOhJ9iP0NWiQmec TKGAX4rr9sD4uj7HpWyk+hm3LvMefvZVmLOTfbS7ln/eqsR//xdIuRYmsyR2G8i3fhQh hZqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JEFPYe7e; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i13si3513488ils.127.2021.06.18.15.28.19; Fri, 18 Jun 2021 15:28:33 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JEFPYe7e; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235674AbhFRPyM (ORCPT + 99 others); Fri, 18 Jun 2021 11:54:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36898 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235658AbhFRPyL (ORCPT ); Fri, 18 Jun 2021 11:54:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624031521; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2JEl/D8fElGUs5qE1bIG8tGOHlH8JDuVtFpyPtPAcRM=; b=JEFPYe7eYkoNs0u1MF2VlyQ3u0ZtH+8Qz6FK7E9IFj6Vf7dGULakGJI49asSHs8uJYouXW fj/L9iteQXMWKHhQpcCPk598sJhvzbcCGhi1cXXZzt8CHX72ZI68u3vjlBC780B7frsuI1 /TiZlB75ke9C+cwaQnw2Iwq/FM/U0LQ= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-577-KONeMURzPTur3reikz6_Zw-1; Fri, 18 Jun 2021 11:52:00 -0400 X-MC-Unique: KONeMURzPTur3reikz6_Zw-1 Received: by mail-il1-f198.google.com with SMTP id g14-20020a926b0e0000b02901bb2deb9d71so6234682ilc.6 for ; Fri, 18 Jun 2021 08:52:00 -0700 (PDT) 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:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=2JEl/D8fElGUs5qE1bIG8tGOHlH8JDuVtFpyPtPAcRM=; b=FqdbflCJnGsRUpkzL5UXeQKDq7PfcdvnWrTmY5kqfpcvHRoaxsV9I5dAXwVebcUU3n zL+v/W8M90FHSNORuMe+9KU/QAfVNM7iR+z52ASQ36bTK1feKwCbE58p5jaxfk85OP+y ZqbEOiUFBBk3J1/slDet0l0wkLPaXbIX0qXlR+qFNpGWaB23kGc7bd71DS3R2rKwXvtv WfoCw0B1dGbaD5g7cSt+lihQtDiW2rxl2BT1/Luro+Palk/DmPFvV30BKJJ9WS5vYhws VpH27I7Fi+lgIDvI93bPT19RAWwFkvLog21ES6WD4dfPo9AaKBk1slmaZC6t7HqriPEk Otrg== X-Gm-Message-State: AOAM532TyQAYo3FvaWPNfTnDFZ7ENb/eeeFYD5AZp9K/VeXdsnMpXNxk 0+uLpBjoURm4Rafl+yYpamM+2mV1CCFx7JqwTHullTgzdRAjQnII14gItR8nmXmYsA0ehiF7xvv TT/l3bxcR+bx/RL1NrofmJYNh X-Received: by 2002:a05:6e02:1383:: with SMTP id d3mr6837998ilo.172.1624031519706; Fri, 18 Jun 2021 08:51:59 -0700 (PDT) X-Received: by 2002:a05:6e02:1383:: with SMTP id d3mr6837986ilo.172.1624031519497; Fri, 18 Jun 2021 08:51:59 -0700 (PDT) Received: from redhat.com (c-73-14-100-188.hsd1.co.comcast.net. [73.14.100.188]) by smtp.gmail.com with ESMTPSA id y13sm4516131ioa.51.2021.06.18.08.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 08:51:59 -0700 (PDT) Date: Fri, 18 Jun 2021 09:51:57 -0600 From: Alex Williamson To: "Raj, Ashok" Cc: Jason Gunthorpe , Joerg Roedel , "Tian, Kevin" , Jean-Philippe Brucker , David Gibson , Jason Wang , "parav@mellanox.com" , "Enrico Weigelt, metux IT consult" , Paolo Bonzini , Shenming Lu , Eric Auger , Jonathan Corbet , "Liu, Yi L" , "Wu, Hao" , "Jiang, Dave" , Jacob Pan , Kirti Wankhede , Robin Murphy , "kvm@vger.kernel.org" , "iommu@lists.linux-foundation.org" , David Woodhouse , LKML , Lu Baolu Subject: Re: Plan for /dev/ioasid RFC v2 Message-ID: <20210618095157.131eb309.alex.williamson@redhat.com> In-Reply-To: <20210618153735.GA37688@otc-nc-03> References: <20210612105711.7ac68c83.alex.williamson@redhat.com> <20210614140711.GI1002214@nvidia.com> <20210614102814.43ada8df.alex.williamson@redhat.com> <20210615101215.4ba67c86.alex.williamson@redhat.com> <20210616133937.59050e1a.alex.williamson@redhat.com> <20210618151506.GG1002214@nvidia.com> <20210618153735.GA37688@otc-nc-03> Organization: Red Hat X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 18 Jun 2021 08:37:35 -0700 "Raj, Ashok" wrote: > On Fri, Jun 18, 2021 at 12:15:06PM -0300, Jason Gunthorpe wrote: > > On Fri, Jun 18, 2021 at 03:47:51PM +0200, Joerg Roedel wrote: > > > Hi Kevin, > > > > > > On Thu, Jun 17, 2021 at 07:31:03AM +0000, Tian, Kevin wrote: > > > > Now let's talk about the new IOMMU behavior: > > > > > > > > - A device is blocked from doing DMA to any resource outside of > > > > its group when it's probed by the IOMMU driver. This could be a > > > > special state w/o attaching to any domain, or a new special domain > > > > type which differentiates it from existing domain types (identity, > > > > dma, or unmanged). Actually existing code already includes a > > > > IOMMU_DOMAIN_BLOCKED type but nobody uses it. > > > > > > There is a reason for the default domain to exist: Devices which require > > > RMRR mappings to be present. You can't just block all DMA from devices > > > until a driver takes over, we put much effort into making sure there is > > > not even a small window in time where RMRR regions (unity mapped regions > > > on AMD) are not mapped. > > > > Yes, I think the DMA blocking can only start around/after a VFIO type > > driver has probed() and bound to a device in the group, not much > > different from today. > > Does this mean when a device has a required "RMRR" that requires a unity > mapping we block assigning those devices to guests? I remember we had some > restriction but there was a need to go around it at some point in time. > > - Either we disallow assigning devices with RMRR > - Break that unity map when the device is probed and after which any RMRR > access from device will fault. We currently disallow assignment of RMRR encumbered devices except for the known cases of USB and IGD. In the general case, an RMRR imposes a requirement on the host system to maintain ranges of identity mapping that is incompatible with userspace ownership of the device and IOVA address space. AFAICT, nothing changes in the /dev/iommu model that would make it safe to entrust userspace with RMRR encumbered devices. Thanks, Alex