Skip to content

Commit 01227a8

Browse files
committed
Merge tag 'kvm-3.10-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull kvm updates from Gleb Natapov: "Highlights of the updates are: general: - new emulated device API - legacy device assignment is now optional - irqfd interface is more generic and can be shared between arches x86: - VMCS shadow support and other nested VMX improvements - APIC virtualization and Posted Interrupt hardware support - Optimize mmio spte zapping ppc: - BookE: in-kernel MPIC emulation with irqfd support - Book3S: in-kernel XICS emulation (incomplete) - Book3S: HV: migration fixes - BookE: more debug support preparation - BookE: e6500 support ARM: - reworking of Hyp idmaps s390: - ioeventfd for virtio-ccw And many other bug fixes, cleanups and improvements" * tag 'kvm-3.10-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (204 commits) kvm: Add compat_ioctl for device control API KVM: x86: Account for failing enable_irq_window for NMI window request KVM: PPC: Book3S: Add API for in-kernel XICS emulation kvm/ppc/mpic: fix missing unlock in set_base_addr() kvm/ppc: Hold srcu lock when calling kvm_io_bus_read/write kvm/ppc/mpic: remove users kvm/ppc/mpic: fix mmio region lists when multiple guests used kvm/ppc/mpic: remove default routes from documentation kvm: KVM_CAP_IOMMU only available with device assignment ARM: KVM: iterate over all CPUs for CPU compatibility check KVM: ARM: Fix spelling in error message ARM: KVM: define KVM_ARM_MAX_VCPUS unconditionally KVM: ARM: Fix API documentation for ONE_REG encoding ARM: KVM: promote vfp_host pointer to generic host cpu context ARM: KVM: add architecture specific hook for capabilities ARM: KVM: perform HYP initilization for hotplugged CPUs ARM: KVM: switch to a dual-step HYP init code ARM: KVM: rework HYP page table freeing ARM: KVM: enforce maximum size for identity mapped code ARM: KVM: move to a KVM provided HYP idmap ...
2 parents 9e68794 + db6ae61 commit 01227a8

110 files changed

Lines changed: 8522 additions & 2270 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/virtual/kvm/api.txt‎

Lines changed: 140 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,15 +1486,23 @@ struct kvm_ioeventfd {
14861486
__u8 pad[36];
14871487
};
14881488

1489+
For the special case of virtio-ccw devices on s390, the ioevent is matched
1490+
to a subchannel/virtqueue tuple instead.
1491+
14891492
The following flags are defined:
14901493

14911494
#define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch)
14921495
#define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio)
14931496
#define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign)
1497+
#define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY \
1498+
(1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify)
14941499

14951500
If datamatch flag is set, the event will be signaled only if the written value
14961501
to the registered address is equal to datamatch in struct kvm_ioeventfd.
14971502

1503+
For virtio-ccw devices, addr contains the subchannel id and datamatch the
1504+
virtqueue index.
1505+
14981506

14991507
4.60 KVM_DIRTY_TLB
15001508

@@ -1780,27 +1788,48 @@ registers, find a list below:
17801788
PPC | KVM_REG_PPC_VPA_DTL | 128
17811789
PPC | KVM_REG_PPC_EPCR | 32
17821790
PPC | KVM_REG_PPC_EPR | 32
1791+
PPC | KVM_REG_PPC_TCR | 32
1792+
PPC | KVM_REG_PPC_TSR | 32
1793+
PPC | KVM_REG_PPC_OR_TSR | 32
1794+
PPC | KVM_REG_PPC_CLEAR_TSR | 32
1795+
PPC | KVM_REG_PPC_MAS0 | 32
1796+
PPC | KVM_REG_PPC_MAS1 | 32
1797+
PPC | KVM_REG_PPC_MAS2 | 64
1798+
PPC | KVM_REG_PPC_MAS7_3 | 64
1799+
PPC | KVM_REG_PPC_MAS4 | 32
1800+
PPC | KVM_REG_PPC_MAS6 | 32
1801+
PPC | KVM_REG_PPC_MMUCFG | 32
1802+
PPC | KVM_REG_PPC_TLB0CFG | 32
1803+
PPC | KVM_REG_PPC_TLB1CFG | 32
1804+
PPC | KVM_REG_PPC_TLB2CFG | 32
1805+
PPC | KVM_REG_PPC_TLB3CFG | 32
1806+
PPC | KVM_REG_PPC_TLB0PS | 32
1807+
PPC | KVM_REG_PPC_TLB1PS | 32
1808+
PPC | KVM_REG_PPC_TLB2PS | 32
1809+
PPC | KVM_REG_PPC_TLB3PS | 32
1810+
PPC | KVM_REG_PPC_EPTCFG | 32
1811+
PPC | KVM_REG_PPC_ICP_STATE | 64
17831812

