linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] habanalabs: Elide a warning on 32-bit targets
@ 2022-04-01 16:39 Palmer Dabbelt
  2022-04-01 18:13 ` Oded Gabbay
  0 siblings, 1 reply; 7+ messages in thread
From: Palmer Dabbelt @ 2022-04-01 16:39 UTC (permalink / raw)
  To: linux-riscv
  Cc: ogabbay, Arnd Bergmann, Greg KH, ynudelman, obitton, fkassabri,
	daniel.vetter, ttayar, sozeri, bjauhari, linux-kernel,
	Palmer Dabbelt

From: Palmer Dabbelt <palmer@rivosinc.com>

This double-cast pattern looks a bit awkward, but it already exists
elsewhere in the driver.  Without this patch I get

drivers/misc/habanalabs/common/memory.c: In function ‘alloc_device_memory’:
drivers/misc/habanalabs/common/memory.c:153:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  153 |                                                 (u64) gen_pool_dma_alloc_align(vm->dram_pg_pool,
      |                                                 ^

which ends up promoted to a build error in my test setup.

Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

---

I don't know anything about this driver, I'm just pattern-matching the
warning away.
---
 drivers/misc/habanalabs/common/memory.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
index e008d82e4ba3..f1fc79c1fc10 100644
--- a/drivers/misc/habanalabs/common/memory.c
+++ b/drivers/misc/habanalabs/common/memory.c
@@ -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);
+						(u64) (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] = (u64) (uintptr_t) 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.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] habanalabs: Elide a warning on 32-bit targets
  2022-04-01 16:39 [PATCH] habanalabs: Elide a warning on 32-bit targets Palmer Dabbelt
@ 2022-04-01 18:13 ` Oded Gabbay
  2022-04-01 18:36   ` Palmer Dabbelt
  2022-04-02  7:49   ` Greg KH
  0 siblings, 2 replies; 7+ messages in thread
From: Oded Gabbay @ 2022-04-01 18:13 UTC (permalink / raw)
  To: Palmer Dabbelt, Greg KH
  Cc: linux-riscv, Arnd Bergmann, Linux-Kernel@Vger. Kernel. Org, Ohad Sharabi

On Fri, Apr 1, 2022 at 7:41 PM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>
> From: Palmer Dabbelt <palmer@rivosinc.com>
>
> This double-cast pattern looks a bit awkward, but it already exists
> elsewhere in the driver.  Without this patch I get
>
> drivers/misc/habanalabs/common/memory.c: In function ‘alloc_device_memory’:
> drivers/misc/habanalabs/common/memory.c:153:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>   153 |                                                 (u64) gen_pool_dma_alloc_align(vm->dram_pg_pool,
>       |                                                 ^
>
> which ends up promoted to a build error in my test setup.
>
> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>
> ---
>
> I don't know anything about this driver, I'm just pattern-matching the
> warning away.
> ---
>  drivers/misc/habanalabs/common/memory.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
> index e008d82e4ba3..f1fc79c1fc10 100644
> --- a/drivers/misc/habanalabs/common/memory.c
> +++ b/drivers/misc/habanalabs/common/memory.c
> @@ -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);
> +                                               (u64) (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] = (u64) (uintptr_t) 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.34.1
>

This patch is:
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>

Greg,
Could you please apply this directly to your misc tree and send it to
Linus at your next pull request ?
I don't have any other fixes pending for 5.18.

For 5.19 we will do a more elegant solution that Arnd has recommended.

Thanks,
Oded

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] habanalabs: Elide a warning on 32-bit targets
  2022-04-01 18:13 ` Oded Gabbay
@ 2022-04-01 18:36   ` Palmer Dabbelt
  2022-04-04 15:02     ` Greg KH
  2022-04-02  7:49   ` Greg KH
  1 sibling, 1 reply; 7+ messages in thread
From: Palmer Dabbelt @ 2022-04-01 18:36 UTC (permalink / raw)
  To: ogabbay; +Cc: Greg KH, linux-riscv, Arnd Bergmann, linux-kernel, osharabi

