Commit Graph

1067918 Commits

Author SHA1 Message Date
Jaegeuk Kim
0874e4661d Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-5.15.y' into android14-5.15
* aosp/upstream-f2fs-stable-linux-5.15.y:
  f2fs: remove unnessary comment in __may_age_extent_tree
  f2fs: allocate node blocks for atomic write block replacement
  f2fs: use cow inode data when updating atomic write
  f2fs: remove power-of-two limitation of zoned device
  f2fs: allocate trace path buffer from names_cache
  f2fs: add has_enough_free_secs()
  f2fs: relax sanity check if checkpoint is corrupted
  f2fs: refactor f2fs_gc to call checkpoint in urgent condition
  f2fs: remove folio_detach_private() in .invalidate_folio and .release_folio
  f2fs: fix to call clear_page_private_reference in .{release,invalid}_folio
  f2fs: remove bulk remove_proc_entry() and unnecessary kobject_del()
  f2fs: support iopoll method
  f2fs: remove batched_trim_sections node description
  f2fs: fix to check return value of inc_valid_block_count()
  f2fs: fix to check return value of f2fs_do_truncate_blocks()
  f2fs: fix passing relative address when discard zones
  f2fs: fix potential corruption when moving a directory
  f2fs: add radix_tree_preload_end in error case
  f2fs: fix to recover quota data correctly
  f2fs: fix to check readonly condition correctly
  docs: f2fs: Correct instruction to disable checkpoint
  f2fs: fix to keep consistent i_gc_rwsem lock order
  f2fs: fix to drop all dirty pages during umount() if cp_error is set
  f2fs: fix to avoid use-after-free for cached IPU bio
  f2fs: remove unneeded in-memory i_crtime copy
  f2fs: use f2fs_hw_is_readonly() instead of bdev_read_only()
  f2fs: use common implementation of file type
  f2fs: merge lz4hc_compress_pages() to lz4_compress_pages()
  f2fs: convert to use sysfs_emit
  f2fs: set default compress option only when sb_has_compression
  f2fs: Fix system crash due to lack of free space in LFS
  f2fs: remove struct victim_selection default_v_ops
  f2fs: fix null pointer panic in tracepoint in __replace_atomic_write_block
  f2fs: fix iostat lock protection
  f2fs: fix align check for npo2
  f2fs: add compression feature check for all compress mount opt
  f2fs: convert is_extension_exist() to return bool type
  f2fs: fix scheduling while atomic in decompression path
  f2fs: preserve direct write semantics when buffering is forced
  f2fs: compress: fix to call f2fs_wait_on_page_writeback() in f2fs_write_raw_pages()
  f2fs: remove else in f2fs_write_cache_pages()
  f2fs: apply zone capacity to all zone type
  f2fs: fix to handle filemap_fdatawrite() error in f2fs_ioc_decompress_file/f2fs_ioc_compress_file
  f2fs: convert to MAX_SBI_FLAG instead of 32 in stat_show()
  f2fs: Fix discard bug on zoned block devices with 2MiB zone size
  f2fs: remove entire rb_entry sharing
  f2fs: factor out discard_cmd usage from general rb_tree use
  f2fs: factor out victim_entry usage from general rb_tree use
  f2fs: fix uninitialized skipped_gc_rwsem
  f2fs: handle dqget error in f2fs_transfer_project_quota()
  f2fs: convert to use bitmap API
  f2fs: export compress_percent and compress_watermark entries
  f2fs: make f2fs_sync_inode_meta() static
  f2fs: Fix f2fs_truncate_partial_nodes ftrace event

Bug: 273795759
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I260f4009b3bb6a0ffca20488d0ad0e41e92fb9d2
2023-04-26 17:03:06 -07:00
Carlos Llamas
bef7cc8154 ANDROID: 4/26/2023 KMI update
Set KMI_GENERATION=5 for 4/26 KMI update

1 function symbol(s) added
  'unsigned long dmabuf_page_pool_get_size(struct dmabuf_page_pool*)'

function symbol changed from 'int pkvm_iommu_register(struct device*, u64, phys_addr_t, size_t, struct device*)' to 'int pkvm_iommu_register(struct device*, u64, phys_addr_t, size_t, struct device*, u8)'
  CRC changed from 0x5b4f6732 to 0x884bf4b6
  type changed from 'int(struct device*, u64, phys_addr_t, size_t, struct device*)' to 'int(struct device*, u64, phys_addr_t, size_t, struct device*, u8)'
    parameter 6 of type 'u8' was added

function symbol 'int ___pskb_trim(struct sk_buff*, unsigned int)' changed
  CRC changed from 0x7d722404 to 0x5078bf09

function symbol 'struct sk_buff* __alloc_skb(unsigned int, gfp_t, int, int)' changed
  CRC changed from 0x7d394cb3 to 0x3065de54

function symbol 'struct sk_buff* __cfg80211_alloc_event_skb(struct wiphy*, struct wireless_dev*, enum nl80211_commands, enum nl80211_attrs, unsigned int, int, int, gfp_t)' changed
  CRC changed from 0x3415238f to 0x7d26f3e2

... 719 omitted; 722 symbols have only CRC changes

type 'struct netns_ipv6' changed
  member 'struct list_head mr6_tables' was added
  member 'struct fib_rules_ops* mr6_rules_ops' was added
  member 'struct mr_table* mrt6' was removed
  9 members ('atomic_t dev_addr_genid' .. 'u64 android_kabi_reserved1') changed
    offset changed by 128

Bug: 279074305
Change-Id: Iadf86cb97ff76e52a19de8ec4d12c46c35e712c5
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2023-04-26 16:23:52 +00:00
Mostafa Saleh
970a9ef174 ANDROID: KVM: arm64: iommu: Pass device specific flags to hypervisor
We need to pass some device specific flags that are detected from EL1
(as built-in sync device) to the hypervisor. The flags are defined
by the driver but hosted in the main iommu struct.

As we use SMCCC1.1 we only have 7 args, which were already used, so
mem_size is removed as it really not needed as all page donations
are 1 page. so passing the base address is enough.

Bug: 255266847
Change-Id: I14e6d2573d7a822334455999aa9fd6f01ac97450
Signed-off-by: Mostafa Saleh <smostafa@google.com>
2023-04-26 16:23:52 +00:00
Carlos Llamas
9d58eeb9d6 ANDROID: gki_defconfig: enable IPV6_MROUTE_MULTIPLE_TABLES
Enable support for multicast policy routing. This will allow border
router devices to run multiple routing tables simultaneously.