17841813
ARM registers are mapped using the lower 32 bits. The upper 16 of that
17851814
is the register group type, or coprocessor number:
17861815

17871816
ARM core registers have the following id bit patterns:
1788-
0x4002 0000 0010 <index into the kvm_regs struct:16>
1817+
0x4020 0000 0010 <index into the kvm_regs struct:16>
17891818

17901819
ARM 32-bit CP15 registers have the following id bit patterns:
1791-
0x4002 0000 000F <zero:1> <crn:4> <crm:4> <opc1:4> <opc2:3>
1820+
0x4020 0000 000F <zero:1> <crn:4> <crm:4> <opc1:4> <opc2:3>
17921821

17931822
ARM 64-bit CP15 registers have the following id bit patterns:
1794-
0x4003 0000 000F <zero:1> <zero:4> <crm:4> <opc1:4> <zero:3>
1823+
0x4030 0000 000F <zero:1> <zero:4> <crm:4> <opc1:4> <zero:3>
17951824

17961825
ARM CCSIDR registers are demultiplexed by CSSELR value:
1797-
0x4002 0000 0011 00 <csselr:8>
1826+
0x4020 0000 0011 00 <csselr:8>
17981827

17991828
ARM 32-bit VFP control registers have the following id bit patterns:
1800-
0x4002 0000 0012 1 <regno:12>
1829+
0x4020 0000 0012 1 <regno:12>
18011830

18021831
ARM 64-bit FP registers have the following id bit patterns:
1803-
0x4002 0000 0012 0 <regno:12>
1832+
0x4030 0000 0012 0 <regno:12>
18041833

18051834
4.69 KVM_GET_ONE_REG
18061835

@@ -2161,6 +2190,76 @@ header; first `n_valid' valid entries with contents from the data
21612190
written, then `n_invalid' invalid entries, invalidating any previously
21622191
valid entries found.
21632192

2193+
4.79 KVM_CREATE_DEVICE
2194+
2195+
Capability: KVM_CAP_DEVICE_CTRL
2196+
Type: vm ioctl
2197+
Parameters: struct kvm_create_device (in/out)
2198+
Returns: 0 on success, -1 on error
2199+
Errors:
2200+
ENODEV: The device type is unknown or unsupported
2201+
EEXIST: Device already created, and this type of device may not
2202+
be instantiated multiple times
2203+
2204+
Other error conditions may be defined by individual device types or
2205+
have their standard meanings.
2206+
2207+
Creates an emulated device in the kernel. The file descriptor returned
2208+
in fd can be used with KVM_SET/GET/HAS_DEVICE_ATTR.
2209+
2210+
If the KVM_CREATE_DEVICE_TEST flag is set, only test whether the
2211+
device type is supported (not necessarily whether it can be created
2212+
in the current vm).
2213+
2214+
Individual devices should not define flags. Attributes should be used
2215+
for specifying any behavior that is not implied by the device type
2216+
number.
2217+
2218+
struct kvm_create_device {
2219+
__u32 type; /* in: KVM_DEV_TYPE_xxx */
2220+
__u32 fd; /* out: device handle */
2221+
__u32 flags; /* in: KVM_CREATE_DEVICE_xxx */
2222+
};
2223+
2224+
4.80 KVM_SET_DEVICE_ATTR/KVM_GET_DEVICE_ATTR
2225+
2226+
Capability: KVM_CAP_DEVICE_CTRL
2227+
Type: device ioctl
2228+
Parameters: struct kvm_device_attr
2229+
Returns: 0 on success, -1 on error
2230+
Errors:
2231+
ENXIO: The group or attribute is unknown/unsupported for this device
2232+
EPERM: The attribute cannot (currently) be accessed this way
2233+
(e.g. read-only attribute, or attribute that only makes
2234+
sense when the device is in a different state)
2235+
2236+
Other error conditions may be defined by individual device types.
2237+
2238+
Gets/sets a specified piece of device configuration and/or state. The
2239+
semantics are device-specific. See individual device documentation in
2240+
the "devices" directory. As with ONE_REG, the size of the data
2241+
transferred is defined by the particular attribute.
2242+
2243+
struct kvm_device_attr {
2244+
__u32 flags; /* no flags currently defined */
2245+
__u32 group; /* device-defined */
2246+
__u64 attr; /* group-defined */
2247+
__u64 addr; /* userspace address of attr data */
2248+
};
2249+
2250+
4.81 KVM_HAS_DEVICE_ATTR
2251+
2252+
Capability: KVM_CAP_DEVICE_CTRL
2253+
Type: device ioctl
2254+
Parameters: struct kvm_device_attr
2255+
Returns: 0 on success, -1 on error
2256+
Errors:
2257+
ENXIO: The group or attribute is unknown/unsupported for this device
2258+
2259+
Tests whether a device supports a particular attribute. A successful
2260+
return indicates the attribute is implemented. It does not necessarily
2261+
indicate that the attribute can be read or written in the device's
2262+
current state. "addr" is ignored.
21642263

