Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4464452rwd; Tue, 23 May 2023 08:04:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ72lORqCtAdO1A0DMUYHYTFIVPcjy/kNKofv046YmnozTY3e8wdldBMtgzwyKtbAJSgTF7M X-Received: by 2002:a05:6a00:850:b0:647:776c:d19c with SMTP id q16-20020a056a00085000b00647776cd19cmr20890118pfk.13.1684854277620; Tue, 23 May 2023 08:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684854277; cv=none; d=google.com; s=arc-20160816; b=k/q9H31/Mw/mDqIEoH0kntMwSF6PGkbHOd6xIWXqIMeTmad8aDAYgDpQttSX36dfrV t+2kjMOJ1NfmYaQR1Wdwb3pXn9VpB5F/hZplbv+WisUReLYrep8UM8K9gCNhUGXJ7NrL 2WLW8uMoYuHLyIBYWG1V9eziSawIJPRVNjCSsNQvSRizn5o6C7Lp8mUOeMHLOIjMp81A UY7GFMukwcQuh07TSsvPB2uXicWfngK605QNZurZdY4HAcqTRc7UjCiHaXZl0Xyl6ksz 4wRnR/SDcKCioDGy8788OOzF+VbIIm7CACp6sLk/PSEU2kg0n3aZrZZndF0UfguhQsKd Es2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zPxJfv8Gp/np80rJQlBAE1bGG9in5p+Ub2ud9nocz6U=; b=peUJAcb9NyuFjTlTUEY7b+o9Vm+2bUc6UxNNw4+RTxcKXbi2OHXPbLDtwsiCnT9mGM A6BgKGRBf2va4eGFaKaRil2TTV3jfFLP8tLiythmSk74IF8KgJ6HKY5J3J0Yv6RvNEJB Zkl1kT8V5k/zD75UbOLcLGWcJcINX9P5jMlpqdUCQIDc5iU1eUBeuPAtQYiMKMXRC/Cz Q28NxkEZTLDajQrL0VLUWYh/Zod9+H9I23Dxiw7MlCunisYx0WzgxBmEHI2BZ5tOXP7Y /IidkNTeEIKVuNK3igxmmmXLbo5+sDxE1doSoDRfMyFY3/thXCDGa6daYpvxhXYPX/5O tS2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WqoXIxmj; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k10-20020aa7972a000000b0063b86ce6813si2924001pfg.41.2023.05.23.08.04.22; Tue, 23 May 2023 08:04:37 -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=@linaro.org header.s=google header.b=WqoXIxmj; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236707AbjEWOrf (ORCPT + 99 others); Tue, 23 May 2023 10:47:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232856AbjEWOre (ORCPT ); Tue, 23 May 2023 10:47:34 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AE47E9 for ; Tue, 23 May 2023 07:47:33 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-30a4ebbda56so3444515f8f.1 for ; Tue, 23 May 2023 07:47:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684853251; x=1687445251; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=zPxJfv8Gp/np80rJQlBAE1bGG9in5p+Ub2ud9nocz6U=; b=WqoXIxmjF4fRAuTza7LWI2l7Be8/QIYJutSNRRaw6QSkA0mZSS80UAZtniMf9EPffx OJ3DQ4IWYyAQdL5dtehn8ytxLkeS218smegrauZjfoDvgLIPqyaA471Ff6rz4yYDo8L0 eihGyFOEA4EXqQwzbTXi1GHtWmaD/2gTaCX3tWaEvNU5utjQSjMCCEtIvD8VlLNV7rXl MvBWX/tUboGmcWG7a2buIakdgPUPd5FnKQXFBgZuDHTyU4/lFGLUcEWI8auxq4+QU1Ty xgJsnP06DonVPnXiEblbtQ9eMi5u1EOqtmVRt7KpKabtmIFukFHkC8e0ct4b3138yvOQ DHiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684853251; x=1687445251; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zPxJfv8Gp/np80rJQlBAE1bGG9in5p+Ub2ud9nocz6U=; b=kOjRigKYMUx12l2C7RwAMOiorLk9H8jIbTHVLSU6JDgUQZ+1EtEpKTM2W3ZbNrV0Ku AF5qhNPKY4y69icBBvMxCxjTTZyS+ePCNcUQrh1T/f/ikND44mZfVwtRF3w5VFfJf6YJ 4fk6hdk/OIPahU5VYKdzCYRhijA76VPJ2kJOOmWaerXec8V01wdJQhHIlbb/buz1BJu3 X8Mlz5WCmclzN9XhXSgUt+siHM+JixnZFkPCbeAJUtkw0fgk8lE7YBk+5ZI9xIULqnYK mWalOtFKAAdSOqadgOXlTmgiqeWW2frcWgdkqoteFvA3FoEGXm6XT1OieBhd0rZY2Wov uZgw== X-Gm-Message-State: AC+VfDyzMbRNsWPkN6JTHtV31T/ZHz7/Vgw5akhB3y/P6jn21SGJnGnI 7uakbhq+yiqKDcOhrdj3IUOAKw== X-Received: by 2002:adf:ee82:0:b0:306:2aa7:2ecc with SMTP id b2-20020adfee82000000b003062aa72eccmr10390763wro.45.1684853251337; Tue, 23 May 2023 07:47:31 -0700 (PDT) Received: from myrica (5750a5b3.skybroadband.com. [87.80.165.179]) by smtp.gmail.com with ESMTPSA id 10-20020a05600c024a00b003f423dfc686sm10151223wmj.45.2023.05.23.07.47.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:47:30 -0700 (PDT) Date: Tue, 23 May 2023 15:47:33 +0100 From: Jean-Philippe Brucker To: Jacob Pan Cc: LKML , iommu@lists.linux.dev, Jason Gunthorpe , Lu Baolu , Joerg Roedel , dmaengine@vger.kernel.org, vkoul@kernel.org, Robin Murphy , Will Deacon , David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , "Yu, Fenghua" , Dave Jiang , Tony Luck , "Zanussi, Tom" , narayan.ranganathan@intel.com Subject: Re: [PATCH v6 1/4] iommu: Generalize default PCIe requester ID PASID Message-ID: <20230523144733.GA4137946@myrica> References: <20230519203223.2777255-1-jacob.jun.pan@linux.intel.com> <20230519203223.2777255-2-jacob.jun.pan@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230519203223.2777255-2-jacob.jun.pan@linux.intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 Hi Jacob, On Fri, May 19, 2023 at 01:32:20PM -0700, Jacob Pan wrote: > PCIe Process address space ID (PASID) is used to tag DMA traffic, it > provides finer grained isolation than requester ID (RID). > > For each RID, 0 is as a special PASID for the legacy DMA (without > PASID), thus RID_PASID. This is universal across all architectures, > therefore warranted to be declared in the common header. > Noting that VT-d could support none-zero RID_PASID, but currently not > used. > > By having a common RID_PASID, we can avoid conflicts between different > use cases in the generic code. e.g. SVA and DMA API with PASIDs. > > Signed-off-by: Jacob Pan > --- > v6: > - let SMMU code use the common RID_PASID macro > --- > .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 2 +- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 ++++---- > drivers/iommu/intel/iommu.c | 24 +++++++++---------- > drivers/iommu/intel/pasid.c | 2 +- > drivers/iommu/intel/pasid.h | 1 - > include/linux/iommu.h | 1 + > 6 files changed, 20 insertions(+), 20 deletions(-) > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c > index a5a63b1c947e..160b31e6239d 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c > @@ -80,7 +80,7 @@ arm_smmu_share_asid(struct mm_struct *mm, u16 asid) > * be some overlap between use of both ASIDs, until we invalidate the > * TLB. > */ > - arm_smmu_write_ctx_desc(smmu_domain, 0, cd); > + arm_smmu_write_ctx_desc(smmu_domain, IOMMU_DEF_RID_PASID, cd); I agree with reserving 0 globally for non-PASID DMA, but could we call this something more generic, like IOMMU_NO_PASID? The term "RID_PASID" is specific to VT-d and "RID" to PCI, so it looks confusing here (this driver also supports non-PCI). "NO_PASID" would be clearer to someone just trying to follow this driver code. Thanks, Jean