Changes in 4.19.198
scsi: core: Retry I/O for Notify (Enable Spinup) Required error
ALSA: usb-audio: fix rate on Ozone Z90 USB headset
ALSA: usb-audio: Fix OOB access at proc output
media: dvb-usb: fix wrong definition
Input: usbtouchscreen - fix control-request directions
net: can: ems_usb: fix use-after-free in ems_usb_disconnect()
usb: gadget: eem: fix echo command packet response issue
USB: cdc-acm: blacklist Heimann USB Appset device
usb: dwc3: Fix debugfs creation flow
usb: typec: Add the missed altmode_id_remove() in typec_register_altmode()
xhci: solve a double free problem while doing s4
ntfs: fix validity check for file name attribute
iov_iter_fault_in_readable() should do nothing in xarray case
Input: joydev - prevent use of not validated data in JSIOCSBTNMAP ioctl
arm_pmu: Fix write counter incorrect in ARMv7 big-endian mode
ARM: dts: at91: sama5d4: fix pinctrl muxing
btrfs: send: fix invalid path for unlink operations after parent orphanization
btrfs: clear defrag status of a root if starting transaction fails
ext4: cleanup in-core orphan list if ext4_truncate() failed to get a transaction handle
ext4: fix kernel infoleak via ext4_extent_header
ext4: return error code when ext4_fill_flex_info() fails
ext4: correct the cache_nr in tracepoint ext4_es_shrink_exit
ext4: remove check for zero nr_to_scan in ext4_es_scan()
ext4: fix avefreec in find_group_orlov
ext4: use ext4_grp_locked_error in mb_find_extent
can: bcm: delay release of struct bcm_op after synchronize_rcu()
can: gw: synchronize rcu operations before removing gw job entry
can: peak_pciefd: pucan_handle_status(): fix a potential starvation issue in TX path
SUNRPC: Fix the batch tasks count wraparound.
SUNRPC: Should wake up the privileged task firstly.
s390/cio: dont call css_wait_for_slow_path() inside a lock
rtc: stm32: Fix unbalanced clk_disable_unprepare() on probe error path
iio: light: tcs3472: do not free unallocated IRQ
iio: ltr501: mark register holding upper 8 bits of ALS_DATA{0,1} and PS_DATA as volatile, too
iio: ltr501: ltr559: fix initialization of LTR501_ALS_CONTR
iio: ltr501: ltr501_read_ps(): add missing endianness conversion
serial: sh-sci: Stop dmaengine transfer in sci_stop_tx()
serial_cs: Add Option International GSM-Ready 56K/ISDN modem
serial_cs: remove wrong GLOBETROTTER.cis entry
ath9k: Fix kernel NULL pointer dereference during ath_reset_internal()
ssb: sdio: Don't overwrite const buffer if block_write fails
rsi: Assign beacon rate settings to the correct rate_info descriptor field
rsi: fix AP mode with WPA failure due to encrypted EAPOL
tracing/histograms: Fix parsing of "sym-offset" modifier
tracepoint: Add tracepoint_probe_register_may_exist() for BPF tracing
seq_buf: Make trace_seq_putmem_hex() support data longer than 8
powerpc/stacktrace: Fix spurious "stale" traces in raise_backtrace_ipi()
evm: Execute evm_inode_init_security() only when an HMAC key is loaded
evm: Refuse EVM_ALLOW_METADATA_WRITES only if an HMAC key is loaded
fuse: check connected before queueing on fpq->io
spi: Make of_register_spi_device also set the fwnode
spi: spi-loopback-test: Fix 'tx_buf' might be 'rx_buf'
spi: spi-topcliff-pch: Fix potential double free in pch_spi_process_messages()
spi: omap-100k: Fix the length judgment problem
regulator: uniphier: Add missing MODULE_DEVICE_TABLE
crypto: nx - add missing MODULE_DEVICE_TABLE
media: cpia2: fix memory leak in cpia2_usb_probe
media: cobalt: fix race condition in setting HPD
media: pvrusb2: fix warning in pvr2_i2c_core_done
crypto: qat - check return code of qat_hal_rd_rel_reg()
crypto: qat - remove unused macro in FW loader
sched/fair: Fix ascii art by relpacing tabs
media: em28xx: Fix possible memory leak of em28xx struct
media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release
media: bt8xx: Fix a missing check bug in bt878_probe
media: st-hva: Fix potential NULL pointer dereferences
media: dvd_usb: memory leak in cinergyt2_fe_attach
mmc: via-sdmmc: add a check against NULL pointer dereference
crypto: shash - avoid comparing pointers to exported functions under CFI
media: dvb_net: avoid speculation from net slot
media: siano: fix device register error path
media: imx-csi: Skip first few frames from a BT.656 source
btrfs: fix error handling in __btrfs_update_delayed_inode
btrfs: abort transaction if we fail to update the delayed inode
btrfs: disable build on platforms having page size 256K
regulator: da9052: Ensure enough delay time for .set_voltage_time_sel
HID: do not use down_interruptible() when unbinding devices
EDAC/ti: Add missing MODULE_DEVICE_TABLE
ACPI: processor idle: Fix up C-state latency if not ordered
hv_utils: Fix passing zero to 'PTR_ERR' warning
lib: vsprintf: Fix handling of number field widths in vsscanf
ACPI: EC: Make more Asus laptops use ECDT _GPE
block_dump: remove block_dump feature in mark_inode_dirty()
fs: dlm: cancel work sync othercon
random32: Fix implicit truncation warning in prandom_seed_state()
fs: dlm: fix memory leak when fenced
ACPICA: Fix memory leak caused by _CID repair function
ACPI: bus: Call kobject_put() in acpi_init() error path
platform/x86: toshiba_acpi: Fix missing error code in toshiba_acpi_setup_keyboard()
clocksource: Retry clock read if long delays detected
ACPI: tables: Add custom DSDT file as makefile prerequisite
HID: wacom: Correct base usage for capacitive ExpressKey status bits
ia64: mca_drv: fix incorrect array size calculation
media: s5p_cec: decrement usage count if disabled
crypto: ixp4xx - dma_unmap the correct address
crypto: ux500 - Fix error return code in hash_hw_final()
sata_highbank: fix deferred probing
pata_rb532_cf: fix deferred probing
media: I2C: change 'RST' to "RSET" to fix multiple build errors
pata_octeon_cf: avoid WARN_ON() in ata_host_activate()
evm: fix writing <securityfs>/evm overflow
crypto: ccp - Fix a resource leak in an error handling path
media: rc: i2c: Fix an error message
pata_ep93xx: fix deferred probing
media: exynos4-is: Fix a use after free in isp_video_release
media: tc358743: Fix error return code in tc358743_probe_of()
media: gspca/gl860: fix zero-length control requests
media: siano: Fix out-of-bounds warnings in smscore_load_firmware_family2()
mmc: usdhi6rol0: fix error return code in usdhi6_probe()
media: s5p-g2d: Fix a memory leak on ctx->fh.m2m_ctx
hwmon: (max31722) Remove non-standard ACPI device IDs
hwmon: (max31790) Fix fan speed reporting for fan7..12
btrfs: clear log tree recovering status if starting transaction fails
spi: spi-sun6i: Fix chipselect/clock bug
crypto: nx - Fix RCU warning in nx842_OF_upd_status
ACPI: sysfs: Fix a buffer overrun problem with description_show()
blk-wbt: introduce a new disable state to prevent false positive by rwb_enabled()
blk-wbt: make sure throttle is enabled properly
ocfs2: fix snprintf() checking
net: mvpp2: Put fwnode in error case during ->probe()
net: pch_gbe: Propagate error from devm_gpio_request_one()
drm/rockchip: cdn-dp-core: add missing clk_disable_unprepare() on error in cdn_dp_grf_write()
ehea: fix error return code in ehea_restart_qps()
RDMA/rxe: Fix failure during driver load
drm: qxl: ensure surf.data is ininitialized
tools/bpftool: Fix error return code in do_batch()
wireless: carl9170: fix LEDS build errors & warnings
ieee802154: hwsim: Fix possible memory leak in hwsim_subscribe_all_others
wcn36xx: Move hal_buf allocation to devm_kmalloc in probe
ssb: Fix error return code in ssb_bus_scan()
brcmfmac: fix setting of station info chains bitmask
brcmfmac: correctly report average RSSI in station info
brcmsmac: mac80211_if: Fix a resource leak in an error handling path
ath10k: Fix an error code in ath10k_add_interface()
netlabel: Fix memory leak in netlbl_mgmt_add_common
RDMA/mlx5: Don't add slave port to unaffiliated list
netfilter: nft_exthdr: check for IPv6 packet before further processing
netfilter: nft_osf: check for TCP packet before further processing
netfilter: nft_tproxy: restrict support to TCP and UDP transport protocols
RDMA/rxe: Fix qp reference counting for atomic ops
samples/bpf: Fix the error return code of xdp_redirect's main()
net: ethernet: aeroflex: fix UAF in greth_of_remove
net: ethernet: ezchip: fix UAF in nps_enet_remove
net: ethernet: ezchip: fix error handling
pkt_sched: sch_qfq: fix qfq_change_class() error path
vxlan: add missing rcu_read_lock() in neigh_reduce()
net/ipv4: swap flow ports when validating source
ieee802154: hwsim: Fix memory leak in hwsim_add_one
ieee802154: hwsim: avoid possible crash in hwsim_del_edge_nl()
mac80211: remove iwlwifi specific workaround NDPs of null_response
net: bcmgenet: Fix attaching to PYH failed on RPi 4B
ipv6: exthdrs: do not blindly use init_net
bpf: Do not change gso_size during bpf_skb_change_proto()
i40e: Fix error handling in i40e_vsi_open
i40e: Fix autoneg disabling for non-10GBaseT links
Revert "ibmvnic: remove duplicate napi_schedule call in open function"
ibmvnic: free tx_pool if tso_pool alloc fails
ipv6: fix out-of-bound access in ip6_parse_tlv()
Bluetooth: mgmt: Fix slab-out-of-bounds in tlv_data_is_valid
Bluetooth: Fix handling of HCI_LE_Advertising_Set_Terminated event
writeback: fix obtain a reference to a freeing memcg css
net: lwtunnel: handle MTU calculation in forwading
net: sched: fix warning in tcindex_alloc_perfect_hash
RDMA/mlx5: Don't access NULL-cleared mpi pointer
tty: nozomi: Fix a resource leak in an error handling function
mwifiex: re-fix for unaligned accesses
iio: adis_buffer: do not return ints in irq handlers
iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: accel: hid: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: accel: stk8ba50: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: adc: ti-ads1015: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: prox: srf08: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: prox: as3935: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: light: tcs3472: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: potentiostat: lmp91000: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
ASoC: hisilicon: fix missing clk_disable_unprepare() on error in hi6210_i2s_startup()
ASoC: rsnd: tidyup loop on rsnd_adg_clk_query()
Input: hil_kbd - fix error return code in hil_dev_connect()
char: pcmcia: error out if 'num_bytes_read' is greater than 4 in set_protocol()
tty: nozomi: Fix the error handling path of 'nozomi_card_init()'
scsi: FlashPoint: Rename si_flags field
fsi: core: Fix return of error values on failures
fsi: scom: Reset the FSI2PIB engine for any error
fsi/sbefifo: Clean up correct FIFO when receiving reset request from SBE
fsi/sbefifo: Fix reset timeout
visorbus: fix error return code in visorchipset_init()
s390: appldata depends on PROC_SYSCTL
eeprom: idt_89hpesx: Put fwnode in matching case during ->probe()
eeprom: idt_89hpesx: Restore printing the unsupported fwnode name
iio: adc: hx711: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: adc: mxs-lradc: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: adc: ti-ads8688: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
staging: gdm724x: check for buffer overflow in gdm_lte_multi_sdu_pkt()
staging: gdm724x: check for overflow in gdm_lte_netif_rx()
staging: mt7621-dts: fix pci address for PCI memory range
serial: 8250: Actually allow UPF_MAGIC_MULTIPLIER baud rates
iio: prox: isl29501: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
ASoC: cs42l42: Correct definition of CS42L42_ADC_PDN_MASK
of: Fix truncation of memory sizes on 32-bit platforms
mtd: rawnand: marvell: add missing clk_disable_unprepare() on error in marvell_nfc_resume()
scsi: mpt3sas: Fix error return value in _scsih_expander_add()
phy: ti: dm816x: Fix the error handling path in 'dm816x_usb_phy_probe()
extcon: sm5502: Drop invalid register write in sm5502_reg_data
extcon: max8997: Add missing modalias string
ASoC: atmel-i2s: Fix usage of capture and playback at the same time
configfs: fix memleak in configfs_release_bin_file
leds: as3645a: Fix error return code in as3645a_parse_node()
leds: ktd2692: Fix an error handling path
powerpc: Offline CPU in stop_this_cpu()
serial: mvebu-uart: correctly calculate minimal possible baudrate
arm64: dts: marvell: armada-37xx: Fix reg for standard variant of UART
vfio/pci: Handle concurrent vma faults
mm/huge_memory.c: don't discard hugepage if other processes are mapping it
selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random
perf llvm: Return -ENOMEM when asprintf() fails
mmc: block: Disable CMDQ on the ioctl path
mmc: vub3000: fix control-request direction
drm/mxsfb: Don't select DRM_KMS_FB_HELPER
drm/zte: Don't select DRM_KMS_FB_HELPER
drm/amd/amdgpu/sriov disable all ip hw status by default
net: pch_gbe: Use proper accessors to BE data in pch_ptp_match()
drm/amd/display: fix use_max_lb flag for 420 pixel formats
hugetlb: clear huge pte during flush function on mips platform
atm: iphase: fix possible use-after-free in ia_module_exit()
mISDN: fix possible use-after-free in HFC_cleanup()
atm: nicstar: Fix possible use-after-free in nicstar_cleanup()
net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT
reiserfs: add check for invalid 1st journal block
drm/virtio: Fix double free on probe failure
udf: Fix NULL pointer dereference in udf_symlink function
e100: handle eeprom as little endian
clk: renesas: r8a77995: Add ZA2 clock
clk: tegra: Ensure that PLLU configuration is applied properly
ipv6: use prandom_u32() for ID generation
RDMA/cxgb4: Fix missing error code in create_qp()
dm space maps: don't reset space map allocation cursor when committing
pinctrl: mcp23s08: fix race condition in irq handler
ice: set the value of global config lock timeout longer
virtio_net: Remove BUG() to avoid machine dead
net: bcmgenet: check return value after calling platform_get_resource()
net: mvpp2: check return value after calling platform_get_resource()
net: micrel: check return value after calling platform_get_resource()
fjes: check return value after calling platform_get_resource()
selinux: use __GFP_NOWARN with GFP_NOWAIT in the AVC
xfrm: Fix error reporting in xfrm_state_construct.
wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP
wl1251: Fix possible buffer overflow in wl1251_cmd_scan
cw1200: add missing MODULE_DEVICE_TABLE
net: fix mistake path for netdev_features_strings
rtl8xxxu: Fix device info for RTL8192EU devices
MIPS: add PMD table accounting into MIPS'pmd_alloc_one
atm: nicstar: use 'dma_free_coherent' instead of 'kfree'
atm: nicstar: register the interrupt handler in the right place
vsock: notify server to shutdown when client has pending signal
RDMA/rxe: Don't overwrite errno from ib_umem_get()
iwlwifi: mvm: don't change band on bound PHY contexts
iwlwifi: pcie: free IML DMA memory allocation
sfc: avoid double pci_remove of VFs
sfc: error code if SRIOV cannot be disabled
wireless: wext-spy: Fix out-of-bounds warning
media, bpf: Do not copy more entries than user space requested
net: ip: avoid OOM kills with large UDP sends over loopback
RDMA/cma: Fix rdma_resolve_route() memory leak
Bluetooth: Fix the HCI to MGMT status conversion table
Bluetooth: Shutdown controller after workqueues are flushed or cancelled
Bluetooth: btusb: fix bt fiwmare downloading failure issue for qca btsoc.
sctp: validate from_addr_param return
sctp: add size validation when walking chunks
MIPS: set mips32r5 for virt extensions
fscrypt: don't ignore minor_hash when hash is 0
bdi: Do not use freezable workqueue
serial: mvebu-uart: clarify the baud rate derivation
serial: mvebu-uart: fix calculation of clock divisor
fuse: reject internal errno
powerpc/barrier: Avoid collision with clang's __lwsync macro
usb: gadget: f_fs: Fix setting of device and driver data cross-references
drm/radeon: Add the missed drm_gem_object_put() in radeon_user_framebuffer_create()
drm/amd/display: fix incorrrect valid irq check
pinctrl/amd: Add device HID for new AMD GPIO controller
drm/msm/mdp4: Fix modifier support enabling
mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
mmc: core: clear flags before allowing to retune
mmc: core: Allow UHS-I voltage switch for SDSC cards if supported
ata: ahci_sunxi: Disable DIPM
cpu/hotplug: Cure the cpusets trainwreck
clocksource/arm_arch_timer: Improve Allwinner A64 timer workaround
ASoC: tegra: Set driver_name=tegra for all machine drivers
qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
ipmi/watchdog: Stop watchdog timer when the current action is 'none'
power: supply: ab8500: Fix an old bug
seq_buf: Fix overflow in seq_buf_putmem_hex()
tracing: Simplify & fix saved_tgids logic
tracing: Resize tgid_map to pid_max, not PID_MAX_DEFAULT
ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe
coresight: tmc-etf: Fix global-out-of-bounds in tmc_update_etf_buffer()
dm btree remove: assign new_root only when removal succeeds
PCI: Leave Apple Thunderbolt controllers on for s2idle or standby
PCI: aardvark: Fix checking for PIO Non-posted Request
media: subdev: disallow ioctl for saa6588/davinci
media: dtv5100: fix control-request directions
media: zr364xx: fix memory leak in zr364xx_start_readpipe
media: gspca/sq905: fix control-request direction
media: gspca/sunplus: fix zero-length control requests
media: uvcvideo: Fix pixel format change for Elgato Cam Link 4K
pinctrl: mcp23s08: Fix missing unlock on error in mcp23s08_irq()
jfs: fix GPF in diFree
smackfs: restrict bytes count in smk_set_cipso()
KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled
KVM: X86: Disable hardware breakpoints unconditionally before kvm_x86->run()
scsi: core: Fix bad pointer dereference when ehandler kthread is invalid
tracing: Do not reference char * as a string in histograms
PCI: aardvark: Don't rely on jiffies while holding spinlock
PCI: aardvark: Fix kernel panic during PIO transfer
tty: serial: fsl_lpuart: fix the potential risk of division or modulo by zero
misc/libmasm/module: Fix two use after free in ibmasm_init_one
Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro"
w1: ds2438: fixing bug that would always get page0
scsi: lpfc: Fix "Unexpected timeout" error in direct attach topology
scsi: lpfc: Fix crash when lpfc_sli4_hba_setup() fails to initialize the SGLs
scsi: core: Cap scsi_host cmd_per_lun at can_queue
ALSA: ac97: fix PM reference leak in ac97_bus_remove()
tty: serial: 8250: serial_cs: Fix a memory leak in error handling path
scsi: scsi_dh_alua: Check for negative result value
fs/jfs: Fix missing error code in lmLogInit()
scsi: iscsi: Add iscsi_cls_conn refcount helpers
scsi: iscsi: Fix conn use after free during resets
scsi: iscsi: Fix shost->max_id use
scsi: qedi: Fix null ref during abort handling
mfd: da9052/stmpe: Add and modify MODULE_DEVICE_TABLE
s390/sclp_vt220: fix console name to match device
selftests: timers: rtcpie: skip test if default RTC device does not exist
ALSA: sb: Fix potential double-free of CSP mixer elements
powerpc/ps3: Add dma_mask to ps3_dma_region
gpio: zynq: Check return value of pm_runtime_get_sync
ALSA: ppc: fix error return code in snd_pmac_probe()
selftests/powerpc: Fix "no_handler" EBB selftest
gpio: pca953x: Add support for the On Semi pca9655
ASoC: soc-core: Fix the error return code in snd_soc_of_parse_audio_routing()
Input: hideep - fix the uninitialized use in hideep_nvm_unlock()
ALSA: bebob: add support for ToneWeal FW66
usb: gadget: f_hid: fix endianness issue with descriptors
usb: gadget: hid: fix error return code in hid_bind()
powerpc/boot: Fixup device-tree on little endian
backlight: lm3630a: Fix return code of .update_status() callback
ALSA: hda: Add IRQ check for platform_get_irq()
staging: rtl8723bs: fix macro value for 2.4Ghz only device
intel_th: Wait until port is in reset before programming it
i2c: core: Disable client irq on reboot/shutdown
lib/decompress_unlz4.c: correctly handle zero-padding around initrds.
pwm: spear: Don't modify HW state in .remove callback
power: supply: ab8500: Avoid NULL pointers
power: supply: max17042: Do not enforce (incorrect) interrupt trigger type
power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE
ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1
watchdog: Fix possible use-after-free in wdt_startup()
watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff()
watchdog: Fix possible use-after-free by calling del_timer_sync()
watchdog: iTCO_wdt: Account for rebooting on second timeout
x86/fpu: Return proper error codes from user access functions
PCI: tegra: Add missing MODULE_DEVICE_TABLE
orangefs: fix orangefs df output.
ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty
NFS: nfs_find_open_context() may only select open files
power: supply: charger-manager: add missing MODULE_DEVICE_TABLE
power: supply: ab8500: add missing MODULE_DEVICE_TABLE
pwm: tegra: Don't modify HW state in .remove callback
ACPI: AMBA: Fix resource name in /proc/iomem
ACPI: video: Add quirk for the Dell Vostro 3350
virtio-blk: Fix memory leak among suspend/resume procedure
virtio_net: Fix error handling in virtnet_restore()
virtio_console: Assure used length from device is limited
f2fs: add MODULE_SOFTDEP to ensure crc32 is included in the initramfs
PCI/sysfs: Fix dsm_label_utf16s_to_utf8s() buffer overrun
power: supply: rt5033_battery: Fix device tree enumeration
NFSv4: Initialise connection to the server in nfs4_alloc_client()
um: fix error return code in slip_open()
um: fix error return code in winch_tramp()
watchdog: aspeed: fix hardware timeout calculation
nfs: fix acl memory leak of posix_acl_create()
ubifs: Set/Clear I_LINKABLE under i_lock for whiteout inode
PCI: iproc: Fix multi-MSI base vector number allocation
PCI: iproc: Support multi-MSI only on uniprocessor kernel
x86/fpu: Limit xstate copy size in xstateregs_set()
virtio_net: move tx vq operation under tx queue lock
ALSA: isa: Fix error return code in snd_cmi8330_probe()
NFSv4/pNFS: Don't call _nfs4_pnfs_v3_ds_connect multiple times
hexagon: use common DISCARDS macro
reset: a10sr: add missing of_match_table reference
ARM: dts: exynos: fix PWM LED max brightness on Odroid XU/XU3
ARM: dts: exynos: fix PWM LED max brightness on Odroid HC1
ARM: dts: exynos: fix PWM LED max brightness on Odroid XU4
memory: atmel-ebi: add missing of_node_put for loop iteration
rtc: fix snprintf() checking in is_rtc_hctosys()
arm64: dts: renesas: v3msk: Fix memory size
ARM: dts: r8a7779, marzen: Fix DU clock names
ARM: dts: BCM5301X: Fixup SPI binding
reset: bail if try_module_get() fails
memory: fsl_ifc: fix leak of IO mapping on probe failure
memory: fsl_ifc: fix leak of private memory on probe failure
ARM: dts: am335x: align ti,pindir-d0-out-d1-in property with dt-shema
ARM: dts: am437x: align ti,pindir-d0-out-d1-in property with dt-shema
ARM: dts: imx6q-dhcom: Fix ethernet reset time properties
ARM: dts: imx6q-dhcom: Fix ethernet plugin detection problems
ARM: dts: imx6q-dhcom: Add gpios pinctrl for i2c bus recovery
scsi: be2iscsi: Fix an error handling path in beiscsi_dev_probe()
mips: always link byteswap helpers into decompressor
mips: disable branch profiling in boot/decompress.o
MIPS: vdso: Invalid GIC access through VDSO
net: bridge: multicast: fix PIM hello router port marking race
scsi: scsi_dh_alua: Fix signedness bug in alua_rtpg()
seq_file: disallow extremely large seq buffer allocations
Linux 4.19.198
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iaa8a95c4d30ca85021bae6c60b4818038797e04e
990 lines
26 KiB
C
990 lines
26 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* S390 version
|
|
* Copyright IBM Corp. 1999, 2012
|
|
* Author(s): Hartmut Penner (hp@de.ibm.com),
|
|
* Martin Schwidefsky (schwidefsky@de.ibm.com)
|
|
*
|
|
* Derived from "arch/i386/kernel/setup.c"
|
|
* Copyright (C) 1995, Linus Torvalds
|
|
*/
|
|
|
|
/*
|
|
* This file handles the architecture-dependent parts of initialization
|
|
*/
|
|
|
|
#define KMSG_COMPONENT "setup"
|
|
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
|
|
|
|
#include <linux/errno.h>
|
|
#include <linux/export.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/sched/task.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/memblock.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/stddef.h>
|
|
#include <linux/unistd.h>
|
|
#include <linux/ptrace.h>
|
|
#include <linux/random.h>
|
|
#include <linux/user.h>
|
|
#include <linux/tty.h>
|
|
#include <linux/ioport.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/init.h>
|
|
#include <linux/initrd.h>
|
|
#include <linux/bootmem.h>
|
|
#include <linux/root_dev.h>
|
|
#include <linux/console.h>
|
|
#include <linux/kernel_stat.h>
|
|
#include <linux/dma-contiguous.h>
|
|
#include <linux/device.h>
|
|
#include <linux/notifier.h>
|
|
#include <linux/pfn.h>
|
|
#include <linux/ctype.h>
|
|
#include <linux/reboot.h>
|
|
#include <linux/topology.h>
|
|
#include <linux/kexec.h>
|
|
#include <linux/crash_dump.h>
|
|
#include <linux/memory.h>
|
|
#include <linux/compat.h>
|
|
|
|
#include <asm/ipl.h>
|
|
#include <asm/facility.h>
|
|
#include <asm/smp.h>
|
|
#include <asm/mmu_context.h>
|
|
#include <asm/cpcmd.h>
|
|
#include <asm/lowcore.h>
|
|
#include <asm/nmi.h>
|
|
#include <asm/irq.h>
|
|
#include <asm/page.h>
|
|
#include <asm/ptrace.h>
|
|
#include <asm/sections.h>
|
|
#include <asm/ebcdic.h>
|
|
#include <asm/diag.h>
|
|
#include <asm/os_info.h>
|
|
#include <asm/sclp.h>
|
|
#include <asm/sysinfo.h>
|
|
#include <asm/numa.h>
|
|
#include <asm/alternative.h>
|
|
#include <asm/nospec-branch.h>
|
|
#include "entry.h"
|
|
|
|
/*
|
|
* Machine setup..
|
|
*/
|
|
unsigned int console_mode = 0;
|
|
EXPORT_SYMBOL(console_mode);
|
|
|
|
unsigned int console_devno = -1;
|
|
EXPORT_SYMBOL(console_devno);
|
|
|
|
unsigned int console_irq = -1;
|
|
EXPORT_SYMBOL(console_irq);
|
|
|
|
unsigned long elf_hwcap __read_mostly = 0;
|
|
char elf_platform[ELF_PLATFORM_SIZE];
|
|
|
|
unsigned long int_hwcap = 0;
|
|
|
|
int __initdata memory_end_set;
|
|
unsigned long __initdata memory_end;
|
|
unsigned long __initdata max_physmem_end;
|
|
|
|
unsigned long VMALLOC_START;
|
|
EXPORT_SYMBOL(VMALLOC_START);
|
|
|
|
unsigned long VMALLOC_END;
|
|
EXPORT_SYMBOL(VMALLOC_END);
|
|
|
|
struct page *vmemmap;
|
|
EXPORT_SYMBOL(vmemmap);
|
|
|
|
unsigned long MODULES_VADDR;
|
|
unsigned long MODULES_END;
|
|
|
|
/* An array with a pointer to the lowcore of every CPU. */
|
|
struct lowcore *lowcore_ptr[NR_CPUS];
|
|
EXPORT_SYMBOL(lowcore_ptr);
|
|
|
|
/*
|
|
* This is set up by the setup-routine at boot-time
|
|
* for S390 need to find out, what we have to setup
|
|
* using address 0x10400 ...
|
|
*/
|
|
|
|
#include <asm/setup.h>
|
|
|
|
/*
|
|
* condev= and conmode= setup parameter.
|
|
*/
|
|
|
|
static int __init condev_setup(char *str)
|
|
{
|
|
int vdev;
|
|
|
|
vdev = simple_strtoul(str, &str, 0);
|
|
if (vdev >= 0 && vdev < 65536) {
|
|
console_devno = vdev;
|
|
console_irq = -1;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
__setup("condev=", condev_setup);
|
|
|
|
static void __init set_preferred_console(void)
|
|
{
|
|
if (CONSOLE_IS_3215 || CONSOLE_IS_SCLP)
|
|
add_preferred_console("ttyS", 0, NULL);
|
|
else if (CONSOLE_IS_3270)
|
|
add_preferred_console("tty3270", 0, NULL);
|
|
else if (CONSOLE_IS_VT220)
|
|
add_preferred_console("ttysclp", 0, NULL);
|
|
else if (CONSOLE_IS_HVC)
|
|
add_preferred_console("hvc", 0, NULL);
|
|
}
|
|
|
|
static int __init conmode_setup(char *str)
|
|
{
|
|
#if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
|
|
if (strncmp(str, "hwc", 4) == 0 || strncmp(str, "sclp", 5) == 0)
|
|
SET_CONSOLE_SCLP;
|
|
#endif
|
|
#if defined(CONFIG_TN3215_CONSOLE)
|
|
if (strncmp(str, "3215", 5) == 0)
|
|
SET_CONSOLE_3215;
|
|
#endif
|
|
#if defined(CONFIG_TN3270_CONSOLE)
|
|
if (strncmp(str, "3270", 5) == 0)
|
|
SET_CONSOLE_3270;
|
|
#endif
|
|
set_preferred_console();
|
|
return 1;
|
|
}
|
|
|
|
__setup("conmode=", conmode_setup);
|
|
|
|
static void __init conmode_default(void)
|
|
{
|
|
char query_buffer[1024];
|
|
char *ptr;
|
|
|
|
if (MACHINE_IS_VM) {
|
|
cpcmd("QUERY CONSOLE", query_buffer, 1024, NULL);
|
|
console_devno = simple_strtoul(query_buffer + 5, NULL, 16);
|
|
ptr = strstr(query_buffer, "SUBCHANNEL =");
|
|
console_irq = simple_strtoul(ptr + 13, NULL, 16);
|
|
cpcmd("QUERY TERM", query_buffer, 1024, NULL);
|
|
ptr = strstr(query_buffer, "CONMODE");
|
|
/*
|
|
* Set the conmode to 3215 so that the device recognition
|
|
* will set the cu_type of the console to 3215. If the
|
|
* conmode is 3270 and we don't set it back then both
|
|
* 3215 and the 3270 driver will try to access the console
|
|
* device (3215 as console and 3270 as normal tty).
|
|
*/
|
|
cpcmd("TERM CONMODE 3215", NULL, 0, NULL);
|
|
if (ptr == NULL) {
|
|
#if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
|
|
SET_CONSOLE_SCLP;
|
|
#endif
|
|
return;
|
|
}
|
|
if (strncmp(ptr + 8, "3270", 4) == 0) {
|
|
#if defined(CONFIG_TN3270_CONSOLE)
|
|
SET_CONSOLE_3270;
|
|
#elif defined(CONFIG_TN3215_CONSOLE)
|
|
SET_CONSOLE_3215;
|
|
#elif defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
|
|
SET_CONSOLE_SCLP;
|
|
#endif
|
|
} else if (strncmp(ptr + 8, "3215", 4) == 0) {
|
|
#if defined(CONFIG_TN3215_CONSOLE)
|
|
SET_CONSOLE_3215;
|
|
#elif defined(CONFIG_TN3270_CONSOLE)
|
|
SET_CONSOLE_3270;
|
|
#elif defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
|
|
SET_CONSOLE_SCLP;
|
|
#endif
|
|
}
|
|
} else if (MACHINE_IS_KVM) {
|
|
if (sclp.has_vt220 && IS_ENABLED(CONFIG_SCLP_VT220_CONSOLE))
|
|
SET_CONSOLE_VT220;
|
|
else if (sclp.has_linemode && IS_ENABLED(CONFIG_SCLP_CONSOLE))
|
|
SET_CONSOLE_SCLP;
|
|
else
|
|
SET_CONSOLE_HVC;
|
|
} else {
|
|
#if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
|
|
SET_CONSOLE_SCLP;
|
|
#endif
|
|
}
|
|
if (IS_ENABLED(CONFIG_VT) && IS_ENABLED(CONFIG_DUMMY_CONSOLE))
|
|
conswitchp = &dummy_con;
|
|
}
|
|
|
|
#ifdef CONFIG_CRASH_DUMP
|
|
static void __init setup_zfcpdump(void)
|
|
{
|
|
if (ipl_info.type != IPL_TYPE_FCP_DUMP)
|
|
return;
|
|
if (OLDMEM_BASE)
|
|
return;
|
|
strcat(boot_command_line, " cio_ignore=all,!ipldev,!condev");
|
|
console_loglevel = 2;
|
|
}
|
|
#else
|
|
static inline void setup_zfcpdump(void) {}
|
|
#endif /* CONFIG_CRASH_DUMP */
|
|
|
|
/*
|
|
* Reboot, halt and power_off stubs. They just call _machine_restart,
|
|
* _machine_halt or _machine_power_off.
|
|
*/
|
|
|
|
void machine_restart(char *command)
|
|
{
|
|
if ((!in_interrupt() && !in_atomic()) || oops_in_progress)
|
|
/*
|
|
* Only unblank the console if we are called in enabled
|
|
* context or a bust_spinlocks cleared the way for us.
|
|
*/
|
|
console_unblank();
|
|
_machine_restart(command);
|
|
}
|
|
|
|
void machine_halt(void)
|
|
{
|
|
if (!in_interrupt() || oops_in_progress)
|
|
/*
|
|
* Only unblank the console if we are called in enabled
|
|
* context or a bust_spinlocks cleared the way for us.
|
|
*/
|
|
console_unblank();
|
|
_machine_halt();
|
|
}
|
|
|
|
void machine_power_off(void)
|
|
{
|
|
if (!in_interrupt() || oops_in_progress)
|
|
/*
|
|
* Only unblank the console if we are called in enabled
|
|
* context or a bust_spinlocks cleared the way for us.
|
|
*/
|
|
console_unblank();
|
|
_machine_power_off();
|
|
}
|
|
|
|
/*
|
|
* Dummy power off function.
|
|
*/
|
|
void (*pm_power_off)(void) = machine_power_off;
|
|
EXPORT_SYMBOL_GPL(pm_power_off);
|
|
|
|
static int __init early_parse_mem(char *p)
|
|
{
|
|
memory_end = memparse(p, &p);
|
|
memory_end &= PAGE_MASK;
|
|
memory_end_set = 1;
|
|
return 0;
|
|
}
|
|
early_param("mem", early_parse_mem);
|
|
|
|
static int __init parse_vmalloc(char *arg)
|
|
{
|
|
if (!arg)
|
|
return -EINVAL;
|
|
VMALLOC_END = (memparse(arg, &arg) + PAGE_SIZE - 1) & PAGE_MASK;
|
|
return 0;
|
|
}
|
|
early_param("vmalloc", parse_vmalloc);
|
|
|
|
void *restart_stack __section(.data);
|
|
|
|
static void __init setup_lowcore_dat_off(void)
|
|
{
|
|
struct lowcore *lc;
|
|
|
|
/*
|
|
* Setup lowcore for boot cpu
|
|
*/
|
|
BUILD_BUG_ON(sizeof(struct lowcore) != LC_PAGES * PAGE_SIZE);
|
|
lc = memblock_virt_alloc_low(sizeof(*lc), sizeof(*lc));
|
|
lc->restart_psw.mask = PSW_KERNEL_BITS;
|
|
lc->restart_psw.addr = (unsigned long) restart_int_handler;
|
|
lc->external_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK;
|
|
lc->external_new_psw.addr = (unsigned long) ext_int_handler;
|
|
lc->svc_new_psw.mask = PSW_KERNEL_BITS |
|
|
PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
|
|
lc->svc_new_psw.addr = (unsigned long) system_call;
|
|
lc->program_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK;
|
|
lc->program_new_psw.addr = (unsigned long) pgm_check_handler;
|
|
lc->mcck_new_psw.mask = PSW_KERNEL_BITS;
|
|
lc->mcck_new_psw.addr = (unsigned long) mcck_int_handler;
|
|
lc->io_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK;
|
|
lc->io_new_psw.addr = (unsigned long) io_int_handler;
|
|
lc->clock_comparator = clock_comparator_max;
|
|
lc->kernel_stack = ((unsigned long) &init_thread_union)
|
|
+ THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
|
|
lc->async_stack = (unsigned long)
|
|
memblock_virt_alloc(ASYNC_SIZE, ASYNC_SIZE)
|
|
+ ASYNC_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
|
|
lc->panic_stack = (unsigned long)
|
|
memblock_virt_alloc(PAGE_SIZE, PAGE_SIZE)
|
|
+ PAGE_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
|
|
lc->current_task = (unsigned long)&init_task;
|
|
lc->lpp = LPP_MAGIC;
|
|
lc->machine_flags = S390_lowcore.machine_flags;
|
|
lc->preempt_count = S390_lowcore.preempt_count;
|
|
lc->stfl_fac_list = S390_lowcore.stfl_fac_list;
|
|
memcpy(lc->stfle_fac_list, S390_lowcore.stfle_fac_list,
|
|
sizeof(lc->stfle_fac_list));
|
|
memcpy(lc->alt_stfle_fac_list, S390_lowcore.alt_stfle_fac_list,
|
|
sizeof(lc->alt_stfle_fac_list));
|
|
nmi_alloc_boot_cpu(lc);
|
|
vdso_alloc_boot_cpu(lc);
|
|
lc->sync_enter_timer = S390_lowcore.sync_enter_timer;
|
|
lc->async_enter_timer = S390_lowcore.async_enter_timer;
|
|
lc->exit_timer = S390_lowcore.exit_timer;
|
|
lc->user_timer = S390_lowcore.user_timer;
|
|
lc->system_timer = S390_lowcore.system_timer;
|
|
lc->steal_timer = S390_lowcore.steal_timer;
|
|
lc->last_update_timer = S390_lowcore.last_update_timer;
|
|
lc->last_update_clock = S390_lowcore.last_update_clock;
|
|
|
|
restart_stack = memblock_virt_alloc(ASYNC_SIZE, ASYNC_SIZE);
|
|
restart_stack += ASYNC_SIZE;
|
|
|
|
/*
|
|
* Set up PSW restart to call ipl.c:do_restart(). Copy the relevant
|
|
* restart data to the absolute zero lowcore. This is necessary if
|
|
* PSW restart is done on an offline CPU that has lowcore zero.
|
|
*/
|
|
lc->restart_stack = (unsigned long) restart_stack;
|
|
lc->restart_fn = (unsigned long) do_restart;
|
|
lc->restart_data = 0;
|
|
lc->restart_source = -1UL;
|
|
|
|
/* Setup absolute zero lowcore */
|
|
mem_assign_absolute(S390_lowcore.restart_stack, lc->restart_stack);
|
|
mem_assign_absolute(S390_lowcore.restart_fn, lc->restart_fn);
|
|
mem_assign_absolute(S390_lowcore.restart_data, lc->restart_data);
|
|
mem_assign_absolute(S390_lowcore.restart_source, lc->restart_source);
|
|
mem_assign_absolute(S390_lowcore.restart_psw, lc->restart_psw);
|
|
|
|
#ifdef CONFIG_SMP
|
|
lc->spinlock_lockval = arch_spin_lockval(0);
|
|
lc->spinlock_index = 0;
|
|
arch_spin_lock_setup(0);
|
|
#endif
|
|
lc->br_r1_trampoline = 0x07f1; /* br %r1 */
|
|
|
|
set_prefix((u32)(unsigned long) lc);
|
|
lowcore_ptr[0] = lc;
|
|
}
|
|
|
|
static void __init setup_lowcore_dat_on(void)
|
|
{
|
|
__ctl_clear_bit(0, 28);
|
|
S390_lowcore.external_new_psw.mask |= PSW_MASK_DAT;
|
|
S390_lowcore.svc_new_psw.mask |= PSW_MASK_DAT;
|
|
S390_lowcore.program_new_psw.mask |= PSW_MASK_DAT;
|
|
S390_lowcore.io_new_psw.mask |= PSW_MASK_DAT;
|
|
__ctl_set_bit(0, 28);
|
|
}
|
|
|
|
static struct resource code_resource = {
|
|
.name = "Kernel code",
|
|
.flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM,
|
|
};
|
|
|
|
static struct resource data_resource = {
|
|
.name = "Kernel data",
|
|
.flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM,
|
|
};
|
|
|
|
static struct resource bss_resource = {
|
|
.name = "Kernel bss",
|
|
.flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM,
|
|
};
|
|
|
|
static struct resource __initdata *standard_resources[] = {
|
|
&code_resource,
|
|
&data_resource,
|
|
&bss_resource,
|
|
};
|
|
|
|
static void __init setup_resources(void)
|
|
{
|
|
struct resource *res, *std_res, *sub_res;
|
|
struct memblock_region *reg;
|
|
int j;
|
|
|
|
code_resource.start = (unsigned long) _text;
|
|
code_resource.end = (unsigned long) _etext - 1;
|
|
data_resource.start = (unsigned long) _etext;
|
|
data_resource.end = (unsigned long) _edata - 1;
|
|
bss_resource.start = (unsigned long) __bss_start;
|
|
bss_resource.end = (unsigned long) __bss_stop - 1;
|
|
|
|
for_each_memblock(memory, reg) {
|
|
res = memblock_virt_alloc(sizeof(*res), 8);
|
|
res->flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM;
|
|
|
|
res->name = "System RAM";
|
|
res->start = reg->base;
|
|
res->end = reg->base + reg->size - 1;
|
|
request_resource(&iomem_resource, res);
|
|
|
|
for (j = 0; j < ARRAY_SIZE(standard_resources); j++) {
|
|
std_res = standard_resources[j];
|
|
if (std_res->start < res->start ||
|
|
std_res->start > res->end)
|
|
continue;
|
|
if (std_res->end > res->end) {
|
|
sub_res = memblock_virt_alloc(sizeof(*sub_res), 8);
|
|
*sub_res = *std_res;
|
|
sub_res->end = res->end;
|
|
std_res->start = res->end + 1;
|
|
request_resource(res, sub_res);
|
|
} else {
|
|
request_resource(res, std_res);
|
|
}
|
|
}
|
|
}
|
|
#ifdef CONFIG_CRASH_DUMP
|
|
/*
|
|
* Re-add removed crash kernel memory as reserved memory. This makes
|
|
* sure it will be mapped with the identity mapping and struct pages
|
|
* will be created, so it can be resized later on.
|
|
* However add it later since the crash kernel resource should not be
|
|
* part of the System RAM resource.
|
|
*/
|
|
if (crashk_res.end) {
|
|
memblock_add_node(crashk_res.start, resource_size(&crashk_res), 0);
|
|
memblock_reserve(crashk_res.start, resource_size(&crashk_res));
|
|
insert_resource(&iomem_resource, &crashk_res);
|
|
}
|
|
#endif
|
|
}
|
|
|
|
static void __init setup_memory_end(void)
|
|
{
|
|
unsigned long vmax, vmalloc_size, tmp;
|
|
|
|
/* Choose kernel address space layout: 2, 3, or 4 levels. */
|
|
vmalloc_size = VMALLOC_END ?: (128UL << 30) - MODULES_LEN;
|
|
tmp = (memory_end ?: max_physmem_end) / PAGE_SIZE;
|
|
tmp = tmp * (sizeof(struct page) + PAGE_SIZE);
|
|
if (tmp + vmalloc_size + MODULES_LEN <= _REGION2_SIZE)
|
|
vmax = _REGION2_SIZE; /* 3-level kernel page table */
|
|
else
|
|
vmax = _REGION1_SIZE; /* 4-level kernel page table */
|
|
/* module area is at the end of the kernel address space. */
|
|
MODULES_END = vmax;
|
|
MODULES_VADDR = MODULES_END - MODULES_LEN;
|
|
VMALLOC_END = MODULES_VADDR;
|
|
VMALLOC_START = vmax - vmalloc_size;
|
|
|
|
/* Split remaining virtual space between 1:1 mapping & vmemmap array */
|
|
tmp = VMALLOC_START / (PAGE_SIZE + sizeof(struct page));
|
|
/* vmemmap contains a multiple of PAGES_PER_SECTION struct pages */
|
|
tmp = SECTION_ALIGN_UP(tmp);
|
|
tmp = VMALLOC_START - tmp * sizeof(struct page);
|
|
tmp &= ~((vmax >> 11) - 1); /* align to page table level */
|
|
tmp = min(tmp, 1UL << MAX_PHYSMEM_BITS);
|
|
vmemmap = (struct page *) tmp;
|
|
|
|
/* Take care that memory_end is set and <= vmemmap */
|
|
memory_end = min(memory_end ?: max_physmem_end, tmp);
|
|
max_pfn = max_low_pfn = PFN_DOWN(memory_end);
|
|
memblock_remove(memory_end, ULONG_MAX);
|
|
|
|
pr_notice("The maximum memory size is %luMB\n", memory_end >> 20);
|
|
}
|
|
|
|
#ifdef CONFIG_CRASH_DUMP
|
|
|
|
/*
|
|
* When kdump is enabled, we have to ensure that no memory from
|
|
* the area [0 - crashkernel memory size] and
|
|
* [crashk_res.start - crashk_res.end] is set offline.
|
|
*/
|
|
static int kdump_mem_notifier(struct notifier_block *nb,
|
|
unsigned long action, void *data)
|
|
{
|
|
struct memory_notify *arg = data;
|
|
|
|
if (action != MEM_GOING_OFFLINE)
|
|
return NOTIFY_OK;
|
|
if (arg->start_pfn < PFN_DOWN(resource_size(&crashk_res)))
|
|
return NOTIFY_BAD;
|
|
if (arg->start_pfn > PFN_DOWN(crashk_res.end))
|
|
return NOTIFY_OK;
|
|
if (arg->start_pfn + arg->nr_pages - 1 < PFN_DOWN(crashk_res.start))
|
|
return NOTIFY_OK;
|
|
return NOTIFY_BAD;
|
|
}
|
|
|
|
static struct notifier_block kdump_mem_nb = {
|
|
.notifier_call = kdump_mem_notifier,
|
|
};
|
|
|
|
#endif
|
|
|
|
/*
|
|
* Make sure that the area behind memory_end is protected
|
|
*/
|
|
static void __init reserve_memory_end(void)
|
|
{
|
|
#ifdef CONFIG_CRASH_DUMP
|
|
if (ipl_info.type == IPL_TYPE_FCP_DUMP &&
|
|
!OLDMEM_BASE && sclp.hsa_size) {
|
|
memory_end = sclp.hsa_size;
|
|
memory_end &= PAGE_MASK;
|
|
memory_end_set = 1;
|
|
}
|
|
#endif
|
|
if (!memory_end_set)
|
|
return;
|
|
memblock_reserve(memory_end, ULONG_MAX);
|
|
}
|
|
|
|
/*
|
|
* Make sure that oldmem, where the dump is stored, is protected
|
|
*/
|
|
static void __init reserve_oldmem(void)
|
|
{
|
|
#ifdef CONFIG_CRASH_DUMP
|
|
if (OLDMEM_BASE)
|
|
/* Forget all memory above the running kdump system */
|
|
memblock_reserve(OLDMEM_SIZE, (phys_addr_t)ULONG_MAX);
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* Make sure that oldmem, where the dump is stored, is protected
|
|
*/
|
|
static void __init remove_oldmem(void)
|
|
{
|
|
#ifdef CONFIG_CRASH_DUMP
|
|
if (OLDMEM_BASE)
|
|
/* Forget all memory above the running kdump system */
|
|
memblock_remove(OLDMEM_SIZE, (phys_addr_t)ULONG_MAX);
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* Reserve memory for kdump kernel to be loaded with kexec
|
|
*/
|
|
static void __init reserve_crashkernel(void)
|
|
{
|
|
#ifdef CONFIG_CRASH_DUMP
|
|
unsigned long long crash_base, crash_size;
|
|
phys_addr_t low, high;
|
|
int rc;
|
|
|
|
rc = parse_crashkernel(boot_command_line, memory_end, &crash_size,
|
|
&crash_base);
|
|
|
|
crash_base = ALIGN(crash_base, KEXEC_CRASH_MEM_ALIGN);
|
|
crash_size = ALIGN(crash_size, KEXEC_CRASH_MEM_ALIGN);
|
|
if (rc || crash_size == 0)
|
|
return;
|
|
|
|
if (memblock.memory.regions[0].size < crash_size) {
|
|
pr_info("crashkernel reservation failed: %s\n",
|
|
"first memory chunk must be at least crashkernel size");
|
|
return;
|
|
}
|
|
|
|
low = crash_base ?: OLDMEM_BASE;
|
|
high = low + crash_size;
|
|
if (low >= OLDMEM_BASE && high <= OLDMEM_BASE + OLDMEM_SIZE) {
|
|
/* The crashkernel fits into OLDMEM, reuse OLDMEM */
|
|
crash_base = low;
|
|
} else {
|
|
/* Find suitable area in free memory */
|
|
low = max_t(unsigned long, crash_size, sclp.hsa_size);
|
|
high = crash_base ? crash_base + crash_size : ULONG_MAX;
|
|
|
|
if (crash_base && crash_base < low) {
|
|
pr_info("crashkernel reservation failed: %s\n",
|
|
"crash_base too low");
|
|
return;
|
|
}
|
|
low = crash_base ?: low;
|
|
crash_base = memblock_find_in_range(low, high, crash_size,
|
|
KEXEC_CRASH_MEM_ALIGN);
|
|
}
|
|
|
|
if (!crash_base) {
|
|
pr_info("crashkernel reservation failed: %s\n",
|
|
"no suitable area found");
|
|
return;
|
|
}
|
|
|
|
if (register_memory_notifier(&kdump_mem_nb))
|
|
return;
|
|
|
|
if (!OLDMEM_BASE && MACHINE_IS_VM)
|
|
diag10_range(PFN_DOWN(crash_base), PFN_DOWN(crash_size));
|
|
crashk_res.start = crash_base;
|
|
crashk_res.end = crash_base + crash_size - 1;
|
|
memblock_remove(crash_base, crash_size);
|
|
pr_info("Reserving %lluMB of memory at %lluMB "
|
|
"for crashkernel (System RAM: %luMB)\n",
|
|
crash_size >> 20, crash_base >> 20,
|
|
(unsigned long)memblock.memory.total_size >> 20);
|
|
os_info_crashkernel_add(crash_base, crash_size);
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* Reserve the initrd from being used by memblock
|
|
*/
|
|
static void __init reserve_initrd(void)
|
|
{
|
|
#ifdef CONFIG_BLK_DEV_INITRD
|
|
if (!INITRD_START || !INITRD_SIZE)
|
|
return;
|
|
initrd_start = INITRD_START;
|
|
initrd_end = initrd_start + INITRD_SIZE;
|
|
memblock_reserve(INITRD_START, INITRD_SIZE);
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* Check for initrd being in usable memory
|
|
*/
|
|
static void __init check_initrd(void)
|
|
{
|
|
#ifdef CONFIG_BLK_DEV_INITRD
|
|
if (INITRD_START && INITRD_SIZE &&
|
|
!memblock_is_region_memory(INITRD_START, INITRD_SIZE)) {
|
|
pr_err("The initial RAM disk does not fit into the memory\n");
|
|
memblock_free(INITRD_START, INITRD_SIZE);
|
|
initrd_start = initrd_end = 0;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* Reserve memory used for lowcore/command line/kernel image.
|
|
*/
|
|
static void __init reserve_kernel(void)
|
|
{
|
|
unsigned long start_pfn = PFN_UP(__pa(_end));
|
|
|
|
#ifdef CONFIG_DMA_API_DEBUG
|
|
/*
|
|
* DMA_API_DEBUG code stumbles over addresses from the
|
|
* range [PARMAREA_END, _stext]. Mark the memory as reserved
|
|
* so it is not used for CONFIG_DMA_API_DEBUG=y.
|
|
*/
|
|
memblock_reserve(0, PFN_PHYS(start_pfn));
|
|
#else
|
|
memblock_reserve(0, PARMAREA_END);
|
|
memblock_reserve((unsigned long)_stext, PFN_PHYS(start_pfn)
|
|
- (unsigned long)_stext);
|
|
#endif
|
|
}
|
|
|
|
static void __init setup_memory(void)
|
|
{
|
|
struct memblock_region *reg;
|
|
|
|
/*
|
|
* Init storage key for present memory
|
|
*/
|
|
for_each_memblock(memory, reg) {
|
|
storage_key_init_range(reg->base, reg->base + reg->size);
|
|
}
|
|
psw_set_key(PAGE_DEFAULT_KEY);
|
|
|
|
/* Only cosmetics */
|
|
memblock_enforce_memory_limit(memblock_end_of_DRAM());
|
|
}
|
|
|
|
/*
|
|
* Setup hardware capabilities.
|
|
*/
|
|
static int __init setup_hwcaps(void)
|
|
{
|
|
static const int stfl_bits[6] = { 0, 2, 7, 17, 19, 21 };
|
|
struct cpuid cpu_id;
|
|
int i;
|
|
|
|
/*
|
|
* The store facility list bits numbers as found in the principles
|
|
* of operation are numbered with bit 1UL<<31 as number 0 to
|
|
* bit 1UL<<0 as number 31.
|
|
* Bit 0: instructions named N3, "backported" to esa-mode
|
|
* Bit 2: z/Architecture mode is active
|
|
* Bit 7: the store-facility-list-extended facility is installed
|
|
* Bit 17: the message-security assist is installed
|
|
* Bit 19: the long-displacement facility is installed
|
|
* Bit 21: the extended-immediate facility is installed
|
|
* Bit 22: extended-translation facility 3 is installed
|
|
* Bit 30: extended-translation facility 3 enhancement facility
|
|
* These get translated to:
|
|
* HWCAP_S390_ESAN3 bit 0, HWCAP_S390_ZARCH bit 1,
|
|
* HWCAP_S390_STFLE bit 2, HWCAP_S390_MSA bit 3,
|
|
* HWCAP_S390_LDISP bit 4, HWCAP_S390_EIMM bit 5 and
|
|
* HWCAP_S390_ETF3EH bit 8 (22 && 30).
|
|
*/
|
|
for (i = 0; i < 6; i++)
|
|
if (test_facility(stfl_bits[i]))
|
|
elf_hwcap |= 1UL << i;
|
|
|
|
if (test_facility(22) && test_facility(30))
|
|
elf_hwcap |= HWCAP_S390_ETF3EH;
|
|
|
|
/*
|
|
* Check for additional facilities with store-facility-list-extended.
|
|
* stfle stores doublewords (8 byte) with bit 1ULL<<63 as bit 0
|
|
* and 1ULL<<0 as bit 63. Bits 0-31 contain the same information
|
|
* as stored by stfl, bits 32-xxx contain additional facilities.
|
|
* How many facility words are stored depends on the number of
|
|
* doublewords passed to the instruction. The additional facilities
|
|
* are:
|
|
* Bit 42: decimal floating point facility is installed
|
|
* Bit 44: perform floating point operation facility is installed
|
|
* translated to:
|
|
* HWCAP_S390_DFP bit 6 (42 && 44).
|
|
*/
|
|
if ((elf_hwcap & (1UL << 2)) && test_facility(42) && test_facility(44))
|
|
elf_hwcap |= HWCAP_S390_DFP;
|
|
|
|
/*
|
|
* Huge page support HWCAP_S390_HPAGE is bit 7.
|
|
*/
|
|
if (MACHINE_HAS_EDAT1)
|
|
elf_hwcap |= HWCAP_S390_HPAGE;
|
|
|
|
/*
|
|
* 64-bit register support for 31-bit processes
|
|
* HWCAP_S390_HIGH_GPRS is bit 9.
|
|
*/
|
|
elf_hwcap |= HWCAP_S390_HIGH_GPRS;
|
|
|
|
/*
|
|
* Transactional execution support HWCAP_S390_TE is bit 10.
|
|
*/
|
|
if (MACHINE_HAS_TE)
|
|
elf_hwcap |= HWCAP_S390_TE;
|
|
|
|
/*
|
|
* Vector extension HWCAP_S390_VXRS is bit 11. The Vector extension
|
|
* can be disabled with the "novx" parameter. Use MACHINE_HAS_VX
|
|
* instead of facility bit 129.
|
|
*/
|
|
if (MACHINE_HAS_VX) {
|
|
elf_hwcap |= HWCAP_S390_VXRS;
|
|
if (test_facility(134))
|
|
elf_hwcap |= HWCAP_S390_VXRS_EXT;
|
|
if (test_facility(135))
|
|
elf_hwcap |= HWCAP_S390_VXRS_BCD;
|
|
}
|
|
|
|
/*
|
|
* Guarded storage support HWCAP_S390_GS is bit 12.
|
|
*/
|
|
if (MACHINE_HAS_GS)
|
|
elf_hwcap |= HWCAP_S390_GS;
|
|
|
|
get_cpu_id(&cpu_id);
|
|
add_device_randomness(&cpu_id, sizeof(cpu_id));
|
|
switch (cpu_id.machine) {
|
|
case 0x2064:
|
|
case 0x2066:
|
|
default: /* Use "z900" as default for 64 bit kernels. */
|
|
strcpy(elf_platform, "z900");
|
|
break;
|
|
case 0x2084:
|
|
case 0x2086:
|
|
strcpy(elf_platform, "z990");
|
|
break;
|
|
case 0x2094:
|
|
case 0x2096:
|
|
strcpy(elf_platform, "z9-109");
|
|
break;
|
|
case 0x2097:
|
|
case 0x2098:
|
|
strcpy(elf_platform, "z10");
|
|
break;
|
|
case 0x2817:
|
|
case 0x2818:
|
|
strcpy(elf_platform, "z196");
|
|
break;
|
|
case 0x2827:
|
|
case 0x2828:
|
|
strcpy(elf_platform, "zEC12");
|
|
break;
|
|
case 0x2964:
|
|
case 0x2965:
|
|
strcpy(elf_platform, "z13");
|
|
break;
|
|
case 0x3906:
|
|
case 0x3907:
|
|
strcpy(elf_platform, "z14");
|
|
break;
|
|
}
|
|
|
|
/*
|
|
* Virtualization support HWCAP_INT_SIE is bit 0.
|
|
*/
|
|
if (sclp.has_sief2)
|
|
int_hwcap |= HWCAP_INT_SIE;
|
|
|
|
return 0;
|
|
}
|
|
arch_initcall(setup_hwcaps);
|
|
|
|
/*
|
|
* Add system information as device randomness
|
|
*/
|
|
static void __init setup_randomness(void)
|
|
{
|
|
struct sysinfo_3_2_2 *vmms;
|
|
|
|
vmms = (struct sysinfo_3_2_2 *) memblock_alloc(PAGE_SIZE, PAGE_SIZE);
|
|
if (stsi(vmms, 3, 2, 2) == 0 && vmms->count)
|
|
add_device_randomness(&vmms->vm, sizeof(vmms->vm[0]) * vmms->count);
|
|
memblock_free((unsigned long) vmms, PAGE_SIZE);
|
|
}
|
|
|
|
/*
|
|
* Find the correct size for the task_struct. This depends on
|
|
* the size of the struct fpu at the end of the thread_struct
|
|
* which is embedded in the task_struct.
|
|
*/
|
|
static void __init setup_task_size(void)
|
|
{
|
|
int task_size = sizeof(struct task_struct);
|
|
|
|
if (!MACHINE_HAS_VX) {
|
|
task_size -= sizeof(__vector128) * __NUM_VXRS;
|
|
task_size += sizeof(freg_t) * __NUM_FPRS;
|
|
}
|
|
arch_task_struct_size = task_size;
|
|
}
|
|
|
|
/*
|
|
* Setup function called from init/main.c just after the banner
|
|
* was printed.
|
|
*/
|
|
|
|
void __init setup_arch(char **cmdline_p)
|
|
{
|
|
/*
|
|
* print what head.S has found out about the machine
|
|
*/
|
|
if (MACHINE_IS_VM)
|
|
pr_info("Linux is running as a z/VM "
|
|
"guest operating system in 64-bit mode\n");
|
|
else if (MACHINE_IS_KVM)
|
|
pr_info("Linux is running under KVM in 64-bit mode\n");
|
|
else if (MACHINE_IS_LPAR)
|
|
pr_info("Linux is running natively in 64-bit mode\n");
|
|
else
|
|
pr_info("Linux is running as a guest in 64-bit mode\n");
|
|
|
|
/* Have one command line that is parsed and saved in /proc/cmdline */
|
|
/* boot_command_line has been already set up in early.c */
|
|
*cmdline_p = boot_command_line;
|
|
|
|
ROOT_DEV = Root_RAM0;
|
|
|
|
/* Is init_mm really needed? */
|
|
init_mm.start_code = PAGE_OFFSET;
|
|
init_mm.end_code = (unsigned long) _etext;
|
|
init_mm.end_data = (unsigned long) _edata;
|
|
init_mm.brk = (unsigned long) _end;
|
|
|
|
if (IS_ENABLED(CONFIG_EXPOLINE_AUTO))
|
|
nospec_auto_detect();
|
|
|
|
jump_label_init();
|
|
parse_early_param();
|
|
#ifdef CONFIG_CRASH_DUMP
|
|
/* Deactivate elfcorehdr= kernel parameter */
|
|
elfcorehdr_addr = ELFCORE_ADDR_MAX;
|
|
#endif
|
|
|
|
os_info_init();
|
|
setup_ipl();
|
|
setup_task_size();
|
|
|
|
/* Do some memory reservations *before* memory is added to memblock */
|
|
reserve_memory_end();
|
|
reserve_oldmem();
|
|
reserve_kernel();
|
|
reserve_initrd();
|
|
memblock_allow_resize();
|
|
|
|
/* Get information about *all* installed memory */
|
|
detect_memory_memblock();
|
|
|
|
remove_oldmem();
|
|
|
|
/*
|
|
* Make sure all chunks are MAX_ORDER aligned so we don't need the
|
|
* extra checks that HOLES_IN_ZONE would require.
|
|
*
|
|
* Is this still required?
|
|
*/
|
|
memblock_trim_memory(1UL << (MAX_ORDER - 1 + PAGE_SHIFT));
|
|
|
|
setup_memory_end();
|
|
setup_memory();
|
|
dma_contiguous_reserve(memory_end);
|
|
vmcp_cma_reserve();
|
|
|
|
check_initrd();
|
|
reserve_crashkernel();
|
|
#ifdef CONFIG_CRASH_DUMP
|
|
/*
|
|
* Be aware that smp_save_dump_cpus() triggers a system reset.
|
|
* Therefore CPU and device initialization should be done afterwards.
|
|
*/
|
|
smp_save_dump_cpus();
|
|
#endif
|
|
|
|
setup_resources();
|
|
setup_lowcore_dat_off();
|
|
smp_fill_possible_mask();
|
|
cpu_detect_mhz_feature();
|
|
cpu_init();
|
|
numa_setup();
|
|
smp_detect_cpus();
|
|
topology_init_early();
|
|
|
|
/*
|
|
* Create kernel page tables and switch to virtual addressing.
|
|
*/
|
|
paging_init();
|
|
|
|
/*
|
|
* After paging_init created the kernel page table, the new PSWs
|
|
* in lowcore can now run with DAT enabled.
|
|
*/
|
|
setup_lowcore_dat_on();
|
|
|
|
/* Setup default console */
|
|
conmode_default();
|
|
set_preferred_console();
|
|
|
|
apply_alternative_instructions();
|
|
if (IS_ENABLED(CONFIG_EXPOLINE))
|
|
nospec_init_branches();
|
|
|
|
/* Setup zfcpdump support */
|
|
setup_zfcpdump();
|
|
|
|
/* Add system specific data to the random pool */
|
|
setup_randomness();
|
|
}
|