21652264
4.77 KVM_ARM_VCPU_INIT
21662265

@@ -2243,6 +2342,25 @@ and distributor interface, the ioctl must be called after calling
22432342
KVM_CREATE_IRQCHIP, but before calling KVM_RUN on any of the VCPUs. Calling
22442343
this ioctl twice for any of the base addresses will return -EEXIST.
22452344

2345+
4.82 KVM_PPC_RTAS_DEFINE_TOKEN
2346+
2347+
Capability: KVM_CAP_PPC_RTAS
2348+
Architectures: ppc
2349+
Type: vm ioctl
2350+
Parameters: struct kvm_rtas_token_args
2351+
Returns: 0 on success, -1 on error
2352+
2353+
Defines a token value for a RTAS (Run Time Abstraction Services)
2354+
service in order to allow it to be handled in the kernel. The
2355+
argument struct gives the name of the service, which must be the name
2356+
of a service that has a kernel-side implementation. If the token
2357+
value is non-zero, it will be associated with that service, and
2358+
subsequent RTAS calls by the guest specifying that token will be
2359+
handled by the kernel. If the token value is 0, then any token
2360+
associated with the service will be forgotten, and subsequent RTAS
2361+
calls by the guest for that service will be passed to userspace to be
2362+
handled.
2363+
22462364

22472365
5. The kvm_run structure
22482366
------------------------
@@ -2646,3 +2764,19 @@ to receive the topmost interrupt vector.
26462764
When disabled (args[0] == 0), behavior is as if this facility is unsupported.
26472765

