Skip to content

Commit 2cc5eda

Browse files
ankita-nvnirmoy
authored andcommitted
NVIDIA: SAUCE: vfio/nvgrace-egm: expose the egm size through sysfs
To allocate the EGM, the userspace need to know it's size. Currently, there is no easy way for the userspace to determine that. Make nvgrace-egm expose the size through sysfs that can be queried by the userspace from /sys/devices/virtual/egm/egmX/egm_size. Signed-off-by: Ankit Agrawal <ankita@nvidia.com> Ref: sj24: /home/nvidia/ankita/kernel_patches/0003_vfio_nvgrace-egm_expose_the_egm_size_through_sysfs.patch Signed-off-by: Koba Ko <kobak@nvidia.com> Acked-by: Matthew R. Ochs <mochs@nvidia.com> Acked-by: Carol L. Soto <csoto@nvidia.com> Signed-off-by: Matthew R. Ochs <mochs@nvidia.com> (cherry picked from commit dcdcef2 https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-adv-6.11-next) Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
1 parent 68132df commit 2cc5eda

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

  • drivers/vfio/pci/nvgrace-gpu

drivers/vfio/pci/nvgrace-gpu/egm.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,19 @@ static ssize_t gpu_devices_show(struct device *dev, struct device_attribute *att
380380

381381
static DEVICE_ATTR_RO(gpu_devices);
382382

383+
static ssize_t egm_size_show(struct device *dev, struct device_attribute *attr,
384+
char *buf)
385+
{
386+
struct egm_region *region =
387+
container_of(dev, struct egm_region, device);
388+
return sysfs_emit(buf, "0x%lx\n", region->egmlength);
389+
}
390+
391+
static DEVICE_ATTR_RO(egm_size);
392+
383393
static struct attribute *attrs[] = {
384394
&dev_attr_gpu_devices.attr,
395+
&dev_attr_egm_size.attr,
385396
NULL,
386397
};
387398

0 commit comments

Comments
 (0)