Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4424414rwd; Tue, 23 May 2023 07:34:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5UVG/T1coFq0/4iIDnNa5Xn9E0rcs8CWoYQr4gFQjEKdo0VT4jNV2MOzHuN95eRJ1jr3Oz X-Received: by 2002:aa7:88d6:0:b0:62d:cfd4:e440 with SMTP id k22-20020aa788d6000000b0062dcfd4e440mr19345895pff.8.1684852492216; Tue, 23 May 2023 07:34:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684852492; cv=none; d=google.com; s=arc-20160816; b=olBrPws8zhP35cdbZWt31+wSeg4dlPJ6gfHOtkSr2yvyeQp3AlSbZau9sAsQiITEfw Vw3Au45AA2kgHjcEPH8IbqHreY4JOUzYyyPze+WLczQ0lrn2eYC1ZNkNFKnxcfFohRIN 4qTR3QGOCS9nFg9UJA1+/2howbLLFKveyiadPGjVT4U53jslsBbGK9Q6CI2/+Wf3eWqt D2lxHXc2SN5gMjrsyMij8MAEsA3Ce+gcZw1PIftexcbGOS9d0agouMGZBcPHeSAsm7U6 /vZj7tJbnbfWtWbbjwcp4cWGZQJsLDarHkJM54s+iBM+ITSrve9NkqzLabXctriRttIp cCUw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a6543c7000000b0053ef7d2f807si389175pgp.462.2023.05.23.07.34.38; Tue, 23 May 2023 07:34:52 -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 S237105AbjEWOHT (ORCPT + 99 others); Tue, 23 May 2023 10:07:19 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 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); } -- 2.34.1