Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1243222pxj; Fri, 4 Jun 2021 09:23:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyT04NO/5R4raaGH4Ol10OKpMWERU/LRPWIjTuCpe/Iu9A422K0d+rEtQNI/Nk31vRFn4ar X-Received: by 2002:a17:906:3818:: with SMTP id v24mr4778622ejc.197.1622823821859; Fri, 04 Jun 2021 09:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622823821; cv=none; d=google.com; s=arc-20160816; b=p7tn840rKyFlbxjxMa/yzvPJC1e6/P5qti2SGDRdIpZak8lV7G6xeGprJq+kMf//5u WRRZQCWKHhrpaKn522/GM1iyo7R/UXV84lRaIvBdXhyDtoq1c7wxyCZT5wSrC2oIdFbc QlGfO2jSE8ar0+btiwR7IKDMbKpJ2qwTDwzJ4FeHUxiNYG+uOLlvq9g2yED8b80Uabm3 d1SluNpNY7vAmlKnUpIlvFaAdGbdYmVs4G3IABNJruOTaumPh9NZbj09SCvrXhscUvLX e25F7dzIGzkbproLBJzK9/t9Uo86YO9pH4rwR4PzQ5EQZbYpiFDmNgd6OHKCbS/uuH9c nPUA== 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=E3Bv7m5OESAoJNXXLrXaeEAylmDzFOeWQQhNOs/6uEg=; b=Lf7Ks/YDR/Vxq6jL798TAvtcr5XDzLwMYjJMetlbVPXAUgwGb7aZyEOJvhPtGq899F Q9VEJV/9sBM78uaB1YGXDNrLLlsD5qs9nWBro39M59WyG5Y5SgYyFuR8dhBLuVaFhuaB yWMX4uYscLka1mbaBCpjTkT5clouB5M23a0zjec7E+wqRFTTr71w9yx0twVTO0tHzXLd mhITvMxlvvyLHVzvQbspSjdBLXb/fbwbFIYMuYfdPoOeLrPnqnNHamIO686E0udJJas0 a+8mHUFAJ6We7XI+++iySJ8+7svOwwokPYkud7oX254rYrcUKJpGvdLqY99UjHxpLg4N 2JFw== 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 l3si5699898ejd.313.2021.06.04.09.23.17; Fri, 04 Jun 2021 09:23:41 -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 S230128AbhFDQVz convert rfc822-to-8bit (ORCPT + 99 others); Fri, 4 Jun 2021 12:21:55 -0400 Received: from mga14.intel.com ([192.55.52.115]:33810 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbhFDQVy (ORCPT ); Fri, 4 Jun 2021 12:21:54 -0400 IronPort-SDR: 5+W7pf5l1yBpcI/BBBc7rWLyqFeMVDlxOROqny9Q6+q0BwkeJR+098U8siZo4Gb+AeJ3leiFGt zaO4YtxYwLvg== X-IronPort-AV: E=McAfee;i="6200,9189,10005"; a="204134791" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="204134791" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 09:20:05 -0700 IronPort-SDR: CTvtJdPKdL7KqXyLzIbdMrFdnFKp+Ju+OSzf2PnUoTrmxEGmg1uGDqEgovEeQOFzdWMSQpKoeJ wr0Z0gzGuBXA== X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="446738781" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 09:20:05 -0700 Date: Fri, 4 Jun 2021 09:22:43 -0700 From: Jacob Pan To: Jason Wang Cc: Shenming Lu , 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" , jacob.jun.pan@linux.intel.com Subject: Re: [RFC] /dev/ioasid uAPI proposal Message-ID: <20210604092243.245bd0f4@jacob-builder> In-Reply-To: <1175ebd5-9d8e-2000-6d05-baa93e960915@redhat.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> <1175ebd5-9d8e-2000-6d05-baa93e960915@redhat.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=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jason, On Fri, 4 Jun 2021 09:30:37 +0800, Jason Wang wrote: > 在 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. > Yes, in that case we should support both. Give the device driver a chance to handle the IOPF if it can. > Thanks > > > > > >> Thanks, > >> Shenming > >> > > > > Thanks, > > > > Jacob > > > Thanks, Jacob