Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp970587lqp; Thu, 23 May 2024 05:48:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVTb5kFQnkGH44FSo990cBpbdV6lDUaTekN4N+EB7alYEGGmJJzW/68od4Ai3I75w4FGJEyEahLxV72KmlHEe8UWmV6hEKAgfv4k76G/Q== X-Google-Smtp-Source: AGHT+IFh8wWzGTUX1xzGHgBXrg/hlXvXsTEk6uWk2dJ8Jtfr7W983oLug6P6hvMic0TtX5dZB2qL X-Received: by 2002:a17:90a:c907:b0:2bd:edbe:4e1 with SMTP id 98e67ed59e1d1-2bdedbe0512mr1069911a91.31.1716468504683; Thu, 23 May 2024 05:48:24 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bdd9f01223si1580693a91.39.2024.05.23.05.48.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 05:48:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187494-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=guR7t+aw; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-187494-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187494-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 41764B20975 for ; Thu, 23 May 2024 12:48:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C8BD14A4CE; Thu, 23 May 2024 12:48:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="guR7t+aw" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2076.outbound.protection.outlook.com [40.107.94.76]) (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 BEA198174C; Thu, 23 May 2024 12:48:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.76 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716468495; cv=fail; b=GrppuLyBa8EDSeKCDOu2OTe4FjLvF9qzBZDBTDw4pWi+jRVM5LPKHdPv6d3WYvAeEb6kodyIRFWfyatsuK1kKH6LWdsNxW/039eqVNe3JTcSNg7Z8QNboWzV7sPR1WsBpo7gUOcY+SAUoyOsWiBSMtC27WM+wB8OXlFYIgXL2YA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716468495; c=relaxed/simple; bh=XmHbtNq9i/3yc9HgvjQc2umk3Kynl5+nP2Mkx9X4DTk=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=u6LWFK5mSoiVsKz+dVZ4AO4PrSY4hLhKH/zrbUDhBsuVdSx4aSLV34EW6RzowG+Gh5zureU9hHdqWkPsznTcpY+EhPydE/P0HXjihwgvN6qq44iUmHKYfDNx5ycI20l+oLChRXeufU4OVgGG6fc0RAqPekI4BMBRW2Vf4B75wLI= 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=guR7t+aw; arc=fail smtp.client-ip=40.107.94.76 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=SwaxdFst3L72Tyydbczdzl3QiQ9O/3Gbi9f7Vzfoc7vNgrV9eaV3RSQ1kS/FEXuvKgqd2uHQmTJR1bgsh/HLoEG7SzQh+B23AhmzU94atnh/vJ5+2gv5/LvLTrnLH749WS732cLaY33TrG5i1rW78Ewzfdt8ZAk7hats5hk+3Sj4IShWz3bZS8D3VHdhwsh4yF3rTgQ3fNQrVKde1oREdpSJT9G5UwJJhV+LtHM04ct4C+2HPiXKol/vLHOn4lYGvVDuaEn6nnEgJrmZDpGeE7bwfuvoHNuoIDY+54fJvONYWMurqwesj88m3T3etPc7OtmRTst/jwosSk6yYaD5LA== 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=MksDHYz0B/CAQ0GIzrV74cRj56QW0Oy+DoalaBhO1Ok=; b=MfSGpWX+e0jOPgeEKJIcvePEX5k5wQT2UsE3bOyqODpzsIY1wJWqrLtYTMk823o8OE+KFw7hFXbdiq6mFBgdDPTQ3tylUvO/VXaUMOMQ92xwpp+r0jR/cYuac0hSZrS7tCOo3GqKQNW5FgzUUzFabmhWVOhYrfT+pvV9vSNQAcepk5UDwHwwu/vaWiTxAJ+De4GDFNzb4NIBBF3yX5nD8fuz67OvTNcOsadEEoNr/qja2TO2JGaxcGIKmSeV/kZi/lktJsAqZL/slZMihpk9SL1rIZa4J+UxYLzR4itNoxpqaKX1r2n3SPf4w6ZdOcmr+h9hSApJ7y6krKGPwy68EA== 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=MksDHYz0B/CAQ0GIzrV74cRj56QW0Oy+DoalaBhO1Ok=; b=guR7t+aw7M7YkmpOVFi+okJDBko5Dxbw8elhN3x6LCC9ShyjnlS7He6QOHgvBgQJ+XuGXmgB6ZoGRrA3zD+dNRt75tTHmdIf9mI1zymbUg2V7PTWtCE1uc7c3SFsIFa0p/D6v7n5uM0Rc23EAc3AX7FQxdIrldXt9oAtjp7j+2jcnsYX/8s3phgY+xNp9mUmNgC6wACX7z1wTxOeygB8k7ZegxdrDSXN1Ds7HPftleMlzsMHrzhqQ07f3G+fRCQ7p9+Ctt1fs+Bo0PKy2XovQ9fphaIWaiElMXExLyaW7WsZ0ziIQ7H6QADOgumTfjyTiDNwtMKbAkoBSUq53sCPag== 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 SN7PR12MB6910.namprd12.prod.outlook.com (2603:10b6:806:262::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.36; Thu, 23 May 2024 12:48:09 +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.7611.016; Thu, 23 May 2024 12:48:08 +0000 Date: Thu, 23 May 2024 09:48:06 -0300 From: Jason Gunthorpe To: Nicolin Chen Cc: "Tian, Kevin" , "will@kernel.org" , "robin.murphy@arm.com" , "suravee.suthikulpanit@amd.com" , "joro@8bytes.org" , "linux-kernel@vger.kernel.org" , "iommu@lists.linux.dev" , "linux-arm-kernel@lists.infradead.org" , "linux-tegra@vger.kernel.org" , "Liu, Yi L" , "eric.auger@redhat.com" , "vasant.hegde@amd.com" , "jon.grimm@amd.com" , "santosh.shukla@amd.com" , "Dhaval.Giani@amd.com" , "shameerali.kolothum.thodi@huawei.com" Subject: Re: [PATCH RFCv1 00/14] Add Tegra241 (Grace) CMDQV Support (part 2/2) Message-ID: <20240523124806.GK20229@nvidia.com> References: <20240522164818.GB20229@nvidia.com> <20240522232833.GH20229@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: MN2PR01CA0041.prod.exchangelabs.com (2603:10b6:208:23f::10) 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_|SN7PR12MB6910:EE_ X-MS-Office365-Filtering-Correlation-Id: 7871fbe5-3267-48ab-5fa5-08dc7b269904 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|366007|376005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Dc2O9D9knK6MpV+GgcegqPkcm/KE1TIZnCnlXLr6w8MzHqgILMbmVVv+wmoJ?= =?us-ascii?Q?MVAD9oQPctwzrPpA4Grt+lHocMANtqmf2ntxEdEDY+gXk+4UD976yIdueBcy?= =?us-ascii?Q?ttoaDJuClUJJXh7Yw4sL4Sv/dXFvDJ/wogczrSAGfBkLXN9ISnAfnj1Uh8Df?= =?us-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NqunBBqMbP2q/4?= =?us-ascii?Q?knWqjBq5JEm+ggdbtbCB0rsxUW8Y94RaKndUVEywDIb6v7cbIMJv8DvvHELA?= =?us-ascii?Q?Gqhq5Hnmq7sLfWxUyaQsZJG76rabnhn0UIMXkJxRwtcF7nCSlAn13/cOsv9D?= =?us-ascii?Q?wP0xWge03gZLilnvYppC8ssyeMDM1Wjm6cdeWrV7rGn4YvEpkIN9bZXd2Lvp?= =?us-ascii?Q?kE2oNJL++r5RdhszcZFz/IXeyBqQrQJE8mdZ56851Q=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)(1800799015)(7416005)(366007)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?48jKtD8xmrPe5+ls9+MXRi7UlkGOZG1zwHAxVOd/NdWQsiWF8m0D7NSJc+MH?= =?us-ascii?Q?fvfVGNUOpR9EO6+Slh3hF02FvScRXCHvFZGClvOtmKIo/HjeIK4TMcCZmnVt?= =?us-ascii?Q?9HEoBEnDJ+c7ZyIm5mvzZtGbOy/4WFQg9bMQ/Zr2sM4Mu6GBDmoSbLU2EdlO?= =?us-ascii?Q?JEzVxJWfz66U3ktHy9Sql42DTIFZLyN30nqfzQ4kRcBt9v/JMGZ+1eK1pU4x?= =?us-ascii?Q?U8XRzm6n3YMx7csLg6aw6VmOd/ZtaedR/Oxq5r5T6aAkPdT3N0eoAK79qA8T?= =?us-ascii?Q?BUFHnvgedFGksbANDXF0Lj70tItB/0V2iGsugDtDsUXUK0zq9LvyJUEaQoRF?= =?us-ascii?Q?pgzwZ1hdehqZqOiLoV1pKE2jeKP9rOJiv6kkeXSa/j9SPAT02Vg3KW/+3/9P?= =?us-ascii?Q?qBGqg1raCWu1u7qC9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k?= =?us-ascii?Q?RlTGdZpJIQfm2Qgxi4oSLkwHNDdEnLeyFnyx74CYi/GVMqZ8mHc2XZVnrauY?= =?us-ascii?Q?nTPRRyTz1VyVHFGZBfSigPUir4NjpqSApslY0Y9FzcmMudfba0sWjIt4R0q2?= =?us-ascii?Q?TESlZFb4jd/O2t9uwascwbipEZRNQKAiLCs8Py3pl7kDNj0adFGyCftsn21F?= =?us-ascii?Q?MXNdYJomyDXin+3Bud+C+BOE9GpbXVJUIAvLHboRq3sp+kgUEgyn2pZ4bHMh?= =?us-ascii?Q?ESdS9zVZ80APnMoh7Vzu7YoMFZwPeWeB+cffkw27?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7871fbe5-3267-48ab-5fa5-08dc7b269904 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2024 12:48:08.7574 (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: 6xK4AE6fdAJEbEJXFjgbBmwtzHIo1X7qO/SsCG9V0jfIJfP9idBuhvWPQhnrUUY7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6910 On Wed, May 22, 2024 at 08:09:12PM -0700, Nicolin Chen wrote: > On Wed, May 22, 2024 at 11:43:51PM +0000, Tian, Kevin wrote: > > > From: Jason Gunthorpe > > > Sent: Thursday, May 23, 2024 7:29 AM > > > On Wed, May 22, 2024 at 12:47:19PM -0700, Nicolin Chen wrote: > > > > Yea, SMMU also has Event Queue and PRI queue. Though I haven't > > > > got time to sit down to look at Baolu's work closely, the uAPI > > > > seems to be a unified one for all IOMMUs. And though I have no > > > > intention to be against that design, yet maybe there could be > > > > an alternative in a somewhat HW specific language as we do for > > > > invalidation? Or not worth it? > > > > > > I was thinking not worth it, I expect a gain here is to do as AMD has > > > done and make the HW dma the queues directly to guest memory. > > > > > > IMHO the primary issue with the queues is DOS, as having any shared > > > queue across VMs is dangerous in that way. Allowing each VIOMMU to > > > have its own private queue and own flow control helps with that. > > > > > > > and also shorter delivering path with less data copy? > > Should I interpret that as a yes for fault report via VQUEUE? > > We only have AMD that can HW dma the events to the guest queue > memory. Others all need a backward translation of (at least) a > physical dev ID to a virtual dev ID. This is now doable in the > kernel by the ongoing vdev_id design by the way. So kernel then > can write the guest memory directly to report events? I don't think we should get into kernel doing direct access at this point, lets focus on basic functionality before we get to microoptimizations like that. So long as the API could support doing something like that it could be done after benchmarking/etc. Jason