summaryrefslogtreecommitdiff
path: root/arch
AgeCommit message (Collapse)AuthorFilesLines
2026-05-05riscv: dts: microchip: add gpio line names on beaglev-fireConor Dooley1-0/+5
GPIO controller 2 has the gpio-line-names property, but the two other controllers do not. Add the property for these controllers too. Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
2026-05-05riscv: dts: microchip: add adc interrupt on beaglev-fireConor Dooley1-0/+2
The mcp3464r on the beaglev-fire has its interrupt wired up, but not present in the devicetree. Add it. Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
2026-05-05riscv: dts: microchip: clean up beaglev-fire regulator node namesConor Dooley1-2/+2
Recently the binding for regulator-fixed introduced preferred naming, in the regulator-XvY format. Change the existing regulators to match this pattern. Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
2026-05-05riscv: dts: microchip: remove gpio hogs from beaglev-fireConor Dooley1-15/+10
sd-det-hog should be cd-gpios, but when the mmc-spi-slot was added, the "cd-" prefix was omitted and the collision with the hog was not noticed. vio-enable-hog is just a regulator that can be modelled as such. Fixes: 1088d49b62648 ("riscv: dts: microchip: enable qspi adc/mmc-spi-slot on BeagleV Fire") Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
2026-05-05riscv: dts: microchip: gpio controllers on mpfs need 2 interrupt cellsConor Dooley1-3/+3
The platform has variable interrupt types for GPIO interrupts, in addition to having multiple lines per GPIO controller. Two interrupt cells are required. Fixes: 528a5b1f2556d ("riscv: dts: microchip: add new peripherals to icicle kit device tree") Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
2026-05-05riscv: dts: microchip: sort pic64gx i2c nodes alphanumericallyConor Dooley1-8/+8
The i2c nodes are out of place, sort them where they should be. Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
2026-05-05riscv: dts: microchip: update pic64gx gpio interrupts to better match the SoCConor Dooley2-21/+58
Just like PolarFire SoC, the same issues with GPIO interrupts exist in the pic64gx, due to their similarity. Yoinking from the commit message for the same change for PolarFire SoC: There are 3 GPIO controllers on this SoC, of which: - GPIO controller 0 has 14 GPIOs - GPIO controller 1 has 24 GPIOs - GPIO controller 2 has 32 GPIOs All GPIOs are capable of generating interrupts, for a total of 70. There are only 41 IRQs available however, so a configurable mux is used to ensure all GPIOs can be used for interrupt generation. 38 of the 41 interrupts are in what the documentation calls "direct mode", as they provide an exclusive connection from a GPIO to the PLIC. The 3 remaining interrupts are used to mux the interrupts which do not have a exclusive connection, one for each GPIO controller. The mux was overlooked when the bindings and driver were originally written for the GPIO controllers on Polarfire SoC, and the interrupts property in the GPIO nodes used to try and convey what the mapping was. Instead, the mux should be a device in its own right, and the GPIO controllers should be connected to it, rather than to the PLIC. Now that a binding exists for that mux, fix the inaccurate description of the interrupt controller hierarchy. Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
2026-05-05riscv: dts: microchip: add tsu clock to macb on pic64gxConor Dooley1-4/+4
In increment mode, the tsu clock for the macb is provided separately to the pck, usually the same clock as the reference to the rtc provided by an off-chip oscillator. pclk is 150 MHz typically, and the reference is either 100 MHz or 125 MHz, so having the tsu clock is required for correct rate selection. Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
2026-05-05dts: spacemit: set console baud rate on bpif3Conor Dooley1-1/+1
Because the default console's baud rate is not set, defconfig kernels do not have any serial output on this platform. Set the baud rate to 115200, matching what is used by U-Boot etc on this platform. Suggested-by: Vivian Wang <wangruikang@iscas.ac.cn> Fixes: d60d57ab6b2a8 ("riscv: dts: spacemit: add Banana Pi BPI-F3 board device tree") Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Reviewed-by: Yixun Lan <dlan@kernel.org> Link: https://lore.kernel.org/r/20260430-reword-overstep-3be08b7eab25@spud Signed-off-by: Yixun Lan <dlan@kernel.org>
2026-05-05x86/xen: Fix a potential problem in xen_e820_resolve_conflicts()Juergen Gross1-4/+9
When fixing a conflict in xen_e820_resolve_conflicts(), the loop over the E820 map entries needs to be restarted, as the E820 map will have been modified by the fix. Otherwise entries might be skipped by accident. Fixes: be35d91c8880 ("xen: tolerate ACPI NVS memory overlapping with Xen allocated memory") Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: xen-devel@lists.xenproject.org Link: https://patch.msgid.link/20260505080653.197775-1-jgross@suse.com
2026-05-05s390: Remove extra check of task_stack_page()Maninder Singh1-3/+0
There is no need to call task_stack_page(), because try_get_task_stack() already takes care of that. Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
2026-05-05x86/efi: Restore IRQ state in EFI page fault handlerArd Biesheuvel3-3/+13
The kernel's softirq API does not permit re-enabling softirqs while IRQs are disabled. The reason for this is that local_bh_enable() will not only re-enable delivery of softirqs over the back of IRQs, it will also handle any pending softirqs immediately, regardless of whether IRQs are enabled at that point. For this reason, commit d02198550423 ("x86/fpu: Improve crypto performance by making kernel-mode FPU reliably usable in softirqs") disables softirqs only when IRQs are enabled, as it is not permitted otherwise, but also unnecessary, given that asynchronous softirq delivery never happens to begin with while IRQs are disabled. However, this does mean that entering a kernel mode FPU section with IRQs enabled and leaving it with IRQs disabled leads to problems, as identified by Sashiko [0]: the EFI page fault handler is called from page_fault_oops() with IRQs disabled, and thus ends the kernel mode FPU section with IRQs disabled as well, regardless of whether IRQs were enabled when it was started. This may result in schedule() being called with a non-zero preempt_count, causing a BUG(). So take care to re-enable IRQs when handling any EFI page faults if they were taken with IRQs enabled. [0] https://sashiko.dev/#/patchset/20260430074107.27051-1-ivan.hu%40canonical.com Cc: Eric Biggers <ebiggers@kernel.org> Cc: Ivan Hu <ivan.hu@canonical.com> Cc: x86@kernel.org Cc: <stable@vger.kernel.org> Fixes: d02198550423 ("x86/fpu: Improve crypto performance by making kernel-mode FPU reliably usable in softirqs") Reviewed-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2026-05-04objtool: Grow __cfi_* prefix symbols for all CFI+CALL_PADDINGJosh Poimboeuf1-4/+0
For all CONFIG_CFI+CONFIG_CALL_PADDING configs, for C functions, the __cfi_ symbols only cover the 5-byte kCFI type hash. After that there also N bytes of NOP padding between the hash and the function entry which aren't associated with any symbol. The NOPs can be replaced with actual code at runtime. Without a symbol, unwinders and tooling have no way of knowing where those bytes belong. Grow the existing __cfi_* symbols to fill that gap. Note that assembly functions with SYM_TYPED_FUNC_START() aren't affected by this issue, their __cfi_ symbols also cover the padding. Also, CONFIG_PREFIX_SYMBOLS has no reason to exist: CONFIG_CALL_PADDING is what causes the compiler to emit NOP padding before function entry (via -fpatchable-function-entry), so it's the right condition for creating prefix symbols. Remove CONFIG_PREFIX_SYMBOLS, as it's no longer needed. Simplify the LONGEST_SYM_KUNIT_TEST dependency accordingly. Rework objtool's arguments a bit to handle the variety of prefix/cfi-related cases. Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
2026-05-04ARM: dts: imx6ul-var-som: add support for LVDS display panelHugo Villeneuve6-12/+139
Add support for the LD configuration option (LVDS encoder assembled on SOM) so that the LVDS display panel on the concerto EVK board works properly. Not all VAR-SOM-6UL SOMs have the LD configuration option so factor out this functionality to a separate dtsi. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: dts: imx6ul-var-som: factor out audio supportHugo Villeneuve6-21/+34
Not all boards use the audio codec, so factor out this functionality to a separate dtsi. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: dts: imx6ul-var-som: add support for EC configuration option (ENET1)Hugo Villeneuve8-54/+69
ENET1 is currently disabled and not supported/working on the concerto EVK. Add support for this optional configuration in a separate dtsi, so that it can be selectively enabled/disabled. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: dts: imx6ul-var-som: factor out ENET2 ethernet supportHugo Villeneuve7-57/+72
Not all boards use the ethernet ENET2 port, so factor out this functionality to a separate dtsi. On the concerto board, this uses the ethernet PHY assembled on it. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: dts: imx6ul-var-som: add proper Wifi and Bluetooth supportHugo Villeneuve7-10/+151
Add proper support for the optional Wifi and Bluetooth configuration on VAR-SOM-6UL so that it works out of the box, without any custom scripts. The Wifi/BT module support is mutually exclusive with SD card interface. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: dts: imx6ul-var-som: factor out SD card supportHugo Villeneuve5-51/+62
Move SD support to a separate dtsi, since it cannot be used at the same time as the Wifi/BT module. Also not all boards support the SD card. Move pinctrl_usdhc1* to the common imx6ul-var-som-common dtsi so that it can be used by the future Wifi/BT dtsi. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: dts: imx6ul-var-som-concerto: order DT propertiesHugo Villeneuve1-4/+4
reorder pinctrl_gpio_leds to respect alphabetical order. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: dts: imx6ul-var-som-concerto: Factor out common parts for all CPU variantsHugo Villeneuve5-307/+339
Export common parts to the Variscite VAR-SOM-6UL dtsi so that they can be reused on other boards and to simplify adding future dedicated device tree files for each CPU variant. Move i2c1 pinctrl to var-som dtsi pinmux, so that it can be reused by other boards. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: dts: imx6ul-var-som: Factor out common parts for all CPU variantsHugo Villeneuve3-213/+243
Factor out the parts on the Variscite VAR-SOM-6UL [1] that are common to all CPU variants (6UL, 6ULL, etc). This will simplify adding future dedicated device tree files for each CPU variant. Link https://dev.variscite.com/var-som-6ul [1] Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: dts: imx6ul-var-som: change incorrect VAR-SOM-MX6UL referencesHugo Villeneuve2-4/+4
There is no Variscite module named VAR-SOM-MX6UL, but there is VAR-SOM-MX6 and also VAR-SOM-6UL, so it is confusing at first to know to which one it refers to. The imx6ul-var-som* dts/dtsi supports only the VAR-SOM-6UL [1], not VAR-SOM-MX6 [2], so modify comments and model descriptions accordingly. Link https://dev.variscite.com/var-som-6ul [1] Link: https://dev.variscite.com/var-som-mx6 [2] Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: dts: imx6ul-var-som: fix warning for boolean property with a valueHugo Villeneuve2-2/+2
dmesg warning: OF: /soc/bus@2000000/ethernet@20b4000/mdio/ethernet-phy@3: Read of boolean property 'micrel,rmii-reference-clock-select-25-mhz' with a value. Using of_property_read_bool() for non-boolean properties is deprecated and results in a warning during runtime since commit c141ecc3cecd ("of: Warn when of_property_read_bool() is used on non-boolean properties") micrel,rmii-reference-clock-select-25-mhz is a boolean property and should not have a value, so remove it. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: dts: imx6ul-var-som: fix warning for non-existent dc-supply propertyHugo Villeneuve1-4/+0
The dc-supply property is non-existent in Linux now, nor when this DTS file was created when importing it from Variscite own kernel. Therefore remove it to fix this warning: imx6ul-var-som-concerto.dtb: cpu@0 (arm,cortex-a7): Unevaluated properties are not allowed ('dc-supply' was unexpected) from schema $id: http://devicetree.org/schemas/arm/cpus.yaml Fixes: 9d6a67d9c7a9 ("ARM: dts: imx6ul: Add Variscite VAR-SOM-MX6UL SoM support") Cc: stable@kernel.org Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04arm64: dts: add support for NXP i.MX95 15x15 audio board (version 2)Shengjiu Wang2-0/+670
i.MX Audio Board is a configurable and functional audio processing platform. Integrating a variety of audio input and output interfaces into the system, the i.MX Audio Board supports HDMI input, HDMI eARC, S/PDIF I/O, 2-ch ADC line-in, 24-ch DAC line-out and more. Based on these features, rich audio application cases can be realized. This is a basic device tree supporting with i.MX95 15x15 SoC and Audio board (version 2). - Six Cortex-A55 - NXP PCAL6416 GPIO expanders - RGB LEDs via GPIO expander - LPI2C1, LPI2C2, LPI2C3 controllers - LPUART1 (console) - USDHC1 (eMMC), USDHC2 (SD) - Three DAC (AK4458) - One ADC (AK5552) Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Signed-off-by: Frank Li <Frank.Li@nxp.com>
2026-05-04ARM: s3c: use gpio lookup table for LEDsArnd Bergmann1-8/+16
The crag6410 board is one of the last users of the gpio-led driver with plain gpio numbers. The driver has several ways to pass this information without using gpio numbers, using a lookup table is the easiest way. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/20260427143546.3098519-1-arnd@kernel.org Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
2026-05-04staging: octeon: convert cvmx_pip_port_status_t from typedef to plain structEric Wu1-3/+3
The Linux kernel coding style discourages the use of typedefs for structs. Convert cvmx_pip_port_status_t to a plain 'struct cvmx_pip_port_status' and update all users across the MIPS Octeon architecture code and the staging driver. No functional change. Signed-off-by: Eric Wu <kunjinkao.jp@gmail.com> Link: https://patch.msgid.link/20260427155427.668540-8-kunjinkao.jp@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-04staging: octeon: convert cvmx_pko_port_status_t from typedef to plain structEric Wu1-3/+3
The Linux kernel coding style discourages the use of typedefs for structs. Convert cvmx_pko_port_status_t to a plain 'struct cvmx_pko_port_status' and update all users across the MIPS Octeon architecture code and the staging driver. No functional change. Signed-off-by: Eric Wu <kunjinkao.jp@gmail.com> Link: https://patch.msgid.link/20260427155427.668540-7-kunjinkao.jp@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-04staging: octeon: convert cvmx_pko_status_t from typedef to plain enumEric Wu2-7/+7
The Linux kernel coding style discourages the use of typedefs for enums. Convert cvmx_pko_status_t to a plain 'enum cvmx_pko_status' and update all users across the MIPS Octeon architecture code and the staging driver stubs. No functional change. Signed-off-by: Eric Wu <kunjinkao.jp@gmail.com> Link: https://patch.msgid.link/20260427155427.668540-6-kunjinkao.jp@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-04staging: octeon: convert cvmx_pko_lock_t from typedef to plain enumEric Wu1-5/+5
The Linux kernel coding style discourages the use of typedefs for enums. Convert cvmx_pko_lock_t to a plain 'enum cvmx_pko_lock' and update all users across the MIPS Octeon architecture code and the staging driver stubs. No functional change. Signed-off-by: Eric Wu <kunjinkao.jp@gmail.com> Link: https://patch.msgid.link/20260427155427.668540-5-kunjinkao.jp@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-04staging: octeon: convert cvmx_pow_wait_t from typedef to plain enumEric Wu1-6/+6
The Linux kernel coding style discourages the use of typedefs for enums. Convert cvmx_pow_wait_t to a plain 'enum cvmx_pow_wait' and update all users across the MIPS Octeon architecture code and the staging driver stubs. No functional change. Signed-off-by: Eric Wu <kunjinkao.jp@gmail.com> Link: https://patch.msgid.link/20260427155427.668540-4-kunjinkao.jp@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-04staging: octeon: convert cvmx_helper_interface_mode_t from typedef to plain enumEric Wu5-10/+10
The Linux kernel coding style discourages the use of typedefs for enums. Convert cvmx_helper_interface_mode_t to a plain 'enum cvmx_helper_interface_mode' and update all users across the MIPS Octeon architecture code and the staging driver stubs. No functional change. Signed-off-by: Eric Wu <kunjinkao.jp@gmail.com> Link: https://patch.msgid.link/20260427155427.668540-3-kunjinkao.jp@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-04staging: octeon: convert cvmx_spi_mode_t from typedef to plain enumEric Wu2-27/+27
The Linux kernel coding style discourages the use of typedefs for enums. Convert cvmx_spi_mode_t to a plain 'enum cvmx_spi_mode' and update all users across the MIPS Octeon architecture code and the staging driver stubs. This is part of a series converting all remaining enum typedefs in the octeon subsystem to plain enums, improving compliance with the kernel coding style. No functional change. Signed-off-by: Eric Wu <kunjinkao.jp@gmail.com> Link: https://patch.msgid.link/20260427155427.668540-2-kunjinkao.jp@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-04x86/boot: Get rid of kstrtoull()Borislav Petkov (AMD)2-26/+5
Fold the '+' check in the single-underscore-prefixed version _kstrtoull() and remove the function. The arch/x86/boot/ namespace prefixes everything copied from kernel proper with "boot_" so that namespace clashes can be avoided. No functional changes. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
2026-05-04x86/boot/compressed: Use boot_kstrtoul() for hugepages= parsingThorsten Blum1-1/+2
Replace simple_strtoull() with boot_kstrtoul() for parsing the hugepages= boot parameter. Unlike simple_strtoull(), boot_kstrtoul() performs strict validation and returns an error on invalid inputs instead of silently accepting partial input. Use boot_kstrtoul() to reject and warn about invalid hugepages= values. boot_kstrtoul() also converts the input directly to an unsigned long and avoids implicit casting as max_gb_huge_pages *is* an unsigned long. [ bp: Massage commit message. ] Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/20260409161600.152012-2-thorsten.blum@linux.dev
2026-05-04x86/efi: Fix graceful fault handling after FPU softirq changesIvan Hu1-1/+1
Since commit d02198550423 ("x86/fpu: Improve crypto performance by making kernel-mode FPU reliably usable in softirqs"), kernel_fpu_begin() calls fpregs_lock() which uses local_bh_disable() instead of the previous preempt_disable(). This sets SOFTIRQ_OFFSET in preempt_count during the entire EFI runtime service call, causing in_interrupt() to return true in normal task context. The graceful page fault handler efi_crash_gracefully_on_page_fault() uses in_interrupt() to bail out for faults in real interrupt context. With SOFTIRQ_OFFSET now set, the handler always bails out, leaving EFI firmware page faults unhandled. This escalates to die() which also sees in_interrupt() as true and calls panic("Fatal exception in interrupt"), resulting in a hard system freeze. On systems with buggy firmware that triggers page faults during EFI runtime calls (e.g., accessing unmapped memory in GetTime()), this causes an unrecoverable hang instead of the expected graceful EFI_ABORTED recovery. Fix by replacing in_interrupt() with !in_task(). This preserves the original intent of bailing for interrupts or NMI faults, while no longer falsely triggering from the FPU code path's local_bh_disable(). Fixes: d02198550423 ("x86/fpu: Improve crypto performance by making kernel-mode FPU reliably usable in softirqs") Cc: <stable@vger.kernel.org> Signed-off-by: Ivan Hu <ivan.hu@canonical.com> [ardb: Sashiko spotted that using 'in_hardirq() || in_nmi()' leaves a window where a softirq may be taken before fpregs_lock() is called, but after efi_rts_work.efi_rts_id has been assigned, and any page faults occurring in that window will then be misidentified as having been caused by the firmware. Instead, use !in_task(), which incorporates in_serving_softirq(). ] Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2026-05-04x86/entry: Zap the #VC entry user and kernel macrosBorislav Petkov (AMD)5-40/+18
Drop the separate kernel and user macros in favor of calling a single #VC C handler which multiplexes between the kernel and user #VC entry points by looking at CS's RPL. Zap unused DEFINE_IDTENTRY_VC while at it. There should be no functionality change resulting from this - just code simplification. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Nikunj A. Dadhania <nikunj@amd.com> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Acked-by: Joerg Roedel <joerg.roedel@amd.com> Tested-by: Nikunj A. Dadhania <nikunj@amd.com> Link: https://patch.msgid.link/20260420164352.32129-1-bp@kernel.org
2026-05-04LoongArch: KVM: Move unconditional delay into timer clear sceneryBibo Mao1-2/+8
When timer interrupt arrives in guest kernel, guest kernel clears the timer interrupt and program timer with the next incoming event. During this stage, timer tick is -1 and timer interrupt status is disabled in ESTAT register. KVM hypervisor need write zero with timer tick register and wait timer interrupt injection from HW side, and then clear timer interrupt. So there is 2 cycle delay in KVM hypervisor to emulate such scenery, and the delay is unnecessary if there is no need to clear the timer interrupt. Here move 2 cycle delay into timer clear scenery and add timer ESTAT checking after delay, and set max timer expire value if timer interrupt does not arrive still. Cc: stable@vger.kernel.org Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-05-04LoongArch: KVM: Fix HW timer interrupt lost when inject interrupt by softwareBibo Mao1-0/+14
With passthrough HW timer, timer interrupt is injected by HW. When inject emulated CPU interrupt by software such SIP0/SIP1/IPI, HW timer interrupt may be lost. Here check whether there is timer tick value inversion before and after injecting emulated CPU interrupt by software, timer enabling by reading timer cfg register is skipped. If the timer tick value is detected with changing, then timer should be enabled. And inject a timer interrupt by software if there is. Cc: <stable@vger.kernel.org> Fixes: f45ad5b8aa93 ("LoongArch: KVM: Implement vcpu interrupt operations"). Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-05-04LoongArch: KVM: Move AVEC interrupt injection into switch loopBibo Mao1-11/+9
When AVEC interrupt controller is emulated in user space, AVEC interrupt is injected by software like SIP0/SIP1/TI/IPI interrupts. Here also move the AVEC interrupt injection in switch loop. Cc: stable@vger.kernel.org Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-05-04LoongArch: KVM: Use kvm_set_pte() in kvm_flush_pte()Tao Cui1-1/+1
kvm_flush_pte() is the only caller that directly assigns *pte instead of using the kvm_set_pte() wrapper. Use the wrapper for consistency with the rest of the file. No functional change intended. Cc: stable@vger.kernel.org Reviewed-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Tao Cui <cuitao@kylinos.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-05-04LoongArch: KVM: Fix missing EMULATE_FAIL in kvm_emu_mmio_read()Tao Cui1-0/+1
In the ldptr (0x24...0x27) opcode decoding path, the default case only breaks out but without setting "ret" value to EMULATE_FAIL. This leaves run->mmio.len uninitialized (stale from a previous MMIO operation) while "ret" value remains EMULATE_DO_MMIO, causing the code to proceed with an incorrect MMIO length. Add "ret = EMULATE_FAIL" to match the other default branches in the same function (e.g. the 0x28...0x2e and 0x38 cases). Cc: stable@vger.kernel.org Reviewed-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Tao Cui <cuitao@kylinos.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-05-04LoongArch: KVM: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUSQiang Ma1-1/+1
It doesn't make sense to return the recommended maximum number of vCPUs which exceeds the maximum possible number of vCPUs. Other architectures have already done this, such as commit 57a2e13ebdda ("KVM: MIPS: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS") Cc: stable@vger.kernel.org Reviewed-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Qiang Ma <maqianga@uniontech.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-05-04LoongArch: KVM: Fix "unreliable stack" for kvm_exc_entryXianglai Li1-1/+1
Insert the appropriate UNWIND hint into the kvm_exc_entry assembly function to guide the generation of correct ORC table entries, thereby solving the timeout problem ("unreliable stack") while loading the livepatch-sample module on a physical machine running virtual machines with multiple vcpus. Cc: stable@vger.kernel.org Signed-off-by: Xianglai Li <lixianglai@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-05-04LoongArch: KVM: Compile switch.S directly into the kernelXianglai Li6-42/+41
If we directly compile the switch.S file into the kernel, the address of the kvm_exc_entry function will definitely be within the DMW memory area. Therefore, we will no longer need to perform a copy relocation of the kvm_exc_entry. So this patch compiles switch.S directly into the kernel, and then remove the copy relocation execution logic for the kvm_exc_entry function. Cc: stable@vger.kernel.org Signed-off-by: Xianglai Li <lixianglai@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-05-04LoongArch: vDSO: Drop custom __arch_vdso_hres_capable()Thomas Weißschuh1-6/+0
The custom definition is identical to the generic fallback one. So remove it. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-05-04LoongArch: Fix potential ADE in loongson_gpu_fixup_dma_hang()Wentao Guan1-0/+3
The switch case in loongson_gpu_fixup_dma_hang() may not DC2 or DC3, and readl(crtc_reg) will access with random address, because the "device" is from "base+PCI_DEVICE_ID", "base" is from "pdev->devfn+1". This is wrong when my platform inserts a discrete GPU: lspci -tv -[0000:00]-+-00.0 Loongson Technology LLC Hyper Transport Bridge Controller ... +-06.0 Loongson Technology LLC LG100 GPU +-06.2 Loongson Technology LLC Device 7a37 ... Add a default switch case to fix the panic as below: Kernel ade access[#1]: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.6.136-loong64-desktop-hwe+ #4 pc 90000000017e5534 ra 90000000017e54c0 tp 90000001002f8000 sp 90000001002fb6c0 a0 80000efe00003100 a1 0000000000003100 a2 0000000000000000 a3 0000000000000002 a4 90000001002fb6b4 a5 900000087cdb58fd a6 90000000027af000 a7 0000000000000001 t0 00000000000085b9 t1 000000000000ffff t2 0000000000000000 t3 0000000000000000 t4 fffffffffffffffd t5 00000000fffb6d9c t6 0000000000083b00 t7 00000000000070c0 t8 900000087cdb4d94 u0 900000087cdb58fd s9 90000001002fb826 s0 90000000031c12c8 s1 7fffffffffffff00 s2 90000000031c12d0 s3 0000000000002710 s4 0000000000000000 s5 0000000000000000 s6 9000000100053000 s7 7fffffffffffff00 s8 90000000030d4000 ra: 90000000017e54c0 loongson_gpu_fixup_dma_hang+0x40/0x210 ERA: 90000000017e5534 loongson_gpu_fixup_dma_hang+0xb4/0x210 CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE) PRMD: 00000004 (PPLV0 +PIE -PWE) EUEN: 00000000 (-FPE -SXE -ASXE -BTE) ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7) ESTAT: 00480000 [ADEM] (IS= ECode=8 EsubCode=1) BADV: 7fffffffffffff00 PRID: 0014d000 (Loongson-64bit, Loongson-3A6000-HV) Modules linked in: Process swapper/0 (pid: 1, threadinfo=(____ptrval____), task=(____ptrval____)) Stack : 0000000000000006 90000001002fb778 90000001002fb704 0000000000000007 0000000016a65700 90000000017e5690 000000000000ffff ffffffffffffffff 900000000209f7c0 9000000100053000 900000000209f7a8 9000000000eebc08 0000000000000000 0000000000000000 0000000000000006 90000001002fb778 90000001000530b8 90000000027af000 0000000000000000 9000000100054000 9000000100053000 9000000000ebb70c 9000000100004c00 9000000004000001 90000001002fb7e4 bae765461f31cb12 0000000000000000 0000000000000000 0000000000000006 90000000027af000 0000000000000030 90000000027af000 900000087cd6f800 9000000100053000 0000000000000000 9000000000ebc560 7a2500147cdaf720 bae765461f31cb12 0000000000000001 0000000000000030 ... Call Trace: [<90000000017e5534>] loongson_gpu_fixup_dma_hang+0xb4/0x210 [<9000000000eebc08>] pci_fixup_device+0x108/0x280 [<9000000000ebb70c>] pci_setup_device+0x24c/0x690 [<9000000000ebc560>] pci_scan_single_device+0xe0/0x140 [<9000000000ebc684>] pci_scan_slot+0xc4/0x280 [<9000000000ebdd00>] pci_scan_child_bus_extend+0x60/0x3f0 [<9000000000f5bc94>] acpi_pci_root_create+0x2b4/0x420 [<90000000017e5e74>] pci_acpi_scan_root+0x2d4/0x440 [<9000000000f5b02c>] acpi_pci_root_add+0x21c/0x3a0 [<9000000000f4ee54>] acpi_bus_attach+0x1a4/0x3c0 [<90000000010e200c>] device_for_each_child+0x6c/0xe0 [<9000000000f4bbf4>] acpi_dev_for_each_child+0x44/0x70 [<9000000000f4ef40>] acpi_bus_attach+0x290/0x3c0 [<90000000010e200c>] device_for_each_child+0x6c/0xe0 [<9000000000f4bbf4>] acpi_dev_for_each_child+0x44/0x70 [<9000000000f4ef40>] acpi_bus_attach+0x290/0x3c0 [<9000000000f5211c>] acpi_bus_scan+0x6c/0x280 [<900000000189c028>] acpi_scan_init+0x194/0x310 [<900000000189bc6c>] acpi_init+0xcc/0x140 [<9000000000220cdc>] do_one_initcall+0x4c/0x310 [<90000000018618fc>] kernel_init_freeable+0x258/0x2d4 [<900000000184326c>] kernel_init+0x28/0x13c [<9000000000222008>] ret_from_kernel_thread+0xc/0xa4 Cc: stable@vger.kernel.org Fixes: 95db0c9f526d ("LoongArch: Workaround LS2K/LS7A GPU DMA hang bug") Link: https://gist.github.com/opsiff/ebf2dac51b4013d22462f2124c55f807 Link: https://gist.github.com/opsiff/a62f2a73db0492b3c49bf223a339b133 Signed-off-by: Wentao Guan <guanwentao@uniontech.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-05-04LoongArch: Use per-root-bridge PCIH flag to skip mem resource fixupHuacai Chen1-0/+5
When firmware enables 64-bit PCI host bridge support, some root bridges already provide valid 64-bit mem resource windows through ACPI. In this case, the LoongArch-specific mem resource high-bits fixup in acpi_prepare_root_resources() should not be applied unconditionally. Otherwise, the kernel may override the native resource layout derived from firmware, and later BAR assignment can fail to place device BARs into the intended 64-bit address space correctly. Add a per-root-bridge ACPI flag, PCIH, and evaluate it from the current root bridge device scope. When PCIH is set, skip the mem resource high- bits fixup path and let the kernel use the firmware-provided resource description directly. When PCIH is absent or cleared, keep the existing behavior and continue filling the high address bits from the host bridge address. This makes the behavior per-root-bridge configurable and avoids breaking valid 64-bit BAR space allocation on bridges whose 64-bit windows have already been fully described by firmware. Cc: stable@vger.kernel.org Suggested-by: Chao Li <lichao@loongson.cn> Tested-by: Dongyan Qian <qiandongyan@loongson.cn> Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2026-05-04LoongArch: Fix SYM_SIGFUNC_START definition for 32BITHuacai Chen1-1/+1
The SYM_SIGFUNC_START definition should match sigcontext that the length of GPRs are 8 bytes for both 32BIT and 64BIT. So replace SZREG with 8 to fix it. Cc: stable@vger.kernel.org Fixes: e4878c37f6679fde ("LoongArch: vDSO: Emit GNU_EH_FRAME correctly") Suggested-by: Xi Ruoyao <xry111@xry111.site> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>