[siemens/jailhouse] a9b3ce: x86: Emulate MTRR enable/disable

2 views
Skip to first unread message

GitHub

unread,
Apr 7, 2015, 4:28:26 AM4/7/15
to jailho...@googlegroups.com
Branch: refs/heads/coverity_scan
Home: https://github.com/siemens/jailhouse
Commit: a9b3cedc52d2cdd439dc18065bf46e0c54f8339b
https://github.com/siemens/jailhouse/commit/a9b3cedc52d2cdd439dc18065bf46e0c54f8339b
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/percpu.h
M hypervisor/arch/x86/include/asm/processor.h
M hypervisor/arch/x86/setup.c
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Emulate MTRR enable/disable

We assume that cells will only flip the enabled flag of
IA32_MTRR_DEF_TYPE, leaving the rest of the register in default state
(the one found during handover). SVM already implemented this but
emulated the disabled state by modifying the host PAT.

This approach works less invasively by only changing the effective guest
PAT to 0 in case MTRRs are off. And it provides this for Intel as well.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: c4e9603eb184e61dd8db3ac07044d1f162750da2
https://github.com/siemens/jailhouse/commit/c4e9603eb184e61dd8db3ac07044d1f162750da2
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Block write access to MTRR registers

Linux does not try to rewrite them on CPU hotplug if they are identical
to other CPUs' registers, and our non-root cells have no business in
touching them as well. This effectively freezes MTRRs after handover
ensures consistent states for both the hypervisor and all cells across
all CPUs.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 6a838ce80b323f00ebfd8c5d74358b7b27cd2767
https://github.com/siemens/jailhouse/commit/6a838ce80b323f00ebfd8c5d74358b7b27cd2767
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/vcpu.c

Log Message:
-----------
x86: Remove local cpu_data variable from vcpu_handle_hypercall

Only used once.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: c21e35fabd05ceaa35a778e1f93c97f54ae1d9cf
https://github.com/siemens/jailhouse/commit/c21e35fabd05ceaa35a778e1f93c97f54ae1d9cf
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/apic.c
M hypervisor/arch/x86/control.c
M hypervisor/arch/x86/include/asm/apic.h

Log Message:
-----------
x86: Remove cpu_data parameter from apic_clear

The function only works against the current CPU, thus should avoid to
take the misleading parameter. The necessary reference can be obtained
inline.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 10176a905663a8d38e620f8bbd6a2461c6573949
https://github.com/siemens/jailhouse/commit/10176a905663a8d38e620f8bbd6a2461c6573949
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/apic.c

Log Message:
-----------
x86: Remove unused parameter from apic_valid_ipi_mode

No use case in sight.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: a84e252eaf73b0d0fa238029b9c4daf2efa3f3e6
https://github.com/siemens/jailhouse/commit/a84e252eaf73b0d0fa238029b9c4daf2efa3f3e6
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/apic.c

Log Message:
-----------
x86: Remove cpu_data parameter from apic_send_[logical_dest_]ipi

The function only works against the current CPU, thus should avoid to
take the misleading parameter. The necessary reference can be obtained
inline.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: c23e2fa1d20cc2b8f0cf18d0709b5db176b81135
https://github.com/siemens/jailhouse/commit/c23e2fa1d20cc2b8f0cf18d0709b5db176b81135
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/apic.c
M hypervisor/arch/x86/include/asm/apic.h

Log Message:
-----------
x86: Update apic_handle_icr_write signature

apic_handle_icr_write became locally used only by 3da0bd91d9, and we
also no longer use the cpu_data parameter.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 5ddc9d0367d8138067ed72ab204f2bc7f6263f31
https://github.com/siemens/jailhouse/commit/5ddc9d0367d8138067ed72ab204f2bc7f6263f31
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/control.c
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Remove cpu_data parameter from vcpu_park

The function only works against the current CPU, thus should avoid to
take the misleading parameter. The implementations can obtain the
reference inline as needed.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: b8a8f858a98044a810db3559aac353e3efaf6d5f
https://github.com/siemens/jailhouse/commit/b8a8f858a98044a810db3559aac353e3efaf6d5f
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Obtain execution state inside vcpu_handle_hypercall

This simplifies the invocation of the handler and aligns it with
vcpu_handle_pt_violation.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 26f315a7868b4dc8f69d579f8bc0a567c62cf254
https://github.com/siemens/jailhouse/commit/26f315a7868b4dc8f69d579f8bc0a567c62cf254
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Retrieve vcpu_io_intercept from vcpu_handle_io_access

Convert the vendor-specific functions into vcpu_vendor_get_io_intercept
and invoke that one from vcpu_handle_io_access. That offloads this
burden from the callers of vcpu_handle_io_access and takes us further
towards consistent vendor callbacks for such purposes.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 43b6447ca927122515b5fb3abde8f247fa4c11ba
https://github.com/siemens/jailhouse/commit/43b6447ca927122515b5fb3abde8f247fa4c11ba
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Rename parameter of vcpu_vendor_get_io_intercept

This aligns the internal names with those used externally. No functional
changes.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: f7c9d39057e37e26210ff7e3316bc357bda4e0f5
https://github.com/siemens/jailhouse/commit/f7c9d39057e37e26210ff7e3316bc357bda4e0f5
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Rename vcpu_handle_pt_violation to vcpu_handle_mmio_access

This describes more accurately what the handler does and aligns us with
vcpu_handle_io_access.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: e11cc707a3f472344aeb477997b1f62a87dca6eb
https://github.com/siemens/jailhouse/commit/e11cc707a3f472344aeb477997b1f62a87dca6eb
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Retrieve vcpu_mmio_intercept from vcpu_handle_mmio_access

Analogously to vcpu_handle_io_access, define the vendor callback
vcpu_vendor_get_mmio_intercept and call it from vcpu_handle_mmio_access
instead of passing it to the handler. For consistency reasons, rename
vcpu_pf_intercept to vcpu_mmio_intercept.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 34489e9b50e1e3865ea6f0345470a0cf677e619d
https://github.com/siemens/jailhouse/commit/34489e9b50e1e3865ea6f0345470a0cf677e619d
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Factor out vcpu_handle_xsetbv

The handling logic is fully shared between AMD and Intel CPUs.
Consolidate it.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 3f77fa2ff14cf6864752ed49b1b6fd61b26979ef
https://github.com/siemens/jailhouse/commit/3f77fa2ff14cf6864752ed49b1b6fd61b26979ef
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/apic.c
M hypervisor/arch/x86/i8042.c
M hypervisor/arch/x86/include/asm/apic.h
M hypervisor/arch/x86/include/asm/i8042.h
M hypervisor/arch/x86/include/asm/pci.h
M hypervisor/arch/x86/include/asm/processor.h
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/pci.c
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Allow index-based guest register access without type casts

Convert struct registers into a union and provide a by_index array for
index-based access. This is used by various handlers that parse guest
instructions and so far use a blunt type case on the structure.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 188b90fb7802689f25d222e26b1682bba518ae26
https://github.com/siemens/jailhouse/commit/188b90fb7802689f25d222e26b1682bba518ae26
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm-vmexit.S

Log Message:
-----------
x86: Reorder stack layout in svm_vmexit

Push the guest registers first so that they end up at the same location
on the stack as on Intel. This will allow to address them generically
via the per_cpu structure.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 87329baac352bef8727e3a207eac1e3105ebfc27
https://github.com/siemens/jailhouse/commit/87329baac352bef8727e3a207eac1e3105ebfc27
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/percpu.h

Log Message:
-----------
x86: Enable direct access to per-cpu guest registers

Now that the guest registers are saved at the same location on the
per-cpu stack for both Intel and AMD, we can enable direct access via
the per-cpu data structure. This will allow to drop the guest registers
parameter from most functions.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: a34de56a19f13bc4102cc34649d0448c2fa11206
https://github.com/siemens/jailhouse/commit/a34de56a19f13bc4102cc34649d0448c2fa11206
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm-vmexit.S
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vmx-vmexit.S
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Remove guest registers parameter from vcpu_handle_exit

We can retrieve them from the per-cpu data structure now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 9ef8dd8cc6210de9d71451db423db52c3eea3c69
https://github.com/siemens/jailhouse/commit/9ef8dd8cc6210de9d71451db423db52c3eea3c69
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Remove guest registers parameter from vcpu_reset

The function only works against the current CPU, thus should avoid to
take the misleading parameter. The necessary reference can be obtained
from the per-cpu data structure now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: a3d20dd9726eb9d4da02887afc2dc37473a89516
https://github.com/siemens/jailhouse/commit/a3d20dd9726eb9d4da02887afc2dc37473a89516
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Remove guest registers parameter from vcpu_deactivate_vmm

The function only works against the current CPU, thus should avoid to
take the misleading parameter. The necessary reference can be obtained
from the per-cpu data structure now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 1660ec499756dbeec6431755644ae8002be37b84
https://github.com/siemens/jailhouse/commit/1660ec499756dbeec6431755644ae8002be37b84
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Remove guest registers parameter from vcpu_handle_hypercall

The function only works against the current CPU, thus should avoid to
take the misleading parameter. The necessary reference can be obtained
from the per-cpu data structure now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: a7573753b3a9dbed95f6f29de54e1c9835064422
https://github.com/siemens/jailhouse/commit/a7573753b3a9dbed95f6f29de54e1c9835064422
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Remove guest registers parameter from vcpu_handle_xsetbv

The function only works against the current CPU, thus should avoid to
take the misleading parameter. The necessary reference can be obtained
from the per-cpu data structure now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 7ab190fd9fdae29cbb0d0917f5fd184555147a3a
https://github.com/siemens/jailhouse/commit/7ab190fd9fdae29cbb0d0917f5fd184555147a3a
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/apic.c
M hypervisor/arch/x86/include/asm/apic.h
M hypervisor/arch/x86/vcpu.c

Log Message:
-----------
x86: Remove parameters from x2apic_handle_read/write

The function only works against the current CPU, thus should avoid to
take the misleading parameters. We can retrieve the per-cpu data
structure and the guest registers in the function now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 2dc2a67846c78ea484cd96a88e5dfec3761d7471
https://github.com/siemens/jailhouse/commit/2dc2a67846c78ea484cd96a88e5dfec3761d7471
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/apic.c
M hypervisor/arch/x86/include/asm/apic.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Remove guest registers and cpu_data parameters from apic_mmio_access

The function only works on the current CPU, thus should avoid to take
misleading parameters. The necessary references can be obtained inline.

With the parameters no longer needed, the callers
svm/vmx_handle_apic_access can drop some of them as well.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 77a974e4779c0c8557586ad04276a14e6dfd4eb2
https://github.com/siemens/jailhouse/commit/77a974e4779c0c8557586ad04276a14e6dfd4eb2
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/i8042.c
M hypervisor/arch/x86/include/asm/i8042.h
M hypervisor/arch/x86/vcpu.c

Log Message:
-----------
x86: Remove guest registers parameter from i8042_access_handler

The function only works against the current CPU, thus should avoid to
take the misleading parameter. The necessary reference can be obtained
from the per-cpu data structure now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 0f935394d1e68ba5c8a9298159a5aae1d111ccc5
https://github.com/siemens/jailhouse/commit/0f935394d1e68ba5c8a9298159a5aae1d111ccc5
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/pci.c

Log Message:
-----------
x86: Rework RAX register accessors of PCI layer

Stop requiring that the guest registers are passed down to the
accessors. Access handlers always work over the issuing CPU, thus can
obtain the register state themselves. Rename the accessors to make it
clear that they work against guest registers.

This allows to drop the guest_regs parameters from
data_port_in/out_handler.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 7774d0aeb635dfae68ca03e42cb148502b222eb9
https://github.com/siemens/jailhouse/commit/7774d0aeb635dfae68ca03e42cb148502b222eb9
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/pci.h
M hypervisor/arch/x86/pci.c
M hypervisor/arch/x86/vcpu.c

Log Message:
-----------
x86: Remove guest registers and cell parameters from x86_pci_config_handler

The function only works against the current CPU, thus should avoid to
take the misleading parameters. Guest registers are no long er required,
and the cell reference can be obtained inline.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 6f914f2caf943aa098d3c39c37d7a805cb122991
https://github.com/siemens/jailhouse/commit/6f914f2caf943aa098d3c39c37d7a805cb122991
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Remove unused guest registers parameter from vcpu_handle_io_access

All filter functions obtain the reference themselves now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: b7f6999d2898e8ce6a44de6bdd958e3eac45e289
https://github.com/siemens/jailhouse/commit/b7f6999d2898e8ce6a44de6bdd958e3eac45e289
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Remove guest registers parameter from vcpu_handle_mmio_access

The function only works against the current CPU, thus should avoid to
take the misleading parameter. The necessary reference can be obtained
from the per-cpu data structure now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: eaf7a217b0b397a1e1fb1d3b3daa80201f4b61a3
https://github.com/siemens/jailhouse/commit/eaf7a217b0b397a1e1fb1d3b3daa80201f4b61a3
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/vcpu.h
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vcpu.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Remove guest registers parameter from vcpu_handle_msr_read/write

The function only works against the current CPU, thus should avoid to
take the misleading parameter. The necessary reference can be obtained
from the per-cpu data structure now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: afc65f482f70bb8329bf89a73e893e127aefb451
https://github.com/siemens/jailhouse/commit/afc65f482f70bb8329bf89a73e893e127aefb451
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Remove parameters from vmx_handle_cr

Guest registers can be retrieved inline.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 70e297a2c4840add140127d89fe4efad05aa265d
https://github.com/siemens/jailhouse/commit/70e297a2c4840add140127d89fe4efad05aa265d
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Factor out vmx_handle_cpuid

Shortens vcpu_handle_exit and improves readability.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 2343852668703e8ea21a50c3702dcf263e016aa2
https://github.com/siemens/jailhouse/commit/2343852668703e8ea21a50c3702dcf263e016aa2
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Drop local guest_regs variable from VMX version of vcpu_handle_exit

No need to cache it. It can be derived from cpu_data now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 19f1e25bc2a51256e4b8fb0afdf97c31c39ca440
https://github.com/siemens/jailhouse/commit/19f1e25bc2a51256e4b8fb0afdf97c31c39ca440
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Drop some unneeded local variables from SVM functions

No need to maintain cpu_data or even vmcb as local variable if they are
only used once.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: e828947bbc4bf84c2ed0910ecc498b4befd92289
https://github.com/siemens/jailhouse/commit/e828947bbc4bf84c2ed0910ecc498b4befd92289
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Remove traces of cpuid interception from SVM

There is no foreseeable need to intercept cpuid on AMD. On Intel, we
are not asked if we want to, so we have to execute it on behalf of the
cell.But here we can simple let it happen.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: e03aa98a97b02b5cb067c7b9b26c542f9f7f4cd3
https://github.com/siemens/jailhouse/commit/e03aa98a97b02b5cb067c7b9b26c542f9f7f4cd3
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Remove guest registers parameter from svm_handle_cr

We can retrieve them from the per-cpu data structure now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: ab0041d9c54a87157930566746abe42373102399
https://github.com/siemens/jailhouse/commit/ab0041d9c54a87157930566746abe42373102399
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Cache vmcb instead of cpu_data in SVM's vcpu_vendor_get_execution_state

Easier to read.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 94f8885839f41a3e78a7cc3885982b6ba06636d4
https://github.com/siemens/jailhouse/commit/94f8885839f41a3e78a7cc3885982b6ba06636d4
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Rename x86_parse_mov_to_cr to svm_parse_mov_to_cr

This functions is SVM-specific.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 00410f2cda938acd7ad903deaad3ba8429635413
https://github.com/siemens/jailhouse/commit/00410f2cda938acd7ad903deaad3ba8429635413
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Pass vmcb instead of cpu_data to some internal SVM functions

update_efer, svm_parse_mov_to_cr and svm_handle_apic_access have no use
for cpu_data and rather convert it into a vmcb reference directly. So
pass that one instead to save some statements.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: b24ca51f6d5a10f2b24d60db3dde1f1332039e49
https://github.com/siemens/jailhouse/commit/b24ca51f6d5a10f2b24d60db3dde1f1332039e49
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Remove guest registers parameter from svm_handle_msr_write

We can retrieve them from the per-cpu data structure now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 82263086f6cc456a9dae82575878c81e783c215e
https://github.com/siemens/jailhouse/commit/82263086f6cc456a9dae82575878c81e783c215e
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Drop local guest_regs variable from SVM version of vcpu_handle_exit

No need to cache it. It can be derived from cpu_data now.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 69a668b91917e6459140689d0e3dce9b63b159a4
https://github.com/siemens/jailhouse/commit/69a668b91917e6459140689d0e3dce9b63b159a4
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/asm-defines.c
M hypervisor/arch/x86/svm-vmexit.S

Log Message:
-----------
x86: Drop PERCPU_VMCB and VMCB_RAX

We can calculate PERCPU_VMCB_RAX directly and save the two intermediate
steps.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 7624c716002ece552927d1c49872c06521aa2268
https://github.com/siemens/jailhouse/commit/7624c716002ece552927d1c49872c06521aa2268
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Simplify set_svm_segment_from_segment

No need to complain: segment.access_rights is generic as it simply holds
bits 8..23 of the second descriptor dword. The additional invalid bit
used by VMX only can be ignored by SVM - and it is already, even when
leaving out the explicit test.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 9521b6c5c6d8577551cd35e0da3c24771d1bb9d3
https://github.com/siemens/jailhouse/commit/9521b6c5c6d8577551cd35e0da3c24771d1bb9d3
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Simplify set_svm_segment_from_dtr

By using set_svm_segment_from_segment for ldtr, we can remove the
condition from set_svm_segment_from_dtr.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 8c5697271c1727984ab12b6afb5824cfaeb0b268
https://github.com/siemens/jailhouse/commit/8c5697271c1727984ab12b6afb5824cfaeb0b268
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Simplify descriptor reset in svm_vcpu_reset

Reduce boilerplate code by using constants for common reset states.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 29ba6c1e384017f8e4709eaed71f82e17e3137f5
https://github.com/siemens/jailhouse/commit/29ba6c1e384017f8e4709eaed71f82e17e3137f5
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Drop constant return values from SVM functions

vmcb writing cannot fail on AMD, thus neither vmcb_setup nor
svm_set_cell_config can. Simply remove the error codes and related
handling.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 2e4922af238a3a58b6f47abd52fced6130235ca9
https://github.com/siemens/jailhouse/commit/2e4922af238a3a58b6f47abd52fced6130235ca9
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Simplify error exit of svm_parse_mov_to_cr and svm_handle_cr

No need to maintain a return code variable when we can simply return
false directly.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 05be8421efc8ea51cba77d76021f51c13a722fc2
https://github.com/siemens/jailhouse/commit/05be8421efc8ea51cba77d76021f51c13a722fc2
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/svm.h
M hypervisor/arch/x86/svm-vmexit.S
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Refactor SVM version of vcpu_activate_vmm

We can reduce the assembly required in vcpu_activate_vmm by reordering
svm_vmexit to svm_vmentry, i.e. pulling the VM entry logic to the front.
Moreover, RAX can be loaded directly. There is furthermore no need to
declare clobbered variables as we won't return from the assembly block,
which is already declared via __builtin_unreachable.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 678e0e5ff287304362d2d8485e603e0361acc563
https://github.com/siemens/jailhouse/commit/678e0e5ff287304362d2d8485e603e0361acc563
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Remove unneeded MSR restoring from SVM's vcpu_deactivate_vmm

None of these MSRs is modified by Jailhouse after VM exit, thus they
still contain the state the Linux guest left behind.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 191a567f0693fbca471c6c0f16579b240fad9bcb
https://github.com/siemens/jailhouse/commit/191a567f0693fbca471c6c0f16579b240fad9bcb
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/setup.c
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Make SYSENTER MSR restoration VMX-specific

SVM does not overwrite these MSRs on VM exit, thus does not require the
restoration done in arch_cpu_restore so far. Make them VMX-specific so
that we can drop a few lines of code.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 3606e7ef869cdf82b0afdb27a24483108a960e92
https://github.com/siemens/jailhouse/commit/3606e7ef869cdf82b0afdb27a24483108a960e92
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/include/asm/percpu.h
M hypervisor/arch/x86/setup.c

Log Message:
-----------
x86: Remove write-only linux_sysenter_* fields

The vendor code reads the state directly from the MSRs during setup.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 0e21242fd5d3981e05333468f43fa2bb6399a37f
https://github.com/siemens/jailhouse/commit/0e21242fd5d3981e05333468f43fa2bb6399a37f
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/setup.c
M hypervisor/arch/x86/svm.c
M hypervisor/arch/x86/vmx.c

Log Message:
-----------
x86: Make FS_BASE MSR restoration VMX-specific

SVM does not touch this MSR on VM exit, thus does not require the
restoration done in arch_cpu_restore so far. Make it VMX-specific so
that we can drop a few lines of code.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>


Commit: 600e0ab631ee261aa110ab677b3a927f11eb749a
https://github.com/siemens/jailhouse/commit/600e0ab631ee261aa110ab677b3a927f11eb749a
Author: Jan Kiszka <jan.k...@siemens.com>
Date: 2015-04-07 (Tue, 07 Apr 2015)

Changed paths:
M hypervisor/arch/x86/svm-vmexit.S
M hypervisor/arch/x86/svm.c

Log Message:
-----------
x86: Do not call vmload/vmsave on every VM exit

Benchmarks indicate that we can gain about 160 cycles per VM exit &
reentry by only saving/restoring MSR_GS_BASE. We don't touch the other
states that vmload/vmsave deals with.

We still need to perform vmload on handover (actually, we only need to
load MSR_GS_BASE, but vmload is simpler) and after VCPU reset. And as we
no longer save the full state, also for shutdown, we need to pull the
missing information for arch_cpu_restore directly from the registers.


Compare: https://github.com/siemens/jailhouse/compare/dbf2fe479ac0...600e0ab631ee
Reply all
Reply to author
Forward
0 new messages