Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp18059imn; Thu, 28 Jul 2022 20:29:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR5V+jSj6aZTBMFWRAq9yjvY8QdYBLZ77wwvS/KqlilFnT6xVj8hV7/dV68ER8GU9vG6jq6+ X-Received: by 2002:a17:90b:17c1:b0:1f2:e246:6704 with SMTP id me1-20020a17090b17c100b001f2e2466704mr1897634pjb.224.1659065344455; Thu, 28 Jul 2022 20:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659065344; cv=none; d=google.com; s=arc-20160816; b=hiNAkL8eZg6HZ19LcyT8XW2Qaqvk0ljxvRnglvvjdVPsQl/VwmMGMikUxc12TsNYsH Ggo02nuLJevJzcNe3qzsEn7d7R14lvhfF8RTt750Z+XepdNJolfgvOyEHRJM/MGojZ7e yTYDR0bE0pnnzd/02ULXG11XEzO4rcZg0G3Qlm8D+FqtijUV3oer4llwzf/VTIPAUSpM 6WYyWCOuqH8y4PWXYzaxxqPUDlllLmJwQBPGs+5HFgBvdDAGHgSRi8ZZ2uHdd3UfP//e 43jjDxpXMhA6nMamDk7Fk4xdGvCwv5xYDe6kbsy+Y57/aV2K08qg1KfPLXaJHLSiti7p ANnw== 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:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=vHvUFAIHM2L7VZBRYVXlVwwEuUlfNyiIO/dyYVIFxeI=; b=dznOrEgbSi9w2S0ib2oMNBw2PO6VmT6lM8jD32Um3RRjT7UwePAV6wOrjE0zroEGD6 JaBS6+HknvM8uEbkYgCdy0O80fS4aiBRy9fe+dYebL9HP1/epGoOiGYDjP2vL9RgOu6B 3mcEYShaZM55lKcTZSyfdf+Ln9oEUKu4PP9eLtqh7isl4yC0aSXe2dNotj6YtzKRlzs1 N80FTne5LBWIdhLLhbo3fP4n6qmoDziCHTusO6LkOV0M894wEbkgbdkfBfAHheLgAHiQ 6O1G0siRs7P5C9DZebvh21TGkjnX4bqNVecgNlyTxXflup76VzDiLh/pvBBu+aZUH80/ Bqwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HxoJB8l2; 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 il12-20020a17090b164c00b001f3185e3a9asi5909321pjb.112.2022.07.28.20.28.49; Thu, 28 Jul 2022 20:29:04 -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=HxoJB8l2; 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 S233956AbiG2DVF (ORCPT + 99 others); Thu, 28 Jul 2022 23:21:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232555AbiG2DVB (ORCPT ); Thu, 28 Jul 2022 23:21:01 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC6462B18F for ; Thu, 28 Jul 2022 20:21:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659064860; x=1690600860; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=kJsMSRMn4triv25Il9mhWiVI3dfthWPMlrBpNxMmXo8=; b=HxoJB8l2cZUZxCvw9kxqxj47RIaYTCvnO6hO6hqw0oU9MC4F0hxqPyH9 1ciQVsHkW3inqFJm+NAgOx5omvYDWu4v2i+Md6fFAFTBf3dXS5R2GF/uq PvIe+9UivPRuxE3AWUcSLOeOtQIAS7KH7pn3JjmSqKN/Oce7MjbNLhd9I j1u3TrxmJnbjRXXgvwtD/O/R9wR5K3gq/JwbSLKd/t1mN5gRTb53WcStQ ACEO5szQIIX2gk9jf6AS1vh7ZBWI+AWee+TCVYq9HiUv/H5AUScYyf227 wyyUfyMiQxv9Goa9pkIqPTe42HfdKnui1Lyni62gUPrBVup+TgHBqanQ2 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10422"; a="314476136" X-IronPort-AV: E=Sophos;i="5.93,200,1654585200"; d="scan'208";a="314476136" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2022 20:20:55 -0700 X-IronPort-AV: E=Sophos;i="5.93,200,1654585200"; d="scan'208";a="660057778" Received: from xuzhenzh-mobl.ccr.corp.intel.com (HELO [10.249.174.84]) ([10.249.174.84]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2022 20:20:51 -0700 Message-ID: <64667345-7f7f-74ec-215a-f2d36be0f9ce@linux.intel.com> Date: Fri, 29 Jul 2022 11:20:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cc: baolu.lu@linux.intel.com, Joerg Roedel , Christoph Hellwig , "Raj, Ashok" , Will Deacon , Robin Murphy , Jean-Philippe Brucker , "Jiang, Dave" , Vinod Koul , Eric Auger , "Liu, Yi L" , "Pan, Jacob jun" , Zhangfei Gao , "Zhu, Tony" , "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" , Jean-Philippe Brucker Subject: Re: [PATCH v10 04/12] iommu: Add attach/detach_dev_pasid iommu interface Content-Language: en-US To: "Tian, Kevin" , Jason Gunthorpe References: <20220705050710.2887204-1-baolu.lu@linux.intel.com> <20220705050710.2887204-5-baolu.lu@linux.intel.com> <20220723141118.GD79279@nvidia.com> <686b137f-232a-2a78-beb0-e4373bd20959@linux.intel.com> <20220725144005.GE3747@nvidia.com> <6da27a6b-b580-4ba4-24c8-ebdfb2d9345d@linux.intel.com> <20220726135722.GC4438@nvidia.com> <20220727115339.GM4438@nvidia.com> <78376ca4-9b55-7609-abf1-27a1a376a8e0@linux.intel.com> From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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 On 2022/7/29 10:56, Tian, Kevin wrote: >> +static bool iommu_group_device_pasid_viable(struct iommu_group *group, >> + struct device *dev) >> +{ >> + int count; >> + >> + count = iommu_group_device_count(group); >> + if (count != 1) >> + return false; >> + >> + /* >> + * Block PASID attachment in cases where the PCI fabric is >> + * routing based on address. PCI/ACS disables that. >> + */ >> + if (dev_is_pci(dev)) >> + return pci_acs_path_enabled(to_pci_dev(dev), NULL, >> + REQ_ACS_FLAGS); > I think we are leaning toward doing above check in pci_enable_pasid(). > Then no singleton check inside iommu core. The iommu grouping also considers other things, like PCI alias. There are many calls of pci_add_dma_alias() in drivers/pci/quirks.c. Therefore, I believe that pci_acs_path_enabled() returning true doesn't guarantees a singleton group. > > Presumably similar check can be done in DT/ACPI path of enabling pasid? > I can't find the pasid (or anything similar) enabling interfaces for DT or ACPI. They are device specific? Best regards, baolu