Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3274132pxb; Mon, 9 Nov 2020 07:07:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6Ni0x3/HY/W/bI48NJvvdyBnHy4m2ac9F5J9M0Zj6/mxSTwZ9vqI90l+Vb3xnnqDoypC8 X-Received: by 2002:a17:906:c20f:: with SMTP id d15mr15264874ejz.341.1604934462582; Mon, 09 Nov 2020 07:07:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604934462; cv=none; d=google.com; s=arc-20160816; b=OovErfiZ1bcKSoBvSFuw7aOTVwSdtdQCxIAo7oVVAwGKtkGeUyIiF6xhRGRf/I0Njt sc9gyo7zfA9wUy9HiugxiwfAFbg006yGu94m479FrkpHc3QKlEl3zVHkbv/a/d9UGB6A Zw9+AbIsl3q4Nh/BBh567SnH+HkgfOQXbo/r8YsLKKvzxTLnGTM+z0r4x5jARCOTNdrB jb2XmPNcD1xi2AKrlIp3v/eI2L20sAiPiFwV7zZJCceWWed+POdjdIdDZetDbouwUFyQ NUCYCvukA8nwZ7UYE+MC7i53a9pDDWoNOxWuk+RAFzzodHnPqSuEJ7yt6yTjecwFyI+E Kmiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=p25LYLFCQk+jcRTNmaHi2zNxBTYwLVU2zqlpwZb4QTM=; b=mlR3SIxa14JzYFWd+pH4/pBalGoJ6xoUafa3DKcGX1soO+l4UVOQM7zhCh6CvLvZd0 eI2GR9IKrgCfoflc5F/xUn45xm6htbj7w02gE1BUi4VCxbA9ORwhHCj7clselH3aF5y1 bg7T8H23uOV+auDl8Z5TfROWsK7q10YxiA8OO3pCfmRt4m+s/GJOTWsPpHBGk+afaidO KISBip0sPH7Z8grESTH8u9OQDdN+2Oz0JnhY3Agn2HEKCoDVoOOLgJB/axfno+KCy7qe xWlzNdZEtU+Y0tJRU2sWGhNIElhsPW+O50gCt/r7c9+x58A1kKXOTdUG9ok6yCqcR0DB 0/7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UtPuiqRO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si7109682ejy.148.2020.11.09.07.07.18; Mon, 09 Nov 2020 07:07:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UtPuiqRO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730405AbgKIPDa (ORCPT + 99 others); Mon, 9 Nov 2020 10:03:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:34472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729661AbgKIPDa (ORCPT ); Mon, 9 Nov 2020 10:03:30 -0500 Received: from dhcp-10-100-145-180.wdc.com (unknown [199.255.45.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D39D2083B; Mon, 9 Nov 2020 15:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604934209; bh=r+Ft2tymmH5NpLInpLBcaHHGbXBmIxUIIoWZRRKi3Ns=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UtPuiqROcd/6G01mEcpCI4ZkuoLNoh/cHEoW1pWvWnXrcS9oX6qi25orcEe/HD6gQ /2y+a50beBfImRzQnG4uTWBnNextYf4nu2KfFLXSU6AOTbMFpSso49pl+Bj1AlzYpM TKyuOwfpDhx5CeUMmKig1ylwMR32SikIaTFabfbU= Date: Mon, 9 Nov 2020 07:03:26 -0800 From: Keith Busch To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Stephen Bates , Christoph Hellwig , Dan Williams , Jason Gunthorpe , Christian =?iso-8859-1?Q?K=F6nig?= , Ira Weiny , John Hubbard , Don Dutile , Matthew Wilcox , Daniel Vetter Subject: Re: [RFC PATCH 15/15] nvme-pci: Allow mmaping the CMB in userspace Message-ID: <20201109150326.GA2221592@dhcp-10-100-145-180.wdc.com> References: <20201106170036.18713-1-logang@deltatee.com> <20201106170036.18713-16-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201106170036.18713-16-logang@deltatee.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 06, 2020 at 10:00:36AM -0700, Logan Gunthorpe wrote: > Allow userspace to obtain CMB memory by mmaping the controller's > char device. The mmap call allocates and returns a hunk of CMB memory, > (the offset is ignored) so userspace does not have control over the > address within the CMB. > > A VMA allocated in this way will only be usable by drivers that set > FOLL_PCI_P2PDMA when calling GUP. And inter-device support will be > checked the first time the pages are mapped for DMA. > > Currently this is only supported by O_DIRECT to an PCI NVMe device > or through the NVMe passthrough IOCTL. Rather than make this be specific to nvme, could pci p2pdma create an mmap'able file for any resource registered with it?