Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3332843rwb; Tue, 16 Aug 2022 00:29:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR5KCgF8T8J89MtlHKEuhXmBxMYPqdyU7Glt2e8jHE/oz4W9dmK9TPFTccGeFAMtj4T7wp1/ X-Received: by 2002:aa7:c983:0:b0:43d:3879:216b with SMTP id c3-20020aa7c983000000b0043d3879216bmr17573093edt.131.1660634970142; Tue, 16 Aug 2022 00:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660634970; cv=none; d=google.com; s=arc-20160816; b=pfQWq4QGWY/B5wKzNQAYWymVqmS7U1HP2VtOnzLOzo0kzqoVrK5zMpCYOGQLc40U8N 5bCoLWZC2KdPPNYh6+vIwq+gRFq+keLQ0jJIeNjJrLMX8obBq/cIW17acnDweLn0fd0P aW5Hl5niDvp3WDZ4FnUKqFFQVD7hQY8PM0dloCYdy19exgeukXnkefNKrE3zVM8dvEB5 7v+eX7TkDHd0XqaW7EV1T9XIqQEyWYPzbKpVWvUmkJuz+Z21wv5wWUUoQ9Nl2G39P21M Tep4BsprHiJpZhJTDjXcN/Vq7w4jAoq8K99NtoqWkwtkFCxR5tIn8Aup11D4kJZjuCL0 vSjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=XvjQNCx/5HT/6Hi1jhlbv8sIK9n9q3DdfDW27g70aAE=; b=o8H9ToNfrp7ZQ8KKMo07nud8oSn+QCZChS+Mg/aO3P7wX1+n4rDN4gA3pzW7wLGLVF gMQuPXJ98RQCBbvJ3GenIlvwN+Yj4sDCu2TULrIdZP2olL7K62wchkWAijdSQYiCgGGs MHYhQJ3bgyAoBOk0c2vrmbl1c9GMBxeKG/fgLiyPJKw/5126+DRH480TZHAg4S2p8u3D zn28NNNqrM/724nn2afOlX/0SMSP0/yEI+6GMw8aSjotjStmCqJwkPEbwhY4wIC0R2y/ uaijOfYsidFiIvbqt2JFQRUgpe1PXcpE1M1gx6gnjDbwbOj3t74BBX2nmTcpBNPaxqky kHdw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg38-20020a170907972600b00730aaef8b3dsi9973394ejc.807.2022.08.16.00.29.03; Tue, 16 Aug 2022 00:29:30 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231279AbiHPGyu (ORCPT + 99 others); Tue, 16 Aug 2022 02:54:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230382AbiHPGyS (ORCPT ); Tue, 16 Aug 2022 02:54:18 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F367882D20 for ; Mon, 15 Aug 2022 19:09:45 -0700 (PDT) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4M6F0P6wV1zmVlt; Tue, 16 Aug 2022 10:07:33 +0800 (CST) Received: from huawei.com (10.175.112.208) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 16 Aug 2022 10:09:43 +0800 From: Yuan Can To: , , , CC: , Subject: [PATCH -next] iommu: return early when devices in a group require different domain type Date: Tue, 16 Aug 2022 02:07:01 +0000 Message-ID: <20220816020701.90533-1-yuancan@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,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 When alloc default domain for an iommu_group in probe_alloc_default_domain, the expected domain type of each device in the iommu_group is checked in a loop, if two devices require different types, the loop can be breaked since the default domain will be set to iommu_def_domain_type. Return 1 when this happened to break the loop in __iommu_group_for_each_dev. Signed-off-by: Yuan Can --- drivers/iommu/iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 74bc9111c7be..0d4d78946d31 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1653,6 +1653,7 @@ static int probe_get_default_domain_type(struct device *dev, void *data) dev_name(gtype->dev), iommu_domain_type_str(gtype->type)); gtype->type = 0; + return 1; /* end the outer loop */ } if (!gtype->dev) { -- 2.17.1