-
Notifications
You must be signed in to change notification settings - Fork 0
Linux v6.15 #4
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
Open
joaopeixoto13
wants to merge
6
commits into
main
Choose a base branch
from
linux-v6.15
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Linux v6.15 #4
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cfe3e5a
fix: name the modules more clearly
joaopeixoto13 dd7e40d
update: iodispatcher module
joaopeixoto13 25b1f30
update: ipcshmem module
joaopeixoto13 5940e1c
fix(iodispatcher): remove redundant input constraints in bao_remio_hy…
joaopeixoto13 6f54e31
fix(iodispatcher): initialize virtio_requests_lock and hypercall cont…
joaopeixoto13 2c57c23
iodispatcher: remove explicit dispatch loop for control client
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,149 @@ | ||
| // SPDX-License-Identifier: GPL-2.0 | ||
| /* | ||
| * Hypercall API for Bao Hypervisor | ||
| * | ||
| * Copyright (c) Bao Project and Contributors. All rights reserved. | ||
| * | ||
| * Authors: | ||
| * João Peixoto <joaopeixotooficial@gmail.com> | ||
| */ | ||
|
|
||
| #ifndef __BAO_HYPERCALL_H | ||
| #define __BAO_HYPERCALL_H | ||
|
|
||
| #include "bao.h" | ||
|
|
||
| #if defined(CONFIG_ARM64) || defined(CONFIG_ARM) | ||
| #include <linux/arm-smccc.h> | ||
| #elif CONFIG_RISCV | ||
| #include <asm/sbi.h> | ||
| #endif | ||
|
|
||
| /* Remote I/O Hypercall ID */ | ||
| #define REMIO_HC_ID 0x2 | ||
|
|
||
| #if defined(CONFIG_ARM64) | ||
| static inline unsigned long bao_ipcshmem_hypercall(unsigned long ipcshmem_id) | ||
| { | ||
| struct arm_smccc_res res; | ||
|
|
||
| arm_smccc_hvc(ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_64, | ||
| ARM_SMCCC_OWNER_VENDOR_HYP, | ||
| BAO_IPCSHMEM_HYPERCALL_ID), | ||
| ipcshmem_id, 0, 0, 0, 0, 0, 0, &res); | ||
|
|
||
| return res.a0; | ||
| } | ||
|
|
||
| static inline unsigned long | ||
| bao_remio_hypercall(struct bao_remio_hypercall_ctx *ctx) | ||
| { | ||
| register int x0 asm("x0") = | ||
| ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_64, | ||
| ARM_SMCCC_OWNER_VENDOR_HYP, BAO_REMIO_HYPERCALL_ID); | ||
| register u64 x1 asm("x1") = ctx->dm_id; | ||
| register u64 x2 asm("x2") = ctx->addr; | ||
| register u64 x3 asm("x3") = ctx->op; | ||
| register u64 x4 asm("x4") = ctx->value; | ||
| register u64 x5 asm("x5") = ctx->request_id; | ||
| register u64 x6 asm("x6") = 0; | ||
|
|
||
| asm volatile("hvc 0\n\t" | ||
| : "=r"(x0), "=r"(x1), "=r"(x2), "=r"(x3), "=r"(x4), | ||
| "=r"(x5), "=r"(x6) | ||
| : "r"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5) | ||
| : "memory"); | ||
|
|
||
| ctx->addr = x1; | ||
| ctx->op = x2; | ||
| ctx->value = x3; | ||
| ctx->access_width = x4; | ||
| ctx->request_id = x5; | ||
| ctx->npend_req = x6; | ||
|
|
||
| return x0; | ||
| } | ||
| #elif defined(CONFIG_ARM) | ||
| static inline unsigned long bao_ipcshmem_hypercall(unsigned long ipcshmem_id) | ||
| { | ||
| struct arm_smccc_res res; | ||
|
|
||
| arm_smccc_hvc(ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_32, | ||
| ARM_SMCCC_OWNER_VENDOR_HYP, | ||
| BAO_IPCSHMEM_HYPERCALL_ID), | ||
| ipcshmem_id, 0, 0, 0, 0, 0, 0, &res); | ||
|
|
||
| return res.a0; | ||
| } | ||
|
|
||
| static inline unsigned long | ||
| bao_remio_hypercall(struct bao_remio_hypercall_ctx *ctx) | ||
| { | ||
| register int r0 asm("r0") = | ||
| ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_32, | ||
| ARM_SMCCC_OWNER_VENDOR_HYP, BAO_REMIO_HYPERCALL_ID); | ||
| register u32 r1 asm("r1") = ctx->dm_id; | ||
| register u32 r2 asm("r2") = ctx->addr; | ||
| register u32 r3 asm("r3") = ctx->op; | ||
| register u32 r4 asm("r4") = ctx->value; | ||
| register u32 r5 asm("r5") = ctx->request_id; | ||
| register u32 r6 asm("r6") = 0; | ||
|
|
||
| asm volatile("hvc 0\n\t" | ||
| : "=r"(r0), "=r"(r1), "=r"(r2), "=r"(r3), "=r"(r4), | ||
| "=r"(r5), "=r"(r6) | ||
| : "r"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5) | ||
| : "memory"); | ||
|
|
||
| ctx->addr = r1; | ||
| ctx->op = r2; | ||
| ctx->value = r3; | ||
| ctx->access_width = r4; | ||
| ctx->request_id = r5; | ||
| ctx->npend_req = r6; | ||
|
|
||
| return r0; | ||
| } | ||
| #elif defined(CONFIG_RISCV) | ||
| #define BAO_SBI_EXT_ID 0x08000ba0 | ||
|
|
||
| static inline unsigned long bao_ipcshmem_hypercall(unsigned long ipcshmem_id) | ||
| { | ||
| struct sbiret ret; | ||
|
|
||
| ret = sbi_ecall(BAO_SBI_EXT_ID, BAO_IPCSHMEM_HYPERCALL_ID, ipcshmem_id, | ||
| 0, 0, 0, 0, 0); | ||
|
|
||
| return ret.error; | ||
| } | ||
|
|
||
| static inline unsigned long | ||
| bao_remio_hypercall(struct bao_remio_hypercall_ctx *ctx) | ||
| { | ||
| register uintptr_t a0 asm("a0") = (uintptr_t)(ctx->dm_id); | ||
| register uintptr_t a1 asm("a1") = (uintptr_t)(ctx->addr); | ||
| register uintptr_t a2 asm("a2") = (uintptr_t)(ctx->op); | ||
| register uintptr_t a3 asm("a3") = (uintptr_t)(ctx->value); | ||
| register uintptr_t a4 asm("a4") = (uintptr_t)(ctx->request_id); | ||
| register uintptr_t a5 asm("a5") = (uintptr_t)(0); | ||
| register uintptr_t a6 asm("a6") = (uintptr_t)(BAO_REMIO_HYPERCALL_ID); | ||
| register uintptr_t a7 asm("a7") = (uintptr_t)(0x08000ba0); | ||
|
|
||
| asm volatile("ecall" | ||
| : "+r"(a0), "+r"(a1), "+r"(a2), "+r"(a3), "+r"(a4), | ||
| "+r"(a5), "+r"(a6), "+r"(a7) | ||
| : | ||
| : "memory"); | ||
|
|
||
| ctx->addr = a2; | ||
| ctx->op = a3; | ||
| ctx->value = a4; | ||
| ctx->access_width = a5; | ||
| ctx->request_id = a6; | ||
| ctx->npend_req = a7; | ||
|
|
||
| return a0; | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* __BAO_HYPERCALL_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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| # Object files and module definition | ||
| obj-m += bao-iodispatcher.o | ||
| iodispatcher-y := dm.o driver.o intc.o io_client.o io_dispatcher.o ioctls.o ioeventfd.o irqfd.o | ||
| bao-iodispatcher-y := dm.o driver.o intc.o io_client.o io_dispatcher.o ioeventfd.o irqfd.o | ||
| ccflags-y += -I$(PWD)/../include |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we use
arm_smccc_hvchere also?