summaryrefslogtreecommitdiffstats
path: root/kernel/include
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/ioctl.h2
-rw-r--r--kernel/include/nvidia-vgpu-vfio.h12
2 files changed, 14 insertions, 0 deletions
diff --git a/kernel/include/ioctl.h b/kernel/include/ioctl.h
index 36d28ac..58fea37 100644
--- a/kernel/include/ioctl.h
+++ b/kernel/include/ioctl.h
@@ -42,6 +42,7 @@ struct nv_vgpu_type_info {
u64 vdev_id;
u64 pdev_id;
u32 max_instances;
+ u32 vram_mb; /* emulated framebuffer size; 0 = 512 MiB default */
};
struct nv_vgpu_ioctl_get_info {
@@ -111,6 +112,7 @@ struct nv_vgpu_ioctl_register_vgpu_type {
u64 vdev_id;
u64 pdev_id;
u32 max_instances;
+ u32 vram_mb;
};
int nv_vgpu_ioctl_get_info(struct nv_vgpu_device *vgpu, void __user *arg);
diff --git a/kernel/include/nvidia-vgpu-vfio.h b/kernel/include/nvidia-vgpu-vfio.h
index ccd7262..bed90a7 100644
--- a/kernel/include/nvidia-vgpu-vfio.h
+++ b/kernel/include/nvidia-vgpu-vfio.h
@@ -137,6 +137,11 @@ struct nv_vgpu_device {
u64 fb_base;
u64 fb_size;
+ /* Emulated framebuffer/vidmem size for this mdev, from its type's
+ * vram_mb (nv_vgpu_type_info); defaults to NV_VGPU_EMUL_FB_SIZE. All
+ * emulated-GSP consumers (GSCI fb_length/lb region/frtsOffset, WPR2,
+ * LOCAL_MEMORY_RANGE, vidmem allocator, BAR shadow) must agree. */
+ u64 fb_emul_size;
u64 bar0_config_base;
struct list_head list;
@@ -223,6 +228,13 @@ static inline struct nv_vgpu_device *mdev_to_vgpu(struct mdev_device *mdev)
return dev_get_drvdata(&mdev->dev);
}
+/* Per-mdev emulated framebuffer size in bytes (default 512 MiB). */
+static inline u64 nv_vgpu_fb_emul_size(const struct nv_vgpu_device *vgpu)
+{
+ return (vgpu && vgpu->fb_emul_size) ? vgpu->fb_emul_size :
+ NV_VGPU_EMUL_FB_SIZE;
+}
+
/* NULL-tolerant logging: emulation paths may run with a NULL vgpu
* (e.g. unit tests, early init) - fall back to plain pr_*. */
#define nv_vgpu_dbg(vgpu, fmt, ...) do { \