Re: [PATCH v3 2/3] KVM: x86: Introduce allow list for MSR emulation

2020-08-03 Thread Alexander Graf
On 03.08.20 13:37, Vitaly Kuznetsov wrote: Alexander Graf writes: It's not desireable to have all MSRs always handled by KVM kernel space. Some MSRs would be useful to handle in user space to either emulate behavior (like uCode updates) or differentiate whether they are valid based

Re: [PATCH v3 1/3] KVM: x86: Deflect unknown MSR accesses to user space

2020-08-03 Thread Alexander Graf
On 03.08.20 13:27, Vitaly Kuznetsov wrote: Alexander Graf writes: MSRs are weird. Some of them are normal control registers, such as EFER. Some however are registers that really are model specific, not very interesting to virtualization workloads, and not performance critical. Others again

Re: [PATCH v3 1/3] KVM: x86: Deflect unknown MSR accesses to user space

2020-08-03 Thread Alexander Graf
On 01.08.20 01:36, Jim Mattson wrote: On Fri, Jul 31, 2020 at 2:50 PM Alexander Graf wrote: MSRs are weird. Some of them are normal control registers, such as EFER. Some however are registers that really are model specific, not very interesting to virtualization workloads

[PATCH v3 2/3] KVM: x86: Introduce allow list for MSR emulation

2020-07-31 Thread Alexander Graf
is populated, MSR handling stays identical to before. Signed-off-by: KarimAllah Ahmed Signed-off-by: Alexander Graf --- v2 -> v3: - document flags for KVM_X86_ADD_MSR_ALLOWLIST - generalize exit path, always unlock when returning - s/KVM_CAP_ADD_MSR_ALLOWLIST/KVM_CAP_X86_MSR_ALLOWLIS

[PATCH v3 3/3] KVM: selftests: Add test for user space MSR handling

2020-07-31 Thread Alexander Graf
Now that we have the ability to handle MSRs from user space and also to select which ones we do want to prevent in-kernel KVM code from handling, let's add a selftest to show case and verify the API. Signed-off-by: Alexander Graf --- v2 -> v3: - s/KVM_CAP_ADD_MSR_ALLOWL

[PATCH v3 1/3] KVM: x86: Deflect unknown MSR accesses to user space

2020-07-31 Thread Alexander Graf
the existing "ignore_msrs" logic with something that applies per-VM rather than on the full system. That way you can run productive VMs in parallel to experimental ones where you don't care about proper MSR handling. Signed-off-by: Alexander Graf --- v1 -> v2: - s/ETRAP_TO_USER_S

[PATCH v3 0/3] Allow user space to restrict and augment MSR emulation

2020-07-31 Thread Alexander Graf
- Add test to clear whitelist - Adjust to reply-less API - Fix asserts - Actually trap on MSR_IA32_POWER_CTL writes Alexander Graf (3): KVM: x86: Deflect unknown MSR accesses to user space KVM: x86: Introduce allow list for MSR emulation KVM: selftests: Add test for user space MSR ha

Re: [PATCH v2 2/3] KVM: x86: Introduce allow list for MSR emulation

2020-07-31 Thread Alexander Graf
On 30.07.20 10:59, Vitaly Kuznetsov wrote: Alexander Graf writes: It's not desireable to have all MSRs always handled by KVM kernel space. Some MSRs would be useful to handle in user space to either emulate behavior (like uCode updates) or differentiate whether they are valid based

Re: [PATCH v2 1/3] KVM: x86: Deflect unknown MSR accesses to user space

2020-07-31 Thread Alexander Graf
PM Alexander Graf wrote: Do you have a particular situation in mind where that would not be the case and where we would still want to actually complete an MSR operation after the environment changed? As far as userspace is concerned, if it has replied with error=0, the instruction has completed

Re: [PATCH v2 1/3] KVM: x86: Deflect unknown MSR accesses to user space

2020-07-30 Thread Alexander Graf
On 31.07.20 00:42, Jim Mattson wrote: On Wed, Jul 29, 2020 at 4:59 PM Alexander Graf wrote: MSRs are weird. Some of them are normal control registers, such as EFER. Some however are registers that really are model specific, not very interesting to virtualization workloads

[PATCH] KVM: arm: Add trace name for ARM_NISV

2020-07-30 Thread Alexander Graf
n readable names to these exit reasons inside the trace log. Let's fix that up after the fact, so that trace logs are pretty even when we get user space MMIO traps on ARM. Fixes: c726200dd106d ("KVM: arm/arm64: Allow reporting non-ISV data aborts to userspace") Signed-off-by: Alexande

[PATCH v2 2/3] KVM: x86: Introduce allow list for MSR emulation

2020-07-29 Thread Alexander Graf
is populated, MSR handling stays identical to before. Signed-off-by: KarimAllah Ahmed Signed-off-by: Alexander Graf --- Documentation/virt/kvm/api.rst | 53 ++ arch/x86/include/asm/kvm_host.h | 10 +++ arch/x86/include/uapi/asm/kvm.h | 15 arch/x86/kvm/x86.c | 123

[PATCH v2 1/3] KVM: x86: Deflect unknown MSR accesses to user space

2020-07-29 Thread Alexander Graf
the existing "ignore_msrs" logic with something that applies per-VM rather than on the full system. That way you can run productive VMs in parallel to experimental ones where you don't care about proper MSR handling. Signed-off-by: Alexander Graf --- v1 -> v2: - s/ETRAP_TO_USER_S

