-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmUBaBUACgkQONu9yGCS aT6OkBAArqBSUyCYQJrhoUlFYBnBqF7BLSkj0GwINGSUOlt5ilJ3kZwH9ftjvpWp ZtO0Rp/1yH2H5PpcsaLljPl055Sf30e0oCkz6vX16vy17NGnzI4rJi55+nRZbFRH tBMhMjblgIJoTiTPEQPSGghENok+QzJ9Imffo4/Wru3w5ytkBnGcPPXreHJw+8V5 Pjhzg5tcjhz23rk2wzVtR4VfEqWaHQaapv49rKB1Yls578WYn4QXl4jgUyB7rCo7 9vBB7xy77H1hr9m8ifB/9v1ToV/vw6L1xGPWWWbhsSikFAMBoq34SCsq+6RdeURo 43CCcFsx1s5acM7NQWvxkoV5Hgl8Hc3WgFsx5eVBlNd+vS6ezkgdYuGmN76t+dF/ hZ7XGEoEFuoz9NKQC/5rKjdBd2p/IQYx6vf8EpK0IxFPD4h+DY9pn0FvwuAmxAcA M41xLYGbXX5l/QJR016B1AYiB3DqVxRRRyQT0yNip+PDAh2N06MOJ84KgMSR9lg7 jyeFKZM2vQ619RopMIspuHTWxNiMw7x94aUhBnY1oD+fDzaRn+VNL8po6QYHLK8U QTDhrWplTbTuGIF72h+1IyX1aUj6ozoCewl9Y9ry1u9jBb7LZoupVd0s1dwqORIk 2OSo74pDu5F2BT+4hEcCpDRcYvWlfKbZWBunRrMqvHN8BON0Mks= =aFyS -----END PGP SIGNATURE----- Merge 6.1.53 into android14-6.1-lts Changes in 6.1.53 Revert "bridge: Add extack warning when enabling STP in netns." Partially revert "drm/amd/display: Fix possible underflow for displays with large vblank" scsi: ufs: Try harder to change the power mode Revert "Revert drm/amd/display: Enable Freesync Video Mode by default" ARM: dts: imx: Set default tuning step for imx7d usdhc ALSA: hda/realtek: Enable 4 amplifiers instead of 2 on a HP platform powerpc/boot: Disable power10 features after BOOTAFLAGS assignment media: uapi: HEVC: Add num_delta_pocs_of_ref_rps_idx field Revert "MIPS: unhide PATA_PLATFORM" phy: qcom-snps-femto-v2: use qcom_snps_hsphy_suspend/resume error code media: amphion: use dev_err_probe media: pulse8-cec: handle possible ping error media: pci: cx23885: fix error handling for cx23885 ATSC boards 9p: virtio: fix unlikely null pointer deref in handle_rerror 9p: virtio: make sure 'offs' is initialized in zc_request ksmbd: fix out of bounds in smb3_decrypt_req() ksmbd: validate session id and tree id in compound request ksmbd: no response from compound read ksmbd: fix out of bounds in init_smb2_rsp_hdr() ASoC: da7219: Flush pending AAD IRQ when suspending ASoC: da7219: Check for failure reading AAD IRQ events ASoC: nau8821: Add DMI quirk mechanism for active-high jack-detect ethernet: atheros: fix return value check in atl1c_tso_csum() m68k: Fix invalid .section syntax s390/dasd: use correct number of retries for ERP requests s390/dasd: fix hanging device after request requeue fs/nls: make load_nls() take a const parameter ASoC: rt5682-sdw: fix for JD event handling in ClockStop Mode0 ASoc: codecs: ES8316: Fix DMIC config ASoC: rt711: fix for JD event handling in ClockStop Mode0 ASoC: rt711-sdca: fix for JD event handling in ClockStop Mode0 ASoC: atmel: Fix the 8K sample parameter in I2SC master ALSA: usb-audio: Add quirk for Microsoft Modern Wireless Headset platform/x86: intel: hid: Always call BTNL ACPI method platform/x86/intel/hid: Add HP Dragonfly G2 to VGBS DMI quirks platform/x86: think-lmi: Use kfree_sensitive instead of kfree platform/x86: asus-wmi: Fix setting RGB mode on some TUF laptops platform/x86: huawei-wmi: Silence ambient light sensor drm/amd/smu: use AverageGfxclkFrequency* to replace previous GFX Curr Clock drm/amd/display: Guard DCN31 PHYD32CLK logic against chip family drm/amd/display: Exit idle optimizations before attempt to access PHY ovl: Always reevaluate the file signature for IMA ata: pata_arasan_cf: Use dev_err_probe() instead dev_err() in data_xfer() ALSA: usb-audio: Update for native DSD support quirks staging: fbtft: ili9341: use macro FBTFT_REGISTER_SPI_DRIVER security: keys: perform capable check only on privileged operations kprobes: Prohibit probing on CFI preamble symbol clk: fixed-mmio: make COMMON_CLK_FIXED_MMIO depend on HAS_IOMEM vmbus_testing: fix wrong python syntax for integer value comparison Revert "wifi: ath6k: silence false positive -Wno-dangling-pointer warning on GCC 12" net: dsa: microchip: KSZ9477 register regmap alignment to 32 bit boundaries net: annotate data-races around sk->sk_{rcv|snd}timeo net: usb: qmi_wwan: add Quectel EM05GV2 wifi: brcmfmac: Fix field-spanning write in brcmf_scan_params_v2_to_v1() powerpc/powermac: Use early_* IO variants in via_calibrate_decr() idmaengine: make FSL_EDMA and INTEL_IDMA64 depends on HAS_IOMEM platform/x86/amd/pmf: Fix unsigned comparison with less than zero scsi: lpfc: Remove reftag check in DIF paths scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock net: hns3: restore user pause configure when disable autoneg drm/amdgpu: Match against exact bootloader status wifi: cfg80211: remove links only on AP wifi: mac80211: Use active_links instead of valid_links in Tx netlabel: fix shift wrapping bug in netlbl_catmap_setlong() bnx2x: fix page fault following EEH recovery cifs: fix sockaddr comparison in iface_cmp cifs: fix max_credits implementation sctp: handle invalid error codes without calling BUG() scsi: aacraid: Reply queue mapping to CPUs based on IRQ affinity scsi: storvsc: Always set no_report_opcodes scsi: lpfc: Fix incorrect big endian type assignment in bsg loopback path LoongArch: Let pmd_present() return true when splitting pmd LoongArch: Fix the write_fcsr() macro ALSA: seq: oss: Fix racy open/close of MIDI devices net: sfp: handle 100G/25G active optical cables in sfp_parse_support tracing: Introduce pipe_cpumask to avoid race on trace_pipes platform/mellanox: Fix mlxbf-tmfifo not handling all virtio CONSOLE notifications of: property: Simplify of_link_to_phandle() cpufreq: intel_pstate: set stale CPU frequency to minimum crypto: rsa-pkcs1pad - Use helper to set reqsize tpm: Enable hwrng only for Pluton on AMD CPUs KVM: x86/mmu: Use kstrtobool() instead of strtobool() KVM: x86/mmu: Add "never" option to allow sticky disabling of nx_huge_pages net: Avoid address overwrite in kernel_connect drm/amd/display: ensure async flips are only accepted for fast updates udf: Check consistency of Space Bitmap Descriptor udf: Handle error when adding extent to a file Input: i8042 - add quirk for TUXEDO Gemini 17 Gen1/Clevo PD70PN Revert "PCI: tegra194: Enable support for 256 Byte payload" Revert "net: macsec: preserve ingress frame ordering" tools lib subcmd: Add install target tools lib subcmd: Make install_headers clearer tools lib subcmd: Add dependency test to install_headers tools/resolve_btfids: Use pkg-config to locate libelf tools/resolve_btfids: Install subcmd headers tools/resolve_btfids: Alter how HOSTCC is forced tools/resolve_btfids: Compile resolve_btfids as host program tools/resolve_btfids: Tidy HOST_OVERRIDES tools/resolve_btfids: Pass HOSTCFLAGS as EXTRA_CFLAGS to prepare targets tools/resolve_btfids: Fix setting HOSTCFLAGS reiserfs: Check the return value from __getblk() eventfd: prevent underflow for eventfd semaphores fs: Fix error checking for d_hash_and_lookup() iomap: Remove large folio handling in iomap_invalidate_folio() tmpfs: verify {g,u}id mount options correctly selftests/harness: Actually report SKIP for signal tests vfs, security: Fix automount superblock LSM init problem, preventing NFS sb sharing ARM: ptrace: Restore syscall restart tracing ARM: ptrace: Restore syscall skipping for tracers refscale: Fix uninitalized use of wait_queue_head_t OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd() selftests/resctrl: Add resctrl.h into build deps selftests/resctrl: Don't leak buffer in fill_cache() selftests/resctrl: Unmount resctrl FS if child fails to run benchmark selftests/resctrl: Close perf value read fd on errors arm64/ptrace: Clean up error handling path in sve_set_common() sched/psi: Select KERNFS as needed x86/decompressor: Don't rely on upper 32 bits of GPRs being preserved arm64/sme: Don't use streaming mode to probe the maximum SME VL arm64/fpsimd: Only provide the length to cpufeature for xCR registers sched/rt: Fix sysctl_sched_rr_timeslice intial value perf/imx_ddr: don't enable counter0 if none of 4 counters are used selftests/futex: Order calls to futex_lock_pi s390/pkey: fix/harmonize internal keyblob headers s390/pkey: fix PKEY_TYPE_EP11_AES handling in PKEY_GENSECK2 IOCTL s390/pkey: fix PKEY_TYPE_EP11_AES handling for sysfs attributes s390/paes: fix PKEY_TYPE_EP11_AES handling for secure keyblobs irqchip/loongson-eiointc: Fix return value checking of eiointc_index ACPI: x86: s2idle: Post-increment variables when getting constraints ACPI: x86: s2idle: Fix a logic error parsing AMD constraints table thermal/of: Fix potential uninitialized value access cpufreq: amd-pstate-ut: Remove module parameter access cpufreq: amd-pstate-ut: Fix kernel panic when loading the driver x86/efistub: Fix PCI ROM preservation in mixed mode cpufreq: powernow-k8: Use related_cpus instead of cpus in driver.exit() selftests/bpf: Fix bpf_nf failure upon test rerun bpftool: use a local copy of perf_event to fix accessing :: Bpf_cookie bpftool: Define a local bpf_perf_link to fix accessing its fields bpftool: Use a local copy of BPF_LINK_TYPE_PERF_EVENT in pid_iter.bpf.c bpftool: Use a local bpf_perf_event_value to fix accessing its fields libbpf: Fix realloc API handling in zero-sized edge cases bpf: Clear the probe_addr for uprobe bpf: Fix an error in verifying a field in a union crypto: qat - change value of default idle filter tcp: tcp_enter_quickack_mode() should be static hwrng: nomadik - keep clock enabled while hwrng is registered hwrng: pic32 - use devm_clk_get_enabled regmap: rbtree: Use alloc_flags for memory allocations wifi: rtw89: debug: Fix error handling in rtw89_debug_priv_btc_manual_set() wifi: mt76: mt7921: fix non-PSC channel scan fail udp: re-score reuseport groups when connected sockets are present bpf: reject unhashed sockets in bpf_sk_assign wifi: mt76: testmode: add nla_policy for MT76_TM_ATTR_TX_LENGTH spi: tegra20-sflash: fix to check return value of platform_get_irq() in tegra_sflash_probe() can: gs_usb: gs_usb_receive_bulk_callback(): count RX overflow errors also in case of OOM wifi: mt76: mt7915: fix power-limits while chan_switch wifi: mwifiex: Fix OOB and integer underflow when rx packets wifi: mwifiex: fix error recovery in PCIE buffer descriptor management selftests/bpf: fix static assert compilation issue for test_cls_*.c kbuild: rust_is_available: remove -v option kbuild: rust_is_available: fix version check when CC has multiple arguments kbuild: rust_is_available: add check for `bindgen` invocation kbuild: rust_is_available: fix confusion when a version appears in the path crypto: stm32 - Properly handle pm_runtime_get failing crypto: api - Use work queue in crypto_destroy_instance Bluetooth: nokia: fix value check in nokia_bluetooth_serdev_probe() Bluetooth: Fix potential use-after-free when clear keys Bluetooth: hci_sync: Don't double print name in add/remove adv_monitor Bluetooth: hci_sync: Avoid use-after-free in dbg for hci_add_adv_monitor() net: tcp: fix unexcepted socket die when snd_wnd is 0 selftests/bpf: Fix repeat option when kfunc_call verification fails selftests/bpf: Clean up fmod_ret in bench_rename test script net-memcg: Fix scope of sockmem pressure indicators ice: ice_aq_check_events: fix off-by-one check when filling buffer crypto: caam - fix unchecked return value error hwrng: iproc-rng200 - Implement suspend and resume calls lwt: Fix return values of BPF xmit ops lwt: Check LWTUNNEL_XMIT_CONTINUE strictly fs: ocfs2: namei: check return value of ocfs2_add_entry() net: annotate data-races around sk->sk_lingertime wifi: mwifiex: fix memory leak in mwifiex_histogram_read() wifi: mwifiex: Fix missed return in oob checks failed path ARM: dts: Add .dts files missing from the build samples/bpf: fix bio latency check with tracepoint samples/bpf: fix broken map lookup probe wifi: ath9k: fix races between ath9k_wmi_cmd and ath9k_wmi_ctrl_rx wifi: ath9k: protect WMI command response buffer replacement with a lock wifi: nl80211/cfg80211: add forgotten nla_policy for BSS color attribute mac80211: make ieee80211_tx_info padding explicit wifi: mwifiex: avoid possible NULL skb pointer dereference Bluetooth: btusb: Do not call kfree_skb() under spin_lock_irqsave() arm64: mm: use ptep_clear() instead of pte_clear() in clear_flush() wifi: ath9k: use IS_ERR() with debugfs_create_dir() ice: avoid executing commands on other ports when driving sync net: arcnet: Do not call kfree_skb() under local_irq_disable() mlxsw: i2c: Fix chunk size setting in output mailbox buffer mlxsw: i2c: Limit single transaction buffer size mlxsw: core_hwmon: Adjust module label names based on MTCAP sensor counter hwmon: (tmp513) Fix the channel number in tmp51x_is_visible() octeontx2-pf: Refactor schedular queue alloc/free calls octeontx2-pf: Fix PFC TX scheduler free cteonxt2-pf: Fix backpressure config for multiple PFC priorities to work simultaneously sfc: Check firmware supports Ethernet PTP filter net/sched: sch_hfsc: Ensure inner classes have fsc curve netrom: Deny concurrent connect(). drm/bridge: tc358764: Fix debug print parameter order ASoC: cs43130: Fix numerator/denominator mixup quota: factor out dquot_write_dquot() quota: rename dquot_active() to inode_quota_active() quota: add new helper dquot_active() quota: fix dqput() to follow the guarantees dquot_srcu should provide drm/amd/display: Do not set drr on pipe commit drm/hyperv: Fix a compilation issue because of not including screen_info.h ASoC: stac9766: fix build errors with REGMAP_AC97 soc: qcom: ocmem: Add OCMEM hardware version print soc: qcom: ocmem: Fix NUM_PORTS & NUM_MACROS macros arm64: dts: qcom: sm6350: Fix ZAP region arm64: dts: qcom: sm8250: correct dynamic power coefficients arm64: dts: qcom: msm8916-l8150: correct light sensor VDDIO supply arm64: dts: qcom: sm8250-edo: Add gpio line names for TLMM arm64: dts: qcom: sm8250-edo: Add GPIO line names for PMIC GPIOs arm64: dts: qcom: sm8250-edo: Rectify gpio-keys arm64: dts: qcom: sc8280xp-crd: Correct vreg_misc_3p3 GPIO arm64: dts: qcom: sc8280xp: Add missing SCM interconnect arm64: dts: qcom: msm8996: Add missing interrupt to the USB2 controller arm64: dts: qcom: sdm845-tama: Set serial indices and stdout-path arm64: dts: qcom: sm8350: Fix CPU idle state residency times arm64: dts: qcom: sm8350: Add missing LMH interrupts to cpufreq arm64: dts: qcom: sm8350: Use proper CPU compatibles arm64: dts: qcom: pm8350: fix thermal zone name arm64: dts: qcom: pm8350b: fix thermal zone name arm64: dts: qcom: pmr735b: fix thermal zone name arm64: dts: qcom: pmk8350: fix ADC-TM compatible string arm64: dts: qcom: sm8250: Mark PCIe hosts as DMA coherent ARM: dts: stm32: Rename mdio0 to mdio ARM: dts: stm32: YAML validation fails for Argon Boards ARM: dts: stm32: adopt generic iio bindings for adc channels on emstamp-argon ARM: dts: stm32: Add missing detach mailbox for emtrion emSBC-Argon ARM: dts: stm32: YAML validation fails for Odyssey Boards ARM: dts: stm32: Add missing detach mailbox for Odyssey SoM ARM: dts: stm32: Update to generic ADC channel binding on DHSOM systems ARM: dts: stm32: Add missing detach mailbox for DHCOM SoM firmware: ti_sci: Use system_state to determine polling drm/amdgpu: avoid integer overflow warning in amdgpu_device_resize_fb_bar() ARM: dts: BCM53573: Drop nonexistent #usb-cells ARM: dts: BCM53573: Add cells sizes to PCIe node ARM: dts: BCM53573: Use updated "spi-gpio" binding properties arm64: tegra: Fix HSUART for Jetson AGX Orin arm64: dts: qcom: sm8250-sony-xperia: correct GPIO keys wakeup again arm64: dts: qcom: pm6150l: Add missing short interrupt arm64: dts: qcom: pm660l: Add missing short interrupt arm64: dts: qcom: pmi8994: Add missing OVP interrupt arm64: tegra: Fix HSUART for Smaug drm/etnaviv: fix dumping of active MMU context block: cleanup queue_wc_store block: don't allow enabling a cache on devices that don't support it x86/mm: Fix PAT bit missing from page protection modify mask drm/bridge: anx7625: Use common macros for DP power sequencing commands drm/bridge: anx7625: Use common macros for HDCP capabilities ARM: dts: samsung: s3c6410-mini6410: correct ethernet reg addresses (split) ARM: dts: s5pv210: add dummy 5V regulator for backlight on SMDKv210 ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split) drm: adv7511: Fix low refresh rate register for ADV7533/5 ARM: dts: BCM53573: Fix Ethernet info for Luxul devices arm64: dts: qcom: sdm845: Add missing RPMh power domain to GCC arm64: dts: qcom: sdm845: Fix the min frequency of "ice_core_clk" arm64: dts: qcom: msm8996-gemini: fix touchscreen VIO supply drm/amdgpu: Update min() to min_t() in 'amdgpu_info_ioctl' md: Factor out is_md_suspended helper md: Change active_io to percpu md: restore 'noio_flag' for the last mddev_resume() md/raid10: factor out dereference_rdev_and_rrdev() md/raid10: use dereference_rdev_and_rrdev() to get devices md/md-bitmap: remove unnecessary local variable in backlog_store() md/md-bitmap: hold 'reconfig_mutex' in backlog_store() drm/msm: Update dev core dump to not print backwards drm/tegra: dpaux: Fix incorrect return value of platform_get_irq of: unittest: fix null pointer dereferencing in of_unittest_find_node_by_name() arm64: dts: qcom: sm8150: Fix the I2C7 interrupt ARM: dts: BCM53573: Fix Tenda AC9 switch CPU port drm/armada: Fix off-by-one error in armada_overlay_get_property() drm/repaper: Reduce temporary buffer size in repaper_fb_dirty() drm/panel: simple: Add missing connector type and pixel format for AUO T215HVN01 ima: Remove deprecated IMA_TRUSTED_KEYRING Kconfig drm: xlnx: zynqmp_dpsub: Add missing check for dma_set_mask soc: qcom: smem: Fix incompatible types in comparison drm/msm/mdp5: Don't leak some plane state firmware: meson_sm: fix to avoid potential NULL pointer dereference drm/msm/dpu: fix the irq index in dpu_encoder_phys_wb_wait_for_commit_done smackfs: Prevent underflow in smk_set_cipso() drm/amd/pm: fix variable dereferenced issue in amdgpu_device_attr_create() drm/msm/a2xx: Call adreno_gpu_init() earlier audit: fix possible soft lockup in __audit_inode_child() block/mq-deadline: use correct way to throttling write requests io_uring: fix drain stalls by invalid SQE drm/mediatek: dp: Add missing error checks in mtk_dp_parse_capabilities bus: ti-sysc: Fix build warning for 64-bit build drm/mediatek: Remove freeing not dynamic allocated memory ARM: dts: qcom: ipq4019: correct SDHCI XO clock drm/mediatek: Fix potential memory leak if vmap() fail arm64: dts: qcom: apq8016-sbc: Fix ov5640 regulator supply names arm64: dts: qcom: msm8998: Drop bus clock reference from MMSS SMMU arm64: dts: qcom: msm8998: Add missing power domain to MMSS SMMU arm64: dts: qcom: msm8996: Fix dsi1 interrupts arm64: dts: qcom: sc8280xp-x13s: Unreserve NC pins bus: ti-sysc: Fix cast to enum warning md/raid5-cache: fix a deadlock in r5l_exit_log() md/raid5-cache: fix null-ptr-deref for r5l_flush_stripe_to_raid() firmware: cs_dsp: Fix new control name check md: add error_handlers for raid0 and linear md/raid0: Factor out helper for mapping and submitting a bio md/raid0: Fix performance regression for large sequential writes md: raid0: account for split bio in iostat accounting ASoC: SOF: amd: clear dsp to host interrupt status of: overlay: Call of_changeset_init() early of: unittest: Fix overlay type in apply/revert check ALSA: ac97: Fix possible error value of *rac97 ipmi:ssif: Add check for kstrdup ipmi:ssif: Fix a memory leak when scanning for an adapter clk: qcom: gpucc-sm6350: Introduce index-based clk lookup clk: qcom: gpucc-sm6350: Fix clock source names clk: qcom: gcc-sc8280xp: Add EMAC GDSCs clk: qcom: gcc-sc8280xp: Add missing GDSC flags dt-bindings: clock: qcom,gcc-sc8280xp: Add missing GDSCs clk: qcom: gcc-sc8280xp: Add missing GDSCs clk: rockchip: rk3568: Fix PLL rate setting for 78.75MHz PCI: apple: Initialize pcie->nvecs before use PCI: qcom-ep: Switch MHI bus master clock off during L1SS drivers: clk: keystone: Fix parameter judgment in _of_pll_clk_init() PCI/DOE: Fix destroy_work_on_stack() race clk: sunxi-ng: Modify mismatched function name clk: qcom: gcc-sc7180: Fix up gcc_sdcc2_apps_clk_src EDAC/igen6: Fix the issue of no error events ext4: correct grp validation in ext4_mb_good_group ext4: avoid potential data overflow in next_linear_group clk: qcom: gcc-sm8250: Fix gcc_sdcc2_apps_clk_src kvm/vfio: Prepare for accepting vfio device fd kvm/vfio: ensure kvg instance stays around in kvm_vfio_group_add() clk: qcom: reset: Use the correct type of sleep/delay based on length clk: qcom: gcc-sm6350: Fix gcc_sdcc2_apps_clk_src PCI: microchip: Correct the DED and SEC interrupt bit offsets PCI: Mark NVIDIA T4 GPUs to avoid bus reset pinctrl: mcp23s08: check return value of devm_kasprintf() PCI: Allow drivers to request exclusive config regions PCI: Add locking to RMW PCI Express Capability Register accessors PCI: pciehp: Use RMW accessors for changing LNKCTL PCI/ASPM: Use RMW accessors for changing LNKCTL clk: qcom: gcc-sm8450: Use floor ops for SDCC RCGs clk: imx: pllv4: Fix SPLL2 MULT range clk: imx: imx8ulp: update SPLL2 type clk: imx8mp: fix sai4 clock clk: imx: composite-8m: fix clock pauses when set_rate would be a no-op powerpc/radix: Move some functions into #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE vfio/type1: fix cap_migration information leak nvdimm: Fix memleak of pmu attr_groups in unregister_nvdimm_pmu() nvdimm: Fix dereference after free in register_nvdimm_pmu() powerpc/fadump: reset dump area size if fadump memory reserve fails powerpc/perf: Convert fsl_emb notifier to state machine callbacks drm/amdgpu: Use RMW accessors for changing LNKCTL drm/radeon: Use RMW accessors for changing LNKCTL net/mlx5: Use RMW accessors for changing LNKCTL wifi: ath11k: Use RMW accessors for changing LNKCTL wifi: ath10k: Use RMW accessors for changing LNKCTL NFSv4.2: Rework scratch handling for READ_PLUS NFSv4.2: Fix READ_PLUS smatch warnings NFSv4.2: Fix up READ_PLUS alignment NFSv4.2: Fix READ_PLUS size calculations powerpc: Don't include lppaca.h in paca.h powerpc/pseries: Rework lppaca_shared_proc() to avoid DEBUG_PREEMPT nfs/blocklayout: Use the passed in gfp flags powerpc/pseries: Fix hcall tracepoints with JUMP_LABEL=n powerpc/mpc5xxx: Add missing fwnode_handle_put() powerpc/iommu: Fix notifiers being shared by PCI and VIO buses ext4: fix unttached inode after power cut with orphan file feature enabled jfs: validate max amount of blocks before allocation. fs: lockd: avoid possible wrong NULL parameter NFSD: da_addr_body field missing in some GETDEVICEINFO replies NFS: Guard against READDIR loop when entry names exceed MAXNAMELEN NFSv4.2: fix handling of COPY ERR_OFFLOAD_NO_REQ pNFS: Fix assignment of xprtdata.cred cgroup/cpuset: Inherit parent's load balance state in v2 RDMA/qedr: Remove a duplicate assignment in irdma_query_ah() media: ov5640: fix low resolution image abnormal issue media: ad5820: Drop unsupported ad5823 from i2c_ and of_device_id tables media: i2c: tvp5150: check return value of devm_kasprintf() media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link() iommu/amd/iommu_v2: Fix pasid_state refcount dec hit 0 warning on pasid unbind iommu: rockchip: Fix directory table address encoding drivers: usb: smsusb: fix error handling code in smsusb_init_device media: dib7000p: Fix potential division by zero media: dvb-usb: m920x: Fix a potential memory leak in m920x_i2c_xfer() media: cx24120: Add retval check for cx24120_message_send() RDMA/siw: Fabricate a GID on tun and loopback devices scsi: hisi_sas: Fix warnings detected by sparse scsi: hisi_sas: Fix normally completed I/O analysed as failed dt-bindings: extcon: maxim,max77843: restrict connector properties media: amphion: reinit vpu if reqbufs output 0 media: amphion: add helper function to get id name media: mtk-jpeg: Fix use after free bug due to uncanceled work media: rkvdec: increase max supported height for H.264 media: amphion: fix CHECKED_RETURN issues reported by coverity media: amphion: fix REVERSE_INULL issues reported by coverity media: amphion: fix UNINIT issues reported by coverity media: amphion: fix UNUSED_VALUE issue reported by coverity media: amphion: ensure the bitops don't cross boundaries media: mediatek: vcodec: Return NULL if no vdec_fb is found media: mediatek: vcodec: fix potential double free media: mediatek: vcodec: fix resource leaks in vdec_msg_queue_init() usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host() scsi: RDMA/srp: Fix residual handling scsi: iscsi: Rename iscsi_set_param() to iscsi_if_set_param() scsi: iscsi: Add length check for nlattr payload scsi: iscsi: Add strlen() check in iscsi_if_set{_host}_param() scsi: be2iscsi: Add length check when parsing nlattrs scsi: qla4xxx: Add length check when parsing nlattrs iio: accel: adxl313: Fix adxl313_i2c_id[] table serial: sprd: Assign sprd_port after initialized to avoid wrong access serial: sprd: Fix DMA buffer leak issue x86/APM: drop the duplicate APM_MINOR_DEV macro RDMA/rxe: Split rxe_run_task() into two subroutines RDMA/rxe: Fix incomplete state save in rxe_requester scsi: qedf: Do not touch __user pointer in qedf_dbg_stop_io_on_error_cmd_read() directly scsi: qedf: Do not touch __user pointer in qedf_dbg_debug_cmd_read() directly scsi: qedf: Do not touch __user pointer in qedf_dbg_fp_int_cmd_read() directly RDMA/irdma: Replace one-element array with flexible-array member coresight: tmc: Explicit type conversions to prevent integer overflow interconnect: qcom: qcm2290: Enable sync state dma-buf/sync_file: Fix docs syntax driver core: test_async: fix an error code driver core: Call dma_cleanup() on the test_remove path kernfs: add stub helper for kernfs_generic_poll() extcon: cht_wc: add POWER_SUPPLY dependency iommu/mediatek: Remove unused "mapping" member from mtk_iommu_data iommu/mediatek: Fix two IOMMU share pagetable issue iommu/sprd: Add missing force_aperture RDMA/hns: Fix port active speed RDMA/hns: Fix incorrect post-send with direct wqe of wr-list RDMA/hns: Fix inaccurate error label name in init instance RDMA/hns: Fix CQ and QP cache affinity IB/uverbs: Fix an potential error pointer dereference fsi: aspeed: Reset master errors after CFAM reset iommu/qcom: Disable and reset context bank before programming iommu/vt-d: Fix to flush cache of PASID directory table platform/x86: dell-sysman: Fix reference leak media: cec: core: add adap_nb_transmit_canceled() callback media: cec: core: add adap_unconfigured() callback media: go7007: Remove redundant if statement media: venus: hfi_venus: Only consider sys_idle_indicator on V1 docs: ABI: fix spelling/grammar in SBEFIFO timeout interface USB: gadget: core: Add missing kerneldoc for vbus_work USB: gadget: f_mass_storage: Fix unused variable warning drivers: base: Free devm resources when unregistering a device HID: input: Support devices sending Eraser without Invert media: ov5640: Enable MIPI interface in ov5640_set_power_mipi() media: ov5640: Fix initial RESETB state and annotate timings media: i2c: ov2680: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flips media: ov2680: Remove auto-gain and auto-exposure controls media: ov2680: Fix ov2680_bayer_order() media: ov2680: Fix vflip / hflip set functions media: ov2680: Remove VIDEO_V4L2_SUBDEV_API ifdef-s media: ov2680: Don't take the lock for try_fmt calls media: ov2680: Add ov2680_fill_format() helper function media: ov2680: Fix ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY not working media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors media: i2c: rdacm21: Fix uninitialized value f2fs: fix to avoid mmap vs set_compress_option case f2fs: judge whether discard_unit is section only when have CONFIG_BLK_DEV_ZONED f2fs: Only lfs mode is allowed with zoned block device feature Revert "f2fs: fix to do sanity check on extent cache correctly" cgroup:namespace: Remove unused cgroup_namespaces_init() coresight: trbe: Fix TRBE potential sleep in atomic context RDMA/irdma: Prevent zero-length STAG registration scsi: core: Use 32-bit hostnum in scsi_host_lookup() scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock interconnect: qcom: sm8450: Enable sync_state interconnect: qcom: bcm-voter: Improve enable_mask handling interconnect: qcom: bcm-voter: Use enable_maks for keepalive voting serial: tegra: handle clk prepare error in tegra_uart_hw_init() amba: bus: fix refcount leak Revert "IB/isert: Fix incorrect release of isert connection" RDMA/siw: Balance the reference of cep->kref in the error path RDMA/siw: Correct wrong debug message RDMA/efa: Fix wrong resources deallocation order HID: logitech-dj: Fix error handling in logi_dj_recv_switch_to_dj_mode() HID: uclogic: Correct devm device reference for hidinput input_dev name HID: multitouch: Correct devm device reference for hidinput input_dev name platform/x86/amd/pmf: Fix a missing cleanup path tick/rcu: Fix false positive "softirq work is pending" messages x86/speculation: Mark all Skylake CPUs as vulnerable to GDS tracing: Remove extra space at the end of hwlat_detector/mode tracing: Fix race issue between cpu buffer write and swap mtd: rawnand: brcmnand: Fix mtd oobsize dmaengine: idxd: Modify the dependence of attribute pasid_enabled phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328 phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write rpmsg: glink: Add check for kstrdup leds: pwm: Fix error code in led_pwm_create_fwnode() leds: multicolor: Use rounded division when calculating color components leds: Fix BUG_ON check for LED_COLOR_ID_MULTI that is always false leds: trigger: tty: Do not use LED_ON/OFF constants, use led_blink_set_oneshot instead mtd: spi-nor: Check bus width while setting QE bit mtd: rawnand: fsmc: handle clk prepare error in fsmc_nand_resume() um: Fix hostaudio build errors dmaengine: ste_dma40: Add missing IRQ check in d40_probe Drivers: hv: vmbus: Don't dereference ACPI root object handle cpufreq: Fix the race condition while updating the transition_task of policy virtio_ring: fix avail_wrap_counter in virtqueue_add_packed igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c netfilter: nft_exthdr: Fix non-linear header modification netfilter: xt_u32: validate user space input netfilter: xt_sctp: validate the flag_info count skbuff: skb_segment, Call zero copy functions before using skbuff frags igb: set max size RX buffer when store bad packet is enabled PM / devfreq: Fix leak in devfreq_dev_release() ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl rcu: dump vmalloc memory info safely printk: ringbuffer: Fix truncating buffer size min_t cast scsi: core: Fix the scsi_set_resid() documentation mm/vmalloc: add a safer version of find_vm_area() for debug cpu/hotplug: Prevent self deadlock on CPU hot-unplug media: i2c: ccs: Check rules is non-NULL media: i2c: Add a camera sensor top level menu PCI: rockchip: Use 64-bit mask on MSI 64-bit PCI address ipmi_si: fix a memleak in try_smi_init() ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch() XArray: Do not return sibling entries from xa_load() io_uring: break iopolling on signal backlight/gpio_backlight: Compare against struct fb_info.device backlight/bd6107: Compare against struct fb_info.device backlight/lv5207lp: Compare against struct fb_info.device drm/amd/display: register edp_backlight_control() for DCN301 xtensa: PMU: fix base address for the newer hardware LoongArch: mm: Add p?d_leaf() definitions i3c: master: svc: fix probe failure when no i3c device exist arm64: csum: Fix OoB access in IP checksum code for negative lengths ALSA: hda/cirrus: Fix broken audio on hardware with two CS42L42 codecs. media: dvb: symbol fixup for dvb_attach() media: venus: hfi_venus: Write to VIDC_CTRL_INIT after unmasking interrupts Revert "scsi: qla2xxx: Fix buffer overrun" scsi: mpt3sas: Perform additional retries if doorbell read returns 0 PCI: Free released resource after coalescing PCI: hv: Fix a crash in hv_pci_restore_msi_msg() during hibernation PCI/PM: Only read PCI_PM_CTRL register when available ntb: Drop packets when qp link is down ntb: Clean up tx tail index on link down ntb: Fix calculation ntb_transport_tx_free_entry() Revert "PCI: Mark NVIDIA T4 GPUs to avoid bus reset" block: don't add or resize partition on the disk with GENHD_FL_NO_PART procfs: block chmod on /proc/thread-self/comm parisc: Fix /proc/cpuinfo output for lscpu drm/amd/display: Add smu write msg id fail retry process bpf: Fix issue in verifying allow_ptr_leaks dlm: fix plock lookup when using multiple lockspaces dccp: Fix out of bounds access in DCCP error handler x86/sev: Make enc_dec_hypercall() accept a size instead of npages r8169: fix ASPM-related issues on a number of systems with NIC version from RTL8168h X.509: if signature is unsupported skip validation net: handle ARPHRD_PPP in dev_is_mac_header_xmit() fsverity: skip PKCS#7 parser when keyring is empty x86/MCE: Always save CS register on AMD Zen IF Poison errors platform/chrome: chromeos_acpi: print hex string for ACPI_TYPE_BUFFER mmc: renesas_sdhi: register irqs before registering controller pstore/ram: Check start of empty przs during init arm64: sdei: abort running SDEI handlers during crash s390/dcssblk: fix kernel crash with list_add corruption s390/ipl: add missing secure/has_secure file to ipl type 'unknown' s390/dasd: fix string length handling crypto: stm32 - fix loop iterating through scatterlist for DMA cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug of: property: fw_devlink: Add a devlink for panel followers usb: typec: tcpm: set initial svdm version based on pd revision usb: typec: bus: verify partner exists in typec_altmode_attention USB: core: Unite old scheme and new scheme descriptor reads USB: core: Change usb_get_device_descriptor() API USB: core: Fix race by not overwriting udev->descriptor in hub_port_init() USB: core: Fix oversight in SuperSpeed initialization x86/sgx: Break up long non-preemptible delays in sgx_vepc_release() perf/x86/uncore: Correct the number of CHAs on EMR serial: sc16is7xx: remove obsolete out_thread label serial: sc16is7xx: fix regression with GPIO configuration tracing: Zero the pipe cpumask on alloc to avoid spurious -EBUSY Revert "drm/amd/display: Do not set drr on pipe commit" md: Free resources in __md_stop NFSv4.2: Fix a potential double free with READ_PLUS NFSv4.2: Rework scratch handling for READ_PLUS (again) md: fix regression for null-ptr-deference in __md_stop() clk: Mark a fwnode as initialized when using CLK_OF_DECLARE() macro treewide: Fix probing of devices in DT overlays clk: Avoid invalid function names in CLK_OF_DECLARE() udf: initialize newblock to 0 Linux 6.1.53 Change-Id: I6f5858bce0f20963ae42515eac36ac14cb686f24 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
1118 lines
25 KiB
C
1118 lines
25 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* SMP initialisation and IPI support
|
|
* Based on arch/arm/kernel/smp.c
|
|
*
|
|
* Copyright (C) 2012 ARM Ltd.
|
|
*/
|
|
|
|
#include <linux/acpi.h>
|
|
#include <linux/arm_sdei.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/init.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/sched/mm.h>
|
|
#include <linux/sched/hotplug.h>
|
|
#include <linux/sched/task_stack.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/cache.h>
|
|
#include <linux/profile.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/err.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/seq_file.h>
|
|
#include <linux/irq.h>
|
|
#include <linux/irqchip/arm-gic-v3.h>
|
|
#include <linux/percpu.h>
|
|
#include <linux/clockchips.h>
|
|
#include <linux/completion.h>
|
|
#include <linux/of.h>
|
|
#include <linux/irq_work.h>
|
|
#include <linux/kernel_stat.h>
|
|
#include <linux/kexec.h>
|
|
#include <linux/kvm_host.h>
|
|
|
|
#include <asm/alternative.h>
|
|
#include <asm/atomic.h>
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/cpu.h>
|
|
#include <asm/cputype.h>
|
|
#include <asm/cpu_ops.h>
|
|
#include <asm/daifflags.h>
|
|
#include <asm/kvm_mmu.h>
|
|
#include <asm/mmu_context.h>
|
|
#include <asm/numa.h>
|
|
#include <asm/processor.h>
|
|
#include <asm/smp_plat.h>
|
|
#include <asm/sections.h>
|
|
#include <asm/tlbflush.h>
|
|
#include <asm/ptrace.h>
|
|
#include <asm/virt.h>
|
|
|
|
#define CREATE_TRACE_POINTS
|
|
#include <trace/events/ipi.h>
|
|
#undef CREATE_TRACE_POINTS
|
|
#include <trace/hooks/debug.h>
|
|
|
|
DEFINE_PER_CPU_READ_MOSTLY(int, cpu_number);
|
|
EXPORT_PER_CPU_SYMBOL(cpu_number);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(ipi_raise);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(ipi_entry);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(ipi_exit);
|
|
|
|
/*
|
|
* as from 2.5, kernels no longer have an init_tasks structure
|
|
* so we need some other way of telling a new secondary core
|
|
* where to place its SVC stack
|
|
*/
|
|
struct secondary_data secondary_data;
|
|
/* Number of CPUs which aren't online, but looping in kernel text. */
|
|
static int cpus_stuck_in_kernel;
|
|
|
|
enum ipi_msg_type {
|
|
IPI_RESCHEDULE,
|
|
IPI_CALL_FUNC,
|
|
IPI_CPU_STOP,
|
|
IPI_CPU_CRASH_STOP,
|
|
IPI_TIMER,
|
|
IPI_IRQ_WORK,
|
|
IPI_WAKEUP,
|
|
NR_IPI
|
|
};
|
|
|
|
static int ipi_irq_base __read_mostly;
|
|
static int nr_ipi __read_mostly = NR_IPI;
|
|
static struct irq_desc *ipi_desc[NR_IPI] __read_mostly;
|
|
|
|
static void ipi_setup(int cpu);
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
static void ipi_teardown(int cpu);
|
|
static int op_cpu_kill(unsigned int cpu);
|
|
#else
|
|
static inline int op_cpu_kill(unsigned int cpu)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
#endif
|
|
|
|
|
|
/*
|
|
* Boot a secondary CPU, and assign it the specified idle task.
|
|
* This also gives us the initial stack to use for this CPU.
|
|
*/
|
|
static int boot_secondary(unsigned int cpu, struct task_struct *idle)
|
|
{
|
|
const struct cpu_operations *ops = get_cpu_ops(cpu);
|
|
|
|
if (ops->cpu_boot)
|
|
return ops->cpu_boot(cpu);
|
|
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static DECLARE_COMPLETION(cpu_running);
|
|
|
|
int __cpu_up(unsigned int cpu, struct task_struct *idle)
|
|
{
|
|
int ret;
|
|
long status;
|
|
|
|
/*
|
|
* We need to tell the secondary core where to find its stack and the
|
|
* page tables.
|
|
*/
|
|
secondary_data.task = idle;
|
|
update_cpu_boot_status(CPU_MMU_OFF);
|
|
|
|
/* Now bring the CPU into our world */
|
|
ret = boot_secondary(cpu, idle);
|
|
if (ret) {
|
|
pr_err("CPU%u: failed to boot: %d\n", cpu, ret);
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* CPU was successfully started, wait for it to come online or
|
|
* time out.
|
|
*/
|
|
wait_for_completion_timeout(&cpu_running,
|
|
msecs_to_jiffies(5000));
|
|
if (cpu_online(cpu))
|
|
return 0;
|
|
|
|
pr_crit("CPU%u: failed to come online\n", cpu);
|
|
secondary_data.task = NULL;
|
|
status = READ_ONCE(secondary_data.status);
|
|
if (status == CPU_MMU_OFF)
|
|
status = READ_ONCE(__early_cpu_boot_status);
|
|
|
|
switch (status & CPU_BOOT_STATUS_MASK) {
|
|
default:
|
|
pr_err("CPU%u: failed in unknown state : 0x%lx\n",
|
|
cpu, status);
|
|
cpus_stuck_in_kernel++;
|
|
break;
|
|
case CPU_KILL_ME:
|
|
if (!op_cpu_kill(cpu)) {
|
|
pr_crit("CPU%u: died during early boot\n", cpu);
|
|
break;
|
|
}
|
|
pr_crit("CPU%u: may not have shut down cleanly\n", cpu);
|
|
fallthrough;
|
|
case CPU_STUCK_IN_KERNEL:
|
|
pr_crit("CPU%u: is stuck in kernel\n", cpu);
|
|
if (status & CPU_STUCK_REASON_52_BIT_VA)
|
|
pr_crit("CPU%u: does not support 52-bit VAs\n", cpu);
|
|
if (status & CPU_STUCK_REASON_NO_GRAN) {
|
|
pr_crit("CPU%u: does not support %luK granule\n",
|
|
cpu, PAGE_SIZE / SZ_1K);
|
|
}
|
|
cpus_stuck_in_kernel++;
|
|
break;
|
|
case CPU_PANIC_KERNEL:
|
|
panic("CPU%u detected unsupported configuration\n", cpu);
|
|
}
|
|
|
|
return -EIO;
|
|
}
|
|
|
|
static void init_gic_priority_masking(void)
|
|
{
|
|
u32 cpuflags;
|
|
|
|
if (WARN_ON(!gic_enable_sre()))
|
|
return;
|
|
|
|
cpuflags = read_sysreg(daif);
|
|
|
|
WARN_ON(!(cpuflags & PSR_I_BIT));
|
|
WARN_ON(!(cpuflags & PSR_F_BIT));
|
|
|
|
gic_write_pmr(GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET);
|
|
}
|
|
|
|
/*
|
|
* This is the secondary CPU boot entry. We're using this CPUs
|
|
* idle thread stack, but a set of temporary page tables.
|
|
*/
|
|
asmlinkage notrace void secondary_start_kernel(void)
|
|
{
|
|
u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
|
|
struct mm_struct *mm = &init_mm;
|
|
const struct cpu_operations *ops;
|
|
unsigned int cpu = smp_processor_id();
|
|
|
|
/*
|
|
* All kernel threads share the same mm context; grab a
|
|
* reference and switch to it.
|
|
*/
|
|
mmgrab(mm);
|
|
current->active_mm = mm;
|
|
|
|
/*
|
|
* TTBR0 is only used for the identity mapping at this stage. Make it
|
|
* point to zero page to avoid speculatively fetching new entries.
|
|
*/
|
|
cpu_uninstall_idmap();
|
|
|
|
if (system_uses_irq_prio_masking())
|
|
init_gic_priority_masking();
|
|
|
|
rcu_cpu_starting(cpu);
|
|
trace_hardirqs_off();
|
|
|
|
/*
|
|
* If the system has established the capabilities, make sure
|
|
* this CPU ticks all of those. If it doesn't, the CPU will
|
|
* fail to come online.
|
|
*/
|
|
check_local_cpu_capabilities();
|
|
|
|
ops = get_cpu_ops(cpu);
|
|
if (ops->cpu_postboot)
|
|
ops->cpu_postboot();
|
|
|
|
/*
|
|
* Log the CPU info before it is marked online and might get read.
|
|
*/
|
|
cpuinfo_store_cpu();
|
|
store_cpu_topology(cpu);
|
|
|
|
/*
|
|
* Enable GIC and timers.
|
|
*/
|
|
notify_cpu_starting(cpu);
|
|
|
|
ipi_setup(cpu);
|
|
|
|
numa_add_cpu(cpu);
|
|
|
|
/*
|
|
* OK, now it's safe to let the boot CPU continue. Wait for
|
|
* the CPU migration code to notice that the CPU is online
|
|
* before we continue.
|
|
*/
|
|
pr_info("CPU%u: Booted secondary processor 0x%010lx [0x%08x]\n",
|
|
cpu, (unsigned long)mpidr,
|
|
read_cpuid_id());
|
|
update_cpu_boot_status(CPU_BOOT_SUCCESS);
|
|
set_cpu_online(cpu, true);
|
|
complete(&cpu_running);
|
|
|
|
local_daif_restore(DAIF_PROCCTX);
|
|
|
|
/*
|
|
* OK, it's off to the idle thread for us
|
|
*/
|
|
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
|
|
}
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
static int op_cpu_disable(unsigned int cpu)
|
|
{
|
|
const struct cpu_operations *ops = get_cpu_ops(cpu);
|
|
|
|
/*
|
|
* If we don't have a cpu_die method, abort before we reach the point
|
|
* of no return. CPU0 may not have an cpu_ops, so test for it.
|
|
*/
|
|
if (!ops || !ops->cpu_die)
|
|
return -EOPNOTSUPP;
|
|
|
|
/*
|
|
* We may need to abort a hot unplug for some other mechanism-specific
|
|
* reason.
|
|
*/
|
|
if (ops->cpu_disable)
|
|
return ops->cpu_disable(cpu);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* __cpu_disable runs on the processor to be shutdown.
|
|
*/
|
|
int __cpu_disable(void)
|
|
{
|
|
unsigned int cpu = smp_processor_id();
|
|
int ret;
|
|
|
|
ret = op_cpu_disable(cpu);
|
|
if (ret)
|
|
return ret;
|
|
|
|
remove_cpu_topology(cpu);
|
|
numa_remove_cpu(cpu);
|
|
|
|
/*
|
|
* Take this CPU offline. Once we clear this, we can't return,
|
|
* and we must not schedule until we're ready to give up the cpu.
|
|
*/
|
|
set_cpu_online(cpu, false);
|
|
ipi_teardown(cpu);
|
|
|
|
/*
|
|
* OK - migrate IRQs away from this CPU
|
|
*/
|
|
irq_migrate_all_off_this_cpu();
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int op_cpu_kill(unsigned int cpu)
|
|
{
|
|
const struct cpu_operations *ops = get_cpu_ops(cpu);
|
|
|
|
/*
|
|
* If we have no means of synchronising with the dying CPU, then assume
|
|
* that it is really dead. We can only wait for an arbitrary length of
|
|
* time and hope that it's dead, so let's skip the wait and just hope.
|
|
*/
|
|
if (!ops->cpu_kill)
|
|
return 0;
|
|
|
|
return ops->cpu_kill(cpu);
|
|
}
|
|
|
|
/*
|
|
* called on the thread which is asking for a CPU to be shutdown -
|
|
* waits until shutdown has completed, or it is timed out.
|
|
*/
|
|
void __cpu_die(unsigned int cpu)
|
|
{
|
|
int err;
|
|
|
|
if (!cpu_wait_death(cpu, 5)) {
|
|
pr_crit("CPU%u: cpu didn't die\n", cpu);
|
|
return;
|
|
}
|
|
pr_debug("CPU%u: shutdown\n", cpu);
|
|
|
|
/*
|
|
* Now that the dying CPU is beyond the point of no return w.r.t.
|
|
* in-kernel synchronisation, try to get the firwmare to help us to
|
|
* verify that it has really left the kernel before we consider
|
|
* clobbering anything it might still be using.
|
|
*/
|
|
err = op_cpu_kill(cpu);
|
|
if (err)
|
|
pr_warn("CPU%d may not have shut down cleanly: %d\n", cpu, err);
|
|
}
|
|
|
|
/*
|
|
* Called from the idle thread for the CPU which has been shutdown.
|
|
*
|
|
*/
|
|
void cpu_die(void)
|
|
{
|
|
unsigned int cpu = smp_processor_id();
|
|
const struct cpu_operations *ops = get_cpu_ops(cpu);
|
|
|
|
idle_task_exit();
|
|
|
|
local_daif_mask();
|
|
|
|
/* Tell __cpu_die() that this CPU is now safe to dispose of */
|
|
(void)cpu_report_death();
|
|
|
|
/*
|
|
* Actually shutdown the CPU. This must never fail. The specific hotplug
|
|
* mechanism must perform all required cache maintenance to ensure that
|
|
* no dirty lines are lost in the process of shutting down the CPU.
|
|
*/
|
|
ops->cpu_die(cpu);
|
|
|
|
BUG();
|
|
}
|
|
#endif
|
|
|
|
static void __cpu_try_die(int cpu)
|
|
{
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
const struct cpu_operations *ops = get_cpu_ops(cpu);
|
|
|
|
if (ops && ops->cpu_die)
|
|
ops->cpu_die(cpu);
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* Kill the calling secondary CPU, early in bringup before it is turned
|
|
* online.
|
|
*/
|
|
void cpu_die_early(void)
|
|
{
|
|
int cpu = smp_processor_id();
|
|
|
|
pr_crit("CPU%d: will not boot\n", cpu);
|
|
|
|
/* Mark this CPU absent */
|
|
set_cpu_present(cpu, 0);
|
|
rcu_report_dead(cpu);
|
|
|
|
if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) {
|
|
update_cpu_boot_status(CPU_KILL_ME);
|
|
__cpu_try_die(cpu);
|
|
}
|
|
|
|
update_cpu_boot_status(CPU_STUCK_IN_KERNEL);
|
|
|
|
cpu_park_loop();
|
|
}
|
|
|
|
static void __init hyp_mode_check(void)
|
|
{
|
|
if (is_hyp_mode_available())
|
|
pr_info("CPU: All CPU(s) started at EL2\n");
|
|
else if (is_hyp_mode_mismatched())
|
|
WARN_TAINT(1, TAINT_CPU_OUT_OF_SPEC,
|
|
"CPU: CPUs started in inconsistent modes");
|
|
else
|
|
pr_info("CPU: All CPU(s) started at EL1\n");
|
|
if (IS_ENABLED(CONFIG_KVM) && !is_kernel_in_hyp_mode()) {
|
|
kvm_compute_layout();
|
|
kvm_apply_hyp_relocations();
|
|
}
|
|
}
|
|
|
|
void __init smp_cpus_done(unsigned int max_cpus)
|
|
{
|
|
pr_info("SMP: Total of %d processors activated.\n", num_online_cpus());
|
|
setup_cpu_features();
|
|
hyp_mode_check();
|
|
apply_alternatives_all();
|
|
mark_linear_text_alias_ro();
|
|
}
|
|
|
|
void __init smp_prepare_boot_cpu(void)
|
|
{
|
|
/*
|
|
* The runtime per-cpu areas have been allocated by
|
|
* setup_per_cpu_areas(), and CPU0's boot time per-cpu area will be
|
|
* freed shortly, so we must move over to the runtime per-cpu area.
|
|
*/
|
|
set_my_cpu_offset(per_cpu_offset(smp_processor_id()));
|
|
cpuinfo_store_boot_cpu();
|
|
|
|
/*
|
|
* We now know enough about the boot CPU to apply the
|
|
* alternatives that cannot wait until interrupt handling
|
|
* and/or scheduling is enabled.
|
|
*/
|
|
apply_boot_alternatives();
|
|
|
|
/* Conditionally switch to GIC PMR for interrupt masking */
|
|
if (system_uses_irq_prio_masking())
|
|
init_gic_priority_masking();
|
|
|
|
kasan_init_hw_tags();
|
|
}
|
|
|
|
/*
|
|
* Duplicate MPIDRs are a recipe for disaster. Scan all initialized
|
|
* entries and check for duplicates. If any is found just ignore the
|
|
* cpu. cpu_logical_map was initialized to INVALID_HWID to avoid
|
|
* matching valid MPIDR values.
|
|
*/
|
|
static bool __init is_mpidr_duplicate(unsigned int cpu, u64 hwid)
|
|
{
|
|
unsigned int i;
|
|
|
|
for (i = 1; (i < cpu) && (i < NR_CPUS); i++)
|
|
if (cpu_logical_map(i) == hwid)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
* Initialize cpu operations for a logical cpu and
|
|
* set it in the possible mask on success
|
|
*/
|
|
static int __init smp_cpu_setup(int cpu)
|
|
{
|
|
const struct cpu_operations *ops;
|
|
|
|
if (init_cpu_ops(cpu))
|
|
return -ENODEV;
|
|
|
|
ops = get_cpu_ops(cpu);
|
|
if (ops->cpu_init(cpu))
|
|
return -ENODEV;
|
|
|
|
set_cpu_possible(cpu, true);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static bool bootcpu_valid __initdata;
|
|
static unsigned int cpu_count = 1;
|
|
|
|
#ifdef CONFIG_ACPI
|
|
static struct acpi_madt_generic_interrupt cpu_madt_gicc[NR_CPUS];
|
|
|
|
struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu)
|
|
{
|
|
return &cpu_madt_gicc[cpu];
|
|
}
|
|
EXPORT_SYMBOL_GPL(acpi_cpu_get_madt_gicc);
|
|
|
|
/*
|
|
* acpi_map_gic_cpu_interface - parse processor MADT entry
|
|
*
|
|
* Carry out sanity checks on MADT processor entry and initialize
|
|
* cpu_logical_map on success
|
|
*/
|
|
static void __init
|
|
acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor)
|
|
{
|
|
u64 hwid = processor->arm_mpidr;
|
|
|
|
if (!(processor->flags & ACPI_MADT_ENABLED)) {
|
|
pr_debug("skipping disabled CPU entry with 0x%llx MPIDR\n", hwid);
|
|
return;
|
|
}
|
|
|
|
if (hwid & ~MPIDR_HWID_BITMASK || hwid == INVALID_HWID) {
|
|
pr_err("skipping CPU entry with invalid MPIDR 0x%llx\n", hwid);
|
|
return;
|
|
}
|
|
|
|
if (is_mpidr_duplicate(cpu_count, hwid)) {
|
|
pr_err("duplicate CPU MPIDR 0x%llx in MADT\n", hwid);
|
|
return;
|
|
}
|
|
|
|
/* Check if GICC structure of boot CPU is available in the MADT */
|
|
if (cpu_logical_map(0) == hwid) {
|
|
if (bootcpu_valid) {
|
|
pr_err("duplicate boot CPU MPIDR: 0x%llx in MADT\n",
|
|
hwid);
|
|
return;
|
|
}
|
|
bootcpu_valid = true;
|
|
cpu_madt_gicc[0] = *processor;
|
|
return;
|
|
}
|
|
|
|
if (cpu_count >= NR_CPUS)
|
|
return;
|
|
|
|
/* map the logical cpu id to cpu MPIDR */
|
|
set_cpu_logical_map(cpu_count, hwid);
|
|
|
|
cpu_madt_gicc[cpu_count] = *processor;
|
|
|
|
/*
|
|
* Set-up the ACPI parking protocol cpu entries
|
|
* while initializing the cpu_logical_map to
|
|
* avoid parsing MADT entries multiple times for
|
|
* nothing (ie a valid cpu_logical_map entry should
|
|
* contain a valid parking protocol data set to
|
|
* initialize the cpu if the parking protocol is
|
|
* the only available enable method).
|
|
*/
|
|
acpi_set_mailbox_entry(cpu_count, processor);
|
|
|
|
cpu_count++;
|
|
}
|
|
|
|
static int __init
|
|
acpi_parse_gic_cpu_interface(union acpi_subtable_headers *header,
|
|
const unsigned long end)
|
|
{
|
|
struct acpi_madt_generic_interrupt *processor;
|
|
|
|
processor = (struct acpi_madt_generic_interrupt *)header;
|
|
if (BAD_MADT_GICC_ENTRY(processor, end))
|
|
return -EINVAL;
|
|
|
|
acpi_table_print_madt_entry(&header->common);
|
|
|
|
acpi_map_gic_cpu_interface(processor);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void __init acpi_parse_and_init_cpus(void)
|
|
{
|
|
int i;
|
|
|
|
/*
|
|
* do a walk of MADT to determine how many CPUs
|
|
* we have including disabled CPUs, and get information
|
|
* we need for SMP init.
|
|
*/
|
|
acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_INTERRUPT,
|
|
acpi_parse_gic_cpu_interface, 0);
|
|
|
|
/*
|
|
* In ACPI, SMP and CPU NUMA information is provided in separate
|
|
* static tables, namely the MADT and the SRAT.
|
|
*
|
|
* Thus, it is simpler to first create the cpu logical map through
|
|
* an MADT walk and then map the logical cpus to their node ids
|
|
* as separate steps.
|
|
*/
|
|
acpi_map_cpus_to_nodes();
|
|
|
|
for (i = 0; i < nr_cpu_ids; i++)
|
|
early_map_cpu_to_node(i, acpi_numa_get_nid(i));
|
|
}
|
|
#else
|
|
#define acpi_parse_and_init_cpus(...) do { } while (0)
|
|
#endif
|
|
|
|
/*
|
|
* Enumerate the possible CPU set from the device tree and build the
|
|
* cpu logical map array containing MPIDR values related to logical
|
|
* cpus. Assumes that cpu_logical_map(0) has already been initialized.
|
|
*/
|
|
static void __init of_parse_and_init_cpus(void)
|
|
{
|
|
struct device_node *dn;
|
|
|
|
for_each_of_cpu_node(dn) {
|
|
u64 hwid = of_get_cpu_hwid(dn, 0);
|
|
|
|
if (hwid & ~MPIDR_HWID_BITMASK)
|
|
goto next;
|
|
|
|
if (is_mpidr_duplicate(cpu_count, hwid)) {
|
|
pr_err("%pOF: duplicate cpu reg properties in the DT\n",
|
|
dn);
|
|
goto next;
|
|
}
|
|
|
|
/*
|
|
* The numbering scheme requires that the boot CPU
|
|
* must be assigned logical id 0. Record it so that
|
|
* the logical map built from DT is validated and can
|
|
* be used.
|
|
*/
|
|
if (hwid == cpu_logical_map(0)) {
|
|
if (bootcpu_valid) {
|
|
pr_err("%pOF: duplicate boot cpu reg property in DT\n",
|
|
dn);
|
|
goto next;
|
|
}
|
|
|
|
bootcpu_valid = true;
|
|
early_map_cpu_to_node(0, of_node_to_nid(dn));
|
|
|
|
/*
|
|
* cpu_logical_map has already been
|
|
* initialized and the boot cpu doesn't need
|
|
* the enable-method so continue without
|
|
* incrementing cpu.
|
|
*/
|
|
continue;
|
|
}
|
|
|
|
if (cpu_count >= NR_CPUS)
|
|
goto next;
|
|
|
|
pr_debug("cpu logical map 0x%llx\n", hwid);
|
|
set_cpu_logical_map(cpu_count, hwid);
|
|
|
|
early_map_cpu_to_node(cpu_count, of_node_to_nid(dn));
|
|
next:
|
|
cpu_count++;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Enumerate the possible CPU set from the device tree or ACPI and build the
|
|
* cpu logical map array containing MPIDR values related to logical
|
|
* cpus. Assumes that cpu_logical_map(0) has already been initialized.
|
|
*/
|
|
void __init smp_init_cpus(void)
|
|
{
|
|
int i;
|
|
|
|
if (acpi_disabled)
|
|
of_parse_and_init_cpus();
|
|
else
|
|
acpi_parse_and_init_cpus();
|
|
|
|
if (cpu_count > nr_cpu_ids)
|
|
pr_warn("Number of cores (%d) exceeds configured maximum of %u - clipping\n",
|
|
cpu_count, nr_cpu_ids);
|
|
|
|
if (!bootcpu_valid) {
|
|
pr_err("missing boot CPU MPIDR, not enabling secondaries\n");
|
|
return;
|
|
}
|
|
|
|
/*
|
|
* We need to set the cpu_logical_map entries before enabling
|
|
* the cpus so that cpu processor description entries (DT cpu nodes
|
|
* and ACPI MADT entries) can be retrieved by matching the cpu hwid
|
|
* with entries in cpu_logical_map while initializing the cpus.
|
|
* If the cpu set-up fails, invalidate the cpu_logical_map entry.
|
|
*/
|
|
for (i = 1; i < nr_cpu_ids; i++) {
|
|
if (cpu_logical_map(i) != INVALID_HWID) {
|
|
if (smp_cpu_setup(i))
|
|
set_cpu_logical_map(i, INVALID_HWID);
|
|
}
|
|
}
|
|
}
|
|
|
|
void __init smp_prepare_cpus(unsigned int max_cpus)
|
|
{
|
|
const struct cpu_operations *ops;
|
|
int err;
|
|
unsigned int cpu;
|
|
unsigned int this_cpu;
|
|
|
|
init_cpu_topology();
|
|
|
|
this_cpu = smp_processor_id();
|
|
store_cpu_topology(this_cpu);
|
|
numa_store_cpu_info(this_cpu);
|
|
numa_add_cpu(this_cpu);
|
|
|
|
/*
|
|
* If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set
|
|
* secondary CPUs present.
|
|
*/
|
|
if (max_cpus == 0)
|
|
return;
|
|
|
|
/*
|
|
* Initialise the present map (which describes the set of CPUs
|
|
* actually populated at the present time) and release the
|
|
* secondaries from the bootloader.
|
|
*/
|
|
for_each_possible_cpu(cpu) {
|
|
|
|
per_cpu(cpu_number, cpu) = cpu;
|
|
|
|
if (cpu == smp_processor_id())
|
|
continue;
|
|
|
|
ops = get_cpu_ops(cpu);
|
|
if (!ops)
|
|
continue;
|
|
|
|
err = ops->cpu_prepare(cpu);
|
|
if (err)
|
|
continue;
|
|
|
|
set_cpu_present(cpu, true);
|
|
numa_store_cpu_info(cpu);
|
|
}
|
|
}
|
|
|
|
static const char *ipi_types[NR_IPI] __tracepoint_string = {
|
|
[IPI_RESCHEDULE] = "Rescheduling interrupts",
|
|
[IPI_CALL_FUNC] = "Function call interrupts",
|
|
[IPI_CPU_STOP] = "CPU stop interrupts",
|
|
[IPI_CPU_CRASH_STOP] = "CPU stop (for crash dump) interrupts",
|
|
[IPI_TIMER] = "Timer broadcast interrupts",
|
|
[IPI_IRQ_WORK] = "IRQ work interrupts",
|
|
[IPI_WAKEUP] = "CPU wake-up interrupts",
|
|
};
|
|
|
|
static void smp_cross_call(const struct cpumask *target, unsigned int ipinr);
|
|
|
|
unsigned long irq_err_count;
|
|
|
|
int arch_show_interrupts(struct seq_file *p, int prec)
|
|
{
|
|
unsigned int cpu, i;
|
|
|
|
for (i = 0; i < NR_IPI; i++) {
|
|
seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i,
|
|
prec >= 4 ? " " : "");
|
|
for_each_online_cpu(cpu)
|
|
seq_printf(p, "%10u ", irq_desc_kstat_cpu(ipi_desc[i], cpu));
|
|
seq_printf(p, " %s\n", ipi_types[i]);
|
|
}
|
|
|
|
seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count);
|
|
return 0;
|
|
}
|
|
|
|
void arch_send_call_function_ipi_mask(const struct cpumask *mask)
|
|
{
|
|
smp_cross_call(mask, IPI_CALL_FUNC);
|
|
}
|
|
|
|
void arch_send_call_function_single_ipi(int cpu)
|
|
{
|
|
smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC);
|
|
}
|
|
|
|
#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
|
|
void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
|
|
{
|
|
smp_cross_call(mask, IPI_WAKEUP);
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_IRQ_WORK
|
|
void arch_irq_work_raise(void)
|
|
{
|
|
smp_cross_call(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
|
|
}
|
|
#endif
|
|
|
|
static void local_cpu_stop(void)
|
|
{
|
|
set_cpu_online(smp_processor_id(), false);
|
|
|
|
local_daif_mask();
|
|
sdei_mask_local_cpu();
|
|
cpu_park_loop();
|
|
}
|
|
|
|
/*
|
|
* We need to implement panic_smp_self_stop() for parallel panic() calls, so
|
|
* that cpu_online_mask gets correctly updated and smp_send_stop() can skip
|
|
* CPUs that have already stopped themselves.
|
|
*/
|
|
void panic_smp_self_stop(void)
|
|
{
|
|
local_cpu_stop();
|
|
}
|
|
|
|
#ifdef CONFIG_KEXEC_CORE
|
|
static atomic_t waiting_for_crash_ipi = ATOMIC_INIT(0);
|
|
#endif
|
|
|
|
static void ipi_cpu_crash_stop(unsigned int cpu, struct pt_regs *regs)
|
|
{
|
|
#ifdef CONFIG_KEXEC_CORE
|
|
crash_save_cpu(regs, cpu);
|
|
|
|
atomic_dec(&waiting_for_crash_ipi);
|
|
|
|
local_irq_disable();
|
|
sdei_mask_local_cpu();
|
|
|
|
if (IS_ENABLED(CONFIG_HOTPLUG_CPU))
|
|
__cpu_try_die(cpu);
|
|
|
|
/* just in case */
|
|
cpu_park_loop();
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* Main handler for inter-processor interrupts
|
|
*/
|
|
static void do_handle_IPI(int ipinr)
|
|
{
|
|
unsigned int cpu = smp_processor_id();
|
|
|
|
if ((unsigned)ipinr < NR_IPI)
|
|
trace_ipi_entry_rcuidle(ipi_types[ipinr]);
|
|
|
|
switch (ipinr) {
|
|
case IPI_RESCHEDULE:
|
|
scheduler_ipi();
|
|
break;
|
|
|
|
case IPI_CALL_FUNC:
|
|
generic_smp_call_function_interrupt();
|
|
break;
|
|
|
|
case IPI_CPU_STOP:
|
|
trace_android_vh_ipi_stop(get_irq_regs());
|
|
local_cpu_stop();
|
|
break;
|
|
|
|
case IPI_CPU_CRASH_STOP:
|
|
if (IS_ENABLED(CONFIG_KEXEC_CORE)) {
|
|
ipi_cpu_crash_stop(cpu, get_irq_regs());
|
|
|
|
unreachable();
|
|
}
|
|
break;
|
|
|
|
#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
|
|
case IPI_TIMER:
|
|
tick_receive_broadcast();
|
|
break;
|
|
#endif
|
|
|
|
#ifdef CONFIG_IRQ_WORK
|
|
case IPI_IRQ_WORK:
|
|
irq_work_run();
|
|
break;
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL
|
|
case IPI_WAKEUP:
|
|
WARN_ONCE(!acpi_parking_protocol_valid(cpu),
|
|
"CPU%u: Wake-up IPI outside the ACPI parking protocol\n",
|
|
cpu);
|
|
break;
|
|
#endif
|
|
|
|
default:
|
|
pr_crit("CPU%u: Unknown IPI message 0x%x\n", cpu, ipinr);
|
|
break;
|
|
}
|
|
|
|
if ((unsigned)ipinr < NR_IPI)
|
|
trace_ipi_exit_rcuidle(ipi_types[ipinr]);
|
|
}
|
|
|
|
static irqreturn_t ipi_handler(int irq, void *data)
|
|
{
|
|
do_handle_IPI(irq - ipi_irq_base);
|
|
return IRQ_HANDLED;
|
|
}
|
|
|
|
static void smp_cross_call(const struct cpumask *target, unsigned int ipinr)
|
|
{
|
|
trace_ipi_raise(target, ipi_types[ipinr]);
|
|
__ipi_send_mask(ipi_desc[ipinr], target);
|
|
}
|
|
|
|
static void ipi_setup(int cpu)
|
|
{
|
|
int i;
|
|
|
|
if (WARN_ON_ONCE(!ipi_irq_base))
|
|
return;
|
|
|
|
for (i = 0; i < nr_ipi; i++)
|
|
enable_percpu_irq(ipi_irq_base + i, 0);
|
|
}
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
static void ipi_teardown(int cpu)
|
|
{
|
|
int i;
|
|
|
|
if (WARN_ON_ONCE(!ipi_irq_base))
|
|
return;
|
|
|
|
for (i = 0; i < nr_ipi; i++)
|
|
disable_percpu_irq(ipi_irq_base + i);
|
|
}
|
|
#endif
|
|
|
|
void __init set_smp_ipi_range(int ipi_base, int n)
|
|
{
|
|
int i;
|
|
|
|
WARN_ON(n < NR_IPI);
|
|
nr_ipi = min(n, NR_IPI);
|
|
|
|
for (i = 0; i < nr_ipi; i++) {
|
|
int err;
|
|
|
|
err = request_percpu_irq(ipi_base + i, ipi_handler,
|
|
"IPI", &cpu_number);
|
|
WARN_ON(err);
|
|
|
|
ipi_desc[i] = irq_to_desc(ipi_base + i);
|
|
irq_set_status_flags(ipi_base + i, IRQ_HIDDEN);
|
|
}
|
|
|
|
ipi_irq_base = ipi_base;
|
|
|
|
/* Setup the boot CPU immediately */
|
|
ipi_setup(smp_processor_id());
|
|
}
|
|
|
|
void smp_send_reschedule(int cpu)
|
|
{
|
|
smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE);
|
|
}
|
|
|
|
#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
|
|
void tick_broadcast(const struct cpumask *mask)
|
|
{
|
|
smp_cross_call(mask, IPI_TIMER);
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* The number of CPUs online, not counting this CPU (which may not be
|
|
* fully online and so not counted in num_online_cpus()).
|
|
*/
|
|
static inline unsigned int num_other_online_cpus(void)
|
|
{
|
|
unsigned int this_cpu_online = cpu_online(smp_processor_id());
|
|
|
|
return num_online_cpus() - this_cpu_online;
|
|
}
|
|
|
|
void smp_send_stop(void)
|
|
{
|
|
unsigned long timeout;
|
|
|
|
if (num_other_online_cpus()) {
|
|
cpumask_t mask;
|
|
|
|
cpumask_copy(&mask, cpu_online_mask);
|
|
cpumask_clear_cpu(smp_processor_id(), &mask);
|
|
|
|
if (system_state <= SYSTEM_RUNNING)
|
|
pr_crit("SMP: stopping secondary CPUs\n");
|
|
smp_cross_call(&mask, IPI_CPU_STOP);
|
|
}
|
|
|
|
/* Wait up to one second for other CPUs to stop */
|
|
timeout = USEC_PER_SEC;
|
|
while (num_other_online_cpus() && timeout--)
|
|
udelay(1);
|
|
|
|
if (num_other_online_cpus())
|
|
pr_warn("SMP: failed to stop secondary CPUs %*pbl\n",
|
|
cpumask_pr_args(cpu_online_mask));
|
|
|
|
sdei_mask_local_cpu();
|
|
}
|
|
|
|
#ifdef CONFIG_KEXEC_CORE
|
|
void crash_smp_send_stop(void)
|
|
{
|
|
static int cpus_stopped;
|
|
cpumask_t mask;
|
|
unsigned long timeout;
|
|
|
|
/*
|
|
* This function can be called twice in panic path, but obviously
|
|
* we execute this only once.
|
|
*/
|
|
if (cpus_stopped)
|
|
return;
|
|
|
|
cpus_stopped = 1;
|
|
|
|
/*
|
|
* If this cpu is the only one alive at this point in time, online or
|
|
* not, there are no stop messages to be sent around, so just back out.
|
|
*/
|
|
if (num_other_online_cpus() == 0)
|
|
goto skip_ipi;
|
|
|
|
cpumask_copy(&mask, cpu_online_mask);
|
|
cpumask_clear_cpu(smp_processor_id(), &mask);
|
|
|
|
atomic_set(&waiting_for_crash_ipi, num_other_online_cpus());
|
|
|
|
pr_crit("SMP: stopping secondary CPUs\n");
|
|
smp_cross_call(&mask, IPI_CPU_CRASH_STOP);
|
|
|
|
/* Wait up to one second for other CPUs to stop */
|
|
timeout = USEC_PER_SEC;
|
|
while ((atomic_read(&waiting_for_crash_ipi) > 0) && timeout--)
|
|
udelay(1);
|
|
|
|
if (atomic_read(&waiting_for_crash_ipi) > 0)
|
|
pr_warn("SMP: failed to stop secondary CPUs %*pbl\n",
|
|
cpumask_pr_args(&mask));
|
|
|
|
skip_ipi:
|
|
sdei_mask_local_cpu();
|
|
sdei_handler_abort();
|
|
}
|
|
|
|
bool smp_crash_stop_failed(void)
|
|
{
|
|
return (atomic_read(&waiting_for_crash_ipi) > 0);
|
|
}
|
|
#endif
|
|
|
|
static bool have_cpu_die(void)
|
|
{
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
int any_cpu = raw_smp_processor_id();
|
|
const struct cpu_operations *ops = get_cpu_ops(any_cpu);
|
|
|
|
if (ops && ops->cpu_die)
|
|
return true;
|
|
#endif
|
|
return false;
|
|
}
|
|
|
|
bool cpus_are_stuck_in_kernel(void)
|
|
{
|
|
bool smp_spin_tables = (num_possible_cpus() > 1 && !have_cpu_die());
|
|
|
|
return !!cpus_stuck_in_kernel || smp_spin_tables ||
|
|
is_protected_kvm_enabled();
|
|
}
|
|
|
|
int nr_ipi_get(void)
|
|
{
|
|
return nr_ipi;
|
|
}
|
|
EXPORT_SYMBOL_GPL(nr_ipi_get);
|
|
|
|
struct irq_desc **ipi_desc_get(void)
|
|
{
|
|
return ipi_desc;
|
|
}
|
|
EXPORT_SYMBOL_GPL(ipi_desc_get);
|