aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/virtual
diff options
context:
space:
mode:
authorDavid Gibson <dwg@au1.ibm.com>2011-06-28 20:22:41 -0400
committerAvi Kivity <avi@redhat.com>2011-07-12 06:16:56 -0400
commit54738c097163c3f01e67ccc85462b78d4d4f495f (patch)
treecba8d389d50251856cbe967c16ba2193a30d6d12 /Documentation/virtual
parenta8606e20e41a8149456bafdf76ad29d47672027c (diff)
KVM: PPC: Accelerate H_PUT_TCE by implementing it in real mode
This improves I/O performance for guests using the PAPR paravirtualization interface by making the H_PUT_TCE hcall faster, by implementing it in real mode. H_PUT_TCE is used for updating virtual IOMMU tables, and is used both for virtual I/O and for real I/O in the PAPR interface. Since this moves the IOMMU tables into the kernel, we define a new KVM_CREATE_SPAPR_TCE ioctl to allow qemu to create the tables. The ioctl returns a file descriptor which can be used to mmap the newly created table. The qemu driver models use them in the same way as userspace managed tables, but they can be updated directly by the guest with a real-mode H_PUT_TCE implementation, reducing the number of host/guest context switches during guest IO. There are certain circumstances where it is useful for userland qemu to write to the TCE table even if the kernel H_PUT_TCE path is used most of the time. Specifically, allowing this will avoid awkwardness when we need to reset the table. More importantly, we will in the future need to write the table in order to restore its state after a checkpoint resume or migration. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'Documentation/virtual')
-rw-r--r--Documentation/virtual/kvm/api.txt35
1 files changed, 35 insertions, 0 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index e8875fef3eb8..a1d344d5ff4c 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -1350,6 +1350,41 @@ The following flags are defined:
1350If datamatch flag is set, the event will be signaled only if the written value 1350If datamatch flag is set, the event will be signaled only if the written value
1351to the registered address is equal to datamatch in struct kvm_ioeventfd. 1351to the registered address is equal to datamatch in struct kvm_ioeventfd.
1352 1352
13534.62 KVM_CREATE_SPAPR_TCE
1354
1355Capability: KVM_CAP_SPAPR_TCE
1356Architectures: powerpc
1357Type: vm ioctl
1358Parameters: struct kvm_create_spapr_tce (in)
1359Returns: file descriptor for manipulating the created TCE table
1360
1361This creates a virtual TCE (translation control entry) table, which
1362is an IOMMU for PAPR-style virtual I/O. It is used to translate
1363logical addresses used in virtual I/O into guest physical addresses,
1364and provides a scatter/gather capability for PAPR virtual I/O.
1365
1366/* for KVM_CAP_SPAPR_TCE */
1367struct kvm_create_spapr_tce {
1368 __u64 liobn;
1369 __u32 window_size;
1370};
1371
1372The liobn field gives the logical IO bus number for which to create a
1373TCE table. The window_size field specifies the size of the DMA window
1374which this TCE table will translate - the table will contain one 64
1375bit TCE entry for every 4kiB of the DMA window.
1376
1377When the guest issues an H_PUT_TCE hcall on a liobn for which a TCE
1378table has been created using this ioctl(), the kernel will handle it
1379in real mode, updating the TCE table. H_PUT_TCE calls for other
1380liobns will cause a vm exit and must be handled by userspace.
1381
1382The return value is a file descriptor which can be passed to mmap(2)
1383to map the created TCE table into userspace. This lets userspace read
1384the entries written by kernel-handled H_PUT_TCE calls, and also lets
1385userspace update the TCE table directly which is useful in some
1386circumstances.
1387
13535. The kvm_run structure 13885. The kvm_run structure
1354 1389
1355Application code obtains a pointer to the kvm_run structure by 1390Application code obtains a pointer to the kvm_run structure by