From patchwork Tue May 23 14:05:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98021 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2189086vqo; Tue, 23 May 2023 07:34:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6lGRSw7YapNTG0uuwMtwxYxBOa0tvEu9zY2j6YMtlJMI4C9fDlMOHWl/ZsMnaGjfOPUh4c X-Received: by 2002:a05:6a20:549d:b0:10b:acb4:6249 with SMTP id i29-20020a056a20549d00b0010bacb46249mr7550319pzk.8.1684852460879; Tue, 23 May 2023 07:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684852460; cv=none; d=google.com; s=arc-20160816; b=aJtNYh90EiUBkVxnHKt7K+K0a/bzKTV3kbD3BQU5zRx/2mCoYbRW85/Wkrea06St42 h98aLW4fjbSYc5rh2izX4ccIqzQ3M8KwLvUhOpQkPBjrbGcGeTIo8R9jYSBswiNz0uYV LKNy4PCS21CG3i5Tr7vIAmV+mN5g4Pevt2ZmllWV9vq2LCmwPjsZDGZX2Ge35DCPv9kE 7OdCnrtFksSpzKs1YxzsPE5GjrRlUc2J8jsLFNO4AeVWzUWPVdXq+geUZyAeLN07TXO/ 8sXkCY4V0PDcT1t5JRFzIwO6PZ2APv4l/Aaw4QZnhiDYYs1FwcQgvjFwyA27Hx5UDj+z x2YA== 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=TbXL5Twdc1M3fkj/Sfo2AvG8vHBJBOECO6c9XrmOFlhfLJ/DVuT+unkT3ULZCZM8NU mc4GYiMiWN7cTwYQ4+uY1mus4nbfncA/Zghf5pNVM4kGGKgYlN2Yr983Myvkg/026WIN /DS+T1LpvYP08dlYaxQExq9UnsodkuWG+oB34fenm8hRHP7RYcs8YT1U+LERKyQ+RrJm ZwOXkaa6MwzMnOqYX/AxYdZn/ritb0qQgYFBBp8vdKQBUQxNYNa84+7zKDBksB4AKqCv EP0Q4JZaQVwmTtvBF3la0lUknbxS64fRFoAyOisilOiO2rRzBjJZhhPQ9bIytFfmG+nw rtCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yi3hcBL/"; 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 z12-20020a63b90c000000b0052866b25be5si81064pge.746.2023.05.23.07.34.08; Tue, 23 May 2023 07:34:20 -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="yi3hcBL/"; 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 S237090AbjEWOGy (ORCPT + 99 others); Tue, 23 May 2023 10:06:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237085AbjEWOGu (ORCPT ); Tue, 23 May 2023 10:06:50 -0400 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 748C3130 for ; Tue, 23 May 2023 07:06:47 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-4f4bd608cf4so1001117e87.1 for ; Tue, 23 May 2023 07:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850746; x=1687442746; 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=yi3hcBL/sMAfGA15PDa1P8NdEmww4HzJP2F/sUwI9IpWl8FAr9D8nzxcXs3kk9VZLg gqW+uTf0Quu6EKOMoBtewB5My0WXhMod0GC8z1ZbYL4s/yewGksiSDol/qQUkOAwxxUP tWgq8rOI0YG+2kzNAd6LFlZQnU/w/sUVfPTphub78KgJsbXLOjbr0epF5+oc5rNWTcLT 4z9nAmfx1uJBTtHPDaWVenyL8i5pZQeTVRUJb52fjzXC6jarDxR7o0xXXXnUa9XVKQra c4l8ZCAV1hnrQiBJbDsUuYXenW29rw/An0d2CKxpWMKMbNQerNNefqEtiX0g0tIAPTZn 73Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850746; x=1687442746; 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=CH2B8OsYnVQ+umNHKS9gP1lp6dAdILmi4qhdYTeg6PtWPdZilcn5f1CaaW8fUo/C2L zeqiM2MX5lsKTMtmhauCAJqpijtaIGTumiG6b/vFqn+aj/zSsfg1IKJ6plNoSrzuBXXU wNUihkst+FTah36A/BPPCdUmVW7gTMCJ5T2ILvK+MwZJ9017f6XiNUwolHLpEq3rv8aX 2ZhRJJZ2z9naWAocZdkFhit5DIDNq7Jp6K4UqSDbiKq3U3y8+sV3h8eUb1H+TUMgk/dk bK+WtSW18NfN11FWjINSeT079O6UZ0wmfmfUUW7m96ZZ4FsQhLCWDOZmEtc/Za5wxkQf W3WA== X-Gm-Message-State: AC+VfDw2OKx2wvl/QZMrWOpnkigP16VuEM9tdsXdASbUMHrutmnChoB9 redry9Z+GHLjK7gSh1Q/6viFEw== X-Received: by 2002:ac2:43a2:0:b0:4f3:a1db:ad4 with SMTP id t2-20020ac243a2000000b004f3a1db0ad4mr4313623lfl.66.1684850745735; Tue, 23 May 2023 07:05:45 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:45 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:25 +0200 Subject: [PATCH v3 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-v3-1-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=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?1766695853850783278?= X-GMAIL-MSGID: =?utf-8?q?1766695853850783278?= 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 Tue May 23 14:05:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98006 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2170844vqo; Tue, 23 May 2023 07:08:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ55WU35zFXTO+UtaokiqQLhaSX0aQ7/3PEWUNxBoga32KLvTI26LD6i1zvZOzrNUOqIkp7t X-Received: by 2002:a05:6a20:8e1a:b0:10b:8ce2:6a94 with SMTP id y26-20020a056a208e1a00b0010b8ce26a94mr7277668pzj.14.1684850936017; Tue, 23 May 2023 07:08:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684850936; cv=none; d=google.com; s=arc-20160816; b=QSuvdUb28SQjrCEyAQihWJ0Z6mBVv1Ljp3mQf0iJ2+KvyWrNz4e0dgrUQhuePza/an ZjRUhyR8QQTfe11ohATgO3DlkTYRAstVf9jICFkLkqrbv11C+RFAMZTyPdPxshUNNfdt 6jR89XYqziI/Uz9MZR+8O5ceu4bwn1jWEx6JeXGnhzx2stF/Z0cnLdXfGYZTqmTyu08f Tn/aFptOL6XQik411WXWuglzmsZulcP6zQtdr2LeWCIdDGXs78UPeEr1nQyRgAjzU5Lq LuQ0BIY3ivty5wYvGCzFG9oofinNyog9raJzG3YnDaJTLbHbGCcjvsCDogbtI0gY60vs PtrQ== 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=EZAVHnI0RnVaS/2VmTowQqEKdQQ5rGu0g+MysdOCzRE=; b=onnZAGdhmcZ5wg9mddazfdfTW0yiirRMdcAMvVs5GstxKUxZbi4iEPvW5zH4i7ThNs vhWGBx9YVioq0eCGeXdEIfszzd8/RUbrCDfT+YQhxQiyENyDgtRUuCICNCoJTiUvg8q5 GBDKUOupjhxx+wiEaZZjhGtEnINziOFHQDj410aAphUfB0L3/vDQMIQ7dEw5x3SDh6I8 2njD2+fvyLrRqprCeIvK91XHdIQYYtEI0D36UdGtMp0MmdB2p2AzxXOyMEnR7PvW4Dyw 2ETg/Qc6KIHV/ntrM7RF5AQEcqAl3j9orrZhUsHe3tqzYhzTYIqpQkaLyl3leprXGrlv a6sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CndnVf4W; 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 m18-20020a637d52000000b0050f89421524si367101pgn.319.2023.05.23.07.08.42; Tue, 23 May 2023 07:08:55 -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=CndnVf4W; 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 S237165AbjEWOHO (ORCPT + 99 others); Tue, 23 May 2023 10:07:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237097AbjEWOGv (ORCPT ); Tue, 23 May 2023 10:06:51 -0400 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75828184 for ; Tue, 23 May 2023 07:06:48 -0700 (PDT) Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-4f3a99b9177so6333208e87.1 for ; Tue, 23 May 2023 07:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850747; x=1687442747; 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=EZAVHnI0RnVaS/2VmTowQqEKdQQ5rGu0g+MysdOCzRE=; b=CndnVf4Wz0L7DCgFoh3Gq+YOBOn/KSBOCbH8YksJupr6UUPOhddHJUufNJpsGX6RPn rTDP0CIM0yfz0E9z2hoqsv+IrS9bNsKCIWeoIiAKo1FLM6IUrHeaw016T1O9DEAo7W0s lGILyoagX94XkZQ+8x2RQCqAZfYySvk+7OvtomiQ5PLGb7k8yRkB5FQhQ10QmX0bg6eL s7Ko5smzRaiFKzMutWbf/9ftcS5cdW7GP0A5ukP7k6S25BdkMtlB9BCM9AQmGDpbZGdM uxU1fALRef1aE+fzPPwRaMJZVm/kLgAfXQLWcvxYyYtb7qAOO8RA1O1GAaM+1Cd9JyCz y/YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850747; x=1687442747; 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=EZAVHnI0RnVaS/2VmTowQqEKdQQ5rGu0g+MysdOCzRE=; b=ItXtXTkmxkQXTmP/gFlgk4XH2F4JVElhwMR7cA0VTtReYUE/Y9bcj/IMQPm6wziuKj 6NeIguYMHa91vPrGu+lUXZWu8LEs4lxmuStdKxu2KcTKlpn5J7bmq65GBvAiIJm3Ywng BvGg9O85XzndfioIpE/BmF8zUNYTQ6t2djRT0CJj7VWuseCZ4plcLSdT5SEAZJI4OU4R 2vnGxxca5Yl6xh25g0FnKjBF5AwB3PdQqJWqvftp/UjzZa1MD5ccIfyPTWROrQ+xXxf7 b3dH0pZOvqs5f1ZhGH9B9vOa2mLbDWDGdMS19Q8dbvuwTsg+KBj7Q7v+VvHw5wCSSdix 7RIg== X-Gm-Message-State: AC+VfDxwCfJvRgRAQd/6uiAZAppf+uNaYjGEoQ1JJMn8tG6HfRqHm+VF k9fMgfEssLSJ67njKYcMKP1lNA== X-Received: by 2002:ac2:4c39:0:b0:4f1:2986:3920 with SMTP id u25-20020ac24c39000000b004f129863920mr4308136lfq.41.1684850746806; Tue, 23 May 2023 07:05:46 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:46 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:26 +0200 Subject: [PATCH v3 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-v3-2-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=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?1766694255243587069?= X-GMAIL-MSGID: =?utf-8?q?1766694255243587069?= 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 Reviewed-by: Geert Uytterhoeven Acked-by: Geert Uytterhoeven --- ChangeLog v2->v3: - Fix up versioning. This is v3. - Let Coldfire __pte_page() return a (void *) instead of __va - Delete Coldfire pte_pagenr() which was using unsigned long semantics from __pte_page() - Drop ill-advised change to Coldfire pmd_page_vaddr() ChangeLog v1->v2: - Fix the sun3 pgtable macro to not cast to unsigned long. - Make a similar change to the ColdFire include. - Add an extra parens around the page argument to the PD_PTABLE() macro, as is normally required. --- arch/m68k/include/asm/mcf_pgtable.h | 3 +-- 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, 10 insertions(+), 10 deletions(-) diff --git a/arch/m68k/include/asm/mcf_pgtable.h b/arch/m68k/include/asm/mcf_pgtable.h index d97fbb812f63..43e8da8465f9 100644 --- a/arch/m68k/include/asm/mcf_pgtable.h +++ b/arch/m68k/include/asm/mcf_pgtable.h @@ -115,7 +115,7 @@ 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 __pte_page(pte) ((void *) (pte_val(pte) & PAGE_MASK)) #define pmd_page_vaddr(pmd) ((unsigned long) (pmd_val(pmd))) static inline int pte_none(pte_t pte) @@ -134,7 +134,6 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_val(*ptep) = 0; } -#define pte_pagenr(pte) ((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT) #define pte_page(pte) virt_to_page(__pte_page(pte)) static inline int pmd_none2(pmd_t *pmd) { return !pmd_val(*pmd); } 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 Tue May 23 14:05:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98007 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2170876vqo; Tue, 23 May 2023 07:08:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ49fmI/RDV2dmvo95cMgjJYGvZ8pLuYVNGioSyOCGD4hzXyll6cgxYFR+yRniym/dLi3whh X-Received: by 2002:a17:902:ec8a:b0:1ae:5212:748b with SMTP id x10-20020a170902ec8a00b001ae5212748bmr15369424plg.49.1684850938889; Tue, 23 May 2023 07:08:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684850938; cv=none; d=google.com; s=arc-20160816; b=iK7Nx+lY8f2cp5BlcoIJ8cxCrBUtiNY+R92/pRjNW2vxMYhLGUYvCMmHCo6+S29VMD UF6rVldJ6LECug/AKiZIrC1tllRu6qsZ/QFMzYe10JoT5vR3dogqc+SvvIJ2ODIC1eGr bzivTg9eHD4DRjBFkdExQFbXjOdi1gZhMdvs4CE3I5MC1nge+ukpFN5iuUFRN+XSxlHw ElLvNyVmo05l5ZONDzNZPr7BpsBs+DYNzaUzfd8Y6CMuXjHn/qeKJc73QdSM+BM5iMTF hehwJ10FJvClMKxnUx2gI+reqG6kxHxMHiwtN7j+U5q07D6xq+ASOpMpUfImjtsqw+bi i+8Q== 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=MT1tk74HN6fl9gQe7nBAiF/zVfO9gAlctG3h7Y3foqJvC3Tkg8TAWV7GdipFtxnOtt ItPFHdo1kWmC2wk9My6PFl97h2k0ToPDikhxgovAFrR9YYR/VVGZnWWlk78he7RnTkne YNDUsMeg3aG9gTpn9/YSxUN1Gjuz033J2ilj8RK9v5A3ma6ReQVqCim0pvQlMa5etXs8 fw1rhNhnuKgrlqzw+46tRS8x8aLbLImuCK78UDO4axwhSNnhqwUTshdCY16L9hxXW0HF nup0qbwGxIR/0WadU6f0IPVAV0DV2lDaNS0hzCFA0WRufEQbvqGFV/Y3KVEo61Rd9M0H CGfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DHx5ZxV7; 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 s12-20020a170902ea0c00b001aade54f986si2015710plg.249.2023.05.23.07.08.45; Tue, 23 May 2023 07:08:58 -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=DHx5ZxV7; 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 S237122AbjEWOHR (ORCPT + 99 others); Tue, 23 May 2023 10:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237105AbjEWOGv (ORCPT ); Tue, 23 May 2023 10:06:51 -0400 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BF3BFA for ; Tue, 23 May 2023 07:06:49 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-4f4b2bc1565so2255528e87.2 for ; Tue, 23 May 2023 07:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850748; x=1687442748; 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=DHx5ZxV7p8BhGcgtHBETWYRJd1dP/RkZ+YUCwCVosoC2AbBpe5sHXnMZMwMfxH0y90 XzQe0bQlxKytbPkvQ7V2w5JMdAcALyzlLbnEu6FgCRgXy4OrpPkT/mSWek9ZWrsZAiWH t18h2rnk6uTfqGPlKFgZORYwPzN9BqAyYgP2fxRMHyNsWSDezmeWQlLl3RvNoS0at2N4 zwQ3dB33a/q/dRZ6aJBGgNr9dIXjla+n0UxG3C1sJgM5T6M4GTED+bWcwU/Qj9vEwFAM ENMA+EKO7SMaOA+g+taxuDmYjq5EjwmFMZZGZfVYtGGJEuSMfUR23VvC7Y2vQbS5i/pL sqIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850748; x=1687442748; 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=b4WcrwPIjoqPo/3V91gHBMK8fd2EIdDiBQDQitFlmCThVMOzK6MNxq6fCIY04v4izO wXGl1o+E3Ip1vsBtYTV2D83ADaQKfsIJSCASkaepZqbjNo7/i5vWSX3+NVKlWwX9XdZX xF49U+XEgh5giKGOZ1NEItXGUFx3/O6wuUyKBWmfuCDtOrlwCpz2CTcZ4W1xN9F23Hw7 A1un6B5k0vAQsdOQfjgW/68u6CH+FBs4jB1AYhHseqfBpoFf8pKWjLxXx+Ur12v8ouPh KmhJ9KhBwW+AtE2q33ADwMgZ/SrLiEdGCUC+8jxHlMuCXg/nGf1A/6+8W86iJIqh7Y3k xq0Q== X-Gm-Message-State: AC+VfDwrcZ7zmzxnZH0/SYP2k+lFdkcorJbr8fQ4srz2u3MklNmfGqNk zJCnRQu/8eOWPyccBxL+HAIG7w== X-Received: by 2002:a05:6512:259:b0:4f0:1124:8b2a with SMTP id b25-20020a056512025900b004f011248b2amr4733118lfo.46.1684850747942; Tue, 23 May 2023 07:05:47 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:47 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:27 +0200 Subject: [PATCH v3 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-v3-3-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766694257913809762?= X-GMAIL-MSGID: =?utf-8?q?1766694257913809762?= 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 Tue May 23 14:05:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2170966vqo; Tue, 23 May 2023 07:09:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4uH8HNDdaMYoWHYhk05TByLcQS/jPQ1zQNeRlqlXdCncFYwZIZqqNbA88Lv3oDJ8GE+Sf6 X-Received: by 2002:a05:6a20:442a:b0:10b:4a5d:28d5 with SMTP id ce42-20020a056a20442a00b0010b4a5d28d5mr9939664pzb.19.1684850944662; Tue, 23 May 2023 07:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684850944; cv=none; d=google.com; s=arc-20160816; b=fL6YYsFR2jyzzDItTAjP5cxDZjfHHjRW3aez4//i50r1EM760gxxeS7gactzUSeRZk fKKiSoRfrsd0WjdJirjO3m0m9xXeOGk/hZuxAaLFs9hBXv59sHpKWZ88SHLWPf/SDh1b XN4HScsihJTdaCbDJWAPj1AqcPE3ZFZjCT1npGINaCr0dfQ9aEfTwhrYmcfeXA6kLhjR iNwGnSAM7eMSz2cldVKGQefH5oEAc/Qj+4qq2Y/JBtKfdu+49SeePaenofCObY1fzQ9T LvQce9Yl2BxjK898faZH2gjDz39Me3dZcwtPr6gdyOj2oJ61c0gn55iJzlhqrCRmAyGw V7lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=SZOtWVS1lCOxds2QCY7M+hAIKv6XvV3Hqis31ERV0mU=; b=JcR4/ENR7McPW7Q5ktA28Q3iNesE3lcJi5NLUSZicZyUs4npTbdQZPn2q5/mpX5xtj h5nK/5DuFvV6htgS9p06tw6z4jfe6GjpQ/E7crA0JU4hW5mtUflmYjUq8irTJiRUa8WL juhCaJ9EQPKwp/Y1MxGveOxn2uCOAwcS8AmCjyhsPuZ6yP3rBCZD9/FkEOzkWmyR4bo3 gUbcOz2z7gEZA+cwVhZEr+7gyAiGQK/9Ngy/9BwMG9QU87Anf8HBppyoYol39TGmYVSL Dy6nj4gninAKL+c31FWogSWQeIIsl7jRiaaihb8qBifb2n9zP3BvE6tSwdGZlqYZ4axA 2Cbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jQFz6Zi2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a63ae0b000000b005098590f1edsi2041170pgf.757.2023.05.23.07.08.46; Tue, 23 May 2023 07:09:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jQFz6Zi2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237176AbjEWOHU (ORCPT + 99 others); Tue, 23 May 2023 10:07:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237120AbjEWOHM (ORCPT ); Tue, 23 May 2023 10:07:12 -0400 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4446118 for ; Tue, 23 May 2023 07:06:50 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-4f3bb395e69so3564106e87.2 for ; Tue, 23 May 2023 07:06:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850749; x=1687442749; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SZOtWVS1lCOxds2QCY7M+hAIKv6XvV3Hqis31ERV0mU=; b=jQFz6Zi2QlqzFhgg609+OdU2cVzXhTGama6kh7r3qdlPmt1t9W7hOhsu94u+OwaOb4 qZCyO9HFjWxC1UNvj7aH4gjawmqX/FfvnrnEMqAdWBJ1gKgK3OsCh2be1l8goABkGeca 4qq5vjGppvB0Ff3wZVKpQwbjqPgJrSjep7pLQRAqJ0vCR1bSNUwj/9E5GGjNWZG6UBIQ laVwoCR2Q+OLiyyzutCe6jstO9ARgNPtspYX4FMnjz5PkCuGHkQ+phxAPeufD6G8i1or 2yIWRKaSDcAN6pWjBjwXMvm/DRKg3Ys05cggpxTJlPQbn2mQmxpWJNhzydJrgvcQ4AmW jBKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850749; x=1687442749; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SZOtWVS1lCOxds2QCY7M+hAIKv6XvV3Hqis31ERV0mU=; b=EOUwn6UCMJNQGnikvGdlldZ3QTU9dTBGwWCUHsaxWeeLFiRI9e7iJwTZgXTdgeqTl2 +i22Z01U44cMG+Ko22oQ4SDtMT+gT2YUO1IRa58trQQminUMrF7t0/1p7FAaagcyPhAe Smq3irkRw1E2x43no0MDKW75ZcaSJyZPDjMUgAs54GQfz7tPWcPpYMdN0XgsLHFowSzF SO0HU/3QSFmHA6V98HY0Cz4riXQ+6jsCBfWY7pNZkiG/3fMjOLpnYD+NcH71jRr4tRlu 2zauCtK5MoRBlcafdB39Tpo48iBhX17BJViVf7GnH5ij42DFfIhLUvhnDa03svoTPeLR AEVw== X-Gm-Message-State: AC+VfDxq9ebhmzzG95Qm2nh8XtPzXF6MV5wcWrkesvFrzcikt/bj/1YY TkVY5qOxNLd/6507opzNIdNeMQ== X-Received: by 2002:ac2:593c:0:b0:4f3:b588:48d0 with SMTP id v28-20020ac2593c000000b004f3b58848d0mr3291847lfi.14.1684850749081; Tue, 23 May 2023 07:05:49 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:48 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:28 +0200 Subject: [PATCH v3 04/12] riscv: mm: init: Pass a pointer to virt_to_page() MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v3-4-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij , Alexandre Ghiti X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766694264463881768?= X-GMAIL-MSGID: =?utf-8?q?1766694264463881768?= Functions that work on a pointer to virtual memory such as virt_to_pfn() and users of that function such as virt_to_page() are supposed to pass a pointer to virtual memory, ideally a (void *) or other pointer. However since many architectures implement virt_to_pfn() as a macro, this function becomes polymorphic and accepts both a (unsigned long) and a (void *). Fix this in the RISCV mm init code, so we can implement a strongly typed virt_to_pfn(). Reviewed-by: Alexandre Ghiti Signed-off-by: Linus Walleij --- arch/riscv/mm/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 747e5b1ef02d..2f7a7c345a6a 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -356,7 +356,7 @@ static phys_addr_t __init alloc_pte_late(uintptr_t va) unsigned long vaddr; vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr))); + BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page((void *)vaddr))); return __pa(vaddr); } @@ -439,7 +439,7 @@ static phys_addr_t __init alloc_pmd_late(uintptr_t va) unsigned long vaddr; vaddr = __get_free_page(GFP_KERNEL); - BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page(vaddr))); + BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page((void *)vaddr))); return __pa(vaddr); } From patchwork Tue May 23 14:05:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2170980vqo; Tue, 23 May 2023 07:09:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4yF8WUL51RoMeFCzB+8aN9Ua8UJscJxxN3/6xc4d6r0Nl9ycCT+RIEu4onDuZbddFlhhIH X-Received: by 2002:a17:90a:f48d:b0:255:a904:7a7b with SMTP id bx13-20020a17090af48d00b00255a9047a7bmr2451940pjb.26.1684850945527; Tue, 23 May 2023 07:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684850945; cv=none; d=google.com; s=arc-20160816; b=GxnGzjg/klACo3MhI5aDrPs3w029gHgPsJ6dQ2m7IfhV5rbrdSbNB29ZusS5HdnlNb Gw2GsLublJPqehT1v0MiBHLvcSkE7oh0714JUdxFfgFg3wZqE/DFQRSAfdxTTWTLGEbt hUq1d6aQW8bSFD3nDxFC467kDDHfwZyCXAHySPnZcnb9J6ThkxFlLRNbtN0xVKK1qQjM bqV4it7/2+Nm+r88eeeM+pUNVs123HBKpquQGned/UP0jjuXxrj3Y6MiF8hmYkbX47Dh n01udtAQSMsV3wfPaMDHIYTc8E4q30PYRScLltNgnwbr67+SNED4iBF22uJ5SNHTF3eb y5Wg== 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=U9vprZ1pIDH97fv03zsvm5cvMMf0oZK4qN5ym5NpUoP6MPmkyiaDX0ESY+OgUhHFD7 nVGwKl67iFOfFGmCK84Kt/yNo6Y+8p03aBadklv3FCTmYHJ1jPzuv8OGcjwxXqrcSxNs vwASsmMDZYhcqYy/FyliCynIFaEoyV16ybnKlOycMnBzly87kw3nBqE4zNbPOEZ1DijU /26gCmHhnSakIRnoMHadVeyouz6O5iRi1RLVbrVUZzTMhhmvhza/SCqQO1SIX88ctNc4 eWiGbUPcvslGTZjIlGFlUSNI1btLumWiHtAtVB2a7s/EL/UDphznUM41F5oJyEywCBr0 QouQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qhdr9VIe; 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 lt9-20020a17090b354900b002473e331f90si6479223pjb.46.2023.05.23.07.08.51; Tue, 23 May 2023 07:09:05 -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=qhdr9VIe; 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 S237190AbjEWOHY (ORCPT + 99 others); Tue, 23 May 2023 10:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237129AbjEWOHM (ORCPT ); Tue, 23 May 2023 10:07:12 -0400 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF4C018D for ; Tue, 23 May 2023 07:06:51 -0700 (PDT) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-4f380cd1019so8398205e87.1 for ; Tue, 23 May 2023 07:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850750; x=1687442750; 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=qhdr9VIeHm3TCAUgvcaHfodtBDTuWxK2iXj6V/SQ66zUErdAk9+DCvdLTF4aCd1ETu C+ZAXFKiOs20Y/LEEtHSq1dPudVvh6HRokN0i21bR1zIMcVKbUmCrYz24kNjxTLPVXAa cFSvLYM8x6ZBwAnEtC4zHJP9yI7e0Y76rr1w29rfD59OhfMtbLcaAZOSrbcUgEQ+zCmx caIJ/LOff8nHxBYzP4GFpPBpy1b42pU47PMbeKWiMmKuOjXR5pkLmpUVwA4W9JWmR+b4 CDnpYKOJa/b0/Br6Vk3EN6ig9EeMV6vmOvhLsCfhbrFKneL3zoOIRn+iLLV6tfwCA1tP yGJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850750; x=1687442750; 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=lkDZhpQCYcHjhMVA7ddeZybJcHCQNQMt+y0vsU1LkcVwst+19CSF7yHRj2wsK2jPVr sb4hGVlcf3LsXcUXxxLXUqumUeNwAMjL4yHtLLLHwBiKe1JDpqghgMqUk8PAuYDI3+RT Zp1cmPNkBhC5O3LlzWBPlnoqb+VJQAUUvUPJ1AtLt1NYXfaiN2X8Syq1WBF5tqGleFV/ C4Eeq21GKTDw3ofYQyGpTYcHFt1vOhg6Hghmkhk34q0whqAB8KeE6+pGYgQd2+63egmw ILq3k+2T8orS/e31pbdwmBTow6LcKK1w9epoxF6eA8ILkZDSPCJGAr3Y5YNOZ3G4OZ1V w6SA== X-Gm-Message-State: AC+VfDwEp7DcGrbvmzNbDtdiStEEqzABsBj/u3NoPGhIlPvFQBMLTPpN gz0OhBP52iQtG9ickWTOTcT5kA== X-Received: by 2002:ac2:52aa:0:b0:4ef:d6e2:6530 with SMTP id r10-20020ac252aa000000b004efd6e26530mr4123672lfm.37.1684850750175; Tue, 23 May 2023 07:05:50 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:49 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:29 +0200 Subject: [PATCH v3 05/12] cifs: Pass a pointer to virt_to_page() MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v3-5-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij , 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, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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?1766694264728311968?= X-GMAIL-MSGID: =?utf-8?q?1766694264728311968?= 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 Tue May 23 14:05:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98019 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2188352vqo; Tue, 23 May 2023 07:33:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ577hbYMTrgEgINTN6HAJzghAzisWdMKGrZkWjlKzdf6wJgrcAscjBDjlVvZhFrrs5S5Czr X-Received: by 2002:a05:6a00:1596:b0:64c:a554:f577 with SMTP id u22-20020a056a00159600b0064ca554f577mr19364090pfk.11.1684852398928; Tue, 23 May 2023 07:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684852398; cv=none; d=google.com; s=arc-20160816; b=BxNCB8CCSodNOK2Mrylm8M4Ge00oatv2a9Wml+dx7qfrtk5Fh6dzZNBAy/RYWFM9M0 252sioWRVynUnLDjgfQKbBMPWAOVOXRaShssSnFq77N09xNUXQuaWft/NqIPMeYFuvGF GzQ+NOe++/GgJ/MW2Jz/fLs+P56c5AOyEdiEtRUCcDOYanFa0+dFNzWrqEwG2hhHa2oH /p0V4eQaQuZdbKyl/iCY6nxuw9cjyTBQc4KDXQ6Iczrz1cPTjGp5IVfk2RF40WxH3pBN e4U3F1WNOwjQ9qYmBf+0dRixFg1DvQU+bmcuBFRc684FQyVfIkjYb7tlaT0oqHyvd6M6 Y1+w== 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=pqXuQKdfQG1+fZNRO7zze6jW5r7YWRmYLvLtk8bBuv/JucazPOJ2bMS6EZQyLFO5a4 SOPofEvo0BRAevxEhPe2qtXmMP911rQi7H+ky0knO+LsAsbrp+WH8x1O/vtxeVkXVeVv Tt3fBMSwb4flk322CBcD7d7HT2A0U7AyCpr1GUDENsJ4picREpjymuuaGg7QV/+Ju9BR B4guBE2R7oUTjwEvtmRmgTQtM8zceoERoQ5UQruT3MkInNimMEy4Ap5KIAJ8UasoIJt1 BPuoMsox4LdbfgxU7gGq5aK/ml3aC5YxXjVqVJauS8ttuAjppyYiD76k4BYzuXy6aJfI +cmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=suXLt6rU; 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 u70-20020a638549000000b00534878ba944si846526pgd.336.2023.05.23.07.32.42; Tue, 23 May 2023 07:33:18 -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=suXLt6rU; 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 S237059AbjEWOH2 (ORCPT + 99 others); Tue, 23 May 2023 10:07:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237136AbjEWOHN (ORCPT ); Tue, 23 May 2023 10:07:13 -0400 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E80B0196 for ; Tue, 23 May 2023 07:06:52 -0700 (PDT) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-4f3b39cea1eso4337222e87.3 for ; Tue, 23 May 2023 07:06:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850751; x=1687442751; 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=suXLt6rUWNL44vDNr6SS/EymOZ59hQEEGR2ZTXjDAx/AQp8nmKRLdaV2gUtIwvhf1t K/tAq8Z9ZeMTJQOstwd3dQeZhusrHSkrzN26dMfjKZk7yFZpGGO12BPMNBl2tvDMBfau g1zZ2x6JYoE8G1O6v87j/M1aKi8OQ0BwKQlzHWXj2LMSLUmsooYNVOxWag2uMhjdMbMO cWdFAnbyaQzYQHH2jmdzSe8LmY7bWDBbmxV219wusGP7c6T2/7oOh6ZhoSHiNVm9tLUm nypNbf4j0yWVIS8C0Jk1OKF5sOw3pb2FjFioOqx47SpRH6sLccmqgHJKbm5qp2ED/llI S7Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850751; x=1687442751; 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=LYXtzNQ+FbDmLZU1vht6+AwGZKaRK1heLdyWaYvlDuBtb4C8TgCEwPKIgmgW8c3b5s YLPuIyxkwYx2ivuFQOUYdA4lz/1qufuCQ9gfODu9IvAXM8jrHgUgrRQK35wXgYxq1JOp sgZ2nwI2FJNz///CEyNj3ujqV5MCJi082KZcJitoZNI2dQSx05lW88INjLxQy7CDSFGz 5hvlP4TVUYVL8C/0UeAkOuKf6W4ubG79o0WuJrHa1RyJrA/bPbQI/AROYOYKsUWsq3lp uoeoL6zJOj4L96J+8OU5W9DpXd4tBcwvimXdww3diV8kVQNEce9nAYTpKjd+RIb9VSVS eZ1w== X-Gm-Message-State: AC+VfDyeZOxjztngAnzxCgZLNeqycoYQnLP73GXbmAiQ6hVGawsUsizy P33JryBJvA+1xtDyrlvFds3KJw== X-Received: by 2002:a05:6512:908:b0:4ef:f11c:f5b0 with SMTP id e8-20020a056512090800b004eff11cf5b0mr4377803lft.54.1684850751226; Tue, 23 May 2023 07:05:51 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:50 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:30 +0200 Subject: [PATCH v3 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-v3-6-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij , 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, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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?1766695789191563500?= X-GMAIL-MSGID: =?utf-8?q?1766695789191563500?= 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 Tue May 23 14:05:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2187697vqo; Tue, 23 May 2023 07:32:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ47WVw49TRjwXiDVbiHXVyDn8xjdLHtdSCGCV7PscXMthWr3cbd5QZwkXn1pnUu5zjcST77 X-Received: by 2002:a05:6a20:1591:b0:105:5086:fd42 with SMTP id h17-20020a056a20159100b001055086fd42mr17071894pzj.45.1684852349533; Tue, 23 May 2023 07:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684852349; cv=none; d=google.com; s=arc-20160816; b=I6S89O5/6/QcWVM9jWxgeRMmRedhGeRTpMyTaJLlx/ti4C+8Cd3KLkhJAofyf/Fi3R 7r4fUwom7R0zgAbrZKPASMe2HehRotUp+Ox5hDIh8IeUnQhJKITg3NZskIj1Ywp9VBIV ijCylQPx3ZwJaHca942qRDHqQpgJj6grGNy7TBhbO6B01TSu+rVQfrZHzjDEe87pGmdl BG4O9LbW3slJCWQ71t7bYUutM74Heu0+vo+0tm4OtQvNxBta94O9zUYUqOTBFyacqyXa G/3TYjkPoxaYPTkcPHdHen1sEiIokUwkDMEf5CEAFK3IIiJEfkhCeZ+2wuQllC4zfQVI zJDw== 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=uOKpaahNXJ3du5vssQ1tL98eqFzjzXdzETI+g4FiGHXZ68x4vrIMof7K5tK8dY+GRJ OZyE/XnrM8/hIlG7adFPSkLVtZ0sIPryNWZgrn+AOrSxtlWKldwH2Nk9XmJzqf3510/u YduEALWkkSFHNHnH/eCssPtUiW33ZAp0AiUUEZQWRYe65qECqSseJcvclNgJY41y2DLq BrcKZnYF0t67oPn4l/cTgS0WbhKMaWpoupZVAhBIs0jgjJ48Dij9N8ia7pGnp8KI4tw8 3GqHex6kCr0xik/bv2fOiyc9I072SEKM5b0pJqINtDUgiWOWN3486F9qHKvgVDMppUUH BpLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sbGtpTGQ; 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 s11-20020a63924b000000b00530b1e7099dsi4839040pgn.84.2023.05.23.07.31.58; Tue, 23 May 2023 07:32:29 -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=sbGtpTGQ; 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 S237215AbjEWOHe (ORCPT + 99 others); Tue, 23 May 2023 10:07:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237149AbjEWOHN (ORCPT ); Tue, 23 May 2023 10:07:13 -0400 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD0871A6 for ; Tue, 23 May 2023 07:06:53 -0700 (PDT) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-4f3a9ad31dbso6175272e87.0 for ; Tue, 23 May 2023 07:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850752; x=1687442752; 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=sbGtpTGQuKoJbgxbzRVNan0g3ud99MIRZSa7psCYWoBO5Gd4ngiT8ZH12iPBec4b/f sv3wsOpDUcgyEoNSv9DLn8MhriBoP7mFWJrbwaXvmmnHPiHxtLFssiTqg1+3y3/CC9Ng 5q2rgJSMArU+a9KH/zpDgU6xvBjhPfINAqbfFlUmU6jcGaflnUqrxGDRKWin1C7+6kod w8BvwYrZ7iBnRg/rTBiAeldXSsgcYri6iPf4e7gY99RgCsDpQFTetppSyZ4a9pLmLesB A3f0/o/eDj5XUSN3Ow0r5byyVkJLGeP9SLaqg9YZ9I4EfNu99apZyryJofgUt+kGvN56 2QFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850752; x=1687442752; 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=Pqnd0d7OykBOgXY0JnQAwYdWEcEfoH2nxMtZhBnTCitNgHkbX68qqdIZPlJxdKZiAx hX3DGkD1Az6vbE8LC2lZ9y/OeE9WboyxW71cbSqYAAh/hF55Y6P8w0B7RAuqqzVMvEAk 4pvPdAE9r66qpH8SQ+l2dpu+Dfe78UP0gwpYgQTl5VhJqmGFLXgfN5dg5vIFYwBEiUvs SvC+rH7M/Mg+jeIcKg7VDBpryg1pPzazwN3ToYAp0etFL9fjB6zyr+MBknXv7HSVKaz4 LEcqD+Qbialsdts80fU1ExAYsnQD2H76o7FFlcSAkVNM9ZNaCONvR8oMdTH+UOrEOE3D E+iQ== X-Gm-Message-State: AC+VfDwoOYoz8wNkmlZv+Zos+OS5cvUkctYAnKTsh99EcUmNAG2ug7Ws K1RyspCh9+s7iT/23VJaDFOusw0L2qSyiSkbHuc= X-Received: by 2002:a05:6512:4cd:b0:4f2:62aa:986a with SMTP id w13-20020a05651204cd00b004f262aa986amr4590844lfq.21.1684850752229; Tue, 23 May 2023 07:05:52 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:51 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:31 +0200 Subject: [PATCH v3 07/12] netfs: Pass a pointer to virt_to_page() MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v3-7-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=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?1766695737653218368?= X-GMAIL-MSGID: =?utf-8?q?1766695737653218368?= 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 Tue May 23 14:05:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2172383vqo; Tue, 23 May 2023 07:10:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52zYWCzx91rOXP3B9gKI24taAtF9qxFKbSQopp39pjgeSG6AbOiNhDotBUZgbovcCtCKVI X-Received: by 2002:a05:6a20:1590:b0:101:8b:43a5 with SMTP id h16-20020a056a20159000b00101008b43a5mr16470667pzj.8.1684851052129; Tue, 23 May 2023 07:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684851052; cv=none; d=google.com; s=arc-20160816; b=S341VGKeivMbhyAk8wp27KpdFOIsV217EIMpV3od1QMEvAhumy8uydcVpddhI8/BsC VcEWqpTl7GFfbqTGnzzMee6lCmgyXfDNNizJ5srMAMGDHAUNRPY35BbxysVCgUjvH0VE 53arFWu2EvHEtBbvbUz//LDb5W6GOJLDCKOuM2noC+NMV+pBuIXa19RdnJ/NUwo7ph8h /ybFtWWrlCDWhWIovmkKxezcxyo8JU58okdjE/ja+RbD6iLtaQbjBWtiqZ0w0svfwWBF AVp5VdxjDEVjp5zQXUvIH+/OcAou5frmsBIF+VZ28+xMLfwCZkgiio2kehlVQ7yfpTos sZZQ== 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=CiqC+u5brjMKyT+rMIVjgA8TPFuyBVmj0kvJ8mbwt97XkrxThsIjGtghhbteZ1RuDJ ktHaQPwI+2JpA7pjXmR6wr97myprjwUnno0cr96sKK8faIA1DZQ/bybuMTpSx/RpUM89 7ahSqNFgwxAAL4LoY2gxOXt+fN4MODPACg0RByzfZT7HHfSSR2jkkfQ3LNhGtnMe5nSN 4Yex0JH2Q2XajT+/gdUnkgmWN96jD/QkM7uv6wme9ikvWEqcUfAtbC+Fce5jvx/9CIh5 bTtvUhq2TgkvDXmEItRoap6hfPikqvwR9fwjKom/k3Bk/FjSulxMsC0WwOZjssiTf2JN li0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sZzbi9Or; 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 m30-20020a63711e000000b005346e1b7614si1737133pgc.893.2023.05.23.07.10.38; Tue, 23 May 2023 07:10:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sZzbi9Or; 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 S237255AbjEWOIO (ORCPT + 99 others); Tue, 23 May 2023 10:08:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237152AbjEWOHN (ORCPT ); Tue, 23 May 2023 10:07:13 -0400 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14FC61B4 for ; Tue, 23 May 2023 07:06:55 -0700 (PDT) Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-4f1411e8111so8183397e87.1 for ; Tue, 23 May 2023 07:06:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850753; x=1687442753; 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=sZzbi9Or1ecOkZRiN09Yj29Ot8B7LAVjqlaksWa5mtFSaJfhhAjYBQqCbgu39f00zk VK7TpV3BWK7N5disTxsUT+9gEJBxOb/ehtepI30IxdIgZOD7ILx03dfX1U9LUlrqnIxN o/DfgylSvuaURfgnFTqAlkk4/e/2QTF/i6nSUNEA8A45JrglmfBlJskn+PBcNSxo8Nax UjDkj9kSQQAr49/ra9mfVBiByY1gHuy6vLurVvXWcr3GtGvlt7ps8J70oCU3gREuO2Ow Oymkav54lF/OR103ZsyoD4QG8gT0MmmztfsSMu7sHfsLZwHZYwfd4ojLRHaLUm/2afXV RLGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850753; x=1687442753; 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=O0LexNQTnSwYUqFbPTbpXZMZG29cdUl1XXB0aKK7saRTxUOZgr7vXJOlnyRyQ3ObmJ kN1r3e3GtflS22A8pOhQAVs/s+MnfAtx6dSajS5rxyE9l4wROA4aL8s02ZmjVtawQ3s0 M/JhdUgBEN40aUlC9dug4PVRBTecmIWPa60/HhNWdNb9JP8+lYiG72Ol3Sq7HgzamhIl 9fJZ2syX2iZA7IuGXyJYGjnFBuQotoQ5C1a1ZtC0fj9CFIiOmTcyUf5j8epu84HgIzh4 VZ5X8BxPoc8pqfClS+eIwlpWRxsF6fgrLvXOMSEBzd+O8rKl1ys/nx39bkcPkD5OhCZJ HZ9g== X-Gm-Message-State: AC+VfDx3/qXM1PVhiTQ2omJ/pi1FeyQa0dqQrSamcgNqC6iRCKQL9Hk2 zxF1iRLkaz/MHmCCdUAetHL3tw== X-Received: by 2002:ac2:52ad:0:b0:4f3:8263:cfdb with SMTP id r13-20020ac252ad000000b004f38263cfdbmr3539737lfm.50.1684850753268; Tue, 23 May 2023 07:05:53 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:52 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:32 +0200 Subject: [PATCH v3 08/12] arm64: vdso: Pass (void *) to virt_to_page() MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v3-8-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=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?1766694377232911095?= X-GMAIL-MSGID: =?utf-8?q?1766694377232911095?= 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 Tue May 23 14:05:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2188320vqo; Tue, 23 May 2023 07:33:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5fqcgeP0JTqW2hGxNw0PTybfxXrgJpxN2PHfi3mRwXALGnkI/QyZe0S91Fke9G9CmvAoRZ X-Received: by 2002:a05:6a20:3caa:b0:101:65a2:e06b with SMTP id b42-20020a056a203caa00b0010165a2e06bmr15693262pzj.20.1684852396267; Tue, 23 May 2023 07:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684852396; cv=none; d=google.com; s=arc-20160816; b=W2Q0YI045eze6vn72pWwbndyD0N5jED5HIleB3Knom43gH78BDomm1OfIxc9s0Vz2X zw45zzBUsIMZ4+Zf5Ra4CIf4y5GiYRoE7B3Wl9n9MlWxBklAzzkrhsqOsrZUsBz8ZIkL OTtjDbeCkXViwNRfvbkcJn7lPcv7GYrS6gDqN2NDFGH++Fv7z4LMWilhZY1nZtsLW1Ej lciUUX6nQ4EcxEmspi6bKt26aZA/cDw45OaLiaDKc9F/0799KdcmqlFteFnOpH0pjfGI EhE7IoiYWWx+ZXd3zjk26EbUAQ0+jPEKVlGdh/CTmQIc12rDhbPfvgTLbC8/oYp5QdQs wB+A== 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=E+b8NL3nGj5ubOAx2OCEmUfvMc3Wh+Nsxd2aPMKL2Giyu9sKG90eenS+ffihs7/zIy hhs76/c87hqEmZ8IVVX5J2aNzBstt56DSSaTEJvyRU6ymHL4+COdrw8pr284717DA6X7 gEUk4mBfodWx70Af4fTeKg5srfSQcvJXjnE06ITA08wX54d14XpRch93lT/xogBv8a4x yIO876qrrQ9PTD4U6TQG3Yj26qdlIKzuUN/m59rSBkkoKogx0Fu/0qvCQm5DU1ZAuoyF v8/mHb7WE/uNcwJU922HAP3TYQQYyTH35AKWWexIXw0EiKxI0U8l4/L7MUQo/l5lXUs2 hgew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HpmD5IFX; 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 p5-20020a637f45000000b0053076a4da8esi1841323pgn.761.2023.05.23.07.33.02; Tue, 23 May 2023 07:33:16 -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=HpmD5IFX; 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 S237187AbjEWOIS (ORCPT + 99 others); Tue, 23 May 2023 10:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237159AbjEWOHN (ORCPT ); Tue, 23 May 2023 10:07:13 -0400 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2CEBE43 for ; Tue, 23 May 2023 07:06:55 -0700 (PDT) Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-4f122ff663eso8056433e87.2 for ; Tue, 23 May 2023 07:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850754; x=1687442754; 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=HpmD5IFXXBYh79hB/QdHKbKxuFRZSDMi4b5OZGTylI/XbzqUU0nz4W2BvN6yvKss7I K1cwCwlsNLZKWtwDIbEgnBIwLeSRk9MusgogzqpLIGkeV6I3IpHf5ZImCV1dO7TmBmQd Jxo5lBjORGSyxFQpYfuSMr3vb6XHB27JbLUYvAKRm5hN6Vx2cqGdrc5nBtxembJzIGb+ XkA5TOH4FTAGjGGX8LhKx2vDYw5pSIfYWUjWXmA8zVjBOfrxf/vDnuKaKLU2/n/3jNel W+4yMbxUSUGgrAJBjS8Un11ko0kSEr5ibGVEHRlBzUWYgh4gIdzzchv9ZLkOCYx4CEzT 1cyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850754; x=1687442754; 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=c1IiiWxTLO8Cmh6n/gRL0U9btfTBlyPYjaQA5eSU4/nPYlj3lSGbiu5k8GHqCFHms9 O5COTINfeq6ZyBl6AMolZPZOpGs+Ap3w1is3rZv6Jgn4YCrbtuw252xJ6L0ZSiG5zAHL 3v2Hgn2gphKk4MJKoC93G6SWA2hOMREgAUqXlNH5OQzb0iYvQAN0CIZw/iEENHdUTvYm hSw3hKBJymHmVeIw9EYoSOl5KYpT2N9aMI8G5HSO8+RccDVFJ5SKG6xx1Cr/4u/JdsZP /KFEEWX51V9i2I/MkmMsccvWMdrgOGArVmSnK6M4lxEpxhXtWQqXigLJeeOgjRcOnB2W +xOQ== X-Gm-Message-State: AC+VfDy/d6nNboQHm2JfDJODRQP4cL5yKI76JcZ5hrtIVqTttrikO6jV xKhgcVA/pYKfM+epunwc+lFvlg== X-Received: by 2002:ac2:51a9:0:b0:4f3:b9bc:9d68 with SMTP id f9-20020ac251a9000000b004f3b9bc9d68mr2955818lfk.18.1684850754250; Tue, 23 May 2023 07:05:54 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:53 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:33 +0200 Subject: [PATCH v3 09/12] asm-generic/page.h: Make pfn accessors static inlines MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v3-9-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766695786218945224?= X-GMAIL-MSGID: =?utf-8?q?1766695786218945224?= 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 Tue May 23 14:05:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98010 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2171544vqo; Tue, 23 May 2023 07:09:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5YqfBDSZy0wliO9iCJ2S44drgFeU5JRMWvzaHhnO8hsFqmoDEEKjNzvtMlwVmHozgNzZlz X-Received: by 2002:a17:90a:c7d2:b0:250:c118:cb4f with SMTP id gf18-20020a17090ac7d200b00250c118cb4fmr13805601pjb.34.1684850988565; Tue, 23 May 2023 07:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684850988; cv=none; d=google.com; s=arc-20160816; b=XTe8Mns0YIuZ0zwORfe9voXXNOGKGHq9+M6SVR30RKAhRog/tKVGYYdkhMSoTsEIKQ Rb2Rp3c9IUBfa1fxcQci5vPWEVOhACn3YmIPFgYy32rhyCO0QMbEX0ZsPLZ1u/xQatGq 5b+EUg4zoluk4Qg+Y8KHEs+zmURrg3nchpZfi8Ui2yWY8Yf8Ex9qXtzDsgm8iosFJJel ZQBCrj+b2A/hglC9fX1J7bkWjcpFz21x2mbBALlM3wNYTtiGTIxysKvNmBQSkrr0sdIp SUmzhoxvEdZ+OeeA/9jlZy5KpMZyFTmeDJgCbmbcIcoha3+LL8X4yJzOkFb0xdG6IJHJ lhKw== 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=FjUmJePM/CLjTYqDgvM6rfIAWkQIFhAuJTRmWqUwMT9d/eTkpYbZAg6fByJQwqglQn jOXQnBH2CFlK6uLKcI9wY8Er9VICOwbao0PZo2T1NaNN2APYDR39GhkckxJzNr+a5G+e BRd2blwFWVeKOj11xyk9sk1cIEKuTYEy9KO0id8Kw/9jKCxRyJQudKS2wgtMY4dC1hrP Eu2rv3usFXDzf/lhThxkfJS0gd41Lb1WFzXYwWvVxO3mRTWSFKIYPLTprwXdEQ4Q72a3 YsGvOXY9Bxr7w834hF7JAca9cbZM/NZmrzXJzwr4K9hllPOXgrczMsYYT97HoFjDwHSX bOYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RTNF1dOI; 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 u72-20020a63794b000000b005130f15c5b1si6691886pgc.363.2023.05.23.07.09.34; Tue, 23 May 2023 07:09:48 -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=RTNF1dOI; 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 S237262AbjEWOIV (ORCPT + 99 others); Tue, 23 May 2023 10:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237181AbjEWOHW (ORCPT ); Tue, 23 May 2023 10:07:22 -0400 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 592BDE4D for ; Tue, 23 May 2023 07:06:57 -0700 (PDT) Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-4f3b9755961so3499113e87.0 for ; Tue, 23 May 2023 07:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850755; x=1687442755; 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=RTNF1dOI8qXq/eykiP1dN0zND1ocK0wBWXijQ70vdH0qgf0zuAL3WXeheksWAnT4iD WkS6mYR6Vtr9ViSQofZxqXRVktx4l1ePcQfL54w2Rjl14Eqqu8hVHkQA0uhv0TopPH4o JWyRQf9CWHKXLVJdzA4hBRwrrsdl+b84x5jxJreMYFTPEcmB+Bnujqw9jSEqvk7EH4iC aszeeaD0iik3i/d2y+NK506z17nzcANmfSRMZZREQdt/LYkeCQgVsyCzf5TK608CDad0 LgKv3tdrJSovh05GHnH4ihpKbNe/1vgXgsClUdU17aL6oarVcv3XhksHdDsd7kEdrhym HvPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850755; x=1687442755; 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=cyg3uXhL9BJwtKhBMRqTOJFc5r31gJYX9zWI47H8x6pttPbSMI0EDPHX2xHTFEn46k lmUIvfz1cg8EWP4cWMS19CwTf9MvLvNSF5xq1zZmidGWKQxBfRBdb9yEWnvSiatWG0BT LKpkZHA5Dp5ef9dr94kbqIGAU4ZNG4m0pUfwNGFoU1+C+kARtzmWPjjoMOdsPty5gkoH 7iTNeKXGkiuJvrkyh1+ILw1fup+6o/N0EHkbo6tWii0XZomOcYa/qhOtYxMynneJyjhR yy6nJh0EOpmWwaB3jIaxK8k6jetbFtxZa7xHEs66wNe/prskZKqtFDtf3lBMsRVpmOrV pKIA== X-Gm-Message-State: AC+VfDxxnwAGUYW3ndHTxxtIlmu4vePpPWweCUbHsc9fN6SQqEB1Z5RR lUvdD92NI3tfnAukH6ifBZThnQ== X-Received: by 2002:ac2:4354:0:b0:4f3:91a2:279 with SMTP id o20-20020ac24354000000b004f391a20279mr3649798lfl.61.1684850755271; Tue, 23 May 2023 07:05:55 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:54 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:34 +0200 Subject: [PATCH v3 10/12] ARM: mm: Make virt_to_pfn() a static inline MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v3-10-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=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?1766694309955358768?= X-GMAIL-MSGID: =?utf-8?q?1766694309955358768?= 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 Tue May 23 14:05:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 98011 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2171586vqo; Tue, 23 May 2023 07:09:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5gBdV9Jf1szKh/2DQGTZnjPzZF1YSEuAk1waxyh6k3rFDoVjp5Peuv6x9gF66EUiCDC49b X-Received: by 2002:a05:6a20:7d81:b0:10c:8e4e:f303 with SMTP id v1-20020a056a207d8100b0010c8e4ef303mr2204873pzj.44.1684850991453; Tue, 23 May 2023 07:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684850991; cv=none; d=google.com; s=arc-20160816; b=Z3VLna8vmk1Udgw7O6zktuFsBAx5Q/RV3udIbVTfPlKWBmPakRKfEWTtqZHnAKmKe3 MnzeE/afkj+wEp6BoHDf3sHhM46njp3UqR7Pmsk4SPc0tGSw7K3aM00Qh33qGDMwm/X7 GjMKeHo/n6pzJBL3TUrTmlnCHrW/MG0VZT+0LoXhyVXVsdpV8TNSVCvg/CmKon3dBJgZ 4kIG8H1pMvVf8lilAf+qoQAWee1eKvpyJIQC8F0954XZFd3B0C46Zl18OgtdWzWM9oyK IXTqHPqMci9mYelisVjD1+ZtZPcpJKLh33mcbzMFOQbktLuzTiONHziWO3Up4aXtp1AC 3Byw== 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=W/C8b4DiJjeWvwRZe6aiqqr/kgTHhvfN/2RtmH0QL9SRkw++Sw2l98+4je3I59EZYm SWuDQ7i88zeBNNMpxUsxC6FJ6c7JfW0sxWmfIasphEkPVHl04et7i4Sdry0oGqI5eUkx +ldT1ngffZYPAEQGZdQLYlpsb6wO9VxUdqBDeOGuaghACptBbNXG8O8HNHmgDyfMd4Ho 3n0gWjykFdPpxut12R8X1urgpPeKUnW6UxL+S0gVp/gej2qz7fShIStpJyV1Jl68sZ1O CPNXw4oofx3wFeCW6Jz0FJkcHads6u2A7ipPam0nVYvDACErS/X1cJktLpO2n0V5eg5A 8rFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fzeFctH+; 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 j29-20020a633c1d000000b0050bd8dd1b5asi6487618pga.43.2023.05.23.07.09.38; Tue, 23 May 2023 07:09:51 -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=fzeFctH+; 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 S237268AbjEWOI0 (ORCPT + 99 others); Tue, 23 May 2023 10:08:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237192AbjEWOHZ (ORCPT ); Tue, 23 May 2023 10:07:25 -0400 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FFCBE58 for ; Tue, 23 May 2023 07:06:58 -0700 (PDT) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-4f1411e8111so8183465e87.1 for ; Tue, 23 May 2023 07:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850756; x=1687442756; 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=fzeFctH+wspWO49TnIPElwVca6DLjWLQwYxkWmX/Iy1UmULCTqkJMiM0qA8MXZ/96E Dtzvq/Nx1wNuktXBNrc7rb+BddK3eOpeRmaIEM+nRheV+Bmapv0H53LUZOJqTGNjV3bP zWDe7Noi+kppHqm/7HwhlAvjZPM0NdHk76Cr/uat1pZJDm0mz4HCGb4uRkPCQwNqiDYu JW0aKwNZrkes49GmhKEiOFOCDjns4pmVJcNZeTw7Y/+UpIuTv7ewPTXRg18mgR0J2Qx3 I7hqjEkHLpYieL/NE9aRDNlp28sfW4e7RnZIt0ZnBTCL9b1MxLrV2Xk0Mrq3ZmPvUUoO qQfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850756; x=1687442756; 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=KzMTOO8vM3hpc7gtS63HQFiFvK/DQ6aVqbOiGC4iv8btVfVTh51szncPPnDDeerl/d QFX/RY5OsdyeTSEUHCIX9G5+3wce+7IuYh6Wpj1Ll1UK0d4gRGg0ZX0H3EVlNRrY83RL Jd8XeNFpJBdo/5cBAyDaxjysqoKIs6VNpzAdi18Oyx7oIEWuL/BMk1eqZymZ/QKOw8Wu cBDws/VTiTGV2XGjql3SnbAsTylYDL3BmSsWH2bDjFb5FtslAlYYozNEzNzKzZOFFJJE DHXnkzX/Hn2r/2nJDD8e4luy4TdIyFkuwmy636leGZnndLxUZmwUi7/bwexTqAIi6M9h 1r5Q== X-Gm-Message-State: AC+VfDxXJAArR0JlWWc+M8AQQN+K25mHZ3dvh2pSwT5mfXfvCghOmmEo MF6oMJcElAOy78TmMT3CH2dDAw== X-Received: by 2002:ac2:44c8:0:b0:4f1:b3ab:cd61 with SMTP id d8-20020ac244c8000000b004f1b3abcd61mr3958413lfm.61.1684850756424; Tue, 23 May 2023 07:05:56 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:56 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:35 +0200 Subject: [PATCH v3 11/12] arm64: memory: Make virt_to_pfn() a static inline MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v3-11-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=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?1766694313110819703?= X-GMAIL-MSGID: =?utf-8?q?1766694313110819703?= 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 Tue May 23 14:05: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: 98012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2171649vqo; Tue, 23 May 2023 07:09:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ZDjVfpe7vWsBuiL9Ope93QFdxL3Etlh/C7YTE0dmqARawPJc61ThKHXtzkDY4Oqnh0DS2 X-Received: by 2002:a17:903:1205:b0:1ab:224b:d1fc with SMTP id l5-20020a170903120500b001ab224bd1fcmr14817668plh.41.1684850998722; Tue, 23 May 2023 07:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684850998; cv=none; d=google.com; s=arc-20160816; b=YIQoYJq2MmJPHycTFqDUrpH3FTaI1ujCTsiOyllERjHZYBc+bTI8nuByWqrEVq55wi KvkisuKlF+I9hiQuUetn07jTFcBTcOyBX7suRfCIE3vMKHZwTSYqU8yLaRSNBTbpKT9M n/S9i0SozHba8vU1fQy4959BN3KcVehmkWroxA1FIdMR7b67wew3nUbpy/YduwZDG2dJ eOmtYRw1qZ6ecEgX5RysjwV25EUkIZpwzLN1UpBAFaOwV3hB5geLrKJphhnMsajXboGn HxYpeXud7+WXJdauSuvWAsb+5R9YJYmIn3tr6rSKrtcsyi8EzbKlEc4sF2HYlaivzv+P siEw== 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=NgxdEsLSKklYSR8YprSpV8unJguD6EPGzLlKdjTuU+t3R2DEjoStjWq2Jy0PIFLZ/v DdYy1QCVvlgSLoWOJTrZdK5urDkELIHL51J79KDbKNs3avdkpCHWb5KS3FlJbLSMT5c+ l/rc8w/hkhf9w6VP6typFl85TVufVoCoOr3DWxseTb0U0nq1Q+q75EgC6bcNUlzsVDwr lbTA7kvSQHW5CJCvRxANKbB7jS+vq+65LTdhQoBmj5CHkqse/dKn6PRnsVHxBUaeLsoc y4Jkb3tz/3c0Lq8VFEmuwlQLorH+3fPF6Dmj3Tcud6+sdWvY4dteLE0o3ra7yT6Pu8U9 Gk0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jUf/xLDR"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a63ae0b000000b005098590f1edsi2041170pgf.757.2023.05.23.07.09.45; Tue, 23 May 2023 07:09:58 -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="jUf/xLDR"; 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 S237276AbjEWOIu (ORCPT + 99 others); Tue, 23 May 2023 10:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237198AbjEWOHZ (ORCPT ); Tue, 23 May 2023 10:07:25 -0400 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72861E65 for ; Tue, 23 May 2023 07:06:59 -0700 (PDT) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-4f3ba703b67so3630202e87.1 for ; Tue, 23 May 2023 07:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684850757; x=1687442757; 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=jUf/xLDRQeFWkvJxlE7DG8k/g9Kaq7kmU356lCnEcTPt7HRH9mF3yYSSKYy3AjdmMb PNJoXmxSr7xwdkekuAGpi31DkWD2cnBbwWlnwniyL4NTEq8RWhSGAm7lNJ56nBi7lYUz E0oj4UfEebq9LsjfphS/f/Zp9PIP/3JLeguL6Pe8UJJWKt8dQFmYwMpDNb6cjxHzVKmh 7fNHGbzoBbZ9dqlk8I/Mn0uG+EBCCvXw2LyD39z4Mh8nQI8yIzYFz+e/GOxUL2Yxfk6e uOTevK/Gu1QvFq1s1cju6TkuunqswAEzPfBN+ZKrRoq9EFkn/phqnUa5oOger2h3AlhE 3yJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684850757; x=1687442757; 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=ZRaAS3rWNcubpKcRUazk7YZPMjaV/uwMw4pThm17XrS2z+/3zoDV/MEH5uoKMtdcKr UP0AST4vJQVDDMRAz/3brKtgDYIb0dR73ClVV1JuT0E0BjQfx3dQ0odgljkX/J97Q3CN djw3sUWy3pwepmOCGHX5TQGKDTR1ZnBc/28vqJHqc42QfJcI47G5fvHc3tVe2yCOthLx ip+BQ29JX71hfmeP678sydDuNFpkqpaGfobAi4hWLMy4vGtL6oJaHxvSgNY6chk+VKOf U9KV53K7IwY1Cd2v2wlLyMilm6nYwAka0VIyhTdAdjfGH+GJ4AverDR9BJSMSXA/05My vKYg== X-Gm-Message-State: AC+VfDzcY2vVZepJ3BqZs3MOy7c3vU0wXsnegjFjOlg5PtB7zcrIHKOv bi/h5n5JMoeVVJleU44QFjDkUg== X-Received: by 2002:ac2:43ba:0:b0:4f4:aea9:2a2d with SMTP id t26-20020ac243ba000000b004f4aea92a2dmr2010283lfl.43.1684850757405; Tue, 23 May 2023 07:05:57 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h28-20020ac2597c000000b004e9bf853c27sm1346562lfp.70.2023.05.23.07.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:05:57 -0700 (PDT) From: Linus Walleij Date: Tue, 23 May 2023 16:05:36 +0200 Subject: [PATCH v3 12/12] m68k/mm: Make pfn accessors static inlines MIME-Version: 1.0 Message-Id: <20230503-virt-to-pfn-v6-4-rc1-v3-12-a16c19c03583@linaro.org> References: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> In-Reply-To: <20230503-virt-to-pfn-v6-4-rc1-v3-0-a16c19c03583@linaro.org> To: Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Greg Ungerer Cc: linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-snps-arc@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=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?1766694320872543114?= X-GMAIL-MSGID: =?utf-8?q?1766694320872543114?= 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 Reviewed-by: Geert Uytterhoeven Acked-by: Geert Uytterhoeven --- 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))