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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 DEF6FC48260 for ; Tue, 13 Feb 2024 15:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wc8WQbeLiKwMBZS/p4egA0Lciavttks3iSDhSBk14PM=; b=uwTV5qGIVYphq4 jqN5a63SPzxWeHa8pRcWMGMJusBEXpWY5QgP8NlzjCTW3tpxAONmqHu4UeWq1yC2XV3RH67eiyVi3 7f5RnmLnv+v+8XuZns+gr3fi0yd2MUihiwHJTm/ZnNeHPFyNiagsMkCjdYvT7jzqc/2vtacM777l6 crl+RoVAH73dvWOIlyUZ7GWXGNGpYqF3YeWXaE2FocDfn110LUpDLzLkLF9+4tNyBIgJj6jac4w0O ZR7r1WUBllVJkbMGrRo4abn7yXDjBzvKJVasgDvTKgn+Yrd+lpNKGo4PpjVIzo4Inqbzw7OR8m5u3 29nTc7/LiWpwo9CessFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZur4-00000009mUr-0E3o; Tue, 13 Feb 2024 15:37:54 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZur0-00000009mSh-204I for linux-arm-kernel@lists.infradead.org; Tue, 13 Feb 2024 15:37:52 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-410c9f17c9eso57625e9.0 for ; Tue, 13 Feb 2024 07:37:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707838668; x=1708443468; darn=lists.infradead.org; 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=Zwr6PKiZpNhLTE2guxAZqjlW96JM5kQoMb1X0WZ59CU=; b=QFCYmJks+j86NeyQ0gbLKF3lvZGrCkIyXkSMbCI1Epgwk4qA1znrB2I8lGXsfuqdcZ F+itY421kYAsXXCaJKrX/mrcHqdksPgkzbXnAd7Q+JuNBJ6vy693tj5Ak7EC/zX06gmO RKTzyRcaeqXabkvxKCCxmo4mRjCyxtnFOOWPtXFDS5wWMjOQzEe+IRmW7QnDZAt+vghf n91IwTTSSBSOTIFHOKUtYH0/SOo582ak7+vucbM0hkn4tuOFveB4ujjl4egc9Mk8kcYx q66+OGxn3f3k/XV1J3M+uO8Hux1UYQrDOtauSqA9QVl3oGaA/kl0kg9D/dEP486cdtYX b7Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707838668; x=1708443468; 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=Zwr6PKiZpNhLTE2guxAZqjlW96JM5kQoMb1X0WZ59CU=; b=wWwakfSxuIn8l+qyg5pQ6Fa+xM+SxANLFdNx7GTNYoeQex53LCIfsmHlEknamOWV9g z1py6RkXOgpIR6rjPvaqBnOdYSXbGrXCGE5jnC/wNBUerhraacf85TPUIwCRp57bredT ICDGDwkflkLwFHTrSngfVTHssGRdw7UYZPsb7vnIB6eEbNwYdKupsCYuVvftOljppsch g0LnpYSjh1bou5W8dySy/LZ9lMu2YYkjSWP5M9UxBVJBxnsD3CxcVyM+tyuJtwcojufj xACFDu5COvVow3rjsTcUuly7h05tTjz1cf/0ckFTUJ1xf3W6zee98XKpbgJe4xbPy3Os lPhQ== X-Forwarded-Encrypted: i=1; AJvYcCX2qraf9pgPuju0VHBjLM/0EjFNDY7YNAKWcQP4IlWcRfk1b5j7HOiQHXwuvxVKyD8/myOVMwKORKilUSXnyBYlwicDqoeG2RGWiFsD9Gp2oSc4YWY= X-Gm-Message-State: AOJu0Yz7q/sFmHHjgBlwflEHD6Rnl+HuVW6LRYv/ka07dVNVWTMZb2su yUI4Teq2c4lrYJt9Wv4hr8TqQDyPZHNYw1t7NdyAzaKC9y9Xn7Sf1yRU4sIuMw== X-Google-Smtp-Source: AGHT+IHtsU5AWhMPPiPV60/mKu/c1RVNIy8lz4Y19Wq//wfQ65ZRTok6AKBtoFN6I/zlMgz+M2mYcA== X-Received: by 2002:a05:600c:3d05:b0:411:c03e:217c with SMTP id bh5-20020a05600c3d0500b00411c03e217cmr110189wmb.1.1707838668442; Tue, 13 Feb 2024 07:37:48 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUIEKZahnjEoFxPo2yqL67J4jEmvZOYyvfU1gzL2Qd6fxYKmkx18l93i5SVRdDWQtc77GT2wSjtCQy6+yaXxocP7dukAEaRZY+C0D6rODQ3rCYDK8RzPdpU4k6ehXzd5Xe6ETfiej+pZOeRIA28aWQ7dRaGPAWc7QorbQ2CbbsxPv4dTpjIvLoGyGMqz3EEOaUxoo9fRAoQEwmfBBDbBwgf7lSgpczfVE+vB92+9EmskxbgA5HroFh0v7Zf+QLdRVgpkxB3ilfOWmsA8CgBVLb4sWxAdZmJTLqKGl985Wrhh3xWkSTXX08Z0zQC9z/vyAgaaTCt/oRvgnb/CTj8ktqrFusTceqzLEfc1g+rxNBDnMYyrt2edxWIr9UKtzSVtitEoLAfWyf9fDKOqIP9twNiB8nowYIqS31uGUhaVF0JymIrrbEZEyxAUKQPiPBJxhJL9ZI6PSHBDwTzrgBXaYV66kbDdOuXHW77BM8xYiifwTiCS7YeRQ== Received: from google.com (185.83.140.34.bc.googleusercontent.com. [34.140.83.185]) by smtp.gmail.com with ESMTPSA id n40-20020a05600c3ba800b00411c724fa10sm1694378wms.2.2024.02.13.07.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 07:37:47 -0800 (PST) Date: Tue, 13 Feb 2024 15:37:43 +0000 From: Mostafa Saleh To: Jason Gunthorpe Cc: iommu@lists.linux.dev, Joerg Roedel , linux-arm-kernel@lists.infradead.org, Robin Murphy , Will Deacon , Lu Baolu , Jean-Philippe Brucker , Joerg Roedel , Moritz Fischer , Moritz Fischer , Michael Shavit , Nicolin Chen , patches@lists.linux.dev, Shameer Kolothum , Zhangfei Gao Subject: Re: [PATCH v5 03/17] iommu/arm-smmu-v3: Move arm_smmu_rmr_install_bypass_ste() Message-ID: References: <0-v5-cd1be8dd9c71+3fa-smmuv3_newapi_p1_jgg@nvidia.com> <3-v5-cd1be8dd9c71+3fa-smmuv3_newapi_p1_jgg@nvidia.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <3-v5-cd1be8dd9c71+3fa-smmuv3_newapi_p1_jgg@nvidia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240213_073750_560233_1967180C X-CRM114-Status: GOOD ( 23.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Jason, On Tue, Feb 06, 2024 at 11:12:40AM -0400, Jason Gunthorpe wrote: > Logically arm_smmu_init_strtab() is the function that allocates and > populates the stream table with the initial value of the STEs. After this > function returns the stream table should be fully ready. > > arm_smmu_rmr_install_bypass_ste() adjusts the initial stream table to force > any SIDs that the FW says have IOMMU_RESV_DIRECT to use bypass. This > ensures there is no disruption to the identity mapping during boot. > > Put arm_smmu_rmr_install_bypass_ste() into arm_smmu_init_strtab(), it > already executes immediately after arm_smmu_init_strtab(). > > No functional change intended. I think arm_smmu_init_strtab is quite low level to abstract FW configuration in it. For example in KVM[1] we'd re-use a big part of this driver and rely on similar low-level functions. But no strong opinion. [1] https://lore.kernel.org/kvmarm/20230201125328.2186498-1-jean-philippe@linaro.org/ Thanks, Mostafa > Tested-by: Shameer Kolothum > Tested-by: Nicolin Chen > Tested-by: Moritz Fischer > Signed-off-by: Jason Gunthorpe > --- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > index 6123e5ad95822c..2ab36dcf7c61f5 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > @@ -101,6 +101,8 @@ static struct arm_smmu_option_prop arm_smmu_options[] = { > { 0, NULL}, > }; > > +static void arm_smmu_rmr_install_bypass_ste(struct arm_smmu_device *smmu); > + > static void parse_driver_options(struct arm_smmu_device *smmu) > { > int i = 0; > @@ -3256,6 +3258,7 @@ static int arm_smmu_init_strtab_linear(struct arm_smmu_device *smmu) > cfg->strtab_base_cfg = reg; > > arm_smmu_init_bypass_stes(strtab, cfg->num_l1_ents); > + > return 0; > } > > @@ -3279,6 +3282,8 @@ static int arm_smmu_init_strtab(struct arm_smmu_device *smmu) > > ida_init(&smmu->vmid_map); > > + /* Check for RMRs and install bypass STEs if any */ > + arm_smmu_rmr_install_bypass_ste(smmu); > return 0; > } > > @@ -4073,9 +4078,6 @@ static int arm_smmu_device_probe(struct platform_device *pdev) > /* Record our private device structure */ > platform_set_drvdata(pdev, smmu); > > - /* Check for RMRs and install bypass STEs if any */ > - arm_smmu_rmr_install_bypass_ste(smmu); > - > /* Reset the device */ > ret = arm_smmu_device_reset(smmu, bypass); > if (ret) > -- > 2.43.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel