Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1927854rda; Tue, 24 Oct 2023 07:30:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG8hI6zI9b136IpJqiO0F4UgfDaauH289UcyEwW1c0L1h/Aw+deKZY8AWAbbUdQSF3PQm+1 X-Received: by 2002:a05:6359:1902:b0:168:eb8a:7db with SMTP id mf2-20020a056359190200b00168eb8a07dbmr5731380rwb.32.1698157799884; Tue, 24 Oct 2023 07:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698157799; cv=none; d=google.com; s=arc-20160816; b=Cg6C8isrl0LQm6DPdEYatYUYmSxtwIi7QtrmPPV5EUxQkH/TR2gsOkiz2iFxfdAAbd y4lmfM2eZ1A/TRH2iHU2fSB/evfIW3CXemiwIj/8Bl/GMBV0i+FDyZbP813l8BblQwu2 NgKdMDJKXt4C5IO5oy6CFPdpSDpfmxCKpRgxWFBlKwOn3ov1gUUXKhZLnOBcWZe1VGFB QLVqqkUwljarj2/CEm48E9Fduaz1z3sOp0bSLOHuu85rwhbG0716GyUxveShkzOZ2wJW kfCMSRd2UCa2BEokwDoVmoLXG8pNZp0nath9ay8z9p6K/gorxAvqhoiwQAsruXFPzjUZ XMTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=SdQMnez5jsVqyd2k1Qq2RfvliqO19PHfA3+OAlVzE/o=; fh=RuDaKoiKVSZuEyq7VgDNZFBXOiCcEenUqykOa8MrxYI=; b=Qf+WyAvF4L8YOdLYuU7C1x3S7jbQrWQ3OO1NVt/M33eCUe24EbqLLfU7loLLNYsuJ6 YCrEMRRyn99mqMkQHxIk35mLRAauk/M3kHemrjfk3fXg8jwUYxKtVwXyRFJKGAwjv4zr SMufqEA8JlqNG4+KJIZR4iz/PCo6JaIwFTmSG0rY1+f9T5mOUetZMkKmhgtEacNH757j FFahytWCNdTEMi6iWX/yPZnrUb6Gj6XZJDGB6QQt9NvLRI5fPLlICf+YBEOCM8x9GdVw 39zwrRpGF+XFfNfdxB5KBgORB7Ze7P8F8N7v7iRIqv1M4qROmE3FOc4urR70Nwf+K0E9 svJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y+CrKZcs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id i5-20020a633c45000000b005ab1f1ef721si8462220pgn.888.2023.10.24.07.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:29:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y+CrKZcs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 63BBC802DCF5; Tue, 24 Oct 2023 07:29:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343524AbjJXO3w (ORCPT + 99 others); Tue, 24 Oct 2023 10:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234717AbjJXO3u (ORCPT ); Tue, 24 Oct 2023 10:29:50 -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 74A498F for ; Tue, 24 Oct 2023 07:29:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698157744; 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=SdQMnez5jsVqyd2k1Qq2RfvliqO19PHfA3+OAlVzE/o=; b=Y+CrKZcsLpDT+VroVH30mJtjG+/K58YwA3HlBEEUHWcuELJjlyzoWLok3CYNLOz2zwdEuj n6E48+BIcc8JjzmDjR1tkhlv5s6V15HnlRzdioto6lAoSZXYFhB1KvZEHQtJphZoLg8291 QD75mesdl/aNxB1FMOc/VDEx+apmQiE= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-328-fzVPKXqTOK-vX1jnPZW9Rg-1; Tue, 24 Oct 2023 10:29:00 -0400 X-MC-Unique: fzVPKXqTOK-vX1jnPZW9Rg-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-7834a155749so500276539f.0 for ; Tue, 24 Oct 2023 07:28:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698157737; x=1698762537; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SdQMnez5jsVqyd2k1Qq2RfvliqO19PHfA3+OAlVzE/o=; b=Y9Gd5BZ6czol9KgMwWg+L/7Fzjc102oy4itHxDQVYntE0Pa+YrfXTUrRjg55XXSIvf Iz7erKl4TsAIN2UlNZEIl0TB5DuSnrWTzRNT7q0/yiHssYpT/DqUMoy8v+f7yqeNnM2U xLJ94ZuEA7zcYUxc0bFOsR7pBDEejiZa9lfGNIzZloPmlgmO+rNashdwgelbIWdJs2nl QwWhdTG1u1m2qw0dRb8XK6bSk3MVaVut+rfpRLwSOY1X6x2rpg+HA2UAnUDUKTryJzyh 0bohgrn/AtLzOLJcMXMjHpsGfo0z/X5yOf2wLJ8bb5l+9QVYplBv9iWn5wJ3M/PKTbjn Fjig== X-Gm-Message-State: AOJu0YxTzsZAnW/vtNesUAbiZ5ayNU2ZEuSeqYWoFS7mGOnYu8G36Sfi GBhjdavgPxN4vP2JmnVAl89fq1vgPjKE/qIC/VWcGMQCafVHb//DJ9fTk4Rk6M68F6rGA+8Pc20 Te+pywcEd3txj+PxGfV1BHTgc X-Received: by 2002:a05:6602:1351:b0:791:16ba:d764 with SMTP id i17-20020a056602135100b0079116bad764mr15985598iov.16.1698157737324; Tue, 24 Oct 2023 07:28:57 -0700 (PDT) X-Received: by 2002:a05:6602:1351:b0:791:16ba:d764 with SMTP id i17-20020a056602135100b0079116bad764mr15985570iov.16.1698157737057; Tue, 24 Oct 2023 07:28:57 -0700 (PDT) Received: from redhat.com ([38.15.60.12]) by smtp.gmail.com with ESMTPSA id a19-20020a02ac13000000b00459d7c3dcf3sm2822147jao.115.2023.10.24.07.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:28:56 -0700 (PDT) Date: Tue, 24 Oct 2023 08:28:54 -0600 From: Alex Williamson To: Ankit Agrawal Cc: Jason Gunthorpe , Yishai Hadas , "shameerali.kolothum.thodi@huawei.com" , "kevin.tian@intel.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 Message-ID: <20231024082854.0b767d74.alex.williamson@redhat.com> In-Reply-To: References: <20231015163047.20391-1-ankita@nvidia.com> <20231017165437.69a84f0c.alex.williamson@redhat.com> <20231023084312.15b8e37e.alex.williamson@redhat.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.35; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Tue, 24 Oct 2023 07:29:57 -0700 (PDT) On Tue, 24 Oct 2023 14:03:25 +0000 Ankit Agrawal wrote: > >> > After looking at Yishai's virtio-vfio-pci driver where BAR0 is emula= ted > >> > as an IO Port BAR, it occurs to me that there's no config space > >> > emulation of BAR2 (or BAR3) here.=C2=A0 Doesn't this mean that QEMU = registers > >> > the BAR as 32-bit, non-prefetchable?=C2=A0 ie. VFIOBAR.type & .mem64= are > >> > wrong? =20 > >> > >> Maybe I didn't understand the question, but the PCI config space read/= write > >> would still be handled by vfio_pci_core_read/write() which returns the > >> appropriate flags. I have checked that the device BARs are 64b and > >> prefetchable in the VM. =20 > > > > vfio_pci_core_read/write() accesses the physical device, which doesn't > > implement BAR2.=C2=A0 Why would an unimplemented BAR2 on the physical d= evice > > report 64-bit, prefetchable? > > > > QEMU records VFIOBAR.type and .mem64 from reading the BAR register in > > vfio_bar_prepare() and passes this type to pci_register_bar() in > > vfio_bar_register().=C2=A0 Without an implementation of a config space = read > > op in the variant driver and with no physical implementation of BAR2 on > > the device, I don't see how we get correct values in these fields. =20 >=20 > I think I see the cause of confusion. There are real PCIe compliant BARs > present on the device, just that it isn't being used once the C2C > interconnect is active. The BARs are 64b prefetchable. Here it the lspci > snippet of the device on the host. > # lspci -v -s 9:1:0.0 > 0009:01:00.0 3D controller: NVIDIA Corporation Device 2342 (rev a1) > Subsystem: NVIDIA Corporation Device 16eb > Physical Slot: 0-5 > Flags: bus master, fast devsel, latency 0, IRQ 263, NUMA node 0, = IOMMU group 19 > Memory at 661002000000 (64-bit, prefetchable) [size=3D16M] > Memory at 662000000000 (64-bit, prefetchable) [size=3D128G] > Memory at 661000000000 (64-bit, prefetchable) [size=3D32M] >=20 > I suppose this answers the BAR sizing question as well? Does this BAR2 size match the size we're reporting for the region? Now I'm confused why we need to intercept the BAR2 region info if there's physically a real BAR behind it. Thanks, Alex