26482766
When this capability is enabled, KVM_EXIT_EPR can occur.
2767+
2768+
6.6 KVM_CAP_IRQ_MPIC
2769+
2770+
Architectures: ppc
2771+
Parameters: args[0] is the MPIC device fd
2772+
args[1] is the MPIC CPU number for this vcpu
2773+
2774+
This capability connects the vcpu to an in-kernel MPIC device.
2775+
2776+
6.7 KVM_CAP_IRQ_XICS
2777+
2778+
Architectures: ppc
2779+
Parameters: args[0] is the XICS device fd
2780+
args[1] is the XICS CPU number (server ID) for this vcpu
2781+
2782+
This capability connects the vcpu to an in-kernel XICS device.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This directory contains specific device bindings for KVM_CAP_DEVICE_CTRL.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
MPIC interrupt controller
2+
=========================
3+
4+
Device types supported:
5+
KVM_DEV_TYPE_FSL_MPIC_20 Freescale MPIC v2.0
6+
KVM_DEV_TYPE_FSL_MPIC_42 Freescale MPIC v4.2
7+
8+
Only one MPIC instance, of any type, may be instantiated. The created
9+
MPIC will act as the system interrupt controller, connecting to each
10+
vcpu's interrupt inputs.
11+
12+
Groups:
13+
KVM_DEV_MPIC_GRP_MISC
14+
Attributes:
15+
KVM_DEV_MPIC_BASE_ADDR (rw, 64-bit)
16+
Base address of the 256 KiB MPIC register space. Must be
17+
naturally aligned. A value of zero disables the mapping.
18+
Reset value is zero.
19+
20+
KVM_DEV_MPIC_GRP_REGISTER (rw, 32-bit)
21+
Access an MPIC register, as if the access were made from the guest.
22+
"attr" is the byte offset into the MPIC register space. Accesses
23+
must be 4-byte aligned.
24+
25+
MSIs may be signaled by using this attribute group to write
26+
to the relevant MSIIR.
27+
28+
KVM_DEV_MPIC_GRP_IRQ_ACTIVE (rw, 32-bit)
29+
IRQ input line for each standard openpic source. 0 is inactive and 1
30+
is active, regardless of interrupt sense.
31+
32+
For edge-triggered interrupts: Writing 1 is considered an activating
33+
edge, and writing 0 is ignored. Reading returns 1 if a previously
34+
signaled edge has not been acknowledged, and 0 otherwise.
35+
36+
"attr" is the IRQ number. IRQ numbers for standard sources are the
37+
byte offset of the relevant IVPR from EIVPR0, divided by 32.
38+
39+
IRQ Routing:
40+
41+
The MPIC emulation supports IRQ routing. Only a single MPIC device can
42+
be instantiated. Once that device has been created, it's available as
43+
irqchip id 0.
44+
45+
This irqchip 0 has 256 interrupt pins, which expose the interrupts in
46+
the main array of interrupt sources (a.k.a. "SRC" interrupts).
47+
48+
The numbering is the same as the MPIC device tree binding -- based on
49+
the register offset from the beginning of the sources array, without
50+
regard to any subdivisions in chip documentation such as "internal"
51+
or "external" interrupts.
52+
53+
Access to non-SRC interrupts is not implemented through IRQ routing mechanisms.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
XICS interrupt controller
2+
3+
Device type supported: KVM_DEV_TYPE_XICS
4+
5+
Groups:
6+
KVM_DEV_XICS_SOURCES
7+
Attributes: One per interrupt source, indexed by the source number.
8+
9+
This device emulates the XICS (eXternal Interrupt Controller
10+
Specification) defined in PAPR. The XICS has a set of interrupt
11+
sources, each identified by a 20-bit source number, and a set of
12+
Interrupt Control Presentation (ICP) entities, also called "servers",
13+
each associated with a virtual CPU.
14+
15+
The ICP entities are created by enabling the KVM_CAP_IRQ_ARCH
16+
capability for each vcpu, specifying KVM_CAP_IRQ_XICS in args[0] and
17+
the interrupt server number (i.e. the vcpu number from the XICS's
18+
point of view) in args[1] of the kvm_enable_cap struct. Each ICP has
19+
64 bits of state which can be read and written using the
20+
KVM_GET_ONE_REG and KVM_SET_ONE_REG ioctls on the vcpu. The 64 bit
21+
state word has the following bitfields, starting at the
22+
least-significant end of the word:
23+
24+
* Unused, 16 bits
25+
26+
* Pending interrupt priority, 8 bits
27+
Zero is the highest priority, 255 means no interrupt is pending.
28+
29+
* Pending IPI (inter-processor interrupt) priority, 8 bits
30+
Zero is the highest priority, 255 means no IPI is pending.
31+
32+
* Pending interrupt source number, 24 bits
33+
Zero means no interrupt pending, 2 means an IPI is pending
34+
35+
* Current processor priority, 8 bits
36+
Zero is the highest priority, meaning no interrupts can be
37+
delivered, and 255 is the lowest priority.
38+
39+
Each source has 64 bits of state that can be read and written using
40+
the KVM_GET_DEVICE_ATTR and KVM_SET_DEVICE_ATTR ioctls, specifying the
41+
KVM_DEV_XICS_SOURCES attribute group, with the attribute number being
42+
the interrupt source number. The 64 bit state word has the following
43+
bitfields, starting from the least-significant end of the word:
44+
45+
* Destination (server number), 32 bits
46+
This specifies where the interrupt should be sent, and is the
47+
interrupt server number specified for the destination vcpu.
48+
49+
* Priority, 8 bits
50+
This is the priority specified for this interrupt source, where 0 is
51+
the highest priority and 255 is the lowest. An interrupt with a
52+
priority of 255 will never be delivered.
53+
54+
* Level sensitive flag, 1 bit
55+
This bit is 1 for a level-sensitive interrupt source, or 0 for
56+
edge-sensitive (or MSI).
57+
58+
* Masked flag, 1 bit
59+
This bit is set to 1 if the interrupt is masked (cannot be delivered
60+
regardless of its priority), for example by the ibm,int-off RTAS
61+
call, or 0 if it is not masked.
62+
63+
* Pending flag, 1 bit
64+
This bit is 1 if the source has a pending interrupt, otherwise 0.
65+
66+
Only one XICS instance may be created per VM.

‎arch/arm/include/asm/idmap.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#define __idmap __section(.idmap.text) noinline notrace
99

1010
extern pgd_t *idmap_pgd;
11-
extern pgd_t *hyp_pgd;
1211

1312
void setup_mm_for_reboot(void);
1413

0 commit comments

Comments
 (0)