Commit Graph

979667 Commits

Author SHA1 Message Date
Mark Tomlinson
2521995617 UPSTREAM: usb: max-3421: Prevent corruption of freed memory
commit b5fdf5c6e6 upstream.

The MAX-3421 USB driver remembers the state of the USB toggles for a
device/endpoint. To save SPI writes, this was only done when a new
device/endpoint was being used. Unfortunately, if the old device was
removed, this would cause writes to freed memory.

To fix this, a simpler scheme is used. The toggles are read from
hardware when a URB is completed, and the toggles are always written to
hardware when any URB transaction is started. This will cause a few more
SPI transactions, but no causes kernel panics.

Fixes: 2d53139f31 ("Add support for using a MAX3421E chip as a host driver.")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20210625031456.8632-1-mark.tomlinson@alliedtelesis.co.nz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 202859772
Change-Id: I55e4fd4609e7e0c68986bcf10718f486d2e55cad
2021-10-12 12:26:40 -07:00
wangting11
6fbdea5772 ANDROID: GKI: update xiaomi symbol list
Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function unsigned long int try_to_free_mem_cgroup_pages(mem_cgroup*, unsigned long int, gfp_t, bool)'

Bug: 202691227
Signed-off-by: ting wang <wangting11@xiaomi.com>
Change-Id: I5274ab355cf01b29b2ec2953856855b4101d868d
2021-10-11 15:01:34 +00:00
Kever Yang
7cc2fcb4ca ANDROID: GKI: rockchip: Enable symbols for rk81x
Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable

1 Added variable:

  [A] 'class* power_supply_class'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I576b9d2ea7b62bd9c91257fa09ee8d2464634b58
2021-10-11 17:14:02 +08:00
Guangming Cao
0a7cdb7fe4 ANDROID: Update symbol list for mtk
1. Generated with:
   BUILD_CONFIG=common/build.config.gki.aarch64 build/build_abi.sh --update

2. Leaf changes summary: 4 artifact changed (2 filtered out)
   Changed leaf types summary: 0 (2 filtered out) leaf type changed
   Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 2 Added functions
   Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 2 Added variables

   2 Added functions:
   [A] 'function int __traceiter_android_vh_iommu_iovad_alloc_iova(struct device *, struct iova_domain *, dma_addr_t, size_t )'
   [A] 'function int __traceiter_android_vh_iommu_iovad_free_iova(struct iova_domain *, dma_addr_t, size_t )'

   2 Added variables:
   [A] 'tracepoint __tracepoint_android_vh_iommu_iovad_alloc_iova'
   [A] 'tracepoint __tracepoint_android_vh_iommu_iovad_free_iova'

Bug: 201255968

Change-Id: I480fbbd4b7a37c31e073d4008dbfa633309101bf
Signed-off-by: Guangming Cao <Guangming.Cao@mediatek.com>
2021-10-09 10:51:22 +08:00
Guangming Cao
dccb021dc4 ANDROID: iommu: Add vendor hook to tracing iova alloc & free in iova_domain
Add struct (iova_domain *) in iova alloc & free vendor hook by create a new vendor hook.
Thus we can know the iova we are operating belongs to which iova domain.

Bug: 201255968

Change-Id: I7df419650af2e85a3b2b8c3d6995247694bdc953
Signed-off-by: Chao Hao <chao.hao@mediatek.com>
Signed-off-by: Guangming Cao <Guangming.Cao@mediatek.com>
2021-10-09 10:07:26 +08:00
Guangming Cao
befb2a75ab ANDROID: iommu: vendor_hook: remove the obsolete code
Remove the obsolete #if .. #else .. #endif

Bug: 201255968

Change-Id: I1e00f0ac0dfb30150fea6004b5da81e470fdce93
Signed-off-by: Guangming Cao <Guangming.Cao@mediatek.com>
2021-10-09 10:06:58 +08:00
Kever Yang
b01ae5f1b4 ANDROID: GKI: rockchip: Enable dummy_irq_chip for pcie
Leaf changes summary: 1 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable

1 Added variable:

  [A] 'irq_chip dummy_irq_chip'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I9366d807c3041353af4b7304b481ac72d13fbb3b
2021-10-08 15:06:38 +08:00
Prasad Sodagudi
fc90aa522f ANDROID: tracing: fix register tracing spam on memcpy
Disable register read/write tracing for memcpy and memset
APIs to avoid flood of read/write trace events.

Bug: 202309221
Fixes: 4373261be0 ("ANDROID: tracing: Add generic flag for register tracing disable")
Change-Id: Ic860ee3a86b4664f3c5edd79a9c432dede87733e
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
2021-10-07 16:33:41 +00:00
Bart Van Assche
d5aea3dbfb BACKPORT: FROMGIT: scsi: ufs: core: Stop clearing unit attentions
Commit aa53f580e6 ("scsi: ufs: Minor adjustments to error handling")
introduced a ufshcd_clear_ua_wluns() call in
ufshcd_err_handling_unprepare(). As explained in detail by Adrian Hunter,
this can trigger a deadlock. Avoid that deadlock by removing the code that
clears the unit attention. This is safe because the only software that
relies on clearing unit attentions is the Android Trusty software and
because support for handling unit attentions has been added in the Trusty software.

