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 01B15C6FD1D for ; Mon, 20 Mar 2023 20:48:54 +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=FacnXjVC9/gr26RdydPZUYQ1TlMMFebDXk+sXC166kA=; b=IEzVKbKk5laTVd RvFJzKoojCTsbJyHIaoCpy/S9I7xJveRbQYrYp1cypRySCDyVs66u+tvxxmzvvWn4W9d5ISYgkTjz IO07yw4US4mPh2Wu+/p6pjBehjpjfzRomsu/JJpmoq/+CUnAfTCCvmvhyllk7xrBmC39mRpM6YTlI 44u8/CixZtC2S2DGf9dpop+2PpHk03oZnQ1wxtmj4NObuBDBIoznVbe1cWXZSevhHMANoZnfqsSwr MIa2jzsKPf7xL7R8KIshmYuQcpBK2XUvi7ha2ju7wPE0IYki1Rvm35NiUl+xrnnjX8J3HyiDSnHVh CAPKntbmlaz365qrQS5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peMPV-00ASse-0t; Mon, 20 Mar 2023 20:47:17 +0000 Received: from mail-bn7nam10on20614.outbound.protection.outlook.com ([2a01:111:f400:7e8a::614] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peMPQ-00ASrf-2c for linux-arm-kernel@lists.infradead.org; Mon, 20 Mar 2023 20:47:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jdmq11yKS8YsZapXKKC/lzX+Fn6Rcq1Hsw8EMcWUQV7eitmhw6nQF7IwpC6LnIolqQYMPSVaAh3deRSEY4jmqZu0XroG0aJ7GO95ac4XDAXPetmaHZuluknmxRtSNpPoR26sFxTsjyZD0OsCZtPftdF0tDRxBcNAeDI/L5LAddFqgX4hYThN5SA8TqlqCUSQBfBOuPiF+KGqNCPTIYLakQlohg4sqKhSzL75l0Gq9/6IiZYDUkEWdbyH+1mxhMj3qx185z7J3wGFi/CfMyp0J4k3yTaUZNyt/9bbV6hPeCFz7/Q1YEUlXXkX0ONT0HYT0XdI2wjPSen1lGPlJvMKCg== 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=14Mva8e8qmEkbSikBO6n8yxgx97b3Bn+isFabfMXLoA=; b=KKv/EtC58RfgF6PBKpxgHIB+gHTJJO4A7klo/Kc/gcp7V5/nGxeJW1IFw4x2QPgWMyaZ3wQZ+mKmeB32omT1PwaY8S/gRJRHX2QnNbj2VhNodyKCFStlilUdLkd7yfD+c1WNeab4xomDWm4S2pd/Cvk1Yk/swIBOnx6731A0xVmJizyx72Dgb8McRoRAd5eH5IPaiB2xaiGCtqtqctrT867c0owfPBNUcQcsHJDDtmw0Ze8SUEr7ujp7jZMXCB84Nres3xJqOMXgmWM7cHJf2S+UnYYmwqWLn4lrxxtRZzA3WCuUpE7qmHCFQNvaXr5glhwL5F2XGWnFMJSZpv4ejA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=arm.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=14Mva8e8qmEkbSikBO6n8yxgx97b3Bn+isFabfMXLoA=; b=rS44QuhANNXubaReeAGuPhyOBdXaNCTO53UbxxEyllnqvsRakYcahWrs8XSgyhPZasxtR+KLPeuIYq4z7+Blc/oxNuIWWrGOWu0E0piUOYaPMiBXyIIHMo5yyqKAFbWekDwO9H3LSyfBTw+O+q3NvVSK5TI94RO4K34ZZesaq9lhtq74erFkOj2VnW/1eSOlN7CmEqi7HBvXDrWZmLUZIm9poihU1BsInjOPGq59dy9W5DEGbZygc9G770pBNpV7AzARa86ur9Yu68fi+2IE7AYglDxG4Yuo+IxepeFHpvr2hwssy3bSpp7l3qNlOoJf4sMINMoHUKMLs0XQ4JOZ4g== Received: from MW4PR04CA0069.namprd04.prod.outlook.com (2603:10b6:303:6b::14) by SA0PR12MB4496.namprd12.prod.outlook.com (2603:10b6:806:9b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 20:47:08 +0000 Received: from CO1NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:303:6b:cafe::58) by MW4PR04CA0069.outlook.office365.com (2603:10b6:303:6b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Mon, 20 Mar 2023 20:47:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT058.mail.protection.outlook.com (10.13.174.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.15 via Frontend Transport; Mon, 20 Mar 2023 20:47:07 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 20 Mar 2023 13:46:54 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 20 Mar 2023 13:46:54 -0700 Received: from Asurada-Nvidia (10.127.8.10) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Mon, 20 Mar 2023 13:46:53 -0700 Date: Mon, 20 Mar 2023 13:46:52 -0700 From: Nicolin Chen To: Jason Gunthorpe CC: Robin Murphy , , , , , , , , , , Subject: Re: [PATCH v1 14/14] iommu/arm-smmu-v3: Add arm_smmu_cache_invalidate_user Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT058:EE_|SA0PR12MB4496:EE_ X-MS-Office365-Filtering-Correlation-Id: d818c371-cae9-4231-8a51-08db29844566 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wP5m6YtOuq1kQzwFy7mYRVBE+PK6b7Z8SQN/EO1DC9LBwGr/yFwEIM7+BHHILqMPG1j2bWGYMSsxPneuR255GOkvwBFl6nsfrfCOc5P2RVPoz78A3sk6HOhWzDosYkqB65Q4TSb/Du6ytcrAPZ8fKkeupqwn1gBMyWHN97JvKTdkD3hJfTSIKAME4uRJaiTyhBQPrXNM+AKe/tUo6l3mWFj7W2qcHw4JowMTsenOm3QW7gRBUSYwPUScLSleyitMoqXBZ/gc53Bfd2KgWb386Yk/0WywoQVI1EBMO+2wAjc+AQCBLjrAdZ0WSS3fdZpv6gNzs09bw5uZuUqPvwDYiKFtUmvf/bri7ij2icFUn65oEzg/6yhLNR+s9zfURBDVCFIx3Qgjwtp12SX/lnfDWSaYOTJILqE5I56wxBdEDQiQ0N/g4JOm9+J9fKvqoH5AyVhiBt0ejXLOTNyGVfjwTspKhD/EEufcOxQLEnUkY8svQRnTsnFj9+5wHp5cXR3mFzfrCfLDO1SKjnuvfMzxK9zjcm2SRpMLAAx58pMMt93frucTDP5mjpnpCCcLlSe3j3okR+zJ2zg5l1f+V5jRGyYWQMBw0vvQ8W2heNSoqXHtkDRa6vwdcNX118lUX8L3gxk/b58CcTuKBeta43jGsfjBYA5KKKkrFdaGRYZWsdbVgYpKvYadCp+1aUmAvf2M+YwGicHg5yhc1mP+vxxikmOnaZvuFQtT2LY10qR/I/9ZQ24TERnOI/KGn8DCPLWX X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(376002)(396003)(346002)(136003)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(82310400005)(47076005)(83380400001)(478600001)(6636002)(426003)(336012)(86362001)(356005)(36860700001)(7636003)(70586007)(40460700003)(55016003)(82740400003)(4326008)(8676002)(41300700001)(40480700001)(2906002)(8936002)(6862004)(70206006)(7416002)(5660300002)(9686003)(26005)(316002)(54906003)(186003)(33716001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2023 20:47:07.8420 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d818c371-cae9-4231-8a51-08db29844566 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4496 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230320_134712_858455_1E5A4D8E X-CRM114-Status: GOOD ( 20.83 ) 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 On Mon, Mar 20, 2023 at 03:07:13PM -0300, Jason Gunthorpe wrote: > On Mon, Mar 20, 2023 at 09:35:20AM -0700, Nicolin Chen wrote: > > > > You need to know what devices the vSID is targetting ang issues > > > invalidations only for those devices. > > > > I agree with that, yet cannot think of a solution to achieve > > that out of vSID. QEMU code by means of emulating a physical > > SMMU only reads the commands from the queue, without knowing > > which device (vSID) actually sent these commands. > > Huh? > > CMD_ATC_INV has the SID > > Other commands have the ASID. > > You never need to cross an ASID to a SID or vice versa. > > If the guest is aware of ATS it will issue CMD_ATC_INV with vSIDs, and > the hypervisor just needs to convert vSID to pSID. > > Otherwise vSID doesn't matter because it isn't used in the invalidation > API and you are just handling ASIDs that only need the VM_ID scope > applied. Yea, I was thinking of your point (at the top) how we could ensure if an invalidation is targeting a correct vSID. So, that narrative was only about CMD_ATC_INV... Actually, we don't forward CMD_ATC_INV in QEMU. In another thread, Kevin also remarked whether we need to support that in the host or not. And I plan to drop CMD_ATC_INV from the list of cache_invalidate_user(), following his comments and the QEMU situation. Our uAPI, either forwarding the commands or a package of queue info, should be able to cover this in the future whenever we think it's required. Combining the two parts above, we probably don't need to know at this moment which vSID an invalidation is targeting, nor to only allow it to execute for those devices, since the rest of commands are all ASID based. Thanks Nic _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel