Skip to content
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

Support complex backend/frontend hierarchies #7

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

hlyytine
Copy link
Collaborator

@hlyytine hlyytine commented Oct 5, 2023

No description provided.

`service_vm_va` is a bit redundant here -- `vaddr` should be enough.

Signed-off-by: Hannu Lyytinen <[email protected]>
Signed-off-by: Hannu Lyytinen <[email protected]>
Signed-off-by: Hannu Lyytinen <[email protected]>
Despite eliminating all locks on ring buffers, userspace helper
(such as QEMU) can access the buffers without context switches
to kernel.

Signed-off-by: Hannu Lyytinen <[email protected]>
Signed-off-by: Hannu Lyytinen <[email protected]>
Userspace helper (such as QEMU) is now able to ring the doorbell
without context switch to kernel.

Signed-off-by: Hannu Lyytinen <[email protected]>
@hlyytine hlyytine marked this pull request as ready for review October 25, 2023 06:05
Copy link
Collaborator

@elmankku elmankku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Queue head/tail reading and writing require barriers as well as ioreq state variable reads and writes because these are inspected and modified by all three (sel4 vmm, linux kernel and linux user space) and we must ensure all three share the same view

#define RPC_MR0_STATE_SHIFT (RPC_MR0_OP_WIDTH + RPC_MR0_OP_SHIFT)

#define RPC_MR0_STATE_COMPLETE 0
#define RPC_MR0_STATE_RESERVED 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reserved here means unused...?

static inline
sel4_rpc_t *rpcmsg_commit(sel4_rpc_t *rpc, rpcmsg_t *msg)
{
msg->mr0 = BIT_FIELD_SET(msg->mr0, RPC_MR0_STATE, RPC_MR0_STATE_PENDING);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write release / write barrier

rpcmsg_t *rpcmsg_queue_advance_tail(rpcmsg_queue_t *q)
{
rpc_assert((!rpcmsg_queue_full(q)));
q->tail = QUEUE_NEXT(q->tail);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have write release / write barrier

rpcmsg_t *rpcmsg_queue_advance_head(rpcmsg_queue_t *q)
{
rpc_assert(!rpcmsg_queue_empty(q));
q->head = QUEUE_NEXT(q->head);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have write release / write barrier

rpc_assert(!"tx queue full");
}

switch (BIT_FIELD_GET(msg->mr0, RPC_MR0_STATE)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Load acquire / read barrier

return NULL;
}

next = QUEUE_NEXT(msg - q->data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Load acquire

((uint32_t *) dataport->mem[0].service_vm_va)[0] = 1;
uint32_t *emit_register = private;

*emit_register = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think write barrier here to ensure ordering of writes

smp_store_release(&ioreq->state,
SEL4_IOREQ_STATE_PROCESSING);
set_bit(slot, vm->ioreq_map);
req->mr0 = BIT_FIELD_SET(req->mr0, RPC_MR0_STATE, RPC_MR0_STATE_PROCESSING);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Store release to ensure others share the view

rpc = driver_ack_mmio_finish(rpc, slot, 0);
BUG_ON(!rpc);

req->mr0 = BIT_FIELD_SET(req->mr0, RPC_MR0_STATE, RPC_MR0_STATE_COMPLETE);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Store release to ensure order of writes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants