Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2532325rda; Wed, 25 Oct 2023 05:43:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrfqpDog43C3CPtR/2x/I7UaaEoyc+h6gtYL34WCap8vGPGkgatKg34yWqvDBV4QiHFq4v X-Received: by 2002:a05:690c:ed6:b0:5a7:b10c:4772 with SMTP id cs22-20020a05690c0ed600b005a7b10c4772mr20771535ywb.19.1698237816853; Wed, 25 Oct 2023 05:43:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698237816; cv=pass; d=google.com; s=arc-20160816; b=MV5mGZRoK6ZnUJFi61LF6VQN4hDwWCATlbB1TgKzrqdmufWGAWXKHEt0tqZTKkmbtn EUKUERo0XRRIw7oe/UXDUUVIUbJk4MaO3FGNkCIeQjIsrjnMFk9ttSka4fS4eMgJ6d1t 51Lf238Zk77FRTIdEO29VnXnCvSZo5fH3E4tIOSFJ70T1PIU0NBBdNf65Drkx1G0oHNN j9ua15NlwF7K44ZUjSUcu7jlD9HkeLrESu0y094yRfmHBEUhGoAwYVrP5YN1y7liGUzE oMTV6xSXGg5R37y2P3K3Mj72pGTDmFGO7JgkZw4VKCrDy5a2r2JVpEF8tfkOWW86M73l 5wZQ== 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 :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=7Ryt9rxTpUCxTp0sq7obEZXuzmGpMy5sCK0Er9TSEDQ=; fh=2qAf+PQQmXk2n9XkfC1/Od7bm2OOC+CfgLdCTqBSgvo=; b=PxGV1lxZO66HneY1wwPGrInZC+EYKOAdvYT+Ge1H4reBtD3wvHiPLI5vGiZuWJiI1m CgYmqPt0N5mJmx45Pe4zPJp3qc1RulOVqrgjFlzUTqSg8uHHED+cuThZUpTl3ByCIL8p 8Z2y17Sf9UXeMotEIEL5Q0ZfpUg+cCshhkUOEXbJjQJiFkzCbkFrnGoznFsaj4DosK0B cqT1Ji999OlgViQfkH4NmWzNHQQkKcCMBEJJUcRGOTZ5IcKv738x59W11p4/oZOJ2xgr 3FqstX0qw6O+ocpnpAz6QDr0jbSpBfefq+1Xgy6QVcVx5EGnCs2mgXGwtkytrWdyj/yb up5w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=rD1qlDtC; 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.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id d4-20020a0df404000000b00583acdad086si10737463ywf.542.2023.10.25.05.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 05:43:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=rD1qlDtC; 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.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3926680FA859; Wed, 25 Oct 2023 05:43:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234875AbjJYMnc (ORCPT + 99 others); Wed, 25 Oct 2023 08:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234883AbjJYMna (ORCPT ); Wed, 25 Oct 2023 08:43:30 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2061.outbound.protection.outlook.com [40.107.244.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42314192; Wed, 25 Oct 2023 05:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HjJXxSh9jlHNeWNRxRa9+fNCgy5TX8zewSP/jOxrACz5AiLFn1NipQyr28fdoXrUkSIDovQNUl+AO1ZDslDSDN666DcIu1thJhEHspx87Xgv94uLHVq/NwRj1ZHZVj7TM6YfkJqyKwqhQUsjpDQ/3StZXF0IwtdTbjyTU3DQH+6VtnreFIReGJkOlpJXyb8KXXybvhO09G8UtJHLjBRYmT1/QQQjQJwBltP9q8UBcwRdizklhVVjPm2TndVK+WzpcYYx44o4ua/h7D3tLL8+QaCwcLVwL1pXD8j0jJ+SBWpkdwRLT+i/mlPx+aIuePFVEgojd795zRlPZQf8Jca5yw== 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=7Ryt9rxTpUCxTp0sq7obEZXuzmGpMy5sCK0Er9TSEDQ=; b=MXoJN4ttuTzbLHrTuDE3+YY5bYSRGU8i6Yzt/MADwaMC5w/xd9m35NsUB9nK/5GwHvfq/Dwjet/6RG6gyaa8H0yLKONqHU2QUswGaE2PQi1RZmmxzDoTwxNPuRCAJ5ddYUw0HOA+3Z3a46FtvJI0LqpYNzYmzIwTbWzv/vR6MOycVPo3Gn913l85iIQH5Aj7hmMPxgxzHToGs9oW3wZqjvF/V7s9wvpxrMSOX+dKn1mAk6YUrXAW8RPoVy3Ehtv1zjS74lRfcZfWMReea4izPxTeNXLgCLDQbQvN/A62LRbZ2zAd4VZlz8s0R5rPxWvpUQqwwfPaBDyCDoJXu0stLQ== 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=7Ryt9rxTpUCxTp0sq7obEZXuzmGpMy5sCK0Er9TSEDQ=; b=rD1qlDtCJ5Lm4+ZVAFskC+uS7LARWbCrjIyHh2ym1LuekNKFeGJ4srRXrwafMf3o4JJrF71cbtgKWqK7dD4bmvuLX1Pqp6nmKcBPK3CQU5+SinAJDNEjh407ify8Vz0C25K+E4ktjJtVTbQ1U1dJIFNIbMjbmDq0V+V2vUjIrhzVAnp93iHOJbgFqj3WtjN5x814psXMGCLDhwJ1SoJ7cu9Mquxl43SOGj8vuL+rt1qKHXstTOhj2BDgNpmLmZAgH1rGT4svhp/G60K7kAuVxDPovRl2QwVwJsWqpUuszfifzI9X7X+nUWHwV9oq/5SMFHI9Id8OFUNfvE7XPkzdrA== Received: from BY5PR12MB3763.namprd12.prod.outlook.com (2603:10b6:a03:1a8::24) by SA0PR12MB4557.namprd12.prod.outlook.com (2603:10b6:806:9d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Wed, 25 Oct 2023 12:43:25 +0000 Received: from BY5PR12MB3763.namprd12.prod.outlook.com ([fe80::84:dd27:ba92:6b15]) by BY5PR12MB3763.namprd12.prod.outlook.com ([fe80::84:dd27:ba92:6b15%4]) with mapi id 15.20.6907.030; Wed, 25 Oct 2023 12:43:24 +0000 From: Ankit Agrawal To: "Tian, Kevin" , Alex Williamson CC: Jason Gunthorpe , Yishai Hadas , "shameerali.kolothum.thodi@huawei.com" , Aniket Agashe , Neo Jia , Kirti Wankhede , "Tarun Gupta (SW-GPU)" , Vikram Sethi , Andy Currid , Alistair Popple , John Hubbard , Dan Williams , "Anuj Aggarwal (SW-GPU)" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v12 1/1] vfio/nvgpu: Add vfio pci variant module for grace hopper Thread-Topic: [PATCH v12 1/1] vfio/nvgpu: Add vfio pci variant module for grace hopper Thread-Index: AQHZ/4T6dPreO49caEWsaHN/ceuQqrBOmsSAgAi/5YSAACTLAIABhTmtgAAJHQCAAS20AIAAOkSM Date: Wed, 25 Oct 2023 12:43:24 +0000 Message-ID: References: <20231015163047.20391-1-ankita@nvidia.com> <20231017165437.69a84f0c.alex.williamson@redhat.com> <20231023084312.15b8e37e.alex.williamson@redhat.com> <20231024082854.0b767d74.alex.williamson@redhat.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BY5PR12MB3763:EE_|SA0PR12MB4557:EE_ x-ms-office365-filtering-correlation-id: f6a88927-b266-46f2-4529-08dbd557fabc x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: iNH3BKbwj+vLhq93IVtcss4LBLvBYfNt9BkW5nxLLwk/yuDI3ygNjNWb6NGXXaMteDkdXGVLuJjA/YhI+0cxWR3ezZ/TRV6JqKe2BIoS/A7hldVUxhEKk6V/Xh+w19xtfS0TtO0Ah+UWeWTjp/Z7wNzXhDvsvJIaehxL7n/+cKp8PvvfllOGLxva2AQBNyUB8PKvZgCLvcwOCVso3bGNN673CFtbmZVkDOjT2olrHTL5qIOLlGxk/HqRvdtIUUM+kW2Mk78gLWvIDOYZy1Zv8qzyO2TPV56m9wBbv9/FbaiGinZuEUQfG39elZrY5N9UE5zzxSRauLea/sAvbc9KFjld5dPB+2wJU6+ARfFGoA4TuVbqFyIx31PX09QFEgnAXRV8xhhuzaVC1VfdJri5vHg6LwA+Xp6CddA6otmhrYx0jm7gAX14PS70Sxm06ZFN18weHeFJPNmnKar9BXM9i4h3m4Qbv4wSbFCiGkZVoftuuORP9Dqge7Vxv+mmoyyQdaErzklJRh1SKpq1o34xFNVfAe1DXMeqxPAf+5ey+wSfJGZgTMHL0RpR7rje3Rz8P1jhrlOQZx8PL6b9atl3e4X2X8Ay/rGl5rEjQIyNLoCzuW7FgwpvxboG11Q2Um03 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB3763.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(346002)(136003)(396003)(366004)(39860400002)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(38070700009)(26005)(38100700002)(2906002)(55016003)(41300700001)(5660300002)(86362001)(52536014)(316002)(8936002)(8676002)(33656002)(4326008)(64756008)(478600001)(71200400001)(6506007)(76116006)(91956017)(7696005)(122000001)(66476007)(110136005)(66946007)(66556008)(66446008)(54906003)(83380400001)(9686003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?5agjQCC60NZ+ZF2/3VN36Pp3hsSrYG00TVzWsPKrpGc3CSlM7ODB0Uy9b3?= =?iso-8859-1?Q?mIAac9hPdCOkLS/xMjXK1GyPngo1bSoknG65fM3uBKjUis1n8Cesf8m4OS?= =?iso-8859-1?Q?5m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vsSBiwJoR93R6DmV?= =?iso-8859-1?Q?RFG/Ke5j+ZPch5OBaS3TEGvWOJagcPEh9W9hui9rLa71zCQj7iRqylMKK6?= =?iso-8859-1?Q?MZHsmPZwx+5XJX00gluUpBCXxY6wS2CwTyyU4tcX44oog8Uqt4sfepJIf0?= =?iso-8859-1?Q?z7HadDByo61qaKSfLojmbMb7oem5isykG2RlzDiieZME7+Jsw8oeT4YDyH?= =?iso-8859-1?Q?h5ks57gd1Zs69gBPOxxGBUP/Q9UVDpDZIslt2gWoXAKteiwS2t5xoIbxep?= =?iso-8859-1?Q?35qjxassr3fgpyyxeQkUzAQkguht23PiKn+2Hi9GDe/339pjE4oLdvtNMM?= =?iso-8859-1?Q?g4wFH/j/FpdqM4EfPaRA3XwEu5QaxHobyLXriPgg3d+SPddOqHJolSOIWW?= =?iso-8859-1?Q?uBsI6iDMjG70+i4Uy2+NP/JvO3v15T6ho7esnRV7wBcgEWHoVdbABI/sJS?= =?iso-8859-1?Q?7nPSix8F3zKPFhCFHWxJ7SMnUfObrdCp/8xdVXRjwzpvSLn4zikBAd2FU8?= =?iso-8859-1?Q?aSE3fYogCOEctDxHx2lDva/lzXzILkiDLr1xAkbTOJNykmVWKNFMbC2kJz?= =?iso-8859-1?Q?n7CtRqY0d4FxVCZN3oQlW7fJ99QCafBqv0aaRntO5ODTxpGxcdIt0If/mH?= =?iso-8859-1?Q?/33Uilzg/hauc=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB3763.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6a88927-b266-46f2-4529-08dbd557fabc X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Oct 2023 12:43:24.8491 (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: V25wH8Scw1BHir/C0ZXyEYlfkJhrNCXVINoBdsU82Wn5VeCwGZ5dPh0R+AFUDDu08aeRZLcDaioEpvXFod7yPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4557 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 25 Oct 2023 05:43:35 -0700 (PDT) While the physical BAR is present on the device, it is not being used on th= e host=0A= system. The access to the device memory region on the host occur through th= e=0A= C2C interconnect link (not the PCIe) and is present for access as a separat= e memory=0A= region in the physical address space on the host. The variant driver querie= s this range=0A= from the host ACPI DSD tables.=0A= =0A= Now, this device memory region on the host is exposed as a device BAR in th= e VM.=0A= So the device BAR in the VM is actually mapped to the device memory region = in the=0A= physical address space (and not to the physical BAR) on the host. The confi= g space=0A= accesses to the device however, are still going to the physical BAR on the = host.=0A= =0A= > Does this BAR2 size match the size we're reporting for the region?=A0 Now= =0A= > I'm confused why we need to intercept the BAR2 region info if there's=0A= > physically a real BAR behind it.=A0 Thanks,=0A= =0A= Yes, it does match the size being reported through region info. But the reg= ion=0A= info ioctl is still intercepted to provide additional cap to establish the = sparse=0A= mapping. Why we do sparse mapping? The actual device memory size is not=0A= power-of-2 aligned (a requirement for a BAR). So we roundup to the next=0A= power-of-2 value and report the size as such. Then we utilize sparse mappin= g=0A= to show only the actual size of the device memory as mappable.=0A= =0A=