Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp813569rwl; Fri, 24 Mar 2023 02:15:50 -0700 (PDT) X-Google-Smtp-Source: AKy350ZtRYKenIWSLkCa20woHPiLpWCGnwO+sNtVEfdMrgy/9anJE0UXSpqgw/Pj6f0vsg0YslmZ X-Received: by 2002:a17:90b:3901:b0:23a:333c:6bab with SMTP id ob1-20020a17090b390100b0023a333c6babmr2071589pjb.23.1679649350041; Fri, 24 Mar 2023 02:15:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679649350; cv=pass; d=google.com; s=arc-20160816; b=luwMs5nXAtwiTPQrnQKm3Sbh8Xq46uowG4JJUGTpSWSGsatINZ+BNzlOeydwdHgnlM 20+cRsmtrpLT21EYRAim4G9wE2KF5yDjTE3xuaU4uALKE+cp5T64AtzHD6kTYvF1HGhZ 6kj0oaSsIDGuI2/hLGgEYnSxoy9qLL0RKTjMM8fQibUucmUsaVZEA+qTfiT61euI6nCb b/snkNKKHdNG/IWayG6S8nXUZAmYK7sCVt3eZ6ZKVa9XZX6iGyW4McVE+2LsjHD2jeZ2 PrsCxwSPODyb89wRLIU+43CcmzJfwPlNeNArbqdObRRV4oCVfvWst0kBOn9DHtfBIZcx LYBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=ipvqM8LRCTctIfpsFuoJeBvpByp1k9+e4gFAR58JzgM=; b=gaz6QSYAnVjJ45SSuxeJspfymmKue6VM0m3k1DFEm8Bv3Xea+fGf+udOaxpHH3Z/WR kxB3ZJfray5Cgeo9HH38ZglUjCGpzZXYYc/0kP+9rxqMmhd/ffeB3rgWgVS7uZsZq4sP Q0ykUB7IKdeJWr/5537TrTtPsA7cK1IDvgJ9fIQ+00RT+mLShP1dbn0FdVtm5T6+fJ/I 3QQOzzXx0iV3BAvKAEtq4A/UAUiSdEQy8C0tPYDnOPq1+Jjl6eGcfxtGiBlEVZz7JDjq eaOh/p4OV9s8PFbgOC7BE7f+dJzBPrv4z/l2lWZvTBjXxJ9qKVPTfWVxllOvC2ZZv9gq h06Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ib2p6vYB; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); 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 c12-20020a170902848c00b0019ca3e987dbsi19326065plo.631.2023.03.24.02.15.37; Fri, 24 Mar 2023 02:15:50 -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=Ib2p6vYB; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); 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 S231436AbjCXJCu (ORCPT + 99 others); Fri, 24 Mar 2023 05:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231621AbjCXJCr (ORCPT ); Fri, 24 Mar 2023 05:02:47 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96DB9199D for ; Fri, 24 Mar 2023 02:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679648566; x=1711184566; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ipvqM8LRCTctIfpsFuoJeBvpByp1k9+e4gFAR58JzgM=; b=Ib2p6vYB0vSg31zGC5G/nhAcT8vCicOQbMLhaJCn2ZkRcqVfai2cIvNK /ZMGFo9/Cic7URODjRwZCeHp96y1h3M6mhINltPaaWIu/vCbtxMx+i0f+ 9XbKNmIq8FstIZka4RNCBOZWjA7gdpnXJi6iUy42IKVhb8PwsQmAyxsg0 o4SDnJxihjjYAIQZn22uTvNvFdSDdVzCT2cKzEj4Yk/E/zlfEuXrsJkcV coKxtS77AAzp+A9rP4nix02MA+VwiDUqSPYMvt7fVWGdWbbiJKHMpWAgs DU+P0eliVE388Wu3Ap2rT1ARzADEfNiFNmKiNiX3A2q+NZ3nE1oe0gcZX w==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="338453657" X-IronPort-AV: E=Sophos;i="5.98,287,1673942400"; d="scan'208";a="338453657" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2023 02:02:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="747085993" X-IronPort-AV: E=Sophos;i="5.98,287,1673942400"; d="scan'208";a="747085993" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga008.fm.intel.com with ESMTP; 24 Mar 2023 02:02:43 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 24 Mar 2023 02:02:42 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 24 Mar 2023 02:02:42 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Fri, 24 Mar 2023 02:02:42 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.177) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Fri, 24 Mar 2023 02:02:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XDDRN7Mh16kCnEvhRLf/o0XdTc/nbHyk2CIxiLgJsz8jpKxQt9DyPjR1bKKKAkcbt9Ndc4zSJqESjlBmiVbmixCmPnKY9ozYSueIWHkAZwYGR1E9dEhO4QALlCESRvaAqIrcK3qYPDvk3CgHzEFuA/BfENB3FniX3IVYaFBozy7e0RQLq1BujC+qm+hpbtP0CA3Je3I880caz3CNI3xZf5ZtCXHj/lAfFyA/ywBl/B8IIRvt5sWokWabb5R8MbE5Vx81ZYxlU7fdBOM/LYw9zuX8NcyAaCGCoMsiqFkvyqu0+J76VJ6ZtpWidkYsnCNUu/TkDEKsbr5MQdiTCP1K6w== 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=ipvqM8LRCTctIfpsFuoJeBvpByp1k9+e4gFAR58JzgM=; b=jRlKE1xglr/vRbs+nyentM7fAjv/A3iLtMAa2/YxJaUcv66rYdMjOChmzbha9XfXv/9nx50glKa69jy7BJAlaq5C0uNKHyf3Hhuxbq143HHK034pqxjNScYU6AJsg4yKT8dwGbnaIoD5vvqSuu3YVQiN07+5pGV60yu0qtwTYM+XV5wK5VdhGQfewggEIGh0vbrtMEj+SCTK8osOlcM2uUJGQMwUjBPb5mOyb7WL6Nqc60nTgeof1I8gkSOtBZzglpQh5x+KYCuG8JItt1mlywSUdgEnDuP9gFPYovMQ+tl6/SB2hVYvA4FWza4c65XCntfVK7dpNCVrX5y6En5cMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from BN9PR11MB5276.namprd11.prod.outlook.com (2603:10b6:408:135::18) by MW4PR11MB6739.namprd11.prod.outlook.com (2603:10b6:303:20b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.39; Fri, 24 Mar 2023 09:02:35 +0000 Received: from BN9PR11MB5276.namprd11.prod.outlook.com ([fe80::1aac:b695:f7c5:bcac]) by BN9PR11MB5276.namprd11.prod.outlook.com ([fe80::1aac:b695:f7c5:bcac%8]) with mapi id 15.20.6178.039; Fri, 24 Mar 2023 09:02:34 +0000 From: "Tian, Kevin" To: Nicolin Chen , Jason Gunthorpe CC: Robin Murphy , "will@kernel.org" , "eric.auger@redhat.com" , "baolu.lu@linux.intel.com" , "joro@8bytes.org" , "shameerali.kolothum.thodi@huawei.com" , "jean-philippe@linaro.org" , "linux-arm-kernel@lists.infradead.org" , "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v1 14/14] iommu/arm-smmu-v3: Add arm_smmu_cache_invalidate_user Thread-Topic: [PATCH v1 14/14] iommu/arm-smmu-v3: Add arm_smmu_cache_invalidate_user Thread-Index: AQHZUnWe1bQRwtfhAUSI/T7BqHBa167yh7YAgAALsACAANbagIAAyRsAgAqMnjCABPKxgIAANdgAgAAeawCAAPG3IIAAOI6AgAE8z4CAA0qgoA== Date: Fri, 24 Mar 2023 09:02:34 +0000 Message-ID: References: <1467e666-1b6c-c285-3f79-f8e8b088718b@arm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR11MB5276:EE_|MW4PR11MB6739:EE_ x-ms-office365-filtering-correlation-id: 5a95fa1b-f6ff-4600-cb19-08db2c46820a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9JCeVeifyLyAR+q1s7c8q25PpoaWekbLpzKlY+jW5y1qt9OaMa5ulyRBVkfz0/rDtA6sJY9z5aD5KGOh3aiAzFi/WycyPKNPc8wbL+P9GjvwnBBerHcEX85m7dbFA4a6PxQ5p0H4VvyYokWVdLuLYd7dDwDsmFtPaSNFsOdYFXJl9w0ZCjSgsen+CSPE4bfszw464thQu9vG6mjJSubwmcL5UoHcMmmcYc749eTTnBcYZlCxi9POsoaUp5+22t3kGLtACkINrYXvWCD0bLQT8oRYLrKf0CrsW6cIj7kwZ04U+VhDaqeMHdFzh5Faw2D/J/lkVuY66JJ0RPg53N+LiZ7pjrpASmnUqIP4WNNH3qXoIcd4Wcmx+f63OEOakanPSWPDZlUC/IOqcajVzrjSD8w+xlnrNFRWNfoOoA16wRhCS7X33eL+84vNABmCifUSfriFcxu2Wgq55cm3DIrYoJ31Tf6kr983VQa4dV1/FvgktDPxu/yxXL7HjXeovKHD4u7sAUWn6jh5jky9mXvN2c4KQx4LGQ2BwjzFDng4LFQKG6T0g6eRGpFF6z2K4D4Tthd35HWIojVjDYVoi5F1w9L87Gc9s2L0E+HZc/d3e3WH9oK1qoq5KEXPF58+n1hEFlhXWBnPn8CVQQc1dmrrAY1DzY7ANsbn/glDxlEd/ySHcmnGHcIdetF7gafr7jMXdhxLanB+ZjeYe8QclqLz2w== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5276.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(346002)(366004)(396003)(376002)(39860400002)(136003)(451199018)(66946007)(66556008)(66476007)(66446008)(64756008)(8676002)(4326008)(41300700001)(76116006)(52536014)(8936002)(33656002)(122000001)(9686003)(6506007)(38100700002)(86362001)(55016003)(38070700005)(83380400001)(26005)(186003)(54906003)(110136005)(478600001)(71200400001)(7696005)(316002)(82960400001)(2906002)(5660300002)(7416002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?VlFUz1uGUrKlqC+LWX1E1pt7w7RKBQnB8AsaH5kmEeOd0zZEUmlIq5DV7avm?= =?us-ascii?Q?kZjt1LQasWBZzRFiuRNz/gVyr/Gj1R4fxObxqh1KU6JRuFLWd4ecTA31Xr8c?= =?us-ascii?Q?+vJEbMbrhgcY4H1Z1bSQ6WZ42ieE4w00XWJS7Dl6upHr74P5PcOlT0NU0Sem?= =?us-ascii?Q?AXrU68aUqeFVqT+ikV5CZWMLU9m7ogYFt+g3EBVYYCh9KUNrptMV+qQBoBuE?= =?us-ascii?Q?3fuV9YOXjWoKu110upgb9YOPNpf0m12U24W4+1cyvLmd05wXusVlM24fYG40?= =?us-ascii?Q?v1iVNtpiepog5Zg9HiGg5eTN0OfOSOHg0z/uoSuHBflxzrpmoFeHlTqYCyK4?= =?us-ascii?Q?ew+eMMKnxjGDGib3YZHSMgEjywMEtLH/+IM+OT4Rpu6rf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R5g+PrKST/pOk62HH6FQ0wvRAor9RR+oF9OW/5o+Joa?= =?us-ascii?Q?yNauCTIO6DpcF4avLno3gZBzJtSLdjw+DSX6DvnQvfEafYTS5TqEkqXteQa2?= =?us-ascii?Q?mcjyqm7cxwIv5FJ0WMN5Ilr55rXmF7gpixH4jwkuNGVmnUcx3v2Hjhhmupe3?= =?us-ascii?Q?p6Q///LZ7dKIS8YyaDvgg1uModsPJMQ7HMWuuxcgYME5+Njjx1fSWAQ7/yNy?= =?us-ascii?Q?hZRZc7tjzLkjNPmHAdLzGbQ4Y0jmNa3QgFmrI3G/i9quzGj1rvktC34FVoRM?= =?us-ascii?Q?vHttaEIgNtJy+cWR8APO1Bxq5vnCWMQrIM0jyffh?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5276.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a95fa1b-f6ff-4600-cb19-08db2c46820a X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Mar 2023 09:02:34.3510 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: C9ScXR/oa9zRPZDFJRlqjrxEYDXl5zZnsUAbfjA91L2AUF0BROQU4gDesOlj4Ed8d6xEUKve4SvVF0FQ2NCKkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6739 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 > From: Nicolin Chen > Sent: Wednesday, March 22, 2023 2:42 PM >=20 > On Tue, Mar 21, 2023 at 08:48:31AM -0300, Jason Gunthorpe wrote: > > On Tue, Mar 21, 2023 at 08:34:00AM +0000, Tian, Kevin wrote: > > > > > > > Rephrasing that to put into a design: the IOCTL would pass a > > > > > user pointer to the queue, the size of the queue, then a head > > > > > pointer and a tail pointer? Then the kernel reads out all the > > > > > commands between the head and the tail and handles all those > > > > > invalidation commands only? > > > > > > > > Yes, that is one possible design > > > > > > If we cannot have the short path in the kernel then I'm not sure the > > > value of using native format and queue in the uAPI. Batching can > > > be enabled over any format. > > > > SMMUv3 will have a hardware short path where the HW itself runs the > > VM's command queue and does this logic. > > > > So I like the symmetry of the SW path being close to that. >=20 > A tricky thing here that I just realized: >=20 > With VCMDQ, the guest will have two CMDQs. One is the vSMMU's > CMDQ handling all non-TLBI commands like CMD_CFGI_STE via the > invalidation IOCTL, and the other hardware accelerated VCMDQ > handling all TLBI commands by the HW. In this setup, we will > need a VCMDQ kernel driver to dispatch commands into the two > different queues. >=20 why doesn't hw generate a vm-exit for unsupported CMDs in VCMDQ and then let them emulated by vSMMU? such events should be rare once map/unmap are being conducted...