[PATCH v2 3/3] KVM: selftests: Add test for user space MSR handling

2020-07-29 Thread Alexander Graf
Now that we have the ability to handle MSRs from user space and also to select which ones we do want to prevent in-kernel KVM code from handling, let's add a selftest to show case and verify the API. Signed-off-by: Alexander Graf --- tools/testing/selftests/kvm/Makefile | 1

[PATCH v2 0/3] Allow user space to restrict and augment MSR emulation

2020-07-29 Thread Alexander Graf
space trapping allows us to emulate arbitrary MSRs in user space, paving the way for target CPU specific MSR implementations from user space. Alexander Graf (3): KVM: x86: Deflect unknown MSR accesses to user space KVM: x86: Introduce allow list for MSR emulation KVM: selftests: Add test

Re: [PATCH] KVM: x86: Deflect unknown MSR accesses to user space

2020-07-29 Thread Alexander Graf
On 29.07.20 22:37, Jim Mattson wrote: On Wed, Jul 29, 2020 at 1:29 PM Alexander Graf wrote: Meanwhile, I have cleaned up Karim's old patch to add allow listing to KVM and would post it if Aaron doesn't beat me to it :). Ideally, this becomes a collaboration rather than a race

Re: [PATCH] KVM: x86: Deflect unknown MSR accesses to user space

2020-07-29 Thread Alexander Graf
On 29.07.20 20:27, Jim Mattson wrote: CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe. On Wed, Jul 29, 2020 at 2:06 AM Alexander Graf wrote: On 28.07.20 19:13, Jim

Re: [PATCH] KVM: x86: Deflect unknown MSR accesses to user space

2020-07-29 Thread Alexander Graf
On 29.07.20 11:22, Vitaly Kuznetsov wrote: CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe. Alexander Graf writes: On 29.07.20 10:23, Vitaly Kuznetsov wrote: Jim

Re: [PATCH] KVM: x86: Deflect unknown MSR accesses to user space

2020-07-29 Thread Alexander Graf
On 29.07.20 10:23, Vitaly Kuznetsov wrote: Jim Mattson writes: On Tue, Jul 28, 2020 at 5:41 AM Alexander Graf wrote: ... While it does feel a bit overengineered, it would solve the problem that we're turning in-KVM handled MSRs into an ABI. It seems unlikely that userspace

Re: [PATCH] KVM: x86: Deflect unknown MSR accesses to user space

2020-07-29 Thread Alexander Graf
On 28.07.20 19:13, Jim Mattson wrote: CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe. On Tue, Jul 28, 2020 at 5:41 AM Alexander Graf wrote: On 28.07.20 10:15

Re: [PATCH] KVM: x86: Deflect unknown MSR accesses to user space

2020-07-28 Thread Alexander Graf
On 28.07.20 10:15, Vitaly Kuznetsov wrote: Alexander Graf writes: MSRs are weird. Some of them are normal control registers, such as EFER. Some however are registers that really are model specific, not very interesting to virtualization workloads, and not performance critical. Others

[PATCH] KVM: x86: Deflect unknown MSR accesses to user space

2020-07-27 Thread Alexander Graf
the existing "ignore_msrs" logic with something that applies per-VM rather than on the full system. That way you can run productive VMs in parallel to experimental ones where you don't care about proper MSR handling. Signed-off-by: Alexander Graf --- As a quick example to show what th

Re: [PATCH v5 01/18] nitro_enclaves: Add ioctl interface definition

2020-07-23 Thread Alexander Graf
On 23.07.20 20:21, Paraschiv, Andra-Irina wrote: On 23/07/2020 13:54, Greg KH wrote: On Thu, Jul 23, 2020 at 12:23:56PM +0300, Paraschiv, Andra-Irina wrote: On 22/07/2020 12:57, Greg KH wrote: On Wed, Jul 22, 2020 at 11:27:29AM +0300, Paraschiv, Andra-Irina wrote: +#ifndef

Re: [PATCH v5 05/18] nitro_enclaves: Handle PCI device command requests

2020-07-21 Thread Alexander Graf
...@intel.com/ Reported-by: kbuild test robot This means that the overall patch is a fix that was reported by the test rebot. I doubt that's what you mean. Just remove the line. Signed-off-by: Andra Paraschiv Reviewed-by: Alexander Graf Alex Amazon Development Center Germany GmbH

Re: [PATCH v5 04/18] nitro_enclaves: Init PCI device driver

2020-07-20 Thread Alexander Graf
support for MSI-X interrupts. Signed-off-by: Alexandru-Catalin Vasile Signed-off-by: Alexandru Ciobotaru Signed-off-by: Andra Paraschiv Reviewed-by: Alexander Graf Alex Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan

Re: [PATCH v4 11/18] nitro_enclaves: Add logic for enclave memory region set

2020-07-09 Thread Alexander Graf
On 09.07.20 09:36, Paraschiv, Andra-Irina wrote: On 06/07/2020 13:46, Alexander Graf wrote: On 22.06.20 22:03, Andra Paraschiv wrote: Another resource that is being set for an enclave is memory. User space memory regions, that need to be backed by contiguous memory regions

Re: [PATCH v4 16/18] nitro_enclaves: Add sample for ioctl interface usage

