Received: by 2002:a05:6512:2355:0:0:0:0 with SMTP id p21csp130070lfu; Mon, 4 Apr 2022 22:13:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfA0PwpMwWZjllK/k4YSapgav+NDhzquYyMRZa7qqE4ivCXTM7/7WE1x2DtmdrBxJVrLNC X-Received: by 2002:a17:907:d06:b0:6e0:e2f5:4f55 with SMTP id gn6-20020a1709070d0600b006e0e2f54f55mr1771033ejc.618.1649135629836; Mon, 04 Apr 2022 22:13:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649135629; cv=none; d=google.com; s=arc-20160816; b=gok5jZg2e9Hv6fiFVN/T8yqqhCjMSo+O9iddwwE/Wcu6LkkrW7IaOgSbUsUx+GmkIs oO6JdioehcKSdGVPsEWarGkjR7/1uuucrzqBin7coZEL2RNIyESvDyovVDvhKgbDDlPy agmXnzhA/zRlHpk3k6jRAUxd+QWhoXkwXHHVAHsA6ps/XvOrOaBL1KhZRUYGCKnKyWK6 U0p31w/1bfhw64NMce0/JnoAW2v7Sdf7/3iqS/88yBXlIcilK72M+FRLyQaDO991ubUH kFhTUMs0ga3H3iTTvsr/jyjZBjdn/jcAIj7BbznC7YNDrNOAHv/22kwlEuhrZPqcYoyq LYfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=afZ7V/zhM7ibaNiFmEOc4Fe74ITX9AQvg8kK7NRCbV0=; b=b1hRME3T6Ml+1dZuVqzSmiQsVJEc3IbviczrywDf1SS/Bv6dEhRXdxHgpLplnEAsFU One6nJrrToxPjL2ZV2rRVg96uWJpFXVGbqJQgD/R27y4Wpy+ByIqHbaGlfiZcXGaxh4l 0MRXmiUDHnhQInRJXs5fdgR8XBb1/GdR7NGWMy5W5+U+iNl7Qi9opT0DUG9Cz5Nu6kb0 cjkUA89fZ+nFLKsbsgRoLasRTGzG0CB6TXOojhRluM0yfWWhX3Qxi2+eBmedqFk5Fwic DZbRSp9bs8KPeUrcnyNtStUz3lsNTLj2CVvXJuWJiCxZWgDoZB1Y84lQ3/drIaJQn18C uJZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m5R2delX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a05640235c900b00418c2b5be27si9564544edc.265.2022.04.04.22.13.20; Mon, 04 Apr 2022 22:13:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m5R2delX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229495AbiDEFFz (ORCPT + 99 others); Tue, 5 Apr 2022 01:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiDEFFy (ORCPT ); Tue, 5 Apr 2022 01:05:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5610F2408C for ; Mon, 4 Apr 2022 22:03:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 069A4B81A1C for ; Tue, 5 Apr 2022 05:03:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C5BDC340EE; Tue, 5 Apr 2022 05:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649135032; bh=s4jp7m29/elz1udJzUPX9qnRlradyqvvImu+zBEXFdE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m5R2delX1lljAk2JBtzoqkfHqaYsSTbH/yqi4QazW0ubO3ZF+2M7qsapY84ha91JR xn5CFXzvROv39jkI5gjk0nE4bYk0BeJw6SwtGnjoyvlHfL/XaVLOBwWM/9oymJ07WV uJWyd/WlQAIOBBbrk+gRWPJEGMTS2eCyIlebXL7M= Date: Tue, 5 Apr 2022 07:03:50 +0200 From: Greg KH To: Palmer Dabbelt Cc: ogabbay@kernel.org, linux-riscv@lists.infradead.org, Arnd Bergmann , linux-kernel@vger.kernel.org, osharabi@habana.ai Subject: Re: [PATCH] habanalabs: Elide a warning on 32-bit targets Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 wrote: > > > > > > > > > > From: Palmer Dabbelt > > > > > > > > > > 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 > > > > > > > > > > --- > > > > > > > > > > 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 > > > > > > > > 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