Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10051444rwr; Fri, 12 May 2023 03:08:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4hoLu0buEGkHtAKVN51R6TxZXpR9j+JM49efJ4EgJNNdnz+LfJMkAKNG1mnTO2A3vn/sTu X-Received: by 2002:a05:6a00:8cf:b0:640:e12a:3a20 with SMTP id s15-20020a056a0008cf00b00640e12a3a20mr29965163pfu.1.1683886117932; Fri, 12 May 2023 03:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683886117; cv=none; d=google.com; s=arc-20160816; b=VPCnTt0WCSiOwSdl4n3oivrlHlju0j+hF6NWi7bLunEF7Zhb7Cr2rIHlfEVkiNx3wP q7gDaXVpKr5/VLsKUBijP1YO4+B77sR9QWku8eANikqizvxMBDgmynj0KD4mTCvqc6LK qXFsaRh7ru5hpZ4MIj9TdlNCv6274Glzr6NBdS8/MD2asfjK1otaHuazXPmyNywldYf+ yrkgiEDulTvMp0zzcONh5B6/QmQfMwhDIqJp0wFTASVl3NaEvXd72ihLFyL8EKd1ZPts 6tPsmztMlPpyXBF2dEynDB4zizVDNLbR6ndSyCwXuCP5jOZa55IEIfS1C0QPWii1DQBZ sNtA== 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; bh=9ymGhU/3p44XzONR24EcBAHfDi/i5TIfxXb5R3MGZ7k=; b=DfDXTbjtD0ekC8r+NbAPF8uuuARlw1Rw/msge07vHCtaWWzYuMASEF8Uh49noSzJhb J2haGJSGGZ7JfhSiWgqS09hYehWBsTqCJTbTrenlgCFh8v+avTmLmdTB56xtIzogvduK K9ENk72oD46r4aDjw3crsqqbLhsXuKFKxkLSIy+02rgzz2kHieoNr50mM2AzcH6hTnpK 7r3mgRyt6owACeYJ8odlOQG28KVmxMcr/YOqqMkBIMuCVeJTZTWK1tK6nN/jzVKn7cag nHSKPY91lpx2ExLoNxfFM06qimjSi+XJggs+rxmImIWmRPCOqLcPG6InxvqdkWG4zr6X Wbiw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t193-20020a6378ca000000b0050f6925a400si9153763pgc.589.2023.05.12.03.08.23; Fri, 12 May 2023 03:08:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240584AbjELJ41 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 12 May 2023 05:56:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240576AbjELJ4R (ORCPT ); Fri, 12 May 2023 05:56:17 -0400 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 217D5E70B; Fri, 12 May 2023 02:56:09 -0700 (PDT) Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-b9daef8681fso8318324276.1; Fri, 12 May 2023 02:56:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683885368; x=1686477368; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G26aphgD58tBa5cm3UBUurmWT+f5Rv1D2HQTBHZMzO8=; b=MstuOBtGoWvN9ULpvx/fDT1WNIButquFg8dv372BFQsdwA7hRiu4fvgP8zjNQ1X9wh PajQR2QUUPIp55/mmj7JFBPRkT5EO4MgDnP3VqeQC24uu2HBu7yNpAOlw1DXxu4ovOZd 5IfTf/MWC7PNXEMPFZKE4DVfr7SKN7R16sm7M/LcEj0nS6oCuJfGiQ5CKtdM6wuLrlAR DiiART5TbnuQbwQtWG2VbRwpUzSQlFYcG/LVCb13x6UIBlFXVhCz7jEsZj2OEZ7VGCw3 Tnyi87Mz71/k7jiafDnYbG3U+OEhqDlLikTJ/3IrbmcL8S038aCPtJ5aPlOWNT5q1jDi XA4Q== X-Gm-Message-State: AC+VfDwV7SWien3A0ekJKboMoU6M4cJFjzjcOtmOfRO6BYxCP6ub3r7R KdFlCKV7uMGwUYOQQS4167HtN6Vo2JJzFg== X-Received: by 2002:a25:16c5:0:b0:ba2:16b6:b128 with SMTP id 188-20020a2516c5000000b00ba216b6b128mr12085378ybw.4.1683885367881; Fri, 12 May 2023 02:56:07 -0700 (PDT) Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com. [209.85.128.175]) by smtp.gmail.com with ESMTPSA id w9-20020a0dd409000000b0054f50f71834sm5547073ywd.124.2023.05.12.02.56.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 May 2023 02:56:06 -0700 (PDT) Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-55a1462f9f6so94882417b3.3; Fri, 12 May 2023 02:56:06 -0700 (PDT) X-Received: by 2002:a81:a012:0:b0:555:f33e:e32e with SMTP id x18-20020a81a012000000b00555f33ee32emr22884527ywg.51.1683885366474; Fri, 12 May 2023 02:56:06 -0700 (PDT) MIME-Version: 1.0 References: <20230503-virt-to-pfn-v6-4-rc1-v1-0-6c4698dcf9c8@linaro.org> <20230503-virt-to-pfn-v6-4-rc1-v1-2-6c4698dcf9c8@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v1-2-6c4698dcf9c8@linaro.org> From: Geert Uytterhoeven Date: Fri, 12 May 2023 11:55:55 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 02/12] m68k: Pass a pointer to virt_to_pfn() virt_to_page() To: Linus Walleij Cc: Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer , linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, 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 Hi Linus, On Thu, May 11, 2023 at 1:59 PM Linus Walleij wrote: > Functions that work on a pointer to virtual memory such as > virt_to_pfn() and users of that function such as > virt_to_page() are supposed to pass a pointer to virtual > memory, ideally a (void *) or other pointer. However since > many architectures implement virt_to_pfn() as a macro, > this function becomes polymorphic and accepts both a > (unsigned long) and a (void *). > > Fix up the offending calls in arch/m68k with explicit casts. > > Signed-off-by: Linus Walleij > --- > ChangeLog v1->v2: > - Add an extra parens around the page argument to the > PD_PTABLE() macro, as is normally required. Thanks for the update! To build sun3_defconfig and m5475evb_defconfig cleanly, you need to include the (Gmail-whitespace-damaged) changes below. These were compile-tested only. diff --git a/arch/m68k/include/asm/mcf_pgtable.h b/arch/m68k/include/asm/mcf_pgtable.h index 96d069829803505c..46ae379bb14d5e05 100644 --- a/arch/m68k/include/asm/mcf_pgtable.h +++ b/arch/m68k/include/asm/mcf_pgtable.h @@ -135,7 +135,7 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, } #define pte_pagenr(pte) ((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT) -#define pte_page(pte) virt_to_page(__pte_page(pte)) +#define pte_page(pte) virt_to_page((void *)__pte_page(pte)) static inline int pmd_none2(pmd_t *pmd) { return !pmd_val(*pmd); } #define pmd_none(pmd) pmd_none2(&(pmd)) diff --git a/arch/m68k/include/asm/sun3_pgtable.h b/arch/m68k/include/asm/sun3_pgtable.h index e582b0484a55cd82..f3e7728f58cd9dd0 100644 --- a/arch/m68k/include/asm/sun3_pgtable.h +++ b/arch/m68k/include/asm/sun3_pgtable.h @@ -109,9 +109,9 @@ static inline void pte_clear (struct mm_struct *mm, unsigned long addr, pte_t *p #define pfn_pte(pfn, pgprot) \ ({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; }) -#define pte_page(pte) virt_to_page(__pte_page(pte)) +#define pte_page(pte) virt_to_page((void *)__pte_page(pte)) #define pmd_pfn(pmd) (pmd_val(pmd) >> PAGE_SHIFT) -#define pmd_page(pmd) virt_to_page(pmd_page_vaddr(pmd)) +#define pmd_page(pmd) virt_to_page((void *)pmd_page_vaddr(pmd)) static inline int pmd_none2 (pmd_t *pmd) { return !pmd_val (*pmd); } diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c index 70aa0979e02710a8..a4c552c7e2c8ca12 100644 --- a/arch/m68k/mm/mcfmmu.c +++ b/arch/m68k/mm/mcfmmu.c @@ -69,7 +69,7 @@ void __init paging_init(void) /* now change pg_table to kernel virtual addresses */ for (i = 0; i < PTRS_PER_PTE; ++i, ++pg_table) { - pte_t pte = pfn_pte(virt_to_pfn(address), PAGE_INIT); + pte_t pte = pfn_pte(virt_to_pfn((void *)address), PAGE_INIT); if (address >= (unsigned long) high_memory) pte_val(pte) = 0; 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