Bug: 233821827
Change-Id: Ib029f4db1c5bb9416c06813fa0b66c965fef8fd8
Signed-off-by: Carlos Llamas <cmllamas@google.com>
(cherry picked from commit c9e98bfeeeae4580143ec87b4f1f3ef8571dc331)
2023-04-26 16:23:52 +00:00
T.J. Mercier
0831e8804f ANDROID: dma-buf: heaps: dmabuf page pool spinlock should be spinlock_t
Address checkpatch warning:
WARNING: struct spinlock should be spinlock_t
+	struct spinlock lock;

Fixes: 060e38dce1 ("ANDROID: dma-buf: heaps: replace mutex lock with spinlock")
Bug: 275698445
Change-Id: I6f2fc7c5ec4bc56a43e8fa738577cb4b64cfcb3e
Signed-off-by: T.J. Mercier <tjmercier@google.com>
2023-04-26 16:23:52 +00:00
T.J. Mercier
1beded838c ANDROID: GKI: Update virtual_device symbol list for dmabuf_page_pool_get_size
Update symbol list after making the DMA-BUF heap page-pool helper
library built-in.

Bug: 275698445
Change-Id: Ib20070b0e2fa45fd3f3b6e3bd2236f64ba77f5fd
Signed-off-by: T.J. Mercier <tjmercier@google.com>
2023-04-26 16:23:52 +00:00
T.J. Mercier
1a1e567be4 ANDROID: GKI: Update db845c symbol list for dmabuf_page_pool_get_size
Update symbol list after making the DMA-BUF heap page-pool helper

Bug: 275698445
Change-Id: I676d44d7497cc33b552d1b6cbccbb89f4b4f088a
Signed-off-by: T.J. Mercier <tjmercier@google.com>
2023-04-26 16:23:52 +00:00
T.J. Mercier
7a3538cd40 ANDROID: dma-buf: heaps: Move dmabuf_page_pool struct out of the KMI
Users of dmabuf_page_pool should not need to refer to its fields, so
hide them from the KMI. Add dmabuf_page_pool_get_size to fullfill the
needs of users. Update the system_heap to use the new API.

Bug: 264474028
Bug: 275698445
Change-Id: I848ff52e73a13568f561deeb6aea48f40dc0960b
Signed-off-by: T.J. Mercier <tjmercier@google.com>
2023-04-26 16:23:52 +00:00
Wanwei Jiang
754ba89a30 ANDROID: GKI: Update symbol list for Amlogic
2 function symbol(s) added
  'void usb_disable_autosuspend(struct usb_device*)'
  'int usb_interrupt_msg(struct usb_device*, unsigned int, void*, int, int*, int)'

Bug: 279715656
Change-Id: I0cd97b7005849ed41e2461c383e8b9ddec19f128
Signed-off-by: Wanwei Jiang <wanwei.jiang@amlogic.com>
2023-04-26 20:19:32 +08:00
Kyle Tso
e568434983 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - dev_vprintk_emit

1 function symbol(s) added
  'int dev_vprintk_emit(int, const struct device*, const char*, va_list)'

Bug: 276898533
Change-Id: I8b1e4a13f27e08247bd9d69684c3ee7fc20a49bd
Signed-off-by: Kyle Tso <kyletso@google.com>
2023-04-26 10:11:41 +00:00
Greg Kroah-Hartman
ab338605b8 Merge changes Icdb539c6,I5d35ddaa,I59838b0a,I88efacf4 into android14-5.15
* changes:
  Merge 5.15.108 into android14-5.15
  ANDROID: db845c: Update list of module outs
  ANDROID: preserve CRC for xhci symbols
  Merge 5.15.107 into android14-5.15
2023-04-26 07:00:10 +00:00
Bart Van Assche
c4915fdc20 FROMLIST: scsi: ufs: Fix management of lrbp->cmd
ufshcd_queuecommand() may be called two times in a row for a SCSI
command before it is completed. Hence make the following changes:
- In the functions that submit a command, do not check the old value of
  lrbp->cmd nor clear lrbp->cmd in error paths.
- In ufshcd_release_scsi_cmd(), do not clear lrbp->cmd.

See also scsi_send_eh_cmnd().

This patch prevents that the following appears if a command times out:

WARNING: at drivers/ufs/core/ufshcd.c:2965 ufshcd_queuecommand+0x6f8/0x9a8
Call trace:
 ufshcd_queuecommand+0x6f8/0x9a8
 scsi_send_eh_cmnd+0x2c0/0x960
 scsi_eh_test_devices+0x100/0x314
 scsi_eh_ready_devs+0xd90/0x114c
 scsi_error_handler+0x2b4/0xb70
 kthread+0x16c/0x1e0

Fixes: 5a0b0cb9be ("[SCSI] ufs: Add support for sending NOP OUT UPIU")
Bug: 276080919
Link: https://lore.kernel.org/linux-scsi/20230417230656.523826-5-bvanassche@acm.org/T/#m0d16bcb0507d082036732005b2d85d0cfc068325
Change-Id: I6dfe0a51cfc354fae56ecebeedd8f7e181580cec
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-04-25 22:00:07 +00:00
Chungkai Mei
26265ecbab ANDROID: binder: set default min and max uclamp to 0 and SCHED_CAPACITY_SCALE
Don't use the uclamp of current task as the default uclamp for
binders, because the uclamp of current task influence
binders' placement when not in a transaction.

Just use default value 0 and SCHED_CAPACITY_SCALE for binders'
default uclamp min and max. Also replace set_inherited_uclamp with
set_binder_prio_uclamp

Bug: 277389699
Change-Id: I07c4f40c2689dbc7eb23e7d3e2a2f435353dc25f
Signed-off-by: Chungkai Mei <chungkai@google.com>
2023-04-25 17:35:21 +00:00
Marc Zyngier
972b60b7d3 BACKPORT: KVM: arm64: Make vcpu flag updates non-preemptible
Per-vcpu flags are updated using a non-atomic RMW operation.
Which means it is possible to get preempted between the read and
write operations.

Another interesting thing to note is that preemption also updates
flags, as we have some flag manipulation in both the load and put
operations.

It is thus possible to lose information communicated by either
load or put, as the preempted flag update will overwrite the flags
when the thread is resumed. This is specially critical if either
load or put has stored information which depends on the physical
CPU the vcpu runs on.

This results in really elusive bugs, and kudos must be given to
Mostafa for the long hours of debugging, and finally spotting
the problem.

Fix it by disabling preemption during the RMW operation, which
ensures that the state stays consistent. Also upgrade vcpu_get_flag
path to use READ_ONCE() to make sure the field is always atomically
accessed.

Fixes: e87abb73e5 ("KVM: arm64: Add helpers to manipulate vcpu flags among a set")
Reported-by: Mostafa Saleh <smostafa@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230418125737.2327972-1-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
(cherry picked from commit 35dcb3ac66)
[willdeacon@: also update __vcpu_copy_flag()]
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 278750073
Change-Id: I63058ff1494e4092dab9d29cb66c295dd8fe9d86
2023-04-25 17:23:29 +00:00
Fuad Tabba
12d85b76fc BACKPORT: KVM: arm64: Advertise ID_AA64PFR0_EL1.CSV2/3 to protected VMs
The existing pKVM code attempts to advertise CSV2/3 using values
initialized to 0, but never set. To advertise CSV2/3 to protected
guests, pass the CSV2/3 values to hyp when initializing hyp's
view of guests' ID_AA64PFR0_EL1.

Similar to non-protected KVM, these are system-wide, rather than
per cpu, for simplicity.

Fixes: 6c30bfb18d ("KVM: arm64: Add handlers for protected VM System Registers")
Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://lore.kernel.org/r/20230404152321.413064-1-tabba@google.com
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
(cherry picked from commit e81625218b)
[willdeacon@: fixed_config.h has been moved into kvm_pkvm.h]
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 278750073
Change-Id: I27821a28bcde0dbce3d45bac6cf4de20dcf299f9
2023-04-25 17:23:29 +00:00
Wanwei Jiang
d152f9ec2e ANDROID: GKI: Update symbol list for Amlogic
9 function symbol(s) added
  'struct phy* devm_of_phy_get(struct device*, struct device_node*, const char*)'
  'struct pci_host_bridge* devm_pci_alloc_host_bridge(struct device*, size_t)'
  'int pci_host_probe(struct pci_host_bridge*)'
  'struct irq_domain* pci_msi_create_irq_domain(struct fwnode_handle*, struct msi_domain_info*, struct irq_domain*)'
  'int pci_msi_enabled()'
  'void pci_remove_root_bus(struct pci_bus*)'
  'void pci_stop_root_bus(struct pci_bus*)'
  'unsigned long timespec64_to_jiffies(const struct timespec64*)'
  'u64 trace_clock_local()'

Bug: 279568816
Change-Id: Ib022845e8cf9cece0c3a9c5c208ce7911d0c27e2
Signed-off-by: Wanwei Jiang <wanwei.jiang@amlogic.com>
2023-04-25 17:21:18 +00:00
Greg Kroah-Hartman
4ea7053789 Merge 5.15.108 into android14-5.15
Changes in 5.15.108
	Revert "pinctrl: amd: Disable and mask interrupts on resume"
	ALSA: emu10k1: fix capture interrupt handler unlinking
	ALSA: hda/sigmatel: add pin overrides for Intel DP45SG motherboard
	ALSA: i2c/cs8427: fix iec958 mixer control deactivation
	ALSA: firewire-tascam: add missing unwind goto in snd_tscm_stream_start_duplex()
	ALSA: emu10k1: don't create old pass-through playback device on Audigy
	ALSA: hda/sigmatel: fix S/PDIF out on Intel D*45* motherboards
	Bluetooth: L2CAP: Fix use-after-free in l2cap_disconnect_{req,rsp}
	Bluetooth: Fix race condition in hidp_session_thread
	btrfs: print checksum type and implementation at mount time
	btrfs: fix fast csum implementation detection
	fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace
	mtdblock: tolerate corrected bit-flips
	mtd: rawnand: meson: fix bitmask for length in command word
	mtd: rawnand: stm32_fmc2: remove unsupported EDO mode
	mtd: rawnand: stm32_fmc2: use timings.mode instead of checking tRC_min
	KVM: arm64: PMU: Restore the guest's EL0 event counting after migration
	drm/i915/dsi: fix DSS CTL register offsets for TGL+
	clk: sprd: set max_register according to mapping range
	RDMA/irdma: Fix memory leak of PBLE objects
	RDMA/irdma: Increase iWARP CM default rexmit count
	RDMA/irdma: Add ipv4 check to irdma_find_listener()
	IB/mlx5: Add support for 400G_8X lane speed
	RDMA/cma: Allow UD qp_type to join multicast only
	bpf: tcp: Use sock_gen_put instead of sock_put in bpf_iter_tcp
	9p/xen : Fix use after free bug in xen_9pfs_front_remove due to race condition
	niu: Fix missing unwind goto in niu_alloc_channels()
	tcp: restrict net.ipv4.tcp_app_win
	drm/armada: Fix a potential double free in an error handling path
	qlcnic: check pci_reset_function result
	net: qrtr: Fix an uninit variable access bug in qrtr_tx_resume()
	sctp: fix a potential overflow in sctp_ifwdtsn_skip
	RDMA/core: Fix GID entry ref leak when create_ah fails
	udp6: fix potential access to stale information
	net: macb: fix a memory corruption in extended buffer descriptor mode
	skbuff: Fix a race between coalescing and releasing SKBs
	libbpf: Fix single-line struct definition output in btf_dump
	ARM: 9290/1: uaccess: Fix KASAN false-positives
	power: supply: cros_usbpd: reclassify "default case!" as debug
	wifi: mwifiex: mark OF related data as maybe unused
	i2c: imx-lpi2c: clean rx/tx buffers upon new message
	i2c: hisi: Avoid redundant interrupts
	efi: sysfb_efi: Add quirk for Lenovo Yoga Book X91F/L
	drm: panel-orientation-quirks: Add quirk for Lenovo Yoga Book X90F
	verify_pefile: relax wrapper length check
	asymmetric_keys: log on fatal failures in PE/pkcs7
	wifi: iwlwifi: mvm: fix mvmtxq->stopped handling
	ACPI: resource: Add Medion S17413 to IRQ override quirk
	counter: stm32-lptimer-cnt: Provide defines for clock polarities
	counter: stm32-timer-cnt: Provide defines for slave mode selection
	counter: Internalize sysfs interface code
	counter: 104-quad-8: Fix Synapse action reported for Index signals
	tracing: Add trace_array_puts() to write into instance
	tracing: Have tracing_snapshot_instance_cond() write errors to the appropriate instance
	i915/perf: Replace DRM_DEBUG with driver specific drm_dbg call
	drm/i915: fix race condition UAF in i915_perf_add_config_ioctl
	riscv: add icache flush for nommu sigreturn trampoline
	net: sfp: initialize sfp->i2c_block_size at sfp allocation
	net: phy: nxp-c45-tja11xx: add remove callback
	net: phy: nxp-c45-tja11xx: fix unsigned long multiplication overflow
	scsi: ses: Handle enclosure with just a primary component gracefully
	x86/PCI: Add quirk for AMD XHCI controller that loses MSI-X state in D3hot
	cgroup/cpuset: Wake up cpuset_attach_wq tasks in cpuset_cancel_attach()
	mptcp: use mptcp_schedule_work instead of open-coding it
	mptcp: stricter state check in mptcp_worker
	ubi: Fix failure attaching when vid_hdr offset equals to (sub)page size
	ubi: Fix deadlock caused by recursively holding work_sem
	powerpc/papr_scm: Update the NUMA distance table for the target node
	sched/fair: Move calculate of avg_load to a better location
	sched/fair: Fix imbalance overflow
	x86/rtc: Remove __init for runtime functions
	i2c: ocores: generate stop condition after timeout in polling mode
	nvme-pci: add NVME_QUIRK_BOGUS_NID for ADATA XPG GAMMIX S50
	nvme-pci: avoid the deepest sleep state on ZHITAI TiPro7000 SSDs
	nvme-pci: Crucial P2 has bogus namespace ids
	nvme-pci: add NVME_QUIRK_BOGUS_NID for Lexar NM610
	nvme-pci: add NVME_QUIRK_BOGUS_NID for Lexar NM760
	nvme-pci: mark Lexar NM760 as IGNORE_DEV_SUBNQN
	nvme-pci: add NVME_QUIRK_BOGUS_NID for T-FORCE Z330 SSD
	kexec: turn all kexec_mutex acquisitions into trylocks
	panic, kexec: make __crash_kexec() NMI safe
	counter: fix docum. build problems after filename change
	counter: Add the necessary colons and indents to the comments of counter_compi
	nvme-pci: avoid the deepest sleep state on ZHITAI TiPro5000 SSDs
	Linux 5.15.108

Change-Id: Icdb539c68f2ea04d37818cb4fe66b08384b77609
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-04-25 16:02:54 +00:00
Ulises Mendez Martinez
ccdc86a720 ANDROID: db845c: Update list of module outs
In commit 3ef52e4bcf ("net: qrtr: combine nameservice into main
module"), the ns.ko kernel module got merged into the qrtr module, so it
needs to be removed from the db845c list of modules as it is no longer
part of the build at all.

Bug: 279448025
Fixes: 3ef52e4bcf ("net: qrtr: combine nameservice into main module")
Change-Id: I5d35ddaa0a8bf68ec16800264cb1a0bd7581b4e5
Signed-off-by: Ulises Mendez Martinez <umendez@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-04-25 16:00:43 +00:00
xieliujie
f6f198900a ANDROID: ABI: Update oplus symbol list
1 function symbol(s) added
  'int __traceiter_android_vh_exit_signal(void*, struct task_struct*)'

1 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_exit_signal'

Bug: 193384408
Change-Id: Ifc16f21ce65413633dc7d6efb9ccf83499ed6776
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-04-25 19:13:42 +08:00
xieliujie
226f36eddd ANDROID: vendor_hooks: Add hooks for signal
Add hook to boost thread when process killed.

Bug: 237749933
Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: I7cc6f248397021f3a8271433144a0e582ed27cfa
(cherry picked from commit 709679142d583b0b7338d931fdd43b27b1bbf9e0)
2023-04-25 18:08:34 +08:00
xieliujie
a4d5b99e38 ANDROID: ABI: Update oplus symbol list
7 function symbol(s) added
  'int __traceiter_sched_stat_blocked(void*, struct task_struct*, u64)'
  'int __traceiter_sched_stat_iowait(void*, struct task_struct*, u64)'
  'int __traceiter_sched_stat_sleep(void*, struct task_struct*, u64)'
  'int __traceiter_sched_stat_wait(void*, struct task_struct*, u64)'
  'int __traceiter_sched_waking(void*, struct task_struct*)'
  'unsigned long get_wchan(struct task_struct*)'
  'void wq_worker_comm(char*, size_t, struct task_struct*)'

5 variable symbol(s) added
  'struct tracepoint __tracepoint_sched_stat_blocked'
  'struct tracepoint __tracepoint_sched_stat_iowait'
  'struct tracepoint __tracepoint_sched_stat_sleep'
  'struct tracepoint __tracepoint_sched_stat_wait'
  'struct tracepoint __tracepoint_sched_waking'

Bug: 193384408
Change-Id: Id64dd1beb21868d1c07d474cfc6346eeda4c9b74
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-04-25 02:14:19 +00:00
Liujie Xie
b7f527071c ANDROID: vendor_hooks: Export the tracepoints sched_stat_sleep
and sched_waking to let module probe them

Get task info about sleep and waking

Bug: 190422437
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: I828c93f531f84e6133c2c3a7f8faada51683afcf
(cherry picked from commit 13af062abf)
(cherry picked from commit 869954e72dac700580d0ea5734d07b574e41afe9)
2023-04-25 02:13:50 +00:00
Liujie Xie
c3c2917768 ANDROID: vendor_hooks: Export the tracepoints sched_stat_iowait, sched_stat_blocked, sched_stat_wait to let modules probe them
Get task info about scheduling delay, iowait, and block time.

It is used to get thread scheduling info when thread happened abnormal situation.

Bug: 189415303
Change-Id: Ib6b548f8a78de5b26d555e9a89e3cc79ea2d1024
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
(cherry picked from commit a6bb1af39d)
(cherry picked from commit 6d8d2ab52facfd6d5de2715e2470872e6a70cf22)
2023-04-25 02:12:21 +00:00
xieliujie
1bcf1fc767 ANDROID: vendor_hooks: export get_wchan
Export get_wchan to get the block reason.

It is used to get the block reason(why the thread blocked in Uninterrupted Sleep) when happened long D state. We use this information check if it's reasonable.

Bug: 205684022
Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: I7b65bb502b805e7dac13e5f9d725da1ff70fe306
(cherry picked from commit 0db6925868)
(cherry picked from commit de72c813d12537ea6ced87b39ffcad446815609a)
2023-04-25 02:09:48 +00:00
zhengding chen
38a713dc80 ANDROID: workqueue: export symbol of the function wq_worker_comm()
Export symbol of the function wq_worker_comm() in kernel/workqueue.c for dlkm to get the description of the kworker process. It is used to get the description when kworker thread happened abnormal situation.

Bug: 208394207
Signed-off-by: zhengding chen <chenzhengding@oppo.com>
Change-Id: I2e7ddd52a15e22e99e6596f16be08243af1bb473
(cherry picked from commit 28de741861)
(cherry picked from commit 87e0e98c25ba8e121975708943335e3abad651d9)
2023-04-25 01:58:41 +00:00
Martin Liu
be7357c438 ANDROID: Update the ABI symbol list
1 function symbol(s) added
  'int __traceiter_android_vh_si_meminfo(void*, struct sysinfo*)'

1 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_si_meminfo'

Bug: 277746082
Change-Id: I62025937489e1ddd61daf1377578bd8726707b8c
Signed-off-by: Martin Liu <liumartin@google.com>
2023-04-23 23:24:47 +00:00
Martin Liu
4d84e8c400 ANDROID: mm: Add vendor hook in si_meminfo
Add a vendor hook for meminfo fixup.

Bug: 277746082
Change-Id: Ifa7850f75ccdf862d900c9a6c00f165b07e84595
Signed-off-by: Martin Liu <liumartin@google.com>
2023-04-23 23:24:47 +00:00
Sajid Dalvi
336321c6f0 BACKPORT: FROMLIST: PCI: dwc: Wait for link up only if link is started
The upstream driver has added start/stop link inline functions that
result in quite a few changes to the designware code. The upstream patch
for this issue, builds on top of these changes. Since we are based on
5.15, it is cleaner to apply a simpler fix on top of the existing code.

In dw_pcie_host_init() regardless of whether the link has been started
or not, the code waits for the link to come up. Even in cases where
start_link() is not defined the code ends up spinning in a loop for 1
second. Since in some systems dw_pcie_host_init() gets called during
probe, this one second loop for each pcie interface instance ends up
extending the boot time.

Call trace when start_link() is not defined:
dw_pcie_wait_for_link << spins in a loop for 1 second
dw_pcie_host_init

Bug: 270085637
Link: https://lore.kernel.org/all/20230412093425.3659088-1-ajayagarwal@google.com/
Change-Id: Ibc42801fa06674e43e921b4976ec83c9fb5483cf
Signed-off-by: Sajid Dalvi <sdalvi@google.com>
2023-04-21 23:44:21 +00:00
Sebastian Ene
6e8704fc7a ANDROID: KVM: arm64: Clear the PTEs which are not refcounted on unmap path
With coalescing we don't refcount default PTE entries. Fix an issue
which clears out non-refcounted PTE entries on the unmap path.

Bug: 279165129
Change-Id: Ie4fdabcc420d54c1338272d38abbe393fc5ce75c
Signed-off-by: Sebastian Ene <sebastianene@google.com>
2023-04-21 16:56:37 +00:00
Wanwei Jiang
b53185721e ANDROID: GKI: Update symbol list for Amlogic
1 function symbol(s) added
  'int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler*, struct v4l2_ctrl_handler*, bool(*)(const struct v4l2_ctrl*), bool)'

Bug: 279005287
Change-Id: I2138206b8a88cb00e76d5fc398f2e2ce6a8c37f6
Signed-off-by: Wanwei Jiang <wanwei.jiang@amlogic.com>
2023-04-21 15:48:04 +00:00
Jiantao Zhang
d711563536 BACKPORT: USB: gadget: Fix use-after-free during usb config switch
In the process of switching USB config from rndis to other config,
if the hardware does not support the ->pullup callback, or the
hardware encounters a low probability fault, both of them may cause
the ->pullup callback to fail, which will then cause a system panic
(use after free).

The gadget drivers sometimes need to be unloaded regardless of the
hardware's behavior.

Analysis as follows:
=======================================================================
(1) write /config/usb_gadget/g1/UDC "none"

gether_disconnect+0x2c/0x1f8
rndis_disable+0x4c/0x74
composite_disconnect+0x74/0xb0
configfs_composite_disconnect+0x60/0x7c
usb_gadget_disconnect+0x70/0x124
usb_gadget_unregister_driver+0xc8/0x1d8
gadget_dev_desc_UDC_store+0xec/0x1e4

(2) rm /config/usb_gadget/g1/configs/b.1/f1

rndis_deregister+0x28/0x54
rndis_free+0x44/0x7c
usb_put_function+0x14/0x1c
config_usb_cfg_unlink+0xc4/0xe0
configfs_unlink+0x124/0x1c8
vfs_unlink+0x114/0x1dc

(3) rmdir /config/usb_gadget/g1/functions/rndis.gs4

panic+0x1fc/0x3d0
do_page_fault+0xa8/0x46c
do_mem_abort+0x3c/0xac
el1_sync_handler+0x40/0x78
0xffffff801138f880
rndis_close+0x28/0x34
eth_stop+0x74/0x110
dev_close_many+0x48/0x194
rollback_registered_many+0x118/0x814
unregister_netdev+0x20/0x30
gether_cleanup+0x1c/0x38
rndis_attr_release+0xc/0x14
kref_put+0x74/0xb8
configfs_rmdir+0x314/0x374

If gadget->ops->pullup() return an error, function rndis_close() will be
called, then it will causes a use-after-free problem.
=======================================================================

Fixes: 0a55187a1e ("USB: gadget core: Issue ->disconnect() callback from usb_gadget_disconnect()")
Signed-off-by: Jiantao Zhang <water.zhangjiantao@huawei.com>
Signed-off-by: TaoXue <xuetao09@huawei.com>
Link: https://lore.kernel.org/r/20221121130805.10735-1-water.zhangjiantao@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 273510696
Bug: 275027942
Change-Id: I702f324c5852d3b2448081b092fef464f8691989
(cherry picked from commit afdc12887f)
[ray: Resolved minor conflict in drivers/usb/gadget/udc/core.c]
Signed-off-by: Ray Chi <raychi@google.com>
(cherry picked from commit 2ce4ee5f2e02702ce61b07a170eeb9ffede0601a)
2023-04-21 08:44:29 +00:00
Rick Yiu
e34090d715 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - resched_curr
  - reweight_task
  - __traceiter_android_rvh_prepare_prio_fork
  - __traceiter_android_rvh_setscheduler
  - __traceiter_android_rvh_set_user_nice
  - __tracepoint_android_rvh_prepare_prio_fork
  - __tracepoint_android_rvh_setscheduler
  - __tracepoint_android_rvh_set_user_nice

Bug: 245675204
Change-Id: I5ff30450746ed2e31f9d214aefa531d1cffc1b5e
Signed-off-by: Rick Yiu <rickyiu@google.com>
2023-04-20 15:29:39 +00:00
Greg Kroah-Hartman
3299fb3685 Linux 5.15.108
Link: https://lore.kernel.org/r/20230418120305.520719816@linuxfoundation.org
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230419072156.965447596@linuxfoundation.org
Tested-by: Chris Paterson (CIP) <chris.paterson2@renesas.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20230419093700.102927265@linuxfoundation.org
Tested-by: Ron Economos <re@w6rz.net>
Link: https://lore.kernel.org/r/20230419132034.475843587@linuxfoundation.org
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Tested-by: Ron Economos <re@w6rz.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-20 12:13:57 +02:00
Xi Ruoyao
adef0cebea nvme-pci: avoid the deepest sleep state on ZHITAI TiPro5000 SSDs
commit d5d3c100ac upstream.

ZHITAI TiPro5000 SSDs has the same APST sleep problem as its cousin,
TiPro7000.  The quirk for TiPro7000 has been added in
commit 6b961bce50 ("nvme-pci: avoid the deepest sleep state on
ZHITAI TiPro7000 SSDs"), use the same quirk for TiPro5000.

The ASPT data from "nvme id-ctrl /dev/nvme1":

vid       : 0x1e49
ssvid     : 0x1e49
sn        : ZTA21T0KA2227304LM
mn        : ZHITAI TiPlus5000 1TB
fr        : ZTA09139
[...]
ps    0 : mp:6.50W operational enlat:0 exlat:0 rrt:0 rrl:0
         rwt:0 rwl:0 idle_power:- active_power:-
ps    1 : mp:5.80W operational enlat:0 exlat:0 rrt:1 rrl:1
         rwt:1 rwl:1 idle_power:- active_power:-
ps    2 : mp:3.60W operational enlat:0 exlat:0 rrt:2 rrl:2
         rwt:2 rwl:2 idle_power:- active_power:-
ps    3 : mp:0.0500W non-operational enlat:5000 exlat:10000 rrt:3 rrl:3
         rwt:3 rwl:3 idle_power:- active_power:-
ps    4 : mp:0.0025W non-operational enlat:8000 exlat:45000 rrt:4 rrl:4
         rwt:4 rwl:4 idle_power:- active_power:-

Reported-and-tested-by: Chang Feng <flukehn@gmail.com>
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-20 12:13:57 +02:00
Yanteng Si
c6897dfe2b counter: Add the necessary colons and indents to the comments of counter_compi
commit 0032ca576a upstream.

Since commit aaec1a0f76 ("counter: Internalize sysfs interface code")
introduce a warning as:

linux-next/Documentation/driver-api/generic-counter:234: ./include/linux/counter.h:43: WARNING: Unexpected indentation.
linux-next/Documentation/driver-api/generic-counter:234: ./include/linux/counter.h:45: WARNING: Block quote ends without a blank line; unexpected unindent.

Add the necessary colons and indents.

Fixes: aaec1a0f76 ("counter: Internalize sysfs interface code")
Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/26011e814d6eca02c7ebdbb92f171a49928a7e89.1640072891.git.vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-20 12:13:57 +02:00
Randy Dunlap
fa934784fb counter: fix docum. build problems after filename change
commit 7110acbdab upstream.

Fix documentation build warnings due to a source file being
renamed.

WARNING: kernel-doc '../scripts/kernel-doc -rst -enable-lineno -sphinx-version 1.8.5 -export ../drivers/counter/counter.c' failed with return code 2

Error: Cannot open file ../drivers/counter/counter.c

Fixes: aaec1a0f76 ("counter: Internalize sysfs interface code")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: linux-iio@vger.kernel.org
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20211005055157.22937-1-rdunlap@infradead.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-20 12:13:57 +02:00
Valentin Schneider
0cf2833400 panic, kexec: make __crash_kexec() NMI safe
commit 05c6257433 upstream.

Attempting to get a crash dump out of a debug PREEMPT_RT kernel via an NMI
panic() doesn't work.  The cause of that lies in the PREEMPT_RT definition
of mutex_trylock():

	if (IS_ENABLED(CONFIG_DEBUG_RT_MUTEXES) && WARN_ON_ONCE(!in_task()))
		return 0;

This prevents an nmi_panic() from executing the main body of
__crash_kexec() which does the actual kexec into the kdump kernel.  The
warning and return are explained by:

  6ce47fd961 ("rtmutex: Warn if trylock is called from hard/softirq context")
  [...]
  The reasons for this are:

      1) There is a potential deadlock in the slowpath

      2) Another cpu which blocks on the rtmutex will boost the task
	 which allegedly locked the rtmutex, but that cannot work
	 because the hard/softirq context borrows the task context.

Furthermore, grabbing the lock isn't NMI safe, so do away with kexec_mutex
and replace it with an atomic variable.  This is somewhat overzealous as
*some* callsites could keep using a mutex (e.g.  the sysfs-facing ones
like crash_shrink_memory()), but this has the benefit of involving a
single unified lock and preventing any future NMI-related surprises.

Tested by triggering NMI panics via:

  $ echo 1 > /proc/sys/kernel/panic_on_unrecovered_nmi
  $ echo 1 > /proc/sys/kernel/unknown_nmi_panic
  $ echo 1 > /proc/sys/kernel/panic

  $ ipmitool power diag

Link: https://lkml.kernel.org/r/20220630223258.4144112-3-vschneid@redhat.com
Fixes: 6ce47fd961 ("rtmutex: Warn if trylock is called from hard/softirq context")
Signed-off-by: Valentin Schneider <vschneid@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Baoquan He <bhe@redhat.com>
Cc: "Eric W . Biederman" <ebiederm@xmission.com>
Cc: Juri Lelli <jlelli@redhat.com>
Cc: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Wen Yang <wenyang.linux@foxmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-20 12:13:57 +02:00
Valentin Schneider
9e1e511119 kexec: turn all kexec_mutex acquisitions into trylocks
commit 7bb5da0d49 upstream.

