Commit Graph

993148 Commits

Author SHA1 Message Date
Bian Jin chen
ceff5c1670 ANDROID: GKI: Add symbols for crypto
23 function symbol(s) added
  'void __crypto_xor(u8 *, const u8 *, const u8 *, unsigned int)'
  'int ce_aes_expandkey(struct crypto_aes_ctx *, const u8 *, unsigned int)'
  'int crypto_ahash_digest(struct ahash_request *)'
  'int crypto_ahash_final(struct ahash_request *)'
  'struct crypto_ahash * crypto_alloc_ahash(const char *, u32, u32)'
  'struct crypto_akcipher * crypto_alloc_akcipher(const char *, u32, u32)'
  'struct crypto_async_request * crypto_dequeue_request(struct crypto_queue *)'
  'int crypto_enqueue_request(struct crypto_queue *, struct crypto_async_request *)'
  'void crypto_inc(u8 *, unsigned int)'
  'void crypto_init_queue(struct crypto_queue *, unsigned int)'
  'int crypto_register_akcipher(struct akcipher_alg *)'
  'int crypto_sha1_finup(struct shash_desc *, const u8 *, unsigned int, u8 *)'
  'int crypto_sha1_update(struct shash_desc *, const u8 *, unsigned int)'
  'void crypto_unregister_ahash(struct ahash_alg *)'
  'void crypto_unregister_akcipher(struct akcipher_alg *)'
  'void crypto_unregister_algs(struct crypto_alg *, int)'
  'void crypto_unregister_skcipher(struct skcipher_alg *)'
  'void gf128mul_lle(be128 *, const be128 *)'
  'int rsa_parse_priv_key(struct rsa_key *, void *, unsigned int)'
  'int rsa_parse_pub_key(struct rsa_key *, void *, unsigned int)'
  'struct scatterlist * sg_last(struct scatterlist *, unsigned int)'
  'int sg_nents(struct scatterlist *)'
  'size_t sg_pcopy_to_buffer(struct scatterlist *, unsigned int, void *, size_t, off_t)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I6ead1bad2e1fb4935a9e044e54f7c6a25a314dfa
2022-12-17 12:08:39 +08:00
Eric Biggers
dc01503266 ANDROID: fips140: add dump_jitterentropy command to fips140_lab_util
For the entropy analysis, we must provide some output from the Jitter
RNG: a large amount of output from one instance, and a smaller amount of
output from each of a certain number of instances.

The original plan was to use a build of the userspace jitterentropy
library that matches the kernel's jitterentropy_rng as closely as
possible.  However, it's now being requested that the output be gotten
from the kernel instead.

Now that fips140_lab_util depends on AF_ALG anyway, it's straightforward
to dump output from jitterentropy_rng instances using AF_ALG.
Therefore, add a command dump_jitterentropy which supports this.

Bug: 188620248
Change-Id: I78eb26250e88f2fc28fc44aa201acbe5b84df8bb
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-12-16 19:01:49 +00:00
Bian Jin chen
6ab4ce67b5 ANDROID: GKI: Add symbols for misc driver
27 function symbol(s) added
  '__arm_smccc_hvc'
  'void bitmap_free(const unsigned long int *)'
  'unsigned long int * bitmap_zalloc(unsigned int, gfp_t)'
  'struct device * class_find_device(struct class *, struct device *, void *, int(*)(struct device *, void *))'
  'struct iio_channel * devm_iio_channel_get(struct device *, const char *)'
  'unsigned long int gen_pool_best_fit(unsigned long int *, unsigned long int, unsigned long int, unsigned int, void *, struct gen_pool *, unsigned long int)'
  'void gen_pool_set_algo(struct gen_pool *, genpool_algo_t, void *)'
  'phys_addr_t gen_pool_virt_to_phys(struct gen_pool *, unsigned long int)'
  'int get_kernel_pages(const struct kvec *, int, int, struct page * *)'
  'int i2c_bit_add_numbered_bus(struct i2c_adapter *)'
  'void iio_channel_release_all(struct iio_channel *)'
  'int iio_get_channel_type(struct iio_channel *, enum iio_chan_type *)'
  'int iio_read_channel_processed(struct iio_channel *, int *)'
  'int iio_update_buffers(struct iio_dev *, struct iio_buffer *, struct iio_buffer *)'
  'void input_set_poll_interval(struct input_dev *, unsigned int)'
  'int input_setup_polling(struct input_dev *, void(*)(struct input_dev *))'
  'int irq_domain_xlate_onetwocell(struct irq_domain *, struct device_node *, const u32 *, unsigned int, unsigned long int *, unsigned int *)'
  'int irq_set_chip(unsigned int, struct irq_chip *)'
  'int irq_set_parent(int, int)'
  'int led_classdev_flash_register_ext(struct device *, struct led_classdev_flash *, struct led_init_data *)'
  'void led_classdev_flash_unregister(struct led_classdev_flash *)'
  'void led_set_brightness_nosleep(struct led_classdev *, enum led_brightness)'
  'int led_trigger_register(struct led_trigger *)'
  'void led_trigger_unregister(struct led_trigger *)'
  'struct pinctrl_gpio_range * pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *, unsigned int)'
  'unsigned int swiotlb_max_segment()'
  'void unpin_user_pages(struct page * *, unsigned long int)'

1 variable symbol(s) added
  'unsigned long int avenrun[3]'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I531260b6e0dc7784f2abe079dfbaf13932dc1d0e
2022-12-16 18:39:48 +00:00
Eric Biggers
76938a48b3 UPSTREAM: crypto: algboss - compile out test-related code when tests disabled
When CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is set, the code in algboss.c
that handles CRYPTO_MSG_ALG_REGISTER is unnecessary, so make it be
compiled out.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Bug: 256875295
(cherry picked from commit 441cb1b730)
Change-Id: I11ebf60e1915ad5d13bd16a26d6c2c0944b4c401
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-12-15 19:16:27 +00:00
Eric Biggers
4294518a56 UPSTREAM: crypto: api - compile out crypto_boot_test_finished when tests disabled
The crypto_boot_test_finished static key is unnecessary when self-tests
are disabled in the kconfig, so optimize it out accordingly, along with
the entirety of crypto_start_tests().  This mainly avoids the overhead
of an unnecessary static_branch_enable() on every boot.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Bug: 256875295
(cherry picked from commit 06bd9c967e)
Change-Id: I68eff9772dc219a8786bf410cb4e946052ea7811
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-12-15 19:16:27 +00:00
Eric Biggers
1301367224 UPSTREAM: crypto: algboss - optimize registration of internal algorithms
Since algboss always skips testing of algorithms with the
CRYPTO_ALG_INTERNAL flag, there is no need to go through the dance of
creating the test kthread, which creates a lot of overhead.  Instead, we
can just directly finish the algorithm registration, like is now done
when self-tests are disabled entirely.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Bug: 256875295
(cherry picked from commit 9cadd73ade)
Change-Id: I10f814cd6903d41265f69297d8568b43ec30012e
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-12-15 19:16:27 +00:00
Eric Biggers
83685e1c4a BACKPORT: crypto: api - optimize algorithm registration when self-tests disabled
Currently, registering an algorithm with the crypto API always causes a
notification to be posted to the "cryptomgr", which then creates a
kthread to self-test the algorithm.  However, if self-tests are disabled
in the kconfig (as is the default option), then this kthread just
notifies waiters that the algorithm has been tested, then exits.

This causes a significant amount of overhead, especially in the kthread
creation and destruction, which is not necessary at all.  For example,
in a quick test I found that booting a "minimum" x86_64 kernel with all
the crypto options enabled (except for the self-tests) takes about 400ms
until PID 1 can start.  Of that, a full 13ms is spent just doing this
pointless dance, involving a kthread being created, run, and destroyed
over 200 times.  That's over 3% of the entire kernel start time.

Fix this by just skipping the creation of the test larval and the
posting of the registration notification entirely, when self-tests are
disabled.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Bug: 256875295
(cherry picked from commit a7008584ab)
(Resolved trivial conflict due to missing upstream commit d6097b8d5d)
Change-Id: Ia6be068618e9286c1be01415a6766ba2fa94fc0d
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-12-15 19:16:27 +00:00
Herbert Xu
50d30af868 UPSTREAM: crypto: api - Fix boot-up crash when crypto manager is disabled
When the crypto manager is disabled, we need to explicitly set
the crypto algorithms' tested status so that they can be used.

Fixes: cad439fc04 ("crypto: api - Do not create test larvals if...")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reported-by: Ido Schimmel <idosch@idosch.org>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Bug: 256875295
(cherry picked from commit beaaaa37c6)
Change-Id: I6cb42580e4774fbfd075497468b488be3447b7a9
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-12-15 19:16:27 +00:00
Herbert Xu
c10b51f9ed UPSTREAM: crypto: api - Do not create test larvals if manager is disabled
The delayed boot-time testing patch created a dependency loop
between api.c and algapi.c because it added a crypto_alg_tested
call to the former when the crypto manager is disabled.

We could instead avoid creating the test larvals if the crypto
manager is disabled.  This avoids the dependency loop as well
as saving some unnecessary work, albeit in a very unlikely case.

Reported-by: Nathan Chancellor <nathan@kernel.org>
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Reported-by: kernel test robot <lkp@intel.com>
Fixes: adad556efc ("crypto: api - Fix built-in testing dependency failures")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Bug: 256875295
(cherry picked from commit cad439fc04)
Change-Id: I4e0e0b2022dc060fc1d84744e04beae411165ad0
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-12-15 19:16:27 +00:00
Herbert Xu
ccb916e15f UPSTREAM: crypto: api - Export crypto_boot_test_finished
We need to export crypto_boot_test_finished in case api.c is
built-in while algapi.c is built as a module.

Fixes: adad556efc ("crypto: api - Fix built-in testing dependency failures")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Stephen Rothwell <sfr@canb.auug.org.au> # ppc32 build
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Bug: 256875295
(cherry picked from commit e42dff467e)
Change-Id: Iefc190f29539084e7c84e23120e861de2e0b9351
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-12-15 19:16:27 +00:00
Herbert Xu
46d85d752a UPSTREAM: crypto: api - Fix built-in testing dependency failures
When complex algorithms that depend on other algorithms are built
into the kernel, the order of registration must be done such that
the underlying algorithms are ready before the ones on top are
registered.  As otherwise they would fail during the self-test
which is required during registration.

In the past we have used subsystem initialisation ordering to
guarantee this.  The number of such precedence levels are limited
and they may cause ripple effects in other subsystems.

This patch solves this problem by delaying all self-tests during
boot-up for built-in algorithms.  They will be tested either when
something else in the kernel requests for them, or when we have
finished registering all built-in algorithms, whichever comes
earlier.

Reported-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Bug: 256875295
(cherry picked from commit adad556efc)
Change-Id: I9cb048ffe0ce7e471cc6e71904f1b2c462b57be4
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-12-15 19:16:27 +00:00
Bian Jin chen
f2470c29a5 ANDROID: GKI: Enable multimedia
11 function symbol(s) added
  'unsigned long int alloc_iova_fast(struct iova_domain *, unsigned long int, unsigned long int, bool)'
  'int devfreq_remove_governor(struct devfreq_governor *)'
  'int device_match_name(struct device *, void *)'
  'bool disable_hardirq(unsigned int)'
  'int drm_gem_dumb_destroy(struct drm_file *, struct drm_device *, uint32_t)'
  'int drm_gem_handle_delete(struct drm_file *, u32)'
  'void free_iova_fast(struct iova_domain *, unsigned long int, unsigned long int)'
  'void iommu_detach_group(struct iommu_domain *, struct iommu_group *)'
  'int iommu_dma_reserve_iova(struct device *, dma_addr_t, u64)'
  'struct platform_device * of_device_alloc(struct device_node *, const char *, struct device *)'
  'int vm_insert_page(struct vm_area_struct *, unsigned long int, struct page *)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I5dc79849a31303134a66fffd9e072d6311632dd8
2022-12-15 17:39:11 +08:00
Bian Jin chen
ef563b9a2f ANDROID: : GKI: Enable symbols for camera
37 function symbol(s) added
  'int __media_device_register(struct media_device *, struct module *)'
  'int __v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *)'
  'int __v4l2_ctrl_modify_range(struct v4l2_ctrl *, s64, s64, u64, s64)'
  'int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *, s32)'
  'int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *, s64)'
  'ssize_t iio_read_const_attr(struct device *, struct device_attribute *, char *)'
  'void media_device_cleanup(struct media_device *)'
  'void media_device_init(struct media_device *)'
  'void media_device_unregister(struct media_device *)'
  'int media_entity_setup_link(struct media_link *, u32)'
  'void media_graph_walk_cleanup(struct media_graph *)'
  'int media_graph_walk_init(struct media_graph *, struct media_device *)'
  'struct media_entity * media_graph_walk_next(struct media_graph *)'
  'void media_graph_walk_start(struct media_graph *, struct media_entity *)'
  'int media_pipeline_start(struct media_entity *, struct media_pipeline *)'
  'void media_pipeline_stop(struct media_entity *)'
  'int v4l2_async_notifier_register(struct v4l2_device *, struct v4l2_async_notifier *)'
  'void v4l2_async_unregister_subdev(struct v4l2_subdev *)'
  's64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *)'
  'struct v4l2_ctrl * v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *, const struct v4l2_ctrl_ops *, u32, u8, u8, const s64 *)'
  'struct v4l2_ctrl * v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *, const struct v4l2_ctrl_ops *, u32, u8, u64, u8, const char * const *)'
  'int v4l2_ctrl_subdev_log_status(struct v4l2_subdev *)'
  'int v4l2_ctrl_subdev_subscribe_event(struct v4l2_subdev *, struct v4l2_fh *, struct v4l2_event_subscription *)'
  'int v4l2_enum_dv_timings_cap(struct v4l2_enum_dv_timings *, const struct v4l2_dv_timings_cap *, v4l2_check_dv_timings_fnc *, void *)'
  'void v4l2_event_queue(struct video_device *, const struct v4l2_event *)'
  'int v4l2_event_subdev_unsubscribe(struct v4l2_subdev *, struct v4l2_fh *, struct v4l2_event_subscription *)'
  'int v4l2_event_subscribe(struct v4l2_fh *, const struct v4l2_event_subscription *, unsigned int, const struct v4l2_subscribed_event_ops *)'
  'bool v4l2_match_dv_timings(const struct v4l2_dv_timings *, const struct v4l2_dv_timings *, unsigned int, bool)'
  'int v4l2_pipeline_link_notify(struct media_link *, u32, unsigned int)'
  'int v4l2_pipeline_pm_get(struct media_entity *)'
  'void v4l2_pipeline_pm_put(struct media_entity *)'
  'void v4l2_print_dv_timings(const char *, const char *, const struct v4l2_dv_timings *, bool)'
  'int v4l2_src_change_event_subdev_subscribe(struct v4l2_subdev *, struct v4l2_fh *, struct v4l2_event_subscription *)'
  'int v4l2_subdev_link_validate(struct media_link *)'
  'void v4l2_subdev_notify_event(struct v4l2_subdev *, const struct v4l2_event *)'
  'bool v4l2_valid_dv_timings(const struct v4l2_dv_timings *, const struct v4l2_dv_timings_cap *, v4l2_check_dv_timings_fnc *, void *)'
  'int vb2_ioctl_prepare_buf(struct file *, void *, struct v4l2_buffer *)'

1 variable symbol(s) added
  'const char * v4l2_type_names[15]'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: Ibcedeab5b59ca85611d1930c02497f0860dc4446
2022-12-14 19:35:45 +00:00
Bian Jin chen
fcf367d4f3 ANDROID: : GKI: Add symbols for rockchip phy
31 function symbol(s) added
  'int devm_extcon_register_notifier(struct device *, struct extcon_dev *, unsigned int, struct notifier_block *)'
  'int extcon_sync(struct extcon_dev *, unsigned int)'
  'bool fwnode_device_is_available(const struct fwnode_handle *)'
  'struct fwnode_handle * fwnode_graph_get_next_endpoint(const struct fwnode_handle *, struct fwnode_handle *)'
  'struct fwnode_handle * fwnode_graph_get_port_parent(const struct fwnode_handle *)'
  'struct fwnode_handle * fwnode_graph_get_remote_endpoint(const struct fwnode_handle *)'
  'struct fwnode_handle * fwnode_graph_get_remote_port_parent(const struct fwnode_handle *)'
  'int fwnode_graph_parse_endpoint(const struct fwnode_handle *, struct fwnode_endpoint *)'
  'int fwnode_property_get_reference_args(const struct fwnode_handle *, const char *, const char *, unsigned int, unsigned int, struct fwnode_reference_args *)'
  'int fwnode_property_read_u64_array(const struct fwnode_handle *, const char *, u64 *, size_t)'
  'int media_create_pad_link(struct media_entity *, u16, struct media_entity *, u16, u32)'
  'int media_entity_pads_init(struct media_entity *, u16, struct media_pad *)'
  'struct media_pad * media_entity_remote_pad(const struct media_pad *)'
  'struct platform_device * of_platform_device_create(struct device_node *, const char *, struct device *)'
  'enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *, int)'
  'int phy_mipi_dphy_config_validate(struct phy_configure_opts_mipi_dphy *)'
  'void * typec_mux_get_drvdata(struct typec_mux *)'
  'struct typec_mux * typec_mux_register(struct device *, const struct typec_mux_desc *)'
  'void typec_mux_unregister(struct typec_mux *)'
  'int usb_add_phy(struct usb_phy *, enum usb_phy_type)'
  'enum usb_device_speed usb_get_maximum_speed(struct device *)'
  'struct v4l2_async_subdev * v4l2_async_notifier_add_fwnode_subdev(struct v4l2_async_notifier *, struct fwnode_handle *, unsigned int)'
  'int v4l2_async_notifier_add_subdev(struct v4l2_async_notifier *, struct v4l2_async_subdev *)'
  'void v4l2_async_notifier_cleanup(struct v4l2_async_notifier *)'
  'void v4l2_async_notifier_init(struct v4l2_async_notifier *)'
  'void v4l2_async_notifier_unregister(struct v4l2_async_notifier *)'
  'int v4l2_async_register_subdev(struct v4l2_subdev *)'
  'int v4l2_async_subdev_notifier_register(struct v4l2_subdev *, struct v4l2_async_notifier *)'
  'struct v4l2_ctrl * v4l2_ctrl_find(struct v4l2_ctrl_handler *, u32)'
  's32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *)'
  'int v4l2_querymenu(struct v4l2_ctrl_handler *, struct v4l2_querymenu *)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I10283a87163750a8dfb9c25830698ee0cbf151da
