Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9986719rwr; Fri, 12 May 2023 02:03:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6j/mArN/SHGSdvAdxHA6bjzP19Hw/Lbhzw4pyMS1JlefUgnucXP14JU2fQ+IGVMiELs19z X-Received: by 2002:a05:6a00:1acf:b0:643:d40c:7da0 with SMTP id f15-20020a056a001acf00b00643d40c7da0mr25485954pfv.31.1683882192005; Fri, 12 May 2023 02:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683882191; cv=none; d=google.com; s=arc-20160816; b=y1iDOlrd9iU5h+NxdvdckI2a+p/9nbwj6Iz4FDUKgFryWptW2jXzJJm//bfzVlClkd Zu9jIWbikG9gS55ORp+yAPtuwmPg1pmvbrjS9vABcKHsrdt/1ExT7IvVRVwjKKnbF/u8 Sn7KFtVqVjd0ni/JeLpyeDtJZ2ABzWK554Z7PRCOcV5ES2nOn4X4ZrK13uUG5w15vKPy vMYykDlTPaWjusTlJghyjdQWr5nLPeIw2iQKep+xjjCN8Tf23vfwez+N9ucuij+IvItJ ESQpwPviHvVa9rZPf/XqV2aRBrBA/bVJcIXaoCWE3/QKfafzAQneLqwYE+huPZ3NmJlY lLLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=htv9jQ28gZWufbBudoiECMyD+OpdEvJCkiE6sz8LUxE=; b=wDJvkVD3KY43PAWqM7YV69bn+oQ3rBDwWmoP5q7sZam0MNtV8DQz+TIPGDX176kJ3U qBE0IbXoSFNKlKxPZ4r2fQM9O2X+xa8g/DR+7v/+OwqmbpBPpwETqbIJO3LhqLCOa6Cn OXyPdmu0837QSZlC+EeO9fWyFyjXwm7ndAHK4G6I6I+sfD5kAdUyiQ2y0w+0myyeAaSM UYlOtaaOvp9ssjm7GUXQB2P2Wvh3uPrq0R/O941eYdYda1QdLZ87MTHQN9c6TMDL7AMt K/DOiRci/5tPCdi056gX/aNWh1MR7fv9Wf+axJUkZhfl2DjIDBL4wWV0uOhRxc/h6MtL gIig== 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 z195-20020a6333cc000000b005304f692247si7342012pgz.458.2023.05.12.02.02.57; Fri, 12 May 2023 02:03:11 -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 S240074AbjELI45 (ORCPT + 99 others); Fri, 12 May 2023 04:56:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240113AbjELI4z (ORCPT ); Fri, 12 May 2023 04:56:55 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79972128; Fri, 12 May 2023 01:56:49 -0700 (PDT) Received: (Authenticated sender: alex@ghiti.fr) by mail.gandi.net (Postfix) with ESMTPSA id 5F562FF811; Fri, 12 May 2023 08:56:24 +0000 (UTC) Message-ID: <1e30aaca-b4a8-4269-c368-d1f6e0ffff54@ghiti.fr> Date: Fri, 12 May 2023 10:56:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 04/12] riscv: mm: init: Pass a pointer to virt_to_page() To: Linus Walleij , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: 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, "linux-riscv@lists.infradead.org" References: <20230503-virt-to-pfn-v6-4-rc1-v1-0-6c4698dcf9c8@linaro.org> <20230503-virt-to-pfn-v6-4-rc1-v1-4-6c4698dcf9c8@linaro.org> Content-Language: en-US From: Alexandre Ghiti In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v1-4-6c4698dcf9c8@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_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 +cc linux-riscv On 5/11/23 13:59, 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 this in the RISCV mm init code, so we can implement > a strongly typed virt_to_pfn(). > > Signed-off-by: Linus Walleij > --- > arch/riscv/mm/init.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 747e5b1ef02d..2f7a7c345a6a 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -356,7 +356,7 @@ static phys_addr_t __init alloc_pte_late(uintptr_t va) > unsigned long vaddr; > > vaddr = __get_free_page(GFP_KERNEL); > - BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr))); > + BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page((void *)vaddr))); > > return __pa(vaddr); > } > @@ -439,7 +439,7 @@ static phys_addr_t __init alloc_pmd_late(uintptr_t va) > unsigned long vaddr; > > vaddr = __get_free_page(GFP_KERNEL); > - BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page(vaddr))); > + BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page((void *)vaddr))); > > return __pa(vaddr); > } > Reviewed-by: Alexandre Ghiti Thanks, Alex