Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp723378pxj; Thu, 3 Jun 2021 18:34:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyL2sbUs1OwI0noiJXdWw/WCJ225xze2meP+LSw13OLYVegqvH6UbvRfA8TdJJ5SdHtQJC5 X-Received: by 2002:a05:6402:655:: with SMTP id u21mr2113719edx.211.1622770446151; Thu, 03 Jun 2021 18:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622770446; cv=none; d=google.com; s=arc-20160816; b=Lm5ipqpdbGCQJTb+U5QL3qSspKt76lA3Y+KINfdgutigneF5KxfNYyuI5y6QkdtWqN ISAMUrC/3p42Te4eIJdaVwtsITCLLPs+RgQl3V9/OXbkqbmwzPbHp1dByEiftsbLCH+Q 2A/rMc/NAq7wGj4Kz82623NC84+9Noam1fsq54iCVn9yudJrX1q7y64oKhusIG6Whq2z OffUAlw1h8mn4+khJFvp3XgLdk7goMO8vOzsb5gnAEiZEsCPTtrhT2TRteUm2Gxq1A6m 87UihnSxRs7Ag67DfUE2/aXMlD1xM3BtDKatQ4mnG5f6fRysEbx+rR2JwbPChNsYq2AV ghsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=jD0SrrifrVAIWI7R1gZoaTn69EV68xZixLKv5uzjFb0=; b=Kl6nxMIB28kQ4NIqHQnMH6ZByStiZVx83cUrNSc1oGdsedZUmf7oZ4SXeMKpyqXBGl EidjZ3wTIG2DjM5Qaq843aL8W7oa7wqovwlt3CYVyG+uSema49Igd8EVM6nPahx/IakM AZ1phiTXdgFNvMmMbfsqjsW7Ggs9nsVIl4TjWxeVLXs2rQKOlCyt24Zx8QZ7ZDwDcIWs EY1G/VwTaKfPX7WhpzkyEXr/Mb1vjUeytZJG56eUyMCWa45197gD3TUq7Nq3jsqsjUqI Kb2hrma0YOxtr+RH/6qcayS8dgXqnfovoRfr5U381pWzNv511n/7zEfHoRUqEYWyYczP Gmug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LMBoFqc4; 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 n1si3331091ejx.353.2021.06.03.18.33.42; Thu, 03 Jun 2021 18:34:06 -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=LMBoFqc4; 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 S229892AbhFDBce (ORCPT + 99 others); Thu, 3 Jun 2021 21:32:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20876 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbhFDBcd (ORCPT ); Thu, 3 Jun 2021 21:32:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622770248; 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=jD0SrrifrVAIWI7R1gZoaTn69EV68xZixLKv5uzjFb0=; b=LMBoFqc44DOArA0RxhZDRCpNYIRKtOjHtRTf9+0oDj5qumjjiYyTznNL0O+1WtmWe3JPUi OQa4ICPKWYN8rQ4UzTXu9woMyBx6ItojTaXMr/GveL/Ngtl6vMY8iTrNiCulIAoTy5N7wL JQuQ5WP1FwCq9DJkS1WfBLTVKpgdSVA= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-297-YqgCkUpuPYSYgUb2kOBEdw-1; Thu, 03 Jun 2021 21:30:46 -0400 X-MC-Unique: YqgCkUpuPYSYgUb2kOBEdw-1 Received: by mail-pj1-f72.google.com with SMTP id w12-20020a17090a528cb029015d7f990752so6599709pjh.0 for ; Thu, 03 Jun 2021 18:30:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=jD0SrrifrVAIWI7R1gZoaTn69EV68xZixLKv5uzjFb0=; b=pIxWGVAPsQvk2tO2kmPSmT8DuNCyVjsAwt5lnS2fpk/8JwVfi9AnnScRpRwzsfUbWb I+huzNyuqf+OesvsAu2QgbE6D9173F3+YkT1J8/Xrk89P9e3xbgHta9wK9WoRqyFUZ3c GOJjmsed9sHpblwp223IJkPIjtZmCc+X6mMmZLEO4sgXtAo4nfxA9WnjbyEk9WRS2ZIG PPdeAjasyBiQwUFdCByrahJQEojRGcZzg8ZAI1DCsPTEhX0j5TgJ2FRCUUbCL/7nYh7c xbcf1xLpyeB9pvbaSKQBFEJ5Anjd9drAYf6bVIjgcodFPzWAGGZonVvAzwAAkTKxJUnx neuw== X-Gm-Message-State: AOAM532Ez+Qq3XXEZiwK+l2y2lsc5AozMH7PpMD27hE1NBow5PLZVRg0 wYUa9EzTG//U4eH6kZlMb9g9q6019MwawZ7y52PHk+LUuwQEIXIwi3Dfmxj154N6HE9XqWbwxC0 9EWK4USHqMUpVlpYZknbtOZ7/ X-Received: by 2002:a63:6e87:: with SMTP id j129mr2331150pgc.45.1622770245926; Thu, 03 Jun 2021 18:30:45 -0700 (PDT) X-Received: by 2002:a63:6e87:: with SMTP id j129mr2331134pgc.45.1622770245745; Thu, 03 Jun 2021 18:30:45 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id d3sm3177937pjk.16.2021.06.03.18.30.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Jun 2021 18:30:45 -0700 (PDT) Subject: Re: [RFC] /dev/ioasid uAPI proposal To: Jacob Pan , 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)" , 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" References: <01fe5034-42c8-6923-32f1-e287cc36bccc@linux.intel.com> <20210601173323.GN1002214@nvidia.com> <23a482f9-b88a-da98-3800-f3fd9ea85fbd@huawei.com> <20210603111914.653c4f61@jacob-builder> From: Jason Wang Message-ID: <1175ebd5-9d8e-2000-6d05-baa93e960915@redhat.com> Date: Fri, 4 Jun 2021 09:30:37 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210603111914.653c4f61@jacob-builder> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2021/6/4 ????2:19, Jacob Pan ะด??: > 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. As discussed in another thread. I think the reason is that ATS doesn't forbid the #PF to be reported via a device specific way. Thanks > >> Thanks, >> Shenming >> > > Thanks, > > Jacob >