summaryrefslogtreecommitdiffstats
path: root/drivers/mailbox/bcm-flexrm-mailbox.c
AgeCommit message (Collapse)AuthorFilesLines
2022-10-05mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sgJack Wang1-4/+4
dma_map_sg return 0 on error, fix the error check, and return -EIO to caller. Fixes: dbc049eee730 ("mailbox: Add driver for Broadcom FlexRM ring manager") Signed-off-by: Jack Wang <jinpu.wang@ionos.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2022-06-10treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE ↵Thomas Gleixner1-12/+2
(part 2) Based on the normalized pattern: this program is free software you can redistribute it and/or modify it under the terms of the gnu general public license as published by the free software foundation version 2 this program is distributed as is without any warranty of any kind whether express or implied without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference. Reviewed-by: Allison Randal <allison@lohutok.net> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-13Merge tag 'irq-msi-2022-01-13' of ↵Linus Torvalds1-6/+3
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull MSI irq updates from Thomas Gleixner: "Rework of the MSI interrupt infrastructure. This is a treewide cleanup and consolidation of MSI interrupt handling in preparation for further changes in this area which are necessary to: - address existing shortcomings in the VFIO area - support the upcoming Interrupt Message Store functionality which decouples the message store from the PCI config/MMIO space" * tag 'irq-msi-2022-01-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (94 commits) genirq/msi: Populate sysfs entry only once PCI/MSI: Unbreak pci_irq_get_affinity() genirq/msi: Convert storage to xarray genirq/msi: Simplify sysfs handling genirq/msi: Add abuse prevention comment to msi header genirq/msi: Mop up old interfaces genirq/msi: Convert to new functions genirq/msi: Make interrupt allocation less convoluted platform-msi: Simplify platform device MSI code platform-msi: Let core code handle MSI descriptors bus: fsl-mc-msi: Simplify MSI descriptor handling soc: ti: ti_sci_inta_msi: Remove ti_sci_inta_msi_domain_free_irqs() soc: ti: ti_sci_inta_msi: Rework MSI descriptor allocation NTB/msi: Convert to msi_on_each_desc() PCI: hv: Rework MSI handling powerpc/mpic_u3msi: Use msi_for_each-desc() powerpc/fsl_msi: Use msi_for_each_desc() powerpc/pasemi/msi: Convert to msi_on_each_dec() powerpc/cell/axon_msi: Convert to msi_on_each_desc() powerpc/4xx/hsta: Rework MSI handling ...
2021-12-16mailbox: bcm-flexrm-mailbox: Rework MSI interrupt handlingThomas Gleixner1-5/+2
No point in retrieving the MSI descriptors. Just query the Linux interrupt number. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20211210221815.148331680@linutronix.de
2021-12-16platform-msi: Use msi_desc::msi_indexThomas Gleixner1-2/+2
Use the common msi_index member and get rid of the pointless wrapper struct. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Nishanth Menon <nm@ti.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20211210221814.413638645@linutronix.de
2021-12-10mailbox: Use irq_update_affinity_hint()Nitesh Narayan Lal1-2/+2
The driver uses irq_set_affinity_hint() to: - Set the affinity_hint which is consumed by the userspace for distributing the interrupts - Enforce affinity As per commit 6ac17fe8c14a ("mailbox: bcm-flexrm-mailbox: Set IRQ affinity hint for FlexRM ring IRQs") the latter is done to ensure that the FlexRM ring interrupts are evenly spread across all available CPUs. However, since commit a0c9259dc4e1 ("irq/matrix: Spread interrupts on allocation") the spreading of interrupts is dynamically performed at the time of allocation. Hence, there is no need for the drivers to enforce their own affinity for the spreading of interrupts. Also, irq_set_affinity_hint() applying the provided cpumask as an affinity for the interrupt is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_update_affinity_hint() that only sets the affinity_hint pointer. Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Jassi Brar <jaswinder.singh@linaro.org> Link: https://lore.kernel.org/r/20210903152430.244937-11-nitesh@redhat.com
2021-06-26mailbox: bcm-flexrm-mailbox: Remove redundant dev_err call in ↵Zhihao Cheng1-1/+0
flexrm_mbox_probe() There is a error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundant error message. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2021-04-13mailbox: fix various typos in commentsTom Saeger1-2/+2
Fix trivial typos in mailbox driver comments. s/Intergrated/Integrated/ s/extenstion/extension/ s/atleast/at least/ s/commnunication/communication/ s/assgined/assigned/ s/commnunication/communication/ s/recevied/received/ s/succeded/succeeded/ s/implmentation/implementation/ s/definiation/definition/ s/traget/target/ s/wont/won't/ Cc: trivial@kernel.org Signed-off-by: Tom Saeger <tom.saeger@oracle.com> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2020-03-19maillbox: bcm-flexrm-mailbox: handle cmpl_pool dma allocation failureRayagonda Kokatanur1-0/+2
Handle 'cmpl_pool' dma memory allocation failure. Fixes: a9a9da47f8e6 ("mailbox: no need to check return value of debugfs_create functions") Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2019-07-14Merge tag 'mailbox-v5.3' of ↵Linus Torvalds1-4/+2
git://git.linaro.org/landing-teams/working/fujitsu/integration Pull mailbox updates from Jassi Brar: - stm32: race fix by adding a spinlock - mhu: trim included headers - omap: add support for K3 SoCs - imx: Irq disable fix - bcm: tidy up extracting driver data - tegra: make resume 'noirq' - api: fix error handling * tag 'mailbox-v5.3' of git://git.linaro.org/landing-teams/working/fujitsu/integration: mailbox: handle failed named mailbox channel request mailbox: tegra: avoid resume NULL mailboxes mailbox: tegra: hsp: add noirq resume mailbox: bcm-flexrm-mailbox: using dev_get_drvdata directly mailbox: imx: Clear GIEn bit at shutdown mailbox: omap: Add support for TI K3 SoCs dt-bindings: mailbox: omap: Update bindings for TI K3 SoCs mailbox: arm_mhu: reorder header inclusion and drop unneeded ones mailbox: stm32_ipcc: add spinlock to fix channels concurrent access
2019-07-10mailbox: bcm-flexrm-mailbox: using dev_get_drvdata directlyFuqian Huang1-4/+2
Several drivers cast a struct device pointer to a struct platform_device pointer only to then call platform_get_drvdata(). To improve readability, these constructs can be simplified by using dev_get_drvdata() directly. Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2019-06-03mailbox: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-23/+5
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Jassi Brar <jassisinghbrar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-18mailbox: bcm-flexrm-mailbox: Fix FlexRM ring flush timeout issueRayagonda Kokatanur1-2/+2
RING_CONTROL reg was not written due to wrong address, hence all the subsequent ring flush was timing out. Fixes: a371c10ea4b3 ("mailbox: bcm-flexrm-mailbox: Fix FlexRM ring flush sequence") Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Signed-off-by: Ray Jui <ray.jui@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2018-12-21mailbox: bcm-flexrm: Use device-managed registration APIThierry Reding1-3/+1
Get rid of some boilerplate driver removal code by using the newly added device-managed registration API. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Scott Branden <scott.branden@broadcom.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2018-09-29mailbox: bcm-flexrm-mailbox: fix spelling mistake "toogle" -> "toggle"Colin Ian King1-3/+3
Trivial fix to spelling mistake in function name flexrm_flip_header_toogle, rename it to flexrm_flip_header_toggle. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2018-03-15maillbox: bcm-flexrm-mailbox: Use dma_pool_zalloc()Souptick Joarder1-2/+1
Use dma_pool_zalloc() instead of dma_pool_alloc + memset Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2017-10-27mailbox: bcm-flexrm-mailbox: Use common GPL comment headerAnup Patel1-5/+13
This patch makes the comment header of Broadcom FlexRM driver similar to the GPL comment header used across Broadcom driver sources. Signed-off-by: Anup Patel <anup.patel@broadcom.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2017-10-27mailbox: bcm-flexrm-mailbox: Print ring number in errors and warningsAnup Patel1-9/+17
This patch updates all dev_err() and dev_warn() to print ring number so that we have more info for debugging. Signed-off-by: Anup Patel <anup.patel@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2017-10-27mailbox: bcm-flexrm-mailbox: Fix FlexRM ring flush sequenceAnup Patel1-3/+19
As-per suggestion from FlexRM HW folks, we have to first set FlexRM ring flush state and then clear it for FlexRM ring flush to work properly. Currently, the FlexRM driver has incomplete FlexRM ring flush sequence which causes repeated insmod+rmmod of mailbox client drivers to fail. This patch fixes FlexRM ring flush sequence in flexrm_shutdown() as described above. Fixes: dbc049eee730 ("mailbox: Add driver for Broadcom FlexRM ring manager") Signed-off-by: Anup Patel <anup.patel@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Cc: stable@vger.kernel.org Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2017-08-31mailbox: bcm-flexrm-mailbox: Use txdone_ack instead of txdone_pollAnup Patel1-57/+4
Currently, FlexRM driver uses txdone_poll method of Linux Mailbox to model the send_data() callback. To achieve this, we have introduced "last_pending_msg" pointer for each FlexRM ring which keeps track of the message that did not fit in the FlexRM ring. This patch updates FlexRM driver to use txdone_ack method instead of txdone_poll method because txdone_poll is not efficient for FlexRM and requires additional tracking in FlexRM driver. Also, moving to txdone_ack method helps us remove "last_pending_msg" pointer and last_tx_done() callback. Signed-off-by: Anup Patel <anup.patel@broadcom.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2017-08-31mailbox: bcm-flexrm-mailbox: Use bitmap instead of IDAAnup Patel1-17/+19
Currently, we are using IDA library for managing IDs on a FlexRM ring. The IDA library dynamically allocates memory for underlying data structures which can cause potential locking issue when allocating/free IDs from flexrm_new_request() and flexrm_process_completions(). To tackle this, we replace use of IDA with bitmap for each FlexRM ring and also protect the bitmap with FlexRM ring lock. Signed-off-by: Anup Patel <anup.patel@broadcom.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2017-08-31mailbox: bcm-flexrm-mailbox: Fix mask used in CMPL_START_ADDR_VALUE()Anup Patel1-1/+1
The mask used in CMPL_START_ADDR_VALUE() should be 27bits instead of 26bits. This incorrect mask was causing completion writes to 40bits physical address fail. This patch fixes mask used in CMPL_START_ADDR_VALUE() macro. Fixes: dbc049eee730 ("mailbox: Add driver for Broadcom FlexRM ring manager") Signed-off-by: Anup Patel <anup.patel@broadcom.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Cc: stable@vger.kernel.org Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2017-08-31mailbox: bcm-flexrm-mailbox: Add debugfs supportAnup Patel1-2/+134
This patch adds debugfs support to Broadcom FlexRM driver so that we can see FlexRM ring state when any issue happens. Signed-off-by: Anup Patel <anup.patel@broadcom.com> Reviewed-by: Vikram Prakash <vikram.prakash@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2017-08-31mailbox: bcm-flexrm-mailbox: Set IRQ affinity hint for FlexRM ring IRQsAnup Patel1-0/+17
This patch set IRQ affinity hint for FlexRM ring IRQ at time of enabling ring (i.e. flexrm_startup()). The IRQ affinity hint will allow FlexRM driver to distribute FlexRM ring IRQs across online CPUs so that all FlexRM ring IRQs don't land in CPU0 by default. Signed-off-by: Anup Patel <anup.patel@broadcom.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2017-03-28mailbox: Add driver for Broadcom FlexRM ring managerAnup Patel1-0/+1595
Some of the Broadcom iProc SoCs have FlexRM ring manager which provides a ring-based programming interface to various offload engines (e.g. RAID, Crypto, etc). This patch adds a common mailbox driver for Broadcom FlexRM ring manager which can be shared by various offload engine drivers (implemented as mailbox clients). Reviewed-by: Ray Jui <ray.jui@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Reviewed-by: Pramod KUMAR <pramod.kumar@broadcom.com> Signed-off-by: Anup Patel <anup.patel@broadcom.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>