summaryrefslogtreecommitdiffstats
path: root/drivers/misc/habanalabs/memory.c
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@gmail.com>2019-02-26 23:19:18 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-27 16:00:20 +0100
commit230afe74d139f37ba5e344ad4e53d65911d12188 (patch)
tree0102fcdc091178a3f2cafe94220bb2dab6cfdc3e /drivers/misc/habanalabs/memory.c
parentmic: vop: Allow building on more systems (diff)
downloadlinux-230afe74d139f37ba5e344ad4e53d65911d12188.tar.xz
linux-230afe74d139f37ba5e344ad4e53d65911d12188.zip
habanalabs: allow memory allocations larger than 4GB
This patch increase the size field in the uapi structure of the Memory IOCTL from 32-bit to 64-bit. This is to allow the user to allocate and/or map memory in chunks that are larger then 4GB. Goya's device memory (DRAM) can be up to 16GB, and for certain topologies, the user may want an allocation that is larger than 4GB. This change doesn't break current user-space because there was a "pad" field in the uapi structure right after the size field. Changing the size field to be 64-bit and removing the pad field maintains compatibility with current user-space. Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/habanalabs/memory.c')
-rw-r--r--drivers/misc/habanalabs/memory.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/misc/habanalabs/memory.c b/drivers/misc/habanalabs/memory.c
index 9e3491dc3b55..4b57d7ce50dd 100644
--- a/drivers/misc/habanalabs/memory.c
+++ b/drivers/misc/habanalabs/memory.c
@@ -1210,7 +1210,7 @@ out:
* - Pins the physical pages
* - Create a SG list from those pages
*/
-int hl_pin_host_memory(struct hl_device *hdev, u64 addr, u32 size,
+int hl_pin_host_memory(struct hl_device *hdev, u64 addr, u64 size,
struct hl_userptr *userptr)
{
u64 start, end;
@@ -1218,14 +1218,12 @@ int hl_pin_host_memory(struct hl_device *hdev, u64 addr, u32 size,
int rc;
if (!size) {
- dev_err(hdev->dev, "size to pin is invalid - %d\n",
- size);
+ dev_err(hdev->dev, "size to pin is invalid - %llu\n", size);
return -EINVAL;
}
if (!access_ok((void __user *) (uintptr_t) addr, size)) {
- dev_err(hdev->dev, "user pointer is invalid - 0x%llx\n",
- addr);
+ dev_err(hdev->dev, "user pointer is invalid - 0x%llx\n", addr);
return -EFAULT;
}
@@ -1236,7 +1234,7 @@ int hl_pin_host_memory(struct hl_device *hdev, u64 addr, u32 size,
if (((addr + size) < addr) ||
PAGE_ALIGN(addr + size) < (addr + size)) {
dev_err(hdev->dev,
- "user pointer 0x%llx + %u causes integer overflow\n",
+ "user pointer 0x%llx + %llu causes integer overflow\n",
addr, size);
return -EINVAL;
}