Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4295119rwb; Tue, 16 Aug 2022 19:10:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR7xLtIR9ou9HBUwJuvLDawvUS/R9mKJahbc1Kwcru93KhoO0moj7JfV0XzM6eaQA2d/ef1a X-Received: by 2002:a17:906:9bd5:b0:730:a07d:9534 with SMTP id de21-20020a1709069bd500b00730a07d9534mr15162947ejc.747.1660702257902; Tue, 16 Aug 2022 19:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660702257; cv=none; d=google.com; s=arc-20160816; b=BOZ2CJ7N15tBCLpXh603zH7PUV8t49lbuPCtr32rvrhgnFFC+MIhV2lp7ZVKJfScKZ ntaZaAeHQ5O716Kq6vLsvfkU2zFOzhSN2Kr3WaRmrrm94l+7AcwvNkHS6gtzA+lxyBOE V9LLvRIyOMpcoCFw+V8K9u0m1kntCf5AYzPdsr9FCZoohghLPgvijc9xlVQzF0VmP5uE aTRIcFCDLxea38zNoubYeDRoJXQAZfbEJbJtdqeBuPPMsfpdLfAXW+xZQbn0XApFl1VT Evio+oGlfWYtT5kigE38qBLuFH182KvWjrzBszY/QJMD31y6cZBn7R4AzFfpNsoP0yhF SMXw== 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:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=0Rdx0Ol+9GeqrQi+/D6MJ+JOtoR/KI6mK42V27tInBs=; b=SptkVP70OhBhW95G9J/WWry1qCnD4tQMcAqIpaB/GCNWEDEi5symazhe667OK5T9P/ r0MuvACVU/U5/HB/VYDW2fc/xoRTa2glaTDzeI+BnPmsDVP1AR3+l6lPpktsXJs+wKY9 LPNVSeSjCOPGoB6Ky2Dmb05aYGrJWD9qe7djb7LNAD7c59fUhnTJRvuKmSvDSIcqzOKG 5akqwfZ9kVkHe8S8lc+8qvJHzaGYdKUJ3njghtj5GGrO7WmOt325+5XlPVLq3DUJk/UV Xp/fhuu0s4iq+chbJsX0hO1VXQgKjlXoBp/QpSaw3pXHLsuGFR0JHG4ioW+G+fFAOBgR 37Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ezuxv2Ce; 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 hs20-20020a1709073e9400b0073305fd2278si12013509ejc.864.2022.08.16.19.10.32; Tue, 16 Aug 2022 19:10:57 -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=ezuxv2Ce; 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 S237896AbiHQCGU (ORCPT + 99 others); Tue, 16 Aug 2022 22:06:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235578AbiHQCGT (ORCPT ); Tue, 16 Aug 2022 22:06:19 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F31F598D00 for ; Tue, 16 Aug 2022 19:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660701978; x=1692237978; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=eAXvkVBxq2Yz0rp1C3vUTZ4WeY9kQ3s6M3PSgH+MdjU=; b=ezuxv2Ce8Cq1eZD4z+WY7fbdh796in8AHDXVJ4vlFb5LCElKrgWvhi28 slJowS9noQxQB0BMBs9hSL201JGnQtXbNcEPENtwHw1PN7NzIgOJxKb3n G78q1zw+4WPsWctjWyYZAUonpZuwmQMcHnqu7FXnsj1Vjer6ALKP8nEyx ZazlPE++XCTwPClaUymV5DqCQ5AgEtwG1E1XJ2mlMph6TsRHDsHY2BBNB /rdwJB11keZeE2MklWKjQI+7BNs88j9rG4hRJKkW0YU25JLV3SMM17rwq KKCVpBDS33TSVSA59+DjpC2cJYfcMRj5NYirPdwp4RYCaPcfJgdI8no0h w==; X-IronPort-AV: E=McAfee;i="6400,9594,10441"; a="291131628" X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="291131628" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2022 19:06:18 -0700 X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="583563293" Received: from xinpei-mobl1.ccr.corp.intel.com (HELO [10.255.29.150]) ([10.255.29.150]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2022 19:06:14 -0700 Message-ID: Date: Wed, 17 Aug 2022 10:06:10 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH -next] iommu: return early when devices in a group require different domain type To: Yuan Can , joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, iommu@lists.linux.dev Cc: linux-kernel@vger.kernel.org References: <20220816020701.90533-1-yuancan@huawei.com> From: Ethan Zhao In-Reply-To: <20220816020701.90533-1-yuancan@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed 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,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,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 Yuan, 在 2022/8/16 10:07, Yuan Can 写道: > 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 s/breaked/broken > 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) { Thanks, Ethan -- "firm, enduring, strong, and long-lived"