2022-12-14 19:35:45 +00:00
Bian Jin chen
9078255b0a ANDROID: : GKI: Add symbols for dwc pcie controller
14 function symbol(s) added
  'void debugfs_create_devm_seqfile(struct device *, const char *, struct dentry *, int(*)(struct seq_file *, void *))'
  'struct pci_host_bridge * devm_pci_alloc_host_bridge(struct device *, size_t)'
  'void * devm_pci_remap_cfg_resource(struct device *, struct resource *)'
  'u16 dw_pcie_find_ext_capability(struct dw_pcie *, u8)'
  'int dw_pcie_link_up(struct dw_pcie *)'
  'u32 dw_pcie_read_dbi(struct dw_pcie *, u32, size_t)'
  'void dw_pcie_write_dbi(struct dw_pcie *, u32, size_t, u32)'
  'int of_pci_get_max_link_speed(struct device_node *)'
  'int pci_disable_link_state(struct pci_dev *, int)'
  'int pci_host_probe(struct pci_host_bridge *)'
  'void pci_remove_root_bus(struct pci_bus *)'
  'void pci_stop_root_bus(struct pci_bus *)'
  'int pcie_capability_clear_and_set_word(struct pci_dev *, int, u16, u16)'
  'int regulator_get_current_limit(struct regulator *)'

1 variable symbol(s) added
  'struct irq_chip dummy_irq_chip'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I6394ebfe65ee352af0d049be9963e49dddd92eb1
2022-12-14 19:35:45 +00:00
Bian Jin chen
c85c26ba19 ANDROID: : GKI: Enable symbols for display interface
50 function symbol(s) added
  'struct backlight_device * backlight_device_register(const char *, struct device *, void *, const struct backlight_ops *, const struct backlight_properties *)'
  'void cec_fill_conn_info_from_drm(struct cec_connector_info *, const struct drm_connector *)'
  'struct cec_notifier * cec_notifier_cec_adap_register(struct device *, const char *, struct cec_adapter *)'
  'void cec_notifier_cec_adap_unregister(struct cec_notifier *, struct cec_adapter *)'
  'struct cec_notifier * cec_notifier_conn_register(struct device *, const char *, const struct cec_connector_info *)'
  'void cec_notifier_conn_unregister(struct cec_notifier *)'
  'void cec_notifier_set_phys_addr(struct cec_notifier *, u16)'
  'void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *, const struct edid *)'
  'void cec_queue_pin_hpd_event(struct cec_adapter *, bool, ktime_t)'
  'struct phy * devm_of_phy_get(struct device *, struct device_node *, const char *)'
  'struct phy * devm_of_phy_get_by_index(struct device *, struct device_node *, int)'
  'struct phy * devm_phy_optional_get(struct device *, const char *)'
  'void devm_remove_action(struct device *, void(*)(void *), void *)'
  'struct edid * drm_bridge_get_edid(struct drm_bridge *, struct drm_connector *)'
  'int drm_connector_attach_max_bpc_property(struct drm_connector *, int, int)'
  'enum hdmi_quantization_range drm_default_rgb_quant_range(const struct drm_display_mode *)'
  'int drm_dp_get_phy_test_pattern(struct drm_dp_aux *, struct drm_dp_phy_test_params *)'
  'int drm_dp_read_desc(struct drm_dp_aux *, struct drm_dp_desc *, bool)'
  'int drm_dp_read_dpcd_caps(struct drm_dp_aux *, u8 *)'
  'int drm_dp_read_sink_count(struct drm_dp_aux *)'
  'int drm_dp_set_phy_test_pattern(struct drm_dp_aux *, struct drm_dp_phy_test_params *, u8)'
  'int drm_dp_start_crc(struct drm_dp_aux *, struct drm_crtc *)'
  'int drm_dp_stop_crc(struct drm_dp_aux *)'
  'void drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *, const struct drm_connector *, const struct drm_display_mode *, enum hdmi_quantization_range)'
  'int drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *, const struct drm_connector_state *)'
  'int drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *, const struct drm_connector *, const struct drm_display_mode *)'
  'u8 drm_match_cea_mode(const struct drm_display_mode *)'
  'int drm_mode_create_hdmi_colorspace_property(struct drm_connector *)'
  'bool drm_mode_is_420(const struct drm_display_info *, const struct drm_display_mode *)'
  'bool drm_mode_is_420_also(const struct drm_display_info *, const struct drm_display_mode *)'
  'bool drm_mode_is_420_only(const struct drm_display_info *, const struct drm_display_mode *)'
  'int drm_of_encoder_active_endpoint(struct device_node *, struct drm_encoder *, struct of_endpoint *)'
  'void drm_panel_bridge_remove(struct drm_bridge *)'
  'void drm_property_destroy(struct drm_device *, struct drm_property *)'
  'int drm_property_replace_global_blob(struct drm_device *, struct drm_property_blob * *, size_t, void *, struct drm_mode_object *, struct drm_property *)'
  'ssize_t drm_scdc_read(struct i2c_adapter *, u8, void *, size_t)'
  'bool drm_scdc_set_high_tmds_clock_ratio(struct i2c_adapter *, bool)'
  'bool drm_scdc_set_scrambling(struct i2c_adapter *, bool)'
  'ssize_t drm_scdc_write(struct i2c_adapter *, u8, void *, size_t)'
  'ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *, void *, size_t)'
  'ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *, void *, size_t)'
  'ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *, void *, size_t)'
  'struct iio_channel * iio_channel_get(struct device *, const char *)'
  'bool mipi_dsi_packet_format_is_short(u8)'
  'int phy_mipi_dphy_get_default_config(unsigned long int, unsigned int, unsigned int, struct phy_configure_opts_mipi_dphy *)'
  'void pwm_free(struct pwm_device *)'
  'struct pwm_device * pwm_request(int, const char *)'
  'int report_iommu_fault(struct iommu_domain *, struct device *, unsigned long int, int)'
  'void sha1_init(__u32 *)'
  'void sha1_transform(__u32 *, const char *, __u32 *)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: Ie5ced38ed41c74d3d2684ff80d49b3429acfcae5
2022-12-14 19:35:45 +00:00
Lee Jones
2bf2370001 UPSTREAM: drm/amdgpu: temporarily disable broken Clang builds due to blown stack-frame
commit 6f6cb17143 upstream.

Patch series "Fix a bunch of allmodconfig errors", v2.

Since b339ec9c22 ("kbuild: Only default to -Werror if COMPILE_TEST")
WERROR now defaults to COMPILE_TEST meaning that it's enabled for
allmodconfig builds.  This leads to some interesting build failures when
using Clang, each resolved in this set.

With this set applied, I am able to obtain a successful allmodconfig Arm
build.

This patch (of 2):

calculate_bandwidth() is presently broken on all !(X86_64 || SPARC64 ||
ARM64) architectures built with Clang (all released versions), whereby the
stack frame gets blown up to well over 5k.  This would cause an immediate
kernel panic on most architectures.  We'll revert this when the following
bug report has been resolved:
https://github.com/llvm/llvm-project/issues/41896.

Bug: 261962742
Link: https://lkml.kernel.org/r/20221125120750.3537134-1-lee@kernel.org
Link: https://lkml.kernel.org/r/20221125120750.3537134-2-lee@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@gmail.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Lee Jones <lee@kernel.org>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Tom Rix <trix@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Iaa42b18cdcf9fe23d740c036371bd7950d431e14
Signed-off-by: Lee Jones <joneslee@google.com>
2022-12-14 08:01:23 +00:00
Lee Jones
c6580e1530 BACKPORT: Kconfig.debug: provide a little extra FRAME_WARN leeway when KASAN is enabled
[ Upstream commit 152fe65f30 ]

When enabled, KASAN enlarges function's stack-frames.  Pushing quite a few
over the current threshold.  This can mainly be seen on 32-bit
architectures where the present limit (when !GCC) is a lowly 1024-Bytes.

Bug: 261962742
Link: https://lkml.kernel.org/r/20221125120750.3537134-3-lee@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@gmail.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Tom Rix <trix@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Change-Id: I505a5187220b426fe49c0f15bf1704198082f63d
Signed-off-by: Lee Jones <joneslee@google.com>
2022-12-14 08:01:23 +00:00
Sabrina Dubroca
cc8b1052e8 UPSTREAM: esp: limit skb_page_frag_refill use to a single page
[ Upstream commit 5bd8baab08 ]

Commit ebe48d368e ("esp: Fix possible buffer overflow in ESP
transformation") tried to fix skb_page_frag_refill usage in ESP by
capping allocsize to 32k, but that doesn't completely solve the issue,
as skb_page_frag_refill may return a single page. If that happens, we
will write out of bounds, despite the check introduced in the previous
patch.

This patch forces COW in cases where we would end up calling
skb_page_frag_refill with a size larger than a page (first in
esp_output_head with tailen, then in esp_output_tail with
skb->data_len).

Fixes: cac2661c53 ("esp4: Avoid skb_cow_data whenever possible")
Fixes: 03e2a30f6a ("esp6: Avoid skb_cow_data whenever possible")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c075c3ea03)
[ resolves a merge conflict mistake in 5.10.113 as pointed out by
  Daniel that was noticed by watching the compiler warnings.]
Reported-by: Daniel Micay <danielmicay@gmail.com>
Bug: 261841282
Reported-by: Robin Peng <robinpeng@google.com>
Reported-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ic0c3b752b552a20aa35a9b262ee356e56b264695
2022-12-13 18:25:10 +00:00
Paul Lawrence
27e8affcfa ANDROID: fuse-bpf: Add /sys/fs flags for fuse-bpf version
Note that this is specific for the non-upstreamed version

Bug: 202785178
Test: cat /sys/fs/fuse/fuse_bpf_major_version
Change-Id: I68f9ca56778874975428839dfc1fd8f48b11bd75
Signed-off-by: Paul Lawrence <paullawrence@google.com>
2022-12-13 18:06:17 +00:00
Leo Chen
dbf356e587 ANDROID: Update the ABI representation
4 function symbol(s) added
  'void drm_atomic_bridge_chain_post_disable(struct drm_bridge *, struct drm_atomic_state *)'
  'void drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *)'
  'void drm_atomic_helper_update_legacy_modeset_state(struct drm_device *, struct drm_atomic_state *)'
  'bool drm_dev_has_vblank(const struct drm_device *)'

Bug: 255678834
Change-Id: I871b9a4ee778a42df20bbde767815f3ae2cb4364
Signed-off-by: Leo Chen <yinchiuan@google.com>
2022-12-13 09:18:24 +00:00
Bian Jin chen
4972310624 ANDROID: GKI: rockchip: Enable symbols for drm peripheral
21 function symbol(s) added
  'int compat_only_sysfs_link_entry_to_kobj(struct kobject *, struct kobject *, const char *, const char *)'
  'u32 * drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *, struct drm_bridge_state *, struct drm_crtc_state *, struct drm_connector_state *, u32, unsigned int *)'
  'enum drm_connector_status drm_bridge_detect(struct drm_bridge *)'
  'int drm_bridge_get_modes(struct drm_bridge *, struct drm_connector *)'
  'bool drm_kms_helper_is_poll_worker()'
  'int drm_of_find_panel_or_bridge(const struct device_node *, int, int, struct drm_panel * *, struct drm_bridge * *)'
  'int extcon_set_state(struct extcon_dev *, unsigned int, bool)'
  'int param_get_bool(char *, const struct kernel_param *)'
  'int param_set_bool(const char *, const struct kernel_param *)'
  'int pinctrl_generic_add_group(struct pinctrl_dev *, const char *, int *, int, void *)'
  'struct group_desc * pinctrl_generic_get_group(struct pinctrl_dev *, unsigned int)'
  'int pinctrl_generic_get_group_count(struct pinctrl_dev *)'
  'const char * pinctrl_generic_get_group_name(struct pinctrl_dev *, unsigned int)'
  'int pinctrl_generic_get_group_pins(struct pinctrl_dev *, unsigned int, const unsigned int * *, unsigned int *)'
  'int pinmux_generic_add_function(struct pinctrl_dev *, const char *, const char * *, const unsigned int, void *)'
  'struct function_desc * pinmux_generic_get_function(struct pinctrl_dev *, unsigned int)'
  'int pinmux_generic_get_function_count(struct pinctrl_dev *)'
  'int pinmux_generic_get_function_groups(struct pinctrl_dev *, unsigned int, const char * const * *, unsigned int * const)'
  'const char * pinmux_generic_get_function_name(struct pinctrl_dev *, unsigned int)'
  'int power_supply_is_system_supplied()'
  'int snd_pcm_stop(struct snd_pcm_substream *, snd_pcm_state_t)'

1 variable symbol(s) added
  'struct workqueue_struct * pm_wq'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I36c954316c7d55b901a01341812d9500fe026a3a
2022-12-09 07:25:27 +00:00
Lee Jones
0e3339114a UPSTREAM: bpf: Ensure correct locking around vulnerable function find_vpid()
[ Upstream commit 83c10cc362 ]

The documentation for find_vpid() clearly states:

  "Must be called with the tasklist_lock or rcu_read_lock() held."

Presently we do neither for find_vpid() instance in bpf_task_fd_query().
Add proper rcu_read_lock/unlock() to fix the issue.

Bug: 232939090
Fixes: 41bdc4b40e ("bpf: introduce bpf subcommand BPF_TASK_FD_QUERY")
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20220912133855.1218900-1-lee@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I517b52d97a22b92be1a479279067ddb7b84efbba
2022-12-08 11:26:25 +00:00
Kever Yang
68b77eae46 ANDROID: GKI: rockchip: Enable symbols for usbnet and serial
58 symbol(s) added
  'int __mdiobus_register(struct mii_bus *, struct module *)'
  'struct tty_driver * __tty_alloc_driver(unsigned int, struct module *, unsigned long int)'
  'struct net_device * __vlan_find_dev_deep_rcu(struct net_device *, __be16, u16)'
  'int cdc_ncm_bind_common(struct usbnet *, struct usb_interface *, u8, int)'
  'int cdc_ncm_change_mtu(struct net_device *, int)'
  'struct sk_buff * cdc_ncm_fill_tx_frame(struct usbnet *, struct sk_buff *, __le32)'
  'int cdc_ncm_rx_verify_ndp16(struct sk_buff *, int)'
  'int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *, struct sk_buff *)'
  'u8 cdc_ncm_select_altsetting(struct usb_interface *)'
  'void cdc_ncm_unbind(struct usbnet *, struct usb_interface *)'
  'int cdc_parse_cdc_header(struct usb_cdc_parsed_header *, struct usb_interface *, u8 *, int)'
  'u16 crc16(u16, const u8 *, size_t)'
  'int driver_attach(struct device_driver *)'
  'int genphy_read_status(struct phy_device *)'
  'void in6_dev_finish_destroy(struct inet6_dev *)'
  'const struct ipv6_stub * ipv6_stub'
  'struct mii_bus * mdiobus_alloc_size(size_t)'
  'void mdiobus_free(struct mii_bus *)'
  'void mdiobus_unregister(struct mii_bus *)'
  'void phy_attached_info(struct phy_device *)'
  'int phy_connect_direct(struct net_device *, struct phy_device *, void(*)(struct net_device *), phy_interface_t)'
  'void phy_disconnect(struct phy_device *)'
  'int phy_ethtool_get_link_ksettings(struct net_device *, struct ethtool_link_ksettings *)'
  'int phy_ethtool_nway_reset(struct net_device *)'
  'int phy_ethtool_set_link_ksettings(struct net_device *, const struct ethtool_link_ksettings *)'
  'struct phy_device * phy_find_first(struct mii_bus *)'
  'void phy_get_pause(struct phy_device *, bool *, bool *)'
  'int phy_init_hw(struct phy_device *)'
  'int phy_mii_ioctl(struct phy_device *, struct ifreq *, int)'
  'void phy_print_status(struct phy_device *)'
  'void phy_start(struct phy_device *)'
  'void phy_stop(struct phy_device *)'
  'void put_tty_driver(struct tty_driver *)'
  'void tty_ldisc_deref(struct tty_ldisc *)'
  'struct tty_ldisc * tty_ldisc_ref(struct tty_struct *)'
  'void tty_port_close(struct tty_port *, struct tty_struct *, struct file *)'
  'void tty_port_destroy(struct tty_port *)'
  'void tty_port_hangup(struct tty_port *)'
  'void tty_port_init(struct tty_port *)'
  'int tty_port_open(struct tty_port *, struct tty_struct *, struct file *)'
  'struct device * tty_port_register_device(struct tty_port *, struct tty_driver *, unsigned int, struct device *)'
  'void tty_port_tty_wakeup(struct tty_port *)'
  'int tty_register_driver(struct tty_driver *)'
  'void tty_set_operations(struct tty_driver *, const struct tty_operations *)'
  'int tty_standard_install(struct tty_driver *, struct tty_struct *)'
  'struct ktermios tty_std_termios'
  'void tty_termios_copy_hw(struct ktermios *, struct ktermios *)'
  'void tty_unregister_device(struct tty_driver *, unsigned int)'
  'int tty_unregister_driver(struct tty_driver *)'
  'void tty_vhangup(struct tty_struct *)'
  'void usb_autopm_get_interface_no_resume(struct usb_interface *)'
  'void usb_kill_urb(struct urb *)'
  'int usb_match_one_id(struct usb_interface *, const struct usb_device_id *)'
  'void usb_poison_urb(struct urb *)'
  'ssize_t usb_show_dynids(struct usb_dynids *, char *)'
  'ssize_t usb_store_new_id(struct usb_dynids *, const struct usb_device_id *, struct device_driver *, const char *, size_t)'
  'void usb_unpoison_urb(struct urb *)'
  'void usbnet_defer_kevent(struct usbnet *, int)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I5345c645595ce8fcab37afc51a5c16d7208f2bfb
