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

[demo] Add clock ioctls to the KVM interface #84

Open
wants to merge 12 commits into
base: mk-demo
Choose a base branch
from

Conversation

brendank310
Copy link
Member

No description provided.

Pavan-Infovision and others added 12 commits October 22, 2021 11:21
Instead of using a pointer for the indices entry in kvm_msr_list, use a
normal array and define the KVM_MSR_GET_INDEX_LIST ioctl using the
_IOWR_LIST macro (see "shim/linux: add _IOWR_LIST macro").

Define MSR_LIST_MAX_INDICES to be 128, as this leaves some room to keep
the stack frame < 1024 bytes. This may be too low of a max, but is
plenty for our current QEMU and integration testing.

Signed-off-by: Nick Rosbrook <[email protected]>
The KVM API states that when the number of MSRs is greater than the
value set in nmsrs by the caller, the kernel will set the correct value
in nmsrs and return -E2BIG. This behavior was excluded from the first
implementation of KVM_GET_MSR_INDEX_LIST. Define SHIM_2BIG so that other
shim functions can implement this behavior, which is a common pattern in
ioctls.

Signed-off-by: Nick Rosbrook <[email protected]>
The enum mv_cpuid_flag_t is incorrectly defined as mv_cpuid_flag
(missing the _t suffix) in the C header file, which causes the following
build errors:

/home/nr/bareflank/microv/hypercall/include/mv_cdl_entry_t.h:51:9: error: User-defined types must have the same name as the header file they are defined in. Either name the Enum 'mv_cdl_entry_t', or name the header 'mv_cpuid_flag_t' [bsl-user-defined-type-names-match-header-name,-warnings-as-errors]
        enum mv_cpuid_flag_t flags;
        ^
/home/nr/bareflank/microv/hypercall/include/mv_cdl_entry_t.h:51:14: error: Enum 'mv_cpuid_flag_t' is missing documentation. Are you missing the '@brief' command? [bsl-documentation,-warnings-as-errors]
        enum mv_cpuid_flag_t flags;
             ^
/home/nr/bareflank/microv/hypercall/include/mv_cdl_entry_t.h:51:30: error: field has incomplete type 'enum mv_cpuid_flag_t' [clang-diagnostic-error]
        enum mv_cpuid_flag_t flags;
                             ^
/home/nr/bareflank/microv/hypercall/include/mv_cdl_entry_t.h:51:14: note: forward declaration of 'enum mv_cpuid_flag_t'
        enum mv_cpuid_flag_t flags;
             ^
/home/nr/bareflank/microv/hypercall/include/mv_cpuid_flag_t.h:46:1: error: User-defined types must have the same name as the header file they are defined in. Either name the Enum 'mv_cpuid_flag_t', or name the header 'mv_cpuid_flag' [bsl-user-defined-type-names-match-header-name,-warnings-as-errors]
enum mv_cpuid_flag
^

Fix this by adding the _t suffix in the C header file.

Signed-off-by: Nick Rosbrook <[email protected]>
Implment support in the shim for the GET_SUPPORTED_CPUID ioctl. This has
been tested against QEMU to confirm execution advances passed these
ioctl calls.

Note that the current CPUID2_MAX_ENTRIES causes stack frames to exceed
1024 bytes:

/home/nr/bareflank/microv/shim/linux/src/entry.c: In function ‘dispatch_system_kvm_get_supported_cpuid’:
/home/nr/bareflank/microv/shim/linux/src/entry.c:325:1: warning: the frame size of 1616 bytes is larger than 1024 bytes [-Wframe-larger-than=]
  325 | }
      | ^

Currently the number of entries we return is 30, and reducing the max
much lower could cause QEMU to fail.

Signed-off-by: Nick Rosbrook <[email protected]>
…on-demo-and-intel-portio

Set user memory region demo and intel portio
Add KVM_GET_CLOCK vm ioctl to the shim

Signed-off-by: Brendan Kerrigan <[email protected]>
Add KVM_SET_CLOCK vm ioctl to the shim

Signed-off-by: Brendan Kerrigan <[email protected]>
@chp-io chp-io changed the title Add clock ioctls to the KVM interface [demo] Add clock ioctls to the KVM interface Oct 27, 2021
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.

None yet

3 participants