Commit Graph

974984 Commits

Author SHA1 Message Date
Minchan Kim
134ac2d4dc FROMLIST: mm: replace migrate_prep with lru_add_drain_all
Currently, migrate_prep is merely a wrapper of lru_cache_add_all.
There is not much to gain from having additional abstraction.

Use lru_add_drain_all instead of migrate_prep, which would be more
descriptive.

note: migrate_prep_local in compaction.c changed into lru_add_drain
to avoid CPU schedule cost with involving many other CPUs to keep
keep old behavior.

Bug: 180018981
Link: https://lore.kernel.org/linux-mm/20210310161429.399432-1-minchan@kernel.org/
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I1bd3fcb13993e8a7a7961ceec817ac17304364cb
2021-03-12 12:35:53 -08:00
Jan Stancek
a71a3e1ce6 UPSTREAM: mm: migrate: initialize err in do_migrate_pages
After commit 236c32eb10 ("mm: migrate: clean up migrate_prep{_local}")',
do_migrate_pages can return uninitialized variable 'err' (which is
propagated to user-space as error) when 'from' and 'to' nodesets are
identical.  This can be reproduced with LTP migrate_pages01, which calls
migrate_pages() with same set for both old/new_nodes.

Add 'err' initialization back.

Bug: 180018981
Link: https://lkml.kernel.org/r/456a021c7ef3636d7668cec9dcb4a446a4244812.1609855564.git.jstancek@redhat.com
Fixes: 236c32eb10 ("mm: migrate: clean up migrate_prep{_local}")
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Yang Shi <shy828301@gmail.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Song Liu <songliubraving@fb.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit f555befd18)
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: Ia0b7012dc4191bf3af5ca015939d9e37a1f7ec43
2021-03-12 12:35:52 -08:00
Yang Shi
059eaf82c0 UPSTREAM: mm: migrate: clean up migrate_prep{_local}
The migrate_prep{_local} never fails, so it is pointless to have return
value and check the return value.

Bug: 180018981
Link: https://lkml.kernel.org/r/20201113205359.556831-5-shy828301@gmail.com
Signed-off-by: Yang Shi <shy828301@gmail.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Song Liu <songliubraving@fb.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 236c32eb10)
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I26ae0a4240c704e6127b51532e5de8ba778edd6e
2021-03-12 12:35:52 -08:00
Giuliano Procida
be409db652 ANDROID: Clang LTO: Only set -fvisibility=hidden for x86
Otherwise this upsets ABI monitoring.

Leaf changes summary: 2689 artifacts changed
Changed leaf types summary: 16 leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 2472 Changed, 136 Added functions
Removed/Changed/Added variables summary: 0 Removed, 47 Changed, 18 Added variables

136 Added functions:

  [A] 'function int ___pskb_trim(sk_buff*, unsigned int)'
  [A] 'function void __cfi_slowpath(uint64_t, void*, void*)'
  [A] 'function void __dynamic_dev_dbg(_ddebug*, const device*, const char*, ...)'
  [A] 'function void __dynamic_pr_debug(_ddebug*, const char*, ...)'
  [A] 'function ktime_t __hrtimer_get_remaining(const hrtimer*, bool)'
  [A] 'function zoneref* __next_zones_zonelist(zoneref*, zone_type, nodemask_t*)'
  [A] 'function int __nla_validate(const nlattr*, int, int, const nla_policy*, unsigned int, netlink_ext_ack*)'
  [A] 'function void __skb_get_hash(sk_buff*)'
  [A] 'function sk_buff* __skb_gso_segment(sk_buff*, netdev_features_t, bool)'
  [A] 'function int __trace_bputs(unsigned long int, const char*)'
  [A] 'function int __trace_printk(unsigned long int, const char*, ...)'
  [A] 'function int _raw_spin_trylock_bh(raw_spinlock_t*)'
  [A] 'function int add_memory_subsection(int, u64, u64)'
  [A] 'function int alarm_cancel(alarm*)'
  [A] 'function void alarm_init(alarm*, alarmtimer_type, enum alarmtimer_restart (alarm*, typedef ktime_t)*)'
  [A] 'function void alarm_start_relative(alarm*, ktime_t)'
  [A] 'function int bgpio_init(gpio_chip*, device*, unsigned long int, void*, void*, void*, void*, void*, unsigned long int)'
  [A] 'function int bitmap_parselist(const char*, unsigned long int*, int)'
  [A] 'function int bitmap_parselist_user(const char*, unsigned int, unsigned long int*, int)'
  [A] 'function void bt_err(const char*, ...)'
  [A] 'function int cgroup_path_ns(cgroup*, char*, size_t, cgroup_namespace*)'
  [A] 'function void clk_hw_set_rate_range(clk_hw*, unsigned long int, unsigned long int)'
  [A] 'function unsigned int cpufreq_quick_get(unsigned int)'
  [A] 'function s64 cpuidle_governor_latency_req(unsigned int)'
  [A] 'function int cpuidle_register_governor(cpuidle_governor*)'
  [A] 'function int cpupri_find_fitness(cpupri*, task_struct*, cpumask*, typedef bool (task_struct*, int)*)'
  [A] 'function __sum16 csum_ipv6_magic(const in6_addr*, const in6_addr*, __u32, __u8, __wsum)'
  [A] 'function __wsum csum_partial(void*, int, __wsum)'
  [A] 'function dentry* debugfs_create_blob(const char*, umode_t, dentry*, debugfs_blob_wrapper*)'
  [A] 'function dentry* debugfs_create_symlink(const char*, dentry*, const char*)'
  [A] 'function int dev_pm_genpd_remove_notifier(device*)'
  [A] 'function int dev_pm_genpd_set_next_wakeup(device*, ktime_t)'
  [A] 'function int dev_pm_opp_register_notifier(device*, notifier_block*)'
  [A] 'function int dev_pm_opp_unregister_notifier(device*, notifier_block*)'
  [A] 'function int devfreq_add_governor(devfreq_governor*)'
  [A] 'function int devfreq_remove_governor(devfreq_governor*)'
  [A] 'function void device_remove_groups(device*, const attribute_group**)'
  [A] 'function ssize_t device_show_int(device*, device_attribute*, char*)'
  [A] 'function ssize_t device_store_int(device*, device_attribute*, const char*, size_t)'
  [A] 'function backlight_device* devm_backlight_device_register(device*, const char*, device*, void*, const backlight_ops*, const backlight_properties*)'
  [A] 'function int devm_blk_ksm_init(device*, blk_keyslot_manager*, unsigned int)'
  [A] 'function void devm_extcon_dev_unregister(device*, extcon_dev*)'
  [A] 'function usb_phy* devm_usb_get_phy_by_node(device*, device_node*, notifier_block*)'
  [A] 'function bool drm_edid_is_valid(edid*)'
  [A] 'function bool drm_mode_is_420_only(const drm_display_info*, const drm_display_mode*)'
  [A] 'function pid* find_get_pid(pid_t)'
  [A] 'function task_struct* find_task_by_vpid(pid_t)'
  [A] 'function const char* fwnode_get_name(const fwnode_handle*)'
  [A] 'function fwnode_handle* fwnode_get_named_child_node(const fwnode_handle*, const char*)'
  [A] 'function pid* get_task_pid(task_struct*, pid_type)'
  [A] 'function unsigned long int get_unmapped_area(file*, unsigned long int, unsigned long int, unsigned long int, unsigned long int)'
  [A] 'function void getboottime64(timespec64*)'
  [A] 'function zone_type gfp_zone(gfp_t)'
  [A] 'function void gro_cells_destroy(gro_cells*)'
  [A] 'function int gro_cells_init(gro_cells*, net_device*)'
  [A] 'function int gro_cells_receive(gro_cells*, sk_buff*)'
  [A] 'function hci_dev* hci_alloc_dev()'
  [A] 'function void hci_free_dev(hci_dev*)'
  [A] 'function int hci_recv_frame(hci_dev*, sk_buff*)'
  [A] 'function int hci_register_dev(hci_dev*)'
  [A] 'function void hci_unregister_dev(hci_dev*)'
  [A] 'function bool hrtimer_active(const hrtimer*)'
  [A] 'function i2c_client* i2c_new_scanned_device(i2c_adapter*, i2c_board_info*, const unsigned short int*, int (i2c_adapter*, unsigned short int)*)'
  [A] 'function i2c_adapter* i2c_verify_adapter(device*)'
  [A] 'function int input_mt_assign_slots(input_dev*, int*, const input_mt_pos*, int, int)'
  [A] 'function void input_mt_drop_unused(input_dev*)'
  [A] 'function void input_mt_report_finger_count(input_dev*, int)'
  [A] 'function void input_mt_sync_frame(input_dev*)'
  [A] 'function unsigned long int int_sqrt(unsigned long int)'
  [A] 'function int iommu_attach_group(iommu_domain*, iommu_group*)'
  [A] 'function void iommu_detach_group(iommu_domain*, iommu_group*)'
  [A] 'function int iommu_get_msi_cookie(iommu_domain*, dma_addr_t)'
  [A] 'function phys_addr_t iommu_iova_to_phys(iommu_domain*, dma_addr_t)'
  [A] 'function __sum16 ip_compute_csum(void*, int)'
  [A] 'function bool ipv6_ext_hdr(u8)'
  [A] 'function int ipv6_skip_exthdr(const sk_buff*, int, u8*, __be16*)'
  [A] 'function int kstrtoull_from_user(const char*, size_t, unsigned int, long long unsigned int*)'
  [A] 'function llist_node* llist_reverse_order(llist_node*)'
  [A] 'function nlattr* nla_find(const nlattr*, int, int)'
  [A] 'function nlattr* nla_reserve(sk_buff*, int, int)'
  [A] 'function nlattr* nla_reserve_64bit(sk_buff*, int, int, int)'
  [A] 'function int nvmem_cell_read_u32(device*, const char*, u32*)'
  [A] 'function thermal_cooling_device* of_devfreq_cooling_register(device_node*, devfreq*)'
  [A] 'function device_node* of_find_node_by_phandle(phandle)'
  [A] 'function bool of_graph_is_present(const device_node*)'
  [A] 'function int of_platform_device_destroy(device*, void*)'
  [A] 'function int of_property_read_variable_u16_array(const device_node*, const char*, u16*, size_t, size_t)'
  [A] 'function int param_get_ullong(char*, const kernel_param*)'
  [A] 'function task_struct* pick_highest_pushable_task(rq*, int)'
  [A] 'function pid_t pid_nr_ns(pid*, pid_namespace*)'
  [A] 'function void proc_remove(proc_dir_entry*)'
  [A] 'function void proc_set_user(proc_dir_entry*, kuid_t, kgid_t)'
  [A] 'function void ps2_begin_command(ps2dev*)'
  [A] 'function void ps2_cmd_aborted(ps2dev*)'
  [A] 'function int ps2_command(ps2dev*, u8*, unsigned int)'
  [A] 'function void ps2_drain(ps2dev*, size_t, unsigned int)'
  [A] 'function void ps2_end_command(ps2dev*)'
  [A] 'function bool ps2_handle_ack(ps2dev*, u8)'
  [A] 'function bool ps2_handle_response(ps2dev*, u8)'
  [A] 'function void ps2_init(ps2dev*, serio*)'
  [A] 'function int ps2_sendbyte(ps2dev*, u8, unsigned int)'
  [A] 'function int ps2_sliced_command(ps2dev*, u8)'
  [A] 'function void qdisc_reset(Qdisc*)'
  [A] 'function rb_node* rb_last(const rb_root*)'
  [A] 'function int remove_memory_subsection(int, u64, u64)'
  [A] 'function int scsi_device_quiesce(scsi_device*)'
  [A] 'function void scsi_remove_device(scsi_device*)'
  [A] 'function void serio_rescan(serio*)'
  [A] 'function void serio_unregister_child_port(serio*)'
  [A] 'function void show_regs(pt_regs*)'
  [A] 'function void si_meminfo(sysinfo*)'
  [A] 'function void si_swapinfo(sysinfo*)'
  [A] 'function int skb_append_pagefrags(sk_buff*, page*, int, size_t)'
  [A] 'function __wsum skb_checksum(const sk_buff*, int, int, __wsum)'
  [A] 'function void snd_pcm_stream_lock(snd_pcm_substream*)'
  [A] 'function void snd_pcm_stream_unlock(snd_pcm_substream*)'
  [A] 'function void static_key_disable(static_key*)'
  [A] 'function long int strncpy_from_user(char*, const char*, long int)'
  [A] 'function int sysfs_create_bin_file(kobject*, const bin_attribute*)'
  [A] 'function void sysfs_remove_bin_file(kobject*, const bin_attribute*)'
  [A] 'function bool task_may_not_preempt(task_struct*, int)'
  [A] 'function int thermal_zone_get_slope(thermal_zone_device*)'
  [A] 'function ktime_t tick_nohz_get_sleep_length(ktime_t*)'
  [A] 'function unsigned long int total_swapcache_pages()'
  [A] 'function const char* trace_print_flags_seq(trace_seq*, const char*, unsigned long int, const trace_print_flags*)'
  [A] 'function const char* trace_print_hex_seq(trace_seq*, const unsigned char*, int, bool)'
  [A] 'function int tracepoint_probe_register_prio(tracepoint*, void*, void*, int)'
  [A] 'function int ufshcd_shutdown(ufs_hba*)'
  [A] 'function int update_devfreq(devfreq*)'
  [A] 'function void usb_phy_set_charger_current(usb_phy*, unsigned int)'
  [A] 'function void usb_put_dev(usb_device*)'
  [A] 'function usb_role_switch* usb_role_switch_find_by_fwnode(const fwnode_handle*)'
  [A] 'function int vm_insert_page(vm_area_struct*, unsigned long int, page*)'
  [A] 'function unsigned long int vmalloc_nr_pages()'
  [A] 'function bool zone_watermark_ok(zone*, unsigned int, unsigned long int, int, unsigned int)'
  [A] 'function bool zone_watermark_ok_safe(zone*, unsigned int, unsigned long int, int)'

2472 functions with some sub-type change:

  [C] 'function void* PDE_DATA(const inode*)' at generic.c:799:1 has some sub-type changes:
    CRC (modversions) changed from 0x7aae1df7 to 0x9d4e937a

  [C] 'function void __ClearPageMovable(page*)' at compaction.c:138:1 has some sub-type changes:
    CRC (modversions) changed from 0x10923ef0 to 0xbca697b6

  [C] 'function void __SetPageMovable(page*, address_space*)' at compaction.c:130:1 has some sub-type changes:
    CRC (modversions) changed from 0x78273bab to 0xbae6e38b

  ... 2469 omitted; 2472 symbols have only CRC changes

18 Added variables:

  [A] 'tracepoint __tracepoint_android_rvh_check_preempt_wakeup'
  [A] 'tracepoint __tracepoint_android_rvh_cpufreq_transition'
  [A] 'tracepoint __tracepoint_android_rvh_pick_next_entity'
  [A] 'tracepoint __tracepoint_android_rvh_sched_balance_rt'
  [A] 'tracepoint __tracepoint_android_rvh_select_task_rq_rt'
  [A] 'tracepoint __tracepoint_android_vh_allow_domain_state'
  [A] 'tracepoint __tracepoint_android_vh_ipi_stop'
  [A] 'tracepoint __tracepoint_android_vh_printk_hotplug'
  [A] 'tracepoint __tracepoint_android_vh_timer_calc_index'
  [A] 'tracepoint __tracepoint_cpu_frequency_limits'
  [A] 'tracepoint __tracepoint_ipi_entry'
  [A] 'tracepoint __tracepoint_ipi_raise'
  [A] 'tracepoint __tracepoint_irq_handler_entry'
  [A] 'tracepoint __tracepoint_sched_switch'
  [A] 'device_type i2c_client_type'
  [A] 'int overflowuid'
  [A] 'atomic_long_t vm_node_stat[38]'
  [A] 'atomic_long_t vm_zone_stat[12]'

47 Changed variables:

  [C] 'pglist_data contig_page_data' was changed at memblock.c:96:1:
    CRC (modversions) changed from 0xdeb74410 to 0x17ba9562
    type of variable changed:
      type size hasn't changed
      1 data member insertion:
        'deferred_split pglist_data::deferred_split_queue', at offset 54336 (in bits) at mmzone.h:828:1
      there are data member changes:
        2 ('lruvec pglist_data::__lruvec' .. 'unsigned long int pglist_data::flags') offsets changed (by +256 bits)
      2529 impacted interfaces

  [C] 'rq runqueues' was changed at core.c:51:1:
    CRC (modversions) changed from 0x7d8ddb7c to 0xa7379acd
    type of variable changed:
      type size hasn't changed
      1 data member insertion:
        'ktime_t rq::hrtick_time', at offset 25344 (in bits) at sched.h:1029:1
      there are data member changes:
        11 ('sched_info rq::rq_sched_info' .. 'u64 rq::android_vendor_data1[96]') offsets changed (by +64 bits)
      2529 impacted interfaces

  [C] 'bus_type amba_bustype' was changed at bus.c:215:1:
    CRC (modversions) changed from 0xa38da620 to 0xca23025

  [C] 'const clk_ops clk_fixed_factor_ops' was changed at clk-fixed-factor.c:60:1:
    CRC (modversions) changed from 0x6d350258 to 0x96009648

  [C] 'const clk_ops clk_fixed_rate_ops' was changed at clk-fixed-rate.c:46:1:
    CRC (modversions) changed from 0x6a810889 to 0xda835cdb

  ... 42 omitted; 45 symbols have only CRC changes

'enum cpuhp_state at cpuhotplug.h:25:1' changed:
  type size hasn't changed
  1 enumerator insertion:
    'cpuhp_state::CPUHP_AP_DTPM_CPU_ONLINE' value '215'
  2 enumerator changes:
    'cpuhp_state::CPUHP_AP_ACTIVE' from value '215' to '216' at cpuhotplug.h:25:1
    'cpuhp_state::CPUHP_ONLINE' from value '216' to '217' at cpuhotplug.h:25:1
  5 impacted interfaces
'struct address_space at fs.h:451:1' changed:
  type size changed from 1344 to 1408 (in bits)
  1 data member insertion:
    'atomic_t address_space::nr_thps', at offset 256 (in bits) at fs.h:458:1
  there are data member changes:
    11 ('rb_root_cached address_space::i_mmap' .. 'void* address_space::private_data') offsets changed (by +64 bits)
  2529 impacted interfaces

'struct amba_driver at bus.h:76:1' changed:
  type size hasn't changed
  there are data member changes:
    type 'int (amba_device*)*' of 'amba_driver::remove' changed:
      pointer type changed from: 'int (amba_device*)*' to: 'void (amba_device*)*'
  2 impacted interfaces

'struct block_device at blk_types.h:22:1' changed:
  type size changed from 1472 to 1536 (in bits)
  1 data member insertion:
    'super_block* block_device::bd_fsfreeze_sb', at offset 1472 (in bits) at blk_types.h:49:1
  2529 impacted interfaces

'struct drm_crtc_helper_funcs at drm_modeset_helper_vtables.h:61:1' changed (indirectly):
  type size hasn't changed
  there are data member changes:
    type 'int (drm_crtc*, drm_framebuffer*, int, int, enum mode_set_atomic)*' of 'drm_crtc_helper_funcs::mode_set_base_atomic' changed:
      pointer type changed from: 'int (drm_crtc*, drm_framebuffer*, int, int, enum mode_set_atomic)*' to: 'int (drm_crtc*, drm_framebuffer*, int, int, enum mode_set_atomic)*'
  246 impacted interfaces

'struct em_perf_domain at energy_model.h:43:1' changed:
  type size hasn't changed
  1 data member insertion:
    'int em_perf_domain::milliwatts', at offset 96 (in bits) at energy_model.h:48:1
  2529 impacted interfaces

'struct inode at fs.h:610:1' changed (indirectly):
  type size changed from 4800 to 4864 (in bits)
  there are data member changes:
    type 'struct address_space' of 'inode::i_data' changed, as reported earlier
    'list_head inode::i_devices' offset changed (by +64 bits)
    while looking at anonymous data member 'union {pipe_inode_info* i_pipe; block_device* i_bdev; cdev* i_cdev; char* i_link; unsigned int i_dir_seq;}':
    the internal name of that anonymous data member changed from:
     __anonymous_union__51
    to:
     __anonymous_union__27
     This is usually due to an anonymous member type being added or removed from the containing type
    and offset changed from 4416 to 4480 (in bits) (by +64 bits)
    6 ('__u32 inode::i_generation' .. 'void* inode::i_private') offsets changed (by +64 bits)
  2529 impacted interfaces

'struct module at module.h:366:1' changed:
  type size hasn't changed
  1 data member insertion:
    'cfi_check_fn module::cfi_check', at offset 1920 (in bits) at module.h:389:1
  there are data member changes:
    15 ('mutex module::param_lock' .. 'int ()* module::init') offsets changed (by +64 bits)
  2529 impacted interfaces

'struct pglist_data at mmzone.h:728:1' changed:
  details were reported earlier

'struct regulator_desc at driver.h:313:1' changed:
  type size changed from 2240 to 2304 (in bits)
  1 data member insertion:
    'bool regulator_desc::of_match_full_name', at offset 192 (in bits) at driver.h:319:1
  there are data member changes:
    52 ('const char* regulator_desc::regulators_node' .. 'unsigned int (unsigned int)* regulator_desc::of_map_mode') offsets changed (by +64 bits)
  32 impacted interfaces

'struct rq at sched.h:897:1' changed:
  details were reported earlier

'struct tty_ldisc_ops at tty_ldisc.h:175:1' changed:
  type size hasn't changed
  there are data member changes:
    type 'typedef ssize_t (tty_struct*, file*, unsigned char*, typedef size_t)*' of 'tty_ldisc_ops::read' changed:
      pointer type changed from: 'typedef ssize_t (tty_struct*, file*, unsigned char*, typedef size_t)*' to: 'typedef ssize_t (tty_struct*, file*, unsigned char*, typedef size_t, void**, unsigned long int)*'
  27 impacted interfaces

'struct ufs_hba_variant_ops at ufshcd.h:301:1' changed:
  type size changed from 1728 to 1408 (in bits)
  5 data member deletions:
    'int (ufs_hba*, ufshcd_lrb*, unsigned int)* ufs_hba_variant_ops::fill_prdt', at offset 1408 (in bits) at ufshcd.h:335:1
    'int (ufs_hba*, request*, ufshcd_lrb*)* ufs_hba_variant_ops::prepare_command', at offset 1472 (in bits) at ufshcd.h:337:1
    'int (ufs_hba*)* ufs_hba_variant_ops::update_sysfs', at offset 1536 (in bits) at ufshcd.h:339:1
    'void (ufs_hba*, ufshcd_lrb*)* ufs_hba_variant_ops::send_command', at offset 1600 (in bits) at ufshcd.h:340:1
    'void (ufs_hba*, ufshcd_lrb*)* ufs_hba_variant_ops::compl_command', at offset 1664 (in bits) at ufshcd.h:341:1
  15 impacted interfaces

'struct vm_area_struct at mm_types.h:306:1' changed (indirectly):
  type size changed from 1536 to 1600 (in bits)
  there are data member changes:
    'seqcount_t vm_area_struct::vm_sequence' offset changed (by +64 bits)
    type 'struct vm_userfaultfd_ctx' of 'vm_area_struct::vm_userfaultfd_ctx' changed:
      type size changed from 0 to 64 (in bits)
      1 data member insertion:
        'userfaultfd_ctx* vm_userfaultfd_ctx::ctx', at offset 0 (in bits) at mm_types.h:293:1
      2529 impacted interfaces
    'atomic_t vm_area_struct::vm_ref_count' offset changed (by +64 bits)
  2529 impacted interfaces

'struct vm_userfaultfd_ctx at mm_types.h:297:1' changed:
  details were reported earlier

'struct zone at mmzone.h:450:1' changed:
  type size hasn't changed
  1 data member insertion:
    'unsigned long int zone::cma_pages', at offset 960 (in bits) at mmzone.h:529:1
  there are data member changes:
    4 ('const char* zone::name' .. 'int zone::initialized') offsets changed (by +64 bits)
  2529 impacted interfaces

Bug: 182194803
Fixes: ba01e93b41 ("FROMLIST: kbuild: add support for Clang LTO")
Change-Id: If6011ad739ecccd23a92cfa2f9fd43084f9a0b4f
Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-03-12 17:22:36 +00:00
Badhri Jagan Sridharan
02efd18b77 UPSTREAM: usb: typec: tcpci: Refactor tcpc_presenting_cc1_rd macro
Defining one macro instead of two for tcpc_presenting_*_rd.
This is a follow up of the comment left by Heikki Krogerus.

https://patchwork.kernel.org/project/linux-usb/patch/
20210304070931.1947316-1-badhri@google.com/

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210310223536.3471243-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit aecb1e452d)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iffee064c4aba766d9819673282ffe62835f1fb5d
2021-03-12 16:33:34 +00:00
Minchan Kim
8d03e49505 ANDROID: mm: build alloc_contig_dump_pages in page_alloc.o
GKI has CONFIG_DYNAMIC_DEBUG_CORE. Thus, to enable only the
specific alloc_contig_dump_pages without needing all pr_debug
in every source files is using -DCONFIG_DYNAMIC_MODULE
when the page_alloc.o compiled.

Bug: 182195592
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I93266eb4161b3653389c737d4c767fd5d1083339
2021-03-12 16:08:38 +00:00
Minchan Kim
28f6641041 FROMLIST: mm: page_alloc: dump migrate-failed pages
Currently, debugging CMA allocation failures is quite limited.
The most common source of these failures seems to be page
migration which doesn't provide any useful information on the
reason of the failure by itself. alloc_contig_range can report
those failures as it holds a list of migrate-failed pages.

The information logged by dump_page() has already proven helpful
for debugging allocation issues, like identifying long-term
pinnings on ZONE_MOVABLE or MIGRATE_CMA.

Let's use the dynamic debugging infrastructure, such that we
avoid flooding the logs and creating a lot of noise on frequent
alloc_contig_range() calls. This information is helpful for
debugging only.

There are two ifdefery conditions to support common dyndbg options:

- CONFIG_DYNAMIC_DEBUG_CORE && DYNAMIC_DEBUG_MODULE
It aims for supporting the feature with only specific file
with adding ccflags.

- CONFIG_DYNAMIC_DEBUG
It aims for supporting the feature with system wide globally.

A simple example to enable the feature:

Admin could enable the dump like this(by default, disabled)

	echo "func alloc_contig_dump_pages +p" > control

Admin could disable it.

	echo "func alloc_contig_dump_pages =_" > control

Detail goes Documentation/admin-guide/dynamic-debug-howto.rst

A concern is utility functions in dump_page use inconsistent
loglevels. In the future, we might want to make the loglevels
used inside dump_page() consistent and eventually rework the way
we log the information here. See [1].

[1] https://lore.kernel.org/linux-mm/YEh4doXvyuRl5BDB@google.com/

Bug: 182195592
Link: https://lore.kernel.org/linux-mm/20210311194042.825152-1-minchan@kernel.org/
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Change-Id: I4db99a76a543d559a05515d6800c66ab48196978
2021-03-12 16:08:03 +00:00
Rick Yiu
cc1f93cb20 ANDROID: sched: Add vendor hook for uclamp_eff_get
Vendor may have their own behavior for determing uclamp value. Also
uclamp_eff_get() is used in uclamp_rq_inc_id() when task is enqueued,
and it is contained in uclamp_eff_value(), there is no much benefit to
hook uclamp_eff_value(), so remove the hook in uclamp_eff_value().

Bug: 170507972
Bug: 180859906
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: Ibf7c043188a77c40baf5b4040b198a4197236089
2021-03-12 16:33:30 +08:00
Stephen Dickey
5e1e3e9387 ANDROID: cpu/hotplug: failure to offline 2nd to last cpu
cpu_down() checks for num_active_cpus() to ensure that at least one
cpu is left active. If there are two online CPUs, but one of these
is paused this check will fail indicating that only one active
CPU is available. This will prevent the online but inactive cpu
from being offlined.

Correct cpu_down() to ensure that if there is only one active CPU
and that is the CPU being requested, the offline is blocked, allowing
the second to last CPU that is inactive but online to be offlined.

Bug: 182362445
Change-Id: I5b26cb6c5fdba4f2e69e5201e25bfe987d30c405
Signed-off-by: Stephen Dickey <dickey@codeaurora.org>
2021-03-11 21:32:28 +00:00
Elliot Berman
2c728929c1 ANDROID: qcom: Add devm_blk_ksm_init to ABI
Add devm_blk_ksm_init to qcom symbol list for crypto engine.

Bug: 182453339
Change-Id: Ibb015293a66a31a8754aafe26b4fc680b7b977d7
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2021-03-11 20:32:30 +00:00
Sangmoon Kim
9108e9ba66 ANDROID: arm64: add vendor hooks for unusal abort cases
Add hooks to gather data of unsual aborts and summarize it with
other information.

Bug: 177483057

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I5f44b12770ae4976a6e3b098bd95a05dea347764
2021-03-11 19:59:21 +00:00
Colin Ian King
5f1e1f42a5 UPSTREAM: powercap/drivers/dtpm: Fix size of object being allocated
The kzalloc allocation for dtpm_cpu is currently allocating the size
of the pointer and not the size of the structure. Fix this by using
the correct sizeof argument.

Addresses-Coverity: ("Wrong sizeof argument")
Fixes: 0e8f68d7f0 ("powercap/drivers/dtpm: Add CPU energy model based support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Link: https://www.spinics.net/lists/linux-kernel-janitors/msg56960.html
Bug: 182396925
Change-Id: Iac5e069ca027136d85089b8eab9ba6dfe10034b7
(cherry picked from commit 66e713fbbb)
Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
2021-03-11 16:17:37 +00:00
Dan Carpenter
fd2c659694 UPSTREAM: powercap/drivers/dtpm: Fix an IS_ERR() vs NULL check
The powercap_register_control_type() function never returns NULL, it
returns error pointers on error so update this check.

Fixes: a20d0ef97a ("powercap/drivers/dtpm: Add API for dynamic thermal power management")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Link: https://www.spinics.net/lists/linux-kernel-janitors/msg56987.html
Bug: 182396925
Change-Id: Ica228174817bbaa5819778ef55f56e7177e51e94
(cherry picked from commit f8f706ad75)
Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
2021-03-11 16:17:29 +00:00
Dan Carpenter
2a1cd71862 UPSTREAM: powercap/drivers/dtpm: Fix some missing unlock bugs
We need to unlock on these paths before returning.

Fixes: a20d0ef97a ("powercap/drivers/dtpm: Add API for dynamic thermal power management")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Link: https://www.spinics.net/lists/linux-kernel-janitors/msg57004.html
Bug: 182396925
Change-Id: Idc13f42fc1c74e6b923edeabeacd9a782ef77e11
(cherry picked from commit 0fe1329b7b)
Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
2021-03-11 16:17:22 +00:00
Dan Carpenter
7112d4320f UPSTREAM: powercap/drivers/dtpm: Fix a double shift bug
The DTPM_POWER_LIMIT_FLAG is used for test_bit() etc which take a bit
number so it should be bit 0.  But currently it's set to BIT(0) then
that is double shifted equivalent to BIT(BIT(0)).  This doesn't cause a
run time problem because it's done consistently.

Fixes: a20d0ef97a ("powercap/drivers/dtpm: Add API for dynamic thermal power management")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Link: https://www.spinics.net/lists/linux-kernel-janitors/msg57003.html
Bug: 182396925
Change-Id: I4245d8d0de695fa4c07916113df2097ec8ab8bcf
(cherry picked from commit 2185c23071)
Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
2021-03-11 16:17:14 +00:00
Daniel Lezcano
578572c48c UPSTREAM: powercap/drivers/dtpm: Fix __udivdi3 and __aeabi_uldivmod unresolved symbols
32-bit architectures do not support u64 divisions, so the macro
DIV_ROUND_CLOSEST is not adequate as the compiler will replace the
call to an unexisting function for the platform, leading to
unresolved references to symbols.

Fix this by using the compatible macros:

DIV64_U64_ROUND_CLOSEST and DIV_ROUND_CLOSEST_ULL.

Fixes: a20d0ef97a ("powercap/drivers/dtpm: Add API for dynamic thermal power management")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Link: https://lkml.org/lkml/2020/12/30/304
Bug: 182396925
Change-Id: I1a67791b071acb2fe6ed0d348f4462985ebabdc3
(cherry picked from commit 8f50db4b5c)
Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
2021-03-11 16:16:48 +00:00
Daniel Lezcano
7f17016dc8 UPSTREAM: powercap/drivers/dtpm: Add CPU energy model based support
With the powercap dtpm controller, we are able to plug devices with
power limitation features in the tree.

The following patch introduces the CPU power limitation based on the
energy model and the performance states.

The power limitation is done at the performance domain level. If some
CPUs are unplugged, the corresponding power will be subtracted from
the performance domain total power.

It is up to the platform to initialize the dtpm tree and add the CPU.

Here is an example to create a simple tree with one root node called
"pkg" and the CPU's performance domains.

static int dtpm_register_pkg(struct dtpm_descr *descr)
{
	struct dtpm *pkg;
	int ret;

	pkg = dtpm_alloc(NULL);
	if (!pkg)
		return -ENOMEM;

	ret = dtpm_register(descr->name, pkg, descr->parent);
	if (ret)
		return ret;

	return dtpm_register_cpu(pkg);
}

static struct dtpm_descr descr = {
	.name = "pkg",
	.init = dtpm_register_pkg,
};
DTPM_DECLARE(descr);

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Tested-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Link: https://lkml.org/lkml/2020/12/8/736
Bug: 182396925
Change-Id: I01f949c0cb685806de1194fef3ad8a740301046d
(cherry picked from commit 0e8f68d7f0)
Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
2021-03-11 16:16:38 +00:00
Daniel Lezcano
082e8dcea9 UPSTREAM: powercap/drivers/dtpm: Add API for dynamic thermal power management
On the embedded world, the complexity of the SoC leads to an
increasing number of hotspots which need to be monitored and mitigated
as a whole in order to prevent the temperature to go above the
normative and legally stated 'skin temperature'.

Another aspect is to sustain the performance for a given power budget,
for example virtual reality where the user can feel dizziness if the
GPU performance is capped while a big CPU is processing something
else. Or reduce the battery charging because the dissipated power is
too high compared with the power consumed by other devices.

The userspace is the most adequate place to dynamically act on the
different devices by limiting their power given an application
profile: it has the knowledge of the platform.

These userspace daemons are in charge of the Dynamic Thermal Power
Management (DTPM).

Nowadays, the dtpm daemons are abusing the thermal framework as they
act on the cooling device state to force a specific and arbitrary
state without taking care of the governor decisions. Given the closed
loop of some governors that can confuse the logic or directly enter in
a decision conflict.

As the number of cooling device support is limited today to the CPU
and the GPU, the dtpm daemons have little control on the power
dissipation of the system. The out of tree solutions are hacking
around here and there in the drivers, in the frameworks to have
control on the devices. The common solution is to declare them as
cooling devices.

There is no unification of the power limitation unit, opaque states
are used.

This patch provides a way to create a hierarchy of constraints using
the powercap framework. The devices which are registered as power
limit-able devices are represented in this hierarchy as a tree. They
are linked together with intermediate nodes which are just there to
propagate the constraint to the children.

The leaves of the tree are the real devices, the intermediate nodes
are virtual, aggregating the children constraints and power
characteristics.

Each node have a weight on a 2^10 basis, in order to reflect the
percentage of power distribution of the children's node. This
percentage is used to dispatch the power limit to the children.

The weight is computed against the max power of the siblings.

This simple approach allows to do a fair distribution of the power
limit.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Tested-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Link: https://lkml.org/lkml/2020/12/8/736
Bug: 182396925
Change-Id: I1786b8f4de45e8f0abbdb9bac99da80245a4d7f7
(cherry picked from commit a20d0ef97a)
Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
2021-03-11 16:05:21 +00:00
Daniel Lezcano
b2267c21c0 UPSTREAM: units: Add Watt units
As there are the temperature units, let's add the Watt macros definition.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Link: https://lkml.org/lkml/2020/12/8/736
Bug: 182396925
Change-Id: Iabcd01a02f52c55ba018aca59104807778f1d866
(cherry picked from commit 2ee5f8f059)
Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
2021-03-11 16:02:50 +00:00
Daniel Lezcano
7847beabbe UPSTREAM: Documentation/powercap/dtpm: Add documentation for dtpm
The dynamic thermal and power management is a technique to dynamically
adjust the power consumption of different devices in order to ensure a
global thermal constraint.

An userspace daemon is usually monitoring the temperature and the
power to take immediate action on the device.

The DTPM framework provides an unified API to userspace to act on the
power.

Document this framework.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Link: https://lkml.org/lkml/2020/12/8/736
Bug: 182396925
Change-Id: I72d7326f3f1f97bb367fd0b6efd6af6776e512b3
(cherry picked from commit f5ad1c7479)
Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
2021-03-11 16:02:39 +00:00
Mathias Nyman
39d4d9a6e8 UPSTREAM: xhci: Fix repeated xhci wake after suspend due to uncleared internal wake state
If port terminations are detected in suspend, but link never reaches U0
then xHCI may have an internal uncleared wake state that will cause an
immediate wake after suspend.

This wake state is normally cleared when driver clears the PORT_CSC bit,
which is set after a device is enabled and in U0.

Write 1 to clear PORT_CSC for ports that don't have anything connected
when suspending. This makes sure any pending internal wake states in
xHCI are cleared.

Cc: stable@vger.kernel.org
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210311115353.2137560-5-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit d26c00e727)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I26c39851c5c3c646c4d8ea84d2e608e2ddfebb9d
2021-03-11 15:47:31 +01:00
Forest Crossman
a6d2369a63 UPSTREAM: usb: xhci: Fix ASMedia ASM1042A and ASM3242 DMA addressing
I've confirmed that both the ASMedia ASM1042A and ASM3242 have the same
problem as the ASM1142 and ASM2142/ASM3142, where they lose some of the
upper bits of 64-bit DMA addresses. As with the other chips, this can
cause problems on systems where the upper bits matter, and adding the
XHCI_NO_64BIT_SUPPORT quirk completely fixes the issue.

Cc: stable@vger.kernel.org
Signed-off-by: Forest Crossman <cyrozap@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210311115353.2137560-4-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit b71c669ad8)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I5d8ed7834b15a4415a1dfeb778f616e235172046
2021-03-11 15:47:31 +01:00
Mathias Nyman
a4ed825aee UPSTREAM: xhci: Improve detection of device initiated wake signal.
A xHC USB 3 port might miss the first wake signal from a USB 3 device
if the port LFPS reveiver isn't enabled fast enough after xHC resume.

xHC host will anyway be resumed by a PME# signal, but will go back to
suspend if no port activity is seen.
The device resends the U3 LFPS wake signal after a 100ms delay, but
by then host is already suspended, starting all over from the
beginning of this issue.

USB 3 specs say U3 wake LFPS signal is sent for max 10ms, then device
needs to delay 100ms before resending the wake.

Don't suspend immediately if port activity isn't detected in resume.
Instead add a retry. If there is no port activity then delay for 120ms,
and re-check for port activity.

Cc: <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210311115353.2137560-3-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 253f588c70)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I30e4e5f6859e4e4605a32c03a1090ccb5222ae0e
2021-03-11 15:47:31 +01:00
Stanislaw Gruszka
5cff5fab36 UPSTREAM: usb: xhci: do not perform Soft Retry for some xHCI hosts
On some systems rt2800usb and mt7601u devices are unable to operate since
commit f8f80be501 ("xhci: Use soft retry to recover faster from
transaction errors")

Seems that some xHCI controllers can not perform Soft Retry correctly,
affecting those devices.

To avoid the problem add xhci->quirks flag that restore pre soft retry
xhci behaviour for affected xHCI controllers. Currently those are
AMD_PROMONTORYA_4 and AMD_PROMONTORYA_2, since it was confirmed
by the users: on those xHCI hosts issue happen and is gone after
disabling Soft Retry.

[minor commit message rewording for checkpatch -Mathias]

Fixes: f8f80be501 ("xhci: Use soft retry to recover faster from transaction errors")
Cc: <stable@vger.kernel.org> # 4.20+
Reported-by: Bernhard <bernhard.gebetsberger@gmx.at>
Tested-by: Bernhard <bernhard.gebetsberger@gmx.at>
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202541
Link: https://lore.kernel.org/r/20210311115353.2137560-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit a4a251f8c2)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ie909d0e08b51795ad3db0975881157a04aafc8a7
2021-03-11 15:47:31 +01:00
Sangmoon Kim
f23fe39801 FROMGIT: rcu/tree: Add a trace event for RCU CPU stall warnings
This commit adds a trace event which allows tracing the beginnings of RCU
CPU stall warnings on systems where sysctl_panic_on_rcu_stall is disabled.

The first parameter is the name of RCU flavor like other trace events.
The second parameter indicates whether this is a stall of an expedited
grace period, a self-detected stall of a normal grace period, or a stall
of a normal grace period detected by some CPU other than the one that
is stalled.

RCU CPU stall warnings are often caused by external-to-RCU issues,
for example, in interrupt handling or task scheduling.  Therefore,
this event uses TRACE_EVENT, not TRACE_EVENT_RCU, to avoid requiring
those interested in tracing RCU CPU stalls to rebuild their kernels
with CONFIG_RCU_TRACE=y.

Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Reviewed-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
(cherry picked from commit 71580d6503f747f1b06ef8dbb7cdbbe20400a2ec
 git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev)
Bug: 177483057
Change-Id: Ie2f0340725a2fb582d026ecfaf5e1d35cc90fece
Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
2021-03-11 21:06:44 +09:00
Alistair Delva
7ca48748e5 ANDROID: GKI: Update virtual_device symbol list
For fvp and bt vhci.

Bug: 174674728
Change-Id: I083c1c54b7884913f8873aa2b0b0324c0a49f631
Signed-off-by: Alistair Delva <adelva@google.com>
2021-03-11 12:10:57 +00:00
Jack Pham
6c997d153d ANDROID: usb: host: export additional xhci symbols for ring management
Export the following xhci symbols which will allow vendor modules
to perform their own ring management. These will be used to create
and manage additional secondary rings that are used to offload to a
separate coprocessor which interacts with the xHC controller.

xhci_ring_alloc
    - Allocate a struct xhci_ring.

xhci_alloc_erst
xhci_free_erst
    - Allocate and free event ring segment tables.

xhci_trb_virt_to_dma
    - Used to retrieve the DMA address of a TRB

xhci_ring_cmd_db
    - Notify the controller when a new command is issued

xhci_alloc_command
xhci_free_command
    - Allocate and free a struct xhci_command

xhci_queue_stop_endpoint
    - Issue a stop endpoint command to the controller

Bug: 182336717
Change-Id: I9d4c5884108e656e890aca8137d4ef580bcd7a12
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2021-03-11 07:48:30 +00:00
Collin Fijalkovich
64872b5388 ANDROID: GKI: add fields required to enable CONFIG_READ_ONLY_THP_FOR_FS
Allow devices to back files with read-only transparent hugepages.

Bug: 179484689
Bug: 179223738
Signed-off-by: Collin Fijalkovich <cfijalkovich@google.com>
Change-Id: Ifba593c33c8d06724e88daa76fb8c080ab5ef225
2021-03-10 23:32:49 +00:00
xieliujie
80b4341d05 ANDROID: vendor_hooks: Add hooks for rwsem and mutex
Add hooks to apply oem's optimization of rwsem and mutex

Bug: 182237112
Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: I6332623732e2d6826b8b61087ca74e55393e0c3d
2021-03-10 21:18:26 +00:00
Wesley Cheng
ec89366c1f BACKPORT: usb: dwc3: gadget: Allow runtime suspend if UDC unbinded
The DWC3 runtime suspend routine checks for the USB connected parameter to
determine if the controller can enter into a low power state.  The
connected state is only set to false after receiving a disconnect event.
However, in the case of a device initiated disconnect (i.e. UDC unbind),
the controller is halted and a disconnect event is never generated.  Set
the connected flag to false if issuing a device initiated disconnect to
allow the controller to be suspended.

Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
Link: https://lore.kernel.org/r/1609283136-22140-2-git-send-email-wcheng@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 177879761
(cherry picked from commit 77adb8bdf4)
Change-Id: Ida95a1274f186cf81d40489ae0bdf2c702779a7c
Signed-off-by: Ray Chi <raychi@google.com>
2021-03-10 20:16:49 +00:00
Srinivas Kandagatla
457cf3aff7 FROMGIT: ASoC: codecs: wcd934x: add a sanity check in set channel map
set channel map can be passed with a channel maps, however if
the number of channels that are passed are more than the actual
supported channels then we would be accessing array out of bounds.

So add a sanity check to validate these numbers!

Fixes: a61f3b4f47 ("ASoC: wcd934x: add support to wcd9340/wcd9341 codec")
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210309142129.14182-4-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: Id0edc2996db0c9ee4e3dba344e7624abfb00b05d
(cherry picked from commit 480c25e7003d0222f64824d4c7afcd274bc66ebd
 https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next)
2021-03-10 19:47:36 +00:00
Srinivas Kandagatla
10ea78b158 FROMGIT: ASoC: qcom: sdm845: Fix array out of range on rx slim channels
WCD934x has only 13 RX SLIM ports however we are setting it as 16
in set_channel_map, this will lead to array out of bounds error!

Orignally caught by enabling USBAN array out of bounds check:

Fixes: 5caf64c633 ("ASoC: qcom: sdm845: add support to DB845c and Lenovo Yoga")
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210309142129.14182-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: Iff65dcb62082807b29b1cbfb098932617a918fb0
(cherry picked from commit 3ed85d1e1aa53db6fa4398846fbd213a7d87ceac
 https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next)
2021-03-10 19:47:27 +00:00
Srinivas Kandagatla
67feb52297 FROMGIT: ASoC: qcom: sdm845: Fix array out of bounds access
Static analysis Coverity had detected a potential array out-of-bounds
write issue due to the fact that MAX AFE port Id was set to 16 instead
of using AFE_PORT_MAX macro.

Fix this by properly using AFE_PORT_MAX macro.

Fixes: 1b93a88431 ("ASoC: qcom: sdm845: handle soundwire stream")
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210309142129.14182-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: Id6a064a3f1b5f21730edc2edf033a6346e3ab3ff
(cherry picked from commit a5fd5e475655d3830f376e29ca6a7222dc7074cf
 https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next)
2021-03-10 19:47:17 +00:00
Catalin Marinas
da32064cb9 FROMGIT: arm64: mte: Map hotplugged memory as Normal Tagged
In a system supporting MTE, the linear map must allow reading/writing
allocation tags by setting the memory type as Normal Tagged. Currently,
this is only handled for memory present at boot. Hotplugged memory uses
Normal non-Tagged memory.

Introduce pgprot_mhp() for hotplugged memory and use it in
add_memory_resource(). The arm64 code maps pgprot_mhp() to
pgprot_tagged().

Note that ZONE_DEVICE memory should not be mapped as Tagged and
therefore setting the memory type in arch_add_memory() is not feasible.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Fixes: 0178dc7613 ("arm64: mte: Use Normal Tagged attributes for the linear map")
Reported-by: Patrick Daly <pdaly@codeaurora.org>
Tested-by: Patrick Daly <pdaly@codeaurora.org>
Link: https://lore.kernel.org/r/1614745263-27827-1-git-send-email-pdaly@codeaurora.org
Cc: <stable@vger.kernel.org> # 5.10.x
Cc: Will Deacon <will@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/r/20210309122601.5543-1-catalin.marinas@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit d15dfd3138
 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/fixes)
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 181697456
Change-Id: Id1077c49637d4791fee781dd4c013b112e77ae0d
2021-03-10 11:47:51 +00:00
Will Deacon
6ae96921a3 ANDROID: KVM: arm64: Disable CFI only for nVHE hyp object
This patch effectively reverts 2df99b6397 ("ANDROID: KVM: arm64: disable
CFI for hypervisor code") now that the arm64 KVM hypervisor code builds
correctly with LTO enabled, which is also the case upstream. CFI remains
disabled, but only for the nVHE hyp object at EL2.

Cc: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 145210207
Change-Id: I5084f880576dd6a23b8e15eec840f666f36bd2b1
2021-03-10 09:26:23 +00:00
Marc Zyngier
a1c0ce2b1b FROMGIT: KVM: arm64: Ensure I-cache isolation between vcpus of a same VM
It recently became apparent that the ARMv8 architecture has interesting
rules regarding attributes being used when fetching instructions
if the MMU is off at Stage-1.

In this situation, the CPU is allowed to fetch from the PoC and
allocate into the I-cache (unless the memory is mapped with
the XN attribute at Stage-2).

If we transpose this to vcpus sharing a single physical CPU,
it is possible for a vcpu running with its MMU off to influence
another vcpu running with its MMU on, as the latter is expected to
fetch from the PoU (and self-patching code doesn't flush below that
level).

In order to solve this, reuse the vcpu-private TLB invalidation
code to apply the same policy to the I-cache, nuking it every time
the vcpu runs on a physical CPU that ran another vcpu of the same
VM in the past.

This involve renaming __kvm_tlb_flush_local_vmid() to
__kvm_flush_cpu_context(), and inserting a local i-cache invalidation
there.

Cc: stable@vger.kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Acked-by: Will Deacon <will@kernel.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20210303164505.68492-1-maz@kernel.org
(cherry picked from commit 01dc9262ff
 git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git fixes)
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 178098380
Test: atest VirtualizationHostTestCases on an EL2-enabled device
Change-Id: I05b5c2065f522225c744264caa781951d8b7888c
2021-03-10 09:26:23 +00:00
Sami Tolvanen
c036d378ac FROMGIT: KVM: arm64: Don't use cbz/adr with external symbols
allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following
linker errors:

  ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC):
  relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in
  [-1048576, 1048575]; references hyp_panic
  >>> defined in vmlinux.o

  ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0):
  relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in
  [-1048576, 1048575]; references hyp_panic
  >>> defined in vmlinux.o

This is because with LTO, the compiler ends up placing hyp_panic()
more than 1MB away from __guest_enter(). Use an unconditional branch
and adr_l instead to fix the issue.

Link: https://github.com/ClangBuiltLinux/linux/issues/1317
Reported-by: Nathan Chancellor <nathan@kernel.org>
Suggested-by: Marc Zyngier <maz@kernel.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Will Deacon <will@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210305202124.3768527-1-samitolvanen@google.com
(cherry picked from commit dbaee836d6
 git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git fixes)
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 178098380
Test: atest VirtualizationHostTestCases on an EL2-enabled device
Change-Id: I1c567b1aa44fc96ac044d572248bf1b4b4e13a68
2021-03-10 09:26:23 +00:00
Jia He
e4a7350da0 FROMGIT: KVM: arm64: Fix range alignment when walking page tables
When walking the page tables at a given level, and if the start
address for the range isn't aligned for that level, we propagate
the misalignment on each iteration at that level.

This results in the walker ignoring a number of entries (depending
on the original misalignment) on each subsequent iteration.

Properly aligning the address before the next iteration addresses
this issue.

Cc: stable@vger.kernel.org
Reported-by: Howard Zhang <Howard.Zhang@arm.com>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Jia He <justin.he@arm.com>
Fixes: b1e57de62c ("KVM: arm64: Add stand-alone page-table walker infrastructure")
[maz: rewrite commit message]
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210303024225.2591-1-justin.he@arm.com
(cherry picked from commit e85583b3f1fe62c9b371a3100c1c91af94005ca9
 git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git fixes)
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 178098380
Test: atest VirtualizationHostTestCases on an EL2-enabled device
Change-Id: Ic5d8a5966201610ead899eacf1d75b94df572be8
2021-03-10 09:26:22 +00:00
Frankie.Chang
a9c29b897d BACKPORT: binder: move structs from core file to header file
Moving all structs to header file makes module more
extendable, and makes all these structs to be defined
in the same file.

Signed-off-by: Frankie.Chang <Frankie.Chang@mediatek.com>
Acked-by: Todd Kjos <tkjos@google.com>
Link: https://lore.kernel.org/r/1605063764-12930-2-git-send-email-Frankie.Chang@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 182234755
Change-Id: Ifd9c159195011e9311a5dda6e15f102b584d4b5a
(cherry picked from commit 1987f112f1)
Signed-off-by: Frankie Chang <frankie.chang@mediatek.com>
2021-03-10 00:21:18 +00:00
Vijayanand Jitta
51b610b87d ANDROID: dma-buf: add get_each_dmabuf function
Add and export get_each_dmabuf function which helps in
traversing the db_list, this will be used by the minidump
module to get dmabuf info.

Bug: 181203151
Change-Id: Ie24788fcf9cf0a49316cb871dcb9191e8084ccde
Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
2021-03-09 03:44:12 +00:00
Subbaraman Narayanamurthy
a05c4bdbc0 FROMLIST: drivers: thermal: Add NULL pointer check before using cooling device stats
There is a possible chance that some cooling device stats buffer
allocation fails due to very high cooling device max state value.
Later cooling device update sysfs can try to access stats data
for the same cooling device. It will lead to NULL pointer
dereference issue.

Add a NULL pointer check before accessing thermal cooling device
stats data. It fixes the following bug

[ 26.812833] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004
[ 27.122960] Call trace:
[ 27.122963] do_raw_spin_lock+0x18/0xe8
[ 27.122966] _raw_spin_lock+0x24/0x30
[ 27.128157] thermal_cooling_device_stats_update+0x24/0x98
[ 27.128162] cur_state_store+0x88/0xb8
[ 27.128166] dev_attr_store+0x40/0x58
[ 27.128169] sysfs_kf_write+0x50/0x68
[ 27.133358] kernfs_fop_write+0x12c/0x1c8
[ 27.133362] __vfs_write+0x54/0x160
[ 27.152297] vfs_write+0xcc/0x188
[ 27.157132] ksys_write+0x78/0x108
[ 27.162050] ksys_write+0xf8/0x108
[ 27.166968] __arm_smccc_hvc+0x158/0x4b0
[ 27.166973] __arm_smccc_hvc+0x9c/0x4b0
[ 27.186005] el0_svc+0x8/0xc

Link: https://lore.kernel.org/linux-pm/7486c27b-c6fb-4686-811c-85945ec5a273@linaro.org/T/#m0ea0afc9eb655a66d5352520a650b4525141a041
Bug: 182193227
Change-Id: I67831afb887d4c97f9cdf3274024f5d38ea2c22d
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2021-03-08 16:56:48 -08:00
Alistair Delva
f328ea9631 ANDROID: GKI: Switch to LTO_FULL
The product config for GKI should be as optimized as possible, and
"full" LTO can result in additional optimizations that are not possible
with "thin" LTO.

Bug: 167259389
Signed-off-by: Alistair Delva <adelva@google.com>
Change-Id: I3a3f2e0069a77f501d0b4cffc35d9c813735d210
2021-03-08 22:10:23 +00:00
Vijayanand Jitta
488ee13b2d ANDROID: gki_defconfig: set CONFIG_STACK_HASH_ORDER to 12
This helps in reducing the static memory usage of stack
depot when CONFIG_PAGE_OWNER is set.

Bug: 171354330
Change-Id: I7dceceacef5610bde53877f57bbbd72366ff61b4
Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
2021-03-08 20:29:38 +00:00
Frankie Chang
067bf187ef ANDROID: sched: move vendor hook to check scheduling nice value
move hook to collect scheduling information and apply vendor's
tuning before task's scheduling priority is changed

Bug: 163431711

Signed-off-by: Frankie Chang <frankie.chang@mediatek.com>
Change-Id: I61a7ab663316c0fbcb28d1b6e523649a6374b492
(cherry picked from commit 5cf5bc7523bd5608590de487de896c1026161a18)
2021-03-08 20:01:04 +00:00
Elliot Berman
5ae9d14c13 ANDROID: qcom: Add __cfi_slowpath
Add __cfi_slowpath to android/abi_gki_aarch64_qcom since CFI was enabled
in gki_defconfig.

Bug: 182137499
Change-Id: Ic67fb6fcdf652fbcc94a19ef3334dc0df01d19ec
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2021-03-08 18:56:50 +00:00
Matthias Kaehlcke
d01013e377 FROMGIT: usb: dwc3: qcom: Honor wakeup enabled/disabled state
The dwc3-qcom currently enables wakeup interrupts unconditionally
when suspending, however this should not be done when wakeup is
disabled (e.g. through the sysfs attribute power/wakeup). Only
enable wakeup interrupts when device_may_wakeup() returns true.

Fixes: a4333c3a6b ("usb: dwc3: Add Qualcomm DWC3 glue driver")
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210302103659.v2.1.I44954d9e1169f2cf5c44e6454d357c75ddfa99a2@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit dc649f810a4c1e18dded8d4f1e1c42b40ff6bb2e
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I63a5e51301dd9f05f29556f20342813ed5451466
2021-03-08 19:46:25 +01:00
Wei Yongjun
492a543bdd FROMGIT: usb: typec: stusb160x: fix return value check in stusb160x_probe()
In case of error, the function device_get_named_child_node() returns
NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Fixes: da0cb63100 ("usb: typec: add support for STUSB160x Type-C controller family")
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210308094839.3586773-1-weiyongjun1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit e74fa668af3e2e5df1a58d758194b2cb5ce05f92
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6cef709709f7c8f27e92244b5c1013c1c116749e
2021-03-08 19:46:25 +01:00
Wei Yongjun
7ac8008a5d FROMGIT: usb: typec: tps6598x: Fix return value check in tps6598x_probe()
In case of error, the function device_get_named_child_node() returns
NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Fixes: 18a6c866bb ("usb: typec: tps6598x: Add USB role switching logic")
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210308094841.3587751-1-weiyongjun1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit cb518f3b783e41a5a6e1d8021abce3bc057359a7
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I843896f1df09b8d9201149560d518ac03e469ff4
2021-03-08 19:46:25 +01:00
Yang Li
6962bec5ac FROMGIT: usb: typec: tcpm: turn tcpm_ams_finish into void function
This function always return '0' and no callers use the return value.
So make it a void function.

This eliminates the following coccicheck warning:
./drivers/usb/typec/tcpm/tcpm.c:778:5-8: Unneeded variable: "ret".
Return "0" on line 794

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Link: https://lore.kernel.org/r/1615185330-118246-1-git-send-email-yang.lee@linux.alibaba.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f8aea504e509e16e70f907480691fa87fe245a7e
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I8c879c9db439ed06dc7f39505b43e1ddbbcd8efc
2021-03-08 19:46:25 +01:00
Badhri Jagan Sridharan
0ad6b1dd63 FROMGIT: usb: typec: tcpci: Check ROLE_CONTROL while interpreting CC_STATUS
While interpreting CC_STATUS, ROLE_CONTROL has to be read to make
sure that CC1/CC2 is not forced presenting Rp/Rd.

>From the TCPCI spec:

4.4.5.2 ROLE_CONTROL (Normative):
The TCPM shall write B6 (DRP) = 0b and B3..0 (CC1/CC2) if it wishes
to control the Rp/Rd directly instead of having the TCPC perform
DRP toggling autonomously. When controlling Rp/Rd directly, the
TCPM writes to B3..0 (CC1/CC2) each time it wishes to change the
CC1/CC2 values. This control is used for TCPM-TCPC implementing
Source or Sink only as well as when a connection has been detected
via DRP toggling but the TCPM wishes to attempt Try.Src or Try.Snk.

Table 4-22. CC_STATUS Register Definition:
If (ROLE_CONTROL.CC1 = Rd) or ConnectResult=1)
00b: SNK.Open (Below maximum vRa)
01b: SNK.Default (Above minimum vRd-Connect)
10b: SNK.Power1.5 (Above minimum vRd-Connect) Detects Rp-1.5A
11b: SNK.Power3.0 (Above minimum vRd-Connect) Detects Rp-3.0A

If (ROLE_CONTROL.CC2=Rd) or (ConnectResult=1)
00b: SNK.Open (Below maximum vRa)
01b: SNK.Default (Above minimum vRd-Connect)
10b: SNK.Power1.5 (Above minimum vRd-Connect) Detects Rp 1.5A
11b: SNK.Power3.0 (Above minimum vRd-Connect) Detects Rp 3.0A

Fixes: 74e656d6b0 ("staging: typec: Type-C Port Controller Interface driver (tcpci)")
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210304070931.1947316-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 175d5cd62631dedbaee68ec88f1103cbac679518
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Id4da23c64cfda464ddcbf6aa8d0fd678cc1a3914
2021-03-08 19:46:25 +01:00