summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/platform
diff options
context:
space:
mode:
authorRobin Luk <lubin.lu@antgroup.com>2021-01-14 19:06:46 +0800
committerRobin Luk <lubin.lu@antgroup.com>2021-02-03 11:50:36 +0000
commit6eb80b2e2df4a7e0a0b9dcfc99906a84fd8fc3f0 (patch)
tree4b04266e0608caf4c661b56d4ef7cb7731ba334d /pkg/sentry/platform
parent25130d6183d399fc3bfa93385aeba6819437ea6c (diff)
arm64 kvm:implement basic lazy save and restore for FPSIMD registers
Implement basic lazy save and restore for FPSIMD registers, which only restore FPSIMD state on el0_fpsimd_acc and save FPSIMD state in switch(). Signed-off-by: Robin Luk <lubin.lu@antgroup.com>
Diffstat (limited to 'pkg/sentry/platform')
-rw-r--r--pkg/sentry/platform/kvm/bluepill_arm64.go8
-rw-r--r--pkg/sentry/platform/kvm/machine_arm64_unsafe.go8
2 files changed, 4 insertions, 12 deletions
diff --git a/pkg/sentry/platform/kvm/bluepill_arm64.go b/pkg/sentry/platform/kvm/bluepill_arm64.go
index 35298135a..6846abee9 100644
--- a/pkg/sentry/platform/kvm/bluepill_arm64.go
+++ b/pkg/sentry/platform/kvm/bluepill_arm64.go
@@ -111,8 +111,8 @@ func (c *vCPU) KernelSyscall() {
regs.Pc -= 4 // Rewind.
}
- vfpEnable := ring0.CPACREL1()
- if vfpEnable != 0 {
+ fpDisableTrap := ring0.CPACREL1()
+ if fpDisableTrap != 0 {
fpsimd := fpsimdPtr((*byte)(c.floatingPointState))
fpcr := ring0.GetFPCR()
fpsr := ring0.GetFPSR()
@@ -135,8 +135,8 @@ func (c *vCPU) KernelException(vector ring0.Vector) {
regs.Pc = 0
}
- vfpEnable := ring0.CPACREL1()
- if vfpEnable != 0 {
+ fpDisableTrap := ring0.CPACREL1()
+ if fpDisableTrap != 0 {
fpsimd := fpsimdPtr((*byte)(c.floatingPointState))
fpcr := ring0.GetFPCR()
fpsr := ring0.GetFPSR()
diff --git a/pkg/sentry/platform/kvm/machine_arm64_unsafe.go b/pkg/sentry/platform/kvm/machine_arm64_unsafe.go
index dca0cdb60..78cbd9701 100644
--- a/pkg/sentry/platform/kvm/machine_arm64_unsafe.go
+++ b/pkg/sentry/platform/kvm/machine_arm64_unsafe.go
@@ -70,14 +70,6 @@ func (c *vCPU) initArchState() error {
panic(fmt.Sprintf("error setting KVM_ARM_VCPU_INIT failed: %v", errno))
}
- // cpacr_el1
- reg.id = _KVM_ARM64_REGS_CPACR_EL1
- // It is off by default, and it is turned on only when in use.
- data = 0 // Disable fpsimd.
- if err := c.setOneRegister(&reg); err != nil {
- return err
- }
-
// tcr_el1
data = _TCR_TXSZ_VA48 | _TCR_CACHE_FLAGS | _TCR_SHARED | _TCR_TG_FLAGS | _TCR_ASID16 | _TCR_IPS_40BITS
reg.id = _KVM_ARM64_REGS_TCR_EL1