2020-07-06 Thread Alexander Graf
On 22.06.20 22:03, Andra Paraschiv wrote: Signed-off-by: Alexandru Vasile Signed-off-by: Andra Paraschiv --- Changelog v3 -> v4 * Update usage details to match the updates in v4. * Update NE ioctl interface usage. v2 -> v3 * Remove the include directory to use the uapi from the kernel.

Re: [PATCH v4 15/18] nitro_enclaves: Add Makefile for the Nitro Enclaves driver

2020-07-06 Thread Alexander Graf
On 22.06.20 22:03, Andra Paraschiv wrote: Signed-off-by: Andra Paraschiv Reviewed-by: Alexander Graf Alex Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB

Re: [PATCH v4 14/18] nitro_enclaves: Add Kconfig for the Nitro Enclaves driver

2020-07-06 Thread Alexander Graf
On 22.06.20 22:03, Andra Paraschiv wrote: Signed-off-by: Andra Paraschiv --- Changelog v3 -> v4 * Add PCI and SMP dependencies. v2 -> v3 * Remove the GPL additional wording as SPDX-License-Identifier is already in place. v1 -> v2 * Update path to Kconfig to match the

Re: [PATCH v4 13/18] nitro_enclaves: Add logic for enclave termination

2020-07-06 Thread Alexander Graf
termination, that is mapped to the enclave fd release callback. Free the internal enclave info used for bookkeeping. Signed-off-by: Alexandru Vasile Signed-off-by: Andra Paraschiv Reviewed-by: Alexander Graf Alex Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin

Re: [PATCH v4 12/18] nitro_enclaves: Add logic for enclave start

2020-07-06 Thread Alexander Graf
On 22.06.20 22:03, Andra Paraschiv wrote: After all the enclave resources are set, the enclave is ready for beginning to run. Add ioctl command logic for starting an enclave after all its resources, memory regions and CPUs, have been set. The enclave start information includes the local

Re: [PATCH v4 11/18] nitro_enclaves: Add logic for enclave memory region set

2020-07-06 Thread Alexander Graf
On 22.06.20 22:03, Andra Paraschiv wrote: Another resource that is being set for an enclave is memory. User space memory regions, that need to be backed by contiguous memory regions, are associated with the enclave. One solution for allocating / reserving contiguous memory regions, that is

Re: [PATCH v4 10/18] nitro_enclaves: Add logic for enclave image load info

2020-07-06 Thread Alexander Graf
On 22.06.20 22:03, Andra Paraschiv wrote: Before setting the memory regions for the enclave, the enclave image needs to be placed in memory. After the memory regions are set, this memory cannot be used anymore by the VM, being carved out. Add ioctl command logic to get the offset in enclave

Re: [PATCH v4 09/18] nitro_enclaves: Add logic for enclave vcpu creation

2020-07-06 Thread Alexander Graf
On 22.06.20 22:03, Andra Paraschiv wrote: An enclave, before being started, has its resources set. One of its resources is CPU. The NE CPU pool is set for choosing CPUs for enclaves from it. Offline the CPUs from the NE CPU pool during the pool setup and online them back during the NE CPU

Re: [PATCH v4 07/18] nitro_enclaves: Init misc device providing the ioctl interface

2020-07-06 Thread Alexander Graf
On 06.07.20 09:49, Paraschiv, Andra-Irina wrote: On 06/07/2020 10:13, Alexander Graf wrote: On 22.06.20 22:03, Andra Paraschiv wrote: The Nitro Enclaves driver provides an ioctl interface to the user space for enclave lifetime management e.g. enclave creation / termination and setting

Re: [PATCH v4 08/18] nitro_enclaves: Add logic for enclave vm creation

2020-07-06 Thread Alexander Graf
. Signed-off-by: Alexandru Vasile Signed-off-by: Andra Paraschiv Reviewed-by: Alexander Graf Alex Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz

Re: [PATCH v4 07/18] nitro_enclaves: Init misc device providing the ioctl interface

2020-07-06 Thread Alexander Graf
On 22.06.20 22:03, Andra Paraschiv wrote: The Nitro Enclaves driver provides an ioctl interface to the user space for enclave lifetime management e.g. enclave creation / termination and setting enclave resources such as memory and CPU. This ioctl interface is mapped to a Nitro Enclaves misc

Re: [PATCH v4 02/18] nitro_enclaves: Define the PCI device interface

2020-07-02 Thread Alexander Graf
by this device. Add an internal data structure used as private data for the PCI device driver and the functions for the PCI device init / uninit and command requests handling. Signed-off-by: Alexandru-Catalin Vasile Signed-off-by: Alexandru Ciobotaru Signed-off-by: Andra Paraschiv Reviewed-by: Alexander

Re: [PATCH v4 01/18] nitro_enclaves: Add ioctl interface definition

2020-07-02 Thread Alexander Graf
running in the VM that launched it. The process interacts with the NE driver, that exposes an ioctl interface for creating an enclave and setting up its resources. Signed-off-by: Alexandru Vasile Signed-off-by: Andra Paraschiv Reviewed-by: Alexander Graf Alex Amazon Development Center Germany

Re: [PATCH v4 06/18] nitro_enclaves: Handle out-of-band PCI device events

2020-07-02 Thread Alexander Graf
On 22.06.20 22:03, Andra Paraschiv wrote: In addition to the replies sent by the Nitro Enclaves PCI device in response to command requests, out-of-band enclave events can happen e.g. an enclave crashes. In this case, the Nitro Enclaves driver needs to be aware of the event and notify the