See also https://lore.kernel.org/linux-scsi/20210930124224.114031-2-adrian.hunter@intel.com/

Note that, should apply "scsi: ufs: retry START_STOP on UNIT_ATTENTION" before
this patch, since this patch gives UNIT ATTENTION to scsi_execute(START_STOP).

Bug: 194712579
(cherry picked from commit edc0596cc0
        git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Link: https://lore.kernel.org/r/20211001182015.1347587-3-jaegeuk@kernel.org
Fixes: aa53f580e6 ("scsi: ufs: Minor adjustments to error handling")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Change-Id: I73656b8b6773558dc7a552700d283c1ae6dc25f7
2021-10-06 15:57:59 +00:00
Jaegeuk Kim
2b411f1257 BACKPORT: FROMGIT: scsi: ufs: core: Retry START_STOP on UNIT_ATTENTION
Commit 57d104c153 ("ufs: add UFS power management support") made the UFS
driver submit a REQUEST SENSE command before submitting a power management
command to a WLUN to clear the POWER ON unit attention. Instead of
submitting a REQUEST SENSE command before submitting a power management
command, retry the power management command until it succeeds.

This is the preparation to get rid of all UNIT ATTENTION code which should
be handled by users.

Bug: 194712579
Link: https://lore.kernel.org/r/20211001182015.1347587-2-jaegeuk@kernel.org
(cherry picked from commit af21c3fd5b
    git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Cc: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Change-Id: I7e639d89ae9fbd5ff0f1b3a6e5cbe77682ebefc0
2021-10-06 15:57:52 +00:00
Kever Yang
f0ad57ddd7 ANDROID: GKI: rockchip: Enable symbols for rockchip-drm
Functions changes summary: 0 Removed, 0 Changed, 14 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

14 Added functions:

  [A] 'function int __drm_atomic_helper_disable_plane(drm_plane*, drm_plane_state*)'
  [A] 'function void drm_connector_list_update(drm_connector*)'
  [A] 'function dma_buf* drm_gem_dmabuf_export(drm_device*, dma_buf_export_info*)'
  [A] 'function int drm_gem_dmabuf_get_uuid(dma_buf*, uuid_t*)'
  [A] 'function int drm_gem_dumb_map_offset(drm_file*, drm_device*, u32, u64*)'
  [A] 'function int drm_gem_fb_afbc_init(drm_device*, const drm_mode_fb_cmd2*, drm_afbc_framebuffer*)'
  [A] 'function int drm_gem_fb_init_with_funcs(drm_device*, drm_framebuffer*, drm_file*, const drm_mode_fb_cmd2*, const drm_framebuffer_funcs*)'
  [A] 'function int drm_mode_create_tv_properties(drm_device*, unsigned int, const char* const*)'
  [A] 'function void drm_mode_prune_invalid(drm_device*, list_head*, bool)'
  [A] 'function drm_mode_status drm_mode_validate_driver(drm_device*, const drm_display_mode*)'
  [A] 'function drm_mode_status drm_mode_validate_size(const drm_display_mode*, int, int)'
  [A] 'function drm_mode_status drm_mode_validate_ycbcr420(const drm_display_mode*, drm_connector*)'
  [A] 'function unsigned long int drm_prime_get_contiguous_size(sg_table*)'
  [A] 'function drm_property* drm_property_create_object(drm_device*, u32, const char*, uint32_t)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9d72fe58cd354b4727e08d733b1c246aed2e48c0
2021-10-06 09:23:11 +02:00
Kever Yang
dfdc93d7c4 ANDROID: GKI: rockchip: Enable symbols for iommu
No symbols need updating.

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I1bfcdb40193b021d0c19f81c407b78ff1bf09b35
2021-10-06 08:37:37 +02:00
Kever Yang
8846927a02 ANDROID: GKI: rockchip: Enable symbols for dwc2
Functions changes summary: 0 Removed, 0 Changed, 2 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

2 Added functions:

  [A] 'function void usb_hcd_unmap_urb_for_dma(usb_hcd*, urb*)'
  [A] 'function unsigned int usb_wakeup_enabled_descendants(usb_device*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ibf2f79ee3fb4e8b77792cab766afcc998aaf963c
2021-10-06 08:30:13 +02:00
Kever Yang
c82b315c4b ANDROID: GKI: rockchip: Enable symbols for phy
Functions changes summary: 0 Removed, 0 Changed, 6 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

6 Added functions:

  [A] 'function void* devm_pci_remap_cfg_resource(device*, resource*)'
  [A] 'function int of_pci_get_max_link_speed(device_node*)'
  [A] 'function void pci_remove_root_bus(pci_bus*)'
  [A] 'function void pci_stop_root_bus(pci_bus*)'
  [A] 'function int usb_add_phy(usb_phy*, usb_phy_type)'
  [A] 'function int v4l2_querymenu(v4l2_ctrl_handler*, v4l2_querymenu*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3a1461aa27120b2062289c303899d2ac0195139e
2021-10-05 19:57:39 +02:00
Kever Yang
c10e63b794 ANDROID: GKI: rockchip: Enable symbols for rockchip-opp
Functions changes summary: 0 Removed, 0 Changed, 3 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

3 Added functions:

  [A] 'function opp_table* dev_pm_opp_set_prop_name(device*, const char*)'
  [A] 'function int devfreq_event_get_event(devfreq_event_dev*, devfreq_event_data*)'
  [A] 'function int devm_devfreq_register_opp_notifier(device*, devfreq*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Id9576d47e09e887a9df4f94a485c8ac4c35ea39e
2021-10-05 19:34:23 +02:00
Kever Yang
54a33334de ANDROID: GKI: rockchip: Enable symbols for sdhci-arasan
Functions changes summary: 0 Removed, 0 Changed, 3 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

3 Added functions:

  [A] 'function int sdhci_pltfm_unregister(platform_device*)'
  [A] 'function void sdhci_set_power_and_bus_voltage(sdhci_host*, unsigned char, unsigned short int)'
  [A] 'function void sdhci_set_uhs_signaling(sdhci_host*, unsigned int)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I1bdf263f03312a80e26e175106b9f244d4e4007a
2021-10-05 19:12:26 +02:00
Kever Yang
6276cc3982 ANDROID: GKI: rockchip: Enable symbols for devfreq
Functions changes summary: 0 Removed, 0 Changed, 6 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

6 Added functions:

  [A] 'function int devfreq_event_disable_edev(devfreq_event_dev*)'
  [A] 'function int devfreq_event_enable_edev(devfreq_event_dev*)'
  [A] 'function devfreq_event_dev* devfreq_event_get_edev_by_phandle(device*, const char*, int)'
  [A] 'function int devfreq_event_get_edev_count(device*, const char*)'
  [A] 'function devfreq_event_dev* devm_devfreq_event_add_edev(device*, devfreq_event_desc*)'
  [A] 'function int down_write_trylock(rw_semaphore*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: If4ca65ee44b961827f289a02a7458370a81e9154
2021-10-05 18:43:17 +02:00
Kever Yang
a195017de8 ANDROID: GKI: rockchip: Enable symbols for gpio-rockchip
Functions changes summary: 0 Removed, 0 Changed, 4 Added functions
Variables changes summary: 0 Removed, 0 Changed, 1 Added variable

4 Added functions:

  [A] 'function int __irq_alloc_domain_generic_chips(irq_domain*, int, int, const char*, irq_flow_handler_t, unsigned int, unsigned int, irq_gc_flags)'
  [A] 'function int irq_gc_set_wake(irq_data*, unsigned int)'
  [A] 'function irq_chip_generic* irq_get_domain_generic_chip(irq_domain*, unsigned int)'
  [A] 'function pinctrl_dev* of_pinctrl_get(device_node*)'

1 Added variable:

  [A] 'irq_domain_ops irq_generic_chip_ops'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: Ie572e071070d1949a105ea84fb906ba0b36bd140
2021-10-05 18:12:51 +02:00
Kever Yang
068f20142a ANDROID: GKI: rockchip: Enable symbol for pm-domain
Functions changes summary: 0 Removed, 0 Changed, 1 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function int pm_clk_add_clk(device*, clk*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I503f715b2cf8f641a7b435dc7be1508c88489b76
2021-10-05 17:48:12 +02:00
Kever Yang
6cef9b2952 ANDROID: GKI: rockchip: Enable symbols for common clk
Functions changes summary: 0 Removed, 0 Changed, 1 Added function
Variables changes summary: 0 Removed, 0 Changed, 2 Added variables

1 Added function:

  [A] 'function clk* clk_register_mux_table(device*, const char*, const char* const*, u8, unsigned long int, void*, u8, u32, u8, u32*, spinlock_t*)'

2 Added variables:

  [A] 'const clk_ops clk_divider_ro_ops'
  [A] 'const clk_ops clk_mux_ro_ops'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I2b8d0f19b3069d3d6beea9b54241e0c6cfd4ab12
2021-10-05 15:11:03 +02:00
Kever Yang
fd41ec3b94 ANDROID: GKI: rockchip: Enable symbols for rtc-rk808
Functions changes summary: 0 Removed, 0 Changed (4066 filtered out), 2 Added functions
Variables changes summary: 0 Removed, 0 Changed (397 filtered out), 0 Added variables

2 Added functions:

  [A] 'function unsigned int _bcd2bin(unsigned char)'
  [A] 'function unsigned char _bin2bcd(unsigned int)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: If6b62156f3b6e23e1347e3c2c3279d626f732080
2021-10-05 14:45:52 +02:00
Kever Yang
7827c05b00 ANDROID: GKI: rockchip: Enable symbol for panel-simple
Functions changes summary: 0 Removed, 0 Changed (4065 filtered out), 1 Added functions
Variables changes summary: 0 Removed, 0 Changed (397 filtered out), 0 Added variables

1 Added function:

  [A] 'function int of_get_drm_display_mode(device_node*, drm_display_mode*, u32*, int)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0a6ae2f80c21c40396b2a1b163765f1101180ac9
2021-10-05 13:56:37 +02:00
Kever Yang
229f9c2faf ANDROID: GKI: rockchip: Enable symbol for ov5695
Functions changes summary: 0 Removed, 0 Changed, 1 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function v4l2_ctrl* v4l2_ctrl_new_int_menu(v4l2_ctrl_handler*, const v4l2_ctrl_ops*, u32, u8, u8, const s64*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0742f3772612c8a35d8a3ff94700668b2b302f4a
2021-10-05 12:06:51 +02:00
Kever Yang
94f76a7779 ANDROID: GKI: rockchip: Enable symbol for nvme
Functions changes summary: 0 Removed, 0 Changed, 1 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function int pci_sriov_configure_simple(pci_dev*, int)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Icacfeeb8f11ba26a030408a9378068ba1a4eb00e
2021-10-05 11:13:49 +02:00
Kever Yang
4275c37d4e ANDROID: GKI: rockchip: Enable symbols for iio
Functions changes summary: 0 Removed, 0 Changed (424 filtered out), 2 Added functions
Variables changes summary: 0 Removed, 0 Changed (3 filtered out), 0 Added variables

2 Added functions:

  [A] 'function void iio_channel_release_all(iio_channel*)'
  [A] 'function int iio_update_buffers(iio_dev*, iio_buffer*, iio_buffer*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ifaaade732fa2372e9d8c31483f52188c227eac13
2021-10-05 10:45:27 +02:00
Kever Yang
be153f6250 ANDROID: GKI: rockchip: Enable symbol for cw2015_battery
Functions changes summary: 0 Removed, 0 Changed (2328 filtered out), 1 Added functions
Variables changes summary: 0 Removed, 0 Changed (22 filtered out), 0 Added variables

1 Added function:

  [A] 'function int power_supply_am_i_supplied(power_supply*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7b313c10eb3bed84f4b4194c63d8dcfd4b5273c5
2021-10-05 09:06:30 +02:00
Kever Yang
a90c09dd41 ANDROID: GKI: rockchip: Enable symbols for mmc driver
Functions changes summary: 0 Removed, 0 Changed, 5 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

5 Added functions:

  [A] 'function int clk_get_phase(clk*)'
  [A] 'function int clk_set_phase(clk*, int)'
  [A] 'function void sdhci_adma_write_desc(sdhci_host*, void**, dma_addr_t, int, unsigned int)'
  [A] 'function unsigned int sdhci_pltfm_clk_get_max_clock(sdhci_host*)'
  [A] 'function void sdhci_set_clock(sdhci_host*, unsigned int)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I2eaf765788b782d397a9291d2351f033a9e5c05f
2021-10-05 08:22:12 +02:00
Kever Yang
f1e23eee85 ANDROID: GKI: rockchip: Enable symbols for cpufreq governor
Functions changes summary: 0 Removed, 0 Changed (147 filtered out), 8 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

8 Added functions:

  [A] 'function void cpufreq_dbs_governor_exit(cpufreq_policy*)'
  [A] 'function int cpufreq_dbs_governor_init(cpufreq_policy*)'
  [A] 'function void cpufreq_dbs_governor_limits(cpufreq_policy*)'
  [A] 'function int cpufreq_dbs_governor_start(cpufreq_policy*)'
  [A] 'function void cpufreq_dbs_governor_stop(cpufreq_policy*)'
  [A] 'function unsigned int dbs_update(cpufreq_policy*)'
  [A] 'function void gov_update_cpu_data(dbs_data*)'
  [A] 'function ssize_t store_sampling_rate(gov_attr_set*, const char*, size_t)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ia03c3afb864e5b875ac24898e8b818d986d50ec6
2021-10-05 08:21:58 +02:00
Kever Yang
5f020167d0 ANDROID: GKI: rockchip: Enable symbols for scsi ch
Leaf changes summary: 1 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added functions:

  [A] 'function int scsi_register_driver(device_driver*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7540204d69feec24f0e7f49b08def874c0c072cf
2021-10-05 08:21:31 +02:00
Kever Yang
64665afcb3 ANDROID: GKI: rockchip: Enable symbols for adc-keys
Leaf changes summary: 2 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 2 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

2 Added functions:

  [A] 'function void input_set_poll_interval(input_dev*, unsigned int)'
  [A] 'function int input_setup_polling(input_dev*, void (input_dev*)*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0e5c2b10ded49faa890aa37d157e7ddf6797e432
2021-10-05 08:21:18 +02:00
Kever Yang
b37b3c9eaa ANDROID: GKI: rockchip: Enable symbol for act8865
Leaf changes summary: 1 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added functions:

  [A] 'function int regulator_set_pull_down_regmap(regulator_dev*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7c8668ad05c11b27d92892a1e4075ef7c87155bd
2021-10-05 08:20:57 +02:00
Kever Yang
21034d71fc ANDROID: GKI: rockchip: Enable symbols for pwm_bl
Functions changes summary: 0 Removed, 0 Changed, 1 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function int pwm_adjust_config(pwm_device*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ic944cb67431d2da199a12f926f6e9248235a3abf
2021-10-05 08:19:40 +02:00
Kever Yang
576c7a6297 ANDROID: GKI: rockchip: Enable symbols for phy
Functions changes summary: 0 Removed, 0 Changed, 4 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

4 Added functions:

  [A] 'function int extcon_set_state(extcon_dev*, unsigned int, bool)'
  [A] 'function int extcon_sync(extcon_dev*, unsigned int)'
  [A] 'function usb_dr_mode of_usb_get_dr_mode_by_phy(device_node*, int)'
  [A] 'function int phy_mipi_dphy_config_validate(phy_configure_opts_mipi_dphy*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ifb68fb8726d7d179a212853abd0be6f5460358ef
2021-10-05 08:19:31 +02:00
Kever Yang
fc1e452fa3 ANDROID: GKI: rockchip: Enable symbols for LED hardbeat
Functions changes summary: 0 Removed, 0 Changed, 3 Added functions
Variables changes summary: 0 Removed, 0 Changed, 1 Added variable

3 Added functions:

  [A] 'function void led_set_brightness_nosleep(led_classdev*, led_brightness)'
  [A] 'function int led_trigger_register(led_trigger*)'
  [A] 'function void led_trigger_unregister(led_trigger*)'

1 Added variable:

  [A] 'unsigned long int avenrun[3]'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I078368f6e330581f3bd3233b5086730be3db4033
2021-10-05 08:19:22 +02:00
Adrian Hunter
f4b3d35dfa FROMLIST: scsi: ufs: Fix task management completion
The UFS driver uses blk_mq_tagset_busy_iter() when identifying task
management requests to complete, however blk_mq_tagset_busy_iter()
doesn't work.

blk_mq_tagset_busy_iter() only iterates requests dispatched by the block
layer. That appears as if it might have started since commit 37f4a24c24
("blk-mq: centralise related handling into blk_mq_get_driver_tag") which
removed 'data->hctx->tags->rqs[rq->tag] = rq' from blk_mq_rq_ctx_init()
which gets called:

	blk_get_request
		blk_mq_alloc_request
			__blk_mq_alloc_request
				blk_mq_rq_ctx_init

Since UFS task management requests are not dispatched by the block
layer, hctx->tags->rqs[rq->tag] remains NULL,  and since
blk_mq_tagset_busy_iter() relies on finding requests using
hctx->tags->rqs[rq->tag], UFS task management requests are never found by
blk_mq_tagset_busy_iter().

By using blk_mq_tagset_busy_iter(), the UFS driver was relying on internal
details of the block layer, which was fragile and subsequently got
broken. Fix by removing the use of blk_mq_tagset_busy_iter() and having
the driver keep track of task management requests.

Fixes: 1235fc569e ("scsi: ufs: core: Fix task management request completion timeout")
Fixes: 69a6c269c0 ("scsi: ufs: Use blk_{get,put}_request() to allocate and free TMFs")
Cc: stable@vger.kernel.org
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Bug: 200291871
Link: https://lore.kernel.org/linux-scsi/20210922091059.4040-1-adrian.hunter@intel.com/
Change-Id: I4e11f40c7371fd66b3a6b570d06c956b113df142
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-10-04 18:29:27 +00:00
Bart Van Assche
7b6860d2a4 ANDROID: scsi: ufs: Rename struct ufs_hba_with_hpb into ufs_hba_add_info
Before adding more data members in struct ufs_hba_with_hpb, rename this
data structure. This patch does not change any functionality.

Bug: 200291871
Change-Id: I6b0365ebcf8adf6cfa009218d8c4dc96fa629bde
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-10-04 18:29:21 +00:00
Konstantin Vyshetsky
5adc3c4124 ANDROID: Update the ABI representation
Leaf changes summary: 2 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable

1 Added function:

  [A] 'function int __traceiter_android_rvh_ufs_complete_init(void*, ufs_hba*)'

1 Added variable:

  [A] 'tracepoint __tracepoint_android_rvh_ufs_complete_init'

Bug: 185809932
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
Change-Id: I48a831d2059901276b1a510d8af186c00ca2f9db
2021-10-04 18:26:10 +00:00
Konstantin Vyshetsky
e774e4eca6 ANDROID: scsi: ufs: add complete init vendor hook
Currently the core UFS driver does not have a vops to notify when the
device is operational. This commit introduces a hook, which serves to
notify device completing initialization and is ready to accept I/O.

This is required by the FIPS140-2 [1] self integrity test of inline
encryption engine, which must run whenever the host controller is reset.
The code requires sleeping while waiting for I/O to complete and allocating
some memory dynamically, which requires the vendor hook to be restricted.

[1] https://csrc.nist.gov/publications/detail/fips/140/2/final

Bug: 185809932
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
Change-Id: I6f476f9c2e2b50574d2898c3f1ef6b648d92df24
2021-10-04 18:26:03 +00:00
Subash Abhinov Kasiviswanathan
7050ead570 ANDROID: qcom: Add qdisc related symbols
Add register_qdisc and unregister_qdisc which are needed by rmnet
modules.

Leaf changes summary: 2 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 2 Added
functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added
variable

2 Added functions:

  [A] 'function int register_qdisc(Qdisc_ops*)'
  [A] 'function int unregister_qdisc(Qdisc_ops*)'

Bug: 201660525
Change-Id: Ifc6c36ffada9046f8f23d3e87059a5d631b5cf8c
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2021-10-04 17:59:34 +00:00
Yee Lee
d788d16fed FROMGIT: scs: Release kasan vmalloc poison in scs_free process
Since scs allocation is moved to vmalloc region, the
shadow stack is protected by kasan_posion_vmalloc.
However, the vfree_atomic operation needs to access
its context for scs_free process and causes kasan error
as the dump info below.

This patch Adds kasan_unpoison_vmalloc() before vfree_atomic,
which aligns to the prior flow as using kmem_cache.
The vmalloc region will go back posioned in the following
vumap() operations.

 ==================================================================
 BUG: KASAN: vmalloc-out-of-bounds in llist_add_batch+0x60/0xd4
 Write of size 8 at addr ffff8000100b9000 by task kthreadd/2

 CPU: 0 PID: 2 Comm: kthreadd Not tainted 5.15.0-rc2-11681-g92477dd1faa6-dirty #1
 Hardware name: linux,dummy-virt (DT)
 Call trace:
  dump_backtrace+0x0/0x43c
  show_stack+0x1c/0x2c
  dump_stack_lvl+0x68/0x84
  print_address_description+0x80/0x394
  kasan_report+0x180/0x1dc
  __asan_report_store8_noabort+0x48/0x58
  llist_add_batch+0x60/0xd4
  vfree_atomic+0x60/0xe0
  scs_free+0x1dc/0x1fc
  scs_release+0xa4/0xd4
  free_task+0x30/0xe4
  __put_task_struct+0x1ec/0x2e0
  delayed_put_task_struct+0x5c/0xa0
  rcu_do_batch+0x62c/0x8a0
  rcu_core+0x60c/0xc14
  rcu_core_si+0x14/0x24
  __do_softirq+0x19c/0x68c
  irq_exit+0x118/0x2dc
  handle_domain_irq+0xcc/0x134
  gic_handle_irq+0x7c/0x1bc
  call_on_irq_stack+0x40/0x70
  do_interrupt_handler+0x78/0x9c
  el1_interrupt+0x34/0x60
  el1h_64_irq_handler+0x1c/0x2c
  el1h_64_irq+0x78/0x7c
  _raw_spin_unlock_irqrestore+0x40/0xcc
  sched_fork+0x4f0/0xb00
  copy_process+0xacc/0x3648
  kernel_clone+0x168/0x534
  kernel_thread+0x13c/0x1b0
  kthreadd+0x2bc/0x400
  ret_from_fork+0x10/0x20

 Memory state around the buggy address:
  ffff8000100b8f00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
  ffff8000100b8f80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
 >ffff8000100b9000: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
                    ^
  ffff8000100b9080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
  ffff8000100b9100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
 ==================================================================

Bug: 201711661
(cherry picked from commit 528a4ab453
https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/ for-next/scs)
Change-Id: I0980e9df3fdff37ebfb9f873174d60f30c00230a
Suggested-by: Kuan-Ying Lee <kuan-ying.lee@mediatek.com>
Acked-by: Will Deacon <will@kernel.org>
Tested-by: Will Deacon <will@kernel.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Fixes: a2abe7cbd8 ("scs: switch to vmapped shadow stacks")
Link: https://lore.kernel.org/r/20210930081619.30091-1-yee.lee@mediatek.com
Signed-off-by: Will Deacon <will@kernel.org>
2021-10-04 15:44:53 +00:00
Lecopzer Chen
2659f14d93 UPSTREAM: arm64: Kconfig: select KASAN_VMALLOC if KANSAN_GENERIC is enabled
Before this patch, someone who wants to use VMAP_STACK when
KASAN_GENERIC enabled must explicitly select KASAN_VMALLOC.

>From Will's suggestion [1]:
  > I would _really_ like to move to VMAP stack unconditionally, and
  > that would effectively force KASAN_VMALLOC to be set if KASAN is in use

Because VMAP_STACK now depends on either HW_TAGS or KASAN_VMALLOC if
KASAN enabled, in order to make VMAP_STACK selected unconditionally,
we bind KANSAN_GENERIC and KASAN_VMALLOC together.

Note that SW_TAGS supports neither VMAP_STACK nor KASAN_VMALLOC now,
so this is the first step to make VMAP_STACK selected unconditionally.

Bind KANSAN_GENERIC and KASAN_VMALLOC together is supposed to cost more
memory at runtime, thus the alternative is using SW_TAGS KASAN instead.

[1]: https://lore.kernel.org/lkml/20210204150100.GE20815@willie-the-truck/

Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Link: https://lore.kernel.org/r/20210324040522.15548-6-lecopzer.chen@mediatek.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Bug: 201711661
(cherry picked from commit acc3042d62)
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Change-Id: Ic7884e3acafa02361c8a250028ceebdb1780a49e
2021-10-04 15:44:41 +00:00
Lecopzer Chen
23232f84c8 UPSTREAM: arm64: kaslr: support randomized module area with KASAN_VMALLOC
After KASAN_VMALLOC works in arm64, we can randomize module region
into vmalloc area now.

Test:
	VMALLOC area ffffffc010000000 fffffffdf0000000

	before the patch:
		module_alloc_base/end ffffffc008b80000 ffffffc010000000
	after the patch:
		module_alloc_base/end ffffffdcf4bed000 ffffffc010000000

	And the function that insmod some modules is fine.

Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Link: https://lore.kernel.org/r/20210324040522.15548-5-lecopzer.chen@mediatek.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Bug: 201711661
(cherry picked from commit 31d02e7ab0)
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Change-Id: I513f205113752b396245e9e8d64b973fcd7ffcb1
2021-10-04 15:44:35 +00:00
Lecopzer Chen
ef61240f62 UPSTREAM: arm64: Kconfig: support CONFIG_KASAN_VMALLOC
We can backed shadow memory in vmalloc area after vmalloc area
isn't populated at kasan_init(), thus make KASAN_VMALLOC selectable.

Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Acked-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20210324040522.15548-4-lecopzer.chen@mediatek.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Bug: 201711661
(cherry picked from commit 71b613fc0c)
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Change-Id: I48d473cadd54ec2c8d3f92fa3d88ff456b70afdc
2021-10-04 15:44:28 +00:00
Lecopzer Chen
d0f4b61ae6 UPSTREAM: arm64: kasan: abstract _text and _end to KERNEL_START/END
Arm64 provides defined macro for KERNEL_START and KERNEL_END,
thus replace them by the abstration instead of using _text and _end.

Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Acked-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20210324040522.15548-3-lecopzer.chen@mediatek.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Bug: 201711661
(cherry picked from commit 7d7b88ff5f)
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Change-Id: I806cb3d57e2064c272f3c87f0eb212ceea80c424
2021-10-04 15:44:20 +00:00
Lecopzer Chen
4d91b1f6ee UPSTREAM: arm64: kasan: don't populate vmalloc area for CONFIG_KASAN_VMALLOC
Linux support KAsan for VMALLOC since commit 3c5c3cfb9e
("kasan: support backing vmalloc space with real shadow memory")

Like how the MODULES_VADDR does now, just not to early populate
the VMALLOC_START between VMALLOC_END.

Before:

MODULE_VADDR: no mapping, no zero shadow at init
VMALLOC_VADDR: backed with zero shadow at init

After:

MODULE_VADDR: no mapping, no zero shadow at init
VMALLOC_VADDR: no mapping, no zero shadow at init

Thus the mapping will get allocated on demand by the core function
of KASAN_VMALLOC.

  -----------  vmalloc_shadow_start
 |           |
 |           |
 |           | <= non-mapping
 |           |
 |           |
 |-----------|
 |///////////|<- kimage shadow with page table mapping.
 |-----------|
 |           |
 |           | <= non-mapping
 |           |
 ------------- vmalloc_shadow_end
 |00000000000|
 |00000000000| <= Zero shadow
 |00000000000|
 ------------- KASAN_SHADOW_END

Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Acked-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20210324040522.15548-2-lecopzer.chen@mediatek.com
[catalin.marinas@arm.com: add a build check on VMALLOC_START != MODULES_END]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Bug: 201711661
(cherry picked from commit 9a0732efa7)
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Change-Id: I82c4b624685cc9e083d720904787df2326cb9cc0
2021-10-04 15:44:10 +00:00
Kever Yang
935b5c3bdd ANDROID: GKI: rockchip: Enable symbols for rk808-regulator
Functions changes summary: 0 Removed, 0 Changed (1546 filtered out), 2 Added functions
Variables changes summary: 0 Removed, 0 Changed (11 filtered out), 0 Added variables

2 Added functions:

  [A] 'function gpio_desc* devm_gpiod_get_index_optional(device*, const char*, unsigned int, gpiod_flags)'
  [A] 'function int gpiod_is_active_low(const gpio_desc*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ie06fa99d6616cb389bccc1d9167f084c7cafbe89
2021-10-04 15:48:04 +02:00
Kever Yang
9a8a15b8bd ANDROID: GKI: rockchip: Enable symbols for hid
Functions changes summary: 0 Removed, 0 Changed (1546 filtered out), 1 Added functions
Variables changes summary: 0 Removed, 0 Changed (11 filtered out), 0 Added variables

1 Added function:

  [A] 'function hid_report* hid_validate_values(hid_device*, unsigned int, unsigned int, unsigned int, unsigned int)'

Leaf changes summary: 11 artifacts changed
Changed leaf types summary: 0 leaf type changed

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I941c191d5c0fb5a01a6b9269f0afa7ea77db327a
2021-10-04 13:38:23 +02:00
Peter Collingbourne
55b0b34791 FROMGIT: arm64: kasan: mte: move GCR_EL1 switch to task switch when KASAN disabled
It is not necessary to write to GCR_EL1 on every kernel entry and
exit when HW tag-based KASAN is disabled because the kernel will not
execute any IRG instructions in that mode. Since accessing GCR_EL1
can be expensive on some microarchitectures, avoid doing so by moving
the access to task switch when HW tag-based KASAN is disabled.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Acked-by: Andrey Konovalov <andreyknvl@gmail.com>
Link: https://linux-review.googlesource.com/id/I78e90d60612a94c24344526f476ac4ff216e10d2
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20210924010655.2886918-1-pcc@google.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit e5af50a5df
 https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/mte)
Change-Id: I0f06de2fce4dea2967c0fee608d1900915493d23
Bug: 192536783
2021-10-01 09:39:36 -07:00
Peter Collingbourne
6c6d1d7e42 UPSTREAM: arm64: add MTE supported check to thread switching and syscall entry/exit
This lets us avoid doing unnecessary work on hardware that does not
support MTE, and will allow us to freely use MTE instructions in the
code called by mte_thread_switch().

Since this would mean that we do a redundant check in
mte_check_tfsr_el1(), remove it and add two checks now required in its
callers. This also avoids an unnecessary DSB+ISB sequence on the syscall
exit path for hardware not supporting MTE.

Fixes: 65812c6921 ("arm64: mte: Enable async tag check fault")
Cc: <stable@vger.kernel.org> # 5.13.x
Signed-off-by: Peter Collingbourne <pcc@google.com>
Link: https://linux-review.googlesource.com/id/I02fd000d1ef2c86c7d2952a7f099b254ec227a5d
Link: https://lore.kernel.org/r/20210915190336.398390-1-pcc@google.com
[catalin.marinas@arm.com: adjust the commit log slightly]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 8c8a3b5bd9)
Change-Id: I131933b18581a40cea9abf556625c80b12e4e974
Bug: 192536783
2021-10-01 09:39:36 -07:00
Mark Rutland
f746714fe4 UPSTREAM: arm64: kasan: mte: use a constant kernel GCR_EL1 value
When KASAN_HW_TAGS is selected, KASAN is enabled at boot time, and the
hardware supports MTE, we'll initialize `kernel_gcr_excl` with a value
dependent on KASAN_TAG_MAX. While the resulting value is a constant
which depends on KASAN_TAG_MAX, we have to perform some runtime work to
generate the value, and have to read the value from memory during the
exception entry path. It would be better if we could generate this as a
constant at compile-time, and use it as such directly.

Early in boot within __cpu_setup(), we initialize GCR_EL1 to a safe
value, and later override this with the value required by KASAN. If
CONFIG_KASAN_HW_TAGS is not selected, or if KASAN is disabeld at boot
time, the kernel will not use IRG instructions, and so the initial value
of GCR_EL1 is does not matter to the kernel. Thus, we can instead have
__cpu_setup() initialize GCR_EL1 to a value consistent with
KASAN_TAG_MAX, and avoid the need to re-initialize it during hotplug and
resume form suspend.

This patch makes arem64 use a compile-time constant KERNEL_GCR_EL1
value, which is compatible with KASAN_HW_TAGS when this is selected.
This removes the need to re-initialize GCR_EL1 dynamically, and acts as
an optimization to the entry assembly, which no longer needs to load
this value from memory. The redundant initialization hooks are removed.

In order to do this, KASAN_TAG_MAX needs to be visible outside of the
core KASAN code. To do this, I've moved the KASAN_TAG_* values into
<linux/kasan-tags.h>.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Peter Collingbourne <pcc@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Will Deacon <will@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Andrey Konovalov <andreyknvl@gmail.com>
Link: https://lore.kernel.org/r/20210714143843.56537-3-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 8286824789)
Change-Id: I397025af7051bedcdd35987af5deec46c228f8e2
Signed-off-by: Peter Collingbourne <pcc@google.com>
Bug: 192536783
2021-10-01 09:39:35 -07:00