From patchwork Wed May 24 12:53:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13253950 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9B67C77B7A for ; Wed, 24 May 2023 12:54:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Kq1wxs8RAmP1WUjhPElFBjn8PnV7BHi4yssGptverP4=; b=H05dvjsTM44Lsi oGQi7dUVdqlagNwyKHatWwQTwMhkGyAzdinjFxarusymp06h8xqJvzoQvWI+L52bkrkHEWtUtCy+t N1DA8M/4ADvgAnUMd7F2y+zxEer2BD6BGePz5Myx4S8UTGH77h8jHck06Crs0K6mu6yVoL4kdMURR QiQyQLEN4/NeCxiewDNWtTJWeg3Jdy/+Rml/tjEsoIwbeomm9y60p2opVquchU64NjJcRduUeFfb6 Eqgtybw+sO96PCJMNvC6SoFcQ1sAKheyMZgdcwDR7mzGsgy8ie/YGhWFd8WZDDlVWgmYwwZuAX2M5 lEyt5M4wCcBU8n3p6ofQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1o09-00DUay-0y; Wed, 24 May 2023 12:54:01 +0000 Received: from mail-yw1-x112d.google.com ([2607:f8b0:4864:20::112d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1o05-00DUZf-1O for linux-arm-kernel@lists.infradead.org; Wed, 24 May 2023 12:53:59 +0000 Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-56186035b61so12918587b3.3 for ; Wed, 24 May 2023 05:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684932834; x=1687524834; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=6k7CwLpjQ+oPFx1tTum0+p01nKq3VVI7v5cgsSAfjNo=; b=uWMJa+LDM2gRpRToobsw29vCAykfT7ArF/5bmR543aY2MOzA64WG8PyYDRrSCbv5Ue Dfvzo5iY0u8OwJh/Usa6lm7EdLSChTnGrEz2jzp6BvPcJkPqFwsqs3Qsp6m8MaB7rsVe Q30nnGF4Q1X8bmtQY4DFlFDiPOWhATsr6lDlVzzEXe3o1eHyS2CHxzaE0yFSt2V70z+u WJ3FVPyWSm6TsN+Z2cxQZKVi782dXQHli55PJmrocqVNgIsBmSnATCMvQI5VdFkx01cp i42stvfX2iLo4xriYKEHP6QY07irj7VIOBgpyAqhKU4jfqvS3UKGZLvMfLg2TeD5ZZyf GMiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684932834; x=1687524834; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=6k7CwLpjQ+oPFx1tTum0+p01nKq3VVI7v5cgsSAfjNo=; b=InzLJCXqySlDhkTiiTS72O5yao3wjpZlNa+qZ4CViMQ0ftbr3JsFF8ZuwO/CANYpYr tmZJZZJMlTb7JyQilWsumqYrtPdnQaeYaSObAuAi/FeB2qQo/r+ozOrbYgmpl+N/PaAK LMrBUVDGejDbgbLE5S1+GfqbxxJi82DTAh69uxyC1eRAGAv4+AsnYLiwKa3RhoIf++E2 ahjdCQC4ymnxU8UA38WWDb/8i4ikHEd6Dz8Rmkd2s5jmpQGuPx3HaumKioBBtoN5OqlU vIN0bMUrpXltufOXHWyRTOjncq6J2JzsgyAo56+RKdqGRENAHKnddnUHNAbT9NqbOxf8 nHkQ== X-Gm-Message-State: AC+VfDwFVrbTHZ89y9naXI//fE7Eomf/7kGqL7PHarWugluoE1DTRHuu nimQ+ctPwC3IcuVmge5ArjEkdg2rFV75Ppb6iMqgRA== X-Google-Smtp-Source: ACHHUZ6z6oKt9Hy3F5Ix9UnojbF6veGj5yOEPPCsEXLq14Lr8kcj2dPHJnCRCMemy7klqa4CHkog7mF+U8MQxAM2Elw= X-Received: by 2002:a0d:f6c3:0:b0:55a:18e2:cdf9 with SMTP id g186-20020a0df6c3000000b0055a18e2cdf9mr14705166ywf.49.1684932834217; Wed, 24 May 2023 05:53:54 -0700 (PDT) MIME-Version: 1.0 From: Linus Walleij Date: Wed, 24 May 2023 14:53:43 +0200 Message-ID: Subject: [GIT PULL] Convert virt_to_phys() into static inlines To: Arnd Bergmann Cc: Linux-Arch , Andrew Morton , Geert Uytterhoeven , Vineet Gupta , Catalin Marinas , Will Deacon , Russell King , Greg Ungerer , linux-mm@vger.kernel.org, Linux ARM , linux-m68k X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230524_055357_492612_28238B73 X-CRM114-Status: GOOD ( 17.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Arnd, I am pretty confident of this branch now, so this needs some rotation in linux-next for the v6.5 kernel. No errors from zeroday! So please pull it into the arch tree for v6.5. If it feels shaky anyway I can set up a separate branch to pull it into linux-next. I heard you have a way to shake out unknown issues with stuff like this using randconfigs... Yours, Linus Walleij The following changes since commit ac9a78681b921877518763ba0e89202254349d1b: Linux 6.4-rc1 (2023-05-07 13:34:35 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator.git tags/virt-to-pfn-for-arch-v6.5 for you to fetch changes up to 8968d8d2bb4f81035138966a18259859fb6bc1ee: m68k/mm: Make pfn accessors static inlines (2023-05-24 14:41:55 +0200) ---------------------------------------------------------------- This is an attempt to harden the typing on virt_to_pfn() and pfn_to_virt(). 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 with pfn_to_virt(). The problem with this inconsistent typing was pointed out by Russell King: https://lore.kernel.org/linux-arm-kernel/YoJDKJXc0MJ2QZTb@shell.armlinux.org.uk/ And confirmed by Andrew Morton: https://lore.kernel.org/linux-mm/20220701160004.2ffff4e5ab59a55499f4c736@linux-foundation.org/ So the recognition of the problem is widespread. These platforms have been chosen as initial conversion targets: - ARM - ARM64/Aarch64 - asm-generic (including for example x86) - m68k The idea is that if this goes in, it will block further misuse of the function signatures due to the large compile coverage, and then I can go in and fix the remaining architectures on a one-by-one basis. Some of the patches have been circulated before but were not picked up by subsystem maintainers, so now the arch tree is target for this series. It has passed zeroday builds after a lot of iterations in my personal tree, but there could be some randconfig outliers. New added or deeply hidden problems appear all the time so some minor fallout can be expected. ---------------------------------------------------------------- Linus Walleij (13): fs/proc/kcore.c: Pass a pointer to virt_addr_valid() m68k: Pass a pointer to virt_to_pfn() virt_to_page() ARC: init: Pass a pointer to virt_to_pfn() in init riscv: mm: init: Pass a pointer to virt_to_page() cifs: Pass a pointer to virt_to_page() cifs: Pass a pointer to virt_to_page() in cifsglob netfs: Pass a pointer to virt_to_page() arm64: vdso: Pass (void *) to virt_to_page() xen/netback: Pass (void *) to virt_to_page() asm-generic/page.h: Make pfn accessors static inlines ARM: mm: Make virt_to_pfn() a static inline arm64: memory: Make virt_to_pfn() a static inline m68k/mm: Make pfn accessors static inlines arch/arc/mm/init.c | 2 +- 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 +- arch/arm64/include/asm/memory.h | 9 ++++++++- arch/arm64/kernel/vdso.c | 2 +- arch/m68k/include/asm/mcf_pgtable.h | 3 +-- arch/m68k/include/asm/page_mm.h | 11 +++++++++-- arch/m68k/include/asm/page_no.h | 11 +++++++++-- 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 +- arch/riscv/mm/init.c | 4 ++-- drivers/memory/ti-emif-sram-pm.S | 2 +- drivers/net/xen-netback/netback.c | 2 +- fs/cifs/cifsglob.h | 2 +- fs/cifs/smbdirect.c | 2 +- fs/netfs/iterator.c | 2 +- fs/proc/kcore.c | 2 +- include/asm-generic/page.h | 12 ++++++++++-- 65 files changed, 109 insertions(+), 81 deletions(-)