From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75B2DC433EF for ; Sat, 2 Jul 2022 02:00:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231686AbiGBCAz (ORCPT ); Fri, 1 Jul 2022 22:00:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231393AbiGBCAt (ORCPT ); Fri, 1 Jul 2022 22:00:49 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE6EF38BEA for ; Fri, 1 Jul 2022 19:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656727248; x=1688263248; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VMlxlWrP1ErjumYvh2kyBvw6utshI62Qz8CCa6LtuXs=; b=P+i+7VnyFWkabLjrJ/g5BJSymURuGcCUB66OsHNbacvMYF6Cyx8pgjv4 ZPunZfzl+ev7sB1nrN9fXNhfiSqSzb3pzVqweSD2vI1WL/30wOlxGx4nw CuuY3IiaIjtn9+o3s2uHs5GvWaL0HhZUQG8HUQ4TKj1541ze5Dtqbn1iq M5N9mRCkAzfUtwk+3yG7AA6Rgg4iPgFfKFTVnzdFAaGix2h3zVlCnWvAp xap4E4crzgG/RQKreMvPtY1lj7HnvKwi2jXDtUk9whsr5Ta8efNXFuB9u Iu6QLil/O2CkwoapL/5lzfWgyhr1TqqVq7RLi+hXpr3bz5lIxbGRUraM8 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10395"; a="262573748" X-IronPort-AV: E=Sophos;i="5.92,238,1650956400"; d="scan'208";a="262573748" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2022 19:00:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,238,1650956400"; d="scan'208";a="589518325" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga007.jf.intel.com with ESMTP; 01 Jul 2022 19:00:45 -0700 From: Lu Baolu To: Joerg Roedel , Steve Wahl , Kevin Tian Cc: David Woodhouse , Jerry Snitselaar , Mike Travis , Dimitri Sivanich , Russ Anderson , iommu@lists.linux.dev, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v2 4/6] iommu/vt-d: Remove unnecessary check in intel_iommu_add() Date: Sat, 2 Jul 2022 09:56:08 +0800 Message-Id: <20220702015610.2849494-5-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220702015610.2849494-1-baolu.lu@linux.intel.com> References: <20220702015610.2849494-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Intel IOMMU hot-add process starts from dmar_device_hotplug(). It uses the global dmar_global_lock to synchronize all the hot-add and hot-remove paths. In the hot-add path, the new IOMMU data structures are allocated firstly by dmar_parse_one_drhd() and then initialized by dmar_hp_add_drhd(). All the IOMMU units are allocated and initialized in the same synchronized path. There is no case where any IOMMU unit is created and then initialized for multiple times. This removes the unnecessary check in intel_iommu_add() which is the last reference place of the global IOMMU array. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 70408c234f5b..d79c48c5fc8c 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -3463,9 +3463,6 @@ static int intel_iommu_add(struct dmar_drhd_unit *dmaru) int sp, ret; struct intel_iommu *iommu = dmaru->iommu; - if (g_iommus[iommu->seq_id]) - return 0; - ret = intel_cap_audit(CAP_AUDIT_HOTPLUG_DMAR, iommu); if (ret) goto out; -- 2.25.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D85B3C433EF for ; Sat, 2 Jul 2022 02:00:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 83C0E60E28; Sat, 2 Jul 2022 02:00:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 83C0E60E28 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=P+i+7Vny X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id stjt0NPV8_rq; Sat, 2 Jul 2022 02:00:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6253A60BAC; Sat, 2 Jul 2022 02:00:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6253A60BAC Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3B331C0035; Sat, 2 Jul 2022 02:00:50 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id A5F18C002D for ; Sat, 2 Jul 2022 02:00:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8F37C418B4 for ; Sat, 2 Jul 2022 02:00:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 8F37C418B4 Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=P+i+7Vny X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E6b2xFgyXqKY for ; Sat, 2 Jul 2022 02:00:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org A60D3418AE Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by smtp4.osuosl.org (Postfix) with ESMTPS id A60D3418AE for ; Sat, 2 Jul 2022 02:00:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656727248; x=1688263248; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VMlxlWrP1ErjumYvh2kyBvw6utshI62Qz8CCa6LtuXs=; b=P+i+7VnyFWkabLjrJ/g5BJSymURuGcCUB66OsHNbacvMYF6Cyx8pgjv4 ZPunZfzl+ev7sB1nrN9fXNhfiSqSzb3pzVqweSD2vI1WL/30wOlxGx4nw CuuY3IiaIjtn9+o3s2uHs5GvWaL0HhZUQG8HUQ4TKj1541ze5Dtqbn1iq M5N9mRCkAzfUtwk+3yG7AA6Rgg4iPgFfKFTVnzdFAaGix2h3zVlCnWvAp xap4E4crzgG/RQKreMvPtY1lj7HnvKwi2jXDtUk9whsr5Ta8efNXFuB9u Iu6QLil/O2CkwoapL/5lzfWgyhr1TqqVq7RLi+hXpr3bz5lIxbGRUraM8 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10395"; a="280338379" X-IronPort-AV: E=Sophos;i="5.92,238,1650956400"; d="scan'208";a="280338379" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2022 19:00:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,238,1650956400"; d="scan'208";a="589518325" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga007.jf.intel.com with ESMTP; 01 Jul 2022 19:00:45 -0700 From: Lu Baolu To: Joerg Roedel , Steve Wahl , Kevin Tian Subject: [PATCH v2 4/6] iommu/vt-d: Remove unnecessary check in intel_iommu_add() Date: Sat, 2 Jul 2022 09:56:08 +0800 Message-Id: <20220702015610.2849494-5-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220702015610.2849494-1-baolu.lu@linux.intel.com> References: <20220702015610.2849494-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Cc: Dimitri Sivanich , Russ Anderson , Mike Travis , Jerry Snitselaar , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, David Woodhouse X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" The Intel IOMMU hot-add process starts from dmar_device_hotplug(). It uses the global dmar_global_lock to synchronize all the hot-add and hot-remove paths. In the hot-add path, the new IOMMU data structures are allocated firstly by dmar_parse_one_drhd() and then initialized by dmar_hp_add_drhd(). All the IOMMU units are allocated and initialized in the same synchronized path. There is no case where any IOMMU unit is created and then initialized for multiple times. This removes the unnecessary check in intel_iommu_add() which is the last reference place of the global IOMMU array. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 70408c234f5b..d79c48c5fc8c 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -3463,9 +3463,6 @@ static int intel_iommu_add(struct dmar_drhd_unit *dmaru) int sp, ret; struct intel_iommu *iommu = dmaru->iommu; - if (g_iommus[iommu->seq_id]) - return 0; - ret = intel_cap_audit(CAP_AUDIT_HOTPLUG_DMAR, iommu); if (ret) goto out; -- 2.25.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu