Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1980417rwb; Wed, 26 Jul 2023 23:35:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlG1bLZDDUBMKHGqkfix/XlZWX/gu+47pdiYA8ZTB0bSNMYT50EOcMtaGHKA4fubXWdre/kg X-Received: by 2002:a05:6358:7f04:b0:130:5951:b268 with SMTP id p4-20020a0563587f0400b001305951b268mr1567851rwn.31.1690439738232; Wed, 26 Jul 2023 23:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690439738; cv=none; d=google.com; s=arc-20160816; b=TsICAdz9Dh/DM9kCfTZsFkvN98HWGjTCwDYa2pIpQbVyPeB5rG+sGxchO0xkg6i/OE jrCNHnDt4tUEnuPBmm+O513+ptFE2ZGnqjUty72flFsEwED7jNPeoh2EfFaUTppjMWSZ tl0/elUywuTLkPYoanePpNEJUAOSI9DOky54pR4OixS7KPb9Zue8cvVAGebXXt/jApYd afbqvybRfW72tSGhjXa1T8xlshdOL9+ng48Yy7NIvxEIUbSE08V/0Afq0ZFfFnCKNgqM Y3cuDhV9ok9pWeUnExmLCxxzuhvC9wJj/eDnT5KLIJ7H/o5J5/PO3lk7a6xy2xaB7B+U iXZA== 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:date:subject:cc:to:from :dkim-signature; bh=fflEfDPPGzsyTs51GncrNOxwkhbuUkPL2jJ0DCA5e5E=; fh=5v0QJkujOnxKSzhmeWiMX/0q9X35NwMz+SRMkKa4moc=; b=Tr6mUDaoCuk3aTAca9OJRF/vANVMglRpOLELHzDytb21GZqRfxB8zj2N/176Bjhvo7 5j7IIPPycakX1+iWZzGH9b27poRuFHkc7rW7voa2VkhA9r05KQzACCnySmepAHiia49X Tc2YI/Ul+ZMPpmEv3N0KmcnCkVoK5KU4rLAndgjZZczdvAvnSORymIMxRzDTZ/y9ZXSP zOjX4PsaC9BsZIZ2E+SS14weWkf/rPooHmeRoUosyxnKj4ct3m9nt1ON7F+PBlITh55/ 3m85xiweWPOPcLz68C2nYISNF0rtTx6yz9di2AAodQyiBQaV3AlgjFNVz8AoS2K6wQzk +IIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P9bu8PRc; 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 z16-20020a634c10000000b0055c7da0216dsi707758pga.635.2023.07.26.23.35.25; Wed, 26 Jul 2023 23:35:38 -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=P9bu8PRc; 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 S232664AbjG0FwE (ORCPT + 99 others); Thu, 27 Jul 2023 01:52:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232569AbjG0Fvu (ORCPT ); Thu, 27 Jul 2023 01:51:50 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0C2F30E8; Wed, 26 Jul 2023 22:51:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690437085; x=1721973085; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xPrIhMzrO/1WIuBZJMjoXCye3jUvuQy6Gz0x3Y15rzk=; b=P9bu8PRcSVMkEQMi65Es9Wn20sI6iLOGBEtJx03dha2DFbQ60MH13oGx KdazJ9T0KGZIG7raxdNt1VyA3W+GBAXYjiRBI23Dz5A4e4rlct6PG5J7T m8WvspjQCdQscR0TQR/kRkWiAfU7fFDYMyJB3ZwVa7FNu84NWo+lTNz4s /PindQKQt9O9xSE0pr3HxM861a+oadBcx95X9i+fGkTdVHfkVDab6Lvh2 tlJbFBNGzTLkdhHbYqiL3il9s6wj4jpXJcny40wfe1UHnRIE+GJtr8KX1 T3iJoAag0X3Vr5Ivsk279tA2qhSOSN8FDxdo+HjtgCi4rh1bpVjhDZzDu Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="399152516" X-IronPort-AV: E=Sophos;i="6.01,234,1684825200"; d="scan'208";a="399152516" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2023 22:51:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="840585282" X-IronPort-AV: E=Sophos;i="6.01,234,1684825200"; d="scan'208";a="840585282" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmsmga002.fm.intel.com with ESMTP; 26 Jul 2023 22:50:59 -0700 From: Lu Baolu To: Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen Cc: Yi Liu , Jacob Pan , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v2 04/12] iommu: Replace device fault handler with iommu_queue_iopf() Date: Thu, 27 Jul 2023 13:48:29 +0800 Message-Id: <20230727054837.147050-5-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230727054837.147050-1-baolu.lu@linux.intel.com> References: <20230727054837.147050-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 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); if (ret && evt_pending) { mutex_lock(&fparam->lock); list_del(&evt_pending->list); -- 2.34.1