Patch series "kexec, panic: Making crash_kexec() NMI safe", v4.


This patch (of 2):

Most acquistions of kexec_mutex are done via mutex_trylock() - those were
a direct "translation" from:

  8c5a1cf0ad ("kexec: use a mutex for locking rather than xchg()")

there have however been two additions since then that use mutex_lock():
crash_get_memory_size() and crash_shrink_memory().

A later commit will replace said mutex with an atomic variable, and
locking operations will become atomic_cmpxchg().  Rather than having those
mutex_lock() become while (atomic_cmpxchg(&lock, 0, 1)), turn them into
trylocks that can return -EBUSY on acquisition failure.

This does halve the printable size of the crash kernel, but that's still
neighbouring 2G for 32bit kernels which should be ample enough.

Link: https://lkml.kernel.org/r/20220630223258.4144112-1-vschneid@redhat.com
Link: https://lkml.kernel.org/r/20220630223258.4144112-2-vschneid@redhat.com
Signed-off-by: Valentin Schneider <vschneid@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Eric W . Biederman" <ebiederm@xmission.com>
Cc: Juri Lelli <jlelli@redhat.com>
Cc: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Baoquan He <bhe@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Wen Yang <wenyang.linux@foxmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-20 12:13:57 +02:00
Duy Truong
6fc7a53fcc nvme-pci: add NVME_QUIRK_BOGUS_NID for T-FORCE Z330 SSD
[ Upstream commit 74391b3e69 ]

