Skip to content

Commit 3f4d8aa

Browse files
committed
nouveau: add an ioctl to return vram bar size.
This returns the BAR resources size so userspace can make decisions based on rebar support. userspace using this has been proposed for nvk, but it's a rather trivial uapi addition. Reviewed-by: Faith Ekstrand <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
1 parent 1d49294 commit 3f4d8aa

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

drivers/gpu/drm/nouveau/nouveau_abi16.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
199199
struct nouveau_cli *cli = nouveau_cli(file_priv);
200200
struct nouveau_drm *drm = nouveau_drm(dev);
201201
struct nvif_device *device = &drm->client.device;
202+
struct nvkm_device *nvkm_device = nvxx_device(&drm->client.device);
202203
struct nvkm_gr *gr = nvxx_gr(device);
203204
struct drm_nouveau_getparam *getparam = data;
204205
struct pci_dev *pdev = to_pci_dev(dev->dev);
@@ -263,6 +264,9 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
263264
getparam->value = nouveau_exec_push_max_from_ib_max(ib_max);
264265
break;
265266
}
267+
case NOUVEAU_GETPARAM_VRAM_BAR_SIZE:
268+
getparam->value = nvkm_device->func->resource_size(nvkm_device, 1);
269+
break;
266270
default:
267271
NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);
268272
return -EINVAL;

include/uapi/drm/nouveau_drm.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ extern "C" {
5454
*/
5555
#define NOUVEAU_GETPARAM_EXEC_PUSH_MAX 17
5656

57+
/*
58+
* NOUVEAU_GETPARAM_VRAM_BAR_SIZE - query bar size
59+
*
60+
* Query the VRAM BAR size.
61+
*/
62+
#define NOUVEAU_GETPARAM_VRAM_BAR_SIZE 18
63+
5764
struct drm_nouveau_getparam {
5865
__u64 param;
5966
__u64 value;

0 commit comments

Comments
 (0)