~kamalmostafa/ubuntu/+source/linux-aws/+git/focal:lp1889282-aws-pvtime

Last commit made on 2020-07-28
Get this branch:
git clone -b lp1889282-aws-pvtime https://git.launchpad.net/~kamalmostafa/ubuntu/+source/linux-aws/+git/focal
Only Kamal Mostafa can upload to this branch. If you are Kamal Mostafa please log in for upload directions.

Branch merges

Branch information

Name:
lp1889282-aws-pvtime
Repository:
lp:~kamalmostafa/ubuntu/+source/linux-aws/+git/focal

Recent commits

e2b961e... by Steven Price

arm64: Retrieve stolen time as paravirtualized guest

BugLink: https://bugs.launchpad.net/bugs/1889282

Enable paravirtualization features when running under a hypervisor
supporting the PV_TIME_ST hypercall.

For each (v)CPU, we ask the hypervisor for the location of a shared
page which the hypervisor will use to report stolen time to us. We set
pv_time_ops to the stolen time function which simply reads the stolen
value from the shared page for a VCPU. We guarantee single-copy
atomicity using READ_ONCE which means we can also read the stolen
time for another VCPU than the currently running one while it is
potentially being updated by the hypervisor.

Signed-off-by: Steven Price <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
(cherry picked from commit e0685fa228fdaf386f82ac0d64b2d6f3e0ddd588)
Signed-off-by: Kamal Mostafa <email address hidden>

e68abff... by Steven Price

arm/arm64: Make use of the SMCCC 1.1 wrapper

BugLink: https://bugs.launchpad.net/bugs/1889282

Rather than directly choosing which function to use based on
psci_ops.conduit, use the new arm_smccc_1_1 wrapper instead.

In some cases we still need to do some operations based on the
conduit, but the code duplication is removed.

No functional change.

Signed-off-by: Steven Price <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
(cherry picked from commit ce4d5ca2b9dd5d85944eb93c1bbf9eb11b7a907d)
Signed-off-by: Kamal Mostafa <email address hidden>

368a269... by Steven Price

arm/arm64: Provide a wrapper for SMCCC 1.1 calls

BugLink: https://bugs.launchpad.net/bugs/1889282

SMCCC 1.1 calls may use either HVC or SMC depending on the PSCI
conduit. Rather than coding this in every call site, provide a macro
which uses the correct instruction. The macro also handles the case
where no conduit is configured/available returning a not supported error
in res, along with returning the conduit used for the call.

This allow us to remove some duplicated code and will be useful later
when adding paravirtualized time hypervisor calls.

Signed-off-by: Steven Price <email address hidden>
Acked-by: Will Deacon <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
(cherry picked from commit 541625ac47ce9d0835efaee0fcbaa251b0000a37)
Signed-off-by: Kamal Mostafa <email address hidden>

5357428... by Steven Price

KVM: arm64: Provide VCPU attributes for stolen time

BugLink: https://bugs.launchpad.net/bugs/1889282

Allow user space to inform the KVM host where in the physical memory
map the paravirtualized time structures should be located.

User space can set an attribute on the VCPU providing the IPA base
address of the stolen time structure for that VCPU. This must be
repeated for every VCPU in the VM.

The address is given in terms of the physical address visible to
the guest and must be 64 byte aligned. The guest will discover the
address via a hypercall.

Signed-off-by: Steven Price <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
(cherry picked from commit 58772e9a3db72d032eeb12bc011bc5184a3925f4)
Signed-off-by: Kamal Mostafa <email address hidden>

f0776c5... by Steven Price

KVM: Allow kvm_device_ops to be const

BugLink: https://bugs.launchpad.net/bugs/1889282

Currently a kvm_device_ops structure cannot be const without triggering
compiler warnings. However the structure doesn't need to be written to
and, by marking it const, it can be read-only in memory. Add some more
const keywords to allow this.

Reviewed-by: Andrew Jones <email address hidden>
Signed-off-by: Steven Price <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
(cherry picked from commit 8538cb22bbce5a988671b68baf0b0f9e86ca1e87)
Signed-off-by: Kamal Mostafa <email address hidden>

26b9f45... by Steven Price

KVM: arm64: Support stolen time reporting via shared structure

BugLink: https://bugs.launchpad.net/bugs/1889282

Implement the service call for configuring a shared structure between a
VCPU and the hypervisor in which the hypervisor can write the time
stolen from the VCPU's execution time by other tasks on the host.

User space allocates memory which is placed at an IPA also chosen by user
space. The hypervisor then updates the shared structure using
kvm_put_guest() to ensure single copy atomicity of the 64-bit value
reporting the stolen time in nanoseconds.

Whenever stolen time is enabled by the guest, the stolen time counter is
reset.

The stolen time itself is retrieved from the sched_info structure
maintained by the Linux scheduler code. We enable SCHEDSTATS when
selecting KVM Kconfig to ensure this value is meaningful.

Signed-off-by: Steven Price <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
(cherry picked from commit 8564d6372a7d8a6d440441b8ed8020f97f744450)
Signed-off-by: Kamal Mostafa <email address hidden>

05860ae... by Steven Price

KVM: Implement kvm_put_guest()

BugLink: https://bugs.launchpad.net/bugs/1889282

kvm_put_guest() is analogous to put_user() - it writes a single value to
the guest physical address. The implementation is built upon put_user()
and so it has the same single copy atomic properties.

Signed-off-by: Steven Price <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
(cherry picked from commit cac0f1b7285eaaf9a186c618c3a7304d82ed5493)
Signed-off-by: Kamal Mostafa <email address hidden>

0759573... by Steven Price

KVM: arm64: Implement PV_TIME_FEATURES call

BugLink: https://bugs.launchpad.net/bugs/1889282

This provides a mechanism for querying which paravirtualized time
features are available in this hypervisor.

Also add the header file which defines the ABI for the paravirtualized
time features we're about to add.

Signed-off-by: Steven Price <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
(cherry picked from commit b48c1a45a190898103cec28771efc399fd65a05a)
Signed-off-by: Kamal Mostafa <email address hidden>

24178ce... by Christoffer Dall <email address hidden>

KVM: arm/arm64: Factor out hypercall handling from PSCI code

BugLink: https://bugs.launchpad.net/bugs/1889282

We currently intertwine the KVM PSCI implementation with the general
dispatch of hypercall handling, which makes perfect sense because PSCI
is the only category of hypercalls we support.

However, as we are about to support additional hypercalls, factor out
this functionality into a separate hypercall handler file.

Signed-off-by: Christoffer Dall <email address hidden>
[<email address hidden>: rebased]
Reviewed-by: Andrew Jones <email address hidden>
Signed-off-by: Steven Price <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
(backported from commit 55009c6ed2d24fc0f5521ab2482f145d269389ea; no Kbuild)
Signed-off-by: Kamal Mostafa <email address hidden>

9f65c7d... by Steven Price

KVM: arm64: Document PV-time interface

BugLink: https://bugs.launchpad.net/bugs/1889282

Introduce a paravirtualization interface for KVM/arm64 based on the
"Arm Paravirtualized Time for Arm-Base Systems" specification DEN 0057A.

This only adds the details about "Stolen Time" as the details of "Live
Physical Time" have not been fully agreed.

User space can specify a reserved area of memory for the guest and
inform KVM to populate the memory with information on time that the host
kernel has stolen from the guest.

A hypercall interface is provided for the guest to interrogate the
hypervisor's support for this interface and the location of the shared
memory structures.

Signed-off-by: Steven Price <email address hidden>
Signed-off-by: Marc Zyngier <email address hidden>
(cherry picked from commit 6a7458485b390f48e481fcd4a0b20e6c5c843d2e)
Signed-off-by: Kamal Mostafa <email address hidden>