5.11.7-rc1 review
Subsystems (4)
[email protected]
maintainercover 5.11.7-rc1 review
From: Greg Kroah-Hartman <[email protected]>
This is the start of the stable review cycle for the 5.11.7 release. There are 306 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Mar 2021 13:54:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.7-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.11.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.11.7-rc1
Andrew Scull <[email protected]>
KVM: arm64: Fix nVHE hyp panic host context restore
Mike Rapoport <[email protected]>
mm/page_alloc.c: refactor initialization of struct page for holes in memory layout
Zhou Guanghui <[email protected]>
mm/memcg: rename mem_cgroup_split_huge_fixup to split_page_memcg and add nr_pages argument
Zhou Guanghui <[email protected]>
mm/memcg: set memcg when splitting page
Suren Baghdasaryan <[email protected]>
mm/madvise: replace ptrace attach requirement for process_madvise
Nadav Amit <[email protected]>
mm/userfaultfd: fix memory corruption due to writeprotect
OGAWA Hirofumi <[email protected]>
mm/highmem.c: fix zero_user_segments() with start > end
Marc Zyngier <[email protected]>
KVM: arm64: Fix exclusive limit for IPA size
Marc Zyngier <[email protected]>
KVM: arm64: Reject VM creation when the default IPA size is unsupported
Suzuki K Poulose <[email protected]>
KVM: arm64: nvhe: Save the SPE context early
Will Deacon <[email protected]>
KVM: arm64: Avoid corrupting vCPU context register in guest exit
Jia He <[email protected]>
KVM: arm64: Fix range alignment when walking page tables
Marc Zyngier <[email protected]>
KVM: arm64: Ensure I-cache isolation between vcpus of a same VM
Wanpeng Li <[email protected]>
KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged
Sean Christopherson <[email protected]>
KVM: x86: Ensure deadline timer has truly expired before posting its IRQ
Andy Lutomirski <[email protected]>
x86/entry: Fix entry/exit mismatch on failed fast 32-bit syscalls
Joerg Roedel <[email protected]>
x86/sev-es: Use __copy_from_user_inatomic()
Joerg Roedel <[email protected]>
x86/sev-es: Correctly track IRQ states in runtime #VC handler
Joerg Roedel <[email protected]>
x86/sev-es: Check regs->sp is trusted before adjusting #VC IST stack
Joerg Roedel <[email protected]>
x86/sev-es: Introduce ip_within_syscall_gap() helper
Josh Poimboeuf <[email protected]>
x86/unwind/orc: Disable KASAN checking in the ORC unwinder, part 2
Andrey Konovalov <[email protected]>
kasan: fix KASAN_STACK dependency for HW_TAGS
Andrey Konovalov <[email protected]>
kasan, mm: fix crash with HW_TAGS and DEBUG_PAGEALLOC
Lior Ribak <[email protected]>
binfmt_misc: fix possible deadlock in bm_register_write
Christophe Leroy <[email protected]>
powerpc: Fix missing declaration of [en/dis]able_kernel_vsx()
Nicholas Piggin <[email protected]>
powerpc: Fix inverted SET_FULL_REGS bitop
Naveen N. Rao <[email protected]>
powerpc/64s: Fix instruction encoding for lis in ppc_function_entry()
Ard Biesheuvel <[email protected]>
efi: stub: omit SetVirtualAddressMap() if marked unsupported in RT_PROP table
Peter Zijlstra <[email protected]>
sched: Simplify set_affinity_pending refcounts
Peter Zijlstra <[email protected]>
sched: Fix affine_move_task() self-concurrency
Peter Zijlstra <[email protected]>
sched: Optimize migration_cpu_stop()
Peter Zijlstra <[email protected]>
sched: Simplify migration_cpu_stop()
Peter Zijlstra <[email protected]>
sched: Collate affine_move_task() stoppers
Mathieu Desnoyers <[email protected]>
sched/membarrier: fix missing local execution of ipi_sync_rq_state()
Peter Zijlstra <[email protected]>
sched: Fix migration_cpu_stop() requeueing
Arnd Bergmann <[email protected]>
linux/compiler-clang.h: define HAVE_BUILTIN_BSWAP*
Minchan Kim <[email protected]>
zram: fix broken page writeback
Minchan Kim <[email protected]>
zram: fix return value on writeback_store
Alexey Dobriyan <[email protected]>
prctl: fix PR_SET_MM_AUXV kernel stack leak
Matthew Wilcox (Oracle) <[email protected]>
include/linux/sched/mm.h: use rcu_dereference in in_vfork()
Arnd Bergmann <[email protected]>
stop_machine: mark helpers __always_inline
Arnd Bergmann <[email protected]>
memblock: fix section mismatch warning
Peter Zijlstra <[email protected]>
seqlock,lockdep: Fix seqcount_latch_init()
Daniel Axtens <[email protected]>
powerpc/64s/exception: Clean up a missed SRR specifier
Anna-Maria Behnsen <[email protected]>
hrtimer: Update softirq_expires_next correctly after __hrtimer_get_next_event()
Kan Liang <[email protected]>
perf/x86/intel: Set PERF_ATTACH_SCHED_CB for large PEBS and LBR
Kan Liang <[email protected]>
perf/core: Flush PMU internal buffers for per-CPU events
Paolo Abeni <[email protected]>
mptcp: fix memory accounting on allocation error
Florian Westphal <[email protected]>
mptcp: put subflow sock on connect error
Willem de Bruijn <[email protected]>
net: expand textsearch ts_state to fit skb_seq_state
Wei Yongjun <[email protected]>
perf/arm_dmc620_pmu: Fix error return code in dmc620_pmu_device_probe()
Dave Airlie <[email protected]>
drm/nouveau: fix dma syncing for loops (v2)
Jens Axboe <[email protected]>
io_uring: perform IOPOLL reaping if canceler is thread itself
Ard Biesheuvel <[email protected]>
arm64: mm: use a 48-bit ID map when possible on 52-bit VA builds
Daiyue Zhang <[email protected]>
configfs: fix a use-after-free in __configfs_open_file
James Smart <[email protected]>
nvme-fc: fix racing controller reset and create association
Anthony DeRossi <[email protected]>
drm/ttm: Fix TTM page pool accounting
Jia-Ju Bai <[email protected]>
block: rsxx: fix error return code of rsxx_pci_probe()
Ondrej Mosnacek <[email protected]>
NFSv4.2: fix return value of _nfs4_get_security_label()
Trond Myklebust <[email protected]>
NFS: Don't gratuitously clear the inode cache when lookup failed
Trond Myklebust <[email protected]>
NFS: Don't revalidate the directory permissions on a lookup failure
Benjamin Coddington <[email protected]>
SUNRPC: Set memalloc_nofs_save() for sync tasks
Anshuman Khandual <[email protected]>
arm64/mm: Fix pfn_valid() for ZONE_DEVICE based memory
Wei Yongjun <[email protected]>
cpufreq: qcom-hw: Fix return value check in qcom_cpufreq_hw_cpu_init()
Shawn Guo <[email protected]>
cpufreq: qcom-hw: fix dereferencing freed memory 'data'
Atish Patra <[email protected]>
net: macb: Add default usrio config to default gem config
Jordan Niethe <[email protected]>
powerpc/sstep: Fix VSX instruction emulation
Sergey Shtylyov <[email protected]>
sh_eth: fix TRSCER mask for R7S72100
Ioana Ciornei <[email protected]>
net: phy: ti: take into account all possible interrupt sources
Ido Schimmel <[email protected]>
mlxsw: spectrum_router: Ignore routes using a deleted nexthop object
Ian Abbott <[email protected]>
staging: comedi: pcl818: Fix endian problem for AI command data
Ian Abbott <[email protected]>
staging: comedi: pcl711: Fix endian problem for AI command data
Ian Abbott <[email protected]>
staging: comedi: me4000: Fix endian problem for AI command data
Ian Abbott <[email protected]>
staging: comedi: dmm32at: Fix endian problem for AI command data
Ian Abbott <[email protected]>
staging: comedi: das800: Fix endian problem for AI command data
Ian Abbott <[email protected]>
staging: comedi: das6402: Fix endian problem for AI command data
Ian Abbott <[email protected]>
staging: comedi: adv_pci1710: Fix endian problem for AI command data
Ian Abbott <[email protected]>
staging: comedi: addi_apci_1500: Fix endian problem for command sample
Ian Abbott <[email protected]>
staging: comedi: addi_apci_1032: Fix endian problem for COS sample
Lee Gibson <[email protected]>
staging: rtl8192e: Fix possible buffer overflow in _rtl92e_wx_set_scan
Lee Gibson <[email protected]>
staging: rtl8712: Fix possible buffer overflow in r8712_sitesurvey_cmd
Dan Carpenter <[email protected]>
staging: ks7010: prevent buffer overflow in ks_wlan_set_scan()
Dan Carpenter <[email protected]>
staging: rtl8188eu: fix potential memory corruption in rtw_check_beacon_data()
Dan Carpenter <[email protected]>
staging: rtl8712: unterminated string leads to read overflow
Dan Carpenter <[email protected]>
staging: rtl8188eu: prevent ->ssid overflow in rtw_wx_set_scan()
Dan Carpenter <[email protected]>
staging: rtl8192u: fix ->ssid overflow in r8192_wx_set_scan()
Dmitry Baryshkov <[email protected]>
misc: fastrpc: restrict user apps from sending kernel RPC messages
Shile Zhang <[email protected]>
misc/pvpanic: Export module FDT device table
Alexander Shiyan <[email protected]>
Revert "serial: max310x: rework RX interrupt handling"
Shuah Khan <[email protected]>
usbip: fix vudc usbip_sockfd_store races leading to gpf
Shuah Khan <[email protected]>
usbip: fix vhci_hcd attach_store() races leading to gpf
Shuah Khan <[email protected]>
usbip: fix stub_dev usbip_sockfd_store() races leading to gpf
Shuah Khan <[email protected]>
usbip: fix vudc to check for stream socket
Shuah Khan <[email protected]>
usbip: fix vhci_hcd to check for stream socket
Shuah Khan <[email protected]>
usbip: fix stub_dev to check for stream socket
Sebastian Reichel <[email protected]>
USB: serial: cp210x: add some more GE USB IDs
Karan Singhal <[email protected]>
USB: serial: cp210x: add ID for Acuity Brands nLight Air Adapter
Niv Sardi <[email protected]>
USB: serial: ch341: add new Product ID
Pavel Skripkin <[email protected]>
USB: serial: io_edgeport: fix memory leak in edge_startup
Mathias Nyman <[email protected]>
xhci: Fix repeated xhci wake after suspend due to uncleared internal wake state
Forest Crossman <[email protected]>
usb: xhci: Fix ASMedia ASM1042A and ASM3242 DMA addressing
Mathias Nyman <[email protected]>
xhci: Improve detection of device initiated wake signal.
Stanislaw Gruszka <[email protected]>
usb: xhci: do not perform Soft Retry for some xHCI hosts
Yoshihiro Shimoda <[email protected]>
usb: renesas_usbhs: Clear PIPECFG for re-enabling pipe with other EPNUM
Pete Zaitcev <[email protected]>
USB: usblp: fix a hang in poll() if disconnected
Matthias Kaehlcke <[email protected]>
usb: dwc3: qcom: Honor wakeup enabled/disabled state
Shawn Guo <[email protected]>
usb: dwc3: qcom: add ACPI device id for sc8180x
Shawn Guo <[email protected]>
usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot
Serge Semin <[email protected]>
usb: dwc3: qcom: Add missing DWC3 OF node refcount decrement
Ruslan Bilovol <[email protected]>
usb: gadget: f_uac1: stop playback on function disable
Ruslan Bilovol <[email protected]>
usb: gadget: f_uac2: always increase endpoint max_packet_size by one audio slot
Dan Carpenter <[email protected]>
USB: gadget: u_ether: Fix a configfs return code
Wei Yongjun <[email protected]>
USB: gadget: udc: s3c2410_udc: fix return value check in s3c2410_udc_probe()
Yorick de Wid <[email protected]>
Goodix Fingerprint device is not a modem
Paulo Alcantara <[email protected]>
cifs: do not send close in compound create+close requests
Frank Li <[email protected]>
mmc: cqhci: Fix random crash when remove mmc module/card
Adrian Hunter <[email protected]>
mmc: core: Fix partition switch time for eMMC
Yann Gautier <[email protected]>
mmc: mmci: Add MMC_CAP_NEED_RSP_BUSY for the stm32 variants
Juergen Gross <[email protected]>
xen/events: avoid handling the same event on two cpus at the same time
Juergen Gross <[email protected]>
xen/events: don't unmask an event channel when an eoi is pending
Juergen Gross <[email protected]>
xen/events: reset affinity of 2-level event when tearing it down
Heikki Krogerus <[email protected]>
software node: Fix node registration
Stefan Haberland <[email protected]>
s390/dasd: fix hanging IO request during DASD driver unbind
Stefan Haberland <[email protected]>
s390/dasd: fix hanging DASD driver unbind
Rob Herring <[email protected]>
arm64: perf: Fix 64-bit event counter read truncation
Catalin Marinas <[email protected]>
arm64: mte: Map hotplugged memory as Normal Tagged
Andrey Konovalov <[email protected]>
arm64: kasan: fix page_alloc tagging with DEBUG_VIRTUAL
Jan Kara <[email protected]>
block: Try to handle busy underlying device on discard
Shin'ichiro Kawasaki <[email protected]>
block: Discard page cache of zone reset target range
Eric W. Biederman <[email protected]>
Revert 95ebabde382c ("capabilities: Don't allow writing ambiguous v3 file capabilities")
Beata Michalska <[email protected]>
opp: Don't drop extra references to OPPs accidentally
Pavel Skripkin <[email protected]>
ALSA: usb-audio: fix use after free in usb_audio_disconnect
Pavel Skripkin <[email protected]>
ALSA: usb-audio: fix NULL ptr dereference in usb_audio_probe
Kai-Heng Feng <[email protected]>
ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()
Takashi Iwai <[email protected]>
ALSA: usb-audio: Apply the control quirk to Plantronics headsets
Takashi Iwai <[email protected]>
ALSA: usb-audio: Fix "cannot get freq eq" errors on Dell AE515 sound bar
Takashi Iwai <[email protected]>
ALSA: hda: Avoid spurious unsol event handling during S3/S4
Takashi Iwai <[email protected]>
ALSA: hda: Flush pending unsolicited events before suspend
Takashi Iwai <[email protected]>
ALSA: hda: Drop the BATCH workaround for AMD controllers
Simeon Simeonoff <[email protected]>
ALSA: hda/ca0132: Add Sound BlasterX AE-5 Plus support
Takashi Iwai <[email protected]>
ALSA: hda/conexant: Add quirk for mute LED control on HP ZBook G5
Takashi Iwai <[email protected]>
ALSA: hda/hdmi: Cancel pending works before suspend
John Ernberg <[email protected]>
ALSA: usb: Add Plantronics C320-M USB ctrl msg delay quirk
AngeloGioacchino Del Regno <[email protected]>
clk: qcom: gpucc-msm8998: Add resets, cxc, fix flags on gpu_gx_gdsc
Aleksandr Miloserdov <[email protected]>
scsi: target: core: Prevent underflow for service actions
Aleksandr Miloserdov <[email protected]>
scsi: target: core: Add cmd length set before cmd complete
Mike Christie <[email protected]>
scsi: libiscsi: Fix iscsi_prep_scsi_cmd_pdu() error handling
Lin Feng <[email protected]>
sysctl.c: fix underflow value setting risk in vm_table
David Hildenbrand <[email protected]>
drivers/base/memory: don't store phys_device in memory blocks
Heiko Carstens <[email protected]>
s390/smp: __smp_rescan_cpus() - move cpumask away from stack
Andrey Konovalov <[email protected]>
kasan: fix memory corruption in kasan_bitops_tags test
Keith Busch <[email protected]>
PCI/ERR: Retain status from error notification
Keita Suzuki <[email protected]>
i40e: Fix memory leak in i40e_probe
Geert Uytterhoeven <[email protected]>
PCI: Fix pci_register_io_range() memory leak
Sasha Levin <[email protected]>
kbuild: clamp SUBLEVEL to 255
Theodore Ts'o <[email protected]>
ext4: don't try to processed freed blocks until mballoc is initialized
Bjorn Helgaas <[email protected]>
PCI/LINK: Remove bandwidth notification
Arnd Bergmann <[email protected]>
drivers/base: build kunit tests without structleak plugin
Krzysztof Wilczyński <[email protected]>
PCI: mediatek: Add missing of_node_put() to fix reference leak
Martin Kaiser <[email protected]>
PCI: xgene-msi: Fix race in installing chained irq handler
Ronald Tschalär <[email protected]>
Input: applespi - don't wait for responses to commands indefinitely.
Khalid Aziz <[email protected]>
sparc64: Use arch_validate_flags() to validate ADI flag
Andreas Larsson <[email protected]>
sparc32: Limit memblock allocation to low memory
AngeloGioacchino Del Regno <[email protected]>
clk: qcom: gdsc: Implement NO_RET_PERIPH flag
Suravee Suthikulpanit <[email protected]>
iommu/amd: Fix performance counter initialization
Michael Ellerman <[email protected]>
powerpc/64: Fix stack trace not displaying final frame
Filipe Laíns <[email protected]>
HID: logitech-dj: add support for the new lightspeed connection iteration
Athira Rajeev <[email protected]>
powerpc/perf: Record counter overflow always if SAMPLE_IP is unset
Nicholas Piggin <[email protected]>
powerpc: improve handling of unrecoverable system reset
Alain Volmat <[email protected]>
spi: stm32: make spurious and overrun interrupts visible
Oliver O'Halloran <[email protected]>
powerpc/pci: Add ppc_md.discover_phbs()
Lubomir Rintel <[email protected]>
Platform: OLPC: Fix probe error handling
Pan Bian <[email protected]>
platform/x86: amd-pmc: put device on error paths
Jeremy Linton <[email protected]>
mmc: sdhci-iproc: Add ACPI bindings for the RPi
Chaotian Jing <[email protected]>
mmc: mediatek: fix race condition between msdc_request_timeout and irq
Christophe JAILLET <[email protected]>
mmc: mxs-mmc: Fix a resource leak in an error handling path in 'mxs_mmc_probe()'
Lu Baolu <[email protected]>
iommu/vt-d: Clear PRQ overflow only when PRQ is empty
Steven J. Magnani <[email protected]>
udf: fix silent AED tagLocation corruption
Can Guo <[email protected]>
scsi: ufs: Protect some contexts from unexpected clock scaling
Jaegeuk Kim <[email protected]>
scsi: ufs: WB is only available on LUN #0 to #7
akshatzen <[email protected]>
scsi: pm80xx: Fix missing tag_free in NVMD DATA req
Wolfram Sang <[email protected]>
i2c: rcar: optimize cacheline to minimize HW race condition
Wolfram Sang <[email protected]>
i2c: rcar: faster irq code to minimize HW race condition
Florian Westphal <[email protected]>
mptcp: reset last_snd on subflow close
Paolo Abeni <[email protected]>
mptcp: always graft subflow socket to parent
Thomas Bogendoerfer <[email protected]>
MIPS: kernel: Reserve exception base early to prevent corruption
Hans Verkuil <[email protected]>
media: rc: compile rc-cec.c into rc-core
Biju Das <[email protected]>
media: v4l: vsp1: Fix bru null pointer access
Biju Das <[email protected]>
media: v4l: vsp1: Fix uif null pointer access
Dafna Hirschfeld <[email protected]>
media: rkisp1: params: fix wrong bits settings
Maxim Mikityanskiy <[email protected]>
media: usbtv: Fix deadlock on suspend
Sergey Shtylyov <[email protected]>
sh_eth: fix TRSCER mask for R7S9210
Colin Ian King <[email protected]>
qxl: Fix uninitialised struct field head.surface_id
Wang Qing <[email protected]>
s390/crypto: return -EFAULT if copy_to_user() fails
Eric Farman <[email protected]>
s390/cio: return -EFAULT if copy_to_user() fails
Tvrtko Ursulin <[email protected]>
drm/i915: Wedge the GPU if command parser setup fails
Noralf Trønnes <[email protected]>
drm/shmem-helpers: vunmap: Don't put pages for dma-buf
Artem Lapkin <[email protected]>
drm: meson_drv add shutdown function
Alex Deucher <[email protected]>
drm/amdgpu: fix S0ix handling when the CONFIG_AMD_PMC=m
Thomas Zimmermann <[email protected]>
drm: Use USB controller's DMA mask when importing dmabufs
Neil Roberts <[email protected]>
drm/shmem-helper: Don't remove the offset in vm_area_struct pgoff
Neil Roberts <[email protected]>
drm/shmem-helper: Check for purged buffers in fault handler
Alex Deucher <[email protected]>
drm/amdgpu/display: handle aux backlight in backlight_get_brightness
Alex Deucher <[email protected]>
drm/amdgpu/display: don't assert in set backlight function
Alex Deucher <[email protected]>
drm/amdgpu/display: simplify backlight setting
Kenneth Feng <[email protected]>
drm/amd/pm: bug fix for pcie dpm
Evan Quan <[email protected]>
drm/amd/pm: correct the watermark settings for Polaris
Holger Hoffstätte <[email protected]>
drm/amd/display: Fix nested FPU context in dcn21_validate_bandwidth()
Holger Hoffstätte <[email protected]>
drm/amdgpu/display: use GFP_ATOMIC in dcn21_validate_bandwidth_fp()
Takashi Iwai <[email protected]>
drm/amd/display: Add a backlight module option
Christian König <[email protected]>
drm/radeon: also init GEM funcs in radeon_gem_prime_import_sg_table
Daniel Vetter <[email protected]>
drm/compat: Clear bounce structures
Tong Zhang <[email protected]>
drm/fb-helper: only unmap if buffer not null
Edwin Peer <[email protected]>
bnxt_en: reliably allocate IRQ table on reset to avoid crash
Wang Qing <[email protected]>
s390/cio: return -EFAULT if copy_to_user() fails again
Jian Shen <[email protected]>
net: hns3: fix bug when calculating the TCAM table info
Jian Shen <[email protected]>
net: hns3: fix query vlan mask value error for flow director
Jian Shen <[email protected]>
net: hns3: fix error mask definition of flow director
Ravi Bangoria <[email protected]>
perf report: Fix -F for branch & mem modes
Ian Rogers <[email protected]>
perf traceevent: Ensure read cmdlines are null terminated.
Danielle Ratson <[email protected]>
mlxsw: spectrum_ethtool: Add an external speed to PTYS register
Danielle Ratson <[email protected]>
selftests: forwarding: Fix race condition in mirror installation
Arnd Bergmann <[email protected]>
net: phy: make mdio_bus_phy_suspend/resume as __maybe_unused
Yinjun Zhang <[email protected]>
ethtool: fix the check logic of at least one channel for RX/TX
Joakim Zhang <[email protected]>
net: stmmac: fix wrongly set buffer2 valid when sph unsupport
Joakim Zhang <[email protected]>
net: stmmac: fix watchdog timeout during suspend/resume stress test
Joakim Zhang <[email protected]>
net: stmmac: stop each tx channel independently
Antonio Terceiro <[email protected]>
perf build: Fix ccache usage in $(CC) when generating arch errno table
Kun-Chuan Hsieh <[email protected]>
tools/resolve_btfids: Fix build error with older host toolchains
Antony Antony <[email protected]>
ixgbe: fail to create xfrm offload of IPsec tunnel mode SA
Hayes Wang <[email protected]>
r8169: fix r8168fp_adjust_ocp_cmd function
Julian Wiedmann <[email protected]>
s390/qeth: fix notification for pending buffers during teardown
Julian Wiedmann <[email protected]>
s390/qeth: schedule TX NAPI on QAOB completion
Julian Wiedmann <[email protected]>
s390/qeth: improve completion of pending TX buffers
Julian Wiedmann <[email protected]>
s390/qeth: fix memory leak after failed TX Buffer allocation
Jia-Ju Bai <[email protected]>
net: qrtr: fix error return code of qrtr_sendmsg()
Vladimir Oltean <[email protected]>
net: enetc: allow hardware timestamping on TX queues with tc-etf enabled
Paul Cercueil <[email protected]>
net: davicom: Fix regulator not turned off on driver removal
Paul Cercueil <[email protected]>
net: davicom: Fix regulator not turned off on failed probe
Xie He <[email protected]>
net: lapbether: Remove netif_start_queue / netif_stop_queue
Wong Vee Khee <[email protected]>
stmmac: intel: Fixes clock registration error seen for multiple interfaces
Ong Boon Leong <[email protected]>
net: stmmac: Fix VLAN filter delete timeout issue in Intel mGBE SGMII
Paul Moore <[email protected]>
cipso,calipso: resolve a number of problems with the DOI refcounts
Hillf Danton <[email protected]>
netdevsim: init u64 stats for 32bit hardware
Daniele Palmas <[email protected]>
net: usb: qmi_wwan: allow qmimux add/del with master up
Vladimir Oltean <[email protected]>
net: dsa: sja1105: fix SGMII PCS being forced to SPEED_UNKNOWN instead of SPEED_10
Vladimir Oltean <[email protected]>
net: mscc: ocelot: properly reject destination IP keys in VCAP IS1
Maximilian Heyne <[email protected]>
net: sched: avoid duplicates in classes dump
Ido Schimmel <[email protected]>
nexthop: Do not flush blackhole nexthops when loopback goes down
Ong Boon Leong <[email protected]>
net: stmmac: fix incorrect DMA channel intr enable setting of EQoS v4.10
Kevin(Yudong) Yang <[email protected]>
net/mlx4_en: update moderation when config reset
Biao Huang <[email protected]>
net: ethernet: mtk-star-emac: fix wrong unmap in RX handling
DENG Qingfang <[email protected]>
net: dsa: tag_mtk: fix 802.1ad VLAN egress
Vladimir Oltean <[email protected]>
net: enetc: keep RX ring consumer index in sync with hardware
Vladimir Oltean <[email protected]>
net: enetc: remove bogus write to SIRXIDR from enetc_setup_rxbdr
Vladimir Oltean <[email protected]>
net: enetc: force the RGMII speed and duplex instead of operating in inband mode
Vladimir Oltean <[email protected]>
net: enetc: don't disable VLAN filtering in IFF_PROMISC mode
Vladimir Oltean <[email protected]>
net: enetc: fix incorrect TPID when receiving 802.1ad tagged packets
Vladimir Oltean <[email protected]>
net: enetc: take the MDIO lock only once per NAPI poll cycle
Vladimir Oltean <[email protected]>
net: enetc: initialize RFS/RSS memories for unused ports too
Vladimir Oltean <[email protected]>
net: enetc: don't overwrite the RSS indirection table when initializing
Sergey Shtylyov <[email protected]>
sh_eth: fix TRSCER mask for SH771x
DENG Qingfang <[email protected]>
net: dsa: tag_rtl4_a: fix egress tags
Jakub Kicinski <[email protected]>
docs: networking: drop special stable handling
Linus Torvalds <[email protected]>
Revert "mm, slub: consider rest of partial list if acquire_slab() fails"
Paulo Alcantara <[email protected]>
cifs: return proper error code in statfs(2)
Aurelien Aptel <[email protected]>
cifs: fix credit accounting for extra channel
Christian Brauner <[email protected]>
mount: fix mounting of detached mounts onto targets that reside on shared mounts
Johan Hovold <[email protected]>
gpio: fix gpio-device list corruption
Lorenzo Bianconi <[email protected]>
mt76: dma: do not report truncated frames to mac80211
Junlin Yang <[email protected]>
ibmvnic: remove excessive irqsave
Jiri Wiesner <[email protected]>
ibmvnic: always store valid MAC address
Michal Suchanek <[email protected]>
ibmvnic: Fix possibly uninitialized old_num_tx_queues variable warning.
Maciej Fijalkowski <[email protected]>
libbpf: Clear map_info before each bpf_obj_get_info_by_fd
Maciej Fijalkowski <[email protected]>
samples, bpf: Add missing munmap in xdpsock
Yauheni Kaliuta <[email protected]>
selftests/bpf: Mask bpf_csum_diff() return value to 16 bits in test_verifier
Hangbin Liu <[email protected]>
selftests/bpf: No need to drop the packet when there is no geneve opt
Ilya Leoshkevich <[email protected]>
selftests/bpf: Use the last page in test_snprintf_btf on s390
Guangbin Huang <[email protected]>
net: phy: fix save wrong speed and duplex problem if autoneg is on
Jason A. Donenfeld <[email protected]>
net: always use icmp{,v6}_ndo_send from ndo_start_xmit
Vasily Averin <[email protected]>
netfilter: x_tables: gpf inside xt_find_revision()
Florian Westphal <[email protected]>
netfilter: nf_nat: undo erroneous tcp edemux lookup
Eric Dumazet <[email protected]>
tcp: add sanity tests to TCP_QUEUE_SEQ
Arjun Roy <[email protected]>
tcp: Fix sign comparison bug in getsockopt(TCP_ZEROCOPY_RECEIVE)
Torin Cooper-Bennun <[email protected]>
can: tcan4x5x: tcan4x5x_init(): fix initialization - clear MRAM before entering Normal Mode
Joakim Zhang <[email protected]>
can: flexcan: invoke flexcan_chip_freeze() to enter freeze mode
Joakim Zhang <[email protected]>
can: flexcan: enable RX FIFO after FRZ/HALT valid
Joakim Zhang <[email protected]>
can: flexcan: assert FRZ bit in flexcan_chip_freeze()
Andy Shevchenko <[email protected]>
gpio: pca953x: Set IRQ type when handle Intel Galileo Gen 2
Oleksij Rempel <[email protected]>
can: skb: can_skb_set_owner(): fix ref counting if socket was closed before setting skb ownership
Andy Shevchenko <[email protected]>
gpiolib: Read "gpio-line-names" from a firmware node
Andy Shevchenko <[email protected]>
gpiolib: acpi: Allow to find GpioInt() resource by name and index
Andy Shevchenko <[email protected]>
gpiolib: acpi: Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk
Matthias Schiffer <[email protected]>
net: l2tp: reduce log level of messages in receive path, add counter instead
Kalle Valo <[email protected]>
ath11k: fix AP mode for QCA6390
Balazs Nemeth <[email protected]>
net: avoid infinite loop in mpls_gso_segment when mpls_hlen == 0
Balazs Nemeth <[email protected]>
net: check if protocol extracted by virtio_net_hdr_set_proto is correct
Daniel Borkmann <[email protected]>
net: Fix gro aggregation for udp encaps with zero csum
Felix Fietkau <[email protected]>
ath9k: fix transmitting to stations in dynamic SMPS mode
Davide Caratti <[email protected]>
mptcp: fix length of ADD_ADDR with port sub-option
Maciej W. Rozycki <[email protected]>
crypto: mips/poly1305 - enable for all MIPS processors
Jakub Kicinski <[email protected]>
ethernet: alx: fix order of calls on resume
Greg Kurz <[email protected]>
powerpc/pseries: Don't enforce MSI affinity with kdump
Athira Rajeev <[email protected]>
powerpc/perf: Fix handling of privilege level checks in perf interrupt context
Christophe Leroy <[email protected]>
powerpc/603: Fix protection of user pages mapped with PROT_NONE
Dmitry V. Levin <[email protected]>
uapi: nfnetlink_cthelper.h: fix userspace compilation error
-------------
Diffstat:
Documentation/ABI/testing/sysfs-devices-memory | 5 +- Documentation/admin-guide/mm/memory-hotplug.rst | 4 +- Documentation/gpu/todo.rst | 21 +++ Documentation/networking/netdev-FAQ.rst | 72 +-------- Documentation/process/stable-kernel-rules.rst | 6 - Documentation/process/submitting-patches.rst | 5 - Documentation/virt/kvm/api.rst | 3 + Makefile | 16 +- arch/arm64/include/asm/kvm_asm.h | 4 +- arch/arm64/include/asm/kvm_hyp.h | 8 +- arch/arm64/include/asm/memory.h | 5 + arch/arm64/include/asm/mmu_context.h | 5 +- arch/arm64/include/asm/pgtable-prot.h | 1 - arch/arm64/include/asm/pgtable.h | 3 + arch/arm64/kernel/head.S | 2 +- arch/arm64/kernel/perf_event.c | 2 +- arch/arm64/kvm/arm.c | 7 +- arch/arm64/kvm/hyp/entry.S | 2 +- arch/arm64/kvm/hyp/nvhe/debug-sr.c | 12 +- arch/arm64/kvm/hyp/nvhe/host.S | 20 +-- arch/arm64/kvm/hyp/nvhe/hyp-main.c | 6 +- arch/arm64/kvm/hyp/nvhe/switch.c | 14 +- arch/arm64/kvm/hyp/nvhe/tlb.c | 3 +- arch/arm64/kvm/hyp/pgtable.c | 1 + arch/arm64/kvm/hyp/vhe/tlb.c | 3 +- arch/arm64/kvm/mmu.c | 3 +- arch/arm64/kvm/reset.c | 12 +- arch/arm64/mm/init.c | 12 ++ arch/arm64/mm/mmu.c | 5 +- arch/mips/crypto/Makefile | 4 +- arch/mips/include/asm/traps.h | 3 + arch/mips/kernel/cpu-probe.c | 6 + arch/mips/kernel/cpu-r3k-probe.c | 3 + arch/mips/kernel/traps.c | 10 +- arch/powerpc/include/asm/code-patching.h | 2 +- arch/powerpc/include/asm/machdep.h | 3 + arch/powerpc/include/asm/ptrace.h | 7 +- arch/powerpc/include/asm/switch_to.h | 10 ++ arch/powerpc/kernel/asm-offsets.c | 2 +- arch/powerpc/kernel/exceptions-64s.S | 2 +- arch/powerpc/kernel/head_book3s_32.S | 9 +- arch/powerpc/kernel/pci-common.c | 10 ++ arch/powerpc/kernel/process.c | 2 +- arch/powerpc/kernel/traps.c | 5 +- arch/powerpc/lib/sstep.c | 4 +- arch/powerpc/perf/core-book3s.c | 23 ++- arch/powerpc/platforms/pseries/msi.c | 25 ++- arch/s390/kernel/smp.c | 2 +- arch/sparc/include/asm/mman.h | 54 ++++--- arch/sparc/mm/init_32.c | 3 + arch/x86/entry/common.c | 3 +- arch/x86/entry/entry_64_compat.S | 2 + arch/x86/events/intel/core.c | 5 +- arch/x86/include/asm/insn-eval.h | 2 + arch/x86/include/asm/proto.h | 1 + arch/x86/include/asm/ptrace.h | 15 ++ arch/x86/kernel/kvmclock.c | 19 ++- arch/x86/kernel/sev-es.c | 22 ++- arch/x86/kernel/traps.c | 3 +- arch/x86/kernel/unwind_orc.c | 12 +- arch/x86/kvm/lapic.c | 11 +- arch/x86/lib/insn-eval.c | 66 ++++++-- block/blk-zoned.c | 38 ++++- crypto/Kconfig | 2 +- drivers/base/memory.c | 25 ++- drivers/base/swnode.c | 3 + drivers/base/test/Makefile | 1 + drivers/block/rsxx/core.c | 1 + drivers/block/zram/zram_drv.c | 17 ++- drivers/clk/qcom/gdsc.c | 10 +- drivers/clk/qcom/gdsc.h | 3 +- drivers/clk/qcom/gpucc-msm8998.c | 8 +- drivers/cpufreq/qcom-cpufreq-hw.c | 6 +- drivers/firmware/efi/libstub/efi-stub.c | 16 ++ drivers/gpio/gpio-pca953x.c | 78 +++------- drivers/gpio/gpiolib-acpi.c | 19 ++- drivers/gpio/gpiolib.c | 16 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 49 +++--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 - .../gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 6 +- .../gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 8 +- .../gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 48 ++++++ .../gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c | 66 ++++++++ .../gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 48 +++--- drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/gpu/drm/drm_gem_shmem_helper.c | 32 ++-- drivers/gpu/drm/drm_ioc32.c | 11 ++ drivers/gpu/drm/i915/gt/intel_engine_cs.c | 7 +- drivers/gpu/drm/i915/i915_cmd_parser.c | 19 ++- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/meson/meson_drv.c | 11 ++ drivers/gpu/drm/nouveau/nouveau_bo.c | 6 +- drivers/gpu/drm/qxl/qxl_display.c | 1 + drivers/gpu/drm/radeon/radeon.h | 2 + drivers/gpu/drm/radeon/radeon_gem.c | 4 +- drivers/gpu/drm/radeon/radeon_prime.c | 2 + drivers/gpu/drm/tiny/gm12u320.c | 44 +++++- drivers/gpu/drm/ttm/ttm_pool.c | 4 +- drivers/gpu/drm/udl/udl_drv.c | 17 +++ drivers/gpu/drm/udl/udl_drv.h | 1 + drivers/gpu/drm/udl/udl_main.c | 10 ++ drivers/hid/hid-logitech-dj.c | 7 +- drivers/i2c/busses/i2c-rcar.c | 13 +- drivers/input/keyboard/applespi.c | 21 ++- drivers/iommu/amd/init.c | 45 ++++-- drivers/iommu/intel/svm.c | 13 +- .../media/platform/rockchip/rkisp1/rkisp1-params.c | 1 - drivers/media/platform/vsp1/vsp1_drm.c | 6 +- drivers/media/rc/Makefile | 1 + drivers/media/rc/keymaps/Makefile | 1 - drivers/media/rc/keymaps/rc-cec.c | 28 ++-- drivers/media/rc/rc-main.c | 6 + drivers/media/usb/usbtv/usbtv-audio.c | 2 +- drivers/misc/fastrpc.c | 5 + drivers/misc/pvpanic.c | 1 + drivers/mmc/core/bus.c | 11 +- drivers/mmc/core/mmc.c | 15 +- drivers/mmc/host/mmci.c | 10 +- drivers/mmc/host/mtk-sd.c | 18 ++- drivers/mmc/host/mxs-mmc.c | 2 +- drivers/mmc/host/sdhci-iproc.c | 18 +++ drivers/net/Kconfig | 2 +- drivers/net/can/flexcan.c | 24 +-- drivers/net/can/m_can/tcan4x5x.c | 6 +- drivers/net/dsa/sja1105/sja1105_main.c | 2 +- drivers/net/ethernet/atheros/alx/main.c | 7 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 14 +- drivers/net/ethernet/cadence/macb_main.c | 15 +- drivers/net/ethernet/davicom/dm9000.c | 21 ++- drivers/net/ethernet/freescale/enetc/enetc.c | 93 ++++++------ drivers/net/ethernet/freescale/enetc/enetc.h | 5 + drivers/net/ethernet/freescale/enetc/enetc_hw.h | 18 ++- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 98 +++++++++--- drivers/net/ethernet/freescale/enetc/enetc_vf.c | 7 + .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 6 +- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 +- drivers/net/ethernet/ibm/ibmvnic.c | 17 +-- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 + drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 5 + drivers/net/ethernet/intel/ixgbevf/ipsec.c | 5 + drivers/net/ethernet/mediatek/mtk_star_emac.c | 5 +- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 + drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 + drivers/net/ethernet/mellanox/mlxsw/reg.h | 1 + .../net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 5 + .../net/ethernet/mellanox/mlxsw/spectrum_router.c | 7 + drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 3 +- drivers/net/ethernet/mscc/ocelot_flower.c | 3 +- drivers/net/ethernet/realtek/r8169_main.c | 2 +- drivers/net/ethernet/renesas/sh_eth.c | 7 + drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 5 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 9 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 19 ++- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 4 - .../net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 2 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 19 ++- drivers/net/netdevsim/netdev.c | 1 + drivers/net/phy/dp83822.c | 9 +- drivers/net/phy/dp83tc811.c | 11 +- drivers/net/phy/phy.c | 6 +- drivers/net/phy/phy_device.c | 6 +- drivers/net/usb/qmi_wwan.c | 14 -- drivers/net/wan/lapbether.c | 3 - drivers/net/wireless/ath/ath11k/mac.c | 4 +- drivers/net/wireless/ath/ath9k/ath9k.h | 3 +- drivers/net/wireless/ath/ath9k/xmit.c | 6 + drivers/net/wireless/mediatek/mt76/dma.c | 11 +- drivers/nvme/host/fc.c | 2 +- drivers/opp/core.c | 48 +++--- drivers/opp/opp.h | 2 + drivers/pci/controller/pci-xgene-msi.c | 10 +- drivers/pci/controller/pcie-mediatek.c | 7 +- drivers/pci/pci.c | 4 + drivers/pci/pcie/Kconfig | 8 - drivers/pci/pcie/Makefile | 1 - drivers/pci/pcie/bw_notification.c | 138 ----------------- drivers/pci/pcie/err.c | 3 +- drivers/pci/pcie/portdrv.h | 6 - drivers/pci/pcie/portdrv_pci.c | 1 - drivers/perf/arm_dmc620_pmu.c | 1 + drivers/platform/olpc/olpc-ec.c | 15 +- drivers/platform/x86/amd-pmc.c | 14 +- drivers/s390/block/dasd.c | 6 +- drivers/s390/cio/vfio_ccw_ops.c | 6 +- drivers/s390/crypto/vfio_ap_ops.c | 2 +- drivers/s390/net/qeth_core.h | 3 +- drivers/s390/net/qeth_core_main.c | 128 ++++++++-------- drivers/scsi/libiscsi.c | 11 +- drivers/scsi/pm8001/pm8001_hwi.c | 14 +- drivers/scsi/ufs/ufs-sysfs.c | 3 +- drivers/scsi/ufs/ufs.h | 6 +- drivers/scsi/ufs/ufshcd.c | 82 ++++++---- drivers/scsi/ufs/ufshcd.h | 6 +- drivers/spi/spi-stm32.c | 15 +- drivers/staging/comedi/drivers/addi_apci_1032.c | 4 +- drivers/staging/comedi/drivers/addi_apci_1500.c | 18 +-- drivers/staging/comedi/drivers/adv_pci1710.c | 10 +- drivers/staging/comedi/drivers/das6402.c | 2 +- drivers/staging/comedi/drivers/das800.c | 2 +- drivers/staging/comedi/drivers/dmm32at.c | 2 +- drivers/staging/comedi/drivers/me4000.c | 2 +- drivers/staging/comedi/drivers/pcl711.c | 2 +- drivers/staging/comedi/drivers/pcl818.c | 2 +- drivers/staging/ks7010/ks_wlan_net.c | 6 +- drivers/staging/rtl8188eu/core/rtw_ap.c | 5 + drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 6 +- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 7 +- drivers/staging/rtl8192u/r8192U_wx.c | 6 +- drivers/staging/rtl8712/rtl871x_cmd.c | 6 +- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 2 +- drivers/target/target_core_pr.c | 15 +- drivers/target/target_core_transport.c | 15 +- drivers/tty/serial/max310x.c | 29 +--- drivers/usb/class/cdc-acm.c | 5 + drivers/usb/class/usblp.c | 16 +- drivers/usb/core/usb.c | 32 ++++ drivers/usb/dwc3/dwc3-qcom.c | 77 +++++++++- drivers/usb/gadget/function/f_uac1.c | 1 + drivers/usb/gadget/function/f_uac2.c | 2 +- drivers/usb/gadget/function/u_ether_configfs.h | 5 +- drivers/usb/gadget/udc/s3c2410_udc.c | 4 +- drivers/usb/host/xhci-pci.c | 13 +- drivers/usb/host/xhci-ring.c | 3 +- drivers/usb/host/xhci.c | 78 +++++----- drivers/usb/host/xhci.h | 1 + drivers/usb/renesas_usbhs/pipe.c | 2 + drivers/usb/serial/ch341.c | 1 + drivers/usb/serial/cp210x.c | 3 + drivers/usb/serial/io_edgeport.c | 26 ++-- drivers/usb/usbip/stub_dev.c | 42 +++++- drivers/usb/usbip/vhci_sysfs.c | 39 ++++- drivers/usb/usbip/vudc_sysfs.c | 49 +++++- drivers/xen/events/events_2l.c | 22 ++- drivers/xen/events/events_base.c | 130 ++++++++++++---- drivers/xen/events/events_fifo.c | 7 - drivers/xen/events/events_internal.h | 14 +- fs/binfmt_misc.c | 29 ++-- fs/block_dev.c | 11 +- fs/cifs/cifsfs.c | 2 +- fs/cifs/cifsglob.h | 11 +- fs/cifs/connect.c | 10 +- fs/cifs/sess.c | 1 + fs/cifs/smb2inode.c | 1 + fs/cifs/smb2misc.c | 8 +- fs/cifs/smb2ops.c | 10 +- fs/cifs/smb2proto.h | 3 +- fs/cifs/transport.c | 2 +- fs/configfs/file.c | 6 +- fs/ext4/super.c | 9 +- fs/io_uring.c | 3 +- fs/nfs/dir.c | 40 +++-- fs/nfs/nfs4proc.c | 2 +- fs/pnode.h | 2 +- fs/udf/inode.c | 9 +- include/linux/acpi.h | 10 +- include/linux/can/skb.h | 8 +- include/linux/compiler-clang.h | 6 + include/linux/gpio/consumer.h | 2 + include/linux/memblock.h | 4 +- include/linux/memcontrol.h | 6 +- include/linux/memory.h | 3 +- include/linux/perf_event.h | 2 + include/linux/pgtable.h | 4 + include/linux/sched/mm.h | 3 +- include/linux/seqlock.h | 5 +- include/linux/stop_machine.h | 11 +- include/linux/textsearch.h | 2 +- include/linux/usb.h | 2 + include/linux/virtio_net.h | 7 +- include/media/rc-map.h | 7 + include/target/target_core_backend.h | 1 + include/uapi/linux/l2tp.h | 1 + include/uapi/linux/netfilter/nfnetlink_cthelper.h | 2 +- kernel/events/core.c | 42 +++++- kernel/sched/core.c | 126 ++++++++-------- kernel/sched/membarrier.c | 4 +- kernel/sys.c | 2 +- kernel/sysctl.c | 8 +- kernel/time/hrtimer.c | 60 +++++--- lib/Kconfig.kasan | 1 + lib/logic_pio.c | 3 + lib/test_kasan.c | 10 +- mm/highmem.c | 17 ++- mm/huge_memory.c | 2 +- mm/madvise.c | 13 +- mm/memcontrol.c | 15 +- mm/memory.c | 8 + mm/memory_hotplug.c | 2 +- mm/page_alloc.c | 167 ++++++++++----------- mm/slub.c | 2 +- net/core/skbuff.c | 2 + net/dsa/tag_mtk.c | 19 ++- net/dsa/tag_rtl4_a.c | 12 +- net/ethtool/channels.c | 26 ++-- net/ipv4/cipso_ipv4.c | 11 +- net/ipv4/ip_tunnel.c | 5 +- net/ipv4/ip_vti.c | 6 +- net/ipv4/nexthop.c | 10 +- net/ipv4/tcp.c | 26 ++-- net/ipv4/udp_offload.c | 2 +- net/ipv6/calipso.c | 14 +- net/ipv6/ip6_gre.c | 16 +- net/ipv6/ip6_tunnel.c | 10 +- net/ipv6/ip6_vti.c | 6 +- net/ipv6/sit.c | 2 +- net/l2tp/l2tp_core.c | 41 ++--- net/l2tp/l2tp_core.h | 1 + net/l2tp/l2tp_netlink.c | 6 + net/mpls/mpls_gso.c | 3 + net/mptcp/protocol.c | 40 ++--- net/mptcp/protocol.h | 15 +- net/mptcp/subflow.c | 4 + net/netfilter/nf_nat_proto.c | 25 ++- net/netfilter/x_tables.c | 6 +- net/netlabel/netlabel_cipso_v4.c | 3 + net/qrtr/qrtr.c | 4 +- net/sched/sch_api.c | 8 +- net/sunrpc/sched.c | 5 +- samples/bpf/xdpsock_user.c | 2 + security/commoncap.c | 12 +- sound/pci/hda/hda_bind.c | 4 + sound/pci/hda/hda_controller.c | 7 - sound/pci/hda/hda_intel.c | 2 + sound/pci/hda/patch_ca0132.c | 1 + sound/pci/hda/patch_conexant.c | 62 +++++--- sound/pci/hda/patch_hdmi.c | 13 ++ sound/usb/card.c | 6 + sound/usb/quirks.c | 11 +- sound/usb/usbaudio.h | 1 + tools/bpf/resolve_btfids/main.c | 5 + tools/lib/bpf/xsk.c | 5 +- tools/perf/Makefile.perf | 2 +- tools/perf/util/sort.c | 4 +- tools/perf/util/trace-event-read.c | 1 + .../selftests/bpf/progs/netif_receive_skb.c | 13 +- .../testing/selftests/bpf/progs/test_tunnel_kern.c | 6 +- .../testing/selftests/bpf/verifier/array_access.c | 3 +- .../net/forwarding/mirror_gre_bridge_1d_vlan.sh | 9 ++ 343 files changed, 2826 insertions(+), 1666 deletions(-)
[email protected]
maintainerPATCH 1/306 uapi: nfnetlink_cthelper.h: fix userspace compilation error
From: Greg Kroah-Hartman <[email protected]>
From: Dmitry V. Levin <[email protected]>
commit c33cb0020ee6dd96cc9976d6085a7d8422f6dbed upstream.
Apparently, <linux/netfilter/nfnetlink_cthelper.h> and <linux/netfilter/nfnetlink_acct.h> could not be included into the same compilation unit because of a cut-and-paste typo in the former header.
--- include/uapi/linux/netfilter/nfnetlink_cthelper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/netfilter/nfnetlink_cthelper.h +1 -1
@@ -5,7 +5,7 @@#define NFCT_HELPER_STATUS_DISABLED 0#define NFCT_HELPER_STATUS_ENABLED 1 -enum nfnl_acct_msg_types { +enum nfnl_cthelper_msg_types {NFNL_MSG_CTHELPER_NEW ,NFNL_MSG_CTHELPER_GET ,NFNL_MSG_CTHELPER_DEL ,
[email protected]
maintainerPATCH 2/306 powerpc/603: Fix protection of user pages mapped with PROT_NONE
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Christophe Leroy <[email protected]>
commit c119565a15a628efdfa51352f9f6c5186e506a1c upstream.
On book3s/32, page protection is defined by the PP bits in the PTE which provide the following protection depending on the access keys defined in the matching segment register:
- PP 00 means RW with key 0 and N/A with key 1.
- PP 01 means RW with key 0 and RO with key 1.
- PP 10 means RW with both key 0 and key 1.
- PP 11 means RO with both key 0 and key 1.
Since the implementation of kernel userspace access protection, PP bits have been set as follows:
- PP00 for pages without _PAGE_USER
- PP01 for pages with _PAGE_USER and _PAGE_RW
- PP11 for pages with _PAGE_USER and without _PAGE_RW
For kernelspace segments, kernel accesses are performed with key 0 and user accesses are performed with key 1. As PP00 is used for non _PAGE_USER pages, user can't access kernel pages not flagged _PAGE_USER while kernel can.
For userspace segments, both kernel and user accesses are performed with key 0, therefore pages not flagged _PAGE_USER are still accessible to the user.
This shouldn't be an issue, because userspace is expected to be accessible to the user. But unlike most other architectures, powerpc implements PROT_NONE protection by removing _PAGE_USER flag instead of flagging the page as not valid. This means that pages in userspace that are not flagged _PAGE_USER shall remain inaccessible.
To get the expected behaviour, just mimic other architectures in the TLB miss handler by checking _PAGE_USER permission on userspace accesses as if it was the _PAGE_PRESENT bit.
Note that this problem only is only for 603 cores. The 604+ have an hash table, and hash_page() function already implement the verification of _PAGE_USER permission on userspace pages.
--- arch/powerpc/kernel/head_book3s_32.S | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/powerpc/kernel/head_book3s_32.S +6 -3
@@ -447,11 +447,12 @@ InstructionTLBMiss: cmplw 0,r1,r3 #endif mfspr r2, SPRN_SDR1 - li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC + li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | _PAGE_USER rlwinm r2, r2, 28, 0xfffff000 #ifdef CONFIG_MODULES bgt- 112f lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ + li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ #endif 112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */
@@ -510,10 +511,11 @@ DataLoadTLBMiss: lis r1, TASK_SIZE@h /* check if kernel address */ cmplw 0,r1,r3 mfspr r2, SPRN_SDR1 - li r1, _PAGE_PRESENT | _PAGE_ACCESSED + li r1, _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER rlwinm r2, r2, 28, 0xfffff000 bgt- 112f lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ + li r1, _PAGE_PRESENT | _PAGE_ACCESSED addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ 112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */ lwz r2,0(r2) /* get pmd entry */
@@ -587,10 +589,11 @@ DataStoreTLBMiss: lis r1, TASK_SIZE@h /* check if kernel address */ cmplw 0,r1,r3 mfspr r2, SPRN_SDR1 - li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED + li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER rlwinm r2, r2, 28, 0xfffff000 bgt- 112f lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ + li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ 112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */ lwz r2,0(r2) /* get pmd entry */
[email protected]
maintainerPATCH 3/306 powerpc/perf: Fix handling of privilege level checks in perf interrupt context
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Athira Rajeev <[email protected]>
commit 5ae5fbd2107959b68ac69a8b75412208663aea88 upstream.
Running "perf mem record" in powerpc platforms with selinux enabled resulted in soft lockup's. Below call-trace was seen in the logs:
CPU: 58 PID: 3751 Comm: sssd_nss Not tainted 5.11.0-rc7+ #2
NIP: c000000000dff3d4 LR: c000000000dff3d0 CTR: 0000000000000000
REGS: c000007fffab7d60 TRAP: 0100 Not tainted (5.11.0-rc7+)
...
NIP _raw_spin_lock_irqsave+0x94/0x120
LR _raw_spin_lock_irqsave+0x90/0x120
Call Trace:
0xc00000000fd47260 (unreliable)
skb_queue_tail+0x3c/0x90
audit_log_end+0x6c/0x180
common_lsm_audit+0xb0/0xe0
slow_avc_audit+0xa4/0x110
avc_has_perm+0x1c4/0x260
selinux_perf_event_open+0x74/0xd0
security_perf_event_open+0x68/0xc0
record_and_restart+0x6e8/0x7f0
perf_event_interrupt+0x22c/0x560
performance_monitor_exception0x4c/0x60
performance_monitor_common_virt+0x1c8/0x1d0
interrupt: f00 at _raw_spin_lock_irqsave+0x38/0x120
NIP: c000000000dff378 LR: c000000000b5fbbc CTR: c0000000007d47f0
REGS: c00000000fd47860 TRAP: 0f00 Not tainted (5.11.0-rc7+)
...
NIP _raw_spin_lock_irqsave+0x38/0x120
LR skb_queue_tail+0x3c/0x90
interrupt: f00
0x38 (unreliable)
0xc00000000aae6200
audit_log_end+0x6c/0x180
audit_log_exit+0x344/0xf80
__audit_syscall_exit+0x2c0/0x320
do_syscall_trace_leave+0x148/0x200
syscall_exit_prepare+0x324/0x390
system_call_common+0xfc/0x27cThe above trace shows that while the CPU was handling a performance monitor exception, there was a call to security_perf_event_open() function. In powerpc core-book3s, this function is called from perf_allow_kernel() check during recording of data address in the sample via perf_get_data_addr().
Commit da97e18458fb ("perf_event: Add support for LSM and SELinux checks") introduced security enhancements to perf. As part of this commit, the new security hook for perf_event_open() was added in all places where perf paranoid check was previously used. In powerpc core-book3s code, originally had paranoid checks in perf_get_data_addr() and power_pmu_bhrb_read(). So perf_paranoid_kernel() checks were replaced with perf_allow_kernel() in these PMU helper functions as well.
The intention of paranoid checks in core-book3s was to verify privilege access before capturing some of the sample data. Along with paranoid checks, perf_allow_kernel() also does a security_perf_event_open(). Since these functions are accessed while recording a sample, we end up calling selinux_perf_event_open() in PMI context. Some of the security functions use spinlock like sidtab_sid2str_put(). If a perf interrupt hits under a spin lock and if we end up in calling selinux hook functions in PMI handler, this could cause a dead lock.
Since the purpose of this security hook is to control access to perf_event_open(), it is not right to call this in interrupt context.
The paranoid checks in powerpc core-book3s were done at interrupt time which is also not correct.
Reference commits:
Commit cd1231d7035f ("powerpc/perf: Prevent kernel address leak via perf_get_data_addr()") Commit bb19af816025 ("powerpc/perf: Prevent kernel address leak to userspace via BHRB buffer")
We only allow creation of events that have already passed the privilege checks in perf_event_open(). So these paranoid checks are not needed at event time. As a fix, patch uses 'event->attr.exclude_kernel' check to prevent exposing kernel address for userspace only sampling.
--- arch/powerpc/perf/core-book3s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/perf/core-book3s.c +2 -2
@@ -212,7 +212,7 @@ static inline void perf_get_data_addr(stif (!(mmcra &MMCRA_SAMPLE_ENABLE ) || sdar_valid) *addrp =mfspr (SPRN_SDAR ); -if (is_kernel_addr (mfspr (SPRN_SDAR )) &&perf_allow_kernel (&event->attr) !=0 ) +if (is_kernel_addr (mfspr (SPRN_SDAR )) && event->attr.exclude_kernel) *addrp =0 ; }
@@ -506,7 +506,7 @@ static void power_pmu_bhrb_read(struct p* addresses, hence include a check before filtering code */ if (!(ppmu->flags &PPMU_ARCH_31 ) && -is_kernel_addr (addr) &&perf_allow_kernel (&event->attr) !=0 ) +is_kernel_addr (addr) && event->attr.exclude_kernel)continue ;/* Branches are read most recent first (ie. mfbhrb 0 is
[email protected]
maintainerPATCH 4/306 powerpc/pseries: Dont enforce MSI affinity with kdump
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Greg Kurz <[email protected]>
commit f9619d5e5174867536b7e558683bc4408eab833f upstream.
Depending on the number of online CPUs in the original kernel, it is likely for CPU #0 to be offline in a kdump kernel. The associated IRQs in the affinity mappings provided by irq_create_affinity_masks() are thus not started by irq_startup(), as per-design with managed IRQs.
This can be a problem with multi-queue block devices driven by blk-mq :
such a non-started IRQ is very likely paired with the single queue enforced by blk-mq during kdump (see blk_mq_alloc_tag_set()). This causes the device to remain silent and likely hangs the guest at some point.
This is a regression caused by commit 9ea69a55b3b9 ("powerpc/pseries:
Pass MSI affinity to irq_create_mapping()"). Note that this only happens with the XIVE interrupt controller because XICS has a workaround to bypass affinity, which is activated during kdump with the "noirqdistrib" kernel parameter.
The issue comes from a combination of factors:
- discrepancy between the number of queues detected by the multi-queue block driver, that was used to create the MSI vectors, and the single queue mode enforced later on by blk-mq because of kdump (i.e. keeping all queues fixes the issue)
- CPU#0 offline (i.e. kdump always succeed with CPU#0)
Given that I couldn't reproduce on x86, which seems to always have CPU#0 online even during kdump, I'm not sure where this should be fixed. Hence going for another approach : fine-grained affinity is for performance and we don't really care about that during kdump. Simply revert to the previous working behavior of ignoring affinity masks in this case only.
--- arch/powerpc/platforms/pseries/msi.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/msi.c +23 -2
@@ -4,6 +4,7 @@* Copyright 2006-2007 Michael Ellerman, IBM Corp. */ +#include <linux/crash_dump.h> #include <linux/device.h> #include <linux/irq.h> #include <linux/msi.h>
@@ -458,8 +459,28 @@ again:return hwirq; } - virq =irq_create_mapping_affinity (NULL , hwirq, - entry->affinity); +/* +* Depending on the number of online CPUs in the original +* kernel, it is likely for CPU #0 to be offline in a kdump +* kernel. The associated IRQs in the affinity mappings +* provided by irq_create_affinity_masks() are thus not +* started by irq_startup(), as per-design for managed IRQs. +* This can be a problem with multi-queue block devices driven +* by blk-mq : such a non-started IRQ is very likely paired +* with the single queue enforced by blk-mq during kdump (see +* blk_mq_alloc_tag_set()). This causes the device to remain +* silent and likely hangs the guest at some point. +* +* We don't really care for fine-grained affinity when doing +* kdump actually : simply ignore the pre-computed affinity +* masks in this case and let the default mask with all CPUs +* be used when creating the IRQ mappings. +*/ +if (is_kdump_kernel ()) + virq =irq_create_mapping (NULL , hwirq); +else + virq =irq_create_mapping_affinity (NULL , hwirq, + entry->affinity);if (!virq) {pr_debug ("rtas_msi: Failed mapping hwirq %d\n" , hwirq);
[email protected]
maintainerPATCH 5/306 ethernet: alx: fix order of calls on resume
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Jakub Kicinski <[email protected]>
commit a4dcfbc4ee2218abd567d81d795082d8d4afcdf6 upstream.
netif_device_attach() will unpause the queues so we can't call it before __alx_open(). This went undetected until commit b0999223f224 ("alx: add ability to allocate and free alx_napi structures") but now if stack tries to xmit immediately on resume before __alx_open() we'll crash on the NAPI being null:
BUG: kernel NULL pointer dereference, address: 0000000000000198 CPU: 0 PID: 12 Comm: ksoftirqd/0 Tainted: G OE 5.10.0-3-amd64 #1 Debian 5.10.13-1 Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./H77-D3H, BIOS F15 11/14/2013 RIP: 0010:alx_start_xmit+0x34/0x650 [alx] Code: 41 56 41 55 41 54 55 53 48 83 ec 20 0f b7 57 7c 8b 8e b0
0b 00 00 39 ca 72 06 89 d0 31 d2 f7 f1 89 d2 48 8b 84 df
RSP: 0018:ffffb09240083d28 EFLAGS: 00010297
RAX: 0000000000000000 RBX: ffffa04d80ae7800 RCX: 0000000000000004
RDX: 0000000000000000 RSI: ffffa04d80afa000 RDI: ffffa04e92e92a00
RBP: 0000000000000042 R08: 0000000000000100 R09: ffffa04ea3146700
R10: 0000000000000014 R11: 0000000000000000 R12: ffffa04e92e92100
R13: 0000000000000001 R14: ffffa04e92e92a00 R15: ffffa04e92e92a00
FS: 0000000000000000(0000) GS:ffffa0508f600000(0000) knlGS:0000000000000000 i915 0000:00:02.0: vblank wait timed out on crtc 0
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000198 CR3: 000000004460a001 CR4: 00000000001706f0
Call Trace: dev_hard_start_xmit+0xc7/0x1e0 sch_direct_xmit+0x10f/0x310
--- drivers/net/ethernet/atheros/alx/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/atheros/alx/main.c +5 -2
@@ -1894,13 +1894,16 @@ static int alx_resume(struct device *devif (!netif_running (alx->dev))return 0 ; -netif_device_attach (alx->dev);rtnl_lock (); err =__alx_open (alx, true);rtnl_unlock (); +if (err) +return err; + +netif_device_attach (alx->dev); -return err; +return 0 ; } static SIMPLE_DEV_PM_OPS(alx_pm_ops, alx_suspend, alx_resume);
[email protected]
maintainerPATCH 6/306 crypto: mips/poly1305 - enable for all MIPS processors
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Maciej W. Rozycki <[email protected]>
commit 6c810cf20feef0d4338e9b424ab7f2644a8b353e upstream.
The MIPS Poly1305 implementation is generic MIPS code written such as to support down to the original MIPS I and MIPS III ISA for the 32-bit and 64-bit variant respectively. Lift the current limitation then to enable code for MIPSr1 ISA or newer processors only and have it available for all MIPS processors.
--- arch/mips/crypto/Makefile | 4 ++-- crypto/Kconfig | 2 +- drivers/net/Kconfig | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
arch/mips/crypto/Makefile +2 -2
@@ -12,8 +12,8 @@ AFLAGS_chacha-core.o += -O2 # needed to obj-$(CONFIG_CRYPTO_POLY1305_MIPS) += poly1305-mips.o poly1305-mips-y := poly1305-core.o poly1305-glue.o -perlasm-flavour-$(CONFIG_CPU_MIPS32) := o32 -perlasm-flavour-$(CONFIG_CPU_MIPS64) := 64 +perlasm-flavour-$(CONFIG_32BIT) := o32 +perlasm-flavour-$(CONFIG_64BIT) := 64 quiet_cmd_perlasm = PERLASM $@ cmd_perlasm = $(PERL) $(<) $(perlasm-flavour-y) $(@)
crypto/Kconfig +1 -1
@@ -772,7 +772,7 @@ config CRYPTO_POLY1305_X86_64 config CRYPTO_POLY1305_MIPS tristate "Poly1305 authenticator algorithm (MIPS optimized)" - depends on CPU_MIPS32 || (CPU_MIPS64 && 64BIT) + depends on MIPS select CRYPTO_ARCH_HAVE_LIB_POLY1305 config CRYPTO_MD4
drivers/net/Kconfig +1 -1
@@ -92,7 +92,7 @@ config WIREGUARD select CRYPTO_POLY1305_ARM if ARM select CRYPTO_CURVE25519_NEON if ARM && KERNEL_MODE_NEON select CRYPTO_CHACHA_MIPS if CPU_MIPS32_R2 - select CRYPTO_POLY1305_MIPS if CPU_MIPS32 || (CPU_MIPS64 && 64BIT) + select CRYPTO_POLY1305_MIPS if MIPS help WireGuard is a secure, fast, and easy to use replacement for IPSec that uses modern cryptography and clever networking tricks. It's
[email protected]
maintainerPATCH 7/306 mptcp: fix length of ADD_ADDR with port sub-option
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Davide Caratti <[email protected]>
commit 27ab92d9996e4e003a726d22c56d780a1655d6b4 upstream.
in current Linux, MPTCP peers advertising endpoints with port numbers use a sub-option length that wrongly accounts for the trailing TCP NOP. Also, receivers will only process incoming ADD_ADDR with port having such wrong sub-option length. Fix this, making ADD_ADDR compliant to RFC8684 §3.4.1.
this can be verified running tcpdump on the kselftests artifacts:
unpatched kernel:
[root@bottarga mptcp]# tcpdump -tnnr unpatched.pcap | grep add-addr
reading from file unpatched.pcap, link-type LINUX_SLL (Linux cooked v1), snapshot length 65535
IP 10.0.1.1.10000 > 10.0.1.2.53078: Flags [.], ack 101, win 509, options [nop,nop,TS val 214459678 ecr 521312851,mptcp add-addr v1 id 1 a00:201:2774:2d88:7436:85c3:17fd:101], length 0 IP 10.0.1.2.53078 > 10.0.1.1.10000: Flags [.], ack 101, win 502, options [nop,nop,TS val 521312852 ecr 214459678,mptcp add-addr[bad opt]]
patched kernel:
[root@bottarga mptcp]# tcpdump -tnnr patched.pcap | grep add-addr
reading from file patched.pcap, link-type LINUX_SLL (Linux cooked v1), snapshot length 65535
IP 10.0.1.1.10000 > 10.0.1.2.38178: Flags [.], ack 101, win 509, options [nop,nop,TS val 3728873902 ecr 2732713192,mptcp add-addr v1 id 1 10.0.2.1:10100 hmac 0xbccdfcbe59292a1f,nop,nop], length 0 IP 10.0.1.2.38178 > 10.0.1.1.10000: Flags [.], ack 101, win 502, options [nop,nop,TS val 2732713195 ecr 3728873902,mptcp add-addr v1-echo id 1 10.0.2.1:10100,nop,nop], length 0
--- net/mptcp/protocol.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
net/mptcp/protocol.h +8 -6
@@ -50,14 +50,15 @@#define TCPOLEN_MPTCP_DSS_MAP64 14#define TCPOLEN_MPTCP_DSS_CHECKSUM 2#define TCPOLEN_MPTCP_ADD_ADDR 16 -#define TCPOLEN_MPTCP_ADD_ADDR_PORT 20 +#define TCPOLEN_MPTCP_ADD_ADDR_PORT 18#define TCPOLEN_MPTCP_ADD_ADDR_BASE 8 -#define TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT 12 +#define TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT 10#define TCPOLEN_MPTCP_ADD_ADDR6 28 -#define TCPOLEN_MPTCP_ADD_ADDR6_PORT 32 +#define TCPOLEN_MPTCP_ADD_ADDR6_PORT 30#define TCPOLEN_MPTCP_ADD_ADDR6_BASE 20 -#define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT 24 -#define TCPOLEN_MPTCP_PORT_LEN 4 +#define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT 22 +#define TCPOLEN_MPTCP_PORT_LEN 2 +#define TCPOLEN_MPTCP_PORT_ALIGN 2#define TCPOLEN_MPTCP_RM_ADDR_BASE 4#define TCPOLEN_MPTCP_FASTCLOSE 12
@@ -587,8 +588,9 @@ static inline unsigned int mptcp_add_add len =TCPOLEN_MPTCP_ADD_ADDR6_BASE ;if (!echo) len +=MPTCPOPT_THMAC_LEN ; +/* account for 2 trailing 'nop' options */ if (port) - len +=TCPOLEN_MPTCP_PORT_LEN ; + len +=TCPOLEN_MPTCP_PORT_LEN +TCPOLEN_MPTCP_PORT_ALIGN ;return len; }
[email protected]
maintainerPATCH 8/306 ath9k: fix transmitting to stations in dynamic SMPS mode
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Felix Fietkau <[email protected]>
commit 3b9ea7206d7e1fdd7419cbd10badd3b2c80d04b4 upstream.
When transmitting to a receiver in dynamic SMPS mode, all transmissions that use multiple spatial streams need to be sent using CTS-to-self or RTS/CTS to give the receiver's extra chains some time to wake up.
This fixes the tx rate getting stuck at <= MCS7 for some clients, especially Intel ones, which make aggressive use of SMPS.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 3 ++- drivers/net/wireless/ath/ath9k/xmit.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ath9k.h +2 -1
@@ -177,7 +177,8 @@ struct ath_frame_info {s8 txq;u8 keyix;u8 rtscts_rate; - u8 retries : 7; + u8 retries : 6; + u8 dyn_smps : 1; u8 baw_tracked : 1;u8 tx_power; enum ath9k_key_type keytype:2;
drivers/net/wireless/ath/ath9k/xmit.c +6 -0
@@ -1271,6 +1271,11 @@ static void ath_buf_set_rate(struct ath_ is_40, is_sgi, is_sp);if (rix <8 && (tx_info->flags &IEEE80211_TX_CTL_STBC )) info->rates[i].RateFlags |=ATH9K_RATESERIES_STBC ; +if (rix >=8 && fi->dyn_smps) { + info->rates[i].RateFlags |= +ATH9K_RATESERIES_RTS_CTS ; + info->flags |=ATH9K_TXDESC_CTSENA ; + } info->txpower[i] =ath_get_rate_txpower (sc, bf, rix, is_40, false);
@@ -2114,6 +2119,7 @@ static void setup_frame_info(struct ieee fi->keyix = an->ps_key; else fi->keyix = ATH9K_TXKEYIX_INVALID; + fi->dyn_smps = sta && sta->smps_mode ==IEEE80211_SMPS_DYNAMIC ; fi->keytype = keytype; fi->framelen = framelen; fi->tx_power = txpower;
[email protected]
maintainerPATCH 9/306 net: Fix gro aggregation for udp encaps with zero csum
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Daniel Borkmann <[email protected]>
commit 89e5c58fc1e2857ccdaae506fb8bc5fed57ee063 upstream.
We noticed a GRO issue for UDP-based encaps such as vxlan/geneve when the csum for the UDP header itself is 0. In that case, GRO aggregation does not take place on the phys dev, but instead is deferred to the vxlan/geneve driver (see trace below).
The reason is essentially that GRO aggregation bails out in udp_gro_receive() for such case when drivers marked the skb with CHECKSUM_UNNECESSARY (ice, i40e, others) where for non-zero csums 2abb7cdc0dc8 ("udp: Add support for doing checksum unnecessary conversion") promotes those skbs to CHECKSUM_COMPLETE and napi context has csum_valid set. This is however not the case for zero UDP csum (here: csum_cnt is still 0 and csum_valid continues to be false).
At the same time 57c67ff4bd92 ("udp: additional GRO support") added matches on !uh->check ^ !uh2->check as part to determine candidates for aggregation, so it certainly is expected to handle zero csums in udp_gro_receive(). The purpose of the check added via 662880f44203 ("net: Allow GRO to use and set levels of checksum unnecessary") seems to catch bad csum and stop aggregation right away.
One way to fix aggregation in the zero case is to only perform the !csum_valid check in udp_gro_receive() if uh->check is infact non-zero.
Before:
[...]
swapper 0 [008] 731.946506: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497100400 len=1500 (1) swapper 0 [008] 731.946507: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497100200 len=1500 swapper 0 [008] 731.946507: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497101100 len=1500 swapper 0 [008] 731.946508: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497101700 len=1500 swapper 0 [008] 731.946508: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497101b00 len=1500 swapper 0 [008] 731.946508: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497100600 len=1500 swapper 0 [008] 731.946508: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497100f00 len=1500 swapper 0 [008] 731.946509: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497100a00 len=1500 swapper 0 [008] 731.946516: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497100500 len=1500 swapper 0 [008] 731.946516: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497100700 len=1500 swapper 0 [008] 731.946516: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497101d00 len=1500 (2) swapper 0 [008] 731.946517: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497101000 len=1500 swapper 0 [008] 731.946517: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497101c00 len=1500 swapper 0 [008] 731.946517: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497101400 len=1500 swapper 0 [008] 731.946518: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497100e00 len=1500 swapper 0 [008] 731.946518: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497101600 len=1500 swapper 0 [008] 731.946521: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff966497100800 len=774 swapper 0 [008] 731.946530: net:netif_receive_skb: dev=test_vxlan skbaddr=0xffff966497100400 len=14032 (1) swapper 0 [008] 731.946530: net:netif_receive_skb: dev=test_vxlan skbaddr=0xffff966497101d00 len=9112 (2)
[...]
# netperf -H 10.55.10.4 -t TCP_STREAM -l 20 MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.55.10.4 () port 0 AF_INET : demo Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec
87380 16384 16384 20.01 13129.24
After:
[...]
swapper 0 [026] 521.862641: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff93ab0d479000 len=11286 (1) swapper 0 [026] 521.862643: net:netif_receive_skb: dev=test_vxlan skbaddr=0xffff93ab0d479000 len=11236 (1) swapper 0 [026] 521.862650: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff93ab0d478500 len=2898 (2) swapper 0 [026] 521.862650: net:netif_receive_skb: dev=enp10s0f0 skbaddr=0xffff93ab0d479f00 len=8490 (3) swapper 0 [026] 521.862653: net:netif_receive_skb: dev=test_vxlan skbaddr=0xffff93ab0d478500 len=2848 (2) swapper 0 [026] 521.862653: net:netif_receive_skb: dev=test_vxlan skbaddr=0xffff93ab0d479f00 len=8440 (3)
[...]
# netperf -H 10.55.10.4 -t TCP_STREAM -l 20 MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.55.10.4 () port 0 AF_INET : demo Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec
87380 16384 16384 20.01 24576.53
--- net/ipv4/udp_offload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/udp_offload.c +1 -1
@@ -525,7 +525,7 @@ struct sk_buff *udp_gro_receive(struct l }if (!sk ||NAPI_GRO_CB (skb)->encap_mark || - (skb->ip_summed !=CHECKSUM_PARTIAL && + (uh->check && skb->ip_summed !=CHECKSUM_PARTIAL &&NAPI_GRO_CB (skb)->csum_cnt ==0 && !NAPI_GRO_CB (skb)->csum_valid) || !udp_sk (sk)->gro_receive)
[email protected]
maintainerPATCH 10/306 net: check if protocol extracted by virtio_net_hdr_set_proto is correct
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Balazs Nemeth <[email protected]>
commit 924a9bc362a5223cd448ca08c3dde21235adc310 upstream.
For gso packets, virtio_net_hdr_set_proto sets the protocol (if it isn't set) based on the type in the virtio net hdr, but the skb could contain anything since it could come from packet_snd through a raw socket. If there is a mismatch between what virtio_net_hdr_set_proto sets and the actual protocol, then the skb could be handled incorrectly later on.
An example where this poses an issue is with the subsequent call to skb_flow_dissect_flow_keys_basic which relies on skb->protocol being set correctly. A specially crafted packet could fool skb_flow_dissect_flow_keys_basic preventing EINVAL to be returned.
Avoid blindly trusting the information provided by the virtio net header by checking that the protocol in the packet actually matches the protocol set by virtio_net_hdr_set_proto. Note that since the protocol is only checked if skb->dev implements header_ops->parse_protocol, packets from devices without the implementation are not checked at this stage.
--- include/linux/virtio_net.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/linux/virtio_net.h +6 -1
@@ -79,8 +79,13 @@ static inline int virtio_net_hdr_to_skb( if (gso_type && skb->network_header) { struct flow_keys_basic keys; - if (!skb->protocol) + if (!skb->protocol) { + __be16 protocol = dev_parse_header_protocol(skb); + virtio_net_hdr_set_proto(skb, hdr); + if (protocol && protocol != skb->protocol) + return -EINVAL; + } retry: if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys, NULL, 0, 0, 0,
[email protected]
maintainerPATCH 11/306 net: avoid infinite loop in mpls_gso_segment when mpls_hlen == 0
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Balazs Nemeth <[email protected]>
commit d348ede32e99d3a04863e9f9b28d224456118c27 upstream.
A packet with skb_inner_network_header(skb) == skb_network_header(skb) and ETH_P_MPLS_UC will prevent mpls_gso_segment from pulling any headers from the packet. Subsequently, the call to skb_mac_gso_segment will again call mpls_gso_segment with the same packet leading to an infinite loop. In addition, ensure that the header length is a multiple of four, which should hold irrespective of the number of stacked labels.
--- net/mpls/mpls_gso.c | 3 +++ 1 file changed, 3 insertions(+)
net/mpls/mpls_gso.c +3 -0
@@ -14,6 +14,7 @@#include <linux/netdev_features.h> #include <linux/netdevice.h> #include <linux/skbuff.h> +#include <net/mpls.h> static struct sk_buff *mpls_gso_segment (struct sk_buff *skb,netdev_features_t features)
@@ -27,6 +28,8 @@ static struct sk_buff *mpls_gso_segment(skb_reset_network_header (skb); mpls_hlen =skb_inner_network_header (skb) -skb_network_header (skb); +if (unlikely (!mpls_hlen || mpls_hlen %MPLS_HLEN )) + goto out;if (unlikely (!pskb_may_pull (skb, mpls_hlen))) goto out;
[email protected]
maintainerPATCH 12/306 ath11k: fix AP mode for QCA6390
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Kalle Valo <[email protected]>
commit 77d7e87128d4dfb400df4208b2812160e999c165 upstream.
Commit c134d1f8c436 ("ath11k: Handle errors if peer creation fails") completely broke AP mode on QCA6390:
kernel: [ 151.230734] ath11k_pci 0000:06:00.0: failed to create peer after vdev start delay: -22 wpa_supplicant[2307]: Failed to set beacon parameters
wpa_supplicant[2307]: Interface initialization failed
wpa_supplicant[2307]: wlan0: interface state UNINITIALIZED->DISABLED wpa_supplicant[2307]: wlan0: AP-DISABLED
wpa_supplicant[2307]: wlan0: Unable to setup interface.
wpa_supplicant[2307]: Failed to initialize AP interface
This was because commit c134d1f8c436 ("ath11k: Handle errors if peer creation fails") added error handling for ath11k_peer_create(), which had been failing all along but was unnoticed due to the missing error handling. The actual bug was introduced already in commit aa44b2f3ecd4 ("ath11k: start vdev if a bss peer is already created").
ath11k_peer_create() was failing because for AP mode the peer is created already earlier op_add_interface() and we should skip creation here, but the check for modes was wrong. Fixing that makes AP mode work again.
This shouldn't affect IPQ8074 nor QCN9074 as they have hw_params.vdev_start_delay disabled.
Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
--- drivers/net/wireless/ath/ath11k/mac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +2 -2
@@ -5299,8 +5299,8 @@ ath11k_mac_op_assign_vif_chanctx(struct }if (ab->hw_params.vdev_start_delay && - (arvif->vdev_type ==WMI_VDEV_TYPE_AP || - arvif->vdev_type ==WMI_VDEV_TYPE_MONITOR )) { + arvif->vdev_type !=WMI_VDEV_TYPE_AP && + arvif->vdev_type !=WMI_VDEV_TYPE_MONITOR ) { param.vdev_id = arvif->vdev_id; param.peer_type =WMI_PEER_TYPE_DEFAULT ; param.peer_addr = ar->mac_addr;
[email protected]
maintainerPATCH 13/306 net: l2tp: reduce log level of messages in receive path, add counter instead
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Matthias Schiffer <[email protected]>
commit 3e59e8856758eb5a2dfe1f831ef53b168fd58105 upstream.
Commit 5ee759cda51b ("l2tp: use standard API for warning log messages") changed a number of warnings about invalid packets in the receive path so that they are always shown, instead of only when a special L2TP debug flag is set. Even with rate limiting these warnings can easily cause significant log spam - potentially triggered by a malicious party sending invalid packets on purpose.
In addition these warnings were noticed by projects like Tunneldigger [1], which uses L2TP for its data path, but implements its own control protocol (which is sufficiently different from L2TP data packets that it would always be passed up to userspace even with future extensions of L2TP).
Some of the warnings were already redundant, as l2tp_stats has a counter for these packets. This commit adds one additional counter for invalid packets that are passed up to userspace. Packets with unknown session are not counted as invalid, as there is nothing wrong with the format of these packets.
With the additional counter, all of these messages are either redundant or benign, so we reduce them to pr_debug_ratelimited().
[1] https://github.com/wlanslovenija/tunneldigger/issues/160
--- include/uapi/linux/l2tp.h | 1 + net/l2tp/l2tp_core.c | 41 ++++++++++++++++++++++------------------- net/l2tp/l2tp_core.h | 1 + net/l2tp/l2tp_netlink.c | 6 ++++++ 4 files changed, 30 insertions(+), 19 deletions(-)
include/uapi/linux/l2tp.h +1 -0
@@ -145,6 +145,7 @@ enum {L2TP_ATTR_RX_ERRORS ,/* u64 */ L2TP_ATTR_STATS_PAD ,L2TP_ATTR_RX_COOKIE_DISCARDS ,/* u64 */ +L2TP_ATTR_RX_INVALID ,/* u64 */ __L2TP_ATTR_STATS_MAX, };
net/l2tp/l2tp_core.c +22 -19
93 lines not on this page · raw message
net/l2tp/l2tp_core.h +1 -0
@@ -39,6 +39,7 @@ struct l2tp_stats {atomic_long_t rx_oos_packets;atomic_long_t rx_errors;atomic_long_t rx_cookie_discards; +atomic_long_t rx_invalid; };struct l2tp_tunnel ;
net/l2tp/l2tp_netlink.c +6 -0
@@ -428,6 +428,9 @@ static int l2tp_nl_tunnel_send(struct sk L2TP_ATTR_STATS_PAD) ||nla_put_u64_64bit (skb,L2TP_ATTR_RX_ERRORS ,atomic_long_read (&tunnel->stats.rx_errors), +L2TP_ATTR_STATS_PAD ) || +nla_put_u64_64bit (skb,L2TP_ATTR_RX_INVALID , +atomic_long_read (&tunnel->stats.rx_invalid), L2TP_ATTR_STATS_PAD)) goto nla_put_failure;nla_nest_end (skb, nest);
@@ -771,6 +774,9 @@ static int l2tp_nl_session_send(struct s L2TP_ATTR_STATS_PAD) ||nla_put_u64_64bit (skb,L2TP_ATTR_RX_ERRORS ,atomic_long_read (&session->stats.rx_errors), +L2TP_ATTR_STATS_PAD ) || +nla_put_u64_64bit (skb,L2TP_ATTR_RX_INVALID , +atomic_long_read (&session->stats.rx_invalid), L2TP_ATTR_STATS_PAD)) goto nla_put_failure;nla_nest_end (skb, nest);
[email protected]
maintainerPATCH 14/306 gpiolib: acpi: Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Andy Shevchenko <[email protected]>
commit 62d5247d239d4b48762192a251c647d7c997616a upstream.
On some systems the ACPI tables has wrong pin number and instead of having a relative one it provides an absolute one in the global GPIO number space.
Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk to cope with such cases.
Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip")
--- drivers/gpio/gpiolib-acpi.c | 7 ++++++- include/linux/gpio/consumer.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib-acpi.c +6 -1
@@ -677,6 +677,7 @@ static int acpi_populate_gpio_lookup(strif (!lookup->desc) {const struct acpi_resource_gpio *agpio = &ares->data.gpio;bool gpioint = agpio->connection_type ==ACPI_RESOURCE_GPIO_TYPE_INT ; +struct gpio_desc *desc;u16 pin_index;if (lookup->info.quirks &ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint)
@@ -689,8 +690,12 @@ static int acpi_populate_gpio_lookup(strif (pin_index >= agpio->pin_table_length)return 1 ; - lookup->desc =acpi_get_gpiod (agpio->resource_source.string_ptr, +if (lookup->info.quirks &ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER ) + desc =gpio_to_desc (agpio->pin_table[pin_index]); +else + desc =acpi_get_gpiod (agpio->resource_source.string_ptr, agpio->pin_table[pin_index]); + lookup->desc = desc; lookup->info.pin_config = agpio->pin_config; lookup->info.debounce = agpio->debounce_timeout; lookup->info.gpioint = gpioint;
include/linux/gpio/consumer.h +2 -0
@@ -674,6 +674,8 @@ struct acpi_gpio_mapping {* get GpioIo type explicitly, this quirk may be used. */ #define ACPI_GPIO_QUIRK_ONLY_GPIOIO BIT(1) +/* Use given pin as an absolute GPIO number in the system */ +#define ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER BIT(2)unsigned int quirks; };
[email protected]
maintainerPATCH 15/306 gpiolib: acpi: Allow to find GpioInt() resource by name and index
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Andy Shevchenko <[email protected]>
commit 809390219fb9c2421239afe5c9eb862d73978ba0 upstream.
Currently only search by index is supported. However, in some cases we might need to pass the quirks to the acpi_dev_gpio_irq_get().
For this, split out acpi_dev_gpio_irq_get_by() and replace acpi_dev_gpio_irq_get() by calling above with NULL for name parameter.
Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip")
--- drivers/gpio/gpiolib-acpi.c | 12 ++++++++---- include/linux/acpi.h | 10 ++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-)
drivers/gpio/gpiolib-acpi.c +8 -4
@@ -945,8 +945,9 @@ struct gpio_desc *acpi_node_get_gpiod(st }/** -* acpi_dev_gpio_irq_get() - Find GpioInt and translate it to Linux IRQ number +* acpi_dev_gpio_irq_get_by() - Find GpioInt and translate it to Linux IRQ number * @adev: pointer to a ACPI device to get IRQ from +* @name: optional name of GpioInt resource * @index: index of GpioInt resource (starting from %0) * * If the device has one or more GpioInt resources, this function can be
@@ -956,9 +957,12 @@ struct gpio_desc *acpi_node_get_gpiod(st* The function is idempotent, though each time it runs it will configure GPIO * pin direction according to the flags in GpioInt resource. * +* The function takes optional @name parameter. If the resource has a property +* name, then only those will be taken into account. +* * Return: Linux IRQ number (> %0) on success, negative errno on failure. */ -int acpi_dev_gpio_irq_get (struct acpi_device *adev,int index) +int acpi_dev_gpio_irq_get_by (struct acpi_device *adev,const char *name,int index) {int idx, i;unsigned int irq_flags;
@@ -968,7 +972,7 @@ int acpi_dev_gpio_irq_get(struct acpi_destruct acpi_gpio_info info;struct gpio_desc *desc; - desc =acpi_get_gpiod_by_index (adev,NULL , i, &info); + desc =acpi_get_gpiod_by_index (adev, name, i, &info);/* Ignore -EPROBE_DEFER, it only matters if idx matches */ if (IS_ERR (desc) &&PTR_ERR (desc) != -EPROBE_DEFER )
@@ -1013,7 +1017,7 @@ int acpi_dev_gpio_irq_get(struct acpi_de }return -ENOENT ; } -EXPORT_SYMBOL_GPL (acpi_dev_gpio_irq_get); +EXPORT_SYMBOL_GPL (acpi_dev_gpio_irq_get_by); static acpi_status acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
include/linux/acpi.h +8 -2
@@ -1072,19 +1072,25 @@ void __acpi_handle_debug(struct _ddebug#if defined(CONFIG_ACPI ) && defined(CONFIG_GPIOLIB )bool acpi_gpio_get_irq_resource (struct acpi_resource *ares,struct acpi_resource_gpio **agpio); -int acpi_dev_gpio_irq_get (struct acpi_device *adev,int index); +int acpi_dev_gpio_irq_get_by (struct acpi_device *adev,const char *name,int index);#else static inline bool acpi_gpio_get_irq_resource (struct acpi_resource *ares,struct acpi_resource_gpio **agpio) {return false; } -static inline int acpi_dev_gpio_irq_get (struct acpi_device *adev,int index) +static inline int acpi_dev_gpio_irq_get_by (struct acpi_device *adev, +const char *name,int index) {return -ENXIO ; }#endif +static inline int acpi_dev_gpio_irq_get (struct acpi_device *adev,int index) +{ +return acpi_dev_gpio_irq_get_by (adev,NULL , index); +} +/* Device properties */ #ifdef CONFIG_ACPI
[email protected]
maintainerPATCH 16/306 gpiolib: Read "gpio-line-names" from a firmware node
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Andy Shevchenko <[email protected]>
commit b41ba2ec54a70908067034f139aa23d0dd2985ce upstream.
On STM32MP1, the GPIO banks are subnodes of pin-controller@50002000, see arch/arm/boot/dts/stm32mp151.dtsi. The driver for pin-controller@50002000 is in drivers/pinctrl/stm32/pinctrl-stm32.c and iterates over all of its DT subnodes when registering each GPIO bank gpiochip. Each gpiochip has:
- gpio_chip.parent = dev,
where dev is the device node of the pin controller
- gpio_chip.of_node = np,
which is the OF node of the GPIO bank
Therefore, dev_fwnode(chip->parent) != of_fwnode_handle(chip.of_node), i.e. pin-controller@50002000 != pin-controller@50002000/gpio@5000*000.
The original code behaved correctly, as it extracted the "gpio-line-names" from of_fwnode_handle(chip.of_node) = pin-controller@50002000/gpio@5000*000.
To achieve the same behaviour, read property from the firmware node.
--- drivers/gpio/gpiolib.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpio/gpiolib.c +4 -8
@@ -365,22 +365,18 @@ static int gpiochip_set_desc_names(struc* * Looks for device property "gpio-line-names" and if it exists assigns * GPIO line names for the chip. The memory allocated for the assigned -* names belong to the underlying software node and should not be released +* names belong to the underlying firmware node and should not be released * by the caller. */ static int devprop_gpiochip_set_names (struct gpio_chip *chip) {struct gpio_device *gdev = chip->gpiodev; -struct device *dev = chip->parent; +struct fwnode_handle *fwnode =dev_fwnode (&gdev->dev);const char **names;int ret, i;int count; -/* GPIO chip may not have a parent device whose properties we inspect. */ -if (!dev) -return 0 ; - - count =device_property_string_array_count (dev,"gpio-line-names" ); + count =fwnode_property_string_array_count (fwnode,"gpio-line-names" );if (count <0 )return 0 ;
@@ -394,7 +390,7 @@ static int devprop_gpiochip_set_names(stif (!names)return -ENOMEM ; - ret =device_property_read_string_array (dev,"gpio-line-names" , + ret =fwnode_property_read_string_array (fwnode,"gpio-line-names" , names, count);if (ret <0 ) {dev_warn (&gdev->dev,"failed to read GPIO line names\n" );
[email protected]
maintainerPATCH 17/306 can: skb: can_skb_set_owner(): fix ref counting if socket was closed before setting skb ownership
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Oleksij Rempel <[email protected]>
commit e940e0895a82c6fbaa259f2615eb52b57ee91a7e upstream.
There are two ref count variables controlling the free()ing of a socket:
- struct sock::sk_refcnt - which is changed by sock_hold()/sock_put()
- struct sock::sk_wmem_alloc - which accounts the memory allocated by the skbs in the send path.
In case there are still TX skbs on the fly and the socket() is closed, the struct sock::sk_refcnt reaches 0. In the TX-path the CAN stack clones an "echo" skb, calls sock_hold() on the original socket and references it. This produces the following back trace:
| WARNING: CPU: 0 PID: 280 at lib/refcount.c:25 refcount_warn_saturate+0x114/0x134 | refcount_t: addition on 0; use-after-free. | Modules linked in: coda_vpu(E) v4l2_jpeg(E) videobuf2_vmalloc(E) imx_vdoa(E) | CPU: 0 PID: 280 Comm: test_can.sh Tainted: G E 5.11.0-04577-gf8ff6603c617 #203 | Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) | Backtrace: | [<80bafea4>] (dump_backtrace) from [<80bb0280>] (show_stack+0x20/0x24) r7:00000000 r6:600f0113 r5:00000000 r4:81441220 | [<80bb0260>] (show_stack) from [<80bb593c>] (dump_stack+0xa0/0xc8) | [<80bb589c>] (dump_stack) from [<8012b268>] (__warn+0xd4/0x114) r9:00000019 r8:80f4a8c2 r7:83e4150c r6:00000000 r5:00000009 r4:80528f90 | [<8012b194>] (__warn) from [<80bb09c4>] (warn_slowpath_fmt+0x88/0xc8) r9:83f26400 r8:80f4a8d1 r7:00000009 r6:80528f90 r5:00000019 r4:80f4a8c2 | [<80bb0940>] (warn_slowpath_fmt) from [<80528f90>] (refcount_warn_saturate+0x114/0x134) r8:00000000 r7:00000000 r6:82b44000 r5:834e5600 r4:83f4d540 | [<80528e7c>] (refcount_warn_saturate) from [<8079a4c8>] (__refcount_add.constprop.0+0x4c/0x50) | [<8079a47c>] (__refcount_add.constprop.0) from [<8079a57c>] (can_put_echo_skb+0xb0/0x13c) | [<8079a4cc>] (can_put_echo_skb) from [<8079ba98>] (flexcan_start_xmit+0x1c4/0x230) r9:00000010 r8:83f48610 r7:0fdc0000 r6:0c080000 r5:82b44000 r4:834e5600 | [<8079b8d4>] (flexcan_start_xmit) from [<80969078>] (netdev_start_xmit+0x44/0x70) r9:814c0ba0 r8:80c8790c r7:00000000 r6:834e5600 r5:82b44000 r4:82ab1f00 | [<80969034>] (netdev_start_xmit) from [<809725a4>] (dev_hard_start_xmit+0x19c/0x318) r9:814c0ba0 r8:00000000 r7:82ab1f00 r6:82b44000 r5:00000000 r4:834e5600 | [<80972408>] (dev_hard_start_xmit) from [<809c6584>] (sch_direct_xmit+0xcc/0x264) r10:834e5600 r9:00000000 r8:00000000 r7:82b44000 r6:82ab1f00 r5:834e5600 r4:83f27400 | [<809c64b8>] (sch_direct_xmit) from [<809c6c0c>] (__qdisc_run+0x4f0/0x534)
To fix this problem, only set skb ownership to sockets which have still a ref count > 0.
--- include/linux/can/skb.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
include/linux/can/skb.h +6 -2
@@ -49,8 +49,12 @@ static inline void can_skb_reserve(strucstatic inline void can_skb_set_owner (struct sk_buff *skb,struct sock *sk) { -if (sk) { -sock_hold (sk); +/* If the socket has already been closed by user space, the +* refcount may already be 0 (and the socket will be freed +* after the last TX skb has been freed). So only increase +* socket refcount if the refcount is > 0. +*/ +if (sk &&refcount_inc_not_zero (&sk->sk_refcnt)) { skb->destructor = sock_efree; skb->sk = sk; }
[email protected]
maintainerPATCH 18/306 gpio: pca953x: Set IRQ type when handle Intel Galileo Gen 2
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Andy Shevchenko <[email protected]>
commit eb441337c7147514ab45036cadf09c3a71e4ce31 upstream.
The commit 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") indeliberately made a regression on how IRQ line from GPIO I²C expander is handled. I.e. it reveals that the quirk for Intel Galileo Gen 2 misses the part of setting IRQ type which previously was predefined by gpio-dwapb driver. Now, we have to reorganize the approach to call necessary parts, which can be done via ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk.
Without this fix and with above mentioned change the kernel hangs on the first IRQ event with:
gpio gpiochip3: Persistence not supported for GPIO 1
irq 32, desc: 62f8fb50, depth: 0, count: 0, unhandled: 0
->handle_irq(): 41c7b0ab, handle_bad_irq+0x0/0x40
->irq_data.chip(): e03f1e72, 0xc2539218
->action(): 0ecc7e6f
->action->handler(): 8a3db21e, irq_default_primary_handler+0x0/0x10
IRQ_NOPROBE set
unexpected IRQ trap at vector 20Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip")
--- drivers/gpio/gpio-pca953x.c | 78 ++++++++++++-------------------------------- 1 file changed, 23 insertions(+), 55 deletions(-)
drivers/gpio/gpio-pca953x.c +23 -55
@@ -112,8 +112,29 @@ MODULE_DEVICE_TABLE(i2c, pca953x_id); #ifdef CONFIG_GPIO_PCA953X_IRQ #include <linux/dmi.h> -#include <linux/gpio.h> -#include <linux/list.h> + +static const struct acpi_gpio_params pca953x_irq_gpios = { 0, 0, true }; + +static const struct acpi_gpio_mapping pca953x_acpi_irq_gpios[] = { + { "irq-gpios", &pca953x_irq_gpios, 1, ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER }, + { } +}; + +static int pca953x_acpi_get_irq(struct device *dev) +{ + int ret; + + ret = devm_acpi_dev_add_driver_gpios(dev, pca953x_acpi_irq_gpios); + if (ret) + dev_warn(dev, "can't add GPIO ACPI mapping\n"); + + ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq-gpios", 0); + if (ret < 0) + return ret; + + dev_info(dev, "ACPI interrupt quirk (IRQ %d)\n", ret); + return ret; +} static const struct dmi_system_id pca953x_dmi_acpi_irq_info[] = { {
@@ -132,59 +153,6 @@ static const struct dmi_system_id pca953 }, {} }; - -#ifdef CONFIG_ACPI -static int pca953x_acpi_get_pin (struct acpi_resource *ares,void *data) -{ -struct acpi_resource_gpio *agpio; -int *pin = data; - -if (acpi_gpio_get_irq_resource (ares, &agpio)) - *pin = agpio->pin_table[0 ]; -return 1 ; -} - -static int pca953x_acpi_find_pin (struct device *dev) -{ -struct acpi_device *adev =ACPI_COMPANION (dev); -int pin = -ENOENT , ret; -LIST_HEAD (r); - - ret =acpi_dev_get_resources (adev, &r, pca953x_acpi_get_pin, &pin); -acpi_dev_free_resource_list (&r); -if (ret <0 ) -return ret; - -return pin; -} -#else -static inline int pca953x_acpi_find_pin (struct device *dev) {return -ENXIO ; } -#endif - -static int pca953x_acpi_get_irq (struct device *dev) -{ -int pin, ret; - - pin =pca953x_acpi_find_pin (dev); -if (pin <0 ) -return pin; - -dev_info (dev,"Applying ACPI interrupt quirk (GPIO %d)\n" , pin); - -if (!gpio_is_valid (pin)) -return -EINVAL ; - - ret =gpio_request (pin,"pca953x interrupt" ); -if (ret) -return ret; - - ret =gpio_to_irq (pin); - -/* When pin is used as an IRQ, no need to keep it requested */ -gpio_free (pin); - -return ret; -}#endif static const struct acpi_device_id pca953x_acpi_ids[] = {
[email protected]
maintainerPATCH 19/306 can: flexcan: assert FRZ bit in flexcan_chip_freeze()
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Joakim Zhang <[email protected]>
commit 449052cfebf624b670faa040245d3feed770d22f upstream.
Assert HALT bit to enter freeze mode, there is a premise that FRZ bit is asserted. This patch asserts FRZ bit in flexcan_chip_freeze, although the reset value is 1b'1. This is a prepare patch, later patch will invoke flexcan_chip_freeze() to enter freeze mode, which polling freeze mode acknowledge.
--- drivers/net/can/flexcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/flexcan.c +1 -1
@@ -701,7 +701,7 @@ static int flexcan_chip_freeze(struct flu32 reg; reg = priv->read (®s->mcr); - reg |=FLEXCAN_MCR_HALT ; + reg |=FLEXCAN_MCR_FRZ |FLEXCAN_MCR_HALT ; priv->write (reg, ®s->mcr);while (timeout-- && !(priv->read (®s->mcr) &FLEXCAN_MCR_FRZ_ACK ))
[email protected]
maintainerPATCH 20/306 can: flexcan: enable RX FIFO after FRZ/HALT valid
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Joakim Zhang <[email protected]>
commit ec15e27cc8904605846a354bb1f808ea1432f853 upstream.
RX FIFO enable failed could happen when do system reboot stress test:
[ 0.303958] flexcan 5a8d0000.can: 5a8d0000.can supply xceiver not found, using dummy regulator [ 0.304281] flexcan 5a8d0000.can (unnamed net_device) (uninitialized): Could not enable RX FIFO, unsupported core [ 0.314640] flexcan 5a8d0000.can: registering netdev failed [ 0.320728] flexcan 5a8e0000.can: 5a8e0000.can supply xceiver not found, using dummy regulator [ 0.320991] flexcan 5a8e0000.can (unnamed net_device) (uninitialized): Could not enable RX FIFO, unsupported core [ 0.331360] flexcan 5a8e0000.can: registering netdev failed [ 0.337444] flexcan 5a8f0000.can: 5a8f0000.can supply xceiver not found, using dummy regulator [ 0.337716] flexcan 5a8f0000.can (unnamed net_device) (uninitialized): Could not enable RX FIFO, unsupported core [ 0.348117] flexcan 5a8f0000.can: registering netdev failed
RX FIFO should be enabled after the FRZ/HALT are valid. But the current code enable RX FIFO and FRZ/HALT at the same time.
--- drivers/net/can/flexcan.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/can/flexcan.c +7 -3
@@ -1864,10 +1864,14 @@ static int register_flexcandev(struct neif (err) goto out_chip_disable; -/* set freeze, halt and activate FIFO, restrict register access */ +/* set freeze, halt */ + err =flexcan_chip_freeze (priv); +if (err) + goto out_chip_disable; + +/* activate FIFO, restrict register access */ reg = priv->read (®s->mcr); - reg |=FLEXCAN_MCR_FRZ |FLEXCAN_MCR_HALT | -FLEXCAN_MCR_FEN |FLEXCAN_MCR_SUPV ; + reg |=FLEXCAN_MCR_FEN |FLEXCAN_MCR_SUPV ; priv->write (reg, ®s->mcr);/* Currently we only support newer versions of this core
[email protected]
maintainerPATCH 21/306 can: flexcan: invoke flexcan_chip_freeze() to enter freeze mode
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Joakim Zhang <[email protected]>
commit c63820045e2000f05657467a08715c18c9f490d9 upstream.
Invoke flexcan_chip_freeze() to enter freeze mode, since need poll freeze mode acknowledge.
--- drivers/net/can/flexcan.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/can/flexcan.c +7 -5
@@ -1479,10 +1479,13 @@ static int flexcan_chip_start(struct netflexcan_set_bittiming (dev); +/* set freeze, halt */ + err =flexcan_chip_freeze (priv); +if (err) + goto out_chip_disable; +/* MCR * -* enable freeze -* halt now * only supervisor access * enable warning int * enable individual RX masking
@@ -1491,9 +1494,8 @@ static int flexcan_chip_start(struct net*/ reg_mcr = priv->read (®s->mcr); reg_mcr &= ~FLEXCAN_MCR_MAXMB (0xff ); - reg_mcr |=FLEXCAN_MCR_FRZ |FLEXCAN_MCR_HALT |FLEXCAN_MCR_SUPV | -FLEXCAN_MCR_WRN_EN |FLEXCAN_MCR_IRMQ |FLEXCAN_MCR_IDAM_C | -FLEXCAN_MCR_MAXMB (priv->tx_mb_idx); + reg_mcr |=FLEXCAN_MCR_SUPV |FLEXCAN_MCR_WRN_EN |FLEXCAN_MCR_IRMQ | +FLEXCAN_MCR_IDAM_C |FLEXCAN_MCR_MAXMB (priv->tx_mb_idx);/* MCR *
[email protected]
maintainerPATCH 22/306 can: tcan4x5x: tcan4x5x_init(): fix initialization - clear MRAM before entering Normal Mode
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Torin Cooper-Bennun <[email protected]>
commit 2712625200ed69c642b9abc3a403830c4643364c upstream.
This patch prevents a potentially destructive race condition. The device is fully operational on the bus after entering Normal Mode, so zeroing the MRAM after entering this mode may lead to loss of information, e.g. new received messages.
This patch fixes the problem by first initializing the MRAM, then bringing the device into Normale Mode.
--- drivers/net/can/m_can/tcan4x5x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/m_can/tcan4x5x.c +3 -3
@@ -326,14 +326,14 @@ static int tcan4x5x_init(struct m_can_clif (ret)return ret; +/* Zero out the MCAN buffers */ +m_can_init_ram (cdev); + ret =regmap_update_bits (tcan4x5x->regmap,TCAN4X5X_CONFIG ,TCAN4X5X_MODE_SEL_MASK ,TCAN4X5X_MODE_NORMAL );if (ret)return ret; -/* Zero out the MCAN buffers */ -m_can_init_ram (cdev); -return ret; }
[email protected]
maintainerPATCH 23/306 tcp: Fix sign comparison bug in getsockopt(TCP_ZEROCOPY_RECEIVE)
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Arjun Roy <[email protected]>
commit 2107d45f17bedd7dbf4178462da0ac223835a2a7 upstream.
getsockopt(TCP_ZEROCOPY_RECEIVE) has a bug where we read a user-provided "len" field of type signed int, and then compare the value to the result of an "offsetofend" operation, which is unsigned.
Negative values provided by the user will be promoted to large positive numbers; thus checking that len < offsetofend() will return false when the intention was that it return true.
Note that while len is originally checked for negative values earlier on in do_tcp_getsockopt(), subsequent calls to get_user() re-read the value from userspace which may have changed in the meantime.
Therefore, re-add the check for negative values after the call to get_user in the handler code for TCP_ZEROCOPY_RECEIVE.
--- net/ipv4/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/tcp.c +2 -1
@@ -4088,7 +4088,8 @@ static int do_tcp_getsockopt(struct sockif (get_user (len, optlen))return -EFAULT ; - if (len < offsetofend(struct tcp_zerocopy_receive, length)) +if (len <0 || + len < offsetofend(struct tcp_zerocopy_receive, length))return -EINVAL ;if (len >sizeof (zc)) { len =sizeof (zc);
[email protected]
maintainerPATCH 24/306 tcp: add sanity tests to TCP_QUEUE_SEQ
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Eric Dumazet <[email protected]>
commit 8811f4a9836e31c14ecdf79d9f3cb7c5d463265d upstream.
Qingyu Li reported a syzkaller bug where the repro changes RCV SEQ _after_ restoring data in the receive queue.
mprotect(0x4aa000, 12288, PROT_READ) = 0mmap(0x1ffff000, 4096, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x1ffff000mmap(0x20000000, 16777216, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x20000000 mmap(0x21000000, 4096, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x21000000socket(AF_INET6, SOCK_STREAM, IPPROTO_IP) = 3setsockopt(3, SOL_TCP, TCP_REPAIR, [1], 4) = 0
connect(3, {sa_family=AF_INET6, sin6_port=htons(0), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_scope_id=0}, 28) = 0 setsockopt(3, SOL_TCP, TCP_REPAIR_QUEUE, [1], 4) = 0
sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="0x0000000000000003\0\0", iov_len=20}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 20 setsockopt(3, SOL_TCP, TCP_REPAIR, [0], 4) = 0setsockopt(3, SOL_TCP, TCP_QUEUE_SEQ, [128], 4) = 0recvfrom(3, NULL, 20, 0, NULL, NULL) = -1 ECONNRESET (Connection reset by peer)
syslog shows:
[ 111.205099] TCP recvmsg seq # bug 2: copied 80, seq 0, rcvnxt 80, fl 0 [ 111.207894] WARNING: CPU: 1 PID: 356 at net/ipv4/tcp.c:2343 tcp_recvmsg_locked+0x90e/0x29a0
This should not be allowed. TCP_QUEUE_SEQ should only be used when queues are empty.
This patch fixes this case, and the tx path as well.
--- net/ipv4/tcp.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
net/ipv4/tcp.c +15 -8
@@ -3431,16 +3431,23 @@ static int do_tcp_setsockopt(struct sockbreak ;case TCP_QUEUE_SEQ : -if (sk->sk_state !=TCP_CLOSE ) +if (sk->sk_state !=TCP_CLOSE ) { err = -EPERM ; -else if (tp->repair_queue ==TCP_SEND_QUEUE ) -WRITE_ONCE (tp->write_seq, val); -else if (tp->repair_queue ==TCP_RECV_QUEUE ) { -WRITE_ONCE (tp->rcv_nxt, val); -WRITE_ONCE (tp->copied_seq, val); - } -else + }else if (tp->repair_queue ==TCP_SEND_QUEUE ) { +if (!tcp_rtx_queue_empty (sk)) + err = -EPERM ; +else +WRITE_ONCE (tp->write_seq, val); + }else if (tp->repair_queue ==TCP_RECV_QUEUE ) { +if (tp->rcv_nxt != tp->copied_seq) { + err = -EPERM ; + }else { +WRITE_ONCE (tp->rcv_nxt, val); +WRITE_ONCE (tp->copied_seq, val); + } + }else { err = -EINVAL ; + }break ;case TCP_REPAIR_OPTIONS :
[email protected]
maintainerPATCH 25/306 netfilter: nf_nat: undo erroneous tcp edemux lookup
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Florian Westphal <[email protected]>
commit 03a3ca37e4c6478e3a84f04c8429dd5889e107fd upstream.
Under extremely rare conditions TCP early demux will retrieve the wrong socket.
1. local machine establishes a connection to a remote server, S, on port p.
This gives:
laddr:lport -> S:p
... both in tcp and conntrack.
2. local machine establishes a connection to host H, on port p2. 2a. TCP stack choses same laddr:lport, so we have laddr:lport -> H:p2 from TCP point of view.
2b). There is a destination NAT rewrite in place, translating
H:p2 to S:p. This results in following conntrack entries:
I) laddr:lport -> S:p (origin) S:p -> laddr:lport (reply) II) laddr:lport -> H:p2 (origin) S:p -> laddr:lport2 (reply)
NAT engine has rewritten laddr:lport to laddr:lport2 to map the reply packet to the correct origin.
When server sends SYN/ACK to laddr:lport2, the PREROUTING hook will undo-the SNAT transformation, rewriting IP header to S:p -> laddr:lport
This causes TCP early demux to associate the skb with the TCP socket of the first connection.
The INPUT hook will then reverse the DNAT transformation, rewriting the IP header to H:p2 -> laddr:lport.
Because packet ends up with the wrong socket, the new connection never completes: originator stays in SYN_SENT and conntrack entry remains in SYN_RECV until timeout, and responder retransmits SYN/ACK until it gives up.
To resolve this, orphan the skb after the input rewrite:
Because the source IP address changed, the socket must be incorrect. We can't move the DNAT undo to prerouting due to backwards compatibility, doing so will make iptables/nftables rules to no longer match the way they did.
After orphan, the packet will be handed to the next protocol layer (tcp, udp, ...) and that will repeat the socket lookup just like as if early demux was disabled.
--- net/netfilter/nf_nat_proto.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
net/netfilter/nf_nat_proto.c +21 -4
@@ -646,8 +646,8 @@ nf_nat_ipv4_fn(void *priv, struct sk_buf }static unsigned int -nf_nat_ipv4_in (void *priv,struct sk_buff *skb, -const struct nf_hook_state *state) +nf_nat_ipv4_pre_routing (void *priv,struct sk_buff *skb, +const struct nf_hook_state *state) {unsigned int ret;__be32 daddr =ip_hdr (skb)->daddr;
@@ -660,6 +660,23 @@ nf_nat_ipv4_in(void *priv, struct sk_buf }static unsigned int +nf_nat_ipv4_local_in (void *priv,struct sk_buff *skb, +const struct nf_hook_state *state) +{ +__be32 saddr =ip_hdr (skb)->saddr; +struct sock *sk = skb->sk; +unsigned int ret; + + ret =nf_nat_ipv4_fn (priv, skb, state); + +if (ret ==NF_ACCEPT && sk && saddr !=ip_hdr (skb)->saddr && + !inet_sk_transparent (sk)) +skb_orphan (skb);/* TCP edemux obtained wrong socket */ + +return ret; +} + +static unsigned int nf_nat_ipv4_out (void *priv,struct sk_buff *skb,const struct nf_hook_state *state) {
@@ -736,7 +753,7 @@ nf_nat_ipv4_local_fn(void *priv, structstatic const struct nf_hook_ops nf_nat_ipv4_ops[] = {/* Before packet filtering, change destination */ { - .hook = nf_nat_ipv4_in, + .hook = nf_nat_ipv4_pre_routing, .pf =NFPROTO_IPV4 , .hooknum =NF_INET_PRE_ROUTING , .priority =NF_IP_PRI_NAT_DST ,
@@ -757,7 +774,7 @@ static const struct nf_hook_ops nf_nat_i },/* After packet filtering, change source */ { - .hook = nf_nat_ipv4_fn, + .hook = nf_nat_ipv4_local_in, .pf = NFPROTO_IPV4, .hooknum = NF_INET_LOCAL_IN, .priority = NF_IP_PRI_NAT_SRC,
[email protected]
maintainerPATCH 26/306 netfilter: x_tables: gpf inside xt_find_revision()
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vasily Averin <[email protected]>
commit 8e24edddad152b998b37a7f583175137ed2e04a5 upstream.
nested target/match_revfn() calls work with xt[NFPROTO_UNSPEC] lists without taking xt[NFPROTO_UNSPEC].mutex. This can race with module unload and cause host to crash:
general protection fault: 0000 [#1] Modules linked in: ... [last unloaded: xt_cluster] CPU: 0 PID: 542455 Comm: iptables RIP: 0010:[<ffffffff8ffbd518>] [<ffffffff8ffbd518>] strcmp+0x18/0x40 RDX: 0000000000000003 RSI: ffff9a5a5d9abe10 RDI: dead000000000111 R13: ffff9a5a5d9abe10 R14: ffff9a5a5d9abd8c R15: dead000000000100 (VvS: %R15 -- &xt_match, %RDI -- &xt_match.name, xt_cluster unregister match in xt[NFPROTO_UNSPEC].match list) Call Trace: [<ffffffff902ccf44>] match_revfn+0x54/0xc0 [<ffffffff902ccf9f>] match_revfn+0xaf/0xc0 [<ffffffff902cd01e>] xt_find_revision+0x6e/0xf0 [<ffffffffc05a5be0>] do_ipt_get_ctl+0x100/0x420 [ip_tables] [<ffffffff902cc6bf>] nf_getsockopt+0x4f/0x70 [<ffffffff902dd99e>] ip_getsockopt+0xde/0x100 [<ffffffff903039b5>] raw_getsockopt+0x25/0x50 [<ffffffff9026c5da>] sock_common_getsockopt+0x1a/0x20 [<ffffffff9026b89d>] SyS_getsockopt+0x7d/0xf0 [<ffffffff903cbf92>] system_call_fastpath+0x25/0x2a
--- net/netfilter/x_tables.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/netfilter/x_tables.c +4 -2
@@ -330,6 +330,7 @@ static int match_revfn(u8 af, const charconst struct xt_match *m;int have_rev =0 ; +mutex_lock (&xt[af].mutex);list_for_each_entry (m, &xt[af].match, list) {if (strcmp (m->name, name) ==0 ) {if (m->revision > *bestp)
@@ -338,6 +339,7 @@ static int match_revfn(u8 af, const char have_rev =1 ; } } +mutex_unlock (&xt[af].mutex);if (af !=NFPROTO_UNSPEC && !have_rev)return match_revfn (NFPROTO_UNSPEC , name, revision, bestp);
@@ -350,6 +352,7 @@ static int target_revfn(u8 af, const chaconst struct xt_target *t;int have_rev =0 ; +mutex_lock (&xt[af].mutex);list_for_each_entry (t, &xt[af].target, list) {if (strcmp (t->name, name) ==0 ) {if (t->revision > *bestp)
@@ -358,6 +361,7 @@ static int target_revfn(u8 af, const cha have_rev =1 ; } } +mutex_unlock (&xt[af].mutex);if (af !=NFPROTO_UNSPEC && !have_rev)return target_revfn (NFPROTO_UNSPEC , name, revision, bestp);
@@ -371,12 +375,10 @@ int xt_find_revision(u8 af, const char * {int have_rev, best =-1 ; -mutex_lock (&xt[af].mutex);if (target ==1 ) have_rev =target_revfn (af, name, revision, &best);else have_rev =match_revfn (af, name, revision, &best); -mutex_unlock (&xt[af].mutex);/* Nothing at all? Return 0 to try loading module. */ if (best ==-1 ) {
[email protected]
maintainerPATCH 27/306 net: always use icmp{,v6}_ndo_send from ndo_start_xmit
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Jason A. Donenfeld <[email protected]>
commit 4372339efc06bc2a796f4cc9d0a7a929dfda4967 upstream.
There were a few remaining tunnel drivers that didn't receive the prior conversion to icmp{,v6}_ndo_send. Knowing now that this could lead to memory corrution (see ee576c47db60 ("net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending") for details), there's even more imperative to have these all converted. So this commit goes through the remaining cases that I could find and does a boring translation to the ndo variety.
The Fixes: line below is the merge that originally added icmp{,v6}_ ndo_send and converted the first batch of icmp{,v6}_send users. The rationale then for the change applies equally to this patch. It's just that these drivers were left out of the initial conversion because these network devices are hiding in net/ rather than in drivers/net/.
--- net/ipv4/ip_tunnel.c | 5 ++--- net/ipv4/ip_vti.c | 6 +++--- net/ipv6/ip6_gre.c | 16 ++++++++-------- net/ipv6/ip6_tunnel.c | 10 +++++----- net/ipv6/ip6_vti.c | 6 +++--- net/ipv6/sit.c | 2 +- 6 files changed, 22 insertions(+), 23 deletions(-)
net/ipv4/ip_tunnel.c +2 -3
@@ -502,8 +502,7 @@ static int tnl_update_pmtu(struct net_deif (!skb_is_gso (skb) && (inner_iph->frag_off &htons (IP_DF )) && mtu < pkt_size) { -memset (IPCB (skb),0 ,sizeof (*IPCB (skb))); -icmp_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED ,htonl (mtu)); +icmp_ndo_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED ,htonl (mtu));return -E2BIG ; } }
@@ -527,7 +526,7 @@ static int tnl_update_pmtu(struct net_deif (!skb_is_gso (skb) && mtu >=IPV6_MIN_MTU && mtu < pkt_size) { -icmpv6_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); +icmpv6_ndo_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu);return -E2BIG ; } }
net/ipv4/ip_vti.c +3 -3
@@ -238,13 +238,13 @@ static netdev_tx_t vti_xmit(struct sk_buif (skb->len > mtu) {skb_dst_update_pmtu_no_confirm (skb, mtu);if (skb->protocol ==htons (ETH_P_IP )) { -icmp_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED , -htonl (mtu)); +icmp_ndo_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED , +htonl (mtu)); }else {if (mtu <IPV6_MIN_MTU ) mtu =IPV6_MIN_MTU ; -icmpv6_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); +icmpv6_ndo_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); }dst_release (dst);
net/ipv6/ip6_gre.c +8 -8
@@ -678,8 +678,8 @@ static int prepare_ip6gre_xmit_ipv6(stru tel = (struct ipv6_tlv_tnl_enc_lim *)&skb_network_header (skb)[offset];if (tel->encap_limit ==0 ) { -icmpv6_send (skb,ICMPV6_PARAMPROB , -ICMPV6_HDR_FIELD , offset +2 ); +icmpv6_ndo_send (skb,ICMPV6_PARAMPROB , +ICMPV6_HDR_FIELD , offset +2 );return -1 ; } *encap_limit = tel->encap_limit -1 ;
@@ -805,8 +805,8 @@ static inline int ip6gre_xmit_ipv4(strucif (err !=0 ) {/* XXX: send ICMP error even if DF is not set. */ if (err == -EMSGSIZE ) -icmp_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED , -htonl (mtu)); +icmp_ndo_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED , +htonl (mtu));return -1 ; }
@@ -837,7 +837,7 @@ static inline int ip6gre_xmit_ipv6(struc &mtu, skb->protocol);if (err !=0 ) {if (err == -EMSGSIZE ) -icmpv6_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); +icmpv6_ndo_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu);return -1 ; }
@@ -1063,10 +1063,10 @@ static netdev_tx_t ip6erspan_tunnel_xmit/* XXX: send ICMP error even if DF is not set. */ if (err == -EMSGSIZE ) {if (skb->protocol ==htons (ETH_P_IP )) -icmp_send (skb,ICMP_DEST_UNREACH , -ICMP_FRAG_NEEDED ,htonl (mtu)); +icmp_ndo_send (skb,ICMP_DEST_UNREACH , +ICMP_FRAG_NEEDED ,htonl (mtu));else -icmpv6_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); +icmpv6_ndo_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); } goto tx_err;
net/ipv6/ip6_tunnel.c +5 -5
@@ -1332,8 +1332,8 @@ ipxip6_tnl_xmit(struct sk_buff *skb, str tel = (void *)&skb_network_header (skb)[offset];if (tel->encap_limit ==0 ) { -icmpv6_send (skb,ICMPV6_PARAMPROB , -ICMPV6_HDR_FIELD , offset +2 ); +icmpv6_ndo_send (skb,ICMPV6_PARAMPROB , +ICMPV6_HDR_FIELD , offset +2 );return -1 ; } encap_limit = tel->encap_limit -1 ;
@@ -1385,11 +1385,11 @@ ipxip6_tnl_xmit(struct sk_buff *skb, strif (err == -EMSGSIZE )switch (protocol) {case IPPROTO_IPIP : -icmp_send (skb,ICMP_DEST_UNREACH , -ICMP_FRAG_NEEDED ,htonl (mtu)); +icmp_ndo_send (skb,ICMP_DEST_UNREACH , +ICMP_FRAG_NEEDED ,htonl (mtu));break ;case IPPROTO_IPV6 : -icmpv6_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); +icmpv6_ndo_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu);break ;default :break ;
net/ipv6/ip6_vti.c +3 -3
@@ -521,10 +521,10 @@ vti6_xmit(struct sk_buff *skb, struct neif (mtu <IPV6_MIN_MTU ) mtu =IPV6_MIN_MTU ; -icmpv6_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); +icmpv6_ndo_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); }else { -icmp_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED , -htonl (mtu)); +icmp_ndo_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED , +htonl (mtu)); } err = -EMSGSIZE ;
net/ipv6/sit.c +1 -1
@@ -987,7 +987,7 @@ static netdev_tx_t ipip6_tunnel_xmit(strskb_dst_update_pmtu_no_confirm (skb, mtu);if (skb->len > mtu && !skb_is_gso (skb)) { -icmpv6_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); +icmpv6_ndo_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu);ip_rt_put (rt); goto tx_error; }
[email protected]
maintainerPATCH 28/306 net: phy: fix save wrong speed and duplex problem if autoneg is on
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Guangbin Huang <[email protected]>
commit d9032dba5a2b2bbf0fdce67c8795300ec9923b43 upstream.
If phy uses generic driver and autoneg is on, enter command "ethtool -s eth0 speed 50" will not change phy speed actually, but command "ethtool eth0" shows speed is 50Mb/s because phydev->speed has been set to 50 and no update later.
And duplex setting has same problem too.
However, if autoneg is on, phy only changes speed and duplex according to phydev->advertising, but not phydev->speed and phydev->duplex. So in this case, phydev->speed and phydev->duplex don't need to be set in function phy_ethtool_ksettings_set() if autoneg is on.
--- drivers/net/phy/phy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/phy/phy.c +4 -2
@@ -276,14 +276,16 @@ int phy_ethtool_ksettings_set(struct phy phydev->autoneg = autoneg; - phydev->speed = speed; +if (autoneg ==AUTONEG_DISABLE ) { + phydev->speed = speed; + phydev->duplex = duplex; + }linkmode_copy (phydev->advertising, advertising);linkmode_mod_bit (ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->advertising, autoneg ==AUTONEG_ENABLE ); - phydev->duplex = duplex; phydev->master_slave_set = cmd->base.master_slave_cfg; phydev->mdix_ctrl = cmd->base.eth_tp_mdix_ctrl;
[email protected]
maintainerPATCH 29/306 selftests/bpf: Use the last page in test_snprintf_btf on s390
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Ilya Leoshkevich <[email protected]>
commit 42a382a466a967dc053c73b969cd2ac2fec502cf upstream.
test_snprintf_btf fails on s390, because NULL points to a readable struct lowcore there. Fix by using the last page instead.
Error message example:
printing fffffffffffff000 should generate error, got (361)
--- tools/testing/selftests/bpf/progs/netif_receive_skb.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/progs/netif_receive_skb.c +10 -3
@@ -16,6 +16,13 @@ bool skip = false;#define STRSIZE 2048#define EXPECTED_STRSIZE 256 +#if defined(bpf_target_s390) +/* NULL points to a readable struct lowcore on s390, so take the last page */ +#define BADPTR ((void *)0xFFFFFFFFFFFFF000ULL) +#else +#define BADPTR 0 +#endif +#ifndef ARRAY_SIZE #define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))#endif
@@ -113,11 +120,11 @@ int BPF_PROG(trace_netif_receive_skb, st }/* Check invalid ptr value */ - p.ptr =0 ; + p.ptr =BADPTR ; __ret =bpf_snprintf_btf (str,STRSIZE , &p,sizeof (p),0 );if (__ret >=0 ) { -bpf_printk ("printing NULL should generate error, got (%d)" , - __ret); +bpf_printk ("printing %llx should generate error, got (%d)" , + (unsigned long long )BADPTR , __ret); ret = -ERANGE ; }
[email protected]
maintainerPATCH 30/306 selftests/bpf: No need to drop the packet when there is no geneve opt
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Hangbin Liu <[email protected]>
commit 557c223b643a35effec9654958d8edc62fd2603a upstream.
In bpf geneve tunnel test we set geneve option on tx side. On rx side we only call bpf_skb_get_tunnel_opt(). Since commit 9c2e14b48119 ("ip_tunnels:
Set tunnel option flag when tunnel metadata is present") geneve_rx() will not add TUNNEL_GENEVE_OPT flag if there is no geneve option, which cause bpf_skb_get_tunnel_opt() return ENOENT and _geneve_get_tunnel() in test_tunnel_kern.c drop the packet.
As it should be valid that bpf_skb_get_tunnel_opt() return error when there is not tunnel option, there is no need to drop the packet and break all geneve rx traffic. Just set opt_class to 0 in this test and keep returning TC_ACT_OK.
--- tools/testing/selftests/bpf/progs/test_tunnel_kern.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/progs/test_tunnel_kern.c +2 -4
@@ -446,10 +446,8 @@ int _geneve_get_tunnel(struct __sk_buff } ret =bpf_skb_get_tunnel_opt (skb, &gopt,sizeof (gopt)); -if (ret <0 ) { -ERROR (ret); -return TC_ACT_SHOT ; - } +if (ret <0 ) + gopt.opt_class =0 ;bpf_trace_printk (fmt,sizeof (fmt), key.tunnel_id, key.remote_ipv4, gopt.opt_class);
[email protected]
maintainerPATCH 31/306 selftests/bpf: Mask bpf_csum_diff() return value to 16 bits in test_verifier
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Yauheni Kaliuta <[email protected]>
commit 6185266c5a853bb0f2a459e3ff594546f277609b upstream.
The verifier test labelled "valid read map access into a read-only array 2" calls the bpf_csum_diff() helper and checks its return value. However, architecture implementations of csum_partial() (which is what the helper uses) differ in whether they fold the return value to 16 bit or not. For example, x86 version has ...
if (unlikely(odd)) {
result = from32to16(result);
result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
}... while generic lib/checksum.c does:
result = from32to16(result); if (odd) result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
This makes the helper return different values on different architectures, breaking the test on non-x86. To fix this, add an additional instruction to always mask the return value to 16 bits, and update the expected return value accordingly.
--- tools/testing/selftests/bpf/verifier/array_access.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/verifier/array_access.c +2 -1
@@ -250,12 +250,13 @@BPF_MOV64_IMM (BPF_REG_5 ,0 ),BPF_RAW_INSN (BPF_JMP |BPF_CALL ,0 ,0 ,0 , BPF_FUNC_csum_diff), +BPF_ALU64_IMM (BPF_AND ,BPF_REG_0 ,0xffff ), BPF_EXIT_INSN(), }, .prog_type =BPF_PROG_TYPE_SCHED_CLS , .fixup_map_array_ro = { 3 }, .result = ACCEPT, - .retval = -29, + .retval = 65507, }, { "invalid write map access into a read-only array 1",
[email protected]
maintainerPATCH 32/306 samples, bpf: Add missing munmap in xdpsock
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Maciej Fijalkowski <[email protected]>
commit 6bc6699881012b5bd5d49fa861a69a37fc01b49c upstream.
We mmap the umem region, but we never munmap it.
Add the missing call at the end of the cleanup.
--- samples/bpf/xdpsock_user.c | 2 ++ 1 file changed, 2 insertions(+)
samples/bpf/xdpsock_user.c +2 -0
@@ -1699,5 +1699,7 @@ int main(int argc, char **argv)xdpsock_cleanup (); +munmap (bufs,NUM_FRAMES * opt_xsk_frame_size); +return 0 ; }
[email protected]
maintainerPATCH 33/306 libbpf: Clear map_info before each bpf_obj_get_info_by_fd
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Maciej Fijalkowski <[email protected]>
commit 2b2aedabc44e9660f90ccf7ba1ca2706d75f411f upstream.
xsk_lookup_bpf_maps, based on prog_fd, looks whether current prog has a reference to XSKMAP. BPF prog can include insns that work on various BPF maps and this is covered by iterating through map_ids.
The bpf_map_info that is passed to bpf_obj_get_info_by_fd for filling needs to be cleared at each iteration, so that it doesn't contain any outdated fields and that is currently missing in the function of interest.
To fix that, zero-init map_info via memset before each bpf_obj_get_info_by_fd call.
Also, since the area of this code is touched, in general strcmp is considered harmful, so let's convert it to strncmp and provide the size of the array name for current map_info.
While at it, do s/continue/break/ once we have found the xsks_map to terminate the search.
--- tools/lib/bpf/xsk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/lib/bpf/xsk.c +3 -2
@@ -535,15 +535,16 @@ static int xsk_lookup_bpf_maps(struct xsif (fd <0 )continue ; +memset (&map_info,0 , map_len); err =bpf_obj_get_info_by_fd (fd, &map_info, &map_len);if (err) {close (fd);continue ; } -if (!strcmp (map_info.name,"xsks_map" )) { +if (!strncmp (map_info.name,"xsks_map" ,sizeof (map_info.name))) { ctx->xsks_map_fd = fd; -continue ; +break ; }close (fd);
[email protected]
maintainerPATCH 34/306 ibmvnic: Fix possibly uninitialized old_num_tx_queues variable warning.
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Michal Suchanek <[email protected]>
commit 6881b07fdd24850def1f03761c66042b983ff86e upstream.
GCC 7.5 reports:../drivers/net/ethernet/ibm/ibmvnic.c: In function 'ibmvnic_reset_init':../drivers/net/ethernet/ibm/ibmvnic.c:5373:51: warning: 'old_num_tx_queues' may be used uninitialized in this function [-Wmaybe-uninitialized] ../drivers/net/ethernet/ibm/ibmvnic.c:5373:6: warning: 'old_num_rx_queues' may be used uninitialized in this function [-Wmaybe-uninitialized]
The variable is initialized only if(reset) and used only if(reset && something) so this is a false positive. However, there is no reason to not initialize the variables unconditionally avoiding the warning.
--- drivers/net/ethernet/ibm/ibmvnic.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +3 -5
@@ -5283,16 +5283,14 @@ static int ibmvnic_reset_init(struct ibm {struct device *dev = &adapter->vdev->dev;unsigned long timeout =msecs_to_jiffies (20000 ); -u64 old_num_rx_queues, old_num_tx_queues; +u64 old_num_rx_queues = adapter->req_rx_queues; +u64 old_num_tx_queues = adapter->req_tx_queues;int rc; adapter->from_passive_init = false; -if (reset) { - old_num_rx_queues = adapter->req_rx_queues; - old_num_tx_queues = adapter->req_tx_queues; +if (reset)reinit_completion (&adapter->init_done); - } adapter->init_done_rc =0 ; rc =ibmvnic_send_crq_init (adapter);
[email protected]
maintainerPATCH 35/306 ibmvnic: always store valid MAC address
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Jiri Wiesner <[email protected]>
commit 67eb211487f0c993d9f402d1c196ef159fd6a3b5 upstream.
The last change to ibmvnic_set_mac(), 8fc3672a8ad3, meant to prevent users from setting an invalid MAC address on an ibmvnic interface that has not been brought up yet. The change also prevented the requested MAC address from being stored by the adapter object for an ibmvnic interface when the state of the ibmvnic interface is VNIC_PROBED - that is after probing has finished but before the ibmvnic interface is brought up. The MAC address stored by the adapter object is used and sent to the hypervisor for checking when an ibmvnic interface is brought up.
The ibmvnic driver ignoring the requested MAC address when in VNIC_PROBED state caused LACP bonds (bonds in 802.3ad mode) with more than one slave to malfunction. The bonding code must be able to change the MAC address of its slaves before they are brought up during enslaving. The inability of kernels with 8fc3672a8ad3 to set the MAC addresses of bonding slaves is observable in the output of "ip address show". The MAC addresses of the slaves are the same as the MAC address of the bond on a working system whereas the slaves retain their original MAC addresses on a system with a malfunctioning LACP bond.
--- drivers/net/ethernet/ibm/ibmvnic.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +2 -3
@@ -1923,10 +1923,9 @@ static int ibmvnic_set_mac(struct net_deif (!is_valid_ether_addr (addr->sa_data))return -EADDRNOTAVAIL ; -if (adapter->state !=VNIC_PROBED ) { -ether_addr_copy (adapter->mac_addr, addr->sa_data); +ether_addr_copy (adapter->mac_addr, addr->sa_data); +if (adapter->state !=VNIC_PROBED ) rc =__ibmvnic_set_mac (netdev, addr->sa_data); - }return rc; }
[email protected]
maintainerPATCH 36/306 ibmvnic: remove excessive irqsave
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Junlin Yang <[email protected]>
commit 69cdb7947adb816fc9325b4ec02a6dddd5070b82 upstream.
ibmvnic_remove locks multiple spinlocks while disabling interrupts:spin_lock_irqsave(&adapter->state_lock, flags); spin_lock_irqsave(&adapter->rwi_lock, flags);
As reported by coccinelle, the second _irqsave() overwrites the value
saved in 'flags' by the first _irqsave(), therefore when the second_irqrestore() comes,the value in 'flags' is not valid,the value saved by the first _irqsave() has been lost.
This likely leads to IRQs remaining disabled. So remove the second _irqsave():spin_lock_irqsave(&adapter->state_lock, flags); spin_lock(&adapter->rwi_lock);
Generated by: ./scripts/coccinelle/locks/flags.cocci ./drivers/net/ethernet/ibm/ibmvnic.c:5413:1-18:
ERROR: nested lock+irqsave that reuses flags from line 5404.
--- drivers/net/ethernet/ibm/ibmvnic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +2 -2
@@ -5474,9 +5474,9 @@ static int ibmvnic_remove(struct vio_dev* after setting state, so __ibmvnic_reset() which is called * from the flush_work() below, can make progress. */ -spin_lock_irqsave (&adapter->rwi_lock, flags); +spin_lock (&adapter->rwi_lock); adapter->state =VNIC_REMOVING ; -spin_unlock_irqrestore (&adapter->rwi_lock, flags); +spin_unlock (&adapter->rwi_lock);spin_unlock_irqrestore (&adapter->state_lock, flags);
[email protected]
maintainerPATCH 37/306 mt76: dma: do not report truncated frames to mac80211
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Lorenzo Bianconi <[email protected]>
commit d0bd52c591a1070c54dc428e926660eb4f981099 upstream.
Commit b102f0c522cf6 ("mt76: fix array overflow on receiving too many fragments for a packet") fixes a possible OOB access but it introduces a memory leak since the pending frame is not released to page_frag_cache if the frag array of skb_shared_info is full. Commit 93a1d4791c10 ("mt76: dma: fix a possible memory leak in mt76_add_fragment()") fixes the issue but does not free the truncated skb that is forwarded to mac80211 layer. Fix the leftover issue discarding even truncated skbs.
--- drivers/net/wireless/mediatek/mt76/dma.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/dma.c +7 -4
@@ -511,13 +511,13 @@ mt76_add_fragment(struct mt76_dev *dev, {struct sk_buff *skb = q->rx_head;struct skb_shared_info *shinfo =skb_shinfo (skb); +int nr_frags = shinfo->nr_frags; -if (shinfo->nr_frags <ARRAY_SIZE (shinfo->frags)) { +if (nr_frags <ARRAY_SIZE (shinfo->frags)) {struct page *page =virt_to_head_page (data);int offset = data -page_address (page) + q->buf_offset; -skb_add_rx_frag (skb, shinfo->nr_frags, page, offset, len, - q->buf_size); +skb_add_rx_frag (skb, nr_frags, page, offset, len, q->buf_size); }else {skb_free_frag (data); }
@@ -526,7 +526,10 @@ mt76_add_fragment(struct mt76_dev *dev,return ; q->rx_head =NULL ; - dev->drv->rx_skb (dev, q - dev->q_rx, skb); +if (nr_frags <ARRAY_SIZE (shinfo->frags)) + dev->drv->rx_skb (dev, q - dev->q_rx, skb); +else +dev_kfree_skb (skb); } static int
[email protected]
maintainerPATCH 38/306 gpio: fix gpio-device list corruption
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Johan Hovold <[email protected]>
commit cf25ef6b631c6fc6c0435fc91eba8734cca20511 upstream.
Make sure to hold the gpio_lock when removing the gpio device from the gpio_devices list (when dropping the last reference) to avoid corrupting the list when there are concurrent accesses.
--- drivers/gpio/gpiolib.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpio/gpiolib.c +4 -0
@@ -469,8 +469,12 @@ EXPORT_SYMBOL_GPL(gpiochip_line_is_validstatic void gpiodevice_release (struct device *dev) {struct gpio_device *gdev =dev_get_drvdata (dev); +unsigned long flags; +spin_lock_irqsave (&gpio_lock, flags);list_del (&gdev->list); +spin_unlock_irqrestore (&gpio_lock, flags); +ida_free (&gpio_ida, gdev->id);kfree_const (gdev->label);kfree (gdev->descs);
[email protected]
maintainerPATCH 39/306 mount: fix mounting of detached mounts onto targets that reside on shared mounts
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Christian Brauner <[email protected]>
commit ee2e3f50629f17b0752b55b2566c15ce8dafb557 upstream.
Creating a series of detached mounts, attaching them to the filesystem, and unmounting them can be used to trigger an integer overflow in ns->mounts causing the kernel to block any new mounts in count_mounts() and returning ENOSPC because it falsely assumes that the maximum number of mounts in the mount namespace has been reached, i.e. it thinks it can't fit the new mounts into the mount namespace anymore.
Depending on the number of mounts in your system, this can be reproduced on any kernel that supportes open_tree() and move_mount() by compiling and running the following program:
/* SPDX-License-Identifier: LGPL-2.1+ */
#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
/* open_tree() */
#ifndef OPEN_TREE_CLONE
#define OPEN_TREE_CLONE 1
#endif
#ifndef OPEN_TREE_CLOEXEC
#define OPEN_TREE_CLOEXEC O_CLOEXEC
#endif
#ifndef __NR_open_tree
#if defined __alpha__
#define __NR_open_tree 538
#elif defined _MIPS_SIM
#if _MIPS_SIM == _MIPS_SIM_ABI32 /* o32 */
#define __NR_open_tree 4428
#endif
#if _MIPS_SIM == _MIPS_SIM_NABI32 /* n32 */
#define __NR_open_tree 6428
#endif
#if _MIPS_SIM == _MIPS_SIM_ABI64 /* n64 */
#define __NR_open_tree 5428
#endif
#elif defined __ia64__
#define __NR_open_tree (428 + 1024)
#else
#define __NR_open_tree 428
#endif
#endif
/* move_mount() */
#ifndef MOVE_MOUNT_F_EMPTY_PATH
#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
#endif
#ifndef __NR_move_mount
#if defined __alpha__
#define __NR_move_mount 539
#elif defined _MIPS_SIM
#if _MIPS_SIM == _MIPS_SIM_ABI32 /* o32 */
#define __NR_move_mount 4429
#endif
#if _MIPS_SIM == _MIPS_SIM_NABI32 /* n32 */
#define __NR_move_mount 6429
#endif
#if _MIPS_SIM == _MIPS_SIM_ABI64 /* n64 */
#define __NR_move_mount 5429
#endif
#elif defined __ia64__
#define __NR_move_mount (428 + 1024)
#else
#define __NR_move_mount 429
#endif
#endif
static inline int sys_open_tree(int dfd, const char *filename, unsigned int flags)
{
return syscall(__NR_open_tree, dfd, filename, flags);
}
static inline int sys_move_mount(int from_dfd, const char *from_pathname, int to_dfd,
const char *to_pathname, unsigned int flags)
{
return syscall(__NR_move_mount, from_dfd, from_pathname, to_dfd, to_pathname, flags);
}
static bool is_shared_mountpoint(const char *path)
{
bool shared = false;
FILE *f = NULL;
char *line = NULL;
int i;
size_t len = 0; f = fopen("/proc/self/mountinfo", "re");
if (!f)
return 0;
while (getline(&line, &len, f) > 0) {
char *slider1, *slider2;
for (slider1 = line, i = 0; slider1 && i < 4; i++)
slider1 = strchr(slider1 + 1, ' ');
if (!slider1)
continue;
slider2 = strchr(slider1 + 1, ' ');
if (!slider2)
continue;
*slider2 = '\0';
if (strcmp(slider1 + 1, path) == 0) {
/* This is the path. Is it shared? */
slider1 = strchr(slider2 + 1, ' ');
if (slider1 && strstr(slider1, "shared:")) {
shared = true;
break;
}
}
}
fclose(f);
free(line);
return shared;}
static void usage(void)
{
const char *text = "mount-new [--recursive] <base-dir>\n";
fprintf(stderr, "%s", text);
_exit(EXIT_SUCCESS);
}
#define exit_usage(format, ...) \
({ \
fprintf(stderr, format "\n", ##__VA_ARGS__); \
usage(); \
})
#define exit_log(format, ...) \
({ \
fprintf(stderr, format "\n", ##__VA_ARGS__); \
exit(EXIT_FAILURE); \
})static const struct option longopts[] = {
{"help", no_argument, 0, 'a'},
{ NULL, no_argument, 0, 0 },};
int main(int argc, char *argv[])
{
int exit_code = EXIT_SUCCESS, index = 0;
int dfd, fd_tree, new_argc, ret;
char *base_dir;
char *const *new_argv;
char target[PATH_MAX]; while ((ret = getopt_long_only(argc, argv, "", longopts, &index)) != -1) {
switch (ret) {
case 'a':
/* fallthrough */
default:
usage();
}
}
new_argv = &argv[optind];
new_argc = argc - optind;
if (new_argc < 1)
exit_usage("Missing base directory\n");
base_dir = new_argv[0];
if (*base_dir != '/')
exit_log("Please specify an absolute path");
/* Ensure that target is a shared mountpoint. */
if (!is_shared_mountpoint(base_dir))
exit_log("Please ensure that \"%s\" is a shared mountpoint", base_dir);
dfd = open(base_dir, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
if (dfd < 0)
exit_log("%m - Failed to open base directory \"%s\"", base_dir);
ret = mkdirat(dfd, "detached-move-mount", 0755);
if (ret < 0)
exit_log("%m - Failed to create required temporary directories");
ret = snprintf(target, sizeof(target), "%s/detached-move-mount", base_dir);
if (ret < 0 || (size_t)ret >= sizeof(target))
exit_log("%m - Failed to assemble target path");
/*
* Having a mount table with 10000 mounts is already quite excessive
* and shoult account even for weird test systems.
*/
for (size_t i = 0; i < 10000; i++) {
fd_tree = sys_open_tree(dfd, "detached-move-mount",
OPEN_TREE_CLONE |
OPEN_TREE_CLOEXEC |
AT_EMPTY_PATH);
if (fd_tree < 0) {
fprintf(stderr, "%m - Failed to open %d(detached-move-mount)", dfd);
exit_code = EXIT_FAILURE;
break;
}
ret = sys_move_mount(fd_tree, "", dfd, "detached-move-mount", MOVE_MOUNT_F_EMPTY_PATH);
if (ret < 0) {
if (errno == ENOSPC)
fprintf(stderr, "%m - Buggy mount counting");
else
fprintf(stderr, "%m - Failed to attach mount to %d(detached-move-mount)", dfd);
exit_code = EXIT_FAILURE;
break;
}
close(fd_tree);
ret = umount2(target, MNT_DETACH);
if (ret < 0) {
fprintf(stderr, "%m - Failed to unmount %s", target);
exit_code = EXIT_FAILURE;
break;
}
}
(void)unlinkat(dfd, "detached-move-mount", AT_REMOVEDIR);
close(dfd);
exit(exit_code);}
and wait for the kernel to refuse any new mounts by returning ENOSPC. How many iterations are needed depends on the number of mounts in your system. Assuming you have something like 50 mounts on a standard system it should be almost instantaneous.
The root cause of this is that detached mounts aren't handled correctly when source and target mount are identical and reside on a shared mount causing a broken mount tree where the detached source itself is propagated which propagation prevents for regular bind-mounts and new mounts. This ultimately leads to a miscalculation of the number of mounts in the mount namespace.
Detached mounts created viaopen_tree(fd, path, OPEN_TREE_CLONE)
are essentially like an unattached new mount, or an unattached bind-mount. They can then later on be attached to the filesystem via move_mount() which calls into attach_recursive_mount(). Part of attaching it to the filesystem is making sure that mounts get correctly propagated in case the destination mountpoint is MS_SHARED, i.e. is a shared mountpoint. This is done by calling into propagate_mnt() which walks the list of peers calling propagate_one() on each mount in this list making sure it receives the propagation event.
The propagate_one() functions thereby skips both new mounts and bind mounts to not propagate them "into themselves". Both are identified by checking whether the mount is already attached to any mount namespace in mnt->mnt_ns. The is what the IS_MNT_NEW() helper is responsible for.
However, detached mounts have an anonymous mount namespace attached to them stashed in mnt->mnt_ns which means that IS_MNT_NEW() doesn't realize they need to be skipped causing the mount to propagate "into itself" breaking the mount table and causing a disconnect between the number of mounts recorded as being beneath or reachable from the target mountpoint and the number of mounts actually recorded/counted in ns->mounts ultimately causing an overflow which in turn prevents any new mounts via the ENOSPC issue.
So teach propagation to handle detached mounts by making it aware of them. I've been tracking this issue down for the last couple of days and then verifying that the fix is correct by
unmounting everything in my current mount table leaving only /proc and /sys mounted and running the reproducer above overnight verifying the number of mounts counted in ns->mounts. With this fix the counts are correct and the ENOSPC issue can't be reproduced.
This change will only have an effect on mounts created with the new mount API since detached mounts cannot be created with the old mount API so regressions are extremely unlikely.
--- fs/pnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/pnode.h +1 -1
@@ -12,7 +12,7 @@#define IS_MNT_SHARED (m) ((m)->mnt.mnt_flags & MNT_SHARED)#define IS_MNT_SLAVE (m) ((m)->mnt_master) -#define IS_MNT_NEW (m) (!(m)->mnt_ns) +#define IS_MNT_NEW (m) (!(m)->mnt_ns || is_anon_ns((m)->mnt_ns))#define CLEAR_MNT_SHARED (m) ((m)->mnt.mnt_flags &= ~MNT_SHARED)#define IS_MNT_UNBINDABLE (m) ((m)->mnt.mnt_flags & MNT_UNBINDABLE)#define IS_MNT_MARKED (m) ((m)->mnt.mnt_flags & MNT_MARKED)
[email protected]
maintainerPATCH 40/306 cifs: fix credit accounting for extra channel
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Aurelien Aptel <[email protected]>
commit a249cc8bc2e2fed680047d326eb9a50756724198 upstream.
With multichannel, operations like the queries from "ls -lR" can cause all credits to be used and errors to be returned since max_credits was not being set correctly on the secondary channels and thus the client was requesting 0 credits incorrectly in some cases (which can lead to not having enough credits to perform any operation on that channel).
--- fs/cifs/connect.c | 10 +++++----- fs/cifs/sess.c | 1 + 2 files changed, 6 insertions(+), 5 deletions(-)
fs/cifs/connect.c +5 -5
@@ -1405,6 +1405,11 @@ smbd_connected: tcp_ses->min_offload = ctx->min_offload; tcp_ses->tcpStatus = CifsNeedNegotiate; +if ((ctx->max_credits <20 ) || (ctx->max_credits >60000 )) + tcp_ses->max_credits =SMB2_MAX_CREDITS_AVAILABLE ; +else + tcp_ses->max_credits = ctx->max_credits; + tcp_ses->nr_targets =1 ; tcp_ses->ignore_signature = ctx->ignore_signature;/* thread spawned, put it on the list */
@@ -2806,11 +2811,6 @@ static int mount_get_conns(struct smb3_f *nserver = server; -if ((ctx->max_credits <20 ) || (ctx->max_credits >60000 )) - server->max_credits =SMB2_MAX_CREDITS_AVAILABLE ; -else - server->max_credits = ctx->max_credits; -/* get a reference to a SMB session */ ses =cifs_get_smb_ses (server, ctx);if (IS_ERR (ses)) {
fs/cifs/sess.c +1 -0
@@ -230,6 +230,7 @@ cifs_ses_add_channel(struct cifs_sb_info ctx.noautotune = ses->server->noautotune; ctx.sockopt_tcp_nodelay = ses->server->tcp_nodelay; ctx.echo_interval = ses->server->echo_interval /HZ ; + ctx.max_credits = ses->server->max_credits;/* * This will be used for encoding/decoding user/domain/pw
[email protected]
maintainerPATCH 41/306 cifs: return proper error code in statfs(2)
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Paulo Alcantara <[email protected]>
commit 14302ee3301b3a77b331cc14efb95bf7184c73cc upstream.
In cifs_statfs(), if server->ops->queryfs is not NULL, then we should use its return value rather than always returning 0. Instead, use rc variable as it is properly set to 0 in case there is no server->ops->queryfs.
--- fs/cifs/cifsfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifsfs.c +1 -1
@@ -290,7 +290,7 @@ cifs_statfs(struct dentry *dentry, struc rc = server->ops->queryfs (xid, tcon, cifs_sb, buf);free_xid (xid); -return 0 ; +return rc; }static long cifs_fallocate (struct file *file,int mode,loff_t off,loff_t len)
[email protected]
maintainerPATCH 42/306 Revert "mm, slub: consider rest of partial list if acquire_slab() fails"
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Linus Torvalds <[email protected]>
commit 9b1ea29bc0d7b94d420f96a0f4121403efc3dd85 upstream.
This reverts commit 8ff60eb052eeba95cfb3efe16b08c9199f8121cf.
The kernel test robot reports a huge performance regression due to the commit, and the reason seems fairly straightforward: when there is contention on the page list (which is what causes acquire_slab() to fail), we do _not_ want to just loop and try again, because that will transfer the contention to the 'n->list_lock' spinlock we hold, and just make things even worse.
This is admittedly likely a problem only on big machines - the kernel test robot report comes from a 96-thread dual socket Intel Xeon Gold 6252 setup, but the regression there really is quite noticeable:
-47.9% regression of stress-ng.rawpkt.ops_per_sec
and the commit that was marked as being fixed (7ced37197196: "slub:Acquire_slab() avoid loop") actually did the loop exit early very intentionally (the hint being that "avoid loop" part of that commit message), exactly to avoid this issue.
The correct thing to do may be to pick some kind of reasonable middle
ground: instead of breaking out of the loop on the very first sign of contention, or trying over and over and over again, the right thing may be to re-try _once_, and then give up on the second failure (or pick your favorite value for "once"..).
--- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/slub.c +1 -1
@@ -1973,7 +1973,7 @@ static void *get_partial_node(struct kme t =acquire_slab (s, n, page, object ==NULL , &objects);if (!t) -continue ;/* cmpxchg raced */ +break ; available += objects;if (!object) {
[email protected]
maintainerPATCH 43/306 docs: networking: drop special stable handling
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Jakub Kicinski <[email protected]>
commit dbbe7c962c3a8163bf724dbc3c9fdfc9b16d3117 upstream.
Leave it to Greg.
--- Documentation/networking/netdev-FAQ.rst | 72 ++------------------------ Documentation/process/stable-kernel-rules.rst | 6 -- Documentation/process/submitting-patches.rst | 5 - 3 files changed, 6 insertions(+), 77 deletions(-)
Documentation/networking/netdev-FAQ.rst +6 -66
@@ -142,73 +142,13 @@ Please send incremental versions on top the patches the way they would look like if your latest patch series was to be merged. -How can I tell what patches are queued up for backporting to the various stable releases? ------------------------------------------------------------------------------------------ -Normally Greg Kroah-Hartman collects stable commits himself, but for -networking, Dave collects up patches he deems critical for the -networking subsystem, and then hands them off to Greg. - -There is a patchworks queue that you can see here: - - https://patchwork.kernel.org/bundle/netdev/stable/?state=* - -It contains the patches which Dave has selected, but not yet handed off -to Greg. If Greg already has the patch, then it will be here: - - https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git - -A quick way to find whether the patch is in this stable-queue is to -simply clone the repo, and then git grep the mainline commit ID, e.g. -:: - - stable-queue$ git grep -l 284041ef21fdf2e - releases/3.0.84/ipv6-fix-possible-crashes-in-ip6_cork_release.patch - releases/3.4.51/ipv6-fix-possible-crashes-in-ip6_cork_release.patch - releases/3.9.8/ipv6-fix-possible-crashes-in-ip6_cork_release.patch - stable/stable-queue$ - -I see a network patch and I think it should be backported to stable. Should I request it via [email protected] like the references in the kernel's Documentation/process/stable-kernel-rules.rst file say? ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -No, not for networking. Check the stable queues as per above first -to see if it is already queued. If not, then send a mail to netdev, -listing the upstream commit ID and why you think it should be a stable -candidate. - -Before you jump to go do the above, do note that the normal stable rules -in :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` -still apply. So you need to explicitly indicate why it is a critical -fix and exactly what users are impacted. In addition, you need to -convince yourself that you *really* think it has been overlooked, -vs. having been considered and rejected. - -Generally speaking, the longer it has had a chance to "soak" in -mainline, the better the odds that it is an OK candidate for stable. So -scrambling to request a commit be added the day after it appears should -be avoided. - -I have created a network patch and I think it should be backported to stable. Should I add a Cc: [email protected] like the references in the kernel's Documentation/ directory say? ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -No. See above answer. In short, if you think it really belongs in -stable, then ensure you write a decent commit log that describes who -gets impacted by the bug fix and how it manifests itself, and when the -bug was introduced. If you do that properly, then the commit will get -handled appropriately and most likely get put in the patchworks stable -queue if it really warrants it. - -If you think there is some valid information relating to it being in -stable that does *not* belong in the commit log, then use the three dash -marker line as described in -:ref:`Documentation/process/submitting-patches.rst <the_canonical_patch_format>` -to temporarily embed that information into the patch that you send. - -Are all networking bug fixes backported to all stable releases? +Are there special rules regarding stable submissions on netdev? --------------------------------------------------------------- -Due to capacity, Dave could only take care of the backports for the -last two stable releases. For earlier stable releases, each stable -branch maintainer is supposed to take care of them. If you find any -patch is missing from an earlier stable branch, please notify [email protected] with either a commit ID or a formal patch -backported, and CC Dave and other relevant networking developers. +While it used to be the case that netdev submissions were not supposed +to carry explicit ``CC: [email protected]`` tags that is no longer +the case today. Please follow the standard stable rules in +:ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`, +and make sure you include appropriate Fixes tags! Is the comment style convention different for the networking content? ---------------------------------------------------------------------
Documentation/process/stable-kernel-rules.rst +0 -6
@@ -35,12 +35,6 @@ Rules on what kind of patches are accept Procedure for submitting patches to the -stable tree ---------------------------------------------------- - - If the patch covers files in net/ or drivers/net please follow netdev stable - submission guidelines as described in - :ref:`Documentation/networking/netdev-FAQ.rst <netdev-FAQ>` - after first checking the stable networking queue at - https://patchwork.kernel.org/bundle/netdev/stable/?state=* - to ensure the requested patch is not already queued up. - Security patches should not be handled (solely) by the -stable review process but should follow the procedures in :ref:`Documentation/admin-guide/security-bugs.rst <securitybugs>`.
Documentation/process/submitting-patches.rst +0 -5
@@ -250,11 +250,6 @@ should also read :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>` in addition to this file. -Note, however, that some subsystem maintainers want to come to their own -conclusions on which patches should go to the stable trees. The networking -maintainer, in particular, would rather not see individual developers -adding lines like the above to their patches. - If changes affect userland-kernel interfaces, please send the MAN-PAGES maintainer (as listed in the MAINTAINERS file) a man-pages patch, or at least a notification of the change, so that some information makes its way
[email protected]
maintainerPATCH 44/306 net: dsa: tag_rtl4_a: fix egress tags
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: DENG Qingfang <[email protected]>
commit 9eb8bc593a5eed167dac2029abef343854c5ba75 upstream.
Commit 86dd9868b878 has several issues, but was accepted too soon before anyone could take a look.
- Double free. dsa_slave_xmit() will free the skb if the xmit function returns NULL, but the skb is already freed by eth_skb_pad(). Use __skb_put_padto() to avoid that.
- Unnecessary allocation. It has been done by DSA core since commit a3b0b6479700.
- A u16 pointer points to skb data. It should be __be16 for network byte order.
- Typo in comments. "numer" -> "number".
--- net/dsa/tag_rtl4_a.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
net/dsa/tag_rtl4_a.c +5 -7
@@ -35,14 +35,12 @@ static struct sk_buff *rtl4a_tag_xmit(st struct net_device *dev) {struct dsa_port *dp =dsa_slave_to_port (dev); +__be16 *p;u8 *tag; -u16 *p;u16 out;/* Pad out to at least 60 bytes */ -if (unlikely (eth_skb_pad (skb))) -return NULL ; -if (skb_cow_head (skb,RTL4_A_HDR_LEN ) <0 ) +if (unlikely (__skb_put_padto (skb,ETH_ZLEN , false)))return NULL ; netdev_dbg(dev, "add realtek tag to package to port %d\n",
@@ -53,13 +51,13 @@ static struct sk_buff *rtl4a_tag_xmit(st tag = skb->data +2 *ETH_ALEN ;/* Set Ethertype */ - p = (u16 *)tag; + p = (__be16 *)tag; *p =htons (RTL4_A_ETHERTYPE ); out = (RTL4_A_PROTOCOL_RTL8366RB <<12 ) | (2 <<8 ); -/* The lower bits is the port numer */ +/* The lower bits is the port number */ out |= (u8 )dp->index; - p = (u16 *)(tag +2 ); + p = (__be16 *)(tag +2 ); *p =htons (out);return skb;
[email protected]
maintainerPATCH 45/306 sh_eth: fix TRSCER mask for SH771x
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Sergey Shtylyov <[email protected]>
commit 8c91bc3d44dfef8284af384877fbe61117e8b7d1 upstream.
According to the SH7710, SH7712, SH7713 Group User's Manual: Hardware, Rev. 3.00, the TRSCER register actually has only bit 7 valid (and named differently), with all the other bits reserved. Apparently, this was not the case with some early revisions of the manual as we have the other bits declared (and set) in the original driver. Follow the suit and add the explicit sh_eth_cpu_data::trscer_err_mask initializer for SH771x...
--- drivers/net/ethernet/renesas/sh_eth.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/renesas/sh_eth.c +3 -0
@@ -1089,6 +1089,9 @@ static struct sh_eth_cpu_data sh771x_datEESIPR_CEEFIP |EESIPR_CELFIP |EESIPR_RRFIP |EESIPR_RTLFIP |EESIPR_RTSFIP | EESIPR_PREIP | EESIPR_CERFIP, + + .trscer_err_mask = DESC_I_RINT8, + .tsu = 1, .dual_port = 1, };
[email protected]
maintainerPATCH 46/306 net: enetc: dont overwrite the RSS indirection table when initializing
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vladimir Oltean <[email protected]>
commit c646d10dda2dcde82c6ce5a474522621ab2b8b19 upstream.
After the blamed patch, all RX traffic gets hashed to CPU 0 because the hashing indirection table set up in:
enetc_pf_probe
-> enetc_alloc_si_resources
-> enetc_configure_si
-> enetc_setup_default_rss_table
is overwritten later in:
enetc_pf_probe
-> enetc_init_port_rss_memory
which zero-initializes the entire port RSS table in order to avoid ECC errors.
The trouble really is that enetc_init_port_rss_memory really neads enetc_alloc_si_resources to be called, because it depends upon enetc_alloc_cbdr and enetc_setup_cbdr. But that whole enetc_configure_si thing could have been better thought out, it has nothing to do in a function called "alloc_si_resources", especially since its counterpart, "free_si_resources", does nothing to unwind the configuration of the SI.
The point is, we need to pull out enetc_configure_si out of enetc_alloc_resources, and move it after enetc_init_port_rss_memory. This allows us to set up the default RSS indirection table after initializing the memory.
--- drivers/net/ethernet/freescale/enetc/enetc.c | 11 +++-------- drivers/net/ethernet/freescale/enetc/enetc.h | 1 + drivers/net/ethernet/freescale/enetc/enetc_pf.c | 7 +++++++ drivers/net/ethernet/freescale/enetc/enetc_vf.c | 7 +++++++ 4 files changed, 18 insertions(+), 8 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.c +3 -8
@@ -1058,13 +1058,12 @@ static int enetc_setup_default_rss_tablereturn 0 ; } -static int enetc_configure_si (struct enetc_ndev_priv *priv) +int enetc_configure_si (struct enetc_ndev_priv *priv) {struct enetc_si *si = priv->si;struct enetc_hw *hw = &si->hw;int err; -enetc_setup_cbdr (hw, &si->cbd_ring);/* set SI cache attributes */ enetc_wr (hw,ENETC_SICAR0 ,ENETC_SICAR_RD_COHERENT |ENETC_SICAR_WR_COHERENT );
@@ -1112,6 +1111,8 @@ int enetc_alloc_si_resources(struct enetif (err)return err; +enetc_setup_cbdr (&si->hw, &si->cbd_ring); + priv->cls_rules =kcalloc (si->num_fs_entries,sizeof (*priv->cls_rules),GFP_KERNEL );if (!priv->cls_rules) {
@@ -1119,14 +1120,8 @@ int enetc_alloc_si_resources(struct enet goto err_alloc_cls; } - err =enetc_configure_si (priv); -if (err) - goto err_config_si; -return 0 ; -err_config_si: -kfree (priv->cls_rules); err_alloc_cls:enetc_clear_cbdr (&si->hw);enetc_free_cbdr (priv->dev, &si->cbd_ring);
drivers/net/ethernet/freescale/enetc/enetc.h +1 -0
@@ -292,6 +292,7 @@ void enetc_get_si_caps(struct enetc_si *void enetc_init_si_rings_params (struct enetc_ndev_priv *priv);int enetc_alloc_si_resources (struct enetc_ndev_priv *priv);void enetc_free_si_resources (struct enetc_ndev_priv *priv); +int enetc_configure_si (struct enetc_ndev_priv *priv);int enetc_open (struct net_device *ndev);int enetc_close (struct net_device *ndev);
drivers/net/ethernet/freescale/enetc/enetc_pf.c +7 -0
@@ -1108,6 +1108,12 @@ static int enetc_pf_probe(struct pci_dev goto err_init_port_rss; } + err =enetc_configure_si (priv); +if (err) { +dev_err (&pdev->dev,"Failed to configure SI\n" ); + goto err_config_si; + } + err =enetc_alloc_msix (priv);if (err) {dev_err (&pdev->dev,"MSIX alloc failed\n" );
@@ -1136,6 +1142,7 @@ err_phylink_create:enetc_mdiobus_destroy (pf); err_mdiobus_create:enetc_free_msix (priv); +err_config_si: err_init_port_rss: err_init_port_rfs: err_alloc_msix:
drivers/net/ethernet/freescale/enetc/enetc_vf.c +7 -0
@@ -171,6 +171,12 @@ static int enetc_vf_probe(struct pci_dev goto err_alloc_si_res; } + err =enetc_configure_si (priv); +if (err) { +dev_err (&pdev->dev,"Failed to configure SI\n" ); + goto err_config_si; + } + err =enetc_alloc_msix (priv);if (err) {dev_err (&pdev->dev,"MSIX alloc failed\n" );
@@ -187,6 +193,7 @@ static int enetc_vf_probe(struct pci_dev err_reg_netdev:enetc_free_msix (priv); +err_config_si: err_alloc_msix:enetc_free_si_resources (priv); err_alloc_si_res:
[email protected]
maintainerPATCH 47/306 net: enetc: initialize RFS/RSS memories for unused ports too
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vladimir Oltean <[email protected]>
commit 3222b5b613db558e9a494bbf53f3c984d90f71ea upstream.
Michael reports that since linux-next-20210211, the AER messages for ECC errors have started reappearing, and this time they can be reliably reproduced with the first ping on one of his LS1028A boards.
$ ping 1[ 33.258069] pcieport 0000:00:1f.0: AER: Multiple Corrected error received: 0000:00:00.0 72.16.0.1 PING [ 33.267050] pcieport 0000:00:1f.0: AER: can't find device of ID0000 172.16.0.1 (172.16.0.1): 56 data bytes 64 bytes from 172.16.0.1: seq=0 ttl=64 time=17.124 ms 64 bytes from 172.16.0.1: seq=1 ttl=64 time=0.273 ms
$ devmem 0x1f8010e10 32 0xC0000006
It isn't clear why this is necessary, but it seems that for the errors to go away, we must clear the entire RFS and RSS memory, not just for the ports in use.
Sadly the code is structured in such a way that we can't have unified logic for the used and unused ports. For the minimal initialization of an unused port, we need just to enable and ioremap the PF memory space, and a control buffer descriptor ring. Unused ports must then free the CBDR because the driver will exit, but used ports can not pick up from where that code path left, since the CBDR API does not reinitialize a ring when setting it up, so its producer and consumer indices are out of sync between the software and hardware state. So a separate enetc_init_unused_port function was created, and it gets called right after the PF memory space is enabled.
--- drivers/net/ethernet/freescale/enetc/enetc.c | 8 ++--- drivers/net/ethernet/freescale/enetc/enetc.h | 4 ++ drivers/net/ethernet/freescale/enetc/enetc_pf.c | 33 ++++++++++++++++++++---- 3 files changed, 36 insertions(+), 9 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.c +4 -4
@@ -984,7 +984,7 @@ static void enetc_free_rxtx_rings(structenetc_free_tx_ring (priv->tx_ring[i]); } -static int enetc_alloc_cbdr (struct device *dev,struct enetc_cbdr *cbdr) +int enetc_alloc_cbdr (struct device *dev,struct enetc_cbdr *cbdr) {int size = cbdr->bd_count *sizeof (struct enetc_cbd );
@@ -1005,7 +1005,7 @@ static int enetc_alloc_cbdr(struct devicreturn 0 ; } -static void enetc_free_cbdr (struct device *dev,struct enetc_cbdr *cbdr) +void enetc_free_cbdr (struct device *dev,struct enetc_cbdr *cbdr) {int size = cbdr->bd_count *sizeof (struct enetc_cbd );
@@ -1013,7 +1013,7 @@ static void enetc_free_cbdr(struct devic cbdr->bd_base =NULL ; } -static void enetc_setup_cbdr (struct enetc_hw *hw,struct enetc_cbdr *cbdr) +void enetc_setup_cbdr (struct enetc_hw *hw,struct enetc_cbdr *cbdr) {/* set CBDR cache attributes */ enetc_wr(hw, ENETC_SICAR2,
@@ -1033,7 +1033,7 @@ static void enetc_setup_cbdr(struct enet cbdr->cir = hw->reg +ENETC_SICBDRCIR ; } -static void enetc_clear_cbdr (struct enetc_hw *hw) +void enetc_clear_cbdr (struct enetc_hw *hw) {enetc_wr (hw,ENETC_SICBDRMR ,0 ); }
drivers/net/ethernet/freescale/enetc/enetc.h +4 -0
@@ -310,6 +310,10 @@ int enetc_setup_tc(struct net_device *ndvoid enetc_set_ethtool_ops (struct net_device *ndev);/* control buffer descriptor ring (CBDR) */ +int enetc_alloc_cbdr (struct device *dev,struct enetc_cbdr *cbdr); +void enetc_free_cbdr (struct device *dev,struct enetc_cbdr *cbdr); +void enetc_setup_cbdr (struct enetc_hw *hw,struct enetc_cbdr *cbdr); +void enetc_clear_cbdr (struct enetc_hw *hw);int enetc_set_mac_flt_entry (struct enetc_si *si,int index,char *mac_addr,int si_map);int enetc_clear_mac_flt_entry (struct enetc_si *si,int index);
drivers/net/ethernet/freescale/enetc/enetc_pf.c +28 -5
@@ -1041,6 +1041,26 @@ static int enetc_init_port_rss_memory(streturn err; } +static void enetc_init_unused_port (struct enetc_si *si) +{ +struct device *dev = &si->pdev->dev; +struct enetc_hw *hw = &si->hw; +int err; + + si->cbd_ring.bd_count =ENETC_CBDR_DEFAULT_SIZE ; + err =enetc_alloc_cbdr (dev, &si->cbd_ring); +if (err) +return ; + +enetc_setup_cbdr (hw, &si->cbd_ring); + +enetc_init_port_rfs_memory (si); +enetc_init_port_rss_memory (si); + +enetc_clear_cbdr (hw); +enetc_free_cbdr (dev, &si->cbd_ring); +} +static int enetc_pf_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -1051,11 +1071,6 @@ static int enetc_pf_probe(struct pci_devstruct enetc_pf *pf;int err; -if (node && !of_device_is_available (node)) { -dev_info (&pdev->dev,"device is disabled, skipping\n" ); -return -ENODEV ; - } - err =enetc_pci_probe (pdev,KBUILD_MODNAME ,sizeof (*pf));if (err) {dev_err (&pdev->dev,"PCI probing failed\n" );
@@ -1069,6 +1084,13 @@ static int enetc_pf_probe(struct pci_dev goto err_map_pf_space; } +if (node && !of_device_is_available (node)) { +enetc_init_unused_port (si); +dev_info (&pdev->dev,"device is disabled, skipping\n" ); + err = -ENODEV ; + goto err_device_disabled; + } + pf =enetc_si_priv (si); pf->si = si; pf->total_vfs =pci_sriov_get_totalvfs (pdev);
@@ -1151,6 +1173,7 @@ err_alloc_si_res: si->ndev =NULL ;free_netdev (ndev); err_alloc_netdev: +err_device_disabled: err_map_pf_space:enetc_pci_remove (pdev);
[email protected]
maintainerPATCH 48/306 net: enetc: take the MDIO lock only once per NAPI poll cycle
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vladimir Oltean <[email protected]>
commit 6d36ecdbc4410e61a0e02adc5d3abeee22a8ffd3 upstream.
The workaround for the ENETC MDIO erratum caused a performance degradation of 82 Kpps (seen with IP forwarding of two 1Gbps streams of 64B packets). This is due to excessive locking and unlocking in the fast path, which can be avoided.
By taking the MDIO read-side lock only once per NAPI poll cycle, we are able to regain 54 Kpps (65%) of the performance hit. The rest of the performance degradation comes from the TX data path, but unfortunately it doesn't look like we can optimize that away easily, even with netdev_xmit_more(), there just isn't any skb batching done, to help with taking the MDIO lock less often than once per packet.
We need to change the register accessor type for enetc_get_tx_tstamp, because it now runs under the enetc_lock_mdio as per the new call path detailed below:
enetc_msix
-> napi_schedule
-> enetc_poll
-> enetc_lock_mdio
-> enetc_clean_tx_ring
-> enetc_get_tx_tstamp
-> enetc_clean_rx_ring
-> enetc_unlock_mdio--- drivers/net/ethernet/freescale/enetc/enetc.c | 31 ++++++------------------ drivers/net/ethernet/freescale/enetc/enetc_hw.h | 2 + 2 files changed, 11 insertions(+), 22 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.c +9 -22
@@ -281,6 +281,8 @@ static int enetc_poll(struct napi_structint work_done;int i; +enetc_lock_mdio (); +for (i =0 ; i < v->count_tx_rings; i++)if (!enetc_clean_tx_ring (&v->tx_ring[i], budget)) complete = false;
@@ -291,8 +293,10 @@ static int enetc_poll(struct napi_structif (work_done) v->rx_napi_work = true; -if (!complete) +if (!complete) { +enetc_unlock_mdio ();return budget; + }napi_complete_done (napi, work_done);
@@ -301,8 +305,6 @@ static int enetc_poll(struct napi_struct v->rx_napi_work = false; -enetc_lock_mdio (); -/* enable interrupts */ enetc_wr_reg_hot (v->rbier,ENETC_RBIER_RXTIE );
@@ -327,8 +329,8 @@ static void enetc_get_tx_tstamp(struct e {u32 lo, hi, tstamp_lo; - lo =enetc_rd (hw,ENETC_SICTR0 ); - hi =enetc_rd (hw,ENETC_SICTR1 ); + lo =enetc_rd_hot (hw,ENETC_SICTR0 ); + hi =enetc_rd_hot (hw,ENETC_SICTR1 ); tstamp_lo =le32_to_cpu (txbd->wb.tstamp);if (lo <= tstamp_lo) hi -=1 ;
@@ -358,9 +360,7 @@ static bool enetc_clean_tx_ring(struct e i = tx_ring->next_to_clean; tx_swbd = &tx_ring->tx_swbd[i]; -enetc_lock_mdio (); bds_to_clean =enetc_bd_ready_count (tx_ring, i); -enetc_unlock_mdio (); do_tstamp = false;
@@ -403,8 +403,6 @@ static bool enetc_clean_tx_ring(struct e tx_swbd = tx_ring->tx_swbd; } -enetc_lock_mdio (); -/* BD iteration loop end */ if (is_eof) { tx_frm_cnt++;
@@ -415,8 +413,6 @@ static bool enetc_clean_tx_ring(struct eif (unlikely (!bds_to_clean)) bds_to_clean =enetc_bd_ready_count (tx_ring, i); - -enetc_unlock_mdio (); } tx_ring->next_to_clean = i;
@@ -660,8 +656,6 @@ static int enetc_clean_rx_ring(struct enu32 bd_status;u16 size; -enetc_lock_mdio (); -if (cleaned_cnt >=ENETC_RXBD_BUNDLE ) {int count =enetc_refill_rx_ring (rx_ring, cleaned_cnt);
@@ -672,19 +666,15 @@ static int enetc_clean_rx_ring(struct en rxbd =enetc_rxbd (rx_ring, i); bd_status =le32_to_cpu (rxbd->r.lstatus); -if (!bd_status) { -enetc_unlock_mdio (); +if (!bd_status)break ; - }enetc_wr_reg_hot (rx_ring->idr,BIT (rx_ring->index));dma_rmb ();/* for reading other rxbd fields */ size =le16_to_cpu (rxbd->r.buf_len); skb =enetc_map_rx_buff_to_skb (rx_ring, i, size); -if (!skb) { -enetc_unlock_mdio (); +if (!skb)break ; - }enetc_get_offloads (rx_ring, rxbd, skb);
@@ -696,7 +686,6 @@ static int enetc_clean_rx_ring(struct enif (unlikely (bd_status &ENETC_RXBD_LSTATUS (ENETC_RXBD_ERR_MASK ))) { -enetc_unlock_mdio ();dev_kfree_skb (skb);while (!(bd_status &ENETC_RXBD_LSTATUS_F )) {dma_rmb ();
@@ -736,8 +725,6 @@ static int enetc_clean_rx_ring(struct enenetc_process_skb (rx_ring, skb); -enetc_unlock_mdio (); -napi_gro_receive (napi, skb); rx_frm_cnt++;
drivers/net/ethernet/freescale/enetc/enetc_hw.h +2 -0
@@ -453,6 +453,8 @@ static inline u64 _enetc_rd_reg64_wa(voi#define enetc_wr_reg (reg, val) _enetc_wr_reg_wa((reg), (val))#define enetc_rd (hw, off) enetc_rd_reg((hw)->reg + (off))#define enetc_wr (hw, off, val) enetc_wr_reg((hw)->reg + (off), val) +#define enetc_rd_hot (hw, off) enetc_rd_reg_hot((hw)->reg + (off)) +#define enetc_wr_hot (hw, off, val) enetc_wr_reg_hot((hw)->reg + (off), val)#define enetc_rd64 (hw, off) _enetc_rd_reg64_wa((hw)->reg + (off))/* port register accessors - PF only */ #define enetc_port_rd (hw, off) enetc_rd_reg((hw)->port + (off))
[email protected]
maintainerPATCH 49/306 net: enetc: fix incorrect TPID when receiving 802.1ad tagged packets
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vladimir Oltean <[email protected]>
commit 827b6fd046516af605e190c872949f22208b5d41 upstream.
When the enetc ports have rx-vlan-offload enabled, they report a TPID of ETH_P_8021Q regardless of what was actually in the packet. When rx-vlan-offload is disabled, packets have the proper TPID. Fix this inconsistency by finishing the TODO left in the code.
--- drivers/net/ethernet/freescale/enetc/enetc.c | 34 ++++++++++++++++++------ drivers/net/ethernet/freescale/enetc/enetc_hw.h | 3 ++ 2 files changed, 29 insertions(+), 8 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc.c +26 -8
@@ -523,9 +523,8 @@ static void enetc_get_rx_tstamp(struct nstatic void enetc_get_offloads (struct enetc_bdr *rx_ring,union enetc_rx_bd *rxbd,struct sk_buff *skb) { -#ifdef CONFIG_FSL_ENETC_PTP_CLOCK struct enetc_ndev_priv *priv =netdev_priv (rx_ring->ndev); -#endif +/* TODO: hashing */ if (rx_ring->ndev->features &NETIF_F_RXCSUM ) {u16 inet_csum =le16_to_cpu (rxbd->r.inet_csum);
@@ -534,12 +533,31 @@ static void enetc_get_offloads(struct en skb->ip_summed =CHECKSUM_COMPLETE ; } -/* copy VLAN to skb, if one is extracted, for now we assume it's a -* standard TPID, but HW also supports custom values -*/ -if (le16_to_cpu (rxbd->r.flags) &ENETC_RXBD_FLAG_VLAN ) -__vlan_hwaccel_put_tag (skb,htons (ETH_P_8021Q ), -le16_to_cpu (rxbd->r.vlan_opt)); +if (le16_to_cpu (rxbd->r.flags) &ENETC_RXBD_FLAG_VLAN ) { +__be16 tpid =0 ; + +switch (le16_to_cpu (rxbd->r.flags) &ENETC_RXBD_FLAG_TPID ) { +case 0 : + tpid =htons (ETH_P_8021Q ); +break ; +case 1 : + tpid =htons (ETH_P_8021AD ); +break ; +case 2 : + tpid =htons (enetc_port_rd (&priv->si->hw, +ENETC_PCVLANR1 )); +break ; +case 3 : + tpid =htons (enetc_port_rd (&priv->si->hw, +ENETC_PCVLANR2 )); +break ; +default : +break ; + } + +__vlan_hwaccel_put_tag (skb, tpid,le16_to_cpu (rxbd->r.vlan_opt)); + } +#ifdef CONFIG_FSL_ENETC_PTP_CLOCK if (priv->active_offloads &ENETC_F_RX_TSTAMP )enetc_get_rx_tstamp (rx_ring->ndev, rxbd, skb);
drivers/net/ethernet/freescale/enetc/enetc_hw.h +3 -0
@@ -172,6 +172,8 @@ enum enetc_bdr_type {TX, RX};#define ENETC_PSIPMAR0 (n) (0x0100 + (n) * 0x8)/* n = SI index */ #define ENETC_PSIPMAR1 (n) (0x0104 + (n) * 0x8)#define ENETC_PVCLCTR 0x0208 +#define ENETC_PCVLANR1 0x0210 +#define ENETC_PCVLANR2 0x0214#define ENETC_VLAN_TYPE_C BIT(0)#define ENETC_VLAN_TYPE_S BIT(1)#define ENETC_PVCLCTR_OVTPIDL (bmp) ((bmp) & 0xff)/* VLAN_TYPE */
@@ -570,6 +572,7 @@ union enetc_rx_bd {#define ENETC_RXBD_LSTATUS (flags) ((flags) << 16)#define ENETC_RXBD_FLAG_VLAN BIT(9)#define ENETC_RXBD_FLAG_TSTMP BIT(10) +#define ENETC_RXBD_FLAG_TPID GENMASK(1, 0)#define ENETC_MAC_ADDR_FILT_CNT 8/* # of supported entries per port */ #define EMETC_MAC_ADDR_FILT_RES 3/* # of reserved entries at the beginning */
[email protected]
maintainerPATCH 50/306 net: enetc: dont disable VLAN filtering in IFF_PROMISC mode
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vladimir Oltean <[email protected]>
commit a74dbce9d4541888fe0d39afe69a3a95004669b4 upstream.
Quoting from the blamed commit:
In promiscuous mode, it is more intuitive that all traffic is received, including VLAN tagged traffic. It appears that it is necessary to set the flag in PSIPVMR for that to be the case, so VLAN promiscuous mode is also temporarily enabled. On exit from promiscuous mode, the setting made by ethtool is restored.
Intuitive or not, there isn't any definition issued by a standards body which says that promiscuity has anything to do with VLAN filtering - it only has to do with accepting packets regardless of destination MAC address.
In fact people are already trying to use this misunderstanding/bug of the enetc driver as a justification to transform promiscuity into something it never was about: accepting every packet (maybe that would be the "rx-all" netdev feature?):
https://lore.kernel.org/netdev/[email protected]/
This is relevant because there are use cases in the kernel (such as tc-flower rules with the protocol 802.1Q and a vlan_id key) which do not (yet) use the vlan_vid_add API to be compatible with VLAN-filtering NICs such as enetc, so for those, disabling rx-vlan-filter is currently the only right solution to make these setups work:
https://lore.kernel.org/netdev/CA+h21hoxwRdhq4y+w8Kwgm74d4cA0xLeiHTrmT-VpSaM7obhkg@mail.gmail.com/
The blamed patch has unintentionally introduced one more way for this to work, which is to enable IFF_PROMISC, however this is non-portable because port promiscuity is not meant to disable VLAN filtering. Therefore, it could invite people to write broken scripts for enetc, and then wonder why they are broken when migrating to other drivers that don't handle promiscuity in the same way.
--- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_pf.c +0 -5
@@ -190,7 +190,6 @@ static void enetc_pf_set_rx_mode(struct {struct enetc_ndev_priv *priv =netdev_priv (ndev);struct enetc_pf *pf =enetc_si_priv (priv->si); -char vlan_promisc_simap = pf->vlan_promisc_simap;struct enetc_hw *hw = &priv->si->hw;bool uprom = false, mprom = false;struct enetc_mac_filter *filter;
@@ -203,16 +202,12 @@ static void enetc_pf_set_rx_mode(struct psipmr =ENETC_PSIPMR_SET_UP (0 ) |ENETC_PSIPMR_SET_MP (0 ); uprom = true; mprom = true; -/* Enable VLAN promiscuous mode for SI0 (PF) */ - vlan_promisc_simap |=BIT (0 ); }else if (ndev->flags &IFF_ALLMULTI ) {/* enable multi cast promisc mode for SI0 (PF) */ psipmr =ENETC_PSIPMR_SET_MP (0 ); mprom = true; } -enetc_set_vlan_promisc (&pf->si->hw, vlan_promisc_simap); -/* first 2 filter entries belong to PF */ if (!uprom) {/* Update unicast filters */
[email protected]
maintainerPATCH 51/306 net: enetc: force the RGMII speed and duplex instead of operating in inband mode
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vladimir Oltean <[email protected]>
commit c76a97218dcbb2cb7cec1404ace43ef96c87d874 upstream.
The ENETC port 0 MAC supports in-band status signaling coming from a PHY when operating in RGMII mode, and this feature is enabled by default.
It has been reported that RGMII is broken in fixed-link, and that is not surprising considering the fact that no PHY is attached to the MAC in that case, but a switch.
This brings us to the topic of the patch: the enetc driver should have not enabled the optional in-band status signaling for RGMII unconditionally, but should have forced the speed and duplex to what was resolved by phylink.
Note that phylink does not accept the RGMII modes as valid for in-band signaling, and these operate a bit differently than 1000base-x and SGMII (notably there is no clause 37 state machine so no ACK required from the MAC, instead the PHY sends extra code words on RXD[3:0] whenever it is not transmitting something else, so it should be safe to leave a PHY with this option unconditionally enabled even if we ignore it). The spec talks about this here:
https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/138/RGMIIv1_5F00_3.pdf
--- drivers/net/ethernet/freescale/enetc/enetc_hw.h | 13 ++++- drivers/net/ethernet/freescale/enetc/enetc_pf.c | 53 ++++++++++++++++++++---- 2 files changed, 56 insertions(+), 10 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_hw.h +10 -3
@@ -238,10 +238,17 @@ enum enetc_bdr_type {TX, RX};#define ENETC_PM_IMDIO_BASE 0x8030#define ENETC_PM0_IF_MODE 0x8300 -#define ENETC_PMO_IFM_RG BIT(2) +#define ENETC_PM0_IFM_RG BIT(2)#define ENETC_PM0_IFM_RLP (BIT(5) | BIT(11)) -#define ENETC_PM0_IFM_RGAUTO (BIT(15) | ENETC_PMO_IFM_RG | BIT(1)) -#define ENETC_PM0_IFM_XGMII BIT(12) +#define ENETC_PM0_IFM_EN_AUTO BIT(15) +#define ENETC_PM0_IFM_SSP_MASK GENMASK(14, 13) +#define ENETC_PM0_IFM_SSP_1000 (2 << 13) +#define ENETC_PM0_IFM_SSP_100 (0 << 13) +#define ENETC_PM0_IFM_SSP_10 (1 << 13) +#define ENETC_PM0_IFM_FULL_DPX BIT(12) +#define ENETC_PM0_IFM_IFMODE_MASK GENMASK(1, 0) +#define ENETC_PM0_IFM_IFMODE_XGMII 0 +#define ENETC_PM0_IFM_IFMODE_GMII 2#define ENETC_PSIDCAPR 0x1b08#define ENETC_PSIDCAPR_MSK GENMASK(15, 0)#define ENETC_PSFCAPR 0x1b18
drivers/net/ethernet/freescale/enetc/enetc_pf.c +46 -7
78 lines not on this page · raw message
[email protected]
maintainerPATCH 52/306 net: enetc: remove bogus write to SIRXIDR from enetc_setup_rxbdr
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vladimir Oltean <[email protected]>
commit 96a5223b918c8b79270fc0fec235a7ebad459098 upstream.
The Station Interface Receive Interrupt Detect Register (SIRXIDR) contains a 16-bit wide mask of 'interrupt detected' events for each ring associated with a port. Bit i is write-1-to-clean for RX ring i.
I have no explanation whatsoever how this line of code came to be inserted in the blamed commit. I checked the downstream versions of that patch and none of them have it.
The somewhat comical aspect of it is that we're writing a binary number to the SIRXIDR register, which is derived from enetc_bd_unused(rx_ring). Since the RX rings have 512 buffer descriptors, we end up writing 511 to this register, which is 0x1ff, so we are effectively clearing the 'interrupt detected' event for rings 0-8.
This register is not what is used for interrupt handling though - it only provides a summary for the entire SI. The hardware provides one separate Interrupt Detect Register per RX ring, which auto-clears upon read. So there doesn't seem to be any adverse effect caused by this bogus write.
There is, however, one reason why this should be handled as a bugfix:next_to_clean _should_ be committed to hardware, just not to that register, and this was obscuring the fact that it wasn't. This is fixed in the next patch, and removing the bogus line now allows the fix patch to be backported beyond that point.
--- drivers/net/ethernet/freescale/enetc/enetc.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc.c +0 -1
@@ -1212,7 +1212,6 @@ static void enetc_setup_rxbdr(struct ene rx_ring->idr = hw->reg +ENETC_SIRXIDR ;enetc_refill_rx_ring (rx_ring,enetc_bd_unused (rx_ring)); -enetc_wr (hw,ENETC_SIRXIDR , rx_ring->next_to_use);/* enable ring */ enetc_rxbdr_wr (hw, idx,ENETC_RBMR , rbmr);
[email protected]
maintainerPATCH 53/306 net: enetc: keep RX ring consumer index in sync with hardware
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vladimir Oltean <[email protected]>
commit 3a5d12c9be6f30080600c8bacaf310194e37d029 upstream.
The RX rings have a producer index owned by hardware, where newly received frame buffers are placed, and a consumer index owned by software, where newly allocated buffers are placed, in expectation of hardware being able to place frame data in them.
Hardware increments the producer index when a frame is received, however it is not allowed to increment the producer index to match the consumer index (RBCIR) since the ring can hold at most RBLENR[LENGTH]-1 received BDs. Whenever the producer index matches the value of the consumer index, the ring has no unprocessed received frames and all BDs in the ring have been initialized/prepared by software, i.e. hardware owns all BDs in the ring.
The code uses the next_to_clean variable to keep track of the producer index, and the next_to_use variable to keep track of the consumer index.
The RX rings are seeded from enetc_refill_rx_ring, which is called from two places:
1. initially the ring is seeded until full with enetc_bd_unused(rx_ring), i.e. with 511 buffers. This will make next_to_clean=0 and next_to_use=511:
.ndo_open
-> enetc_open
-> enetc_setup_bdrs
-> enetc_setup_rxbdr
-> enetc_refill_rx_ring2. then during the data path processing, it is refilled with 16 buffers at a time:
enetc_msix
-> napi_schedule
-> enetc_poll
-> enetc_clean_rx_ring
-> enetc_refill_rx_ringThere is just one problem: the initial seeding done during .ndo_open updates just the producer index (ENETC_RBPIR) with 0, and the software next_to_clean and next_to_use variables. Notably, it will not update the consumer index to make the hardware aware of the newly added buffers.
Wait, what? So how does it work?
Well, the reset values of the producer index and of the consumer index of a ring are both zero. As per the description in the second paragraph, it means that the ring is full of buffers waiting for hardware to put frames in them, which by coincidence is almost true, because we have in fact seeded 511 buffers into the ring.
But will the hardware attempt to access the 512th entry of the ring, which has an invalid BD in it? Well, no, because in order to do that, it would have to first populate the first 511 entries, and the NAPI enetc_poll will kick in by then. Eventually, after 16 processed slots have become available in the RX ring, enetc_clean_rx_ring will call enetc_refill_rx_ring and then will [ finally ] update the consumer index with the new software next_to_use variable. From now on, the next_to_clean and next_to_use variables are in sync with the producer and consumer ring indices.
So the day is saved, right? Well, not quite. Freeing the memory allocated for the rings is done in:
enetc_close
-> enetc_clear_bdrs
-> enetc_clear_rxbdr
-> this just disables the ring
-> enetc_free_rxtx_rings
-> enetc_free_rx_ring
-> sets next_to_clean and next_to_use to 0but again, nothing is committed to the hardware producer and consumer indices (yay!). The assumption is that the ring is disabled, so the indices don't matter anyway, and it's the responsibility of the "open" code path to set those up.
.. Except that the "open" code path does not set those up properly.
While initially, things almost work, during subsequent enetc_close -> enetc_open sequences, we have problems. To be precise, the enetc_open that is subsequent to enetc_close will again refill the ring with 511 entries, but it will leave the consumer index untouched. Untouched means, of course, equal to the value it had before disabling the ring and draining the old buffers in enetc_close.
But as mentioned, enetc_setup_rxbdr will at least update the producer index though, through this line of code:
enetc_rxbdr_wr(hw, idx, ENETC_RBPIR, 0);
so at this stage we'll have:
next_to_clean=0 (in hardware 0)
next_to_use=511 (in hardware we'll have the refill index prior to enetc_close)
Again, the next_to_clean and producer index are in sync and set to correct values, so the driver manages to limp on. Eventually, 16 ring entries will be consumed by enetc_poll, and the savior enetc_clean_rx_ring will come and call enetc_refill_rx_ring, and then update the hardware consumer ring based upon the new next_to_use.
So.. it works?
Well, by coincidence, it almost does, but there's a circumstance where enetc_clean_rx_ring won't be there to save us. If the previous value of the consumer index was 15, there's a problem, because the NAPI poll sequence will only issue a refill when 16 or more buffers have been consumed.
It's easiest to illustrate this with an example:
ip link set eno0 up
ip addr add 192.168.100.1/24 dev eno0
ping 192.168.100.1 -c 20 # ping this port from another board ip link set eno0 down
ip link set eno0 up
ping 192.168.100.1 -c 20 # ping it again from the same other board
One by one:
1. ip link set eno0 up
-> calls enetc_setup_rxbdr:
-> calls enetc_refill_rx_ring(511 buffers)
-> next_to_clean=0 (in hw 0)
-> next_to_use=511 (in hw 0)
2. ping 192.168.100.1 -c 20 # ping this port from another boardenetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=1 next_to_clean 0 (in hw 1) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=2 next_to_clean 1 (in hw 2) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=3 next_to_clean 2 (in hw 3) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=4 next_to_clean 3 (in hw 4) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=5 next_to_clean 4 (in hw 5) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=6 next_to_clean 5 (in hw 6) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=7 next_to_clean 6 (in hw 7) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=8 next_to_clean 7 (in hw 8) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=9 next_to_clean 8 (in hw 9) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=10 next_to_clean 9 (in hw 10) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=11 next_to_clean 10 (in hw 11) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=12 next_to_clean 11 (in hw 12) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=13 next_to_clean 12 (in hw 13) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=14 next_to_clean 13 (in hw 14) next_to_use 511 (in hw 0)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=15 next_to_clean 14 (in hw 15) next_to_use 511 (in hw 0)enetc_clean_rx_ring: enetc_refill_rx_ring(16) increments next_to_use by 16 (mod 512) and writes it to hwenetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=0 next_to_clean 15 (in hw 16) next_to_use 15 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=1 next_to_clean 16 (in hw 17) next_to_use 15 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=2 next_to_clean 17 (in hw 18) next_to_use 15 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=3 next_to_clean 18 (in hw 19) next_to_use 15 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=4 next_to_clean 19 (in hw 20) next_to_use 15 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=5 next_to_clean 20 (in hw 21) next_to_use 15 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=6 next_to_clean 21 (in hw 22) next_to_use 15 (in hw 15)
20 packets transmitted, 20 packets received, 0% packet loss
3. ip link set eno0 downenetc_free_rx_ring: next_to_clean 0 (in hw 22), next_to_use 0 (in hw 15)
4. ip link set eno0 up
-> calls enetc_setup_rxbdr:
-> calls enetc_refill_rx_ring(511 buffers)
-> next_to_clean=0 (in hw 0)
-> next_to_use=511 (in hw 15)
5. ping 192.168.100.1 -c 20 # ping it again from the same other boardenetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=1 next_to_clean 0 (in hw 1) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=2 next_to_clean 1 (in hw 2) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=3 next_to_clean 2 (in hw 3) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=4 next_to_clean 3 (in hw 4) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=5 next_to_clean 4 (in hw 5) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=6 next_to_clean 5 (in hw 6) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=7 next_to_clean 6 (in hw 7) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=8 next_to_clean 7 (in hw 8) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=9 next_to_clean 8 (in hw 9) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=10 next_to_clean 9 (in hw 10) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=11 next_to_clean 10 (in hw 11) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=12 next_to_clean 11 (in hw 12) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=13 next_to_clean 12 (in hw 13) next_to_use 511 (in hw 15)enetc_clean_rx_ring: rx_frm_cnt=1 cleaned_cnt=14 next_to_clean 13 (in hw 14) next_to_use 511 (in hw 15)
20 packets transmitted, 12 packets received, 40% packet loss
And there it dies. No enetc_refill_rx_ring (because cleaned_cnt must be equal to 15 for that to happen), no nothing. The hardware enters the condition where the producer (14) + 1 is equal to the consumer (15) index, which makes it believe it has no more free buffers to put packets in, so it starts discarding them:
ip netns exec ns0 ethtool -S eno0 | grep -v ': 0'
NIC statistics:
Rx ring 0 discarded frames: 8
Summarized, if the interface receives between 16 and 32 (mod 512) frames and then there is a link flap, then the port will eventually die with no way to recover. If it receives less than 16 (mod 512) frames, then the initial NAPI poll [ before the link flap ] will not update the consumer index in hardware (it will remain zero) which will be ok when the buffers are later reinitialized. If more than 32 (mod 512) frames are received, the initial NAPI poll has the chance to refill the ring twice, updating the consumer index to at least 32. So after the link flap, the consumer index is still wrong, but the post-flap NAPI poll gets a chance to refill the ring once (because it passes through cleaned_cnt=15) and makes the consumer index be again back in sync with next_to_use.
The solution to this problem is actually simple, we just need to write next_to_use into the hardware consumer index at enetc_open time, which always brings it back in sync after an initial buffer seeding process.
The simpler thing would be to put the write to the consumer index into enetc_refill_rx_ring directly, but there are issues with the MDIO
locking: in the NAPI poll code we have the enetc_lock_mdio() taken from top-level and we use the unlocked enetc_wr_reg_hot, whereas in enetc_open, the enetc_lock_mdio() is not taken at the top level, but instead by each individual enetc_wr_reg, so we are forced to put an additional enetc_wr_reg in enetc_setup_rxbdr. Better organization of the code is left as a refactoring exercise.
--- drivers/net/ethernet/freescale/enetc/enetc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/enetc/enetc.c +2 -0
@@ -1212,6 +1212,8 @@ static void enetc_setup_rxbdr(struct ene rx_ring->idr = hw->reg +ENETC_SIRXIDR ;enetc_refill_rx_ring (rx_ring,enetc_bd_unused (rx_ring)); +/* update ENETC's consumer index */ +enetc_rxbdr_wr (hw, idx,ENETC_RBCIR , rx_ring->next_to_use);/* enable ring */ enetc_rxbdr_wr (hw, idx,ENETC_RBMR , rbmr);
[email protected]
maintainerPATCH 54/306 net: dsa: tag_mtk: fix 802.1ad VLAN egress
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: DENG Qingfang <[email protected]>
commit 9200f515c41f4cbaeffd8fdd1d8b6373a18b1b67 upstream.
A different TPID bit is used for 802.1ad VLAN frames.
--- net/dsa/tag_mtk.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
net/dsa/tag_mtk.c +13 -6
@@ -13,6 +13,7 @@#define MTK_HDR_LEN 4#define MTK_HDR_XMIT_UNTAGGED 0#define MTK_HDR_XMIT_TAGGED_TPID_8100 1 +#define MTK_HDR_XMIT_TAGGED_TPID_88A8 2#define MTK_HDR_RECV_SOURCE_PORT_MASK GENMASK(2, 0)#define MTK_HDR_XMIT_DP_BIT_MASK GENMASK(5, 0)#define MTK_HDR_XMIT_SA_DIS BIT(6)
@@ -21,8 +22,8 @@ static struct sk_buff *mtk_tag_xmit(stru struct net_device *dev) {struct dsa_port *dp =dsa_slave_to_port (dev); +u8 xmit_tpid;u8 *mtk_tag; -bool is_vlan_skb = true;unsigned char *dest =eth_hdr (skb)->h_dest;bool is_multicast_skb =is_multicast_ether_addr (dest) && !is_broadcast_ether_addr (dest);
@@ -33,10 +34,17 @@ static struct sk_buff *mtk_tag_xmit(stru* the both special and VLAN tag at the same time and then look up VLAN * table with VID. */ -if (!skb_vlan_tagged (skb)) { +switch (skb->protocol) { +case htons (ETH_P_8021Q ): + xmit_tpid =MTK_HDR_XMIT_TAGGED_TPID_8100 ; +break ; +case htons (ETH_P_8021AD ): + xmit_tpid =MTK_HDR_XMIT_TAGGED_TPID_88A8 ; +break ; +default : + xmit_tpid =MTK_HDR_XMIT_UNTAGGED ;skb_push (skb,MTK_HDR_LEN );memmove (skb->data, skb->data +MTK_HDR_LEN ,2 *ETH_ALEN ); - is_vlan_skb = false; } mtk_tag = skb->data +2 *ETH_ALEN ;
@@ -44,8 +52,7 @@ static struct sk_buff *mtk_tag_xmit(stru/* Mark tag attribute on special tag insertion to notify hardware * whether that's a combined special tag with 802.1Q header. */ - mtk_tag[0 ] = is_vlan_skb ?MTK_HDR_XMIT_TAGGED_TPID_8100 : -MTK_HDR_XMIT_UNTAGGED ; + mtk_tag[0 ] = xmit_tpid; mtk_tag[1 ] = (1 << dp->index) &MTK_HDR_XMIT_DP_BIT_MASK ;/* Disable SA learning for multicast frames */
@@ -53,7 +60,7 @@ static struct sk_buff *mtk_tag_xmit(stru mtk_tag[1 ] |=MTK_HDR_XMIT_SA_DIS ;/* Tag control information is kept for 802.1Q */ -if (!is_vlan_skb) { +if (xmit_tpid ==MTK_HDR_XMIT_UNTAGGED ) { mtk_tag[2 ] =0 ; mtk_tag[3 ] =0 ; }
[email protected]
maintainerPATCH 55/306 net: ethernet: mtk-star-emac: fix wrong unmap in RX handling
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Biao Huang <[email protected]>
commit 95b39f07a17faef3a9b225248ba449b976e529c8 upstream.
mtk_star_dma_unmap_rx() should unmap the dma_addr of old skb rather than that of new skb.
Assign new_dma_addr to desc_data.dma_addr after all handling of old skb ends to avoid unexpected receive side error.
--- drivers/net/ethernet/mediatek/mtk_star_emac.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/mediatek/mtk_star_emac.c +3 -2
@@ -1225,8 +1225,6 @@ static int mtk_star_receive_packet(struc goto push_new_skb; } - desc_data.dma_addr = new_dma_addr; -/* We can't fail anymore at this point: it's safe to unmap the skb. */ mtk_star_dma_unmap_rx (priv, &desc_data);
@@ -1236,6 +1234,9 @@ static int mtk_star_receive_packet(struc desc_data.skb->dev = ndev;netif_receive_skb (desc_data.skb); +/* update dma_addr for new skb */ + desc_data.dma_addr = new_dma_addr; + push_new_skb: desc_data.len =skb_tailroom (new_skb); desc_data.skb = new_skb;
[email protected]
maintainerPATCH 56/306 net/mlx4_en: update moderation when config reset
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Kevin(Yudong) Yang <[email protected]>
commit 00ff801bb8ce6711e919af4530b6ffa14a22390a upstream.
This patch fixes a bug that the moderation config will not be applied when calling mlx4_en_reset_config. For example, when turning on rx timestamping, mlx4_en_reset_config() will be called, causing the NIC to forget previous moderation config.
This fix is in phase with a previous fix:
commit 79c54b6bbf06 ("net/mlx4_en: Fix TX moderation info loss after set_ringparam is called")
Tested: Before this patch, on a host with NIC using mlx4, run netserver and stream TCP to the host at full utilization.
$ sar -I SUM 1
INTR intr/s
14:03:56 sum 48758.00After rx hwtstamp is enabled:
$ sar -I SUM 1 14:10:38 sum 317771.00 We see the moderation is not working properly and issued 7x more interrupts.
After the patch, and turned on rx hwtstamp, the rate of interrupts is as expected:
$ sar -I SUM 1 14:52:11 sum 49332.00
--- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 ++ drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +1 -1
@@ -47,7 +47,7 @@#define EN_ETHTOOL_SHORT_MASK cpu_to_be16(0xffff)#define EN_ETHTOOL_WORD_MASK cpu_to_be32(0xffffffff) -static int mlx4_en_moderation_update (struct mlx4_en_priv *priv) +int mlx4_en_moderation_update (struct mlx4_en_priv *priv) {int i, t;int err =0 ;
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +2 -0
@@ -3558,6 +3558,8 @@ int mlx4_en_reset_config(struct net_devien_err (priv,"Failed starting port\n" ); } +if (!err) + err =mlx4_en_moderation_update (priv); out:mutex_unlock (&mdev->state_lock);kfree (tmp);
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +1 -0
@@ -775,6 +775,7 @@ void mlx4_en_ptp_overflow_check(struct m#define DEV_FEATURE_CHANGED (dev, new_features, feature) \ ((dev->features & feature) ^ (new_features & feature)) +int mlx4_en_moderation_update (struct mlx4_en_priv *priv);int mlx4_en_reset_config (struct net_device *dev,struct hwtstamp_config ts_config,netdev_features_t new_features);
[email protected]
maintainerPATCH 57/306 net: stmmac: fix incorrect DMA channel intr enable setting of EQoS v4.10
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Ong Boon Leong <[email protected]>
commit 879c348c35bb5fb758dd881d8a97409c1862dae8 upstream.
We introduce dwmac410_dma_init_channel() here for both EQoS v4.10 and above which use different DMA_CH(n)_Interrupt_Enable bit definitions for NIE and AIE.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +18 -1
@@ -124,6 +124,23 @@ static void dwmac4_dma_init_channel(void ioaddr + DMA_CHAN_INTR_ENA(chan)); } +static void dwmac410_dma_init_channel (void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg,u32 chan) +{ +u32 value; + +/* common channel control register config */ + value =readl (ioaddr +DMA_CHAN_CONTROL (chan)); +if (dma_cfg->pblx8) + value = value |DMA_BUS_MODE_PBL ; + +writel (value, ioaddr +DMA_CHAN_CONTROL (chan)); + +/* Mask interrupts by writing to CSR7 */ +writel (DMA_CHAN_INTR_DEFAULT_MASK_4_10 , + ioaddr +DMA_CHAN_INTR_ENA (chan)); +} +static void dwmac4_dma_init (void __iomem *ioaddr,struct stmmac_dma_cfg *dma_cfg,int atds) {
@@ -523,7 +540,7 @@ const struct stmmac_dma_ops dwmac4_dma_oconst struct stmmac_dma_ops dwmac410_dma_ops = { .reset = dwmac4_dma_reset, .init = dwmac4_dma_init, - .init_chan = dwmac4_dma_init_channel, + .init_chan = dwmac410_dma_init_channel, .init_rx_chan = dwmac4_dma_init_rx_chan, .init_tx_chan = dwmac4_dma_init_tx_chan, .axi = dwmac4_dma_axi,
[email protected]
maintainerPATCH 58/306 nexthop: Do not flush blackhole nexthops when loopback goes down
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Ido Schimmel <[email protected]>
commit 76c03bf8e2624076b88d93542d78e22d5345c88e upstream.
As far as user space is concerned, blackhole nexthops do not have a nexthop device and therefore should not be affected by the administrative or carrier state of any netdev.
However, when the loopback netdev goes down all the blackhole nexthops are flushed. This happens because internally the kernel associates blackhole nexthops with the loopback netdev.
This behavior is both confusing to those not familiar with kernel internals and also diverges from the legacy API where blackhole IPv4 routes are not flushed when the loopback netdev goes down:
# ip route add blackhole 198.51.100.0/24 # ip link set dev lo down # ip route show 198.51.100.0/24 blackhole 198.51.100.0/24
Blackhole IPv6 routes are flushed, but at least user space knows that they are associated with the loopback netdev:
# ip -6 route show 2001:db8:1::/64 blackhole 2001:db8:1::/64 dev lo metric 1024 pref medium
Fix this by only flushing blackhole nexthops when the loopback netdev is unregistered.
--- net/ipv4/nexthop.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
net/ipv4/nexthop.c +7 -3
@@ -1364,7 +1364,7 @@ out:/* rtnl */ /* remove all nexthops tied to a device being deleted */ -static void nexthop_flush_dev (struct net_device *dev) +static void nexthop_flush_dev (struct net_device *dev,unsigned long event) {unsigned int hash =nh_dev_hashfn (dev->ifindex);struct net *net =dev_net (dev);
@@ -1376,6 +1376,10 @@ static void nexthop_flush_dev(struct netif (nhi->fib_nhc.nhc_dev != dev)continue ; +if (nhi->reject_nh && + (event ==NETDEV_DOWN || event ==NETDEV_CHANGE )) +continue ; +remove_nexthop (net, nhi->nh_parent,NULL ); } }
@@ -2122,11 +2126,11 @@ static int nh_netdev_event(struct notifiswitch (event) {case NETDEV_DOWN :case NETDEV_UNREGISTER : -nexthop_flush_dev (dev); +nexthop_flush_dev (dev, event);break ;case NETDEV_CHANGE :if (!(dev_get_flags (dev) & (IFF_RUNNING |IFF_LOWER_UP ))) -nexthop_flush_dev (dev); +nexthop_flush_dev (dev, event);break ;case NETDEV_CHANGEMTU : info_ext = ptr;
[email protected]
maintainerPATCH 59/306 net: sched: avoid duplicates in classes dump
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Maximilian Heyne <[email protected]>
commit bfc2560563586372212b0a8aeca7428975fa91fe upstream.
This is a follow up of commit ea3274695353 ("net: sched: avoid duplicates in qdisc dump") which has fixed the issue only for the qdisc dump.
The duplicate printing also occurs when dumping the classes via
tc class show dev eth0
--- net/sched/sch_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/sched/sch_api.c +4 -4
@@ -2167,7 +2167,7 @@ static int tc_dump_tclass_qdisc(struct Qstatic int tc_dump_tclass_root (struct Qdisc *root,struct sk_buff *skb,struct tcmsg *tcm,struct netlink_callback *cb, -int *t_p,int s_t) +int *t_p,int s_t,bool recur) {struct Qdisc *q;int b;
@@ -2178,7 +2178,7 @@ static int tc_dump_tclass_root(struct Qdif (tc_dump_tclass_qdisc (root, skb, tcm, cb, t_p, s_t) <0 )return -1 ; -if (!qdisc_dev (root)) +if (!qdisc_dev (root) || !recur)return 0 ;if (tcm->tcm_parent) {
@@ -2213,13 +2213,13 @@ static int tc_dump_tclass(struct sk_buff s_t = cb->args[0 ]; t =0 ; -if (tc_dump_tclass_root (dev->qdisc, skb, tcm, cb, &t, s_t) <0 ) +if (tc_dump_tclass_root (dev->qdisc, skb, tcm, cb, &t, s_t, true) <0 ) goto done; dev_queue =dev_ingress_queue (dev);if (dev_queue &&tc_dump_tclass_root (dev_queue->qdisc_sleeping, skb, tcm, cb, - &t, s_t) <0 ) + &t, s_t, false) <0 ) goto done; done:
[email protected]
maintainerPATCH 60/306 net: mscc: ocelot: properly reject destination IP keys in VCAP IS1
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vladimir Oltean <[email protected]>
commit f1becbed411c6fa29d7ce3def3a1dcd4f63f2d74 upstream.
An attempt is made to warn the user about the fact that VCAP IS1 cannot offload keys matching on destination IP (at least given the current half key format), but sadly that warning fails miserably in practice, due to the fact that it operates on an uninitialized "match" variable. We must first decode the keys from the flow rule.
--- drivers/net/ethernet/mscc/ocelot_flower.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mscc/ocelot_flower.c +2 -1
@@ -540,13 +540,14 @@ ocelot_flower_parse_key(struct ocelot *oreturn -EOPNOTSUPP ; } +flow_rule_match_ipv4_addrs (rule, &match); +if (filter->block_id ==VCAP_IS1 && *(u32 *)&match.mask->dst) {NL_SET_ERR_MSG_MOD (extack,"Key type S1_NORMAL cannot match on destination IP" );return -EOPNOTSUPP ; } -flow_rule_match_ipv4_addrs (rule, &match); tmp = &filter->key.ipv4.sip.value.addr[0 ];memcpy (tmp, &match.key->src,4 );
[email protected]
maintainerPATCH 61/306 net: dsa: sja1105: fix SGMII PCS being forced to SPEED_UNKNOWN instead of SPEED_10
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vladimir Oltean <[email protected]>
commit 053d8ad10d585adf9891fcd049637536e2fe9ea7 upstream.
When using MLO_AN_PHY or MLO_AN_FIXED, the MII_BMCR of the SGMII PCS is read before resetting the switch so it can be reprogrammed afterwards. This works for the speeds of 1Gbps and 100Mbps, but not for 10Mbps, because SPEED_10 is actually 0, so AND-ing anything with 0 is false, therefore that last branch is dead code.
Do what others do (genphy_read_status_fixed, phy_mii_ioctl) and just remove the check for SPEED_10, let it fall into the default case.
--- drivers/net/dsa/sja1105/sja1105_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/sja1105/sja1105_main.c +1 -1
@@ -1834,7 +1834,7 @@ out_unlock_ptp: speed =SPEED_1000 ; else if (bmcr & BMCR_SPEED100) speed =SPEED_100 ; - else if (bmcr & BMCR_SPEED10) + else speed =SPEED_10 ;sja1105_sgmii_pcs_force_speed (priv, speed);
[email protected]
maintainerPATCH 62/306 net: usb: qmi_wwan: allow qmimux add/del with master up
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Daniele Palmas <[email protected]>
commit 6c59cff38e66584ae3ac6c2f0cbd8d039c710ba7 upstream.
There's no reason for preventing the creation and removal of qmimux network interfaces when the underlying interface is up.
This makes qmi_wwan mux implementation more similar to the rmnet one, simplifying userspace management of the same logical interfaces.
--- drivers/net/usb/qmi_wwan.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/net/usb/qmi_wwan.c +0 -14
@@ -396,13 +396,6 @@ static ssize_t add_mux_store(struct devi goto err; } -/* we don't want to modify a running netdev */ -if (netif_running (dev->net)) { -netdev_err (dev->net,"Cannot change a running device\n" ); - ret = -EBUSY ; - goto err; - } - ret =qmimux_register_device (dev->net, mux_id);if (!ret) { info->flags |=QMI_WWAN_FLAG_MUX ;
@@ -432,13 +425,6 @@ static ssize_t del_mux_store(struct deviif (!rtnl_trylock ())return restart_syscall (); -/* we don't want to modify a running netdev */ -if (netif_running (dev->net)) { -netdev_err (dev->net,"Cannot change a running device\n" ); - ret = -EBUSY ; - goto err; - } - del_dev =qmimux_find_dev (dev, mux_id);if (!del_dev) {netdev_err (dev->net,"mux_id not present\n" );
[email protected]
maintainerPATCH 63/306 netdevsim: init u64 stats for 32bit hardware
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Hillf Danton <[email protected]>
commit 863a42b289c22df63db62b10fc2c2ffc237e2125 upstream.
Init the u64 stats in order to avoid the lockdep prints on the 32bit hardware like
INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator.
CPU: 0 PID: 4695 Comm: syz-executor.0 Not tainted 5.11.0-rc5-syzkaller #0 Hardware name: ARM-Versatile Express Backtrace: [<826fc5b8>] (dump_backtrace) from [<826fc82c>] (show_stack+0x18/0x1c arch/arm/kernel/traps.c:252) [<826fc814>] (show_stack) from [<8270d1f8>] (__dump_stack lib/dump_stack.c:79 [inline]) [<826fc814>] (show_stack) from [<8270d1f8>] (dump_stack+0xa8/0xc8 lib/dump_stack.c:120) [<8270d150>] (dump_stack) from [<802bf9c0>] (assign_lock_key kernel/locking/lockdep.c:935 [inline]) [<8270d150>] (dump_stack) from [<802bf9c0>] (register_lock_class+0xabc/0xb68 kernel/locking/lockdep.c:1247) [<802bef04>] (register_lock_class) from [<802baa2c>] (__lock_acquire+0x84/0x32d4 kernel/locking/lockdep.c:4711) [<802ba9a8>] (__lock_acquire) from [<802be840>] (lock_acquire.part.0+0xf0/0x554 kernel/locking/lockdep.c:5442) [<802be750>] (lock_acquire.part.0) from [<802bed10>] (lock_acquire+0x6c/0x74 kernel/locking/lockdep.c:5415) [<802beca4>] (lock_acquire) from [<81560548>] (seqcount_lockdep_reader_access include/linux/seqlock.h:103 [inline]) [<802beca4>] (lock_acquire) from [<81560548>] (__u64_stats_fetch_begin include/linux/u64_stats_sync.h:164 [inline]) [<802beca4>] (lock_acquire) from [<81560548>] (u64_stats_fetch_begin include/linux/u64_stats_sync.h:175 [inline]) [<802beca4>] (lock_acquire) from [<81560548>] (nsim_get_stats64+0xdc/0xf0 drivers/net/netdevsim/netdev.c:70) [<8156046c>] (nsim_get_stats64) from [<81e2efa0>] (dev_get_stats+0x44/0xd0 net/core/dev.c:10405) [<81e2ef5c>] (dev_get_stats) from [<81e53204>] (rtnl_fill_stats+0x38/0x120 net/core/rtnetlink.c:1211) [<81e531cc>] (rtnl_fill_stats) from [<81e59d58>] (rtnl_fill_ifinfo+0x6d4/0x148c net/core/rtnetlink.c:1783) [<81e59684>] (rtnl_fill_ifinfo) from [<81e5ceb4>] (rtmsg_ifinfo_build_skb+0x9c/0x108 net/core/rtnetlink.c:3798) [<81e5ce18>] (rtmsg_ifinfo_build_skb) from [<81e5d0ac>] (rtmsg_ifinfo_event net/core/rtnetlink.c:3830 [inline]) [<81e5ce18>] (rtmsg_ifinfo_build_skb) from [<81e5d0ac>] (rtmsg_ifinfo_event net/core/rtnetlink.c:3821 [inline]) [<81e5ce18>] (rtmsg_ifinfo_build_skb) from [<81e5d0ac>] (rtmsg_ifinfo+0x44/0x70 net/core/rtnetlink.c:3839) [<81e5d068>] (rtmsg_ifinfo) from [<81e45c2c>] (register_netdevice+0x664/0x68c net/core/dev.c:10103) [<81e455c8>] (register_netdevice) from [<815608bc>] (nsim_create+0xf8/0x124 drivers/net/netdevsim/netdev.c:317) [<815607c4>] (nsim_create) from [<81561184>] (__nsim_dev_port_add+0x108/0x188 drivers/net/netdevsim/dev.c:941) [<8156107c>] (__nsim_dev_port_add) from [<815620d8>] (nsim_dev_port_add_all drivers/net/netdevsim/dev.c:990 [inline]) [<8156107c>] (__nsim_dev_port_add) from [<815620d8>] (nsim_dev_probe+0x5cc/0x750 drivers/net/netdevsim/dev.c:1119) [<81561b0c>] (nsim_dev_probe) from [<815661dc>] (nsim_bus_probe+0x10/0x14 drivers/net/netdevsim/bus.c:287) [<815661cc>] (nsim_bus_probe) from [<811724c0>] (really_probe+0x100/0x50c drivers/base/dd.c:554) [<811723c0>] (really_probe) from [<811729c4>] (driver_probe_device+0xf8/0x1c8 drivers/base/dd.c:740) [<811728cc>] (driver_probe_device) from [<81172fe4>] (__device_attach_driver+0x8c/0xf0 drivers/base/dd.c:846) [<81172f58>] (__device_attach_driver) from [<8116fee0>] (bus_for_each_drv+0x88/0xd8 drivers/base/bus.c:431) [<8116fe58>] (bus_for_each_drv) from [<81172c6c>] (__device_attach+0xdc/0x1d0 drivers/base/dd.c:914) [<81172b90>] (__device_attach) from [<8117305c>] (device_initial_probe+0x14/0x18 drivers/base/dd.c:961) [<81173048>] (device_initial_probe) from [<81171358>] (bus_probe_device+0x90/0x98 drivers/base/bus.c:491) [<811712c8>] (bus_probe_device) from [<8116e77c>] (device_add+0x320/0x824 drivers/base/core.c:3109) [<8116e45c>] (device_add) from [<8116ec9c>] (device_register+0x1c/0x20 drivers/base/core.c:3182) [<8116ec80>] (device_register) from [<81566710>] (nsim_bus_dev_new drivers/net/netdevsim/bus.c:336 [inline]) [<8116ec80>] (device_register) from [<81566710>] (new_device_store+0x178/0x208 drivers/net/netdevsim/bus.c:215) [<81566598>] (new_device_store) from [<8116fcb4>] (bus_attr_store+0x2c/0x38 drivers/base/bus.c:122) [<8116fc88>] (bus_attr_store) from [<805b4b8c>] (sysfs_kf_write+0x48/0x54 fs/sysfs/file.c:139) [<805b4b44>] (sysfs_kf_write) from [<805b3c90>] (kernfs_fop_write_iter+0x128/0x1ec fs/kernfs/file.c:296) [<805b3b68>] (kernfs_fop_write_iter) from [<804d22fc>] (call_write_iter include/linux/fs.h:1901 [inline]) [<805b3b68>] (kernfs_fop_write_iter) from [<804d22fc>] (new_sync_write fs/read_write.c:518 [inline]) [<805b3b68>] (kernfs_fop_write_iter) from [<804d22fc>] (vfs_write+0x3dc/0x57c fs/read_write.c:605) [<804d1f20>] (vfs_write) from [<804d2604>] (ksys_write+0x68/0xec fs/read_write.c:658) [<804d259c>] (ksys_write) from [<804d2698>] (__do_sys_write fs/read_write.c:670 [inline]) [<804d259c>] (ksys_write) from [<804d2698>] (sys_write+0x10/0x14 fs/read_write.c:667) [<804d2688>] (sys_write) from [<80200060>] (ret_fast_syscall+0x0/0x2c arch/arm/mm/proc-v7.S:64)
--- drivers/net/netdevsim/netdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/netdevsim/netdev.c +1 -0
@@ -296,6 +296,7 @@ nsim_create(struct nsim_dev *nsim_dev, sdev_net_set (dev,nsim_dev_net (nsim_dev)); ns =netdev_priv (dev); ns->netdev = dev; +u64_stats_init (&ns->syncp); ns->nsim_dev = nsim_dev; ns->nsim_dev_port = nsim_dev_port; ns->nsim_bus_dev = nsim_dev->nsim_bus_dev;
[email protected]
maintainerPATCH 64/306 cipso,calipso: resolve a number of problems with the DOI refcounts
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Paul Moore <[email protected]>
commit ad5d07f4a9cd671233ae20983848874731102c08 upstream.
The current CIPSO and CALIPSO refcounting scheme for the DOI definitions is a bit flawed in that we:
1. Don't correctly match gets/puts in netlbl_cipsov4_list().
2. Decrement the refcount on each attempt to remove the DOI from the DOI list, only removing it from the list once the refcount drops to zero.
This patch fixes these problems by adding the missing "puts" to netlbl_cipsov4_list() and introduces a more conventional, i.e. not-buggy, refcounting mechanism to the DOI definitions. Upon the addition of a DOI to the DOI list, it is initialized with a refcount of one, removing a DOI from the list removes it from the list and drops the refcount by one; "gets" and "puts" behave as expected with respect to refcounts, increasing and decreasing the DOI's refcount by one.
--- net/ipv4/cipso_ipv4.c | 11 +---------- net/ipv6/calipso.c | 14 +++++--------- net/netlabel/netlabel_cipso_v4.c | 3 +++ 3 files changed, 9 insertions(+), 19 deletions(-)
net/ipv4/cipso_ipv4.c +1 -10
@@ -519,16 +519,10 @@ int cipso_v4_doi_remove(u32 doi, struct ret_val = -ENOENT ; goto doi_remove_return; } -if (!refcount_dec_and_test (&doi_def->refcount)) { -spin_unlock (&cipso_v4_doi_list_lock); - ret_val = -EBUSY ; - goto doi_remove_return; - }list_del_rcu (&doi_def->list);spin_unlock (&cipso_v4_doi_list_lock); -cipso_v4_cache_invalidate (); -call_rcu (&doi_def->rcu, cipso_v4_doi_free_rcu); +cipso_v4_doi_putdef (doi_def); ret_val =0 ; doi_remove_return:
@@ -585,9 +579,6 @@ void cipso_v4_doi_putdef(struct cipso_v4if (!refcount_dec_and_test (&doi_def->refcount))return ; -spin_lock (&cipso_v4_doi_list_lock); -list_del_rcu (&doi_def->list); -spin_unlock (&cipso_v4_doi_list_lock);cipso_v4_cache_invalidate ();call_rcu (&doi_def->rcu, cipso_v4_doi_free_rcu);
net/ipv6/calipso.c +5 -9
@@ -83,6 +83,9 @@ struct calipso_map_cache_entry {static struct calipso_map_cache_bkt *calipso_cache; +static void calipso_cache_invalidate (void ); +static void calipso_doi_putdef (struct calipso_doi *doi_def); +/* Label Mapping Cache Functions */
@@ -444,15 +447,10 @@ static int calipso_doi_remove(u32 doi, s ret_val = -ENOENT ; goto doi_remove_return; } -if (!refcount_dec_and_test (&doi_def->refcount)) { -spin_unlock (&calipso_doi_list_lock); - ret_val = -EBUSY ; - goto doi_remove_return; - }list_del_rcu (&doi_def->list);spin_unlock (&calipso_doi_list_lock); -call_rcu (&doi_def->rcu, calipso_doi_free_rcu); +calipso_doi_putdef (doi_def); ret_val =0 ; doi_remove_return:
@@ -508,10 +506,8 @@ static void calipso_doi_putdef(struct caif (!refcount_dec_and_test (&doi_def->refcount))return ; -spin_lock (&calipso_doi_list_lock); -list_del_rcu (&doi_def->list); -spin_unlock (&calipso_doi_list_lock); +calipso_cache_invalidate ();call_rcu (&doi_def->rcu, calipso_doi_free_rcu); }
net/netlabel/netlabel_cipso_v4.c +3 -0
@@ -575,6 +575,7 @@ list_start:break ; } +cipso_v4_doi_putdef (doi_def);rcu_read_unlock ();genlmsg_end (ans_skb, data);
@@ -583,12 +584,14 @@ list_start: list_retry:/* XXX - this limit is a guesstimate */ if (nlsze_mult <4 ) { +cipso_v4_doi_putdef (doi_def);rcu_read_unlock ();kfree_skb (ans_skb); nlsze_mult *=2 ; goto list_start; } list_failure_lock: +cipso_v4_doi_putdef (doi_def);rcu_read_unlock (); list_failure:kfree_skb (ans_skb);
[email protected]
maintainerPATCH 65/306 net: stmmac: Fix VLAN filter delete timeout issue in Intel mGBE SGMII
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Ong Boon Leong <[email protected]>
commit 9a7b3950c7e15968e23d83be215e95ccc7c92a53 upstream.
For Intel mGbE controller, MAC VLAN filter delete operation will time-out if serdes power-down sequence happened first during driver remove() with below message.
[82294.764958] intel-eth-pci 0000:00:1e.4 eth2: stmmac_dvr_remove: removing driver [82294.778677] intel-eth-pci 0000:00:1e.4 eth2: Timeout accessing MAC_VLAN_Tag_Filter [82294.779997] intel-eth-pci 0000:00:1e.4 eth2: failed to kill vid 0081/0 [82294.947053] intel-eth-pci 0000:00:1d.2 eth1: stmmac_dvr_remove: removing driver [82295.002091] intel-eth-pci 0000:00:1d.1 eth0: stmmac_dvr_remove: removing driver
Therefore, we delay the serdes power-down to be after unregister_netdev() which triggers the VLAN filter delete.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6 -3
@@ -5144,13 +5144,16 @@ int stmmac_dvr_remove(struct device *devnetdev_info (priv->dev,"%s: removing driver" , __func__);stmmac_stop_all_dma (priv); +stmmac_mac_set (priv, priv->ioaddr, false); +netif_carrier_off (ndev); +unregister_netdev (ndev); +/* Serdes power down needs to happen after VLAN filter +* is deleted that is triggered by unregister_netdev(). +*/ if (priv->plat->serdes_powerdown) priv->plat->serdes_powerdown (ndev, priv->plat->bsp_priv); -stmmac_mac_set (priv, priv->ioaddr, false); -netif_carrier_off (ndev); -unregister_netdev (ndev);#ifdef CONFIG_DEBUG_FS stmmac_exit_fs (ndev);#endif
[email protected]
maintainerPATCH 66/306 stmmac: intel: Fixes clock registration error seen for multiple interfaces
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Wong Vee Khee <[email protected]>
commit 8eb37ab7cc045ec6305a6a1a9c32374695a1a977 upstream.
Issue seen when enumerating multiple Intel mGbE interfaces in EHL.
[ 6.898141] intel-eth-pci 0000:00:1d.2: enabling device (0000 -> 0002) [ 6.900971] intel-eth-pci 0000:00:1d.2: Fail to register stmmac-clk [ 6.906434] intel-eth-pci 0000:00:1d.2: User ID: 0x51, Synopsys ID: 0x52
We fix it by making the clock name to be unique following the format of stmmac-pci_name(pci_dev) so that we can differentiate the clock for these Intel mGbE interfaces in EHL platform as follow:
/sys/kernel/debug/clk/stmmac-0000:00:1d.1
/sys/kernel/debug/clk/stmmac-0000:00:1d.2
/sys/kernel/debug/clk/stmmac-0000:00:1e.4
--- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +4 -1
@@ -233,6 +233,7 @@ static void common_default_data(struct pstatic int intel_mgbe_common_data (struct pci_dev *pdev,struct plat_stmmacenet_data *plat) { +char clk_name[20 ];int ret;int i;
@@ -300,8 +301,10 @@ static int intel_mgbe_common_data(struct plat->eee_usecs_rate = plat->clk_ptp_rate;/* Set system clock */ +sprintf (clk_name,"%s-%s" ,"stmmac" ,pci_name (pdev)); + plat->stmmac_clk =clk_register_fixed_rate (&pdev->dev, -"stmmac-clk" ,NULL ,0 , + clk_name,NULL ,0 , plat->clk_ptp_rate);if (IS_ERR (plat->stmmac_clk)) {
[email protected]
maintainerPATCH 67/306 net: lapbether: Remove netif_start_queue / netif_stop_queue
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Xie He <[email protected]>
commit f7d9d4854519fdf4d45c70a4d953438cd88e7e58 upstream.
For the devices in this driver, the default qdisc is "noqueue", because their "tx_queue_len" is 0.
In function "__dev_queue_xmit" in "net/core/dev.c", devices with the "noqueue" qdisc are specially handled. Packets are transmitted without being queued after a "dev->flags & IFF_UP" check. However, it's possible that even if this check succeeds, "ops->ndo_stop" may still have already been called. This is because in "__dev_close_many", "ops->ndo_stop" is called before clearing the "IFF_UP" flag.
If we call "netif_stop_queue" in "ops->ndo_stop", then it's possible in "__dev_queue_xmit", it sees the "IFF_UP" flag is present, and then it checks "netif_xmit_stopped" and finds that the queue is already stopped. In this case, it will complain that:
"Virtual device ... asks to queue packet!"
To prevent "__dev_queue_xmit" from generating this complaint, we should not call "netif_stop_queue" in "ops->ndo_stop".
We also don't need to call "netif_start_queue" in "ops->ndo_open", because after a netdev is allocated and registered, the "__QUEUE_STATE_DRV_XOFF" flag is initially not set, so there is no need to call "netif_start_queue" to clear it.
--- drivers/net/wan/lapbether.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/wan/lapbether.c +0 -3
@@ -292,7 +292,6 @@ static int lapbeth_open(struct net_devicreturn -ENODEV ; } -netif_start_queue (dev);return 0 ; }
@@ -300,8 +299,6 @@ static int lapbeth_close(struct net_devi {int err; -netif_stop_queue (dev); -if ((err =lapb_unregister (dev)) !=LAPB_OK )pr_err ("lapb_unregister error: %d\n" , err);
[email protected]
maintainerPATCH 68/306 net: davicom: Fix regulator not turned off on failed probe
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Paul Cercueil <[email protected]>
commit ac88c531a5b38877eba2365a3f28f0c8b513dc33 upstream.
When the probe fails or requests to be defered, we must disable the regulator that was previously enabled.
--- drivers/net/ethernet/davicom/dm9000.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/davicom/dm9000.c +9 -3
@@ -1449,7 +1449,7 @@ dm9000_probe(struct platform_device *pdeif (ret) {dev_err (dev,"failed to request reset gpio %d: %d\n" , reset_gpios, ret); -return -ENODEV ; + goto out_regulator_disable; }/* According to manual PWRST# Low Period Min 1ms */
@@ -1461,8 +1461,10 @@ dm9000_probe(struct platform_device *pdeif (!pdata) { pdata =dm9000_parse_dt (&pdev->dev); -if (IS_ERR (pdata)) -return PTR_ERR (pdata); +if (IS_ERR (pdata)) { + ret =PTR_ERR (pdata); + goto out_regulator_disable; + } }/* Init network device */
@@ -1703,6 +1705,10 @@ out:dm9000_release_board (pdev, db);free_netdev (ndev); +out_regulator_disable: +if (!IS_ERR (power)) +regulator_disable (power); +return ret; }
[email protected]
maintainerPATCH 69/306 net: davicom: Fix regulator not turned off on driver removal
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Paul Cercueil <[email protected]>
commit cf9e60aa69ae6c40d3e3e4c94dd6c8de31674e9b upstream.
We must disable the regulator that was enabled in the probe function.
--- drivers/net/ethernet/davicom/dm9000.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/davicom/dm9000.c +8 -1
@@ -133,6 +133,8 @@ struct board_info {u32 wake_state;int ip_summed; + +struct regulator *power_supply; };/* debug code */
@@ -1481,6 +1483,8 @@ dm9000_probe(struct platform_device *pde db->dev = &pdev->dev; db->ndev = ndev; +if (!IS_ERR (power)) + db->power_supply = power;spin_lock_init (&db->lock);mutex_init (&db->addr_lock);
@@ -1766,10 +1770,13 @@ static int dm9000_drv_remove(struct platform_device *pdev) {struct net_device *ndev =platform_get_drvdata (pdev); +struct board_info *dm =to_dm9000_board (ndev);unregister_netdev (ndev); -dm9000_release_board (pdev,netdev_priv (ndev)); +dm9000_release_board (pdev, dm);free_netdev (ndev);/* free device structure */ +if (dm->power_supply) +regulator_disable (dm->power_supply);dev_dbg (&pdev->dev,"released and freed device\n" );return 0 ;
[email protected]
maintainerPATCH 70/306 net: enetc: allow hardware timestamping on TX queues with tc-etf enabled
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Vladimir Oltean <[email protected]>
commit 29d98f54a4fe1b6a9089bec8715a1b89ff9ad59c upstream.
The txtime is passed to the driver in skb->skb_mstamp_ns, which is actually in a union with skb->tstamp (the place where software timestamps are kept).
Since commit b50a5c70ffa4 ("net: allow simultaneous SW and HW transmit timestamping"), __sock_recv_timestamp has some logic for making sure that the two calls to skb_tstamp_tx:
skb_tx_timestamp(skb) # Software timestamp in the driver -> skb_tstamp_tx(skb, NULL)
and
skb_tstamp_tx(skb, &shhwtstamps) # Hardware timestamp in the driver
will both do the right thing and in a race-free manner, meaning that skb_tx_timestamp will deliver a cmsg with the software timestamp only, and skb_tstamp_tx with a non-NULL hwtstamps argument will deliver a cmsg with the hardware timestamp only.
Why are races even possible? Well, because although the software timestamp skb->tstamp is private per skb, the hardware timestamp skb_hwtstamps(skb) lives in skb_shinfo(skb), an area which is shared between skbs and their clones. And skb_tstamp_tx works by cloning the packets when timestamping them, therefore attempting to perform hardware timestamping on an skb's clone will also change the hardware timestamp of the original skb. And the original skb might have been yet again cloned for software timestamping, at an earlier stage.
So the logic in __sock_recv_timestamp can't be as simple as saying "does this skb have a hardware timestamp? if yes I'll send the hardware timestamp to the socket, otherwise I'll send the software timestamp", precisely because the hardware timestamp is shared.
Instead, it's quite the other way around: __sock_recv_timestamp says "does this skb have a software timestamp? if yes, I'll send the software timestamp, otherwise the hardware one". This works because the software timestamp is not shared with clones.
But that means we have a problem when we attempt hardware timestamping with skbs that don't have the skb->tstamp == 0. __sock_recv_timestamp will say "oh, yeah, this must be some sort of odd clone" and will not deliver the hardware timestamp to the socket. And this is exactly what is happening when we have txtime enabled on the socket: as mentioned, that is put in a union with skb->tstamp, so it is quite easy to mistake it.
Do what other drivers do (intel igb/igc) and write zero to skb->tstamp before taking the hardware timestamp. It's of no use to us now (we're already on the TX confirmation path).
--- drivers/net/ethernet/freescale/enetc/enetc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/freescale/enetc/enetc.c +6 -0
@@ -344,6 +344,12 @@ static void enetc_tstamp_tx(struct sk_buif (skb_shinfo (skb)->tx_flags &SKBTX_IN_PROGRESS ) {memset (&shhwtstamps,0 ,sizeof (shhwtstamps)); shhwtstamps.hwtstamp =ns_to_ktime (tstamp); +/* Ensure skb_mstamp_ns, which might have been populated with +* the txtime, is not mistaken for a software timestamp, +* because this will prevent the dispatch of our hardware +* timestamp to the socket. +*/ + skb->tstamp =ktime_set (0 ,0 );skb_tstamp_tx (skb, &shhwtstamps); } }
[email protected]
maintainerPATCH 71/306 net: qrtr: fix error return code of qrtr_sendmsg()
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Jia-Ju Bai <[email protected]>
commit 179d0ba0c454057a65929c46af0d6ad986754781 upstream.
When sock_alloc_send_skb() returns NULL to skb, no error return code of qrtr_sendmsg() is assigned.
To fix this bug, rc is assigned with -ENOMEM in this case.
--- net/qrtr/qrtr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/qrtr/qrtr.c +3 -1
@@ -958,8 +958,10 @@ static int qrtr_sendmsg(struct socket *s plen = (len +3 ) & ~3 ; skb =sock_alloc_send_skb (sk, plen +QRTR_HDR_MAX_SIZE , msg->msg_flags &MSG_DONTWAIT , &rc); -if (!skb) +if (!skb) { + rc = -ENOMEM ; goto out_node; + }skb_reserve (skb,QRTR_HDR_MAX_SIZE );
[email protected]
maintainerPATCH 72/306 s390/qeth: fix memory leak after failed TX Buffer allocation
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Julian Wiedmann <[email protected]>
commit e7a36d27f6b9f389e41d8189a8a08919c6835732 upstream.
When qeth_alloc_qdio_queues() fails to allocate one of the buffers that back an Output Queue, the 'out_freeoutqbufs' path will free all previously allocated buffers for this queue. But it misses to free the half-finished queue struct itself.
Move the buffer allocation into qeth_alloc_output_queue(), and deal with such errors internally.
--- drivers/s390/net/qeth_core_main.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
drivers/s390/net/qeth_core_main.c +17 -18
@@ -2630,15 +2630,28 @@ static void qeth_free_output_queue(strucstatic struct qeth_qdio_out_q *qeth_alloc_output_queue (void ) {struct qeth_qdio_out_q *q =kzalloc (sizeof (*q),GFP_KERNEL ); +unsigned int i;if (!q)return NULL ; -if (qdio_alloc_buffers (q->qdio_bufs,QDIO_MAX_BUFFERS_PER_Q )) { -kfree (q); -return NULL ; +if (qdio_alloc_buffers (q->qdio_bufs,QDIO_MAX_BUFFERS_PER_Q )) + goto err_qdio_bufs; + +for (i =0 ; i <QDIO_MAX_BUFFERS_PER_Q ; i++) { +if (qeth_init_qdio_out_buf (q, i)) + goto err_out_bufs; } +return q; + +err_out_bufs: +while (i >0 ) +kmem_cache_free (qeth_qdio_outbuf_cache, q->bufs[--i]); +qdio_free_buffers (q->qdio_bufs,QDIO_MAX_BUFFERS_PER_Q ); +err_qdio_bufs: +kfree (q); +return NULL ; }static void qeth_tx_completion_timer (struct timer_list *timer)
@@ -2651,7 +2664,7 @@ static void qeth_tx_completion_timer(strstatic int qeth_alloc_qdio_queues (struct qeth_card *card) { -int i, j; +unsigned int i;QETH_CARD_TEXT (card,2 ,"allcqdbf" );
@@ -2685,13 +2698,6 @@ static int qeth_alloc_qdio_queues(struct queue->coalesce_usecs =QETH_TX_COALESCE_USECS ; queue->max_coalesced_frames =QETH_TX_MAX_COALESCED_FRAMES ; queue->priority =QETH_QIB_PQUE_PRIO_DEFAULT ; - -/* give outbound qeth_qdio_buffers their qdio_buffers */ -for (j =0 ; j <QDIO_MAX_BUFFERS_PER_Q ; ++j) { -WARN_ON (queue->bufs[j]); -if (qeth_init_qdio_out_buf (queue, j)) - goto out_freeoutqbufs; - } }/* completion */
@@ -2700,13 +2706,6 @@ static int qeth_alloc_qdio_queues(structreturn 0 ; -out_freeoutqbufs: -while (j >0 ) { - --j; -kmem_cache_free (qeth_qdio_outbuf_cache, - card->qdio.out_qs[i]->bufs[j]); - card->qdio.out_qs[i]->bufs[j] =NULL ; - } out_freeoutq:while (i >0 ) {qeth_free_output_queue (card->qdio.out_qs[--i]);
[email protected]
maintainerPATCH 73/306 s390/qeth: improve completion of pending TX buffers
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Julian Wiedmann <[email protected]>
commit c20383ad1656b0f6354dd50e4acd894f9d94090d upstream.
The current design attaches a pending TX buffer to a custom single-linked list, which is anchored at the buffer's slot on the TX ring. The buffer is then checked for final completion whenever this slot is processed during a subsequent TX NAPI poll cycle.
But if there's insufficient traffic on the ring, we might never make enough progress to get back to this ring slot and discover the pending buffer's final TX completion. In particular if this missing TX completion blocks the application from sending further traffic.
So convert the custom single-linked list code to a per-queue list_head, and scan this list on every TX NAPI cycle.
--- drivers/s390/net/qeth_core.h | 3 + drivers/s390/net/qeth_core_main.c | 69 +++++++++++++++----------------------- 2 files changed, 30 insertions(+), 42 deletions(-)
drivers/s390/net/qeth_core.h +2 -1
@@ -436,7 +436,7 @@ struct qeth_qdio_out_buffer {int is_header[QDIO_MAX_ELEMENTS_PER_BUFFER ];struct qeth_qdio_out_q *q; -struct qeth_qdio_out_buffer *next_pending; +struct list_head list_entry; };struct qeth_card ;
@@ -500,6 +500,7 @@ struct qeth_qdio_out_q {struct qdio_buffer *qdio_bufs[QDIO_MAX_BUFFERS_PER_Q ];struct qeth_qdio_out_buffer *bufs[QDIO_MAX_BUFFERS_PER_Q ];struct qdio_outbuf_state *bufstates;/* convenience pointer */ +struct list_head pending_bufs;struct qeth_out_q_stats stats;spinlock_t lock;unsigned int priority;
drivers/s390/net/qeth_core_main.c +28 -41
130 lines not on this page · raw message
[email protected]
maintainerPATCH 74/306 s390/qeth: schedule TX NAPI on QAOB completion
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Julian Wiedmann <[email protected]>
commit 3e83d467a08e25b27c44c885f511624a71c84f7c upstream.
When a QAOB notifies us that a pending TX buffer has been delivered, the actual TX completion processing by qeth_tx_complete_pending_bufs() is done within the context of a TX NAPI instance. We shouldn't rely on this instance being scheduled by some other TX event, but just do it ourselves.
qeth_qdio_handle_aob() is called from qeth_poll(), ie. our main NAPI instance. To avoid touching the TX queue's NAPI instance before/after it is (un-)registered, reorder the code in qeth_open() and qeth_stop() accordingly.
--- drivers/s390/net/qeth_core_main.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/s390/net/qeth_core_main.c +12 -6
@@ -470,6 +470,7 @@ static void qeth_qdio_handle_aob(structstruct qaob *aob;struct qeth_qdio_out_buffer *buffer;enum iucv_tx_notify notification; +struct qeth_qdio_out_q *queue;unsigned int i; aob = (struct qaob *)phys_to_virt (phys_aob_addr);
@@ -512,7 +513,9 @@ static void qeth_qdio_handle_aob(struct buffer->is_header[i] =0 ; } + queue = buffer->q;atomic_set (&buffer->state,QETH_QDIO_BUF_EMPTY ); +napi_schedule (&queue->napi);break ;default :WARN_ON_ONCE (1 );
@@ -7225,9 +7228,7 @@ int qeth_open(struct net_device *dev) card->data.state =CH_STATE_UP ;netif_tx_start_all_queues (dev); -napi_enable (&card->napi);local_bh_disable (); -napi_schedule (&card->napi);if (IS_IQD (card)) {struct qeth_qdio_out_q *queue;unsigned int i;
@@ -7239,8 +7240,12 @@ int qeth_open(struct net_device *dev)napi_schedule (&queue->napi); } } + +napi_enable (&card->napi); +napi_schedule (&card->napi);/* kick-start the NAPI softirq: */ local_bh_enable (); +return 0 ; }EXPORT_SYMBOL_GPL (qeth_open);
@@ -7250,6 +7255,11 @@ int qeth_stop(struct net_device *dev)struct qeth_card *card = dev->ml_priv;QETH_CARD_TEXT (card,4 ,"qethstop" ); + +napi_disable (&card->napi); +cancel_delayed_work_sync (&card->buffer_reclaim_work); +qdio_stop_irq (CARD_DDEV (card)); +if (IS_IQD (card)) {struct qeth_qdio_out_q *queue;unsigned int i;
@@ -7270,10 +7280,6 @@ int qeth_stop(struct net_device *dev)netif_tx_disable (dev); } -napi_disable (&card->napi); -cancel_delayed_work_sync (&card->buffer_reclaim_work); -qdio_stop_irq (CARD_DDEV (card)); -return 0 ; }EXPORT_SYMBOL_GPL (qeth_stop);
[email protected]
maintainerPATCH 75/306 s390/qeth: fix notification for pending buffers during teardown
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Julian Wiedmann <[email protected]>
commit 7eefda7f353ef86ad82a2dc8329e8a3538c08ab6 upstream.
The cited commit reworked the state machine for pending TX buffers. In qeth_iqd_tx_complete() it turned PENDING into a transient state, and uses NEED_QAOB for buffers that get parked while waiting for their QAOB completion.
But it missed to adjust the check in qeth_tx_complete_buf(). So if qeth_tx_complete_pending_bufs() is called during teardown to drain the parked TX buffers, we no longer raise a notification for af_iucv.
Instead of updating the checked state, just move this code into qeth_tx_complete_pending_bufs() itself. This also gets rid of the special-case in the common TX completion path.
--- drivers/s390/net/qeth_core_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/s390/net/qeth_core_main.c +3 -3
@@ -1386,9 +1386,6 @@ static void qeth_tx_complete_buf(structstruct qeth_qdio_out_q *queue = buf->q;struct sk_buff *skb; -if (atomic_read (&buf->state) ==QETH_QDIO_BUF_PENDING ) -qeth_notify_skbs (queue, buf,TX_NOTIFY_GENERALERROR ); -/* Empty buffer? */ if (buf->next_element_to_fill ==0 )return ;
@@ -1461,6 +1458,9 @@ static void qeth_tx_complete_pending_bufQETH_CARD_TEXT (card,5 ,"fp" );QETH_CARD_TEXT_ (card,5 ,"%lx" , (long ) buf); +if (drain) +qeth_notify_skbs (queue, buf, +TX_NOTIFY_GENERALERROR );qeth_tx_complete_buf (buf, drain,0 );list_del (&buf->list_entry);
[email protected]
maintainerPATCH 76/306 r8169: fix r8168fp_adjust_ocp_cmd function
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Hayes Wang <[email protected]>
commit abbf9a0ef8848dca58c5b97750c1c59bbee45637 upstream.
The (0xBAF70000 & 0x00FFF000) << 6 should be (0xf70 << 18).
--- drivers/net/ethernet/realtek/r8169_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +1 -1
@@ -1013,7 +1013,7 @@ static void r8168fp_adjust_ocp_cmd(struc {/* based on RTL8168FP_OOBMAC_BASE in vendor driver */ if (tp->mac_version ==RTL_GIGA_MAC_VER_52 && type ==ERIAR_OOB ) - *cmd |=0x7f0 <<18 ; + *cmd |=0xf70 <<18 ; }DECLARE_RTL_COND (rtl_eriar_cond)
[email protected]
maintainerPATCH 77/306 ixgbe: fail to create xfrm offload of IPsec tunnel mode SA
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Antony Antony <[email protected]>
commit d785e1fec60179f534fbe8d006c890e5ad186e51 upstream.
Based on talks and indirect references ixgbe IPsec offlod do not support IPsec tunnel mode offload. It can only support IPsec transport mode offload. Now explicitly fail when creating non transport mode SA with offload to avoid false performance expectations.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 5 +++++ drivers/net/ethernet/intel/ixgbevf/ipsec.c | 5 +++++ 2 files changed, 10 insertions(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +5 -0
@@ -575,6 +575,11 @@ static int ixgbe_ipsec_add_sa(struct xfrreturn -EINVAL ; } +if (xs->props.mode !=XFRM_MODE_TRANSPORT ) { +netdev_err (dev,"Unsupported mode for ipsec offload\n" ); +return -EINVAL ; + } +if (ixgbe_ipsec_check_mgmt_ip (xs)) {netdev_err (dev,"IPsec IP addr clash with mgmt filters\n" );return -EINVAL ;
drivers/net/ethernet/intel/ixgbevf/ipsec.c +5 -0
@@ -272,6 +272,11 @@ static int ixgbevf_ipsec_add_sa(struct xreturn -EINVAL ; } +if (xs->props.mode !=XFRM_MODE_TRANSPORT ) { +netdev_err (dev,"Unsupported mode for ipsec offload\n" ); +return -EINVAL ; + } +if (xs->xso.flags &XFRM_OFFLOAD_INBOUND ) {struct rx_sa rsa;
[email protected]
maintainerPATCH 78/306 tools/resolve_btfids: Fix build error with older host toolchains
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Kun-Chuan Hsieh <[email protected]>
commit 41462c6e730ca0e63f5fed5a517052385d980c54 upstream.
Older libelf.h and glibc elf.h might not yet define the ELF compression types.
Checking and defining SHF_COMPRESSED fix the build error when compiling with older toolchains. Also, the tool resolve_btfids is compiled with host toolchain. The host toolchain is more likely to be older than the cross compile toolchain.
--- tools/bpf/resolve_btfids/main.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/bpf/resolve_btfids/main.c +5 -0
@@ -260,6 +260,11 @@ static struct btf_id *add_symbol(structreturn btf_id__add (root, id, false); } +/* Older libelf.h and glibc elf.h might not yet define the ELF compression types. */ +#ifndef SHF_COMPRESSED +#define SHF_COMPRESSED (1 << 11)/* Section with compressed data. */ +#endif +/* * The data of compressed section should be aligned to 4 * (for 32bit) or 8 (for 64 bit) bytes. The binutils ld
[email protected]
maintainerPATCH 79/306 perf build: Fix ccache usage in $(CC) when generating arch errno table
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Antonio Terceiro <[email protected]>
commit dacfc08dcafa7d443ab339592999e37bbb8a3ef0 upstream.
This was introduced by commit e4ffd066ff440a57 ("perf: Normalize gcc parameter when generating arch errno table").
Assuming the first word of $(CC) is the actual compiler breaks usage like CC="ccache gcc": the script ends up calling ccache directly with gcc arguments, what fails. Instead of getting the first word, just remove from $(CC) any word that starts with a "-". This maintains the spirit of the original patch, while not breaking ccache users.
--- tools/perf/Makefile.perf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
@@ -600,7 +600,7 @@ arch_errno_hdr_dir := $(srctree)/tools arch_errno_tbl := $(srctree)/tools/perf/trace/beauty/arch_errno_names.sh $(arch_errno_name_array): $(arch_errno_tbl) - $(Q)$(SHELL) '$(arch_errno_tbl)' $(firstword $(CC)) $(arch_errno_hdr_dir) > $@ + $(Q)$(SHELL) '$(arch_errno_tbl)' '$(patsubst -%,,$(CC))' $(arch_errno_hdr_dir) > $@ sync_file_range_arrays := $(beauty_outdir)/sync_file_range_arrays.c sync_file_range_tbls := $(srctree)/tools/perf/trace/beauty/sync_file_range.sh
[email protected]
maintainerPATCH 80/306 net: stmmac: stop each tx channel independently
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Joakim Zhang <[email protected]>
commit a3e860a83397bf761ec1128a3f0ba186445992c6 upstream.
If clear GMAC_CONFIG_TE bit, it would stop all tx channels, but users may only want to stop specific tx channel.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +0 -4
@@ -53,10 +53,6 @@ void dwmac4_dma_stop_tx(void __iomem *io value &= ~DMA_CONTROL_ST ;writel (value, ioaddr +DMA_CHAN_TX_CONTROL (chan)); - - value =readl (ioaddr +GMAC_CONFIG ); - value &= ~GMAC_CONFIG_TE ; -writel (value, ioaddr +GMAC_CONFIG ); }void dwmac4_dma_start_rx (void __iomem *ioaddr,u32 chan)
[email protected]
maintainerPATCH 81/306 net: stmmac: fix watchdog timeout during suspend/resume stress test
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Joakim Zhang <[email protected]>
commit c511819d138de38e1637eedb645c207e09680d0f upstream.
stmmac_xmit() call stmmac_tx_timer_arm() at the end to modify tx timer to do the transmission cleanup work. Imagine such a situation, stmmac enters suspend immediately after tx timer modified, it's expire callback stmmac_tx_clean() would not be invoked. This could affect BQL, since netdev_tx_sent_queue() has been called, but netdev_tx_completed_queue() have not been involved, as a result, dql_avail(&dev_queue->dql) finally always return a negative value.
__dev_queue_xmit->__dev_xmit_skb->qdisc_run->__qdisc_run->qdisc_restart->dequeue_skb:
if ((q->flags & TCQ_F_ONETXQUEUE) && netif_xmit_frozen_or_stopped(txq)) // __QUEUE_STATE_STACK_XOFF is set
Net core will stop transmitting any more. Finillay, net watchdong would timeout. To fix this issue, we should call netdev_tx_reset_queue() in stmmac_resume().
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -0
@@ -5260,6 +5260,8 @@ static void stmmac_reset_queues_param(st tx_q->cur_tx =0 ; tx_q->dirty_tx =0 ; tx_q->mss =0 ; + +netdev_tx_reset_queue (netdev_get_tx_queue (priv->dev, queue)); } }
[email protected]
maintainerPATCH 82/306 net: stmmac: fix wrongly set buffer2 valid when sph unsupport
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Joakim Zhang <[email protected]>
commit 396e13e11577b614db77db0bbb6fca935b94eb1b upstream.
In current driver, buffer2 available only when hardware supports split header. Wrongly set buffer2 valid in stmmac_rx_refill when refill buffer address. You can see that desc3 is 0x81000000 after initialization, but turn out to be 0x83000000 after refill.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 9 +++++++-- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 2 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++++-- 4 files changed, 15 insertions(+), 6 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +7 -2
@@ -499,10 +499,15 @@ static void dwmac4_get_rx_header_len(str *len =le32_to_cpu (p->des2) &RDES2_HL ; } -static void dwmac4_set_sec_addr (struct dma_desc *p,dma_addr_t addr) +static void dwmac4_set_sec_addr (struct dma_desc *p,dma_addr_t addr,bool buf2_valid) { p->des2 =cpu_to_le32 (lower_32_bits (addr)); - p->des3 =cpu_to_le32 (upper_32_bits (addr) |RDES3_BUFFER2_VALID_ADDR ); + p->des3 =cpu_to_le32 (upper_32_bits (addr)); + +if (buf2_valid) + p->des3 |=cpu_to_le32 (RDES3_BUFFER2_VALID_ADDR ); +else + p->des3 &=cpu_to_le32 (~RDES3_BUFFER2_VALID_ADDR ); }static void dwmac4_set_tbs (struct dma_edesc *p,u32 sec,u32 nsec)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +1 -1
@@ -292,7 +292,7 @@ static void dwxgmac2_get_rx_header_len(s *len =le32_to_cpu (p->des2) &XGMAC_RDES2_HL ; } -static void dwxgmac2_set_sec_addr (struct dma_desc *p,dma_addr_t addr) +static void dwxgmac2_set_sec_addr (struct dma_desc *p,dma_addr_t addr,bool is_valid) { p->des2 =cpu_to_le32 (lower_32_bits (addr)); p->des3 =cpu_to_le32 (upper_32_bits (addr));
drivers/net/ethernet/stmicro/stmmac/hwif.h +1 -1
@@ -91,7 +91,7 @@ struct stmmac_desc_ops {int (*get_rx_hash)(struct dma_desc *p,u32 *hash,enum pkt_hash_types *type);void (*get_rx_header_len)(struct dma_desc *p,unsigned int *len); -void (*set_sec_addr)(struct dma_desc *p,dma_addr_t addr); +void (*set_sec_addr)(struct dma_desc *p,dma_addr_t addr,bool buf2_valid);void (*set_sarc)(struct dma_desc *p,u32 sarc_type);void (*set_vlan_tag)(struct dma_desc *p,u16 tag,u16 inner_tag,u32 inner_type);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6 -2
@@ -1303,9 +1303,10 @@ static int stmmac_init_rx_buffers(structreturn -ENOMEM ; buf->sec_addr =page_pool_get_dma_addr (buf->sec_page); -stmmac_set_desc_sec_addr (priv, p, buf->sec_addr); +stmmac_set_desc_sec_addr (priv, p, buf->sec_addr, true); }else { buf->sec_page =NULL ; +stmmac_set_desc_sec_addr (priv, p, buf->sec_addr, false); } buf->addr =page_pool_get_dma_addr (buf->page);
@@ -3648,7 +3649,10 @@ static inline void stmmac_rx_refill(stru DMA_FROM_DEVICE);stmmac_set_desc_addr (priv, p, buf->addr); -stmmac_set_desc_sec_addr (priv, p, buf->sec_addr); +if (priv->sph) +stmmac_set_desc_sec_addr (priv, p, buf->sec_addr, true); +else +stmmac_set_desc_sec_addr (priv, p, buf->sec_addr, false);stmmac_refill_desc3 (priv, rx_q, p); rx_q->rx_count_frames++;
[email protected]
maintainerPATCH 83/306 ethtool: fix the check logic of at least one channel for RX/TX
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Yinjun Zhang <[email protected]>
commit a4fc088ad4ff4a99d01978aa41065132b574b4b2 upstream.
The command "ethtool -L <intf> combined 0" may clean the RX/TX channel count and skip the error path, since the attrs tb[ETHTOOL_A_CHANNELS_RX_COUNT] and tb[ETHTOOL_A_CHANNELS_TX_COUNT] are NULL in this case when recent ethtool is used.
Tested using ethtool v5.10.
--- net/ethtool/channels.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
net/ethtool/channels.c +13 -13
@@ -116,10 +116,9 @@ int ethnl_set_channels(struct sk_buff *sstruct ethtool_channels channels = {};struct ethnl_req_info req_info = {};struct nlattr **tb = info->attrs; -const struct nlattr *err_attr; +u32 err_attr, max_rx_in_use =0 ;const struct ethtool_ops *ops;struct net_device *dev; -u32 max_rx_in_use =0 ;int ret; ret = ethnl_parse_header_dev_get(&req_info,
@@ -157,34 +156,35 @@ int ethnl_set_channels(struct sk_buff *s/* ensure new channel counts are within limits */ if (channels.rx_count > channels.max_rx) - err_attr = tb[ETHTOOL_A_CHANNELS_RX_COUNT ]; + err_attr =ETHTOOL_A_CHANNELS_RX_COUNT ;else if (channels.tx_count > channels.max_tx) - err_attr = tb[ETHTOOL_A_CHANNELS_TX_COUNT ]; + err_attr =ETHTOOL_A_CHANNELS_TX_COUNT ;else if (channels.other_count > channels.max_other) - err_attr = tb[ETHTOOL_A_CHANNELS_OTHER_COUNT ]; + err_attr =ETHTOOL_A_CHANNELS_OTHER_COUNT ;else if (channels.combined_count > channels.max_combined) - err_attr = tb[ETHTOOL_A_CHANNELS_COMBINED_COUNT ]; + err_attr =ETHTOOL_A_CHANNELS_COMBINED_COUNT ;else - err_attr =NULL ; + err_attr =0 ;if (err_attr) { ret = -EINVAL ; -NL_SET_ERR_MSG_ATTR (info->extack, err_attr, +NL_SET_ERR_MSG_ATTR (info->extack, tb[err_attr],"requested channel count exceeds maximum" ); goto out_ops; }/* ensure there is at least one RX and one TX channel */ if (!channels.combined_count && !channels.rx_count) - err_attr = tb[ETHTOOL_A_CHANNELS_RX_COUNT ]; + err_attr =ETHTOOL_A_CHANNELS_RX_COUNT ;else if (!channels.combined_count && !channels.tx_count) - err_attr = tb[ETHTOOL_A_CHANNELS_TX_COUNT ]; + err_attr =ETHTOOL_A_CHANNELS_TX_COUNT ;else - err_attr =NULL ; + err_attr =0 ;if (err_attr) {if (mod_combined) - err_attr = tb[ETHTOOL_A_CHANNELS_COMBINED_COUNT ]; + err_attr =ETHTOOL_A_CHANNELS_COMBINED_COUNT ; ret = -EINVAL ; -NL_SET_ERR_MSG_ATTR (info->extack, err_attr,"requested channel counts would result in no RX or TX channel being configured" ); +NL_SET_ERR_MSG_ATTR (info->extack, tb[err_attr], +"requested channel counts would result in no RX or TX channel being configured" ); goto out_ops; }
[email protected]
maintainerPATCH 84/306 net: phy: make mdio_bus_phy_suspend/resume as __maybe_unused
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Arnd Bergmann <[email protected]>
commit 7f654157f0aefba04cd7f6297351c87b76b47b89 upstream.
When CONFIG_PM_SLEEP is disabled, the compiler warns about unused functions:
drivers/net/phy/phy_device.c:273:12: error: unused function 'mdio_bus_phy_suspend' [-Werror,-Wunused-function] static int mdio_bus_phy_suspend(struct device *dev)drivers/net/phy/phy_device.c:293:12: error: unused function 'mdio_bus_phy_resume' [-Werror,-Wunused-function] static int mdio_bus_phy_resume(struct device *dev)
The logic is intentional, so just mark these two as __maybe_unused and remove the incorrect #ifdef.
--- drivers/net/phy/phy_device.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/phy/phy_device.c +2 -4
@@ -230,7 +230,6 @@ static struct phy_driver genphy_driver;static LIST_HEAD (phy_fixup_list);static DEFINE_MUTEX (phy_fixup_lock); -#ifdef CONFIG_PM static bool mdio_bus_phy_may_suspend (struct phy_device *phydev) {struct device_driver *drv = phydev->mdio.dev.driver;
@@ -270,7 +269,7 @@ out:return !phydev->suspended; } -static int mdio_bus_phy_suspend (struct device *dev) +static __maybe_unused int mdio_bus_phy_suspend (struct device *dev) {struct phy_device *phydev =to_phy_device (dev);
@@ -290,7 +289,7 @@ static int mdio_bus_phy_suspend(struct dreturn phy_suspend (phydev); } -static int mdio_bus_phy_resume (struct device *dev) +static __maybe_unused int mdio_bus_phy_resume (struct device *dev) {struct phy_device *phydev =to_phy_device (dev);int ret;
@@ -316,7 +315,6 @@ no_resume: static SIMPLE_DEV_PM_OPS(mdio_bus_phy_pm_ops, mdio_bus_phy_suspend, mdio_bus_phy_resume); -#endif /* CONFIG_PM */ /** * phy_register_fixup - creates a new phy_fixup and adds it to the list
[email protected]
maintainerPATCH 85/306 selftests: forwarding: Fix race condition in mirror installation
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Danielle Ratson <[email protected]>
commit edcbf5137f093b5502f5f6b97cce3cbadbde27aa upstream.
When mirroring to a gretap in hardware the device expects to be programmed with the egress port and all the encapsulating headers. This requires the driver to resolve the path the packet will take in the software data path and program the device accordingly.
If the path cannot be resolved (in this case because of an unresolved neighbor), then mirror installation fails until the path is resolved. This results in a race that causes the test to sometimes fail.
Fix this by setting the neighbor's state to permanent, so that it is always valid.
--- tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh +9 -0
@@ -86,11 +86,20 @@ test_ip6gretap() test_gretap_stp() { + # Sometimes after mirror installation, the neighbor's state is not valid. + # The reason is that there is no SW datapath activity related to the + # neighbor for the remote GRE address. Therefore whether the corresponding + # neighbor will be valid is a matter of luck, and the test is thus racy. + # Set the neighbor's state to permanent, so it would be always valid. + ip neigh replace 192.0.2.130 lladdr $(mac_get $h3) \ + nud permanent dev br2 full_test_span_gre_stp gt4 $swp3.555 "mirror to gretap" } test_ip6gretap_stp() { + ip neigh replace 2001:db8:2::2 lladdr $(mac_get $h3) \ + nud permanent dev br2 full_test_span_gre_stp gt6 $swp3.555 "mirror to ip6gretap" }
[email protected]
maintainerPATCH 86/306 mlxsw: spectrum_ethtool: Add an external speed to PTYS register
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Danielle Ratson <[email protected]>
commit ae9b24ddb69b4e31cda1b5e267a5a08a1db11717 upstream.
Currently, only external bits are added to the PTYS register, whereas there is one external bit that is wrongly marked as internal, and so was recently removed from the register.
Add that bit to the PTYS register again, as this bit is no longer internal.
Its removal resulted in '100000baseLR4_ER4/Full' link mode no longer being supported, causing a regression on some setups.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 1 + drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 5 +++++ drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/reg.h +1 -0
@@ -4430,6 +4430,7 @@ MLXSW_ITEM32(reg, ptys, ext_eth_proto_ca#define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_CR4 BIT(20)#define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_SR4 BIT(21)#define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4 BIT(22) +#define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4 BIT(23)#define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_CR BIT(27)#define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_KR BIT(28)#define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_SR BIT(29)
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +5 -0
@@ -1171,6 +1171,11 @@ static const struct mlxsw_sp1_port_link_ .mask_ethtool = ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT, .speed = SPEED_100000, }, + { + .mask = MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4, + .mask_ethtool = ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT, + .speed = SPEED_100000, + }, };#define MLXSW_SP1_PORT_LINK_MODE_LEN ARRAY_SIZE(mlxsw_sp1_port_link_mode)
drivers/net/ethernet/mellanox/mlxsw/switchx2.c +2 -1
@@ -613,7 +613,8 @@ static const struct mlxsw_sx_port_link_m { .mask = MLXSW_REG_PTYS_ETH_SPEED_100GBASE_CR4 | MLXSW_REG_PTYS_ETH_SPEED_100GBASE_SR4 | - MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4, + MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4 | + MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4, .speed = 100000, }, };
[email protected]
maintainerPATCH 87/306 perf traceevent: Ensure read cmdlines are null terminated.
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Ian Rogers <[email protected]>
commit 137a5258939aca56558f3a23eb229b9c4b293917 upstream.
Issue detected by address sanitizer.
--- tools/perf/util/trace-event-read.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/trace-event-read.c +1 -0
@@ -361,6 +361,7 @@ static int read_saved_cmdline(struct teppr_debug ("error reading saved cmdlines\n" ); goto out; } + buf[ret] ='\0' ;parse_saved_cmdline (pevent, buf, size); ret =0 ;
[email protected]
maintainerPATCH 88/306 perf report: Fix -F for branch & mem modes
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Ravi Bangoria <[email protected]>
commit 6740a4e70e5d1b9d8e7fe41fd46dd5656d65dadf upstream.
perf report fails to add valid additional fields with -F when used with branch or mem modes. Fix it.
Before patch:
$ perf record -b $ perf report -b -F +srcline_from --stdio Error: Invalid --fields key: `srcline_from'
After patch:
$ perf report -b -F +srcline_from --stdio # Samples: 8K of event 'cycles' # Event count (approx.): 8784 ...
Committer notes:
There was an inversion: when looking at branch stack dimensions (keys) it was checking if the sort mode was 'mem', not 'branch'.
--- tools/perf/util/sort.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/sort.c +2 -2
@@ -3033,7 +3033,7 @@ int output_field_add(struct perf_hpp_lisif (strncasecmp (tok, sd->name,strlen (tok)))continue ; -if (sort__mode !=SORT_MODE__MEMORY ) +if (sort__mode !=SORT_MODE__BRANCH )return -EINVAL ;return __sort_dimension__add_output (list, sd);
@@ -3045,7 +3045,7 @@ int output_field_add(struct perf_hpp_lisif (strncasecmp (tok, sd->name,strlen (tok)))continue ; -if (sort__mode !=SORT_MODE__BRANCH ) +if (sort__mode !=SORT_MODE__MEMORY )return -EINVAL ;return __sort_dimension__add_output (list, sd);
[email protected]
maintainerPATCH 89/306 net: hns3: fix error mask definition of flow director
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Jian Shen <[email protected]>
commit ae85ddda0f1b341b2d25f5a5e0eff1d42b6ef3df upstream.
Currently, some bit filed definitions of flow director TCAM configuration command are incorrect. Since the wrong MSB is always 0, and these fields are assgined in order, so it still works.
Fix it by redefine them.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +3 -3
@@ -1048,16 +1048,16 @@ struct hclge_fd_tcam_config_3_cmd {#define HCLGE_FD_AD_DROP_B 0#define HCLGE_FD_AD_DIRECT_QID_B 1#define HCLGE_FD_AD_QID_S 2 -#define HCLGE_FD_AD_QID_M GENMASK(12, 2) +#define HCLGE_FD_AD_QID_M GENMASK(11, 2)#define HCLGE_FD_AD_USE_COUNTER_B 12#define HCLGE_FD_AD_COUNTER_NUM_S 13#define HCLGE_FD_AD_COUNTER_NUM_M GENMASK(20, 13)#define HCLGE_FD_AD_NXT_STEP_B 20#define HCLGE_FD_AD_NXT_KEY_S 21 -#define HCLGE_FD_AD_NXT_KEY_M GENMASK(26, 21) +#define HCLGE_FD_AD_NXT_KEY_M GENMASK(25, 21)#define HCLGE_FD_AD_WR_RULE_ID_B 0#define HCLGE_FD_AD_RULE_ID_S 1 -#define HCLGE_FD_AD_RULE_ID_M GENMASK(13, 1) +#define HCLGE_FD_AD_RULE_ID_M GENMASK(12, 1)#define HCLGE_FD_AD_TC_OVRD_B 16#define HCLGE_FD_AD_TC_SIZE_S 17#define HCLGE_FD_AD_TC_SIZE_M GENMASK(20, 17)
[email protected]
maintainerPATCH 90/306 net: hns3: fix query vlan mask value error for flow director
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Jian Shen <[email protected]>
commit c75ec148a316e8cf52274d16b9b422703b96f5ce upstream.
Currently, the driver returns VLAN_VID_MASK for vlan mask field, when get flow director rule information for rule doesn't use vlan. It may cause the vlan mask value display as 0xf000 in this case, like below:
estuary:/$ ethtool -u eth1 50 RX rings available Total 1 rules
Filter: 2
Rule Type: TCP over IPv4
Src IP addr: 0.0.0.0 mask: 255.255.255.255
Dest IP addr: 0.0.0.0 mask: 255.255.255.255
TOS: 0x0 mask: 0xff
Src port: 0 mask: 0xffff
Dest port: 0 mask: 0xffff
VLAN EtherType: 0x0 mask: 0xffff
VLAN: 0x0 mask: 0xf000
User-defined: 0x1234 mask: 0x0
Action: Direct to queue 3
Fix it by return 0.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +1 -2
@@ -6283,8 +6283,7 @@ static void hclge_fd_get_ext_info(struct fs->h_ext.vlan_tci =cpu_to_be16 (rule->tuples.vlan_tag1); fs->m_ext.vlan_tci = rule->unused_tuple &BIT (INNER_VLAN_TAG_FST ) ? -cpu_to_be16 (VLAN_VID_MASK ) : -cpu_to_be16 (rule->tuples_mask.vlan_tag1); +0 :cpu_to_be16 (rule->tuples_mask.vlan_tag1); }if (fs->flow_type &FLOW_MAC_EXT ) {
[email protected]
maintainerPATCH 91/306 net: hns3: fix bug when calculating the TCAM table info
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Jian Shen <[email protected]>
commit b36fc875bcdee56865c444a2cdae17d354a6d5f5 upstream.
The function hclge_fd_convert_tuple() is used to convert tuples and tuples mask to TCAM x and y. But it misuses the source mac as source mac mask when convert INNER_SRC_MAC, which may cause the flow director rule works unexpectedly. So fix it.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +2 -2
@@ -5194,9 +5194,9 @@ static bool hclge_fd_convert_tuple(u32 tcase BIT (INNER_SRC_MAC ):for (i =0 ; i <ETH_ALEN ; i++) {calc_x (key_x[ETH_ALEN -1 - i], rule->tuples.src_mac[i], - rule->tuples.src_mac[i]); + rule->tuples_mask.src_mac[i]);calc_y (key_y[ETH_ALEN -1 - i], rule->tuples.src_mac[i], - rule->tuples.src_mac[i]); + rule->tuples_mask.src_mac[i]); }return true;
[email protected]
maintainerPATCH 92/306 s390/cio: return -EFAULT if copy_to_user() fails again
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Wang Qing <[email protected]>
commit 51c44babdc19aaf882e1213325a0ba291573308f upstream.
The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete.
--- drivers/s390/cio/vfio_ccw_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/cio/vfio_ccw_ops.c +2 -2
@@ -543,7 +543,7 @@ static ssize_t vfio_ccw_mdev_ioctl(strucif (ret)return ret; -return copy_to_user ((void __user *)arg, &info, minsz); +return copy_to_user ((void __user *)arg, &info, minsz) ? -EFAULT :0 ; }case VFIO_DEVICE_GET_REGION_INFO : {
@@ -561,7 +561,7 @@ static ssize_t vfio_ccw_mdev_ioctl(strucif (ret)return ret; -return copy_to_user ((void __user *)arg, &info, minsz); +return copy_to_user ((void __user *)arg, &info, minsz) ? -EFAULT :0 ; }case VFIO_DEVICE_GET_IRQ_INFO : {
[email protected]
maintainerPATCH 93/306 bnxt_en: reliably allocate IRQ table on reset to avoid crash
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Edwin Peer <[email protected]>
commit 20d7d1c5c9b11e9f538ed4a2289be106de970d3e upstream.
The following trace excerpt corresponds with a NULL pointer dereference of 'bp->irq_tbl' in bnxt_setup_inta() on an Aarch64 system after many device resets:
Unable to handle kernel NULL pointer dereference at ... 000000d
...
pc : string+0x3c/0x80
lr : vsnprintf+0x294/0x7e0
sp : ffff00000f61ba70 pstate : 20000145
x29: ffff00000f61ba70 x28: 000000000000000d
x27: ffff0000009c8b5a x26: ffff00000f61bb80
x25: ffff0000009c8b5a x24: 0000000000000012
x23: 00000000ffffffe0 x22: ffff000008990428
x21: ffff00000f61bb80 x20: 000000000000000d
x19: 000000000000001f x18: 0000000000000000
x17: 0000000000000000 x16: ffff800b6d0fb400
x15: 0000000000000000 x14: ffff800b7fe31ae8
x13: 00001ed16472c920 x12: ffff000008c6b1c9
x11: ffff000008cf0580 x10: ffff00000f61bb80
x9 : 00000000ffffffd8 x8 : 000000000000000c
x7 : ffff800b684b8000 x6 : 0000000000000000
x5 : 0000000000000065 x4 : 0000000000000001
x3 : ffff0a00ffffff04 x2 : 000000000000001f
x1 : 0000000000000000 x0 : 000000000000000d
Call trace:
string+0x3c/0x80
vsnprintf+0x294/0x7e0
snprintf+0x44/0x50
__bnxt_open_nic+0x34c/0x928 [bnxt_en]
bnxt_open+0xe8/0x238 [bnxt_en]
__dev_open+0xbc/0x130
__dev_change_flags+0x12c/0x168
dev_change_flags+0x20/0x60
...Ordinarily, a call to bnxt_setup_inta() (not in trace due to inlining) would not be expected on a system supporting MSIX at all. However, if bnxt_init_int_mode() does not end up being called after the call to bnxt_clear_int_mode() in bnxt_fw_reset_close(), then the driver will think that only INTA is supported and bp->irq_tbl will be NULL, causing the above crash.
In the error recovery scenario, we call bnxt_clear_int_mode() in bnxt_fw_reset_close() early in the sequence. Ordinarily, we will call bnxt_init_int_mode() in bnxt_hwrm_if_change() after we reestablish communication with the firmware after reset. However, if the sequence has to abort before we call bnxt_init_int_mode() and if the user later attempts to re-open the device, then it will cause the crash above.
We fix it in 2 ways:
1. Check for bp->irq_tbl in bnxt_setup_int_mode(). If it is NULL, call bnxt_init_init_mode().
2. If we need to abort in bnxt_hwrm_if_change() and cannot complete the error recovery sequence, set the BNXT_STATE_ABORT_ERR flag. This will cause more drastic recovery at the next attempt to re-open the device, including a call to bnxt_init_int_mode().
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +12 -2
@@ -8430,10 +8430,18 @@ static void bnxt_setup_inta(struct bnxt bp->irq_tbl[0 ].handler = bnxt_inta; } +static int bnxt_init_int_mode (struct bnxt *bp); +static int bnxt_setup_int_mode (struct bnxt *bp) {int rc; +if (!bp->irq_tbl) { + rc =bnxt_init_int_mode (bp); +if (rc || !bp->irq_tbl) +return rc ?: -ENODEV ; + } +if (bp->flags &BNXT_FLAG_USING_MSIX )bnxt_setup_msix (bp);else
@@ -8618,7 +8626,7 @@ static int bnxt_init_inta(struct bnxt *bstatic int bnxt_init_int_mode (struct bnxt *bp) { -int rc =0 ; +int rc = -ENODEV ;if (bp->flags &BNXT_FLAG_MSIX_CAP ) rc =bnxt_init_msix (bp);
@@ -9339,7 +9347,8 @@ static int bnxt_hwrm_if_change(struct bn {struct hwrm_func_drv_if_change_output *resp = bp->hwrm_cmd_resp_addr;struct hwrm_func_drv_if_change_input req = {0 }; -bool resc_reinit = false, fw_reset = false; +bool fw_reset = !bp->irq_tbl; +bool resc_reinit = false;u32 flags =0 ;int rc;
@@ -9367,6 +9376,7 @@ static int bnxt_hwrm_if_change(struct bnif (test_bit (BNXT_STATE_IN_FW_RESET , &bp->state) && !fw_reset) {netdev_err (bp->dev,"RESET_DONE not set during FW reset.\n" ); +set_bit (BNXT_STATE_ABORT_ERR , &bp->state);return -ENODEV ; }if (resc_reinit || fw_reset) {
[email protected]
maintainerPATCH 94/306 drm/fb-helper: only unmap if buffer not null
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Tong Zhang <[email protected]>
commit 874a52f9b693ed8bf7a92b3592a547ce8a684e6f upstream.
drm_fbdev_cleanup() can be called when fb_helper->buffer is null, hence fb_helper->buffer should be checked before calling drm_client_buffer_vunmap(). This buffer is also checked in drm_client_framebuffer_delete(), so we should also do the same thing for drm_client_buffer_vunmap().
[ 199.128742] RIP: 0010:drm_client_buffer_vunmap+0xd/0x20 [ 199.129031] Code: 43 18 48 8b 53 20 49 89 45 00 49 89 55 08 5b 44 89 e0 41 5c 41 5d 41 5e 5d c3 0f 1f 00 53 48 89 fb 48 8d 7f 10 e8 73 7d a1 ff <48> 8b 7b 10 48 8d 73 18 5b e9 75 53 fc ff 0 f 1f 44 00 00 48 b8 00 [ 199.130041] RSP: 0018:ffff888103f3fc88 EFLAGS: 00010282 [ 199.130329] RAX: 0000000000000001 RBX: 0000000000000000 RCX: ffffffff8214d46d [ 199.130733] RDX: 1ffffffff079c6b9 RSI: 0000000000000246 RDI: ffffffff83ce35c8 [ 199.131119] RBP: ffff888103d25458 R08: 0000000000000001 R09: fffffbfff0791761 [ 199.131505] R10: ffffffff83c8bb07 R11: fffffbfff0791760 R12: 0000000000000000 [ 199.131891] R13: ffff888103d25468 R14: ffff888103d25418 R15: ffff888103f18120 [ 199.132277] FS: 00007f36fdcbb6a0(0000) GS:ffff88815b400000(0000) knlGS:0000000000000000 [ 199.132721] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 199.133033] CR2: 0000000000000010 CR3: 0000000103d26000 CR4: 00000000000006f0 [ 199.133420] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 199.133807] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 199.134195] Call Trace: [ 199.134333] drm_fbdev_cleanup+0x179/0x1a0 [ 199.134562] drm_fbdev_client_unregister+0x2b/0x40 [ 199.134828] drm_client_dev_unregister+0xa8/0x180 [ 199.135088] drm_dev_unregister+0x61/0x110 [ 199.135315] mgag200_pci_remove+0x38/0x52 [mgag200] [ 199.135586] pci_device_remove+0x62/0xe0 [ 199.135806] device_release_driver_internal+0x148/0x270 [ 199.136094] driver_detach+0x76/0xe0 [ 199.136294] bus_remove_driver+0x7e/0x100 [ 199.136521] pci_unregister_driver+0x28/0xf0 [ 199.136759] __x64_sys_delete_module+0x268/0x300 [ 199.137016] ? __ia32_sys_delete_module+0x300/0x300 [ 199.137285] ? call_rcu+0x3e4/0x580 [ 199.137481] ? fpregs_assert_state_consistent+0x4d/0x60 [ 199.137767] ? exit_to_user_mode_prepare+0x2f/0x130 [ 199.138037] do_syscall_64+0x33/0x40 [ 199.138237] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 199.138517] RIP: 0033:0x7f36fdc3dcf7
--- drivers/gpu/drm/drm_fb_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +1 -1
@@ -2043,7 +2043,7 @@ static void drm_fbdev_cleanup(struct drmif (shadow)vfree (shadow); -else +else if (fb_helper->buffer)drm_client_buffer_vunmap (fb_helper->buffer);drm_client_framebuffer_delete (fb_helper->buffer);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
[email protected]
maintainerPATCH 95/306 drm/compat: Clear bounce structures
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Daniel Vetter <[email protected]>
commit de066e116306baf3a6a62691ac63cfc0b1dabddb upstream.
Some of them have gaps, or fields we don't clear. Native ioctl code does full copies plus zero-extends on size mismatch, so nothing can leak. But compat is more hand-rolled so need to be careful.
None of these matter for performance, so just memset.
Also I didn't fix up the CONFIG_DRM_LEGACY or CONFIG_DRM_AGP ioctl, those are security holes anyway.
--- drivers/gpu/drm/drm_ioc32.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/drm_ioc32.c +11 -0
@@ -99,6 +99,8 @@ static int compat_drm_version(struct filif (copy_from_user (&v32, (void __user *)arg,sizeof (v32)))return -EFAULT ; +memset (&v,0 ,sizeof (v)); + v = (struct drm_version ) { .name_len = v32.name_len, .name =compat_ptr (v32.name),
@@ -137,6 +139,9 @@ static int compat_drm_getunique(struct fif (copy_from_user (&uq32, (void __user *)arg,sizeof (uq32)))return -EFAULT ; + +memset (&uq,0 ,sizeof (uq)); + uq = (struct drm_unique ){ .unique_len = uq32.unique_len, .unique =compat_ptr (uq32.unique),
@@ -265,6 +270,8 @@ static int compat_drm_getclient(struct fif (copy_from_user (&c32, argp,sizeof (c32)))return -EFAULT ; +memset (&client,0 ,sizeof (client)); + client.idx = c32.idx; err =drm_ioctl_kernel (file, drm_getclient, &client,0 );
@@ -852,6 +859,8 @@ static int compat_drm_wait_vblank(structif (copy_from_user (&req32, argp,sizeof (req32)))return -EFAULT ; +memset (&req,0 ,sizeof (req)); + req.request.type = req32.request.type; req.request.sequence = req32.request.sequence; req.request.signal = req32.request.signal;
@@ -889,6 +898,8 @@ static int compat_drm_mode_addfb2(structstruct drm_mode_fb_cmd2 req64;int err; +memset (&req64,0 ,sizeof (req64)); +if (copy_from_user (&req64, argp, offsetof(drm_mode_fb_cmd232_t , modifier)))return -EFAULT ;
[email protected]
maintainerPATCH 96/306 drm/radeon: also init GEM funcs in radeon_gem_prime_import_sg_table
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Christian König <[email protected]>
commit a25955ba123499d7db520175c6be59c29f9215e3 upstream.
Otherwise we will run into a NULL ptr deref.
--- drivers/gpu/drm/radeon/radeon.h | 2 ++ drivers/gpu/drm/radeon/radeon_gem.c | 4 ++-- drivers/gpu/drm/radeon/radeon_prime.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon.h +2 -0
@@ -575,6 +575,8 @@ struct radeon_gem {struct list_head objects; }; +extern const struct drm_gem_object_funcs radeon_gem_object_funcs; +int radeon_gem_init (struct radeon_device *rdev);void radeon_gem_fini (struct radeon_device *rdev); int radeon_gem_object_create(struct radeon_device *rdev, unsigned long size,
drivers/gpu/drm/radeon/radeon_gem.c +2 -2
@@ -43,7 +43,7 @@ struct sg_table *radeon_gem_prime_get_sgint radeon_gem_prime_pin (struct drm_gem_object *obj);void radeon_gem_prime_unpin (struct drm_gem_object *obj); -static const struct drm_gem_object_funcs radeon_gem_object_funcs; +const struct drm_gem_object_funcs radeon_gem_object_funcs;static void radeon_gem_object_free (struct drm_gem_object *gobj) {
@@ -227,7 +227,7 @@ static int radeon_gem_handle_lockup(strureturn r; } -static const struct drm_gem_object_funcs radeon_gem_object_funcs = { +const struct drm_gem_object_funcs radeon_gem_object_funcs = { .free = radeon_gem_object_free, .open = radeon_gem_object_open, .close = radeon_gem_object_close,
drivers/gpu/drm/radeon/radeon_prime.c +2 -0
@@ -56,6 +56,8 @@ struct drm_gem_object *radeon_gem_prime_if (ret)return ERR_PTR (ret); + bo->tbo.base.funcs = &radeon_gem_object_funcs; +mutex_lock (&rdev->gem.mutex);list_add_tail (&bo->list, &rdev->gem.objects);mutex_unlock (&rdev->gem.mutex);
[email protected]
maintainerPATCH 97/306 drm/amd/display: Add a backlight module option
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Takashi Iwai <[email protected]>
commit 7a46f05e5e163c00e41892e671294286e53fe15c upstream.
There seem devices that don't work with the aux channel backlight control. For allowing such users to test with the other backlight control method, provide a new module option, aux_backlight, to specify enabling or disabling the aux backport support explicitly. As default, the aux support is detected by the hardware capability.
v2: make the backlight option generic in case we add future backlight types (Alex)
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++ 3 files changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -179,6 +179,7 @@ extern uint amdgpu_smu_memory_pool_size;extern uint amdgpu_dc_feature_mask;extern uint amdgpu_dc_debug_mask;extern uint amdgpu_dm_abm_level; +extern int amdgpu_backlight;extern struct amdgpu_mgpu_info mgpu_info;extern int amdgpu_ras_enable;extern uint amdgpu_ras_mask;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
@@ -777,6 +777,10 @@ uint amdgpu_dm_abm_level;MODULE_PARM_DESC (abmlevel,"ABM level (0 = off (default), 1-4 = backlight reduction level) " );module_param_named (abmlevel, amdgpu_dm_abm_level, uint,0444 ); +int amdgpu_backlight =-1 ; +MODULE_PARM_DESC (backlight,"Backlight control (0 = pwm, 1 = aux, -1 auto (default))" ); +module_param_named (backlight, amdgpu_backlight, bint,0444 ); +/** * DOC: tmz (int) * Trusted Memory Zone (TMZ) is a method to protect data being written
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -0
@@ -2209,6 +2209,11 @@ static void update_connector_ext_caps(st caps->ext_caps->bits.hdr_aux_backlight_control == 1) caps->aux_support = true; +if (amdgpu_backlight ==0 ) + caps->aux_support = false; +else if (amdgpu_backlight ==1 ) + caps->aux_support = true; +/* From the specification (CTA-861-G), for calculating the maximum * luminance we need to use: * Luminance = 50*2**(CV/32)
[email protected]
maintainerPATCH 98/306 drm/amdgpu/display: use GFP_ATOMIC in dcn21_validate_bandwidth_fp()
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Holger Hoffstätte <[email protected]>
commit 680174cfd1e1cea70a8f30ccb44d8fbdf996018e upstream.
After fixing nested FPU contexts caused by 41401ac67791 we're still seeing complaints about spurious kernel_fpu_end(). As it turns out this was already fixed for dcn20 in commit f41ed88cbd ("drm/amdgpu/display:
use GFP_ATOMIC in dcn20_validate_bandwidth_internal") but never moved forward to dcn21.
--- drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +1 -1
@@ -1339,7 +1339,7 @@ static noinline bool dcn21_validate_bandint vlevel =0 ;int pipe_split_from[MAX_PIPES ];int pipe_cnt =0 ; -display_e2e_pipe_params_st *pipes =kzalloc (dc->res_pool->pipe_count *sizeof (display_e2e_pipe_params_st),GFP_KERNEL ); +display_e2e_pipe_params_st *pipes =kzalloc (dc->res_pool->pipe_count *sizeof (display_e2e_pipe_params_st),GFP_ATOMIC );DC_LOGGER_INIT (dc->ctx->logger);BW_VAL_TRACE_COUNT ();
[email protected]
maintainerPATCH 99/306 drm/amd/display: Fix nested FPU context in dcn21_validate_bandwidth()
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Holger Hoffstätte <[email protected]>
commit 15e8b95d5f7509e0b09289be8c422c459c9f0412 upstream.
Commit 41401ac67791 added FPU wrappers to dcn21_validate_bandwidth(), which was correct. Unfortunately a nested function alredy contained DC_FP_START()/DC_FP_END() calls, which results in nested FPU context enter/exit and complaints by kernel_fpu_begin_mask().
This can be observed e.g. with 5.10.20, which backported 41401ac67791 and now emits the following warning on boot:
WARNING: CPU: 6 PID: 858 at arch/x86/kernel/fpu/core.c:129 kernel_fpu_begin_mask+0xa5/0xc0 Call Trace: dcn21_calculate_wm+0x47/0xa90 [amdgpu] dcn21_validate_bandwidth_fp+0x15d/0x2b0 [amdgpu] dcn21_validate_bandwidth+0x29/0x40 [amdgpu] dc_validate_global_state+0x3c7/0x4c0 [amdgpu]
The warning is emitted due to the additional DC_FP_START/END calls in patch_bounding_box(), which is inlined into dcn21_calculate_wm(), its only caller. Removing the calls brings the code in line with dcn20 and makes the warning disappear.
--- drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +0 -4
@@ -1062,8 +1062,6 @@ static void patch_bounding_box(struct dc {int i; -DC_FP_START (); -if (dc->bb_overrides.sr_exit_time_ns) {for (i =0 ; i <WM_SET_COUNT ; i++) { dc->clk_mgr->bw_params->wm_table.entries[i].sr_exit_time_us =
@@ -1088,8 +1086,6 @@ static void patch_bounding_box(struct dc dc->bb_overrides.dram_clock_change_latency_ns /1000.0 ; } } - -DC_FP_END (); } void dcn21_calculate_wm(
[email protected]
maintainerPATCH 100/306 drm/amd/pm: correct the watermark settings for Polaris
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Evan Quan <[email protected]>
commit 48123d068fcb584838ce29912660c5e9490bad0e upstream.
The "/ 10" should be applied to the right-hand operand instead of the left-hand one.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +4 -4
@@ -5216,10 +5216,10 @@ static int smu7_set_watermarks_for_clockfor (j =0 ; j < dep_sclk_table->count; j++) { valid_entry = false;for (k =0 ; k < watermarks->num_wm_sets; k++) { -if (dep_sclk_table->entries[i].clk /10 >= watermarks->wm_clk_ranges[k].wm_min_eng_clk_in_khz && - dep_sclk_table->entries[i].clk /10 < watermarks->wm_clk_ranges[k].wm_max_eng_clk_in_khz && - dep_mclk_table->entries[i].clk /10 >= watermarks->wm_clk_ranges[k].wm_min_mem_clk_in_khz && - dep_mclk_table->entries[i].clk /10 < watermarks->wm_clk_ranges[k].wm_max_mem_clk_in_khz) { +if (dep_sclk_table->entries[i].clk >= watermarks->wm_clk_ranges[k].wm_min_eng_clk_in_khz /10 && + dep_sclk_table->entries[i].clk < watermarks->wm_clk_ranges[k].wm_max_eng_clk_in_khz /10 && + dep_mclk_table->entries[i].clk >= watermarks->wm_clk_ranges[k].wm_min_mem_clk_in_khz /10 && + dep_mclk_table->entries[i].clk < watermarks->wm_clk_ranges[k].wm_max_mem_clk_in_khz /10 ) { valid_entry = true; table->DisplayWatermark[i][j] = watermarks->wm_clk_ranges[k].wm_set_id;break ;
[email protected]
maintainerPATCH 101/306 drm/amd/pm: bug fix for pcie dpm
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Kenneth Feng <[email protected]>
commit 50ceb1fe7acd50831180f4b5597bf7b39e8059c8 upstream.
Currently the pcie dpm has two problems.
1. Only the high dpm level speed/width can be overrided if the requested values are out of the pcie capability.
2. The high dpm level is always overrided though sometimes it's not necesarry.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 48 +++++++++++++ drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c | 66 ++++++++++++++++++ drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 48 +++++++------ 3 files changed, 141 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +48 -0
@@ -1506,6 +1506,48 @@ static int vega10_populate_single_lclk_lreturn 0 ; } +static int vega10_override_pcie_parameters (struct pp_hwmgr *hwmgr) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); +struct vega10_hwmgr *data = + (struct vega10_hwmgr *)(hwmgr->backend); +uint32_t pcie_gen =0 , pcie_width =0 ; +PPTable_t *pp_table = &(data->smc_state_table.pp_table); +int i; + +if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4 ) + pcie_gen =3 ; +else if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3 ) + pcie_gen =2 ; +else if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2 ) + pcie_gen =1 ; +else if (adev->pm.pcie_gen_mask &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1 ) + pcie_gen =0 ; + +if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X16 ) + pcie_width =6 ; +else if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X12 ) + pcie_width =5 ; +else if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 ) + pcie_width =4 ; +else if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 ) + pcie_width =3 ; +else if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 ) + pcie_width =2 ; +else if (adev->pm.pcie_mlw_mask &CAIL_PCIE_LINK_WIDTH_SUPPORT_X1 ) + pcie_width =1 ; + +for (i =0 ; i <NUM_LINK_LEVELS ; i++) { +if (pp_table->PcieGenSpeed[i] > pcie_gen) + pp_table->PcieGenSpeed[i] = pcie_gen; + +if (pp_table->PcieLaneCount[i] > pcie_width) + pp_table->PcieLaneCount[i] = pcie_width; + } + +return 0 ; +} +static int vega10_populate_smc_link_levels (struct pp_hwmgr *hwmgr) {int result =-1 ;
@@ -2557,6 +2599,11 @@ static int vega10_init_smc_table(struct"Failed to initialize Link Level!" , return result); + result =vega10_override_pcie_parameters (hwmgr); +PP_ASSERT_WITH_CODE (!result, +"Failed to override pcie parameters!" , + return result); + result =vega10_populate_all_graphic_levels (hwmgr); PP_ASSERT_WITH_CODE(!result, "Failed to initialize Graphics Level!",
@@ -2923,6 +2970,7 @@ static int vega10_start_dpm(struct pp_hwreturn 0 ; } +static int vega10_enable_disable_PCC_limit_feature (struct pp_hwmgr *hwmgr,bool enable) {struct vega10_hwmgr *data = hwmgr->backend;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c +66 -0
78 lines not on this page · raw message
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c +27 -21
73 lines not on this page · raw message
[email protected]
maintainerPATCH 102/306 drm/amdgpu/display: simplify backlight setting
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Alex Deucher <[email protected]>
commit a2f8d988698d7d3645b045f4940415b045140b81 upstream.
Avoid the extra wrapper function.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -16
@@ -3132,19 +3132,6 @@ static void amdgpu_dm_update_backlight_c#endif } -static int set_backlight_via_aux (struct dc_link *link,uint32_t brightness) -{ -bool rc; - -if (!link) -return 1 ; - - rc =dc_link_set_backlight_level_nits (link, true, brightness, -AUX_BL_DEFAULT_TRANSITION_TIME_MS ); - -return rc ?0 :1 ; -} -static int get_brightness_range (const struct amdgpu_dm_backlight_caps *caps,unsigned *min,unsigned *max) {
@@ -3207,9 +3194,10 @@ static int amdgpu_dm_backlight_update_st brightness =convert_brightness_from_user (&caps, bd->props.brightness);// Change brightness based on AUX property if (caps.aux_support) -return set_backlight_via_aux (link, brightness); - - rc =dc_link_set_backlight_level (dm->backlight_link, brightness,0 ); + rc =dc_link_set_backlight_level_nits (link, true, brightness, +AUX_BL_DEFAULT_TRANSITION_TIME_MS ); +else + rc =dc_link_set_backlight_level (dm->backlight_link, brightness,0 );return rc ?0 :1 ; }
[email protected]
maintainerPATCH 103/306 drm/amdgpu/display: dont assert in set backlight function
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Alex Deucher <[email protected]>
commit dfd8b7fbd985ec1cf76fe10f2875a50b10833740 upstream.
It just spams the logs.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +0 -1
@@ -2571,7 +2571,6 @@ bool dc_link_set_backlight_level(const sif (pipe_ctx->plane_state ==NULL ) frame_ramp =0 ; }else { -ASSERT (false);return false; }
[email protected]
maintainerPATCH 104/306 drm/amdgpu/display: handle aux backlight in backlight_get_brightness
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Alex Deucher <[email protected]>
commit 0ad3e64eb46d8c47de3af552e282894e3893e973 upstream.
Need to fetch it via aux.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +20 -4
@@ -3205,11 +3205,27 @@ static int amdgpu_dm_backlight_update_ststatic int amdgpu_dm_backlight_get_brightness (struct backlight_device *bd) {struct amdgpu_display_manager *dm =bl_get_data (bd); -int ret =dc_link_get_backlight_level (dm->backlight_link); +struct amdgpu_dm_backlight_caps caps; -if (ret ==DC_ERROR_UNEXPECTED ) -return bd->props.brightness; -return convert_brightness_to_user (&dm->backlight_caps, ret); +amdgpu_dm_update_backlight_caps (dm); + caps = dm->backlight_caps; + +if (caps.aux_support) { +struct dc_link *link = (struct dc_link *)dm->backlight_link; +u32 avg, peak; +bool rc; + + rc =dc_link_get_backlight_level_nits (link, &avg, &peak); +if (!rc) +return bd->props.brightness; +return convert_brightness_to_user (&caps, avg); + }else { +int ret =dc_link_get_backlight_level (dm->backlight_link); + +if (ret ==DC_ERROR_UNEXPECTED ) +return bd->props.brightness; +return convert_brightness_to_user (&caps, ret); + } }static const struct backlight_ops amdgpu_dm_backlight_ops = {
[email protected]
maintainerPATCH 105/306 drm/shmem-helper: Check for purged buffers in fault handler
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Neil Roberts <[email protected]>
commit d611b4a0907cece060699f2fd347c492451cd2aa upstream.
When a buffer is madvised as not needed and then purged, any attempts to access the buffer from user-space should cause a bus fault. This patch adds a check for that.
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_gem_shmem_helper.c +14 -4
@@ -525,14 +525,24 @@ static vm_fault_t drm_gem_shmem_fault(ststruct drm_gem_object *obj = vma->vm_private_data;struct drm_gem_shmem_object *shmem =to_drm_gem_shmem_obj (obj);loff_t num_pages = obj->size >>PAGE_SHIFT ; +vm_fault_t ret;struct page *page; -if (vmf->pgoff >= num_pages ||WARN_ON_ONCE (!shmem->pages)) -return VM_FAULT_SIGBUS ; +mutex_lock (&shmem->pages_lock); - page = shmem->pages[vmf->pgoff]; +if (vmf->pgoff >= num_pages || +WARN_ON_ONCE (!shmem->pages) || + shmem->madv <0 ) { + ret =VM_FAULT_SIGBUS ; + }else { + page = shmem->pages[vmf->pgoff]; -return vmf_insert_page (vma, vmf->address, page); + ret =vmf_insert_page (vma, vmf->address, page); + } + +mutex_unlock (&shmem->pages_lock); + +return ret; }static void drm_gem_shmem_vm_open (struct vm_area_struct *vma)
[email protected]
maintainerPATCH 106/306 drm/shmem-helper: Dont remove the offset in vm_area_struct pgoff
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Neil Roberts <[email protected]>
commit 11d5a4745e00e73745774671dbf2fb07bd6e2363 upstream.
When mmapping the shmem, it would previously adjust the pgoff in the vm_area_struct to remove the fake offset that is added to be able to identify the buffer. This patch removes the adjustment and makes the fault handler use the vm_fault address to calculate the page offset instead. Although using this address is apparently discouraged, several DRM drivers seem to be doing it anyway.
The problem with removing the pgoff is that it prevents drm_vma_node_unmap from working because that searches the mapping tree by address. That doesn't work because all of the mappings are at offset
0. drm_vma_node_unmap is being used by the shmem helpers when purging the buffer.
This fixes a bug in Panfrost which is using drm_gem_shmem_purge. Without this the mapping for the purged buffer can still be accessed which might mean it would access random pages from other buffers
v2: Don't check whether the unsigned page_offset is less than 0.
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_gem_shmem_helper.c +6 -5
@@ -527,15 +527,19 @@ static vm_fault_t drm_gem_shmem_fault(stloff_t num_pages = obj->size >>PAGE_SHIFT ;vm_fault_t ret;struct page *page; +pgoff_t page_offset; + +/* We don't use vmf->pgoff since that has the fake offset */ + page_offset = (vmf->address - vma->vm_start) >>PAGE_SHIFT ;mutex_lock (&shmem->pages_lock); -if (vmf->pgoff >= num_pages || +if (page_offset >= num_pages ||WARN_ON_ONCE (!shmem->pages) || shmem->madv <0 ) { ret =VM_FAULT_SIGBUS ; }else { - page = shmem->pages[vmf->pgoff]; + page = shmem->pages[page_offset]; ret =vmf_insert_page (vma, vmf->address, page); }
@@ -591,9 +595,6 @@ int drm_gem_shmem_mmap(struct drm_gem_obstruct drm_gem_shmem_object *shmem;int ret; -/* Remove the fake offset */ - vma->vm_pgoff -=drm_vma_node_start (&obj->vma_node); -if (obj->import_attach) {/* Drop the reference drm_gem_mmap_obj() acquired.*/ drm_gem_object_put (obj);
[email protected]
maintainerPATCH 107/306 drm: Use USB controllers DMA mask when importing dmabufs
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Thomas Zimmermann <[email protected]>
commit 659ab7a49cbebe0deffcbe1f9560e82006b21817 upstream.
USB devices cannot perform DMA and hence have no dma_mask set in their device structure. Therefore importing dmabuf into a USB-based driver fails, which breaks joining and mirroring of display in X11.
For USB devices, pick the associated USB controller as attachment device. This allows the DRM import helpers to perform the DMA setup. If the DMA controller does not support DMA transfers, we're out of luck and cannot import. Our current USB-based DRM drivers don't use DMA, so the actual DMA device is not important.
Tested by joining/mirroring displays of udl and radeon under Gnome/X11.
v8:
* release dmadev if device initialization fails (Noralf)
* fix commit description (Noralf)
v7:
* fix use-before-init bug in gm12u320 (Dan)
v6:
* implement workaround in DRM drivers and hold reference to DMA device while USB device is in use
* remove dev_is_usb() (Greg)
* collapse USB helper into usb_intf_get_dma_device() (Alan)
* integrate Daniel's TODO statement (Daniel)
* fix typos (Greg)
v5:
* provide a helper for USB interfaces (Alan)
* add FIXME item to documentation and TODO list (Daniel)
v4:
* implement workaround with USB helper functions (Greg)
* use struct usb_device->bus->sysdev as DMA device (Takashi)
v3:
* drop gem_create_object
* use DMA mask of USB controller, if any (Daniel, Christian, Noralf)
v2:
* move fix to importer side (Christian, Daniel)
* update SHMEM and CMA helpers for new PRIME callbacks
--- Documentation/gpu/todo.rst | 21 +++++++++++++++++++ drivers/gpu/drm/tiny/gm12u320.c | 44 ++++++++++++++++++++++++++++++++-------- drivers/gpu/drm/udl/udl_drv.c | 17 +++++++++++++++ drivers/gpu/drm/udl/udl_drv.h | 1 drivers/gpu/drm/udl/udl_main.c | 10 +++++++++ drivers/usb/core/usb.c | 32 +++++++++++++++++++++++++++++ include/linux/usb.h | 2 + 7 files changed, 119 insertions(+), 8 deletions(-)
Documentation/gpu/todo.rst +21 -0
@@ -594,6 +594,27 @@ Some of these date from the very introdu Level: Intermediate +Remove automatic page mapping from dma-buf importing +---------------------------------------------------- + +When importing dma-bufs, the dma-buf and PRIME frameworks automatically map +imported pages into the importer's DMA area. drm_gem_prime_fd_to_handle() and +drm_gem_prime_handle_to_fd() require that importers call dma_buf_attach() +even if they never do actual device DMA, but only CPU access through +dma_buf_vmap(). This is a problem for USB devices, which do not support DMA +operations. + +To fix the issue, automatic page mappings should be removed from the +buffer-sharing code. Fixing this is a bit more involved, since the import/export +cache is also tied to &drm_gem_object.import_attach. Meanwhile we paper over +this problem for USB devices by fishing out the USB host controller device, as +long as that supports DMA. Otherwise importing can still needlessly fail. + +Contact: Thomas Zimmermann <[email protected]>, Daniel Vetter + +Level: Advanced + + Better Testing ==============
drivers/gpu/drm/tiny/gm12u320.c +36 -8
108 lines not on this page · raw message
drivers/gpu/drm/udl/udl_drv.c +17 -0
@@ -32,6 +32,22 @@ static int udl_usb_resume(struct usb_intreturn drm_mode_config_helper_resume (dev); } +/* +* FIXME: Dma-buf sharing requires DMA support by the importing device. +* This function is a workaround to make USB devices work as well. +* See todo.rst for how to fix the issue in the dma-buf framework. +*/ +static struct drm_gem_object *udl_driver_gem_prime_import (struct drm_device *dev, +struct dma_buf *dma_buf) +{ +struct udl_device *udl =to_udl (dev); + +if (!udl->dmadev) +return ERR_PTR (-ENODEV ); + +return drm_gem_prime_import_dev (dev, dma_buf, udl->dmadev); +} +DEFINE_DRM_GEM_FOPS (udl_driver_fops);static const struct drm_driver driver = {
@@ -40,6 +56,7 @@ static const struct drm_driver driver =/* GEM hooks */ .fops = &udl_driver_fops,DRM_GEM_SHMEM_DRIVER_OPS , + .gem_prime_import = udl_driver_gem_prime_import, .name = DRIVER_NAME, .desc = DRIVER_DESC,
drivers/gpu/drm/udl/udl_drv.h +1 -0
@@ -50,6 +50,7 @@ struct urb_list {struct udl_device {struct drm_device drm;struct device *dev; +struct device *dmadev;struct drm_simple_display_pipe display_pipe;
drivers/gpu/drm/udl/udl_main.c +10 -0
@@ -315,6 +315,10 @@ int udl_init(struct udl_device *udl)DRM_DEBUG ("\n" ); + udl->dmadev =usb_intf_get_dma_device (to_usb_interface (dev->dev)); +if (!udl->dmadev) +drm_warn (dev,"buffer sharing not supported" );/* not an error */ +mutex_init (&udl->gem_lock);if (!udl_parse_vendor_descriptor (udl)) {
@@ -343,12 +347,18 @@ int udl_init(struct udl_device *udl) err:if (udl->urbs.count)udl_free_urb_list (dev); +put_device (udl->dmadev);DRM_ERROR ("%d\n" , ret);return ret; }int udl_drop_usb (struct drm_device *dev) { +struct udl_device *udl =to_udl (dev); +udl_free_urb_list (dev); +put_device (udl->dmadev); + udl->dmadev =NULL ; +return 0 ; }
drivers/usb/core/usb.c +32 -0
@@ -748,6 +748,38 @@ void usb_put_intf(struct usb_interface * }EXPORT_SYMBOL_GPL (usb_put_intf); +/** +* usb_intf_get_dma_device - acquire a reference on the usb interface's DMA endpoint +* @intf: the usb interface +* +* While a USB device cannot perform DMA operations by itself, many USB +* controllers can. A call to usb_intf_get_dma_device() returns the DMA endpoint +* for the given USB interface, if any. The returned device structure must be +* released with put_device(). +* +* See also usb_get_dma_device(). +* +* Returns: A reference to the usb interface's DMA endpoint; or NULL if none +* exists. +*/ +struct device *usb_intf_get_dma_device (struct usb_interface *intf) +{ +struct usb_device *udev =interface_to_usbdev (intf); +struct device *dmadev; + +if (!udev->bus) +return NULL ; + + dmadev =get_device (udev->bus->sysdev); +if (!dmadev || !dmadev->dma_mask) { +put_device (dmadev); +return NULL ; + } + +return dmadev; +} +EXPORT_SYMBOL_GPL (usb_intf_get_dma_device); +/* USB device locking * * USB devices and interfaces are locked using the semaphore in their
include/linux/usb.h +2 -0
@@ -746,6 +746,8 @@ extern int usb_lock_device_for_reset(strextern int usb_reset_device (struct usb_device *dev);extern void usb_queue_reset_device (struct usb_interface *dev); +extern struct device *usb_intf_get_dma_device (struct usb_interface *intf); +#ifdef CONFIG_ACPI extern int usb_acpi_set_power_state (struct usb_device *hdev,int index,bool enable);
[email protected]
maintainerPATCH 108/306 drm/amdgpu: fix S0ix handling when the CONFIG_AMD_PMC=m
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Alex Deucher <[email protected]>
commit a5cb3c1a36376c25cd25fd3e99918dc48ac420bb upstream.
Need to check the module variant as well.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
@@ -903,7 +903,7 @@ void amdgpu_acpi_fini(struct amdgpu_devi*/ bool amdgpu_acpi_is_s0ix_supported (struct amdgpu_device *adev) { -#if defined(CONFIG_AMD_PMC ) +#if defined(CONFIG_AMD_PMC ) || defined(CONFIG_AMD_PMC_MODULE )if (acpi_gbl_FADT.flags &ACPI_FADT_LOW_POWER_S0 ) {if (adev->flags &AMD_IS_APU )return true;
[email protected]
maintainerPATCH 109/306 drm: meson_drv add shutdown function
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Artem Lapkin <[email protected]>
commit fa0c16caf3d73ab4d2e5d6fa2ef2394dbec91791 upstream.
Problem: random stucks on reboot stage about 1/20 stuck/reboots // debug kernel log
[ 4.496660] reboot: kernel restart prepare CMD:(null) [ 4.498114] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin [ 4.503949] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU...
...STUCK...
Solution: add shutdown function to meson_drm driver // debug kernel log
[ 5.231896] reboot: kernel restart prepare CMD:(null) [ 5.246135] [drm:meson_drv_shutdown] ... [ 5.259271] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin [ 5.274688] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU... [ 5.338331] reboot: Restarting system [ 5.358293] psci: PSCI_0_2_FN_SYSTEM_RESET reboot_mode:0 cmd:(null)
bl31 reboot reason: 0xd
bl31 reboot reason: 0x0
system cmd 1.
...REBOOT...
Tested: on VIM1 VIM2 VIM3 VIM3L khadas sbcs - 1000+ successful reboots and Odroid boards, WeTek Play2 (GXBB)
--- drivers/gpu/drm/meson/meson_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/meson/meson_drv.c +11 -0
@@ -482,6 +482,16 @@ static int meson_probe_remote(struct plareturn count; } +static void meson_drv_shutdown (struct platform_device *pdev) +{ +struct meson_drm *priv =dev_get_drvdata (&pdev->dev); +struct drm_device *drm = priv->drm; + +DRM_DEBUG_DRIVER ("\n" ); +drm_kms_helper_poll_fini (drm); +drm_atomic_helper_shutdown (drm); +} +static int meson_drv_probe (struct platform_device *pdev) {struct component_match *match =NULL ;
@@ -553,6 +563,7 @@ static const struct dev_pm_ops meson_drvstatic struct platform_driver meson_drm_platform_driver = { .probe = meson_drv_probe, + .shutdown = meson_drv_shutdown, .driver = { .name ="meson-drm" , .of_match_table = dt_match,
[email protected]
maintainerPATCH 110/306 drm/shmem-helpers: vunmap: Dont put pages for dma-buf
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Noralf Trønnes <[email protected]>
commit 64e194e278673bceb68fb2dde7dbc3d812bfceb3 upstream.
dma-buf importing was reworked in commit 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing"). Before that commit drm_gem_shmem_prime_import_sg_table() did set ->pages_use_count=1 and drm_gem_shmem_vunmap_locked() could call drm_gem_shmem_put_pages() unconditionally. Now without the use count set, put pages is called also on dma-bufs. Fix this by only putting pages if it's not imported.
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_gem_shmem_helper.c +4 -3
@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(if (--shmem->vmap_use_count >0 )return ; -if (obj->import_attach) +if (obj->import_attach) {dma_buf_vunmap (obj->import_attach->dmabuf, map); -else + }else {vunmap (shmem->vaddr); +drm_gem_shmem_put_pages (shmem); + } shmem->vaddr =NULL ; -drm_gem_shmem_put_pages (shmem); }/*
[email protected]
maintainerPATCH 111/306 drm/i915: Wedge the GPU if command parser setup fails
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Tvrtko Ursulin <[email protected]>
commit a829f033e966d5e4aa27c3ef2b381f51734e4a7f upstream.
Commit 311a50e76a33 ("drm/i915: Add support for mandatory cmdparsing") introduced mandatory command parsing but setup failures were not translated into wedging the GPU which was probably the intent.
Possible errors come in two categories. Either the sanity check on internal tables has failed, which should be caught in CI unless an affected platform would be missed in testing; or memory allocation failure happened during driver load, which should be extremely unlikely but for correctness should still be handled.
v2:
* Tidy coding style. (Chris)
--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 7 ++++++- drivers/gpu/drm/i915/i915_cmd_parser.c | 19 +++++++++++++------ drivers/gpu/drm/i915/i915_drv.h | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +6 -1
@@ -709,9 +709,12 @@ static int engine_setup_common(struct in goto err_status; } + err =intel_engine_init_cmd_parser (engine); +if (err) + goto err_cmd_parser; +intel_engine_init_active (engine,ENGINE_PHYSICAL );intel_engine_init_execlists (engine); -intel_engine_init_cmd_parser (engine);intel_engine_init__pm (engine);intel_engine_init_retire (engine);
@@ -725,6 +728,8 @@ static int engine_setup_common(struct inreturn 0 ; +err_cmd_parser: +intel_breadcrumbs_free (engine->breadcrumbs); err_status:cleanup_status_page (engine);return err;
drivers/gpu/drm/i915/i915_cmd_parser.c +13 -6
@@ -939,7 +939,7 @@ static void fini_hash_table(struct intel* struct intel_engine_cs based on whether the platform requires software * command parsing. */ -void intel_engine_init_cmd_parser (struct intel_engine_cs *engine) +int intel_engine_init_cmd_parser (struct intel_engine_cs *engine) {const struct drm_i915_cmd_table *cmd_tables;int cmd_table_count;
@@ -947,7 +947,7 @@ void intel_engine_init_cmd_parser(structif (!IS_GEN (engine->i915,7 ) && !(IS_GEN (engine->i915,9 ) && engine->class ==COPY_ENGINE_CLASS )) -return ; +return 0 ;switch (engine->class) {case RENDER_CLASS :
@@ -1012,19 +1012,19 @@ void intel_engine_init_cmd_parser(structbreak ;default :MISSING_CASE (engine->class); -return ; + goto out; }if (!validate_cmds_sorted (engine, cmd_tables, cmd_table_count)) {drm_err (&engine->i915->drm,"%s: command descriptions are not sorted\n" , engine->name); -return ; + goto out; }if (!validate_regs_sorted (engine)) {drm_err (&engine->i915->drm,"%s: registers are not sorted\n" , engine->name); -return ; + goto out; } ret =init_hash_table (engine, cmd_tables, cmd_table_count);
@@ -1032,10 +1032,17 @@ void intel_engine_init_cmd_parser(structdrm_err (&engine->i915->drm,"%s: initialised failed!\n" , engine->name);fini_hash_table (engine); -return ; + goto out; } engine->flags |=I915_ENGINE_USING_CMD_PARSER ; + +out: +if (intel_engine_requires_cmd_parser (engine) && + !intel_engine_using_cmd_parser (engine)) +return -EINVAL ; + +return 0 ; }/**
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -1947,7 +1947,7 @@ const char *i915_cache_level_str(struct/* i915_cmd_parser.c */ int i915_cmd_parser_get_version (struct drm_i915_private *dev_priv); -void intel_engine_init_cmd_parser (struct intel_engine_cs *engine); +int intel_engine_init_cmd_parser (struct intel_engine_cs *engine);void intel_engine_cleanup_cmd_parser (struct intel_engine_cs *engine); int intel_engine_cmd_parser(struct intel_engine_cs *engine, struct i915_vma *batch,
[email protected]
maintainerPATCH 112/306 s390/cio: return -EFAULT if copy_to_user() fails
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Eric Farman <[email protected]>
commit d9c48a948d29bcb22f4fe61a81b718ef6de561a0 upstream.
--- drivers/s390/cio/vfio_ccw_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/vfio_ccw_ops.c +1 -1
@@ -582,7 +582,7 @@ static ssize_t vfio_ccw_mdev_ioctl(strucif (info.count ==-1 )return -EINVAL ; -return copy_to_user ((void __user *)arg, &info, minsz); +return copy_to_user ((void __user *)arg, &info, minsz) ? -EFAULT :0 ; }case VFIO_DEVICE_SET_IRQS : {
[email protected]
maintainerPATCH 113/306 s390/crypto: return -EFAULT if copy_to_user() fails
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Wang Qing <[email protected]>
commit 942df4be7ab40195e2a839e9de81951a5862bc5b upstream.
The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete.
--- drivers/s390/crypto/vfio_ap_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/crypto/vfio_ap_ops.c +1 -1
@@ -1286,7 +1286,7 @@ static int vfio_ap_mdev_get_device_info( info.num_regions =0 ; info.num_irqs =0 ; -return copy_to_user ((void __user *)arg, &info, minsz); +return copy_to_user ((void __user *)arg, &info, minsz) ? -EFAULT :0 ; } static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,
[email protected]
maintainerPATCH 114/306 qxl: Fix uninitialised struct field head.surface_id
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Colin Ian King <[email protected]>
commit 738acd49eb018feb873e0fac8f9517493f6ce2c7 upstream.
The surface_id struct field in head is not being initialized and static analysis warns that this is being passed through to dev->monitors_config->heads[i] on an assignment. Clear up this warning by initializing it to zero.
Addresses-Coverity: ("Uninitialized scalar variable")
--- drivers/gpu/drm/qxl/qxl_display.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/qxl/qxl_display.c +1 -0
@@ -328,6 +328,7 @@ static void qxl_crtc_update_monitors_con head.id = i; head.flags =0 ; + head.surface_id =0 ; oldcount = qdev->monitors_config->count;if (crtc->state->active) {struct drm_display_mode *mode = &crtc->mode;
[email protected]
maintainerPATCH 115/306 sh_eth: fix TRSCER mask for R7S9210
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Sergey Shtylyov <[email protected]>
commit 165bc5a4f30eee4735845aa7dbd6b738643f2603 upstream.
According to the RZ/A2M Group User's Manual: Hardware, Rev. 2.00, the TRSCER register has bit 9 reserved, hence we can't use the driver's default TRSCER mask. Add the explicit initializer for sh_eth_cpu_data::trscer_err_mask for R7S9210.
--- drivers/net/ethernet/renesas/sh_eth.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/renesas/sh_eth.c +2 -0
@@ -780,6 +780,8 @@ static struct sh_eth_cpu_data r7s9210_da .fdr_value = 0x0000070f, + .trscer_err_mask = DESC_I_RINT8 | DESC_I_RINT5, + .apr = 1, .mpr = 1, .tpauser = 1,
[email protected]
maintainerPATCH 116/306 media: usbtv: Fix deadlock on suspend
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Maxim Mikityanskiy <[email protected]>
commit 8a7e27fd5cd696ba564a3f62cedef7269cfd0723 upstream.
usbtv doesn't support power management, so on system suspend the .disconnect callback of the driver is called. The teardown sequence includes a call to snd_card_free. Its implementation waits until the refcount of the sound card device drops to zero, however, if its file is open, snd_card_file_add takes a reference, which can't be dropped during the suspend, because the userspace processes are already frozen at this point. snd_card_free waits for completion forever, leading to a hang on suspend.
This commit fixes this deadlock condition by replacing snd_card_free with snd_card_free_when_closed, that doesn't wait until all references are released, allowing suspend to progress.
--- drivers/media/usb/usbtv/usbtv-audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/usbtv/usbtv-audio.c +1 -1
@@ -371,7 +371,7 @@ void usbtv_audio_free(struct usbtv *usbtcancel_work_sync (&usbtv->snd_trigger);if (usbtv->snd && usbtv->udev) { -snd_card_free (usbtv->snd); +snd_card_free_when_closed (usbtv->snd); usbtv->snd =NULL ; } }
[email protected]
maintainerPATCH 117/306 media: rkisp1: params: fix wrong bits settings
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Dafna Hirschfeld <[email protected]>
commit 2025a48cfd92d541c5ee47deee97f8a46d00c4ac upstream.
The histogram mode is set using 'rkisp1_params_set_bits'. Only the bits of the mode should be the value argument for that function. Otherwise bits outside the mode mask are turned on which is not what was intended.
--- drivers/media/platform/rockchip/rkisp1/rkisp1-params.c | 1 - 1 file changed, 1 deletion(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c +0 -1
@@ -1288,7 +1288,6 @@ static void rkisp1_params_config_parametmemset (hst.hist_weight,0x01 ,sizeof (hst.hist_weight));rkisp1_hst_config (params, &hst);rkisp1_param_set_bits (params,RKISP1_CIF_ISP_HIST_PROP , - ~RKISP1_CIF_ISP_HIST_PROP_MODE_MASK | rkisp1_hst_params_default_config.mode);/* set the range */
[email protected]
maintainerPATCH 118/306 media: v4l: vsp1: Fix uif null pointer access
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Biju Das <[email protected]>
commit 6732f313938027a910e1f7351951ff52c0329e70 upstream.
RZ/G2L SoC has no UIF. This patch fixes null pointer access, when UIF module is not used.
--- drivers/media/platform/vsp1/vsp1_drm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/vsp1/vsp1_drm.c +2 -2
@@ -462,9 +462,9 @@ static int vsp1_du_pipeline_setup_inputs* make sure it is present in the pipeline's list of entities if it * wasn't already. */ -if (!use_uif) { +if (drm_pipe->uif && !use_uif) { drm_pipe->uif->pipe =NULL ; - }else if (!drm_pipe->uif->pipe) { + }else if (drm_pipe->uif && !drm_pipe->uif->pipe) { drm_pipe->uif->pipe = pipe;list_add_tail (&drm_pipe->uif->list_pipe, &pipe->entities); }
[email protected]
maintainerPATCH 119/306 media: v4l: vsp1: Fix bru null pointer access
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Biju Das <[email protected]>
commit ac8d82f586c8692b501cb974604a71ef0e22a04c upstream.
RZ/G2L SoC has only BRS. This patch fixes null pointer access,when only BRS is enabled.
--- drivers/media/platform/vsp1/vsp1_drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/vsp1/vsp1_drm.c +1 -1
@@ -245,7 +245,7 @@ static int vsp1_du_pipeline_setup_brx(st brx = &vsp1->bru->entity; else if (pipe->brx && !drm_pipe->force_brx_release) brx = pipe->brx; - else if (!vsp1->bru->entity.pipe) + else if (vsp1_feature(vsp1, VSP1_HAS_BRU) && !vsp1->bru->entity.pipe) brx = &vsp1->bru->entity; else brx = &vsp1->brs->entity;
[email protected]
maintainerPATCH 120/306 media: rc: compile rc-cec.c into rc-core
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Hans Verkuil <[email protected]>
commit f09f9f93afad770a04b35235a0aa465fcc8d6e3d upstream.
The rc-cec keymap is unusual in that it can't be built as a module, instead it is registered directly in rc-main.c if CONFIG_MEDIA_CEC_RC is set. This is because it can be called from drm_dp_cec_set_edid() via cec_register_adapter() in an asynchronous context, and it is not allowed to use request_module() to load rc-cec.ko in that case. Trying to do so results in a 'WARN_ON_ONCE(wait && current_is_async())'.
Since this keymap is only used if CONFIG_MEDIA_CEC_RC is set, we just compile this keymap into the rc-core module and never as a separate module.
--- drivers/media/rc/Makefile | 1 + drivers/media/rc/keymaps/Makefile | 1 - drivers/media/rc/keymaps/rc-cec.c | 28 +++++++++++----------------- drivers/media/rc/rc-main.c | 6 ++++++ include/media/rc-map.h | 7 +++++++ 5 files changed, 25 insertions(+), 18 deletions(-)
drivers/media/rc/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-y += keymaps/ obj-$(CONFIG_RC_CORE) += rc-core.o rc-core-y := rc-main.o rc-ir-raw.o rc-core-$(CONFIG_LIRC) += lirc_dev.o +rc-core-$(CONFIG_MEDIA_CEC_RC) += keymaps/rc-cec.o rc-core-$(CONFIG_BPF_LIRC_MODE2) += bpf-lirc.o obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o
drivers/media/rc/keymaps/Makefile +0 -1
@@ -21,7 +21,6 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t rc-behold.o \ rc-behold-columbus.o \ rc-budget-ci-old.o \ - rc-cec.o \ rc-cinergy-1400.o \ rc-cinergy.o \ rc-d680-dmb.o \
drivers/media/rc/keymaps/rc-cec.c +11 -17
@@ -1,6 +1,16 @@// SPDX-License-Identifier: GPL-2.0-or-later /* Keytable for the CEC remote control * +* This keymap is unusual in that it can't be built as a module, +* instead it is registered directly in rc-main.c if CONFIG_MEDIA_CEC_RC +* is set. This is because it can be called from drm_dp_cec_set_edid() via +* cec_register_adapter() in an asynchronous context, and it is not +* allowed to use request_module() to load rc-cec.ko in that case. +* +* Since this keymap is only used if CONFIG_MEDIA_CEC_RC is set, we +* just compile this keymap into the rc-core module and never as a +* separate module. +* * Copyright (c) 2015 by Kamil Debski */
@@ -152,7 +162,7 @@ static struct rc_map_table cec[] = {/* 0x77-0xff: Reserved */ }; -static struct rc_map_list cec_map = { +struct rc_map_list cec_map = { .map = { .scan = cec, .size =ARRAY_SIZE (cec),
@@ -160,19 +170,3 @@ static struct rc_map_list cec_map = { .name = RC_MAP_CEC, } }; - -static int __init init_rc_map_cec (void ) -{ -return rc_map_register (&cec_map); -} - -static void __exit exit_rc_map_cec(void) -{ -rc_map_unregister (&cec_map); -} - -module_init (init_rc_map_cec); -module_exit (exit_rc_map_cec); - -MODULE_LICENSE ("GPL" ); -MODULE_AUTHOR ("Kamil Debski" );
drivers/media/rc/rc-main.c +6 -0
@@ -2069,6 +2069,9 @@ static int __init rc_core_init(void)led_trigger_register_simple ("rc-feedback" , &led_feedback);rc_map_register (&empty_map); +#ifdef CONFIG_MEDIA_CEC_RC +rc_map_register (&cec_map); +#endif return 0 ; }
@@ -2078,6 +2081,9 @@ static void __exit rc_core_exit(void)lirc_dev_exit ();class_unregister (&rc_class);led_trigger_unregister_simple (led_feedback); +#ifdef CONFIG_MEDIA_CEC_RC +rc_map_unregister (&cec_map); +#endif rc_map_unregister (&empty_map); }
include/media/rc-map.h +7 -0
@@ -175,6 +175,13 @@ struct rc_map_list {struct rc_map map; }; +#ifdef CONFIG_MEDIA_CEC_RC +/* +* rc_map_list from rc-cec.c +*/ +extern struct rc_map_list cec_map; +#endif +/* Routines from rc-map.c */ /**
[email protected]
maintainerPATCH 121/306 MIPS: kernel: Reserve exception base early to prevent corruption
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Thomas Bogendoerfer <[email protected]>
[ Upstream commit bd67b711bfaa02cf19e88aa2d9edae5c1c1d2739 ]
BMIPS is one of the few platforms that do change the exception base. After commit 2dcb39645441 ("memblock: do not start bottom-up allocations with kernel_end") we started seeing BMIPS boards fail to boot with the built-in FDT being corrupted.
Before the cited commit, early allocations would be in the [kernel_end, RAM_END] range, but after commit they would be within [RAM_START + PAGE_SIZE, RAM_END].
The custom exception base handler that is installed by bmips_ebase_setup() done for BMIPS5000 CPUs ends-up trampling on the memory region allocated by unflatten_and_copy_device_tree() thus corrupting the FDT used by the kernel.
To fix this, we need to perform an early reservation of the custom exception space. Additional we reserve the first 4k (1k for R3k) for either normal exception vector space (legacy CPUs) or special vectors like cache exceptions.
Huge thanks to Serge for analysing and proposing a solution to this issue.
--- arch/mips/include/asm/traps.h | 3 +++ arch/mips/kernel/cpu-probe.c | 6 ++++++ arch/mips/kernel/cpu-r3k-probe.c | 3 +++ arch/mips/kernel/traps.c | 10 +++++----- 4 files changed, 17 insertions(+), 5 deletions(-)
arch/mips/include/asm/traps.h +3 -0
@@ -24,6 +24,9 @@ extern void (*board_ebase_setup)(void);extern void (*board_cache_error_setup)(void );extern int register_nmi_notifier (struct notifier_block *nb); +extern void reserve_exception_space (phys_addr_t addr,unsigned long size); + +#define VECTORSPACING 0x100/* for EI/VI mode */ #define nmi_notifier (fn, pri) \ ({ \
arch/mips/kernel/cpu-probe.c +6 -0
@@ -26,6 +26,7 @@#include <asm/elf.h> #include <asm/pgtable-bits.h> #include <asm/spram.h> +#include <asm/traps.h> #include <linux/uaccess.h> #include "fpu-probe.h"
@@ -1619,6 +1620,7 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) c->cputype =CPU_BMIPS3300 ; __cpu_name[cpu] ="Broadcom BMIPS3300" ;set_elf_platform (cpu,"bmips3300" ); +reserve_exception_space (0x400 ,VECTORSPACING *64 );break ;case PRID_IMP_BMIPS43XX : {int rev = c->processor_id &PRID_REV_MASK ;
@@ -1629,6 +1631,7 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) __cpu_name[cpu] ="Broadcom BMIPS4380" ;set_elf_platform (cpu,"bmips4380" ); c->options |=MIPS_CPU_RIXI ; +reserve_exception_space (0x400 ,VECTORSPACING *64 ); }else { c->cputype =CPU_BMIPS4350 ; __cpu_name[cpu] ="Broadcom BMIPS4350" ;
@@ -1645,6 +1648,7 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) __cpu_name[cpu] ="Broadcom BMIPS5000" ;set_elf_platform (cpu,"bmips5000" ); c->options |=MIPS_CPU_ULRI |MIPS_CPU_RIXI ; +reserve_exception_space (0x1000 ,VECTORSPACING *64 );break ; } }
@@ -2124,6 +2128,8 @@ void cpu_probe(void)if (cpu ==0 ) __ua_limit = ~((1ull << cpu_vmbits) -1 );#endif + +reserve_exception_space (0 ,0x1000 ); }void cpu_report (void )
arch/mips/kernel/cpu-r3k-probe.c +3 -0
@@ -21,6 +21,7 @@#include <asm/fpu.h> #include <asm/mipsregs.h> #include <asm/elf.h> +#include <asm/traps.h> #include "fpu-probe.h"
@@ -158,6 +159,8 @@ void cpu_probe(void)cpu_set_fpu_opts (c); elsecpu_set_nofpu_opts (c ); + +reserve_exception_space (0 ,0x400 ); }void cpu_report (void )
arch/mips/kernel/traps.c +5 -5
@@ -2009,13 +2009,16 @@ void __noreturn nmi_exception_handler(struct pt_regs *regs)nmi_exit (); } -#define VECTORSPACING 0x100/* for EI/VI mode */ -unsigned long ebase;EXPORT_SYMBOL_GPL (ebase);unsigned long exception_handlers[32 ];unsigned long vi_handlers[64 ]; +void reserve_exception_space (phys_addr_t addr,unsigned long size) +{ +memblock_reserve (addr, size); +} +void __init *set_except_vector (int n,void *addr) {unsigned long handler = (unsigned long ) addr;
@@ -2367,10 +2370,7 @@ void __init trap_init(void)if (!cpu_has_mips_r2_r6) { ebase =CAC_BASE ; - ebase_pa =virt_to_phys ((void *)ebase); vec_size =0x400 ; - -memblock_reserve (ebase_pa, vec_size); }else {if (cpu_has_veic || cpu_has_vint) vec_size =0x200 +VECTORSPACING *64 ;
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 122/306 mptcp: always graft subflow socket to parent
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Paolo Abeni <[email protected]>
[ Upstream commit 866f26f2a9c33bc70eb0f07ffc37fd9424ffe501 ]
Currently, incoming subflows link to the parent socket, while outgoing ones link to a per subflow socket. The latter is not really needed, except at the initial connect() time and for the first subflow.
Always graft the outgoing subflow to the parent socket and free the unneeded ones early.
This allows some code cleanup, reduces the amount of memory used and will simplify the next patch
--- net/mptcp/protocol.c | 36 ++++++++++-------------------------- net/mptcp/protocol.h | 1 + net/mptcp/subflow.c | 3 +++ 3 files changed, 14 insertions(+), 26 deletions(-)
net/mptcp/protocol.c +10 -26
@@ -114,11 +114,7 @@ static int __mptcp_socket_create(struct mptcp_sock *msk)list_add (&subflow->node, &msk->conn_list);sock_hold (ssock->sk); subflow->request_mptcp =1 ; - -/* accept() will wait on first subflow sk_wq, and we always wakes up -* via msk->sk_socket -*/ -RCU_INIT_POINTER (msk->first->sk_wq, &sk->sk_socket->wq); +mptcp_sock_graft (msk->first, sk->sk_socket);return 0 ; }
@@ -2114,9 +2110,6 @@ static struct sock *mptcp_subflow_get_retrans(const struct mptcp_sock *msk)void __mptcp_close_ssk (struct sock *sk,struct sock *ssk,struct mptcp_subflow_context *subflow) { -bool dispose_socket = false; -struct socket *sock; -list_del (&subflow->node);lock_sock_nested (ssk,SINGLE_DEPTH_NESTING );
@@ -2124,11 +2117,8 @@ void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,/* if we are invoked by the msk cleanup code, the subflow is * already orphaned */ - sock = ssk->sk_socket; -if (sock) { - dispose_socket = sock != sk->sk_socket; +if (ssk->sk_socket)sock_orphan (ssk); - } subflow->disposable =1 ;
@@ -2146,8 +2136,6 @@ void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,__sock_put (ssk); }release_sock (ssk); -if (dispose_socket) -iput (SOCK_INODE (sock));sock_put (ssk); }
@@ -2535,6 +2523,12 @@ static void __mptcp_destroy_sock(struct sock *sk)pr_debug ("msk=%p" , msk); +/* dispose the ancillatory tcp socket, if any */ +if (msk->subflow) { +iput (SOCK_INODE (msk->subflow)); + msk->subflow =NULL ; + } +/* be sure to always acquire the join list lock, to sync vs * mptcp_finish_join(). */
@@ -2585,20 +2579,10 @@ cleanup:inet_csk (sk)->icsk_mtup.probe_timestamp = tcp_jiffies32;list_for_each_entry (subflow, &mptcp_sk (sk)->conn_list, node) {struct sock *ssk =mptcp_subflow_tcp_sock (subflow); -bool slow, dispose_socket; -struct socket *sock; +bool slow =lock_sock_fast (ssk); - slow =lock_sock_fast (ssk); - sock = ssk->sk_socket; - dispose_socket = sock && sock != sk->sk_socket;sock_orphan (ssk);unlock_sock_fast (ssk, slow); - -/* for the outgoing subflows we additionally need to free -* the associated socket -*/ -if (dispose_socket) -iput (SOCK_INODE (sock)); }sock_orphan (sk);
@@ -3040,7 +3024,7 @@ void mptcp_finish_connect(struct sock *ssk)mptcp_rcv_space_init (msk, ssk); } -static void mptcp_sock_graft (struct sock *sk,struct socket *parent) +void mptcp_sock_graft (struct sock *sk,struct socket *parent) {write_lock_bh (&sk->sk_callback_lock);rcu_assign_pointer (sk->sk_wq, &parent->wq);
net/mptcp/protocol.h +1 -0
@@ -460,6 +460,7 @@ void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how);void __mptcp_close_ssk (struct sock *sk,struct sock *ssk,struct mptcp_subflow_context *subflow);void mptcp_subflow_reset (struct sock *ssk); +void mptcp_sock_graft (struct sock *sk,struct socket *parent);/* called with sk socket lock held */ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
net/mptcp/subflow.c +3 -0
@@ -1165,6 +1165,9 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,if (err && err != -EINPROGRESS ) goto failed_unlink; +/* discard the subflow socket */ +mptcp_sock_graft (ssk, sk->sk_socket); +iput (SOCK_INODE (sf));return err; failed_unlink:
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 123/306 mptcp: reset last_snd on subflow close
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Florian Westphal <[email protected]>
[ Upstream commit e0be4931f3fee2e04dec4013ea4f27ec2db8556f ]
Send logic caches last active subflow in the msk, so it needs to be cleared when the cached subflow is closed.
--- net/mptcp/protocol.c | 5 +++++ 1 file changed, 5 insertions(+)
net/mptcp/protocol.c +5 -0
@@ -2110,6 +2110,8 @@ static struct sock *mptcp_subflow_get_retrans(const struct mptcp_sock *msk)void __mptcp_close_ssk (struct sock *sk,struct sock *ssk,struct mptcp_subflow_context *subflow) { +struct mptcp_sock *msk =mptcp_sk (sk); +list_del (&subflow->node);lock_sock_nested (ssk,SINGLE_DEPTH_NESTING );
@@ -2138,6 +2140,9 @@ void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,release_sock (ssk);sock_put (ssk); + +if (ssk == msk->last_snd) + msk->last_snd =NULL ; }static unsigned int mptcp_sync_mss (struct sock *sk,u32 pmtu)
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 124/306 i2c: rcar: faster irq code to minimize HW race condition
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Wolfram Sang <[email protected]>
[ Upstream commit c7b514ec979e23a08c411f3d8ed39c7922751422 ]
To avoid the HW race condition on R-Car Gen2 and earlier, we need to write to ICMCR as soon as possible in the interrupt handler. We can improve this by writing a static value instead of masking out bits.
--- drivers/i2c/busses/i2c-rcar.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-rcar.c +4 -7
@@ -91,7 +91,6 @@#define RCAR_BUS_PHASE_START (MDBS | MIE | ESG)#define RCAR_BUS_PHASE_DATA (MDBS | MIE) -#define RCAR_BUS_MASK_DATA (~(ESG | FSB) & 0xFF)#define RCAR_BUS_PHASE_STOP (MDBS | MIE | FSB)#define RCAR_IRQ_SEND (MNR | MAL | MST | MAT | MDE)
@@ -621,7 +620,7 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)/* * This driver has a lock-free design because there are IP cores (at least * R-Car Gen2) which have an inherent race condition in their hardware design. -* There, we need to clear RCAR_BUS_MASK_DATA bits as soon as possible after +* There, we need to switch to RCAR_BUS_PHASE_DATA as soon as possible after * the interrupt was generated, otherwise an unwanted repeated message gets * generated. It turned out that taking a spinlock at the beginning of the ISR * was already causing repeated messages. Thus, this driver was converted to
@@ -630,13 +629,11 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)static irqreturn_t rcar_i2c_irq (int irq,void *ptr) {struct rcar_i2c_priv *priv = ptr; -u32 msr, val; +u32 msr;/* Clear START or STOP immediately, except for REPSTART after read */ -if (likely (!(priv->flags &ID_P_REP_AFTER_RD ))) { - val =rcar_i2c_read (priv,ICMCR ); -rcar_i2c_write (priv,ICMCR , val &RCAR_BUS_MASK_DATA ); - } +if (likely (!(priv->flags &ID_P_REP_AFTER_RD ))) +rcar_i2c_write (priv,ICMCR ,RCAR_BUS_PHASE_DATA ); msr =rcar_i2c_read (priv,ICMSR );
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 125/306 i2c: rcar: optimize cacheline to minimize HW race condition
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Wolfram Sang <[email protected]>
[ Upstream commit 25c2e0fb5fefb8d7847214cf114d94c7aad8e9ce ]
'flags' and 'io' are needed first, so they should be at the beginning of the private struct.
--- drivers/i2c/busses/i2c-rcar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-rcar.c +1 -1
@@ -119,6 +119,7 @@ enum rcar_i2c_type { };struct rcar_i2c_priv { +u32 flags;void __iomem *io;struct i2c_adapter adap;struct i2c_msg *msg;
@@ -129,7 +130,6 @@ struct rcar_i2c_priv {int pos;u32 icccr; -u32 flags;u8 recovery_icmcr;/* protected by adapter lock */ enum rcar_i2c_type devtype;struct i2c_client *slave;
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 126/306 scsi: pm80xx: Fix missing tag_free in NVMD DATA req
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: akshatzen <[email protected]>
[ Upstream commit 5d28026891c7041deec08cc5ddd8f3abd90195e1 ]
Tag was not freed in NVMD get/set data request failure scenario. This caused a tag leak each time a request failed.
--- drivers/scsi/pm8001/pm8001_hwi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +10 -4
@@ -3038,8 +3038,8 @@ void pm8001_mpi_set_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)complete (pm8001_ha->nvmd_completion);pm8001_dbg (pm8001_ha,MSG ,"Set nvm data complete!\n" );if ((dlen_status &NVMD_STAT ) !=0 ) { -pm8001_dbg (pm8001_ha,FAIL ,"Set nvm data error!\n" ); -return ; +pm8001_dbg (pm8001_ha,FAIL ,"Set nvm data error %x\n" , + dlen_status); } ccb->task =NULL ; ccb->ccb_tag =0xFFFFFFFF ;
@@ -3062,11 +3062,17 @@ pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)pm8001_dbg (pm8001_ha,MSG ,"Get nvm data complete!\n" );if ((dlen_status &NVMD_STAT ) !=0 ) { -pm8001_dbg (pm8001_ha,FAIL ,"Get nvm data error!\n" ); +pm8001_dbg (pm8001_ha,FAIL ,"Get nvm data error %x\n" , + dlen_status);complete (pm8001_ha->nvmd_completion); +/* We should free tag during failure also, the tag is not being +* freed by requesting path anywhere. +*/ + ccb->task =NULL ; + ccb->ccb_tag =0xFFFFFFFF ; +pm8001_tag_free (pm8001_ha, tag);return ; } -if (ir_tds_bn_dps_das_nvm & IPMode) {/* indirect mode - IR bit set */ pm8001_dbg (pm8001_ha,MSG ,"Get NVMD success, IR=1\n" );
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 127/306 scsi: ufs: WB is only available on LUN #0 to #7
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Jaegeuk Kim <[email protected]>
[ Upstream commit a2fca52ee640a04112ed9d9a137c940ea6ad288e ]
Kernel stack violation when getting unit_descriptor/wb_buf_alloc_units from rpmb LUN. The reason is that the unit descriptor length is different per LU.
The length of Normal LU is 45 while the one of rpmb LU is 35.
int ufshcd_read_desc_param(struct ufs_hba *hba, ...)
{
param_offset=41;
param_size=4;
buff_len=45;
...
buff_len=35 by rpmb LU;
if (is_kmalloc) {
/* Make sure we don't copy more data than available */
if (param_offset + param_size > buff_len)
param_size = buff_len - param_offset;
--> param_size = 250;
memcpy(param_read_buf, &desc_buf[param_offset], param_size);
--> memcpy(param_read_buf, desc_buf+41, 250);[ 141.868974][ T9174] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: wb_buf_alloc_units_show+0x11c/0x11c }
}
--- drivers/scsi/ufs/ufs-sysfs.c | 3 ++- drivers/scsi/ufs/ufs.h | 6 ++++-- drivers/scsi/ufs/ufshcd.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-)
drivers/scsi/ufs/ufs-sysfs.c +2 -1
@@ -792,7 +792,8 @@ static ssize_t _pname##_show(struct device *dev, \struct scsi_device *sdev =to_scsi_device (dev); \struct ufs_hba *hba =shost_priv (sdev->host); \u8 lun =ufshcd_scsi_to_upiu_lun (sdev->lun); \ -if (!ufs_is_valid_unit_desc_lun (&hba->dev_info, lun)) \ +if (!ufs_is_valid_unit_desc_lun (&hba->dev_info, lun, \ + _duname##_DESC_PARAM##_puname)) \return -EINVAL ; \ return ufs_sysfs_read_desc_param(hba, QUERY_DESC_IDN_##_duname, \ lun, _duname##_DESC_PARAM##_puname, buf, _size); \
drivers/scsi/ufs/ufs.h +4 -2
@@ -552,13 +552,15 @@ struct ufs_dev_info {* @return: true if the lun has a matching unit descriptor, false otherwise */ static inline bool ufs_is_valid_unit_desc_lun (struct ufs_dev_info *dev_info, -u8 lun) +u8 lun,u8 param_offset) {if (!dev_info || !dev_info->max_lu_supported) {pr_err ("Max General LU supported by UFS isn't initialized\n" );return false; } - +/* WB is available only for the logical unit from 0 to 7 */ +if (param_offset ==UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS ) +return lun <UFS_UPIU_MAX_WB_LUN_ID ;return lun ==UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported); }
drivers/scsi/ufs/ufshcd.c +1 -1
@@ -3427,7 +3427,7 @@ static inline int ufshcd_read_unit_desc_param(struct ufs_hba *hba,* Unit descriptors are only available for general purpose LUs (LUN id * from 0 to 7) and RPMB Well known LU. */ -if (!ufs_is_valid_unit_desc_lun (&hba->dev_info, lun)) +if (!ufs_is_valid_unit_desc_lun (&hba->dev_info, lun, param_offset))return -EOPNOTSUPP ; return ufshcd_read_desc_param(hba, QUERY_DESC_IDN_UNIT, lun,
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 128/306 scsi: ufs: Protect some contexts from unexpected clock scaling
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Can Guo <[email protected]>
[ Upstream commit 0e9d4ca43ba8112821397f56a26d20682001c011 ]
In contexts like suspend, shutdown, and error handling we need to suspend devfreq to make sure these contexts won't be disturbed by clock scaling. However, suspending devfreq is not enough since users can still trigger a clock scaling by manipulating the devfreq sysfs nodes like min/max_freq and governor even after devfreq is suspended. Moreover, mere suspending devfreq cannot synchroinze a clock scaling which has already been invoked through these sysfs nodes. Add one more flag in struct clk_scaling and wrap the entire func ufshcd_devfreq_scale() with the clk_scaling_lock, so that we can use this flag and clk_scaling_lock to control and synchronize clock scaling invoked through devfreq sysfs nodes.
--- drivers/scsi/ufs/ufshcd.c | 80 ++++++++++++++++++++++++--------------- drivers/scsi/ufs/ufshcd.h | 6 ++- 2 files changed, 54 insertions(+), 32 deletions(-)
drivers/scsi/ufs/ufshcd.c +49 -31
@@ -1184,19 +1184,30 @@ static int ufshcd_clock_scaling_prepare(struct ufs_hba *hba)*/ ufshcd_scsi_block_requests (hba);down_write (&hba->clk_scaling_lock); -if (ufshcd_wait_for_doorbell_clr (hba,DOORBELL_CLR_TOUT_US )) { + +if (!hba->clk_scaling.is_allowed || +ufshcd_wait_for_doorbell_clr (hba,DOORBELL_CLR_TOUT_US )) { ret = -EBUSY ;up_write (&hba->clk_scaling_lock);ufshcd_scsi_unblock_requests (hba); + goto out; } +/* let's not get into low power until clock scaling is completed */ +ufshcd_hold (hba, false); + +out:return ret; } -static void ufshcd_clock_scaling_unprepare (struct ufs_hba *hba) +static void ufshcd_clock_scaling_unprepare (struct ufs_hba *hba,bool writelock) { -up_write (&hba->clk_scaling_lock); +if (writelock) +up_write (&hba->clk_scaling_lock); +else +up_read (&hba->clk_scaling_lock);ufshcd_scsi_unblock_requests (hba); +ufshcd_release (hba); }/**
@@ -1211,13 +1222,11 @@ static void ufshcd_clock_scaling_unprepare(struct ufs_hba *hba)static int ufshcd_devfreq_scale (struct ufs_hba *hba,bool scale_up) {int ret =0 ; - -/* let's not get into low power until clock scaling is completed */ -ufshcd_hold (hba, false); +bool is_writelock = true; ret =ufshcd_clock_scaling_prepare (hba);if (ret) - goto out; +return ret;/* scale down the gear before scaling down clocks */ if (!scale_up) {
@@ -1243,14 +1252,12 @@ static int ufshcd_devfreq_scale(struct ufs_hba *hba, bool scale_up) }/* Enable Write Booster if we have scaled up else disable it */ -up_write (&hba->clk_scaling_lock); +downgrade_write (&hba->clk_scaling_lock); + is_writelock = false;ufshcd_wb_ctrl (hba, scale_up); -down_write (&hba->clk_scaling_lock); out_unprepare: -ufshcd_clock_scaling_unprepare (hba); -out: -ufshcd_release (hba); +ufshcd_clock_scaling_unprepare (hba, is_writelock);return ret; }
@@ -1524,7 +1531,7 @@ static ssize_t ufshcd_clkscale_enable_show(struct device *dev, {struct ufs_hba *hba =dev_get_drvdata (dev); -return snprintf (buf,PAGE_SIZE ,"%d\n" , hba->clk_scaling.is_allowed); +return snprintf (buf,PAGE_SIZE ,"%d\n" , hba->clk_scaling.is_enabled); } static ssize_t ufshcd_clkscale_enable_store(struct device *dev,
@@ -1538,7 +1545,7 @@ static ssize_t ufshcd_clkscale_enable_store(struct device *dev,return -EINVAL ; value = !!value; -if (value == hba->clk_scaling.is_allowed) +if (value == hba->clk_scaling.is_enabled) goto out;pm_runtime_get_sync (hba->dev);
@@ -1547,7 +1554,7 @@ static ssize_t ufshcd_clkscale_enable_store(struct device *dev,cancel_work_sync (&hba->clk_scaling.suspend_work);cancel_work_sync (&hba->clk_scaling.resume_work); - hba->clk_scaling.is_allowed = value; + hba->clk_scaling.is_enabled = value;if (value) {ufshcd_resume_clkscaling (hba);
@@ -1885,8 +1892,6 @@ static void ufshcd_init_clk_scaling(struct ufs_hba *hba)snprintf (wq_name,sizeof (wq_name),"ufs_clkscaling_%d" , hba->host->host_no); hba->clk_scaling.workq =create_singlethread_workqueue (wq_name); - -ufshcd_clkscaling_init_sysfs (hba); }static void ufshcd_exit_clk_scaling (struct ufs_hba *hba)
@@ -1894,6 +1899,8 @@ static void ufshcd_exit_clk_scaling(struct ufs_hba *hba)if (!ufshcd_is_clkscaling_supported (hba))return ; +if (hba->clk_scaling.enable_attr.attr.name) +device_remove_file (hba->dev, &hba->clk_scaling.enable_attr);destroy_workqueue (hba->clk_scaling.workq);ufshcd_devfreq_remove (hba); }
@@ -1958,7 +1965,7 @@ static void ufshcd_clk_scaling_start_busy(struct ufs_hba *hba)if (!hba->clk_scaling.active_reqs++) queue_resume_work = true; -if (!hba->clk_scaling.is_allowed || hba->pm_op_in_progress) +if (!hba->clk_scaling.is_enabled || hba->pm_op_in_progress)return ;if (queue_resume_work)
@@ -5744,18 +5751,24 @@ static void ufshcd_err_handling_prepare(struct ufs_hba *hba)ufshcd_vops_resume (hba, pm_op); }else {ufshcd_hold (hba, false); -if (hba->clk_scaling.is_allowed) { +if (hba->clk_scaling.is_enabled) {cancel_work_sync (&hba->clk_scaling.suspend_work);cancel_work_sync (&hba->clk_scaling.resume_work);ufshcd_suspend_clkscaling (hba); } +down_write (&hba->clk_scaling_lock); + hba->clk_scaling.is_allowed = false; +up_write (&hba->clk_scaling_lock); } }static void ufshcd_err_handling_unprepare (struct ufs_hba *hba) {ufshcd_release (hba); -if (hba->clk_scaling.is_allowed) +down_write (&hba->clk_scaling_lock); + hba->clk_scaling.is_allowed = true; +up_write (&hba->clk_scaling_lock); +if (hba->clk_scaling.is_enabled)ufshcd_resume_clkscaling (hba);pm_runtime_put (hba->dev); }
@@ -7741,12 +7754,14 @@ static int ufshcd_add_lus(struct ufs_hba *hba) sizeof(struct ufs_pa_layer_attr)); hba->clk_scaling.saved_pwr_info.is_valid = true;if (!hba->devfreq) { + hba->clk_scaling.is_allowed = true; ret =ufshcd_devfreq_init (hba);if (ret) goto out; - } - hba->clk_scaling.is_allowed = true; + hba->clk_scaling.is_enabled = true; +ufshcd_clkscaling_init_sysfs (hba); + } }ufs_bsg_probe (hba);
@@ -8661,11 +8676,14 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)ufshcd_hold (hba, false); hba->clk_gating.is_suspended = true; -if (hba->clk_scaling.is_allowed) { +if (hba->clk_scaling.is_enabled) {cancel_work_sync (&hba->clk_scaling.suspend_work);cancel_work_sync (&hba->clk_scaling.resume_work);ufshcd_suspend_clkscaling (hba); } +down_write (&hba->clk_scaling_lock); + hba->clk_scaling.is_allowed = false; +up_write (&hba->clk_scaling_lock);if (req_dev_pwr_mode ==UFS_ACTIVE_PWR_MODE && req_link_state ==UIC_LINK_ACTIVE_STATE ) {
@@ -8762,8 +8780,6 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) goto out; set_link_active: -if (hba->clk_scaling.is_allowed) -ufshcd_resume_clkscaling (hba);ufshcd_vreg_set_hpm (hba);/* * Device hardware reset is required to exit DeepSleep. Also, for
@@ -8787,7 +8803,10 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)if (!ufshcd_set_dev_pwr_mode (hba,UFS_ACTIVE_PWR_MODE ))ufshcd_disable_auto_bkops (hba); enable_gating: -if (hba->clk_scaling.is_allowed) +down_write (&hba->clk_scaling_lock); + hba->clk_scaling.is_allowed = true; +up_write (&hba->clk_scaling_lock); +if (hba->clk_scaling.is_enabled)ufshcd_resume_clkscaling (hba); hba->clk_gating.is_suspended = false; hba->dev_info.b_rpm_dev_flush_capable = false;
@@ -8891,7 +8910,10 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) hba->clk_gating.is_suspended = false; -if (hba->clk_scaling.is_allowed) +down_write (&hba->clk_scaling_lock); + hba->clk_scaling.is_allowed = true; +up_write (&hba->clk_scaling_lock); +if (hba->clk_scaling.is_enabled)ufshcd_resume_clkscaling (hba);/* Enable Auto-Hibernate if configured */
@@ -8917,8 +8939,6 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)ufshcd_vreg_set_lpm (hba); disable_irq_and_vops_clks:ufshcd_disable_irq (hba); -if (hba->clk_scaling.is_allowed) -ufshcd_suspend_clkscaling (hba);ufshcd_setup_clocks (hba, false);if (ufshcd_is_clkgating_allowed (hba)) { hba->clk_gating.state =CLKS_OFF ;
@@ -9155,8 +9175,6 @@ void ufshcd_remove(struct ufs_hba *hba)ufshcd_exit_clk_scaling (hba);ufshcd_exit_clk_gating (hba); -if (ufshcd_is_clkscaling_supported (hba)) -device_remove_file (hba->dev, &hba->clk_scaling.enable_attr);ufshcd_hba_exit (hba); }EXPORT_SYMBOL_GPL (ufshcd_remove);
drivers/scsi/ufs/ufshcd.h +5 -1
@@ -419,7 +419,10 @@ struct ufs_saved_pwr_info {* @suspend_work: worker to suspend devfreq * @resume_work: worker to resume devfreq * @min_gear: lowest HS gear to scale down to -* @is_allowed: tracks if scaling is currently allowed or not +* @is_enabled: tracks if scaling is currently enabled or not, controlled by +clkscale_enable sysfs node +* @is_allowed: tracks if scaling is currently allowed or not, used to block +clock scaling which is not invoked from devfreq governor * @is_busy_started: tracks if busy period has started or not * @is_suspended: tracks if devfreq is suspended or not */
@@ -434,6 +437,7 @@ struct ufs_clk_scaling {struct work_struct suspend_work;struct work_struct resume_work;u32 min_gear; +bool is_enabled;bool is_allowed;bool is_busy_started;bool is_suspended;
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 129/306 udf: fix silent AED tagLocation corruption
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Steven J. Magnani <[email protected]>
[ Upstream commit 63c9e47a1642fc817654a1bc18a6ec4bbcc0f056 ]
When extending a file, udf_do_extend_file() may enter following empty indirect extent. At the end of udf_do_extend_file() we revert prev_epos to point to the last written extent. However if we end up not adding any further extent in udf_do_extend_file(), the reverting points prev_epos into the header area of the AED and following updates of the extents (in udf_update_extents()) will corrupt the header.
Make sure that we do not follow indirect extent if we are not going to add any more extents so that returning back to the last written extent works correctly.
--- fs/udf/inode.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/udf/inode.c +6 -3
@@ -544,11 +544,14 @@ static int udf_do_extend_file(struct inode *inode,udf_write_aext (inode, last_pos, &last_ext->extLocation, last_ext->extLength,1 ); +/* -* We've rewritten the last extent but there may be empty -* indirect extent after it - enter it. +* We've rewritten the last extent. If we are going to add +* more extents, we may need to enter possible following +* empty indirect extent. */ -udf_next_aext (inode, last_pos, &tmploc, &tmplen,0 ); +if (new_block_bytes || prealloc_len) +udf_next_aext (inode, last_pos, &tmploc, &tmplen,0 ); }/* Managed to do everything necessary? */
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 130/306 iommu/vt-d: Clear PRQ overflow only when PRQ is empty
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Lu Baolu <[email protected]>
[ Upstream commit 28a77185f1cd0650b664f54614143aaaa3a7a615 ]
It is incorrect to always clear PRO when it's set w/o first checking whether the overflow condition has been cleared. Current code assumes that if an overflow condition occurs it must have been cleared by earlier loop. However since the code runs in a threaded context, the overflow condition could occur even after setting the head to the tail under some extreme condition. To be sane, we should read both head/tail again when seeing a pending PRO and only clear PRO after all pending PRs have been handled.
--- drivers/iommu/intel/svm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/iommu/intel/svm.c +11 -2
@@ -1079,8 +1079,17 @@ static irqreturn_t prq_event_thread(int irq, void *d)* Clear the page request overflow bit and wake up all threads that * are waiting for the completion of this handling. */ -if (readl (iommu->reg +DMAR_PRS_REG ) &DMA_PRS_PRO ) -writel (DMA_PRS_PRO , iommu->reg +DMAR_PRS_REG ); +if (readl (iommu->reg +DMAR_PRS_REG ) &DMA_PRS_PRO ) { +pr_info_ratelimited ("IOMMU: %s: PRQ overflow detected\n" , + iommu->name); + head =dmar_readq (iommu->reg +DMAR_PQH_REG ) &PRQ_RING_MASK ; + tail =dmar_readq (iommu->reg +DMAR_PQT_REG ) &PRQ_RING_MASK ; +if (head == tail) { +writel (DMA_PRS_PRO , iommu->reg +DMAR_PRS_REG ); +pr_info_ratelimited ("IOMMU: %s: PRQ overflow cleared" , + iommu->name); + } + }if (!completion_done (&iommu->prq_complete))complete (&iommu->prq_complete);
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 131/306 mmc: mxs-mmc: Fix a resource leak in an error handling path in mxs_mmc_probe()
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Christophe JAILLET <[email protected]>
[ Upstream commit 0bb7e560f821c7770973a94e346654c4bdccd42c ]
If 'mmc_of_parse()' fails, we must undo the previous 'dma_request_chan()' call.
--- drivers/mmc/host/mxs-mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/mxs-mmc.c +1 -1
@@ -628,7 +628,7 @@ static int mxs_mmc_probe(struct platform_device *pdev) ret =mmc_of_parse (mmc);if (ret) - goto out_clk_disable; + goto out_free_dma; mmc->ocr_avail =MMC_VDD_32_33 |MMC_VDD_33_34 ;
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 132/306 mmc: mediatek: fix race condition between msdc_request_timeout and irq
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Chaotian Jing <[email protected]>
[ Upstream commit 0354ca6edd464a2cf332f390581977b8699ed081 ]
when get request SW timeout, if CMD/DAT xfer done irq coming right now, then there is race between the msdc_request_timeout work and irq handler, and the host->cmd and host->data may set to NULL in irq handler. also, current flow ensure that only one path can go to msdc_request_done(), so no need check the return value of cancel_delayed_work().
--- drivers/mmc/host/mtk-sd.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/mmc/host/mtk-sd.c +10 -8
@@ -1127,13 +1127,13 @@ static void msdc_track_cmd_data(struct msdc_host *host,static void msdc_request_done (struct msdc_host *host,struct mmc_request *mrq) {unsigned long flags; -bool ret; - ret =cancel_delayed_work (&host->req_timeout); -if (!ret) { -/* delay work already running */ -return ; - } +/* +* No need check the return value of cancel_delayed_work, as only ONE +* path will go here! +*/ +cancel_delayed_work (&host->req_timeout); +spin_lock_irqsave (&host->lock, flags); host->mrq =NULL ;spin_unlock_irqrestore (&host->lock, flags);
@@ -1155,7 +1155,7 @@ static bool msdc_cmd_done(struct msdc_host *host, int events,bool done = false;bool sbc_error;unsigned long flags; -u32 *rsp = cmd->resp; +u32 *rsp; if (mrq->sbc && cmd == mrq->cmd && (events & (MSDC_INT_ACMDRDY | MSDC_INT_ACMDCRCERR
@@ -1176,6 +1176,7 @@ static bool msdc_cmd_done(struct msdc_host *host, int events,if (done)return true; + rsp = cmd->resp;sdr_clr_bits (host->base +MSDC_INTEN , cmd_ints_mask);
@@ -1363,7 +1364,7 @@ static void msdc_data_xfer_next(struct msdc_host *host,static bool msdc_data_xfer_done (struct msdc_host *host,u32 events,struct mmc_request *mrq,struct mmc_data *data) { -struct mmc_command *stop = data->stop; +struct mmc_command *stop;unsigned long flags;bool done; unsigned int check_data = events &
@@ -1379,6 +1380,7 @@ static bool msdc_data_xfer_done(struct msdc_host *host, u32 events,if (done)return true; + stop = data->stop;if (check_data || (stop && stop->error)) { dev_dbg(host->dev, "DMA status: 0x%8X\n",
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 133/306 mmc: sdhci-iproc: Add ACPI bindings for the RPi
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Jeremy Linton <[email protected]>
[ Upstream commit 4f9833d3ec8da34861cd0680b00c73e653877eb9 ]
The RPi4 has an Arasan controller it carries over from the RPi3 and a newer eMMC2 controller. Because of a couple of quirks, it seems wiser to bind these controllers to the same driver that DT is using on this platform rather than the generic sdhci_acpi driver with PNP0D40.
So, BCM2847 describes the older Arasan and BRCME88C describes the newer eMMC2. The older Arasan is reusing an existing ACPI _HID used by other OSes booting these tables on the RPi.
With this change, Linux is capable of utilizing the SD card slot, and the Wi-Fi when booted with UEFI+ACPI on the RPi4.
--- drivers/mmc/host/sdhci-iproc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/mmc/host/sdhci-iproc.c +18 -0
@@ -296,9 +296,27 @@ static const struct of_device_id sdhci_iproc_of_match[] = {MODULE_DEVICE_TABLE (of, sdhci_iproc_of_match);#ifdef CONFIG_ACPI +/* +* This is a duplicate of bcm2835_(pltfrm_)data without caps quirks +* which are provided by the ACPI table. +*/ +static const struct sdhci_pltfm_data sdhci_bcm_arasan_data = { + .quirks =SDHCI_QUIRK_BROKEN_CARD_DETECTION | +SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | +SDHCI_QUIRK_NO_HISPD_BIT , + .quirks2 =SDHCI_QUIRK2_PRESET_VALUE_BROKEN , + .ops = &sdhci_iproc_32only_ops, +}; + +static const struct sdhci_iproc_data bcm_arasan_data = { + .pdata = &sdhci_bcm_arasan_data, +}; +static const struct acpi_device_id sdhci_iproc_acpi_ids[] = { { .id ="BRCM5871" , .driver_data = (kernel_ulong_t)&iproc_cygnus_data }, { .id ="BRCM5872" , .driver_data = (kernel_ulong_t)&iproc_data }, + { .id ="BCM2847" , .driver_data = (kernel_ulong_t)&bcm_arasan_data }, + { .id ="BRCME88C" , .driver_data = (kernel_ulong_t)&bcm2711_data }, {/* sentinel */ } };MODULE_DEVICE_TABLE (acpi, sdhci_iproc_acpi_ids);
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 134/306 platform/x86: amd-pmc: put device on error paths
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Pan Bian <[email protected]>
[ Upstream commit 745ed17a04f966406c8c27c8f992544336c06013 ]
Put the PCI device rdev on error paths to fix potential reference count leaks.
--- drivers/platform/x86/amd-pmc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/platform/x86/amd-pmc.c +11 -3
@@ -210,31 +210,39 @@ static int amd_pmc_probe(struct platform_device *pdev) dev->dev = &pdev->dev; rdev =pci_get_domain_bus_and_slot (0 ,0 ,PCI_DEVFN (0 ,0 )); -if (!rdev || !pci_match_id (pmc_pci_ids, rdev)) +if (!rdev || !pci_match_id (pmc_pci_ids, rdev)) { +pci_dev_put (rdev);return -ENODEV ; + } dev->cpu_id = rdev->device; err =pci_write_config_dword (rdev,AMD_PMC_SMU_INDEX_ADDRESS ,AMD_PMC_BASE_ADDR_LO );if (err) {dev_err (dev->dev,"error writing to 0x%x\n" ,AMD_PMC_SMU_INDEX_ADDRESS ); +pci_dev_put (rdev);return pcibios_err_to_errno (err); } err =pci_read_config_dword (rdev,AMD_PMC_SMU_INDEX_DATA , &val); -if (err) +if (err) { +pci_dev_put (rdev);return pcibios_err_to_errno (err); + } base_addr_lo = val &AMD_PMC_BASE_ADDR_HI_MASK ; err =pci_write_config_dword (rdev,AMD_PMC_SMU_INDEX_ADDRESS ,AMD_PMC_BASE_ADDR_HI );if (err) {dev_err (dev->dev,"error writing to 0x%x\n" ,AMD_PMC_SMU_INDEX_ADDRESS ); +pci_dev_put (rdev);return pcibios_err_to_errno (err); } err =pci_read_config_dword (rdev,AMD_PMC_SMU_INDEX_DATA , &val); -if (err) +if (err) { +pci_dev_put (rdev);return pcibios_err_to_errno (err); + } base_addr_hi = val &AMD_PMC_BASE_ADDR_LO_MASK ;pci_dev_put (rdev);
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 135/306 Platform: OLPC: Fix probe error handling
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Lubomir Rintel <[email protected]>
[ Upstream commit cec551ea0d41c679ed11d758e1a386e20285b29d ]
Reset ec_priv if probe ends unsuccessfully.
--- drivers/platform/olpc/olpc-ec.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/platform/olpc/olpc-ec.c +8 -7
@@ -426,11 +426,8 @@ static int olpc_ec_probe(struct platform_device *pdev)/* get the EC revision */ err =olpc_ec_cmd (EC_FIRMWARE_REV ,NULL ,0 , &ec->version,1 ); -if (err) { - ec_priv =NULL ; -kfree (ec); -return err; - } +if (err) + goto error; config.dev = pdev->dev.parent; config.driver_data = ec;
@@ -440,12 +437,16 @@ static int olpc_ec_probe(struct platform_device *pdev)if (IS_ERR (ec->dcon_rdev)) {dev_err (&pdev->dev,"failed to register DCON regulator\n" ); err =PTR_ERR (ec->dcon_rdev); -kfree (ec); -return err; + goto error; } ec->dbgfs_dir =olpc_ec_setup_debugfs (); +return 0 ; + +error: + ec_priv =NULL ; +kfree (ec);return err; }
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 136/306 powerpc/pci: Add ppc_md.discover_phbs()
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Oliver O'Halloran <[email protected]>
[ Upstream commit 5537fcb319d016ce387f818dd774179bc03217f5 ]
On many powerpc platforms the discovery and initalisation of pci_controllers (PHBs) happens inside of setup_arch(). This is very early in boot (pre-initcalls) and means that we're initialising the PHB long before many basic kernel services (slab allocator, debugfs, a real ioremap) are available.
On PowerNV this causes an additional problem since we map the PHB registers with ioremap(). As of commit d538aadc2718 ("powerpc/ioremap: warn on early use of ioremap()") a warning is printed because we're using the "incorrect" API to setup and MMIO mapping in searly boot. The kernel does provide early_ioremap(), but that is not intended to create long-lived MMIO mappings and a seperate warning is printed by generic code if early_ioremap() mappings are "leaked."
This is all fixable with dumb hacks like using early_ioremap() to setup the initial mapping then replacing it with a real ioremap later on in boot, but it does raise the question: Why the hell are we setting up the PHB's this early in boot?
The old and wise claim it's due to "hysterical rasins." Aside from amused grapes there doesn't appear to be any real reason to maintain the current behaviour. Already most of the newer embedded platforms perform PHB discovery in an arch_initcall and between the end of setup_arch() and the start of initcalls none of the generic kernel code does anything PCI related. On powerpc scanning PHBs occurs in a subsys_initcall so it should be possible to move the PHB discovery to a core, postcore or arch initcall.
This patch adds the ppc_md.discover_phbs hook and a core_initcall stub that calls it. The core_initcalls are the earliest to be called so this will any possibly issues with dependency between initcalls. This isn't just an academic issue either since on pseries and PowerNV EEH init occurs in an arch_initcall and depends on the pci_controllers being available, similarly the creation of pci_dns occurs at core_initcall_sync (i.e. between core and postcore initcalls). These problems need to be addressed seperately.
--- arch/powerpc/include/asm/machdep.h | 3 +++ arch/powerpc/kernel/pci-common.c | 10 ++++++++++ 2 files changed, 13 insertions(+)
arch/powerpc/include/asm/machdep.h +3 -0
@@ -59,6 +59,9 @@ struct machdep_calls {int (*pcibios_root_bridge_prepare)(struct pci_host_bridge *bridge); +/* finds all the pci_controllers present at boot */ +void (*discover_phbs)(void ); +/* To setup PHBs when using automatic OF platform driver for PCI */ int (*pci_setup_phb)(struct pci_controller *host);
arch/powerpc/kernel/pci-common.c +10 -0
@@ -1699,3 +1699,13 @@ static void fixup_hide_host_resource_fsl(struct pci_dev *dev) }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MOTOROLA ,PCI_ANY_ID , fixup_hide_host_resource_fsl);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_FREESCALE ,PCI_ANY_ID , fixup_hide_host_resource_fsl); + + +static int __init discover_phbs (void ) +{ +if (ppc_md.discover_phbs) + ppc_md.discover_phbs (); + +return 0 ; +} +core_initcall (discover_phbs);
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 137/306 spi: stm32: make spurious and overrun interrupts visible
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Alain Volmat <[email protected]>
[ Upstream commit c64e7efe46b7de21937ef4b3594d9b1fc74f07df ]
We do not expect to receive spurious interrupts so rise a warning if it happens.
RX overrun is an error condition that signals a corrupted RX stream both in dma and in irq modes. Report the error and abort the transfer in either cases.
--- drivers/spi/spi-stm32.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/spi/spi-stm32.c +4 -11
@@ -928,8 +928,8 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id) mask |=STM32H7_SPI_SR_RXP ;if (!(sr & mask)) { -dev_dbg (spi->dev,"spurious IT (sr=0x%08x, ier=0x%08x)\n" , - sr, ier); +dev_warn (spi->dev,"spurious IT (sr=0x%08x, ier=0x%08x)\n" , + sr, ier);spin_unlock_irqrestore (&spi->lock, flags);return IRQ_NONE ; }
@@ -956,15 +956,8 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id) }if (sr &STM32H7_SPI_SR_OVR ) { -dev_warn (spi->dev,"Overrun: received value discarded\n" ); -if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len >0 ))) -stm32h7_spi_read_rxfifo (spi, false); -/* -* If overrun is detected while using DMA, it means that -* something went wrong, so stop the current transfer -*/ -if (spi->cur_usedma) - end = true; +dev_err (spi->dev,"Overrun: RX data lost\n" ); + end = true; }if (sr &STM32H7_SPI_SR_EOT ) {
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 138/306 powerpc: improve handling of unrecoverable system reset
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Nicholas Piggin <[email protected]>
[ Upstream commit 11cb0a25f71818ca7ab4856548ecfd83c169aa4d ]
If an unrecoverable system reset hits in process context, the system does not have to panic. Similar to machine check, call nmi_exit() before die().
--- arch/powerpc/kernel/traps.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/kernel/traps.c +4 -1
@@ -503,8 +503,11 @@ void system_reset_exception(struct pt_regs *regs)die ("Unrecoverable nested System Reset" , regs,SIGABRT );#endif /* Must die if the interrupt is not recoverable */ -if (!(regs->msr &MSR_RI )) +if (!(regs->msr &MSR_RI )) { +/* For the reason explained in die_mce, nmi_exit before die */ +nmi_exit ();die ("Unrecoverable System Reset" , regs,SIGABRT ); + }if (saved_hsrrs) {mtspr (SPRN_HSRR0 , hsrr0);
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 139/306 powerpc/perf: Record counter overflow always if SAMPLE_IP is unset
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Athira Rajeev <[email protected]>
[ Upstream commit d137845c973147a22622cc76c7b0bc16f6206323 ]
While sampling for marked events, currently we record the sample only if the SIAR valid bit of Sampled Instruction Event Register (SIER) is set. SIAR_VALID bit is used for fetching the instruction address from Sampled Instruction Address Register(SIAR). But there are some usecases, where the user is interested only in the PMU stats at each counter overflow and the exact IP of the overflow event is not required. Dropping SIAR invalid samples will fail to record some of the counter overflows in such cases.
Example of such usecase is dumping the PMU stats (event counts) after some regular amount of instructions/events from the userspace (ex: via ptrace). Here counter overflow is indicated to userspace via signal handler, and captured by monitoring and enabling I/O signaling on the event file descriptor. In these cases, we expect to get sample/overflow indication after each specified sample_period.
Perf event attribute will not have PERF_SAMPLE_IP set in the sample_type if exact IP of the overflow event is not requested. So while profiling if SAMPLE_IP is not set, just record the counter overflow irrespective of SIAR_VALID check.
--- arch/powerpc/perf/core-book3s.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
arch/powerpc/perf/core-book3s.c +15 -4
@@ -2149,7 +2149,17 @@ static void record_and_restart(struct perf_event *event, unsigned long val, left += period;if (left <=0 ) left = period; - record =siar_valid (regs); + +/* +* If address is not requested in the sample via +* PERF_SAMPLE_IP, just record that sample irrespective +* of SIAR valid check. +*/ +if (event->attr.sample_type &PERF_SAMPLE_IP ) + record =siar_valid (regs); +else + record =1 ; + event->hw.last_period = event->hw.sample_period; }if (left <0x80000000LL )
@@ -2167,9 +2177,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val,* MMCR2. Check attr.exclude_kernel and address to drop the sample in * these cases. */ -if (event->attr.exclude_kernel && record) -if (is_kernel_addr (mfspr (SPRN_SIAR ))) - record =0 ; +if (event->attr.exclude_kernel && + (event->attr.sample_type &PERF_SAMPLE_IP ) && +is_kernel_addr (mfspr (SPRN_SIAR ))) + record =0 ;/* * Finally record data if requested.
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 140/306 HID: logitech-dj: add support for the new lightspeed connection iteration
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Filipe Laíns <[email protected]>
[ Upstream commit fab3a95654eea01d6b0204995be8b7492a00d001 ]
This new connection type is the new iteration of the Lightspeed connection and will probably be used in some of the newer gaming devices. It is currently use in the G Pro X Superlight.
This patch should be backported to older versions, as currently the driver will panic when seing the unsupported connection. This isn't an issue when using the receiver that came with the device, as Logitech has been using different PIDs when they change the connection type, but is an issue when using a generic receiver (well, generic Lightspeed receiver), which is the case of the one in the Powerplay mat. Currently, the only generic Ligthspeed receiver we support, and the only one that exists AFAIK, is ther Powerplay.
As it stands, the driver will panic when seeing a G Pro X Superlight connected to the Powerplay receiver and won't send any input events to userspace! The kernel will warn about this so the issue should be easy to identify, but it is still very worrying how hard it will fail :(
[915977.398471] logitech-djreceiver 0003:046D:C53A.0107: unusable device of type UNKNOWN (0x0f) connected on slot 1
--- drivers/hid/hid-logitech-dj.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-dj.c +6 -1
@@ -995,7 +995,12 @@ static void logi_hidpp_recv_queue_notif(struct hid_device *hdev, workitem.reports_supported |=STD_KEYBOARD ;break ;case 0x0d : - device_type ="eQUAD Lightspeed 1_1" ; + device_type ="eQUAD Lightspeed 1.1" ; +logi_hidpp_dev_conn_notif_equad (hdev, hidpp_report, &workitem); + workitem.reports_supported |=STD_KEYBOARD ; +break ; +case 0x0f : + device_type ="eQUAD Lightspeed 1.2" ;logi_hidpp_dev_conn_notif_equad (hdev, hidpp_report, &workitem); workitem.reports_supported |=STD_KEYBOARD ;break ;
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 141/306 powerpc/64: Fix stack trace not displaying final frame
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Michael Ellerman <[email protected]>
[ Upstream commit e3de1e291fa58a1ab0f471a4b458eff2514e4b5f ]
In commit bf13718bc57a ("powerpc: show registers when unwinding interrupt frames") we changed our stack dumping logic to show the full registers whenever we find an interrupt frame on the stack.
However we didn't notice that on 64-bit this doesn't show the final frame, ie. the interrupt that brought us in from userspace, whereas on 32-bit it does.
That is due to confusion about the size of that last frame. The code in show_stack() calls validate_sp(), passing it STACK_INT_FRAME_SIZE to check the sp is at least that far below the top of the stack.
However on 64-bit that size is too large for the final frame, because it includes the red zone, but we don't allocate a red zone for the first frame.
So add a new define that encodes the correct size for 32-bit and 64-bit, and use it in show_stack().
This results in the full trace being shown on 64-bit, eg:
sysrq: Trigger a crash
Kernel panic - not syncing: sysrq triggered crash CPU: 0 PID: 83 Comm: sh Not tainted 5.11.0-rc2-gcc-8.2.0-00188-g571abcb96b10-dirty #649 Call Trace: [c00000000a1c3ac0] [c000000000897b70] dump_stack+0xc4/0x114 (unreliable) [c00000000a1c3b00] [c00000000014334c] panic+0x178/0x41c [c00000000a1c3ba0] [c00000000094e600] sysrq_handle_crash+0x40/0x50 [c00000000a1c3c00] [c00000000094ef98] __handle_sysrq+0xd8/0x210 [c00000000a1c3ca0] [c00000000094f820] write_sysrq_trigger+0x100/0x188 [c00000000a1c3ce0] [c0000000005559dc] proc_reg_write+0x10c/0x1b0 [c00000000a1c3d10] [c000000000479950] vfs_write+0xf0/0x360 [c00000000a1c3d60] [c000000000479d9c] ksys_write+0x7c/0x140 [c00000000a1c3db0] [c00000000002bf5c] system_call_exception+0x19c/0x2c0 [c00000000a1c3e10] [c00000000000d35c] system_call_common+0xec/0x278 --- interrupt: c00 at 0x7fff9fbab428 NIP: 00007fff9fbab428 LR: 000000001000b724 CTR: 0000000000000000 REGS: c00000000a1c3e80 TRAP: 0c00 Not tainted (5.11.0-rc2-gcc-8.2.0-00188-g571abcb96b10-dirty) MSR: 900000000280f033 <SF,HV,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE> CR: 22002884 XER: 00000000 IRQMASK: 0 GPR00: 0000000000000004 00007fffc3cb8960 00007fff9fc59900 0000000000000001 GPR04: 000000002a4b32d0 0000000000000002 0000000000000063 0000000000000063 GPR08: 000000002a4b32d0 0000000000000000 0000000000000000 0000000000000000 GPR12: 0000000000000000 00007fff9fcca9a0 0000000000000000 0000000000000000 GPR16: 0000000000000000 0000000000000000 0000000000000000 00000000100b8fd0 GPR20: 000000002a4b3485 00000000100b8f90 0000000000000000 0000000000000000 GPR24: 000000002a4b0440 00000000100e77b8 0000000000000020 000000002a4b32d0 GPR28: 0000000000000001 0000000000000002 000000002a4b32d0 0000000000000001 NIP [00007fff9fbab428] 0x7fff9fbab428 LR [000000001000b724] 0x1000b724 --- interrupt: c00
--- arch/powerpc/include/asm/ptrace.h | 3 +++ arch/powerpc/kernel/asm-offsets.c | 2 +- arch/powerpc/kernel/process.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/ptrace.h +3 -0
@@ -70,6 +70,9 @@ struct pt_regs };#endif + +#define STACK_FRAME_WITH_PT_REGS (STACK_FRAME_OVERHEAD + sizeof(struct pt_regs)) +#ifdef __powerpc64__/*
arch/powerpc/kernel/asm-offsets.c +1 -1
@@ -309,7 +309,7 @@ int main(void)/* Interrupt register frame */ DEFINE (INT_FRAME_SIZE ,STACK_INT_FRAME_SIZE ); -DEFINE (SWITCH_FRAME_SIZE ,STACK_FRAME_OVERHEAD +sizeof (struct pt_regs )); +DEFINE (SWITCH_FRAME_SIZE ,STACK_FRAME_WITH_PT_REGS );STACK_PT_REGS_OFFSET (GPR0 , gpr[0 ]);STACK_PT_REGS_OFFSET (GPR1 , gpr[1 ]);STACK_PT_REGS_OFFSET (GPR2 , gpr[2 ]);
arch/powerpc/kernel/process.c +1 -1
@@ -2176,7 +2176,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack,* See if this is an exception frame. * We look for the "regshere" marker in the current frame. */ -if (validate_sp (sp, tsk,STACK_INT_FRAME_SIZE ) +if (validate_sp (sp, tsk,STACK_FRAME_WITH_PT_REGS ) && stack[STACK_FRAME_MARKER ] ==STACK_FRAME_REGS_MARKER ) {struct pt_regs *regs = (struct pt_regs *) (sp +STACK_FRAME_OVERHEAD );
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 142/306 iommu/amd: Fix performance counter initialization
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Suravee Suthikulpanit <[email protected]>
[ Upstream commit 6778ff5b21bd8e78c8bd547fd66437cf2657fd9b ]
Certain AMD platforms enable power gating feature for IOMMU PMC, which prevents the IOMMU driver from updating the counter while trying to validate the PMC functionality in the init_iommu_perf_ctr(). This results in disabling PMC support and the following error message:
"AMD-Vi: Unable to read/write to IOMMU perf counter"
To workaround this issue, disable power gating temporarily by programming the counter source to non-zero value while validating the counter, and restore the prior state afterward.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201753
--- drivers/iommu/amd/init.c | 45 ++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 11 deletions(-)
drivers/iommu/amd/init.c +34 -11
@@ -12,6 +12,7 @@#include <linux/acpi.h> #include <linux/list.h> #include <linux/bitmap.h> +#include <linux/delay.h> #include <linux/slab.h> #include <linux/syscore_ops.h> #include <linux/interrupt.h>
@@ -254,6 +255,8 @@ static enum iommu_init_state init_state = IOMMU_START_STATE;static int amd_iommu_enable_interrupts (void );static int __init iommu_go_to_state (enum iommu_init_state state);static void init_device_table_dma (void ); +static int iommu_pc_get_set_reg (struct amd_iommu *iommu,u8 bank,u8 cntr, +u8 fxn,u64 *value,bool is_write);static bool amd_iommu_pre_enabled = true;
@@ -1712,13 +1715,11 @@ static int __init init_iommu_all(struct acpi_table_header *table)return 0 ; } -static int iommu_pc_get_set_reg (struct amd_iommu *iommu,u8 bank,u8 cntr, -u8 fxn,u64 *value,bool is_write); - -static void init_iommu_perf_ctr (struct amd_iommu *iommu) +static void __init init_iommu_perf_ctr (struct amd_iommu *iommu) { +int retry;struct pci_dev *pdev = iommu->dev; -u64 val =0xabcd , val2 =0 , save_reg =0 ; +u64 val =0xabcd , val2 =0 , save_reg, save_src;if (!iommu_feature (iommu,FEATURE_PC ))return ;
@@ -1726,17 +1727,39 @@ static void init_iommu_perf_ctr(struct amd_iommu *iommu) amd_iommu_pc_present = true;/* save the value to restore, if writable */ -if (iommu_pc_get_set_reg (iommu,0 ,0 ,0 , &save_reg, false)) +if (iommu_pc_get_set_reg (iommu,0 ,0 ,0 , &save_reg, false) || +iommu_pc_get_set_reg (iommu,0 ,0 ,8 , &save_src, false)) goto pc_false; -/* Check if the performance counters can be written to */ -if ((iommu_pc_get_set_reg (iommu,0 ,0 ,0 , &val, true)) || - (iommu_pc_get_set_reg (iommu,0 ,0 ,0 , &val2, false)) || - (val != val2)) +/* +* Disable power gating by programing the performance counter +* source to 20 (i.e. counts the reads and writes from/to IOMMU +* Reserved Register [MMIO Offset 1FF8h] that are ignored.), +* which never get incremented during this init phase. +* (Note: The event is also deprecated.) +*/ + val =20 ; +if (iommu_pc_get_set_reg (iommu,0 ,0 ,8 , &val, true)) goto pc_false; +/* Check if the performance counters can be written to */ + val =0xabcd ; +for (retry =5 ; retry; retry--) { +if (iommu_pc_get_set_reg (iommu,0 ,0 ,0 , &val, true) || +iommu_pc_get_set_reg (iommu,0 ,0 ,0 , &val2, false) || + val2) +break ; + +/* Wait about 20 msec for power gating to disable and retry. */ +msleep (20 ); + } +/* restore */ -if (iommu_pc_get_set_reg (iommu,0 ,0 ,0 , &save_reg, true)) +if (iommu_pc_get_set_reg (iommu,0 ,0 ,0 , &save_reg, true) || +iommu_pc_get_set_reg (iommu,0 ,0 ,8 , &save_src, true)) + goto pc_false; + +if (val != val2) goto pc_false;pci_info (pdev,"IOMMU performance counters supported\n" );
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 143/306 clk: qcom: gdsc: Implement NO_RET_PERIPH flag
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 785c02eb35009a4be6dbc68f4f7d916e90b7177d ]
In some rare occasions, we want to only set the RETAIN_MEM bit, but not the RETAIN_PERIPH one: this is seen on at least SDM630/636/660's GPU-GX GDSC, where unsetting and setting back the RETAIN_PERIPH bit will generate chaos and panics during GPU suspend time (mainly, the chaos is unaligned access).
For this reason, introduce a new NO_RET_PERIPH flag to the GDSC driver to address this corner case.
--- drivers/clk/qcom/gdsc.c | 10 ++++++++-- drivers/clk/qcom/gdsc.h | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/clk/qcom/gdsc.c +8 -2
@@ -183,7 +183,10 @@ static inline int gdsc_assert_reset(struct gdsc *sc)static inline void gdsc_force_mem_on (struct gdsc *sc) {int i; -u32 mask =RETAIN_MEM |RETAIN_PERIPH ; +u32 mask =RETAIN_MEM ; + +if (!(sc->flags &NO_RET_PERIPH )) + mask |=RETAIN_PERIPH ;for (i =0 ; i < sc->cxc_count; i++)regmap_update_bits (sc->regmap, sc->cxcs[i], mask, mask);
@@ -192,7 +195,10 @@ static inline void gdsc_force_mem_on(struct gdsc *sc)static inline void gdsc_clear_mem_on (struct gdsc *sc) {int i; -u32 mask =RETAIN_MEM |RETAIN_PERIPH ; +u32 mask =RETAIN_MEM ; + +if (!(sc->flags &NO_RET_PERIPH )) + mask |=RETAIN_PERIPH ;for (i =0 ; i < sc->cxc_count; i++)regmap_update_bits (sc->regmap, sc->cxcs[i], mask,0 );
drivers/clk/qcom/gdsc.h +2 -1
@@ -42,7 +42,7 @@ struct gdsc {#define PWRSTS_ON BIT(2)#define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON)#define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON) -const u8 flags; +const u16 flags;#define VOTABLE BIT(0)#define CLAMP_IO BIT(1)#define HW_CTRL BIT(2)
@@ -51,6 +51,7 @@ struct gdsc {#define POLL_CFG_GDSCR BIT(5)#define ALWAYS_ON BIT(6)#define RETAIN_FF_ENABLE BIT(7) +#define NO_RET_PERIPH BIT(8)struct reset_controller_dev *rcdev;unsigned int *resets;unsigned int reset_count;
Signature · 1 line
2.30.1
[email protected]
maintainerPATCH 144/306 sparc32: Limit memblock allocation to low memory
In reply to [email protected]From: Greg Kroah-Hartman <[email protected]>
From: Andreas Larsson <[email protected]>
[ Upstream commit bda166930c37604ffa93f2425426af6921ec575a ]
Commit cca079ef8ac29a7c02192d2bad2ffe4c0c5ffdd0 changed sparc32 to use memblocks instead of bootmem, but also made high memory available via memblock allocation which does not work together with e.g. phys_to_virt and can lead to kernel panic.
This changes back to only low memory being allocatable in the early stages, now using memblock allocation.
--- arch/sparc/mm/init_32.c | 3 +++ 1 file changed, 3 insertions(+)
arch/sparc/mm/init_32.c +3 -0
@@ -197,6 +197,9 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) size =memblock_phys_mem_size () -memblock_reserved_size (); *pages_avail = (size >>PAGE_SHIFT ) - high_pages; +/* Only allow low memory to be allocated via memblock allocation */ +memblock_set_current_limit (max_low_pfn <<PAGE_SHIFT ); +return max_pfn; }
Signature · 1 line
2.30.1