summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-11-06printk: move console printing to kthreadsJohn Ogness2-492/+236
Create a kthread for each console to perform console printing. Now all console printing is fully asynchronous except for the boot console and when the kernel enters sync mode (and there are atomic consoles available). The console_lock() and console_unlock() functions now only do what their name says... locking and unlocking of the console. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2023-11-06printk: introduce kernel sync modeJohn Ogness3-10/+178
When the kernel performs an OOPS, enter into "sync mode": - only atomic consoles (write_atomic() callback) will print - printing occurs within vprintk_store() instead of console_unlock() CONSOLE_LOG_MAX is moved to printk.h to support the per-console buffer used in sync mode. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2023-11-06printk: use seqcount_latch for console_seqJohn Ogness1-32/+41
In preparation for atomic printing, change @console_seq to use seqcount_latch so that it can be read without requiring @console_sem. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2023-11-06printk: call boot_delay_msec() in printk_delay()John Ogness1-3/+4
boot_delay_msec() is always called immediately before printk_delay() so just call it from within printk_delay(). Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2023-11-06printk: relocate printk_delay()John Ogness1-14/+14
Move printk_delay() "as is" further up so that they can be used by new functions in an upcoming commit. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2023-11-06serial: 8250: implement write_atomicJohn Ogness7-44/+162
Implement a non-sleeping NMI-safe write_atomic() console function in order to support emergency console printing. Since interrupts need to be disabled during transmit, all usage of the IER register is wrapped with access functions that use the console_atomic_lock() function to synchronize register access while tracking the state of the interrupts. This is necessary because write_atomic() can be called from an NMI context that has preempted write_atomic(). Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2023-11-06kdb: only use atomic consoles for output mirroringJohn Ogness1-12/+6
Currently kdb uses the @oops_in_progress hack to mirror kdb output to all active consoles from NMI context. Ignoring locks is unsafe. Now that an NMI-safe atomic interfaces is available for consoles, use that interface to mirror kdb output. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2023-11-06console: add write_atomic interfaceJohn Ogness9-23/+100
Add a write_atomic() callback to the console. This is an optional function for console drivers. The function must be atomic (including NMI safe) for writing to the console. Console drivers must still implement the write() callback. The write_atomic() callback will only be used in special situations, such as when the kernel panics. Creating an NMI safe write_atomic() that must synchronize with write() requires a careful implementation of the console driver. To aid with the implementation, a set of console_atomic_*() functions are provided: void console_atomic_lock(unsigned long flags); void console_atomic_unlock(unsigned long flags); These functions synchronize using the printk cpulock and disable hardware interrupts. kgdb makes use of its own cpulock (@dbg_master_lock, @kgdb_active) during cpu roundup. This will conflict with the printk cpulock. Therefore, a CPU must ensure that it is not holding the printk cpulock when calling kgdb_cpu_enter(). If it is, it must allow its printk context to complete first. A new helper function kgdb_roundup_delay() is introduced for kgdb to determine if it is holding the printk cpulock. If so, a flag is set so that when the printk cpulock is released, kgdb will be re-triggered for that CPU. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2023-11-06printk: rename printk cpulock API and always disable interruptsJohn Ogness3-20/+18
The printk cpulock functions use local_irq_disable(). This means that hardware interrupts are also disabled on PREEMPT_RT. To make this clear, rename the functions to use the raw_ prefix: raw_printk_cpu_lock_irqsave(flags); raw_printk_cpu_unlock_irqrestore(flags); Also, these functions were a NOP for !CONFIG_SMP. But for !CONFIG_SMP they still need to disable hardware interrupts. So modify them appropriately for this. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2023-11-06arm64: mm: Make arch_faults_on_old_pte() check for migratabilityValentin Schneider1-1/+1
arch_faults_on_old_pte() relies on the calling context being non-preemptible. CONFIG_PREEMPT_RT turns the PTE lock into a sleepable spinlock, which doesn't disable preemption once acquired, triggering the warning in arch_faults_on_old_pte(). It does however disable migration, ensuring the task remains on the same CPU during the entirety of the critical section, making the read of cpu_has_hw_af() safe and stable. Make arch_faults_on_old_pte() check migratable() instead of preemptible(). Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Link: https://lore.kernel.org/r/20210811201354.1976839-5-valentin.schneider@arm.com
2023-11-06sched: Introduce migratable()Valentin Schneider1-0/+10
Some areas use preempt_disable() + preempt_enable() to safely access per-CPU data. The PREEMPT_RT folks have shown this can also be done by keeping preemption enabled and instead disabling migration (and acquiring a sleepable lock, if relevant). Introduce a helper which checks whether the current task can be migrated elsewhere, IOW if it is pinned to its local CPU in the current context. This can help determining if per-CPU properties can be safely accessed. Note that CPU affinity is not checked here, as a preemptible task can have its affinity changed at any given time (including if it has PF_NO_SETAFFINITY, when hotplug gets involved). Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> [bigeasy: Return false on UP, call it is_migratable().] Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Link: https://lore.kernel.org/r/20210811201354.1976839-3-valentin.schneider@arm.com
2023-11-06rcu/tree: Protect rcu_rdp_is_offloaded() invocations on RTThomas Gleixner1-3/+4
Valentin reported warnings about suspicious RCU usage on RT kernels. Those happen when offloading of RCU callbacks is enabled: WARNING: suspicious RCU usage 5.13.0-rt1 #20 Not tainted ----------------------------- kernel/rcu/tree_plugin.h:69 Unsafe read of RCU_NOCB offloaded state! rcu_rdp_is_offloaded (kernel/rcu/tree_plugin.h:69 kernel/rcu/tree_plugin.h:58) rcu_core (kernel/rcu/tree.c:2332 kernel/rcu/tree.c:2398 kernel/rcu/tree.c:2777) rcu_cpu_kthread (./include/linux/bottom_half.h:32 kernel/rcu/tree.c:2876) The reason is that rcu_rdp_is_offloaded() is invoked without one of the required protections on RT enabled kernels because local_bh_disable() does not disable preemption on RT. Valentin proposed to add a local lock to the code in question, but that's suboptimal in several aspects: 1) local locks add extra code to !RT kernels for no value. 2) All possible callsites have to audited and amended when affected possible at an outer function level due to lock nesting issues. 3) As the local lock has to be taken at the outer functions it's required to release and reacquire them in the inner code sections which might voluntary schedule, e.g. rcu_do_batch(). Both callsites of rcu_rdp_is_offloaded() which trigger this check invoke rcu_rdp_is_offloaded() in the variable declaration section right at the top of the functions. But the actual usage of the result is either within a section which provides the required protections or after such a section. So the obvious solution is to move the invocation into the code sections which provide the proper protections, which solves the problem for RT and does not have any impact on !RT kernels. Reported-by: Valentin Schneider <valentin.schneider@arm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2023-11-04Merge tag 'JH7110_515_SDK_v5.9.0' into vf2-515-develAndy Hu7-50/+1187
2023-11-01Merge branch 'CR_8138_ssout_setting_zejian.su' into 'jh7110-5.15.y-devel'andy.hu2-0/+69
CR_8138: Add ISP control for video2 and video3. See merge request sdk/linux!977
2023-11-01Merge branch 'CR_6614_isp_control_zejian.su' into 'jh7110-5.15.y-devel'andy.hu7-50/+1118
CR_6614: Add support for libcamera See merge request sdk/linux!970
2023-11-01Add ISP control for video2 and video3.zejian.su2-0/+69
Signed-off-by: zejian.su <zejian.su@starfivetech.com>
2023-11-01Expand 2 bytes after the SC buffer for the AE/AWB flag and copy the ↵zejian.su5-26/+87
histogram data to the SC buffer.
2023-11-01Add 16 ISP controls, remove the frame SYNC event to video7 (SC) These ↵zejian.su4-8/+706
controls are: WB, CAR, CCM, CFA, CTC, DBC, DNYUV, GMARGB, LCCF, OBC, OECF, R2Y, SAT, SHRP, YCRV, SC
2023-11-01media: starfive: isp: Fix enum isp subdev code bugChanghuang Liang1-13/+3
Fix enum isp subdev code bug. Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
2023-11-01media: starfive: isp: Update format pad table one by oneChanghuang Liang1-32/+14
Update format pad table one by one, it can simply code. Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
2023-11-01media: starfive: Add isp sc buffer pointChanghuang Liang2-1/+4
Add isp sc buffer point. Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
2023-11-01media: satrfive: stf_isp: Add new conctrl supportChanghuang Liang3-1/+311
Add new conctrl for jh7110 isp. Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
2023-11-01media: starfive: Add isp frame sync eventChanghuang Liang1-1/+25
Add isp frame sync event. Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
2023-11-01media: starfive: Add V4L2_CAP_IO_MC capabilitiesChanghuang Liang1-1/+1
Add V4L2_CAP_IO_MC capabilities. Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
2023-10-26Merge branch 'CR_7252_vf2_wifi_dongle_5.15_ziv.xu' into 'vf2-515-devel'VF2_v3.8.2andy.hu1-3/+0
CR_7252_vf2_wifi_dongle_5.15_ziv.xu See merge request sbc/linux!174
2023-10-26Merge tag 'JH7110_515_SDK_v5.8.2' into vf2-515-develAndy Hu1-38/+5
2023-10-25drivers: wireless: aic8800 : wifi dongle revert to one interfaceziv.xu1-3/+0
wifi dongle revert to one interface Signed-off-by: ziv.xu <ziv.xu@starfive.com>
2023-10-25Merge branch ↵andy.hu1-38/+5
'CR_7479_linux5.15_refix_mosaic_cursor_and_improve_display_perfmance_4K30_Windsome.Zeng' into 'jh7110-5.15.y-devel' CR 7479 Revert to original code on update_fb See merge request sdk/linux!974
2023-10-24Revert to original code to avoid possible mosaic problem.Windsome Zeng1-38/+5
Signed-off-by: Windsome Zeng <windsome.zeng@starfivetech.com>
2023-10-19Merge branch 'CR_7889_vf2_qspi_5.15_ziv.xu' into 'vf2-515-devel'andy.hu1-0/+33
CR_7889_vf2_qspi_5.15_ziv.xu See merge request sbc/linux!173
2023-10-18Merge tag 'JH7110_515_SDK_v5.8.1' into vf2-515-develAndy Hu2-27/+33
2023-10-18Merge branch 'CR_7889_evb_qspi_5.15_ziv.xu' into 'jh7110-5.15.y-devel'andy.hu2-27/+33
CR_7889_evb_qspi_5.15_ziv.xu See merge request sdk/linux!972
2023-10-16riscv: dts: starfive: modify qspi dtsziv.xu1-0/+33
modify qspi dts Signed-off-by: ziv.xu <ziv.xu@starfive.com>
2023-10-16riscv: dts: starfive: modify qspi dtsziv.xu2-27/+33
modify qspi dts Signed-off-by: ziv.xu <ziv.xu@starfive.com>
2023-10-12Merge tag 'JH7110_515_SDK_v5.8.0' into vf2-515-develAndy Hu1-1/+0
2023-10-11Merge branch 'CR_7607_reset_hal.feng' into 'jh7110-5.15.y-devel'andy.hu1-1/+0
CR_7607_reset_hal.feng See merge request sdk/linux!969
2023-09-25reset: starfive: jh7110: Drop the unused EXPORT_SYMBOL_GPLHal Feng1-1/+0
reset_starfive_jh7110_generic_probe() is never called by other modules, so drop the EXPORT_SYMBOL_GPL for it. Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
2023-09-22Merge tag 'JH7110_515_SDK_v5.7.5' into vf2-515-develVF2_v3.7.5Andy Hu1-0/+1
2023-09-22Merge branch ↵andy.hu1-0/+1
'CR_7479_linux5.15_refix_mosaic_cursor_and_improve_display_perfmance_4K30_Windsome.Zeng' into 'jh7110-5.15.y-devel' CR 7479 Enlarge flush cache size to avoid flick See merge request sdk/linux!966
2023-09-22Enlarge flush cache size to avoid flick on console/modetest and UVC 1080P ↵Windsome Zeng1-0/+1
camera. Signed-off-by: Windsome Zeng <windsome.zeng@starfivetech.com>
2023-09-21Merge tag 'JH7110_515_SDK_v5.7.4' into vf2-515-develAndy Hu4-8/+61
2023-09-21Merge branch 'CR_6347_linux_hdmi_hotplug_keith.zhao' into 'jh7110-5.15.y-devel'andy.hu1-1/+10
CR_6347 display : hdmi: fix hotplug hang See merge request sdk/linux!960
2023-09-21Merge branch 'CR_7149_UART_5.15_william.qiu' into 'jh7110-5.15.y-devel'andy.hu1-0/+4
CR_7149_5.15: uart: 8250: add reset operation in runtime PM See merge request sdk/linux!964
2023-09-21Merge branch ↵andy.hu2-7/+47
'CR_7479_linux5.15_refix_mosaic_cursor_and_improve_display_perfmance_4K30_Windsome.Zeng' into 'jh7110-5.15.y-devel' CR 7479 Refix mmosaic cursor and improve display performance to 4K30 See merge request sdk/linux!959
2023-09-21Mosaic cursor: Revert commit 30289b2ca780bcaf7acb1ffe88125a65b7e34577 as it ↵Windsome Zeng2-7/+47
will drop 50% performance. Just do real flush data while cursor is about to change. Other plane: According to the behavior of L2 cache controller in U74, only the last 2MB data is needed to be flushed. For 4K resolution, it will reduce flush loops from 518400 to 32768 on each frame update. Signed-off-by: Windsome Zeng <windsome.zeng@starfivetech.com>
2023-09-20uart: 8250: add reset operation in runtime PMWilliam Qiu1-0/+4
add reset operation in runtime PM Signed-off-by: William Qiu <william.qiu@starfivetech.com>
2023-09-20display : hdmi: fix hotplug hangkeith.zhao1-1/+10
Fixed the probability of hdmi crash after repeated insertion and removal Signed-off-by: keith.zhao <keith.zhao@starfivetech.com>
2023-09-14Merge branch 'CR_7358_VF2_5.15_radxa_gsensor_shengyang.chen' into ↵andy.hu7-72/+281
'vf2-515-devel' CR_7358_VF2_5.15: riscv: drm: panel: update radxa panel startup process and support accelerator-sc7a20 && riscv: iio: accel: add sc7a20 support for linux 515 See merge request sbc/linux!171
2023-09-14Merge tag 'JH7110_515_SDK_v5.7.3' into vf2-515-develAndy Hu1-4/+8
2023-09-13Merge branch 'CR_7193_PCIe_515_Kevin.xie' into 'jh7110-5.15.y-devel'andy.hu1-4/+8
CR 7193 [515] driver: pci: Update reset timing as the requirement in PCIe base spec r6.0 See merge request sdk/linux!957