From patchwork Mon May 22 07:00:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97099 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1259713vqo; Mon, 22 May 2023 00:12:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BD7/GB2MpIpWk2LxfZQyR4orbLSi6lh1JtXqXja2d0zZKTzjLm706ISjhXQ06W0F1S141 X-Received: by 2002:a17:902:7848:b0:1af:a2a4:8374 with SMTP id e8-20020a170902784800b001afa2a48374mr3821952pln.21.1684739524098; Mon, 22 May 2023 00:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684739524; cv=none; d=google.com; s=arc-20160816; b=XR35dOnJ0rWuvErNhRs0X3gHWI7NaV+Y7LYQZNHF4BKKtrenKoUcQKtNmysNNT9fjB XnCpSqFlzAk7jI03p793pt2pUSkF+/FYFhuH3TZtgVk82M6/WhOOI+HsMAsrGWfAvxHz TCqmYCz3TeEy8toBSTWcSrQZ1oawKvoHQszXrAA5bXQpZxVzB0q74mO5HcyQNonog5xU b9aqvP+SffUsp8eOy/X4QJKXkf9RUl2fRu9hIsauDOBkY63rXFcTShdinCip+joV0sRR qmTtQgNo2raYRafjDQcou+I+AmcAgamzFxBVFQqn0RBsTvMb2VzF5mAKc7TAMIC2PznY u36g== 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=YTX4Tz4CcBGOc47UheSp+g/bVVrlmTcO43VxvIAqLxkTHZTTNLd+6xhPNeOxWORSZ1 XMvyz4RzOYpuwFCbqMdF3ra0uiIh+hANB4UrlJNnoVusFDpz/NjKzZ88UJzj5+aar4em iD9M6vFzNoyrlLZZVavxymqeKWh1VFAHiL6uEscSiaLH4S2FcitLsvqLOavZM4XAWWst gBEj3ZrqbK9DO8yvwZQILMt2j3NMzEnHxxu+hryI3dsjAcrAgfK/UC+QbQ0evHmldlA2 3FGLGf+y38Hj3uyYotLZV9XckyxgXBqzHOc1UfyNR7zU2V91c0myOkuhq/JPORCabo1r uRjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HPynyF9d; 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 i14-20020a17090332ce00b001a2a4eb10d6si55369plr.58.2023.05.22.00.11.48; Mon, 22 May 2023 00:12: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=HPynyF9d; 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 S232242AbjEVHBX (ORCPT + 99 others); Mon, 22 May 2023 03:01:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230109AbjEVHAt (ORCPT ); Mon, 22 May 2023 03:00:49 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15CD4110 for ; Mon, 22 May 2023 00:00:44 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2af31dc49f9so17197671fa.0 for ; Mon, 22 May 2023 00:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684738842; x=1687330842; 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=HPynyF9dBnm8kzZsPMGuzG4tGQ0wQ3Xr3WZ6xD7T/LfVcLe2V89yhp9749clY9crPm qG+Ir4rpDSBK6txtleKSHHAoDkcHodUiVZEGspM78lo5oN/1e608teWeY9dzCA81mmGY 3yD/wym5h4WqSG+LrMozqn4fKUqn/qUP59x8v5zFk9cHktPKlbrYTkPbim+gsAhI7K0m 5w8V6qXvcsdSkuS2CIyEV8/smObrHzuoNcRONSSEORXDMznpyIH08pgdb9ej7EcewhPn nAN3lOIxQfwpuzpgrFnVMITkhgAvyIakdv0L6ph868VTBX1lS5f2Q1HzQjhTiA+la9hW 2/zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738842; x=1687330842; 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=Rl81qynsRXvJhAHXf8aPtWIXlIcOgqzmYCDJE3GdTXNNkjR2CE3uUnOOLICXonECdF Qqm3t6q3VGj+Zrt+zod3OvizTswNnvMzUD619L0LsO1rprix3bzkzk7i1rwMO0jw4+HW R8KzKuxFUlBu/eFN9+tPc/LuUEMQphojn4S9k0SxZiMo0a19WN6zvUxioWLedE8ZDxsO 3mOmlBbNSnPcvbJW0XcZt9sicdgFRyd6E+gi4o+6cLvb8i0K+80i5VRIC6UGgQvawnVH 3h5L1DyGOwGRpoLtP8IlZwVpG9Stj3d0CfDl5FU9/0O8dYSkoZHDxSJOK+xvasVDlEVF 4sVQ== X-Gm-Message-State: AC+VfDyk/29rJpxcnl5FhsD4cLTnhWE7Uf07s7NHfvJ85zbWU7xNMFUj t7+QM/P6aSRaax8mShMYlvQ4zw== X-Received: by 2002:a2e:a40d:0:b0:2a8:bd1f:a377 with SMTP id p13-20020a2ea40d000000b002a8bd1fa377mr3256924ljn.20.1684738842484; Mon, 22 May 2023 00:00:42 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id q4-20020a2e8744000000b002adb98fdf81sm1010187ljj.7.2023.05.22.00.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:41 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:39 +0200 Subject: [PATCH v2 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-v2-4-0948d38bddab@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v2-0-0948d38bddab@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v2-0-0948d38bddab@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, samba-technical@lists.samba.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, SPF_HELO_NONE,SPF_PASS,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766577431178349722?= X-GMAIL-MSGID: =?utf-8?q?1766577431178349722?= 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); }