Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp236348iog; Tue, 28 Jun 2022 21:48:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uctoNdpMywmP18XGh0aOShpmk2ho6lYL/mUsNHdABNawR+uyky1vlCWCTrsZa/8V3KwuV6 X-Received: by 2002:a05:6402:35d3:b0:435:dd1d:183b with SMTP id z19-20020a05640235d300b00435dd1d183bmr1760073edc.369.1656478129523; Tue, 28 Jun 2022 21:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656478129; cv=none; d=google.com; s=arc-20160816; b=MnlykOduIv9ffeaMdIJRZNfct/4wDN+OuTr5dBb2lE+QlqZBfWik/KSoJHaizIwTDf sWpN1Texrbrrq0jSUvUrcDjJDHW18iDTd0cvAkZVbu/NUonQOvMcFOPfDYZh4jRndixN 5oDObQrv+cFgvQekvr1rxDBD8N3zzLu1FtGMkgFZzzIEOVRQl+De7J+vkIphGg/eYPcr wwYErGdKO76GL7lF1KUyHYuHieDkC8YrBCVx2UfH3upFol3CaoV0l8XAfEED1Dssicdm n2arqaGpjTY3OAprj35AvRD9WrBzQgWtKh3vDtdu09o7g4qqSdA7MjfDtTVEmNXbTb8y +quw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=1MIf5g3Jl2ccYDq88qi9jqt8Pm+XnItgl8DC2NiyptM=; b=TIncchzf1ZX7lwTG425xobD5xMrZEpdkVwHSSaDD14IiOnPLTTLRgho7yuLM0L2Gqx JYdYgdM+lhbPt3kO+nHxCBnNGB04GTIubtHiHg8nJcfSYWIgB1wpr9NBcDwE4Zdql6xW PeS0Y6tTezzooYNT1rsKjE/6Sj8uaQ8CPeQDskEJQj2K318xN2Acf0Fmu4247E2J+SrI RoqH9/DLlu4jfjMW4MhRBHSVYNgYJQDDe6Aw9njJ7rcIpARlwFg4zLkoH5BiVdHG0sv0 DKniY8o8Q7diC5l4omsoogKJZ+TZEGX2DsFkvziL/t9uIYJ+aRFN7NzqSjVnyyRzoGot 1aww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NV3Vj8lI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020a056402350e00b00437890d0348si12802232edd.624.2022.06.28.21.48.00; Tue, 28 Jun 2022 21:48:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NV3Vj8lI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230416AbiF2EpC (ORCPT + 99 others); Wed, 29 Jun 2022 00:45:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbiF2EpA (ORCPT ); Wed, 29 Jun 2022 00:45:00 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 546E72E9EF for ; Tue, 28 Jun 2022 21:44:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656477898; x=1688013898; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=hxgyYSnI+FwWqBuZmldweQbjdTdxbrF5eneMMsvYm4Q=; b=NV3Vj8lI15qxY8a9QXYA7BTLuX8YDrmtrNXZwcg2XUqp1RYwJyu+Lnv9 TO0RI5/ow/cFX+LYhR+g+xmFQXom9XfOSm38tfdQmafzProNFwb2JX6dd b7P25m8LzwEyyB8RYLEekdCpdkoiRVTuiI/gBHdo8LaZ+QVuP4RfIANVC xc3mhi45tzpVmp+0dAQNT/kjjOeH8WDUWa85WWpyvRFd0W+5lDE3bGR1+ 97o+Wt5Ncj3l5I3PbPJnwlDUgXPEZZsamcIh0Y/Ku+5qhQF7vaXWG7ZIf wffmsDm3e4F9frCdm5vlIvteY6Zy/oUV4vgGT5n+A5pRLDEo6JKQZx02Z w==; X-IronPort-AV: E=McAfee;i="6400,9594,10392"; a="345914508" X-IronPort-AV: E=Sophos;i="5.92,230,1650956400"; d="scan'208";a="345914508" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2022 21:44:57 -0700 X-IronPort-AV: E=Sophos;i="5.92,230,1650956400"; d="scan'208";a="647215003" Received: from xuepengx-mobl1.ccr.corp.intel.com (HELO [10.255.29.216]) ([10.255.29.216]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2022 21:44:53 -0700 Message-ID: Date: Wed, 29 Jun 2022 12:44:51 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cc: baolu.lu@linux.intel.com, Eric Auger , "Liu, Yi L" , "Pan, Jacob jun" , "iommu@lists.linux-foundation.org" , "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" , Jean-Philippe Brucker Subject: Re: [PATCH v9 04/11] iommu: Add sva iommu_domain support Content-Language: en-US To: "Tian, Kevin" , Joerg Roedel , Jason Gunthorpe , Christoph Hellwig , "Raj, Ashok" , Will Deacon , Robin Murphy , Jean-Philippe Brucker , "Jiang, Dave" , Vinod Koul References: <20220621144353.17547-1-baolu.lu@linux.intel.com> <20220621144353.17547-5-baolu.lu@linux.intel.com> <42825be5-e24c-0f95-f49d-5f50d608506d@linux.intel.com> <89130952-155c-38f0-3318-1c071562661f@linux.intel.com> From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/6/29 09:54, Tian, Kevin wrote: >> From: Baolu Lu >> Sent: Tuesday, June 28, 2022 7:34 PM >> >> On 2022/6/28 16:50, Tian, Kevin wrote: >>>> From: Baolu Lu >>>> Sent: Tuesday, June 28, 2022 1:41 PM >>>>>> struct iommu_domain { >>>>>> unsigned type; >>>>>> const struct iommu_domain_ops *ops; >>>>>> unsigned long pgsize_bitmap; /* Bitmap of page sizes in use */ >>>>>> - iommu_fault_handler_t handler; >>>>>> - void *handler_token; >>>>>> struct iommu_domain_geometry geometry; >>>>>> struct iommu_dma_cookie *iova_cookie; >>>>>> + union { >>>>>> + struct { /* IOMMU_DOMAIN_DMA */ >>>>>> + iommu_fault_handler_t handler; >>>>>> + void *handler_token; >>>>>> + }; >>>>> why is it DMA domain specific? What about unmanaged >>>>> domain? Unrecoverable fault can happen on any type >>>>> including SVA. Hence I think above should be domain type >>>>> agnostic. >>>> The report_iommu_fault() should be replaced by the new >>>> iommu_report_device_fault(). Jean has already started this work. >>>> >>>> https://lore.kernel.org/linux-iommu/Yo4Nw9QyllT1RZbd@myrica/ >>>> >>>> Currently this is only for DMA domains, hence Robin suggested to make it >>>> exclude with the SVA domain things. >>>> >>>> https://lore.kernel.org/linux-iommu/f3170016-4d7f-e78e-db48- >>>> 68305f683349@arm.com/ >>> Then it's worthy a comment that those two fields are for >>> some legacy fault reporting stuff and DMA type only. >> >> The iommu_fault and SVA fields are exclusive. The former is used for >> unrecoverable DMA remapping faults, while the latter is only interested >> in the recoverable page faults. >> >> I will update the commit message with above explanation. Does this work >> for you? >> > > Not exactly. Your earlier explanation is about old vs. new API thus > leaving the existing fault handler with current only user is fine. > > but this is not related to unrecoverable vs. recoverable. As I said > unrecoverable could happen on all domain types. Tying it to > DMA-only doesn't make sense and I think in the end the new > iommu_report_device_fault() will need support both. Is it not the > case? You are right. The report_iommu_fault() should be replaced by the new iommu_report_device_fault(). Leave the existing fault handler with the existing users and the newly added SVA members should exclude it. Best regards, baolu