- 02 Dec, 2020 1 commit
-
-
Loic Poulain authored
Fix the following warning with explicit cast: warning: implicit conversion from 'unsigned long long' to 'dma_addr_t' (aka 'unsigned int') mhi_cntrl->iova_stop = DMA_BIT_MASK(info->dma_data_width); Fixes: 855a70c1 ("bus: mhi: Add MHI PCI support for WWAN modems") Signed-off-by:
Loic Poulain <loic.poulain@linaro.org> Reported-by:
kernel test robot <lkp@intel.com> Reviewed-by:
Nathan Chancellor <natechancellor@gmail.com> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
- 01 Dec, 2020 1 commit
-
-
Dan Carpenter authored
There are a few problems with the error handling in this function. They mostly center around the alloc_ordered_workqueue() allocation. 1) If that allocation fails or if the kcalloc() prior to it fails then it leads to a NULL dereference when we call destroy_workqueue(mhi_cntrl->hiprio_wq). 2) The error code is not set. 3) The "mhi_cntrl->mhi_cmd" allocation is not freed. The error handling was slightly confusing and I re-ordered it to be in the exact mirror/reverse order of how things were allocated. I changed the label names to say what the goto does instead of describing where the goto comes from. Fixes: 8f703978 ("bus: mhi: core: Move to using high priority workqueue") Signed-off-by:
Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by:
Loic Poulain <loic.poulain@linaro.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
- 28 Nov, 2020 2 commits
-
-
Loic Poulain authored
This patch fixes the hierarchical structure of MHI devices. Indeed, MHI client devices are directly 'enumerated' from the mhi controller and therefore must be direct descendants/children of their mhi controller device, in accordance with the Linux Device Model. Today both MHI clients and controller devices are at the same level, this patch ensures that MHI controller is parent of its client devices. The hierarchy is especially important for power management (safe suspend/resume order). It is also useful for userspace to determine relationship between MHI client devices and controllers. Signed-off-by:
Loic Poulain <loic.poulain@linaro.org> Reviewed-by:
Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by:
Hemant Kumar <hemantk@codeaurora.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Loic Poulain authored
Today the MHI controller name is simply cloned from the underlying bus device (its parent), that gives the following device structure for e.g. a MHI/PCI controller: devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:02:00.0 devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:02:00.0/0000:02:00.0_IPCR ... That's quite misleading/confusing and can cause device registering issues because of duplicate dev name (e.g. if a PCI device register two different MHI instances). This patch changes MHI core to create indexed mhi controller names (mhi0, mhi1...) in the same way as other busses (i2c0, usb0...). The previous example becomes: devices/pci0000:00/0000:00:01.2/0000:02:00.0/mhi0 devices/pci0000:00/0000:00:01.2/0000:02:00.0/mhi0/mhi0_IPCR ... v2: move index field at the end of mhi_controller struct (before bool) to avoid breaking well packed alignment. Signed-off-by:
Loic Poulain <loic.poulain@linaro.org> Reviewed-by:
Jeffrey Hugo <jhugo@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
- 20 Nov, 2020 2 commits
-
-
Manivannan Sadhasivam authored
-
Bhaumik Bhatt authored
Reset MHI device channels when driver remove is called due to module unload or any crash scenario. This will make sure that MHI channels no longer remain enabled for transfers since the MHI stack does not take care of this anymore after the auto-start channels feature was removed. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Acked-by:
Jakub Kicinski <kuba@kernel.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
- 18 Nov, 2020 25 commits
-
-
Bhaumik Bhatt authored
While powering down, the device may or may not acknowledge an MHI RESET issued by host for a graceful shutdown scenario and end up sending an incoming data packet after tasklets have been killed. If a rogue device sends this interrupt for a data transfer event ring update, it can result in a tasklet getting scheduled while a clean up is ongoing or has completed and cause access to freed memory leading to a NULL pointer exception. Remove the interrupt handlers for MHI event rings early on to avoid this scenario. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
mhi_power_down() does not ensure that the PM state is moved to an inaccessible state soon enough as the system can encounter scheduling delays till mhi_pm_disable_transition() gets called. Additionally, if an MHI controller decides that the device is now inaccessible and issues a power down, the register inaccessible state is not maintained by moving from MHI_PM_LD_ERR_FATAL_DETECT to MHI_PM_SHUTDOWN_PROCESS. This can result in bus errors if a client driver attempted to read registers when powering down. Close these gaps and avoid any race conditions to prevent such activity. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
Currently, there exist a set of if...else statements in the mhi_pm_disable_transition() function which make handling system error and disable transitions differently complex. To make that cleaner and facilitate differences in behavior, separate these two transitions for MHI host. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
Current design allows a controller to register with MHI successfully without the need to have any IRQs available for use. If no IRQs are available, power up requests to MHI can fail after a successful registration with MHI. Improve the design by checking for the number of IRQs available sooner within the mhi_regsiter_controller() API as it is required to be specified by the controller. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
If the host receives a mission mode event and by the time it can get to processing it, the register accesses fail implying a connectivity error, MHI should move to an error state. This helps avoid longer wait times from a synchronous power up perspective and accurately reflects the MHI execution environment and power management states. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
Correct the "error_read" label to say "error_ready_state" as that is the appropriate usage of the label. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
Move MHI to a firmware download error state for a failure to find the firmware files or to load SBL or EBL image using BHI/BHIe. This helps detect an error state sooner and shortens the wait for a synchronous power up timeout. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
If an mhi_power_down() is initiated after the device has entered RDDM and a status callback was provided for it, it is possible that another BHI interrupt fires while waiting for the MHI RESET to be cleared. If that happens, MHI host would have moved a "disabled" execution environment and the check to allow sending an RDDM status callback will pass when it is should not. Add a check to see if MHI is in an active state before proceeding. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
In some cases, the entry of device to RDDM execution environment can occur after a significant amount of time has elapsed and a SYS_ERROR state change event has already arrived. This can result in scenarios where MHI controller and client drivers are unaware of the error state of the device. Remove the check for rddm_image when processing the SYS_ERROR state change as it is present in mhi_pm_sys_err_handler() already and prevent further activity until the expected RDDM execution environment change occurs or the controller driver decides further action. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
MHI client drivers can request a device wake even if the device may be in an error state or undergoing a shutdown. To prevent unnecessary device wake processing, check for the device state and bail out early so that the clients are made aware of the device state sooner. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
MHI work is currently scheduled on the global/system workqueue and can encounter delays on a stressed system. To avoid those unforeseen delays which can hamper bootup or shutdown times, use a dedicated high priority workqueue instead of the global/system workqueue. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
mhi_fw_load_sbl() function is currently used to transfer SBL or EDL images over BHI (Boot Host Interface). Same goes with mhi_fw_load_amss() which uses BHIe. However, the contents of these functions do not indicate support for a specific set of images. Since these can be used for any image download over BHI or BHIe, rename them based on the protocol used. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
If MHI is unable to determine the execution environment during the panic path, host must skip the RDDM download. This can happen if the BHI offset read or the BHI_EXECENV register read fails indicating that the underlying transport is unresponsive. Hence, there is no need to trigger an RDDM using SYSERR or request an SOC reset. Suggested-by:
Hemant Kumar <hemantk@codeaurora.org> Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
mhi_download_rddm_img() uses a shorter version of the word image. Expand it and rename the function to mhi_download_rddm_image(). Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
The mhi_fw_load_worker() function no longer exists. Remove its declaration as part of code clean-up. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
The mhi_get_exec_env() APIs can be used by the controller drivers to query the execution environment of the MHI device. Expose it so it can be used in some scenarios to determine behavior of controllers. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
Add missing EXPORT_SYMBOL_GPL() declaration for mhi_get_mhi_state() API. Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
There is an extra 'i' counter in the mhi_firmware_copy() function which is unused. Remove it to clean-up code and reduce stack space as well as improve efficiency of the function. Fixes: cd457afb ("bus: mhi: core: Add support for downloading firmware over BHIe") Reported-by:
kernel test robot <lkp@intel.com> Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Loic Poulain authored
Some MHI device drivers need to stop the channels in their driver remove callback (e.g. module unloading), but the unprepare function is aborted because MHI core moved the channels to suspended state prior calling driver remove callback. This prevents the driver to send a proper MHI RESET CHAN command to the device. Device is then unaware of the stopped state of these channels. This causes issue when driver tries to start the channels again (e.g. module is reloaded), since device considers channels as already started (inconsistent state). Fix this by allowing channel reset when channel is suspended. Signed-off-by:
Loic Poulain <loic.poulain@linaro.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Carl Yin authored
Functions parse_ev_cfg() and parse_ch_cfg() access mhi_cntrl->mhi_dev before it is set in function mhi_register_controller(), use cntrl_dev instead of mhi_dev. Fixes: 0cbf2608 ("bus: mhi: core: Add support for registering MHI controllers") Signed-off-by:
Carl Yin <carl.yin@quectel.com> Reviewed-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Hemant Kumar <hemantk@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Loic Poulain authored
This is a generic MHI-over-PCI controller driver for MHI only devices such as QCOM modems. For now it supports registering of Qualcomm SDX55 based PCIe modules. The MHI channels have been extracted from mhi downstream driver. This driver is for MHI-only devices which have all functionalities exposed through MHI channels and accessed by the corresponding MHI device drivers (no out-of-band communication). Signed-off-by:
Loic Poulain <loic.poulain@linaro.org> Reviewed-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Hemant Kumar <hemantk@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> [mani: fixed up the Makefile rule] Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Jeffrey Hugo authored
The BHI_MSMHWID and BHI_OEMPKHASH macros take a value 'n' which is a BHI register index. If 'n' is an expression rather than a simple value, there can be an operator precedence issue which can result in the incorrect calculation of the register offset. Adding parentheses around the macro parameter can prevent such issues. Signed-off-by:
Jeffrey Hugo <jhugo@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by:
Hemant Kumar <hemantk@codeaurora.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Bhaumik Bhatt authored
There is double acquisition of the pm_lock from mhi_driver_remove() function. Remove the read_lock_bh/read_unlock_bh calls for pm_lock taken during a call to mhi_device_put() as the lock is acquired within the function already. This will help avoid a potential kernel panic. Fixes: 189ff97c ("bus: mhi: core: Add support for data transfer") Reported-by:
Shuah Khan <skhan@linuxfoundation.org> Signed-off-by:
Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Loic Poulain authored
Start MHI device channels so that transfers can be performed. The MHI stack does not auto-start channels anymore. Signed-off-by:
Loic Poulain <loic.poulain@linaro.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Acked-by:
David S. Miller <davem@davemloft.net> Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
Loic Poulain authored
There is really no point having an auto-start for channels. This is confusing for the device drivers, some have to enable the channels, others don't have... and waste resources (e.g. pre allocated buffers) that may never be used. This is really up to the MHI device(channel) driver to manage the state of its channels. While at it, let's also remove the auto-start option from ath11k mhi controller. Signed-off-by:
Loic Poulain <loic.poulain@linaro.org> Acked-by:
Kalle Valo <kvalo@codeaurora.org> Reviewed-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> [mani: clubbed ath11k change] Signed-off-by:
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
- 25 Oct, 2020 9 commits
-
-
Linus Torvalds authored
-
Joe Perches authored
Use a more generic form for __section that requires quotes to avoid complications with clang and gcc differences. Remove the quote operator # from compiler_attributes.h __section macro. Convert all unquoted __section(foo) uses to quoted __section("foo"). Also convert __attribute__((section("foo"))) uses to __section("foo") even if the __attribute__ has multiple list entry forms. Conversion done using the script at: https://lore.kernel.org/lkml/75393e5ddc272dc7403de74d645e6c6e0f4e70eb.camel@perches.com/2-convert_section.plSigned-off-by:
Joe Perches <joe@perches.com> Reviewed-by:
Nick Desaulniers <ndesaulniers@gooogle.com> Reviewed-by:
Miguel Ojeda <ojeda@kernel.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
Rasmus Villemoes authored
tid_addr is not a "pointer to (pointer to int in userspace)"; it is in fact a "pointer to (pointer to int in userspace) in userspace". So sparse rightfully complains about passing a kernel pointer to put_user(). Reported-by:
kernel test robot <lkp@intel.com> Signed-off-by:
Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
Eric Biggers authored
Commit 453431a5 ("mm, treewide: rename kzfree() to kfree_sensitive()") renamed kzfree() to kfree_sensitive(), but it left a compatibility definition of kzfree() to avoid being too disruptive. Since then a few more instances of kzfree() have slipped in. Just get rid of them and remove the compatibility definition once and for all. Signed-off-by:
Eric Biggers <ebiggers@google.com> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
Joe Perches authored
If set, use the environment variable GIT_DIR to change the default .git location of the kernel git tree. If GIT_DIR is unset, keep using the current ".git" default. Link: https://lkml.kernel.org/r/c5e23b45562373d632fccb8bc04e563abba4dd1d.camel@perches.comSigned-off-by:
Joe Perches <joe@perches.com> Tested-by:
Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds authored
Pull timer fixes from Thomas Gleixner: "A time namespace fix and a matching selftest. The futex absolute timeouts which are based on CLOCK_MONOTONIC require time namespace corrected. This was missed in the original time namesapce support" * tag 'timers-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: selftests/timens: Add a test for futex() futex: Adjust absolute futex timeouts with per time namespace offset
-
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds authored
Pull scheduler fixes from Thomas Gleixner: "Two scheduler fixes: - A trivial build fix for sched_feat() to compile correctly with CONFIG_JUMP_LABEL=n - Replace a zero lenght array with a flexible array" * tag 'sched-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched/features: Fix !CONFIG_JUMP_LABEL case sched: Replace zero-length array with flexible-array
-
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds authored
Pull perf fix from Thomas Gleixner: "A single fix to compute the field offset of the SNOOPX bit in the data source bitmask of perf events correctly" * tag 'perf-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf: correct SNOOPX field offset
-
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds authored
Pull locking fix from Thomas Gleixner: "Just a trivial fix for kernel-doc warnings" * tag 'locking-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: locking/seqlocks: Fix kernel-doc warnings
-