Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1688488pxj; Wed, 19 May 2021 11:30:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJPVBIs3WcfgDXD+bCsoKCHej9vR67tdS1JtUeaZp9uTb8vENgKnatz0+9PZJxHLgvnug6 X-Received: by 2002:a05:6e02:527:: with SMTP id h7mr377351ils.93.1621449018699; Wed, 19 May 2021 11:30:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621449018; cv=none; d=google.com; s=arc-20160816; b=vzT+0oppKVcoVq90brD9IPkuIM/4m1eyAFPnXExPbrNyMRNo18+lA4/lf8BmmGh2iq Jh75n9oCktiYq9zZT1NjNlAyDC4x9IKEO9SYKY90SZvXkYqHkhERoyK5hx/PnldYA6HE U7ERjMpO+9HjnokGpN805dYszYM/4I1p/F/hHp8Bnu9a1n+4uZqU/r6jPEhKmhhDc0si esIOdv6jdJwjLaTn4oBI9W/Sg9JxXXXilSB3v0bQs18vK8ELnZcXcTJOFYaj9gDSn07y WFjnUqlmsZwa4qx9pdB6mcbClUghkK4V3qUB/aBPzuc+P7OLyOh3+pcg+wCULffh72zZ +kXA== 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=EmvqAF/tGZxnpJT45xMDZ2Iz1NsXhbJqP8uJhgy88+E=; b=dZQUG9lrKm/cXcDgm6+W5MAYjV4El68LqqO4/R0h960c22kU8hf9c4atvMevfNRWd3 d46NzoAvWQDrS/EKc1/T9+eOOu+YQCc1emVguOBmo2KVHLItpoi0gvuNHc3ZpUWv6Xyx bMhBiQZCpBpcLkd/CvvUftyFmG7h3hp6kVIkVInmHVVrK8tOwbP3P4rIE4Nuzafhxjoc y1GYWg1Y2O6AkPvRoFfsSHDriFU6Twn+MH6pOlDojzFYUvuzOdP9NLXnvpeyMyZDCzsf oXxG2IknHLqEK1AXCBl1+1G6V9gYUd0ZJsEK+30jQDQCBKl6Ob0q0AUwy92p8cGkE1Du Ob0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e8E9uxQl; 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 d8si303533ilo.3.2021.05.19.11.30.05; Wed, 19 May 2021 11:30:18 -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=e8E9uxQl; 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 S1351740AbhERTAZ (ORCPT + 99 others); Tue, 18 May 2021 15:00:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58714 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242103AbhERTAW (ORCPT ); Tue, 18 May 2021 15:00:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621364343; 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=EmvqAF/tGZxnpJT45xMDZ2Iz1NsXhbJqP8uJhgy88+E=; b=e8E9uxQlyBwfTCyl/wNowmTI3LZESH5h39x4YndMDGKzfh2TQ+dUkQV5hsF6Cjy7tocF/U g/ZR9OXQvX2hZsTRphBeJmWOZyI3QKGWNU58yyfRs1L7Z1s4Xcdf1UvBefG7P+DcQ9RPn/ 0BhIa7KXyhveaF8LKEbQEuyJtP0gCzg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-501-msU198vYOKCHIds7qVJYZw-1; Tue, 18 May 2021 14:58:59 -0400 X-MC-Unique: msU198vYOKCHIds7qVJYZw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED0AF80006E; Tue, 18 May 2021 18:58:56 +0000 (UTC) Received: from redhat.com (ovpn-113-225.phx2.redhat.com [10.3.113.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id E08931037E88; Tue, 18 May 2021 18:58:55 +0000 (UTC) Date: Tue, 18 May 2021 12:58:43 -0600 From: Alex Williamson To: Shenming Lu Cc: Cornelia Huck , Will Deacon , Robin Murphy , Joerg Roedel , Jean-Philippe Brucker , Eric Auger , , , , , , Kevin Tian , Lu Baolu , , Christoph Hellwig , Jonathan Cameron , Barry Song , , Subject: Re: [RFC PATCH v3 1/8] iommu: Evolve the device fault reporting framework Message-ID: <20210518125843.68552b67.alex.williamson@redhat.com> In-Reply-To: <20210409034420.1799-2-lushenming@huawei.com> References: <20210409034420.1799-1-lushenming@huawei.com> <20210409034420.1799-2-lushenming@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 9 Apr 2021 11:44:13 +0800 Shenming Lu wrote: > This patch follows the discussion here: > > https://lore.kernel.org/linux-acpi/YAaxjmJW+ZMvrhac@myrica/ > > Besides SVA/vSVA, such as VFIO may also enable (2nd level) IOPF to remove > pinning restriction. In order to better support more scenarios of using > device faults, we extend iommu_register_fault_handler() with flags and > introduce FAULT_REPORT_ to describe the device fault reporting capability > under a specific configuration. > > Note that we don't further distinguish recoverable and unrecoverable faults > by flags in the fault reporting cap, having PAGE_FAULT_REPORT_ + > UNRECOV_FAULT_REPORT_ seems not a clean way. > > In addition, still take VFIO as an example, in nested mode, the 1st level > and 2nd level fault reporting may be configured separately and currently > each device can only register one iommu dev fault handler, so we add a > handler update interface for this. IIUC, you're introducing flags for the fault handler callout, which essentially allows the IOMMU layer to filter which types of faults the handler can receive. You then need an update function to modify those flags. Why can't the handler itself perform this filtering? For instance in your vfio example, the handler registered by the type1 backend could itself return fault until the fault transfer path to the device driver is established. Thanks, Alex