Re: [PATCH v4 03/18] nitro_enclaves: Define enclave info for internal bookkeeping

2020-07-02 Thread Alexander Graf
. Signed-off-by: Alexandru-Catalin Vasile Signed-off-by: Andra Paraschiv Reviewed-by: Alexander Graf Alex Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B

Re: [PATCH v4 05/18] nitro_enclaves: Handle PCI device command requests

2020-07-02 Thread Alexander Graf
On 22.06.20 22:03, Andra Paraschiv wrote: The Nitro Enclaves PCI device exposes a MMIO space that this driver uses to submit command requests and to receive command replies e.g. for enclave creation / termination or setting enclave resources. Add logic for handling PCI device command

Re: [PATCH v4 04/18] nitro_enclaves: Init PCI device driver

2020-07-02 Thread Alexander Graf
On 22.06.20 22:03, Andra Paraschiv wrote: The Nitro Enclaves PCI device is used by the kernel driver as a means of communication with the hypervisor on the host where the primary VM and the enclaves run. It handles requests with regard to enclave lifetime. Setup the PCI device driver and add

[PATCH] KVM: arm64: Change default caching mode for {PEND,PROP}BASER.outer

2020-07-01 Thread Alexander Graf
the outer mode to be set to SameAsInner explicitly, so the easy fix is to default to that instead of nC for situations when an OS asks for a not fulfillable cachability request. This fixes booting Windows in KVM with vgicv3 and ITS enabled for me. Signed-off-by: Alexander Graf --- arch/arm64/kvm/vgic

Re: [PATCH v3 07/18] nitro_enclaves: Init misc device providing the ioctl interface

2020-06-09 Thread Alexander Graf
On 01.06.20 05:04, Benjamin Herrenschmidt wrote: On Thu, 2020-05-28 at 15:12 +0200, Greg KH wrote: So at runtime, after all is booted and up and going, you just ripped cores out from under someone's feet? :) And the code really handles writing to that value while the module is already

Re: [PATCH v3 07/18] nitro_enclaves: Init misc device providing the ioctl interface

2020-05-28 Thread Alexander Graf
On 27.05.20 00:24, Greg KH wrote: On Tue, May 26, 2020 at 03:44:30PM +0200, Alexander Graf wrote: On 26.05.20 15:17, Greg KH wrote: On Tue, May 26, 2020 at 02:44:18PM +0200, Alexander Graf wrote: On 26.05.20 14:33, Greg KH wrote: On Tue, May 26, 2020 at 01:42:41PM +0200, Alexander

Re: [PATCH v3 07/18] nitro_enclaves: Init misc device providing the ioctl interface

2020-05-26 Thread Alexander Graf
On 26.05.20 15:17, Greg KH wrote: On Tue, May 26, 2020 at 02:44:18PM +0200, Alexander Graf wrote: On 26.05.20 14:33, Greg KH wrote: On Tue, May 26, 2020 at 01:42:41PM +0200, Alexander Graf wrote: On 26.05.20 08:51, Greg KH wrote: On Tue, May 26, 2020 at 01:13:23AM +0300, Andra

Re: [PATCH v3 07/18] nitro_enclaves: Init misc device providing the ioctl interface

2020-05-26 Thread Alexander Graf
On 26.05.20 14:33, Greg KH wrote: On Tue, May 26, 2020 at 01:42:41PM +0200, Alexander Graf wrote: On 26.05.20 08:51, Greg KH wrote: On Tue, May 26, 2020 at 01:13:23AM +0300, Andra Paraschiv wrote: +#define NE "nitro_enclaves: " Again, no need for this. +#define N

Re: [PATCH v3 07/18] nitro_enclaves: Init misc device providing the ioctl interface

2020-05-26 Thread Alexander Graf
On 26.05.20 08:51, Greg KH wrote: On Tue, May 26, 2020 at 01:13:23AM +0300, Andra Paraschiv wrote: +#define NE "nitro_enclaves: " Again, no need for this. +#define NE_DEV_NAME "nitro_enclaves" KBUILD_MODNAME? +#define NE_IMAGE_LOAD_OFFSET (8 * 1024UL * 1024UL) + +static char

Re: [PATCH v2 04/18] nitro_enclaves: Init PCI device driver

