Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp74633pxj; Tue, 1 Jun 2021 15:32:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAfYgOy631U8FMm6EhnP3pAgi5M3JgUB2/1LreV6/wDSiD5OfJquXgQrjW/2uiqqj57iEO X-Received: by 2002:a17:906:488a:: with SMTP id v10mr23652575ejq.383.1622586741017; Tue, 01 Jun 2021 15:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622586741; cv=none; d=google.com; s=arc-20160816; b=0Ml++buBNEka5u/TdPaXSgg9N/lSy4/w7w6g3dNMrPC6cqV2iMXaUrcMPcZLChcNb8 BI8TtLZHdtp99m1VDwFfL3A9M8u8+aMYO1DtPKk5cT4TQehru23sYNMH691T0jCJXC7b cS/k94nCbzeOPbbv1PkvRuZddcLvdA6eaZf7hoN/NYGnGWkGqHoeaO86eRBDKE76N8Zt MjwA8IbfiW87+qKO93nxiN7DAYvvJ8n+e/Bendl3BiiC1ACdXpVxmesN8EUG/wyO0PAg 8dPAAM0LgcU/ZUPMSWxS/2u+k2fiUxk1dmVIGyQr1LQf0BkqhZU7p+SxGhH2QdEbxUCt sCjg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=QQ6OOCiaBJ+Tmwz5+IKCbPSSgkslxV7sVjnAnThBj/I=; b=Ux1QUu2aXp4m/lHjPuBx8t1c4em+PWpCTvuuFGQWTsml56yBmPYHOkRhGPRN/8D8rO Y2oTpYOf7b3AorMXUCjO01Hivrl9CBhfdj/KiDogdloU43LkruOXMRLxHjKtSvQgJ3wK mXUmEV9Cu3ZqcScd2yoHSWjcfA83oOvCOfXesLjiIgJ6dEOPbEX4sCtQkROF9ZWkuIXn o1OxeYWWsRasnpaRz/i7wq9tW7V4Oeijv0dYxvMCN2GJz7fQhgWwf/cyS5nAV38/yVFO 2X8y2QCYT404bx8AaFKjoO+e5bc/TXOcDP61J96ohla7EtO9IElu+mMDIdB4SbGHW+kf WrMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="iYW4l/ye"; 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 bi14si17111380ejb.441.2021.06.01.15.31.58; Tue, 01 Jun 2021 15:32:21 -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="iYW4l/ye"; 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 S235029AbhFAWYP (ORCPT + 99 others); Tue, 1 Jun 2021 18:24:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47540 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234890AbhFAWYO (ORCPT ); Tue, 1 Jun 2021 18:24:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622586152; 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=QQ6OOCiaBJ+Tmwz5+IKCbPSSgkslxV7sVjnAnThBj/I=; b=iYW4l/ye/20fA3QsGFfc+xYd8NHpoyaVYYaPcJyftRCfBy11bbVc11FJ0VIgNxIR54gHtO 1IL6d89qvYydAgcjri4m6JHfQiNOFdYRYDiPpUs/iWnxy59NYB52dnVloYsKemBbp7cBv+ XgAw2M3VyBEURbkBlPs94Dj3feHCJ3E= Received: from mail-oi1-f198.google.com (mail-oi1-f198.google.com [209.85.167.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-95-zsuddzURMbq_ran-qb7wkw-1; Tue, 01 Jun 2021 18:22:30 -0400 X-MC-Unique: zsuddzURMbq_ran-qb7wkw-1 Received: by mail-oi1-f198.google.com with SMTP id k18-20020a05680808d2b02901edfe86c6dcso439600oij.9 for ; Tue, 01 Jun 2021 15:22:30 -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:mime-version:content-transfer-encoding; bh=QQ6OOCiaBJ+Tmwz5+IKCbPSSgkslxV7sVjnAnThBj/I=; b=I1wbz/16+wrsyrOI8htiNOgtH/Je6JbBPwdIWMHPl/mcq8PiYWF97p2BZ4xcHCV5U0 OUkU09/TTqukercd36lOC1K1LwPmgswVc8/UXqNLdlt4CveC1kaX+gg0E3xxsaUKs8lH Xd5sTaUo7uEpcVC1FrepTmakKqk9Zvu/SxZSDhJT2Mxlk2VFch4snoGxN4p4DsNyrfD3 gYzdzT5vdWi2gqqufiuy67hJkKsgIWjBRMok73SnAag84bpXlNNn91tqk7179VrNt372 Ctz1+opxP9hD6xxbMzPcd7986COsMmdKpcxd2dmoJ0XB+g52AnQ8qTbXyMMz7CM/4o7Q j3sQ== X-Gm-Message-State: AOAM530DnJV8URn7T3wFggD8IxO8uxFryuQ2irefhk8ZqjReLbVAyKGb SY4NUHkWRLumjRHVm/EfVQ2H+Q8szn54Cn8/HJqstoJeq/2uOIsaixmbC6TYuCgyMeu+j46wt/P 4Ski7pqTWgkNGY3tmMBygGg49 X-Received: by 2002:aca:6505:: with SMTP id m5mr18776740oim.93.1622586150037; Tue, 01 Jun 2021 15:22:30 -0700 (PDT) X-Received: by 2002:aca:6505:: with SMTP id m5mr18776727oim.93.1622586149841; Tue, 01 Jun 2021 15:22:29 -0700 (PDT) Received: from redhat.com ([198.99.80.109]) by smtp.gmail.com with ESMTPSA id w10sm3658007oou.35.2021.06.01.15.22.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 15:22:29 -0700 (PDT) Date: Tue, 1 Jun 2021 16:22:25 -0600 From: Alex Williamson To: "Tian, Kevin" Cc: Jason Gunthorpe , LKML , Joerg Roedel , "Lu Baolu" , David Woodhouse , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , Jason Wang , Eric Auger , Jonathan Corbet , "Raj, Ashok" , "Liu, Yi L" , "Wu, Hao" , "Jiang, Dave" , Jacob Pan , Jean-Philippe Brucker , David Gibson , Kirti Wankhede , "Robin Murphy" Subject: Re: [RFC] /dev/ioasid uAPI proposal Message-ID: <20210601162225.259923bc.alex.williamson@redhat.com> In-Reply-To: References: <20210528200311.GP1002214@nvidia.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; 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 Tue, 1 Jun 2021 07:01:57 +0000 "Tian, Kevin" wrote: > > I summarized five opens here, about: > > 1) Finalizing the name to replace /dev/ioasid; > 2) Whether one device is allowed to bind to multiple IOASID fd's; > 3) Carry device information in invalidation/fault reporting uAPI; > 4) What should/could be specified when allocating an IOASID; > 5) The protocol between vfio group and kvm; > ... > > For 5), I'd expect Alex to chime in. Per my understanding looks the > original purpose of this protocol is not about I/O address space. It's > for KVM to know whether any device is assigned to this VM and then > do something special (e.g. posted interrupt, EPT cache attribute, etc.). Right, the original use case was for KVM to determine whether it needs to emulate invlpg, so it needs to be aware when an assigned device is present and be able to test if DMA for that device is cache coherent. The user, QEMU, creates a KVM "pseudo" device representing the vfio group, providing the file descriptor of that group to show ownership. The ugly symbol_get code is to avoid hard module dependencies, ie. the kvm module should not pull in or require the vfio module, but vfio will be present if attempting to register this device. With kvmgt, the interface also became a way to register the kvm pointer with vfio for the translation mentioned elsewhere in this thread. The PPC/SPAPR support allows KVM to associate a vfio group to an IOMMU page table so that it can handle iotlb programming from pre-registered memory without trapping out to userspace. > Because KVM deduces some policy based on the fact of assigned device, > it needs to hold a reference to related vfio group. this part is irrelevant > to this RFC. All of these use cases are related to the IOMMU, whether DMA is coherent, translating device IOVA to GPA, and an acceleration path to emulate IOMMU programming in kernel... they seem pretty relevant. > But ARM's VMID usage is related to I/O address space thus needs some > consideration. Another strange thing is about PPC. Looks it also leverages > this protocol to do iommu group attach: kvm_spapr_tce_attach_iommu_ > group. I don't know why it's done through KVM instead of VFIO uAPI in > the first place. AIUI, IOMMU programming on PPC is done through hypercalls, so KVM needs to know how to handle those for in-kernel acceleration. Thanks, Alex