From patchwork Thu Jul 27 05:48:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 126684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp895973vqo; Wed, 26 Jul 2023 23:41:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlGAQ+zGrQc+U1kQK9Hi+cmGgz3T2VYqK+1jK9TaIjXSGQQLDD2liGwX4HUcgihn1j7xH8Ze X-Received: by 2002:a05:6402:430f:b0:521:82d2:fa81 with SMTP id m15-20020a056402430f00b0052182d2fa81mr1632666edc.4.1690440099840; Wed, 26 Jul 2023 23:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690440099; cv=none; d=google.com; s=arc-20160816; b=y4FdU3kgNCiv8trYeUbS1Se3xbDPlVi1B5UuU2dkSVw0yGMoBKMa+HEDM2C82jFWsn 8ax+/Ojq9x1Ha+MhCI/FM/EtOyOPEK8mNancFRuyqE8SaHZAW+CJoYFBJH9ZtCemmRh1 DtXl75kLnsiZ6QFFgGqbw1YekaXzfzxbEqAyfreEKb5/Rwbvwkdx0ujG7pi8qqCdo2bj I/Sw1JRAAzZ04rYQRxOBeaYlH4S5i04+AuI4rOqmo/bcWDEg1zSxGWBgdEdqsN2hN7k6 4lJH5ICFwurVMuOtSqhQbuVMeluoMlLv1QXBkbKgftdMxT8ecIW5pMG5blxAc5N/LkZ2 Gm6w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g7-20020aa7d1c7000000b005223abb31ccsi492524edp.354.2023.07.26.23.41.16; Wed, 26 Jul 2023 23:41:39 -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 S232591AbjG0FwE (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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772554918066768389 X-GMAIL-MSGID: 1772554918066768389 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 Reviewed-by: Kevin Tian --- 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);