From patchwork Mon May 22 07:00:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97097 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1259143vqo; Mon, 22 May 2023 00:10:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5wc0/7VxYidE+1ncxUym8DTWv7JXVBYApN5H1QeUUt9Fx9FwKUNrJLDOd354SJYc4yW3V+ X-Received: by 2002:a17:903:2444:b0:1a6:9762:6eed with SMTP id l4-20020a170903244400b001a697626eedmr12631167pls.22.1684739450996; Mon, 22 May 2023 00:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684739450; cv=none; d=google.com; s=arc-20160816; b=RCf+stdkboZMzCAPQKvEMIvgHMuy36xL14DikNwzwm2/7TtY7dHlNWykvUbHNkKx0q cEnofSEQMLkrQp6xhM8AU7KixXKSUkfAUQcIykNosKwwkaww47KO//y+RIbDG/rVthT2 Nm8Xm42Hu4tYNAU2k7wpZvTCtSnM9Y51mPXABFR2hEiivAcAaXa0zDtOrWV6Uk2pT2Rv i0U3ezKUinpGqL+qqBYasP4ubJnEufFopNKN12euo7sZrIysrXUfDjwHWKmj4bTAI+m9 jVQNI2EZMBpBp2kBlDPj+O5eiGCGJjY6LAIevSVncO7z3GjxlcZ/+FNxIyFoWz0PAeoo T09Q== 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=hYHNj4xOB3A9+sRrGGyA+CHl8mr8r8wePJEdzxz75NA=; b=k7hlrkcs1kJ6KMzKCaqbgxxA6gjECzYG4iXtZou4f6DbFbWV4jc+cwUnVJ7/yc1Pqz To0gfLIsEkHpd48N7VFBJBjUCSlM8e0GIs0KV9H1mVLi/4WhBd/qz9t+dT6IkP0D3vuU DKLGfIQB9RuTwKn4E0HBLQA8QkJNu09kmOrVuJ1MY5HOblwAL1YfPHdbWpG4fO3AQCNj 9gro4aqnlDPb23BCk4NSm6Za/lPdDpa9S4tZIlonyAyTrBC68D/96dYxb5d1S6uVX25n qWTNhxNypb28+OiS1J5zeSr6kidLXAHT3wtQDRROwM93S0e7DAmJQZN9HGA7Vm4LtfKV 8J/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LO7QAWEi; 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 a10-20020a170902ee8a00b001ae44cd96basi4088036pld.312.2023.05.22.00.10.36; Mon, 22 May 2023 00:10:50 -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=LO7QAWEi; 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 S232105AbjEVHBA (ORCPT + 99 others); Mon, 22 May 2023 03:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230352AbjEVHAq (ORCPT ); Mon, 22 May 2023 03:00:46 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C18B2E0 for ; Mon, 22 May 2023 00:00:40 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2af177f12d1so51127531fa.0 for ; Mon, 22 May 2023 00:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684738839; x=1687330839; 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=hYHNj4xOB3A9+sRrGGyA+CHl8mr8r8wePJEdzxz75NA=; b=LO7QAWEi3XWWfPv7Pu1gIWoRWXD05Svn0aUWe9ia+PVPpBGbWgIXoeSqDhEuCZ9m1V N7o2yMOT/bX3Zg0bXymvaKcRueAICvYEskWgjbbJN9M8kpsCCxGIu7sMq+djqX9iletp NNTzhji7kSJp8V/MfSbC+Y92IAyKCek6VdF0BjOskhtqU5NAtJBK4rohlpMp63KwGw95 x2q9EZhMOloZtzIwKBd0/W0MNFje2NGvy7nJs88/cnXEdWaUPK14XY5ambA4t3lPz/d1 gK7IocWkrX/JFXWArNaIuBZ9filDa0aW6ZCzB0E/m9A3+MAjwUl8TtQ/V31Mqm4/e4+r ORhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738839; x=1687330839; 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=hYHNj4xOB3A9+sRrGGyA+CHl8mr8r8wePJEdzxz75NA=; b=Z0KIbLTxPGU8+smkKIPblL08cZ+EUYUcGf0Nk9yfo6qv2v0sJY9oVsZhNUI9vjdWyY 471FTDOsdkeReRzF46m5Us2uLy13f9jzutBSWxtQdk82wfXFA7Gua9yL5qZ3OhyVvXQV K6G+ji5H9mF2Ul2wPMer3/qIk1haVDZs81eUMf6ICBhSyt8TPCOAmSEqJo4SZWk0hlTT 3G7DFlRjjPcwnHCfFHQ5zHwmRxlrDkxGjCet0wAtWUg+WpYm5du5y5dOvlIXmEbX8F9h F4jX9uHncAZNGI4ZjHviupQcSpi8lAnRVYF2GxhD1y1zSBCFfEjOlF+KSyaOcBWXRmEu crHA== X-Gm-Message-State: AC+VfDxfkFfLYK2foLfcsYBWU+evd38IMdD+DsxlkVF8X7mKOcRdfPkk mIZfESc+02K5eVVwIEIwF5vOuw== X-Received: by 2002:a2e:a0cf:0:b0:2ad:89ed:aa40 with SMTP id f15-20020a2ea0cf000000b002ad89edaa40mr3349235ljm.9.1684738839020; Mon, 22 May 2023 00:00:39 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:38 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:36 +0200 Subject: [PATCH v2 01/12] fs/proc/kcore.c: Pass a pointer to virt_addr_valid() MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v2-1-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 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?1766577354509378947?= X-GMAIL-MSGID: =?utf-8?q?1766577354509378947?= The virt_addr_valid() should be passed a pointer, the current code passing a long unsigned int is just exploiting the unintentional polymorphism of these calls being implemented as preprocessor macros. Signed-off-by: Linus Walleij --- fs/proc/kcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 25b44b303b35..75708c66527f 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -199,7 +199,7 @@ kclist_add_private(unsigned long pfn, unsigned long nr_pages, void *arg) ent->addr = (unsigned long)page_to_virt(p); ent->size = nr_pages << PAGE_SHIFT; - if (!virt_addr_valid(ent->addr)) + if (!virt_addr_valid((void *)ent->addr)) goto free_out; /* cut not-mapped area. ....from ppc-32 code. */ From patchwork Mon May 22 07:00:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97089 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1255318vqo; Mon, 22 May 2023 00:02:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5R2jrF9Vv7XnIzosrlpsqTggnq64r2gr85ZBIRMaTuxv54G0EdWwABYrCzOCkoM9474abQ X-Received: by 2002:a17:903:2444:b0:1a6:9762:6eed with SMTP id l4-20020a170903244400b001a697626eedmr12608732pls.22.1684738944265; Mon, 22 May 2023 00:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684738944; cv=none; d=google.com; s=arc-20160816; b=eTn/M2GZ39nDMR2YIGxQ4Jhz80541/Fb5Kbgf9DH682xh6hsUjnYBPCxYTDek6toz7 7fYTSxlCQbWicfm/+L4oncz/qUtijKGJs8E6Vt2/HUJuU338ZglNDB6khIKX0TAWFyNI NH4huDVq1punra3pV3AmY7KAqdNXklDhAtW3ORSBqub5g6qboB2FWdi6zmVFTOFXpk/r LLJiN+31xLkbMalhD9qjX8B0+z45gKtsz4sAE23OEE+8sR/yBhPk3MbpKGP0KuR7USUE BbUgW8OLjKwS3OEDVmqSi7bMK86MbZ5unxZx00th6agj4cMNHZ2DGKi9RPH9cWcuBXej VRWg== 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=y1BV5+u3+iDQGG82NKA3Uk8CjUXjAl1NpVyNEDgtFOM=; b=bFoYNt4UU5+2XtuJqhPcrFE1JSs/IL1Q3yes1M0einexHHGM59ZcIvqd/hqEHAzbCL isABMfg2uLhiSQNkpRyI3eDfLJoTt6TuE9ye44uXA9BKyfrmEbDgkxQWqVcqUBCKAj4y kx+ptLGOkgHO4FR2WgBzTJePO1pDMtCw9iLcnnRs+TLVK/d/afWFo/H9IL6XfYf/FfRZ BtxaeS340Q5rVzPzQG3EgVkdkomAgYbC3/ClhUP83nJRjRFh+WLk2IxcKTh8M7l2eTxM HRn1YewRGRngMwxfnN4XS2a+C+6KTf8jcMu6r64q79NWwUheQ1kaq9qK6aHKqYxxO8t+ 9b7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OKP+r7By; 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 iz5-20020a170902ef8500b001ab1fb8cc83si4049537plb.161.2023.05.22.00.02.09; Mon, 22 May 2023 00:02:24 -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=OKP+r7By; 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 S232195AbjEVHBG (ORCPT + 99 others); Mon, 22 May 2023 03:01:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231687AbjEVHAs (ORCPT ); Mon, 22 May 2023 03:00:48 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC748FA for ; Mon, 22 May 2023 00:00:41 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2af1822b710so49532151fa.1 for ; Mon, 22 May 2023 00:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684738840; x=1687330840; 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=y1BV5+u3+iDQGG82NKA3Uk8CjUXjAl1NpVyNEDgtFOM=; b=OKP+r7By/j3u91/9pbO8LYHiGzCG6RttQtNhTdrGq4Bc89GgPOJ758rfRT5NXv/U8C PIpZ6whX3aG9EmmY+G4CvSY4mdbVzScibpiP4DlJLf8oDC+66K49hGw6FXvuZaohOrB6 sXYdatLAKFRUiPQsB4RW5ZAeeIH5t9viv2Tl0aeDN6oE8DNR2Ocll/clZIhQiMfSvFNa NhsbrCGAJbfQDxzwE0BwV2FkvdfbjwofxwdtwSiRXAdrqZoTptDZ4pQFAJx6I1z3InPr aPVuNvgjpGcVRF1bKcf7k033n6y1BMp2C0HFtn5LNPpHBW/m7MYVreWkCwszb7jdSTaY pkug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738840; x=1687330840; 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=y1BV5+u3+iDQGG82NKA3Uk8CjUXjAl1NpVyNEDgtFOM=; b=eEbYjUjceIMLB9/944ARxqMDmLOp49vOAZ1WT/lP9undMB/Ls7ztx9UWf1GrCugTDR 6Vcu9LRaKRDY1q5gAngFTLslG1FMZviaPIQkWfZ4NdLvQLPRDsWKfdGoCIAxanAFGmWL z3PjY6iRjMQMGN+CZ5HFvSbTKQw0Jpx8HnCBzIfcTPoHWpS0qmfBWPlk6vEO/E8xFvEo po6FwfPas5PqTJwIK8ESfcJNkNjpeEl/TUjQcMoHXHaMdnuk1ORk6+0g3lxTHve5pZ5f s0i/G77S2QLb3JgH5MLwhbgx47oONGIDYCFLokIf2ORYntitzNIxdvcEvSWkyKcArGIU X4qw== X-Gm-Message-State: AC+VfDzkjn4X5EI37TDwzttPj8pm9X8MOFqYG2WhgkC3UIrcqcKyGN+/ UKAxpVUwiSiGdK4ws7zvwPIOQA== X-Received: by 2002:a2e:7811:0:b0:2ac:85d7:342b with SMTP id t17-20020a2e7811000000b002ac85d7342bmr3472578ljc.29.1684738840123; Mon, 22 May 2023 00:00:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:39 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:37 +0200 Subject: [PATCH v2 02/12] m68k: Pass a pointer to virt_to_pfn() virt_to_page() MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v2-2-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 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?1766576823277084180?= X-GMAIL-MSGID: =?utf-8?q?1766576823277084180?= 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. The page table include will include different variants of the defines depending on whether you build for classic m68k, ColdFire or Sun3, so fix all variants. Tested-by: Geert Uytterhoeven Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Fix the sun3 pgtable macro to not cast to unsigned long. - Make a similar change to the ColdFire include. ChangeLog v1->v2: - Add an extra parens around the page argument to the PD_PTABLE() macro, as is normally required. --- arch/m68k/include/asm/mcf_pgtable.h | 4 ++-- arch/m68k/include/asm/sun3_pgtable.h | 4 ++-- arch/m68k/mm/mcfmmu.c | 3 ++- arch/m68k/mm/motorola.c | 4 ++-- arch/m68k/mm/sun3mmu.c | 2 +- arch/m68k/sun3/dvma.c | 2 +- arch/m68k/sun3x/dvma.c | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/m68k/include/asm/mcf_pgtable.h b/arch/m68k/include/asm/mcf_pgtable.h index d97fbb812f63..f67c59336ab4 100644 --- a/arch/m68k/include/asm/mcf_pgtable.h +++ b/arch/m68k/include/asm/mcf_pgtable.h @@ -115,8 +115,8 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp) pgd_val(*pgdp) = virt_to_phys(pmdp); } -#define __pte_page(pte) ((unsigned long) (pte_val(pte) & PAGE_MASK)) -#define pmd_page_vaddr(pmd) ((unsigned long) (pmd_val(pmd))) +#define __pte_page(pte) (__va (pte_val(pte) & PAGE_MASK)) +#define pmd_page_vaddr(pmd) (__va (pmd_val(pmd))) static inline int pte_none(pte_t pte) { diff --git a/arch/m68k/include/asm/sun3_pgtable.h b/arch/m68k/include/asm/sun3_pgtable.h index e582b0484a55..f428f73125d5 100644 --- a/arch/m68k/include/asm/sun3_pgtable.h +++ b/arch/m68k/include/asm/sun3_pgtable.h @@ -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) { @@ -111,7 +111,7 @@ static inline void pte_clear (struct mm_struct *mm, unsigned long addr, pte_t *p #define pte_page(pte) virt_to_page(__pte_page(pte)) #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)) static inline int pmd_none2 (pmd_t *pmd) { return !pmd_val (*pmd); } diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c index 70aa0979e027..278e85fcecd4 100644 --- a/arch/m68k/mm/mcfmmu.c +++ b/arch/m68k/mm/mcfmmu.c @@ -69,7 +69,8 @@ void __init paging_init(void) /* now change pg_table to kernel virtual addresses */ for (i = 0; i < PTRS_PER_PTE; ++i, ++pg_table) { - pte_t pte = pfn_pte(virt_to_pfn(address), PAGE_INIT); + pte_t pte = pfn_pte(virt_to_pfn((void *)address), + PAGE_INIT); if (address >= (unsigned long) high_memory) pte_val(pte) = 0; diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index 911301224078..c75984e2d86b 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c @@ -102,7 +102,7 @@ static struct list_head ptable_list[2] = { LIST_HEAD_INIT(ptable_list[1]), }; -#define PD_PTABLE(page) ((ptable_desc *)&(virt_to_page(page)->lru)) +#define PD_PTABLE(page) ((ptable_desc *)&(virt_to_page((void *)(page))->lru)) #define PD_PAGE(ptable) (list_entry(ptable, struct page, lru)) #define PD_MARKBITS(dp) (*(unsigned int *)&PD_PAGE(dp)->index) @@ -201,7 +201,7 @@ int free_pointer_table(void *table, int type) list_del(dp); mmu_page_dtor((void *)page); if (type == TABLE_PTE) - pgtable_pte_page_dtor(virt_to_page(page)); + pgtable_pte_page_dtor(virt_to_page((void *)page)); free_page (page); return 1; } else if (ptable_list[type].next != dp) { diff --git a/arch/m68k/mm/sun3mmu.c b/arch/m68k/mm/sun3mmu.c index b619d0d4319c..c5e6a23e0262 100644 --- a/arch/m68k/mm/sun3mmu.c +++ b/arch/m68k/mm/sun3mmu.c @@ -75,7 +75,7 @@ void __init paging_init(void) /* now change pg_table to kernel virtual addresses */ pg_table = (pte_t *) __va ((unsigned long) pg_table); for (i=0; i= (unsigned long)high_memory) pte_val (pte) = 0; set_pte (pg_table, pte); diff --git a/arch/m68k/sun3/dvma.c b/arch/m68k/sun3/dvma.c index f15ff16b9997..83fcae6a0e79 100644 --- a/arch/m68k/sun3/dvma.c +++ b/arch/m68k/sun3/dvma.c @@ -29,7 +29,7 @@ static unsigned long dvma_page(unsigned long kaddr, unsigned long vaddr) j = *(volatile unsigned long *)kaddr; *(volatile unsigned long *)kaddr = j; - ptep = pfn_pte(virt_to_pfn(kaddr), PAGE_KERNEL); + ptep = pfn_pte(virt_to_pfn((void *)kaddr), PAGE_KERNEL); pte = pte_val(ptep); // pr_info("dvma_remap: addr %lx -> %lx pte %08lx\n", kaddr, vaddr, pte); if(ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] != pte) { diff --git a/arch/m68k/sun3x/dvma.c b/arch/m68k/sun3x/dvma.c index 08bb92113026..a6034ba05845 100644 --- a/arch/m68k/sun3x/dvma.c +++ b/arch/m68k/sun3x/dvma.c @@ -125,7 +125,7 @@ inline int dvma_map_cpu(unsigned long kaddr, do { pr_debug("mapping %08lx phys to %08lx\n", __pa(kaddr), vaddr); - set_pte(pte, pfn_pte(virt_to_pfn(kaddr), + set_pte(pte, pfn_pte(virt_to_pfn((void *)kaddr), PAGE_KERNEL)); pte++; kaddr += PAGE_SIZE; From patchwork Mon May 22 07:00:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97104 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1261440vqo; Mon, 22 May 2023 00:15:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5UlPajbcDaKnDf9jZoG0xKRZdBHtn+BxWnLPZQRGGTDI98CbldU1R6pPZHTvNLgwtMtECF X-Received: by 2002:a05:6a00:845:b0:64d:1585:fff2 with SMTP id q5-20020a056a00084500b0064d1585fff2mr14333389pfk.29.1684739759070; Mon, 22 May 2023 00:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684739759; cv=none; d=google.com; s=arc-20160816; b=LDspnJQebjHhEF7Ij2uKccH7J1sgngfokpd/bwmhF87fuyapaGXIsJ5b3L4M5HYF9x PbexseaJZ4JdLRymTqyOVDFfeCysWikVHfkIAAD6V4C9VZm5+4M5OWjuGASzluZNnK9v wYoAi+Rxi+63R8i/Ymh5x3nwML3fmbA3qRZ/PoJllx8HWjZ/dH/GQ09WSzKe7sHoAzey dYNu8/XFT4xhtw3jt5QvdPnAIoM4sG1oxphv5872MntCiBx2BDUUH6wE4BXxh479mIq6 6E474+ndZIGi+WZHXevlIP9bS40xX+LANYfqF6A1m3Ef1FdkKH+zcBDF6pc00e5XBgSv Wqcg== 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=2CPc/Vm/Ur0JOy8kF/L6fs0qWXc+VKBrwCqiZQE3hiQ=; b=x2dAotP4DLlyxPx8wW12fq1xZOmgOGCjbCOFSmTy5ZNXaKK8dzcQIJCEUCXplzmc1o owZO55WCym3WTGcZiuyR0XrYge+AobkKzIpjH4MRQwkUeorunqxYP4rN2+73c3YirXKf c8LQwVq+y16IP1hwYI0Uaeat5T3ZOdDx7s0Z1oBZrgkFMpcvqiwa53Rnud81ThoFnRw5 PqWgq5VOzqaHqIpAwQ1yjRGKkPNE7DHeRj2pcOwowVxG3J5Vtw2pTV+GXx/TQYsc9BRs bGZCakqV2f3Kb2CixU+QDo6CoT4L0jWlHxVYGmWShE54M9nAxsa65D3gdLiXGIjpRz5P 4YKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NrzO6oCP; 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 e28-20020aa798dc000000b0064672de37cesi4416666pfm.192.2023.05.22.00.15.45; Mon, 22 May 2023 00:15:59 -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=NrzO6oCP; 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 S232211AbjEVHBP (ORCPT + 99 others); Mon, 22 May 2023 03:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230486AbjEVHAr (ORCPT ); Mon, 22 May 2023 03:00:47 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16B7594 for ; Mon, 22 May 2023 00:00:43 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2af2602848aso34470391fa.2 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=1684738841; x=1687330841; 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=2CPc/Vm/Ur0JOy8kF/L6fs0qWXc+VKBrwCqiZQE3hiQ=; b=NrzO6oCPjwihy/7NbpJ3YcgsArRc78cEfJMpT9F0OLcbOW2y8Fl22oTOY/WH+QouJU 4sULmDBFIIZPjR6Mx3pJe8TZEIahkyyb7WkWsNTDeKsKYKrPJekLb/gD1GgHaIpqlCsj 6QSKMiFR3KohhV92qLpgW0jRCS603xx3WtBCfv+WNRiPUwpuMiR+QiKd4LB4eBXFxrTl iNaMwVqg/f8wzqRqyYInLs1GFw2HsoBArqyOCLOOOtgD3dLXhiOQx5YrwSt21rFQERmE n4MTcZbVb2/vJmHdtmzbg4g68dyWgt0y911Ry3rDmEQOUhiC9fxEWLl1Lpop3daP//x6 ClCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738841; x=1687330841; 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=2CPc/Vm/Ur0JOy8kF/L6fs0qWXc+VKBrwCqiZQE3hiQ=; b=FmX5bHvs4cL9//ArMtTDal/bpa9l5t8KcQA5RRqnWubbQrjGFA36cZzFe0ZphqzLaF NxiNuTBV7dlMKGInQ7x0EF34+ji3LuJDcSE4J5F7uNMwriWWEYI7q05YPpZh6iTr0uIV x1n+DMEsrjTTehNZTIfrBRi7R1+FLmfXBp0n4ZndI4aN8McexpEF6toumjyeXwXnu2Gp oYAvXnzlFl/3R8Se5qnr9GNAT39/EAumU/jiJRghFJSMaF/nCC96mg2wbEO66t+rh+7H fxXCbG4yhKyN+hzRZARVM1lYSagYaRHfUWDcxjWvUcP+NDExiIi2N7mCnIDBjQ4UIOZP B5fg== X-Gm-Message-State: AC+VfDxObcBoopTzgCDLVGPLr5G4zpJWnj4H1aHXx1KrFC6hPT2EZ+dg wiqcFyi3czFAC+k+jUbYYpfGAg== X-Received: by 2002:a2e:9115:0:b0:2a8:c42f:6913 with SMTP id m21-20020a2e9115000000b002a8c42f6913mr3287059ljg.36.1684738841185; Mon, 22 May 2023 00:00:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:40 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:38 +0200 Subject: [PATCH v2 03/12] ARC: init: Pass a pointer to virt_to_pfn() in init MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v2-3-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 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=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?1766577677485939751?= X-GMAIL-MSGID: =?utf-8?q?1766577677485939751?= 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 call in arch/arc with an explicit cast. Signed-off-by: Linus Walleij --- arch/arc/mm/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c index 2b89b6c53801..9f64d729c9f8 100644 --- a/arch/arc/mm/init.c +++ b/arch/arc/mm/init.c @@ -87,7 +87,7 @@ void __init setup_arch_memory(void) setup_initial_init_mm(_text, _etext, _edata, _end); /* first page of system - kernel .vector starts here */ - min_low_pfn = virt_to_pfn(CONFIG_LINUX_RAM_BASE); + min_low_pfn = virt_to_pfn((void *)CONFIG_LINUX_RAM_BASE); /* Last usable page of low mem */ max_low_pfn = max_pfn = PFN_DOWN(low_mem_start + low_mem_sz); 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); } From patchwork Mon May 22 07:00:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97102 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1261317vqo; Mon, 22 May 2023 00:15:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7LzMICKjX+XiCWWyTlgCH5pc6S1CRZAtga/arrp9Im9hnfHD+CVfMjkSY2NaCTY34iytZq X-Received: by 2002:a17:90a:df82:b0:252:a0dc:7950 with SMTP id p2-20020a17090adf8200b00252a0dc7950mr9462572pjv.2.1684739740965; Mon, 22 May 2023 00:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684739740; cv=none; d=google.com; s=arc-20160816; b=aAAmvFUeQZyWdFBMW56y2zKaycje3ImPO8SE3hBhRmYLeTATyRMge3JDX4Y4r1iPzZ +Y5vGftQrEYQ0L4uVzILNOu6NX0JCJPe9PZ2UmZSG0j+pcSlBQCfztjm9N4b6nsV/Kct Ok545AX8ohOGB56fEChZDKHRn3bvRz1iWcDfOjd8NrAvNsMHr2SDKsoOreEG4M8p3zbP 15Yzp1sIovND9gwjAwhBLFDGIwicq41o2YIvXYugfnvDf8Z5lHngNT9C5PvwNI3dqu8w RzPxe+fPSJ7QRYqsXTMryuoZ5tPANQPUKl0BNihubLw+3ReOAnOQXHGJ2gaaqrha+Qpv mKQw== 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=b/3885L94lN4KFkmIG4KL0Z1VLtyVywWWWjhcZ8AdCI=; b=v57yHiSOeXrLzZtVyOyhpP/3GJQ+wQ2bh6boPJ98j1duff0Ry0MfgCN2cGio2hppuy loZN8J3RFiTBODEW9i1NC05PVdiDH4TgexnhMNbxOOT1eMNeY58jmgpse5P2pqewNVMn ZUmTXQ3DCNTyDVs32k3tfieyRLPTV0qBOGi7WwLeqAimWrMoZhpbg9lVNTfN6bUxewzy 1Vjn3ydNwNHJ4PJo0TpE2nmh9Xi3VHM8pX0iI1sIIMKCEHGPoW0ciBgjGWsyRcfXhEOU w6J5XsH1RTw6vJvLbzqjsP9wujPVHFktUTeHrDO4Kx1zkpam0IArkb6naYXV6sbG1DWb QLog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=msJmmXil; 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 go11-20020a17090b03cb00b002506da491casi6309592pjb.72.2023.05.22.00.15.26; Mon, 22 May 2023 00:15:40 -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=msJmmXil; 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 S232254AbjEVHBc (ORCPT + 99 others); Mon, 22 May 2023 03:01:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232040AbjEVHAv (ORCPT ); Mon, 22 May 2023 03:00:51 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD73A132 for ; Mon, 22 May 2023 00:00:45 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2af1a7d2f6aso48823011fa.1 for ; Mon, 22 May 2023 00:00:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684738843; x=1687330843; 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=b/3885L94lN4KFkmIG4KL0Z1VLtyVywWWWjhcZ8AdCI=; b=msJmmXilknfX0gustXHQKSFGoGGpP7zNrDPXSF8hGlzB+iOnAsG/9I6PNDaTC7tpuP LHrjj4nADiOaY1JF8IDevtTJnrfZzdlukdM5EjxmOQMluBLXF00uxSCrlJ7fF0ejN4JD Q4LwkNUmpBY3r0XYmP3BaT5xUCGJ3H0IrrWD/2ui8jqMelbfiq8VPrnWpZSMsASEmnHp U8ckmtBg7/nb/4CIadFGBoWiB71MX9sNNtt3ZXZuNUZ4nD1NSR0DTjKbTfHDFJKiWu3S oI2KEw+qKpXMHbdxZKQDP3RSyQcxiJeCdJJD4p+woUWbiPjn42x6zslxWBMZPoVgpmY0 MXjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738843; x=1687330843; 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=b/3885L94lN4KFkmIG4KL0Z1VLtyVywWWWjhcZ8AdCI=; b=YZwXFrJADzkxQhQ1rKLX22iEFx11/UAZgilqW8wrMi2FNiNMbA10OuiXzQyhc4i6w+ CsE1qGPRbgjrLY44f+2maTR7kVzeJXhAeev+lIlUJjyQMdhCIXCXf9PSXt0W73DOiDA9 vFBe4m552LgF8zrTEjMxQQxgxZ+/oWNWvgTS+ypQeXIQmU80VM2ojQIMfgN5EUIBVm0V fzPub57G3ugBDoEZlVpC8JtScMxT6E1kAiuafRtORGQrC411QhSL/Mql5ZKhabYulP6B xXWT7MrV/C/0Q7YbKQ3zjHrbrUbqNYLouH5yw8wowLGXpOYZWGQGbB7NKJS3e8nkHmff muaQ== X-Gm-Message-State: AC+VfDxtDbN2Fch+iGZLeCV63xe5/LC1GxOVgFOfIQXWkFnnyHvmEsbp TnEbpDjZbLKFJcxI+OOUCDtBaA== X-Received: by 2002:a2e:9081:0:b0:2ac:8486:e318 with SMTP id l1-20020a2e9081000000b002ac8486e318mr3451294ljg.35.1684738843518; Mon, 22 May 2023 00:00:43 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:43 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:40 +0200 Subject: [PATCH v2 05/12] cifs: Pass a pointer to virt_to_page() MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v2-5-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 , Tom Talpey 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?1766577658371219664?= X-GMAIL-MSGID: =?utf-8?q?1766577658371219664?= Like the other calls in this function virt_to_page() expects a pointer, not an integer. 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 up with an explicit cast. Acked-by: Tom Talpey Signed-off-by: Linus Walleij --- fs/cifs/smbdirect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index 0362ebd4fa0f..964f07375a8d 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -2500,7 +2500,7 @@ static ssize_t smb_extract_kvec_to_rdma(struct iov_iter *iter, if (is_vmalloc_or_module_addr((void *)kaddr)) page = vmalloc_to_page((void *)kaddr); else - page = virt_to_page(kaddr); + page = virt_to_page((void *)kaddr); if (!smb_set_sge(rdma, page, off, seg)) return -EIO; From patchwork Mon May 22 07:00:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97101 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1261313vqo; Mon, 22 May 2023 00:15:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6w4VkP23m/ir8wl5ti1PvC5/E3wCqPHl7yHoFCrLAfZNlW62lcWLKjIKqiEBEeDF4OG/Dx X-Received: by 2002:a05:6a21:100c:b0:101:e4f3:5336 with SMTP id nk12-20020a056a21100c00b00101e4f35336mr8307705pzb.27.1684739739814; Mon, 22 May 2023 00:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684739739; cv=none; d=google.com; s=arc-20160816; b=nn5FO08vHk0UsPd/woy8OVKMeepW7sJUMSxvPE8d8C6L/NUPuT7OYqK+3edEtBET0E 1/1WLyqcLE9dValBI2lgeNsj19TRMqt5Qyc9XY89QRvRsqfvG83s2Lp/VeuapgzoJTtn Fpse3rvkbVPZEstUc/M6xEw738pKIfj51aDV+7oyEXemqj8M1bUJhXv4TQtmciWMs4I2 Y/9oBiu2IkTmCtnBuoNd9LdYSjp1b5k3d3xAmr+XUvf2bsnRhLW4yTctUEktb9iquZXF Ytp3J3oh8IE96SqlNYf7z+2VYVCh7+3Qv/7rrFcpc7ltJH07M6fOZ/FazMoe3aDong1j dtEg== 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=AahUWbcM1gd1dIKV3ajpbH14PSzhJ7702+mo4mqS4bw=; b=HbGue12vJ4v2q/nXu2mFKvhTgP5NSuwAC6DZvuKK+LB/c3Hts2jkwsU2O2r8g13mCg EG9PeQ2o9O7W9wnRsrfkBRW7ilGU+KWeHM0xZTrW1kiI91Yx2rA9+E7L/GFvMD7g1R9j iB3T/eh1g88UGAFVvX9e03JcIUHyyep3MCoGAK+IFtiN0jIbXmVWPmnzi7fCIXvvVQu+ LarT86gTgpXhGRoMIMjt7TcAnDB+J5V5fXiLSaybb/ZOwWNayVkpM1Y1UFmBWYgxysVl o8YpjHNpvONgZ2sPNcCTHKg4xdSn/UFP7b8bw8SHWpl0rM1o5iIrOYwlh8zfm4azk2nw Eyyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BOx3hh3z; 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 i1-20020a639d01000000b005348464b81fsi2840431pgd.371.2023.05.22.00.15.25; Mon, 22 May 2023 00:15:39 -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=BOx3hh3z; 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 S232266AbjEVHBg (ORCPT + 99 others); Mon, 22 May 2023 03:01:36 -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 S232053AbjEVHAw (ORCPT ); Mon, 22 May 2023 03:00:52 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6DEE133 for ; Mon, 22 May 2023 00:00:46 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2af2db78b38so22153281fa.3 for ; Mon, 22 May 2023 00:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684738845; x=1687330845; 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=AahUWbcM1gd1dIKV3ajpbH14PSzhJ7702+mo4mqS4bw=; b=BOx3hh3zVFySbprqCFUQMf+fnYuA2iUWep9gxTTyP5WeKKesv2gkIt/oZ6gEvNuPqI gsjbEjKEDWqEmE5Xz+Nt/ksrroHKs3LUAOgWVbkRN1Kydxt9EKFhkr8TpfFEhu56yyMK Fi4/TilXApxKBTJwYVjZxj/UXLWFIj9+4VoHAGULRBmHb3Zda8kO4YxVCQ0d2N/ryL0/ trIrcEVfvwtXA0iflvfhHsiTC15IrKKRjozmZ4AWsaglSOB7UzCOIdwM2j6Z++exTmfV E97bpCK0CgHzzii3nCIaFh8KtL2mBA+CmhLDuwxHMJPOnCXsxBPehRvCb+Dc2MeynGDJ h1cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738845; x=1687330845; 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=AahUWbcM1gd1dIKV3ajpbH14PSzhJ7702+mo4mqS4bw=; b=hxvM4a+ghqPQZJiUOW9k0G0pDlmHw81kF+xo2SsLiuu0TLniZ9uDNaDT5nOM2MU6rR n6w/XfC+9kHFUtA+V+qphile4yqfpHgUhD38uBj7TnHP/Y0Hqi3zJRn2VJi814dSzMxd hMNnIOR0Y9a8rzM6E+EiiuqMvmJ18KSDqu5I0i+AnuU2EYQYrBqmeNqsxFmynmkNoQN7 4iYYj8SkH4v1qUHiaeDo+MwtyNoSMDOlVxZU7sWmol88FhjWGCJ1HMGFEYT9jyyCl2/g xqzAo79xoHJRQXOXVznx5ST3eP+1nKxaJMhwh2j1AMo0Fju7bvlKB9EczY3bvYyA1eH1 YHmQ== X-Gm-Message-State: AC+VfDwxQBuEz9RCVh58baJBLwM7JHJhYoHS1vBz2tjwdqBGpjGofNqk OQJLDf/8z7zE2biOr0lHt9sXqw== X-Received: by 2002:a2e:81d1:0:b0:2a7:a719:5943 with SMTP id s17-20020a2e81d1000000b002a7a7195943mr3785908ljg.40.1684738844861; Mon, 22 May 2023 00:00:44 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:44 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:41 +0200 Subject: [PATCH v2 06/12] cifs: Pass a pointer to virt_to_page() in cifsglob MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v2-6-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 , Tom Talpey 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?1766577657266375005?= X-GMAIL-MSGID: =?utf-8?q?1766577657266375005?= Like the other calls in this function virt_to_page() expects a pointer, not an integer. 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 up with an explicit cast. Acked-by: Tom Talpey Signed-off-by: Linus Walleij --- fs/cifs/cifsglob.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 414685c5d530..3d29a4bbbc40 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -2218,7 +2218,7 @@ static inline void cifs_sg_set_buf(struct sg_table *sgtable, } while (buflen); } else { sg_set_page(&sgtable->sgl[sgtable->nents++], - virt_to_page(addr), buflen, off); + virt_to_page((void *)addr), buflen, off); } } From patchwork Mon May 22 07:00:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97090 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1255552vqo; Mon, 22 May 2023 00:03:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Rw4ZnK8yTYxdRIBiQKL7J0BFHCSOeaJJfsaY0NTinO5/0TagUI0o85d1uFXh/Sk4V6LTZ X-Received: by 2002:a17:902:e84c:b0:1af:bfb0:e7e4 with SMTP id t12-20020a170902e84c00b001afbfb0e7e4mr133720plg.36.1684738981608; Mon, 22 May 2023 00:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684738981; cv=none; d=google.com; s=arc-20160816; b=PfOFGQuEQwv3KLlRWgBmsBjW65+qg+DiHgNdE4uSMQ3ZnrBS1Oi4DLURumdkH9yGC9 kGU7lnnCxJ+zAu6+eLvroKMmmz9kHaCrk/pErSQ0sYQstl8TW24L9SvTE+r+9OXkYpV3 IIG3V51Cp5dazPSoK8cwrwpHrcRvnRvmcLkS8W6sUN6vMmCl3RL0rwidKpYvW7CY0ey4 jEuyVnuhEIy6ZKZJj5g3ODpHF4VoOGpzU9v5GY+dfuDn32fpIUsdJsepbfVnht/OlZ4j NSl0hH4gZghZ4cf2QJgAZkBeFs3KzhK9COAaQaJjSm8Wy9yV1iNIi1qVAA32w3ESoAPp Dmfw== 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=cbjvTSrc7JXib/jYCtsnbT8Pj+twUmj4f7HYrh8lbjo=; b=TT87B2zl28LS9U0FdjwNYlC6aDnoqioTVpNeXFFkAiaxlowuA7ctiUR8+UtWA6lsWw uTe2TwduKKJ+1fIVrChYDUTqoJJ848THHXrlvqCiMQI6MPjPY8n2A2sNYvovkUMFZ5IP RxCL10Mp3puM+YoQ9MXZdpU0D8cjm4xWGLGNn5hCjq5FD///RMWGOFepEi3qiYPssHd4 57rpxWV9xARtanJiDp2dy6zipok8PWDp0mtkKw+Cb+Ny27EgLtVLHwI8XNCHvKcpgyck kKv5/f4+KdgpMn54zdajtSHFppzLVwSaCn3YPKxAGrQ2Ly5aT8c/Fz65byi8075KIB2f BnwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="mY0aNW1/"; 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 v4-20020a170902b7c400b001ae4c3bbb0dsi505014plz.145.2023.05.22.00.02.47; Mon, 22 May 2023 00:03:01 -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="mY0aNW1/"; 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 S232282AbjEVHBm (ORCPT + 99 others); Mon, 22 May 2023 03:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232132AbjEVHBD (ORCPT ); Mon, 22 May 2023 03:01:03 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E23ACCA for ; Mon, 22 May 2023 00:00:47 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2af1e290921so43965561fa.3 for ; Mon, 22 May 2023 00:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684738846; x=1687330846; 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=cbjvTSrc7JXib/jYCtsnbT8Pj+twUmj4f7HYrh8lbjo=; b=mY0aNW1/EfjKDkZ/iGL1m6Zy8Fuo6cIs8D94rSpcZbEbpG1ej+LIXwwg8IjfW1ubMf naeqWo2Tcv4U7TJhz9Le9MuCuBLyv4D3QBwlIS3zm4uuM0sDBiKrRy1hwX60LW4us3Fy lkizvvt3WsoYNWJw4yNFIDsi+sL5v4YZ3faevgqnaAPtaHVH/NygExxLIfBKibX15pwh tHGJ8JNozxqi8y1yMVmjsLj2PaJE+bFjBQdfzX3wucmA58zcUBePI0oa6lqw7Yl8bVB9 VaJ8pSouLbJ41Y6QU3Shc7N4h3wuDh4QnygF5tReoR09XiD0FLth1k8KkiUU3nySSVUd z1oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738846; x=1687330846; 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=cbjvTSrc7JXib/jYCtsnbT8Pj+twUmj4f7HYrh8lbjo=; b=lk0znYnKTo6AsBtoKJN5MqNTANx0HKodFtfbLL8VukpNPKsP+LZ5MWnbXI0/pbq4IT LaEBUbqlp0J46ardapi4+oPbmYNj0NlliH+NFMeL9Gv996+gNpxCCT5elXTSc1uee3sp jgn+iEEizvMDr2Em+qwL+MPLYXBY/alheZzvbffae1ASFU4dYAS6fc01euXnVo8ZD3Gc qf89Jvu4+Hm3q+YtLEMeM9ANDqK54jSCE/7II89aOMaaZ9CAPp5bER+0ulhaGixRrpaR Ji5UGPIrjykCGZuYLBCj2aOpRcHvQvZgpig6okopyMm1daAAaKLIObEymlRpvwilM1N1 s30Q== X-Gm-Message-State: AC+VfDxWeQ9kGndJAx05Qfm+qr4eJPuT3gdJV/4wTVmlRnOBEkgEi11j eOf4X6J+RXNWzkRNoQNQVSGjgA== X-Received: by 2002:a2e:88d1:0:b0:2a9:9e99:a508 with SMTP id a17-20020a2e88d1000000b002a99e99a508mr3233749ljk.53.1684738845921; Mon, 22 May 2023 00:00:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:45 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:42 +0200 Subject: [PATCH v2 07/12] netfs: Pass a pointer to virt_to_page() MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v2-7-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 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?1766576862331184536?= X-GMAIL-MSGID: =?utf-8?q?1766576862331184536?= Like the other calls in this function virt_to_page() expects a pointer, not an integer. 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 up with an explicit cast. Signed-off-by: Linus Walleij --- fs/netfs/iterator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/netfs/iterator.c b/fs/netfs/iterator.c index 8a4c86687429..0431ec4a7298 100644 --- a/fs/netfs/iterator.c +++ b/fs/netfs/iterator.c @@ -240,7 +240,7 @@ static ssize_t netfs_extract_kvec_to_sg(struct iov_iter *iter, if (is_vmalloc_or_module_addr((void *)kaddr)) page = vmalloc_to_page((void *)kaddr); else - page = virt_to_page(kaddr); + page = virt_to_page((void *)kaddr); sg_set_page(sg, page, len, off); sgtable->nents++; From patchwork Mon May 22 07:00:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97092 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1256993vqo; Mon, 22 May 2023 00:06:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5bCXH+DBk6d3sm6/khImPQr0nfczEKLrfpQ6P/yW0U/W6yXilc+xW0B6fftxV6JqpMRB5A X-Received: by 2002:a05:6a20:1444:b0:103:73a6:5cc1 with SMTP id a4-20020a056a20144400b0010373a65cc1mr10778729pzi.4.1684739164716; Mon, 22 May 2023 00:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684739164; cv=none; d=google.com; s=arc-20160816; b=vsuqssvzEZs0AjVWXASRXGoUU7MDFegNHfouyjptDItHIkLyqB3y5OzqeJckmVojGr C0BRBwBMMqeiHa3dYaSTFBYvtNQtToHJ5aM2xiV6IDWfMBiaENQquswHjeoMOUW4xRji /t34TJbu0fKeaDrEySo+BaQdAvlliOeC7HiuxQ5wCK5aUUO5welUEsfnHr2yQ7iNvP0P LDyspJMlKT40bqauUK+/qxUE73fTQzr3vO497h+DTuVpUJlF+ZwktFzizbc7SbdddMQ7 WqxM04s9TeWpvINWXNvpW+CKYyWA98cF7eGHstYjViZdiKrg97NwuGVc7vudleZoM2LC hKmA== 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=H1mJE8PBb75X4TbUyJXZ6L55Fw+NsuGtTu+nI/l3Cvc=; b=gRoAdPLvLsKgUaU09fUoiOWvjrroM2jRvhQlFhpFMT/quMMLihGLbSh9e4cIcMDlQa kjXx6YoOVAkJKRYF3y6K8MPlBL3fn2PdicH2fEw+kJDJPdDuQFNyOYREFiA0QuBRiXZH y6LOAC1Fk1kyPcfCW1YjV++i9o/fvWSbtUMrLGoPZ52uAyM2IkEoOZpfdXOoYuZSVdyU 2aWB18n2EWdEtPaDqgI4E5suPQLXH7sfuojiYHxALymGioSCN/Cd8W+JDRc4ahouYWI3 /4UqxexYdNC7wpbOGceSLdUtDv9LIsmR8jpJujehrtyrpMy8WR2L9N0rzJPQxkVG8Fi6 Gy4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FMR+Qlxw; 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 v11-20020a63b94b000000b005073e333addsi4182147pgo.390.2023.05.22.00.05.49; Mon, 22 May 2023 00:06: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=FMR+Qlxw; 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 S232312AbjEVHCH (ORCPT + 99 others); Mon, 22 May 2023 03:02:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232147AbjEVHBE (ORCPT ); Mon, 22 May 2023 03:01:04 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58446E9 for ; Mon, 22 May 2023 00:00:49 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2af316b4515so17193821fa.1 for ; Mon, 22 May 2023 00:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684738847; x=1687330847; 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=H1mJE8PBb75X4TbUyJXZ6L55Fw+NsuGtTu+nI/l3Cvc=; b=FMR+Qlxwuc8HLvz2Un+03lMzADefhZtZYcE4XHeTZEM0NlyayLDLr/ghrIPr4wOfsn hd18jrfSt0sSLwyi2R+kpdFTUKZrJ+BZ/C8tqM3Dro15MT0Bz2r43LqkO6JTuURAVyjo Hb5ibuaMMZUbyrbu0TGj+c4eZkPKyBY2Q7Hmx1HpmabTY9nj/7nqGyXR7uNb2h4G+5o+ IbpEDIbdkQb08eN8cpfyD7jW1r5UTuEKzmsjHWQMxcDTMqfGNaZaaT25Z3ATIrIWcChT 9UniGw6vl1lHpSHdcRd6BKV3duDmePJf14FnN89u8aN1cFzRNUW+g2/WjLxXlTSI3LHB 9xcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738847; x=1687330847; 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=H1mJE8PBb75X4TbUyJXZ6L55Fw+NsuGtTu+nI/l3Cvc=; b=aCcqD0iUT72iLePKJ/flZtKH7JAnR0KNCLicbpZrs2GjuYoD2J30pF7pGA/NHM5TRn o8l+/ss81iyKhpoxtHtMwNIS7ZLu0D+iIJ7XVV2Kqn66rkqBL2DUqFFNdVQB+vyk2YSK 286r9K65jqQoZgc3kQCvwgpYwtvx6BW/AhwBPna9EH0e4WzyByNdqt8VgCKhBwV/tew+ UvQzwqdI6fE0Y6oiQpV96ulvvupHil9fz+vw2g29eUZtGenhqtNlQT3F3/nboG5e4/HX Hp1pi+Abt/WirsLj+oOD1DIIkk1oSHyLWYGtP/3CDbpPe7y2w5+exCWPyk4YoellI+Xq GvXQ== X-Gm-Message-State: AC+VfDy075tXLqsR7Gij6sv6viS+ILOxcOeLBBJbvs31FXHYU8qwFyTH 9WeQaedBnYPaPApcy+KBOk2fW/HQWy2rVTWYyl0= X-Received: by 2002:a2e:a40d:0:b0:2a8:a5b8:184a with SMTP id p13-20020a2ea40d000000b002a8a5b8184amr3297249ljn.40.1684738847083; Mon, 22 May 2023 00:00:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:46 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:43 +0200 Subject: [PATCH v2 08/12] arm64: vdso: Pass (void *) to virt_to_page() MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v2-8-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 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?1766577054409755743?= X-GMAIL-MSGID: =?utf-8?q?1766577054409755743?= Like the other calls in this function virt_to_page() expects a pointer, not an integer. 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 up with an explicit cast. Acked-by: Catalin Marinas Signed-off-by: Linus Walleij --- arch/arm64/kernel/vdso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 0119dc91abb5..d9e1355730ef 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -288,7 +288,7 @@ static int aarch32_alloc_kuser_vdso_page(void) memcpy((void *)(vdso_page + 0x1000 - kuser_sz), __kuser_helper_start, kuser_sz); - aarch32_vectors_page = virt_to_page(vdso_page); + aarch32_vectors_page = virt_to_page((void *)vdso_page); return 0; } From patchwork Mon May 22 07:00:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97100 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1260807vqo; Mon, 22 May 2023 00:14:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5TMXZLYzV3IQ71MIVoiOpnsOxQ2HUGM6ItKjc4g8J73wPDTDbX3DWcybQBdX0rDwlWXXHK X-Received: by 2002:a17:90a:70cf:b0:253:266a:3b00 with SMTP id a15-20020a17090a70cf00b00253266a3b00mr9362298pjm.37.1684739677108; Mon, 22 May 2023 00:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684739677; cv=none; d=google.com; s=arc-20160816; b=QyayuBGLHS9id3nsXzNFNjQ0ALQRJtm4dRZZgDd7h+AeFOgpFLEYorqMCQqrsQ/mtw 5iIzGb5XZTdDzJTiUdxzS1S01XMGmuVkZy+Lv5gR7vpYeZtJiAYn/8uauvflG+4kO4Az e8lMeKPWDmJOkZ9BiztnXM7IWmFq74VDlOFBVS72AW530fP6JGVAsdCHGWe8cKwEyEc2 l6tBnvamS73oDA7gj1BdQLT6TV0yn7JKHvupJzrZe1MhW1E0h6otaM9no+7+aN7j6X+2 uch68ibVAPpWBagchkdQrE59NNd3UxgZbjhfLaZppcH+8ci2yYRy0I2h8ErPwQ5vCS6w fHCg== 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=UDtU5Jqmt1rhTrWGvrFpFNAhujSWuurCg4wxa03/anU=; b=AONfAAZMrnsFVzGnn4T7AsxCflbiCmylFoMW0ZmEwzYaXSAoxfSVPhr3/9BFj25o0T 9+ZFith/GWOSEHafAWGKYRdtlHxzgVSGKQ8k4lGFhbSQjEQlPj/GyZbN8mP6SaLzPhLv BLwiHq3F0NPF665BIChOnWaGPfd13KOtcGXsVsYSy8oXoFOa2NmttJLfcPrYmsP7vX7S seqTRu64C3zO2y2FNK4q6X7ZNgImR19W+SQP7X4f6uVLdDdPbvJl1EaYAvemfA/3nbze myNpgbjYHTbkGhMESW/tvPwRw/hDMUkSTW/0O/HZy0h+GtFigXc07qQQrRB8XkzyDezX hU7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EgeeaYxH; 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 p4-20020a63ab04000000b00535f192eac7si405742pgf.211.2023.05.22.00.14.21; Mon, 22 May 2023 00:14:37 -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=EgeeaYxH; 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 S232332AbjEVHCO (ORCPT + 99 others); Mon, 22 May 2023 03:02:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232193AbjEVHBF (ORCPT ); Mon, 22 May 2023 03:01:05 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A881E107 for ; Mon, 22 May 2023 00:00:50 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2af20198f20so41911611fa.0 for ; Mon, 22 May 2023 00:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684738848; x=1687330848; 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=UDtU5Jqmt1rhTrWGvrFpFNAhujSWuurCg4wxa03/anU=; b=EgeeaYxHiw9wjOAGc/5G+LN0c3KUHNjvlMLN8uS8AnOgASES7fyW/rsQOHqr9DJIm4 Q8pNdnQ8gVkoZSj/+upHrsi/tavYgOTyzBUdlAtcr2Kh9ffmMPH4gQgxiD9jwMMKDMI+ CuKr2WQEU8br9TaFssSRKesDxf+IahbGC5Zx0cbDL1B32MIMmQqJEpul0X/k5OkwgL/p biyoDSbwAxtoAdQjplEuS+uPbUVkhGZwVNA6jM4DVWvLhyshkUq3uEnshyu8D9Pr1j1Y dtZh4qZurb2FlkyA/lCRl9W6OQ/h4jDhIaJlJh3cxPH3CVc6wzd8qQhjtgUMnfkuf6pl /E1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738848; x=1687330848; 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=UDtU5Jqmt1rhTrWGvrFpFNAhujSWuurCg4wxa03/anU=; b=TFqO43hd96uQ7TSKeT/xhXeahhu/eh2tXOYB8vrHxFJ23p70sg1X6O7TcSCnaBYoy9 Pf49oHI+6tYIM6lRinxz49hSXbIMz3gzsJ0yUzseVMeOZt/Vhn4Up45NZuAZuwFUim80 V11mItSUIE8ijS8QY9fJDdgW4goSKRNMQp62M+U9bGsHBitmvTrGK9wbEmMkfLnHKsM8 IgU0LYo2PsyCoU9W0CYZH4wXZi9fk8lU8pWoJ77xkVvO4OWSTpcsJnm4Q154UXuEn+pd jHgnr9zH+Xg06NlVz7W1dMZsFtu0AvFyjGLwz5HLKHEK+ZXVnEawlrZ4kKMKyV0KGhYC Vykg== X-Gm-Message-State: AC+VfDzhQcyRVgQ6y28v7dhwK/FStbpANu73xPfotLVDmRXmLO+k36bW MEKHjK/YLKrbkiuWt24bxPWoZQ== X-Received: by 2002:a2e:9588:0:b0:2ad:aa42:8c0b with SMTP id w8-20020a2e9588000000b002adaa428c0bmr3570722ljh.35.1684738848500; Mon, 22 May 2023 00:00:48 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:48 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:44 +0200 Subject: [PATCH v2 09/12] asm-generic/page.h: Make pfn accessors static inlines MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v2-9-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 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?1766577591345801451?= X-GMAIL-MSGID: =?utf-8?q?1766577591345801451?= Making virt_to_pfn() a static inline taking a strongly typed (const void *) makes the contract of a passing a pointer of that type to the function explicit and exposes any misuse of the macro virt_to_pfn() acting polymorphic and accepting many types such as (void *), (unitptr_t) or (unsigned long) as arguments without warnings. For symmetry we do the same change for pfn_to_virt. Immediately define virt_to_pfn and pfn_to_virt to the static inline after the static inline since this style of defining functions is used for the generic helpers. Signed-off-by: Linus Walleij --- include/asm-generic/page.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h index c0be2edeb484..9773582fd96e 100644 --- a/include/asm-generic/page.h +++ b/include/asm-generic/page.h @@ -74,8 +74,16 @@ extern unsigned long memory_end; #define __va(x) ((void *)((unsigned long) (x))) #define __pa(x) ((unsigned long) (x)) -#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) -#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) +static inline unsigned long virt_to_pfn(const void *kaddr) +{ + return __pa(kaddr) >> PAGE_SHIFT; +} +#define virt_to_pfn virt_to_pfn +static inline void *pfn_to_virt(unsigned long pfn) +{ + return __va(pfn) << PAGE_SHIFT; +} +#define pfn_to_virt pfn_to_virt #define virt_to_page(addr) pfn_to_page(virt_to_pfn(addr)) #define page_to_virt(page) pfn_to_virt(page_to_pfn(page)) From patchwork Mon May 22 07:00:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97094 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1257512vqo; Mon, 22 May 2023 00:07:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ68pdJmZWmBZKKivhrSilH8jZipaAiPWKfQrflwePx8idKdtROqorVWXbAQuAR1T9VcwMPC X-Received: by 2002:a05:6a20:258f:b0:106:a78f:be1d with SMTP id k15-20020a056a20258f00b00106a78fbe1dmr10556102pzd.20.1684739233951; Mon, 22 May 2023 00:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684739233; cv=none; d=google.com; s=arc-20160816; b=QiytVaPrl8E1Zsy2xQuNs1Ks/FDTiEhulwxTlCCgD3/6PtikRucwjmoqlsw+zS39o2 IztngIGyQKjxBKZjmyAWt2a7fNDg1JYsc69PSMwkS8L0KiADxLDIW//Q8UNq2dAX1U1g giMlYuJWuIzsXnqqr/df3qd0fU3k/XysA12n7vsidAzlEE1V3c0NwNcBKkXk17bNJK+a ceJwSsCl8iiZd/71pQ6RUJpWfqy2nvDCpuuJd9hVIWjf72u/NwQ/4jx7Pewi+BsS1GEA wF1ang3Ga0gQqMnDfkdvbTUH9LAcEXk/ZMBXQgb6TAKWNh9BkmGjMffd9dSwkbxXclNw 3JTw== 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=byQ7R65S71m0wzPqbiFWNKE9LKN0vAgU/hu26mJ4Tao=; b=gSlENRlAEC537HY6zf5t77FDbYjPt2NpfZNb8iHPMMDmDa7P5P05oZPfspTXz/SZNT gnVdij68vdpiES5fyVSQDSX4ZVzijvti4TXXBVsTUaXo9v9d1X4ZNz7PBCUWeKME1aAh hxzq0jGA2Bya8mxZJ8w/doPUcp0JdkK0eC4/yO5m+UYiCl4ytgn5PWRuC1bHBC6L+6in T7EuQQs/3v8hbgRZQtHBvdYiFxvW8D9MsuC5jssxOHQvWC2acFaZjFErXdxDmuX9fnDT EmXspyDxi7yRhuXkYpgkFV8soDKU3jKDzUQqjXOS1XzTlW/31uwH8T3ler5TEiT0QnWa fMIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kJooNGP5; 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 k126-20020a633d84000000b0052c842e5182si4257911pga.500.2023.05.22.00.06.59; Mon, 22 May 2023 00:07:13 -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=kJooNGP5; 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 S232338AbjEVHCS (ORCPT + 99 others); Mon, 22 May 2023 03:02:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232206AbjEVHBL (ORCPT ); Mon, 22 May 2023 03:01:11 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6AD0118 for ; Mon, 22 May 2023 00:00:51 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2af278ca45eso32455471fa.1 for ; Mon, 22 May 2023 00:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684738850; x=1687330850; 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=byQ7R65S71m0wzPqbiFWNKE9LKN0vAgU/hu26mJ4Tao=; b=kJooNGP5mzkfqx5paHzPlQK9GaMCMbm9cLo2rusx+wfgd12kSLGkR7PU1iPl7v7JN9 lvwVK7O5UCiAx0dRZ95adnFGUIU0fu2Air7yySVWDKOVyQVnND6C+5UGuQmjQNNuW+YE lBQuxEQaqXAUWkfF9gBq7LntHwsSsYSWqWw6whXMEBZKOQXPBpJ7DTCYAhSm7RNWYljB tLdb5ztyQWz3l56/Kgp62fv4NYOkdW/tuzdtsJGn7KsnEKwovaTVISGYSi7gRLNw9OEs +JKcal4hBUK7t62shNxL7pa2vozWHX8CdrFKTh3hRR1+Nf/IHBySLdJm1ENjPenGtkek x4qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738850; x=1687330850; 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=byQ7R65S71m0wzPqbiFWNKE9LKN0vAgU/hu26mJ4Tao=; b=e/HYG8pow1SDLAiJmIboNVatM0cEgzLrffdAEusSA5/YwqJojA0PYzY/Px/sbwMsZv 6XQlTobh9G22oyuu7pssWpSh9VfVWxEfEcY7wdUIc1H0gt8vsXHtedgkRA7CeN8hFJQd fZ0WKeapI8Fi7Xyu1yYmtXN2PkS1D9bykn+tki0Gu/Ft4ioh2+SkJdutIDExkO+2PSvz oV8XreGdhWUsN5QmwNlc4e7CidMI3Z3W7HRguKN7l2FsduE6IKbmoWGiUOKJ+4vmL3/n +oU0BPwG+KFUGObRvacf7rD96O2UFbNGPLt78j3BA3DRIrzx7vEGfsRMpmbYetmtRKib wlEw== X-Gm-Message-State: AC+VfDxbGmqGal9tXSwzBVsWNq2ARbjQ6Yb41ELu4XtAtjTH5SPetbU3 Os3orlUas8TqM3m6j6Mq1gM9pw== X-Received: by 2002:a2e:720f:0:b0:2a8:a651:8098 with SMTP id n15-20020a2e720f000000b002a8a6518098mr3723282ljc.38.1684738849749; Mon, 22 May 2023 00:00:49 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:49 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:45 +0200 Subject: [PATCH v2 10/12] ARM: mm: Make virt_to_pfn() a static inline MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v2-10-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 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?1766577127328912312?= X-GMAIL-MSGID: =?utf-8?q?1766577127328912312?= Making virt_to_pfn() a static inline taking a strongly typed (const void *) makes the contract of a passing a pointer of that type to the function explicit and exposes any misuse of the macro virt_to_pfn() acting polymorphic and accepting many types such as (void *), (unitptr_t) or (unsigned long) as arguments without warnings. Doing this is a bit intrusive: virt_to_pfn() requires PHYS_PFN_OFFSET and PAGE_SHIFT to be defined, and this is defined in , so this must be included *before* . The use of macros were obscuring the unclear inclusion order here, as the macros would eventually be resolved, but a static inline like this cannot be compiled with unresolved macros. The naive solution to include at the top of does not work, because sometimes includes at the end of itself, which would create a confusing inclusion loop. So instead, take the approach to always unconditionally include at the end of arch/arm uses explicitly in a lot of places, however it turns out that if we just unconditionally include into and switch all inclusions of to instead, we enforce the right order and will always have access to the definitions. Put an inclusion guard in place making it impossible to include explicitly. Link: https://lore.kernel.org/linux-mm/20220701160004.2ffff4e5ab59a55499f4c736@linux-foundation.org/ Signed-off-by: Linus Walleij --- Russell: the vs inclusion really gave me headaches, if you have a better idea how to do it I'm all ears! --- arch/arm/common/sharpsl_param.c | 2 +- arch/arm/include/asm/delay.h | 2 +- arch/arm/include/asm/io.h | 2 +- arch/arm/include/asm/memory.h | 17 ++++++++++++----- arch/arm/include/asm/page.h | 4 ++-- arch/arm/include/asm/pgtable.h | 2 +- arch/arm/include/asm/proc-fns.h | 2 -- arch/arm/include/asm/sparsemem.h | 2 +- arch/arm/include/asm/uaccess-asm.h | 2 +- arch/arm/include/asm/uaccess.h | 2 +- arch/arm/kernel/asm-offsets.c | 2 +- arch/arm/kernel/entry-armv.S | 2 +- arch/arm/kernel/entry-common.S | 2 +- arch/arm/kernel/entry-v7m.S | 2 +- arch/arm/kernel/head-nommu.S | 3 +-- arch/arm/kernel/head.S | 2 +- arch/arm/kernel/hibernate.c | 2 +- arch/arm/kernel/suspend.c | 2 +- arch/arm/kernel/tcm.c | 2 +- arch/arm/kernel/vmlinux-xip.lds.S | 3 +-- arch/arm/kernel/vmlinux.lds.S | 3 +-- arch/arm/mach-berlin/platsmp.c | 2 +- arch/arm/mach-keystone/keystone.c | 2 +- arch/arm/mach-omap2/sleep33xx.S | 2 +- arch/arm/mach-omap2/sleep43xx.S | 2 +- arch/arm/mach-omap2/sleep44xx.S | 2 +- arch/arm/mach-pxa/gumstix.c | 2 +- arch/arm/mach-rockchip/sleep.S | 2 +- arch/arm/mach-sa1100/pm.c | 2 +- arch/arm/mach-shmobile/headsmp-scu.S | 2 +- arch/arm/mach-shmobile/headsmp.S | 2 +- arch/arm/mach-socfpga/headsmp.S | 2 +- arch/arm/mach-spear/spear.h | 2 +- arch/arm/mm/cache-fa.S | 1 - arch/arm/mm/cache-v4wb.S | 1 - arch/arm/mm/dma-mapping.c | 2 +- arch/arm/mm/dump.c | 2 +- arch/arm/mm/init.c | 2 +- arch/arm/mm/kasan_init.c | 1 - arch/arm/mm/mmu.c | 2 +- arch/arm/mm/physaddr.c | 2 +- arch/arm/mm/pmsa-v8.c | 2 +- arch/arm/mm/proc-v7.S | 2 +- arch/arm/mm/proc-v7m.S | 2 +- arch/arm/mm/pv-fixup-asm.S | 2 +- drivers/memory/ti-emif-sram-pm.S | 2 +- 46 files changed, 54 insertions(+), 55 deletions(-) diff --git a/arch/arm/common/sharpsl_param.c b/arch/arm/common/sharpsl_param.c index 6237ede2f0c7..1ca26c063f80 100644 --- a/arch/arm/common/sharpsl_param.c +++ b/arch/arm/common/sharpsl_param.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include /* * Certain hardware parameters determined at the time of device manufacture, diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h index 4f80b72372b4..1d069e558d8d 100644 --- a/arch/arm/include/asm/delay.h +++ b/arch/arm/include/asm/delay.h @@ -7,7 +7,7 @@ #ifndef __ASM_ARM_DELAY_H #define __ASM_ARM_DELAY_H -#include +#include #include /* HZ */ /* diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 7fcdc785366c..56b08ed6cc3b 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include /* diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 62e9df024445..ef2aa79ece5a 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -5,11 +5,16 @@ * Copyright (C) 2000-2002 Russell King * modification for nommu, Hyok S. Choi, 2004 * - * Note: this file should not be included by non-asm/.h files + * Note: this file should not be included explicitly, include + * to get access to these definitions. */ #ifndef __ASM_ARM_MEMORY_H #define __ASM_ARM_MEMORY_H +#ifndef _ASMARM_PAGE_H +#error "Do not include directly" +#endif + #include #include #include @@ -288,10 +293,12 @@ static inline unsigned long __phys_to_virt(phys_addr_t x) #endif -#define virt_to_pfn(kaddr) \ - ((((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT) + \ - PHYS_PFN_OFFSET) - +static inline unsigned long virt_to_pfn(const void *p) +{ + unsigned long kaddr = (unsigned long)p; + return (((kaddr - PAGE_OFFSET) >> PAGE_SHIFT) + + PHYS_PFN_OFFSET); +} #define __pa_symbol_nodebug(x) __virt_to_phys_nodebug((x)) #ifdef CONFIG_DEBUG_VIRTUAL diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h index 74bb5947b387..4e44f9707376 100644 --- a/arch/arm/include/asm/page.h +++ b/arch/arm/include/asm/page.h @@ -161,10 +161,10 @@ extern int pfn_valid(unsigned long); #define pfn_valid pfn_valid #endif -#include - #endif /* !__ASSEMBLY__ */ +#include + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC #include diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index a58ccbb406ad..34662a9d4cab 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -27,7 +27,7 @@ extern struct page *empty_zero_page; #else #include -#include +#include #include diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h index c82f7a29ec4a..280396483f5d 100644 --- a/arch/arm/include/asm/proc-fns.h +++ b/arch/arm/include/asm/proc-fns.h @@ -147,8 +147,6 @@ static inline void init_proc_vtable(const struct processor *p) extern void cpu_resume(void); -#include - #ifdef CONFIG_MMU #define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm) diff --git a/arch/arm/include/asm/sparsemem.h b/arch/arm/include/asm/sparsemem.h index d362233856a5..421e3415338a 100644 --- a/arch/arm/include/asm/sparsemem.h +++ b/arch/arm/include/asm/sparsemem.h @@ -2,7 +2,7 @@ #ifndef ASMARM_SPARSEMEM_H #define ASMARM_SPARSEMEM_H -#include +#include /* * Two definitions are required for sparsemem: diff --git a/arch/arm/include/asm/uaccess-asm.h b/arch/arm/include/asm/uaccess-asm.h index 6451a433912c..65da32e1f1c1 100644 --- a/arch/arm/include/asm/uaccess-asm.h +++ b/arch/arm/include/asm/uaccess-asm.h @@ -5,7 +5,7 @@ #include #include -#include +#include #include .macro csdb diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 2fcbec9c306c..bb5c81823117 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -9,7 +9,7 @@ * User space memory access functions */ #include -#include +#include #include #include #include diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index 38121c59cbc2..6a80d4be743b 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index c39303e5c234..112fd6cd3f26 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include #include diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 03d4c5578c5c..bcc4c9ec3aa4 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -9,7 +9,7 @@ #include #include #include -#include +#include #ifdef CONFIG_AEABI #include #endif diff --git a/arch/arm/kernel/entry-v7m.S b/arch/arm/kernel/entry-v7m.S index de8a60363c85..52bacf07ba16 100644 --- a/arch/arm/kernel/entry-v7m.S +++ b/arch/arm/kernel/entry-v7m.S @@ -6,7 +6,7 @@ * * Low-level vector interface routines for the ARMv7-M architecture */ -#include +#include #include #include #include diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S index 950bef83339f..b9d6818f1ee1 100644 --- a/arch/arm/kernel/head-nommu.S +++ b/arch/arm/kernel/head-nommu.S @@ -14,12 +14,11 @@ #include #include #include -#include +#include #include #include #include #include -#include /* * Kernel startup entry point. diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 656991055bc1..1ec35f065617 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_SEMIHOSTING) diff --git a/arch/arm/kernel/hibernate.c b/arch/arm/kernel/hibernate.c index 2373020af965..38a90a3d12b2 100644 --- a/arch/arm/kernel/hibernate.c +++ b/arch/arm/kernel/hibernate.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include "reboot.h" diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c index 43f0a3ebf390..c3ec3861dd07 100644 --- a/arch/arm/kernel/suspend.c +++ b/arch/arm/kernel/suspend.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/arm/kernel/tcm.c b/arch/arm/kernel/tcm.c index d3a85f01b328..f59927bcfbce 100644 --- a/arch/arm/kernel/tcm.c +++ b/arch/arm/kernel/tcm.c @@ -15,7 +15,7 @@ #include /* memcpy */ #include #include -#include +#include #include #include #include diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S index 76678732c60d..c16d196b5aad 100644 --- a/arch/arm/kernel/vmlinux-xip.lds.S +++ b/arch/arm/kernel/vmlinux-xip.lds.S @@ -12,9 +12,8 @@ #include #include #include -#include -#include #include +#include OUTPUT_ARCH(arm) ENTRY(stext) diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index aa12b65a7fd6..bd9127c4b451 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -12,9 +12,8 @@ #include #include #include -#include -#include #include +#include OUTPUT_ARCH(arm) ENTRY(stext) diff --git a/arch/arm/mach-berlin/platsmp.c b/arch/arm/mach-berlin/platsmp.c index 593fc4a69d84..ed94758d30ff 100644 --- a/arch/arm/mach-berlin/platsmp.c +++ b/arch/arm/mach-berlin/platsmp.c @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c index aa352c2de313..68039aad3014 100644 --- a/arch/arm/mach-keystone/keystone.c +++ b/arch/arm/mach-keystone/keystone.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include "memory.h" diff --git a/arch/arm/mach-omap2/sleep33xx.S b/arch/arm/mach-omap2/sleep33xx.S index ac3d0b363c51..3bfd8b5e03ed 100644 --- a/arch/arm/mach-omap2/sleep33xx.S +++ b/arch/arm/mach-omap2/sleep33xx.S @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include "iomap.h" #include "cm33xx.h" diff --git a/arch/arm/mach-omap2/sleep43xx.S b/arch/arm/mach-omap2/sleep43xx.S index 832c91327945..ec0972a48f08 100644 --- a/arch/arm/mach-omap2/sleep43xx.S +++ b/arch/arm/mach-omap2/sleep43xx.S @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include "cm33xx.h" #include "common.h" diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S index f60f6a9aed73..f09c9197808b 100644 --- a/arch/arm/mach-omap2/sleep44xx.S +++ b/arch/arm/mach-omap2/sleep44xx.S @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include "omap-secure.h" diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c index 72b08a9bf0fd..ebeee82e649e 100644 --- a/arch/arm/mach-pxa/gumstix.c +++ b/arch/arm/mach-pxa/gumstix.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include diff --git a/arch/arm/mach-rockchip/sleep.S b/arch/arm/mach-rockchip/sleep.S index 3eca3922c944..38b6c5186c3c 100644 --- a/arch/arm/mach-rockchip/sleep.S +++ b/arch/arm/mach-rockchip/sleep.S @@ -6,7 +6,7 @@ #include #include -#include +#include .data /* diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c index 9a7079f565bd..9cf5d917bb92 100644 --- a/arch/arm/mach-sa1100/pm.c +++ b/arch/arm/mach-sa1100/pm.c @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include diff --git a/arch/arm/mach-shmobile/headsmp-scu.S b/arch/arm/mach-shmobile/headsmp-scu.S index d0234296ae62..e892ee794d64 100644 --- a/arch/arm/mach-shmobile/headsmp-scu.S +++ b/arch/arm/mach-shmobile/headsmp-scu.S @@ -7,7 +7,7 @@ #include #include -#include +#include /* * Boot code for secondary CPUs. diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S index 9466ae61f56a..a956b489b6ea 100644 --- a/arch/arm/mach-shmobile/headsmp.S +++ b/arch/arm/mach-shmobile/headsmp.S @@ -11,7 +11,7 @@ #include #include #include -#include +#include #define SCTLR_MMU 0x01 #define BOOTROM_ADDRESS 0xE6340000 diff --git a/arch/arm/mach-socfpga/headsmp.S b/arch/arm/mach-socfpga/headsmp.S index 54f1844eac03..f7e91a772428 100644 --- a/arch/arm/mach-socfpga/headsmp.S +++ b/arch/arm/mach-socfpga/headsmp.S @@ -6,7 +6,7 @@ */ #include #include -#include +#include #include .arch armv7-a diff --git a/arch/arm/mach-spear/spear.h b/arch/arm/mach-spear/spear.h index 432efd407c76..f23eaf1e522f 100644 --- a/arch/arm/mach-spear/spear.h +++ b/arch/arm/mach-spear/spear.h @@ -10,7 +10,7 @@ #ifndef __MACH_SPEAR_H #define __MACH_SPEAR_H -#include +#include #if defined(CONFIG_ARCH_SPEAR3XX) || defined (CONFIG_ARCH_SPEAR6XX) diff --git a/arch/arm/mm/cache-fa.S b/arch/arm/mm/cache-fa.S index 3a464d1649b4..71c64e92dead 100644 --- a/arch/arm/mm/cache-fa.S +++ b/arch/arm/mm/cache-fa.S @@ -13,7 +13,6 @@ #include #include #include -#include #include #include "proc-macros.S" diff --git a/arch/arm/mm/cache-v4wb.S b/arch/arm/mm/cache-v4wb.S index 905ac2fa2b1e..ad382cee0fdb 100644 --- a/arch/arm/mm/cache-v4wb.S +++ b/arch/arm/mm/cache-v4wb.S @@ -7,7 +7,6 @@ #include #include #include -#include #include #include "proc-macros.S" diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index b4a33358d2e9..0549bee68a67 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c index 059eb4cdc9c2..a9381095ab36 100644 --- a/arch/arm/mm/dump.c +++ b/arch/arm/mm/dump.c @@ -15,7 +15,7 @@ #include #include -#include +#include #include static struct addr_marker address_markers[] = { diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index ce64bdb55a16..a42e4cd11db2 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/arm/mm/kasan_init.c b/arch/arm/mm/kasan_init.c index 46d9f4a622cb..24d71b5db62d 100644 --- a/arch/arm/mm/kasan_init.c +++ b/arch/arm/mm/kasan_init.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 463fc2a8448f..22292cf3381c 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include diff --git a/arch/arm/mm/physaddr.c b/arch/arm/mm/physaddr.c index cf75819e4c13..3f263c840ebc 100644 --- a/arch/arm/mm/physaddr.c +++ b/arch/arm/mm/physaddr.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include diff --git a/arch/arm/mm/pmsa-v8.c b/arch/arm/mm/pmsa-v8.c index 8359748a19a1..28cdc5468406 100644 --- a/arch/arm/mm/pmsa-v8.c +++ b/arch/arm/mm/pmsa-v8.c @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include "mm.h" diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 6b4ef9539b68..193c7aeb6703 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include "proc-macros.S" diff --git a/arch/arm/mm/proc-v7m.S b/arch/arm/mm/proc-v7m.S index 335144d50134..d65a12f851a9 100644 --- a/arch/arm/mm/proc-v7m.S +++ b/arch/arm/mm/proc-v7m.S @@ -9,7 +9,7 @@ */ #include #include -#include +#include #include #include "proc-macros.S" diff --git a/arch/arm/mm/pv-fixup-asm.S b/arch/arm/mm/pv-fixup-asm.S index f8e11f7c7880..1d9f52c71ad0 100644 --- a/arch/arm/mm/pv-fixup-asm.S +++ b/arch/arm/mm/pv-fixup-asm.S @@ -9,7 +9,7 @@ #include #include #include -#include +#include .section ".idmap.text", "ax" diff --git a/drivers/memory/ti-emif-sram-pm.S b/drivers/memory/ti-emif-sram-pm.S index d60a8cfd63f3..7756b3971244 100644 --- a/drivers/memory/ti-emif-sram-pm.S +++ b/drivers/memory/ti-emif-sram-pm.S @@ -8,7 +8,7 @@ #include #include -#include +#include #include "emif.h" #include "ti-emif-asm-offsets.h" From patchwork Mon May 22 07:00:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97105 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1261457vqo; Mon, 22 May 2023 00:16:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6DIfadg2h7zCOHeeXDzvbBbtg5ntP3Sly4VgPFhc/b0UkLkfAeO7G+Lij+vOIgovAW8vHh X-Received: by 2002:a05:6a20:8f05:b0:10b:d045:f0cf with SMTP id b5-20020a056a208f0500b0010bd045f0cfmr1551756pzk.23.1684739761703; Mon, 22 May 2023 00:16:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684739761; cv=none; d=google.com; s=arc-20160816; b=GwK07oYmpkF/Uiou1KxxDY30e/LFSPU3I055c19oeW1fC5DefyYmuH61kaX8Dud4zA II0tYBEkZmKM2xbi/5HHQ0FSLPkDFiPA3vOlG3U4WClAtOQaHXKUX7GlHAWanwp5WzGL VwOYlpyZQQf82GAV8YAuIW7nzS9f6xONXG2X8H5T2fFfFX9xT32Tuf29oTLSWQKEefGg sqw6+jj2gxNdH+rlZEA2SnprKbCwfMIlQwyVs61B1uPUx38StFKcbX4/BDhYYIhh5Nzh MeQIVoGCeP/+5i/jpJhGFnG/38Dyy9kD+No+JZD3zDl/9kDmLVFyOhhzPBh1iYcqle2J 7MLg== 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=721W88MgL2sNJMPnk6EOnDreN0TGHiKcLljkK4k+Xz4=; b=a28VhuLuIoW0gkKl/X2kczyr8RHsT2dkGjLhaffw8rCgY0U8zl8Zzf7WrAYlzb9T1D MJX50KMBq7NSx7FdZYZlxaUU2zjAPIhtK2mlUxHZXvb/xe2zlZ1//2gAq3FAieOK8mEr 3MD0rAkQ8GUrVhQ6JprcG40L20kW7mYRVxf3/BoIPNpDOFPZWllEKNMETs6nRYj9iZhH KDFUost1LP4Wx7YgBlQj3cvVbqz7Mn6/v9psL75RH1u9BKrrxeRBah9+y9uYEZYxFEA0 YNXvT6baZzEqTO8dD+7WyogvF52K3K26PALcoumIPiYQueyAYOLeIDnnfd25g3i2n7F8 u1Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XQtAW71u; 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 a5-20020a637045000000b005309e9ab3b8si4208635pgn.795.2023.05.22.00.15.46; Mon, 22 May 2023 00:16:01 -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=XQtAW71u; 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 S232214AbjEVHCm (ORCPT + 99 others); Mon, 22 May 2023 03:02:42 -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 S232255AbjEVHBd (ORCPT ); Mon, 22 May 2023 03:01:33 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F41219B for ; Mon, 22 May 2023 00:00:53 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2af20198f20so41912251fa.0 for ; Mon, 22 May 2023 00:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684738851; x=1687330851; 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=721W88MgL2sNJMPnk6EOnDreN0TGHiKcLljkK4k+Xz4=; b=XQtAW71u4fTNd1m3CoQ2jBdXD9/L9co0wiCGXKPV7VPHkFBkn2paLpq4u7Zun4vihP Jt89fVfIK/kqwIEhUG0rEaMiY9youfI2gwNHpVmFNoLUlHPTqMB+dSsLsyZ0Nud3GfbF dtwCWhOjSDsxmfy8EsojhF7c8s35Z8LE87tWI+GqyJFAAak2TwvLXaQdq7RckdkYTHnU 18kKgbLJk4GVeA4A4vRYQZN2Dj0n1wcSakUxJpXVVadQkTB4oxfQonCpFh8YOMyqM+LF 0rSyjSqVr+DzD+fnTYDbXV9mB2Zq6QefKszArXVUbAr8pzAQFYflvnoSfXBTu+vX7dJn HUmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738851; x=1687330851; 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=721W88MgL2sNJMPnk6EOnDreN0TGHiKcLljkK4k+Xz4=; b=DFFEvEQjx6vVsG/Jvc9TLcR2iYwOya5OC2LpCKIEENLQJhr0lLihTn5oiYjGs/VlWI phrtHBsNeBz6qC0QwTQEIoRcvbaMIOjzv02CfPQlZCPpTJUAAaXvW195D8lT3N1qAEuz SL+qYcScF3UPjfnx450q2SJhHd19PrY1c2hm/Wvu8opJklF06XCrol8krNkqE2Myrl43 tsn4V0VUJ5KOy6i4RkIOvp7J4kCkqIhS44xsYA6gZmNlLznwjbMC6J/MdlAKVn4Q1qQO ePFNHb+u/igoXci02s2DWHQhvG3UAyRVrkmF9ujMFjYcpIhz0vNPtQPRFvPxrthbYE03 NfdA== X-Gm-Message-State: AC+VfDxjfTuQQK2PinAgwkVkAaCgBX6O4TBJU38dvnnXTdfbLi8bMjVW y1WJp9vB/4hooXp3mAG+S7XUZQ== X-Received: by 2002:a2e:8e89:0:b0:2b0:259d:f670 with SMTP id z9-20020a2e8e89000000b002b0259df670mr453615ljk.4.1684738850979; Mon, 22 May 2023 00:00:50 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:50 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:46 +0200 Subject: [PATCH v2 11/12] arm64: memory: Make virt_to_pfn() a static inline MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v2-11-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 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?1766577680443517057?= X-GMAIL-MSGID: =?utf-8?q?1766577680443517057?= Making virt_to_pfn() a static inline taking a strongly typed (const void *) makes the contract of a passing a pointer of that type to the function explicit and exposes any misuse of the macro virt_to_pfn() acting polymorphic and accepting many types such as (void *), (unitptr_t) or (unsigned long) as arguments without warnings. Since arm64 is using to provide __phys_to_pfn() we need to move the inclusion of that header up, so we can resolve the static inline at compile time. Acked-by: Catalin Marinas Signed-off-by: Linus Walleij --- arch/arm64/include/asm/memory.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index c735afdf639b..4d85212b622e 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -331,6 +331,14 @@ static inline void *phys_to_virt(phys_addr_t x) return (void *)(__phys_to_virt(x)); } +/* Needed already here for resolving __phys_to_pfn() in virt_to_pfn() */ +#include + +static inline unsigned long virt_to_pfn(const void *kaddr) +{ + return __phys_to_pfn(virt_to_phys(kaddr)); +} + /* * Drivers should NOT use these either. */ @@ -339,7 +347,6 @@ static inline void *phys_to_virt(phys_addr_t x) #define __pa_nodebug(x) __virt_to_phys_nodebug((unsigned long)(x)) #define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x))) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -#define virt_to_pfn(x) __phys_to_pfn(__virt_to_phys((unsigned long)(x))) #define sym_to_pfn(x) __phys_to_pfn(__pa_symbol(x)) /* From patchwork Mon May 22 07:00:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 97091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1255954vqo; Mon, 22 May 2023 00:03:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5EogDypHhO8CzOhecBVvCRrLiTN4WwJ+I7tpLnHcOXuWgEFDq4pV3Y/K98HfayU1RCMfPN X-Received: by 2002:a05:6a20:12d1:b0:10b:cf0a:f82a with SMTP id v17-20020a056a2012d100b0010bcf0af82amr1462411pzg.45.1684739033118; Mon, 22 May 2023 00:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684739033; cv=none; d=google.com; s=arc-20160816; b=gGZuruP9iBGmiLY47HhUPyQNDepe8qJpW5NqZ0Ce+2LEJacTqZu68mT9elMnjavBmL EkdbCWr9E+5qAUWlIgYTz5gMRFSdmVd+yizA3DmXD7W8XrtXqduZ2eiwZ05h8IpVGDpi 2OPoAo9gx2VkrvdJQxpvh2SQn95krFmb3Wo1eQLMZVACRAB6Qc23lEuPq12pjj3tBMdt WDdEoehEf7RgW36VZU+e/E5Nvng1aelrDCzV1u8FVnsLbi3cYzcJQmhyE4ZFsYNojieC 4mBe03z2Kg4KwoepcfpNYp3dpA+Q7FLRKDrGdJN5CEgAKmakTVtkSaNw2HrRoyREKCj4 81pQ== 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=XXvb5TDUzvESWFR9QC/PoBRtJqf1+F8aU7D/u9pREy0=; b=KlCYhdCXKxd3StHoANs0M1VN8f5ksfInvcX32T52UujWtTXj2ykzyeCufka3WntA9L 3nKKWvi+e4UiF33a975pPVvRtdVAE38DtujvbV5ePY1z4kDax32WAIcBkAoJtzMwQb9C Y5fdxSb0ZGIJ2PkFbtq9Ey/8v0eSi2gNP64UeqPSxB/kN6VJRJrQfD/iBv7w2ShIhUbR 0fzWArgkRsLkJ8QLqH3jGc71giyIgfpkzTRVFduCnPhnXKHOret/8c54T+67Xg6XkGnz AL77vPafqAqKyJ4wsuPj2YA2AUC5cC7F3f8Ycu0W2COYQmjLqLaRa2z7N/1ZaoO58RRz T2Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OtttQP9k; 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 i7-20020a633c47000000b00534839d5ee5si791867pgn.98.2023.05.22.00.03.38; Mon, 22 May 2023 00:03:53 -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=OtttQP9k; 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 S232365AbjEVHCf (ORCPT + 99 others); Mon, 22 May 2023 03:02:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232214AbjEVHBb (ORCPT ); Mon, 22 May 2023 03:01:31 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A84ED110 for ; Mon, 22 May 2023 00:00:52 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2af1a7d2f6aso48824341fa.1 for ; Mon, 22 May 2023 00:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684738852; x=1687330852; 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=XXvb5TDUzvESWFR9QC/PoBRtJqf1+F8aU7D/u9pREy0=; b=OtttQP9k8xlpdHUIJVQBj8OckJ52gXzjAKfZrO75yaomv2Kiy+b4fjJvIwaykOdpkr usJaUK3rXE5surL3MPXnlE1TEJwwCby96MhbkYqN1mF6zVB6zp2XsGhjdCbv4XVJE6/s T4ni/jV8YaVyRAd6JB8iNtxkvmPyKAInGhO77viNGA33qHHTOTMSjoPo6kYmfoiQK12j iDtwhnWm7qBIe6BJff5uUa9Mw7T989YyEmwWpkc6B/+u6Lc+aAkLc1d4kRY6SMY63VU7 hmiPvpMUPJTmQnqUoOO6sf1NrZ+OQ4se37lsy0EYUsaGwaOuyi19yVC4YL6wRFmh7WLu cHJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684738852; x=1687330852; 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=XXvb5TDUzvESWFR9QC/PoBRtJqf1+F8aU7D/u9pREy0=; b=EIJmkm5Yk4pS7CFgncZ+kuzQeGAI7GUNaNUI8y9MuZKPn6JGVfxU4bguImY/ekc1ah nHa1Tn+mR3sMrjO1d/V0JZ1Eh1FvTb18qAabJx0yQL6J2B3nJnZtvp0c5cheNY3YZrvU uRFYEyjVGI3WYs3wK6T4RR0gtFX1fooIe7/YQqeXk6PBEKENmLb+rKH7GywisBd79ffF t/tCqygpfBxOxmhTrWR5P+xBHJzZD/XRaI+TMJPCcNaPl7vz16L8sD/RrPQgslLVZWe3 1wcUj0Ed+EtQH45pzY9VvYkiR+N5VQ73g17Hngzn6l36oy+vlEBxciTz6BUulS4AeRI+ 4I7w== X-Gm-Message-State: AC+VfDxOj9oSlabI+RswXbifI2/y3yGa6Ha0DMGv/gxlvZGF1JhddETJ vNQTqR9RSYSjCemS3/XYw5/nqQ== X-Received: by 2002:a2e:9f42:0:b0:2af:19dd:ecda with SMTP id v2-20020a2e9f42000000b002af19ddecdamr3543683ljk.45.1684738851937; Mon, 22 May 2023 00:00:51 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 00:00:51 -0700 (PDT) From: Linus Walleij Date: Mon, 22 May 2023 09:00:47 +0200 Subject: [PATCH v2 12/12] m68k/mm: Make pfn accessors static inlines MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v2-12-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 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?1766576916888050232?= X-GMAIL-MSGID: =?utf-8?q?1766576916888050232?= Making virt_to_pfn() a static inline taking a strongly typed (const void *) makes the contract of a passing a pointer of that type to the function explicit and exposes any misuse of the macro virt_to_pfn() acting polymorphic and accepting many types such as (void *), (unitptr_t) or (unsigned long) as arguments without warnings. For symmetry, do the same with pfn_to_virt(). Signed-off-by: Linus Walleij --- arch/m68k/include/asm/page_mm.h | 11 +++++++++-- arch/m68k/include/asm/page_no.h | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h index 3903db2e8da7..363aa0f9ba8a 100644 --- a/arch/m68k/include/asm/page_mm.h +++ b/arch/m68k/include/asm/page_mm.h @@ -121,8 +121,15 @@ static inline void *__va(unsigned long x) * TODO: implement (fast) pfn<->pgdat_idx conversion functions, this makes lots * of the shifts unnecessary. */ -#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) -#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) +static inline unsigned long virt_to_pfn(const void *kaddr) +{ + return __pa(kaddr) >> PAGE_SHIFT; +} + +static inline void *pfn_to_virt(unsigned long pfn) +{ + return __va(pfn << PAGE_SHIFT); +} extern int m68k_virt_to_node_shift; diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h index 060e4c0e7605..af3a10973233 100644 --- a/arch/m68k/include/asm/page_no.h +++ b/arch/m68k/include/asm/page_no.h @@ -19,8 +19,15 @@ extern unsigned long memory_end; #define __pa(vaddr) ((unsigned long)(vaddr)) #define __va(paddr) ((void *)((unsigned long)(paddr))) -#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) -#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) +static inline unsigned long virt_to_pfn(const void *kaddr) +{ + return __pa(kaddr) >> PAGE_SHIFT; +} + +static inline void *pfn_to_virt(unsigned long pfn) +{ + return __va(pfn << PAGE_SHIFT); +} #define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) #define page_to_virt(page) __va(((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET))