diff options
author | Scott Wood <scottwood@freescale.com> | 2011-08-18 16:25:21 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-03-05 07:52:24 -0500 |
commit | dc83b8bc0256ee682506ed83853a98eaba529c6f (patch) | |
tree | 0d5f73b725392104320894d606bba10151a9ea3c /Documentation | |
parent | 0164c0f0c404017fb04defb0ceb23fd1c3c3a53e (diff) |
KVM: PPC: e500: MMU API
This implements a shared-memory API for giving host userspace access to
the guest's TLB.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/virtual/kvm/api.txt | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 7ca696227d3a..bcd45d5afcab 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt | |||
@@ -1409,6 +1409,38 @@ The following flags are defined: | |||
1409 | If datamatch flag is set, the event will be signaled only if the written value | 1409 | If datamatch flag is set, the event will be signaled only if the written value |
1410 | to the registered address is equal to datamatch in struct kvm_ioeventfd. | 1410 | to the registered address is equal to datamatch in struct kvm_ioeventfd. |
1411 | 1411 | ||
1412 | 4.59 KVM_DIRTY_TLB | ||
1413 | |||
1414 | Capability: KVM_CAP_SW_TLB | ||
1415 | Architectures: ppc | ||
1416 | Type: vcpu ioctl | ||
1417 | Parameters: struct kvm_dirty_tlb (in) | ||
1418 | Returns: 0 on success, -1 on error | ||
1419 | |||
1420 | struct kvm_dirty_tlb { | ||
1421 | __u64 bitmap; | ||
1422 | __u32 num_dirty; | ||
1423 | }; | ||
1424 | |||
1425 | This must be called whenever userspace has changed an entry in the shared | ||
1426 | TLB, prior to calling KVM_RUN on the associated vcpu. | ||
1427 | |||
1428 | The "bitmap" field is the userspace address of an array. This array | ||
1429 | consists of a number of bits, equal to the total number of TLB entries as | ||
1430 | determined by the last successful call to KVM_CONFIG_TLB, rounded up to the | ||
1431 | nearest multiple of 64. | ||
1432 | |||
1433 | Each bit corresponds to one TLB entry, ordered the same as in the shared TLB | ||
1434 | array. | ||
1435 | |||
1436 | The array is little-endian: the bit 0 is the least significant bit of the | ||
1437 | first byte, bit 8 is the least significant bit of the second byte, etc. | ||
1438 | This avoids any complications with differing word sizes. | ||
1439 | |||
1440 | The "num_dirty" field is a performance hint for KVM to determine whether it | ||
1441 | should skip processing the bitmap and just invalidate everything. It must | ||
1442 | be set to the number of set bits in the bitmap. | ||
1443 | |||
1412 | 4.62 KVM_CREATE_SPAPR_TCE | 1444 | 4.62 KVM_CREATE_SPAPR_TCE |
1413 | 1445 | ||
1414 | Capability: KVM_CAP_SPAPR_TCE | 1446 | Capability: KVM_CAP_SPAPR_TCE |
@@ -1842,3 +1874,45 @@ HTAB address part of SDR1 contains an HVA instead of a GPA, as PAPR keeps the | |||
1842 | HTAB invisible to the guest. | 1874 | HTAB invisible to the guest. |
1843 | 1875 | ||
1844 | When this capability is enabled, KVM_EXIT_PAPR_HCALL can occur. | 1876 | When this capability is enabled, KVM_EXIT_PAPR_HCALL can occur. |
1877 | |||
1878 | 6.3 KVM_CAP_SW_TLB | ||
1879 | |||
1880 | Architectures: ppc | ||
1881 | Parameters: args[0] is the address of a struct kvm_config_tlb | ||
1882 | Returns: 0 on success; -1 on error | ||
1883 | |||
1884 | struct kvm_config_tlb { | ||
1885 | __u64 params; | ||
1886 | __u64 array; | ||
1887 | __u32 mmu_type; | ||
1888 | __u32 array_len; | ||
1889 | }; | ||
1890 | |||
1891 | Configures the virtual CPU's TLB array, establishing a shared memory area | ||
1892 | between userspace and KVM. The "params" and "array" fields are userspace | ||
1893 | addresses of mmu-type-specific data structures. The "array_len" field is an | ||
1894 | safety mechanism, and should be set to the size in bytes of the memory that | ||
1895 | userspace has reserved for the array. It must be at least the size dictated | ||
1896 | by "mmu_type" and "params". | ||
1897 | |||
1898 | While KVM_RUN is active, the shared region is under control of KVM. Its | ||
1899 | contents are undefined, and any modification by userspace results in | ||
1900 | boundedly undefined behavior. | ||
1901 | |||
1902 | On return from KVM_RUN, the shared region will reflect the current state of | ||
1903 | the guest's TLB. If userspace makes any changes, it must call KVM_DIRTY_TLB | ||
1904 | to tell KVM which entries have been changed, prior to calling KVM_RUN again | ||
1905 | on this vcpu. | ||
1906 | |||
1907 | For mmu types KVM_MMU_FSL_BOOKE_NOHV and KVM_MMU_FSL_BOOKE_HV: | ||
1908 | - The "params" field is of type "struct kvm_book3e_206_tlb_params". | ||
1909 | - The "array" field points to an array of type "struct | ||
1910 | kvm_book3e_206_tlb_entry". | ||
1911 | - The array consists of all entries in the first TLB, followed by all | ||
1912 | entries in the second TLB. | ||
1913 | - Within a TLB, entries are ordered first by increasing set number. Within a | ||
1914 | set, entries are ordered by way (increasing ESEL). | ||
1915 | - The hash for determining set number in TLB0 is: (MAS2 >> 12) & (num_sets - 1) | ||
1916 | where "num_sets" is the tlb_sizes[] value divided by the tlb_ways[] value. | ||
1917 | - The tsize field of mas1 shall be set to 4K on TLB0, even though the | ||
1918 | hardware ignores this value for TLB0. | ||