Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12450674rwd; Fri, 23 Jun 2023 06:22:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4lO2ZBi9t4N8Luh3drdhngBvMcI+DqxbG9aNpQF2yeROXUfQaXkDqvh0L5Bc6tQU3ynfmU X-Received: by 2002:a17:90a:ead2:b0:25e:b066:8084 with SMTP id ev18-20020a17090aead200b0025eb0668084mr13943355pjb.18.1687526571408; Fri, 23 Jun 2023 06:22:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687526571; cv=none; d=google.com; s=arc-20160816; b=fDIQcbWdGdaB+bfCihqNAsmKEvPdVpRzNCwBLyH3NR0GdVBB8XvlZ+u3MOX4AcJ5vb Z6g3VWcBa8bRAYq3QolNxZbpFqy2uMz2MPn9LPYPRvYwtDeuRKqLnEpf7wC/e9SO8ar4 J1RBny3b0eKe4/VlKki2Y31LzYYZb/Hv+F6OiiWLal1UiljFKhuPJc/rss+B1+9ph9ZP cozvKHonyxaOjKzS/Aj3UQyQ3jJcji0GbmPr/EMwLwgaTz0fPh70wpOtpTV0McxODWKd 96uH4SPChBs3Dq+R/ExMI3pWkJALGVteBui7owaxmuDqnF/eopMj7zBFZI/MvzZScKQ1 tARw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=E6jWWQrwh2hHtedtzxrNhDIjAs17Rbx7BLQgx2TQ9mc=; b=LhVBtwBEihzZn+D1Z1J4Es0k9b/VNvesSZ4djXynaYcPwsDWPhAizDTmldHIWiF+8L ch/cC74G6wrSAjrCSiESPKA59Ln2tuXLPOK+s3525sRxgzwW1j8Tlstj+RC3H+V1wurf 1rml4dt5ntIWdoC8fqCwXNDgdJCcxYHGt6DGdjTtI4XWSpWOxRDwud2LNxw+cARJ0rr9 aba0nvygpEoODQYiqtrIAlbMOhQBTFg9A02cGQyBsoIV0/INy2kK0kxvt5uYFlsWC2J/ GixvuaYgiBPHt/14Y/xViW5ZLA/HDedV9fbbwd+Tv7i2ZXi0rthcdQLJDzXDl6gxd+5j poXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VhZz1g8D; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bt27-20020a63291b000000b0054fe07d2f49si5194318pgb.657.2023.06.23.06.22.36; Fri, 23 Jun 2023 06:22:51 -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=@redhat.com header.s=mimecast20190719 header.b=VhZz1g8D; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231214AbjFWNFM (ORCPT + 99 others); Fri, 23 Jun 2023 09:05:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230242AbjFWNFM (ORCPT ); Fri, 23 Jun 2023 09:05:12 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27B9F1FF5 for ; Fri, 23 Jun 2023 06:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687525464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E6jWWQrwh2hHtedtzxrNhDIjAs17Rbx7BLQgx2TQ9mc=; b=VhZz1g8DoUztheVJkyNwStMKpOScXwxCOunKXpFdTEza69jAgKNd+kRUNN6fxCrYmcrasQ PExjbhuIt/zVEYUDaGSWcsf2UAoFlFQHblJtl8Y/Ev9jgO4hfuLX3uZdA5uhsZEO5X0PEA d3z6kYsoSwtLpnm9EZ7xM0+KHwDdIog= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-574-6-9b88BEMZuhV9AKFLN2vw-1; Fri, 23 Jun 2023 09:04:22 -0400 X-MC-Unique: 6-9b88BEMZuhV9AKFLN2vw-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-76548fab0b2so73143385a.1 for ; Fri, 23 Jun 2023 06:04:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687525461; x=1690117461; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=E6jWWQrwh2hHtedtzxrNhDIjAs17Rbx7BLQgx2TQ9mc=; b=g069KbODhWHbA6BP1xfjcti1HX6ZpW9pQ4pJNWLvr6pUdcJEUPV9benZsMVY693osm kLZbUp3MaAu8/zgoB0CE18lbH2914xOENzMuxoHfeSKqgQdp54v+VvQSQPlL6lBajyIP T+2YndXTrfNL7wboUilvYWx97VLeFoySarCmulgIFGPATcANgZX+yvebLKxxGzqXuG6X +FWhVhjoEDniFT/Xi6tiDUIqEt5UxvWfhXQGXxu8dht1W3+lJX7IDcvLSFCIH176N4QI MFWaZSDgkdVCpuuXdYMJBgD6z2b7A8i37O0tYbeuy8LdcYQO0DKLmRrPd85NyRnOWybR qVnw== X-Gm-Message-State: AC+VfDzIOP4wSPPW0H+IpPo0+9mR+7VzEHqM2W99tlQh9y6nOxiQCJ1a 585jdG+7Js7ausKh4fzSxlh7v6BlJShjAl0xX0hsV4y4u4mprRLLjlbDl9o07gFkWK5VDSEOYs7 1LYInMgQezYIs/3qDvdk0zTPC X-Received: by 2002:a05:620a:2a12:b0:765:4855:26db with SMTP id o18-20020a05620a2a1200b00765485526dbmr2333882qkp.10.1687525461490; Fri, 23 Jun 2023 06:04:21 -0700 (PDT) X-Received: by 2002:a05:620a:2a12:b0:765:4855:26db with SMTP id o18-20020a05620a2a1200b00765485526dbmr2333855qkp.10.1687525461253; Fri, 23 Jun 2023 06:04:21 -0700 (PDT) Received: from ?IPV6:2a01:e0a:280:24f0:576b:abc6:6396:ed4a? ([2a01:e0a:280:24f0:576b:abc6:6396:ed4a]) by smtp.gmail.com with ESMTPSA id bs14-20020ac86f0e000000b003f6b58b986fsm36489qtb.41.2023.06.23.06.04.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Jun 2023 06:04:20 -0700 (PDT) Message-ID: <62dcff6b-852d-4a85-dfd4-0ce1f324602e@redhat.com> Date: Fri, 23 Jun 2023 15:04:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v4 1/1] vfio/nvgpu: Add vfio pci variant module for grace hopper Content-Language: en-US To: Jason Gunthorpe Cc: ankita@nvidia.com, 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 References: <20230622030720.19652-1-ankita@nvidia.com> <46a79333-12f6-229f-86f9-1e79bdba7d11@redhat.com> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 6/23/23 13:47, Jason Gunthorpe wrote: > On Fri, Jun 23, 2023 at 08:27:17AM +0200, Cédric Le Goater wrote: >>> + req_len = vma->vm_end - vma->vm_start; >>> + pgoff = vma->vm_pgoff & >>> + ((1U << (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT)) - 1); >>> + if (pgoff >= (nvdev->mem_prop.mem_length >> PAGE_SHIFT)) >>> + return -EINVAL; >> >> you cound introduce accessor macros for nvdev->mem_prop.mem_length and >> nvdev->mem_prop.hpa > > Accessors are not the usual style.. I meant something like #define nvgpu_mem_size(nvdev) (nvdev)->mem_prop.mem_length #define nvgpu_mem_pa_base(nvdev) (nvdev)->mem_prop.hpa This is minor. > >>> +static const struct pci_device_id nvgpu_vfio_pci_table[] = { >>> + { PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_NVIDIA, 0x2342) }, >>> + { PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_NVIDIA, 0x2343) }, >>> + { PCI_DRIVER_OVERRIDE_DEVICE_VFIO(PCI_VENDOR_ID_NVIDIA, 0x2345) }, >> >> It would be good to add definitions for the PCI IDs. > > The common form these days is to have a comment with the marketing > name, we stopped putting constants for every device a while ago. OK then. Thanks, C.