2022-12-07 08:22:24 +08:00
Kever Yang
6c6cc97632 ANDROID: GKI: rockchip: Enable symbols for USB and type-c
45 symbol(s) added
  'int __typec_altmode_register_driver(struct typec_altmode_driver *, struct module *)'
  'void debugfs_create_regset32(const char *, umode_t, struct dentry *, struct debugfs_regset32 *)'
  'int default_wake_function(struct wait_queue_entry *, unsigned int, int, void *)'
  'void * devm_platform_get_and_ioremap_resource(struct platform_device *, unsigned int, struct resource * *)'
  'struct extcon_dev * extcon_get_extcon_dev(const char *)'
  'struct fwnode_handle * fwnode_create_software_node(const struct property_entry *, const struct fwnode_handle *)'
  'struct fwnode_handle * fwnode_find_reference(const struct fwnode_handle *, const char *, unsigned int)'
  'unsigned int mii_check_media(struct mii_if_info *, unsigned int, unsigned int)'
  'int mii_link_ok(struct mii_if_info *)'
  'int phy_reset(struct phy *)'
  'struct tcpm_port * tcpm_register_port(struct device *, struct tcpc_dev *)'
  'void tcpm_tcpc_reset(struct tcpm_port *)'
  'void tcpm_unregister_port(struct tcpm_port *)'
  'struct typec_port * typec_altmode2port(struct typec_altmode *)'
  'int typec_altmode_enter(struct typec_altmode *, u32 *)'
  'int typec_altmode_exit(struct typec_altmode *)'
  'const struct typec_altmode * typec_altmode_get_partner(struct typec_altmode *)'
  'int typec_altmode_notify(struct typec_altmode *, unsigned long int, void *)'
  'void typec_altmode_unregister_driver(struct typec_altmode_driver *)'
  'int typec_altmode_vdm(struct typec_altmode *, const u32, const u32 *, int)'
  'int typec_get_negotiated_svdm_version(struct typec_port *)'
  'int usb_add_gadget_udc(struct device *, struct usb_gadget *)'
  'void usb_del_gadget_udc(struct usb_gadget *)'
  'void usb_deregister_dev(struct usb_interface *, struct usb_class_driver *)'
  'void usb_ep_set_maxpacket_limit(struct usb_ep *, unsigned int)'
  'int usb_find_common_endpoints(struct usb_host_interface *, struct usb_endpoint_descriptor * *, struct usb_endpoint_descriptor * *, struct usb_endpoint_descriptor * *, struct usb_endpoint_descriptor * *)'
  'struct usb_interface * usb_find_interface(struct usb_driver *, int)'
  'void usb_gadget_giveback_request(struct usb_ep *, struct usb_request *)'
  'int usb_gadget_map_request(struct usb_gadget *, struct usb_request *, int)'
  'void usb_gadget_unmap_request(struct usb_gadget *, struct usb_request *, int)'
  'enum usb_dr_mode usb_get_dr_mode(struct device *)'
  'struct usb_interface * usb_get_intf(struct usb_interface *)'
  'int usb_hcd_map_urb_for_dma(struct usb_hcd *, struct urb *, gfp_t)'
  'void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *)'
  'int usb_hub_clear_tt_buffer(struct urb *)'
  'void usb_phy_set_charger_current(struct usb_phy *, unsigned int)'
  'void usb_poison_anchored_urbs(struct usb_anchor *)'
  'void usb_put_intf(struct usb_interface *)'
  'int usb_register_dev(struct usb_interface *, struct usb_class_driver *)'
  'unsigned int usb_wakeup_enabled_descendants(struct usb_device *)'
  'int usbnet_change_mtu(struct net_device *, int)'
  'void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *)'
  'u32 usbnet_get_link(struct net_device *)'
  'int usbnet_get_link_ksettings(struct net_device *, struct ethtool_link_ksettings *)'
  'int usbnet_set_link_ksettings(struct net_device *, const struct ethtool_link_ksettings *)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I43ee73d1171d69c2b722709b5d087b6eb2bca88b
2022-12-07 08:22:22 +08:00
Kever Yang
824ee512f4 ANDROID: GKI: rockchip: Enable symbols for mmc
14 symbol(s) added
  'int clk_get_phase(struct clk *)'
  'int clk_set_phase(struct clk *, int)'
  'u64 dma_get_required_mask(struct device *)'
  'void sdhci_adma_write_desc(struct sdhci_host *, void * *, dma_addr_t, int, unsigned int)'
  'void sdhci_dumpregs(struct sdhci_host *)'
  'int sdhci_execute_tuning(struct mmc_host *, u32)'
  'unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *)'
  'int sdhci_pltfm_unregister(struct platform_device *)'
  'void sdhci_request(struct mmc_host *, struct mmc_request *)'
  'int sdhci_resume_host(struct sdhci_host *)'
  'void sdhci_set_clock(struct sdhci_host *, unsigned int)'
  'void sdhci_set_power_and_bus_voltage(struct sdhci_host *, unsigned char, unsigned short int)'
  'void sdhci_set_uhs_signaling(struct sdhci_host *, unsigned int)'
  'int sdhci_suspend_host(struct sdhci_host *)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I09408f84b0a07b23cdb5557deda449b8e774229d
2022-12-07 08:22:22 +08:00
Kever Yang
884dddd59b ANDROID: GKI: rockchip: Enable symbols for drm module
51 symbol(s) added
  'void __drm_atomic_helper_connector_reset(struct drm_connector *, struct drm_connector_state *)'
  'int __drm_atomic_helper_disable_plane(struct drm_plane *, struct drm_plane_state *)'
  'void __drm_atomic_helper_plane_reset(struct drm_plane *, struct drm_plane_state *)'
  'int __platform_register_drivers(struct platform_driver * const *, unsigned int, struct module *)'
  'void * __vmalloc(unsigned long int, gfp_t)'
  'struct drm_bridge_state * drm_atomic_get_new_bridge_state(struct drm_atomic_state *, struct drm_bridge *)'
  'void drm_atomic_helper_wait_for_vblanks(struct drm_device *, struct drm_atomic_state *)'
  'int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *, const struct drm_display_mode *)'
  'void drm_bus_flags_from_videomode(const struct videomode *, u32 *)'
  'void drm_connector_list_update(struct drm_connector *)'
  'struct drm_crtc * drm_crtc_from_index(struct drm_device *, int)'
  'int drm_display_info_set_bus_formats(struct drm_display_info *, const u32 *, unsigned int)'
  'void drm_display_mode_from_videomode(const struct videomode *, struct drm_display_mode *)'
  'int drm_event_reserve_init_locked(struct drm_device *, struct drm_file *, struct drm_pending_event *, struct drm_event *)'
  'uint64_t drm_format_info_min_pitch(const struct drm_format_info *, int, unsigned int)'
  'void drm_framebuffer_cleanup(struct drm_framebuffer *)'
  'struct dma_buf * drm_gem_dmabuf_export(struct drm_device *, struct dma_buf_export_info *)'
  'int drm_gem_dmabuf_get_uuid(struct dma_buf *, uuid_t *)'
  'int drm_gem_dumb_map_offset(struct drm_file *, struct drm_device *, u32, u64 *)'
  'int drm_gem_fb_afbc_init(struct drm_device *, const struct drm_mode_fb_cmd2 *, struct drm_afbc_framebuffer *)'
  'int drm_gem_fb_init_with_funcs(struct drm_device *, struct drm_framebuffer *, struct drm_file *, const struct drm_mode_fb_cmd2 *, const struct drm_framebuffer_funcs *)'
  'void drm_kms_helper_poll_enable(struct drm_device *)'
  'int drm_mm_reserve_node(struct drm_mm *, struct drm_mm_node *)'
  'struct drm_display_mode * drm_mode_create(struct drm_device *)'
  'int drm_mode_create_tv_properties(struct drm_device *, unsigned int, const char * const *)'
  'int drm_mode_crtc_set_gamma_size(struct drm_crtc *, int)'
  'void drm_mode_prune_invalid(struct drm_device *, struct list_head *, bool)'
  'void drm_mode_set_crtcinfo(struct drm_display_mode *, int)'
  'void drm_mode_set_name(struct drm_display_mode *)'
  'void drm_mode_sort(struct list_head *)'
  'enum drm_mode_status drm_mode_validate_driver(struct drm_device *, const struct drm_display_mode *)'
  'enum drm_mode_status drm_mode_validate_size(const struct drm_display_mode *, int, int)'
  'enum drm_mode_status drm_mode_validate_ycbcr420(const struct drm_display_mode *, struct drm_connector *)'
  'uint32_t drm_of_crtc_port_mask(struct drm_device *, struct device_node *)'
  'int drm_panel_of_backlight(struct drm_panel *)'
  'unsigned long int drm_prime_get_contiguous_size(struct sg_table *)'
  'bool drm_probe_ddc(struct i2c_adapter *)'
  'struct drm_property * drm_property_create_object(struct drm_device *, u32, const char *, uint32_t)'
  'void drm_self_refresh_helper_cleanup(struct drm_crtc *)'
  'int drm_self_refresh_helper_init(struct drm_crtc *)'
  'int memblock_free(phys_addr_t, phys_addr_t)'
  'int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *, u16 *)'
  'ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *, void *, size_t)'
  'int of_drm_get_panel_orientation(const struct device_node *, enum drm_panel_orientation *)'
  'int of_get_display_timing(const struct device_node *, const char *, struct display_timing *)'
  'int of_get_drm_display_mode(struct device_node *, struct drm_display_mode *, u32 *, int)'
  'struct i2c_adapter * of_get_i2c_adapter_by_node(struct device_node *)'
  'struct device_node * of_graph_get_port_by_id(struct device_node *, u32)'
  'struct device_node * of_graph_get_remote_port(const struct device_node *)'
  'void platform_unregister_drivers(struct platform_driver * const *, unsigned int)'
  'void videomode_from_timing(const struct display_timing *, struct videomode *)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I214d4137a92f2cff5d0b2c1c16fca8277756e62f
2022-12-07 08:22:22 +08:00
John Stultz
4351d23057 ANDROID: softirq: Fix missing wakeup_softirqd() in !CONFIG_RT_SOFTINT_OPTIMIZATION case
In commit 0578248bed ("ANDROID: softirq: defer softirq
processing to ksoftirqd if CPU is busy with RT"), the patch tweaked
the logic as such:

__do_softirq(void)
        local_irq_disable();

        pending = local_softirq_pending();
+       deferred = softirq_deferred_for_rt(pending);
+
        if (pending) {
                if (time_before(jiffies, end) && !need_resched() &&
                    --max_restart)
                        goto restart;
-
-               wakeup_softirqd();
        }

+#ifdef CONFIG_RT_SOFTINT_OPTIMIZATION
+       if (pending | deferred)
+               wakeup_softirqd();
+#endif

The problem with the above, is in the case
!CONFIG_RT_SOFTINT_OPTIMIZATION, wakeup_softirqd() will not be called
when there is a pending local softirq.

This was originally raised by Qais Yousef <qyousef@google.com> but
had not been prioritized due to it being only a correctness issue
as CONFIG_RT_SOFTINT_OPTIMIZATION is enabled on Android kernels.

However, it was pointed out that on ARM32, _RT_SOFTINT_OPTIMIZATION
is disabled, and this was in fact causing errors of the sort:
  "NOHZ tick-stop error: Non-RCU local softirq work is pending..."

Bug: 261354911
Fixes: 0578248bed ("ANDROID: softirq: defer softirq processing to ksoftirqd if CPU is busy with RT")
Signed-off-by: John Stultz <jstultz@google.com>
Change-Id: I2b84811a2e7435e861304b22b0b0a63405a48bc8
2022-12-06 17:44:55 +00:00
Kever Yang
1e3329fb68 ANDROID: GKI: rockchip: Add symbols for pinctrl and pmic
24 symbol(s) added
  'int __irq_alloc_domain_generic_chips(struct irq_domain *, int, int, const char *, irq_flow_handler_t, unsigned int, unsigned int, enum irq_gc_flags)'
  'int class_for_each_device(struct class *, struct device *, void *, int(*)(struct device *, void *))'
  'struct gpio_desc * devm_gpiod_get_index_optional(struct device *, const char *, unsigned int, enum gpiod_flags)'
  'int gpiod_is_active_low(const struct gpio_desc *)'
  'void irq_gc_ack_set_bit(struct irq_data *)'
  'void irq_gc_mask_clr_bit(struct irq_data *)'
  'void irq_gc_mask_set_bit(struct irq_data *)'
  'int irq_gc_set_wake(struct irq_data *, unsigned int)'
  'struct irq_domain_ops irq_generic_chip_ops'
  'struct irq_chip_generic * irq_get_domain_generic_chip(struct irq_domain *, unsigned int)'
  'struct pinctrl_dev * of_pinctrl_get(struct device_node *)'
  'int of_regulator_match(struct device *, struct device_node *, struct of_regulator_match *, unsigned int)'
  'int pinconf_generic_parse_dt_config(struct device_node *, struct pinctrl_dev *, unsigned long int * *, unsigned int *)'
  'int pinctrl_gpio_direction_input(unsigned int)'
  'int pinctrl_gpio_direction_output(unsigned int)'
  'void(* pm_power_off_prepare)()'
  'struct class * power_supply_class'
  'int pwm_adjust_config(struct pwm_device *)'
  'int regulator_map_voltage_iterate(struct regulator_dev *, int, int)'
  'int regulator_map_voltage_linear_range(struct regulator_dev *, int, int)'
  'int regulator_set_pull_down_regmap(struct regulator_dev *)'
  'int regulator_set_voltage_time_sel(struct regulator_dev *, unsigned int, unsigned int)'
  'int regulator_suspend_enable(struct regulator_dev *, suspend_state_t)'
  'int spi_write_then_read(struct spi_device *, void *, unsigned int, void *, unsigned int)'

Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I2b870b4e283b3d502c3368bfb9686841db990a00
2022-12-06 07:34:54 +00:00
Hyunwoo Kim
9762be4214 UPSTREAM: HID: roccat: Fix use-after-free in roccat_read()
[ Upstream commit cacdb14b1c ]

roccat_report_event() is responsible for registering
roccat-related reports in struct roccat_device.

int roccat_report_event(int minor, u8 const *data)
{
	struct roccat_device *device;
	struct roccat_reader *reader;
	struct roccat_report *report;
	uint8_t *new_value;

	device = devices[minor];

	new_value = kmemdup(data, device->report_size, GFP_ATOMIC);
	if (!new_value)
		return -ENOMEM;

	report = &device->cbuf[device->cbuf_end];

	/* passing NULL is safe */
	kfree(report->value);
	...

The registered report is stored in the struct roccat_device member
"struct roccat_report cbuf[ROCCAT_CBUF_SIZE];".
If more reports are received than the "ROCCAT_CBUF_SIZE" value,
kfree() the saved report from cbuf[0] and allocates a new reprot.
Since there is no lock when this kfree() is performed,
kfree() can be performed even while reading the saved report.

static ssize_t roccat_read(struct file *file, char __user *buffer,
		size_t count, loff_t *ppos)
{
	struct roccat_reader *reader = file->private_data;
	struct roccat_device *device = reader->device;
	struct roccat_report *report;
	ssize_t retval = 0, len;
	DECLARE_WAITQUEUE(wait, current);

	mutex_lock(&device->cbuf_lock);

	...

	report = &device->cbuf[reader->cbuf_start];
	/*
	 * If report is larger than requested amount of data, rest of report
	 * is lost!
	 */
	len = device->report_size > count ? count : device->report_size;

	if (copy_to_user(buffer, report->value, len)) {
		retval = -EFAULT;
		goto exit_unlock;
	}
	...

The roccat_read() function receives the device->cbuf report and
delivers it to the user through copy_to_user().
If the N+ROCCAT_CBUF_SIZE th report is received while copying of
the Nth report->value is in progress, the pointer that copy_to_user()
is working on is kfree()ed and UAF read may occur. (race condition)

Since the device node of this driver does not set separate permissions,
this is not a security vulnerability, but because it is used for
requesting screen display of profile or dpi settings,
a user using the roccat device can apply udev to this device node or
There is a possibility to use it by giving.

Bug: 251067658
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I90b24df9216ab87a4fec0ab06fa52e7b1eb97fd1
2022-12-05 23:33:19 +00:00
Amit Pundir
2f04489ef3 ANDROID: GKI: db845c: Update symbols list and ABI
android13-5.10 is broken on Dragonboard 845c because of
recently added symbols.

So updated the symbols list by running:
  "BUILD_CONFIG=common/build.config.db845c \
    KMI_SYMBOL_LIST_ADD_ONLY=1 build/build_abi.sh -s"

And the abi_gki_aarch64 ABI by running:
  "BUILD_CONFIG=common/build.config.gki.aarch64 \
    ABI_DEFINITION=abi_gki_aarch64.xml KMI_SYMBOL_LIST_ADD_ONLY=1 \
     build/build_abi.sh --update --print-report"

========================================================

ABI DIFFERENCES HAVE BEEN DETECTED!

4 function symbol(s) added
  'struct reset_control * __reset_control_get(struct device *, const char *, int, bool, bool, bool)'
  'void * devm_platform_get_and_ioremap_resource(struct platform_device *, unsigned int, struct resource * *)'
  'void reset_control_put(struct reset_control *)'
  'ssize_t strscpy_pad(char *, const char *, size_t)'

========================================================

This ABI and symbols update end up adding a lot more symbols
than the above 4 missing function symbols:
* devm_get_clk_from_child symbol was added in commit
6f3673c8d8 ("phy: qcom-qmp: fix struct clk leak on probe
errors")
* xa_* symbols were added in commit 4f7286422a
("qrtr: Convert qrtr_ports from IDR to XArray")

Bug: 146449535
Fixes: 66651d7199 ("mmc: sdhci-msm: Reset GCC_SDCC_BCR register for SDHC")
Fixes: 3660db29b0 ("iommu/arm-smmu: fix possible null-ptr-deref in arm_smmu_device_probe()")
Fixes: 0a49bfa8f8 ("rpmsg: qcom: glink: replace strncpy() with strscpy_pad()")
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: I620624933bde04c663d753b4e970f9b1156c396b
2022-12-05 20:42:36 +00:00
Charan Teja Kalla
02e57a0850 ANDROID: arm64: mm: perform clean & invalidation in __dma_map_area
commit c50f11c619 ("arm64: mm: Don't invalidate FROM_DEVICE buffers at
start of DMA transfer") break assumptions of some device drivers about
invalidation that happens as part of __dma_map_area(DMA_FROM_DEVICE). An
example include drivers using dmabuf API dma_buf_begin_cpu_access() and
dma_buf_end_cpu_access() to achieve buffer invalidation. Fix this breakage
by replacing clean with clean and invalidation in __dma_map_area() for
DMA inbound case.

Bug: 260978220
Change-Id: Id1a2750c2036de693cd52e8f7316f1d820b5a262
Fixes: c50f11c619 ("arm64: mm: Don't invalidate FROM_DEVICE buffers at start of DMA transfer")
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
Signed-off-by: Shiraz Hashim <quic_shashim@quicinc.com>
Signed-off-by: Prakash Gupta <quic_guptap@quicinc.com>
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
2022-12-05 17:39:59 +00:00
SeongJae Park
08bf420407 UPSTREAM: mm/damon/core: initialize damon_target->list in damon_new_target()
'struct damon_target' creation function, 'damon_new_target()' is not
initializing its '->list' field, unlike other DAMON structs creator
functions such as 'damon_new_region()'.  Normal users of
'damon_new_target()' initializes the field by adding the target to DAMON
context's targets list, but some code could access the uninitialized
field.

This commit avoids the case by initializing the field in
'damon_new_target()'.

Bug: 254441685
Link: https://lkml.kernel.org/r/20221002193130.8227-1-sj@kernel.org
Fixes: f23b8eee18 ("mm/damon/core: implement region-based sampling")
Signed-off-by: SeongJae Park <sj@kernel.org>
Reported-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit b1f44cdaba)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I42adfe86cbe78f45c04a66d486261234e16d463f
2022-12-05 11:27:45 +00:00
Dan Carpenter
94ce24b0ce BACKPORT: usb: dwc3: core: fix some leaks in probe
The dwc3_get_properties() function calls:

	dwc->usb_psy = power_supply_get_by_name(usb_psy_name);

so there is some additional clean up required on these error paths.

Bug: 254441685
Fixes: 6f0764b5ad ("usb: dwc3: add a power supply for current control")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YyxFYFnP53j9sCg+@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2a735e4b55)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ic8833e7db878998bb88baaf6d396aa8dcfd4984f
2022-12-05 11:27:45 +00:00
Baolin Wang
e1b3243fcb UPSTREAM: mm/damon: validate if the pmd entry is present before accessing
pmd_huge() is used to validate if the pmd entry is mapped by a huge page,
also including the case of non-present (migration or hwpoisoned) pmd entry
on arm64 or x86 architectures.  This means that pmd_pfn() can not get the
correct pfn number for a non-present pmd entry, which will cause
damon_get_page() to get an incorrect page struct (also may be NULL by
pfn_to_online_page()), making the access statistics incorrect.

This means that the DAMON may make incorrect decision according to the
incorrect statistics, for example, DAMON may can not reclaim cold page
in time due to this cold page was regarded as accessed mistakenly if
DAMOS_PAGEOUT operation is specified.

Moreover it does not make sense that we still waste time to get the page
of the non-present entry.  Just treat it as not-accessed and skip it,
which maintains consistency with non-present pte level entries.

So add pmd entry present validation to fix the above issues.

Bug: 254441685
Link: https://lkml.kernel.org/r/58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com
Fixes: 3f49584b26 ("mm/damon: implement primitives for the virtual memory address spaces")
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit c8b9aff419)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Id7ac065318002e3a293581bace65ea201eb68b2c
2022-12-05 11:27:45 +00:00
Greg Kroah-Hartman
22993dce82 UPSTREAM: mm/damon/dbgfs: fix memory leak when using debugfs_lookup()
When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time.  Fix this up by properly calling
dput().

Bug: 254441685
Link: https://lkml.kernel.org/r/20220902191149.112434-1-sj@kernel.org
Fixes: 75c1c2b53c ("mm/damon/dbgfs: support multiple contexts")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 1552fd3ef7)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ib7cfad2c9d32d185ff8267c3d421dd2426e36eb8
2022-12-05 11:27:45 +00:00
William Wu
f9ed366175 UPSTREAM: usb: dwc3: core: leave default DMA if the controller does not support 64-bit DMA
On some DWC3 controllers (e.g. Rockchip SoCs), the DWC3 core
doesn't support 64-bit DMA address width. In this case, this
driver should use the default 32-bit mask. Otherwise, the DWC3
controller will break if it runs on above 4GB physical memory
environment.

This patch reads the DWC_USB3_AWIDTH bits of GHWPARAMS0 which
used for the DMA address width, and only configure 64-bit DMA
mask if the DWC_USB3_AWIDTH is 64.

Bug: 254441685
Fixes: 45d39448b4 ("usb: dwc3: support 64 bit DMA in platform driver")
Cc: stable <stable@kernel.org>
Reviewed-by: Sven Peter <sven@svenpeter.dev>
Signed-off-by: William Wu <william.wu@rock-chips.com>
Link: https://lore.kernel.org/r/20220901083446.3799754-1-william.wu@rock-chips.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 91062e663b)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I0557881e11288edea471635911bc32e19445136a
2022-12-05 11:27:45 +00:00
Yuezhang Mo
90e5478437 BACKPORT: exfat: fix overflow for large capacity partition
Using int type for sector index, there will be overflow in a large
capacity partition.

For example, if storage with sector size of 512 bytes and partition
capacity is larger than 2TB, there will be overflow.

Bug: 254441685
Fixes: 1b61383854 ("exfat: reduce block requests when zeroing a cluster")
Cc: stable@vger.kernel.org # v5.19+
Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Andy Wu <Andy.Wu@sony.com>
Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com>
Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
(cherry picked from commit 2e9ceb6728)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I0ebd4d6d3ac9e0e5b50f58a62e5b49ef4959b3e3
2022-12-05 11:27:45 +00:00
Badari Pulavarty
0e47e246cf UPSTREAM: mm/damon/dbgfs: avoid duplicate context directory creation
When user tries to create a DAMON context via the DAMON debugfs interface
with a name of an already existing context, the context directory creation
fails but a new context is created and added in the internal data
structure, due to absence of the directory creation success check.  As a
result, memory could leak and DAMON cannot be turned on.  An example test
case is as below:

    # cd /sys/kernel/debug/damon/
    # echo "off" >  monitor_on
    # echo paddr > target_ids
    # echo "abc" > mk_context
    # echo "abc" > mk_context
    # echo $$ > abc/target_ids
    # echo "on" > monitor_on  <<< fails

Return value of 'debugfs_create_dir()' is expected to be ignored in
general, but this is an exceptional case as DAMON feature is depending
on the debugfs functionality and it has the potential duplicate name
issue.  This commit therefore fixes the issue by checking the directory
creation failure and immediately return the error in the case.

Bug: 254441685
Link: https://lkml.kernel.org/r/20220821180853.2400-1-sj@kernel.org
Fixes: 75c1c2b53c ("mm/damon/dbgfs: support multiple contexts")
Signed-off-by: Badari Pulavarty <badari.pulavarty@intel.com>
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org>	[ 5.15.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit d26f607036)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I62986ea5d81c7dfcb1a04de60ffebab392ff75de
2022-12-05 11:27:45 +00:00
Johan Hovold
55df4d9fc9 BACKPORT: usb: dwc3: qcom: fix runtime PM wakeup
A device must enable wakeups during runtime suspend regardless of
whether it is capable and allowed to wake the system up from system
suspend.

Bug: 254441685
Fixes: 2664deb093 ("usb: dwc3: qcom: Honor wakeup enabled/disabled state")
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20220804151001.23612-6-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 6498a96c8c)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I023063bc8a4e62a1422f316dc792b03446ff4b3f
2022-12-05 11:27:45 +00:00
Badhri Jagan Sridharan
4bb9418c72 UPSTREAM: usb: typec: tcpm: Return ENOTSUPP for power supply prop writes
When the port does not support USB PD, prevent transition to PD
only states when power supply property is written. In this case,
TCPM transitions to SNK_NEGOTIATE_CAPABILITIES
which should not be the case given that the port is not pd_capable.

[   84.308251] state change SNK_READY -> SNK_NEGOTIATE_CAPABILITIES [rev3 NONE_AMS]
[   84.308335] Setting usb_comm capable false
[   84.323367] set_auto_vbus_discharge_threshold mode:3 pps_active:n vbus:5000 ret:0
[   84.323376] state change SNK_NEGOTIATE_CAPABILITIES -> SNK_WAIT_CAPABILITIES [rev3 NONE_AMS]

Bug: 254441685
Fixes: e9e6e164ed ("usb: typec: tcpm: Support non-PD mode")
Cc: stable@vger.kernel.org
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20220817215410.1807477-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f2d38edc5e)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: If1c20f957e3644cf42e69bd1dad3be089d54f888
2022-12-05 11:27:45 +00:00
Oliver Upton
bb44ca0133 UPSTREAM: KVM: arm64: Reject 32bit user PSTATE on asymmetric systems
KVM does not support AArch32 EL0 on asymmetric systems. To that end,
prevent userspace from configuring a vCPU in such a state through
setting PSTATE.

It is already ABI that KVM rejects such a write on a system where
AArch32 EL0 is unsupported. Though the kernel's definition of a 32bit
system changed in commit 2122a83331 ("arm64: Allow mismatched
32-bit EL0 support"), KVM's did not.

Bug: 254441685
Fixes: 2122a83331 ("arm64: Allow mismatched 32-bit EL0 support")
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220816192554.1455559-3-oliver.upton@linux.dev
(cherry picked from commit b10d86fb8e)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ibe2b69ec1d9aef3ed97d00aada5a9addb26f23da
2022-12-05 11:27:45 +00:00
Oliver Upton
6b3f3123a6 UPSTREAM: KVM: arm64: Treat PMCR_EL1.LC as RES1 on asymmetric systems
KVM does not support AArch32 on asymmetric systems. To that end, enforce
AArch64-only behavior on PMCR_EL1.LC when on an asymmetric system.

Bug: 254441685
Fixes: 2122a83331 ("arm64: Allow mismatched 32-bit EL0 support")
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220816192554.1455559-2-oliver.upton@linux.dev
(cherry picked from commit f3c6efc72f)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I980557ff6d0886059fb9b884c0925c7a9559d052
2022-12-05 11:27:45 +00:00
Peter Wang
3691084606 UPSTREAM: scsi: ufs: core: Correct ufshcd_shutdown() flow
After ufshcd_wl_shutdown() set device power off and link off,
ufshcd_shutdown() could turn off clock/power. Also remove
pm_runtime_get_sync.

The reason why it is safe to remove pm_runtime_get_sync() is because:

 - ufshcd_wl_shutdown() -> pm_runtime_get_sync() will resume hba->dev too.

 - device resume(turn on clk/power) is not required, even if device is in
   RPM_SUSPENDED.

Bug: 254441685
Link: https://lore.kernel.org/r/20220727030526.31022-1-peter.wang@mediatek.com
Fixes: b294ff3e34 ("scsi: ufs: core: Enable power management for wlun")
Cc: <stable@vger.kernel.org> # 5.15.x
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 00511d2abf)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I0b4e365484af5dcc432a2905c2775218becafdfa
2022-12-05 11:27:45 +00:00
Josef Bacik
ea56f85395 UPSTREAM: mm: fix page leak with multiple threads mapping the same page
We have an application with a lot of threads that use a shared mmap backed
by tmpfs mounted with -o huge=within_size.  This application started
leaking loads of huge pages when we upgraded to a recent kernel.

