Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp630626pxb; Sat, 18 Sep 2021 12:55:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFvzk0pf1mhYAyJxdMkzFHSt7x1CLZYsmdVo9USXLztlphxoN/5jwJhegJqwK1BiO5xCyy X-Received: by 2002:a17:906:68cb:: with SMTP id y11mr20122942ejr.70.1631994900833; Sat, 18 Sep 2021 12:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631994900; cv=none; d=google.com; s=arc-20160816; b=depfAkF2gvo7BZwbwX3ndCzQ9jV9qZVaQJypR9UZjQzdwByebjqJ+j8F2IpGf9dDrV zV9g24xbSfxec/xZ+py8m0xcP7yhhAKDCH/ImzKDr6q6dHmCKiAMhtNy5r1HSwQIlgiq sDKLPFVLP3nTa8VHj/ZnYsJ6sqTzGgFGeUFUH8msT5JM9J+uJW+1UBgDZN9168V8HTtz 4wB3BajF4xZ+lgnuFuNaPnXE6wlW8/j+88kytqdcdLYHTAEud8BinnpCBOcqLmRuZeWf W2ZS30TEtKTY1MwmjgNlCG4CO9CwzbYyncug4OcvvjCFxuobbY+wbghU6O3+GMbIO9EJ PJKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=+95Akgiaz9WFBupooVQKul5TnDqhDaarMu481JkCNos=; b=JC3GfBjy27FzSmOuQEV9x2mMfYx4xGS2b1GIDntaLY+N6+KmSLICbqHC1nWYrmKi9R 4PrqVTCDhYmcpKD6qA3S9LHeY2kLYaSvK/ix0VY7BFj4eYmGfkHCX7p53Y77wvzrJ46Q 8BusDghK0D4UqGhIIBmJ2ssKDw9K0wNhe/ZQnKeSdTj6st1tUNGSmC1owDJGy8F701d7 17WwSwZ3c0ed65D+WZZkIJosPQ+mqllKZmlBKKC+y/Sp0/AH7eArRL461713FJ1PsrhF hqb7hUN97WMt6Vv87BQKS1Kl2PFBDjTP2LCpHfehjZF3EkDDTE2M5z+TnuzPW2nJ2Ew7 MTKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q23si12626461ejr.192.2021.09.18.12.54.37; Sat, 18 Sep 2021 12:55:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238898AbhIRLVs (ORCPT + 99 others); Sat, 18 Sep 2021 07:21:48 -0400 Received: from mail-ua1-f47.google.com ([209.85.222.47]:41706 "EHLO mail-ua1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230313AbhIRLVs (ORCPT ); Sat, 18 Sep 2021 07:21:48 -0400 Received: by mail-ua1-f47.google.com with SMTP id f24so7771066uav.8; Sat, 18 Sep 2021 04:20:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+95Akgiaz9WFBupooVQKul5TnDqhDaarMu481JkCNos=; b=1pcmGyft6ErF0QKrncnT+kw6apPkrSSYaO1DO2ivy0qjXVkySC5QtE/PmxaJc4tx4T qDB34kVaRJ8SoKnSEHlk5LVO/wvWIgViNOhQ6Vq2AZIQQZr+vNwPCbl7gqXgS8XRXb7D up4YMrC60bxltNkyl+1zLflcO+l2mEY9yGWZdZ/2fzSqpOYeddzQ7PVTtrjoQ184arJu MIFbIfJ3ZpzNY5UnYLp1BMDi70U3fcDMaGcA0WcdB/j0SQU0aGMk6prOOwRZdYZH3bF5 9nlI8brDZc9pRLzGXp0iDm9XkYJbxZv+QFePmGBdgvN3TVC99zCfr31LpxLoeNl6PEFZ hxnQ== X-Gm-Message-State: AOAM531QMebAbKrrQyJdUetP+MuL363j3Flbec8Cqumv9bg2q+lc02iq KGc7aQ7qsmAC80antUSVuZxL6agJi9TnTzgLcxM= X-Received: by 2002:a9f:35aa:: with SMTP id t39mr7546907uad.89.1631964024115; Sat, 18 Sep 2021 04:20:24 -0700 (PDT) MIME-Version: 1.0 References: <2c2eef3c9a2f57e5609100a4864715ccf253d30f.1631713483.git.geert+renesas@glider.be> <1acace03-4273-a5ad-50b4-5ab8e3baa551@landley.net> In-Reply-To: From: Geert Uytterhoeven Date: Sat, 18 Sep 2021 13:20:13 +0200 Message-ID: Subject: Re: [PATCH] sh: pgtable-3level: Fix cast to pointer from integer of different size To: Rob Landley Cc: Yoshinori Sato , Rich Felker , "Aneesh Kumar K . V" , Andrew Morton , Jacopo Mondi , Daniel Palmer , Linux-sh list , Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rob, On Sat, Sep 18, 2021 at 6:45 AM Rob Landley wrote: > On 9/17/21 4:21 AM, Geert Uytterhoeven wrote: > > On Fri, Sep 17, 2021 at 3:12 AM Rob Landley wrote: > >> On 9/15/21 8:50 AM, Geert Uytterhoeven wrote: > >> > arch/sh/include/asm/pgtable-3level.h:37:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] > >> ... > >> > The truncation to "unsigned long" has been there since forever, so > >> > probably it still works fine ;-) > >> > >> 1) Linux is LP64 so sizeof(long) and sizeof(pointer) always match, so it's not > >> truncating. > >> > >> 2) The sh5 only ever shipped evaluation units, it never had a production run, > >> and we haven't implemented j64 yet, so all superh targets are currently 32 bit. > >> (I.E. it's complaining about _expanding_ the pointer, which shouldn't be a > >> problem as long as endianness is respected.) > > > > The build error is for 32-bit. > > I know. I'm just saying your fix doesn't seem wrong. (Personally I would have > just cast once to (void *) and let C not being C++ do the right thing, but eh...) That would still give a warning, as "unsigned long long" us 64-bit, and "void *" is 32-bit. > Not sure I understand the point of the original code though. Under what > conditions do you want 64 bit page tables on a 32 bit system? (Some PAE variant?) > > > If CONFIG_X2TLB=y, pgd_t.pgd is "unsigned long long", i.e. 64-bit, so > > casting it to a pointer needs an intermediate cast to "unsigned long". > > See arch/sh/include/asm/page.h: > > I can't find a user of it. None of the existing defconfigs select this option: > > $ grep -r X2TLB arch/sh/configs Note that these are reduced config files, so auto-selected symbols are not present in the defconfig. config X2TLB def_bool y depends on (CPU_SHX2 || CPU_SHX3) && MMU and e.g. config CPU_SUBTYPE_SH7723 bool "Support SH7723 processor" select CPU_SH4A select CPU_SHX2 > > And it's weird in other ways, like 8k page size. (Why...?) > > Google finds sh-x2 mentioned in Renesas' sh4a debugger docs, but I've never > played with the renesas "a" variants. The stuff I'm familiar with is all > following up on what Hitachi did, not Renesas. > > *shrug* You fix looks good enough to me. > > Acked-by: Rob Landley Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds