Skip to content

SVA support for FreeBSD 9.3#36

Open
tupipa wants to merge 9 commits intojtcriswell:masterfrom
tupipa:freebsd93
Open

SVA support for FreeBSD 9.3#36
tupipa wants to merge 9 commits intojtcriswell:masterfrom
tupipa:freebsd93

Conversation

@tupipa
Copy link
Copy Markdown

@tupipa tupipa commented Jan 23, 2019

With TLS enabled, now FreeBSD 9.3 can run on SVA. Compared to the SVA version for FreeBSD 9.0, the main changes in SVA code are the offsets of members in the CPUState structure.

The Ported FreeBSD 9.3 Kernel: https://github.com/tupipa/sva_freebsd93.

Tests:

  1. On virtual machine, host with original FreeBSD 9.0, build 9.3 with SVA, passed;
  2. On virtual machine, host with original FreeBSD 9.3, build 9.3 with SVA, passed;
  3. On physical machine, Sandy Bridge, host with 9.0/9.3, build 9.3 with SVA, passed;

  1. added two members 'fsbase', and 'state_flags' in structure sva_integer_state_t
  2. updated system call entry: SVAsyscall in handler.S: reset state_flags to 0 before enter syscall; after syscall returns, check state_flags to determine wheter to restore FSBASE MSR
  3. updated context switch (sva_swap_integer): set state_flags to 1 for old thread.
  4. added a hack function sva_init_fsbase. This is used for Kernel to update 'fsbase' in SVA. This is a hack since 'fsbase' should not be exposed to Kernel. A better solution could be allowing the application to issue a hypercall directly to SVA to initializae 'fsbase'.
@tupipa
Copy link
Copy Markdown
Author

tupipa commented Jan 24, 2019

Update, new tests:
4. Coleman (Haswell), host 9.3, build 9.3 with SVA. passed;

Note: On coleman: 1) need to disable usb 3.0 in BIOS setup and disable fusefs in /etc/rc.conf; 2) ssh server daemon occasionally crash at boot.

@tupipa
Copy link
Copy Markdown
Author

tupipa commented Jan 25, 2019

Update-02: new tests:

  1. Marquez (Skylake), host 9.3, build 9.3 with SVA. passed;

Note: the patched system booted on SSD drive, which seems to have a more 'official' installation of FreeBSD 9.3 and allows the system to boot normally as expected. The 'official' installation on the other HDD disk cannot boot with single user mode, nor the sva-patched 9.3 kernel can boot on it. Problem is unclear, probably related to some kernel configurations by which an unsupported driver is triggered.

2. sva_init_stack: copy the fsbase from the old thread;
3. remove state_flags in integer state struct, remove macro STATE_FULL_IRET. Instead, use 3rd lowest bit in IC->valid for full_iret flag, use IC_FULL_IRET as the constant value of the flag (def in offsets.h)
@tupipa
Copy link
Copy Markdown
Author

tupipa commented Apr 12, 2019

This branch is force pushed. To checkout please use git rebase and select drop to the conflicting commits.

git checkout freebsd93 && git rebase -i origin/freebsd93

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.

1 participant