Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp881446rwl; Wed, 12 Apr 2023 05:34:23 -0700 (PDT) X-Google-Smtp-Source: AKy350ZpSaw0kQdqx/QIEJChYWju0KlnbrcFBlzg3LeoZlDNoCbWsNSaNiW+MzrnFTRweoEXOgAJ X-Received: by 2002:a62:1952:0:b0:62d:c382:1384 with SMTP id 79-20020a621952000000b0062dc3821384mr3426185pfz.5.1681302863315; Wed, 12 Apr 2023 05:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681302863; cv=none; d=google.com; s=arc-20160816; b=tnfLTrdPNWMgBHLWXU5sScNdnEhhalcSdIcNo0EjcLtCffq4yFI0CjMIKUmZGKTQws N/Xpykof/GTndOadca6PDy6sUwJ6/BzrDjn7HoWqpObdsWa0mvHRaWcQB66Nsa6YwT1R ieayuBUSXf9ZHkxjdVcvC0FBJfyuSY8VFv3RbBsYIoDuPD+3jYaL/cKLW9lX5AVVzT/V twi6DDIxfayKxkQ9ZTHlt16YGYVGh0uUGjLgrVi3TWwbOfJo2AxZhmfo/ztb2MHBomJg ZLSstBaFrOYctezQxE5wFNfG2ApllcXWEq1jAKdDAv1+pxkHn9VB1cTYFQ8GHUw1DwlB F2Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=mlxm1AajJpAnXSJdhFgSvMQ+1gIA4yVtwMmFnWpqwwg=; b=ieOpYJzHil69Yt5AX5IjAIwq7eONYw0eeVR+hwHulfbYCJxRsWakBeNYorkD32N4je O8jMeym2RPJZWNGb7QYSNTAuBKae0z05cqlKRFqU6Pc/U3s/p1XkwOvyfqecTvYMSBUc WXZcaqk9PFJzRqLPDSUwOcUURDtMhQe0JF7YV6g6h5Qr7SAMJi4xgetALqktbP/uGEI8 Cus+CeNANeoI18KMxpHIPFELlc6EMz11Ibza48NW9rDvnvn0xE6rRmT5dxLlncPJvMxD Hwj6QTgPYvbDTmrrBL4UxlRO5NTGUMa5IJGEt1Rtd5w48eDaUuNA2VR+FuSNXUdNHVJa 7hnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z5Iteany; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020aa79e8b000000b0062e024b49c2si15739185pfq.152.2023.04.12.05.34.11; Wed, 12 Apr 2023 05:34:23 -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=@kernel.org header.s=k20201202 header.b=Z5Iteany; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229634AbjDLM2n (ORCPT + 99 others); Wed, 12 Apr 2023 08:28:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230038AbjDLM2R (ORCPT ); Wed, 12 Apr 2023 08:28:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1C7F7A9B; Wed, 12 Apr 2023 05:28:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3A51E6321F; Wed, 12 Apr 2023 12:28:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AFD2C4339B; Wed, 12 Apr 2023 12:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681302491; bh=6FoH81ZoljOnwwsVDKczs8ze1AD1h4N7YdQq49DUJCI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Z5IteanyktRgqXMBi2ojlqQXm8aO8qY7wuKa+kxHoEdUI1Pv9v2nMdYQmddGty2oP +kzfgwhsEDdamBBntfgPzpUuvQetCM6y5bYI5SBFZRf2EOuvI5y6dOPFm3Q8EbbcPi UoVKdcc08m7tw6v0HicScjoBxoZ8lMFZTyiE5t4o2vNgk4S2SaFRkDji8JZ/Jx75eN rOSw5e+BYDUBg2JSz+lv+Jcb0vFkeICU9BKzr7dOzNrQgRpLyBMNfGrq7FdLYIwamI AOyrFmM9wzyKCo4TKDfpuAi8AtM8tDq7/x48T7k02VPExTTHCbndcSrjI2FnTEQ9Cg aIfjWNIYYuC3Q== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pmZa5-007pOX-7J; Wed, 12 Apr 2023 13:28:09 +0100 Date: Wed, 12 Apr 2023 13:28:08 +0100 Message-ID: <86sfd5l1yf.wl-maz@kernel.org> From: Marc Zyngier To: Cc: , , , , , , , , , , , , , , , , Subject: Re: [PATCH v3 0/6] Expose GPU memory as coherently CPU accessible In-Reply-To: <20230405180134.16932-1-ankita@nvidia.com> References: <20230405180134.16932-1-ankita@nvidia.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: ankita@nvidia.com, jgg@nvidia.com, alex.williamson@redhat.com, naoya.horiguchi@nec.com, oliver.upton@linux.dev, 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, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 Wed, 05 Apr 2023 19:01:28 +0100, wrote: > > From: Ankit Agrawal > > NVIDIA's upcoming Grace Hopper Superchip provides a PCI-like device > for the on-chip GPU that is the logical OS representation of the > internal propritary cache coherent interconnect. > > This representation has a number of limitations compared to a real PCI > device, in particular, it does not model the coherent GPU memory > aperture as a PCI config space BAR, and PCI doesn't know anything > about cacheable memory types. > > Provide a VFIO PCI variant driver that adapts the unique PCI > representation into a more standard PCI representation facing > userspace. The GPU memory aperture is obtained from ACPI, according to > the FW specification, and exported to userspace as the VFIO_REGION > that covers the first PCI BAR. qemu will naturally generate a PCI > device in the VM where the cacheable aperture is reported in BAR1. > > Since this memory region is actually cache coherent with the CPU, the > VFIO variant driver will mmap it into VMA using a cacheable mapping. > > As this is the first time an ARM environment has placed cacheable > non-struct page backed memory (eg from remap_pfn_range) into a KVM > page table, fix a bug in ARM KVM where it does not copy the cacheable > memory attributes from non-struct page backed PTEs to ensure the guest > also gets a cacheable mapping. This is not a bug, but a conscious design decision. As you pointed out above, nothing needed this until now, and a device mapping is the only safe thing to do as we know exactly *nothing* about the memory that gets mapped. M. -- Without deviation from the norm, progress is not possible.