Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp717724pxb; Thu, 30 Sep 2021 15:58:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzVbDtaxS2Iiay9N4oDxTw7DLx3XukclKcmPYFEN2sGhRv/lbrc/iXvXWQGzDxaFEqzrHr X-Received: by 2002:a17:902:8682:b0:13e:5d9f:1eb3 with SMTP id g2-20020a170902868200b0013e5d9f1eb3mr6520356plo.42.1633042693319; Thu, 30 Sep 2021 15:58:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1633042693; cv=pass; d=google.com; s=arc-20160816; b=wOJjY/DHqFmS7PpCT7wWrTKhsdEyP8ZAmMZj20VxwwR5Ydb8RUuKXLBdy1O+OMhR3Q m+nYqcVPHk21n68omnGe835XJm6NlM3im/Ruw/UCevwQI3H3icCZtg81Kk6D7RdOGbQP mzgfCb/mpN07FK6/NOslA8Npf74Ok+wpgPrGvrNLPeAqpK1EeMeFRQv0xyFndCb34ZLW zOj9wwsbyZ6o0Ry4FT+supqeOitOM4wgJ4w/3Yyarjnni2ZjLNh+qhsf3PqXAbZbgXrw jV4RXS1cXnallTkMaF/+izRRS8SWpYqI//0ekLwiK6OuiISubEuF1S0tSzRAaU9LjDyq vEtA== 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=3uyD4Ff0OSsv6edYmNGdaHx7H1A2AQMtXF8tHjsQEUs=; b=J1UZ4Fr8iwwW0iNDYR3qkY1jQv5gNnGkLy/gZ2FgiTqnQR4DwHQg92H9eDP1dqDEQE uugOtMr45VfBssia5ny+WTy9mMLhSyshATVhgxshTr8aya1SVpNVefAyHtfLBcLAEiRI fd4aqGf573iXta+9kD/oTFoQAeUofou/P7lzrtDDOFgNyN/Yk+YqFIbk4U74k56wByQm 3eCVtFL1dO/45Snqp/bRwvvg2wKs6yqNUEUa7NK/FuxjrRclx7ByULK63fwMaAPNa3oy qD0rmnEBfrUJO/3DL7c7BLf0d08V48FhXpIP6D/VQaEEthwtpKmKBbB9FE6NSQFlXUNv fMwg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=j1ucfU4B; 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=QUARANTINE 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 c17si5188054pls.182.2021.09.30.15.58.00; Thu, 30 Sep 2021 15:58:13 -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=j1ucfU4B; 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=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345434AbhI3WKK (ORCPT + 99 others); Thu, 30 Sep 2021 18:10:10 -0400 Received: from mail-dm3nam07on2089.outbound.protection.outlook.com ([40.107.95.89]:20288 "EHLO NAM02-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S245132AbhI3WKJ (ORCPT ); Thu, 30 Sep 2021 18:10:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T8t9dKOUwzXwbtWXuU/vqXK2a5WUBJzsegTLlBvRoB3XTFk+B2INDzvMqpRJpQ6NnhPqB/fVCsucOcbykz4v1ouUFG0xOvU4BMGwD9yDRaa8iGBEgM3xbjDyyuDxDf0t+Z10T6D+x0ZGDEj6cWCu2n17VXtYfEwP5qrwX9f9TFk5GdoZ/iPrvHH/EFhMbDTfQ+33t6FGNSYrVgZ3TIvz4qecGEKWUlQxXNBQSl5RYQ49hEGkrcRcfHBunwVt3OYaUiJHvjVaSD0RpCqWqf+SsLZ5iOGB6KzromjAY5RkqGD00gJJOFICZ8/hdarLWQIHu4eIvGLHYDOU6v5KEbvUHA== 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=3uyD4Ff0OSsv6edYmNGdaHx7H1A2AQMtXF8tHjsQEUs=; b=fcPLyKHL65/zLMEoe3n38bOGE4xwbpIEX503k+Oj8CmnUWDD90O7Izgo4iOwgfY8s0ZjncdfRy37oHq4gwgRPrdJTQKl9AviaDrhJmOmBee4d5VE3oycbqTkAG1f/TpSNTn+IKVGl4vwbMzWqDkGJm6Dj+wII3xPFclp2f8gIak4BbnL5dnS7uRZ4wlvLqT9m83x1Nlf+t542BiE9KnHagconm3c8jSdn6r+cYuJwyrLHWCuBBN4zL9wVvqR8lT2j4P4gL8t30EtL1E/4tQoRQ1FYC1/vfFn0tAn05BcQncPWm3LO0DxiyuT8io8uNFPhJ8dRE4vNspjLN0PUvcXLQ== 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=3uyD4Ff0OSsv6edYmNGdaHx7H1A2AQMtXF8tHjsQEUs=; b=j1ucfU4B6TqHQpiuYvQhutZ8v65UCN2KN4syubVQc6y012YCRecFz7usFahmVJMJuwSDt/rKHqGmALCK7/F3VJzKo4aAJ0eRvXVqqgICf/exkqRTt6QII4dGw42+Dcsff9jCklhyoJk0lXxGin/2pllCxSTh9FHWMOFYU4SkKCzqf+rcAkrPWKf12mgl6mP/81Ei/fXeYesVUsZsZmLxCg4u5LSdt4q9E4RDbrHkLiISYHYp0yGejM7zpB3bzR9Z6jqaEjcMOj1gWAnv6AurVbliMjxCyhtfinJJ0STZhA7uCUEkL4auwUpO1jfz4YsIgUgrYwk4tCJ7DE8NmeEnKQ== Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) by BL1PR12MB5223.namprd12.prod.outlook.com (2603:10b6:208:315::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14; Thu, 30 Sep 2021 22:08:24 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::e8af:232:915e:2f95]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::e8af:232:915e:2f95%8]) with mapi id 15.20.4566.017; Thu, 30 Sep 2021 22:08:24 +0000 Date: Thu, 30 Sep 2021 19:08:22 -0300 From: Jason Gunthorpe To: "Tian, Kevin" Cc: "Lu, Baolu" , Jean-Philippe Brucker , Alex Williamson , "Liu, Yi L" , "hch@lst.de" , "jasowang@redhat.com" , "joro@8bytes.org" , "parav@mellanox.com" , "lkml@metux.net" , "pbonzini@redhat.com" , "lushenming@huawei.com" , "eric.auger@redhat.com" , "corbet@lwn.net" , "Raj, Ashok" , "yi.l.liu@linux.intel.com" , "Tian, Jun J" , "Wu, Hao" , "Jiang, Dave" , "jacob.jun.pan@linux.intel.com" , "kwankhede@nvidia.com" , "robin.murphy@arm.com" , "kvm@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "dwmw2@infradead.org" , "linux-kernel@vger.kernel.org" , "baolu.lu@linux.intel.com" , "david@gibson.dropbear.id.au" , "nicolinc@nvidia.com" Subject: Re: [RFC 10/20] iommu/iommufd: Add IOMMU_DEVICE_GET_INFO Message-ID: <20210930220822.GG964074@nvidia.com> References: <20210919063848.1476776-1-yi.l.liu@intel.com> <20210919063848.1476776-11-yi.l.liu@intel.com> <20210922152407.1bfa6ff7.alex.williamson@redhat.com> <20210922234954.GB964074@nvidia.com> <20210923112716.GE964074@nvidia.com> <20210923122220.GL964074@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: MN2PR07CA0029.namprd07.prod.outlook.com (2603:10b6:208:1a0::39) To BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) MIME-Version: 1.0 Received: from mlx.ziepe.ca (142.162.113.129) by MN2PR07CA0029.namprd07.prod.outlook.com (2603:10b6:208:1a0::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.17 via Frontend Transport; Thu, 30 Sep 2021 22:08:23 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mW4E2-008DI0-Sm; Thu, 30 Sep 2021 19:08:22 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0bbac8bb-0a19-476f-8973-08d9845ed251 X-MS-TrafficTypeDiagnostic: BL1PR12MB5223: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TkHrtYd4+Iwla1bVf/4E5abCTmQqhx+TvAvX5CiAG0Tuf3YTcZdyb9DR8ijMGql6bsdJao/bSGfnAEAd3jf9EcLH/popySDmzdB//rWPSpu11qgc0Z8KXExIOmBhUSqZ7nngfMMkP0qJdmqNMMBUDxaWKgmEPeuyzMPP0ndCi3wv7Rspl1qibGMHu6yvht5JgVhJ1B+1AsPkkkJIeUcFzWep9F+lQh856sYYHxaflz3phP8liSSAH3XEqTM8XJaSWU11BNWsFn1pTUSF+fbzbhvVOAL3vmfANBL78MVgpjH+68GdP715DKhSxEwE8U5lpG4NQIgWHo5ggMREp5zYRDWLJSZZg4+fCMBaxcEsRGYAmqr0raDd2QBfPwirvWtt+a/M/Oc+CiI1MK4CNW2hXZz2F1fLIwR7xOuAvEKyY0pUfmt0qhlolxY6rOvr8cUGNugdZ8lHobqx8GoFWHrb/apguTwcaWXfQ16ghNOp7AXhkq4rfqKoYQePblJpNwftFkVkVlC/rbtE/7GYZt+IezURThenz5OqXIVdccRr1A7TNLeiR5NcFShhVTgdtcYNobf3CwFxhyPRAy0TAO/TY9esE/N7enuDSVP3/VFkIEBPD9T3+qJ46SMO2OI+wX7Y1ioRrrFcp8cQWZYQ6L2d0zOVhms9IMDD8w27frqxxZ2Ranf4c7D0LYyOYFv/Q8DchMVQahwnt7LlCfw/pJ2SRw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB5506.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(107886003)(5660300002)(316002)(83380400001)(1076003)(7416002)(2906002)(38100700002)(54906003)(66556008)(66476007)(36756003)(26005)(8676002)(6916009)(186003)(86362001)(9746002)(33656002)(8936002)(4326008)(426003)(508600001)(2616005)(9786002)(66946007)(27376004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData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NZnaR3KEACnUD0LoCauURxd5IdSinsi5QR?= =?us-ascii?Q?8QjSMWHvdvgZULtTrKegKenNVw1+MVnOZxeUmb8vdyDePS1XPiP6W8XExUm2?= =?us-ascii?Q?CYQe9mVSziuUWhhEzab96C22SPW7DoRcwFP0tqeIwtzRCtMGC2NGf2YdgVGe?= =?us-ascii?Q?WNsJ//GdY0aThhzJyOEJFemSUj+BEyYrNREAA2WskwnPY8wUdXBl+2kWuhw1?= =?us-ascii?Q?E8e5Dg4co8iS/0Bn5XBO1SBCv/dhCnpoed8hcBDSlWwJY4XbWSGZOFiXCShe?= =?us-ascii?Q?c/cCAcjPYnA1Nt5PLqaUMJQbpdtOsxecH8Mw4bqIzDJsx47uPJDDdqt8CQj6?= =?us-ascii?Q?LbA4VAhkZVMMPS0IhskgqvUgqWj2bjKVqxFzcQulzSG4SEDU/jhHMhnP/bua?= =?us-ascii?Q?jSDUB7/adR9ECrQIfITcf7fK20RUjgs9qM5a+K9stcinQd3WZS/zFfuHpFZ7?= =?us-ascii?Q?g5hHK0fwqv/qscgSchpqQfuf?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bbac8bb-0a19-476f-8973-08d9845ed251 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2021 22:08:24.3412 (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: zmZu0OkRqtyfRiuAKUaTtb37dctGIm9NFs8l4DeDOt1r+910l9lmmTkGK8M1T9ap X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5223 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 30, 2021 at 08:49:03AM +0000, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Thursday, September 23, 2021 8:22 PM > > > > > > These are different things and need different bits. Since the ARM path > > > > has a lot more code supporting it, I'd suggest Intel should change > > > > their code to use IOMMU_BLOCK_NO_SNOOP and abandon > > IOMMU_CACHE. > > > > > > I didn't fully get this point. The end result is same, i.e. making the DMA > > > cache-coherent when IOMMU_CACHE is set. Or if you help define the > > > behavior of IOMMU_CACHE, what will you define now? > > > > It is clearly specifying how the kernel API works: > > > > !IOMMU_CACHE > > must call arch cache flushers > > IOMMU_CACHE - > > do not call arch cache flushers > > IOMMU_CACHE|IOMMU_BLOCK_NO_SNOOP - > > dot not arch cache flushers, and ignore the no snoop bit. > > Who will set IOMMU_BLOCK_NO_SNOOP? Basically only qemu due to specialized x86 hypervisor knowledge. The only purpose of this attribute is to support a specific virtualization use case where a whole bunch of stuff is broken together: - the cache maintenance instructions are not available to a guest - the guest isn't aware that the instructions don't work and tells the device to issue no-snoop TLPs - The device ignores the 'disable no-snoop' flag in the PCIe config space Thus things become broken. Jason