Using the page ref tracepoints and a BPF program written by Tejun Heo we
were able to determine that these pages would have multiple refcounts from
the page fault path, but when it came to unmap time we wouldn't drop the
number of refs we had added from the faults.

I wrote a reproducer that mmap'ed a file backed by tmpfs with -o
huge=always, and then spawned 20 threads all looping faulting random
offsets in this map, while using madvise(MADV_DONTNEED) randomly for huge
page aligned ranges.  This very quickly reproduced the problem.

The problem here is that we check for the case that we have multiple
threads faulting in a range that was previously unmapped.  One thread maps
the PMD, the other thread loses the race and then returns 0.  However at
this point we already have the page, and we are no longer putting this
page into the processes address space, and so we leak the page.  We
actually did the correct thing prior to f9ce0be71d, however it looks
like Kirill copied what we do in the anonymous page case.  In the
anonymous page case we don't yet have a page, so we don't have to drop a
reference on anything.  Previously we did the correct thing for file based
faults by returning VM_FAULT_NOPAGE so we correctly drop the reference on
the page we faulted in.

Fix this by returning VM_FAULT_NOPAGE in the pmd_devmap_trans_unstable()
case, this makes us drop the ref on the page properly, and now my
reproducer no longer leaks the huge pages.

Bug: 254441685
[josef@toxicpanda.com: v2]
  Link: https://lkml.kernel.org/r/e90c8f0dbae836632b669c2afc434006a00d4a67.1657721478.git.josef@toxicpanda.com
Link: https://lkml.kernel.org/r/2b798acfd95c9ab9395fe85e8d5a835e2e10a920.1657051137.git.josef@toxicpanda.com
Fixes: f9ce0be71d ("mm: Cleanup faultaround and finish_fault() codepaths")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Rik van Riel <riel@surriel.com>
Signed-off-by: Chris Mason <clm@fb.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 3fe2895cfe)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I915f82653b7340cc594a5af1c4a1122edb9d428e
2022-12-05 11:27:45 +00:00
Hsin-Yi Wang
f9f05b57f4 UPSTREAM: PM: domains: Ensure genpd_debugfs_dir exists before remove
Both genpd_debug_add() and genpd_debug_remove() may be called
indirectly by other drivers while genpd_debugfs_dir is not yet
set. For example, drivers can call pm_genpd_init() in probe or
pm_genpd_init() in probe fail/cleanup path:

pm_genpd_init()
 --> genpd_debug_add()

pm_genpd_remove()
 --> genpd_remove()
   --> genpd_debug_remove()

At this time, genpd_debug_init() may not yet be called.

genpd_debug_add() checks that if genpd_debugfs_dir is NULL, it
will return directly. Make sure this is also checked
in pm_genpd_remove(), otherwise components under debugfs root
which has the same name as other components under pm_genpd may
be accidentally removed, since NULL represents debugfs root.

Bug: 254441685
Fixes: 718072ceb2 ("PM: domains: create debugfs nodes when adding power domains")
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 37101d3c71)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I11b189fb66e29557fea12d0d6dcd41a6b6e0b2ef
2022-12-05 11:27:45 +00:00
Bjorn Andersson
d6b4e4078b UPSTREAM: scsi: ufs: core: Drop loglevel of WriteBoost message
Commit '3b5f3c0d0548 ("scsi: ufs: core: Tidy up WB configuration code")'
changed the log level of the write boost enable/disable notification from
debug to info. This results in a lot of noise in the kernel log during
normal operation.

Drop it back to debug level to avoid this.

Bug: 254441685
Link: https://lore.kernel.org/r/20220709000027.3929970-1-bjorn.andersson@linaro.org
Fixes: 3b5f3c0d05 ("scsi: ufs: core: Tidy up WB configuration code")
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Acked-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 2ae57c9950)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I02721806166750d014e55486508d2126cedd20f8
2022-12-05 11:27:45 +00:00
Liang He
6d03ca09dd UPSTREAM: of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer
We should use of_node_put() for the reference 'node' returned by
of_parse_phandle() which will increase the refcount.

Bug: 254441685
Fixes: fec9b62509 ("of: Add plumbing for restricted DMA pool")
Co-authored-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Liang He <windhl@126.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220702014449.263772-1-windhl@126.com
(cherry picked from commit d17e37c41b)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ib56e5a7b71e8785b5d8e7947cdbee7be501cfd21
2022-12-05 11:27:45 +00:00
Robin Murphy
ee3bce3554 UPSTREAM: swiotlb: fail map correctly with failed io_tlb_default_mem
In the failure case of trying to use a buffer which we'd previously
failed to allocate, the "!mem" condition is no longer sufficient since
io_tlb_default_mem became static and assigned by default. Update the
condition to work as intended per the rest of that conversion.

Bug: 254441685
Fixes: 463e862ac6 ("swiotlb: Convert io_default_tlb_mem to static allocation")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit c51ba246cb)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I2d422a479c4307ec01ab5d5850ce0154ab46fd73
2022-12-05 11:27:45 +00:00
Ren Zhijie
471a70f4d8 BACKPORT: dma-mapping: Fix build error unused-value
If CONFIG_DMA_DECLARE_COHERENT is not set,
make ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu- will be failed, like this:

drivers/remoteproc/remoteproc_core.c: In function ‘rproc_rvdev_release’:
./include/linux/dma-map-ops.h:182:42: error: statement with no effect [-Werror=unused-value]
 #define dma_release_coherent_memory(dev) (0)
                                          ^
drivers/remoteproc/remoteproc_core.c:464:2: note: in expansion of macro ‘dma_release_coherent_memory’
  dma_release_coherent_memory(dev);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

The return type of function dma_release_coherent_memory in CONFIG_DMA_DECLARE_COHERENT area is void, so in !CONFIG_DMA_DECLARE_COHERENT area it should neither return any value nor be defined as zero.

Bug: 254441685
Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: e61c451476 ("dma-mapping: Add dma_release_coherent_memory to DMA API")
Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220630123528.251181-1-renzhijie2@huawei.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
(cherry picked from commit 50d6281ce9)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I167262e8ff99cc0aefbdd4079723616501db1c06
2022-12-05 11:27:45 +00:00