Skip to content

Commit cdcf831

Browse files
lyakhlgirdwood
authored andcommitted
audio: fast-get: fast_get() and fast_put() should not be syscalls
Userspace modules should only call mod_fast_get() and mod_fast_put(), which already can cross into the kernel space on their own, so fast_get() and fast_put() themselves don't need to be syscalls. Remove their syscall implementations. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 6d2d581 commit cdcf831

2 files changed

Lines changed: 6 additions & 41 deletions

File tree

src/include/sof/lib/fast-get.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,7 @@
1212

1313
struct k_heap;
1414

15-
#if defined(__ZEPHYR__) && defined(CONFIG_SOF_FULL_ZEPHYR_APPLICATION)
16-
#include <zephyr/toolchain.h>
17-
18-
__syscall const void *fast_get(struct k_heap *heap, const void * const dram_ptr, size_t size);
19-
__syscall void fast_put(struct k_heap *heap, const void *sram_ptr);
20-
#include <zephyr/syscalls/fast-get.h>
21-
#else
22-
const void *z_impl_fast_get(struct k_heap *heap, const void * const dram_ptr, size_t size);
23-
void z_impl_fast_put(struct k_heap *heap, const void *sram_ptr);
24-
#define fast_get z_impl_fast_get
25-
#define fast_put z_impl_fast_put
26-
#endif /* __ZEPHYR__ */
15+
const void *fast_get(struct k_heap *heap, const void * const dram_ptr, size_t size);
16+
void fast_put(struct k_heap *heap, const void *sram_ptr);
2717

2818
#endif /* __SOF_LIB_FAST_GET_H__ */

zephyr/lib/fast-get.c

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static struct sof_fast_get_entry *fast_get_find_entry(struct sof_fast_get_data *
8181
return NULL;
8282
}
8383

84-
const void *z_impl_fast_get(struct k_heap *heap, const void *dram_ptr, size_t size)
84+
const void *fast_get(struct k_heap *heap, const void *dram_ptr, size_t size)
8585
{
8686
struct sof_fast_get_data *data = &fast_get_data;
8787
struct sof_fast_get_entry *entry;
@@ -133,7 +133,7 @@ const void *z_impl_fast_get(struct k_heap *heap, const void *dram_ptr, size_t si
133133

134134
return ret;
135135
}
136-
EXPORT_SYMBOL(z_impl_fast_get);
136+
EXPORT_SYMBOL(fast_get);
137137

138138
static struct sof_fast_get_entry *fast_put_find_entry(struct sof_fast_get_data *data,
139139
const void *sram_ptr)
@@ -148,7 +148,7 @@ static struct sof_fast_get_entry *fast_put_find_entry(struct sof_fast_get_data *
148148
return NULL;
149149
}
150150

151-
void z_impl_fast_put(struct k_heap *heap, const void *sram_ptr)
151+
void fast_put(struct k_heap *heap, const void *sram_ptr)
152152
{
153153
struct sof_fast_get_data *data = &fast_get_data;
154154
struct sof_fast_get_entry *entry;
@@ -170,29 +170,4 @@ void z_impl_fast_put(struct k_heap *heap, const void *sram_ptr)
170170
entry ? entry->size : 0, entry ? entry->refcount : 0);
171171
k_spin_unlock(&data->lock, key);
172172
}
173-
EXPORT_SYMBOL(z_impl_fast_put);
174-
175-
#ifdef CONFIG_USERSPACE
176-
#include <zephyr/internal/syscall_handler.h>
177-
void z_vrfy_fast_put(struct k_heap *heap, const void *sram_ptr)
178-
{
179-
K_OOPS(K_SYSCALL_MEMORY_WRITE(heap, sizeof(*heap)));
180-
/*
181-
* FIXME: we don't know how much SRAM has been allocated, so cannot
182-
* check. Should fast_put() be changed to pass a size argument?
183-
*/
184-
185-
z_impl_fast_put(heap, sram_ptr);
186-
}
187-
#include <zephyr/syscalls/fast_put_mrsh.c>
188-
189-
const void *z_vrfy_fast_get(struct k_heap *heap, const void *dram_ptr, size_t size)
190-
{
191-
K_OOPS(K_SYSCALL_MEMORY_WRITE(heap, sizeof(*heap)));
192-
/* We cannot (easily) verify the actual heapp memory */
193-
K_OOPS(K_SYSCALL_MEMORY_READ(dram_ptr, size));
194-
195-
return z_impl_fast_get(heap, dram_ptr, size);
196-
}
197-
#include <zephyr/syscalls/fast_get_mrsh.c>
198-
#endif
173+
EXPORT_SYMBOL(fast_put);

0 commit comments

Comments
 (0)