From: Steven Newbury Subject: block device backed by DRM buffer object Date: Mon, 21 Sep 2015 12:33:06 +0100 Message-ID: <1442835186.12687.26.camel@snewbury.org.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0179265870==" Return-path: Received: from know-smtprelay-omc-11.server.virginmedia.net (know-smtprelay-omc-11.server.virginmedia.net [80.0.253.75]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E93A6E0AB for ; Mon, 21 Sep 2015 04:42:43 -0700 (PDT) Received: from artifact-4.local (artifact-4.local [192.168.75.106]) (authenticated bits=0) by mail.snewbury.org.uk (8.14.9/8.14.9) with ESMTP id t8LBXAZW029173 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO) for ; Mon, 21 Sep 2015 12:33:13 +0100 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0179265870== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-FJomOexeU9UpoQwtH7cD" --=-FJomOexeU9UpoQwtH7cD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I have a mostly* headless server containing a Radeon discrete GPU. =C2=A0It occured to me that having a GiB or two of high speed memory sitting unused is pretty wasteful. Not an original thought; indeed there's a Gentoo wiki which describes how to map the memory as a mtd device: =C2=A0 http://www.gentoo-wiki.info/TIP_Use_memory_on_video_card_as_swap There's also a driver (cudaram) written by Piotr Jaroszy=C5=84ski which allocates memory through CUDA and maps it to a block device: http://blog.piotrj.org/2011/03/cudaram-block-device-exposing-nvidia.htm l The Gentoo method is extremely limited, and of course isn't exactly safe, although using pci-stub would probably help. =C2=A0There's no arbitration between the DRM driver and the mtd phram driver. =C2=A0Most of all, it can only expose the memory mapped into the PCI aperture, likely somewhat less than the full VMEM. The second method obviously requires the proprietary NVidia driver and an NVidia gfx card, but it's good proof of concept at utilising a driver managed buffer object as a block device. I'm looking into creating a volatile block device driver which allocates VMEM from DRM, what if any is the right API to use? =C2=A0The DRM userspace API is well documented, but I'd like to make this a kernel module, so using a userspace API would seem inappropriate at best. =C2=A0Ideally I'd like to create something like the bcache flash_vol_create interface except expose a /sys/fs/drm-block/card0/vol_create (where drm-block is a placeholder for the proposed driver name) for each DRM device in the system, and likewise persistence through udev. So is there an API I can (mis-)use for this? =C2=A0Any suggestions? * There's a screen attached for maintainence, but it usually turned off. --=-FJomOexeU9UpoQwtH7cD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEABECAAYFAlX/6vkACgkQGcb56gMuC62kawCdFG0jCTNbZInqdt6WA3WNudKq Gz4AnR/I/3pktA3bcGkKCVZpPxeX20We =3BZU -----END PGP SIGNATURE----- --=-FJomOexeU9UpoQwtH7cD-- --===============0179265870== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9kcmktZGV2ZWwK --===============0179265870==--