Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3431556pxb; Mon, 4 Apr 2022 16:48:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoHGk7DrNnbjTCLekxRr+ybLCuofFTw+Bn/y2NTVUKrcG2LcSRGozvECEf5IjXpv7/VuHK X-Received: by 2002:a17:903:2351:b0:156:a562:b3f8 with SMTP id c17-20020a170903235100b00156a562b3f8mr669756plh.81.1649116095324; Mon, 04 Apr 2022 16:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649116095; cv=none; d=google.com; s=arc-20160816; b=OE2FAHSH4QdNK838q34YaoIsxGljz56aOaKkZ9b0bnJVUiB0Vln2AiLVHxzGtGtTtv bmzMDWcp+Eo7BmDq4EdBngse/6QKTf2Q97mz/CRp2lXN2P2iiwHaxqh9hRlAdbLKQIQC s3oeqFF6dz5+wc2WZRQOi0LOyIWvL+DO6SGec5kYX+zJHSWNj+d0Py0f4BnTOxphoBlI 2QZxz+nDelA4p8p+aCvPBvmP7FEiv4cEMi42LsU4wzEQcj7IrPoxu4EJkCU9RtJnJnON YbtoKDINW6FbyJFa82Vcv022cgXQNQ295XdhsF3LSWVEzma0ixCJ58HFEIMD2haIyTQ9 FAyQ== 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=ja/OhHqW9Qzn/S887OrBOc1gkiuYvMPId1lkuJw0aD8=; b=QESgsYOFneLSXvY4SPXZdsSZI+DC8B3la1nHN4bc/xS1F86F3Mo+r4atOdREM8Shek HNsOBuMXUJa+wtEa9b4rZZMa0uuj7buayG0pOHpjbPHGCz3tR6T33dhyhJhcbJa2UdY9 5pJKyuiAj7D9c8SlRM+xFJAMddNLtXpjIuBgxhVj1BbhFaxY2YQ6CJjuBwGVliGL68OL b6RO9Ls4uwrplyLrj2wQMFqJemTzIuUzZd41xNXdrpExxswIbvXkmgKwuxQT4JNhh0lO BmLL9N6uysIqYAIo+C6fI5VJN1z5n8zDDQOt86Q3dQ4NNdym46C/D6XAMkDACQ6rPG7U ixnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=naW15HUk; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id pg11-20020a17090b1e0b00b001bd14e03053si669638pjb.43.2022.04.04.16.48.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 16:48:15 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=naW15HUk; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9F2B03524D; Mon, 4 Apr 2022 16:34:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229912AbiDDPEu (ORCPT + 99 others); Mon, 4 Apr 2022 11:04:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378393AbiDDPEo (ORCPT ); Mon, 4 Apr 2022 11:04:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494DA2FE4F for ; Mon, 4 Apr 2022 08:02:47 -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 E465BB81807 for ; Mon, 4 Apr 2022 15:02:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0444CC340EE; Mon, 4 Apr 2022 15:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649084564; bh=DSyr/AuapRImCrjmRCEvAPYtyLzoTPYJz8OafeBekS8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=naW15HUkpTiiBzJlkVtO0Zfifg/rwX7VjL5I0XYYjQwKRzdSELAEoyb1vCu9IfsoU 57VWRv5Qrlx0ICiAVzuCPD/A9yEZAAZv4/VXth5pJmPYkgQjc5+tlu+zce7/ujv972 uffGmFB/hwk/8I+Pe+IZp6wCtQ1vTYrRA8ityj8s= Date: Mon, 4 Apr 2022 17:02:41 +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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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. thanks, greg k-h