summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-02-02Merge branch 'starfive-5.15-dubhe-pause-gmac' into 'starfive-5.15-dubhe'REL_DUBHE_JAN2023starfive-5.15-dubheleyfoon.tan4-7/+18
Dubhe Jan 2023 release MR See merge request starfive-tech/linux!85
2023-02-02net: stmmac: Set MAC's flow control register to reflect current settingsGoh, Wei Sheng2-2/+12
[ Upstream commit cc3d2b5fc0d6f8ad8a52da5ea679e5c2ec2adbd4 ] Currently, pause frame register GMAC_RX_FLOW_CTRL_RFE is not updated correctly when 'ethtool -A <IFACE> autoneg off rx off tx off' command is issued. This fix ensures the flow control change is reflected directly in the GMAC_RX_FLOW_CTRL_RFE register. Fixes: 46f69ded988d ("net: stmmac: Use resolved link config in mac_link_up()") Cc: <stable@vger.kernel.org> # 5.10.x Signed-off-by: Goh, Wei Sheng <wei.sheng.goh@intel.com> Signed-off-by: Noor Azura Ahmad Tarmizi <noor.azura.ahmad.tarmizi@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2023-02-02net: phylink: Assign link config in phylink_create()Genevieve Chan1-4/+4
This patch parse the following config to a struct phylink: * speed = 10Mbps * duplex = full * pause = RX on, TX on Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
2023-02-02riscv: dts: dubhe: Set ip in boot args and enable gmacGenevieve Chan1-1/+2
Set ip at kernel bootargs with the following parameters: * Client IP Address: autoconfg using DHCP * Server IP Address: not defined * Gateway IP Address: 192.168.152.1 * Netmask: 255.255.255.0 * Network device to use: eth0 * Autoconfiguration: dhcp Enable gmac driver. Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
2022-12-30Merge branch 'starfive-5.15-dubhe-autonego-off' into 'starfive-5.15-dubhe'leyfoon.tan1-0/+2
net: phy: marvell: Set autonegotiation to OFF by default upon init See merge request starfive-tech/linux!82
2022-12-30net: phy: marvell: Set autonegotiation to OFF by default upon initGenevieve Chan1-0/+2
This patch set AUTONEG_DISABLE during init to disable autonegotiation by default. Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
2022-12-21riscv: mm: notify remote harts about mmu cache updatesSergey Matyukevich5-18/+42
[ Upstream commit 4bd1d80efb5af640f99157f39b50fb11326ce641 ] Current implementation of update_mmu_cache function performs local TLB flush. It does not take into account ASID information. Besides, it does not take into account other harts currently running the same mm context or possible migration of the running context to other harts. Meanwhile TLB flush is not performed for every context switch if ASID support is enabled. Patch [1] proposed to add ASID support to update_mmu_cache to avoid flushing local TLB entirely. This patch takes into account other harts currently running the same mm context as well as possible migration of this context to other harts. For this purpose the approach from flush_icache_mm is reused. Remote harts currently running the same mm context are informed via SBI calls that they need to flush their local TLBs. All the other harts are marked as needing a deferred TLB flush when this mm context runs on them. [1] https://lore.kernel.org/linux-riscv/20220821013926.8968-1-tjytimi@163.com/ Signed-off-by: Sergey Matyukevich <sergey.matyukevich@syntacore.com> Fixes: 65d4b9c53017 ("RISC-V: Implement ASID allocator") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/linux-riscv/20220829205219.283543-1-geomatsi@gmail.com/#t Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-12-16Merge branch 'starfive-5.15-dubhe-no-gmac' into 'starfive-5.15-dubhe'leyfoon.tan2-2/+3
riscv: dts: dubhe: Disable GMAC and remove NFS See merge request starfive-tech/linux!80
2022-12-15riscv: configs: Dubhe: Add configs for initramfs sourceGenevieve Chan1-0/+2
The Dubhe ace_20221130 bitfile does not support GMAC. This patch re-enabled booting kernel through initramfs source "rootfs.cpio" Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
2022-12-15riscv: dts: dubhe: Disable GMAC and remove NFSGenevieve Chan1-2/+1
The ace_20221130 version does not have GMAC support. Disable GMAC driver and remove NFS in the bootargs. Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
2022-11-25Merge branch 'starfive-5.15-dubhe-non-vector' into 'starfive-5.15-dubhe'leyfoon.tan1-1/+0
riscv: configs: Dubhe: Remove vector configs See merge request starfive-tech/linux!78
2022-11-25riscv: configs: Dubhe: Remove vector configsGenevieve Chan1-1/+0
This patch removes the CONFIG_VECTOR=y for dubhe nov 2022 release Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
2022-11-07Merge branch 'leyfoon/starfive-5.15-dubhe-gmac-dma-v3' into ↵leyfoon.tan16-51/+598
'starfive-5.15-dubhe' net: stmmac: Add StarFive dwmac support See merge request starfive-tech/linux!74
2022-11-03riscv: dts: dubhe: Enable NFSGenevieve Chan1-1/+1
This patch adds NFS configuration in the bootargs. The bootargs for NFS is set with the following parameters: * Client IP Address: 192.168.152.100 * Server IP Address: 192.168.153.221 * Gateway IP Address: 192.168.152.1 * Netmask: 255.255.255.0 * Network device to use: eth0 * Autoconfiguration: off * NFS root dir: /home/nfsroot Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
2022-11-03riscv: dts: dubhe: Fix ethernet max-speed to 10Mb/sLey Foon Tan1-0/+11
Fix ethernet max-speed to 10Mb/s for FPGA. Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
2022-11-03net: pcs: pcs-xpcs: use mii_bmcr_encode_fixed()Russell King (Oracle)1-17/+1
[ upstream commit 449b7a15200a15af8affefdd80ac567c40898dce ] Use the newly introduced mii_bmcr_encode_fixed() for the xpcs driver. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-11-03net: phy: marvell: use mii_bmcr_encode_fixed()Russell King (Oracle)1-8/+2
[ upstream commit e62dbaff4bc2540393cfc31a7438ed833da7c43c ] Make use of the newly introduced mii_bmcr_encode_fixed() to get the BMCR value when setting loopback mode for the 88e1510. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-11-03net: phy: use mii_bmcr_encode_fixed()Russell King (Oracle)1-15/+3
[ upstream commit f28a602b285eab953879688f030f53b966a63f50 ] phylib can make use of the newly introduced mii_bmcr_encode_fixed() macro, so let's convert it over. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-11-03net: mii: add mii_bmcr_encode_fixed()Russell King (Oracle)1-0/+35
[ upstream commit bdb6cfe7512f7a214815a3092f0be50963dcacbc ] Add a function to encode a fixed speed/duplex to a BMCR value. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-11-03net: phy: marvell: Add errata section 5.1 for Alaska PHYLeszek Polak1-0/+37
[ upstream commit 65a9dedc11d615d8f104a48d38b4fa226967b4ed ] As per Errata Section 5.1, if EEE is intended to be used, some register writes must be done once after every hardware reset. This patch now adds the necessary register writes as listed in the Marvell errata. Without this fix we experience ethernet problems on some of our boards equipped with a new version of this ethernet PHY (different supplier). The fix applies to Marvell Alaska 88E1510/88E1518/88E1512/88E1514 Rev. A0. Signed-off-by: Leszek Polak <lpolak@arri.de> Signed-off-by: Stefan Roese <sr@denx.de> Cc: Marek Behún <kabel@kernel.org> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Heiner Kallweit <hkallweit1@gmail.com> Cc: Russell King <linux@armlinux.org.uk> Cc: David S. Miller <davem@davemloft.net> Reviewed-by: Marek Behún <kabel@kernel.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/20220516070859.549170-1-sr@denx.de Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2022-11-03net: phy: marvell: Fix RGMII Tx/Rx delays setting in 88e1121-compatible PHYsPavel Parkhomenko1-4/+6
[ upstream commit fe4f57bf7b585dca58f1496c4e2481ecbae1812 ] It is mandatory for a software to issue a reset upon modifying RGMII Receive Timing Control and RGMII Transmit Timing Control bit fields of MAC Specific Control register 2 (page 2, register 21) otherwise the changes won't be perceived by the PHY (the same is applicable for a lot of other registers). Not setting the RGMII delays on the platforms that imply it' being done on the PHY side will consequently cause the traffic loss. We discovered that the denoted soft-reset is missing in the m88e1121_config_aneg() method for the case if the RGMII delays are modified but the MDIx polarity isn't changed or the auto-negotiation is left enabled, thus causing the traffic loss on our platform with Marvell Alaska 88E1510 installed. Let's fix that by issuing the soft-reset if the delays have been actually set in the m88e1121_config_aneg_rgmii_delays() method. Cc: stable@vger.kernel.org Fixes: d6ab93364734 ("net: phy: marvell: Avoid unnecessary soft reset") Signed-off-by: Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Serge Semin <fancer.lancer@gmail.com> Link: https://lore.kernel.org/r/20220205203932.26899-1-Pavel.Parkhomenko@baikalelectronics.ru Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-11-03net: phy: marvell: add Marvell specific PHY loopbackMohammad Athari Bin Ismail1-1/+55
[ upstream commit 020a45aff1190c32b1087cd75b57fbf6bff46ea6 ] Existing genphy_loopback() is not applicable for Marvell PHY. Besides configuring bit-6 and bit-13 in Page 0 Register 0 (Copper Control Register), it is also required to configure same bits in Page 2 Register 21 (MAC Specific Control Register 2) according to speed of the loopback is operating. Tested working on Marvell88E1510 PHY for all speeds (1000/100/10Mbps). FIXME: Based on trial and error test, it seem 1G need to have delay between soft reset and loopback enablement. Fixes: 014068dcb5b1 ("net: phy: genphy_loopback: add link speed configuration") Cc: <stable@vger.kernel.org> # 5.15.x Signed-off-by: Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-11-03net: Revert: "net: stmmac: use GFP_DMA32"Ley Foon Tan1-8/+4
This reverts commit 4a75f8889870a8b461c4f0afb6588a3729017490. GMAC supports 64-bit DMA addressing in Dubhe, revert this commit. Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
2022-11-03riscv: starfive: Add DMA non-coherent supportLey Foon Tan2-0/+58
Enable arch_*dma* implementation. Signed-off-by: Ley Foon Tan <leyfoon.tan@linux.starfivetech.com>
2022-11-03riscv: sbi: Add support for sbi_cache_flush and sbi_cache_invalidateGenevieve Chan2-0/+37
This patch introduces the support for GMAC drivers to perform flush and invalidate of L2 Cache: * sbi_cache_invalidate(): Invalidate L2 cache for data passed from GMAC to CPU * sbi_cache_flush(): Flush L2 cache for data passed from CPU to GMAC Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
2022-11-03riscv: configs: Dubhe: Add configs for GMAC driver in StarFive DubheLey Foon Tan1-5/+32
This patch add configs for StarFive Dubhe GMAC driver Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
2022-11-03riscv: dts: starfive: dubhe: Add GMAC DT nodeLey Foon Tan2-0/+58
This patch adds GMAC device tree node. Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
2022-11-03dt-bindings: net: Add bindings for StarFive dwmactanchunhau1-0/+104
2022-11-03net: stmmac: Add StarFive dwmac supportLey Foon Tan3-0/+162
Add StarFive dwmac support. Signed-off-by: Tan Chun Hau <chunhau.tan@starfivetech.com> Signed-off-by: Ley Foon Tan <leyfoon.tan@linux.starfivetech.com>
2022-10-28RISC-V: Re-enable counter access from userspacePalmer Dabbelt1-2/+5
[ upstream commit 5a5294fbe0200d1327f0e089135dad77b45aa2ee ] These counters were part of the ISA when we froze the uABI, removing them breaks userspace. Link: https://lore.kernel.org/all/YxEhC%2FmDW1lFt36J@aurel32.net/ Fixes: e9991434596f ("RISC-V: Add perf platform driver based on SBI PMU extension") Tested-by: Conor Dooley <conor.dooley@microchip.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20220928131807.30386-1-palmer@rivosinc.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-10-27etherdevice: Adjust ether_addr* prototypes to silence -Wstringop-overeadKees Cook1-3/+2
[ Upstream commit 2618a0dae09ef37728dab89ff60418cbe25ae6bd] With GCC 12, -Wstringop-overread was warning about an implicit cast from char[6] to char[8]. However, the extra 2 bytes are always thrown away, alignment doesn't matter, and the risk of hitting the edge of unallocated memory has been accepted, so this prototype can just be converted to a regular char *. Silences: net/core/dev.c: In function ‘bpf_prog_run_generic_xdp’: net/core/dev.c:4618:21: warning: ‘ether_addr_equal_64bits’ reading 8 bytes from a region of size 6 [-Wstringop-overread] 4618 | orig_host = ether_addr_equal_64bits(eth->h_dest, > skb->dev->dev_addr); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/core/dev.c:4618:21: note: referencing argument 1 of type ‘const u8[8]’ {aka ‘const unsigned char[8]’} net/core/dev.c:4618:21: note: referencing argument 2 of type ‘const u8[8]’ {aka ‘const unsigned char[8]’} In file included from net/core/dev.c:91: include/linux/etherdevice.h:375:20: note: in a call to function ‘ether_addr_equal_64bits’ 375 | static inline bool ether_addr_equal_64bits(const u8 addr1[6+2], | ^~~~~~~~~~~~~~~~~~~~~~~ Reported-by: Marc Kleine-Budde <mkl@pengutronix.de> Tested-by: Marc Kleine-Budde <mkl@pengutronix.de> Link: https://lore.kernel.org/netdev/20220212090811.uuzk6d76agw2vv73@pengutronix.de Cc: Jakub Kicinski <kuba@kernel.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-10-27mm: page_alloc: fix building error on -Werror=array-compareXiongwei Song1-1/+1
[ Upstream commit ca831f29f8f25c97182e726429b38c0802200c8f ] Arthur Marsh reported we would hit the error below when building kernel with gcc-12: CC mm/page_alloc.o mm/page_alloc.c: In function `mem_init_print_info': mm/page_alloc.c:8173:27: error: comparison between two arrays [-Werror=array-compare] 8173 | if (start <= pos && pos < end && size > adj) \ | In C++20, the comparision between arrays should be warned. Link: https://lkml.kernel.org/r/20211125130928.32465-1-sxwjean@me.com Signed-off-by: Xiongwei Song <sxwjean@gmail.com> Reported-by: Arthur Marsh <arthur.marsh@internode.on.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-10-27riscv: fix build with binutils 2.38Aurelien Jarno1-0/+6
[ upstream commit 6df2a016c0c8a3d0933ef33dd192ea6606b115e3 ] From version 2.38, binutils default to ISA spec version 20191213. This means that the csr read/write (csrr*/csrw*) instructions and fence.i instruction has separated from the `I` extension, become two standalone extensions: Zicsr and Zifencei. As the kernel uses those instruction, this causes the following build failure: CC arch/riscv/kernel/vdso/vgettimeofday.o <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h: Assembler messages: <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' The fix is to specify those extensions explicitely in -march. However as older binutils version do not support this, we first need to detect that. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Tested-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-10-27Revert "riscv: Separate patch for cflags and aflags"Ley Foon Tan1-13/+7
This reverts commit bbe28549b2be81cf5da4f541f756cea38b721dfb. Latest version patch series drop this patch. Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
2022-10-27riscv: starfive: dubhe: Enable CONFIG_HZ_10Ley Foon Tan1-0/+1
Dubhe FPGA platform is running at lower frequency, changes to use 10 Hz. Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
2022-10-27kernel: Fix 'mult' overflow if using 10 HzLey Foon Tan5-6/+7
Change 'mult' to 64-bit (u64) to fix overflow warning if using 10 Hz jiffies. ./include/vdso/jiffies.h:9:19: warning: unsigned conversion from 'long int' to 'unsigned int' changes value from '6400000000' to '2105032704' [-Woverflow] 9 | #define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ) | ^ kernel/time/jiffies.c:38:35: note: in expansion of macro 'TICK_NSEC' 38 | .mult = TICK_NSEC << JIFFIES_SHIFT, /* details above */ | ^~~~~~~~~ Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
2022-10-27kernel: Add 10 Hz supportLey Foon Tan2-1/+8
Add 10 Hz support for FPGA system that run on lower frequency. Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
2022-09-01Merge branch 'starfive-5.15-dubhe-perf-report-record-annotate' into ↵leyfoon.tan3-0/+42
'starfive-5.15-dubhe' Starfive 5.15 dubhe perf report record annotate See merge request starfive-tech/linux!57
2022-09-01riscv: defconfig: Add defconfigs for perf annotateGenevieve Chan1-0/+3
Include configs for perf annotate Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
2022-09-01perf annotate: Add riscv64 supportWilliam Cohen2-0/+39
commit c5e4d5e99162ba8025d58a3af7ad103f155d2df7 upstream This patch adds basic arch initialization and instruction associate support for the riscv64 CPU architecture. Example output: $ perf annotate --stdio2 Samples: 122K of event 'task-clock:u', 4000 Hz, Event count (approx.): 30637250000, [percent: local period] strcmp() /usr/lib64/libc-2.32.so Percent Disassembly of section .text: 0000000000069a30 <strcmp>: __GI_strcmp(): const unsigned char *s2 = (const unsigned char *) p2; unsigned char c1, c2; do { c1 = (unsigned char) *s1++; 37.30 lbu a5,0(a0) c2 = (unsigned char) *s2++; 1.23 addi a1,a1,1 c1 = (unsigned char) *s1++; 18.68 addi a0,a0,1 c2 = (unsigned char) *s2++; 1.37 lbu a4,-1(a1) if (c1 == '\0') 18.71 ↓ beqz a5,18 return c1 - c2; } Signed-off-by: William Cohen <wcohen@redhat.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: linux-riscv@lists.infradead.org Link: http://lore.kernel.org/lkml/20210927005115.610264-1-wcohen@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Genevieve Chan <genevieve.chan@starfivetech.com>
2022-09-01Merge branch 'starfive-5.15-dubhe' into 'starfive-5.15-dubhe'leyfoon.tan22-218/+812
Starfive 5.15 dubhe SV48 See merge request starfive-tech/linux!58
2022-08-23riscv: Improve virtual kernel memory layout dumpAlexandre Ghiti1-17/+54
Upstream commit 26b8f69edda85a7942fa580360690c2d5c74f765 With the arrival of sv48 and its large address space, it would be cumbersome to statically define the unit size to use to print the different portions of the virtual memory layout: instead, determine it dynamically. Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-08-23riscv: Initialize thread pointer before calling C functionsAlexandre Ghiti1-0/+1
Upstream commit 35d33c76d68dfacc330a8eb477b51cc647c5a847 Because of the stack canary feature that reads from the current task structure the stack canary value, the thread pointer register "tp" must be set before calling any C function from head.S: by chance, setup_vm and all the functions that it calls does not seem to be part of the functions where the canary check is done, but in the following commits, some functions will. Fixes: f2c9699f65557a31 ("riscv: Add STACKPROTECTOR supported") Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-08-23Documentation: riscv: Add sv48 description to VM layoutAlexandre Ghiti1-0/+36
Upstream commit 9d19f2b5256ef6cdd4947b48fab4032d0060e916 sv48 was just introduced, so add its virtual memory layout to the documentation. Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-08-23riscv: Explicit comment about user virtual address space sizeAlexandre Ghiti1-0/+9
Upstream commit c774de22c430733487f70d755067d9ea55dbe6de Define precisely the size of the user accessible virtual space size for sv32/39/48 mmu types and explain why the whole virtual address space is split into 2 equal chunks between kernel and user space. Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-08-23riscv: Use pgtable_l4_enabled to output mmu_type in cpuinfoAlexandre Ghiti1-11/+12
Upstream commit 73c7c8f68e7266bd558227bd9c598cb90b1673cc Now that the mmu type is determined at runtime using SATP characteristic, use the global variable pgtable_l4_enabled to output mmu type of the processor through /proc/cpuinfo instead of relying on device tree infos. Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-08-23riscv: Implement sv48 supportAlexandre Ghiti13-44/+514
Upstream commit e8a62cc26ddf53a3c6ba2a8d33036cf7b84f3923 By adding a new 4th level of page table, give the possibility to 64bit kernel to address 2^48 bytes of virtual address: in practice, that offers 128TB of virtual address space to userspace and allows up to 64TB of physical memory. If the underlying hardware does not support sv48, we will automatically fallback to a standard 3-level page table by folding the new PUD level into PGDIR level. In order to detect HW capabilities at runtime, we use SATP feature that ignores writes with an unsupported mode. Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-08-23asm-generic: Prepare for riscv use of pud_alloc_one and pud_freeAlexandre Ghiti1-6/+18
Upstream commit 60639f74c2f4fcc3ffa2ac0b120eaa874ccc713f In the following commits, riscv will almost use the generic versions of pud_alloc_one and pud_free but an additional check is required since those functions are only relevant when using at least a 4-level page table, which will be determined at runtime on riscv. So move the content of those functions into other functions that riscv can use without duplicating code. Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-08-23riscv: Allow to dynamically define VA_BITSAlexandre Ghiti4-14/+14
Upstream commit 3270bfdb9e4a01bb15d018612a6354c1837b5f97 With 4-level page table folding at runtime, we don't know at compile time the size of the virtual address space so we must set VA_BITS dynamically so that sparsemem reserves the right amount of memory for struct pages. Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-08-23riscv: Introduce functions to switch pt_opsAlexandre Ghiti1-23/+51
Upstream commit 840125a97abc7e676d839adc2743e8f703a156b3 This simply gathers the different pt_ops initialization in functions where a comment was added to explain why the page table operations must be changed along the boot process. Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>