On Fri, 01 Apr 2022 11:13:48 PDT (-0700), ogabbay@kernel.org wrote:
> On Fri, Apr 1, 2022 at 7:41 PM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>>
>> From: Palmer Dabbelt <palmer@rivosinc.com>
>>
>> This double-cast pattern looks a bit awkward, but it already exists
>> elsewhere in the driver.  Without this patch I get
>>
>> drivers/misc/habanalabs/common/memory.c: In function ‘alloc_device_memory’:
>> drivers/misc/habanalabs/common/memory.c:153:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>>   153 |                                                 (u64) gen_pool_dma_alloc_align(vm->dram_pg_pool,
>>       |                                                 ^
>>
>> which ends up promoted to a build error in my test setup.
>>
>> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>>
>> ---
>>
>> I don't know anything about this driver, I'm just pattern-matching the
>> warning away.
>> ---
>>  drivers/misc/habanalabs/common/memory.c | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
>> index e008d82e4ba3..f1fc79c1fc10 100644
>> --- a/drivers/misc/habanalabs/common/memory.c
>> +++ b/drivers/misc/habanalabs/common/memory.c
>> @@ -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);
>> +                                               (u64) (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] = (u64) (uintptr_t) 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.34.1
>>
>
> This patch is:
> Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
>
> Greg,
> Could you please apply this directly to your misc tree and send it to
> Linus at your next pull request ?
> I don't have any other fixes pending for 5.18.
>
> For 5.19 we will do a more elegant solution that Arnd has recommended.

Thanks.

Assuming this is too late for rc1, would it be possibe to have it in 
something I can take into my fixes/for-next without too much diff?  I 
put this on top of the offending commit with a 

Fixes: e8458e20e0a3 ("habanalabs: make sure device mem alloc is page aligned")

at kernel.org/palmer/habana , if that helps any.  No big deal if it goes 
in another way, it's just nice to keep allyesconfig building on my 
branches directly.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] habanalabs: Elide a warning on 32-bit targets
  2022-04-01 18:13 ` Oded Gabbay
  2022-04-01 18:36   ` Palmer Dabbelt
@ 2022-04-02  7:49   ` Greg KH
  1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2022-04-02  7:49 UTC (permalink / raw)
  To: Oded Gabbay
  Cc: Palmer Dabbelt, linux-riscv, Arnd Bergmann,
	Linux-Kernel@Vger. Kernel. Org, Ohad Sharabi

On Fri, Apr 01, 2022 at 09:13:48PM +0300, Oded Gabbay wrote:
> On Fri, Apr 1, 2022 at 7:41 PM Palmer Dabbelt <palmer@rivosinc.com> wrote:
> >
> > From: Palmer Dabbelt <palmer@rivosinc.com>
> >
> > This double-cast pattern looks a bit awkward, but it already exists
> > elsewhere in the driver.  Without this patch I get
> >
> > drivers/misc/habanalabs/common/memory.c: In function ‘alloc_device_memory’:
> > drivers/misc/habanalabs/common/memory.c:153:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> >   153 |                                                 (u64) gen_pool_dma_alloc_align(vm->dram_pg_pool,
> >       |                                                 ^
> >
> > which ends up promoted to a build error in my test setup.
> >
> > Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
> >
> > ---
> >
> > I don't know anything about this driver, I'm just pattern-matching the
> > warning away.
> > ---
> >  drivers/misc/habanalabs/common/memory.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
> > index e008d82e4ba3..f1fc79c1fc10 100644
> > --- a/drivers/misc/habanalabs/common/memory.c
> > +++ b/drivers/misc/habanalabs/common/memory.c
> > @@ -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);
> > +                                               (u64) (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] = (u64) (uintptr_t) 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.34.1
> >
> 
> This patch is:
> Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
> 
> Greg,
> Could you please apply this directly to your misc tree and send it to
> Linus at your next pull request ?

So ignore https://lore.kernel.org/r/20220401041615.3296387-1-jcmvbkbc@gmail.com ?

> I don't have any other fixes pending for 5.18.

Yes, I will queue this up after -rc1 is out.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] habanalabs: Elide a warning on 32-bit targets
  2022-04-01 18:36   ` Palmer Dabbelt
@ 2022-04-04 15:02     ` Greg KH
  2022-04-05  0:43       ` Palmer Dabbelt
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2022-04-04 15:02 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: ogabbay, linux-riscv, Arnd Bergmann, linux-kernel, osharabi

