Commit d68321de authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

Merge tag 'kvm-ppc-fixes-5.5-1' of...

Merge tag 'kvm-ppc-fixes-5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc into kvm-master

PPC KVM fix for 5.5

- Fix a bug where we try to do an ultracall on a system without an
  ultravisor.
parents 19a049f1 d89c69f4
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ The Definitive KVM (Kernel-based Virtual Machine) API Documentation
----------------------

The kvm API is a set of ioctls that are issued to control various aspects
of a virtual machine.  The ioctls belong to three classes:
of a virtual machine.  The ioctls belong to the following classes:

 - System ioctls: These query and set global attributes which affect the
   whole kvm subsystem.  In addition a system ioctl is used to create
@@ -3002,6 +3002,9 @@ can be determined by querying the KVM_CAP_GUEST_DEBUG_HW_BPS and
KVM_CAP_GUEST_DEBUG_HW_WPS capabilities which return a positive number
indicating the number of supported registers.

For ppc, the KVM_CAP_PPC_GUEST_DEBUG_SSTEP capability indicates whether
the single-step debug event (KVM_GUESTDBG_SINGLESTEP) is supported.

When debug events exit the main run loop with the reason
KVM_EXIT_DEBUG with the kvm_debug_exit_arch part of the kvm_run
structure containing architecture specific debug information.
@@ -4146,6 +4149,24 @@ Valid values for 'action':
#define KVM_PMU_EVENT_ALLOW 0
#define KVM_PMU_EVENT_DENY 1

4.121 KVM_PPC_SVM_OFF

Capability: basic
Architectures: powerpc
Type: vm ioctl
Parameters: none
Returns: 0 on successful completion,
Errors:
  EINVAL:    if ultravisor failed to terminate the secure guest
  ENOMEM:    if hypervisor failed to allocate new radix page tables for guest

This ioctl is used to turn off the secure mode of the guest or transition
the guest from secure mode to normal mode. This is invoked when the guest
is reset. This has no effect if called for a normal guest.

This ioctl issues an ultravisor call to terminate the secure guest,
unpins the VPA pages and releases all the device pages that are used to
track the secure pages by hypervisor.

5. The kvm_run structure
------------------------
+12 −2
Original line number Diff line number Diff line
@@ -3,9 +3,19 @@ XICS interrupt controller
Device type supported: KVM_DEV_TYPE_XICS

Groups:
  KVM_DEV_XICS_SOURCES
  1. KVM_DEV_XICS_GRP_SOURCES
  Attributes: One per interrupt source, indexed by the source number.

  2. KVM_DEV_XICS_GRP_CTRL
  Attributes:
    2.1 KVM_DEV_XICS_NR_SERVERS (write only)
  The kvm_device_attr.addr points to a __u32 value which is the number of
  interrupt server numbers (ie, highest possible vcpu id plus one).
  Errors:
    -EINVAL: Value greater than KVM_MAX_VCPU_ID.
    -EFAULT: Invalid user pointer for attr->addr.
    -EBUSY:  A vcpu is already connected to the device.

This device emulates the XICS (eXternal Interrupt Controller
Specification) defined in PAPR.  The XICS has a set of interrupt
sources, each identified by a 20-bit source number, and a set of
@@ -38,7 +48,7 @@ least-significant end of the word:

Each source has 64 bits of state that can be read and written using
the KVM_GET_DEVICE_ATTR and KVM_SET_DEVICE_ATTR ioctls, specifying the
KVM_DEV_XICS_SOURCES attribute group, with the attribute number being
KVM_DEV_XICS_GRP_SOURCES attribute group, with the attribute number being
the interrupt source number.  The 64 bit state word has the following
bitfields, starting from the least-significant end of the word:

+8 −0
Original line number Diff line number Diff line
@@ -78,6 +78,14 @@ the legacy interrupt mode, referred as XICS (POWER7/8).
    migrating the VM.
    Errors: none

    1.3 KVM_DEV_XIVE_NR_SERVERS (write only)
    The kvm_device_attr.addr points to a __u32 value which is the number of
    interrupt server numbers (ie, highest possible vcpu id plus one).
    Errors:
      -EINVAL: Value greater than KVM_MAX_VCPU_ID.
      -EFAULT: Invalid user pointer for attr->addr.
      -EBUSY:  A vCPU is already connected to the device.

  2. KVM_DEV_XIVE_GRP_SOURCE (write only)
  Initializes a new source in the XIVE device and mask it.
  Attributes:
+17 −0
Original line number Diff line number Diff line
@@ -451,6 +451,23 @@ config PPC_TRANSACTIONAL_MEM
	help
	  Support user-mode Transactional Memory on POWERPC.

config PPC_UV
	bool "Ultravisor support"
	depends on KVM_BOOK3S_HV_POSSIBLE
	select ZONE_DEVICE
	select DEV_PAGEMAP_OPS
	select DEVICE_PRIVATE
	select MEMORY_HOTPLUG
	select MEMORY_HOTREMOVE
	default n
	help
	  This option paravirtualizes the kernel to run in POWER platforms that
	  supports the Protected Execution Facility (PEF). On such platforms,
	  the ultravisor firmware runs at a privilege level above the
	  hypervisor.

	  If unsure, say "N".

config LD_HEAD_STUB_CATCH
	bool "Reserve 256 bytes to cope with linker stubs in HEAD text" if EXPERT
	depends on PPC64
+9 −0
Original line number Diff line number Diff line
@@ -342,6 +342,15 @@
#define H_TLB_INVALIDATE	0xF808
#define H_COPY_TOFROM_GUEST	0xF80C

/* Flags for H_SVM_PAGE_IN */
#define H_PAGE_IN_SHARED        0x1

/* Platform-specific hcalls used by the Ultravisor */
#define H_SVM_PAGE_IN		0xEF00
#define H_SVM_PAGE_OUT		0xEF04
#define H_SVM_INIT_START	0xEF08
#define H_SVM_INIT_DONE		0xEF0C

/* Values for 2nd argument to H_SET_MODE */
#define H_SET_MODE_RESOURCE_SET_CIABR		1
#define H_SET_MODE_RESOURCE_SET_DAWR		2
Loading