-
Notifications
You must be signed in to change notification settings - Fork 351
Native sim support #10621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Native sim support #10621
Changes from all commits
49d9c4e
29dd433
5f6c2f2
cd8c007
9c4f29f
c06f542
365142d
01e4691
e3b8ad9
4dbff45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| CONFIG_ZEPHYR_POSIX=y | ||
| CONFIG_SYS_HEAP_BIG_ONLY=y | ||
| CONFIG_ZEPHYR_NATIVE_DRIVERS=y | ||
| CONFIG_ZEPHYR_LOG=y | ||
| CONFIG_ZTEST=y | ||
| CONFIG_SOF_BOOT_TEST_STANDALONE=y | ||
| CONFIG_NUMBERS_VECTOR_FIND=y | ||
| CONFIG_NUMBERS_NORM=y |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* SPDX-License-Identifier: BSD-3-Clause | ||
| * | ||
| * Copyright(c) 2026 Intel Corporation. All rights reserved. | ||
| */ | ||
|
|
||
| /** | ||
| * Symbols shared between the native_posix fuzz harness | ||
| * (src/platform/posix/fuzz.c) and the SOF posix IPC layer | ||
| * (src/platform/posix/ipc.c). | ||
| * | ||
| * Defining them in one place avoids type-mismatch bugs (e.g. a single | ||
| * `extern uint8_t *posix_fuzz_buf, posix_fuzz_sz;` declaring `posix_fuzz_sz` | ||
| * as a `uint8_t` rather than a `size_t`). | ||
| */ | ||
|
|
||
| #ifndef PLATFORM_POSIX_FUZZ_H | ||
| #define PLATFORM_POSIX_FUZZ_H | ||
|
|
||
| #include <stddef.h> | ||
| #include <stdint.h> | ||
|
|
||
| extern const uint8_t *posix_fuzz_buf; | ||
| extern size_t posix_fuzz_sz; | ||
|
|
||
| #endif /* PLATFORM_POSIX_FUZZ_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ SOF_DEFINE_REG_UUID(ipc_task_posix); | |
|
|
||
| static struct ipc *global_ipc; | ||
|
|
||
| #ifdef CONFIG_ARCH_POSIX_LIBFUZZER | ||
| // Not an ISR, called from the native_posix fuzz interrupt. Left | ||
| // alone for general hygiene. This is how a IPC interrupt would look | ||
| // if we had one. | ||
|
Comment on lines
+17
to
20
|
||
|
|
@@ -23,7 +24,7 @@ static void posix_ipc_isr(void *arg) | |
| } | ||
|
|
||
| // External symbols set up by the fuzzing layer | ||
| extern uint8_t *posix_fuzz_buf, posix_fuzz_sz; | ||
| #include <platform/posix_fuzz.h> | ||
|
|
||
| // Lots of space. Should really synchronize with the -max_len | ||
| // parameter to libFuzzer (defaults to 4096), but that requires | ||
|
|
@@ -131,6 +132,7 @@ static void fuzz_isr(const void *arg) | |
|
|
||
| posix_ipc_isr(NULL); | ||
| } | ||
| #endif | ||
|
|
||
| // This API is... confounded by its history. With IPC3, the job of | ||
| // this function is to get a newly-received IPC message header (!) | ||
|
|
@@ -172,12 +174,14 @@ int ipc_platform_compact_read_msg(struct ipc_cmd_hdr *hdr, int words) | |
| // Re-raise the interrupt if there's still fuzz data to process | ||
| void ipc_platform_complete_cmd(struct ipc *ipc) | ||
| { | ||
| #ifdef CONFIG_ARCH_POSIX_LIBFUZZER | ||
| extern void posix_sw_set_pending_IRQ(unsigned int IRQn); | ||
|
|
||
| if (fuzz_in_sz > 0) { | ||
| posix_fuzz_sz = 0; | ||
| posix_sw_set_pending_IRQ(CONFIG_ZEPHYR_POSIX_FUZZ_IRQ); | ||
| } | ||
| #endif | ||
| } | ||
|
|
||
| int ipc_platform_send_msg(const struct ipc_msg *msg) | ||
|
|
@@ -200,8 +204,10 @@ void ipc_platform_send_msg_direct(const struct ipc_msg *msg) | |
|
|
||
| int platform_ipc_init(struct ipc *ipc) | ||
| { | ||
| #ifdef CONFIG_ARCH_POSIX_LIBFUZZER | ||
| IRQ_CONNECT(CONFIG_ZEPHYR_POSIX_FUZZ_IRQ, 0, fuzz_isr, NULL, 0); | ||
| irq_enable(CONFIG_ZEPHYR_POSIX_FUZZ_IRQ); | ||
| #endif | ||
|
|
||
| global_ipc = ipc; | ||
| schedule_task_init_edf(&ipc->ipc_task, SOF_UUID(ipc_task_posix_uuid), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.