On Fri, Apr 01, 2022 at 11:36:53AM -0700, Palmer Dabbelt wrote:
> On Fri, 01 Apr 2022 11:13:48 PDT (-0700), ogabbay@kernel.org wrote:
> > On Fri, Apr 1, 2022 at 7:41 PM Palmer Dabbelt <palmer@rivosinc.com> wrote:
> > > 
> > > From: Palmer Dabbelt <palmer@rivosinc.com>
> > > 
> > > This double-cast pattern looks a bit awkward, but it already exists
> > > elsewhere in the driver.  Without this patch I get
> > > 
> > > drivers/misc/habanalabs/common/memory.c: In function ‘alloc_device_memory’:
> > > drivers/misc/habanalabs/common/memory.c:153:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> > >   153 |                                                 (u64) gen_pool_dma_alloc_align(vm->dram_pg_pool,
> > >       |                                                 ^
> > > 
> > > which ends up promoted to a build error in my test setup.
> > > 
> > > Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
> > > 
> > > ---
> > > 
> > > I don't know anything about this driver, I'm just pattern-matching the
> > > warning away.
> > > ---
> > >  drivers/misc/habanalabs/common/memory.c | 10 +++++-----
> > >  1 file changed, 5 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
> > > index e008d82e4ba3..f1fc79c1fc10 100644
> > > --- a/drivers/misc/habanalabs/common/memory.c
> > > +++ b/drivers/misc/habanalabs/common/memory.c
> > > @@ -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);
> > > +                                               (u64) (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] = (u64) (uintptr_t) 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.34.1
> > > 
> > 
> > This patch is:
> > Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
> > 
> > Greg,
> > Could you please apply this directly to your misc tree and send it to
> > Linus at your next pull request ?
> > I don't have any other fixes pending for 5.18.
> > 
> > For 5.19 we will do a more elegant solution that Arnd has recommended.
> 
> Thanks.
> 
> Assuming this is too late for rc1, would it be possibe to have it in
> something I can take into my fixes/for-next without too much diff?  I put
> this on top of the offending commit with a
> 
> Fixes: e8458e20e0a3 ("habanalabs: make sure device mem alloc is page aligned")
> 
> at kernel.org/palmer/habana , if that helps any.  No big deal if it goes in
> another way, it's just nice to keep allyesconfig building on my branches
> directly.

Looks like Guenter sent in a "more complete" version of this.  I'll
queue it up to my tree and get it to Linus for -rc2.

thanks,
greg k-h


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] habanalabs: Elide a warning on 32-bit targets
  2022-04-04 15:02     ` Greg KH
@ 2022-04-05  0:43       ` Palmer Dabbelt
  2022-04-05  5:03         ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Palmer Dabbelt @ 2022-04-05  0:43 UTC (permalink / raw)
  To: Greg KH; +Cc: ogabbay, linux-riscv, Arnd Bergmann, linux-kernel, osharabi

On Mon, 04 Apr 2022 08:02:41 PDT (-0700), Greg KH wrote:
> On Fri, Apr 01, 2022 at 11:36:53AM -0700, Palmer Dabbelt wrote:
>> On Fri, 01 Apr 2022 11:13:48 PDT (-0700), ogabbay@kernel.org wrote:
>> > On Fri, Apr 1, 2022 at 7:41 PM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>> > >
>> > > From: Palmer Dabbelt <palmer@rivosinc.com>
>> > >
>> > > This double-cast pattern looks a bit awkward, but it already exists
>> > > elsewhere in the driver.  Without this patch I get
>> > >
>> > > drivers/misc/habanalabs/common/memory.c: In function ‘alloc_device_memory’:
>> > > drivers/misc/habanalabs/common/memory.c:153:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>> > >   153 |                                                 (u64) gen_pool_dma_alloc_align(vm->dram_pg_pool,
>> > >       |                                                 ^
>> > >
>> > > which ends up promoted to a build error in my test setup.
>> > >
>> > > Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>> > >
>> > > ---
>> > >
>> > > I don't know anything about this driver, I'm just pattern-matching the
>> > > warning away.
>> > > ---
>> > >  drivers/misc/habanalabs/common/memory.c | 10 +++++-----
>> > >  1 file changed, 5 insertions(+), 5 deletions(-)
>> > >
>> > > diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
>> > > index e008d82e4ba3..f1fc79c1fc10 100644
>> > > --- a/drivers/misc/habanalabs/common/memory.c
>> > > +++ b/drivers/misc/habanalabs/common/memory.c
>> > > @@ -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);
>> > > +                                               (u64) (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] = (u64) (uintptr_t) 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.34.1
>> > >
>> >
>> > This patch is:
>> > Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
>> >
>> > Greg,
>> > Could you please apply this directly to your misc tree and send it to
>> > Linus at your next pull request ?
>> > I don't have any other fixes pending for 5.18.
>> >
>> > For 5.19 we will do a more elegant solution that Arnd has recommended.
>>
>> Thanks.
>>
>> Assuming this is too late for rc1, would it be possibe to have it in
>> something I can take into my fixes/for-next without too much diff?  I put
>> this on top of the offending commit with a
>>
>> Fixes: e8458e20e0a3 ("habanalabs: make sure device mem alloc is page aligned")
>>
>> at kernel.org/palmer/habana , if that helps any.  No big deal if it goes in
>> another way, it's just nice to keep allyesconfig building on my branches
>> directly.
>
> Looks like Guenter sent in a "more complete" version of this.  I'll
> queue it up to my tree and get it to Linus for -rc2.

