From patchwork Tue May 23 14:05:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2170966vqo; Tue, 23 May 2023 07:09:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4uH8HNDdaMYoWHYhk05TByLcQS/jPQ1zQNeRlqlXdCncFYwZIZqqNbA88Lv3oDJ8GE+Sf6 X-Received: by 2002:a05:6a20:442a:b0:10b:4a5d:28d5 with SMTP id ce42-20020a056a20442a00b0010b4a5d28d5mr9939664pzb.19.1684850944662; Tue, 23 May 2023 07:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684850944; cv=none; d=google.com; s=arc-20160816; b=fL6YYsFR2jyzzDItTAjP5cxDZjfHHjRW3aez4//i50r1EM760gxxeS7gactzUSeRZk fKKiSoRfrsd0WjdJirjO3m0m9xXeOGk/hZuxAaLFs9hBXv59sHpKWZ88SHLWPf/SDh1b XN4HScsihJTdaCbDJWAPj1AqcPE3ZFZjCT1npGINaCr0dfQ9aEfTwhrYmcfeXA6kLhjR iNwGnSAM7eMSz2cldVKGQefH5oEAc/Qj+4qq2Y/JBtKfdu+49SeePaenofCObY1fzQ9T LvQce9Yl2BxjK898faZH2gjDz39Me3dZcwtPr6gdyOj2oJ61c0gn55iJzlhqrCRmAyGw V7lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=SZOtWVS1lCOxds2QCY7M+hAIKv6XvV3Hqis31ERV0mU=; b=JcR4/ENR7McPW7Q5ktA28Q3iNesE3lcJi5NLUSZicZyUs4npTbdQZPn2q5/mpX5xtj h5nK/5DuFvV6htgS9p06tw6z4jfe6GjpQ/E7crA0JU4hW5mtUflmYjUq8irTJiRUa8WL juhCaJ9EQPKwp/Y1MxGveOxn2uCOAwcS8AmCjyhsPuZ6yP3rBCZD9/FkEOzkWmyR4bo3 gUbcOz2z7gEZA+cwVhZEr+7gyAiGQK/9Ngy/9BwMG9QU87Anf8HBppyoYol39TGmYVSL Dy6nj4gninAKL+c31FWogSWQeIIsl7jRiaaihb8qBifb2n9zP3BvE6tSwdGZlqYZ4axA 2Cbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jQFz6Zi2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a63ae0b000000b005098590f1edsi2041170pgf.757.2023.05.23.07.08.46; Tue, 23 May 2023 07:09:04 -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; dkim=pass header.i=@linaro.org header.s=google header.b=jQFz6Zi2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237176AbjEWOHU (ORCPT + 99 others); Tue, 23 May 2023 10:07:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237120AbjEWOHM (ORCPT ); Tue, 23 May 2023 10:07:12 -0400 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4446118 for ; Tue, 23 May 2023 07:06:50 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-4f3bb395e69so3564106e87.2 for ; Tue, 23 May 2023 07:06:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850749; x=1687442749; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SZOtWVS1lCOxds2QCY7M+hAIKv6XvV3Hqis31ERV0mU=; b=jQFz6Zi2QlqzFhgg609+OdU2cVzXhTGama6kh7r3qdlPmt1t9W7hOhsu94u+OwaOb4 qZCyO9HFjWxC1UNvj7aH4gjawmqX/FfvnrnEMqAdWBJ1gKgK3OsCh2be1l8goABkGeca 4qq5vjGppvB0Ff3wZVKpQwbjqPgJrSjep7pLQRAqJ0vCR1bSNUwj/9E5GGjNWZG6UBIQ laVwoCR2Q+OLiyyzutCe6jstO9ARgNPtspYX4FMnjz5PkCuGHkQ+phxAPeufD6G8i1or 2yIWRKaSDcAN6pWjBjwXMvm/DRKg3Ys05cggpxTJlPQbn2mQmxpWJNhzydJrgvcQ4AmW jBKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850749; x=1687442749; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SZOtWVS1lCOxds2QCY7M+hAIKv6XvV3Hqis31ERV0mU=; b=EOUwn6UCMJNQGnikvGdlldZ3QTU9dTBGwWCUHsaxWeeLFiRI9e7iJwTZgXTdgeqTl2 +i22Z01U44cMG+Ko22oQ4SDtMT+gT2YUO1IRa58trQQminUMrF7t0/1p7FAaagcyPhAe Smq3irkRw1E2x43no0MDKW75ZcaSJyZPDjMUgAs54GQfz7tPWcPpYMdN0XgsLHFowSzF SO0HU/3QSFmHA6V98HY0Cz4riXQ+6jsCBfWY7pNZkiG/3fMjOLpnYD+NcH71jRr4tRlu 2zauCtK5MoRBlcafdB39Tpo48iBhX17BJViVf7GnH5ij42DFfIhLUvhnDa03svoTPeLR AEVw== X-Gm-Message-State: AC+VfDxq9ebhmzzG95Qm2nh8XtPzXF6MV5wcWrkesvFrzcikt/bj/1YY TkVY5qOxNLd/6507opzNIdNeMQ== X-Received: by 2002:ac2:593c:0:b0:4f3:b588:48d0 with SMTP id v28-20020ac2593c000000b004f3b58848d0mr3291847lfi.14.1684850749081; Tue, 23 May 2023 07:05:49 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:48 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:28 +0200 Subject: [PATCH v3 04/12] riscv: mm: init: Pass a pointer to virt_to_page() MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v3-4-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, 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, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij , Alexandre Ghiti X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766694264463881768?= X-GMAIL-MSGID: =?utf-8?q?1766694264463881768?= 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(). Reviewed-by: Alexandre Ghiti 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); }