Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp189910pxf; Tue, 6 Apr 2021 19:06:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlqb1paypfgvvK8UsLy6G9rCypZ3QSDWL1pJ+6KMmABPNK8mIKx+Gup4vQMGir2YiCvVhG X-Received: by 2002:a05:6402:110b:: with SMTP id u11mr1625718edv.356.1617761179946; Tue, 06 Apr 2021 19:06:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617761179; cv=pass; d=google.com; s=arc-20160816; b=ZMdvo7op2wmIqxMYi6xJsziU049UUnKhWomDjmnvwLVQboYbLz6MUdNHUGQF9+aGxw xhx2snpB60xcLPWPaREZLGqV/G3kMOpTwEK9CIk2SBGhG2bsJXiqxiAhWqIxtQI2RE5T jWyiT42cD2WPvNT6eR8Svw7Jp96vY9XtMoMX7nKh4fumokh+VY8AYuvk8XqBA/SNyYR/ Nv/uGZHiNZ1mN1owRsWcSyMjCm0b/02RNFcckOsCYpTpYCDWEgDpb/Pot76jO47v8h9X X5HXkGd2X659S3exwZ9MYQIGs2arfD8NUbvU5lmKL2eipJKhmnrFVpm6rb7VHjglbLVw ynKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TAyWTpAGiBmIhJeujMEDNxR36LohagizGI7BWUhzgCo=; b=Ln2Tr5WOR7vd4dyQKi8ixBFvKzxc7HiuUz4qIDfn2DwYGPIyDV2RZFqARiGIx7n3zQ NllvjZnRJTWPEf3blaYj66mzdsykfi/eaBEQj+hmUeXVH3ilaBUvztLFFEde44JbzG6o j90xVCRjEtbhM2m/JfwguQe1+JIEwlMMUeZvQzetQYfE4Y1Va81wMGhoFwENJwsLjtIa 754w0qaj4/Qcc1BwCb6ND12uAVuOSpyWXLJZdxum+ZKidSkbeYURf61wDiRUEtqR0Edb sz6zBrUP43W69yx/tf+WfwLfy1MyGra5At/TXLUceY2614bi7mKG4mBe253wMLaw42ht weaw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=qIlL15Xs; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t22si17907565edd.558.2021.04.06.19.05.55; Tue, 06 Apr 2021 19:06:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=qIlL15Xs; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243097AbhDFMP5 (ORCPT + 99 others); Tue, 6 Apr 2021 08:15:57 -0400 Received: from mail-co1nam11on2052.outbound.protection.outlook.com ([40.107.220.52]:14465 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233385AbhDFMP4 (ORCPT ); Tue, 6 Apr 2021 08:15:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N7WQ5udZNya7hWn9+I7V7BTXaJzKM3JxPRlUIzAh5GRq+dI9RNggrIecYj38TOTCbf6wktXC/9lU6rRxuFT42uuOqzRxp7YRDbOuqCrk78fzMJmVUNBpAn7eDc3IudACKFX/+dWINi5JzHyX4+988G7NlCmIjvzFi+1F2fsZyHt21WBjkobOnimU4QxZr4zsiCco0oNDbq2Z4lo+G5oIn3bB15fzjy2bTzhf8MATZ1CJOI6dsUoaxyAQfFx/zYDBYqaE5EInc/GE2HVCTKT4UZU8cl0UaQk8hRn4L9JCYqZ0RmsVK7W5Ah9hFVLlU03gVwQpDB7axCx020/ttPnS0A== 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-SenderADCheck; bh=TAyWTpAGiBmIhJeujMEDNxR36LohagizGI7BWUhzgCo=; b=jhYmcAKGFQ4O10PXKXZQ8kXkHUikloTBHIIdUK8lM4g/eNgz1IqW2rwEExAiHk9h6xYKVfftoxEe1AXUHSzX0fLVBsV5n69QZbHkNrQdfydD29hspsCuFvNaZY0352MMiJLEVNkMKoxEGykYDn61LS4LQxjM08YCqNw/ZLenU7h9hVkkJgqjmYIOUnPzk8r72TCnLsavn19BtR4w2RTwls/dD9G+2chX76yn3lEL/kIP0nkSr9oQelAE5lDey4KpYWZ1MQiD9Rzk1ODHe0Jll6maxko5majVBCHl1X57UBjY4xXDKxuJ7Xnc71qRbNEAfqaJ+BM5Rhm7wb0cu84vxQ== 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=TAyWTpAGiBmIhJeujMEDNxR36LohagizGI7BWUhzgCo=; b=qIlL15XsQ02PtaeaYyl+7oAuoH8i6ae1nr+6e25M6efcJHloboiqE7XKI5lVX+zAVFYtkrlCcD/NJXseo84obNTzS3sgR7EVEKXO5y7O3tCVnV2F7KCRTR61/QgIGoxExqKu91OasfecrniCDqhXzZ6lAuOLNr89jxpZ0OEIcDg1gOjjVlCb35zp7ic+u2mvaj5z0Hy/fqtFqw4VF4apSCQG2AL02JxsTcYnfMRzCmiC3I1sgvoaBbaP0EFa9ngG3fMQuwHQhAcp6OKCqdDXQT8U5O+z7wuWFFr2O7xLpp2/C2bP64HwDBDD19JbqYOSaYOQjI7WyWQlQHK4SBFS6A== Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) by DM6PR12MB3019.namprd12.prod.outlook.com (2603:10b6:5:3d::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.32; Tue, 6 Apr 2021 12:15:47 +0000 Received: from DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87]) by DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87%6]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 12:15:47 +0000 Date: Tue, 6 Apr 2021 09:15:46 -0300 From: Jason Gunthorpe To: "Tian, Kevin" Cc: "Liu, Yi L" , Jean-Philippe Brucker , Jacob Pan , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "cgroups@vger.kernel.org" , Tejun Heo , Li Zefan , Johannes Weiner , Jean-Philippe Brucker , Alex Williamson , Eric Auger , Jonathan Corbet , "Raj, Ashok" , "Wu, Hao" , "Jiang, Dave" Subject: Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs Message-ID: <20210406121546.GL7405@nvidia.com> References: <20210401134236.GF1463678@nvidia.com> <20210401160337.GJ1463678@nvidia.com> <20210405233526.GD7405@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Originating-IP: [142.162.115.133] X-ClientProxiedBy: MN2PR15CA0055.namprd15.prod.outlook.com (2603:10b6:208:237::24) To DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (142.162.115.133) by MN2PR15CA0055.namprd15.prod.outlook.com (2603:10b6:208:237::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Tue, 6 Apr 2021 12:15:47 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lTkcU-0016p2-0k; Tue, 06 Apr 2021 09:15:46 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2278bd09-006d-466d-6660-08d8f8f5b5a1 X-MS-TrafficTypeDiagnostic: DM6PR12MB3019: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B1wj8SVuSsyPYrorTKCTOwVBzELm4/qL5I93qwVWV8kvOjXDML71rw05+P8opOF9AAtZjHPQLe8zGrwgYyXz1a/XIr3ZBZ9azQvvkiylxdUefWLdEd4aopvqHEZaP0uDsCKrp0+chSYMvNumMb86Ip67Dtd5dyzAsJSMWwkImK81xWPzRSUj5XSxQNY2XyXyqNNtUmF+StJgaOWAZk7RIKEPcAMMQDwIYVPW8UzvfIy8pVXBIo2jVPPBzUQGdgKeuRLHmjQKOpxTl4vHHjWLJe3G7HpuLwfHVVkASSgxsKMrf3PL4yrX34ef0V+xm26Oesfhfrp8YyTnlckKwJKqG5fUneKUniTnQohjRAXuEiOlggLhgO2H8Dcao1GOdVoozoImFJrrnHEGAk1Z/XfV9+lKr8fpYms2iDgSir5njyaBMQ9O2gX6vJWe61k+iRUj2dVGsiKYWrdSmKrLgs3+FUAMaS1ZtOf/GTgD+v4z5oZjTlnjMKsGcn6jKIp9Qvfa7tRuVoH3fSaiIglPkCm7jPqDeMjWpzQcJ1clNSUnViW72wsQFf96UaNPzinuO4nyk1ESN2mpM9zV8Wng5MwWx/3naoTKEVW2slDcg/nkdrZeAvqj9KP8bIhC0itrhJ0Xn+qwwnwXukf3Ew0wKLL44BLVr8rBLTb+WUfogW8kDfo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3834.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(396003)(346002)(366004)(39860400002)(136003)(54906003)(478600001)(316002)(66946007)(66476007)(9746002)(1076003)(9786002)(33656002)(66556008)(8936002)(5660300002)(4326008)(6916009)(7416002)(186003)(36756003)(2616005)(38100700001)(426003)(2906002)(86362001)(8676002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?taf4w8TRYhi7+MEkiAo6hMhMiAyhqqAfQ2CldLuvuKwiFHzjrSiKbmhPThzJ?= =?us-ascii?Q?YfdVicbBjTSnApLW0mzLv2VM/pWWd1Xs2gXzYzJTvF4jXVp+alENqDknlde9?= =?us-ascii?Q?a2X7u85J2aMNUvZZaPiF45C7fUUzvgT/iSwleBT9M+0QRuyLIT+D9UxuyyBn?= =?us-ascii?Q?/dTuZ+R1RjqITawBaIgPyLJfJ/LQCi5KcyV3igfVYWXpBzYEk9KtT9w5po+p?= =?us-ascii?Q?t9Z183aHbGlyDiHBGLKf9a96CBaqvmLagMh1zMNlZ3wKYlt4MuB1uhGm25PR?= =?us-ascii?Q?CyUKXHc5o1BsZ1EwZOmEJPv8WiTZlpQjht/lqw53e34Z/Bj0gQAXdp9K8IkO?= =?us-ascii?Q?u+uwktJwvMRbQS0c9Kk8DTx+ezIDuFcmHQN2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ascii?Q?boNfanU84J2lS93TY20U71YahzJ1HbIuORiRZxp94lh6YAXIC78Vec/fvtSB?= =?us-ascii?Q?D4FlQD0XO8+BEBySLAzoyPZvIeVB+1XoSETqhvM6lOaXmg=3D=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2278bd09-006d-466d-6660-08d8f8f5b5a1 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 12:15:47.5172 (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: /Jprj6pIADsWKI9Ao7+bfKiHftdz3DXf0iP+BpAT0cFuWb864AnZXXcRYzRoiBBP X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3019 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 06, 2021 at 12:37:35AM +0000, Tian, Kevin wrote: > With nested translation it is GVA->GPA->HPA. The kernel needs to > fix fault related to GPA->HPA (managed by VFIO/VDPA) while > handle_mm_fault only handles HVA->HPA. In this case, the 2nd-level > page fault is expected to be delivered to VFIO/VDPA first which then > find HVA related to GPA, call handle_mm_fault to fix HVA->HPA, > and then call iommu_map to fix GPA->HPA in the IOMMU page table. > This is exactly like how CPU EPT violation is handled. No, it should all be in the /dev/ioasid layer not duplicated into every user. > > If the fault needs to be fixed in the guest, then it needs to be > > delivered over /dev/ioasid in some way and injected into the > > vIOMMU. VFIO and VDPA have nothing to do with vIOMMU driver in quemu. > > > > You need to have an interface under /dev/ioasid to create both page > > table levels and part of that will be to tell the kernel what VA is > > mapped and how to handle faults. > > VFIO/VDPA already have their own interface to manage GPA->HPA > mappings. Why do we want to duplicate it in /dev/ioasid? They have their own interface to manage other types of HW, we should not duplicate PASID programming into there too. Jason