Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2770257lqo; Tue, 14 May 2024 08:37:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWV98NpVDu62nIJ3dfC6cSHlVU7VwTtnlD9aguEYuY6lKNQVKMoic/r2IHO65GCUSU9R2M90QjW7q3bzimOkm/uWIkslNQxNqldE6EPSA== X-Google-Smtp-Source: AGHT+IFnl/3Q1/sbCEUddhxldZNYjCsVam/chzPrABgMpB4qZZyzspDs6L6d9qb4TtWzWMyZTejG X-Received: by 2002:a05:6a00:391a:b0:6ed:21b2:cb17 with SMTP id d2e1a72fcca58-6f4e0299d1amr12863586b3a.4.1715701073866; Tue, 14 May 2024 08:37:53 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-63412c36adfsi12375426a12.755.2024.05.14.08.37.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 08:37:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178867-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=DSFdo3Xc; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-178867-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178867-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D6B95282C99 for ; Tue, 14 May 2024 15:37:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB1B017EBAA; Tue, 14 May 2024 15:37:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="DSFdo3Xc" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2074.outbound.protection.outlook.com [40.107.236.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BD9C1E480; Tue, 14 May 2024 15:37:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.74 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715701067; cv=fail; b=sMrJpe16VPNiKEtj5Y9g0ANnGft5ltrSjYFRil52PS+Jfmk3AGKZnx+pEgqtTnb3XcCNgsXRNfydIEtU/xSiCbSEA0Qgmo+NRPHBp5+8Vc0iF2R7V0rBwGe03ag7NkJ9yZIQ8JH83i2rJHmu6S2zKw3GqixhN6WUrLkUSvT1ar4= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715701067; c=relaxed/simple; bh=9coMyyd/ncOnHaW6eIlO+TAngp7Sn4HHCp/LkkKYw3U=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=Bzb4jJzUnwQM4gyBVCQQgaQxOj7csrTKVm1dZP/wSOCtqtcIZcbNxwUMcSrA1erMbHdtWjhwNG8bDMxpWv0zLwEI+MjBN4IdiGKeEFCnmYURI10Uf82RvgqgMLj9tHaMUfh0q4fWf+st/J1MHnV/dvmTEzd9usCATdVEuyXIm4s= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=DSFdo3Xc; arc=fail smtp.client-ip=40.107.236.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=faZ6HH19NYHrTZPjTUrUya2jt2BC6zIibpYvLfFudGqkVueZFhercSZC/zaCBbvSgfUBkcSLBVrhXHuruMOKzXAGYrVHGaG31ib7K9gqKiOdhu7WGtdZg8IwRH9AEjhCQ5Ua+z/T0IQJK6RuWGvloSmimmXUEJJ6C8Cd37duKDRtecjLQmL1iSTTeoxJcsVy7+69Q9jcgdm6O/3Krt42k46GDFNQ5mVpNlmUfJAudfQK+BfaEiXaTdFbv6jdqgCkdiDwBkTxYTFebrikYkAf1pH6YrHO/XYuN2oDHW6XCCGWi9+CXTqvKTxFVpFdpQKGShMVQi/6bd010AAbMjuzSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L0iVHqj7fVzUgzQ6zMeJiIvrwrXlGnqPvFjB3O8vIg8=; b=MB7SbByGvHphp83QY5gMa2aaYG96n/z0+QYNSHvov8+THBAbnzmdWJOdhybA1DRnNr2Ixa814NdmA5DqG4ov9yXrQl3gCtYbSfFux5ngx/GEw8dkVogd5SNQIeu/qkSSOB37jvOEruh5/bGh6ig61x51KQA9xEelFoEpTXNj1X5nsCFmhWdQKXrYmiRcus9B6Up5Xuw8MYRnxni1K7p0HvF3wSGF9Yk+Xv81TdFnY2ba/fRvM1fU4CmTzsoq/HB+SnnxigjdlhvV8cAQ9+XmcZ2R1DBq1q2Va/SZJyI3VL1K34ZFay0o/cw34IShYK2zzwSv5XPeBkMgJ/kQes7dtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L0iVHqj7fVzUgzQ6zMeJiIvrwrXlGnqPvFjB3O8vIg8=; b=DSFdo3XccokXuWQKqgK4C761CiK0txyt/NEQjm403Fq32XwOwfZy15vcCYL/9P7Xhpb70Sqp1sroWlanLZin1CtWuL7kRqdLosV59C7DXvqVa0jg0H+NBYbFViWGm2r6EKrBISTVBbu/AWnp5I09N9MYQw/YkfrhsvnJtce4XKr3RFDzTRl4NmH/TBvYsxRUmM7gYWCZYIUYFiC4c6MCbE4HmeFDj+gBGMYNJi2ldtJR46awQXo5cTi48e1O5RY6IxSS7ffPidQTcXTunkVeGi7Cd9FrG/H5OIZtO+T9msLy/4ob1wcYbfP+qybYzal2l9QnGt66iA7UURzShsxjUg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) by SJ1PR12MB6146.namprd12.prod.outlook.com (2603:10b6:a03:45b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Tue, 14 May 2024 15:37:41 +0000 Received: from DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e]) by DM6PR12MB3849.namprd12.prod.outlook.com ([fe80::c296:774b:a5fc:965e%4]) with mapi id 15.20.7544.052; Tue, 14 May 2024 15:37:40 +0000 Date: Tue, 14 May 2024 12:15:13 -0300 From: Jason Gunthorpe To: Nicolin Chen Cc: will@kernel.org, robin.murphy@arm.com, joro@8bytes.org, thierry.reding@gmail.com, vdumpa@nvidia.com, jonathanh@nvidia.com, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: Re: [PATCH v7 6/6] iommu/tegra241-cmdqv: Limit CMDs for guest owned VINTF Message-ID: References: <062cf0a1e2b8ec6f068262cc68498b8d72b04bcc.1715147377.git.nicolinc@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: CY5PR15CA0114.namprd15.prod.outlook.com (2603:10b6:930:7::28) To DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB3849:EE_|SJ1PR12MB6146:EE_ X-MS-Office365-Filtering-Correlation-Id: 76ea1742-2a3f-4be6-64bd-08dc742bca4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|376005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?NbC46CtGIYv2CMvjkIPQLQB/t5tv1/OyzevMZfOB/qcjRcfEsnI2Rx3hn85K?= =?us-ascii?Q?Vk3iAOn8E5OiRULQSZdaaT4wCb8PZuoUdW3cEdPrBei+yI+z1TozQZH0X6RQ?= =?us-ascii?Q?Fp6CadoZgFRfCUbCMQVCMa6ydJm1eqrreXad29MjTfGJESC58sUPE+yTlKVB?= =?us-ascii?Q?6zP02NFTL+tGuNm5XOgRgmoKBcKmG4KNlkkx+SyMmGRtNQ6qddIHx63VN9Ia?= =?us-ascii?Q?mqY9EPm3CMR/Wib7WPcd7e/WsXsV6EWTSuhjRvcHLggnCEJX3cHRdFdhnL4x?= =?us-ascii?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fCKgJuCnf0YHXtR3vrpLBZx?= =?us-ascii?Q?8cGhXO9EmAjMmh0K+j7eAMoMMwInWCvUA6w4cUtgQi1IklFVl5vQ9IDG14pU?= =?us-ascii?Q?PWhiTXesS6ZXwQd0WarT5w7tAZtP3gNi6eAHmL/52w=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xeb2R5T6Tc96EDZGTObnJHXucN+AxCLzTYFc9IhezG24O0jGgIrr/2Ip68t0?= =?us-ascii?Q?qtlDmOfLfmBjmiJAVzqr6Piti8A1oQ9jXSi5STzWQL7vD/eUSsDbU7rsmE3J?= =?us-ascii?Q?CoIqJQlaO3QyBuiwK9jRNGgiFZBukOYIzb5sBrecnbGAciraE8n4Fj8qEu2k?= =?us-ascii?Q?6RDPK+7/0fRMz/k8if4vd0oEoBpfeBd02edikvOTPtgv8FOth6EP5DD+vbl4?= =?us-ascii?Q?b500gqhbsnqGKya9PkF6+gUkFqVxwqhbgs/U4kO3XtmpqsvfSEv3u0d/ghON?= =?us-ascii?Q?uRpqqUGT3uVdY7XDbFLYlCphjgq9gO9oOghamfJAuI68Xdjf8V/bV/zpt2zF?= =?us-ascii?Q?TDliu4uEaZ6q2DaJ6Z7ENEYa28So+ae8k42IkAhxtNxRbrDwmIvDBkuOnnSE?= =?us-ascii?Q?f+bKMhg8HFFktH7+wnRfDKw+yQvXRFvwlBUgFCYV/0NkJ5EgtkN7ze5eedRg?= =?us-ascii?Q?RJ1HHSX8VLKeN+iiZTV7Kbu1CpqV3k5bFWxqswLpObT2gjmwtv1YUFuC4sqE?= =?us-ascii?Q?Ct2R9FLvgQ3TAMx+t7oF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ascii?Q?54EGLLkCQAIMcq1wSfud1inZ4gEyIDZu4hHriUKlnDjjB/M70ILrW1YLPIan?= =?us-ascii?Q?08hTg47HZQ+zdI5NIE4YV6S3n1Trls1nmIXb/Prvwkdi9vIPe49n4wMAUsmH?= =?us-ascii?Q?skIDjzRFwtvKhblLCHg=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76ea1742-2a3f-4be6-64bd-08dc742bca4b X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2024 15:37:40.7377 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Fg8Lr/2qbj19b+rtMBewwQVYanTXNap1B46E/aynn7M1EXEb/Q0Nw9F8yVUJuguD X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6146 On Sun, May 12, 2024 at 03:09:25PM -0700, Nicolin Chen wrote: > > > -static struct arm_smmu_cmdq *arm_smmu_get_cmdq(struct arm_smmu_device *smmu) > > > +static struct arm_smmu_cmdq * > > > +arm_smmu_get_cmdq(struct arm_smmu_device *smmu, u8 opcode) > > > { > > > if (arm_smmu_has_tegra241_cmdqv(smmu)) > > > - return tegra241_cmdqv_get_cmdq(smmu); > > > + return tegra241_cmdqv_get_cmdq(smmu, opcode); > > > > It is worth a comment descrbing opcode here, I think.. At least the > > nesting invalidation will send mixed batches. > > Right, this makes the "opcode" look bad, though we know that the > "opcode" in the nesting invalidation doesn't matter because VCMDQ > in that case supports all commands with HYP_OWN=1. Yeah, it isn't a real problem, it just looks a little messy and should have a small comment someplace at least.. > A CMD_SYNC, on the other hand, is outside the batch struct. And > here is another assumption that CMD_SYNC is always supported by a > VCMDQ.. > > I could clarify the "opcode" here with these assumptions. Or maybe > we should think think of a better alternative? I don't think it really needs to be more complex, but we should document that invalidation is going to be special and doesn't quite follow this rule. Jason