habanalabs: Fix test build failures
PATCH v2 1/1 habanalabs: Fix test build failures
allmodconfig builds on 32-bit architectures fail with the following error.
drivers/misc/habanalabs/common/memory.c: In function 'alloc_device_memory':drivers/misc/habanalabs/common/memory.c:153:49: error:
cast from pointer to integer of different size
Fix the typecast. While at it, drop other unnecessary typecasts associated with the same commit.
---
v2: Drop unnecessary (u64) typecasts
drivers/misc/habanalabs/common/memory.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/misc/habanalabs/common/memory.c +8 -8
@@ -111,10 +111,10 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,if (contiguous) {if (is_power_of_2 (page_size)) - paddr = (u64 ) (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, - total_size,NULL , page_size); + paddr = (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, + total_size,NULL , page_size);else - paddr = (u64 ) (uintptr_t )gen_pool_alloc (vm->dram_pg_pool, total_size); + paddr =gen_pool_alloc (vm->dram_pg_pool, total_size);if (!paddr) { dev_err(hdev->dev, "failed to allocate %llu contiguous pages with total size of %llu\n",
@@ -150,12 +150,12 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,for (i =0 ; i < num_pgs ; i++) {if (is_power_of_2 (page_size)) phys_pg_pack->pages[i] = - (u64 )gen_pool_dma_alloc_align (vm->dram_pg_pool, - page_size,NULL , - page_size); + (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, + page_size,NULL , + page_size);else - phys_pg_pack->pages[i] = (u64 )gen_pool_alloc (vm->dram_pg_pool, - page_size); + phys_pg_pack->pages[i] =gen_pool_alloc (vm->dram_pg_pool, + page_size);if (!phys_pg_pack->pages[i]) {dev_err (hdev->dev,"Failed to allocate device memory (out of memory)\n" );
Signature · 1 line
2.35.1
Quoted 56 lines · Guenter Roeck
allmodconfig builds on 32-bit architectures fail with the following error.
drivers/misc/habanalabs/common/memory.c: In function 'alloc_device_memory':drivers/misc/habanalabs/common/memory.c:153:49: error:
cast from pointer to integer of different sizeFix the typecast. While at it, drop other unnecessary typecasts associated with the same commit.
Fixes e8458e20e0a3c ("habanalabs: make sure device mem alloc is page aligned")Cc Ohad Sharabi <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
v2: Drop unnecessary (u64) typecastsdrivers/misc/habanalabs/common/memory.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/misc/habanalabs/common/memory.c +8
-9@@ -111,10 +111,10 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,if (contiguous) {if (is_power_of_2 (page_size)) - paddr = (u64 ) (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, - total_size,NULL , page_size); + paddr = (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, + total_size,NULL , page_size);else - paddr = (u64 ) (uintptr_t )gen_pool_alloc (vm->dram_pg_pool, total_size); + paddr =gen_pool_alloc (vm->dram_pg_pool, total_size);if (!paddr) { dev_err(hdev->dev, "failed to allocate %llu contiguous pages with total size of %llu\n",@@ -150,12 +150,12 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,for (i =0 ; i < num_pgs ; i++) {if (is_power_of_2 (page_size)) phys_pg_pack->pages[i] = - (u64 )gen_pool_dma_alloc_align (vm->dram_pg_pool, - page_size,NULL , - page_size); + (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, + page_size,NULL , + page_size);else - phys_pg_pack->pages[i] = (u64 )gen_pool_alloc (vm->dram_pg_pool, - page_size); + phys_pg_pack->pages[i] =gen_pool_alloc (vm->dram_pg_pool, + page_size);if (!phys_pg_pack->pages[i]) {dev_err (hdev->dev,"Failed to allocate device memory (out of memory)\n" ); --
Quoted 2 lines
2.35.1
Hi Guenter,
Thanks for the patch, but Greg already merged a patch that was sent to him. Oded
Greg Kroah-Hartman
maintainerQuoted 54 lines · Oded Gabbay
Quoted 53 lines · Guenter Roeck
allmodconfig builds on 32-bit architectures fail with the following error.
drivers/misc/habanalabs/common/memory.c: In function 'alloc_device_memory':drivers/misc/habanalabs/common/memory.c:153:49: error:
cast from pointer to integer of different sizeFix the typecast. While at it, drop other unnecessary typecasts associated with the same commit.
Fixes e8458e20e0a3c ("habanalabs: make sure device mem alloc is page aligned")Cc Ohad Sharabi <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
v2: Drop unnecessary (u64) typecastsdrivers/misc/habanalabs/common/memory.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/misc/habanalabs/common/memory.c +8
-8@@ -111,10 +111,10 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,if (contiguous) {if (is_power_of_2 (page_size)) - paddr = (u64 ) (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, - total_size,NULL , page_size); + paddr = (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, + total_size,NULL , page_size);else - paddr = (u64 ) (uintptr_t )gen_pool_alloc (vm->dram_pg_pool, total_size); + paddr =gen_pool_alloc (vm->dram_pg_pool, total_size);if (!paddr) { dev_err(hdev->dev, "failed to allocate %llu contiguous pages with total size of %llu\n",@@ -150,12 +150,12 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,for (i =0 ; i < num_pgs ; i++) {if (is_power_of_2 (page_size)) phys_pg_pack->pages[i] = - (u64 )gen_pool_dma_alloc_align (vm->dram_pg_pool, - page_size,NULL , - page_size); + (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, + page_size,NULL , + page_size);else - phys_pg_pack->pages[i] = (u64 )gen_pool_alloc (vm->dram_pg_pool, - page_size); + phys_pg_pack->pages[i] =gen_pool_alloc (vm->dram_pg_pool, + page_size);if (!phys_pg_pack->pages[i]) {
Quoted 8 lines
Quoted 5 lines
drivers/misc/habanalabs/common/memory.c +0
-1dev_err (hdev->dev,"Failed to allocate device memory (out of memory)\n" ); --2.35.1
Hi Guenter,
Thanks for the patch, but Greg already merged a patch that was sent to him.
I did? Where?
Greg Kroah-Hartman
maintainerQuoted 64 lines · Greg Kroah-Hartman
Quoted 54 lines · Oded Gabbay
Quoted 53 lines · Guenter Roeck
allmodconfig builds on 32-bit architectures fail with the following error.
drivers/misc/habanalabs/common/memory.c: In function 'alloc_device_memory':drivers/misc/habanalabs/common/memory.c:153:49: error:
cast from pointer to integer of different sizeFix the typecast. While at it, drop other unnecessary typecasts associated with the same commit.
Fixes e8458e20e0a3c ("habanalabs: make sure device mem alloc is page aligned")Cc Ohad Sharabi <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
v2: Drop unnecessary (u64) typecastsdrivers/misc/habanalabs/common/memory.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/misc/habanalabs/common/memory.c +8
-8@@ -111,10 +111,10 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,if (contiguous) {if (is_power_of_2 (page_size)) - paddr = (u64 ) (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, - total_size,NULL , page_size); + paddr = (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, + total_size,NULL , page_size);else - paddr = (u64 ) (uintptr_t )gen_pool_alloc (vm->dram_pg_pool, total_size); + paddr =gen_pool_alloc (vm->dram_pg_pool, total_size);if (!paddr) { dev_err(hdev->dev, "failed to allocate %llu contiguous pages with total size of %llu\n",@@ -150,12 +150,12 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,for (i =0 ; i < num_pgs ; i++) {if (is_power_of_2 (page_size)) phys_pg_pack->pages[i] = - (u64 )gen_pool_dma_alloc_align (vm->dram_pg_pool, - page_size,NULL , - page_size); + (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, + page_size,NULL , + page_size);else - phys_pg_pack->pages[i] = (u64 )gen_pool_alloc (vm->dram_pg_pool, - page_size); + phys_pg_pack->pages[i] =gen_pool_alloc (vm->dram_pg_pool, + page_size);if (!phys_pg_pack->pages[i]) {Quoted 8 lines
Quoted 5 lines
drivers/misc/habanalabs/common/memory.c +0
-1dev_err (hdev->dev,"Failed to allocate device memory (out of memory)\n" ); --2.35.1
Hi Guenter,
Thanks for the patch, but Greg already merged a patch that was sent to him.
Quoted 1 line
I did? Where?
This fix looks more "correct" than Palmer's, so I'll go queue this one up now.
thanks,
greg k-h
Quoted 66 lines · Greg Kroah-Hartman
Quoted 64 lines · Greg Kroah-Hartman
Quoted 62 lines · Oded Gabbay
Quoted 56 lines · Guenter Roeck
allmodconfig builds on 32-bit architectures fail with the following error.
drivers/misc/habanalabs/common/memory.c: In function 'alloc_device_memory':drivers/misc/habanalabs/common/memory.c:153:49: error:
cast from pointer to integer of different sizeFix the typecast. While at it, drop other unnecessary typecasts associated with the same commit.
Fixes e8458e20e0a3c ("habanalabs: make sure device mem alloc is page aligned")Cc Ohad Sharabi <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
v2: Drop unnecessary (u64) typecastsdrivers/misc/habanalabs/common/memory.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/misc/habanalabs/common/memory.c +8
-9@@ -111,10 +111,10 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,if (contiguous) {if (is_power_of_2 (page_size)) - paddr = (u64 ) (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, - total_size,NULL , page_size); + paddr = (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, + total_size,NULL , page_size);else - paddr = (u64 ) (uintptr_t )gen_pool_alloc (vm->dram_pg_pool, total_size); + paddr =gen_pool_alloc (vm->dram_pg_pool, total_size);if (!paddr) { dev_err(hdev->dev, "failed to allocate %llu contiguous pages with total size of %llu\n",@@ -150,12 +150,12 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,for (i =0 ; i < num_pgs ; i++) {if (is_power_of_2 (page_size)) phys_pg_pack->pages[i] = - (u64 )gen_pool_dma_alloc_align (vm->dram_pg_pool, - page_size,NULL , - page_size); + (uintptr_t )gen_pool_dma_alloc_align (vm->dram_pg_pool, + page_size,NULL , + page_size);else - phys_pg_pack->pages[i] = (u64 )gen_pool_alloc (vm->dram_pg_pool, - page_size); + phys_pg_pack->pages[i] =gen_pool_alloc (vm->dram_pg_pool, + page_size);if (!phys_pg_pack->pages[i]) {dev_err (hdev->dev,"Failed to allocate device memory (out of memory)\n" ); --Quoted 2 lines
2.35.1
Hi Guenter,
Thanks for the patch, but Greg already merged a patch that was sent to him.
Quoted 8 lines
Quoted 1 line
I did? Where?
This fix looks more "correct" than Palmer's, so I'll go queue this one up now.
thanks,
greg k-h
Great
Thanks,
Oded