forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KVM: PPC: Book3S: Add API for in-kernel XICS emulation
This adds the API for userspace to instantiate an XICS device in a VM and connect VCPUs to it. The API consists of a new device type for the KVM_CREATE_DEVICE ioctl, a new capability KVM_CAP_IRQ_XICS, which functions similarly to KVM_CAP_IRQ_MPIC, and the KVM_IRQ_LINE ioctl, which is used to assert and deassert interrupt inputs of the XICS. The XICS device has one attribute group, KVM_DEV_XICS_GRP_SOURCES. Each attribute within this group corresponds to the state of one interrupt source. The attribute number is the same as the interrupt source number. This does not support irq routing or irqfd yet. Signed-off-by: Paul Mackerras <[email protected]> Acked-by: David Gibson <[email protected]> Signed-off-by: Alexander Graf <[email protected]>
- Loading branch information
1 parent
d133b40
commit 5975a2e
Showing
11 changed files
with
287 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
XICS interrupt controller | ||
|
||
Device type supported: KVM_DEV_TYPE_XICS | ||
|
||
Groups: | ||
KVM_DEV_XICS_SOURCES | ||
Attributes: One per interrupt source, indexed by the source number. | ||
|
||
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 | ||
Interrupt Control Presentation (ICP) entities, also called "servers", | ||
each associated with a virtual CPU. | ||
|
||
The ICP entities are created by enabling the KVM_CAP_IRQ_ARCH | ||
capability for each vcpu, specifying KVM_CAP_IRQ_XICS in args[0] and | ||
the interrupt server number (i.e. the vcpu number from the XICS's | ||
point of view) in args[1] of the kvm_enable_cap struct. Each ICP has | ||
64 bits of state which can be read and written using the | ||
KVM_GET_ONE_REG and KVM_SET_ONE_REG ioctls on the vcpu. The 64 bit | ||
state word has the following bitfields, starting at the | ||
least-significant end of the word: | ||
|
||
* Unused, 16 bits | ||
|
||
* Pending interrupt priority, 8 bits | ||
Zero is the highest priority, 255 means no interrupt is pending. | ||
|
||
* Pending IPI (inter-processor interrupt) priority, 8 bits | ||
Zero is the highest priority, 255 means no IPI is pending. | ||
|
||
* Pending interrupt source number, 24 bits | ||
Zero means no interrupt pending, 2 means an IPI is pending | ||
|
||
* Current processor priority, 8 bits | ||
Zero is the highest priority, meaning no interrupts can be | ||
delivered, and 255 is the lowest priority. | ||
|
||
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 | ||
the interrupt source number. The 64 bit state word has the following | ||
bitfields, starting from the least-significant end of the word: | ||
|
||
* Destination (server number), 32 bits | ||
This specifies where the interrupt should be sent, and is the | ||
interrupt server number specified for the destination vcpu. | ||
|
||
* Priority, 8 bits | ||
This is the priority specified for this interrupt source, where 0 is | ||
the highest priority and 255 is the lowest. An interrupt with a | ||
priority of 255 will never be delivered. | ||
|
||
* Level sensitive flag, 1 bit | ||
This bit is 1 for a level-sensitive interrupt source, or 0 for | ||
edge-sensitive (or MSI). | ||
|
||
* Masked flag, 1 bit | ||
This bit is set to 1 if the interrupt is masked (cannot be delivered | ||
regardless of its priority), for example by the ibm,int-off RTAS | ||
call, or 0 if it is not masked. | ||
|
||
* Pending flag, 1 bit | ||
This bit is 1 if the source has a pending interrupt, otherwise 0. | ||
|
||
Only one XICS instance may be created per VM. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.