-
Notifications
You must be signed in to change notification settings - Fork 161
feat(core/remio): add Remote I/O infrastructure #176
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e13ddb6
ref(core/hypercall): rename first argument
joaopeixoto13 cdf3494
feat(inc/hypercall): introduce arch-specific hypercall in/out convention
joaopeixoto13 eb4d558
feat(inc/hypercall): add generic hypercall get/set argument methods
joaopeixoto13 6731369
ref(riscv/sync_exceptions): use vcpu_writepc method
joaopeixoto13 cd6f46b
feat(arch/exception_handler): enable exception handlers to suspend vCPU
joaopeixoto13 f9d8d0c
feat(core/objpool): add objpool_alloc_with_id and objpool_get_by_id
joaopeixoto13 cfcec7c
feat(core/remio): add Remote I/O infrastructure
joaopeixoto13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /** | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * Copyright (c) Bao Project and Contributors. All rights reserved. | ||
| */ | ||
|
|
||
| /** | ||
| * @file remio.h | ||
| * @brief This header file contains the Remote I/O device interface | ||
| */ | ||
|
|
||
| #ifndef REMIO_H | ||
| #define REMIO_H | ||
|
|
||
| #include <bao.h> | ||
| #include <emul.h> | ||
| #include <list.h> | ||
| #include <vm.h> | ||
|
|
||
| /** | ||
| * @struct remio_shmem | ||
| * @brief This structure represents a shared memory region used by a Remote I/O device | ||
| */ | ||
| struct remio_shmem { | ||
| paddr_t base; /**< Shared memory base address */ | ||
| size_t size; /**< Shared memory size */ | ||
| size_t shmem_id; /**< Shared memory ID */ | ||
| }; | ||
|
|
||
| /** | ||
| * @enum REMIO_DEV_TYPE | ||
| * @brief This enum represents the Remote I/O device type | ||
| */ | ||
| enum REMIO_DEV_TYPE { | ||
| REMIO_DEV_FRONTEND = 0, /**< Remote I/O frontend device */ | ||
| REMIO_DEV_BACKEND /**< Remote I/O backend device */ | ||
| }; | ||
|
|
||
| /** | ||
| * @struct remio_dev | ||
| * @brief This structure represents a Remote I/O device | ||
| * @note The device can be either a frontend (driver) or a backend (device) | ||
| */ | ||
| struct remio_dev { | ||
| vaddr_t va; /**< Frontend MMIO base virtual address */ | ||
| size_t size; /**< Frontend MMIO size */ | ||
| irqid_t interrupt; /**< Frontend/backend interrupt number */ | ||
| remio_bind_key_t bind_key; /**< Remote I/O bind key */ | ||
| enum REMIO_DEV_TYPE type; /**< Type of the Remote I/O device */ | ||
| struct remio_shmem shmem; /**< Shared memory region */ | ||
| struct emul_mem emul; /**< Frontend MMIO emulation memory */ | ||
| }; | ||
|
|
||
| /** | ||
| * @brief Remote I/O device initialization routine | ||
| * @note Executed only once by the master CPU | ||
| */ | ||
| void remio_init(void); | ||
|
|
||
| /** | ||
| * @brief Remote I/O device VM CPU assignment routine | ||
| * @note Executed by each VM that holds a Remote I/O device, it is responsible for | ||
| * assigning the frontend or backend CPU ID for the respective Remote I/O device | ||
| * If the VM was alloacted with more than one CPU the assigned CPU will be the | ||
| * one with the lowest ID, since only one CPU is required to inject VM interrupts | ||
| * @param vm Pointer to the VM structure | ||
| */ | ||
| void remio_assign_vm_cpus(struct vm* vm); | ||
|
|
||
| /** | ||
| * @brief Remote I/O hypercall callback | ||
| * @note Used to exchange information between the Remote I/O system and the backend VM | ||
| * @return Returns the number of pending I/O requests | ||
| */ | ||
| long int remio_hypercall(void); | ||
|
|
||
| /** | ||
| * @brief Remote I/O MMIO emulation handler | ||
| * @note Executed by the frontend VM when a MMIO access is performed | ||
| * @param emul_access Holds the information about the MMIO access | ||
| * @return Returns true if handled successfully, false otherwise | ||
| */ | ||
| bool remio_mmio_emul_handler(struct emul_access* emul_access); | ||
|
|
||
| #endif /* __REMIO_H__ */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,4 @@ core-objs-y+=ipc.o | |
| core-objs-y+=objpool.o | ||
| core-objs-y+=hypercall.o | ||
| core-objs-y+=shmem.o | ||
| core-objs-y+=remio.o | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.