Skip to content

Commit 13e19ff

Browse files
committed
dma: Drop syscalls
DMA syscalls as they were implemented were unsafe. Accepting a void* was never acceptable as many things could not be verified about it. Accepting a channel identifier meant that a user mode thread could start/stop any DMA channel which in theory could be owned by any other driver. This shouldn't be possible. Signed-off-by: Tom Burdick <[email protected]>
1 parent 16f4d6c commit 13e19ff

File tree

1 file changed

+7
-29
lines changed
  • include/zephyr/drivers

1 file changed

+7
-29
lines changed

include/zephyr/drivers/dma.h

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,7 @@ static inline int dma_reload(const struct device *dev, uint32_t channel,
451451
* @retval 0 if successful.
452452
* @retval Negative errno code if failure.
453453
*/
454-
__syscall int dma_start(const struct device *dev, uint32_t channel);
455-
456-
static inline int z_impl_dma_start(const struct device *dev, uint32_t channel)
454+
static inline int dma_start(const struct device *dev, uint32_t channel)
457455
{
458456
const struct dma_driver_api *api =
459457
(const struct dma_driver_api *)dev->api;
@@ -479,9 +477,7 @@ static inline int z_impl_dma_start(const struct device *dev, uint32_t channel)
479477
* @retval 0 if successful.
480478
* @retval Negative errno code if failure.
481479
*/
482-
__syscall int dma_stop(const struct device *dev, uint32_t channel);
483-
484-
static inline int z_impl_dma_stop(const struct device *dev, uint32_t channel)
480+
static inline int dma_stop(const struct device *dev, uint32_t channel)
485481
{
486482
const struct dma_driver_api *api =
487483
(const struct dma_driver_api *)dev->api;
@@ -506,9 +502,7 @@ static inline int z_impl_dma_stop(const struct device *dev, uint32_t channel)
506502
* @retval -EINVAL If invalid channel id or state.
507503
* @retval -errno Other negative errno code failure.
508504
*/
509-
__syscall int dma_suspend(const struct device *dev, uint32_t channel);
510-
511-
static inline int z_impl_dma_suspend(const struct device *dev, uint32_t channel)
505+
static inline int dma_suspend(const struct device *dev, uint32_t channel)
512506
{
513507
const struct dma_driver_api *api = (const struct dma_driver_api *)dev->api;
514508

@@ -534,9 +528,7 @@ static inline int z_impl_dma_suspend(const struct device *dev, uint32_t channel)
534528
* @retval -EINVAL If invalid channel id or state.
535529
* @retval -errno Other negative errno code failure.
536530
*/
537-
__syscall int dma_resume(const struct device *dev, uint32_t channel);
538-
539-
static inline int z_impl_dma_resume(const struct device *dev, uint32_t channel)
531+
static inline int dma_resume(const struct device *dev, uint32_t channel)
540532
{
541533
const struct dma_driver_api *api = (const struct dma_driver_api *)dev->api;
542534

@@ -562,11 +554,7 @@ static inline int z_impl_dma_resume(const struct device *dev, uint32_t channel)
562554
* @retval dma channel if successful.
563555
* @retval Negative errno code if failure.
564556
*/
565-
__syscall int dma_request_channel(const struct device *dev,
566-
void *filter_param);
567-
568-
static inline int z_impl_dma_request_channel(const struct device *dev,
569-
void *filter_param)
557+
static inline int dma_request_channel(const struct device *dev, void *filter_param)
570558
{
571559
int i = 0;
572560
int channel = -EINVAL;
@@ -607,11 +595,7 @@ static inline int z_impl_dma_request_channel(const struct device *dev,
607595
* @param channel channel number
608596
*
609597
*/
610-
__syscall void dma_release_channel(const struct device *dev,
611-
uint32_t channel);
612-
613-
static inline void z_impl_dma_release_channel(const struct device *dev,
614-
uint32_t channel)
598+
static inline void dma_release_channel(const struct device *dev, uint32_t channel)
615599
{
616600
const struct dma_driver_api *api =
617601
(const struct dma_driver_api *)dev->api;
@@ -643,11 +627,7 @@ static inline void z_impl_dma_release_channel(const struct device *dev,
643627
* @retval Negative errno code if not support
644628
*
645629
*/
646-
__syscall int dma_chan_filter(const struct device *dev,
647-
int channel, void *filter_param);
648-
649-
static inline int z_impl_dma_chan_filter(const struct device *dev,
650-
int channel, void *filter_param)
630+
static inline int dma_chan_filter(const struct device *dev, int channel, void *filter_param)
651631
{
652632
const struct dma_driver_api *api =
653633
(const struct dma_driver_api *)dev->api;
@@ -812,6 +792,4 @@ static inline uint32_t dma_burst_index(uint32_t burst)
812792
}
813793
#endif
814794

815-
#include <zephyr/syscalls/dma.h>
816-
817795
#endif /* ZEPHYR_INCLUDE_DRIVERS_DMA_H_ */

0 commit comments

Comments
 (0)