Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp723510rdg; Thu, 10 Aug 2023 18:38:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkUPxSggneqiSh49pxDXvWhklKSQ7feOnMSE/9mqNdC1ja4jPEcAiFslfPiEEAEnCatmn5 X-Received: by 2002:a05:6a00:1954:b0:687:e02b:e3c with SMTP id s20-20020a056a00195400b00687e02b0e3cmr585927pfk.17.1691717933955; Thu, 10 Aug 2023 18:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691717933; cv=none; d=google.com; s=arc-20160816; b=E0wUbZgpA92Yhw5YvriqH4JoJTDnQvcrrQ86tw65RWJCB9oP8eJzQ4A0Vtx0ApVRBy 2ABQS7tHz1Nt372yBs4BPE0Efi00kp9fSQ04vRy9J6ipIwDiVn/k/KlNVG3x00LR2hN5 8lirRUPN49tnt/eog1h0E+EP3M35OfNTV/M/uR2fqCS2bHum5sCLFFsc+vGpnkH6S9Q1 Lvt/fgji4mCdicb9E1jHEx12r96HejtxVjE1DpGLTC5hxlANaIOQX4vj3+z9cNGdqTkQ N6UN1Y9+8hiH0RizdaM7FfJZWYdVlUmKltgYnM/3Chqe/DeDtfPHGwA3dhrKawZYZPYM jasw== 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=JJoiiN3oA7ze6gE44MZmirllYhP86z+ptnksfnAkKwM=; fh=r+VlOdz9yHieXWJnz0Rf9gwDu6JsUzRZtfjjcVRKdpQ=; b=THFKsBksJzugPNX39J3pTXZLHWVxEOrqnTW+T+1JQLInlCnCQCM3XvgbskuQp8c4XL jqHG5yJYrqn46Vay2aj3XW1IyoUZm9tonq9/egxw0iBfD1lPNLDBRenIONdkANPw1edp 83lIpUu9xgfr3QpkArHlH32IKaXDPhHlFeMOvESjJHfjS68j8u2/wREJ4fqgHWfLWZwH 5LeWynEjVut1i5qTn6vM76S5uOqHdS1VD4MlBbDHKR77/S0e8RJSwAJrTNpiTpCYk++B +HaXvA9ZdHWnWsV2dXgIR6JZKSZLMIN+PvjGxWyEr/vRMcADvz+qJmVCpoqAaaRbu/kv FfSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ggDRqHUa; 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 f20-20020a056a00229400b0068269b1ebcbsi2551637pfe.394.2023.08.10.18.38.42; Thu, 10 Aug 2023 18:38:53 -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=ggDRqHUa; 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 S232009AbjHKBZa (ORCPT + 99 others); Thu, 10 Aug 2023 21:25:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjHKBZ3 (ORCPT ); Thu, 10 Aug 2023 21:25:29 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6611E2D47; Thu, 10 Aug 2023 18:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691717129; x=1723253129; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=D5xLR5lmykDRMllq56ksssP5MhV1WjAoaSUCU/qhycs=; b=ggDRqHUalvjjGWSY5DqwrfXa742+fGH/t69gT4Qyf++P3uWy6XCybyei ipry+FgUG/Ax6Q6i/UUkBJLNn0WgkdME7HnF4SyuxCOzRnnWhvrDOfJlV yJi50epB+ND0RtIu98dmbdALB1gGB6ARvKrSs2/Lqvf5IGJK6lFcrcsWY Xv5/2F0Yy9WLx+uvSndM6a1wxn895tglWi7WPXXzcfq4zJqGATi2yZbXj sgQ/IkIzT2pj+EDg3T2G3rizlWrNI8TIxo8a79nhHYQPPGOc57M5yCtY0 l30ZFnL5QE+D7LAXplBKslikQCWOF/JmGDoujITbEQeEnf9poveglTH3j w==; X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="375279067" X-IronPort-AV: E=Sophos;i="6.01,164,1684825200"; d="scan'208";a="375279067" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2023 18:25:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="822483323" X-IronPort-AV: E=Sophos;i="6.01,164,1684825200"; d="scan'208";a="822483323" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.254.214.70]) ([10.254.214.70]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2023 18:25:25 -0700 Message-ID: <1066c330-616a-cd16-3b30-61624e2cd69c@linux.intel.com> Date: Fri, 11 Aug 2023 09:25:23 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Cc: baolu.lu@linux.intel.com, Joerg Roedel , Will Deacon , Robin Murphy , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen , Yi Liu , Jacob Pan , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 04/12] iommu: Replace device fault handler with iommu_queue_iopf() Content-Language: en-US To: Jason Gunthorpe References: <20230727054837.147050-1-baolu.lu@linux.intel.com> <20230727054837.147050-5-baolu.lu@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=-6.5 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,URIBL_BLOCKED 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 2023/8/11 2:33, Jason Gunthorpe wrote: > On Thu, Jul 27, 2023 at 01:48:29PM +0800, Lu Baolu wrote: >> The individual iommu drivers report iommu faults by calling >> iommu_report_device_fault(), where a pre-registered device fault handler >> is called to route the fault to another fault handler installed on the >> corresponding iommu domain. >> >> The pre-registered device fault handler is static and won't be dynamic >> as the fault handler is eventually per iommu domain. Replace calling >> device fault handler with iommu_queue_iopf(). >> >> Signed-off-by: Lu Baolu >> --- >> drivers/iommu/iommu.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c >> index 4352a149a935..00309f66153b 100644 >> --- a/drivers/iommu/iommu.c >> +++ b/drivers/iommu/iommu.c >> @@ -1381,7 +1381,7 @@ int iommu_report_device_fault(struct device *dev, struct iommu_fault_event *evt) >> mutex_unlock(&fparam->lock); >> } >> >> - ret = fparam->handler(&evt->fault, fparam->data); >> + ret = iommu_queue_iopf(&evt->fault, dev); > Also fix the function signature at this point: > > int iommu_queue_iopf(struct iommu_fault *fault, void *cookie) > > It should not be 'void *cookie' anymore, it is just 'struct device *dev' I have included this change in the subsequent cleanup patch. Best regards, baolu