Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp480545pxj; Thu, 3 Jun 2021 11:19:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzApC3cBupExoWb529JRIcsSPdZMxffxEF4B5fymHf9LQTG72Ppnxmys4p8n4sbieef6mOI X-Received: by 2002:a17:906:c241:: with SMTP id bl1mr600898ejb.536.1622744398185; Thu, 03 Jun 2021 11:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622744398; cv=none; d=google.com; s=arc-20160816; b=JdtFaxUlbcvDs7U1dxKGy+oq551PsikdAZ7HiymTWu9snCIuJ1OMCpShFQFe53iX64 kMKziXdocx7Q0bm+rEYpDkAnDeTN52CH9MLU0uiTI4pGFLpUjdMtSBypRFk+LoOAHgKP AjNZNKYn9408BVJN67CuKY91jYXI0YiXS1aFptm3OJqA4T92GCOf420rj/gxoZJx/c5o lBbdrDPGrsQZ+czI77jgT3t/ISEsQOJKH0eY+y2F+CfK5qHijqJuVCkgQewXOr6yyx7H QMTglKcQ8bbNsYh2/DieXn/KubPNo+4pqGREvzEoeEs9JIfog5xfaDSUuK98st6sGPVr B3mg== 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:ironport-sdr:ironport-sdr; bh=H7VwSZMFsTsOc5M/1lnuDevPbEbdxwZCzUgx3Uez7iE=; b=E4/KvaecwFy1IBTyYy/vCBnhtFuugfD0ZrEsuts7r01sYSJZqF4WoUHapvefIfab3l f2LESqVJoxYLESfIqKfSIB7COwFbcdMPX65Jl1e69lNiiKbCpxczb/DdxMRyUsoL3j8s U2VSSgjPUCuD/Ty+3ixZ49Czx8fff307ETMtWxJjPiL/H8y1z+rh1OoWaAQ2YahgDK1l h/tkAQ7zmUftujN8gI6c3WMuxy9gffj3MZlJvuku7KRphyzt6CE75a/utGqDAromIBKc 739O5WMif+c+/XA0Fe/evMDLXi9KvIFh3VolNTywO+XKMhsehZOcsC9DPnza6XV5aVtt C6iQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k22si2733023ejd.339.2021.06.03.11.19.34; Thu, 03 Jun 2021 11:19:58 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229840AbhFCSSl (ORCPT + 99 others); Thu, 3 Jun 2021 14:18:41 -0400 Received: from mga04.intel.com ([192.55.52.120]:11462 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhFCSSl (ORCPT ); Thu, 3 Jun 2021 14:18:41 -0400 IronPort-SDR: nq+U15UXWPM6lMBVvzAr1toyl85P2Lu4L1uWLCz7i+/BrUHwwA6cbKHl1CCTn0pJKMFHUR4gX+ 0ArvgLdU68Yg== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="202256216" X-IronPort-AV: E=Sophos;i="5.83,246,1616482800"; d="scan'208";a="202256216" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 11:16:38 -0700 IronPort-SDR: 9pBvENtfWuBMbET//Z1zc0S1vJhEpeu/skYlOjWVxtlNDyqkMly957fa7Ne228wAOY12hp6yte ueK+lCzlzh/A== X-IronPort-AV: E=Sophos;i="5.83,246,1616482800"; d="scan'208";a="417479645" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 11:16:37 -0700 Date: Thu, 3 Jun 2021 11:19:14 -0700 From: Jacob Pan To: Shenming Lu Cc: Jason Gunthorpe , Lu Baolu , "Tian, Kevin" , LKML , Joerg Roedel , David Woodhouse , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "Alex Williamson (alex.williamson@redhat.com)" , Jason Wang , Eric Auger , Jonathan Corbet , "Raj, Ashok" , "Liu, Yi L" , "Wu, Hao" , "Jiang, Dave" , Jean-Philippe Brucker , David Gibson , Kirti Wankhede , "Robin Murphy" , Zenghui Yu , "wanghaibin.wang@huawei.com" , jacob.jun.pan@linux.intel.com Subject: Re: [RFC] /dev/ioasid uAPI proposal Message-ID: <20210603111914.653c4f61@jacob-builder> In-Reply-To: <23a482f9-b88a-da98-3800-f3fd9ea85fbd@huawei.com> References: <01fe5034-42c8-6923-32f1-e287cc36bccc@linux.intel.com> <20210601173323.GN1002214@nvidia.com> <23a482f9-b88a-da98-3800-f3fd9ea85fbd@huawei.com> Organization: OTC X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-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 Hi Shenming, On Wed, 2 Jun 2021 12:50:26 +0800, Shenming Lu wrote: > On 2021/6/2 1:33, Jason Gunthorpe wrote: > > On Tue, Jun 01, 2021 at 08:30:35PM +0800, Lu Baolu wrote: > > > >> The drivers register per page table fault handlers to /dev/ioasid which > >> will then register itself to iommu core to listen and route the per- > >> device I/O page faults. > > > > I'm still confused why drivers need fault handlers at all? > > Essentially it is the userspace that needs the fault handlers, > one case is to deliver the faults to the vIOMMU, and another > case is to enable IOPF on the GPA address space for on-demand > paging, it seems that both could be specified in/through the > IOASID_ALLOC ioctl? > I would think IOASID_BIND_PGTABLE is where fault handler should be registered. There wouldn't be any IO page fault without the binding anyway. I also don't understand why device drivers should register the fault handler, the fault is detected by the pIOMMU and injected to the vIOMMU. So I think it should be the IOASID itself register the handler. > Thanks, > Shenming > Thanks, Jacob