* common/android-4.9-q:
Linux 4.9.321
swiotlb: skip swiotlb_bounce when orig_addr is zero
kexec_file: drop weak attribute from arch_kexec_apply_relocations[_add]
fdt: Update CRC check for rng-seed
xen: unexport __init-annotated xen_xlate_map_ballooned_pages()
drm: remove drm_fb_helper_modinit
powerpc/pseries: wire up rng during setup_arch()
modpost: fix section mismatch check for exported init/exit sections
ARM: cns3xxx: Fix refcount leak in cns3xxx_init
ARM: Fix refcount leak in axxia_boot_secondary
ARM: exynos: Fix refcount leak in exynos_map_pmu
ARM: dts: imx6qdl: correct PU regulator ramp delay
powerpc: Enable execve syscall exit tracepoint
xtensa: Fix refcount leak bug in time.c
xtensa: xtfpga: Fix refcount leak bug in setup
iio: trigger: sysfs: fix use-after-free on remove
iio: accel: mma8452: ignore the return value of reset operation
iio:accel:bma180: rearrange iio trigger get and register
usb: chipidea: udc: check request status before setting device address
iio: adc: vf610: fix conversion mode sysfs node name
igb: Make DMA faster when CPU is active on the PCIe link
MIPS: Remove repetitive increase irq_err_count
x86/xen: Remove undefined behavior in setup_features()
bonding: ARP monitor spams NETDEV_NOTIFY_PEERS notifiers
USB: serial: option: add Telit LE910Cx 0x1250 composition
random: quiet urandom warning ratelimit suppression message
dm era: commit metadata in postsuspend after worker stops
ata: libata: add qc->flags in ata_qc_complete_template tracepoint
random: schedule mix_interrupt_randomness() less often
vt: drop old FONT ioctls
BACKPORT: l2tp: fix race in pppol2tp_release with session object destroy
BACKPORT: l2tp: don't use inet_shutdown on ppp session destroy
Linux 4.9.320
tcp: drop the hash_32() part from the index calculation
tcp: increase source port perturb table to 2^16
tcp: dynamically allocate the perturb table used by source ports
tcp: add small random increments to the source port
tcp: use different parts of the port_offset for index and offset
secure_seq: use the 64 bits of the siphash for port offset calculation
tcp: add some entropy in __inet_hash_connect()
tcp: change source port randomizarion at connect() time
fuse: fix pipe buffer lifetime for direct_io
Reinstate some of "swiotlb: rework "fix info leak with DMA_FROM_DEVICE""
swiotlb: fix info leak with DMA_FROM_DEVICE
xprtrdma: fix incorrect header size calculations
s390/mm: use non-quiescing sske for KVM switch to keyed guest
l2tp: fix race in pppol2tp_release with session object destroy
l2tp: don't use inet_shutdown on ppp session destroy
ext4: add reserved GDT blocks check
ext4: make variable "count" signed
ext4: fix bug_on ext4_mb_use_inode_pa
serial: 8250: Store to lsr_save_flags after lsr read
usb: gadget: lpc32xx_udc: Fix refcount leak in lpc32xx_udc_probe
USB: serial: io_ti: add Agilent E5805A support
USB: serial: option: add support for Cinterion MV31 with new baseline
comedi: vmk80xx: fix expression for tx buffer size
irqchip/gic-v3: Iterate over possible CPUs by for_each_possible_cpu()
irqchip/gic/realview: Fix refcount leak in realview_gic_of_init
misc: atmel-ssc: Fix IRQ check in ssc_probe
pNFS: Don't keep retrying if the server replied NFS4ERR_LAYOUTUNAVAILABLE
random: credit cpu and bootloader seeds by default
net: ethernet: mtk_eth_soc: fix misuse of mem alloc interface netdev[napi]_alloc_frag
ipv6: Fix signed integer overflow in l2tp_ip6_sendmsg
nfc: nfcmrvl: Fix memory leak in nfcmrvl_play_deferred
virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
scsi: lpfc: Fix port stuck in bypassed state after LIP in PT2PT topology
scsi: vmw_pvscsi: Expand vcpuHint to 16 bits
ASoC: wm8962: Fix suspend while playing music
ata: libata-core: fix NULL pointer deref in ata_host_alloc_pinfo()
ASoC: cs42l56: Correct typo in minimum level for SX volume controls
ASoC: cs42l52: Correct TLV for Bypass Volume
ASoC: cs53l30: Correct number of volume levels on SX controls
ASoC: cs42l52: Fix TLV scales for mixer controls
random: account for arch randomness in bits
random: mark bootloader randomness code as __init
random: avoid checking crng_ready() twice in random_init()
crypto: drbg - make reseeding from get_random_bytes() synchronous
crypto: drbg - always try to free Jitter RNG instance
crypto: drbg - move dynamic ->reseed_threshold adjustments to __drbg_seed()
crypto: drbg - track whether DRBG was seeded with !rng_is_initialized()
crypto: drbg - prepare for more fine-grained tracking of seeding state
crypto: drbg - always seeded with SP800-90B compliant noise source
crypto: drbg - add FIPS 140-2 CTRNG for noise source
Revert "random: use static branch for crng_ready()"
random: check for signals after page of pool writes
random: wire up fops->splice_{read,write}_iter()
random: convert to using fops->write_iter()
random: move randomize_page() into mm where it belongs
random: move initialization functions out of hot pages
random: use proper return types on get_random_{int,long}_wait()
random: remove extern from functions in header
random: use static branch for crng_ready()
random: credit architectural init the exact amount
random: handle latent entropy and command line from random_init()
random: use proper jiffies comparison macro
random: remove ratelimiting for in-kernel unseeded randomness
random: avoid initializing twice in credit race
random: use symbolic constants for crng_init states
siphash: use one source of truth for siphash permutations
random: help compiler out with fast_mix() by using simpler arguments
random: do not use input pool from hard IRQs
random: order timer entropy functions below interrupt functions
random: do not pretend to handle premature next security model
random: do not use batches when !crng_ready()
random: insist on random_get_entropy() existing in order to simplify
uapi: rename ext2_swab() to swab() and share globally in swab.h
xtensa: use fallback for random_get_entropy() instead of zero
sparc: use fallback for random_get_entropy() instead of zero
um: use fallback for random_get_entropy() instead of zero
x86/tsc: Use fallback for random_get_entropy() instead of zero
nios2: use fallback for random_get_entropy() instead of zero
arm: use fallback for random_get_entropy() instead of zero
mips: use fallback for random_get_entropy() instead of just c0 random
m68k: use fallback for random_get_entropy() instead of zero
timekeeping: Add raw clock fallback for random_get_entropy()
powerpc: define get_cycles macro for arch-override
alpha: define get_cycles macro for arch-override
parisc: define get_cycles macro for arch-override
s390: define get_cycles macro for arch-override
ia64: define get_cycles macro for arch-override
init: call time_init() before rand_initialize()
random: fix sysctl documentation nits
random: document crng_fast_key_erasure() destination possibility
random: make random_get_entropy() return an unsigned long
random: check for signals every PAGE_SIZE chunk of /dev/[u]random
random: check for signal_pending() outside of need_resched() check
random: do not allow user to keep crng key around on stack
random: do not split fast init input in add_hwgenerator_randomness()
random: mix build-time latent entropy into pool at init
random: re-add removed comment about get_random_{u32,u64} reseeding
random: treat bootloader trust toggle the same way as cpu trust toggle
random: skip fast_init if hwrng provides large chunk of entropy
random: check for signal and try earlier when generating entropy
random: reseed more often immediately after booting
random: make consistent usage of crng_ready()
random: use SipHash as interrupt entropy accumulator
random: replace custom notifier chain with standard one
random: don't let 644 read-only sysctls be written to
random: give sysctl_random_min_urandom_seed a more sensible value
random: do crng pre-init loading in worker rather than irq
random: unify cycles_t and jiffies usage and types
random: cleanup UUID handling
random: only wake up writers after zap if threshold was passed
random: round-robin registers as ulong, not u32
random: clear fast pool, crng, and batches in cpuhp bring up
random: pull add_hwgenerator_randomness() declaration into random.h
hwrng: remember rng chosen by user
hwrng: use rng source with best quality
hwrng: core - remove unused PFX macro
hwrng: core - Move hwrng miscdev minor number to include/linux/miscdevice.h
hwrng: core - Rewrite the header
hwrng: core - rewrite better comparison to NULL
hwrng: core - do not use multiple blank lines
random: check for crng_init == 0 in add_device_randomness()
random: unify early init crng load accounting
random: do not take pool spinlock at boot
random: defer fast pool mixing to worker
workqueue: make workqueue available early during boot
random: rewrite header introductory comment
random: group sysctl functions
random: group userspace read/write functions
random: group entropy collection functions
random: group entropy extraction functions
random: group initialization wait functions
random: remove whitespace and reorder includes
random: remove useless header comment
random: introduce drain_entropy() helper to declutter crng_reseed()
random: deobfuscate irq u32/u64 contributions
random: add proper SPDX header
random: remove unused tracepoints
random: remove ifdef'd out interrupt bench
random: tie batched entropy generation to base_crng generation
random: zero buffer after reading entropy from userspace
random: remove outdated INT_MAX >> 6 check in urandom_read()
random: use hash function for crng_slow_load()
random: absorb fast pool into input pool after fast load
random: do not xor RDRAND when writing into /dev/random
random: ensure early RDSEED goes through mixer on init
random: inline leaves of rand_initialize()
random: use RDSEED instead of RDRAND in entropy extraction
random: fix locking in crng_fast_load()
random: remove batched entropy locking
random: remove use_input_pool parameter from crng_reseed()
random: make credit_entropy_bits() always safe
random: always wake up entropy writers after extraction
random: use linear min-entropy accumulation crediting
random: simplify entropy debiting
random: use computational hash for entropy extraction
random: only call crng_finalize_init() for primary_crng
random: access primary_pool directly rather than through pointer
random: continually use hwgenerator randomness
random: simplify arithmetic function flow in account()
random: access input_pool_data directly rather than through pointer
random: cleanup fractional entropy shift constants
random: prepend remaining pool constants with POOL_
random: de-duplicate INPUT_POOL constants
random: remove unused OUTPUT_POOL constants
random: rather than entropy_store abstraction, use global
random: try to actively add entropy rather than passively wait for it
random: remove unused extract_entropy() reserved argument
random: remove incomplete last_data logic
random: cleanup integer types
crypto: chacha20 - Fix chacha20_block() keystream alignment (again)
random: cleanup poolinfo abstraction
random: fix typo in comments
random: don't reset crng_init_cnt on urandom_read()
random: avoid superfluous call to RDRAND in CRNG extraction
random: early initialization of ChaCha constants
random: initialize ChaCha20 constants with correct endianness
random: use IS_ENABLED(CONFIG_NUMA) instead of ifdefs
random: harmonize "crng init done" messages
random: mix bootloader randomness into pool
random: do not re-init if crng_reseed completes before primary init
random: do not sign extend bytes for rotation when mixing
random: use BLAKE2s instead of SHA1 in extraction
random: remove unused irq_flags argument from add_interrupt_randomness()
random: document add_hwgenerator_randomness() with other input functions
crypto: blake2s - adjust include guard naming
crypto: blake2s - include <linux/bug.h> instead of <asm/bug.h>
MAINTAINERS: co-maintain random.c
random: remove dead code left over from blocking pool
random: avoid arch_get_random_seed_long() when collecting IRQ randomness
random: add arch_get_random_*long_early()
powerpc: Use bool in archrandom.h
linux/random.h: Mark CONFIG_ARCH_RANDOM functions __must_check
linux/random.h: Use false with bool
linux/random.h: Remove arch_has_random, arch_has_random_seed
powerpc: Remove arch_has_random, arch_has_random_seed
x86: Remove arch_has_random, arch_has_random_seed
random: avoid warnings for !CONFIG_NUMA builds
random: split primary/secondary crng init paths
random: remove some dead code of poolinfo
random: fix typo in add_timer_randomness()
random: Add and use pr_fmt()
random: convert to ENTROPY_BITS for better code readability
random: remove unnecessary unlikely()
random: remove kernel.random.read_wakeup_threshold
random: delete code to pull data into pools
random: remove the blocking pool
random: fix crash on multiple early calls to add_bootloader_randomness()
random: make /dev/random be almost like /dev/urandom
random: ignore GRND_RANDOM in getentropy(2)
random: add GRND_INSECURE to return best-effort non-cryptographic bytes
random: Add a urandom_read_nowait() for random APIs that don't warn
random: Don't wake crng_init_wait when crng_init == 1
lib/crypto: sha1: re-roll loops to reduce code size
lib/crypto: blake2s: move hmac construction into wireguard
crypto: blake2s - generic C library implementation and selftest
crypto: Deduplicate le32_to_cpu_array() and cpu_to_le32_array()
Revert "hwrng: core - Freeze khwrng thread during suspend"
char/random: Add a newline at the end of the file
random: Use wait_event_freezable() in add_hwgenerator_randomness()
fdt: add support for rng-seed
random: Support freezable kthreads in add_hwgenerator_randomness()
random: fix soft lockup when trying to read from an uninitialized blocking pool
latent_entropy: avoid build error when plugin cflags are not set
random: document get_random_int() family
random: move rand_initialize() earlier
random: only read from /dev/random after its pool has received 128 bits
drivers/char/random.c: make primary_crng static
drivers/char/random.c: remove unused stuct poolinfo::poolbits
drivers/char/random.c: constify poolinfo_table
random: make CPU trust a boot parameter
random: Make crng state queryable
random: remove preempt disabled region
random: add a config option to trust the CPU's hwrng
random: Return nbytes filled from hw RNG
random: Fix whitespace pre random-bytes work
drivers/char/random.c: remove unused dont_count_entropy
random: optimize add_interrupt_randomness
random: always fill buffer in get_random_bytes_wait
crypto: chacha20 - Fix keystream alignment for chacha20_block()
random: fix data race on crng_node_pool
random: always use batched entropy for get_random_u{32,64}
Revert "char/random: silence a lockdep splat with printk()"
char/random: silence a lockdep splat with printk()
random: add a spinlock_t to struct batched_entropy
random: rate limit unseeded randomness warnings
random: fix possible sleeping allocation from irq context
random: set up the NUMA crng instances after the CRNG is fully initialized
random: use a different mixing algorithm for add_device_randomness()
random: fix warning message on ia64 and parisc
random: reorder READ_ONCE() in get_random_uXX
random: suppress spammy warnings about unseeded randomness
random: do not ignore early device randomness
random: warn when kernel uses unseeded randomness
random: add get_random_{bytes,u32,u64,int,long,once}_wait family
random: add wait_for_random_bytes() API
random: silence compiler warnings and fix race
random: invalidate batched entropy after crng init
random: move random_min_urandom_seed into CONFIG_SYSCTL ifdef block
random: convert get_random_int/long into get_random_u32/u64
random: fix comment for unused random_min_urandom_seed
random: remove variable limit
random: remove stale urandom_init_wait
random: remove stale maybe_reseed_primary_crng
9p: missing chunk of "fs/9p: Don't update file type when updating file attributes"
Linux 4.9.319
x86/speculation/mmio: Print SMT warning
KVM: x86/speculation: Disable Fill buffer clear within guests
x86/speculation/mmio: Reuse SRBDS mitigation for SBDS
x86/speculation/srbds: Update SRBDS mitigation selection
x86/speculation/mmio: Add sysfs reporting for Processor MMIO Stale Data
x86/speculation/mmio: Enable CPU Fill buffer clearing on idle
x86/bugs: Group MDS, TAA & Processor MMIO Stale Data mitigations
x86/speculation/mmio: Add mitigation for Processor MMIO Stale Data
x86/speculation: Add a common function for MD_CLEAR mitigation update
x86/speculation/mmio: Enumerate Processor MMIO Stale Data bug
Documentation: Add documentation for Processor MMIO Stale Data
x86/cpu: Add another Alder Lake CPU to the Intel family
x86/cpu: Add Lakefield, Alder Lake and Rocket Lake models to the to Intel CPU family
x86/cpu: Add Comet Lake to the Intel CPU models header
x86/CPU: Add more Icelake model numbers
x86/CPU: Add Icelake model number
x86/cpu: Add Cannonlake to Intel family
x86/cpu: Add Jasper Lake to Intel family
cpu/speculation: Add prototype for cpu_show_srbds()
x86/cpu: Add Elkhart Lake to Intel family
ANDROID: arch: fix backported syscall numbers
Linux 4.9.318
tcp: fix tcp_mtup_probe_success vs wrong snd_cwnd
PCI: qcom: Fix unbalanced PHY init on probe errors
mtd: cfi_cmdset_0002: Use chip_ready() for write on S29GL064N
mtd: cfi_cmdset_0002: Move and rename chip_check/chip_ready/chip_good_for_write
powerpc/32: Fix overread/overwrite of thread_struct via ptrace
Input: bcm5974 - set missing URB_NO_TRANSFER_DMA_MAP urb flag
nfc: st21nfca: fix memory leaks in EVT_TRANSACTION handling
nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION
ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files
cifs: return errors during session setup during reconnects
ALSA: hda/conexant - Fix loopback issue with CX20632
vringh: Fix loop descriptors check in the indirect cases
nodemask: Fix return values to be unsigned
modpost: fix undefined behavior of is_arm_mapping_symbol()
drm/radeon: fix a possible null pointer dereference
Revert "net: af_key: add check for pfkey_broadcast in function pfkey_process"
md: protect md_unregister_thread from reentrancy
serial: msm_serial: disable interrupts in __msm_console_write()
staging: rtl8712: fix uninit-value in r871xu_drv_init()
clocksource/drivers/sp804: Avoid error on multiple instances
misc: rtsx: set NULL intfdata when probe fails
usb: dwc2: gadget: don't reset gadget's driver->bus
USB: hcd-pci: Fully suspend across freeze/thaw cycle
drivers: usb: host: Fix deadlock in oxu_bus_suspend()
drivers: tty: serial: Fix deadlock in sa1100_set_termios()
USB: host: isp116x: check return value after calling platform_get_resource()
drivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop()
tty: Fix a possible resource leak in icom_probe
tty: synclink_gt: Fix null-pointer-dereference in slgt_clean()
lkdtm/usercopy: Expand size of "out of frame" object
iio: dummy: iio_simple_dummy: check the return value of kstrdup()
net: altera: Fix refcount leak in altera_tse_mdio_create
net: xfrm: unexport __init-annotated xfrm4_protocol_init()
SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer()
net/mlx4_en: Fix wrong return value on ioctl EEPROM query failure
ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe
net: fix nla_strcmp to handle more then one trailing null character
video: fbdev: pxa3xx-gcu: release the resources correctly in pxa3xx_gcu_probe/remove()
m68knommu: fix undefined reference to `_init_sp'
m68knommu: set ZERO_PAGE() to the allocated zeroed page
i2c: cadence: Increase timeout per message if necessary
tracing: Avoid adding tracer option before update_tracer_options
tcp: tcp_rtx_synack() can be called from process context
jffs2: fix memory leak in jffs2_do_fill_super
modpost: fix removing numeric suffixes
net: ethernet: mtk_eth_soc: out of bounds read in mtk_hwlro_get_fdir_entry()
clocksource/drivers/oxnas-rps: Fix irq_of_parse_and_map() return value
firmware: dmi-sysfs: Fix memory leak in dmi_sysfs_register_handle
serial: st-asc: Sanitize CSIZE and correct PARENB for CS7
serial: sh-sci: Don't allow CS5-6
serial: txx9: Don't allow CS5-6
serial: digicolor-usart: Don't allow CS5-6
serial: meson: acquire port->lock in startup()
rtc: mt6397: check return value after calling platform_get_resource()
rpmsg: qcom_smd: Fix irq_of_parse_and_map() return value
pwm: lp3943: Fix duty calculation in case period was clamped
USB: storage: karma: fix rio_karma_init return
usb: usbip: add missing device lock on tweak configuration cmd
usb: usbip: fix a refcount leak in stub_probe()
staging: greybus: codecs: fix type confusion of list iterator variable
pcmcia: db1xxx_ss: restrict to MIPS_DB1XXX boards
netfilter: nf_tables: disallow non-stateful expression in sets earlier
MIPS: IP27: Remove incorrect `cpu_has_fpu' override
RDMA/rxe: Generate a completion for unsupported/invalid opcode
dt-bindings: gpio: altera: correct interrupt-cells
docs/conf.py: Cope with removal of language=None in Sphinx 5.0.0
gma500: fix an incorrect NULL check on list iterator
carl9170: tx: fix an incorrect use of list iterator
ASoC: rt5514: Fix event generation for "DSP Voice Wake Up" control
rtl818x: Prevent using not initialized queues
hugetlb: fix huge_pmd_unshare address update
nodemask.h: fix compilation error with GCC12
iommu/msm: Fix an incorrect NULL check on list iterator
um: Fix out-of-bounds read in LDT setup
um: chan_user: Fix winch_tramp() return value
mac80211: upgrade passive scan to active scan on DFS channels after beacon rx
irqchip: irq-xtensa-mx: fix initial IRQ affinity
irqchip/armada-370-xp: Do not touch Performance Counter Overflow on A375, A38x, A39x
RDMA/hfi1: Fix potential integer multiplication overflow errors
md: fix an incorrect NULL check in md_reload_sb
md: fix an incorrect NULL check in does_sb_need_changing
drm/bridge: analogix_dp: Grab runtime PM reference for DP-AUX
drm/amdgpu/cs: make commands with 0 chunks illegal behaviour.
scsi: ufs: qcom: Add a readl() to make sure ref_clk gets enabled
scsi: dc395x: Fix a missing check on list iterator
ocfs2: dlmfs: fix error handling of user_dlm_destroy_lock
dlm: fix missing lkb refcount handling
dlm: fix plock invalid read
ext4: verify dir block before splitting it
ext4: fix bug_on in ext4_writepages
ext4: fix use-after-free in ext4_rename_dir_prepare
fs-writeback: writeback_sb_inodes:Recalculate 'wrote' according skipped pages
iwlwifi: mvm: fix assert 1F04 upon reconfig
wifi: mac80211: fix use-after-free in chanctx code
iommu/amd: Increase timeout waiting for GA log enablement
video: fbdev: clcdfb: Fix refcount leak in clcdfb_of_vram_setup
Input: sparcspkr - fix refcount leak in bbc_beep_probe
tty: fix deadlock caused by calling printk() under tty_port->lock
powerpc/4xx/cpm: Fix return value of __setup() handler
powerpc/idle: Fix return value of __setup() handler
powerpc/8xx: export 'cpm_setbrg' for modules
drivers/base/node.c: fix compaction sysfs file leak
scsi: fcoe: Fix Wstringop-overflow warnings in fcoe_wwn_from_mac()
mfd: ipaq-micro: Fix error check return value of platform_get_irq()
soc: qcom: smsm: Fix missing of_node_put() in smsm_parse_ipc
soc: qcom: smp2p: Fix missing of_node_put() in smp2p_parse_ipc
rxrpc: Don't try to resend the request if we're receiving the reply
rxrpc: Fix listen() setting the bar too high for the prealloc rings
ASoC: wm2000: fix missing clk_disable_unprepare() on error in wm2000_anc_transition()
sctp: read sk->sk_bound_dev_if once in sctp_rcv()
m68k: math-emu: Fix dependencies of math emulation support
Bluetooth: fix dangling sco_conn and use-after-free in sco_sock_timeout
media: pvrusb2: fix array-index-out-of-bounds in pvr2_i2c_core_init
media: exynos4-is: Change clk_disable to clk_disable_unprepare
regulator: pfuze100: Fix refcount leak in pfuze_parse_regulators_dt
ASoC: mxs-saif: Fix refcount leak in mxs_saif_probe
media: uvcvideo: Fix missing check to determine if element is found in list
drm/msm: return an error pointer in msm_gem_prime_get_sg_table()
x86/mm: Cleanup the control_va_addr_alignment() __setup handler
drm/rockchip: vop: fix possible null-ptr-deref in vop_bind()
drm/msm/hdmi: check return value after calling platform_get_resource_byname()
drm/msm/dsi: fix error checks and return values for DSI xmit functions
x86/pm: Fix false positive kmemleak report in msr_build_context()
inotify: show inotify mask flags in proc fdinfo
ath9k_htc: fix potential out of bounds access with invalid rxstatus->rs_keyix
spi: img-spfi: Fix pm_runtime_get_sync() error checking
HID: hid-led: fix maximum brightness for Dream Cheeky
NFC: NULL out the dev->rfkill to prevent UAF
spi: spi-ti-qspi: Fix return value handling of wait_for_completion_timeout
drm/mediatek: Fix mtk_cec_mask()
x86/delay: Fix the wrong asm constraint in delay_loop()
ASoC: mediatek: Fix error handling in mt8173_max98090_dev_probe
drm: fix EDID struct for old ARM OABI format
macintosh/via-pmu: Fix build failure when CONFIG_INPUT is disabled
powerpc/xics: fix refcount leak in icp_opal_init()
PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store()
ARM: hisi: Add missing of_node_put after of_find_compatible_node
ARM: dts: exynos: add atmel,24c128 fallback to Samsung EEPROM
ARM: versatile: Add missing of_node_put in dcscb_init
fat: add ratelimit to fat*_ent_bread()
ARM: OMAP1: clock: Fix UART rate reporting algorithm
fs: jfs: fix possible NULL pointer dereference in dbFree()
eth: tg3: silence the GCC 12 array-bounds warning
rxrpc: Return an error to sendmsg if call failed
media: exynos4-is: Fix compile warning
ASoC: rt5645: Fix errorenous cleanup order
nvme-pci: fix a NULL pointer dereference in nvme_alloc_admin_tags
openrisc: start CPU timer early in boot
ipmi:ssif: Check for NULL msg when handling events and messages
dma-debug: change allocation mode from GFP_NOWAIT to GFP_ATIOMIC
ASoC: dapm: Don't fold register value changes into notifications
ipv6: Don't send rs packets to the interface of ARPHRD_TUNNEL
drm/amd/pm: fix the compile warning
scsi: megaraid: Fix error check return value of register_chrdev()
media: cx25821: Fix the warning when removing the module
ath9k: fix QCA9561 PA bias level
drm/amd/pm: fix double free in si_parse_power_table()
ALSA: jack: Access input_dev under mutex
ACPICA: Avoid cache flush inside virtual machines
ipw2x00: Fix potential NULL dereference in libipw_xmit()
b43: Fix assigning negative value to unsigned variable
b43legacy: Fix assigning negative value to unsigned variable
mwifiex: add mutex lock for call in mwifiex_dfs_chan_sw_work_queue
drm/virtio: fix NULL pointer dereference in virtio_gpu_conn_get_modes
btrfs: add "0x" prefix for unsupported optional features
ptrace: Reimplement PTRACE_KILL by always sending SIGKILL
ptrace/xtensa: Replace PT_SINGLESTEP with TIF_SINGLESTEP
USB: new quirk for Dell Gen 2 devices
BACKPORT: psi: Fix uaf issue when psi trigger is destroyed while being polled
Conflicts:
drivers/char/Kconfig
drivers/char/random.c
fs/fat/fatent.c
include/linux/random.h
init/main.c
kernel/cpu.c
lib/Makefile
Change-Id: I06579fa22a0347a0d8d2fa32bd6b7b6b54db626f
705 lines
17 KiB
C
705 lines
17 KiB
C
/*
|
|
* CPU subsystem support
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/init.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/topology.h>
|
|
#include <linux/device.h>
|
|
#include <linux/node.h>
|
|
#include <linux/gfp.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/percpu.h>
|
|
#include <linux/acpi.h>
|
|
#include <linux/of.h>
|
|
#include <linux/cpufeature.h>
|
|
#include <linux/tick.h>
|
|
|
|
#include "base.h"
|
|
|
|
static DEFINE_PER_CPU(struct device *, cpu_sys_devices);
|
|
|
|
static int cpu_subsys_match(struct device *dev, struct device_driver *drv)
|
|
{
|
|
/* ACPI style match is the only one that may succeed. */
|
|
if (acpi_driver_match_device(dev, drv))
|
|
return 1;
|
|
|
|
return 0;
|
|
}
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
static void change_cpu_under_node(struct cpu *cpu,
|
|
unsigned int from_nid, unsigned int to_nid)
|
|
{
|
|
int cpuid = cpu->dev.id;
|
|
unregister_cpu_under_node(cpuid, from_nid);
|
|
register_cpu_under_node(cpuid, to_nid);
|
|
cpu->node_id = to_nid;
|
|
}
|
|
|
|
static int cpu_subsys_online(struct device *dev)
|
|
{
|
|
struct cpu *cpu = container_of(dev, struct cpu, dev);
|
|
int cpuid = dev->id;
|
|
int from_nid, to_nid;
|
|
int ret;
|
|
|
|
from_nid = cpu_to_node(cpuid);
|
|
if (from_nid == NUMA_NO_NODE)
|
|
return -ENODEV;
|
|
|
|
ret = cpu_up(cpuid);
|
|
/*
|
|
* When hot adding memory to memoryless node and enabling a cpu
|
|
* on the node, node number of the cpu may internally change.
|
|
*/
|
|
to_nid = cpu_to_node(cpuid);
|
|
if (from_nid != to_nid)
|
|
change_cpu_under_node(cpu, from_nid, to_nid);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static int cpu_subsys_offline(struct device *dev)
|
|
{
|
|
return cpu_down(dev->id);
|
|
}
|
|
|
|
void unregister_cpu(struct cpu *cpu)
|
|
{
|
|
int logical_cpu = cpu->dev.id;
|
|
|
|
unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu));
|
|
|
|
device_unregister(&cpu->dev);
|
|
per_cpu(cpu_sys_devices, logical_cpu) = NULL;
|
|
return;
|
|
}
|
|
|
|
#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
|
|
static ssize_t cpu_probe_store(struct device *dev,
|
|
struct device_attribute *attr,
|
|
const char *buf,
|
|
size_t count)
|
|
{
|
|
ssize_t cnt;
|
|
int ret;
|
|
|
|
ret = lock_device_hotplug_sysfs();
|
|
if (ret)
|
|
return ret;
|
|
|
|
cnt = arch_cpu_probe(buf, count);
|
|
|
|
unlock_device_hotplug();
|
|
return cnt;
|
|
}
|
|
|
|
static ssize_t cpu_release_store(struct device *dev,
|
|
struct device_attribute *attr,
|
|
const char *buf,
|
|
size_t count)
|
|
{
|
|
ssize_t cnt;
|
|
int ret;
|
|
|
|
ret = lock_device_hotplug_sysfs();
|
|
if (ret)
|
|
return ret;
|
|
|
|
cnt = arch_cpu_release(buf, count);
|
|
|
|
unlock_device_hotplug();
|
|
return cnt;
|
|
}
|
|
|
|
static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
|
|
static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store);
|
|
#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
|
|
#endif /* CONFIG_HOTPLUG_CPU */
|
|
|
|
struct bus_type cpu_subsys = {
|
|
.name = "cpu",
|
|
.dev_name = "cpu",
|
|
.match = cpu_subsys_match,
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
.online = cpu_subsys_online,
|
|
.offline = cpu_subsys_offline,
|
|
#endif
|
|
};
|
|
EXPORT_SYMBOL_GPL(cpu_subsys);
|
|
|
|
#ifdef CONFIG_KEXEC
|
|
#include <linux/kexec.h>
|
|
|
|
static ssize_t show_crash_notes(struct device *dev, struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
struct cpu *cpu = container_of(dev, struct cpu, dev);
|
|
ssize_t rc;
|
|
unsigned long long addr;
|
|
int cpunum;
|
|
|
|
cpunum = cpu->dev.id;
|
|
|
|
/*
|
|
* Might be reading other cpu's data based on which cpu read thread
|
|
* has been scheduled. But cpu data (memory) is allocated once during
|
|
* boot up and this data does not change there after. Hence this
|
|
* operation should be safe. No locking required.
|
|
*/
|
|
addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpunum));
|
|
rc = sprintf(buf, "%Lx\n", addr);
|
|
return rc;
|
|
}
|
|
static DEVICE_ATTR(crash_notes, 0400, show_crash_notes, NULL);
|
|
|
|
static ssize_t show_crash_notes_size(struct device *dev,
|
|
struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
ssize_t rc;
|
|
|
|
rc = sprintf(buf, "%zu\n", sizeof(note_buf_t));
|
|
return rc;
|
|
}
|
|
static DEVICE_ATTR(crash_notes_size, 0400, show_crash_notes_size, NULL);
|
|
|
|
static struct attribute *crash_note_cpu_attrs[] = {
|
|
&dev_attr_crash_notes.attr,
|
|
&dev_attr_crash_notes_size.attr,
|
|
NULL
|
|
};
|
|
|
|
static struct attribute_group crash_note_cpu_attr_group = {
|
|
.attrs = crash_note_cpu_attrs,
|
|
};
|
|
#endif
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
|
|
static ssize_t isolate_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct cpu *cpu = container_of(dev, struct cpu, dev);
|
|
ssize_t rc;
|
|
int cpuid = cpu->dev.id;
|
|
unsigned int isolated = cpu_isolated(cpuid);
|
|
|
|
rc = snprintf(buf, PAGE_SIZE-2, "%d\n", isolated);
|
|
|
|
return rc;
|
|
}
|
|
|
|
static DEVICE_ATTR_RO(isolate);
|
|
|
|
static struct attribute *cpu_isolated_attrs[] = {
|
|
&dev_attr_isolate.attr,
|
|
NULL
|
|
};
|
|
|
|
static struct attribute_group cpu_isolated_attr_group = {
|
|
.attrs = cpu_isolated_attrs,
|
|
};
|
|
|
|
#endif
|
|
|
|
static ssize_t show_sched_load_boost(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
ssize_t rc;
|
|
unsigned int boost;
|
|
struct cpu *cpu = container_of(dev, struct cpu, dev);
|
|
int cpuid = cpu->dev.id;
|
|
|
|
boost = per_cpu(sched_load_boost, cpuid);
|
|
rc = snprintf(buf, PAGE_SIZE-2, "%d\n", boost);
|
|
|
|
return rc;
|
|
}
|
|
|
|
static ssize_t __ref store_sched_load_boost(struct device *dev,
|
|
struct device_attribute *attr,
|
|
const char *buf, size_t count)
|
|
{
|
|
int err;
|
|
int boost;
|
|
struct cpu *cpu = container_of(dev, struct cpu, dev);
|
|
int cpuid = cpu->dev.id;
|
|
|
|
err = kstrtoint(strstrip((char *)buf), 0, &boost);
|
|
if (err)
|
|
return err;
|
|
|
|
/*
|
|
* -100 is low enough to cancel out CPU's load and make it near zro.
|
|
* 1000 is close to the maximum value that cpu_util_freq_{walt,pelt}
|
|
* can take without overflow.
|
|
*/
|
|
if (boost < -100 || boost > 1000)
|
|
return -EINVAL;
|
|
|
|
per_cpu(sched_load_boost, cpuid) = boost;
|
|
|
|
return count;
|
|
}
|
|
|
|
static DEVICE_ATTR(sched_load_boost, 0644,
|
|
show_sched_load_boost,
|
|
store_sched_load_boost);
|
|
|
|
static struct attribute *sched_cpu_attrs[] = {
|
|
&dev_attr_sched_load_boost.attr,
|
|
NULL
|
|
};
|
|
|
|
static struct attribute_group sched_cpu_attr_group = {
|
|
.attrs = sched_cpu_attrs,
|
|
};
|
|
|
|
static const struct attribute_group *common_cpu_attr_groups[] = {
|
|
#ifdef CONFIG_KEXEC
|
|
&crash_note_cpu_attr_group,
|
|
#endif
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
&cpu_isolated_attr_group,
|
|
#endif
|
|
&sched_cpu_attr_group,
|
|
NULL
|
|
};
|
|
|
|
static const struct attribute_group *hotplugable_cpu_attr_groups[] = {
|
|
#ifdef CONFIG_KEXEC
|
|
&crash_note_cpu_attr_group,
|
|
#endif
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
&cpu_isolated_attr_group,
|
|
#endif
|
|
&sched_cpu_attr_group,
|
|
NULL
|
|
};
|
|
|
|
/*
|
|
* Print cpu online, possible, present, and system maps
|
|
*/
|
|
|
|
struct cpu_attr {
|
|
struct device_attribute attr;
|
|
const struct cpumask *const map;
|
|
};
|
|
|
|
static ssize_t show_cpus_attr(struct device *dev,
|
|
struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
struct cpu_attr *ca = container_of(attr, struct cpu_attr, attr);
|
|
|
|
return cpumap_print_to_pagebuf(true, buf, ca->map);
|
|
}
|
|
|
|
#define _CPU_ATTR(name, map) \
|
|
{ __ATTR(name, 0444, show_cpus_attr, NULL), map }
|
|
|
|
/* Keep in sync with cpu_subsys_attrs */
|
|
static struct cpu_attr cpu_attrs[] = {
|
|
_CPU_ATTR(online, &__cpu_online_mask),
|
|
_CPU_ATTR(possible, &__cpu_possible_mask),
|
|
_CPU_ATTR(present, &__cpu_present_mask),
|
|
_CPU_ATTR(core_ctl_isolated, &__cpu_isolated_mask),
|
|
};
|
|
|
|
/*
|
|
* Print values for NR_CPUS and offlined cpus
|
|
*/
|
|
static ssize_t print_cpus_kernel_max(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1);
|
|
return n;
|
|
}
|
|
static DEVICE_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL);
|
|
|
|
/* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */
|
|
unsigned int total_cpus;
|
|
|
|
static ssize_t print_cpus_offline(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
int n = 0, len = PAGE_SIZE-2;
|
|
cpumask_var_t offline;
|
|
|
|
/* display offline cpus < nr_cpu_ids */
|
|
if (!alloc_cpumask_var(&offline, GFP_KERNEL))
|
|
return -ENOMEM;
|
|
cpumask_andnot(offline, cpu_possible_mask, cpu_online_mask);
|
|
n = scnprintf(buf, len, "%*pbl", cpumask_pr_args(offline));
|
|
free_cpumask_var(offline);
|
|
|
|
/* display offline cpus >= nr_cpu_ids */
|
|
if (total_cpus && nr_cpu_ids < total_cpus) {
|
|
if (n && n < len)
|
|
buf[n++] = ',';
|
|
|
|
if (nr_cpu_ids == total_cpus-1)
|
|
n += snprintf(&buf[n], len - n, "%d", nr_cpu_ids);
|
|
else
|
|
n += snprintf(&buf[n], len - n, "%d-%d",
|
|
nr_cpu_ids, total_cpus-1);
|
|
}
|
|
|
|
n += snprintf(&buf[n], len - n, "\n");
|
|
return n;
|
|
}
|
|
static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
|
|
|
|
static ssize_t print_cpus_isolated(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
int n = 0, len = PAGE_SIZE-2;
|
|
|
|
n = scnprintf(buf, len, "%*pbl\n", cpumask_pr_args(cpu_isolated_map));
|
|
|
|
return n;
|
|
}
|
|
static DEVICE_ATTR(isolated, 0444, print_cpus_isolated, NULL);
|
|
|
|
#ifdef CONFIG_NO_HZ_FULL
|
|
static ssize_t print_cpus_nohz_full(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
int n = 0, len = PAGE_SIZE-2;
|
|
|
|
n = scnprintf(buf, len, "%*pbl\n", cpumask_pr_args(tick_nohz_full_mask));
|
|
|
|
return n;
|
|
}
|
|
static DEVICE_ATTR(nohz_full, 0444, print_cpus_nohz_full, NULL);
|
|
#endif
|
|
|
|
static void cpu_device_release(struct device *dev)
|
|
{
|
|
/*
|
|
* This is an empty function to prevent the driver core from spitting a
|
|
* warning at us. Yes, I know this is directly opposite of what the
|
|
* documentation for the driver core and kobjects say, and the author
|
|
* of this code has already been publically ridiculed for doing
|
|
* something as foolish as this. However, at this point in time, it is
|
|
* the only way to handle the issue of statically allocated cpu
|
|
* devices. The different architectures will have their cpu device
|
|
* code reworked to properly handle this in the near future, so this
|
|
* function will then be changed to correctly free up the memory held
|
|
* by the cpu device.
|
|
*
|
|
* Never copy this way of doing things, or you too will be made fun of
|
|
* on the linux-kernel list, you have been warned.
|
|
*/
|
|
}
|
|
|
|
#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
|
|
static ssize_t print_cpu_modalias(struct device *dev,
|
|
struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
ssize_t n;
|
|
u32 i;
|
|
|
|
n = sprintf(buf, "cpu:type:" CPU_FEATURE_TYPEFMT ":feature:",
|
|
CPU_FEATURE_TYPEVAL);
|
|
|
|
for (i = 0; i < MAX_CPU_FEATURES; i++)
|
|
if (cpu_have_feature(i)) {
|
|
if (PAGE_SIZE < n + sizeof(",XXXX\n")) {
|
|
WARN(1, "CPU features overflow page\n");
|
|
break;
|
|
}
|
|
n += sprintf(&buf[n], ",%04X", i);
|
|
}
|
|
buf[n++] = '\n';
|
|
return n;
|
|
}
|
|
|
|
static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env)
|
|
{
|
|
char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
|
|
if (buf) {
|
|
print_cpu_modalias(NULL, NULL, buf);
|
|
add_uevent_var(env, "MODALIAS=%s", buf);
|
|
kfree(buf);
|
|
}
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* register_cpu - Setup a sysfs device for a CPU.
|
|
* @cpu - cpu->hotpluggable field set to 1 will generate a control file in
|
|
* sysfs for this CPU.
|
|
* @num - CPU number to use when creating the device.
|
|
*
|
|
* Initialize and register the CPU device.
|
|
*/
|
|
int register_cpu(struct cpu *cpu, int num)
|
|
{
|
|
int error;
|
|
|
|
cpu->node_id = cpu_to_node(num);
|
|
memset(&cpu->dev, 0x00, sizeof(struct device));
|
|
cpu->dev.id = num;
|
|
cpu->dev.bus = &cpu_subsys;
|
|
cpu->dev.release = cpu_device_release;
|
|
cpu->dev.offline_disabled = !cpu->hotpluggable;
|
|
cpu->dev.offline = !cpu_online(num);
|
|
cpu->dev.of_node = of_get_cpu_node(num, NULL);
|
|
#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
|
|
cpu->dev.bus->uevent = cpu_uevent;
|
|
#endif
|
|
cpu->dev.groups = common_cpu_attr_groups;
|
|
if (cpu->hotpluggable)
|
|
cpu->dev.groups = hotplugable_cpu_attr_groups;
|
|
error = device_register(&cpu->dev);
|
|
if (error)
|
|
return error;
|
|
|
|
per_cpu(cpu_sys_devices, num) = &cpu->dev;
|
|
register_cpu_under_node(num, cpu_to_node(num));
|
|
|
|
return 0;
|
|
}
|
|
|
|
struct device *get_cpu_device(unsigned cpu)
|
|
{
|
|
if (cpu < nr_cpu_ids && cpu_possible(cpu))
|
|
return per_cpu(cpu_sys_devices, cpu);
|
|
else
|
|
return NULL;
|
|
}
|
|
EXPORT_SYMBOL_GPL(get_cpu_device);
|
|
|
|
static void device_create_release(struct device *dev)
|
|
{
|
|
kfree(dev);
|
|
}
|
|
|
|
static struct device *
|
|
__cpu_device_create(struct device *parent, void *drvdata,
|
|
const struct attribute_group **groups,
|
|
const char *fmt, va_list args)
|
|
{
|
|
struct device *dev = NULL;
|
|
int retval = -ENODEV;
|
|
|
|
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
|
if (!dev) {
|
|
retval = -ENOMEM;
|
|
goto error;
|
|
}
|
|
|
|
device_initialize(dev);
|
|
dev->parent = parent;
|
|
dev->groups = groups;
|
|
dev->release = device_create_release;
|
|
dev_set_drvdata(dev, drvdata);
|
|
|
|
retval = kobject_set_name_vargs(&dev->kobj, fmt, args);
|
|
if (retval)
|
|
goto error;
|
|
|
|
retval = device_add(dev);
|
|
if (retval)
|
|
goto error;
|
|
|
|
return dev;
|
|
|
|
error:
|
|
put_device(dev);
|
|
return ERR_PTR(retval);
|
|
}
|
|
|
|
struct device *cpu_device_create(struct device *parent, void *drvdata,
|
|
const struct attribute_group **groups,
|
|
const char *fmt, ...)
|
|
{
|
|
va_list vargs;
|
|
struct device *dev;
|
|
|
|
va_start(vargs, fmt);
|
|
dev = __cpu_device_create(parent, drvdata, groups, fmt, vargs);
|
|
va_end(vargs);
|
|
return dev;
|
|
}
|
|
EXPORT_SYMBOL_GPL(cpu_device_create);
|
|
|
|
#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
|
|
static DEVICE_ATTR(modalias, 0444, print_cpu_modalias, NULL);
|
|
#endif
|
|
|
|
static struct attribute *cpu_root_attrs[] = {
|
|
#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
|
|
&dev_attr_probe.attr,
|
|
&dev_attr_release.attr,
|
|
#endif
|
|
&cpu_attrs[0].attr.attr,
|
|
&cpu_attrs[1].attr.attr,
|
|
&cpu_attrs[2].attr.attr,
|
|
&cpu_attrs[3].attr.attr,
|
|
&dev_attr_kernel_max.attr,
|
|
&dev_attr_offline.attr,
|
|
&dev_attr_isolated.attr,
|
|
#ifdef CONFIG_NO_HZ_FULL
|
|
&dev_attr_nohz_full.attr,
|
|
#endif
|
|
#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
|
|
&dev_attr_modalias.attr,
|
|
#endif
|
|
NULL
|
|
};
|
|
|
|
static struct attribute_group cpu_root_attr_group = {
|
|
.attrs = cpu_root_attrs,
|
|
};
|
|
|
|
static const struct attribute_group *cpu_root_attr_groups[] = {
|
|
&cpu_root_attr_group,
|
|
NULL,
|
|
};
|
|
|
|
bool cpu_is_hotpluggable(unsigned cpu)
|
|
{
|
|
struct device *dev = get_cpu_device(cpu);
|
|
return dev && container_of(dev, struct cpu, dev)->hotpluggable;
|
|
}
|
|
EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
|
|
|
|
#ifdef CONFIG_GENERIC_CPU_DEVICES
|
|
static DEFINE_PER_CPU(struct cpu, cpu_devices);
|
|
#endif
|
|
|
|
static void __init cpu_dev_register_generic(void)
|
|
{
|
|
#ifdef CONFIG_GENERIC_CPU_DEVICES
|
|
int i;
|
|
|
|
for_each_possible_cpu(i) {
|
|
if (register_cpu(&per_cpu(cpu_devices, i), i))
|
|
panic("Failed to register CPU device");
|
|
}
|
|
#endif
|
|
}
|
|
|
|
#ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
|
|
|
|
ssize_t __weak cpu_show_meltdown(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
return sprintf(buf, "Not affected\n");
|
|
}
|
|
|
|
ssize_t __weak cpu_show_spectre_v1(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
return sprintf(buf, "Not affected\n");
|
|
}
|
|
|
|
ssize_t __weak cpu_show_spectre_v2(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
return sprintf(buf, "Not affected\n");
|
|
}
|
|
|
|
ssize_t __weak cpu_show_spec_store_bypass(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
return sprintf(buf, "Not affected\n");
|
|
}
|
|
|
|
ssize_t __weak cpu_show_l1tf(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
return sprintf(buf, "Not affected\n");
|
|
}
|
|
|
|
ssize_t __weak cpu_show_mds(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
return sprintf(buf, "Not affected\n");
|
|
}
|
|
|
|
ssize_t __weak cpu_show_tsx_async_abort(struct device *dev,
|
|
struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
return sprintf(buf, "Not affected\n");
|
|
}
|
|
|
|
ssize_t __weak cpu_show_itlb_multihit(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
return sprintf(buf, "Not affected\n");
|
|
}
|
|
|
|
ssize_t __weak cpu_show_srbds(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
return sprintf(buf, "Not affected\n");
|
|
}
|
|
|
|
ssize_t __weak cpu_show_mmio_stale_data(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
return sysfs_emit(buf, "Not affected\n");
|
|
}
|
|
|
|
static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL);
|
|
static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL);
|
|
static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL);
|
|
static DEVICE_ATTR(spec_store_bypass, 0444, cpu_show_spec_store_bypass, NULL);
|
|
static DEVICE_ATTR(l1tf, 0444, cpu_show_l1tf, NULL);
|
|
static DEVICE_ATTR(mds, 0444, cpu_show_mds, NULL);
|
|
static DEVICE_ATTR(tsx_async_abort, 0444, cpu_show_tsx_async_abort, NULL);
|
|
static DEVICE_ATTR(itlb_multihit, 0444, cpu_show_itlb_multihit, NULL);
|
|
static DEVICE_ATTR(srbds, 0444, cpu_show_srbds, NULL);
|
|
static DEVICE_ATTR(mmio_stale_data, 0444, cpu_show_mmio_stale_data, NULL);
|
|
|
|
static struct attribute *cpu_root_vulnerabilities_attrs[] = {
|
|
&dev_attr_meltdown.attr,
|
|
&dev_attr_spectre_v1.attr,
|
|
&dev_attr_spectre_v2.attr,
|
|
&dev_attr_spec_store_bypass.attr,
|
|
&dev_attr_l1tf.attr,
|
|
&dev_attr_mds.attr,
|
|
&dev_attr_tsx_async_abort.attr,
|
|
&dev_attr_itlb_multihit.attr,
|
|
&dev_attr_srbds.attr,
|
|
&dev_attr_mmio_stale_data.attr,
|
|
NULL
|
|
};
|
|
|
|
static const struct attribute_group cpu_root_vulnerabilities_group = {
|
|
.name = "vulnerabilities",
|
|
.attrs = cpu_root_vulnerabilities_attrs,
|
|
};
|
|
|
|
static void __init cpu_register_vulnerabilities(void)
|
|
{
|
|
if (sysfs_create_group(&cpu_subsys.dev_root->kobj,
|
|
&cpu_root_vulnerabilities_group))
|
|
pr_err("Unable to register CPU vulnerabilities\n");
|
|
}
|
|
|
|
#else
|
|
static inline void cpu_register_vulnerabilities(void) { }
|
|
#endif
|
|
|
|
void __init cpu_dev_init(void)
|
|
{
|
|
if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups))
|
|
panic("Failed to register CPU subsystem");
|
|
|
|
cpu_dev_register_generic();
|
|
cpu_register_vulnerabilities();
|
|
}
|