Commit 3f4d8aac authored by Dave Airlie's avatar Dave Airlie
Browse files

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: default avatarFaith Ekstrand <faith.ekstrand@collabora.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 1d492944
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -199,6 +199,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
	struct nouveau_cli *cli = nouveau_cli(file_priv);
	struct nouveau_drm *drm = nouveau_drm(dev);
	struct nvif_device *device = &drm->client.device;
	struct nvkm_device *nvkm_device = nvxx_device(&drm->client.device);
	struct nvkm_gr *gr = nvxx_gr(device);
	struct drm_nouveau_getparam *getparam = data;
	struct pci_dev *pdev = to_pci_dev(dev->dev);
@@ -263,6 +264,9 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
		getparam->value = nouveau_exec_push_max_from_ib_max(ib_max);
		break;
	}
	case NOUVEAU_GETPARAM_VRAM_BAR_SIZE:
		getparam->value = nvkm_device->func->resource_size(nvkm_device, 1);
		break;
	default:
		NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);
		return -EINVAL;
+7 −0
Original line number Diff line number Diff line
@@ -54,6 +54,13 @@ extern "C" {
 */
#define NOUVEAU_GETPARAM_EXEC_PUSH_MAX   17

/*
 * NOUVEAU_GETPARAM_VRAM_BAR_SIZE - query bar size
 *
 * Query the VRAM BAR size.
 */
#define NOUVEAU_GETPARAM_VRAM_BAR_SIZE 18

struct drm_nouveau_getparam {
	__u64 param;
	__u64 value;