Added a quirk to fix the TeamGroup T-Force Cardea Zero Z330 SSDs reporting
duplicate NGUIDs.

Signed-off-by: Duy Truong <dory@dory.moe>
Cc: stable@vger.kernel.org
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:57 +02:00
Juraj Pecigos
fa43e05919 nvme-pci: mark Lexar NM760 as IGNORE_DEV_SUBNQN
[ Upstream commit 1231363aec ]

A system with more than one of these SSDs will only have one usable.
The kernel fails to detect more than one nvme device due to duplicate
cntlids.

before:
[    9.395229] nvme 0000:01:00.0: platform quirk: setting simple suspend
[    9.395262] nvme nvme0: pci function 0000:01:00.0
[    9.395282] nvme 0000:03:00.0: platform quirk: setting simple suspend
[    9.395305] nvme nvme1: pci function 0000:03:00.0
[    9.409873] nvme nvme0: Duplicate cntlid 1 with nvme1, subsys nqn.2022-07.com.siliconmotion:nvm-subsystem-sn-                    , rejecting
[    9.409982] nvme nvme0: Removing after probe failure status: -22
[    9.427487] nvme nvme1: allocated 64 MiB host memory buffer.
[    9.445088] nvme nvme1: 16/0/0 default/read/poll queues
[    9.449898] nvme nvme1: Ignoring bogus Namespace Identifiers

after:
[    1.161890] nvme 0000:01:00.0: platform quirk: setting simple suspend
[    1.162660] nvme nvme0: pci function 0000:01:00.0
[    1.162684] nvme 0000:03:00.0: platform quirk: setting simple suspend
[    1.162707] nvme nvme1: pci function 0000:03:00.0
[    1.191354] nvme nvme0: allocated 64 MiB host memory buffer.
[    1.193378] nvme nvme1: allocated 64 MiB host memory buffer.
[    1.211044] nvme nvme1: 16/0/0 default/read/poll queues
[    1.211080] nvme nvme0: 16/0/0 default/read/poll queues
[    1.216145] nvme nvme0: Ignoring bogus Namespace Identifiers
[    1.216261] nvme nvme1: Ignoring bogus Namespace Identifiers

Adding the NVME_QUIRK_IGNORE_DEV_SUBNQN quirk to resolves the issue.

Signed-off-by: Juraj Pecigos <kernel@juraj.dev>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Stable-dep-of: 74391b3e69 ("nvme-pci: add NVME_QUIRK_BOGUS_NID for T-FORCE Z330 SSD")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:56 +02:00
Abhijit
a814fc9e6e nvme-pci: add NVME_QUIRK_BOGUS_NID for Lexar NM760
[ Upstream commit 80b2624094 ]

Add a quirk to fix Lexar NM760 SSD drives reporting duplicate nsids.

Signed-off-by: Abhijit <abhijit@abhijittomar.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Stable-dep-of: 74391b3e69 ("nvme-pci: add NVME_QUIRK_BOGUS_NID for T-FORCE Z330 SSD")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:56 +02:00
Shyamin Ayesh
972e06d09e nvme-pci: add NVME_QUIRK_BOGUS_NID for Lexar NM610
[ Upstream commit 200dccd07d ]

Lexar NM610 reports bogus eui64 values that appear to be the same across
all drives. Quirk them out so they are not marked as "non globally unique"
duplicates.

Signed-off-by: Shyamin Ayesh <me@shyamin.com>
[patch formatting]
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Stable-dep-of: 74391b3e69 ("nvme-pci: add NVME_QUIRK_BOGUS_NID for T-FORCE Z330 SSD")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:56 +02:00
Tobias Gruetzmacher
cf77383213 nvme-pci: Crucial P2 has bogus namespace ids
[ Upstream commit d6c52fa3e9 ]

This adds a quirk for the Crucial P2.

Signed-off-by: Tobias Gruetzmacher <tobias-git@23.gs>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Stable-dep-of: 74391b3e69 ("nvme-pci: add NVME_QUIRK_BOGUS_NID for T-FORCE Z330 SSD")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:56 +02:00
Ning Wang
5a19b9a49a nvme-pci: avoid the deepest sleep state on ZHITAI TiPro7000 SSDs
[ Upstream commit 6b961bce50 ]

When ZHITAI TiPro7000 SSDs entered deepest power state(ps4)
it has the same APST sleep problem as Kingston A2000.
by chance the system crashes and displays the same dmesg info:

https://bugzilla.kernel.org/show_bug.cgi?id=195039#c65

As the Archlinux wiki suggest (enlat + exlat) < 25000 is fine
and my testing shows no system crashes ever since.
Therefore disabling the deepest power state will fix the APST sleep issue.

https://wiki.archlinux.org/title/Solid_state_drive/NVMe

This is the APST data from 'nvme id-ctrl /dev/nvme1'

