Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10086221rwr; Fri, 12 May 2023 03:42:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ63RCOschTZWp7vdhjpcakHnykCpC28MdRNKPTRXSYfCqwLS6Cy2smAuLw23+3HkKCzmuWx X-Received: by 2002:a17:90a:f0c8:b0:250:46b3:547e with SMTP id fa8-20020a17090af0c800b0025046b3547emr22009863pjb.14.1683888171179; Fri, 12 May 2023 03:42:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683888171; cv=none; d=google.com; s=arc-20160816; b=r4lKi6ZKQrgL7h1i3TbVfIWuWYRMMu5sVsMDfz3CCHtG238Qkt5eljRfL8Pe40buih 4QrQ4fltIdkl+a/K5LJpMW2h0UXpgwozbOIhpV7L4OlTXnWADl24EUrxzhWm+MydMzQB ZLT+FeZRkXvjf9hF2oL7B2uR2M7XU1w4hfI8DZbH6qpQhr5iDVcYtBcCNPbiP44H7amQ bH8/Mby8MiXKUkohb0PoQ4cPRddy2I8oyz0eyY3WueTbkAO4UQvPcCgfmxnJpjkVd/T4 pIhFPfDpxyYdPCXAKoWCIyBY9Q/JZmwJ1CH8snEpPEE0/l7rmXgpVKNt7xcdHzuSQC4r cGXw== 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=3pmcghYzJf2UI9vYjq5jtq1ffNrdz3w3wPXz0MAC9Bc=; b=m5Oe6MSKd1DKBjjo5vVVn1Os5zf24EYMVorLJbw9ZP1jeZHghr4w68vlNR9BgHO+1W +0iqtD0H4tcomKB9uLUQFYfXsqo7lCoLmDMrkaMaTd2QSZl+f6Z5Z/5Dnf1fKCeyPG7p xY6e/rr+85T+PtZ4sEPdg+gWL662VcJpWYabWFXOZlXIFjyB9Ziq4FjUpdGOHkBoiiPx bFKIpWR0JbPpbcBt0RZousFmPkMjAVAj4nk9scKM3USYdmrn3q2g1yC+4EaP2NR7Xt0q JPQSlKMPsMj3W585lRKPAALjKV9SB/3d/kQxkWJivPprN4dUo5e0KtuQXKW8Xog+NDon sQmg== 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 nl16-20020a17090b385000b002502b3fa445si17395706pjb.14.2023.05.12.03.42.36; Fri, 12 May 2023 03:42:51 -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 S240584AbjELK2V convert rfc822-to-8bit (ORCPT + 99 others); Fri, 12 May 2023 06:28:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240545AbjELK2B (ORCPT ); Fri, 12 May 2023 06:28:01 -0400 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF92E14E69; Fri, 12 May 2023 03:26:57 -0700 (PDT) Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-559e53d1195so140909517b3.2; Fri, 12 May 2023 03:26:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683887188; x=1686479188; 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=t7oE+wnAwx9lWj1Dzx32p5gbR9ZsZdOiJLOsGIhtwMM=; b=Gdw89S0d94MLMQTfu+rWI0A/Vb9SX75M6/1QmlaWIQyxRWKvm7PNjbzgj6QxSieNm+ fC2cSbrKeYTQ3k/pHPMp/x3DvtcAemMcW4FQuPfKxVCleSWVPnKdy4scY+OyO8XD2AtS ilFqpEGVkYgkmPoyu2+RuewMwfp0764V12vFeLbwo3KEpECSgv+UZ6v59eWrPV3teDv6 W4lEgmP2C6RFnLvOakKGE7+z6N2Tgx4gtPj930OZtvvJL2LWuBrsJTi5lbAkTXA1V5bL YraVM9d0eggOhhTJUw2cOYkBJa8hYWVXK2z17BoJRTPXR4wGRU+bSi3Bmmk+drUQH2fE yjBA== X-Gm-Message-State: AC+VfDwrXpAc3/P6ATfWX8R3BOMaPgihiO3iQ95GCL6yI7I1l3SUXLOz FZIa+rrHPLmBWFQdlxeYAuOpC5cYj6V+KQ== X-Received: by 2002:a81:7586:0:b0:54f:b244:fef9 with SMTP id q128-20020a817586000000b0054fb244fef9mr23977199ywc.0.1683887187840; Fri, 12 May 2023 03:26:27 -0700 (PDT) Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com. [209.85.128.172]) by smtp.gmail.com with ESMTPSA id b133-20020a81678b000000b00557027bf788sm5584201ywc.74.2023.05.12.03.26.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 May 2023 03:26:26 -0700 (PDT) Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-559de1d36a9so140726217b3.1; Fri, 12 May 2023 03:26:26 -0700 (PDT) X-Received: by 2002:a0d:c281:0:b0:536:cb48:9059 with SMTP id e123-20020a0dc281000000b00536cb489059mr25024547ywd.50.1683887185987; Fri, 12 May 2023 03:26:25 -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: From: Geert Uytterhoeven Date: Fri, 12 May 2023 12:26:14 +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_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 On Fri, May 12, 2023 at 11:55 AM Geert Uytterhoeven wrote: > 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. > --- 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)) Much simpler to drop the cast in __pte_page() instead: @@ -91,7 +91,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) #define pmd_set(pmdp,ptep) do {} while (0) #define __pte_page(pte) \ -((unsigned long) __va ((pte_val (pte) & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT)) + (__va ((pte_val (pte) & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT)) static inline unsigned long pmd_page_vaddr(pmd_t pmd) { > #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)) 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