Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12473303rwd; Fri, 23 Jun 2023 06:40:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7LbeeFKL/mh/p4X/QQ1FWnaiCGfCi1RRdSlT5CVnvSqsEdcQbfDLrMjDZmpLd9tsD6u+5W X-Received: by 2002:a05:6a21:3388:b0:126:1580:36e6 with SMTP id yy8-20020a056a21338800b00126158036e6mr272783pzb.29.1687527641142; Fri, 23 Jun 2023 06:40:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687527641; cv=pass; d=google.com; s=arc-20160816; b=W+Er3LdbJmZiaJmqbOibwMyDv7hbtpgZbW4vlfDMtUCm/4hkpq3v4NC4V5KrLeWL5A Zv11xvMNs1VEoRBAHAImmLSywFCdV+YD9yRFYCRpc6P4OwVG0lEeCDPVr0GdOHnJ7tD8 MbNP5qTtSEpHUhkOA0O5mTxZAk++7gYmEtgySLkIizBzq5ZODMmGJVJYCy8Mpmjtlhqm uy4wPPyizSsudzN4Qdrd0hynlzLXx14Si3rSvBbFftsnkzRUWzq9FqD2/2DmW1cmu7SO yVE/Waj6GTxYRpfwa0zcuQ4hDpa+IJgH278VSMJNKTJEgt7a5Hc3Y9I/R7+LqqTdBt8z 7BUA== 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=8W/+hPePb88MefYVDijPUcEoewwsqtRPAn5mtFXRx3s=; b=Jj9d2/fW7F6Ly/n7BCW45hFEuayTlNQ1Oq8D9hhbJVYzLHLJ7QmkYduIG7R7frT4jd z9Fe2nmX3r9HlZwhAIL1DkRI6pc6wZA16aXyzvJH7TQAJ71FVfIiyfbkE07dQPxx/wdE Og3F5T6cPtaucGjdyjw35DCPhS/W7zHrcpLjG2wVaVFw2GPUHzuirKWhoDagu1vbA1tL mB/qk1MZlcNUBQ6kyxOD0TV2mO0FbtBLe/fv1CE1W7hPxsAhwl9PynQ6j/K1BfDhzJvp 2IbCV2sHBnz7cgc5HKVsEt9MH0FgrIOax8qFKiKAbfeqf3bXIF50JNbDYUWHY8tAVZ3+ llvw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=fKf8PO4W; 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 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d3-20020a170903230300b001b6788a54f4si2327884plh.191.2023.06.23.06.40.25; Fri, 23 Jun 2023 06:40:41 -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=@Nvidia.com header.s=selector2 header.b=fKf8PO4W; 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 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231433AbjFWN0N (ORCPT + 99 others); Fri, 23 Jun 2023 09:26:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbjFWN0L (ORCPT ); Fri, 23 Jun 2023 09:26:11 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2065.outbound.protection.outlook.com [40.107.212.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 142CB19AF; Fri, 23 Jun 2023 06:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TtDg7AKY6Yh2jenXSssbkRS8SjVolbuxLB3B2WLSI8qhx0qCBGhPLNw0ZErNfoxymspV8yMh+iE3b66B7WQYeKR/QWWQdOfDAii7RKT9z+rgTXB7/qtUN8GN+IZ0qc3MOXwXch3VMQksqOaPu/ft2iCQLocn5vIXBItuD0VcTJjrpte5telD7lr7EglZd078inryvib2B2PoK4xfeD1fjZSUYV1FQcLUPkeuWgXFazFs/a2aYR4IpX+yPXJxlBEtLX4TPEsdKVnbmFrd6d6aDFAhzsFCvpxngej0K8OJ4kwN+YK0KIlfftzlFpSRbvDfhvtrD8SgCIglpXpAAW1uYg== 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=8W/+hPePb88MefYVDijPUcEoewwsqtRPAn5mtFXRx3s=; b=ZHzSl0lbQ9qRDYfrhlzGtKVZ4nfVAjY9MtFv1NB2JphZErwLPjkE5z2FzZkLBEIf/yF+2xOWsEvd54f0kWV1xiJa+jAS6WBoHLRDljrCOXV+yyhOLE1arL7Hpz4MHrgyWud3LY7WNWxEMDaXgaQIKpUcQkfALnhrPASrKd5wvZhHUxSYC17y/5Hvxmv3FoBWzjeMGMV5EpiVuz0Cj52mLr+bRUm+zGTSTPnwkwueTzjEizZz6F+qCEuusFmfsyiAeBnXGqzXJRg/M+wyT+8s7BXZOKQ2Y4WJ8rJt7OWNzx8YeS+++j2KlTtOqx2IUrigQ/NQ5Or8XEWR3qLAdnMBTg== 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=8W/+hPePb88MefYVDijPUcEoewwsqtRPAn5mtFXRx3s=; b=fKf8PO4WtLVvsr4uDkd8GR5CA34optM20NBTypNFUUCNF4OoBRk/sqxq4CKBHaIm9bGsqjGuJ0N/ubNC56TUKGHpBu0BD3FISutEe04uEF1aBplJrFq2/eo2GNcMJa0rg1WTZ1rUO8MjwvN8Unnc4HOwe579LKIjelFKAlTMruGgVAAQfQG6yTem+zqGUC0CcNtrevDYKSxHpH0sKfAckmSY6/UBtOgVKwc+vEQvQi7cKxZ1eIBWM4YedleN7m9oXGp7fUqbwZ/dVQptNDmOsNW2wZtD889aQi2z2EEbDRhtgB+v6q1m5pqGS7V1uXzhb7apfK8cMyIdeAeXKg2vPw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by DM6PR12MB4861.namprd12.prod.outlook.com (2603:10b6:5:1bd::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Fri, 23 Jun 2023 13:26:08 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab%7]) with mapi id 15.20.6521.024; Fri, 23 Jun 2023 13:26:07 +0000 Date: Fri, 23 Jun 2023 10:26:05 -0300 From: Jason Gunthorpe To: ankita@nvidia.com Cc: alex.williamson@redhat.com, aniketa@nvidia.com, cjia@nvidia.com, kwankhede@nvidia.com, targupta@nvidia.com, vsethi@nvidia.com, acurrid@nvidia.com, apopple@nvidia.com, jhubbard@nvidia.com, danw@nvidia.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 1/1] vfio/nvgpu: Add vfio pci variant module for grace hopper Message-ID: References: <20230622030720.19652-1-ankita@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230622030720.19652-1-ankita@nvidia.com> X-ClientProxiedBy: YT4PR01CA0199.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:ad::23) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|DM6PR12MB4861:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a24ac50-9f3c-41ed-4f6c-08db73ed671b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /sotJRuOo86wRWWHSmRj60asIC5+3Q+g19Vse0vrsao5nwQYuKQS2S1ERq0biEOhp8+rYak5jXEPurxNzkDeEfbDUCuQeupKvAMO3YPufH+tU/ymZkR6+R4YRdybqt17fd1sA9LR1jAXEeUvxU5ajnjqa9tUMbtFV+b/s+v7SM+VqfbZyeBOG3bDod9gvL4B/j4y7CJpuBgYdLSrHn6xJTh78jMUAoC/NOX6D5sCsRC/I4nng1G9wwpzmwFq4HOEKKbtYmljjxh4U0yknA2s4UARDokeInUi8trXPBXW1NesyNcfZZdTjDSNCTrvS9K7W7urp2Vh5fhf11dlmNjdRVS9MVneRsqqjWrvzbGuS4nE+TSDtV8ykv7m7nkpP78DErv3lPLgMPXpwa3QlFlaZZDODJiV3YujqABtK0Uo/O7EpTq233CvPFarP8P892L9+wO36vD+PiM5Zv9NXhgft/G0AnkO1KErT1x9iqmbIGDZ4nEvXvs68t99zuJlpJExtAs5uxKSVXSv7qUi9z0fP14pHOoDI4aNVZAMP6wHCIaqb+fegyvUv+2EUu8Tvip8YeZPp1BzL/pWdtlnpZraPsD7LGhxmYjGRIHE6maJC+Y= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(136003)(39860400002)(376002)(366004)(451199021)(37006003)(6636002)(478600001)(4326008)(83380400001)(86362001)(36756003)(2616005)(38100700002)(4744005)(2906002)(6512007)(26005)(186003)(6486002)(6506007)(41300700001)(8676002)(66476007)(66946007)(8936002)(66556008)(34206002)(316002)(5660300002)(67856001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Qu71bGoB3pn+Fhp9dJYED/zK7bfA1WiWJlfqetxwO8ZPaDOhBdRWxvlf4XVa?= =?us-ascii?Q?RKY1aCz9IYcsi+VH5A2jDRFHh8Er83zXUBuUUDMSbRLdDto8L947H96jNmCx?= =?us-ascii?Q?8Dk3kFv1wCF5O1U4qcHn2GsPbz28MkjH388Y/PhzKgmL0OfUU8NxsrTK89KF?= =?us-ascii?Q?tpcIrTYbOxLNWUt3fioBxKpbZ29Ww7Q8nXtyEOxz96x3zueIq0xeZ2qdlzKc?= =?us-ascii?Q?bCFhx4djpFfFTK3vAmYHC+EKyHIwoGE3RDIA9e4PfUvbepZ6VBUNtmTNxdgC?= =?us-ascii?Q?TNEmvN4RuCUfORPcunzRW/B+24FjxohAedozUTjwhEaIgOCpf9zPCaeHZYO2?= =?us-ascii?Q?hav/WgPv/62Ld/Gd3dYPjLHlCXskVqhVTVKRDPuTok8GULZ8iwT9OYDL0vF5?= =?us-ascii?Q?IP8FEzUKOUqYBwFAN2oB/h3A7lV2cfJU0/ku/Jz0woM63DBL0X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iHZI7zhoYGFemecVr4kb+VXmJGKY5jMmI67?= =?us-ascii?Q?0GOGimg6xhRUFgvT/+xpdPUZvi5GPZtVxsO1fSuZt0ygn3Ozu39XOMgid/za?= =?us-ascii?Q?Kb+JEGoruqYzkdvDzaBRN0EAiC6RrZew+djI24/qm3PIE8y0PLjyArMJZHoO?= =?us-ascii?Q?k2oljBG8X63eR0BppR9EqYaPN+dT14Ps007F7MKyCJUWFT+TVnmpaShoDzIL?= =?us-ascii?Q?sm5nkp3bbRSuYHxRcEt9QXPY9aPl44GbDDIA49f2?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a24ac50-9f3c-41ed-4f6c-08db73ed671b X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2023 13:26:07.9042 (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: Btn8GwtvZgDEtY1RQebv0Qal8hEYMDUmO6YzKD0sw/XyH5V+wGDTSObJh6dam7ZE X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4861 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_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Wed, Jun 21, 2023 at 08:07:20PM -0700, ankita@nvidia.com wrote: > + if (caps.size) { > + info.flags |= VFIO_REGION_INFO_FLAG_CAPS; > + if (info.argsz < sizeof(info) + caps.size) { > + info.argsz = sizeof(info) + caps.size; > + info.cap_offset = 0; Shouldn't this be an error if we can't fit the caps into the response? Silently discarding the caps seems wrong.. > +static ssize_t nvgpu_vfio_pci_read(struct vfio_device *core_vdev, > + char __user *buf, size_t count, loff_t *ppos) > +{ > + unsigned int index = VFIO_PCI_OFFSET_TO_INDEX(*ppos); > + > + /* > + * Only the device memory present on the hardware is mapped, which may > + * not be power-of-2 aligned. A read to the BAR2 region implies an > + * access outside the available device memory on the hardware. > + */ > + if (index == VFIO_PCI_BAR2_REGION_INDEX) > + return -EINVAL; What does the qemu do in this case? Crash the VM? Jason