NVME Identify Controller:
vid       : 0x1e49
ssvid     : 0x1e49
sn        : [...]
mn        : ZHITAI TiPro7000 1TB
fr        : ZTA32F3Y
[...]
ps    0 : mp:3.50W operational enlat:5 exlat:5 rrt:0 rrl:0
          rwt:0 rwl:0 idle_power:- active_power:-
ps    1 : mp:3.30W operational enlat:50 exlat:100 rrt:1 rrl:1
          rwt:1 rwl:1 idle_power:- active_power:-
ps    2 : mp:2.80W operational enlat:50 exlat:200 rrt:2 rrl:2
          rwt:2 rwl:2 idle_power:- active_power:-
ps    3 : mp:0.1500W non-operational enlat:500 exlat:5000 rrt:3 rrl:3
          rwt:3 rwl:3 idle_power:- active_power:-
ps    4 : mp:0.0200W non-operational enlat:2000 exlat:60000 rrt:4 rrl:4
          rwt:4 rwl:4 idle_power:- active_power:-

Signed-off-by: Ning Wang <ningwang35@outlook.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Stable-dep-of: 74391b3e69 ("nvme-pci: add NVME_QUIRK_BOGUS_NID for T-FORCE Z330 SSD")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:56 +02:00
Stefan Reiter
65f5dc5dff nvme-pci: add NVME_QUIRK_BOGUS_NID for ADATA XPG GAMMIX S50
[ Upstream commit 3765fad508 ]

ADATA XPG GAMMIX S50 drives report bogus eui64 values that appear to
be the same across drives in one system. Quirk them out so they are
not marked as "non globally unique" duplicates.

Signed-off-by: Stefan Reiter <stefan@pimaker.at>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Stable-dep-of: 74391b3e69 ("nvme-pci: add NVME_QUIRK_BOGUS_NID for T-FORCE Z330 SSD")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:56 +02:00
Gregor Herburger
3daaa5f7aa i2c: ocores: generate stop condition after timeout in polling mode
[ Upstream commit f8160d3b35 ]

In polling mode, no stop condition is generated after a timeout. This
causes SCL to remain low and thereby block the bus. If this happens
during a transfer it can cause slaves to misinterpret the subsequent
transfer and return wrong values.

To solve this, pass the ETIMEDOUT error up from ocores_process_polling()
instead of setting STATE_ERROR directly. The caller is adjusted to call
ocores_process_timeout() on error both in polling and in IRQ mode, which
will set STATE_ERROR and generate a stop condition.

Fixes: 69c8c0c0ef ("i2c: ocores: add polling interface")
Signed-off-by: Gregor Herburger <gregor.herburger@tq-group.com>
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Acked-by: Peter Korsgaard <peter@korsgaard.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Federico Vaga <federico.vaga@cern.ch>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:56 +02:00
Matija Glavinic Pecotic
0af686415c x86/rtc: Remove __init for runtime functions
[ Upstream commit 775d3c514c ]

set_rtc_noop(), get_rtc_noop() are after booting, therefore their __init
annotation is wrong.

A crash was observed on an x86 platform where CMOS RTC is unused and
disabled via device tree. set_rtc_noop() was invoked from ntp:
sync_hw_clock(), although CONFIG_RTC_SYSTOHC=n, however sync_cmos_clock()
doesn't honour that.

  Workqueue: events_power_efficient sync_hw_clock
  RIP: 0010:set_rtc_noop
  Call Trace:
   update_persistent_clock64
   sync_hw_clock

Fix this by dropping the __init annotation from set/get_rtc_noop().

Fixes: c311ed6183 ("x86/init: Allow DT configured systems to disable RTC at boot time")
Signed-off-by: Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@nokia.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/59f7ceb1-446b-1d3d-0bc8-1f0ee94b1e18@nokia.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:56 +02:00
Vincent Guittot
b11ff3ef4d sched/fair: Fix imbalance overflow
[ Upstream commit 91dcf1e806 ]

When local group is fully busy but its average load is above system load,
computing the imbalance will overflow and local group is not the best
target for pulling this load.

Fixes: 0b0695f2b3 ("sched/fair: Rework load_balance()")
Reported-by: Tingjia Cao <tjcao980311@gmail.com>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Tingjia Cao <tjcao980311@gmail.com>
Link: https://lore.kernel.org/lkml/CABcWv9_DAhVBOq2=W=2ypKE9dKM5s2DvoV8-U0+GDwwuKZ89jQ@mail.gmail.com/T/
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:56 +02:00
zgpeng
90e3dc5101 sched/fair: Move calculate of avg_load to a better location
[ Upstream commit 0635490078 ]

In calculate_imbalance function, when the value of local->avg_load is
greater than or equal to busiest->avg_load, the calculated sds->avg_load is
not used. So this calculation can be placed in a more appropriate position.

Signed-off-by: zgpeng <zgpeng@tencent.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Samuel Liao <samuelliao@tencent.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/1649239025-10010-1-git-send-email-zgpeng@tencent.com
Stable-dep-of: 91dcf1e806 ("sched/fair: Fix imbalance overflow")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:56 +02:00
Aneesh Kumar K.V
6d1353781b powerpc/papr_scm: Update the NUMA distance table for the target node
[ Upstream commit b277fc793d ]

Platform device helper routines won't update the NUMA distance table
while creating a platform device, even if the device is present on a
NUMA node that doesn't have memory or CPU. This is especially true for
pmem devices. If the target node of the pmem device is not online, we
find the nearest online node to the device and associate the pmem device
with that online node. To find the nearest online node, we should have
the numa distance table updated correctly. Update the distance
information during the device probe.

For a papr scm device on NUMA node 3 distance_lookup_table value for
distance_ref_points_depth = 2 before and after fix is below:

Before fix:
  node 3 distance depth 0  - 0
  node 3 distance depth 1  - 0
  node 4 distance depth 0  - 4
  node 4 distance depth 1  - 2
  node 5 distance depth 0  - 5
  node 5 distance depth 1  - 1

After fix
  node 3 distance depth 0  - 3
  node 3 distance depth 1  - 1
  node 4 distance depth 0  - 4
  node 4 distance depth 1  - 2
  node 5 distance depth 0  - 5
  node 5 distance depth 1  - 1

Without the fix, the nearest numa node to the pmem device (NUMA node 3)
will be picked as 4. After the fix, we get the correct numa node which
is 5.

Fixes: da1115fdbd ("powerpc/nvdimm: Pick nearby online node if the device node is not online")
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230404041433.1781804-1-aneesh.kumar@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:13:56 +02:00