Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3482516pxb; Mon, 4 Apr 2022 18:23:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJOopw4U8y7WcQXKJMMDsj4WbTYwbORIz0V/LavKEzWveB+rmMXUuNbpKCy2VvuDi2EvR7 X-Received: by 2002:a05:6a00:801:b0:4fd:f66a:b36c with SMTP id m1-20020a056a00080100b004fdf66ab36cmr911285pfk.68.1649121806987; Mon, 04 Apr 2022 18:23:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649121806; cv=none; d=google.com; s=arc-20160816; b=JHeO/sF1RxHmKKtEIEpcpj6L9dd6ZrTds87rfZDP33NKpbgq6/U/gvaz4Pa7WkxVEg 5ciL7/hrqzK0XoBk51b20sypioGqe7HAei+qc4UXDNMj4iQ7ivJFf7qIr7hqkR82sW3L ffQNmPpERoDO1TM315Fr7HNqJiKkwFEdahBFubjcwXoiwRv1EZS8pOmWDWd+8a8YkL7K 882diMNDjDe6prENF3FLKLYR37rESblaieY6+fQ/qYMBqlcppRVxuB6vDk+XFermOwds YiLWp096PSQptdzvNRtaN0x/oXlIhbz3fTK5oQh1QHLdRyLEjLGMG402mfLlCb+G8mll MVPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=J19vhpoRjP0B6jppOVKSm6XI+aYw7W/ygavRlgiUrJE=; b=k/vUCb6WR6rTWaXx0pgGGZ7FVcpKAfrQCH3pTvQsDsH70JK5NWdXJ+41QfFPtynMzr PKDCopxhkDL21hDOYdeFwzN35xDzd70KInZZUJzkE0DRL64t5NbZVZk2rr2TilolcMz+ EF28HFZPN2ck7KcAE8FpAivFr3OvQ3KmyzXURQNr0LL4NQycEpjvGQHB8KY5oyadgZAw BcAHLFN31PRsgThJdhIEliu1RLsVcLeI++iXRh2XvPX2/SGBJJq4eXbPrGyY99cYjubA lqfcngcfrWhUjFU7V5OmAiy8qDCU+eGOIlum+i4PiSG7jdXEUkd6e/cqMlKTQNnwvNbK CxjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HWRpGX4V; 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=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x7-20020a656aa7000000b003816043f15csi10583790pgu.849.2022.04.04.18.23.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:23:26 -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=@kernel.org header.s=k20201202 header.b=HWRpGX4V; 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=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3CFAD18D980; Mon, 4 Apr 2022 17:14:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347586AbiDASQJ (ORCPT + 99 others); Fri, 1 Apr 2022 14:16:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345474AbiDASQH (ORCPT ); Fri, 1 Apr 2022 14:16:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79D52178681 for ; Fri, 1 Apr 2022 11:14:16 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 287C760C6C for ; Fri, 1 Apr 2022 18:14:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A7B9C340EE for ; Fri, 1 Apr 2022 18:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648836855; bh=kqU9j86Fp20yiuk8kX7VoDCOGTK2BPuNyNh6eBUBXXQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HWRpGX4VIciF/GlnmQv6GJXgQ+OyVRdB2wgg9us7F85HQm/c2I0dS4nRq0y4Vw9QM tr9hwIO63BWy3fyu7nlMXBlo1IcVkWB1myDWpWUmoGewxy9PJW2RSzNOu3HwE2/6ZV POhh64oogsyLx9uRWiB7tWJ6QGnEzg2zLU+5M0DvHlhJbhVLNFXh1ul9N8HJdXqi+1 xWQXW68UtibXGdJGKREna7V522YPtYDR4XKJQOAIbC80rc61gOytRUYD/SDVXnKt6l p8kKnk48sQvs6rmnHcbgLqi3c3Wfe8PQ3Coy3OChuWrywMtDglBcwDxWhpz/IaVSE1 7sFHryACB157w== Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-2e6ceb45174so41846567b3.8 for ; Fri, 01 Apr 2022 11:14:15 -0700 (PDT) X-Gm-Message-State: AOAM532O/ZszlRi/GonNwJunH236l0wbE40aOcmGVIVB3QvCu63sgQ5E j+gBfPdVBTpD5gWDaxb8rM5BI+3E/wtS8gyop08= X-Received: by 2002:a0d:d912:0:b0:2e6:4099:b34f with SMTP id b18-20020a0dd912000000b002e64099b34fmr11356518ywe.46.1648836854617; Fri, 01 Apr 2022 11:14:14 -0700 (PDT) MIME-Version: 1.0 References: <20220401163909.20343-1-palmer@rivosinc.com> In-Reply-To: <20220401163909.20343-1-palmer@rivosinc.com> From: Oded Gabbay Date: Fri, 1 Apr 2022 21:13:48 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] habanalabs: Elide a warning on 32-bit targets To: Palmer Dabbelt , Greg KH Cc: linux-riscv@lists.infradead.org, Arnd Bergmann , "Linux-Kernel@Vger. Kernel. Org" , Ohad Sharabi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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 =E2=80=98alloc_devic= e_memory=E2=80=99: > drivers/misc/habanalabs/common/memory.c:153:49: warning: cast from pointe= r to integer of different size [-Wpointer-to-int-cast] > 153 | (u64) gen_pool_dm= a_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/haban= alabs/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 =3D 0 ; i < num_pgs ; i++) { > if (is_power_of_2(page_size)) > phys_pg_pack->pages[i] =3D > - (u64) gen_pool_dma_alloc_= align(vm->dram_pg_pool, > - = page_size, NULL, > - = page_size); > + (u64) (uintptr_t) gen_poo= l_dma_alloc_align(vm->dram_pg_pool, > + = page_size, NULL, > + = page_size); > else > - phys_pg_pack->pages[i] =3D (u64) gen_pool= _alloc(vm->dram_pg_pool, > - = page_size); > + phys_pg_pack->pages[i] =3D (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, Oded