2020-05-23 Thread Alexander Graf
Hey Greg, On 22.05.20 09:04, Greg KH wrote: On Fri, May 22, 2020 at 09:29:32AM +0300, Andra Paraschiv wrote: +/** + * ne_setup_msix - Setup MSI-X vectors for the PCI device. + * + * @pdev: PCI device to setup the MSI-X for. + * + * @returns: 0 on success, negative return value on failure. +

Re: [PATCH v2] KVM: nVMX: Skip IBPB when switching between vmcs01 and vmcs02

2020-05-04 Thread Alexander Graf
on current systems. Reported-by: Alexander Graf Cc: KarimAllah Raslan Cc: sta...@vger.kernel.org Fixes: 15d45071523d ("KVM/x86: Add IBPB support") Signed-off-by: Sean Christopherson --- v2: Pass a boolean to indicate a nested VMCS switch and instead WARN if the buddy VMCS is n

Re: [PATCH] KVM: nVMX: Skip IBPB when switching between vmcs01 and vmcs02

2020-04-30 Thread Alexander Graf
on current systems. Reported-by: Alexander Graf Cc: KarimAllah Raslan Cc: sta...@vger.kernel.org Fixes: 15d45071523d ("KVM/x86: Add IBPB support") Signed-off-by: Sean Christopherson I can confirm that with kvm-unit-test's vmcall benchmark, the patch does make a big difference: BEFO

Re: [PATCH v1 00/15] Add support for Nitro Enclaves

2020-04-30 Thread Alexander Graf
On 30.04.20 13:58, Paolo Bonzini wrote: On 30/04/20 13:47, Alexander Graf wrote: So the issue would be that a firmware image provided by the parent could be tampered with by something malicious running in the parent enclave? You have to have a root of trust somewhere. That root

Re: [PATCH v1 00/15] Add support for Nitro Enclaves

2020-04-30 Thread Alexander Graf
On 30.04.20 13:38, Paolo Bonzini wrote: On 30/04/20 13:21, Alexander Graf wrote: Also, would you consider a mode where ne_load_image is not invoked and the enclave starts in real mode at 0xff0? Consider, sure. But I don't quite see any big benefit just yet. The current abstraction

Re: [PATCH v1 00/15] Add support for Nitro Enclaves

2020-04-30 Thread Alexander Graf
On 30.04.20 12:34, Paolo Bonzini wrote: On 28/04/20 17:07, Alexander Graf wrote: Why don't we build something like the following instead? vm = ne_create(vcpus = 4) ne_set_memory(vm, hva, len) ne_load_image(vm, addr, len) ne_start(vm) That way we would get the EIF loading

Re: [PATCH v1 00/15] Add support for Nitro Enclaves

2020-04-28 Thread Alexander Graf
On 27.04.20 13:44, Liran Alon wrote: On 27/04/2020 10:56, Paraschiv, Andra-Irina wrote: On 25/04/2020 18:25, Liran Alon wrote: On 23/04/2020 16:19, Paraschiv, Andra-Irina wrote: The memory and CPUs are carved out of the primary VM, they are dedicated for the enclave. The Nitro

Re: [PATCH v1 00/15] Add support for Nitro Enclaves

2020-04-28 Thread Alexander Graf
On 25.04.20 18:05, Paolo Bonzini wrote: CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe. On 24/04/20 21:11, Alexander Graf wrote: What I was saying above is that maybe

Re: [PATCH v7 18/21] RISC-V: KVM: Add SBI v0.1 support

2019-09-23 Thread Alexander Graf
On 04.09.19 18:16, Anup Patel wrote: From: Atish Patra The KVM host kernel running in HS-mode needs to handle SBI calls coming from guest kernel running in VS-mode. This patch adds SBI v0.1 support in KVM RISC-V. All the SBI calls are implemented correctly except remote tlb flushes. For

Re: [PATCH v7 11/21] RISC-V: KVM: Handle WFI exits for VCPU

2019-09-23 Thread Alexander Graf
On 04.09.19 18:15, Anup Patel wrote: We get illegal instruction trap whenever Guest/VM executes WFI instruction. This patch handles WFI trap by blocking the trapped VCPU using kvm_vcpu_block() API. The blocked VCPU will be automatically resumed whenever a VCPU interrupt is injected from

Re: [PATCH v7 10/21] RISC-V: KVM: Handle MMIO exits for VCPU

2019-09-23 Thread Alexander Graf
. Reviewed-by: Alexander Graf Alex Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879

Re: [PATCH v7 06/21] RISC-V: KVM: Implement VCPU create, init and destroy functions

2019-09-23 Thread Alexander Graf
On 04.09.19 18:14, Anup Patel wrote: This patch implements VCPU create, init and destroy functions required by generic KVM module. We don't have much dynamic resources in struct kvm_vcpu_arch so thest functions are quite Since you're respinning for v8 anyway, please s/thest/these/ :) Alex

Re: [PATCH 1/1] KVM: inject data abort if instruction cannot be decoded

2019-09-06 Thread Alexander Graf
On 06.09.19 15:50, Peter Maydell wrote: On Fri, 6 Sep 2019 at 14:41, Alexander Graf wrote: On 06.09.19 15:31, Peter Maydell wrote: (b) we try to reuse the code we already have that does TCG exception injection, which might or might not be a design mistake, and That's probably a design

Re: [PATCH 1/1] KVM: inject data abort if instruction cannot be decoded

2019-09-06 Thread Alexander Graf
On 06.09.19 15:31, Peter Maydell wrote: On Fri, 6 Sep 2019 at 14:13, Christoffer Dall wrote: I'd prefer leaving it to userspace to worry about, but I thought Peter said that had been problematic historically, which I took at face value, but I could have misunderstood. If QEMU, kvmtool, and

[PATCH v3] KVM: x86: Disable posted interrupts for odd IRQs

2019-09-05 Thread Alexander Graf
This fixes a bug I have with code which configures real hardware to inject virtual SMIs into my guest. Signed-off-by: Alexander Graf --- v1 -> v2: - Make error message more unique - Update commit message to point to __apic_accept_irq() v2 -> v3: - Use if() rather than switch()

Re: [PATCH v2 1/2] KVM: VMX: Disable posted interrupts for odd IRQs

2019-09-04 Thread Alexander Graf
On 04.09.19 17:51, Sean Christopherson wrote: On Wed, Sep 04, 2019 at 05:36:39PM +0200, Alexander Graf wrote: On 04.09.19 16:40, Sean Christopherson wrote: On Wed, Sep 04, 2019 at 03:35:10PM +0200, Alexander Graf wrote: We can easily route hardware interrupts directly into VM context when

Re: [PATCH v2 1/2] KVM: VMX: Disable posted interrupts for odd IRQs

2019-09-04 Thread Alexander Graf
On 04.09.19 16:40, Sean Christopherson wrote: On Wed, Sep 04, 2019 at 03:35:10PM +0200, Alexander Graf wrote: We can easily route hardware interrupts directly into VM context when they target the "Fixed" or "LowPriority" delivery modes. However, on modes such as &quo

[PATCH v2 1/2] KVM: VMX: Disable posted interrupts for odd IRQs

2019-09-04 Thread Alexander Graf
This fixes a bug I have with code which configures real hardware to inject virtual SMIs into my guest. Signed-off-by: Alexander Graf Reviewed-by: Liran Alon --- v1 -> v2: - Make error message more unique - Update commit message to point to __apic_accept_irq() --- arch/x86/kvm/vmx/vmx.c | 22

[PATCH v2 0/2] KVM: Only use posted interrupts for Fixed/LowPrio MSIs

2019-09-04 Thread Alexander Graf
to fix the situation for x86 systems. If anyone has a great idea how to generalize the filtering though, I'm all ears. Alex --- v1 -> v2: - Make error message more unique - Update commit message to point to __apic_accept_irq() Alexander Graf (2): KVM: VMX: Disable posted interrupts

[PATCH v2 2/2] KVM: SVM: Disable posted interrupts for odd IRQs

2019-09-04 Thread Alexander Graf
This fixes a bug I have with code which configures real hardware to inject virtual SMIs into my guest. Signed-off-by: Alexander Graf Reviewed-by: Liran Alon --- v1 -> v2: - Make error message more unique - Update commit message to point to __apic_accept_irq() --- arch/x86/kvm/svm.c | 16

Re: [PATCH 2/2] KVM: SVM: Disable posted interrupts for odd IRQs

2019-09-04 Thread Alexander Graf
On 04.09.19 01:20, Liran Alon wrote: On 3 Sep 2019, at 17:29, Alexander Graf wrote: We can easily route hardware interrupts directly into VM context when they target the "Fixed" or "LowPriority" delivery modes. However, on modes such as "SMI" or &quo

[PATCH 2/2] KVM: SVM: Disable posted interrupts for odd IRQs

2019-09-03 Thread Alexander Graf
n, so we can not post the interrupt Add code in the SVM PI logic to explicitly refuse to establish posted mappings for advanced IRQ deliver modes. This fixes a bug I have with code which configures real hardware to inject virtual SMIs into my guest. Signed-off-by: Alexander Graf --- arch/x86

[PATCH 0/2] KVM: Only use posted interrupts for Fixes/LowPrio MSIs

2019-09-03 Thread Alexander Graf
to fix the situation for x86 systems. If anyone has a great idea how to generalize the filtering though, I'm all ears. Alex Alexander Graf (2): KVM: VMX: Disable posted interrupts for odd IRQs KVM: SVM: Disable posted interrupts for odd IRQs arch/x86/kvm/svm.c | 16 arch/x8

[PATCH 1/2] KVM: VMX: Disable posted interrupts for odd IRQs

2019-09-03 Thread Alexander Graf
n, so we can not post the interrupt Add code in the VMX PI logic to explicitly refuse to establish posted mappings for advanced IRQ deliver modes. This fixes a bug I have with code which configures real hardware to inject virtual SMIs into my guest. Signed-off-by: Alexander Graf --- arch/x86/kvm/

Re: [PATCH v2 12/15] kvm: i8254: Check LAPIC EOI pending when injecting irq on SVM AVIC

2019-08-27 Thread Alexander Graf
On 26.08.19 22:46, Suthikulpanit, Suravee wrote: Alex, On 8/19/2019 5:42 AM, Alexander Graf wrote: On 15.08.19 18:25, Suthikulpanit, Suravee wrote: ACK notifiers don't work with AMD SVM w/ AVIC when the PIT interrupt is delivered as edge-triggered fixed interrupt since AMD processors

Re: [PATCH v2 04/15] kvm: x86: Add per-VM APICv state debugfs

2019-08-27 Thread Alexander Graf
On 26.08.19 21:41, Suthikulpanit, Suravee wrote: Alex, On 8/19/2019 4:57 AM, Alexander Graf wrote: On 15.08.19 18:25, Suthikulpanit, Suravee wrote: Currently, there is no way to tell whether APICv is active on a particular VM. This often cause confusion since APICv can be deactivated

Re: [PATCH v2 06/15] kvm: x86: Add support for activate/de-activate APICv at runtime

2019-08-27 Thread Alexander Graf
On 27.08.19 09:29, Vitaly Kuznetsov wrote: "Suthikulpanit, Suravee" writes: Certain runtime conditions require APICv to be temporary deactivated. However, current implementation only support permanently deactivate APICv at runtime (mainly used when running Hyper-V guest). In addtion, for

Re: [PATCH v5 00/20] KVM RISC-V Support

2019-08-23 Thread Alexander Graf
On 23.08.19 14:19, Anup Patel wrote: On Fri, Aug 23, 2019 at 5:40 PM Paolo Bonzini wrote: On 23/08/19 13:44, Graf (AWS), Alexander wrote: Overall, I'm quite happy with the code. It's a very clean implementation of a KVM target. Yup, I said the same even for v1 (I prefer recursive

Re: [PATCH v5 15/20] RISC-V: KVM: Add timer functionality

2019-08-23 Thread Alexander Graf
On 23.08.19 14:11, Anup Patel wrote: On Fri, Aug 23, 2019 at 5:19 PM Alexander Graf wrote: On 23.08.19 13:46, Anup Patel wrote: On Fri, Aug 23, 2019 at 5:03 PM Graf (AWS), Alexander wrote: Am 23.08.2019 um 13:05 schrieb Anup Patel : On Fri, Aug 23, 2019 at 1:23 PM Alexander Graf

Re: [PATCH v5 18/20] RISC-V: KVM: Add SBI v0.1 support

2019-08-23 Thread Alexander Graf
On 23.08.19 14:00, Anup Patel wrote: On Fri, Aug 23, 2019 at 5:09 PM Graf (AWS), Alexander wrote: Am 23.08.2019 um 13:18 schrieb Anup Patel : On Fri, Aug 23, 2019 at 1:34 PM Alexander Graf wrote: On 22.08.19 10:46, Anup Patel wrote: From: Atish Patra The KVM host kernel running

Re: [PATCH v5 15/20] RISC-V: KVM: Add timer functionality

2019-08-23 Thread Alexander Graf
On 23.08.19 13:46, Anup Patel wrote: On Fri, Aug 23, 2019 at 5:03 PM Graf (AWS), Alexander wrote: Am 23.08.2019 um 13:05 schrieb Anup Patel : On Fri, Aug 23, 2019 at 1:23 PM Alexander Graf wrote: On 22.08.19 10:46, Anup Patel wrote: From: Atish Patra The RISC-V hypervisor

Re: [PATCH v5 00/20] KVM RISC-V Support

2019-08-23 Thread Alexander Graf
stage2 page table programing 4. SBI v0.2 emulation in-kernel 5. SBI v0.2 hart hotplug emulation in-kernel 6. In-kernel PLIC emulation 7. . and more . Please consider patches I did not comment on as Reviewed-by: Alexander Graf Overall, I'm quite happy with the code. It's a very clean

Re: [PATCH v5 18/20] RISC-V: KVM: Add SBI v0.1 support

2019-08-23 Thread Alexander Graf
On 22.08.19 10:46, Anup Patel wrote: From: Atish Patra The KVM host kernel running in HS-mode needs to handle SBI calls coming from guest kernel running in VS-mode. This patch adds SBI v0.1 support in KVM RISC-V. All the SBI calls are implemented correctly except remote tlb flushes. For

Re: [PATCH v5 15/20] RISC-V: KVM: Add timer functionality

2019-08-23 Thread Alexander Graf
On 22.08.19 10:46, Anup Patel wrote: From: Atish Patra The RISC-V hypervisor specification doesn't have any virtual timer feature. Due to this, the guest VCPU timer will be programmed via SBI calls. The host will use a separate hrtimer event for each guest VCPU to provide timer functionality.

Re: [PATCH v5 08/20] RISC-V: KVM: Implement KVM_GET_ONE_REG/KVM_SET_ONE_REG ioctls

2019-08-22 Thread Alexander Graf
On 22.08.19 16:00, Anup Patel wrote: On Thu, Aug 22, 2019 at 5:31 PM Alexander Graf wrote: On 22.08.19 10:44, Anup Patel wrote: For KVM RISC-V, we use KVM_GET_ONE_REG/KVM_SET_ONE_REG ioctls to access VCPU config and registers from user-space. We have three types of VCPU registers: 1

Re: [PATCH v5 13/20] RISC-V: KVM: Implement stage2 page table programming

2019-08-22 Thread Alexander Graf
On 22.08.19 15:58, Anup Patel wrote: On Thu, Aug 22, 2019 at 6:57 PM Alexander Graf wrote: On 22.08.19 14:38, Anup Patel wrote: On Thu, Aug 22, 2019 at 5:58 PM Alexander Graf wrote: On 22.08.19 10:45, Anup Patel wrote: This patch implements all required functions for programming

Re: [PATCH v5 13/20] RISC-V: KVM: Implement stage2 page table programming

2019-08-22 Thread Alexander Graf
On 22.08.19 14:38, Anup Patel wrote: On Thu, Aug 22, 2019 at 5:58 PM Alexander Graf wrote: On 22.08.19 10:45, Anup Patel wrote: This patch implements all required functions for programming the stage2 page table for each Guest/VM. At high-level, the flow of stage2 related functions

Re: [PATCH v5 10/20] RISC-V: KVM: Handle MMIO exits for VCPU

2019-08-22 Thread Alexander Graf
On 22.08.19 14:33, Anup Patel wrote: On Thu, Aug 22, 2019 at 5:44 PM Alexander Graf wrote: On 22.08.19 10:44, Anup Patel wrote: We will get stage2 page faults whenever Guest/VM access SW emulated MMIO device or unmapped Guest RAM. This patch implements MMIO read/write emulation

Re: [PATCH v5 13/20] RISC-V: KVM: Implement stage2 page table programming

2019-08-22 Thread Alexander Graf
On 22.08.19 10:45, Anup Patel wrote: This patch implements all required functions for programming the stage2 page table for each Guest/VM. At high-level, the flow of stage2 related functions is similar from KVM ARM/ARM64 implementation but the stage2 page table format is quite different for KVM

Re: [PATCH v5 11/20] RISC-V: KVM: Handle WFI exits for VCPU

2019-08-22 Thread Alexander Graf
On 22.08.19 10:45, Anup Patel wrote: We get illegal instruction trap whenever Guest/VM executes WFI instruction. This patch handles WFI trap by blocking the trapped VCPU using kvm_vcpu_block() API. The blocked VCPU will be automatically resumed whenever a VCPU interrupt is injected from

Re: [PATCH v5 10/20] RISC-V: KVM: Handle MMIO exits for VCPU

2019-08-22 Thread Alexander Graf
On 22.08.19 10:44, Anup Patel wrote: We will get stage2 page faults whenever Guest/VM access SW emulated MMIO device or unmapped Guest RAM. This patch implements MMIO read/write emulation by extracting MMIO details from the trapped load/store instruction and forwarding the MMIO read/write to

Re: [PATCH v5 10/20] RISC-V: KVM: Handle MMIO exits for VCPU

2019-08-22 Thread Alexander Graf
On 22.08.19 10:44, Anup Patel wrote: We will get stage2 page faults whenever Guest/VM access SW emulated MMIO device or unmapped Guest RAM. This patch implements MMIO read/write emulation by extracting MMIO details from the trapped load/store instruction and forwarding the MMIO read/write to

Re: [PATCH v5 08/20] RISC-V: KVM: Implement KVM_GET_ONE_REG/KVM_SET_ONE_REG ioctls

2019-08-22 Thread Alexander Graf
On 22.08.19 10:44, Anup Patel wrote: For KVM RISC-V, we use KVM_GET_ONE_REG/KVM_SET_ONE_REG ioctls to access VCPU config and registers from user-space. We have three types of VCPU registers: 1. CONFIG - these are VCPU config and capabilities 2. CORE - these are VCPU general purpose registers

Re: [PATCH v2 14/15] kvm: ioapic: Delay update IOAPIC EOI for RTC

2019-08-19 Thread Alexander Graf
On 15.08.19 18:25, Suthikulpanit, Suravee wrote: In-kernel IOAPIC does not update RTC pending EOI info with AMD SVM /w AVIC when interrupt is delivered as edge-triggered since AMD processors cannot exit on EOI for these interrupts. Add code to also check LAPIC pending EOI before injecting

Re: [PATCH v2 12/15] kvm: i8254: Check LAPIC EOI pending when injecting irq on SVM AVIC

2019-08-19 Thread Alexander Graf
On 15.08.19 18:25, Suthikulpanit, Suravee wrote: ACK notifiers don't work with AMD SVM w/ AVIC when the PIT interrupt is delivered as edge-triggered fixed interrupt since AMD processors cannot exit on EOI for these interrupts. Add code to check LAPIC pending EOI before injecting any pending

Re: [PATCH v2 11/15] svm: Temporary deactivate AVIC during ExtINT handling

2019-08-19 Thread Alexander Graf
On 15.08.19 18:25, Suthikulpanit, Suravee wrote: AMD AVIC does not support ExtINT. Therefore, AVIC must be temporary deactivated and fall back to using legacy interrupt injection via vINTR and interrupt window. Signed-off-by: Suravee Suthikulpanit --- arch/x86/kvm/svm.c | 49

Re: [PATCH v2 10/15] kvm: x86: hyperv: Use APICv deactivate request interface

2019-08-19 Thread Alexander Graf
On 15.08.19 18:25, Suthikulpanit, Suravee wrote: Since disabling APICv has to be done for all vcpus on AMD-based system, adopt the newly introduced kvm_make_apicv_deactivate_request() intereface. typo Signed-off-by: Suravee Suthikulpanit --- arch/x86/kvm/hyperv.c | 12 ++-- 1

Re: [PATCH v2 09/15] svm: Add support for activate/deactivate AVIC at runtime

2019-08-19 Thread Alexander Graf
On 15.08.19 18:25, Suthikulpanit, Suravee wrote: Add necessary logics for supporting activate/deactivate AVIC at runtime. Signed-off-by: Suravee Suthikulpanit --- arch/x86/kvm/svm.c | 27 +-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git

Re: [PATCH v2 04/15] kvm: x86: Add per-VM APICv state debugfs

2019-08-19 Thread Alexander Graf
On 15.08.19 18:25, Suthikulpanit, Suravee wrote: Currently, there is no way to tell whether APICv is active on a particular VM. This often cause confusion since APICv can be deactivated at runtime. Introduce a debugfs entry to report APICv state of a VM. This creates a read-only file:

Re: [PATCH v2 02/15] kvm: x86: Introduce KVM APICv state

2019-08-19 Thread Alexander Graf
On 15.08.19 18:25, Suthikulpanit, Suravee wrote: Currently, after a VM boots with APICv enabled, it could go into the following states: * activated = VM is running w/ APICv * deactivated = VM deactivate APICv (temporary) * disabled= VM deactivate APICv (permanent) Introduce

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-14 Thread Alexander Graf
On 12.07.19 16:36, Andy Lutomirski wrote: On Fri, Jul 12, 2019 at 6:45 AM Alexandre Chartre wrote: On 7/12/19 2:50 PM, Peter Zijlstra wrote: On Fri, Jul 12, 2019 at 01:56:44PM +0200, Alexandre Chartre wrote: I think that's precisely what makes ASI and PTI different and independent. PTI

<    1   2   3   4   5   6   7   8   9   >