* [PATCH v2] habanalabs: Fix test build failures
@ 2022-04-04 13:48 Guenter Roeck
2022-04-04 14:38 ` Oded Gabbay
0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2022-04-04 13:48 UTC (permalink / raw)
To: Oded Gabbay
Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel, Guenter Roeck,
Ohad Sharabi
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.
Fixes: e8458e20e0a3c ("habanalabs: make sure device mem alloc is page aligned")
Cc: Ohad Sharabi <osharabi@habana.ai>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Drop unnecessary (u64) typecasts
drivers/misc/habanalabs/common/memory.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
index e008d82e4ba3..a13506dd8119 100644
--- a/drivers/misc/habanalabs/common/memory.c
+++ b/drivers/misc/habanalabs/common/memory.c
@@ -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");
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v2] habanalabs: Fix test build failures 2022-04-04 13:48 [PATCH v2] habanalabs: Fix test build failures Guenter Roeck @ 2022-04-04 14:38 ` Oded Gabbay 2022-04-04 14:46 ` Greg Kroah-Hartman 0 siblings, 1 reply; 5+ messages in thread From: Oded Gabbay @ 2022-04-04 14:38 UTC (permalink / raw) To: Guenter Roeck Cc: Arnd Bergmann, Greg Kroah-Hartman, Linux-Kernel@Vger. Kernel. Org, Ohad Sharabi On Mon, Apr 4, 2022 at 4:49 PM Guenter Roeck <linux@roeck-us.net> wrote: > > 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. > > Fixes: e8458e20e0a3c ("habanalabs: make sure device mem alloc is page aligned") > Cc: Ohad Sharabi <osharabi@habana.ai> > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > --- > v2: Drop unnecessary (u64) typecasts > > drivers/misc/habanalabs/common/memory.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c > index e008d82e4ba3..a13506dd8119 100644 > --- a/drivers/misc/habanalabs/common/memory.c > +++ b/drivers/misc/habanalabs/common/memory.c > @@ -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"); > -- > 2.35.1 > Hi Guenter, Thanks for the patch, but Greg already merged a patch that was sent to him. Oded ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] habanalabs: Fix test build failures 2022-04-04 14:38 ` Oded Gabbay @ 2022-04-04 14:46 ` Greg Kroah-Hartman 2022-04-04 14:54 ` Greg Kroah-Hartman 0 siblings, 1 reply; 5+ messages in thread From: Greg Kroah-Hartman @ 2022-04-04 14:46 UTC (permalink / raw) To: Oded Gabbay Cc: Guenter Roeck, Arnd Bergmann, Linux-Kernel@Vger. Kernel. Org, Ohad Sharabi On Mon, Apr 04, 2022 at 05:38:29PM +0300, Oded Gabbay wrote: > On Mon, Apr 4, 2022 at 4:49 PM Guenter Roeck <linux@roeck-us.net> wrote: > > > > 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. > > > > Fixes: e8458e20e0a3c ("habanalabs: make sure device mem alloc is page aligned") > > Cc: Ohad Sharabi <osharabi@habana.ai> > > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > > --- > > v2: Drop unnecessary (u64) typecasts > > > > drivers/misc/habanalabs/common/memory.c | 16 ++++++++-------- > > 1 file changed, 8 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c > > index e008d82e4ba3..a13506dd8119 100644 > > --- a/drivers/misc/habanalabs/common/memory.c > > +++ b/drivers/misc/habanalabs/common/memory.c > > @@ -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"); > > -- > > 2.35.1 > > > > Hi Guenter, > Thanks for the patch, but Greg already merged a patch that was sent to him. I did? Where? ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] habanalabs: Fix test build failures 2022-04-04 14:46 ` Greg Kroah-Hartman @ 2022-04-04 14:54 ` Greg Kroah-Hartman 2022-04-04 14:55 ` Oded Gabbay 0 siblings, 1 reply; 5+ messages in thread From: Greg Kroah-Hartman @ 2022-04-04 14:54 UTC (permalink / raw) To: Oded Gabbay Cc: Guenter Roeck, Arnd Bergmann, Linux-Kernel@Vger. Kernel. Org, Ohad Sharabi On Mon, Apr 04, 2022 at 04:46:04PM +0200, Greg Kroah-Hartman wrote: > On Mon, Apr 04, 2022 at 05:38:29PM +0300, Oded Gabbay wrote: > > On Mon, Apr 4, 2022 at 4:49 PM Guenter Roeck <linux@roeck-us.net> wrote: > > > > > > 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. > > > > > > Fixes: e8458e20e0a3c ("habanalabs: make sure device mem alloc is page aligned") > > > Cc: Ohad Sharabi <osharabi@habana.ai> > > > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > > > --- > > > v2: Drop unnecessary (u64) typecasts > > > > > > drivers/misc/habanalabs/common/memory.c | 16 ++++++++-------- > > > 1 file changed, 8 insertions(+), 8 deletions(-) > > > > > > diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c > > > index e008d82e4ba3..a13506dd8119 100644 > > > --- a/drivers/misc/habanalabs/common/memory.c > > > +++ b/drivers/misc/habanalabs/common/memory.c > > > @@ -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"); > > > -- > > > 2.35.1 > > > > > > > Hi Guenter, > > Thanks for the patch, but Greg already merged a patch that was sent to him. > > I did? Where? This fix looks more "correct" than Palmer's, so I'll go queue this one up now. thanks, greg k-h ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] habanalabs: Fix test build failures 2022-04-04 14:54 ` Greg Kroah-Hartman @ 2022-04-04 14:55 ` Oded Gabbay 0 siblings, 0 replies; 5+ messages in thread From: Oded Gabbay @ 2022-04-04 14:55 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Guenter Roeck, Arnd Bergmann, Linux-Kernel@Vger. Kernel. Org, Ohad Sharabi On Mon, Apr 4, 2022 at 5:54 PM Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > > On Mon, Apr 04, 2022 at 04:46:04PM +0200, Greg Kroah-Hartman wrote: > > On Mon, Apr 04, 2022 at 05:38:29PM +0300, Oded Gabbay wrote: > > > On Mon, Apr 4, 2022 at 4:49 PM Guenter Roeck <linux@roeck-us.net> wrote: > > > > > > > > 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. > > > > > > > > Fixes: e8458e20e0a3c ("habanalabs: make sure device mem alloc is page aligned") > > > > Cc: Ohad Sharabi <osharabi@habana.ai> > > > > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > > > > --- > > > > v2: Drop unnecessary (u64) typecasts > > > > > > > > drivers/misc/habanalabs/common/memory.c | 16 ++++++++-------- > > > > 1 file changed, 8 insertions(+), 8 deletions(-) > > > > > > > > diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c > > > > index e008d82e4ba3..a13506dd8119 100644 > > > > --- a/drivers/misc/habanalabs/common/memory.c > > > > +++ b/drivers/misc/habanalabs/common/memory.c > > > > @@ -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"); > > > > -- > > > > 2.35.1 > > > > > > > > > > Hi Guenter, > > > Thanks for the patch, but Greg already merged a patch that was sent to him. > > > > 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-04 14:56 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-04-04 13:48 [PATCH v2] habanalabs: Fix test build failures Guenter Roeck 2022-04-04 14:38 ` Oded Gabbay 2022-04-04 14:46 ` Greg Kroah-Hartman 2022-04-04 14:54 ` Greg Kroah-Hartman 2022-04-04 14:55 ` Oded Gabbay
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.