I'm fine with anything here, as long as it fixes my build errors ;).

Do you mind giving me a pointer?  That way I can use exactly what's 
going upstream, rather that keeping around this now-dead-end diff (I 
poked around your kernel.org trees and couldn't find anything, but I've 
not done that before).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] habanalabs: Elide a warning on 32-bit targets
  2022-04-05  0:43       ` Palmer Dabbelt
@ 2022-04-05  5:03         ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2022-04-05  5:03 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: ogabbay, linux-riscv, Arnd Bergmann, linux-kernel, osharabi

On Mon, Apr 04, 2022 at 05:43:08PM -0700, Palmer Dabbelt wrote:
> On Mon, 04 Apr 2022 08:02:41 PDT (-0700), Greg KH wrote:
> > On Fri, Apr 01, 2022 at 11:36:53AM -0700, Palmer Dabbelt wrote:
> > > On Fri, 01 Apr 2022 11:13:48 PDT (-0700), ogabbay@kernel.org wrote:
> > > > On Fri, Apr 1, 2022 at 7:41 PM Palmer Dabbelt <palmer@rivosinc.com> wrote:
> > > > >
> > > > > From: Palmer Dabbelt <palmer@rivosinc.com>
> > > > >
> > > > > This double-cast pattern looks a bit awkward, but it already exists
> > > > > elsewhere in the driver.  Without this patch I get
> > > > >
> > > > > drivers/misc/habanalabs/common/memory.c: In function ‘alloc_device_memory’:
> > > > > drivers/misc/habanalabs/common/memory.c:153:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> > > > >   153 |                                                 (u64) gen_pool_dma_alloc_align(vm->dram_pg_pool,
> > > > >       |                                                 ^
> > > > >
> > > > > which ends up promoted to a build error in my test setup.
> > > > >
> > > > > Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
> > > > >
> > > > > ---
> > > > >
> > > > > I don't know anything about this driver, I'm just pattern-matching the
> > > > > warning away.
> > > > > ---
> > > > >  drivers/misc/habanalabs/common/memory.c | 10 +++++-----
> > > > >  1 file changed, 5 insertions(+), 5 deletions(-)
> > > > >
> > > > > diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
> > > > > index e008d82e4ba3..f1fc79c1fc10 100644
> > > > > --- a/drivers/misc/habanalabs/common/memory.c
> > > > > +++ b/drivers/misc/habanalabs/common/memory.c
> > > > > @@ -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);
> > > > > +                                               (u64) (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] = (u64) (uintptr_t) 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.34.1
> > > > >
> > > >
> > > > This patch is:
> > > > Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
> > > >
> > > > Greg,
> > > > Could you please apply this directly to your misc tree and send it to
> > > > Linus at your next pull request ?
> > > > I don't have any other fixes pending for 5.18.
> > > >
> > > > For 5.19 we will do a more elegant solution that Arnd has recommended.
> > > 
> > > Thanks.
> > > 
> > > Assuming this is too late for rc1, would it be possibe to have it in
> > > something I can take into my fixes/for-next without too much diff?  I put
> > > this on top of the offending commit with a
> > > 
> > > Fixes: e8458e20e0a3 ("habanalabs: make sure device mem alloc is page aligned")
> > > 
> > > at kernel.org/palmer/habana , if that helps any.  No big deal if it goes in
> > > another way, it's just nice to keep allyesconfig building on my branches
> > > directly.
> > 
> > Looks like Guenter sent in a "more complete" version of this.  I'll
> > queue it up to my tree and get it to Linus for -rc2.
> 
> I'm fine with anything here, as long as it fixes my build errors ;).
> 
> Do you mind giving me a pointer?  That way I can use exactly what's going
> upstream, rather that keeping around this now-dead-end diff (I poked around
> your kernel.org trees and couldn't find anything, but I've not done that
> before).

The commit I took is here:
	https://lore.kernel.org/all/20220404134859.3278599-1-linux@roeck-us.net/
and you can find it in my char-misc.git tree with commit:
	94865e2dcb46 ("habanalabs: Fix test build failures")
and it should show up in the next linux-next tree as well.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-05  5:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 16:39 [PATCH] habanalabs: Elide a warning on 32-bit targets Palmer Dabbelt
2022-04-01 18:13 ` Oded Gabbay
2022-04-01 18:36   ` Palmer Dabbelt
2022-04-04 15:02     ` Greg KH
2022-04-05  0:43       ` Palmer Dabbelt
2022-04-05  5:03         ` Greg KH
2022-04-02  7:49   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).