This series makes room in the driver for differentiation between the controllers which currently operate in TCFQ mode. Most of these are actually capable of a lot more in terms of throughput. This is in preparation of a second series which will convert the remaining users of TCFQ mode altogether to XSPI mode with command cycling. Vladimir Oltean (6): doc: spi-fsl-dspi: Add specific compatibles for all Layerscape SoCs spi: spi-fsl-dspi: Use specific compatible strings for all SoC instantiations spi: spi-fsl-dspi: Parameterize the FIFO size and DMA buffer size spi: spi-fsl-dspi: LS2080A and LX2160A support XSPI mode spi: spi-fsl-dspi: Support SPI software timestamping in all non-DMA modes spi: spi-fsl-dspi: Convert the instantiations that support it to DMA .../devicetree/bindings/spi/spi-fsl-dspi.txt | 17 +- drivers/spi/spi-fsl-dspi.c | 162 +++++++++++++----- 2 files changed, 128 insertions(+), 51 deletions(-) -- 2.17.1
Unified · Split
| @@ -100,6 +100,10 @@ modules.order · 99 unmodified lines | |||
| 100 | /include/ksym/ | 100 | /include/ksym/ |
| 101 | /arch/*/include/generated/ | 101 | /arch/*/include/generated/ |
| 102 | 102 | ||
| 103 | # Generated lkdtm tests | ||
| 104 | /tools/testing/selftests/lkdtm/*.sh | ||
| 105 | !/tools/testing/selftests/lkdtm/run.sh | ||
| 106 | |||
| 103 | # stgit generated dirs | 107 | # stgit generated dirs |
| 104 | patches-* | 108 | patches-* |
| 105 | 109 | ||
| @@ -16,3 +16,5 @@ In addition, other licenses may also apply. Please see: · 15 unmodified lines | |||
| 16 | Documentation/process/license-rules.rst | 16 | Documentation/process/license-rules.rst |
| 17 | 17 | ||
| 18 | for more details. | 18 | for more details. |
| 19 | |||
| 20 | All contributions to the Linux Kernel are subject to this COPYING file. | ||
| @@ -567,6 +567,11 @@ D: Original author of Amiga FFS filesystem · 566 unmodified lines | |||
| 567 | S: Orlando, Florida | 567 | S: Orlando, Florida |
| 568 | S: USA | 568 | S: USA |
| 569 | 569 | ||
| 570 | N: Paul Burton | ||
| 571 | E: paulburton@kernel.org | ||
| 572 | W: https://pburton.com | ||
| 573 | D: MIPS maintainer 2018-2020 | ||
| 574 | |||
| 570 | N: Lennert Buytenhek | 575 | N: Lennert Buytenhek |
| 571 | E: kernel@wantstofly.org | 576 | E: kernel@wantstofly.org |
| 572 | D: Original (2.4) rewrite of the ethernet bridging code | 577 | D: Original (2.4) rewrite of the ethernet bridging code |
| @@ -62,6 +62,30 @@ Or more shorter, written as following:: · 61 unmodified lines | |||
| 62 | In both styles, same key words are automatically merged when parsing it | 62 | In both styles, same key words are automatically merged when parsing it |
| 63 | at boot time. So you can append similar trees or key-values. | 63 | at boot time. So you can append similar trees or key-values. |
| 64 | 64 | ||
| 65 | Same-key Values | ||
| 66 | --------------- | ||
| 67 | |||
| 68 | It is prohibited that two or more values or arrays share a same-key. | ||
| 69 | For example,:: | ||
| 70 | |||
| 71 | foo = bar, baz | ||
| 72 | foo = qux # !ERROR! we can not re-define same key | ||
| 73 | |||
| 74 | If you want to append the value to existing key as an array member, | ||
| 75 | you can use ``+=`` operator. For example:: | ||
| 76 | |||
| 77 | foo = bar, baz | ||
| 78 | foo += qux | ||
| 79 | |||
| 80 | In this case, the key ``foo`` has ``bar``, ``baz`` and ``qux``. | ||
| 81 | |||
| 82 | However, a sub-key and a value can not co-exist under a parent key. | ||
| 83 | For example, following config is NOT allowed.:: | ||
| 84 | |||
| 85 | foo = value1 | ||
| 86 | foo.bar = value2 # !ERROR! subkey "bar" and value "value1" can NOT co-exist | ||
| 87 | |||
| 88 | |||
| 65 | Comments | 89 | Comments |
| 66 | -------- | 90 | -------- |
| 67 | 91 | ||
| @@ -102,9 +126,13 @@ Boot Kernel With a Boot Config · 34 unmodified lines | |||
| 102 | ============================== | 126 | ============================== |
| 103 | 127 | ||
| 104 | Since the boot configuration file is loaded with initrd, it will be added | 128 | Since the boot configuration file is loaded with initrd, it will be added |
| 105 | to the end of the initrd (initramfs) image file. The Linux kernel decodes | 129 | to the end of the initrd (initramfs) image file with size, checksum and |
| 106 | the last part of the initrd image in memory to get the boot configuration | 130 | 12-byte magic word as below. |
| 107 | data. | 131 | |
| 132 | [initrd][bootconfig][size(u32)][checksum(u32)][#BOOTCONFIG\n] | ||
| 133 | |||
| 134 | The Linux kernel decodes the last part of the initrd image in memory to | ||
| 135 | get the boot configuration data. | ||
| 108 | Because of this "piggyback" method, there is no need to change or | 136 | Because of this "piggyback" method, there is no need to change or |
| 109 | update the boot loader and the kernel image itself. | 137 | update the boot loader and the kernel image itself. |
| 110 | 138 | ||
| @@ -136,6 +136,10 @@ · 135 unmodified lines | |||
| 136 | dynamic table installation which will install SSDT | 136 | dynamic table installation which will install SSDT |
| 137 | tables to /sys/firmware/acpi/tables/dynamic. | 137 | tables to /sys/firmware/acpi/tables/dynamic. |
| 138 | 138 | ||
| 139 | acpi_no_watchdog [HW,ACPI,WDT] | ||
| 140 | Ignore the ACPI-based watchdog interface (WDAT) and let | ||
| 141 | a native driver control the watchdog device instead. | ||
| 142 | |||
| 139 | acpi_rsdp= [ACPI,EFI,KEXEC] | 143 | acpi_rsdp= [ACPI,EFI,KEXEC] |
| 140 | Pass the RSDP address to the kernel, mostly used | 144 | Pass the RSDP address to the kernel, mostly used |
| 141 | on machines running EFI runtime service to boot the | 145 | on machines running EFI runtime service to boot the |
| @@ -129,7 +129,7 @@ this logic. · 128 unmodified lines | |||
| 129 | 129 | ||
| 130 | As a single binary will need to support both 48-bit and 52-bit VA | 130 | As a single binary will need to support both 48-bit and 52-bit VA |
| 131 | spaces, the VMEMMAP must be sized large enough for 52-bit VAs and | 131 | spaces, the VMEMMAP must be sized large enough for 52-bit VAs and |
| 132 | also must be sized large enought to accommodate a fixed PAGE_OFFSET. | 132 | also must be sized large enough to accommodate a fixed PAGE_OFFSET. |
| 133 | 133 | ||
| 134 | Most code in the kernel should not need to consider the VA_BITS, for | 134 | Most code in the kernel should not need to consider the VA_BITS, for |
| 135 | code that does need to know the VA size the variables are | 135 | code that does need to know the VA size the variables are |
| @@ -44,8 +44,15 @@ The AArch64 Tagged Address ABI has two stages of relaxation depending · 43 unmodified lines | |||
| 44 | how the user addresses are used by the kernel: | 44 | how the user addresses are used by the kernel: |
| 45 | 45 | ||
| 46 | 1. User addresses not accessed by the kernel but used for address space | 46 | 1. User addresses not accessed by the kernel but used for address space |
| 47 | management (e.g. ``mmap()``, ``mprotect()``, ``madvise()``). The use | 47 | management (e.g. ``mprotect()``, ``madvise()``). The use of valid |
| 48 | of valid tagged pointers in this context is always allowed. | 48 | tagged pointers in this context is allowed with the exception of |
| 49 | ``brk()``, ``mmap()`` and the ``new_address`` argument to | ||
| 50 | ``mremap()`` as these have the potential to alias with existing | ||
| 51 | user addresses. | ||
| 52 | |||
| 53 | NOTE: This behaviour changed in v5.6 and so some earlier kernels may | ||
| 54 | incorrectly accept valid tagged pointers for the ``brk()``, | ||
| 55 | ``mmap()`` and ``mremap()`` system calls. | ||
| 49 | 56 | ||
| 50 | 2. User addresses accessed by the kernel (e.g. ``write()``). This ABI | 57 | 2. User addresses accessed by the kernel (e.g. ``write()``). This ABI |
| 51 | relaxation is disabled by default and the application thread needs to | 58 | relaxation is disabled by default and the application thread needs to |
| @@ -551,6 +551,7 @@ options to your ``.config``: · 550 unmodified lines | |||
| 551 | Once the kernel is built and installed, a simple | 551 | Once the kernel is built and installed, a simple |
| 552 | 552 | ||
| 553 | .. code-block:: bash | 553 | .. code-block:: bash |
| 554 | |||
| 554 | modprobe example-test | 555 | modprobe example-test |
| 555 | 556 | ||
| 556 | ...will run the tests. | 557 | ...will run the tests. |
| @@ -43,9 +43,13 @@ properties: · 42 unmodified lines | |||
| 43 | - enum: | 43 | - enum: |
| 44 | - allwinner,sun8i-h3-tcon-tv | 44 | - allwinner,sun8i-h3-tcon-tv |
| 45 | - allwinner,sun50i-a64-tcon-tv | 45 | - allwinner,sun50i-a64-tcon-tv |
| 46 | - allwinner,sun50i-h6-tcon-tv | ||
| 47 | - const: allwinner,sun8i-a83t-tcon-tv | 46 | - const: allwinner,sun8i-a83t-tcon-tv |
| 48 | 47 | ||
| 48 | - items: | ||
| 49 | - enum: | ||
| 50 | - allwinner,sun50i-h6-tcon-tv | ||
| 51 | - const: allwinner,sun8i-r40-tcon-tv | ||
| 52 | |||
| 49 | reg: | 53 | reg: |
| 50 | maxItems: 1 | 54 | maxItems: 1 |
| 51 | 55 | ||
| @@ -1,9 +1,10 @@ | |||
| 1 | Ilitek ILI210x/ILI2117/ILI251x touchscreen controller | 1 | Ilitek ILI210x/ILI2117/ILI2120/ILI251x touchscreen controller |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible: | 4 | - compatible: |
| 5 | ilitek,ili210x for ILI210x | 5 | ilitek,ili210x for ILI210x |
| 6 | ilitek,ili2117 for ILI2117 | 6 | ilitek,ili2117 for ILI2117 |
| 7 | ilitek,ili2120 for ILI2120 | ||
| 7 | ilitek,ili251x for ILI251x | 8 | ilitek,ili251x for ILI251x |
| 8 | 9 | ||
| 9 | - reg: The I2C address of the device | 10 | - reg: The I2C address of the device |
| @@ -33,24 +33,40 @@ properties: · 32 unmodified lines | |||
| 33 | maxItems: 1 | 33 | maxItems: 1 |
| 34 | 34 | ||
| 35 | clocks: | 35 | clocks: |
| 36 | minItems: 2 | 36 | oneOf: |
| 37 | maxItems: 3 | 37 | - items: |
| 38 | items: | 38 | - description: The CSI interface clock |
| 39 | - description: The CSI interface clock | 39 | - description: The CSI DRAM clock |
| 40 | - description: The CSI ISP clock | 40 | |
| 41 | - description: The CSI DRAM clock | 41 | - items: |
| 42 | - description: The CSI interface clock | ||
| 43 | - description: The CSI ISP clock | ||
| 44 | - description: The CSI DRAM clock | ||
| 42 | 45 | ||
| 43 | clock-names: | 46 | clock-names: |
| 44 | minItems: 2 | 47 | oneOf: |
| 45 | maxItems: 3 | 48 | - items: |
| 46 | items: | 49 | - const: bus |
| 47 | - const: bus | 50 | - const: ram |
| 48 | - const: isp | 51 | |
| 49 | - const: ram | 52 | - items: |
| 53 | - const: bus | ||
| 54 | - const: isp | ||
| 55 | - const: ram | ||
| 50 | 56 | ||
| 51 | resets: | 57 | resets: |
| 52 | maxItems: 1 | 58 | maxItems: 1 |
| 53 | 59 | ||
| 60 | # FIXME: This should be made required eventually once every SoC will | ||
| 61 | # have the MBUS declared. | ||
| 62 | interconnects: | ||
| 63 | maxItems: 1 | ||
| 64 | |||
| 65 | # FIXME: This should be made required eventually once every SoC will | ||
| 66 | # have the MBUS declared. | ||
| 67 | interconnect-names: | ||
| 68 | const: dma-mem | ||
| 69 | |||
| 54 | # See ./video-interfaces.txt for details | 70 | # See ./video-interfaces.txt for details |
| 55 | port: | 71 | port: |
| 56 | type: object | 72 | type: object |
| @@ -347,6 +347,7 @@ examples: · 346 unmodified lines | |||
| 347 | interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>; | 347 | interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>; |
| 348 | 348 | ||
| 349 | #iommu-cells = <1>; | 349 | #iommu-cells = <1>; |
| 350 | #reset-cells = <1>; | ||
| 350 | }; | 351 | }; |
| 351 | 352 | ||
| 352 | external-memory-controller@7001b000 { | 353 | external-memory-controller@7001b000 { |
| @@ -363,20 +364,23 @@ examples: · 10 unmodified lines | |||
| 363 | timing-0 { | 364 | timing-0 { |
| 364 | clock-frequency = <12750000>; | 365 | clock-frequency = <12750000>; |
| 365 | 366 | ||
| 366 | nvidia,emc-zcal-cnt-long = <0x00000042>; | ||
| 367 | nvidia,emc-auto-cal-interval = <0x001fffff>; | ||
| 368 | nvidia,emc-ctt-term-ctrl = <0x00000802>; | ||
| 369 | nvidia,emc-cfg = <0x73240000>; | ||
| 370 | nvidia,emc-cfg-2 = <0x000008c5>; | ||
| 371 | nvidia,emc-sel-dpd-ctrl = <0x00040128>; | ||
| 372 | nvidia,emc-bgbias-ctl0 = <0x00000008>; | ||
| 373 | nvidia,emc-auto-cal-config = <0xa1430000>; | 367 | nvidia,emc-auto-cal-config = <0xa1430000>; |
| 374 | nvidia,emc-auto-cal-config2 = <0x00000000>; | 368 | nvidia,emc-auto-cal-config2 = <0x00000000>; |
| 375 | nvidia,emc-auto-cal-config3 = <0x00000000>; | 369 | nvidia,emc-auto-cal-config3 = <0x00000000>; |
| 376 | nvidia,emc-mode-reset = <0x80001221>; | 370 | nvidia,emc-auto-cal-interval = <0x001fffff>; |
| 371 | nvidia,emc-bgbias-ctl0 = <0x00000008>; | ||
| 372 | nvidia,emc-cfg = <0x73240000>; | ||
| 373 | nvidia,emc-cfg-2 = <0x000008c5>; | ||
| 374 | nvidia,emc-ctt-term-ctrl = <0x00000802>; | ||
| 377 | nvidia,emc-mode-1 = <0x80100003>; | 375 | nvidia,emc-mode-1 = <0x80100003>; |
| 378 | nvidia,emc-mode-2 = <0x80200008>; | 376 | nvidia,emc-mode-2 = <0x80200008>; |
| 379 | nvidia,emc-mode-4 = <0x00000000>; | 377 | nvidia,emc-mode-4 = <0x00000000>; |
| 378 | nvidia,emc-mode-reset = <0x80001221>; | ||
| 379 | nvidia,emc-mrs-wait-cnt = <0x000e000e>; | ||
| 380 | nvidia,emc-sel-dpd-ctrl = <0x00040128>; | ||
| 381 | nvidia,emc-xm2dqspadctrl2 = <0x0130b118>; | ||
| 382 | nvidia,emc-zcal-cnt-long = <0x00000042>; | ||
| 383 | nvidia,emc-zcal-interval = <0x00000000>; | ||
| 380 | 384 | ||
| 381 | nvidia,emc-configuration = < | 385 | nvidia,emc-configuration = < |
| 382 | 0x00000000 /* EMC_RC */ | 386 | 0x00000000 /* EMC_RC */ |
| @@ -124,7 +124,7 @@ not every application needs SDIO irq, e.g. MMC cards. · 123 unmodified lines | |||
| 124 | pinctrl-1 = <&mmc1_idle>; | 124 | pinctrl-1 = <&mmc1_idle>; |
| 125 | pinctrl-2 = <&mmc1_sleep>; | 125 | pinctrl-2 = <&mmc1_sleep>; |
| 126 | ... | 126 | ... |
| 127 | interrupts-extended = <&intc 64 &gpio2 28 GPIO_ACTIVE_LOW>; | 127 | interrupts-extended = <&intc 64 &gpio2 28 IRQ_TYPE_LEVEL_LOW>; |
| 128 | }; | 128 | }; |
| 129 | 129 | ||
| 130 | mmc1_idle : pinmux_cirq_pin { | 130 | mmc1_idle : pinmux_cirq_pin { |
| @@ -56,7 +56,6 @@ patternProperties: · 55 unmodified lines | |||
| 56 | examples: | 56 | examples: |
| 57 | - | | 57 | - | |
| 58 | davinci_mdio: mdio@5c030000 { | 58 | davinci_mdio: mdio@5c030000 { |
| 59 | compatible = "ti,davinci_mdio"; | ||
| 60 | reg = <0x5c030000 0x1000>; | 59 | reg = <0x5c030000 0x1000>; |
| 61 | #address-cells = <1>; | 60 | #address-cells = <1>; |
| 62 | #size-cells = <0>; | 61 | #size-cells = <0>; |
| @@ -1,12 +1,17 @@ | |||
| 1 | ARM Freescale DSPI controller | 1 | ARM Freescale DSPI controller |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible : "fsl,vf610-dspi", "fsl,ls1021a-v1.0-dspi", | 4 | - compatible : must be one of: |
| 5 | "fsl,ls2085a-dspi" | 5 | "fsl,vf610-dspi", |
| 6 | or | 6 | "fsl,ls1021a-v1.0-dspi", |
| 7 | "fsl,ls2080a-dspi" followed by "fsl,ls2085a-dspi" | 7 | "fsl,ls1012a-dspi" (optionally followed by "fsl,ls1021a-v1.0-dspi"), |
| 8 | "fsl,ls1012a-dspi" followed by "fsl,ls1021a-v1.0-dspi" | 8 | "fsl,ls1028a-dspi", |
| 9 | "fsl,ls1088a-dspi" followed by "fsl,ls1021a-v1.0-dspi" | 9 | "fsl,ls1043a-dspi" (optionally followed by "fsl,ls1021a-v1.0-dspi"), |
| 10 | "fsl,ls1046a-dspi" (optionally followed by "fsl,ls1021a-v1.0-dspi"), | ||
| 11 | "fsl,ls1088a-dspi" (optionally followed by "fsl,ls1021a-v1.0-dspi"), | ||
| 12 | "fsl,ls2080a-dspi" (optionally followed by "fsl,ls2085a-dspi"), | ||
| 13 | "fsl,ls2085a-dspi", | ||
| 14 | "fsl,lx2160a-dspi", | ||
| 10 | - reg : Offset and length of the register set for the device | 15 | - reg : Offset and length of the register set for the device |
| 11 | - interrupts : Should contain SPI controller interrupt | 16 | - interrupts : Should contain SPI controller interrupt |
| 12 | - clocks: from common clock binding: handle to dspi clock. | 17 | - clocks: from common clock binding: handle to dspi clock. |
| @@ -71,9 +71,13 @@ b) Example for device tree:: · 70 unmodified lines | |||
| 71 | ipmb@10 { | 71 | ipmb@10 { |
| 72 | compatible = "ipmb-dev"; | 72 | compatible = "ipmb-dev"; |
| 73 | reg = <0x10>; | 73 | reg = <0x10>; |
| 74 | i2c-protocol; | ||
| 74 | }; | 75 | }; |
| 75 | }; | 76 | }; |
| 76 | 77 | ||
| 78 | If xmit of data to be done using raw i2c block vs smbus | ||
| 79 | then "i2c-protocol" needs to be defined as above. | ||
| 80 | |||
| 77 | 2) Manually from Linux:: | 81 | 2) Manually from Linux:: |
| 78 | 82 | ||
| 79 | modprobe ipmb-dev-int | 83 | modprobe ipmb-dev-int |
| @@ -134,7 +134,7 @@ Sequential zone files can only be written sequentially, starting from the file · 133 unmodified lines | |||
| 134 | end, that is, write operations can only be append writes. Zonefs makes no | 134 | end, that is, write operations can only be append writes. Zonefs makes no |
| 135 | attempt at accepting random writes and will fail any write request that has a | 135 | attempt at accepting random writes and will fail any write request that has a |
| 136 | start offset not corresponding to the end of the file, or to the end of the last | 136 | start offset not corresponding to the end of the file, or to the end of the last |
| 137 | write issued and still in-flight (for asynchrnous I/O operations). | 137 | write issued and still in-flight (for asynchronous I/O operations). |
| 138 | 138 | ||
| 139 | Since dirty page writeback by the page cache does not guarantee a sequential | 139 | Since dirty page writeback by the page cache does not guarantee a sequential |
| 140 | write pattern, zonefs prevents buffered writes and writeable shared mappings | 140 | write pattern, zonefs prevents buffered writes and writeable shared mappings |
| @@ -142,7 +142,7 @@ on sequential files. Only direct I/O writes are accepted for these files. · 1 unmodified line | |||
| 142 | zonefs relies on the sequential delivery of write I/O requests to the device | 142 | zonefs relies on the sequential delivery of write I/O requests to the device |
| 143 | implemented by the block layer elevator. An elevator implementing the sequential | 143 | implemented by the block layer elevator. An elevator implementing the sequential |
| 144 | write feature for zoned block device (ELEVATOR_F_ZBD_SEQ_WRITE elevator feature) | 144 | write feature for zoned block device (ELEVATOR_F_ZBD_SEQ_WRITE elevator feature) |
| 145 | must be used. This type of elevator (e.g. mq-deadline) is the set by default | 145 | must be used. This type of elevator (e.g. mq-deadline) is set by default |
| 146 | for zoned block devices on device initialization. | 146 | for zoned block devices on device initialization. |
| 147 | 147 | ||
| 148 | There are no restrictions on the type of I/O used for read operations in | 148 | There are no restrictions on the type of I/O used for read operations in |
| @@ -196,7 +196,7 @@ additional conditions that result in I/O errors. · 47 unmodified lines | |||
| 196 | may still happen in the case of a partial failure of a very large direct I/O | 196 | may still happen in the case of a partial failure of a very large direct I/O |
| 197 | operation split into multiple BIOs/requests or asynchronous I/O operations. | 197 | operation split into multiple BIOs/requests or asynchronous I/O operations. |
| 198 | If one of the write request within the set of sequential write requests | 198 | If one of the write request within the set of sequential write requests |
| 199 | issued to the device fails, all write requests after queued after it will | 199 | issued to the device fails, all write requests queued after it will |
| 200 | become unaligned and fail. | 200 | become unaligned and fail. |
| 201 | 201 | ||
| 202 | * Delayed write errors: similarly to regular block devices, if the device side | 202 | * Delayed write errors: similarly to regular block devices, if the device side |
| @@ -207,7 +207,7 @@ additional conditions that result in I/O errors. · 4 unmodified lines | |||
| 207 | causing all data to be dropped after the sector that caused the error. | 207 | causing all data to be dropped after the sector that caused the error. |
| 208 | 208 | ||
| 209 | All I/O errors detected by zonefs are notified to the user with an error code | 209 | All I/O errors detected by zonefs are notified to the user with an error code |
| 210 | return for the system call that trigered or detected the error. The recovery | 210 | return for the system call that triggered or detected the error. The recovery |
| 211 | actions taken by zonefs in response to I/O errors depend on the I/O type (read | 211 | actions taken by zonefs in response to I/O errors depend on the I/O type (read |
| 212 | vs write) and on the reason for the error (bad sector, unaligned writes or zone | 212 | vs write) and on the reason for the error (bad sector, unaligned writes or zone |
| 213 | condition change). | 213 | condition change). |
| @@ -222,7 +222,7 @@ condition change). · 8 unmodified lines | |||
| 222 | * A zone condition change to read-only or offline also always triggers zonefs | 222 | * A zone condition change to read-only or offline also always triggers zonefs |
| 223 | I/O error recovery. | 223 | I/O error recovery. |
| 224 | 224 | ||
| 225 | Zonefs minimal I/O error recovery may change a file size and a file access | 225 | Zonefs minimal I/O error recovery may change a file size and file access |
| 226 | permissions. | 226 | permissions. |
| 227 | 227 | ||
| 228 | * File size changes: | 228 | * File size changes: |
| @@ -237,7 +237,7 @@ permissions. · 8 unmodified lines | |||
| 237 | A file size may also be reduced to reflect a delayed write error detected on | 237 | A file size may also be reduced to reflect a delayed write error detected on |
| 238 | fsync(): in this case, the amount of data effectively written in the zone may | 238 | fsync(): in this case, the amount of data effectively written in the zone may |
| 239 | be less than originally indicated by the file inode size. After such I/O | 239 | be less than originally indicated by the file inode size. After such I/O |
| 240 | error, zonefs always fixes a file inode size to reflect the amount of data | 240 | error, zonefs always fixes the file inode size to reflect the amount of data |
| 241 | persistently stored in the file zone. | 241 | persistently stored in the file zone. |
| 242 | 242 | ||
| 243 | * Access permission changes: | 243 | * Access permission changes: |
| @@ -281,11 +281,11 @@ Further notes: · 37 unmodified lines | |||
| 281 | permissions to read-only applies to all files. The file system is remounted | 281 | permissions to read-only applies to all files. The file system is remounted |
| 282 | read-only. | 282 | read-only. |
| 283 | * Access permission and file size changes due to the device transitioning zones | 283 | * Access permission and file size changes due to the device transitioning zones |
| 284 | to the offline condition are permanent. Remounting or reformating the device | 284 | to the offline condition are permanent. Remounting or reformatting the device |
| 285 | with mkfs.zonefs (mkzonefs) will not change back offline zone files to a good | 285 | with mkfs.zonefs (mkzonefs) will not change back offline zone files to a good |
| 286 | state. | 286 | state. |
| 287 | * File access permission changes to read-only due to the device transitioning | 287 | * File access permission changes to read-only due to the device transitioning |
| 288 | zones to the read-only condition are permanent. Remounting or reformating | 288 | zones to the read-only condition are permanent. Remounting or reformatting |
| 289 | the device will not re-enable file write access. | 289 | the device will not re-enable file write access. |
| 290 | * File access permission changes implied by the remount-ro, zone-ro and | 290 | * File access permission changes implied by the remount-ro, zone-ro and |
| 291 | zone-offline mount options are temporary for zones in a good condition. | 291 | zone-offline mount options are temporary for zones in a good condition. |
| @@ -301,13 +301,13 @@ Mount options · 9 unmodified lines | |||
| 301 | 301 | ||
| 302 | zonefs define the "errors=<behavior>" mount option to allow the user to specify | 302 | zonefs define the "errors=<behavior>" mount option to allow the user to specify |
| 303 | zonefs behavior in response to I/O errors, inode size inconsistencies or zone | 303 | zonefs behavior in response to I/O errors, inode size inconsistencies or zone |
| 304 | condition chages. The defined behaviors are as follow: | 304 | condition changes. The defined behaviors are as follow: |
| 305 | * remount-ro (default) | 305 | * remount-ro (default) |
| 306 | * zone-ro | 306 | * zone-ro |
| 307 | * zone-offline | 307 | * zone-offline |
| 308 | * repair | 308 | * repair |
| 309 | 309 | ||
| 310 | The I/O error actions defined for each behavior is detailed in the previous | 310 | The I/O error actions defined for each behavior are detailed in the previous |
| 311 | section. | 311 | section. |
| 312 | 312 | ||
| 313 | Zonefs User Space Tools | 313 | Zonefs User Space Tools |
| @@ -24,6 +24,7 @@ This driver implements support for Infineon Multi-phase XDPE122 family · 23 unmodified lines | |||
| 24 | dual loop voltage regulators. | 24 | dual loop voltage regulators. |
| 25 | The family includes XDPE12284 and XDPE12254 devices. | 25 | The family includes XDPE12284 and XDPE12254 devices. |
| 26 | The devices from this family complaint with: | 26 | The devices from this family complaint with: |
| 27 | |||
| 27 | - Intel VR13 and VR13HC rev 1.3, IMVP8 rev 1.2 and IMPVP9 rev 1.3 DC-DC | 28 | - Intel VR13 and VR13HC rev 1.3, IMVP8 rev 1.2 and IMPVP9 rev 1.3 DC-DC |
| 28 | converter specification. | 29 | converter specification. |
| 29 | - Intel SVID rev 1.9. protocol. | 30 | - Intel SVID rev 1.9. protocol. |
| @@ -765,7 +765,7 @@ is not sufficient this sometimes needs to be explicit. · 764 unmodified lines | |||
| 765 | Example:: | 765 | Example:: |
| 766 | 766 | ||
| 767 | #arch/x86/boot/Makefile | 767 | #arch/x86/boot/Makefile |
| 768 | subdir- := compressed/ | 768 | subdir- := compressed |
| 769 | 769 | ||
| 770 | The above assignment instructs kbuild to descend down in the | 770 | The above assignment instructs kbuild to descend down in the |
| 771 | directory compressed/ when "make clean" is executed. | 771 | directory compressed/ when "make clean" is executed. |
| @@ -1379,9 +1379,6 @@ See subsequent chapter for the syntax of the Kbuild file. · 607 unmodified lines | |||
| 1379 | in arch/$(ARCH)/include/(uapi/)/asm, Kbuild will automatically generate | 1379 | in arch/$(ARCH)/include/(uapi/)/asm, Kbuild will automatically generate |
| 1380 | a wrapper of the asm-generic one. | 1380 | a wrapper of the asm-generic one. |
| 1381 | 1381 | ||
| 1382 | The convention is to list one subdir per line and | ||
| 1383 | preferably in alphabetic order. | ||
| 1384 | |||
| 1385 | 8 Kbuild Variables | 1382 | 8 Kbuild Variables |
| 1386 | ================== | 1383 | ================== |
| 1387 | 1384 | ||
| @@ -487,8 +487,9 @@ phy_register_fixup_for_id():: · 486 unmodified lines | |||
| 487 | The stubs set one of the two matching criteria, and set the other one to | 487 | The stubs set one of the two matching criteria, and set the other one to |
| 488 | match anything. | 488 | match anything. |
| 489 | 489 | ||
| 490 | When phy_register_fixup() or \*_for_uid()/\*_for_id() is called at module, | 490 | When phy_register_fixup() or \*_for_uid()/\*_for_id() is called at module load |
| 491 | unregister fixup and free allocate memory are required. | 491 | time, the module needs to unregister the fixup and free allocated memory when |
| 492 | it's unloaded. | ||
| 492 | 493 | ||
| 493 | Call one of following function before unloading module:: | 494 | Call one of following function before unloading module:: |
| 494 | 495 | ||
| @@ -13,7 +13,6 @@ Power Management · 12 unmodified lines | |||
| 13 | drivers-testing | 13 | drivers-testing |
| 14 | energy-model | 14 | energy-model |
| 15 | freezing-of-tasks | 15 | freezing-of-tasks |
| 16 | interface | ||
| 17 | opp | 16 | opp |
| 18 | pci | 17 | pci |
| 19 | pm_qos_interface | 18 | pm_qos_interface |
| @@ -244,23 +244,23 @@ disclosure of a particular issue, unless requested by a response team or by · 243 unmodified lines | |||
| 244 | an involved disclosed party. The current ambassadors list: | 244 | an involved disclosed party. The current ambassadors list: |
| 245 | 245 | ||
| 246 | ============= ======================================================== | 246 | ============= ======================================================== |
| 247 | ARM | 247 | ARM Grant Likely <grant.likely@arm.com> |
| 248 | AMD Tom Lendacky <tom.lendacky@amd.com> | 248 | AMD Tom Lendacky <tom.lendacky@amd.com> |
| 249 | IBM | 249 | IBM |
| 250 | Intel Tony Luck <tony.luck@intel.com> | 250 | Intel Tony Luck <tony.luck@intel.com> |
| 251 | Qualcomm Trilok Soni <tsoni@codeaurora.org> | 251 | Qualcomm Trilok Soni <tsoni@codeaurora.org> |
| 252 | 252 | ||
| 253 | Microsoft Sasha Levin <sashal@kernel.org> | 253 | Microsoft James Morris <jamorris@linux.microsoft.com> |
| 254 | VMware | 254 | VMware |
| 255 | Xen Andrew Cooper <andrew.cooper3@citrix.com> | 255 | Xen Andrew Cooper <andrew.cooper3@citrix.com> |
| 256 | 256 | ||
| 257 | Canonical Tyler Hicks <tyhicks@canonical.com> | 257 | Canonical John Johansen <john.johansen@canonical.com> |
| 258 | Debian Ben Hutchings <ben@decadent.org.uk> | 258 | Debian Ben Hutchings <ben@decadent.org.uk> |
| 259 | Oracle Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 259 | Oracle Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> |
| 260 | Red Hat Josh Poimboeuf <jpoimboe@redhat.com> | 260 | Red Hat Josh Poimboeuf <jpoimboe@redhat.com> |
| 261 | SUSE Jiri Kosina <jkosina@suse.cz> | 261 | SUSE Jiri Kosina <jkosina@suse.cz> |
| 262 | 262 | ||
| 263 | Amazon Peter Bowen <pzb@amzn.com> | 263 | Amazon |
| 264 | Google Kees Cook <keescook@chromium.org> | 264 | Google Kees Cook <keescook@chromium.org> |
| 265 | ============= ======================================================== | 265 | ============= ======================================================== |
| 266 | 266 | ||
| @@ -30,4 +30,4 @@ if [ -n "$parallel" ] ; then · 29 unmodified lines | |||
| 30 | parallel="-j$parallel" | 30 | parallel="-j$parallel" |
| 31 | fi | 31 | fi |
| 32 | 32 | ||
| 33 | exec "$sphinx" "$parallel" "$@" | 33 | exec "$sphinx" $parallel "$@" |
| @@ -183,7 +183,7 @@ CVE分配 · 182 unmodified lines | |||
| 183 | VMware | 183 | VMware |
| 184 | Xen Andrew Cooper <andrew.cooper3@citrix.com> | 184 | Xen Andrew Cooper <andrew.cooper3@citrix.com> |
| 185 | 185 | ||
| 186 | Canonical Tyler Hicks <tyhicks@canonical.com> | 186 | Canonical John Johansen <john.johansen@canonical.com> |
| 187 | Debian Ben Hutchings <ben@decadent.org.uk> | 187 | Debian Ben Hutchings <ben@decadent.org.uk> |
| 188 | Oracle Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 188 | Oracle Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> |
| 189 | Red Hat Josh Poimboeuf <jpoimboe@redhat.com> | 189 | Red Hat Josh Poimboeuf <jpoimboe@redhat.com> |
| @@ -1,9 +1,11 @@ | |||
| 1 | ================== | ||
| 1 | Guest halt polling | 2 | Guest halt polling |
| 2 | ================== | 3 | ================== |
| 3 | 4 | ||
| 4 | The cpuidle_haltpoll driver, with the haltpoll governor, allows | 5 | The cpuidle_haltpoll driver, with the haltpoll governor, allows |
| 5 | the guest vcpus to poll for a specified amount of time before | 6 | the guest vcpus to poll for a specified amount of time before |
| 6 | halting. | 7 | halting. |
| 8 | |||
| 7 | This provides the following benefits to host side polling: | 9 | This provides the following benefits to host side polling: |
| 8 | 10 | ||
| 9 | 1) The POLL flag is set while polling is performed, which allows | 11 | 1) The POLL flag is set while polling is performed, which allows |
| @@ -29,18 +31,21 @@ Module Parameters · 19 unmodified lines | |||
| 29 | The haltpoll governor has 5 tunable module parameters: | 31 | The haltpoll governor has 5 tunable module parameters: |
| 30 | 32 | ||
| 31 | 1) guest_halt_poll_ns: | 33 | 1) guest_halt_poll_ns: |
| 34 | |||
| 32 | Maximum amount of time, in nanoseconds, that polling is | 35 | Maximum amount of time, in nanoseconds, that polling is |
| 33 | performed before halting. | 36 | performed before halting. |
| 34 | 37 | ||
| 35 | Default: 200000 | 38 | Default: 200000 |
| 36 | 39 | ||
| 37 | 2) guest_halt_poll_shrink: | 40 | 2) guest_halt_poll_shrink: |
| 41 | |||
| 38 | Division factor used to shrink per-cpu guest_halt_poll_ns when | 42 | Division factor used to shrink per-cpu guest_halt_poll_ns when |
| 39 | wakeup event occurs after the global guest_halt_poll_ns. | 43 | wakeup event occurs after the global guest_halt_poll_ns. |
| 40 | 44 | ||
| 41 | Default: 2 | 45 | Default: 2 |
| 42 | 46 | ||
| 43 | 3) guest_halt_poll_grow: | 47 | 3) guest_halt_poll_grow: |
| 48 | |||
| 44 | Multiplication factor used to grow per-cpu guest_halt_poll_ns | 49 | Multiplication factor used to grow per-cpu guest_halt_poll_ns |
| 45 | when event occurs after per-cpu guest_halt_poll_ns | 50 | when event occurs after per-cpu guest_halt_poll_ns |
| 46 | but before global guest_halt_poll_ns. | 51 | but before global guest_halt_poll_ns. |
| @@ -48,6 +53,7 @@ but before global guest_halt_poll_ns. · 1 unmodified line | |||
| 48 | Default: 2 | 53 | Default: 2 |
| 49 | 54 | ||
| 50 | 4) guest_halt_poll_grow_start: | 55 | 4) guest_halt_poll_grow_start: |
| 56 | |||
| 51 | The per-cpu guest_halt_poll_ns eventually reaches zero | 57 | The per-cpu guest_halt_poll_ns eventually reaches zero |
| 52 | in case of an idle system. This value sets the initial | 58 | in case of an idle system. This value sets the initial |
| 53 | per-cpu guest_halt_poll_ns when growing. This can | 59 | per-cpu guest_halt_poll_ns when growing. This can |
| @@ -66,7 +72,7 @@ high once achieves global guest_halt_poll_ns value). · 12 unmodified lines | |||
| 66 | 72 | ||
| 67 | Default: Y | 73 | Default: Y |
| 68 | 74 | ||
| 69 | The module parameters can be set from the debugfs files in: | 75 | The module parameters can be set from the debugfs files in:: |
| 70 | 76 | ||
| 71 | /sys/module/haltpoll/parameters/ | 77 | /sys/module/haltpoll/parameters/ |
| 72 | 78 | ||
| @@ -74,5 +80,5 @@ Further Notes · 1 unmodified line | |||
| 74 | ============= | 80 | ============= |
| 75 | 81 | ||
| 76 | - Care should be taken when setting the guest_halt_poll_ns parameter as a | 82 | - Care should be taken when setting the guest_halt_poll_ns parameter as a |
| 77 | large value has the potential to drive the cpu usage to 100% on a machine which | 83 | large value has the potential to drive the cpu usage to 100% on a machine |
| 78 | would be almost entirely idle otherwise. | 84 | which would be almost entirely idle otherwise. |
| @@ -8,7 +8,9 @@ Linux Virtualization Support · 7 unmodified lines | |||
| 8 | :maxdepth: 2 | 8 | :maxdepth: 2 |
| 9 | 9 | ||
| 10 | kvm/index | 10 | kvm/index |
| 11 | uml/user_mode_linux | ||
| 11 | paravirt_ops | 12 | paravirt_ops |
| 13 | guest-halt-polling | ||
| 12 | 14 | ||
| 13 | .. only:: html and subproject | 15 | .. only:: html and subproject |
| 14 | 16 | ||
| @@ -1,8 +1,11 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | =================================================================== | ||
| 1 | The Definitive KVM (Kernel-based Virtual Machine) API Documentation | 4 | The Definitive KVM (Kernel-based Virtual Machine) API Documentation |
| 2 | =================================================================== | 5 | =================================================================== |
| 3 | 6 | ||
| 4 | 1. General description | 7 | 1. General description |
| 5 | ---------------------- | 8 | ====================== |
| 6 | 9 | ||
| 7 | The kvm API is a set of ioctls that are issued to control various aspects | 10 | The kvm API is a set of ioctls that are issued to control various aspects |
| 8 | of a virtual machine. The ioctls belong to the following classes: | 11 | of a virtual machine. The ioctls belong to the following classes: |
| @@ -33,7 +36,7 @@ of a virtual machine. The ioctls belong to the following classes: · 24 unmodified lines | |||
| 33 | was used to create the VM. | 36 | was used to create the VM. |
| 34 | 37 | ||
| 35 | 2. File descriptors | 38 | 2. File descriptors |
| 36 | ------------------- | 39 | =================== |
| 37 | 40 | ||
| 38 | The kvm API is centered around file descriptors. An initial | 41 | The kvm API is centered around file descriptors. An initial |
| 39 | open("/dev/kvm") obtains a handle to the kvm subsystem; this handle | 42 | open("/dev/kvm") obtains a handle to the kvm subsystem; this handle |
| @@ -70,7 +73,7 @@ the VM is shut down. · 30 unmodified lines | |||
| 70 | 73 | ||
| 71 | 74 | ||
| 72 | 3. Extensions | 75 | 3. Extensions |
| 73 | ------------- | 76 | ============= |
| 74 | 77 | ||
| 75 | As of Linux 2.6.22, the KVM ABI has been stabilized: no backward | 78 | As of Linux 2.6.22, the KVM ABI has been stabilized: no backward |
| 76 | incompatible change are allowed. However, there is an extension | 79 | incompatible change are allowed. However, there is an extension |
| @@ -84,13 +87,14 @@ set of ioctls is available for application use. · 7 unmodified lines | |||
| 84 | 87 | ||
| 85 | 88 | ||
| 86 | 4. API description | 89 | 4. API description |
| 87 | ------------------ | 90 | ================== |
| 88 | 91 | ||
| 89 | This section describes ioctls that can be used to control kvm guests. | 92 | This section describes ioctls that can be used to control kvm guests. |
| 90 | For each ioctl, the following information is provided along with a | 93 | For each ioctl, the following information is provided along with a |
| 91 | description: | 94 | description: |
| 92 | 95 | ||
| 93 | Capability: which KVM extension provides this ioctl. Can be 'basic', | 96 | Capability: |
| 97 | which KVM extension provides this ioctl. Can be 'basic', | ||
| 94 | which means that is will be provided by any kernel that supports | 98 | which means that is will be provided by any kernel that supports |
| 95 | API version 12 (see section 4.1), a KVM_CAP_xyz constant, which | 99 | API version 12 (see section 4.1), a KVM_CAP_xyz constant, which |
| 96 | means availability needs to be checked with KVM_CHECK_EXTENSION | 100 | means availability needs to be checked with KVM_CHECK_EXTENSION |
| @@ -99,24 +103,29 @@ description: · 2 unmodified lines | |||
| 99 | availability: for kernels that don't support the ioctl, | 103 | availability: for kernels that don't support the ioctl, |
| 100 | the ioctl returns -ENOTTY. | 104 | the ioctl returns -ENOTTY. |
| 101 | 105 | ||
| 102 | Architectures: which instruction set architectures provide this ioctl. | 106 | Architectures: |
| 107 | which instruction set architectures provide this ioctl. | ||
| 103 | x86 includes both i386 and x86_64. | 108 | x86 includes both i386 and x86_64. |
| 104 | 109 | ||
| 105 | Type: system, vm, or vcpu. | 110 | Type: |
| 111 | system, vm, or vcpu. | ||
| 106 | 112 | ||
| 107 | Parameters: what parameters are accepted by the ioctl. | 113 | Parameters: |
| 114 | what parameters are accepted by the ioctl. | ||
| 108 | 115 | ||
| 109 | Returns: the return value. General error numbers (EBADF, ENOMEM, EINVAL) | 116 | Returns: |
| 117 | the return value. General error numbers (EBADF, ENOMEM, EINVAL) | ||
| 110 | are not detailed, but errors with specific meanings are. | 118 | are not detailed, but errors with specific meanings are. |
| 111 | 119 | ||
| 112 | 120 | ||
| 113 | 4.1 KVM_GET_API_VERSION | 121 | 4.1 KVM_GET_API_VERSION |
| 122 | ----------------------- | ||
| 114 | 123 | ||
| 115 | Capability: basic | 124 | :Capability: basic |
| 116 | Architectures: all | 125 | :Architectures: all |
| 117 | Type: system ioctl | 126 | :Type: system ioctl |
| 118 | Parameters: none | 127 | :Parameters: none |
| 119 | Returns: the constant KVM_API_VERSION (=12) | 128 | :Returns: the constant KVM_API_VERSION (=12) |
| 120 | 129 | ||
| 121 | This identifies the API version as the stable kvm API. It is not | 130 | This identifies the API version as the stable kvm API. It is not |
| 122 | expected that this number will change. However, Linux 2.6.20 and | 131 | expected that this number will change. However, Linux 2.6.20 and |
| @@ -127,12 +136,13 @@ described as 'basic' will be available. · 4 unmodified lines | |||
| 127 | 136 | ||
| 128 | 137 | ||
| 129 | 4.2 KVM_CREATE_VM | 138 | 4.2 KVM_CREATE_VM |
| 139 | ----------------- | ||
| 130 | 140 | ||
| 131 | Capability: basic | 141 | :Capability: basic |
| 132 | Architectures: all | 142 | :Architectures: all |
| 133 | Type: system ioctl | 143 | :Type: system ioctl |
| 134 | Parameters: machine type identifier (KVM_VM_*) | 144 | :Parameters: machine type identifier (KVM_VM_*) |
| 135 | Returns: a VM fd that can be used to control the new virtual machine. | 145 | :Returns: a VM fd that can be used to control the new virtual machine. |
| 136 | 146 | ||
| 137 | The new VM has no virtual cpus and no memory. | 147 | The new VM has no virtual cpus and no memory. |
| 138 | You probably want to use 0 as machine type. | 148 | You probably want to use 0 as machine type. |
| @@ -155,17 +165,17 @@ identifier, where IPA_Bits is the maximum width of any physical · 16 unmodified lines | |||
| 155 | address used by the VM. The IPA_Bits is encoded in bits[7-0] of the | 165 | address used by the VM. The IPA_Bits is encoded in bits[7-0] of the |
| 156 | machine type identifier. | 166 | machine type identifier. |
| 157 | 167 | ||
| 158 | e.g, to configure a guest to use 48bit physical address size : | 168 | e.g, to configure a guest to use 48bit physical address size:: |
| 159 | 169 | ||
| 160 | vm_fd = ioctl(dev_fd, KVM_CREATE_VM, KVM_VM_TYPE_ARM_IPA_SIZE(48)); | 170 | vm_fd = ioctl(dev_fd, KVM_CREATE_VM, KVM_VM_TYPE_ARM_IPA_SIZE(48)); |
| 161 | 171 | ||
| 162 | The requested size (IPA_Bits) must be : | 172 | The requested size (IPA_Bits) must be: |
| 163 | 0 - Implies default size, 40bits (for backward compatibility) | ||
| 164 | 173 | ||
| 165 | or | 174 | == ========================================================= |
| 166 | 175 | 0 Implies default size, 40bits (for backward compatibility) | |
| 167 | N - Implies N bits, where N is a positive integer such that, | 176 | N Implies N bits, where N is a positive integer such that, |
| 168 | 32 <= N <= Host_IPA_Limit | 177 | 32 <= N <= Host_IPA_Limit |
| 178 | == ========================================================= | ||
| 169 | 179 | ||
| 170 | Host_IPA_Limit is the maximum possible value for IPA_Bits on the host and | 180 | Host_IPA_Limit is the maximum possible value for IPA_Bits on the host and |
| 171 | is dependent on the CPU capability and the kernel configuration. The limit can | 181 | is dependent on the CPU capability and the kernel configuration. The limit can |
| @@ -179,21 +189,28 @@ host physical address translations). · 7 unmodified lines | |||
| 179 | 189 | ||
| 180 | 190 | ||
| 181 | 4.3 KVM_GET_MSR_INDEX_LIST, KVM_GET_MSR_FEATURE_INDEX_LIST | 191 | 4.3 KVM_GET_MSR_INDEX_LIST, KVM_GET_MSR_FEATURE_INDEX_LIST |
| 192 | ---------------------------------------------------------- | ||
| 193 | |||
| 194 | :Capability: basic, KVM_CAP_GET_MSR_FEATURES for KVM_GET_MSR_FEATURE_INDEX_LIST | ||
| 195 | :Architectures: x86 | ||
| 196 | :Type: system ioctl | ||
| 197 | :Parameters: struct kvm_msr_list (in/out) | ||
| 198 | :Returns: 0 on success; -1 on error | ||
| 182 | 199 | ||
| 183 | Capability: basic, KVM_CAP_GET_MSR_FEATURES for KVM_GET_MSR_FEATURE_INDEX_LIST | ||
| 184 | Architectures: x86 | ||
| 185 | Type: system ioctl | ||
| 186 | Parameters: struct kvm_msr_list (in/out) | ||
| 187 | Returns: 0 on success; -1 on error | ||
| 188 | Errors: | 200 | Errors: |
| 189 | EFAULT: the msr index list cannot be read from or written to | 201 | |
| 190 | E2BIG: the msr index list is to be to fit in the array specified by | 202 | ====== ============================================================ |
| 203 | EFAULT the msr index list cannot be read from or written to | ||
| 204 | E2BIG the msr index list is to be to fit in the array specified by | ||
| 191 | the user. | 205 | the user. |
| 206 | ====== ============================================================ | ||
| 192 | 207 | ||
| 193 | struct kvm_msr_list { | 208 | :: |
| 209 | |||
| 210 | struct kvm_msr_list { | ||
| 194 | __u32 nmsrs; /* number of msrs in entries */ | 211 | __u32 nmsrs; /* number of msrs in entries */ |
| 195 | __u32 indices[0]; | 212 | __u32 indices[0]; |
| 196 | }; | 213 | }; |
| 197 | 214 | ||
| 198 | The user fills in the size of the indices array in nmsrs, and in return | 215 | The user fills in the size of the indices array in nmsrs, and in return |
| 199 | kvm adjusts nmsrs to reflect the actual number of msrs and fills in the | 216 | kvm adjusts nmsrs to reflect the actual number of msrs and fills in the |
| @@ -214,12 +231,13 @@ otherwise. · 14 unmodified lines | |||
| 214 | 231 | ||
| 215 | 232 | ||
| 216 | 4.4 KVM_CHECK_EXTENSION | 233 | 4.4 KVM_CHECK_EXTENSION |
| 234 | ----------------------- | ||
| 217 | 235 | ||
| 218 | Capability: basic, KVM_CAP_CHECK_EXTENSION_VM for vm ioctl | 236 | :Capability: basic, KVM_CAP_CHECK_EXTENSION_VM for vm ioctl |
| 219 | Architectures: all | 237 | :Architectures: all |
| 220 | Type: system ioctl, vm ioctl | 238 | :Type: system ioctl, vm ioctl |
| 221 | Parameters: extension identifier (KVM_CAP_*) | 239 | :Parameters: extension identifier (KVM_CAP_*) |
| 222 | Returns: 0 if unsupported; 1 (or some other positive integer) if supported | 240 | :Returns: 0 if unsupported; 1 (or some other positive integer) if supported |
| 223 | 241 | ||
| 224 | The API allows the application to query about extensions to the core | 242 | The API allows the application to query about extensions to the core |
| 225 | kvm API. Userspace passes an extension identifier (an integer) and | 243 | kvm API. Userspace passes an extension identifier (an integer) and |
| @@ -232,12 +250,13 @@ It is thus encouraged to use the vm ioctl to query for capabilities (available · 6 unmodified lines | |||
| 232 | with KVM_CAP_CHECK_EXTENSION_VM on the vm fd) | 250 | with KVM_CAP_CHECK_EXTENSION_VM on the vm fd) |
| 233 | 251 | ||
| 234 | 4.5 KVM_GET_VCPU_MMAP_SIZE | 252 | 4.5 KVM_GET_VCPU_MMAP_SIZE |
| 253 | -------------------------- | ||
| 235 | 254 | ||
| 236 | Capability: basic | 255 | :Capability: basic |
| 237 | Architectures: all | 256 | :Architectures: all |
| 238 | Type: system ioctl | 257 | :Type: system ioctl |
| 239 | Parameters: none | 258 | :Parameters: none |
| 240 | Returns: size of vcpu mmap area, in bytes | 259 | :Returns: size of vcpu mmap area, in bytes |
| 241 | 260 | ||
| 242 | The KVM_RUN ioctl (cf.) communicates with userspace via a shared | 261 | The KVM_RUN ioctl (cf.) communicates with userspace via a shared |
| 243 | memory region. This ioctl returns the size of that region. See the | 262 | memory region. This ioctl returns the size of that region. See the |
| @@ -245,23 +264,25 @@ KVM_RUN documentation for details. · 1 unmodified line | |||
| 245 | 264 | ||
| 246 | 265 | ||
| 247 | 4.6 KVM_SET_MEMORY_REGION | 266 | 4.6 KVM_SET_MEMORY_REGION |
| 267 | ------------------------- | ||
| 248 | 268 | ||
| 249 | Capability: basic | 269 | :Capability: basic |
| 250 | Architectures: all | 270 | :Architectures: all |
| 251 | Type: vm ioctl | 271 | :Type: vm ioctl |
| 252 | Parameters: struct kvm_memory_region (in) | 272 | :Parameters: struct kvm_memory_region (in) |
| 253 | Returns: 0 on success, -1 on error | 273 | :Returns: 0 on success, -1 on error |
| 254 | 274 | ||
| 255 | This ioctl is obsolete and has been removed. | 275 | This ioctl is obsolete and has been removed. |
| 256 | 276 | ||
| 257 | 277 | ||
| 258 | 4.7 KVM_CREATE_VCPU | 278 | 4.7 KVM_CREATE_VCPU |
| 279 | ------------------- | ||
| 259 | 280 | ||
| 260 | Capability: basic | 281 | :Capability: basic |
| 261 | Architectures: all | 282 | :Architectures: all |
| 262 | Type: vm ioctl | 283 | :Type: vm ioctl |
| 263 | Parameters: vcpu id (apic id on x86) | 284 | :Parameters: vcpu id (apic id on x86) |
| 264 | Returns: vcpu fd on success, -1 on error | 285 | :Returns: vcpu fd on success, -1 on error |
| 265 | 286 | ||
| 266 | This API adds a vcpu to a virtual machine. No more than max_vcpus may be added. | 287 | This API adds a vcpu to a virtual machine. No more than max_vcpus may be added. |
| 267 | The vcpu id is an integer in the range [0, max_vcpu_id). | 288 | The vcpu id is an integer in the range [0, max_vcpu_id). |
| @@ -302,22 +323,25 @@ cpu's hardware control block. · 34 unmodified lines | |||
| 302 | 323 | ||
| 303 | 324 | ||
| 304 | 4.8 KVM_GET_DIRTY_LOG (vm ioctl) | 325 | 4.8 KVM_GET_DIRTY_LOG (vm ioctl) |
| 326 | -------------------------------- | ||
| 305 | 327 | ||
| 306 | Capability: basic | 328 | :Capability: basic |
| 307 | Architectures: all | 329 | :Architectures: all |
| 308 | Type: vm ioctl | 330 | :Type: vm ioctl |
| 309 | Parameters: struct kvm_dirty_log (in/out) | 331 | :Parameters: struct kvm_dirty_log (in/out) |
| 310 | Returns: 0 on success, -1 on error | 332 | :Returns: 0 on success, -1 on error |
| 311 | 333 | ||
| 312 | /* for KVM_GET_DIRTY_LOG */ | 334 | :: |
| 313 | struct kvm_dirty_log { | 335 | |
| 336 | /* for KVM_GET_DIRTY_LOG */ | ||
| 337 | struct kvm_dirty_log { | ||
| 314 | __u32 slot; | 338 | __u32 slot; |
| 315 | __u32 padding; | 339 | __u32 padding; |
| 316 | union { | 340 | union { |
| 317 | void __user *dirty_bitmap; /* one bit per page */ | 341 | void __user *dirty_bitmap; /* one bit per page */ |
| 318 | __u64 padding; | 342 | __u64 padding; |
| 319 | }; | 343 | }; |
| 320 | }; | 344 | }; |
| 321 | 345 | ||
| 322 | Given a memory slot, return a bitmap containing any pages dirtied | 346 | Given a memory slot, return a bitmap containing any pages dirtied |
| 323 | since the last call to this ioctl. Bit 0 is the first page in the | 347 | since the last call to this ioctl. Bit 0 is the first page in the |
| @@ -334,25 +358,31 @@ KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is enabled. For more information, · 10 unmodified lines | |||
| 334 | see the description of the capability. | 358 | see the description of the capability. |
| 335 | 359 | ||
| 336 | 4.9 KVM_SET_MEMORY_ALIAS | 360 | 4.9 KVM_SET_MEMORY_ALIAS |
| 361 | ------------------------ | ||
| 337 | 362 | ||
| 338 | Capability: basic | 363 | :Capability: basic |
| 339 | Architectures: x86 | 364 | :Architectures: x86 |
| 340 | Type: vm ioctl | 365 | :Type: vm ioctl |
| 341 | Parameters: struct kvm_memory_alias (in) | 366 | :Parameters: struct kvm_memory_alias (in) |
| 342 | Returns: 0 (success), -1 (error) | 367 | :Returns: 0 (success), -1 (error) |
| 343 | 368 | ||
| 344 | This ioctl is obsolete and has been removed. | 369 | This ioctl is obsolete and has been removed. |
| 345 | 370 | ||
| 346 | 371 | ||
| 347 | 4.10 KVM_RUN | 372 | 4.10 KVM_RUN |
| 373 | ------------ | ||
| 374 | |||
| 375 | :Capability: basic | ||
| 376 | :Architectures: all | ||
| 377 | :Type: vcpu ioctl | ||
| 378 | :Parameters: none | ||
| 379 | :Returns: 0 on success, -1 on error | ||
| 348 | 380 | ||
| 349 | Capability: basic | ||
| 350 | Architectures: all | ||
| 351 | Type: vcpu ioctl | ||
| 352 | Parameters: none | ||
| 353 | Returns: 0 on success, -1 on error | ||
| 354 | Errors: | 381 | Errors: |
| 355 | EINTR: an unmasked signal is pending | 382 | |
| 383 | ===== ============================= | ||
| 384 | EINTR an unmasked signal is pending | ||
| 385 | ===== ============================= | ||
| 356 | 386 | ||
| 357 | This ioctl is used to run a guest virtual cpu. While there are no | 387 | This ioctl is used to run a guest virtual cpu. While there are no |
| 358 | explicit parameters, there is an implicit parameter block that can be | 388 | explicit parameters, there is an implicit parameter block that can be |
| @@ -362,42 +392,46 @@ kvm_run' (see below). · 3 unmodified lines | |||
| 362 | 392 | ||
| 363 | 393 | ||
| 364 | 4.11 KVM_GET_REGS | 394 | 4.11 KVM_GET_REGS |
| 395 | ----------------- | ||
| 365 | 396 | ||
| 366 | Capability: basic | 397 | :Capability: basic |
| 367 | Architectures: all except ARM, arm64 | 398 | :Architectures: all except ARM, arm64 |
| 368 | Type: vcpu ioctl | 399 | :Type: vcpu ioctl |
| 369 | Parameters: struct kvm_regs (out) | 400 | :Parameters: struct kvm_regs (out) |
| 370 | Returns: 0 on success, -1 on error | 401 | :Returns: 0 on success, -1 on error |
| 371 | 402 | ||
| 372 | Reads the general purpose registers from the vcpu. | 403 | Reads the general purpose registers from the vcpu. |
| 373 | 404 | ||
| 374 | /* x86 */ | 405 | :: |
| 375 | struct kvm_regs { | 406 | |
| 407 | /* x86 */ | ||
| 408 | struct kvm_regs { | ||
| 376 | /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ | 409 | /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ |
| 377 | __u64 rax, rbx, rcx, rdx; | 410 | __u64 rax, rbx, rcx, rdx; |
| 378 | __u64 rsi, rdi, rsp, rbp; | 411 | __u64 rsi, rdi, rsp, rbp; |
| 379 | __u64 r8, r9, r10, r11; | 412 | __u64 r8, r9, r10, r11; |
| 380 | __u64 r12, r13, r14, r15; | 413 | __u64 r12, r13, r14, r15; |
| 381 | __u64 rip, rflags; | 414 | __u64 rip, rflags; |
| 382 | }; | 415 | }; |
| 383 | 416 | ||
| 384 | /* mips */ | 417 | /* mips */ |
| 385 | struct kvm_regs { | 418 | struct kvm_regs { |
| 386 | /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ | 419 | /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ |
| 387 | __u64 gpr[32]; | 420 | __u64 gpr[32]; |
| 388 | __u64 hi; | 421 | __u64 hi; |
| 389 | __u64 lo; | 422 | __u64 lo; |
| 390 | __u64 pc; | 423 | __u64 pc; |
| 391 | }; | 424 | }; |
| 392 | 425 | ||
| 393 | 426 | ||
| 394 | 4.12 KVM_SET_REGS | 427 | 4.12 KVM_SET_REGS |
| 428 | ----------------- | ||
| 395 | 429 | ||
| 396 | Capability: basic | 430 | :Capability: basic |
| 397 | Architectures: all except ARM, arm64 | 431 | :Architectures: all except ARM, arm64 |
| 398 | Type: vcpu ioctl | 432 | :Type: vcpu ioctl |
| 399 | Parameters: struct kvm_regs (in) | 433 | :Parameters: struct kvm_regs (in) |
| 400 | Returns: 0 on success, -1 on error | 434 | :Returns: 0 on success, -1 on error |
| 401 | 435 | ||
| 402 | Writes the general purpose registers into the vcpu. | 436 | Writes the general purpose registers into the vcpu. |
| 403 | 437 | ||
| @@ -405,17 +439,20 @@ See KVM_GET_REGS for the data structure. · 1 unmodified line | |||
| 405 | 439 | ||
| 406 | 440 | ||
| 407 | 4.13 KVM_GET_SREGS | 441 | 4.13 KVM_GET_SREGS |
| 442 | ------------------ | ||
| 408 | 443 | ||
| 409 | Capability: basic | 444 | :Capability: basic |
| 410 | Architectures: x86, ppc | 445 | :Architectures: x86, ppc |
| 411 | Type: vcpu ioctl | 446 | :Type: vcpu ioctl |
| 412 | Parameters: struct kvm_sregs (out) | 447 | :Parameters: struct kvm_sregs (out) |
| 413 | Returns: 0 on success, -1 on error | 448 | :Returns: 0 on success, -1 on error |
| 414 | 449 | ||
| 415 | Reads special registers from the vcpu. | 450 | Reads special registers from the vcpu. |
| 416 | 451 | ||
| 417 | /* x86 */ | 452 | :: |
| 418 | struct kvm_sregs { | 453 | |
| 454 | /* x86 */ | ||
| 455 | struct kvm_sregs { | ||
| 419 | struct kvm_segment cs, ds, es, fs, gs, ss; | 456 | struct kvm_segment cs, ds, es, fs, gs, ss; |
| 420 | struct kvm_segment tr, ldt; | 457 | struct kvm_segment tr, ldt; |
| 421 | struct kvm_dtable gdt, idt; | 458 | struct kvm_dtable gdt, idt; |
| @@ -423,9 +460,9 @@ struct kvm_sregs { · 1 unmodified line | |||
| 423 | __u64 efer; | 460 | __u64 efer; |
| 424 | __u64 apic_base; | 461 | __u64 apic_base; |
| 425 | __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64]; | 462 | __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64]; |
| 426 | }; | 463 | }; |
| 427 | 464 | ||
| 428 | /* ppc -- see arch/powerpc/include/uapi/asm/kvm.h */ | 465 | /* ppc -- see arch/powerpc/include/uapi/asm/kvm.h */ |
| 429 | 466 | ||
| 430 | interrupt_bitmap is a bitmap of pending external interrupts. At most | 467 | interrupt_bitmap is a bitmap of pending external interrupts. At most |
| 431 | one bit may be set. This interrupt has been acknowledged by the APIC | 468 | one bit may be set. This interrupt has been acknowledged by the APIC |
| @@ -433,29 +470,33 @@ but not yet injected into the cpu core. · 1 unmodified line | |||
| 433 | 470 | ||
| 434 | 471 | ||
| 435 | 4.14 KVM_SET_SREGS | 472 | 4.14 KVM_SET_SREGS |
| 473 | ------------------ | ||
| 436 | 474 | ||
| 437 | Capability: basic | 475 | :Capability: basic |
| 438 | Architectures: x86, ppc | 476 | :Architectures: x86, ppc |
| 439 | Type: vcpu ioctl | 477 | :Type: vcpu ioctl |
| 440 | Parameters: struct kvm_sregs (in) | 478 | :Parameters: struct kvm_sregs (in) |
| 441 | Returns: 0 on success, -1 on error | 479 | :Returns: 0 on success, -1 on error |
| 442 | 480 | ||
| 443 | Writes special registers into the vcpu. See KVM_GET_SREGS for the | 481 | Writes special registers into the vcpu. See KVM_GET_SREGS for the |
| 444 | data structures. | 482 | data structures. |
| 445 | 483 | ||
| 446 | 484 | ||
| 447 | 4.15 KVM_TRANSLATE | 485 | 4.15 KVM_TRANSLATE |
| 486 | ------------------ | ||
| 448 | 487 | ||
| 449 | Capability: basic | 488 | :Capability: basic |
| 450 | Architectures: x86 | 489 | :Architectures: x86 |
| 451 | Type: vcpu ioctl | 490 | :Type: vcpu ioctl |
| 452 | Parameters: struct kvm_translation (in/out) | 491 | :Parameters: struct kvm_translation (in/out) |
| 453 | Returns: 0 on success, -1 on error | 492 | :Returns: 0 on success, -1 on error |
| 454 | 493 | ||
| 455 | Translates a virtual address according to the vcpu's current address | 494 | Translates a virtual address according to the vcpu's current address |
| 456 | translation mode. | 495 | translation mode. |
| 457 | 496 | ||
| 458 | struct kvm_translation { | 497 | :: |
| 498 | |||
| 499 | struct kvm_translation { | ||
| 459 | /* in */ | 500 | /* in */ |
| 460 | __u64 linear_address; | 501 | __u64 linear_address; |
| 461 | 502 | ||
| @@ -465,59 +506,68 @@ struct kvm_translation { · 3 unmodified lines | |||
| 465 | __u8 writeable; | 506 | __u8 writeable; |
| 466 | __u8 usermode; | 507 | __u8 usermode; |
| 467 | __u8 pad[5]; | 508 | __u8 pad[5]; |
| 468 | }; | 509 | }; |
| 469 | 510 | ||
| 470 | 511 | ||
| 471 | 4.16 KVM_INTERRUPT | 512 | 4.16 KVM_INTERRUPT |
| 513 | ------------------ | ||
| 472 | 514 | ||
| 473 | Capability: basic | 515 | :Capability: basic |
| 474 | Architectures: x86, ppc, mips | 516 | :Architectures: x86, ppc, mips |
| 475 | Type: vcpu ioctl | 517 | :Type: vcpu ioctl |
| 476 | Parameters: struct kvm_interrupt (in) | 518 | :Parameters: struct kvm_interrupt (in) |
| 477 | Returns: 0 on success, negative on failure. | 519 | :Returns: 0 on success, negative on failure. |
| 478 | 520 | ||
| 479 | Queues a hardware interrupt vector to be injected. | 521 | Queues a hardware interrupt vector to be injected. |
| 480 | 522 | ||
| 481 | /* for KVM_INTERRUPT */ | 523 | :: |
| 482 | struct kvm_interrupt { | 524 | |
| 525 | /* for KVM_INTERRUPT */ | ||
| 526 | struct kvm_interrupt { | ||
| 483 | /* in */ | 527 | /* in */ |
| 484 | __u32 irq; | 528 | __u32 irq; |
| 485 | }; | 529 | }; |
| 486 | 530 | ||
| 487 | X86: | 531 | X86: |
| 532 | ^^^^ | ||
| 533 | |||
| 534 | :Returns: | ||
| 488 | 535 | ||
| 489 | Returns: 0 on success, | 536 | ========= =================================== |
| 490 | -EEXIST if an interrupt is already enqueued | 537 | 0 on success, |
| 491 | -EINVAL the the irq number is invalid | 538 | -EEXIST if an interrupt is already enqueued |
| 492 | -ENXIO if the PIC is in the kernel | 539 | -EINVAL the the irq number is invalid |
| 493 | -EFAULT if the pointer is invalid | 540 | -ENXIO if the PIC is in the kernel |
| 541 | -EFAULT if the pointer is invalid | ||
| 542 | ========= =================================== | ||
| 494 | 543 | ||
| 495 | Note 'irq' is an interrupt vector, not an interrupt pin or line. This | 544 | Note 'irq' is an interrupt vector, not an interrupt pin or line. This |
| 496 | ioctl is useful if the in-kernel PIC is not used. | 545 | ioctl is useful if the in-kernel PIC is not used. |
| 497 | 546 | ||
| 498 | PPC: | 547 | PPC: |
| 548 | ^^^^ | ||
| 499 | 549 | ||
| 500 | Queues an external interrupt to be injected. This ioctl is overleaded | 550 | Queues an external interrupt to be injected. This ioctl is overleaded |
| 501 | with 3 different irq values: | 551 | with 3 different irq values: |
| 502 | 552 | ||
| 503 | a) KVM_INTERRUPT_SET | 553 | a) KVM_INTERRUPT_SET |
| 504 | 554 | ||
| 505 | This injects an edge type external interrupt into the guest once it's ready | 555 | This injects an edge type external interrupt into the guest once it's ready |
| 506 | to receive interrupts. When injected, the interrupt is done. | 556 | to receive interrupts. When injected, the interrupt is done. |
| 507 | 557 | ||
| 508 | b) KVM_INTERRUPT_UNSET | 558 | b) KVM_INTERRUPT_UNSET |
| 509 | 559 | ||
| 510 | This unsets any pending interrupt. | 560 | This unsets any pending interrupt. |
| 511 | 561 | ||
| 512 | Only available with KVM_CAP_PPC_UNSET_IRQ. | 562 | Only available with KVM_CAP_PPC_UNSET_IRQ. |
| 513 | 563 | ||
| 514 | c) KVM_INTERRUPT_SET_LEVEL | 564 | c) KVM_INTERRUPT_SET_LEVEL |
| 515 | 565 | ||
| 516 | This injects a level type external interrupt into the guest context. The | 566 | This injects a level type external interrupt into the guest context. The |
| 517 | interrupt stays pending until a specific ioctl with KVM_INTERRUPT_UNSET | 567 | interrupt stays pending until a specific ioctl with KVM_INTERRUPT_UNSET |
| 518 | is triggered. | 568 | is triggered. |
| 519 | 569 | ||
| 520 | Only available with KVM_CAP_PPC_IRQ_LEVEL. | 570 | Only available with KVM_CAP_PPC_IRQ_LEVEL. |
| 521 | 571 | ||
| 522 | Note that any value for 'irq' other than the ones stated above is invalid | 572 | Note that any value for 'irq' other than the ones stated above is invalid |
| 523 | and incurs unexpected behavior. | 573 | and incurs unexpected behavior. |
| @@ -525,6 +575,7 @@ and incurs unexpected behavior. · 1 unmodified line | |||
| 525 | This is an asynchronous vcpu ioctl and can be invoked from any thread. | 575 | This is an asynchronous vcpu ioctl and can be invoked from any thread. |
| 526 | 576 | ||
| 527 | MIPS: | 577 | MIPS: |
| 578 | ^^^^^ | ||
| 528 | 579 | ||
| 529 | Queues an external interrupt to be injected into the virtual CPU. A negative | 580 | Queues an external interrupt to be injected into the virtual CPU. A negative |
| 530 | interrupt number dequeues the interrupt. | 581 | interrupt number dequeues the interrupt. |
| @@ -533,24 +584,26 @@ This is an asynchronous vcpu ioctl and can be invoked from any thread. · 2 unmodified lines | |||
| 533 | 584 | ||
| 534 | 585 | ||
| 535 | 4.17 KVM_DEBUG_GUEST | 586 | 4.17 KVM_DEBUG_GUEST |
| 587 | -------------------- | ||
| 536 | 588 | ||
| 537 | Capability: basic | 589 | :Capability: basic |
| 538 | Architectures: none | 590 | :Architectures: none |
| 539 | Type: vcpu ioctl | 591 | :Type: vcpu ioctl |
| 540 | Parameters: none) | 592 | :Parameters: none) |
| 541 | Returns: -1 on error | 593 | :Returns: -1 on error |
| 542 | 594 | ||
| 543 | Support for this has been removed. Use KVM_SET_GUEST_DEBUG instead. | 595 | Support for this has been removed. Use KVM_SET_GUEST_DEBUG instead. |
| 544 | 596 | ||
| 545 | 597 | ||
| 546 | 4.18 KVM_GET_MSRS | 598 | 4.18 KVM_GET_MSRS |
| 599 | ----------------- | ||
| 547 | 600 | ||
| 548 | Capability: basic (vcpu), KVM_CAP_GET_MSR_FEATURES (system) | 601 | :Capability: basic (vcpu), KVM_CAP_GET_MSR_FEATURES (system) |
| 549 | Architectures: x86 | 602 | :Architectures: x86 |
| 550 | Type: system ioctl, vcpu ioctl | 603 | :Type: system ioctl, vcpu ioctl |
| 551 | Parameters: struct kvm_msrs (in/out) | 604 | :Parameters: struct kvm_msrs (in/out) |
| 552 | Returns: number of msrs successfully returned; | 605 | :Returns: number of msrs successfully returned; |
| 553 | -1 on error | 606 | -1 on error |
| 554 | 607 | ||
| 555 | When used as a system ioctl: | 608 | When used as a system ioctl: |
| 556 | Reads the values of MSR-based features that are available for the VM. This | 609 | Reads the values of MSR-based features that are available for the VM. This |
| @@ -562,18 +615,20 @@ When used as a vcpu ioctl: · 5 unmodified lines | |||
| 562 | Reads model-specific registers from the vcpu. Supported msr indices can | 615 | Reads model-specific registers from the vcpu. Supported msr indices can |
| 563 | be obtained using KVM_GET_MSR_INDEX_LIST in a system ioctl. | 616 | be obtained using KVM_GET_MSR_INDEX_LIST in a system ioctl. |
| 564 | 617 | ||
| 565 | struct kvm_msrs { | 618 | :: |
| 619 | |||
| 620 | struct kvm_msrs { | ||
| 566 | __u32 nmsrs; /* number of msrs in entries */ | 621 | __u32 nmsrs; /* number of msrs in entries */ |
| 567 | __u32 pad; | 622 | __u32 pad; |
| 568 | 623 | ||
| 569 | struct kvm_msr_entry entries[0]; | 624 | struct kvm_msr_entry entries[0]; |
| 570 | }; | 625 | }; |
| 571 | 626 | ||
| 572 | struct kvm_msr_entry { | 627 | struct kvm_msr_entry { |
| 573 | __u32 index; | 628 | __u32 index; |
| 574 | __u32 reserved; | 629 | __u32 reserved; |
| 575 | __u64 data; | 630 | __u64 data; |
| 576 | }; | 631 | }; |
| 577 | 632 | ||
| 578 | Application code should set the 'nmsrs' member (which indicates the | 633 | Application code should set the 'nmsrs' member (which indicates the |
| 579 | size of the entries array) and the 'index' member of each array entry. | 634 | size of the entries array) and the 'index' member of each array entry. |
| @@ -581,12 +636,13 @@ kvm will fill in the 'data' member. · 1 unmodified line | |||
| 581 | 636 | ||
| 582 | 637 | ||
| 583 | 4.19 KVM_SET_MSRS | 638 | 4.19 KVM_SET_MSRS |
| 639 | ----------------- | ||
| 584 | 640 | ||
| 585 | Capability: basic | 641 | :Capability: basic |
| 586 | Architectures: x86 | 642 | :Architectures: x86 |
| 587 | Type: vcpu ioctl | 643 | :Type: vcpu ioctl |
| 588 | Parameters: struct kvm_msrs (in) | 644 | :Parameters: struct kvm_msrs (in) |
| 589 | Returns: number of msrs successfully set (see below), -1 on error | 645 | :Returns: number of msrs successfully set (see below), -1 on error |
| 590 | 646 | ||
| 591 | Writes model-specific registers to the vcpu. See KVM_GET_MSRS for the | 647 | Writes model-specific registers to the vcpu. See KVM_GET_MSRS for the |
| 592 | data structures. | 648 | data structures. |
| @@ -602,41 +658,44 @@ MSRs that have been set successfully. · 9 unmodified lines | |||
| 602 | 658 | ||
| 603 | 659 | ||
| 604 | 4.20 KVM_SET_CPUID | 660 | 4.20 KVM_SET_CPUID |
| 661 | ------------------ | ||
| 605 | 662 | ||
| 606 | Capability: basic | 663 | :Capability: basic |
| 607 | Architectures: x86 | 664 | :Architectures: x86 |
| 608 | Type: vcpu ioctl | 665 | :Type: vcpu ioctl |
| 609 | Parameters: struct kvm_cpuid (in) | 666 | :Parameters: struct kvm_cpuid (in) |
| 610 | Returns: 0 on success, -1 on error | 667 | :Returns: 0 on success, -1 on error |
| 611 | 668 | ||
| 612 | Defines the vcpu responses to the cpuid instruction. Applications | 669 | Defines the vcpu responses to the cpuid instruction. Applications |
| 613 | should use the KVM_SET_CPUID2 ioctl if available. | 670 | should use the KVM_SET_CPUID2 ioctl if available. |
| 614 | 671 | ||
| 672 | :: | ||
| 615 | 673 | ||
| 616 | struct kvm_cpuid_entry { | 674 | struct kvm_cpuid_entry { |
| 617 | __u32 function; | 675 | __u32 function; |
| 618 | __u32 eax; | 676 | __u32 eax; |
| 619 | __u32 ebx; | 677 | __u32 ebx; |
| 620 | __u32 ecx; | 678 | __u32 ecx; |
| 621 | __u32 edx; | 679 | __u32 edx; |
| 622 | __u32 padding; | 680 | __u32 padding; |
| 623 | }; | 681 | }; |
| 624 | 682 | ||
| 625 | /* for KVM_SET_CPUID */ | 683 | /* for KVM_SET_CPUID */ |
| 626 | struct kvm_cpuid { | 684 | struct kvm_cpuid { |
| 627 | __u32 nent; | 685 | __u32 nent; |
| 628 | __u32 padding; | 686 | __u32 padding; |
| 629 | struct kvm_cpuid_entry entries[0]; | 687 | struct kvm_cpuid_entry entries[0]; |
| 630 | }; | 688 | }; |
| 631 | 689 | ||
| 632 | 690 | ||
| 633 | 4.21 KVM_SET_SIGNAL_MASK | 691 | 4.21 KVM_SET_SIGNAL_MASK |
| 692 | ------------------------ | ||
| 634 | 693 | ||
| 635 | Capability: basic | 694 | :Capability: basic |
| 636 | Architectures: all | 695 | :Architectures: all |
| 637 | Type: vcpu ioctl | 696 | :Type: vcpu ioctl |
| 638 | Parameters: struct kvm_signal_mask (in) | 697 | :Parameters: struct kvm_signal_mask (in) |
| 639 | Returns: 0 on success, -1 on error | 698 | :Returns: 0 on success, -1 on error |
| 640 | 699 | ||
| 641 | Defines which signals are blocked during execution of KVM_RUN. This | 700 | Defines which signals are blocked during execution of KVM_RUN. This |
| 642 | signal mask temporarily overrides the threads signal mask. Any | 701 | signal mask temporarily overrides the threads signal mask. Any |
| @@ -646,25 +705,30 @@ their traditional behaviour) will cause KVM_RUN to return with -EINTR. · 3 unmodified lines | |||
| 646 | Note the signal will only be delivered if not blocked by the original | 705 | Note the signal will only be delivered if not blocked by the original |
| 647 | signal mask. | 706 | signal mask. |
| 648 | 707 | ||
| 649 | /* for KVM_SET_SIGNAL_MASK */ | 708 | :: |
| 650 | struct kvm_signal_mask { | 709 | |
| 710 | /* for KVM_SET_SIGNAL_MASK */ | ||
| 711 | struct kvm_signal_mask { | ||
| 651 | __u32 len; | 712 | __u32 len; |
| 652 | __u8 sigset[0]; | 713 | __u8 sigset[0]; |
| 653 | }; | 714 | }; |
| 654 | 715 | ||
| 655 | 716 | ||
| 656 | 4.22 KVM_GET_FPU | 717 | 4.22 KVM_GET_FPU |
| 718 | ---------------- | ||
| 657 | 719 | ||
| 658 | Capability: basic | 720 | :Capability: basic |
| 659 | Architectures: x86 | 721 | :Architectures: x86 |
| 660 | Type: vcpu ioctl | 722 | :Type: vcpu ioctl |
| 661 | Parameters: struct kvm_fpu (out) | 723 | :Parameters: struct kvm_fpu (out) |
| 662 | Returns: 0 on success, -1 on error | 724 | :Returns: 0 on success, -1 on error |
| 663 | 725 | ||
| 664 | Reads the floating point state from the vcpu. | 726 | Reads the floating point state from the vcpu. |
| 665 | 727 | ||
| 666 | /* for KVM_GET_FPU and KVM_SET_FPU */ | 728 | :: |
| 667 | struct kvm_fpu { | 729 | |
| 730 | /* for KVM_GET_FPU and KVM_SET_FPU */ | ||
| 731 | struct kvm_fpu { | ||
| 668 | __u8 fpr[8][16]; | 732 | __u8 fpr[8][16]; |
| 669 | __u16 fcw; | 733 | __u16 fcw; |
| 670 | __u16 fsw; | 734 | __u16 fsw; |
| @@ -676,21 +740,24 @@ struct kvm_fpu { · 5 unmodified lines | |||
| 676 | __u8 xmm[16][16]; | 740 | __u8 xmm[16][16]; |
| 677 | __u32 mxcsr; | 741 | __u32 mxcsr; |
| 678 | __u32 pad2; | 742 | __u32 pad2; |
| 679 | }; | 743 | }; |
| 680 | 744 | ||
| 681 | 745 | ||
| 682 | 4.23 KVM_SET_FPU | 746 | 4.23 KVM_SET_FPU |
| 747 | ---------------- | ||
| 683 | 748 | ||
| 684 | Capability: basic | 749 | :Capability: basic |
| 685 | Architectures: x86 | 750 | :Architectures: x86 |
| 686 | Type: vcpu ioctl | 751 | :Type: vcpu ioctl |
| 687 | Parameters: struct kvm_fpu (in) | 752 | :Parameters: struct kvm_fpu (in) |
| 688 | Returns: 0 on success, -1 on error | 753 | :Returns: 0 on success, -1 on error |
| 689 | 754 | ||
| 690 | Writes the floating point state to the vcpu. | 755 | Writes the floating point state to the vcpu. |
| 691 | 756 | ||
| 692 | /* for KVM_GET_FPU and KVM_SET_FPU */ | 757 | :: |
| 693 | struct kvm_fpu { | 758 | |
| 759 | /* for KVM_GET_FPU and KVM_SET_FPU */ | ||
| 760 | struct kvm_fpu { | ||
| 694 | __u8 fpr[8][16]; | 761 | __u8 fpr[8][16]; |
| 695 | __u16 fcw; | 762 | __u16 fcw; |
| 696 | __u16 fsw; | 763 | __u16 fsw; |
| @@ -702,16 +769,17 @@ struct kvm_fpu { · 5 unmodified lines | |||
| 702 | __u8 xmm[16][16]; | 769 | __u8 xmm[16][16]; |
| 703 | __u32 mxcsr; | 770 | __u32 mxcsr; |
| 704 | __u32 pad2; | 771 | __u32 pad2; |
| 705 | }; | 772 | }; |
| 706 | 773 | ||
| 707 | 774 | ||
| 708 | 4.24 KVM_CREATE_IRQCHIP | 775 | 4.24 KVM_CREATE_IRQCHIP |
| 776 | ----------------------- | ||
| 709 | 777 | ||
| 710 | Capability: KVM_CAP_IRQCHIP, KVM_CAP_S390_IRQCHIP (s390) | 778 | :Capability: KVM_CAP_IRQCHIP, KVM_CAP_S390_IRQCHIP (s390) |
| 711 | Architectures: x86, ARM, arm64, s390 | 779 | :Architectures: x86, ARM, arm64, s390 |
| 712 | Type: vm ioctl | 780 | :Type: vm ioctl |
| 713 | Parameters: none | 781 | :Parameters: none |
| 714 | Returns: 0 on success, -1 on error | 782 | :Returns: 0 on success, -1 on error |
| 715 | 783 | ||
| 716 | Creates an interrupt controller model in the kernel. | 784 | Creates an interrupt controller model in the kernel. |
| 717 | On x86, creates a virtual ioapic, a virtual PIC (two PICs, nested), and sets up | 785 | On x86, creates a virtual ioapic, a virtual PIC (two PICs, nested), and sets up |
| @@ -727,12 +795,13 @@ before KVM_CREATE_IRQCHIP can be used. · 9 unmodified lines | |||
| 727 | 795 | ||
| 728 | 796 | ||
| 729 | 4.25 KVM_IRQ_LINE | 797 | 4.25 KVM_IRQ_LINE |
| 798 | ----------------- | ||
| 730 | 799 | ||
| 731 | Capability: KVM_CAP_IRQCHIP | 800 | :Capability: KVM_CAP_IRQCHIP |
| 732 | Architectures: x86, arm, arm64 | 801 | :Architectures: x86, arm, arm64 |
| 733 | Type: vm ioctl | 802 | :Type: vm ioctl |
| 734 | Parameters: struct kvm_irq_level | 803 | :Parameters: struct kvm_irq_level |
| 735 | Returns: 0 on success, -1 on error | 804 | :Returns: 0 on success, -1 on error |
| 736 | 805 | ||
| 737 | Sets the level of a GSI input to the interrupt controller model in the kernel. | 806 | Sets the level of a GSI input to the interrupt controller model in the kernel. |
| 738 | On some architectures it is required that an interrupt controller model has | 807 | On some architectures it is required that an interrupt controller model has |
| @@ -756,16 +825,20 @@ of course). · 17 unmodified lines | |||
| 756 | ARM/arm64 can signal an interrupt either at the CPU level, or at the | 825 | ARM/arm64 can signal an interrupt either at the CPU level, or at the |
| 757 | in-kernel irqchip (GIC), and for in-kernel irqchip can tell the GIC to | 826 | in-kernel irqchip (GIC), and for in-kernel irqchip can tell the GIC to |
| 758 | use PPIs designated for specific cpus. The irq field is interpreted | 827 | use PPIs designated for specific cpus. The irq field is interpreted |
| 759 | like this: | 828 | like this:: |
| 760 | 829 | ||
| 761 | bits: | 31 ... 28 | 27 ... 24 | 23 ... 16 | 15 ... 0 | | 830 | bits: | 31 ... 28 | 27 ... 24 | 23 ... 16 | 15 ... 0 | |
| 762 | field: | vcpu2_index | irq_type | vcpu_index | irq_id | | 831 | field: | vcpu2_index | irq_type | vcpu_index | irq_id | |
| 763 | 832 | ||
| 764 | The irq_type field has the following values: | 833 | The irq_type field has the following values: |
| 765 | - irq_type[0]: out-of-kernel GIC: irq_id 0 is IRQ, irq_id 1 is FIQ | 834 | |
| 766 | - irq_type[1]: in-kernel GIC: SPI, irq_id between 32 and 1019 (incl.) | 835 | - irq_type[0]: |
| 836 | out-of-kernel GIC: irq_id 0 is IRQ, irq_id 1 is FIQ | ||
| 837 | - irq_type[1]: | ||
| 838 | in-kernel GIC: SPI, irq_id between 32 and 1019 (incl.) | ||
| 767 | (the vcpu_index field is ignored) | 839 | (the vcpu_index field is ignored) |
| 768 | - irq_type[2]: in-kernel GIC: PPI, irq_id between 16 and 31 (incl.) | 840 | - irq_type[2]: |
| 841 | in-kernel GIC: PPI, irq_id between 16 and 31 (incl.) | ||
| 769 | 842 | ||
| 770 | (The irq_id field thus corresponds nicely to the IRQ ID in the ARM GIC specs) | 843 | (The irq_id field thus corresponds nicely to the IRQ ID in the ARM GIC specs) |
| 771 | 844 | ||
| @@ -779,27 +852,32 @@ Note that on arm/arm64, the KVM_CAP_IRQCHIP capability only conditions · 7 unmodified lines | |||
| 779 | injection of interrupts for the in-kernel irqchip. KVM_IRQ_LINE can always | 852 | injection of interrupts for the in-kernel irqchip. KVM_IRQ_LINE can always |
| 780 | be used for a userspace interrupt controller. | 853 | be used for a userspace interrupt controller. |
| 781 | 854 | ||
| 782 | struct kvm_irq_level { | 855 | :: |
| 856 | |||
| 857 | struct kvm_irq_level { | ||
| 783 | union { | 858 | union { |
| 784 | __u32 irq; /* GSI */ | 859 | __u32 irq; /* GSI */ |
| 785 | __s32 status; /* not used for KVM_IRQ_LEVEL */ | 860 | __s32 status; /* not used for KVM_IRQ_LEVEL */ |
| 786 | }; | 861 | }; |
| 787 | __u32 level; /* 0 or 1 */ | 862 | __u32 level; /* 0 or 1 */ |
| 788 | }; | 863 | }; |
| 789 | 864 | ||
| 790 | 865 | ||
| 791 | 4.26 KVM_GET_IRQCHIP | 866 | 4.26 KVM_GET_IRQCHIP |
| 867 | -------------------- | ||
| 792 | 868 | ||
| 793 | Capability: KVM_CAP_IRQCHIP | 869 | :Capability: KVM_CAP_IRQCHIP |
| 794 | Architectures: x86 | 870 | :Architectures: x86 |
| 795 | Type: vm ioctl | 871 | :Type: vm ioctl |
| 796 | Parameters: struct kvm_irqchip (in/out) | 872 | :Parameters: struct kvm_irqchip (in/out) |
| 797 | Returns: 0 on success, -1 on error | 873 | :Returns: 0 on success, -1 on error |
| 798 | 874 | ||
| 799 | Reads the state of a kernel interrupt controller created with | 875 | Reads the state of a kernel interrupt controller created with |
| 800 | KVM_CREATE_IRQCHIP into a buffer provided by the caller. | 876 | KVM_CREATE_IRQCHIP into a buffer provided by the caller. |
| 801 | 877 | ||
| 802 | struct kvm_irqchip { | 878 | :: |
| 879 | |||
| 880 | struct kvm_irqchip { | ||
| 803 | __u32 chip_id; /* 0 = PIC1, 1 = PIC2, 2 = IOAPIC */ | 881 | __u32 chip_id; /* 0 = PIC1, 1 = PIC2, 2 = IOAPIC */ |
| 804 | __u32 pad; | 882 | __u32 pad; |
| 805 | union { | 883 | union { |
| @@ -807,21 +885,24 @@ struct kvm_irqchip { · 1 unmodified line | |||
| 807 | struct kvm_pic_state pic; | 885 | struct kvm_pic_state pic; |
| 808 | struct kvm_ioapic_state ioapic; | 886 | struct kvm_ioapic_state ioapic; |
| 809 | } chip; | 887 | } chip; |
| 810 | }; | 888 | }; |
| 811 | 889 | ||
| 812 | 890 | ||
| 813 | 4.27 KVM_SET_IRQCHIP | 891 | 4.27 KVM_SET_IRQCHIP |
| 892 | -------------------- | ||
| 814 | 893 | ||
| 815 | Capability: KVM_CAP_IRQCHIP | 894 | :Capability: KVM_CAP_IRQCHIP |
| 816 | Architectures: x86 | 895 | :Architectures: x86 |
| 817 | Type: vm ioctl | 896 | :Type: vm ioctl |
| 818 | Parameters: struct kvm_irqchip (in) | 897 | :Parameters: struct kvm_irqchip (in) |
| 819 | Returns: 0 on success, -1 on error | 898 | :Returns: 0 on success, -1 on error |
| 820 | 899 | ||
| 821 | Sets the state of a kernel interrupt controller created with | 900 | Sets the state of a kernel interrupt controller created with |
| 822 | KVM_CREATE_IRQCHIP from a buffer provided by the caller. | 901 | KVM_CREATE_IRQCHIP from a buffer provided by the caller. |
| 823 | 902 | ||
| 824 | struct kvm_irqchip { | 903 | :: |
| 904 | |||
| 905 | struct kvm_irqchip { | ||
| 825 | __u32 chip_id; /* 0 = PIC1, 1 = PIC2, 2 = IOAPIC */ | 906 | __u32 chip_id; /* 0 = PIC1, 1 = PIC2, 2 = IOAPIC */ |
| 826 | __u32 pad; | 907 | __u32 pad; |
| 827 | union { | 908 | union { |
| @@ -829,16 +910,17 @@ struct kvm_irqchip { · 1 unmodified line | |||
| 829 | struct kvm_pic_state pic; | 910 | struct kvm_pic_state pic; |
| 830 | struct kvm_ioapic_state ioapic; | 911 | struct kvm_ioapic_state ioapic; |
| 831 | } chip; | 912 | } chip; |
| 832 | }; | 913 | }; |
| 833 | 914 | ||
| 834 | 915 | ||
| 835 | 4.28 KVM_XEN_HVM_CONFIG | 916 | 4.28 KVM_XEN_HVM_CONFIG |
| 917 | ----------------------- | ||
| 836 | 918 | ||
| 837 | Capability: KVM_CAP_XEN_HVM | 919 | :Capability: KVM_CAP_XEN_HVM |
| 838 | Architectures: x86 | 920 | :Architectures: x86 |
| 839 | Type: vm ioctl | 921 | :Type: vm ioctl |
| 840 | Parameters: struct kvm_xen_hvm_config (in) | 922 | :Parameters: struct kvm_xen_hvm_config (in) |
| 841 | Returns: 0 on success, -1 on error | 923 | :Returns: 0 on success, -1 on error |
| 842 | 924 | ||
| 843 | Sets the MSR that the Xen HVM guest uses to initialize its hypercall | 925 | Sets the MSR that the Xen HVM guest uses to initialize its hypercall |
| 844 | page, and provides the starting address and size of the hypercall | 926 | page, and provides the starting address and size of the hypercall |
| @@ -846,7 +928,9 @@ blobs in userspace. When the guest writes the MSR, kvm copies one · 1 unmodified line | |||
| 846 | page of a blob (32- or 64-bit, depending on the vcpu mode) to guest | 928 | page of a blob (32- or 64-bit, depending on the vcpu mode) to guest |
| 847 | memory. | 929 | memory. |
| 848 | 930 | ||
| 849 | struct kvm_xen_hvm_config { | 931 | :: |
| 932 | |||
| 933 | struct kvm_xen_hvm_config { | ||
| 850 | __u32 flags; | 934 | __u32 flags; |
| 851 | __u32 msr; | 935 | __u32 msr; |
| 852 | __u64 blob_addr_32; | 936 | __u64 blob_addr_32; |
| @@ -854,16 +938,17 @@ struct kvm_xen_hvm_config { · 1 unmodified line | |||
| 854 | __u8 blob_size_32; | 938 | __u8 blob_size_32; |
| 855 | __u8 blob_size_64; | 939 | __u8 blob_size_64; |
| 856 | __u8 pad2[30]; | 940 | __u8 pad2[30]; |
| 857 | }; | 941 | }; |
| 858 | 942 | ||
| 859 | 943 | ||
| 860 | 4.29 KVM_GET_CLOCK | 944 | 4.29 KVM_GET_CLOCK |
| 945 | ------------------ | ||
| 861 | 946 | ||
| 862 | Capability: KVM_CAP_ADJUST_CLOCK | 947 | :Capability: KVM_CAP_ADJUST_CLOCK |
| 863 | Architectures: x86 | 948 | :Architectures: x86 |
| 864 | Type: vm ioctl | 949 | :Type: vm ioctl |
| 865 | Parameters: struct kvm_clock_data (out) | 950 | :Parameters: struct kvm_clock_data (out) |
| 866 | Returns: 0 on success, -1 on error | 951 | :Returns: 0 on success, -1 on error |
| 867 | 952 | ||
| 868 | Gets the current timestamp of kvmclock as seen by the current guest. In | 953 | Gets the current timestamp of kvmclock as seen by the current guest. In |
| 869 | conjunction with KVM_SET_CLOCK, it is used to ensure monotonicity on scenarios | 954 | conjunction with KVM_SET_CLOCK, it is used to ensure monotonicity on scenarios |
| @@ -880,47 +965,56 @@ with KVM_SET_CLOCK. KVM will try to make all VCPUs follow this clock, · 10 unmodified lines | |||
| 880 | but the exact value read by each VCPU could differ, because the host | 965 | but the exact value read by each VCPU could differ, because the host |
| 881 | TSC is not stable. | 966 | TSC is not stable. |
| 882 | 967 | ||
| 883 | struct kvm_clock_data { | 968 | :: |
| 969 | |||
| 970 | struct kvm_clock_data { | ||
| 884 | __u64 clock; /* kvmclock current value */ | 971 | __u64 clock; /* kvmclock current value */ |
| 885 | __u32 flags; | 972 | __u32 flags; |
| 886 | __u32 pad[9]; | 973 | __u32 pad[9]; |
| 887 | }; | 974 | }; |
| 888 | 975 | ||
| 889 | 976 | ||
| 890 | 4.30 KVM_SET_CLOCK | 977 | 4.30 KVM_SET_CLOCK |
| 978 | ------------------ | ||
| 891 | 979 | ||
| 892 | Capability: KVM_CAP_ADJUST_CLOCK | 980 | :Capability: KVM_CAP_ADJUST_CLOCK |
| 893 | Architectures: x86 | 981 | :Architectures: x86 |
| 894 | Type: vm ioctl | 982 | :Type: vm ioctl |
| 895 | Parameters: struct kvm_clock_data (in) | 983 | :Parameters: struct kvm_clock_data (in) |
| 896 | Returns: 0 on success, -1 on error | 984 | :Returns: 0 on success, -1 on error |
| 897 | 985 | ||
| 898 | Sets the current timestamp of kvmclock to the value specified in its parameter. | 986 | Sets the current timestamp of kvmclock to the value specified in its parameter. |
| 899 | In conjunction with KVM_GET_CLOCK, it is used to ensure monotonicity on scenarios | 987 | In conjunction with KVM_GET_CLOCK, it is used to ensure monotonicity on scenarios |
| 900 | such as migration. | 988 | such as migration. |
| 901 | 989 | ||
| 902 | struct kvm_clock_data { | 990 | :: |
| 991 | |||
| 992 | struct kvm_clock_data { | ||
| 903 | __u64 clock; /* kvmclock current value */ | 993 | __u64 clock; /* kvmclock current value */ |
| 904 | __u32 flags; | 994 | __u32 flags; |
| 905 | __u32 pad[9]; | 995 | __u32 pad[9]; |
| 906 | }; | 996 | }; |
| 907 | 997 | ||
| 908 | 998 | ||
| 909 | 4.31 KVM_GET_VCPU_EVENTS | 999 | 4.31 KVM_GET_VCPU_EVENTS |
| 1000 | ------------------------ | ||
| 910 | 1001 | ||
| 911 | Capability: KVM_CAP_VCPU_EVENTS | 1002 | :Capability: KVM_CAP_VCPU_EVENTS |
| 912 | Extended by: KVM_CAP_INTR_SHADOW | 1003 | :Extended by: KVM_CAP_INTR_SHADOW |
| 913 | Architectures: x86, arm, arm64 | 1004 | :Architectures: x86, arm, arm64 |
| 914 | Type: vcpu ioctl | 1005 | :Type: vcpu ioctl |
| 915 | Parameters: struct kvm_vcpu_event (out) | 1006 | :Parameters: struct kvm_vcpu_event (out) |
| 916 | Returns: 0 on success, -1 on error | 1007 | :Returns: 0 on success, -1 on error |
| 917 | 1008 | ||
| 918 | X86: | 1009 | X86: |
| 1010 | ^^^^ | ||
| 919 | 1011 | ||
| 920 | Gets currently pending exceptions, interrupts, and NMIs as well as related | 1012 | Gets currently pending exceptions, interrupts, and NMIs as well as related |
| 921 | states of the vcpu. | 1013 | states of the vcpu. |
| 922 | 1014 | ||
| 923 | struct kvm_vcpu_events { | 1015 | :: |
| 1016 | |||
| 1017 | struct kvm_vcpu_events { | ||
| 924 | struct { | 1018 | struct { |
| 925 | __u8 injected; | 1019 | __u8 injected; |
| 926 | __u8 nr; | 1020 | __u8 nr; |
| @@ -951,7 +1045,7 @@ struct kvm_vcpu_events { · 24 unmodified lines | |||
| 951 | __u8 reserved[27]; | 1045 | __u8 reserved[27]; |
| 952 | __u8 exception_has_payload; | 1046 | __u8 exception_has_payload; |
| 953 | __u64 exception_payload; | 1047 | __u64 exception_payload; |
| 954 | }; | 1048 | }; |
| 955 | 1049 | ||
| 956 | The following bits are defined in the flags field: | 1050 | The following bits are defined in the flags field: |
| 957 | 1051 | ||
| @@ -967,6 +1061,7 @@ The following bits are defined in the flags field: · 9 unmodified lines | |||
| 967 | KVM_CAP_EXCEPTION_PAYLOAD is enabled. | 1061 | KVM_CAP_EXCEPTION_PAYLOAD is enabled. |
| 968 | 1062 | ||
| 969 | ARM/ARM64: | 1063 | ARM/ARM64: |
| 1064 | ^^^^^^^^^^ | ||
| 970 | 1065 | ||
| 971 | If the guest accesses a device that is being emulated by the host kernel in | 1066 | If the guest accesses a device that is being emulated by the host kernel in |
| 972 | such a way that a real device would generate a physical SError, KVM may make | 1067 | such a way that a real device would generate a physical SError, KVM may make |
| @@ -1006,8 +1101,9 @@ It is not possible to read back a pending external abort (injected via · 33 unmodified lines | |||
| 1006 | KVM_SET_VCPU_EVENTS or otherwise) because such an exception is always delivered | 1101 | KVM_SET_VCPU_EVENTS or otherwise) because such an exception is always delivered |
| 1007 | directly to the virtual CPU). | 1102 | directly to the virtual CPU). |
| 1008 | 1103 | ||
| 1104 | :: | ||
| 1009 | 1105 | ||
| 1010 | struct kvm_vcpu_events { | 1106 | struct kvm_vcpu_events { |
| 1011 | struct { | 1107 | struct { |
| 1012 | __u8 serror_pending; | 1108 | __u8 serror_pending; |
| 1013 | __u8 serror_has_esr; | 1109 | __u8 serror_has_esr; |
| @@ -1017,18 +1113,20 @@ struct kvm_vcpu_events { · 3 unmodified lines | |||
| 1017 | __u64 serror_esr; | 1113 | __u64 serror_esr; |
| 1018 | } exception; | 1114 | } exception; |
| 1019 | __u32 reserved[12]; | 1115 | __u32 reserved[12]; |
| 1020 | }; | 1116 | }; |
| 1021 | 1117 | ||
| 1022 | 4.32 KVM_SET_VCPU_EVENTS | 1118 | 4.32 KVM_SET_VCPU_EVENTS |
| 1119 | ------------------------ | ||
| 1023 | 1120 | ||
| 1024 | Capability: KVM_CAP_VCPU_EVENTS | 1121 | :Capability: KVM_CAP_VCPU_EVENTS |
| 1025 | Extended by: KVM_CAP_INTR_SHADOW | 1122 | :Extended by: KVM_CAP_INTR_SHADOW |
| 1026 | Architectures: x86, arm, arm64 | 1123 | :Architectures: x86, arm, arm64 |
| 1027 | Type: vcpu ioctl | 1124 | :Type: vcpu ioctl |
| 1028 | Parameters: struct kvm_vcpu_event (in) | 1125 | :Parameters: struct kvm_vcpu_event (in) |
| 1029 | Returns: 0 on success, -1 on error | 1126 | :Returns: 0 on success, -1 on error |
| 1030 | 1127 | ||
| 1031 | X86: | 1128 | X86: |
| 1129 | ^^^^ | ||
| 1032 | 1130 | ||
| 1033 | Set pending exceptions, interrupts, and NMIs as well as related states of the | 1131 | Set pending exceptions, interrupts, and NMIs as well as related states of the |
| 1034 | vcpu. | 1132 | vcpu. |
| @@ -1040,9 +1138,11 @@ from the update. These fields are nmi.pending, sipi_vector, smi.smm, · 5 unmodified lines | |||
| 1040 | smi.pending. Keep the corresponding bits in the flags field cleared to | 1138 | smi.pending. Keep the corresponding bits in the flags field cleared to |
| 1041 | suppress overwriting the current in-kernel state. The bits are: | 1139 | suppress overwriting the current in-kernel state. The bits are: |
| 1042 | 1140 | ||
| 1043 | KVM_VCPUEVENT_VALID_NMI_PENDING - transfer nmi.pending to the kernel | 1141 | =============================== ================================== |
| 1044 | KVM_VCPUEVENT_VALID_SIPI_VECTOR - transfer sipi_vector | 1142 | KVM_VCPUEVENT_VALID_NMI_PENDING transfer nmi.pending to the kernel |
| 1045 | KVM_VCPUEVENT_VALID_SMM - transfer the smi sub-struct. | 1143 | KVM_VCPUEVENT_VALID_SIPI_VECTOR transfer sipi_vector |
| 1144 | KVM_VCPUEVENT_VALID_SMM transfer the smi sub-struct. | ||
| 1145 | =============================== ================================== | ||
| 1046 | 1146 | ||
| 1047 | If KVM_CAP_INTR_SHADOW is available, KVM_VCPUEVENT_VALID_SHADOW can be set in | 1147 | If KVM_CAP_INTR_SHADOW is available, KVM_VCPUEVENT_VALID_SHADOW can be set in |
| 1048 | the flags field to signal that interrupt.shadow contains a valid state and | 1148 | the flags field to signal that interrupt.shadow contains a valid state and |
| @@ -1056,6 +1156,7 @@ exception_has_payload, exception_payload, and exception.pending fields · 7 unmodified lines | |||
| 1056 | contain a valid state and shall be written into the VCPU. | 1156 | contain a valid state and shall be written into the VCPU. |
| 1057 | 1157 | ||
| 1058 | ARM/ARM64: | 1158 | ARM/ARM64: |
| 1159 | ^^^^^^^^^^ | ||
| 1059 | 1160 | ||
| 1060 | User space may need to inject several types of events to the guest. | 1161 | User space may need to inject several types of events to the guest. |
| 1061 | 1162 | ||
| @@ -1078,31 +1179,35 @@ See KVM_GET_VCPU_EVENTS for the data structure. · 16 unmodified lines | |||
| 1078 | 1179 | ||
| 1079 | 1180 | ||
| 1080 | 4.33 KVM_GET_DEBUGREGS | 1181 | 4.33 KVM_GET_DEBUGREGS |
| 1182 | ---------------------- | ||
| 1081 | 1183 | ||
| 1082 | Capability: KVM_CAP_DEBUGREGS | 1184 | :Capability: KVM_CAP_DEBUGREGS |
| 1083 | Architectures: x86 | 1185 | :Architectures: x86 |
| 1084 | Type: vm ioctl | 1186 | :Type: vm ioctl |
| 1085 | Parameters: struct kvm_debugregs (out) | 1187 | :Parameters: struct kvm_debugregs (out) |
| 1086 | Returns: 0 on success, -1 on error | 1188 | :Returns: 0 on success, -1 on error |
| 1087 | 1189 | ||
| 1088 | Reads debug registers from the vcpu. | 1190 | Reads debug registers from the vcpu. |
| 1089 | 1191 | ||
| 1090 | struct kvm_debugregs { | 1192 | :: |
| 1193 | |||
| 1194 | struct kvm_debugregs { | ||
| 1091 | __u64 db[4]; | 1195 | __u64 db[4]; |
| 1092 | __u64 dr6; | 1196 | __u64 dr6; |
| 1093 | __u64 dr7; | 1197 | __u64 dr7; |
| 1094 | __u64 flags; | 1198 | __u64 flags; |
| 1095 | __u64 reserved[9]; | 1199 | __u64 reserved[9]; |
| 1096 | }; | 1200 | }; |
| 1097 | 1201 | ||
| 1098 | 1202 | ||
| 1099 | 4.34 KVM_SET_DEBUGREGS | 1203 | 4.34 KVM_SET_DEBUGREGS |
| 1204 | ---------------------- | ||
| 1100 | 1205 | ||
| 1101 | Capability: KVM_CAP_DEBUGREGS | 1206 | :Capability: KVM_CAP_DEBUGREGS |
| 1102 | Architectures: x86 | 1207 | :Architectures: x86 |
| 1103 | Type: vm ioctl | 1208 | :Type: vm ioctl |
| 1104 | Parameters: struct kvm_debugregs (in) | 1209 | :Parameters: struct kvm_debugregs (in) |
| 1105 | Returns: 0 on success, -1 on error | 1210 | :Returns: 0 on success, -1 on error |
| 1106 | 1211 | ||
| 1107 | Writes debug registers into the vcpu. | 1212 | Writes debug registers into the vcpu. |
| 1108 | 1213 | ||
| @@ -1111,24 +1216,27 @@ yet and must be cleared on entry. · 2 unmodified lines | |||
| 1111 | 1216 | ||
| 1112 | 1217 | ||
| 1113 | 4.35 KVM_SET_USER_MEMORY_REGION | 1218 | 4.35 KVM_SET_USER_MEMORY_REGION |
| 1219 | ------------------------------- | ||
| 1114 | 1220 | ||
| 1115 | Capability: KVM_CAP_USER_MEMORY | 1221 | :Capability: KVM_CAP_USER_MEMORY |
| 1116 | Architectures: all | 1222 | :Architectures: all |
| 1117 | Type: vm ioctl | 1223 | :Type: vm ioctl |
| 1118 | Parameters: struct kvm_userspace_memory_region (in) | 1224 | :Parameters: struct kvm_userspace_memory_region (in) |
| 1119 | Returns: 0 on success, -1 on error | 1225 | :Returns: 0 on success, -1 on error |
| 1120 | 1226 | ||
| 1121 | struct kvm_userspace_memory_region { | 1227 | :: |
| 1228 | |||
| 1229 | struct kvm_userspace_memory_region { | ||
| 1122 | __u32 slot; | 1230 | __u32 slot; |
| 1123 | __u32 flags; | 1231 | __u32 flags; |
| 1124 | __u64 guest_phys_addr; | 1232 | __u64 guest_phys_addr; |
| 1125 | __u64 memory_size; /* bytes */ | 1233 | __u64 memory_size; /* bytes */ |
| 1126 | __u64 userspace_addr; /* start of the userspace allocated memory */ | 1234 | __u64 userspace_addr; /* start of the userspace allocated memory */ |
| 1127 | }; | 1235 | }; |
| 1128 | 1236 | ||
| 1129 | /* for kvm_memory_region::flags */ | 1237 | /* for kvm_memory_region::flags */ |
| 1130 | #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) | 1238 | #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) |
| 1131 | #define KVM_MEM_READONLY (1UL << 1) | 1239 | #define KVM_MEM_READONLY (1UL << 1) |
| 1132 | 1240 | ||
| 1133 | This ioctl allows the user to create, modify or delete a guest physical | 1241 | This ioctl allows the user to create, modify or delete a guest physical |
| 1134 | memory slot. Bits 0-15 of "slot" specify the slot id and this value | 1242 | memory slot. Bits 0-15 of "slot" specify the slot id and this value |
| @@ -1174,12 +1282,13 @@ allocation and is deprecated. · 39 unmodified lines | |||
| 1174 | 1282 | ||
| 1175 | 1283 | ||
| 1176 | 4.36 KVM_SET_TSS_ADDR | 1284 | 4.36 KVM_SET_TSS_ADDR |
| 1285 | --------------------- | ||
| 1177 | 1286 | ||
| 1178 | Capability: KVM_CAP_SET_TSS_ADDR | 1287 | :Capability: KVM_CAP_SET_TSS_ADDR |
| 1179 | Architectures: x86 | 1288 | :Architectures: x86 |
| 1180 | Type: vm ioctl | 1289 | :Type: vm ioctl |
| 1181 | Parameters: unsigned long tss_address (in) | 1290 | :Parameters: unsigned long tss_address (in) |
| 1182 | Returns: 0 on success, -1 on error | 1291 | :Returns: 0 on success, -1 on error |
| 1183 | 1292 | ||
| 1184 | This ioctl defines the physical address of a three-page region in the guest | 1293 | This ioctl defines the physical address of a three-page region in the guest |
| 1185 | physical address space. The region must be within the first 4GB of the | 1294 | physical address space. The region must be within the first 4GB of the |
| @@ -1193,21 +1302,24 @@ documentation when it pops into existence). · 7 unmodified lines | |||
| 1193 | 1302 | ||
| 1194 | 1303 | ||
| 1195 | 4.37 KVM_ENABLE_CAP | 1304 | 4.37 KVM_ENABLE_CAP |
| 1305 | ------------------- | ||
| 1306 | |||
| 1307 | :Capability: KVM_CAP_ENABLE_CAP | ||
| 1308 | :Architectures: mips, ppc, s390 | ||
| 1309 | :Type: vcpu ioctl | ||
| 1310 | :Parameters: struct kvm_enable_cap (in) | ||
| 1311 | :Returns: 0 on success; -1 on error | ||
| 1196 | 1312 | ||
| 1197 | Capability: KVM_CAP_ENABLE_CAP | 1313 | :Capability: KVM_CAP_ENABLE_CAP_VM |
| 1198 | Architectures: mips, ppc, s390 | 1314 | :Architectures: all |
| 1199 | Type: vcpu ioctl | 1315 | :Type: vcpu ioctl |
| 1200 | Parameters: struct kvm_enable_cap (in) | 1316 | :Parameters: struct kvm_enable_cap (in) |
| 1201 | Returns: 0 on success; -1 on error | 1317 | :Returns: 0 on success; -1 on error |
| 1202 | 1318 | ||
| 1203 | Capability: KVM_CAP_ENABLE_CAP_VM | 1319 | .. note:: |
| 1204 | Architectures: all | ||
| 1205 | Type: vcpu ioctl | ||
| 1206 | Parameters: struct kvm_enable_cap (in) | ||
| 1207 | Returns: 0 on success; -1 on error | ||
| 1208 | 1320 | ||
| 1209 | +Not all extensions are enabled by default. Using this ioctl the application | 1321 | Not all extensions are enabled by default. Using this ioctl the application |
| 1210 | can enable an extension, making it available to the guest. | 1322 | can enable an extension, making it available to the guest. |
| 1211 | 1323 | ||
| 1212 | On systems that do not support this ioctl, it always fails. On systems that | 1324 | On systems that do not support this ioctl, it always fails. On systems that |
| 1213 | do support it, it only works for extensions that are supported for enablement. | 1325 | do support it, it only works for extensions that are supported for enablement. |
| @@ -1215,76 +1327,91 @@ do support it, it only works for extensions that are supported for enablement. · 1 unmodified line | |||
| 1215 | To check if a capability can be enabled, the KVM_CHECK_EXTENSION ioctl should | 1327 | To check if a capability can be enabled, the KVM_CHECK_EXTENSION ioctl should |
| 1216 | be used. | 1328 | be used. |
| 1217 | 1329 | ||
| 1218 | struct kvm_enable_cap { | 1330 | :: |
| 1331 | |||
| 1332 | struct kvm_enable_cap { | ||
| 1219 | /* in */ | 1333 | /* in */ |
| 1220 | __u32 cap; | 1334 | __u32 cap; |
| 1221 | 1335 | ||
| 1222 | The capability that is supposed to get enabled. | 1336 | The capability that is supposed to get enabled. |
| 1223 | 1337 | ||
| 1338 | :: | ||
| 1339 | |||
| 1224 | __u32 flags; | 1340 | __u32 flags; |
| 1225 | 1341 | ||
| 1226 | A bitfield indicating future enhancements. Has to be 0 for now. | 1342 | A bitfield indicating future enhancements. Has to be 0 for now. |
| 1227 | 1343 | ||
| 1344 | :: | ||
| 1345 | |||
| 1228 | __u64 args[4]; | 1346 | __u64 args[4]; |
| 1229 | 1347 | ||
| 1230 | Arguments for enabling a feature. If a feature needs initial values to | 1348 | Arguments for enabling a feature. If a feature needs initial values to |
| 1231 | function properly, this is the place to put them. | 1349 | function properly, this is the place to put them. |
| 1232 | 1350 | ||
| 1351 | :: | ||
| 1352 | |||
| 1233 | __u8 pad[64]; | 1353 | __u8 pad[64]; |
| 1234 | }; | 1354 | }; |
| 1235 | 1355 | ||
| 1236 | The vcpu ioctl should be used for vcpu-specific capabilities, the vm ioctl | 1356 | The vcpu ioctl should be used for vcpu-specific capabilities, the vm ioctl |
| 1237 | for vm-wide capabilities. | 1357 | for vm-wide capabilities. |
| 1238 | 1358 | ||
| 1239 | 4.38 KVM_GET_MP_STATE | 1359 | 4.38 KVM_GET_MP_STATE |
| 1360 | --------------------- | ||
| 1361 | |||
| 1362 | :Capability: KVM_CAP_MP_STATE | ||
| 1363 | :Architectures: x86, s390, arm, arm64 | ||
| 1364 | :Type: vcpu ioctl | ||
| 1365 | :Parameters: struct kvm_mp_state (out) | ||
| 1366 | :Returns: 0 on success; -1 on error | ||
| 1240 | 1367 | ||
| 1241 | Capability: KVM_CAP_MP_STATE | 1368 | :: |
| 1242 | Architectures: x86, s390, arm, arm64 | ||
| 1243 | Type: vcpu ioctl | ||
| 1244 | Parameters: struct kvm_mp_state (out) | ||
| 1245 | Returns: 0 on success; -1 on error | ||
| 1246 | 1369 | ||
| 1247 | struct kvm_mp_state { | 1370 | struct kvm_mp_state { |
| 1248 | __u32 mp_state; | 1371 | __u32 mp_state; |
| 1249 | }; | 1372 | }; |
| 1250 | 1373 | ||
| 1251 | Returns the vcpu's current "multiprocessing state" (though also valid on | 1374 | Returns the vcpu's current "multiprocessing state" (though also valid on |
| 1252 | uniprocessor guests). | 1375 | uniprocessor guests). |
| 1253 | 1376 | ||
| 1254 | Possible values are: | 1377 | Possible values are: |
| 1255 | 1378 | ||
| 1256 | - KVM_MP_STATE_RUNNABLE: the vcpu is currently running [x86,arm/arm64] | 1379 | ========================== =============================================== |
| 1257 | - KVM_MP_STATE_UNINITIALIZED: the vcpu is an application processor (AP) | 1380 | KVM_MP_STATE_RUNNABLE the vcpu is currently running [x86,arm/arm64] |
| 1381 | KVM_MP_STATE_UNINITIALIZED the vcpu is an application processor (AP) | ||
| 1258 | which has not yet received an INIT signal [x86] | 1382 | which has not yet received an INIT signal [x86] |
| 1259 | - KVM_MP_STATE_INIT_RECEIVED: the vcpu has received an INIT signal, and is | 1383 | KVM_MP_STATE_INIT_RECEIVED the vcpu has received an INIT signal, and is |
| 1260 | now ready for a SIPI [x86] | 1384 | now ready for a SIPI [x86] |
| 1261 | - KVM_MP_STATE_HALTED: the vcpu has executed a HLT instruction and | 1385 | KVM_MP_STATE_HALTED the vcpu has executed a HLT instruction and |
| 1262 | is waiting for an interrupt [x86] | 1386 | is waiting for an interrupt [x86] |
| 1263 | - KVM_MP_STATE_SIPI_RECEIVED: the vcpu has just received a SIPI (vector | 1387 | KVM_MP_STATE_SIPI_RECEIVED the vcpu has just received a SIPI (vector |
| 1264 | accessible via KVM_GET_VCPU_EVENTS) [x86] | 1388 | accessible via KVM_GET_VCPU_EVENTS) [x86] |
| 1265 | - KVM_MP_STATE_STOPPED: the vcpu is stopped [s390,arm/arm64] | 1389 | KVM_MP_STATE_STOPPED the vcpu is stopped [s390,arm/arm64] |
| 1266 | - KVM_MP_STATE_CHECK_STOP: the vcpu is in a special error state [s390] | 1390 | KVM_MP_STATE_CHECK_STOP the vcpu is in a special error state [s390] |
| 1267 | - KVM_MP_STATE_OPERATING: the vcpu is operating (running or halted) | 1391 | KVM_MP_STATE_OPERATING the vcpu is operating (running or halted) |
| 1268 | [s390] | 1392 | [s390] |
| 1269 | - KVM_MP_STATE_LOAD: the vcpu is in a special load/startup state | 1393 | KVM_MP_STATE_LOAD the vcpu is in a special load/startup state |
| 1270 | [s390] | 1394 | [s390] |
| 1395 | ========================== =============================================== | ||
| 1271 | 1396 | ||
| 1272 | On x86, this ioctl is only useful after KVM_CREATE_IRQCHIP. Without an | 1397 | On x86, this ioctl is only useful after KVM_CREATE_IRQCHIP. Without an |
| 1273 | in-kernel irqchip, the multiprocessing state must be maintained by userspace on | 1398 | in-kernel irqchip, the multiprocessing state must be maintained by userspace on |
| 1274 | these architectures. | 1399 | these architectures. |
| 1275 | 1400 | ||
| 1276 | For arm/arm64: | 1401 | For arm/arm64: |
| 1402 | ^^^^^^^^^^^^^^ | ||
| 1277 | 1403 | ||
| 1278 | The only states that are valid are KVM_MP_STATE_STOPPED and | 1404 | The only states that are valid are KVM_MP_STATE_STOPPED and |
| 1279 | KVM_MP_STATE_RUNNABLE which reflect if the vcpu is paused or not. | 1405 | KVM_MP_STATE_RUNNABLE which reflect if the vcpu is paused or not. |
| 1280 | 1406 | ||
| 1281 | 4.39 KVM_SET_MP_STATE | 1407 | 4.39 KVM_SET_MP_STATE |
| 1408 | --------------------- | ||
| 1282 | 1409 | ||
| 1283 | Capability: KVM_CAP_MP_STATE | 1410 | :Capability: KVM_CAP_MP_STATE |
| 1284 | Architectures: x86, s390, arm, arm64 | 1411 | :Architectures: x86, s390, arm, arm64 |
| 1285 | Type: vcpu ioctl | 1412 | :Type: vcpu ioctl |
| 1286 | Parameters: struct kvm_mp_state (in) | 1413 | :Parameters: struct kvm_mp_state (in) |
| 1287 | Returns: 0 on success; -1 on error | 1414 | :Returns: 0 on success; -1 on error |
| 1288 | 1415 | ||
| 1289 | Sets the vcpu's current "multiprocessing state"; see KVM_GET_MP_STATE for | 1416 | Sets the vcpu's current "multiprocessing state"; see KVM_GET_MP_STATE for |
| 1290 | arguments. | 1417 | arguments. |
| @@ -1294,17 +1421,19 @@ in-kernel irqchip, the multiprocessing state must be maintained by userspace on · 3 unmodified lines | |||
| 1294 | these architectures. | 1421 | these architectures. |
| 1295 | 1422 | ||
| 1296 | For arm/arm64: | 1423 | For arm/arm64: |
| 1424 | ^^^^^^^^^^^^^^ | ||
| 1297 | 1425 | ||
| 1298 | The only states that are valid are KVM_MP_STATE_STOPPED and | 1426 | The only states that are valid are KVM_MP_STATE_STOPPED and |
| 1299 | KVM_MP_STATE_RUNNABLE which reflect if the vcpu should be paused or not. | 1427 | KVM_MP_STATE_RUNNABLE which reflect if the vcpu should be paused or not. |
| 1300 | 1428 | ||
| 1301 | 4.40 KVM_SET_IDENTITY_MAP_ADDR | 1429 | 4.40 KVM_SET_IDENTITY_MAP_ADDR |
| 1430 | ------------------------------ | ||
| 1302 | 1431 | ||
| 1303 | Capability: KVM_CAP_SET_IDENTITY_MAP_ADDR | 1432 | :Capability: KVM_CAP_SET_IDENTITY_MAP_ADDR |
| 1304 | Architectures: x86 | 1433 | :Architectures: x86 |
| 1305 | Type: vm ioctl | 1434 | :Type: vm ioctl |
| 1306 | Parameters: unsigned long identity (in) | 1435 | :Parameters: unsigned long identity (in) |
| 1307 | Returns: 0 on success, -1 on error | 1436 | :Returns: 0 on success, -1 on error |
| 1308 | 1437 | ||
| 1309 | This ioctl defines the physical address of a one-page region in the guest | 1438 | This ioctl defines the physical address of a one-page region in the guest |
| 1310 | physical address space. The region must be within the first 4GB of the | 1439 | physical address space. The region must be within the first 4GB of the |
| @@ -1322,12 +1451,13 @@ documentation when it pops into existence). · 11 unmodified lines | |||
| 1322 | Fails if any VCPU has already been created. | 1451 | Fails if any VCPU has already been created. |
| 1323 | 1452 | ||
| 1324 | 4.41 KVM_SET_BOOT_CPU_ID | 1453 | 4.41 KVM_SET_BOOT_CPU_ID |
| 1454 | ------------------------ | ||
| 1325 | 1455 | ||
| 1326 | Capability: KVM_CAP_SET_BOOT_CPU_ID | 1456 | :Capability: KVM_CAP_SET_BOOT_CPU_ID |
| 1327 | Architectures: x86 | 1457 | :Architectures: x86 |
| 1328 | Type: vm ioctl | 1458 | :Type: vm ioctl |
| 1329 | Parameters: unsigned long vcpu_id | 1459 | :Parameters: unsigned long vcpu_id |
| 1330 | Returns: 0 on success, -1 on error | 1460 | :Returns: 0 on success, -1 on error |
| 1331 | 1461 | ||
| 1332 | Define which vcpu is the Bootstrap Processor (BSP). Values are the same | 1462 | Define which vcpu is the Bootstrap Processor (BSP). Values are the same |
| 1333 | as the vcpu id in KVM_CREATE_VCPU. If this ioctl is not called, the default | 1463 | as the vcpu id in KVM_CREATE_VCPU. If this ioctl is not called, the default |
| @@ -1335,102 +1465,119 @@ is vcpu 0. · 1 unmodified line | |||
| 1335 | 1465 | ||
| 1336 | 1466 | ||
| 1337 | 4.42 KVM_GET_XSAVE | 1467 | 4.42 KVM_GET_XSAVE |
| 1468 | ------------------ | ||
| 1338 | 1469 | ||
| 1339 | Capability: KVM_CAP_XSAVE | 1470 | :Capability: KVM_CAP_XSAVE |
| 1340 | Architectures: x86 | 1471 | :Architectures: x86 |
| 1341 | Type: vcpu ioctl | 1472 | :Type: vcpu ioctl |
| 1342 | Parameters: struct kvm_xsave (out) | 1473 | :Parameters: struct kvm_xsave (out) |
| 1343 | Returns: 0 on success, -1 on error | 1474 | :Returns: 0 on success, -1 on error |
| 1344 | 1475 | ||
| 1345 | struct kvm_xsave { | 1476 | |
| 1477 | :: | ||
| 1478 | |||
| 1479 | struct kvm_xsave { | ||
| 1346 | __u32 region[1024]; | 1480 | __u32 region[1024]; |
| 1347 | }; | 1481 | }; |
| 1348 | 1482 | ||
| 1349 | This ioctl would copy current vcpu's xsave struct to the userspace. | 1483 | This ioctl would copy current vcpu's xsave struct to the userspace. |
| 1350 | 1484 | ||
| 1351 | 1485 | ||
| 1352 | 4.43 KVM_SET_XSAVE | 1486 | 4.43 KVM_SET_XSAVE |
| 1487 | ------------------ | ||
| 1488 | |||
| 1489 | :Capability: KVM_CAP_XSAVE | ||
| 1490 | :Architectures: x86 | ||
| 1491 | :Type: vcpu ioctl | ||
| 1492 | :Parameters: struct kvm_xsave (in) | ||
| 1493 | :Returns: 0 on success, -1 on error | ||
| 1353 | 1494 | ||
| 1354 | Capability: KVM_CAP_XSAVE | 1495 | :: |
| 1355 | Architectures: x86 | ||
| 1356 | Type: vcpu ioctl | ||
| 1357 | Parameters: struct kvm_xsave (in) | ||
| 1358 | Returns: 0 on success, -1 on error | ||
| 1359 | 1496 | ||
| 1360 | struct kvm_xsave { | 1497 | |
| 1498 | struct kvm_xsave { | ||
| 1361 | __u32 region[1024]; | 1499 | __u32 region[1024]; |
| 1362 | }; | 1500 | }; |
| 1363 | 1501 | ||
| 1364 | This ioctl would copy userspace's xsave struct to the kernel. | 1502 | This ioctl would copy userspace's xsave struct to the kernel. |
| 1365 | 1503 | ||
| 1366 | 1504 | ||
| 1367 | 4.44 KVM_GET_XCRS | 1505 | 4.44 KVM_GET_XCRS |
| 1506 | ----------------- | ||
| 1507 | |||
| 1508 | :Capability: KVM_CAP_XCRS | ||
| 1509 | :Architectures: x86 | ||
| 1510 | :Type: vcpu ioctl | ||
| 1511 | :Parameters: struct kvm_xcrs (out) | ||
| 1512 | :Returns: 0 on success, -1 on error | ||
| 1368 | 1513 | ||
| 1369 | Capability: KVM_CAP_XCRS | 1514 | :: |
| 1370 | Architectures: x86 | ||
| 1371 | Type: vcpu ioctl | ||
| 1372 | Parameters: struct kvm_xcrs (out) | ||
| 1373 | Returns: 0 on success, -1 on error | ||
| 1374 | 1515 | ||
| 1375 | struct kvm_xcr { | 1516 | struct kvm_xcr { |
| 1376 | __u32 xcr; | 1517 | __u32 xcr; |
| 1377 | __u32 reserved; | 1518 | __u32 reserved; |
| 1378 | __u64 value; | 1519 | __u64 value; |
| 1379 | }; | 1520 | }; |
| 1380 | 1521 | ||
| 1381 | struct kvm_xcrs { | 1522 | struct kvm_xcrs { |
| 1382 | __u32 nr_xcrs; | 1523 | __u32 nr_xcrs; |
| 1383 | __u32 flags; | 1524 | __u32 flags; |
| 1384 | struct kvm_xcr xcrs[KVM_MAX_XCRS]; | 1525 | struct kvm_xcr xcrs[KVM_MAX_XCRS]; |
| 1385 | __u64 padding[16]; | 1526 | __u64 padding[16]; |
| 1386 | }; | 1527 | }; |
| 1387 | 1528 | ||
| 1388 | This ioctl would copy current vcpu's xcrs to the userspace. | 1529 | This ioctl would copy current vcpu's xcrs to the userspace. |
| 1389 | 1530 | ||
| 1390 | 1531 | ||
| 1391 | 4.45 KVM_SET_XCRS | 1532 | 4.45 KVM_SET_XCRS |
| 1533 | ----------------- | ||
| 1534 | |||
| 1535 | :Capability: KVM_CAP_XCRS | ||
| 1536 | :Architectures: x86 | ||
| 1537 | :Type: vcpu ioctl | ||
| 1538 | :Parameters: struct kvm_xcrs (in) | ||
| 1539 | :Returns: 0 on success, -1 on error | ||
| 1392 | 1540 | ||
| 1393 | Capability: KVM_CAP_XCRS | 1541 | :: |
| 1394 | Architectures: x86 | ||
| 1395 | Type: vcpu ioctl | ||
| 1396 | Parameters: struct kvm_xcrs (in) | ||
| 1397 | Returns: 0 on success, -1 on error | ||
| 1398 | 1542 | ||
| 1399 | struct kvm_xcr { | 1543 | struct kvm_xcr { |
| 1400 | __u32 xcr; | 1544 | __u32 xcr; |
| 1401 | __u32 reserved; | 1545 | __u32 reserved; |
| 1402 | __u64 value; | 1546 | __u64 value; |
| 1403 | }; | 1547 | }; |
| 1404 | 1548 | ||
| 1405 | struct kvm_xcrs { | 1549 | struct kvm_xcrs { |
| 1406 | __u32 nr_xcrs; | 1550 | __u32 nr_xcrs; |
| 1407 | __u32 flags; | 1551 | __u32 flags; |
| 1408 | struct kvm_xcr xcrs[KVM_MAX_XCRS]; | 1552 | struct kvm_xcr xcrs[KVM_MAX_XCRS]; |
| 1409 | __u64 padding[16]; | 1553 | __u64 padding[16]; |
| 1410 | }; | 1554 | }; |
| 1411 | 1555 | ||
| 1412 | This ioctl would set vcpu's xcr to the value userspace specified. | 1556 | This ioctl would set vcpu's xcr to the value userspace specified. |
| 1413 | 1557 | ||
| 1414 | 1558 | ||
| 1415 | 4.46 KVM_GET_SUPPORTED_CPUID | 1559 | 4.46 KVM_GET_SUPPORTED_CPUID |
| 1560 | ---------------------------- | ||
| 1416 | 1561 | ||
| 1417 | Capability: KVM_CAP_EXT_CPUID | 1562 | :Capability: KVM_CAP_EXT_CPUID |
| 1418 | Architectures: x86 | 1563 | :Architectures: x86 |
| 1419 | Type: system ioctl | 1564 | :Type: system ioctl |
| 1420 | Parameters: struct kvm_cpuid2 (in/out) | 1565 | :Parameters: struct kvm_cpuid2 (in/out) |
| 1421 | Returns: 0 on success, -1 on error | 1566 | :Returns: 0 on success, -1 on error |
| 1422 | 1567 | ||
| 1423 | struct kvm_cpuid2 { | 1568 | :: |
| 1569 | |||
| 1570 | struct kvm_cpuid2 { | ||
| 1424 | __u32 nent; | 1571 | __u32 nent; |
| 1425 | __u32 padding; | 1572 | __u32 padding; |
| 1426 | struct kvm_cpuid_entry2 entries[0]; | 1573 | struct kvm_cpuid_entry2 entries[0]; |
| 1427 | }; | 1574 | }; |
| 1428 | 1575 | ||
| 1429 | #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0) | 1576 | #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0) |
| 1430 | #define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1) | 1577 | #define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1) |
| 1431 | #define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2) | 1578 | #define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2) |
| 1432 | 1579 | ||
| 1433 | struct kvm_cpuid_entry2 { | 1580 | struct kvm_cpuid_entry2 { |
| 1434 | __u32 function; | 1581 | __u32 function; |
| 1435 | __u32 index; | 1582 | __u32 index; |
| 1436 | __u32 flags; | 1583 | __u32 flags; |
| @@ -1439,7 +1586,7 @@ struct kvm_cpuid_entry2 { · 2 unmodified lines | |||
| 1439 | __u32 ecx; | 1586 | __u32 ecx; |
| 1440 | __u32 edx; | 1587 | __u32 edx; |
| 1441 | __u32 padding[3]; | 1588 | __u32 padding[3]; |
| 1442 | }; | 1589 | }; |
| 1443 | 1590 | ||
| 1444 | This ioctl returns x86 cpuid features which are supported by both the | 1591 | This ioctl returns x86 cpuid features which are supported by both the |
| 1445 | hardware and kvm in its default configuration. Userspace can use the | 1592 | hardware and kvm in its default configuration. Userspace can use the |
| @@ -1467,10 +1614,16 @@ with unknown or unsupported features masked out. Some features (for example, · 21 unmodified lines | |||
| 1467 | x2apic), may not be present in the host cpu, but are exposed by kvm if it can | 1614 | x2apic), may not be present in the host cpu, but are exposed by kvm if it can |
| 1468 | emulate them efficiently. The fields in each entry are defined as follows: | 1615 | emulate them efficiently. The fields in each entry are defined as follows: |
| 1469 | 1616 | ||
| 1470 | function: the eax value used to obtain the entry | 1617 | function: |
| 1471 | index: the ecx value used to obtain the entry (for entries that are | 1618 | the eax value used to obtain the entry |
| 1619 | |||
| 1620 | index: | ||
| 1621 | the ecx value used to obtain the entry (for entries that are | ||
| 1472 | affected by ecx) | 1622 | affected by ecx) |
| 1473 | flags: an OR of zero or more of the following: | 1623 | |
| 1624 | flags: | ||
| 1625 | an OR of zero or more of the following: | ||
| 1626 | |||
| 1474 | KVM_CPUID_FLAG_SIGNIFCANT_INDEX: | 1627 | KVM_CPUID_FLAG_SIGNIFCANT_INDEX: |
| 1475 | if the index field is valid | 1628 | if the index field is valid |
| 1476 | KVM_CPUID_FLAG_STATEFUL_FUNC: | 1629 | KVM_CPUID_FLAG_STATEFUL_FUNC: |
| @@ -1480,12 +1633,14 @@ emulate them efficiently. The fields in each entry are defined as follows: · 3 unmodified lines | |||
| 1480 | KVM_CPUID_FLAG_STATE_READ_NEXT: | 1633 | KVM_CPUID_FLAG_STATE_READ_NEXT: |
| 1481 | for KVM_CPUID_FLAG_STATEFUL_FUNC entries, set if this entry is | 1634 | for KVM_CPUID_FLAG_STATEFUL_FUNC entries, set if this entry is |
| 1482 | the first entry to be read by a cpu | 1635 | the first entry to be read by a cpu |
| 1483 | eax, ebx, ecx, edx: the values returned by the cpuid instruction for | 1636 | |
| 1637 | eax, ebx, ecx, edx: | ||
| 1638 | the values returned by the cpuid instruction for | ||
| 1484 | this function/index combination | 1639 | this function/index combination |
| 1485 | 1640 | ||
| 1486 | The TSC deadline timer feature (CPUID leaf 1, ecx[24]) is always returned | 1641 | The TSC deadline timer feature (CPUID leaf 1, ecx[24]) is always returned |
| 1487 | as false, since the feature depends on KVM_CREATE_IRQCHIP for local APIC | 1642 | as false, since the feature depends on KVM_CREATE_IRQCHIP for local APIC |
| 1488 | support. Instead it is reported via | 1643 | support. Instead it is reported via:: |
| 1489 | 1644 | ||
| 1490 | ioctl(KVM_CHECK_EXTENSION, KVM_CAP_TSC_DEADLINE_TIMER) | 1645 | ioctl(KVM_CHECK_EXTENSION, KVM_CAP_TSC_DEADLINE_TIMER) |
| 1491 | 1646 | ||
| @@ -1494,18 +1649,21 @@ feature in userspace, then you can enable the feature for KVM_SET_CPUID2. · 2 unmodified lines | |||
| 1494 | 1649 | ||
| 1495 | 1650 | ||
| 1496 | 4.47 KVM_PPC_GET_PVINFO | 1651 | 4.47 KVM_PPC_GET_PVINFO |
| 1652 | ----------------------- | ||
| 1497 | 1653 | ||
| 1498 | Capability: KVM_CAP_PPC_GET_PVINFO | 1654 | :Capability: KVM_CAP_PPC_GET_PVINFO |
| 1499 | Architectures: ppc | 1655 | :Architectures: ppc |
| 1500 | Type: vm ioctl | 1656 | :Type: vm ioctl |
| 1501 | Parameters: struct kvm_ppc_pvinfo (out) | 1657 | :Parameters: struct kvm_ppc_pvinfo (out) |
| 1502 | Returns: 0 on success, !0 on error | 1658 | :Returns: 0 on success, !0 on error |
| 1503 | 1659 | ||
| 1504 | struct kvm_ppc_pvinfo { | 1660 | :: |
| 1661 | |||
| 1662 | struct kvm_ppc_pvinfo { | ||
| 1505 | __u32 flags; | 1663 | __u32 flags; |
| 1506 | __u32 hcall[4]; | 1664 | __u32 hcall[4]; |
| 1507 | __u8 pad[108]; | 1665 | __u8 pad[108]; |
| 1508 | }; | 1666 | }; |
| 1509 | 1667 | ||
| 1510 | This ioctl fetches PV specific information that need to be passed to the guest | 1668 | This ioctl fetches PV specific information that need to be passed to the guest |
| 1511 | using the device tree or other means from vm context. | 1669 | using the device tree or other means from vm context. |
| @@ -1515,33 +1673,39 @@ The hcall array defines 4 instructions that make up a hypercall. · 3 unmodified lines | |||
| 1515 | If any additional field gets added to this structure later on, a bit for that | 1673 | If any additional field gets added to this structure later on, a bit for that |
| 1516 | additional piece of information will be set in the flags bitmap. | 1674 | additional piece of information will be set in the flags bitmap. |
| 1517 | 1675 | ||
| 1518 | The flags bitmap is defined as: | 1676 | The flags bitmap is defined as:: |
| 1519 | 1677 | ||
| 1520 | /* the host supports the ePAPR idle hcall | 1678 | /* the host supports the ePAPR idle hcall |
| 1521 | #define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) | 1679 | #define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) |
| 1522 | 1680 | ||
| 1523 | 4.52 KVM_SET_GSI_ROUTING | 1681 | 4.52 KVM_SET_GSI_ROUTING |
| 1682 | ------------------------ | ||
| 1524 | 1683 | ||
| 1525 | Capability: KVM_CAP_IRQ_ROUTING | 1684 | :Capability: KVM_CAP_IRQ_ROUTING |
| 1526 | Architectures: x86 s390 arm arm64 | 1685 | :Architectures: x86 s390 arm arm64 |
| 1527 | Type: vm ioctl | 1686 | :Type: vm ioctl |
| 1528 | Parameters: struct kvm_irq_routing (in) | 1687 | :Parameters: struct kvm_irq_routing (in) |
| 1529 | Returns: 0 on success, -1 on error | 1688 | :Returns: 0 on success, -1 on error |
| 1530 | 1689 | ||
| 1531 | Sets the GSI routing table entries, overwriting any previously set entries. | 1690 | Sets the GSI routing table entries, overwriting any previously set entries. |
| 1532 | 1691 | ||
| 1533 | On arm/arm64, GSI routing has the following limitation: | 1692 | On arm/arm64, GSI routing has the following limitation: |
| 1693 | |||
| 1534 | - GSI routing does not apply to KVM_IRQ_LINE but only to KVM_IRQFD. | 1694 | - GSI routing does not apply to KVM_IRQ_LINE but only to KVM_IRQFD. |
| 1535 | 1695 | ||
| 1536 | struct kvm_irq_routing { | 1696 | :: |
| 1697 | |||
| 1698 | struct kvm_irq_routing { | ||
| 1537 | __u32 nr; | 1699 | __u32 nr; |
| 1538 | __u32 flags; | 1700 | __u32 flags; |
| 1539 | struct kvm_irq_routing_entry entries[0]; | 1701 | struct kvm_irq_routing_entry entries[0]; |
| 1540 | }; | 1702 | }; |
| 1541 | 1703 | ||
| 1542 | No flags are specified so far, the corresponding field must be set to zero. | 1704 | No flags are specified so far, the corresponding field must be set to zero. |
| 1543 | 1705 | ||
| 1544 | struct kvm_irq_routing_entry { | 1706 | :: |
| 1707 | |||
| 1708 | struct kvm_irq_routing_entry { | ||
| 1545 | __u32 gsi; | 1709 | __u32 gsi; |
| 1546 | __u32 type; | 1710 | __u32 type; |
| 1547 | __u32 flags; | 1711 | __u32 flags; |
| @@ -1553,15 +1717,16 @@ struct kvm_irq_routing_entry { · 5 unmodified lines | |||
| 1553 | struct kvm_irq_routing_hv_sint hv_sint; | 1717 | struct kvm_irq_routing_hv_sint hv_sint; |
| 1554 | __u32 pad[8]; | 1718 | __u32 pad[8]; |
| 1555 | } u; | 1719 | } u; |
| 1556 | }; | 1720 | }; |
| 1557 | 1721 | ||
| 1558 | /* gsi routing entry types */ | 1722 | /* gsi routing entry types */ |
| 1559 | #define KVM_IRQ_ROUTING_IRQCHIP 1 | 1723 | #define KVM_IRQ_ROUTING_IRQCHIP 1 |
| 1560 | #define KVM_IRQ_ROUTING_MSI 2 | 1724 | #define KVM_IRQ_ROUTING_MSI 2 |
| 1561 | #define KVM_IRQ_ROUTING_S390_ADAPTER 3 | 1725 | #define KVM_IRQ_ROUTING_S390_ADAPTER 3 |
| 1562 | #define KVM_IRQ_ROUTING_HV_SINT 4 | 1726 | #define KVM_IRQ_ROUTING_HV_SINT 4 |
| 1563 | 1727 | ||
| 1564 | flags: | 1728 | flags: |
| 1729 | |||
| 1565 | - KVM_MSI_VALID_DEVID: used along with KVM_IRQ_ROUTING_MSI routing entry | 1730 | - KVM_MSI_VALID_DEVID: used along with KVM_IRQ_ROUTING_MSI routing entry |
| 1566 | type, specifies that the devid field contains a valid value. The per-VM | 1731 | type, specifies that the devid field contains a valid value. The per-VM |
| 1567 | KVM_CAP_MSI_DEVID capability advertises the requirement to provide | 1732 | KVM_CAP_MSI_DEVID capability advertises the requirement to provide |
| @@ -1569,12 +1734,14 @@ flags: · 1 unmodified line | |||
| 1569 | never set the KVM_MSI_VALID_DEVID flag as the ioctl might fail. | 1734 | never set the KVM_MSI_VALID_DEVID flag as the ioctl might fail. |
| 1570 | - zero otherwise | 1735 | - zero otherwise |
| 1571 | 1736 | ||
| 1572 | struct kvm_irq_routing_irqchip { | 1737 | :: |
| 1738 | |||
| 1739 | struct kvm_irq_routing_irqchip { | ||
| 1573 | __u32 irqchip; | 1740 | __u32 irqchip; |
| 1574 | __u32 pin; | 1741 | __u32 pin; |
| 1575 | }; | 1742 | }; |
| 1576 | 1743 | ||
| 1577 | struct kvm_irq_routing_msi { | 1744 | struct kvm_irq_routing_msi { |
| 1578 | __u32 address_lo; | 1745 | __u32 address_lo; |
| 1579 | __u32 address_hi; | 1746 | __u32 address_hi; |
| 1580 | __u32 data; | 1747 | __u32 data; |
| @@ -1582,7 +1749,7 @@ struct kvm_irq_routing_msi { · 1 unmodified line | |||
| 1582 | __u32 pad; | 1749 | __u32 pad; |
| 1583 | __u32 devid; | 1750 | __u32 devid; |
| 1584 | }; | 1751 | }; |
| 1585 | }; | 1752 | }; |
| 1586 | 1753 | ||
| 1587 | If KVM_MSI_VALID_DEVID is set, devid contains a unique device identifier | 1754 | If KVM_MSI_VALID_DEVID is set, devid contains a unique device identifier |
| 1588 | for the device that wrote the MSI message. For PCI, this is usually a | 1755 | for the device that wrote the MSI message. For PCI, this is usually a |
| @@ -1593,39 +1760,43 @@ feature of KVM_CAP_X2APIC_API capability is enabled. If it is enabled, · 4 unmodified lines | |||
| 1593 | address_hi bits 31-8 provide bits 31-8 of the destination id. Bits 7-0 of | 1760 | address_hi bits 31-8 provide bits 31-8 of the destination id. Bits 7-0 of |
| 1594 | address_hi must be zero. | 1761 | address_hi must be zero. |
| 1595 | 1762 | ||
| 1596 | struct kvm_irq_routing_s390_adapter { | 1763 | :: |
| 1764 | |||
| 1765 | struct kvm_irq_routing_s390_adapter { | ||
| 1597 | __u64 ind_addr; | 1766 | __u64 ind_addr; |
| 1598 | __u64 summary_addr; | 1767 | __u64 summary_addr; |
| 1599 | __u64 ind_offset; | 1768 | __u64 ind_offset; |
| 1600 | __u32 summary_offset; | 1769 | __u32 summary_offset; |
| 1601 | __u32 adapter_id; | 1770 | __u32 adapter_id; |
| 1602 | }; | 1771 | }; |
| 1603 | 1772 | ||
| 1604 | struct kvm_irq_routing_hv_sint { | 1773 | struct kvm_irq_routing_hv_sint { |
| 1605 | __u32 vcpu; | 1774 | __u32 vcpu; |
| 1606 | __u32 sint; | 1775 | __u32 sint; |
| 1607 | }; | 1776 | }; |
| 1608 | 1777 | ||
| 1609 | 1778 | ||
| 1610 | 4.55 KVM_SET_TSC_KHZ | 1779 | 4.55 KVM_SET_TSC_KHZ |
| 1780 | -------------------- | ||
| 1611 | 1781 | ||
| 1612 | Capability: KVM_CAP_TSC_CONTROL | 1782 | :Capability: KVM_CAP_TSC_CONTROL |
| 1613 | Architectures: x86 | 1783 | :Architectures: x86 |
| 1614 | Type: vcpu ioctl | 1784 | :Type: vcpu ioctl |
| 1615 | Parameters: virtual tsc_khz | 1785 | :Parameters: virtual tsc_khz |
| 1616 | Returns: 0 on success, -1 on error | 1786 | :Returns: 0 on success, -1 on error |
| 1617 | 1787 | ||
| 1618 | Specifies the tsc frequency for the virtual machine. The unit of the | 1788 | Specifies the tsc frequency for the virtual machine. The unit of the |
| 1619 | frequency is KHz. | 1789 | frequency is KHz. |
| 1620 | 1790 | ||
| 1621 | 1791 | ||
| 1622 | 4.56 KVM_GET_TSC_KHZ | 1792 | 4.56 KVM_GET_TSC_KHZ |
| 1793 | -------------------- | ||
| 1623 | 1794 | ||
| 1624 | Capability: KVM_CAP_GET_TSC_KHZ | 1795 | :Capability: KVM_CAP_GET_TSC_KHZ |
| 1625 | Architectures: x86 | 1796 | :Architectures: x86 |
| 1626 | Type: vcpu ioctl | 1797 | :Type: vcpu ioctl |
| 1627 | Parameters: none | 1798 | :Parameters: none |
| 1628 | Returns: virtual tsc-khz on success, negative value on error | 1799 | :Returns: virtual tsc-khz on success, negative value on error |
| 1629 | 1800 | ||
| 1630 | Returns the tsc frequency of the guest. The unit of the return value is | 1801 | Returns the tsc frequency of the guest. The unit of the return value is |
| 1631 | KHz. If the host has unstable tsc this ioctl returns -EIO instead as an | 1802 | KHz. If the host has unstable tsc this ioctl returns -EIO instead as an |
| @@ -1633,17 +1804,20 @@ error. · 1 unmodified line | |||
| 1633 | 1804 | ||
| 1634 | 1805 | ||
| 1635 | 4.57 KVM_GET_LAPIC | 1806 | 4.57 KVM_GET_LAPIC |
| 1807 | ------------------ | ||
| 1636 | 1808 | ||
| 1637 | Capability: KVM_CAP_IRQCHIP | 1809 | :Capability: KVM_CAP_IRQCHIP |
| 1638 | Architectures: x86 | 1810 | :Architectures: x86 |
| 1639 | Type: vcpu ioctl | 1811 | :Type: vcpu ioctl |
| 1640 | Parameters: struct kvm_lapic_state (out) | 1812 | :Parameters: struct kvm_lapic_state (out) |
| 1641 | Returns: 0 on success, -1 on error | 1813 | :Returns: 0 on success, -1 on error |
| 1642 | 1814 | ||
| 1643 | #define KVM_APIC_REG_SIZE 0x400 | 1815 | :: |
| 1644 | struct kvm_lapic_state { | 1816 | |
| 1817 | #define KVM_APIC_REG_SIZE 0x400 | ||
| 1818 | struct kvm_lapic_state { | ||
| 1645 | char regs[KVM_APIC_REG_SIZE]; | 1819 | char regs[KVM_APIC_REG_SIZE]; |
| 1646 | }; | 1820 | }; |
| 1647 | 1821 | ||
| 1648 | Reads the Local APIC registers and copies them into the input argument. The | 1822 | Reads the Local APIC registers and copies them into the input argument. The |
| 1649 | data format and layout are the same as documented in the architecture manual. | 1823 | data format and layout are the same as documented in the architecture manual. |
| @@ -1661,17 +1835,20 @@ always uses xAPIC format. · 11 unmodified lines | |||
| 1661 | 1835 | ||
| 1662 | 1836 | ||
| 1663 | 4.58 KVM_SET_LAPIC | 1837 | 4.58 KVM_SET_LAPIC |
| 1838 | ------------------ | ||
| 1664 | 1839 | ||
| 1665 | Capability: KVM_CAP_IRQCHIP | 1840 | :Capability: KVM_CAP_IRQCHIP |
| 1666 | Architectures: x86 | 1841 | :Architectures: x86 |
| 1667 | Type: vcpu ioctl | 1842 | :Type: vcpu ioctl |
| 1668 | Parameters: struct kvm_lapic_state (in) | 1843 | :Parameters: struct kvm_lapic_state (in) |
| 1669 | Returns: 0 on success, -1 on error | 1844 | :Returns: 0 on success, -1 on error |
| 1670 | 1845 | ||
| 1671 | #define KVM_APIC_REG_SIZE 0x400 | 1846 | :: |
| 1672 | struct kvm_lapic_state { | 1847 | |
| 1848 | #define KVM_APIC_REG_SIZE 0x400 | ||
| 1849 | struct kvm_lapic_state { | ||
| 1673 | char regs[KVM_APIC_REG_SIZE]; | 1850 | char regs[KVM_APIC_REG_SIZE]; |
| 1674 | }; | 1851 | }; |
| 1675 | 1852 | ||
| 1676 | Copies the input argument into the Local APIC registers. The data format | 1853 | Copies the input argument into the Local APIC registers. The data format |
| 1677 | and layout are the same as documented in the architecture manual. | 1854 | and layout are the same as documented in the architecture manual. |
| @@ -1682,35 +1859,38 @@ See the note in KVM_GET_LAPIC. · 4 unmodified lines | |||
| 1682 | 1859 | ||
| 1683 | 1860 | ||
| 1684 | 4.59 KVM_IOEVENTFD | 1861 | 4.59 KVM_IOEVENTFD |
| 1862 | ------------------ | ||
| 1685 | 1863 | ||
| 1686 | Capability: KVM_CAP_IOEVENTFD | 1864 | :Capability: KVM_CAP_IOEVENTFD |
| 1687 | Architectures: all | 1865 | :Architectures: all |
| 1688 | Type: vm ioctl | 1866 | :Type: vm ioctl |
| 1689 | Parameters: struct kvm_ioeventfd (in) | 1867 | :Parameters: struct kvm_ioeventfd (in) |
| 1690 | Returns: 0 on success, !0 on error | 1868 | :Returns: 0 on success, !0 on error |
| 1691 | 1869 | ||
| 1692 | This ioctl attaches or detaches an ioeventfd to a legal pio/mmio address | 1870 | This ioctl attaches or detaches an ioeventfd to a legal pio/mmio address |
| 1693 | within the guest. A guest write in the registered address will signal the | 1871 | within the guest. A guest write in the registered address will signal the |
| 1694 | provided event instead of triggering an exit. | 1872 | provided event instead of triggering an exit. |
| 1695 | 1873 | ||
| 1696 | struct kvm_ioeventfd { | 1874 | :: |
| 1875 | |||
| 1876 | struct kvm_ioeventfd { | ||
| 1697 | __u64 datamatch; | 1877 | __u64 datamatch; |
| 1698 | __u64 addr; /* legal pio/mmio address */ | 1878 | __u64 addr; /* legal pio/mmio address */ |
| 1699 | __u32 len; /* 0, 1, 2, 4, or 8 bytes */ | 1879 | __u32 len; /* 0, 1, 2, 4, or 8 bytes */ |
| 1700 | __s32 fd; | 1880 | __s32 fd; |
| 1701 | __u32 flags; | 1881 | __u32 flags; |
| 1702 | __u8 pad[36]; | 1882 | __u8 pad[36]; |
| 1703 | }; | 1883 | }; |
| 1704 | 1884 | ||
| 1705 | For the special case of virtio-ccw devices on s390, the ioevent is matched | 1885 | For the special case of virtio-ccw devices on s390, the ioevent is matched |
| 1706 | to a subchannel/virtqueue tuple instead. | 1886 | to a subchannel/virtqueue tuple instead. |
| 1707 | 1887 | ||
| 1708 | The following flags are defined: | 1888 | The following flags are defined:: |
| 1709 | 1889 | ||
| 1710 | #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch) | 1890 | #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch) |
| 1711 | #define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio) | 1891 | #define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio) |
| 1712 | #define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign) | 1892 | #define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign) |
| 1713 | #define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY \ | 1893 | #define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY \ |
| 1714 | (1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify) | 1894 | (1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify) |
| 1715 | 1895 | ||
| 1716 | If datamatch flag is set, the event will be signaled only if the written value | 1896 | If datamatch flag is set, the event will be signaled only if the written value |
| @@ -1725,17 +1905,20 @@ The speedup may only apply to specific architectures, but the ioeventfd will · 8 unmodified lines | |||
| 1725 | work anyway. | 1905 | work anyway. |
| 1726 | 1906 | ||
| 1727 | 4.60 KVM_DIRTY_TLB | 1907 | 4.60 KVM_DIRTY_TLB |
| 1908 | ------------------ | ||
| 1909 | |||
| 1910 | :Capability: KVM_CAP_SW_TLB | ||
| 1911 | :Architectures: ppc | ||
| 1912 | :Type: vcpu ioctl | ||
| 1913 | :Parameters: struct kvm_dirty_tlb (in) | ||
| 1914 | :Returns: 0 on success, -1 on error | ||
| 1728 | 1915 | ||
| 1729 | Capability: KVM_CAP_SW_TLB | 1916 | :: |
| 1730 | Architectures: ppc | ||
| 1731 | Type: vcpu ioctl | ||
| 1732 | Parameters: struct kvm_dirty_tlb (in) | ||
| 1733 | Returns: 0 on success, -1 on error | ||
| 1734 | 1917 | ||
| 1735 | struct kvm_dirty_tlb { | 1918 | struct kvm_dirty_tlb { |
| 1736 | __u64 bitmap; | 1919 | __u64 bitmap; |
| 1737 | __u32 num_dirty; | 1920 | __u32 num_dirty; |
| 1738 | }; | 1921 | }; |
| 1739 | 1922 | ||
| 1740 | This must be called whenever userspace has changed an entry in the shared | 1923 | This must be called whenever userspace has changed an entry in the shared |
| 1741 | TLB, prior to calling KVM_RUN on the associated vcpu. | 1924 | TLB, prior to calling KVM_RUN on the associated vcpu. |
| @@ -1758,23 +1941,26 @@ be set to the number of set bits in the bitmap. · 16 unmodified lines | |||
| 1758 | 1941 | ||
| 1759 | 1942 | ||
| 1760 | 4.62 KVM_CREATE_SPAPR_TCE | 1943 | 4.62 KVM_CREATE_SPAPR_TCE |
| 1944 | ------------------------- | ||
| 1761 | 1945 | ||
| 1762 | Capability: KVM_CAP_SPAPR_TCE | 1946 | :Capability: KVM_CAP_SPAPR_TCE |
| 1763 | Architectures: powerpc | 1947 | :Architectures: powerpc |
| 1764 | Type: vm ioctl | 1948 | :Type: vm ioctl |
| 1765 | Parameters: struct kvm_create_spapr_tce (in) | 1949 | :Parameters: struct kvm_create_spapr_tce (in) |
| 1766 | Returns: file descriptor for manipulating the created TCE table | 1950 | :Returns: file descriptor for manipulating the created TCE table |
| 1767 | 1951 | ||
| 1768 | This creates a virtual TCE (translation control entry) table, which | 1952 | This creates a virtual TCE (translation control entry) table, which |
| 1769 | is an IOMMU for PAPR-style virtual I/O. It is used to translate | 1953 | is an IOMMU for PAPR-style virtual I/O. It is used to translate |
| 1770 | logical addresses used in virtual I/O into guest physical addresses, | 1954 | logical addresses used in virtual I/O into guest physical addresses, |
| 1771 | and provides a scatter/gather capability for PAPR virtual I/O. | 1955 | and provides a scatter/gather capability for PAPR virtual I/O. |
| 1772 | 1956 | ||
| 1773 | /* for KVM_CAP_SPAPR_TCE */ | 1957 | :: |
| 1774 | struct kvm_create_spapr_tce { | 1958 | |
| 1959 | /* for KVM_CAP_SPAPR_TCE */ | ||
| 1960 | struct kvm_create_spapr_tce { | ||
| 1775 | __u64 liobn; | 1961 | __u64 liobn; |
| 1776 | __u32 window_size; | 1962 | __u32 window_size; |
| 1777 | }; | 1963 | }; |
| 1778 | 1964 | ||
| 1779 | The liobn field gives the logical IO bus number for which to create a | 1965 | The liobn field gives the logical IO bus number for which to create a |
| 1780 | TCE table. The window_size field specifies the size of the DMA window | 1966 | TCE table. The window_size field specifies the size of the DMA window |
| @@ -1794,12 +1980,13 @@ circumstances. · 13 unmodified lines | |||
| 1794 | 1980 | ||
| 1795 | 1981 | ||
| 1796 | 4.63 KVM_ALLOCATE_RMA | 1982 | 4.63 KVM_ALLOCATE_RMA |
| 1983 | --------------------- | ||
| 1797 | 1984 | ||
| 1798 | Capability: KVM_CAP_PPC_RMA | 1985 | :Capability: KVM_CAP_PPC_RMA |
| 1799 | Architectures: powerpc | 1986 | :Architectures: powerpc |
| 1800 | Type: vm ioctl | 1987 | :Type: vm ioctl |
| 1801 | Parameters: struct kvm_allocate_rma (out) | 1988 | :Parameters: struct kvm_allocate_rma (out) |
| 1802 | Returns: file descriptor for mapping the allocated RMA | 1989 | :Returns: file descriptor for mapping the allocated RMA |
| 1803 | 1990 | ||
| 1804 | This allocates a Real Mode Area (RMA) from the pool allocated at boot | 1991 | This allocates a Real Mode Area (RMA) from the pool allocated at boot |
| 1805 | time by the kernel. An RMA is a physically-contiguous, aligned region | 1992 | time by the kernel. An RMA is a physically-contiguous, aligned region |
| @@ -1808,10 +1995,12 @@ will be accessed by real-mode (MMU off) accesses in a KVM guest. · 2 unmodified lines | |||
| 1808 | POWER processors support a set of sizes for the RMA that usually | 1995 | POWER processors support a set of sizes for the RMA that usually |
| 1809 | includes 64MB, 128MB, 256MB and some larger powers of two. | 1996 | includes 64MB, 128MB, 256MB and some larger powers of two. |
| 1810 | 1997 | ||
| 1811 | /* for KVM_ALLOCATE_RMA */ | 1998 | :: |
| 1812 | struct kvm_allocate_rma { | 1999 | |
| 2000 | /* for KVM_ALLOCATE_RMA */ | ||
| 2001 | struct kvm_allocate_rma { | ||
| 1813 | __u64 rma_size; | 2002 | __u64 rma_size; |
| 1814 | }; | 2003 | }; |
| 1815 | 2004 | ||
| 1816 | The return value is a file descriptor which can be passed to mmap(2) | 2005 | The return value is a file descriptor which can be passed to mmap(2) |
| 1817 | to map the allocated RMA into userspace. The mapped area can then be | 2006 | to map the allocated RMA into userspace. The mapped area can then be |
| @@ -1827,12 +2016,13 @@ because it supports the Virtual RMA (VRMA) facility. · 9 unmodified lines | |||
| 1827 | 2016 | ||
| 1828 | 2017 | ||
| 1829 | 4.64 KVM_NMI | 2018 | 4.64 KVM_NMI |
| 2019 | ------------ | ||
| 1830 | 2020 | ||
| 1831 | Capability: KVM_CAP_USER_NMI | 2021 | :Capability: KVM_CAP_USER_NMI |
| 1832 | Architectures: x86 | 2022 | :Architectures: x86 |
| 1833 | Type: vcpu ioctl | 2023 | :Type: vcpu ioctl |
| 1834 | Parameters: none | 2024 | :Parameters: none |
| 1835 | Returns: 0 on success, -1 on error | 2025 | :Returns: 0 on success, -1 on error |
| 1836 | 2026 | ||
| 1837 | Queues an NMI on the thread's vcpu. Note this is well defined only | 2027 | Queues an NMI on the thread's vcpu. Note this is well defined only |
| 1838 | when KVM_CREATE_IRQCHIP has not been called, since this is an interface | 2028 | when KVM_CREATE_IRQCHIP has not been called, since this is an interface |
| @@ -1853,14 +2043,16 @@ debugging. · 14 unmodified lines | |||
| 1853 | 2043 | ||
| 1854 | 2044 | ||
| 1855 | 4.65 KVM_S390_UCAS_MAP | 2045 | 4.65 KVM_S390_UCAS_MAP |
| 2046 | ---------------------- | ||
| 1856 | 2047 | ||
| 1857 | Capability: KVM_CAP_S390_UCONTROL | 2048 | :Capability: KVM_CAP_S390_UCONTROL |
| 1858 | Architectures: s390 | 2049 | :Architectures: s390 |
| 1859 | Type: vcpu ioctl | 2050 | :Type: vcpu ioctl |
| 1860 | Parameters: struct kvm_s390_ucas_mapping (in) | 2051 | :Parameters: struct kvm_s390_ucas_mapping (in) |
| 1861 | Returns: 0 in case of success | 2052 | :Returns: 0 in case of success |
| 2053 | |||
| 2054 | The parameter is defined like this:: | ||
| 1862 | 2055 | ||
| 1863 | The parameter is defined like this: | ||
| 1864 | struct kvm_s390_ucas_mapping { | 2056 | struct kvm_s390_ucas_mapping { |
| 1865 | __u64 user_addr; | 2057 | __u64 user_addr; |
| 1866 | __u64 vcpu_addr; | 2058 | __u64 vcpu_addr; |
| @@ -1873,14 +2065,16 @@ be aligned by 1 megabyte. · 6 unmodified lines | |||
| 1873 | 2065 | ||
| 1874 | 2066 | ||
| 1875 | 4.66 KVM_S390_UCAS_UNMAP | 2067 | 4.66 KVM_S390_UCAS_UNMAP |
| 2068 | ------------------------ | ||
| 1876 | 2069 | ||
| 1877 | Capability: KVM_CAP_S390_UCONTROL | 2070 | :Capability: KVM_CAP_S390_UCONTROL |
| 1878 | Architectures: s390 | 2071 | :Architectures: s390 |
| 1879 | Type: vcpu ioctl | 2072 | :Type: vcpu ioctl |
| 1880 | Parameters: struct kvm_s390_ucas_mapping (in) | 2073 | :Parameters: struct kvm_s390_ucas_mapping (in) |
| 1881 | Returns: 0 in case of success | 2074 | :Returns: 0 in case of success |
| 2075 | |||
| 2076 | The parameter is defined like this:: | ||
| 1882 | 2077 | ||
| 1883 | The parameter is defined like this: | ||
| 1884 | struct kvm_s390_ucas_mapping { | 2078 | struct kvm_s390_ucas_mapping { |
| 1885 | __u64 user_addr; | 2079 | __u64 user_addr; |
| 1886 | __u64 vcpu_addr; | 2080 | __u64 vcpu_addr; |
| @@ -1893,12 +2087,13 @@ All parameters need to be aligned by 1 megabyte. · 6 unmodified lines | |||
| 1893 | 2087 | ||
| 1894 | 2088 | ||
| 1895 | 4.67 KVM_S390_VCPU_FAULT | 2089 | 4.67 KVM_S390_VCPU_FAULT |
| 2090 | ------------------------ | ||
| 1896 | 2091 | ||
| 1897 | Capability: KVM_CAP_S390_UCONTROL | 2092 | :Capability: KVM_CAP_S390_UCONTROL |
| 1898 | Architectures: s390 | 2093 | :Architectures: s390 |
| 1899 | Type: vcpu ioctl | 2094 | :Type: vcpu ioctl |
| 1900 | Parameters: vcpu absolute address (in) | 2095 | :Parameters: vcpu absolute address (in) |
| 1901 | Returns: 0 in case of success | 2096 | :Returns: 0 in case of success |
| 1902 | 2097 | ||
| 1903 | This call creates a page table entry on the virtual cpu's address space | 2098 | This call creates a page table entry on the virtual cpu's address space |
| 1904 | (for user controlled virtual machines) or the virtual machine's address | 2099 | (for user controlled virtual machines) or the virtual machine's address |
| @@ -1910,23 +2105,31 @@ prior to calling the KVM_RUN ioctl. · 5 unmodified lines | |||
| 1910 | 2105 | ||
| 1911 | 2106 | ||
| 1912 | 4.68 KVM_SET_ONE_REG | 2107 | 4.68 KVM_SET_ONE_REG |
| 2108 | -------------------- | ||
| 2109 | |||
| 2110 | :Capability: KVM_CAP_ONE_REG | ||
| 2111 | :Architectures: all | ||
| 2112 | :Type: vcpu ioctl | ||
| 2113 | :Parameters: struct kvm_one_reg (in) | ||
| 2114 | :Returns: 0 on success, negative value on failure | ||
| 1913 | 2115 | ||
| 1914 | Capability: KVM_CAP_ONE_REG | ||
| 1915 | Architectures: all | ||
| 1916 | Type: vcpu ioctl | ||
| 1917 | Parameters: struct kvm_one_reg (in) | ||
| 1918 | Returns: 0 on success, negative value on failure | ||
| 1919 | Errors: | 2116 | Errors: |
| 1920 | ENOENT: no such register | 2117 | |
| 1921 | EINVAL: invalid register ID, or no such register | 2118 | ====== ============================================================ |
| 1922 | EPERM: (arm64) register access not allowed before vcpu finalization | 2119 | ENOENT no such register |
| 2120 | EINVAL invalid register ID, or no such register | ||
| 2121 | EPERM (arm64) register access not allowed before vcpu finalization | ||
| 2122 | ====== ============================================================ | ||
| 2123 | |||
| 1923 | (These error codes are indicative only: do not rely on a specific error | 2124 | (These error codes are indicative only: do not rely on a specific error |
| 1924 | code being returned in a specific situation.) | 2125 | code being returned in a specific situation.) |
| 1925 | 2126 | ||
| 1926 | struct kvm_one_reg { | 2127 | :: |
| 2128 | |||
| 2129 | struct kvm_one_reg { | ||
| 1927 | __u64 id; | 2130 | __u64 id; |
| 1928 | __u64 addr; | 2131 | __u64 addr; |
| 1929 | }; | 2132 | }; |
| 1930 | 2133 | ||
| 1931 | Using this ioctl, a single vcpu register can be set to a specific value | 2134 | Using this ioctl, a single vcpu register can be set to a specific value |
| 1932 | defined by user space with the passed in struct kvm_one_reg, where id | 2135 | defined by user space with the passed in struct kvm_one_reg, where id |
| @@ -1936,217 +2139,226 @@ and architecture specific registers. Each have their own range of operation · 3 unmodified lines | |||
| 1936 | and their own constants and width. To keep track of the implemented | 2139 | and their own constants and width. To keep track of the implemented |
| 1937 | registers, find a list below: | 2140 | registers, find a list below: |
| 1938 | 2141 | ||
| 1939 | Arch | Register | Width (bits) | 2142 | ======= =============================== ============ |
| 1940 | | | | 2143 | Arch Register Width (bits) |
| 1941 | PPC | KVM_REG_PPC_HIOR | 64 | 2144 | ======= =============================== ============ |
| 1942 | PPC | KVM_REG_PPC_IAC1 | 64 | 2145 | PPC KVM_REG_PPC_HIOR 64 |
| 1943 | PPC | KVM_REG_PPC_IAC2 | 64 | 2146 | PPC KVM_REG_PPC_IAC1 64 |
| 1944 | PPC | KVM_REG_PPC_IAC3 | 64 | 2147 | PPC KVM_REG_PPC_IAC2 64 |
| 1945 | PPC | KVM_REG_PPC_IAC4 | 64 | 2148 | PPC KVM_REG_PPC_IAC3 64 |
| 1946 | PPC | KVM_REG_PPC_DAC1 | 64 | 2149 | PPC KVM_REG_PPC_IAC4 64 |
| 1947 | PPC | KVM_REG_PPC_DAC2 | 64 | 2150 | PPC KVM_REG_PPC_DAC1 64 |
| 1948 | PPC | KVM_REG_PPC_DABR | 64 | 2151 | PPC KVM_REG_PPC_DAC2 64 |
| 1949 | PPC | KVM_REG_PPC_DSCR | 64 | 2152 | PPC KVM_REG_PPC_DABR 64 |
| 1950 | PPC | KVM_REG_PPC_PURR | 64 | 2153 | PPC KVM_REG_PPC_DSCR 64 |
| 1951 | PPC | KVM_REG_PPC_SPURR | 64 | 2154 | PPC KVM_REG_PPC_PURR 64 |
| 1952 | PPC | KVM_REG_PPC_DAR | 64 | 2155 | PPC KVM_REG_PPC_SPURR 64 |
| 1953 | PPC | KVM_REG_PPC_DSISR | 32 | 2156 | PPC KVM_REG_PPC_DAR 64 |
| 1954 | PPC | KVM_REG_PPC_AMR | 64 | 2157 | PPC KVM_REG_PPC_DSISR 32 |
| 1955 | PPC | KVM_REG_PPC_UAMOR | 64 | 2158 | PPC KVM_REG_PPC_AMR 64 |
| 1956 | PPC | KVM_REG_PPC_MMCR0 | 64 | 2159 | PPC KVM_REG_PPC_UAMOR 64 |
| 1957 | PPC | KVM_REG_PPC_MMCR1 | 64 | 2160 | PPC KVM_REG_PPC_MMCR0 64 |
| 1958 | PPC | KVM_REG_PPC_MMCRA | 64 | 2161 | PPC KVM_REG_PPC_MMCR1 64 |
| 1959 | PPC | KVM_REG_PPC_MMCR2 | 64 | 2162 | PPC KVM_REG_PPC_MMCRA 64 |
| 1960 | PPC | KVM_REG_PPC_MMCRS | 64 | 2163 | PPC KVM_REG_PPC_MMCR2 64 |
| 1961 | PPC | KVM_REG_PPC_SIAR | 64 | 2164 | PPC KVM_REG_PPC_MMCRS 64 |
| 1962 | PPC | KVM_REG_PPC_SDAR | 64 | 2165 | PPC KVM_REG_PPC_SIAR 64 |
| 1963 | PPC | KVM_REG_PPC_SIER | 64 | 2166 | PPC KVM_REG_PPC_SDAR 64 |
| 1964 | PPC | KVM_REG_PPC_PMC1 | 32 | 2167 | PPC KVM_REG_PPC_SIER 64 |
| 1965 | PPC | KVM_REG_PPC_PMC2 | 32 | 2168 | PPC KVM_REG_PPC_PMC1 32 |
| 1966 | PPC | KVM_REG_PPC_PMC3 | 32 | 2169 | PPC KVM_REG_PPC_PMC2 32 |
| 1967 | PPC | KVM_REG_PPC_PMC4 | 32 | 2170 | PPC KVM_REG_PPC_PMC3 32 |
| 1968 | PPC | KVM_REG_PPC_PMC5 | 32 | 2171 | PPC KVM_REG_PPC_PMC4 32 |
| 1969 | PPC | KVM_REG_PPC_PMC6 | 32 | 2172 | PPC KVM_REG_PPC_PMC5 32 |
| 1970 | PPC | KVM_REG_PPC_PMC7 | 32 | 2173 | PPC KVM_REG_PPC_PMC6 32 |
| 1971 | PPC | KVM_REG_PPC_PMC8 | 32 | 2174 | PPC KVM_REG_PPC_PMC7 32 |
| 1972 | PPC | KVM_REG_PPC_FPR0 | 64 | 2175 | PPC KVM_REG_PPC_PMC8 32 |
| 1973 | ... | 2176 | PPC KVM_REG_PPC_FPR0 64 |
| 1974 | PPC | KVM_REG_PPC_FPR31 | 64 | 2177 | ... |
| 1975 | PPC | KVM_REG_PPC_VR0 | 128 | 2178 | PPC KVM_REG_PPC_FPR31 64 |
| 1976 | ... | 2179 | PPC KVM_REG_PPC_VR0 128 |
| 1977 | PPC | KVM_REG_PPC_VR31 | 128 | 2180 | ... |
| 1978 | PPC | KVM_REG_PPC_VSR0 | 128 | 2181 | PPC KVM_REG_PPC_VR31 128 |
| 1979 | ... | 2182 | PPC KVM_REG_PPC_VSR0 128 |
| 1980 | PPC | KVM_REG_PPC_VSR31 | 128 | 2183 | ... |
| 1981 | PPC | KVM_REG_PPC_FPSCR | 64 | 2184 | PPC KVM_REG_PPC_VSR31 128 |
| 1982 | PPC | KVM_REG_PPC_VSCR | 32 | 2185 | PPC KVM_REG_PPC_FPSCR 64 |
| 1983 | PPC | KVM_REG_PPC_VPA_ADDR | 64 | 2186 | PPC KVM_REG_PPC_VSCR 32 |
| 1984 | PPC | KVM_REG_PPC_VPA_SLB | 128 | 2187 | PPC KVM_REG_PPC_VPA_ADDR 64 |
| 1985 | PPC | KVM_REG_PPC_VPA_DTL | 128 | 2188 | PPC KVM_REG_PPC_VPA_SLB 128 |
| 1986 | PPC | KVM_REG_PPC_EPCR | 32 | 2189 | PPC KVM_REG_PPC_VPA_DTL 128 |
| 1987 | PPC | KVM_REG_PPC_EPR | 32 | 2190 | PPC KVM_REG_PPC_EPCR 32 |
| 1988 | PPC | KVM_REG_PPC_TCR | 32 | 2191 | PPC KVM_REG_PPC_EPR 32 |
| 1989 | PPC | KVM_REG_PPC_TSR | 32 | 2192 | PPC KVM_REG_PPC_TCR 32 |
| 1990 | PPC | KVM_REG_PPC_OR_TSR | 32 | 2193 | PPC KVM_REG_PPC_TSR 32 |
| 1991 | PPC | KVM_REG_PPC_CLEAR_TSR | 32 | 2194 | PPC KVM_REG_PPC_OR_TSR 32 |
| 1992 | PPC | KVM_REG_PPC_MAS0 | 32 | 2195 | PPC KVM_REG_PPC_CLEAR_TSR 32 |
| 1993 | PPC | KVM_REG_PPC_MAS1 | 32 | 2196 | PPC KVM_REG_PPC_MAS0 32 |
| 1994 | PPC | KVM_REG_PPC_MAS2 | 64 | 2197 | PPC KVM_REG_PPC_MAS1 32 |
| 1995 | PPC | KVM_REG_PPC_MAS7_3 | 64 | 2198 | PPC KVM_REG_PPC_MAS2 64 |
| 1996 | PPC | KVM_REG_PPC_MAS4 | 32 | 2199 | PPC KVM_REG_PPC_MAS7_3 64 |
| 1997 | PPC | KVM_REG_PPC_MAS6 | 32 | 2200 | PPC KVM_REG_PPC_MAS4 32 |
| 1998 | PPC | KVM_REG_PPC_MMUCFG | 32 | 2201 | PPC KVM_REG_PPC_MAS6 32 |
| 1999 | PPC | KVM_REG_PPC_TLB0CFG | 32 | 2202 | PPC KVM_REG_PPC_MMUCFG 32 |
| 2000 | PPC | KVM_REG_PPC_TLB1CFG | 32 | 2203 | PPC KVM_REG_PPC_TLB0CFG 32 |
| 2001 | PPC | KVM_REG_PPC_TLB2CFG | 32 | 2204 | PPC KVM_REG_PPC_TLB1CFG 32 |
| 2002 | PPC | KVM_REG_PPC_TLB3CFG | 32 | 2205 | PPC KVM_REG_PPC_TLB2CFG 32 |
| 2003 | PPC | KVM_REG_PPC_TLB0PS | 32 | 2206 | PPC KVM_REG_PPC_TLB3CFG 32 |
| 2004 | PPC | KVM_REG_PPC_TLB1PS | 32 | 2207 | PPC KVM_REG_PPC_TLB0PS 32 |
| 2005 | PPC | KVM_REG_PPC_TLB2PS | 32 | 2208 | PPC KVM_REG_PPC_TLB1PS 32 |
| 2006 | PPC | KVM_REG_PPC_TLB3PS | 32 | 2209 | PPC KVM_REG_PPC_TLB2PS 32 |
| 2007 | PPC | KVM_REG_PPC_EPTCFG | 32 | 2210 | PPC KVM_REG_PPC_TLB3PS 32 |
| 2008 | PPC | KVM_REG_PPC_ICP_STATE | 64 | 2211 | PPC KVM_REG_PPC_EPTCFG 32 |
| 2009 | PPC | KVM_REG_PPC_VP_STATE | 128 | 2212 | PPC KVM_REG_PPC_ICP_STATE 64 |
| 2010 | PPC | KVM_REG_PPC_TB_OFFSET | 64 | 2213 | PPC KVM_REG_PPC_VP_STATE 128 |
| 2011 | PPC | KVM_REG_PPC_SPMC1 | 32 | 2214 | PPC KVM_REG_PPC_TB_OFFSET 64 |
| 2012 | PPC | KVM_REG_PPC_SPMC2 | 32 | 2215 | PPC KVM_REG_PPC_SPMC1 32 |
| 2013 | PPC | KVM_REG_PPC_IAMR | 64 | 2216 | PPC KVM_REG_PPC_SPMC2 32 |
| 2014 | PPC | KVM_REG_PPC_TFHAR | 64 | 2217 | PPC KVM_REG_PPC_IAMR 64 |
| 2015 | PPC | KVM_REG_PPC_TFIAR | 64 | 2218 | PPC KVM_REG_PPC_TFHAR 64 |
| 2016 | PPC | KVM_REG_PPC_TEXASR | 64 | 2219 | PPC KVM_REG_PPC_TFIAR 64 |
| 2017 | PPC | KVM_REG_PPC_FSCR | 64 | 2220 | PPC KVM_REG_PPC_TEXASR 64 |
| 2018 | PPC | KVM_REG_PPC_PSPB | 32 | 2221 | PPC KVM_REG_PPC_FSCR 64 |
| 2019 | PPC | KVM_REG_PPC_EBBHR | 64 | 2222 | PPC KVM_REG_PPC_PSPB 32 |
| 2020 | PPC | KVM_REG_PPC_EBBRR | 64 | 2223 | PPC KVM_REG_PPC_EBBHR 64 |
| 2021 | PPC | KVM_REG_PPC_BESCR | 64 | 2224 | PPC KVM_REG_PPC_EBBRR 64 |
| 2022 | PPC | KVM_REG_PPC_TAR | 64 | 2225 | PPC KVM_REG_PPC_BESCR 64 |
| 2023 | PPC | KVM_REG_PPC_DPDES | 64 | 2226 | PPC KVM_REG_PPC_TAR 64 |
| 2024 | PPC | KVM_REG_PPC_DAWR | 64 | 2227 | PPC KVM_REG_PPC_DPDES 64 |
| 2025 | PPC | KVM_REG_PPC_DAWRX | 64 | 2228 | PPC KVM_REG_PPC_DAWR 64 |
| 2026 | PPC | KVM_REG_PPC_CIABR | 64 | 2229 | PPC KVM_REG_PPC_DAWRX 64 |
| 2027 | PPC | KVM_REG_PPC_IC | 64 | 2230 | PPC KVM_REG_PPC_CIABR 64 |
| 2028 | PPC | KVM_REG_PPC_VTB | 64 | 2231 | PPC KVM_REG_PPC_IC 64 |
| 2029 | PPC | KVM_REG_PPC_CSIGR | 64 | 2232 | PPC KVM_REG_PPC_VTB 64 |
| 2030 | PPC | KVM_REG_PPC_TACR | 64 | 2233 | PPC KVM_REG_PPC_CSIGR 64 |
| 2031 | PPC | KVM_REG_PPC_TCSCR | 64 | 2234 | PPC KVM_REG_PPC_TACR 64 |
| 2032 | PPC | KVM_REG_PPC_PID | 64 | 2235 | PPC KVM_REG_PPC_TCSCR 64 |
| 2033 | PPC | KVM_REG_PPC_ACOP | 64 | 2236 | PPC KVM_REG_PPC_PID 64 |
| 2034 | PPC | KVM_REG_PPC_VRSAVE | 32 | 2237 | PPC KVM_REG_PPC_ACOP 64 |
| 2035 | PPC | KVM_REG_PPC_LPCR | 32 | 2238 | PPC KVM_REG_PPC_VRSAVE 32 |
| 2036 | PPC | KVM_REG_PPC_LPCR_64 | 64 | 2239 | PPC KVM_REG_PPC_LPCR 32 |
| 2037 | PPC | KVM_REG_PPC_PPR | 64 | 2240 | PPC KVM_REG_PPC_LPCR_64 64 |
| 2038 | PPC | KVM_REG_PPC_ARCH_COMPAT | 32 | 2241 | PPC KVM_REG_PPC_PPR 64 |
| 2039 | PPC | KVM_REG_PPC_DABRX | 32 | 2242 | PPC KVM_REG_PPC_ARCH_COMPAT 32 |
| 2040 | PPC | KVM_REG_PPC_WORT | 64 | 2243 | PPC KVM_REG_PPC_DABRX 32 |
| 2041 | PPC | KVM_REG_PPC_SPRG9 | 64 | 2244 | PPC KVM_REG_PPC_WORT 64 |
| 2042 | PPC | KVM_REG_PPC_DBSR | 32 | 2245 | PPC KVM_REG_PPC_SPRG9 64 |
| 2043 | PPC | KVM_REG_PPC_TIDR | 64 | 2246 | PPC KVM_REG_PPC_DBSR 32 |
| 2044 | PPC | KVM_REG_PPC_PSSCR | 64 | 2247 | PPC KVM_REG_PPC_TIDR 64 |
| 2045 | PPC | KVM_REG_PPC_DEC_EXPIRY | 64 | 2248 | PPC KVM_REG_PPC_PSSCR 64 |
| 2046 | PPC | KVM_REG_PPC_PTCR | 64 | 2249 | PPC KVM_REG_PPC_DEC_EXPIRY 64 |
| 2047 | PPC | KVM_REG_PPC_TM_GPR0 | 64 | 2250 | PPC KVM_REG_PPC_PTCR 64 |
| 2048 | ... | 2251 | PPC KVM_REG_PPC_TM_GPR0 64 |
| 2049 | PPC | KVM_REG_PPC_TM_GPR31 | 64 | 2252 | ... |
| 2050 | PPC | KVM_REG_PPC_TM_VSR0 | 128 | 2253 | PPC KVM_REG_PPC_TM_GPR31 64 |
| 2051 | ... | 2254 | PPC KVM_REG_PPC_TM_VSR0 128 |
| 2052 | PPC | KVM_REG_PPC_TM_VSR63 | 128 | 2255 | ... |
| 2053 | PPC | KVM_REG_PPC_TM_CR | 64 | 2256 | PPC KVM_REG_PPC_TM_VSR63 128 |
| 2054 | PPC | KVM_REG_PPC_TM_LR | 64 | 2257 | PPC KVM_REG_PPC_TM_CR 64 |
| 2055 | PPC | KVM_REG_PPC_TM_CTR | 64 | 2258 | PPC KVM_REG_PPC_TM_LR 64 |
| 2056 | PPC | KVM_REG_PPC_TM_FPSCR | 64 | 2259 | PPC KVM_REG_PPC_TM_CTR 64 |
| 2057 | PPC | KVM_REG_PPC_TM_AMR | 64 | 2260 | PPC KVM_REG_PPC_TM_FPSCR 64 |
| 2058 | PPC | KVM_REG_PPC_TM_PPR | 64 | 2261 | PPC KVM_REG_PPC_TM_AMR 64 |
| 2059 | PPC | KVM_REG_PPC_TM_VRSAVE | 64 | 2262 | PPC KVM_REG_PPC_TM_PPR 64 |
| 2060 | PPC | KVM_REG_PPC_TM_VSCR | 32 | 2263 | PPC KVM_REG_PPC_TM_VRSAVE 64 |
| 2061 | PPC | KVM_REG_PPC_TM_DSCR | 64 | 2264 | PPC KVM_REG_PPC_TM_VSCR 32 |
| 2062 | PPC | KVM_REG_PPC_TM_TAR | 64 | 2265 | PPC KVM_REG_PPC_TM_DSCR 64 |
| 2063 | PPC | KVM_REG_PPC_TM_XER | 64 | 2266 | PPC KVM_REG_PPC_TM_TAR 64 |
| 2064 | | | | 2267 | PPC KVM_REG_PPC_TM_XER 64 |
| 2065 | MIPS | KVM_REG_MIPS_R0 | 64 | 2268 | |
| 2066 | ... | 2269 | MIPS KVM_REG_MIPS_R0 64 |
| 2067 | MIPS | KVM_REG_MIPS_R31 | 64 | 2270 | ... |
| 2068 | MIPS | KVM_REG_MIPS_HI | 64 | 2271 | MIPS KVM_REG_MIPS_R31 64 |
| 2069 | MIPS | KVM_REG_MIPS_LO | 64 | 2272 | MIPS KVM_REG_MIPS_HI 64 |
| 2070 | MIPS | KVM_REG_MIPS_PC | 64 | 2273 | MIPS KVM_REG_MIPS_LO 64 |
| 2071 | MIPS | KVM_REG_MIPS_CP0_INDEX | 32 | 2274 | MIPS KVM_REG_MIPS_PC 64 |
| 2072 | MIPS | KVM_REG_MIPS_CP0_ENTRYLO0 | 64 | 2275 | MIPS KVM_REG_MIPS_CP0_INDEX 32 |
| 2073 | MIPS | KVM_REG_MIPS_CP0_ENTRYLO1 | 64 | 2276 | MIPS KVM_REG_MIPS_CP0_ENTRYLO0 64 |
| 2074 | MIPS | KVM_REG_MIPS_CP0_CONTEXT | 64 | 2277 | MIPS KVM_REG_MIPS_CP0_ENTRYLO1 64 |
| 2075 | MIPS | KVM_REG_MIPS_CP0_CONTEXTCONFIG| 32 | 2278 | MIPS KVM_REG_MIPS_CP0_CONTEXT 64 |
| 2076 | MIPS | KVM_REG_MIPS_CP0_USERLOCAL | 64 | 2279 | MIPS KVM_REG_MIPS_CP0_CONTEXTCONFIG 32 |
| 2077 | MIPS | KVM_REG_MIPS_CP0_XCONTEXTCONFIG| 64 | 2280 | MIPS KVM_REG_MIPS_CP0_USERLOCAL 64 |
| 2078 | MIPS | KVM_REG_MIPS_CP0_PAGEMASK | 32 | 2281 | MIPS KVM_REG_MIPS_CP0_XCONTEXTCONFIG 64 |
| 2079 | MIPS | KVM_REG_MIPS_CP0_PAGEGRAIN | 32 | 2282 | MIPS KVM_REG_MIPS_CP0_PAGEMASK 32 |
| 2080 | MIPS | KVM_REG_MIPS_CP0_SEGCTL0 | 64 | 2283 | MIPS KVM_REG_MIPS_CP0_PAGEGRAIN 32 |
| 2081 | MIPS | KVM_REG_MIPS_CP0_SEGCTL1 | 64 | 2284 | MIPS KVM_REG_MIPS_CP0_SEGCTL0 64 |
| 2082 | MIPS | KVM_REG_MIPS_CP0_SEGCTL2 | 64 | 2285 | MIPS KVM_REG_MIPS_CP0_SEGCTL1 64 |
| 2083 | MIPS | KVM_REG_MIPS_CP0_PWBASE | 64 | 2286 | MIPS KVM_REG_MIPS_CP0_SEGCTL2 64 |
| 2084 | MIPS | KVM_REG_MIPS_CP0_PWFIELD | 64 | 2287 | MIPS KVM_REG_MIPS_CP0_PWBASE 64 |
| 2085 | MIPS | KVM_REG_MIPS_CP0_PWSIZE | 64 | 2288 | MIPS KVM_REG_MIPS_CP0_PWFIELD 64 |
| 2086 | MIPS | KVM_REG_MIPS_CP0_WIRED | 32 | 2289 | MIPS KVM_REG_MIPS_CP0_PWSIZE 64 |
| 2087 | MIPS | KVM_REG_MIPS_CP0_PWCTL | 32 | 2290 | MIPS KVM_REG_MIPS_CP0_WIRED 32 |
| 2088 | MIPS | KVM_REG_MIPS_CP0_HWRENA | 32 | 2291 | MIPS KVM_REG_MIPS_CP0_PWCTL 32 |
| 2089 | MIPS | KVM_REG_MIPS_CP0_BADVADDR | 64 | 2292 | MIPS KVM_REG_MIPS_CP0_HWRENA 32 |
| 2090 | MIPS | KVM_REG_MIPS_CP0_BADINSTR | 32 | 2293 | MIPS KVM_REG_MIPS_CP0_BADVADDR 64 |
| 2091 | MIPS | KVM_REG_MIPS_CP0_BADINSTRP | 32 | 2294 | MIPS KVM_REG_MIPS_CP0_BADINSTR 32 |
| 2092 | MIPS | KVM_REG_MIPS_CP0_COUNT | 32 | 2295 | MIPS KVM_REG_MIPS_CP0_BADINSTRP 32 |
| 2093 | MIPS | KVM_REG_MIPS_CP0_ENTRYHI | 64 | 2296 | MIPS KVM_REG_MIPS_CP0_COUNT 32 |
| 2094 | MIPS | KVM_REG_MIPS_CP0_COMPARE | 32 | 2297 | MIPS KVM_REG_MIPS_CP0_ENTRYHI 64 |
| 2095 | MIPS | KVM_REG_MIPS_CP0_STATUS | 32 | 2298 | MIPS KVM_REG_MIPS_CP0_COMPARE 32 |
| 2096 | MIPS | KVM_REG_MIPS_CP0_INTCTL | 32 | 2299 | MIPS KVM_REG_MIPS_CP0_STATUS 32 |
| 2097 | MIPS | KVM_REG_MIPS_CP0_CAUSE | 32 | 2300 | MIPS KVM_REG_MIPS_CP0_INTCTL 32 |
| 2098 | MIPS | KVM_REG_MIPS_CP0_EPC | 64 | 2301 | MIPS KVM_REG_MIPS_CP0_CAUSE 32 |
| 2099 | MIPS | KVM_REG_MIPS_CP0_PRID | 32 | 2302 | MIPS KVM_REG_MIPS_CP0_EPC 64 |
| 2100 | MIPS | KVM_REG_MIPS_CP0_EBASE | 64 | 2303 | MIPS KVM_REG_MIPS_CP0_PRID 32 |
| 2101 | MIPS | KVM_REG_MIPS_CP0_CONFIG | 32 | 2304 | MIPS KVM_REG_MIPS_CP0_EBASE 64 |
| 2102 | MIPS | KVM_REG_MIPS_CP0_CONFIG1 | 32 | 2305 | MIPS KVM_REG_MIPS_CP0_CONFIG 32 |
| 2103 | MIPS | KVM_REG_MIPS_CP0_CONFIG2 | 32 | 2306 | MIPS KVM_REG_MIPS_CP0_CONFIG1 32 |
| 2104 | MIPS | KVM_REG_MIPS_CP0_CONFIG3 | 32 | 2307 | MIPS KVM_REG_MIPS_CP0_CONFIG2 32 |
| 2105 | MIPS | KVM_REG_MIPS_CP0_CONFIG4 | 32 | 2308 | MIPS KVM_REG_MIPS_CP0_CONFIG3 32 |
| 2106 | MIPS | KVM_REG_MIPS_CP0_CONFIG5 | 32 | 2309 | MIPS KVM_REG_MIPS_CP0_CONFIG4 32 |
| 2107 | MIPS | KVM_REG_MIPS_CP0_CONFIG7 | 32 | 2310 | MIPS KVM_REG_MIPS_CP0_CONFIG5 32 |
| 2108 | MIPS | KVM_REG_MIPS_CP0_XCONTEXT | 64 | 2311 | MIPS KVM_REG_MIPS_CP0_CONFIG7 32 |
| 2109 | MIPS | KVM_REG_MIPS_CP0_ERROREPC | 64 | 2312 | MIPS KVM_REG_MIPS_CP0_XCONTEXT 64 |
| 2110 | MIPS | KVM_REG_MIPS_CP0_KSCRATCH1 | 64 | 2313 | MIPS KVM_REG_MIPS_CP0_ERROREPC 64 |
| 2111 | MIPS | KVM_REG_MIPS_CP0_KSCRATCH2 | 64 | 2314 | MIPS KVM_REG_MIPS_CP0_KSCRATCH1 64 |
| 2112 | MIPS | KVM_REG_MIPS_CP0_KSCRATCH3 | 64 | 2315 | MIPS KVM_REG_MIPS_CP0_KSCRATCH2 64 |
| 2113 | MIPS | KVM_REG_MIPS_CP0_KSCRATCH4 | 64 | 2316 | MIPS KVM_REG_MIPS_CP0_KSCRATCH3 64 |
| 2114 | MIPS | KVM_REG_MIPS_CP0_KSCRATCH5 | 64 | 2317 | MIPS KVM_REG_MIPS_CP0_KSCRATCH4 64 |
| 2115 | MIPS | KVM_REG_MIPS_CP0_KSCRATCH6 | 64 | 2318 | MIPS KVM_REG_MIPS_CP0_KSCRATCH5 64 |
| 2116 | MIPS | KVM_REG_MIPS_CP0_MAAR(0..63) | 64 | 2319 | MIPS KVM_REG_MIPS_CP0_KSCRATCH6 64 |
| 2117 | MIPS | KVM_REG_MIPS_COUNT_CTL | 64 | 2320 | MIPS KVM_REG_MIPS_CP0_MAAR(0..63) 64 |
| 2118 | MIPS | KVM_REG_MIPS_COUNT_RESUME | 64 | 2321 | MIPS KVM_REG_MIPS_COUNT_CTL 64 |
| 2119 | MIPS | KVM_REG_MIPS_COUNT_HZ | 64 | 2322 | MIPS KVM_REG_MIPS_COUNT_RESUME 64 |
| 2120 | MIPS | KVM_REG_MIPS_FPR_32(0..31) | 32 | 2323 | MIPS KVM_REG_MIPS_COUNT_HZ 64 |
| 2121 | MIPS | KVM_REG_MIPS_FPR_64(0..31) | 64 | 2324 | MIPS KVM_REG_MIPS_FPR_32(0..31) 32 |
| 2122 | MIPS | KVM_REG_MIPS_VEC_128(0..31) | 128 | 2325 | MIPS KVM_REG_MIPS_FPR_64(0..31) 64 |
| 2123 | MIPS | KVM_REG_MIPS_FCR_IR | 32 | 2326 | MIPS KVM_REG_MIPS_VEC_128(0..31) 128 |
| 2124 | MIPS | KVM_REG_MIPS_FCR_CSR | 32 | 2327 | MIPS KVM_REG_MIPS_FCR_IR 32 |
| 2125 | MIPS | KVM_REG_MIPS_MSA_IR | 32 | 2328 | MIPS KVM_REG_MIPS_FCR_CSR 32 |
| 2126 | MIPS | KVM_REG_MIPS_MSA_CSR | 32 | 2329 | MIPS KVM_REG_MIPS_MSA_IR 32 |
| 2330 | MIPS KVM_REG_MIPS_MSA_CSR 32 | ||
| 2331 | ======= =============================== ============ | ||
| 2127 | 2332 | ||
| 2128 | ARM registers are mapped using the lower 32 bits. The upper 16 of that | 2333 | ARM registers are mapped using the lower 32 bits. The upper 16 of that |
| 2129 | is the register group type, or coprocessor number: | 2334 | is the register group type, or coprocessor number: |
| 2130 | 2335 | ||
| 2131 | ARM core registers have the following id bit patterns: | 2336 | ARM core registers have the following id bit patterns:: |
| 2337 | |||
| 2132 | 0x4020 0000 0010 <index into the kvm_regs struct:16> | 2338 | 0x4020 0000 0010 <index into the kvm_regs struct:16> |
| 2133 | 2339 | ||
| 2134 | ARM 32-bit CP15 registers have the following id bit patterns: | 2340 | ARM 32-bit CP15 registers have the following id bit patterns:: |
| 2341 | |||
| 2135 | 0x4020 0000 000F <zero:1> <crn:4> <crm:4> <opc1:4> <opc2:3> | 2342 | 0x4020 0000 000F <zero:1> <crn:4> <crm:4> <opc1:4> <opc2:3> |
| 2136 | 2343 | ||
| 2137 | ARM 64-bit CP15 registers have the following id bit patterns: | 2344 | ARM 64-bit CP15 registers have the following id bit patterns:: |
| 2345 | |||
| 2138 | 0x4030 0000 000F <zero:1> <zero:4> <crm:4> <opc1:4> <zero:3> | 2346 | 0x4030 0000 000F <zero:1> <zero:4> <crm:4> <opc1:4> <zero:3> |
| 2139 | 2347 | ||
| 2140 | ARM CCSIDR registers are demultiplexed by CSSELR value: | 2348 | ARM CCSIDR registers are demultiplexed by CSSELR value:: |
| 2349 | |||
| 2141 | 0x4020 0000 0011 00 <csselr:8> | 2350 | 0x4020 0000 0011 00 <csselr:8> |
| 2142 | 2351 | ||
| 2143 | ARM 32-bit VFP control registers have the following id bit patterns: | 2352 | ARM 32-bit VFP control registers have the following id bit patterns:: |
| 2353 | |||
| 2144 | 0x4020 0000 0012 1 <regno:12> | 2354 | 0x4020 0000 0012 1 <regno:12> |
| 2145 | 2355 | ||
| 2146 | ARM 64-bit FP registers have the following id bit patterns: | 2356 | ARM 64-bit FP registers have the following id bit patterns:: |
| 2357 | |||
| 2147 | 0x4030 0000 0012 0 <regno:12> | 2358 | 0x4030 0000 0012 0 <regno:12> |
| 2148 | 2359 | ||
| 2149 | ARM firmware pseudo-registers have the following bit pattern: | 2360 | ARM firmware pseudo-registers have the following bit pattern:: |
| 2361 | |||
| 2150 | 0x4030 0000 0014 <regno:16> | 2362 | 0x4030 0000 0014 <regno:16> |
| 2151 | 2363 | ||
| 2152 | 2364 | ||
| @@ -2156,15 +2368,18 @@ that is the register group type, or coprocessor number: · 3 unmodified lines | |||
| 2156 | arm64 core/FP-SIMD registers have the following id bit patterns. Note | 2368 | arm64 core/FP-SIMD registers have the following id bit patterns. Note |
| 2157 | that the size of the access is variable, as the kvm_regs structure | 2369 | that the size of the access is variable, as the kvm_regs structure |
| 2158 | contains elements ranging from 32 to 128 bits. The index is a 32bit | 2370 | contains elements ranging from 32 to 128 bits. The index is a 32bit |
| 2159 | value in the kvm_regs structure seen as a 32bit array. | 2371 | value in the kvm_regs structure seen as a 32bit array:: |
| 2372 | |||
| 2160 | 0x60x0 0000 0010 <index into the kvm_regs struct:16> | 2373 | 0x60x0 0000 0010 <index into the kvm_regs struct:16> |
| 2161 | 2374 | ||
| 2162 | Specifically: | 2375 | Specifically: |
| 2376 | |||
| 2377 | ======================= ========= ===== ======================================= | ||
| 2163 | Encoding Register Bits kvm_regs member | 2378 | Encoding Register Bits kvm_regs member |
| 2164 | ---------------------------------------------------------------- | 2379 | ======================= ========= ===== ======================================= |
| 2165 | 0x6030 0000 0010 0000 X0 64 regs.regs[0] | 2380 | 0x6030 0000 0010 0000 X0 64 regs.regs[0] |
| 2166 | 0x6030 0000 0010 0002 X1 64 regs.regs[1] | 2381 | 0x6030 0000 0010 0002 X1 64 regs.regs[1] |
| 2167 | ... | 2382 | ... |
| 2168 | 0x6030 0000 0010 003c X30 64 regs.regs[30] | 2383 | 0x6030 0000 0010 003c X30 64 regs.regs[30] |
| 2169 | 0x6030 0000 0010 003e SP 64 regs.sp | 2384 | 0x6030 0000 0010 003e SP 64 regs.sp |
| 2170 | 0x6030 0000 0010 0040 PC 64 regs.pc | 2385 | 0x6030 0000 0010 0040 PC 64 regs.pc |
| @@ -2176,27 +2391,31 @@ Specifically: · 5 unmodified lines | |||
| 2176 | 0x6030 0000 0010 004c SPSR_UND 64 spsr[KVM_SPSR_UND] | 2391 | 0x6030 0000 0010 004c SPSR_UND 64 spsr[KVM_SPSR_UND] |
| 2177 | 0x6030 0000 0010 004e SPSR_IRQ 64 spsr[KVM_SPSR_IRQ] | 2392 | 0x6030 0000 0010 004e SPSR_IRQ 64 spsr[KVM_SPSR_IRQ] |
| 2178 | 0x6060 0000 0010 0050 SPSR_FIQ 64 spsr[KVM_SPSR_FIQ] | 2393 | 0x6060 0000 0010 0050 SPSR_FIQ 64 spsr[KVM_SPSR_FIQ] |
| 2179 | 0x6040 0000 0010 0054 V0 128 fp_regs.vregs[0] (*) | 2394 | 0x6040 0000 0010 0054 V0 128 fp_regs.vregs[0] [1]_ |
| 2180 | 0x6040 0000 0010 0058 V1 128 fp_regs.vregs[1] (*) | 2395 | 0x6040 0000 0010 0058 V1 128 fp_regs.vregs[1] [1]_ |
| 2181 | ... | 2396 | ... |
| 2182 | 0x6040 0000 0010 00d0 V31 128 fp_regs.vregs[31] (*) | 2397 | 0x6040 0000 0010 00d0 V31 128 fp_regs.vregs[31] [1]_ |
| 2183 | 0x6020 0000 0010 00d4 FPSR 32 fp_regs.fpsr | 2398 | 0x6020 0000 0010 00d4 FPSR 32 fp_regs.fpsr |
| 2184 | 0x6020 0000 0010 00d5 FPCR 32 fp_regs.fpcr | 2399 | 0x6020 0000 0010 00d5 FPCR 32 fp_regs.fpcr |
| 2400 | ======================= ========= ===== ======================================= | ||
| 2401 | |||
| 2402 | .. [1] These encodings are not accepted for SVE-enabled vcpus. See | ||
| 2403 | KVM_ARM_VCPU_INIT. | ||
| 2185 | 2404 | ||
| 2186 | (*) These encodings are not accepted for SVE-enabled vcpus. See | 2405 | The equivalent register content can be accessed via bits [127:0] of |
| 2187 | KVM_ARM_VCPU_INIT. | 2406 | the corresponding SVE Zn registers instead for vcpus that have SVE |
| 2407 | enabled (see below). | ||
| 2188 | 2408 | ||
| 2189 | The equivalent register content can be accessed via bits [127:0] of | 2409 | arm64 CCSIDR registers are demultiplexed by CSSELR value:: |
| 2190 | the corresponding SVE Zn registers instead for vcpus that have SVE | ||
| 2191 | enabled (see below). | ||
| 2192 | 2410 | ||
| 2193 | arm64 CCSIDR registers are demultiplexed by CSSELR value: | ||
| 2194 | 0x6020 0000 0011 00 <csselr:8> | 2411 | 0x6020 0000 0011 00 <csselr:8> |
| 2195 | 2412 | ||
| 2196 | arm64 system registers have the following id bit patterns: | 2413 | arm64 system registers have the following id bit patterns:: |
| 2414 | |||
| 2197 | 0x6030 0000 0013 <op0:2> <op1:3> <crn:4> <crm:4> <op2:3> | 2415 | 0x6030 0000 0013 <op0:2> <op1:3> <crn:4> <crm:4> <op2:3> |
| 2198 | 2416 | ||
| 2199 | WARNING: | 2417 | .. warning:: |
| 2418 | |||
| 2200 | Two system register IDs do not follow the specified pattern. These | 2419 | Two system register IDs do not follow the specified pattern. These |
| 2201 | are KVM_REG_ARM_TIMER_CVAL and KVM_REG_ARM_TIMER_CNT, which map to | 2420 | are KVM_REG_ARM_TIMER_CVAL and KVM_REG_ARM_TIMER_CNT, which map to |
| 2202 | system registers CNTV_CVAL_EL0 and CNTVCT_EL0 respectively. These | 2421 | system registers CNTV_CVAL_EL0 and CNTVCT_EL0 respectively. These |
| @@ -2205,10 +2424,12 @@ WARNING: · 2 unmodified lines | |||
| 2205 | derived from the register encoding for CNTV_CVAL_EL0. As this is | 2424 | derived from the register encoding for CNTV_CVAL_EL0. As this is |
| 2206 | API, it must remain this way. | 2425 | API, it must remain this way. |
| 2207 | 2426 | ||
| 2208 | arm64 firmware pseudo-registers have the following bit pattern: | 2427 | arm64 firmware pseudo-registers have the following bit pattern:: |
| 2428 | |||
| 2209 | 0x6030 0000 0014 <regno:16> | 2429 | 0x6030 0000 0014 <regno:16> |
| 2210 | 2430 | ||
| 2211 | arm64 SVE registers have the following bit patterns: | 2431 | arm64 SVE registers have the following bit patterns:: |
| 2432 | |||
| 2212 | 0x6080 0000 0015 00 <n:5> <slice:5> Zn bits[2048*slice + 2047 : 2048*slice] | 2433 | 0x6080 0000 0015 00 <n:5> <slice:5> Zn bits[2048*slice + 2047 : 2048*slice] |
| 2213 | 0x6050 0000 0015 04 <n:4> <slice:5> Pn bits[256*slice + 255 : 256*slice] | 2434 | 0x6050 0000 0015 04 <n:4> <slice:5> Pn bits[256*slice + 255 : 256*slice] |
| 2214 | 0x6050 0000 0015 060 <slice:5> FFR bits[256*slice + 255 : 256*slice] | 2435 | 0x6050 0000 0015 060 <slice:5> FFR bits[256*slice + 255 : 256*slice] |
| @@ -2216,7 +2437,7 @@ arm64 SVE registers have the following bit patterns: · 1 unmodified line | |||
| 2216 | 2437 | ||
| 2217 | Access to register IDs where 2048 * slice >= 128 * max_vq will fail with | 2438 | Access to register IDs where 2048 * slice >= 128 * max_vq will fail with |
| 2218 | ENOENT. max_vq is the vcpu's maximum supported vector length in 128-bit | 2439 | ENOENT. max_vq is the vcpu's maximum supported vector length in 128-bit |
| 2219 | quadwords: see (**) below. | 2440 | quadwords: see [2]_ below. |
| 2220 | 2441 | ||
| 2221 | These registers are only accessible on vcpus for which SVE is enabled. | 2442 | These registers are only accessible on vcpus for which SVE is enabled. |
| 2222 | See KVM_ARM_VCPU_INIT for details. | 2443 | See KVM_ARM_VCPU_INIT for details. |
| @@ -2231,21 +2452,21 @@ lengths supported by the vcpu to be discovered and configured by · 8 unmodified lines | |||
| 2231 | userspace. When transferred to or from user memory via KVM_GET_ONE_REG | 2452 | userspace. When transferred to or from user memory via KVM_GET_ONE_REG |
| 2232 | or KVM_SET_ONE_REG, the value of this register is of type | 2453 | or KVM_SET_ONE_REG, the value of this register is of type |
| 2233 | __u64[KVM_ARM64_SVE_VLS_WORDS], and encodes the set of vector lengths as | 2454 | __u64[KVM_ARM64_SVE_VLS_WORDS], and encodes the set of vector lengths as |
| 2234 | follows: | 2455 | follows:: |
| 2235 | 2456 | ||
| 2236 | __u64 vector_lengths[KVM_ARM64_SVE_VLS_WORDS]; | 2457 | __u64 vector_lengths[KVM_ARM64_SVE_VLS_WORDS]; |
| 2237 | 2458 | ||
| 2238 | if (vq >= SVE_VQ_MIN && vq <= SVE_VQ_MAX && | 2459 | if (vq >= SVE_VQ_MIN && vq <= SVE_VQ_MAX && |
| 2239 | ((vector_lengths[(vq - KVM_ARM64_SVE_VQ_MIN) / 64] >> | 2460 | ((vector_lengths[(vq - KVM_ARM64_SVE_VQ_MIN) / 64] >> |
| 2240 | ((vq - KVM_ARM64_SVE_VQ_MIN) % 64)) & 1)) | 2461 | ((vq - KVM_ARM64_SVE_VQ_MIN) % 64)) & 1)) |
| 2241 | /* Vector length vq * 16 bytes supported */ | 2462 | /* Vector length vq * 16 bytes supported */ |
| 2242 | else | 2463 | else |
| 2243 | /* Vector length vq * 16 bytes not supported */ | 2464 | /* Vector length vq * 16 bytes not supported */ |
| 2244 | 2465 | ||
| 2245 | (**) The maximum value vq for which the above condition is true is | 2466 | .. [2] The maximum value vq for which the above condition is true is |
| 2246 | max_vq. This is the maximum vector length available to the guest on | 2467 | max_vq. This is the maximum vector length available to the guest on |
| 2247 | this vcpu, and determines which register slices are visible through | 2468 | this vcpu, and determines which register slices are visible through |
| 2248 | this ioctl interface. | 2469 | this ioctl interface. |
| 2249 | 2470 | ||
| 2250 | (See Documentation/arm64/sve.rst for an explanation of the "vq" | 2471 | (See Documentation/arm64/sve.rst for an explanation of the "vq" |
| 2251 | nomenclature.) | 2472 | nomenclature.) |
| @@ -2270,11 +2491,13 @@ write this register will fail with EPERM. · 18 unmodified lines | |||
| 2270 | MIPS registers are mapped using the lower 32 bits. The upper 16 of that is | 2491 | MIPS registers are mapped using the lower 32 bits. The upper 16 of that is |
| 2271 | the register group type: | 2492 | the register group type: |
| 2272 | 2493 | ||
| 2273 | MIPS core registers (see above) have the following id bit patterns: | 2494 | MIPS core registers (see above) have the following id bit patterns:: |
| 2495 | |||
| 2274 | 0x7030 0000 0000 <reg:16> | 2496 | 0x7030 0000 0000 <reg:16> |
| 2275 | 2497 | ||
| 2276 | MIPS CP0 registers (see KVM_REG_MIPS_CP0_* above) have the following id bit | 2498 | MIPS CP0 registers (see KVM_REG_MIPS_CP0_* above) have the following id bit |
| 2277 | patterns depending on whether they're 32-bit or 64-bit registers: | 2499 | patterns depending on whether they're 32-bit or 64-bit registers:: |
| 2500 | |||
| 2278 | 0x7020 0000 0001 00 <reg:5> <sel:3> (32-bit) | 2501 | 0x7020 0000 0001 00 <reg:5> <sel:3> (32-bit) |
| 2279 | 0x7030 0000 0001 00 <reg:5> <sel:3> (64-bit) | 2502 | 0x7030 0000 0001 00 <reg:5> <sel:3> (64-bit) |
| 2280 | 2503 | ||
| @@ -2285,10 +2508,12 @@ with the RI and XI bits (if they exist) in bits 63 and 62 respectively, and · 4 unmodified lines | |||
| 2285 | the PFNX field starting at bit 30. | 2508 | the PFNX field starting at bit 30. |
| 2286 | 2509 | ||
| 2287 | MIPS MAARs (see KVM_REG_MIPS_CP0_MAAR(*) above) have the following id bit | 2510 | MIPS MAARs (see KVM_REG_MIPS_CP0_MAAR(*) above) have the following id bit |
| 2288 | patterns: | 2511 | patterns:: |
| 2512 | |||
| 2289 | 0x7030 0000 0001 01 <reg:8> | 2513 | 0x7030 0000 0001 01 <reg:8> |
| 2290 | 2514 | ||
| 2291 | MIPS KVM control registers (see above) have the following id bit patterns: | 2515 | MIPS KVM control registers (see above) have the following id bit patterns:: |
| 2516 | |||
| 2292 | 0x7030 0000 0002 <reg:16> | 2517 | 0x7030 0000 0002 <reg:16> |
| 2293 | 2518 | ||
| 2294 | MIPS FPU registers (see KVM_REG_MIPS_FPR_{32,64}() above) have the following | 2519 | MIPS FPU registers (see KVM_REG_MIPS_FPR_{32,64}() above) have the following |
| @@ -2297,31 +2522,40 @@ always accessed according to the current guest FPU mode (Status.FR and · 2 unmodified lines | |||
| 2297 | Config5.FRE), i.e. as the guest would see them, and they become unpredictable | 2522 | Config5.FRE), i.e. as the guest would see them, and they become unpredictable |
| 2298 | if the guest FPU mode is changed. MIPS SIMD Architecture (MSA) vector | 2523 | if the guest FPU mode is changed. MIPS SIMD Architecture (MSA) vector |
| 2299 | registers (see KVM_REG_MIPS_VEC_128() above) have similar patterns as they | 2524 | registers (see KVM_REG_MIPS_VEC_128() above) have similar patterns as they |
| 2300 | overlap the FPU registers: | 2525 | overlap the FPU registers:: |
| 2526 | |||
| 2301 | 0x7020 0000 0003 00 <0:3> <reg:5> (32-bit FPU registers) | 2527 | 0x7020 0000 0003 00 <0:3> <reg:5> (32-bit FPU registers) |
| 2302 | 0x7030 0000 0003 00 <0:3> <reg:5> (64-bit FPU registers) | 2528 | 0x7030 0000 0003 00 <0:3> <reg:5> (64-bit FPU registers) |
| 2303 | 0x7040 0000 0003 00 <0:3> <reg:5> (128-bit MSA vector registers) | 2529 | 0x7040 0000 0003 00 <0:3> <reg:5> (128-bit MSA vector registers) |
| 2304 | 2530 | ||
| 2305 | MIPS FPU control registers (see KVM_REG_MIPS_FCR_{IR,CSR} above) have the | 2531 | MIPS FPU control registers (see KVM_REG_MIPS_FCR_{IR,CSR} above) have the |
| 2306 | following id bit patterns: | 2532 | following id bit patterns:: |
| 2533 | |||
| 2307 | 0x7020 0000 0003 01 <0:3> <reg:5> | 2534 | 0x7020 0000 0003 01 <0:3> <reg:5> |
| 2308 | 2535 | ||
| 2309 | MIPS MSA control registers (see KVM_REG_MIPS_MSA_{IR,CSR} above) have the | 2536 | MIPS MSA control registers (see KVM_REG_MIPS_MSA_{IR,CSR} above) have the |
| 2310 | following id bit patterns: | 2537 | following id bit patterns:: |
| 2538 | |||
| 2311 | 0x7020 0000 0003 02 <0:3> <reg:5> | 2539 | 0x7020 0000 0003 02 <0:3> <reg:5> |
| 2312 | 2540 | ||
| 2313 | 2541 | ||
| 2314 | 4.69 KVM_GET_ONE_REG | 2542 | 4.69 KVM_GET_ONE_REG |
| 2543 | -------------------- | ||
| 2544 | |||
| 2545 | :Capability: KVM_CAP_ONE_REG | ||
| 2546 | :Architectures: all | ||
| 2547 | :Type: vcpu ioctl | ||
| 2548 | :Parameters: struct kvm_one_reg (in and out) | ||
| 2549 | :Returns: 0 on success, negative value on failure | ||
| 2315 | 2550 | ||
| 2316 | Capability: KVM_CAP_ONE_REG | ||
| 2317 | Architectures: all | ||
| 2318 | Type: vcpu ioctl | ||
| 2319 | Parameters: struct kvm_one_reg (in and out) | ||
| 2320 | Returns: 0 on success, negative value on failure | ||
| 2321 | Errors include: | 2551 | Errors include: |
| 2322 | ENOENT: no such register | 2552 | |
| 2323 | EINVAL: invalid register ID, or no such register | 2553 | ======== ============================================================ |
| 2324 | EPERM: (arm64) register access not allowed before vcpu finalization | 2554 | ENOENT no such register |
| 2555 | EINVAL invalid register ID, or no such register | ||
| 2556 | EPERM (arm64) register access not allowed before vcpu finalization | ||
| 2557 | ======== ============================================================ | ||
| 2558 | |||
| 2325 | (These error codes are indicative only: do not rely on a specific error | 2559 | (These error codes are indicative only: do not rely on a specific error |
| 2326 | code being returned in a specific situation.) | 2560 | code being returned in a specific situation.) |
| 2327 | 2561 | ||
| @@ -2335,12 +2569,13 @@ list in 4.68. · 7 unmodified lines | |||
| 2335 | 2569 | ||
| 2336 | 2570 | ||
| 2337 | 4.70 KVM_KVMCLOCK_CTRL | 2571 | 4.70 KVM_KVMCLOCK_CTRL |
| 2572 | ---------------------- | ||
| 2338 | 2573 | ||
| 2339 | Capability: KVM_CAP_KVMCLOCK_CTRL | 2574 | :Capability: KVM_CAP_KVMCLOCK_CTRL |
| 2340 | Architectures: Any that implement pvclocks (currently x86 only) | 2575 | :Architectures: Any that implement pvclocks (currently x86 only) |
| 2341 | Type: vcpu ioctl | 2576 | :Type: vcpu ioctl |
| 2342 | Parameters: None | 2577 | :Parameters: None |
| 2343 | Returns: 0 on success, -1 on error | 2578 | :Returns: 0 on success, -1 on error |
| 2344 | 2579 | ||
| 2345 | This signals to the host kernel that the specified guest is being paused by | 2580 | This signals to the host kernel that the specified guest is being paused by |
| 2346 | userspace. The host will set a flag in the pvclock structure that is checked | 2581 | userspace. The host will set a flag in the pvclock structure that is checked |
| @@ -2356,26 +2591,30 @@ after pausing the vcpu, but before it is resumed. · 9 unmodified lines | |||
| 2356 | 2591 | ||
| 2357 | 2592 | ||
| 2358 | 4.71 KVM_SIGNAL_MSI | 2593 | 4.71 KVM_SIGNAL_MSI |
| 2594 | ------------------- | ||
| 2359 | 2595 | ||
| 2360 | Capability: KVM_CAP_SIGNAL_MSI | 2596 | :Capability: KVM_CAP_SIGNAL_MSI |
| 2361 | Architectures: x86 arm arm64 | 2597 | :Architectures: x86 arm arm64 |
| 2362 | Type: vm ioctl | 2598 | :Type: vm ioctl |
| 2363 | Parameters: struct kvm_msi (in) | 2599 | :Parameters: struct kvm_msi (in) |
| 2364 | Returns: >0 on delivery, 0 if guest blocked the MSI, and -1 on error | 2600 | :Returns: >0 on delivery, 0 if guest blocked the MSI, and -1 on error |
| 2365 | 2601 | ||
| 2366 | Directly inject a MSI message. Only valid with in-kernel irqchip that handles | 2602 | Directly inject a MSI message. Only valid with in-kernel irqchip that handles |
| 2367 | MSI messages. | 2603 | MSI messages. |
| 2368 | 2604 | ||
| 2369 | struct kvm_msi { | 2605 | :: |
| 2606 | |||
| 2607 | struct kvm_msi { | ||
| 2370 | __u32 address_lo; | 2608 | __u32 address_lo; |
| 2371 | __u32 address_hi; | 2609 | __u32 address_hi; |
| 2372 | __u32 data; | 2610 | __u32 data; |
| 2373 | __u32 flags; | 2611 | __u32 flags; |
| 2374 | __u32 devid; | 2612 | __u32 devid; |
| 2375 | __u8 pad[12]; | 2613 | __u8 pad[12]; |
| 2376 | }; | 2614 | }; |
| 2377 | 2615 | ||
| 2378 | flags: KVM_MSI_VALID_DEVID: devid contains a valid value. The per-VM | 2616 | flags: |
| 2617 | KVM_MSI_VALID_DEVID: devid contains a valid value. The per-VM | ||
| 2379 | KVM_CAP_MSI_DEVID capability advertises the requirement to provide | 2618 | KVM_CAP_MSI_DEVID capability advertises the requirement to provide |
| 2380 | the device ID. If this capability is not available, userspace | 2619 | the device ID. If this capability is not available, userspace |
| 2381 | should never set the KVM_MSI_VALID_DEVID flag as the ioctl might fail. | 2620 | should never set the KVM_MSI_VALID_DEVID flag as the ioctl might fail. |
| @@ -2391,30 +2630,31 @@ address_hi must be zero. · 9 unmodified lines | |||
| 2391 | 2630 | ||
| 2392 | 2631 | ||
| 2393 | 4.71 KVM_CREATE_PIT2 | 2632 | 4.71 KVM_CREATE_PIT2 |
| 2633 | -------------------- | ||
| 2394 | 2634 | ||
| 2395 | Capability: KVM_CAP_PIT2 | 2635 | :Capability: KVM_CAP_PIT2 |
| 2396 | Architectures: x86 | 2636 | :Architectures: x86 |
| 2397 | Type: vm ioctl | 2637 | :Type: vm ioctl |
| 2398 | Parameters: struct kvm_pit_config (in) | 2638 | :Parameters: struct kvm_pit_config (in) |
| 2399 | Returns: 0 on success, -1 on error | 2639 | :Returns: 0 on success, -1 on error |
| 2400 | 2640 | ||
| 2401 | Creates an in-kernel device model for the i8254 PIT. This call is only valid | 2641 | Creates an in-kernel device model for the i8254 PIT. This call is only valid |
| 2402 | after enabling in-kernel irqchip support via KVM_CREATE_IRQCHIP. The following | 2642 | after enabling in-kernel irqchip support via KVM_CREATE_IRQCHIP. The following |
| 2403 | parameters have to be passed: | 2643 | parameters have to be passed:: |
| 2404 | 2644 | ||
| 2405 | struct kvm_pit_config { | 2645 | struct kvm_pit_config { |
| 2406 | __u32 flags; | 2646 | __u32 flags; |
| 2407 | __u32 pad[15]; | 2647 | __u32 pad[15]; |
| 2408 | }; | 2648 | }; |
| 2409 | 2649 | ||
| 2410 | Valid flags are: | 2650 | Valid flags are:: |
| 2411 | 2651 | ||
| 2412 | #define KVM_PIT_SPEAKER_DUMMY 1 /* emulate speaker port stub */ | 2652 | #define KVM_PIT_SPEAKER_DUMMY 1 /* emulate speaker port stub */ |
| 2413 | 2653 | ||
| 2414 | PIT timer interrupts may use a per-VM kernel thread for injection. If it | 2654 | PIT timer interrupts may use a per-VM kernel thread for injection. If it |
| 2415 | exists, this thread will have a name of the following pattern: | 2655 | exists, this thread will have a name of the following pattern:: |
| 2416 | 2656 | ||
| 2417 | kvm-pit/<owner-process-pid> | 2657 | kvm-pit/<owner-process-pid> |
| 2418 | 2658 | ||
| 2419 | When running a guest with elevated priorities, the scheduling parameters of | 2659 | When running a guest with elevated priorities, the scheduling parameters of |
| 2420 | this thread may have to be adjusted accordingly. | 2660 | this thread may have to be adjusted accordingly. |
| @@ -2423,37 +2663,39 @@ This IOCTL replaces the obsolete KVM_CREATE_PIT. · 2 unmodified lines | |||
| 2423 | 2663 | ||
| 2424 | 2664 | ||
| 2425 | 4.72 KVM_GET_PIT2 | 2665 | 4.72 KVM_GET_PIT2 |
| 2666 | ----------------- | ||
| 2426 | 2667 | ||
| 2427 | Capability: KVM_CAP_PIT_STATE2 | 2668 | :Capability: KVM_CAP_PIT_STATE2 |
| 2428 | Architectures: x86 | 2669 | :Architectures: x86 |
| 2429 | Type: vm ioctl | 2670 | :Type: vm ioctl |
| 2430 | Parameters: struct kvm_pit_state2 (out) | 2671 | :Parameters: struct kvm_pit_state2 (out) |
| 2431 | Returns: 0 on success, -1 on error | 2672 | :Returns: 0 on success, -1 on error |
| 2432 | 2673 | ||
| 2433 | Retrieves the state of the in-kernel PIT model. Only valid after | 2674 | Retrieves the state of the in-kernel PIT model. Only valid after |
| 2434 | KVM_CREATE_PIT2. The state is returned in the following structure: | 2675 | KVM_CREATE_PIT2. The state is returned in the following structure:: |
| 2435 | 2676 | ||
| 2436 | struct kvm_pit_state2 { | 2677 | struct kvm_pit_state2 { |
| 2437 | struct kvm_pit_channel_state channels[3]; | 2678 | struct kvm_pit_channel_state channels[3]; |
| 2438 | __u32 flags; | 2679 | __u32 flags; |
| 2439 | __u32 reserved[9]; | 2680 | __u32 reserved[9]; |
| 2440 | }; | 2681 | }; |
| 2441 | 2682 | ||
| 2442 | Valid flags are: | 2683 | Valid flags are:: |
| 2443 | 2684 | ||
| 2444 | /* disable PIT in HPET legacy mode */ | 2685 | /* disable PIT in HPET legacy mode */ |
| 2445 | #define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001 | 2686 | #define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001 |
| 2446 | 2687 | ||
| 2447 | This IOCTL replaces the obsolete KVM_GET_PIT. | 2688 | This IOCTL replaces the obsolete KVM_GET_PIT. |
| 2448 | 2689 | ||
| 2449 | 2690 | ||
| 2450 | 4.73 KVM_SET_PIT2 | 2691 | 4.73 KVM_SET_PIT2 |
| 2692 | ----------------- | ||
| 2451 | 2693 | ||
| 2452 | Capability: KVM_CAP_PIT_STATE2 | 2694 | :Capability: KVM_CAP_PIT_STATE2 |
| 2453 | Architectures: x86 | 2695 | :Architectures: x86 |
| 2454 | Type: vm ioctl | 2696 | :Type: vm ioctl |
| 2455 | Parameters: struct kvm_pit_state2 (in) | 2697 | :Parameters: struct kvm_pit_state2 (in) |
| 2456 | Returns: 0 on success, -1 on error | 2698 | :Returns: 0 on success, -1 on error |
| 2457 | 2699 | ||
| 2458 | Sets the state of the in-kernel PIT model. Only valid after KVM_CREATE_PIT2. | 2700 | Sets the state of the in-kernel PIT model. Only valid after KVM_CREATE_PIT2. |
| 2459 | See KVM_GET_PIT2 for details on struct kvm_pit_state2. | 2701 | See KVM_GET_PIT2 for details on struct kvm_pit_state2. |
| @@ -2462,12 +2704,13 @@ This IOCTL replaces the obsolete KVM_SET_PIT. · 2 unmodified lines | |||
| 2462 | 2704 | ||
| 2463 | 2705 | ||
| 2464 | 4.74 KVM_PPC_GET_SMMU_INFO | 2706 | 4.74 KVM_PPC_GET_SMMU_INFO |
| 2707 | -------------------------- | ||
| 2465 | 2708 | ||
| 2466 | Capability: KVM_CAP_PPC_GET_SMMU_INFO | 2709 | :Capability: KVM_CAP_PPC_GET_SMMU_INFO |
| 2467 | Architectures: powerpc | 2710 | :Architectures: powerpc |
| 2468 | Type: vm ioctl | 2711 | :Type: vm ioctl |
| 2469 | Parameters: None | 2712 | :Parameters: None |
| 2470 | Returns: 0 on success, -1 on error | 2713 | :Returns: 0 on success, -1 on error |
| 2471 | 2714 | ||
| 2472 | This populates and returns a structure describing the features of | 2715 | This populates and returns a structure describing the features of |
| 2473 | the "Server" class MMU emulation supported by KVM. | 2716 | the "Server" class MMU emulation supported by KVM. |
| @@ -2475,7 +2718,7 @@ This can in turn be used by userspace to generate the appropriate · 1 unmodified line | |||
| 2475 | device-tree properties for the guest operating system. | 2718 | device-tree properties for the guest operating system. |
| 2476 | 2719 | ||
| 2477 | The structure contains some global information, followed by an | 2720 | The structure contains some global information, followed by an |
| 2478 | array of supported segment page sizes: | 2721 | array of supported segment page sizes:: |
| 2479 | 2722 | ||
| 2480 | struct kvm_ppc_smmu_info { | 2723 | struct kvm_ppc_smmu_info { |
| 2481 | __u64 flags; | 2724 | __u64 flags; |
| @@ -2503,7 +2746,7 @@ The "slb_size" field indicates how many SLB entries are supported · 21 unmodified lines | |||
| 2503 | 2746 | ||
| 2504 | The "sps" array contains 8 entries indicating the supported base | 2747 | The "sps" array contains 8 entries indicating the supported base |
| 2505 | page sizes for a segment in increasing order. Each entry is defined | 2748 | page sizes for a segment in increasing order. Each entry is defined |
| 2506 | as follow: | 2749 | as follow:: |
| 2507 | 2750 | ||
| 2508 | struct kvm_ppc_one_seg_page_size { | 2751 | struct kvm_ppc_one_seg_page_size { |
| 2509 | __u32 page_shift; /* Base page shift of segment (or 0) */ | 2752 | __u32 page_shift; /* Base page shift of segment (or 0) */ |
| @@ -2524,7 +2767,7 @@ size provides the list of supported actual page sizes (which can be · 14 unmodified lines | |||
| 2524 | only larger or equal to the base page size), along with the | 2767 | only larger or equal to the base page size), along with the |
| 2525 | corresponding encoding in the hash PTE. Similarly, the array is | 2768 | corresponding encoding in the hash PTE. Similarly, the array is |
| 2526 | 8 entries sorted by increasing sizes and an entry with a "0" shift | 2769 | 8 entries sorted by increasing sizes and an entry with a "0" shift |
| 2527 | is an empty entry and a terminator: | 2770 | is an empty entry and a terminator:: |
| 2528 | 2771 | ||
| 2529 | struct kvm_ppc_one_page_size { | 2772 | struct kvm_ppc_one_page_size { |
| 2530 | __u32 page_shift; /* Page shift (or 0) */ | 2773 | __u32 page_shift; /* Page shift (or 0) */ |
| @@ -2536,12 +2779,13 @@ PTE's RPN field (ie, it needs to be shifted left by 12 to OR it · 5 unmodified lines | |||
| 2536 | into the hash PTE second double word). | 2779 | into the hash PTE second double word). |
| 2537 | 2780 | ||
| 2538 | 4.75 KVM_IRQFD | 2781 | 4.75 KVM_IRQFD |
| 2782 | -------------- | ||
| 2539 | 2783 | ||
| 2540 | Capability: KVM_CAP_IRQFD | 2784 | :Capability: KVM_CAP_IRQFD |
| 2541 | Architectures: x86 s390 arm arm64 | 2785 | :Architectures: x86 s390 arm arm64 |
| 2542 | Type: vm ioctl | 2786 | :Type: vm ioctl |
| 2543 | Parameters: struct kvm_irqfd (in) | 2787 | :Parameters: struct kvm_irqfd (in) |
| 2544 | Returns: 0 on success, -1 on error | 2788 | :Returns: 0 on success, -1 on error |
| 2545 | 2789 | ||
| 2546 | Allows setting an eventfd to directly trigger a guest interrupt. | 2790 | Allows setting an eventfd to directly trigger a guest interrupt. |
| 2547 | kvm_irqfd.fd specifies the file descriptor to use as the eventfd and | 2791 | kvm_irqfd.fd specifies the file descriptor to use as the eventfd and |
| @@ -2565,6 +2809,7 @@ irqfd. The KVM_IRQFD_FLAG_RESAMPLE is only necessary on assignment · 17 unmodified lines | |||
| 2565 | and need not be specified with KVM_IRQFD_FLAG_DEASSIGN. | 2809 | and need not be specified with KVM_IRQFD_FLAG_DEASSIGN. |
| 2566 | 2810 | ||
| 2567 | On arm/arm64, gsi routing being supported, the following can happen: | 2811 | On arm/arm64, gsi routing being supported, the following can happen: |
| 2812 | |||
| 2568 | - in case no routing entry is associated to this gsi, injection fails | 2813 | - in case no routing entry is associated to this gsi, injection fails |
| 2569 | - in case the gsi is associated to an irqchip routing entry, | 2814 | - in case the gsi is associated to an irqchip routing entry, |
| 2570 | irqchip.pin + 32 corresponds to the injected SPI ID. | 2815 | irqchip.pin + 32 corresponds to the injected SPI ID. |
| @@ -2573,12 +2818,13 @@ On arm/arm64, gsi routing being supported, the following can happen: · 2 unmodified lines | |||
| 2573 | to GICv3 ITS in-kernel emulation). | 2818 | to GICv3 ITS in-kernel emulation). |
| 2574 | 2819 | ||
| 2575 | 4.76 KVM_PPC_ALLOCATE_HTAB | 2820 | 4.76 KVM_PPC_ALLOCATE_HTAB |
| 2821 | -------------------------- | ||
| 2576 | 2822 | ||
| 2577 | Capability: KVM_CAP_PPC_ALLOC_HTAB | 2823 | :Capability: KVM_CAP_PPC_ALLOC_HTAB |
| 2578 | Architectures: powerpc | 2824 | :Architectures: powerpc |
| 2579 | Type: vm ioctl | 2825 | :Type: vm ioctl |
| 2580 | Parameters: Pointer to u32 containing hash table order (in/out) | 2826 | :Parameters: Pointer to u32 containing hash table order (in/out) |
| 2581 | Returns: 0 on success, -1 on error | 2827 | :Returns: 0 on success, -1 on error |
| 2582 | 2828 | ||
| 2583 | This requests the host kernel to allocate an MMU hash table for a | 2829 | This requests the host kernel to allocate an MMU hash table for a |
| 2584 | guest using the PAPR paravirtualization interface. This only does | 2830 | guest using the PAPR paravirtualization interface. This only does |
| @@ -2609,75 +2855,88 @@ real-mode area (VRMA) facility, the kernel will re-create the VMRA · 24 unmodified lines | |||
| 2609 | HPTEs on the next KVM_RUN of any vcpu. | 2855 | HPTEs on the next KVM_RUN of any vcpu. |
| 2610 | 2856 | ||
| 2611 | 4.77 KVM_S390_INTERRUPT | 2857 | 4.77 KVM_S390_INTERRUPT |
| 2858 | ----------------------- | ||
| 2612 | 2859 | ||
| 2613 | Capability: basic | 2860 | :Capability: basic |
| 2614 | Architectures: s390 | 2861 | :Architectures: s390 |
| 2615 | Type: vm ioctl, vcpu ioctl | 2862 | :Type: vm ioctl, vcpu ioctl |
| 2616 | Parameters: struct kvm_s390_interrupt (in) | 2863 | :Parameters: struct kvm_s390_interrupt (in) |
| 2617 | Returns: 0 on success, -1 on error | 2864 | :Returns: 0 on success, -1 on error |
| 2618 | 2865 | ||
| 2619 | Allows to inject an interrupt to the guest. Interrupts can be floating | 2866 | Allows to inject an interrupt to the guest. Interrupts can be floating |
| 2620 | (vm ioctl) or per cpu (vcpu ioctl), depending on the interrupt type. | 2867 | (vm ioctl) or per cpu (vcpu ioctl), depending on the interrupt type. |
| 2621 | 2868 | ||
| 2622 | Interrupt parameters are passed via kvm_s390_interrupt: | 2869 | Interrupt parameters are passed via kvm_s390_interrupt:: |
| 2623 | 2870 | ||
| 2624 | struct kvm_s390_interrupt { | 2871 | struct kvm_s390_interrupt { |
| 2625 | __u32 type; | 2872 | __u32 type; |
| 2626 | __u32 parm; | 2873 | __u32 parm; |
| 2627 | __u64 parm64; | 2874 | __u64 parm64; |
| 2628 | }; | 2875 | }; |
| 2629 | 2876 | ||
| 2630 | type can be one of the following: | 2877 | type can be one of the following: |
| 2631 | 2878 | ||
| 2632 | KVM_S390_SIGP_STOP (vcpu) - sigp stop; optional flags in parm | 2879 | KVM_S390_SIGP_STOP (vcpu) |
| 2633 | KVM_S390_PROGRAM_INT (vcpu) - program check; code in parm | 2880 | - sigp stop; optional flags in parm |
| 2634 | KVM_S390_SIGP_SET_PREFIX (vcpu) - sigp set prefix; prefix address in parm | 2881 | KVM_S390_PROGRAM_INT (vcpu) |
| 2635 | KVM_S390_RESTART (vcpu) - restart | 2882 | - program check; code in parm |
| 2636 | KVM_S390_INT_CLOCK_COMP (vcpu) - clock comparator interrupt | 2883 | KVM_S390_SIGP_SET_PREFIX (vcpu) |
| 2637 | KVM_S390_INT_CPU_TIMER (vcpu) - CPU timer interrupt | 2884 | - sigp set prefix; prefix address in parm |
| 2638 | KVM_S390_INT_VIRTIO (vm) - virtio external interrupt; external interrupt | 2885 | KVM_S390_RESTART (vcpu) |
| 2639 | parameters in parm and parm64 | 2886 | - restart |
| 2640 | KVM_S390_INT_SERVICE (vm) - sclp external interrupt; sclp parameter in parm | 2887 | KVM_S390_INT_CLOCK_COMP (vcpu) |
| 2641 | KVM_S390_INT_EMERGENCY (vcpu) - sigp emergency; source cpu in parm | 2888 | - clock comparator interrupt |
| 2642 | KVM_S390_INT_EXTERNAL_CALL (vcpu) - sigp external call; source cpu in parm | 2889 | KVM_S390_INT_CPU_TIMER (vcpu) |
| 2643 | KVM_S390_INT_IO(ai,cssid,ssid,schid) (vm) - compound value to indicate an | 2890 | - CPU timer interrupt |
| 2644 | I/O interrupt (ai - adapter interrupt; cssid,ssid,schid - subchannel); | 2891 | KVM_S390_INT_VIRTIO (vm) |
| 2645 | I/O interruption parameters in parm (subchannel) and parm64 (intparm, | 2892 | - virtio external interrupt; external interrupt |
| 2646 | interruption subclass) | 2893 | parameters in parm and parm64 |
| 2647 | KVM_S390_MCHK (vm, vcpu) - machine check interrupt; cr 14 bits in parm, | 2894 | KVM_S390_INT_SERVICE (vm) |
| 2648 | machine check interrupt code in parm64 (note that | 2895 | - sclp external interrupt; sclp parameter in parm |
| 2649 | machine checks needing further payload are not | 2896 | KVM_S390_INT_EMERGENCY (vcpu) |
| 2650 | supported by this ioctl) | 2897 | - sigp emergency; source cpu in parm |
| 2898 | KVM_S390_INT_EXTERNAL_CALL (vcpu) | ||
| 2899 | - sigp external call; source cpu in parm | ||
| 2900 | KVM_S390_INT_IO(ai,cssid,ssid,schid) (vm) | ||
| 2901 | - compound value to indicate an | ||
| 2902 | I/O interrupt (ai - adapter interrupt; cssid,ssid,schid - subchannel); | ||
| 2903 | I/O interruption parameters in parm (subchannel) and parm64 (intparm, | ||
| 2904 | interruption subclass) | ||
| 2905 | KVM_S390_MCHK (vm, vcpu) | ||
| 2906 | - machine check interrupt; cr 14 bits in parm, machine check interrupt | ||
| 2907 | code in parm64 (note that machine checks needing further payload are not | ||
| 2908 | supported by this ioctl) | ||
| 2651 | 2909 | ||
| 2652 | This is an asynchronous vcpu ioctl and can be invoked from any thread. | 2910 | This is an asynchronous vcpu ioctl and can be invoked from any thread. |
| 2653 | 2911 | ||
| 2654 | 4.78 KVM_PPC_GET_HTAB_FD | 2912 | 4.78 KVM_PPC_GET_HTAB_FD |
| 2913 | ------------------------ | ||
| 2655 | 2914 | ||
| 2656 | Capability: KVM_CAP_PPC_HTAB_FD | 2915 | :Capability: KVM_CAP_PPC_HTAB_FD |
| 2657 | Architectures: powerpc | 2916 | :Architectures: powerpc |
| 2658 | Type: vm ioctl | 2917 | :Type: vm ioctl |
| 2659 | Parameters: Pointer to struct kvm_get_htab_fd (in) | 2918 | :Parameters: Pointer to struct kvm_get_htab_fd (in) |
| 2660 | Returns: file descriptor number (>= 0) on success, -1 on error | 2919 | :Returns: file descriptor number (>= 0) on success, -1 on error |
| 2661 | 2920 | ||
| 2662 | This returns a file descriptor that can be used either to read out the | 2921 | This returns a file descriptor that can be used either to read out the |
| 2663 | entries in the guest's hashed page table (HPT), or to write entries to | 2922 | entries in the guest's hashed page table (HPT), or to write entries to |
| 2664 | initialize the HPT. The returned fd can only be written to if the | 2923 | initialize the HPT. The returned fd can only be written to if the |
| 2665 | KVM_GET_HTAB_WRITE bit is set in the flags field of the argument, and | 2924 | KVM_GET_HTAB_WRITE bit is set in the flags field of the argument, and |
| 2666 | can only be read if that bit is clear. The argument struct looks like | 2925 | can only be read if that bit is clear. The argument struct looks like |
| 2667 | this: | 2926 | this:: |
| 2668 | 2927 | ||
| 2669 | /* For KVM_PPC_GET_HTAB_FD */ | 2928 | /* For KVM_PPC_GET_HTAB_FD */ |
| 2670 | struct kvm_get_htab_fd { | 2929 | struct kvm_get_htab_fd { |
| 2671 | __u64 flags; | 2930 | __u64 flags; |
| 2672 | __u64 start_index; | 2931 | __u64 start_index; |
| 2673 | __u64 reserved[2]; | 2932 | __u64 reserved[2]; |
| 2674 | }; | 2933 | }; |
| 2675 | 2934 | ||
| 2676 | /* Values for kvm_get_htab_fd.flags */ | 2935 | /* Values for kvm_get_htab_fd.flags */ |
| 2677 | #define KVM_GET_HTAB_BOLTED_ONLY ((__u64)0x1) | 2936 | #define KVM_GET_HTAB_BOLTED_ONLY ((__u64)0x1) |
| 2678 | #define KVM_GET_HTAB_WRITE ((__u64)0x2) | 2937 | #define KVM_GET_HTAB_WRITE ((__u64)0x2) |
| 2679 | 2938 | ||
| 2680 | The `start_index' field gives the index in the HPT of the entry at | 2939 | The 'start_index' field gives the index in the HPT of the entry at |
| 2681 | which to start reading. It is ignored when writing. | 2940 | which to start reading. It is ignored when writing. |
| 2682 | 2941 | ||
| 2683 | Reads on the fd will initially supply information about all | 2942 | Reads on the fd will initially supply information about all |
| @@ -2692,29 +2951,34 @@ Data read or written is structured as a header (8 bytes) followed by a · 8 unmodified lines | |||
| 2692 | series of valid HPT entries (16 bytes) each. The header indicates how | 2951 | series of valid HPT entries (16 bytes) each. The header indicates how |
| 2693 | many valid HPT entries there are and how many invalid entries follow | 2952 | many valid HPT entries there are and how many invalid entries follow |
| 2694 | the valid entries. The invalid entries are not represented explicitly | 2953 | the valid entries. The invalid entries are not represented explicitly |
| 2695 | in the stream. The header format is: | 2954 | in the stream. The header format is:: |
| 2696 | 2955 | ||
| 2697 | struct kvm_get_htab_header { | 2956 | struct kvm_get_htab_header { |
| 2698 | __u32 index; | 2957 | __u32 index; |
| 2699 | __u16 n_valid; | 2958 | __u16 n_valid; |
| 2700 | __u16 n_invalid; | 2959 | __u16 n_invalid; |
| 2701 | }; | 2960 | }; |
| 2702 | 2961 | ||
| 2703 | Writes to the fd create HPT entries starting at the index given in the | 2962 | Writes to the fd create HPT entries starting at the index given in the |
| 2704 | header; first `n_valid' valid entries with contents from the data | 2963 | header; first 'n_valid' valid entries with contents from the data |
| 2705 | written, then `n_invalid' invalid entries, invalidating any previously | 2964 | written, then 'n_invalid' invalid entries, invalidating any previously |
| 2706 | valid entries found. | 2965 | valid entries found. |
| 2707 | 2966 | ||
| 2708 | 4.79 KVM_CREATE_DEVICE | 2967 | 4.79 KVM_CREATE_DEVICE |
| 2968 | ---------------------- | ||
| 2969 | |||
| 2970 | :Capability: KVM_CAP_DEVICE_CTRL | ||
| 2971 | :Type: vm ioctl | ||
| 2972 | :Parameters: struct kvm_create_device (in/out) | ||
| 2973 | :Returns: 0 on success, -1 on error | ||
| 2709 | 2974 | ||
| 2710 | Capability: KVM_CAP_DEVICE_CTRL | ||
| 2711 | Type: vm ioctl | ||
| 2712 | Parameters: struct kvm_create_device (in/out) | ||
| 2713 | Returns: 0 on success, -1 on error | ||
| 2714 | Errors: | 2975 | Errors: |
| 2715 | ENODEV: The device type is unknown or unsupported | 2976 | |
| 2716 | EEXIST: Device already created, and this type of device may not | 2977 | ====== ======================================================= |
| 2978 | ENODEV The device type is unknown or unsupported | ||
| 2979 | EEXIST Device already created, and this type of device may not | ||
| 2717 | be instantiated multiple times | 2980 | be instantiated multiple times |
| 2981 | ====== ======================================================= | ||
| 2718 | 2982 | ||
| 2719 | Other error conditions may be defined by individual device types or | 2983 | Other error conditions may be defined by individual device types or |
| 2720 | have their standard meanings. | 2984 | have their standard meanings. |
| @@ -2730,25 +2994,32 @@ Individual devices should not define flags. Attributes should be used · 9 unmodified lines | |||
| 2730 | for specifying any behavior that is not implied by the device type | 2994 | for specifying any behavior that is not implied by the device type |
| 2731 | number. | 2995 | number. |
| 2732 | 2996 | ||
| 2733 | struct kvm_create_device { | 2997 | :: |
| 2998 | |||
| 2999 | struct kvm_create_device { | ||
| 2734 | __u32 type; /* in: KVM_DEV_TYPE_xxx */ | 3000 | __u32 type; /* in: KVM_DEV_TYPE_xxx */ |
| 2735 | __u32 fd; /* out: device handle */ | 3001 | __u32 fd; /* out: device handle */ |
| 2736 | __u32 flags; /* in: KVM_CREATE_DEVICE_xxx */ | 3002 | __u32 flags; /* in: KVM_CREATE_DEVICE_xxx */ |
| 2737 | }; | 3003 | }; |
| 2738 | 3004 | ||
| 2739 | 4.80 KVM_SET_DEVICE_ATTR/KVM_GET_DEVICE_ATTR | 3005 | 4.80 KVM_SET_DEVICE_ATTR/KVM_GET_DEVICE_ATTR |
| 3006 | -------------------------------------------- | ||
| 3007 | |||
| 3008 | :Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, | ||
| 3009 | KVM_CAP_VCPU_ATTRIBUTES for vcpu device | ||
| 3010 | :Type: device ioctl, vm ioctl, vcpu ioctl | ||
| 3011 | :Parameters: struct kvm_device_attr | ||
| 3012 | :Returns: 0 on success, -1 on error | ||
| 2740 | 3013 | ||
| 2741 | Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, | ||
| 2742 | KVM_CAP_VCPU_ATTRIBUTES for vcpu device | ||
| 2743 | Type: device ioctl, vm ioctl, vcpu ioctl | ||
| 2744 | Parameters: struct kvm_device_attr | ||
| 2745 | Returns: 0 on success, -1 on error | ||
| 2746 | Errors: | 3014 | Errors: |
| 2747 | ENXIO: The group or attribute is unknown/unsupported for this device | 3015 | |
| 3016 | ===== ============================================================= | ||
| 3017 | ENXIO The group or attribute is unknown/unsupported for this device | ||
| 2748 | or hardware support is missing. | 3018 | or hardware support is missing. |
| 2749 | EPERM: The attribute cannot (currently) be accessed this way | 3019 | EPERM The attribute cannot (currently) be accessed this way |
| 2750 | (e.g. read-only attribute, or attribute that only makes | 3020 | (e.g. read-only attribute, or attribute that only makes |
| 2751 | sense when the device is in a different state) | 3021 | sense when the device is in a different state) |
| 3022 | ===== ============================================================= | ||
| 2752 | 3023 | ||
| 2753 | Other error conditions may be defined by individual device types. | 3024 | Other error conditions may be defined by individual device types. |
| 2754 | 3025 | ||
| @@ -2757,23 +3028,30 @@ semantics are device-specific. See individual device documentation in · 2 unmodified lines | |||
| 2757 | the "devices" directory. As with ONE_REG, the size of the data | 3028 | the "devices" directory. As with ONE_REG, the size of the data |
| 2758 | transferred is defined by the particular attribute. | 3029 | transferred is defined by the particular attribute. |
| 2759 | 3030 | ||
| 2760 | struct kvm_device_attr { | 3031 | :: |
| 3032 | |||
| 3033 | struct kvm_device_attr { | ||
| 2761 | __u32 flags; /* no flags currently defined */ | 3034 | __u32 flags; /* no flags currently defined */ |
| 2762 | __u32 group; /* device-defined */ | 3035 | __u32 group; /* device-defined */ |
| 2763 | __u64 attr; /* group-defined */ | 3036 | __u64 attr; /* group-defined */ |
| 2764 | __u64 addr; /* userspace address of attr data */ | 3037 | __u64 addr; /* userspace address of attr data */ |
| 2765 | }; | 3038 | }; |
| 2766 | 3039 | ||
| 2767 | 4.81 KVM_HAS_DEVICE_ATTR | 3040 | 4.81 KVM_HAS_DEVICE_ATTR |
| 3041 | ------------------------ | ||
| 3042 | |||
| 3043 | :Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, | ||
| 3044 | KVM_CAP_VCPU_ATTRIBUTES for vcpu device | ||
| 3045 | :Type: device ioctl, vm ioctl, vcpu ioctl | ||
| 3046 | :Parameters: struct kvm_device_attr | ||
| 3047 | :Returns: 0 on success, -1 on error | ||
| 2768 | 3048 | ||
| 2769 | Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, | ||
| 2770 | KVM_CAP_VCPU_ATTRIBUTES for vcpu device | ||
| 2771 | Type: device ioctl, vm ioctl, vcpu ioctl | ||
| 2772 | Parameters: struct kvm_device_attr | ||
| 2773 | Returns: 0 on success, -1 on error | ||
| 2774 | Errors: | 3049 | Errors: |
| 2775 | ENXIO: The group or attribute is unknown/unsupported for this device | 3050 | |
| 3051 | ===== ============================================================= | ||
| 3052 | ENXIO The group or attribute is unknown/unsupported for this device | ||
| 2776 | or hardware support is missing. | 3053 | or hardware support is missing. |
| 3054 | ===== ============================================================= | ||
| 2777 | 3055 | ||
| 2778 | Tests whether a device supports a particular attribute. A successful | 3056 | Tests whether a device supports a particular attribute. A successful |
| 2779 | return indicates the attribute is implemented. It does not necessarily | 3057 | return indicates the attribute is implemented. It does not necessarily |
| @@ -2781,15 +3059,20 @@ indicate that the attribute can be read or written in the device's · 1 unmodified line | |||
| 2781 | current state. "addr" is ignored. | 3059 | current state. "addr" is ignored. |
| 2782 | 3060 | ||
| 2783 | 4.82 KVM_ARM_VCPU_INIT | 3061 | 4.82 KVM_ARM_VCPU_INIT |
| 3062 | ---------------------- | ||
| 3063 | |||
| 3064 | :Capability: basic | ||
| 3065 | :Architectures: arm, arm64 | ||
| 3066 | :Type: vcpu ioctl | ||
| 3067 | :Parameters: struct kvm_vcpu_init (in) | ||
| 3068 | :Returns: 0 on success; -1 on error | ||
| 2784 | 3069 | ||
| 2785 | Capability: basic | ||
| 2786 | Architectures: arm, arm64 | ||
| 2787 | Type: vcpu ioctl | ||
| 2788 | Parameters: struct kvm_vcpu_init (in) | ||
| 2789 | Returns: 0 on success; -1 on error | ||
| 2790 | Errors: | 3070 | Errors: |
| 2791 | EINVAL: the target is unknown, or the combination of features is invalid. | 3071 | |
| 2792 | ENOENT: a features bit specified is unknown. | 3072 | ====== ================================================================= |
| 3073 | EINVAL the target is unknown, or the combination of features is invalid. | ||
| 3074 | ENOENT a features bit specified is unknown. | ||
| 3075 | ====== ================================================================= | ||
| 2793 | 3076 | ||
| 2794 | This tells KVM what type of CPU to present to the guest, and what | 3077 | This tells KVM what type of CPU to present to the guest, and what |
| 2795 | optional features it should have. This will cause a reset of the cpu | 3078 | optional features it should have. This will cause a reset of the cpu |
| @@ -2805,6 +3088,7 @@ state. All calls to this function after the initial call must use the same · 9 unmodified lines | |||
| 2805 | target and same set of feature flags, otherwise EINVAL will be returned. | 3088 | target and same set of feature flags, otherwise EINVAL will be returned. |
| 2806 | 3089 | ||
| 2807 | Possible features: | 3090 | Possible features: |
| 3091 | |||
| 2808 | - KVM_ARM_VCPU_POWER_OFF: Starts the CPU in a power-off state. | 3092 | - KVM_ARM_VCPU_POWER_OFF: Starts the CPU in a power-off state. |
| 2809 | Depends on KVM_CAP_ARM_PSCI. If not set, the CPU will be powered on | 3093 | Depends on KVM_CAP_ARM_PSCI. If not set, the CPU will be powered on |
| 2810 | and execute guest code when KVM_RUN is called. | 3094 | and execute guest code when KVM_RUN is called. |
| @@ -2861,14 +3145,19 @@ Possible features: · 50 unmodified lines | |||
| 2861 | no longer be written using KVM_SET_ONE_REG. | 3145 | no longer be written using KVM_SET_ONE_REG. |
| 2862 | 3146 | ||
| 2863 | 4.83 KVM_ARM_PREFERRED_TARGET | 3147 | 4.83 KVM_ARM_PREFERRED_TARGET |
| 3148 | ----------------------------- | ||
| 3149 | |||
| 3150 | :Capability: basic | ||
| 3151 | :Architectures: arm, arm64 | ||
| 3152 | :Type: vm ioctl | ||
| 3153 | :Parameters: struct struct kvm_vcpu_init (out) | ||
| 3154 | :Returns: 0 on success; -1 on error | ||
| 2864 | 3155 | ||
| 2865 | Capability: basic | ||
| 2866 | Architectures: arm, arm64 | ||
| 2867 | Type: vm ioctl | ||
| 2868 | Parameters: struct struct kvm_vcpu_init (out) | ||
| 2869 | Returns: 0 on success; -1 on error | ||
| 2870 | Errors: | 3156 | Errors: |
| 2871 | ENODEV: no preferred target available for the host | 3157 | |
| 3158 | ====== ========================================== | ||
| 3159 | ENODEV no preferred target available for the host | ||
| 3160 | ====== ========================================== | ||
| 2872 | 3161 | ||
| 2873 | This queries KVM for preferred CPU target type which can be emulated | 3162 | This queries KVM for preferred CPU target type which can be emulated |
| 2874 | by KVM on underlying host. | 3163 | by KVM on underlying host. |
| @@ -2885,43 +3174,57 @@ in VCPU matching underlying host. · 10 unmodified lines | |||
| 2885 | 3174 | ||
| 2886 | 3175 | ||
| 2887 | 4.84 KVM_GET_REG_LIST | 3176 | 4.84 KVM_GET_REG_LIST |
| 3177 | --------------------- | ||
| 3178 | |||
| 3179 | :Capability: basic | ||
| 3180 | :Architectures: arm, arm64, mips | ||
| 3181 | :Type: vcpu ioctl | ||
| 3182 | :Parameters: struct kvm_reg_list (in/out) | ||
| 3183 | :Returns: 0 on success; -1 on error | ||
| 2888 | 3184 | ||
| 2889 | Capability: basic | ||
| 2890 | Architectures: arm, arm64, mips | ||
| 2891 | Type: vcpu ioctl | ||
| 2892 | Parameters: struct kvm_reg_list (in/out) | ||
| 2893 | Returns: 0 on success; -1 on error | ||
| 2894 | Errors: | 3185 | Errors: |
| 2895 | E2BIG: the reg index list is too big to fit in the array specified by | 3186 | |
| 3187 | ===== ============================================================== | ||
| 3188 | E2BIG the reg index list is too big to fit in the array specified by | ||
| 2896 | the user (the number required will be written into n). | 3189 | the user (the number required will be written into n). |
| 3190 | ===== ============================================================== | ||
| 3191 | |||
| 3192 | :: | ||
| 2897 | 3193 | ||
| 2898 | struct kvm_reg_list { | 3194 | struct kvm_reg_list { |
| 2899 | __u64 n; /* number of registers in reg[] */ | 3195 | __u64 n; /* number of registers in reg[] */ |
| 2900 | __u64 reg[0]; | 3196 | __u64 reg[0]; |
| 2901 | }; | 3197 | }; |
| 2902 | 3198 | ||
| 2903 | This ioctl returns the guest registers that are supported for the | 3199 | This ioctl returns the guest registers that are supported for the |
| 2904 | KVM_GET_ONE_REG/KVM_SET_ONE_REG calls. | 3200 | KVM_GET_ONE_REG/KVM_SET_ONE_REG calls. |
| 2905 | 3201 | ||
| 2906 | 3202 | ||
| 2907 | 4.85 KVM_ARM_SET_DEVICE_ADDR (deprecated) | 3203 | 4.85 KVM_ARM_SET_DEVICE_ADDR (deprecated) |
| 3204 | ----------------------------------------- | ||
| 3205 | |||
| 3206 | :Capability: KVM_CAP_ARM_SET_DEVICE_ADDR | ||
| 3207 | :Architectures: arm, arm64 | ||
| 3208 | :Type: vm ioctl | ||
| 3209 | :Parameters: struct kvm_arm_device_address (in) | ||
| 3210 | :Returns: 0 on success, -1 on error | ||
| 2908 | 3211 | ||
| 2909 | Capability: KVM_CAP_ARM_SET_DEVICE_ADDR | ||
| 2910 | Architectures: arm, arm64 | ||
| 2911 | Type: vm ioctl | ||
| 2912 | Parameters: struct kvm_arm_device_address (in) | ||
| 2913 | Returns: 0 on success, -1 on error | ||
| 2914 | Errors: | 3212 | Errors: |
| 2915 | ENODEV: The device id is unknown | ||
| 2916 | ENXIO: Device not supported on current system | ||
| 2917 | EEXIST: Address already set | ||
| 2918 | E2BIG: Address outside guest physical address space | ||
| 2919 | EBUSY: Address overlaps with other device range | ||
| 2920 | 3213 | ||
| 2921 | struct kvm_arm_device_addr { | 3214 | ====== ============================================ |
| 3215 | ENODEV The device id is unknown | ||
| 3216 | ENXIO Device not supported on current system | ||
| 3217 | EEXIST Address already set | ||
| 3218 | E2BIG Address outside guest physical address space | ||
| 3219 | EBUSY Address overlaps with other device range | ||
| 3220 | ====== ============================================ | ||
| 3221 | |||
| 3222 | :: | ||
| 3223 | |||
| 3224 | struct kvm_arm_device_addr { | ||
| 2922 | __u64 id; | 3225 | __u64 id; |
| 2923 | __u64 addr; | 3226 | __u64 addr; |
| 2924 | }; | 3227 | }; |
| 2925 | 3228 | ||
| 2926 | Specify a device address in the guest's physical address space where guests | 3229 | Specify a device address in the guest's physical address space where guests |
| 2927 | can access emulated or directly exposed devices, which the host kernel needs | 3230 | can access emulated or directly exposed devices, which the host kernel needs |
| @@ -2929,7 +3232,7 @@ to know about. The id field is an architecture specific identifier for a · 1 unmodified line | |||
| 2929 | specific device. | 3232 | specific device. |
| 2930 | 3233 | ||
| 2931 | ARM/arm64 divides the id field into two parts, a device id and an | 3234 | ARM/arm64 divides the id field into two parts, a device id and an |
| 2932 | address type id specific to the individual device. | 3235 | address type id specific to the individual device:: |
| 2933 | 3236 | ||
| 2934 | bits: | 63 ... 32 | 31 ... 16 | 15 ... 0 | | 3237 | bits: | 63 ... 32 | 31 ... 16 | 15 ... 0 | |
| 2935 | field: | 0x00000000 | device id | addr type id | | 3238 | field: | 0x00000000 | device id | addr type id | |
| @@ -2947,12 +3250,13 @@ should be used instead. · 11 unmodified lines | |||
| 2947 | 3250 | ||
| 2948 | 3251 | ||
| 2949 | 4.86 KVM_PPC_RTAS_DEFINE_TOKEN | 3252 | 4.86 KVM_PPC_RTAS_DEFINE_TOKEN |
| 3253 | ------------------------------ | ||
| 2950 | 3254 | ||
| 2951 | Capability: KVM_CAP_PPC_RTAS | 3255 | :Capability: KVM_CAP_PPC_RTAS |
| 2952 | Architectures: ppc | 3256 | :Architectures: ppc |
| 2953 | Type: vm ioctl | 3257 | :Type: vm ioctl |
| 2954 | Parameters: struct kvm_rtas_token_args | 3258 | :Parameters: struct kvm_rtas_token_args |
| 2955 | Returns: 0 on success, -1 on error | 3259 | :Returns: 0 on success, -1 on error |
| 2956 | 3260 | ||
| 2957 | Defines a token value for a RTAS (Run Time Abstraction Services) | 3261 | Defines a token value for a RTAS (Run Time Abstraction Services) |
| 2958 | service in order to allow it to be handled in the kernel. The | 3262 | service in order to allow it to be handled in the kernel. The |
| @@ -2966,18 +3270,21 @@ calls by the guest for that service will be passed to userspace to be · 7 unmodified lines | |||
| 2966 | handled. | 3270 | handled. |
| 2967 | 3271 | ||
| 2968 | 4.87 KVM_SET_GUEST_DEBUG | 3272 | 4.87 KVM_SET_GUEST_DEBUG |
| 3273 | ------------------------ | ||
| 2969 | 3274 | ||
| 2970 | Capability: KVM_CAP_SET_GUEST_DEBUG | 3275 | :Capability: KVM_CAP_SET_GUEST_DEBUG |
| 2971 | Architectures: x86, s390, ppc, arm64 | 3276 | :Architectures: x86, s390, ppc, arm64 |
| 2972 | Type: vcpu ioctl | 3277 | :Type: vcpu ioctl |
| 2973 | Parameters: struct kvm_guest_debug (in) | 3278 | :Parameters: struct kvm_guest_debug (in) |
| 2974 | Returns: 0 on success; -1 on error | 3279 | :Returns: 0 on success; -1 on error |
| 2975 | 3280 | ||
| 2976 | struct kvm_guest_debug { | 3281 | :: |
| 3282 | |||
| 3283 | struct kvm_guest_debug { | ||
| 2977 | __u32 control; | 3284 | __u32 control; |
| 2978 | __u32 pad; | 3285 | __u32 pad; |
| 2979 | struct kvm_guest_debug_arch arch; | 3286 | struct kvm_guest_debug_arch arch; |
| 2980 | }; | 3287 | }; |
| 2981 | 3288 | ||
| 2982 | Set up the processor specific debug registers and configure vcpu for | 3289 | Set up the processor specific debug registers and configure vcpu for |
| 2983 | handling guest debug events. There are two parts to the structure, the | 3290 | handling guest debug events. There are two parts to the structure, the |
| @@ -3019,26 +3326,31 @@ KVM_EXIT_DEBUG with the kvm_debug_exit_arch part of the kvm_run · 35 unmodified lines | |||
| 3019 | structure containing architecture specific debug information. | 3326 | structure containing architecture specific debug information. |
| 3020 | 3327 | ||
| 3021 | 4.88 KVM_GET_EMULATED_CPUID | 3328 | 4.88 KVM_GET_EMULATED_CPUID |
| 3329 | --------------------------- | ||
| 3330 | |||
| 3331 | :Capability: KVM_CAP_EXT_EMUL_CPUID | ||
| 3332 | :Architectures: x86 | ||
| 3333 | :Type: system ioctl | ||
| 3334 | :Parameters: struct kvm_cpuid2 (in/out) | ||
| 3335 | :Returns: 0 on success, -1 on error | ||
| 3022 | 3336 | ||
| 3023 | Capability: KVM_CAP_EXT_EMUL_CPUID | 3337 | :: |
| 3024 | Architectures: x86 | ||
| 3025 | Type: system ioctl | ||
| 3026 | Parameters: struct kvm_cpuid2 (in/out) | ||
| 3027 | Returns: 0 on success, -1 on error | ||
| 3028 | 3338 | ||
| 3029 | struct kvm_cpuid2 { | 3339 | struct kvm_cpuid2 { |
| 3030 | __u32 nent; | 3340 | __u32 nent; |
| 3031 | __u32 flags; | 3341 | __u32 flags; |
| 3032 | struct kvm_cpuid_entry2 entries[0]; | 3342 | struct kvm_cpuid_entry2 entries[0]; |
| 3033 | }; | 3343 | }; |
| 3034 | 3344 | ||
| 3035 | The member 'flags' is used for passing flags from userspace. | 3345 | The member 'flags' is used for passing flags from userspace. |
| 3036 | 3346 | ||
| 3037 | #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0) | 3347 | :: |
| 3038 | #define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1) | ||
| 3039 | #define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2) | ||
| 3040 | 3348 | ||
| 3041 | struct kvm_cpuid_entry2 { | 3349 | #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX BIT(0) |
| 3350 | #define KVM_CPUID_FLAG_STATEFUL_FUNC BIT(1) | ||
| 3351 | #define KVM_CPUID_FLAG_STATE_READ_NEXT BIT(2) | ||
| 3352 | |||
| 3353 | struct kvm_cpuid_entry2 { | ||
| 3042 | __u32 function; | 3354 | __u32 function; |
| 3043 | __u32 index; | 3355 | __u32 index; |
| 3044 | __u32 flags; | 3356 | __u32 flags; |
| @@ -3047,7 +3359,7 @@ struct kvm_cpuid_entry2 { · 2 unmodified lines | |||
| 3047 | __u32 ecx; | 3359 | __u32 ecx; |
| 3048 | __u32 edx; | 3360 | __u32 edx; |
| 3049 | __u32 padding[3]; | 3361 | __u32 padding[3]; |
| 3050 | }; | 3362 | }; |
| 3051 | 3363 | ||
| 3052 | This ioctl returns x86 cpuid features which are emulated by | 3364 | This ioctl returns x86 cpuid features which are emulated by |
| 3053 | kvm.Userspace can use the information returned by this ioctl to query | 3365 | kvm.Userspace can use the information returned by this ioctl to query |
| @@ -3072,10 +3384,14 @@ emulated efficiently and thus not included here. · 18 unmodified lines | |||
| 3072 | 3384 | ||
| 3073 | The fields in each entry are defined as follows: | 3385 | The fields in each entry are defined as follows: |
| 3074 | 3386 | ||
| 3075 | function: the eax value used to obtain the entry | 3387 | function: |
| 3076 | index: the ecx value used to obtain the entry (for entries that are | 3388 | the eax value used to obtain the entry |
| 3389 | index: | ||
| 3390 | the ecx value used to obtain the entry (for entries that are | ||
| 3077 | affected by ecx) | 3391 | affected by ecx) |
| 3078 | flags: an OR of zero or more of the following: | 3392 | flags: |
| 3393 | an OR of zero or more of the following: | ||
| 3394 | |||
| 3079 | KVM_CPUID_FLAG_SIGNIFCANT_INDEX: | 3395 | KVM_CPUID_FLAG_SIGNIFCANT_INDEX: |
| 3080 | if the index field is valid | 3396 | if the index field is valid |
| 3081 | KVM_CPUID_FLAG_STATEFUL_FUNC: | 3397 | KVM_CPUID_FLAG_STATEFUL_FUNC: |
| @@ -3085,24 +3401,28 @@ The fields in each entry are defined as follows: · 3 unmodified lines | |||
| 3085 | KVM_CPUID_FLAG_STATE_READ_NEXT: | 3401 | KVM_CPUID_FLAG_STATE_READ_NEXT: |
| 3086 | for KVM_CPUID_FLAG_STATEFUL_FUNC entries, set if this entry is | 3402 | for KVM_CPUID_FLAG_STATEFUL_FUNC entries, set if this entry is |
| 3087 | the first entry to be read by a cpu | 3403 | the first entry to be read by a cpu |
| 3088 | eax, ebx, ecx, edx: the values returned by the cpuid instruction for | 3404 | |
| 3405 | eax, ebx, ecx, edx: | ||
| 3406 | |||
| 3407 | the values returned by the cpuid instruction for | ||
| 3089 | this function/index combination | 3408 | this function/index combination |
| 3090 | 3409 | ||
| 3091 | 4.89 KVM_S390_MEM_OP | 3410 | 4.89 KVM_S390_MEM_OP |
| 3411 | -------------------- | ||
| 3092 | 3412 | ||
| 3093 | Capability: KVM_CAP_S390_MEM_OP | 3413 | :Capability: KVM_CAP_S390_MEM_OP |
| 3094 | Architectures: s390 | 3414 | :Architectures: s390 |
| 3095 | Type: vcpu ioctl | 3415 | :Type: vcpu ioctl |
| 3096 | Parameters: struct kvm_s390_mem_op (in) | 3416 | :Parameters: struct kvm_s390_mem_op (in) |
| 3097 | Returns: = 0 on success, | 3417 | :Returns: = 0 on success, |
| 3098 | < 0 on generic error (e.g. -EFAULT or -ENOMEM), | 3418 | < 0 on generic error (e.g. -EFAULT or -ENOMEM), |
| 3099 | > 0 if an exception occurred while walking the page tables | 3419 | > 0 if an exception occurred while walking the page tables |
| 3100 | 3420 | ||
| 3101 | Read or write data from/to the logical (virtual) memory of a VCPU. | 3421 | Read or write data from/to the logical (virtual) memory of a VCPU. |
| 3102 | 3422 | ||
| 3103 | Parameters are specified via the following structure: | 3423 | Parameters are specified via the following structure:: |
| 3104 | 3424 | ||
| 3105 | struct kvm_s390_mem_op { | 3425 | struct kvm_s390_mem_op { |
| 3106 | __u64 gaddr; /* the guest address */ | 3426 | __u64 gaddr; /* the guest address */ |
| 3107 | __u64 flags; /* flags */ | 3427 | __u64 flags; /* flags */ |
| 3108 | __u32 size; /* amount of bytes */ | 3428 | __u32 size; /* amount of bytes */ |
| @@ -3110,7 +3430,7 @@ struct kvm_s390_mem_op { · 1 unmodified line | |||
| 3110 | __u64 buf; /* buffer in userspace */ | 3430 | __u64 buf; /* buffer in userspace */ |
| 3111 | __u8 ar; /* the access register number */ | 3431 | __u8 ar; /* the access register number */ |
| 3112 | __u8 reserved[31]; /* should be set to 0 */ | 3432 | __u8 reserved[31]; /* should be set to 0 */ |
| 3113 | }; | 3433 | }; |
| 3114 | 3434 | ||
| 3115 | The type of operation is specified in the "op" field. It is either | 3435 | The type of operation is specified in the "op" field. It is either |
| 3116 | KVM_S390_MEMOP_LOGICAL_READ for reading from logical memory space or | 3436 | KVM_S390_MEMOP_LOGICAL_READ for reading from logical memory space or |
| @@ -3137,24 +3457,25 @@ The "reserved" field is meant for future extensions. It is not used by · 20 unmodified lines | |||
| 3137 | KVM with the currently defined set of flags. | 3457 | KVM with the currently defined set of flags. |
| 3138 | 3458 | ||
| 3139 | 4.90 KVM_S390_GET_SKEYS | 3459 | 4.90 KVM_S390_GET_SKEYS |
| 3460 | ----------------------- | ||
| 3140 | 3461 | ||
| 3141 | Capability: KVM_CAP_S390_SKEYS | 3462 | :Capability: KVM_CAP_S390_SKEYS |
| 3142 | Architectures: s390 | 3463 | :Architectures: s390 |
| 3143 | Type: vm ioctl | 3464 | :Type: vm ioctl |
| 3144 | Parameters: struct kvm_s390_skeys | 3465 | :Parameters: struct kvm_s390_skeys |
| 3145 | Returns: 0 on success, KVM_S390_GET_KEYS_NONE if guest is not using storage | 3466 | :Returns: 0 on success, KVM_S390_GET_KEYS_NONE if guest is not using storage |
| 3146 | keys, negative value on error | 3467 | keys, negative value on error |
| 3147 | 3468 | ||
| 3148 | This ioctl is used to get guest storage key values on the s390 | 3469 | This ioctl is used to get guest storage key values on the s390 |
| 3149 | architecture. The ioctl takes parameters via the kvm_s390_skeys struct. | 3470 | architecture. The ioctl takes parameters via the kvm_s390_skeys struct:: |
| 3150 | 3471 | ||
| 3151 | struct kvm_s390_skeys { | 3472 | struct kvm_s390_skeys { |
| 3152 | __u64 start_gfn; | 3473 | __u64 start_gfn; |
| 3153 | __u64 count; | 3474 | __u64 count; |
| 3154 | __u64 skeydata_addr; | 3475 | __u64 skeydata_addr; |
| 3155 | __u32 flags; | 3476 | __u32 flags; |
| 3156 | __u32 reserved[9]; | 3477 | __u32 reserved[9]; |
| 3157 | }; | 3478 | }; |
| 3158 | 3479 | ||
| 3159 | The start_gfn field is the number of the first guest frame whose storage keys | 3480 | The start_gfn field is the number of the first guest frame whose storage keys |
| 3160 | you want to get. | 3481 | you want to get. |
| @@ -3168,12 +3489,13 @@ The skeydata_addr field is the address to a buffer large enough to hold count · 7 unmodified lines | |||
| 3168 | bytes. This buffer will be filled with storage key data by the ioctl. | 3489 | bytes. This buffer will be filled with storage key data by the ioctl. |
| 3169 | 3490 | ||
| 3170 | 4.91 KVM_S390_SET_SKEYS | 3491 | 4.91 KVM_S390_SET_SKEYS |
| 3492 | ----------------------- | ||
| 3171 | 3493 | ||
| 3172 | Capability: KVM_CAP_S390_SKEYS | 3494 | :Capability: KVM_CAP_S390_SKEYS |
| 3173 | Architectures: s390 | 3495 | :Architectures: s390 |
| 3174 | Type: vm ioctl | 3496 | :Type: vm ioctl |
| 3175 | Parameters: struct kvm_s390_skeys | 3497 | :Parameters: struct kvm_s390_skeys |
| 3176 | Returns: 0 on success, negative value on error | 3498 | :Returns: 0 on success, negative value on error |
| 3177 | 3499 | ||
| 3178 | This ioctl is used to set guest storage key values on the s390 | 3500 | This ioctl is used to set guest storage key values on the s390 |
| 3179 | architecture. The ioctl takes parameters via the kvm_s390_skeys struct. | 3501 | architecture. The ioctl takes parameters via the kvm_s390_skeys struct. |
| @@ -3195,21 +3517,27 @@ Note: If any architecturally invalid key value is found in the given data then · 15 unmodified lines | |||
| 3195 | the ioctl will return -EINVAL. | 3517 | the ioctl will return -EINVAL. |
| 3196 | 3518 | ||
| 3197 | 4.92 KVM_S390_IRQ | 3519 | 4.92 KVM_S390_IRQ |
| 3520 | ----------------- | ||
| 3521 | |||
| 3522 | :Capability: KVM_CAP_S390_INJECT_IRQ | ||
| 3523 | :Architectures: s390 | ||
| 3524 | :Type: vcpu ioctl | ||
| 3525 | :Parameters: struct kvm_s390_irq (in) | ||
| 3526 | :Returns: 0 on success, -1 on error | ||
| 3198 | 3527 | ||
| 3199 | Capability: KVM_CAP_S390_INJECT_IRQ | ||
| 3200 | Architectures: s390 | ||
| 3201 | Type: vcpu ioctl | ||
| 3202 | Parameters: struct kvm_s390_irq (in) | ||
| 3203 | Returns: 0 on success, -1 on error | ||
| 3204 | Errors: | 3528 | Errors: |
| 3205 | EINVAL: interrupt type is invalid | 3529 | |
| 3206 | type is KVM_S390_SIGP_STOP and flag parameter is invalid value | 3530 | |
| 3531 | ====== ================================================================= | ||
| 3532 | EINVAL interrupt type is invalid | ||
| 3533 | type is KVM_S390_SIGP_STOP and flag parameter is invalid value, | ||
| 3207 | type is KVM_S390_INT_EXTERNAL_CALL and code is bigger | 3534 | type is KVM_S390_INT_EXTERNAL_CALL and code is bigger |
| 3208 | than the maximum of VCPUs | 3535 | than the maximum of VCPUs |
| 3209 | EBUSY: type is KVM_S390_SIGP_SET_PREFIX and vcpu is not stopped | 3536 | EBUSY type is KVM_S390_SIGP_SET_PREFIX and vcpu is not stopped, |
| 3210 | type is KVM_S390_SIGP_STOP and a stop irq is already pending | 3537 | type is KVM_S390_SIGP_STOP and a stop irq is already pending, |
| 3211 | type is KVM_S390_INT_EXTERNAL_CALL and an external call interrupt | 3538 | type is KVM_S390_INT_EXTERNAL_CALL and an external call interrupt |
| 3212 | is already pending | 3539 | is already pending |
| 3540 | ====== ================================================================= | ||
| 3213 | 3541 | ||
| 3214 | Allows to inject an interrupt to the guest. | 3542 | Allows to inject an interrupt to the guest. |
| 3215 | 3543 | ||
| @@ -3217,9 +3545,9 @@ Using struct kvm_s390_irq as a parameter allows · 1 unmodified line | |||
| 3217 | to inject additional payload which is not | 3545 | to inject additional payload which is not |
| 3218 | possible via KVM_S390_INTERRUPT. | 3546 | possible via KVM_S390_INTERRUPT. |
| 3219 | 3547 | ||
| 3220 | Interrupt parameters are passed via kvm_s390_irq: | 3548 | Interrupt parameters are passed via kvm_s390_irq:: |
| 3221 | 3549 | ||
| 3222 | struct kvm_s390_irq { | 3550 | struct kvm_s390_irq { |
| 3223 | __u64 type; | 3551 | __u64 type; |
| 3224 | union { | 3552 | union { |
| 3225 | struct kvm_s390_io_info io; | 3553 | struct kvm_s390_io_info io; |
| @@ -3232,44 +3560,45 @@ struct kvm_s390_irq { · 6 unmodified lines | |||
| 3232 | struct kvm_s390_mchk_info mchk; | 3560 | struct kvm_s390_mchk_info mchk; |
| 3233 | char reserved[64]; | 3561 | char reserved[64]; |
| 3234 | } u; | 3562 | } u; |
| 3235 | }; | 3563 | }; |
| 3236 | 3564 | ||
| 3237 | type can be one of the following: | 3565 | type can be one of the following: |
| 3238 | 3566 | ||
| 3239 | KVM_S390_SIGP_STOP - sigp stop; parameter in .stop | 3567 | - KVM_S390_SIGP_STOP - sigp stop; parameter in .stop |
| 3240 | KVM_S390_PROGRAM_INT - program check; parameters in .pgm | 3568 | - KVM_S390_PROGRAM_INT - program check; parameters in .pgm |
| 3241 | KVM_S390_SIGP_SET_PREFIX - sigp set prefix; parameters in .prefix | 3569 | - KVM_S390_SIGP_SET_PREFIX - sigp set prefix; parameters in .prefix |
| 3242 | KVM_S390_RESTART - restart; no parameters | 3570 | - KVM_S390_RESTART - restart; no parameters |
| 3243 | KVM_S390_INT_CLOCK_COMP - clock comparator interrupt; no parameters | 3571 | - KVM_S390_INT_CLOCK_COMP - clock comparator interrupt; no parameters |
| 3244 | KVM_S390_INT_CPU_TIMER - CPU timer interrupt; no parameters | 3572 | - KVM_S390_INT_CPU_TIMER - CPU timer interrupt; no parameters |
| 3245 | KVM_S390_INT_EMERGENCY - sigp emergency; parameters in .emerg | 3573 | - KVM_S390_INT_EMERGENCY - sigp emergency; parameters in .emerg |
| 3246 | KVM_S390_INT_EXTERNAL_CALL - sigp external call; parameters in .extcall | 3574 | - KVM_S390_INT_EXTERNAL_CALL - sigp external call; parameters in .extcall |
| 3247 | KVM_S390_MCHK - machine check interrupt; parameters in .mchk | 3575 | - KVM_S390_MCHK - machine check interrupt; parameters in .mchk |
| 3248 | 3576 | ||
| 3249 | This is an asynchronous vcpu ioctl and can be invoked from any thread. | 3577 | This is an asynchronous vcpu ioctl and can be invoked from any thread. |
| 3250 | 3578 | ||
| 3251 | 4.94 KVM_S390_GET_IRQ_STATE | 3579 | 4.94 KVM_S390_GET_IRQ_STATE |
| 3580 | --------------------------- | ||
| 3252 | 3581 | ||
| 3253 | Capability: KVM_CAP_S390_IRQ_STATE | 3582 | :Capability: KVM_CAP_S390_IRQ_STATE |
| 3254 | Architectures: s390 | 3583 | :Architectures: s390 |
| 3255 | Type: vcpu ioctl | 3584 | :Type: vcpu ioctl |
| 3256 | Parameters: struct kvm_s390_irq_state (out) | 3585 | :Parameters: struct kvm_s390_irq_state (out) |
| 3257 | Returns: >= number of bytes copied into buffer, | 3586 | :Returns: >= number of bytes copied into buffer, |
| 3258 | -EINVAL if buffer size is 0, | 3587 | -EINVAL if buffer size is 0, |
| 3259 | -ENOBUFS if buffer size is too small to fit all pending interrupts, | 3588 | -ENOBUFS if buffer size is too small to fit all pending interrupts, |
| 3260 | -EFAULT if the buffer address was invalid | 3589 | -EFAULT if the buffer address was invalid |
| 3261 | 3590 | ||
| 3262 | This ioctl allows userspace to retrieve the complete state of all currently | 3591 | This ioctl allows userspace to retrieve the complete state of all currently |
| 3263 | pending interrupts in a single buffer. Use cases include migration | 3592 | pending interrupts in a single buffer. Use cases include migration |
| 3264 | and introspection. The parameter structure contains the address of a | 3593 | and introspection. The parameter structure contains the address of a |
| 3265 | userspace buffer and its length: | 3594 | userspace buffer and its length:: |
| 3266 | 3595 | ||
| 3267 | struct kvm_s390_irq_state { | 3596 | struct kvm_s390_irq_state { |
| 3268 | __u64 buf; | 3597 | __u64 buf; |
| 3269 | __u32 flags; /* will stay unused for compatibility reasons */ | 3598 | __u32 flags; /* will stay unused for compatibility reasons */ |
| 3270 | __u32 len; | 3599 | __u32 len; |
| 3271 | __u32 reserved[4]; /* will stay unused for compatibility reasons */ | 3600 | __u32 reserved[4]; /* will stay unused for compatibility reasons */ |
| 3272 | }; | 3601 | }; |
| 3273 | 3602 | ||
| 3274 | Userspace passes in the above struct and for each pending interrupt a | 3603 | Userspace passes in the above struct and for each pending interrupt a |
| 3275 | struct kvm_s390_irq is copied to the provided buffer. | 3604 | struct kvm_s390_irq is copied to the provided buffer. |
| @@ -3283,29 +3612,30 @@ If -ENOBUFS is returned the buffer provided was too small and userspace · 7 unmodified lines | |||
| 3283 | may retry with a bigger buffer. | 3612 | may retry with a bigger buffer. |
| 3284 | 3613 | ||
| 3285 | 4.95 KVM_S390_SET_IRQ_STATE | 3614 | 4.95 KVM_S390_SET_IRQ_STATE |
| 3286 | 3615 | --------------------------- | |
| 3287 | Capability: KVM_CAP_S390_IRQ_STATE | 3616 | |
| 3288 | Architectures: s390 | 3617 | :Capability: KVM_CAP_S390_IRQ_STATE |
| 3289 | Type: vcpu ioctl | 3618 | :Architectures: s390 |
| 3290 | Parameters: struct kvm_s390_irq_state (in) | 3619 | :Type: vcpu ioctl |
| 3291 | Returns: 0 on success, | 3620 | :Parameters: struct kvm_s390_irq_state (in) |
| 3292 | -EFAULT if the buffer address was invalid, | 3621 | :Returns: 0 on success, |
| 3293 | -EINVAL for an invalid buffer length (see below), | 3622 | -EFAULT if the buffer address was invalid, |
| 3294 | -EBUSY if there were already interrupts pending, | 3623 | -EINVAL for an invalid buffer length (see below), |
| 3295 | errors occurring when actually injecting the | 3624 | -EBUSY if there were already interrupts pending, |
| 3625 | errors occurring when actually injecting the | ||
| 3296 | interrupt. See KVM_S390_IRQ. | 3626 | interrupt. See KVM_S390_IRQ. |
| 3297 | 3627 | ||
| 3298 | This ioctl allows userspace to set the complete state of all cpu-local | 3628 | This ioctl allows userspace to set the complete state of all cpu-local |
| 3299 | interrupts currently pending for the vcpu. It is intended for restoring | 3629 | interrupts currently pending for the vcpu. It is intended for restoring |
| 3300 | interrupt state after a migration. The input parameter is a userspace buffer | 3630 | interrupt state after a migration. The input parameter is a userspace buffer |
| 3301 | containing a struct kvm_s390_irq_state: | 3631 | containing a struct kvm_s390_irq_state:: |
| 3302 | 3632 | ||
| 3303 | struct kvm_s390_irq_state { | 3633 | struct kvm_s390_irq_state { |
| 3304 | __u64 buf; | 3634 | __u64 buf; |
| 3305 | __u32 flags; /* will stay unused for compatibility reasons */ | 3635 | __u32 flags; /* will stay unused for compatibility reasons */ |
| 3306 | __u32 len; | 3636 | __u32 len; |
| 3307 | __u32 reserved[4]; /* will stay unused for compatibility reasons */ | 3637 | __u32 reserved[4]; /* will stay unused for compatibility reasons */ |
| 3308 | }; | 3638 | }; |
| 3309 | 3639 | ||
| 3310 | The restrictions for flags and reserved apply as well. | 3640 | The restrictions for flags and reserved apply as well. |
| 3311 | (see KVM_S390_GET_IRQ_STATE) | 3641 | (see KVM_S390_GET_IRQ_STATE) |
| @@ -3320,20 +3650,22 @@ and it must not exceed (max_vcpus + 32) * sizeof(struct kvm_s390_irq), · 8 unmodified lines | |||
| 3320 | which is the maximum number of possibly pending cpu-local interrupts. | 3650 | which is the maximum number of possibly pending cpu-local interrupts. |
| 3321 | 3651 | ||
| 3322 | 4.96 KVM_SMI | 3652 | 4.96 KVM_SMI |
| 3653 | ------------ | ||
| 3323 | 3654 | ||
| 3324 | Capability: KVM_CAP_X86_SMM | 3655 | :Capability: KVM_CAP_X86_SMM |
| 3325 | Architectures: x86 | 3656 | :Architectures: x86 |
| 3326 | Type: vcpu ioctl | 3657 | :Type: vcpu ioctl |
| 3327 | Parameters: none | 3658 | :Parameters: none |
| 3328 | Returns: 0 on success, -1 on error | 3659 | :Returns: 0 on success, -1 on error |
| 3329 | 3660 | ||
| 3330 | Queues an SMI on the thread's vcpu. | 3661 | Queues an SMI on the thread's vcpu. |
| 3331 | 3662 | ||
| 3332 | 4.97 KVM_CAP_PPC_MULTITCE | 3663 | 4.97 KVM_CAP_PPC_MULTITCE |
| 3664 | ------------------------- | ||
| 3333 | 3665 | ||
| 3334 | Capability: KVM_CAP_PPC_MULTITCE | 3666 | :Capability: KVM_CAP_PPC_MULTITCE |
| 3335 | Architectures: ppc | 3667 | :Architectures: ppc |
| 3336 | Type: vm | 3668 | :Type: vm |
| 3337 | 3669 | ||
| 3338 | This capability means the kernel is capable of handling hypercalls | 3670 | This capability means the kernel is capable of handling hypercalls |
| 3339 | H_PUT_TCE_INDIRECT and H_STUFF_TCE without passing those into the user | 3671 | H_PUT_TCE_INDIRECT and H_STUFF_TCE without passing those into the user |
| @@ -3355,26 +3687,27 @@ an implementation for these despite the in kernel acceleration. · 15 unmodified lines | |||
| 3355 | This capability is always enabled. | 3687 | This capability is always enabled. |
| 3356 | 3688 | ||
| 3357 | 4.98 KVM_CREATE_SPAPR_TCE_64 | 3689 | 4.98 KVM_CREATE_SPAPR_TCE_64 |
| 3690 | ---------------------------- | ||
| 3358 | 3691 | ||
| 3359 | Capability: KVM_CAP_SPAPR_TCE_64 | 3692 | :Capability: KVM_CAP_SPAPR_TCE_64 |
| 3360 | Architectures: powerpc | 3693 | :Architectures: powerpc |
| 3361 | Type: vm ioctl | 3694 | :Type: vm ioctl |
| 3362 | Parameters: struct kvm_create_spapr_tce_64 (in) | 3695 | :Parameters: struct kvm_create_spapr_tce_64 (in) |
| 3363 | Returns: file descriptor for manipulating the created TCE table | 3696 | :Returns: file descriptor for manipulating the created TCE table |
| 3364 | 3697 | ||
| 3365 | This is an extension for KVM_CAP_SPAPR_TCE which only supports 32bit | 3698 | This is an extension for KVM_CAP_SPAPR_TCE which only supports 32bit |
| 3366 | windows, described in 4.62 KVM_CREATE_SPAPR_TCE | 3699 | windows, described in 4.62 KVM_CREATE_SPAPR_TCE |
| 3367 | 3700 | ||
| 3368 | This capability uses extended struct in ioctl interface: | 3701 | This capability uses extended struct in ioctl interface:: |
| 3369 | 3702 | ||
| 3370 | /* for KVM_CAP_SPAPR_TCE_64 */ | 3703 | /* for KVM_CAP_SPAPR_TCE_64 */ |
| 3371 | struct kvm_create_spapr_tce_64 { | 3704 | struct kvm_create_spapr_tce_64 { |
| 3372 | __u64 liobn; | 3705 | __u64 liobn; |
| 3373 | __u32 page_shift; | 3706 | __u32 page_shift; |
| 3374 | __u32 flags; | 3707 | __u32 flags; |
| 3375 | __u64 offset; /* in pages */ | 3708 | __u64 offset; /* in pages */ |
| 3376 | __u64 size; /* in pages */ | 3709 | __u64 size; /* in pages */ |
| 3377 | }; | 3710 | }; |
| 3378 | 3711 | ||
| 3379 | The aim of extension is to support an additional bigger DMA window with | 3712 | The aim of extension is to support an additional bigger DMA window with |
| 3380 | a variable page size. | 3713 | a variable page size. |
| @@ -3387,12 +3720,13 @@ of IOMMU pages. · 6 unmodified lines | |||
| 3387 | The rest of functionality is identical to KVM_CREATE_SPAPR_TCE. | 3720 | The rest of functionality is identical to KVM_CREATE_SPAPR_TCE. |
| 3388 | 3721 | ||
| 3389 | 4.99 KVM_REINJECT_CONTROL | 3722 | 4.99 KVM_REINJECT_CONTROL |
| 3723 | ------------------------- | ||
| 3390 | 3724 | ||
| 3391 | Capability: KVM_CAP_REINJECT_CONTROL | 3725 | :Capability: KVM_CAP_REINJECT_CONTROL |
| 3392 | Architectures: x86 | 3726 | :Architectures: x86 |
| 3393 | Type: vm ioctl | 3727 | :Type: vm ioctl |
| 3394 | Parameters: struct kvm_reinject_control (in) | 3728 | :Parameters: struct kvm_reinject_control (in) |
| 3395 | Returns: 0 on success, | 3729 | :Returns: 0 on success, |
| 3396 | -EFAULT if struct kvm_reinject_control cannot be read, | 3730 | -EFAULT if struct kvm_reinject_control cannot be read, |
| 3397 | -ENXIO if KVM_CREATE_PIT or KVM_CREATE_PIT2 didn't succeed earlier. | 3731 | -ENXIO if KVM_CREATE_PIT or KVM_CREATE_PIT2 didn't succeed earlier. |
| 3398 | 3732 | ||
| @@ -3402,21 +3736,24 @@ vector(s) that i8254 injects. Reinject mode dequeues a tick and injects its · 3 unmodified lines | |||
| 3402 | interrupt whenever there isn't a pending interrupt from i8254. | 3736 | interrupt whenever there isn't a pending interrupt from i8254. |
| 3403 | !reinject mode injects an interrupt as soon as a tick arrives. | 3737 | !reinject mode injects an interrupt as soon as a tick arrives. |
| 3404 | 3738 | ||
| 3405 | struct kvm_reinject_control { | 3739 | :: |
| 3740 | |||
| 3741 | struct kvm_reinject_control { | ||
| 3406 | __u8 pit_reinject; | 3742 | __u8 pit_reinject; |
| 3407 | __u8 reserved[31]; | 3743 | __u8 reserved[31]; |
| 3408 | }; | 3744 | }; |
| 3409 | 3745 | ||
| 3410 | pit_reinject = 0 (!reinject mode) is recommended, unless running an old | 3746 | pit_reinject = 0 (!reinject mode) is recommended, unless running an old |
| 3411 | operating system that uses the PIT for timing (e.g. Linux 2.4.x). | 3747 | operating system that uses the PIT for timing (e.g. Linux 2.4.x). |
| 3412 | 3748 | ||
| 3413 | 4.100 KVM_PPC_CONFIGURE_V3_MMU | 3749 | 4.100 KVM_PPC_CONFIGURE_V3_MMU |
| 3750 | ------------------------------ | ||
| 3414 | 3751 | ||
| 3415 | Capability: KVM_CAP_PPC_RADIX_MMU or KVM_CAP_PPC_HASH_MMU_V3 | 3752 | :Capability: KVM_CAP_PPC_RADIX_MMU or KVM_CAP_PPC_HASH_MMU_V3 |
| 3416 | Architectures: ppc | 3753 | :Architectures: ppc |
| 3417 | Type: vm ioctl | 3754 | :Type: vm ioctl |
| 3418 | Parameters: struct kvm_ppc_mmuv3_cfg (in) | 3755 | :Parameters: struct kvm_ppc_mmuv3_cfg (in) |
| 3419 | Returns: 0 on success, | 3756 | :Returns: 0 on success, |
| 3420 | -EFAULT if struct kvm_ppc_mmuv3_cfg cannot be read, | 3757 | -EFAULT if struct kvm_ppc_mmuv3_cfg cannot be read, |
| 3421 | -EINVAL if the configuration is invalid | 3758 | -EINVAL if the configuration is invalid |
| 3422 | 3759 | ||
| @@ -3424,10 +3761,12 @@ This ioctl controls whether the guest will use radix or HPT (hashed · 1 unmodified line | |||
| 3424 | page table) translation, and sets the pointer to the process table for | 3761 | page table) translation, and sets the pointer to the process table for |
| 3425 | the guest. | 3762 | the guest. |
| 3426 | 3763 | ||
| 3427 | struct kvm_ppc_mmuv3_cfg { | 3764 | :: |
| 3765 | |||
| 3766 | struct kvm_ppc_mmuv3_cfg { | ||
| 3428 | __u64 flags; | 3767 | __u64 flags; |
| 3429 | __u64 process_table; | 3768 | __u64 process_table; |
| 3430 | }; | 3769 | }; |
| 3431 | 3770 | ||
| 3432 | There are two bits that can be set in flags; KVM_PPC_MMUV3_RADIX and | 3771 | There are two bits that can be set in flags; KVM_PPC_MMUV3_RADIX and |
| 3433 | KVM_PPC_MMUV3_GTSE. KVM_PPC_MMUV3_RADIX, if set, configures the guest | 3772 | KVM_PPC_MMUV3_GTSE. KVM_PPC_MMUV3_RADIX, if set, configures the guest |
| @@ -3442,12 +3781,13 @@ as the second doubleword of the partition table entry, as defined in · 8 unmodified lines | |||
| 3442 | the Power ISA V3.00, Book III section 5.7.6.1. | 3781 | the Power ISA V3.00, Book III section 5.7.6.1. |
| 3443 | 3782 | ||
| 3444 | 4.101 KVM_PPC_GET_RMMU_INFO | 3783 | 4.101 KVM_PPC_GET_RMMU_INFO |
| 3784 | --------------------------- | ||
| 3445 | 3785 | ||
| 3446 | Capability: KVM_CAP_PPC_RADIX_MMU | 3786 | :Capability: KVM_CAP_PPC_RADIX_MMU |
| 3447 | Architectures: ppc | 3787 | :Architectures: ppc |
| 3448 | Type: vm ioctl | 3788 | :Type: vm ioctl |
| 3449 | Parameters: struct kvm_ppc_rmmu_info (out) | 3789 | :Parameters: struct kvm_ppc_rmmu_info (out) |
| 3450 | Returns: 0 on success, | 3790 | :Returns: 0 on success, |
| 3451 | -EFAULT if struct kvm_ppc_rmmu_info cannot be written, | 3791 | -EFAULT if struct kvm_ppc_rmmu_info cannot be written, |
| 3452 | -EINVAL if no useful information can be returned | 3792 | -EINVAL if no useful information can be returned |
| 3453 | 3793 | ||
| @@ -3456,14 +3796,16 @@ containing supported radix tree geometries, and (b) a list that maps · 2 unmodified lines | |||
| 3456 | page sizes to put in the "AP" (actual page size) field for the tlbie | 3796 | page sizes to put in the "AP" (actual page size) field for the tlbie |
| 3457 | (TLB invalidate entry) instruction. | 3797 | (TLB invalidate entry) instruction. |
| 3458 | 3798 | ||
| 3459 | struct kvm_ppc_rmmu_info { | 3799 | :: |
| 3800 | |||
| 3801 | struct kvm_ppc_rmmu_info { | ||
| 3460 | struct kvm_ppc_radix_geom { | 3802 | struct kvm_ppc_radix_geom { |
| 3461 | __u8 page_shift; | 3803 | __u8 page_shift; |
| 3462 | __u8 level_bits[4]; | 3804 | __u8 level_bits[4]; |
| 3463 | __u8 pad[3]; | 3805 | __u8 pad[3]; |
| 3464 | } geometries[8]; | 3806 | } geometries[8]; |
| 3465 | __u32 ap_encodings[8]; | 3807 | __u32 ap_encodings[8]; |
| 3466 | }; | 3808 | }; |
| 3467 | 3809 | ||
| 3468 | The geometries[] field gives up to 8 supported geometries for the | 3810 | The geometries[] field gives up to 8 supported geometries for the |
| 3469 | radix page table, in terms of the log base 2 of the smallest page | 3811 | radix page table, in terms of the log base 2 of the smallest page |
| @@ -3476,19 +3818,54 @@ encodings, encoded with the AP value in the top 3 bits and the log · 6 unmodified lines | |||
| 3476 | base 2 of the page size in the bottom 6 bits. | 3818 | base 2 of the page size in the bottom 6 bits. |
| 3477 | 3819 | ||
| 3478 | 4.102 KVM_PPC_RESIZE_HPT_PREPARE | 3820 | 4.102 KVM_PPC_RESIZE_HPT_PREPARE |
| 3821 | -------------------------------- | ||
| 3479 | 3822 | ||
| 3480 | Capability: KVM_CAP_SPAPR_RESIZE_HPT | 3823 | :Capability: KVM_CAP_SPAPR_RESIZE_HPT |
| 3481 | Architectures: powerpc | 3824 | :Architectures: powerpc |
| 3482 | Type: vm ioctl | 3825 | :Type: vm ioctl |
| 3483 | Parameters: struct kvm_ppc_resize_hpt (in) | 3826 | :Parameters: struct kvm_ppc_resize_hpt (in) |
| 3484 | Returns: 0 on successful completion, | 3827 | :Returns: 0 on successful completion, |
| 3485 | >0 if a new HPT is being prepared, the value is an estimated | 3828 | >0 if a new HPT is being prepared, the value is an estimated |
| 3486 | number of milliseconds until preparation is complete | 3829 | number of milliseconds until preparation is complete, |
| 3487 | -EFAULT if struct kvm_reinject_control cannot be read, | 3830 | -EFAULT if struct kvm_reinject_control cannot be read, |
| 3488 | -EINVAL if the supplied shift or flags are invalid | 3831 | -EINVAL if the supplied shift or flags are invalid, |
| 3489 | -ENOMEM if unable to allocate the new HPT | 3832 | -ENOMEM if unable to allocate the new HPT, |
| 3490 | -ENOSPC if there was a hash collision when moving existing | 3833 | -ENOSPC if there was a hash collision |
| 3491 | HPT entries to the new HPT | 3834 | |
| 3835 | :: | ||
| 3836 | |||
| 3837 | struct kvm_ppc_rmmu_info { | ||
| 3838 | struct kvm_ppc_radix_geom { | ||
| 3839 | __u8 page_shift; | ||
| 3840 | __u8 level_bits[4]; | ||
| 3841 | __u8 pad[3]; | ||
| 3842 | } geometries[8]; | ||
| 3843 | __u32 ap_encodings[8]; | ||
| 3844 | }; | ||
| 3845 | |||
| 3846 | The geometries[] field gives up to 8 supported geometries for the | ||
| 3847 | radix page table, in terms of the log base 2 of the smallest page | ||
| 3848 | size, and the number of bits indexed at each level of the tree, from | ||
| 3849 | the PTE level up to the PGD level in that order. Any unused entries | ||
| 3850 | will have 0 in the page_shift field. | ||
| 3851 | |||
| 3852 | The ap_encodings gives the supported page sizes and their AP field | ||
| 3853 | encodings, encoded with the AP value in the top 3 bits and the log | ||
| 3854 | base 2 of the page size in the bottom 6 bits. | ||
| 3855 | |||
| 3856 | 4.102 KVM_PPC_RESIZE_HPT_PREPARE | ||
| 3857 | -------------------------------- | ||
| 3858 | |||
| 3859 | :Capability: KVM_CAP_SPAPR_RESIZE_HPT | ||
| 3860 | :Architectures: powerpc | ||
| 3861 | :Type: vm ioctl | ||
| 3862 | :Parameters: struct kvm_ppc_resize_hpt (in) | ||
| 3863 | :Returns: 0 on successful completion, | ||
| 3864 | >0 if a new HPT is being prepared, the value is an estimated | ||
| 3865 | number of milliseconds until preparation is complete, | ||
| 3866 | -EFAULT if struct kvm_reinject_control cannot be read, | ||
| 3867 | -EINVAL if the supplied shift or flags are invalid,when moving existing | ||
| 3868 | HPT entries to the new HPT, | ||
| 3492 | -EIO on other error conditions | 3869 | -EIO on other error conditions |
| 3493 | 3870 | ||
| 3494 | Used to implement the PAPR extension for runtime resizing of a guest's | 3871 | Used to implement the PAPR extension for runtime resizing of a guest's |
| @@ -3506,6 +3883,7 @@ requested in the parameters, discards the existing pending HPT and · 11 unmodified lines | |||
| 3506 | creates a new one as above. | 3883 | creates a new one as above. |
| 3507 | 3884 | ||
| 3508 | If called when there is a pending HPT of the size requested, will: | 3885 | If called when there is a pending HPT of the size requested, will: |
| 3886 | |||
| 3509 | * If preparation of the pending HPT is already complete, return 0 | 3887 | * If preparation of the pending HPT is already complete, return 0 |
| 3510 | * If preparation of the pending HPT has failed, return an error | 3888 | * If preparation of the pending HPT has failed, return an error |
| 3511 | code, then discard the pending HPT. | 3889 | code, then discard the pending HPT. |
| @@ -3522,26 +3900,29 @@ Normally this will be called repeatedly with the same parameters until · 10 unmodified lines | |||
| 3522 | it returns <= 0. The first call will initiate preparation, subsequent | 3900 | it returns <= 0. The first call will initiate preparation, subsequent |
| 3523 | ones will monitor preparation until it completes or fails. | 3901 | ones will monitor preparation until it completes or fails. |
| 3524 | 3902 | ||
| 3525 | struct kvm_ppc_resize_hpt { | 3903 | :: |
| 3904 | |||
| 3905 | struct kvm_ppc_resize_hpt { | ||
| 3526 | __u64 flags; | 3906 | __u64 flags; |
| 3527 | __u32 shift; | 3907 | __u32 shift; |
| 3528 | __u32 pad; | 3908 | __u32 pad; |
| 3529 | }; | 3909 | }; |
| 3530 | 3910 | ||
| 3531 | 4.103 KVM_PPC_RESIZE_HPT_COMMIT | 3911 | 4.103 KVM_PPC_RESIZE_HPT_COMMIT |
| 3912 | ------------------------------- | ||
| 3532 | 3913 | ||
| 3533 | Capability: KVM_CAP_SPAPR_RESIZE_HPT | 3914 | :Capability: KVM_CAP_SPAPR_RESIZE_HPT |
| 3534 | Architectures: powerpc | 3915 | :Architectures: powerpc |
| 3535 | Type: vm ioctl | 3916 | :Type: vm ioctl |
| 3536 | Parameters: struct kvm_ppc_resize_hpt (in) | 3917 | :Parameters: struct kvm_ppc_resize_hpt (in) |
| 3537 | Returns: 0 on successful completion, | 3918 | :Returns: 0 on successful completion, |
| 3538 | -EFAULT if struct kvm_reinject_control cannot be read, | 3919 | -EFAULT if struct kvm_reinject_control cannot be read, |
| 3539 | -EINVAL if the supplied shift or flags are invalid | 3920 | -EINVAL if the supplied shift or flags are invalid, |
| 3540 | -ENXIO is there is no pending HPT, or the pending HPT doesn't | 3921 | -ENXIO is there is no pending HPT, or the pending HPT doesn't |
| 3541 | have the requested size | 3922 | have the requested size, |
| 3542 | -EBUSY if the pending HPT is not fully prepared | 3923 | -EBUSY if the pending HPT is not fully prepared, |
| 3543 | -ENOSPC if there was a hash collision when moving existing | 3924 | -ENOSPC if there was a hash collision when moving existing |
| 3544 | HPT entries to the new HPT | 3925 | HPT entries to the new HPT, |
| 3545 | -EIO on other error conditions | 3926 | -EIO on other error conditions |
| 3546 | 3927 | ||
| 3547 | Used to implement the PAPR extension for runtime resizing of a guest's | 3928 | Used to implement the PAPR extension for runtime resizing of a guest's |
| @@ -3564,31 +3945,35 @@ HPT and the previous HPT will be discarded. · 16 unmodified lines | |||
| 3564 | 3945 | ||
| 3565 | On failure, the guest will still be operating on its previous HPT. | 3946 | On failure, the guest will still be operating on its previous HPT. |
| 3566 | 3947 | ||
| 3567 | struct kvm_ppc_resize_hpt { | 3948 | :: |
| 3949 | |||
| 3950 | struct kvm_ppc_resize_hpt { | ||
| 3568 | __u64 flags; | 3951 | __u64 flags; |
| 3569 | __u32 shift; | 3952 | __u32 shift; |
| 3570 | __u32 pad; | 3953 | __u32 pad; |
| 3571 | }; | 3954 | }; |
| 3572 | 3955 | ||
| 3573 | 4.104 KVM_X86_GET_MCE_CAP_SUPPORTED | 3956 | 4.104 KVM_X86_GET_MCE_CAP_SUPPORTED |
| 3957 | ----------------------------------- | ||
| 3574 | 3958 | ||
| 3575 | Capability: KVM_CAP_MCE | 3959 | :Capability: KVM_CAP_MCE |
| 3576 | Architectures: x86 | 3960 | :Architectures: x86 |
| 3577 | Type: system ioctl | 3961 | :Type: system ioctl |
| 3578 | Parameters: u64 mce_cap (out) | 3962 | :Parameters: u64 mce_cap (out) |
| 3579 | Returns: 0 on success, -1 on error | 3963 | :Returns: 0 on success, -1 on error |
| 3580 | 3964 | ||
| 3581 | Returns supported MCE capabilities. The u64 mce_cap parameter | 3965 | Returns supported MCE capabilities. The u64 mce_cap parameter |
| 3582 | has the same format as the MSR_IA32_MCG_CAP register. Supported | 3966 | has the same format as the MSR_IA32_MCG_CAP register. Supported |
| 3583 | capabilities will have the corresponding bits set. | 3967 | capabilities will have the corresponding bits set. |
| 3584 | 3968 | ||
| 3585 | 4.105 KVM_X86_SETUP_MCE | 3969 | 4.105 KVM_X86_SETUP_MCE |
| 3970 | ----------------------- | ||
| 3586 | 3971 | ||
| 3587 | Capability: KVM_CAP_MCE | 3972 | :Capability: KVM_CAP_MCE |
| 3588 | Architectures: x86 | 3973 | :Architectures: x86 |
| 3589 | Type: vcpu ioctl | 3974 | :Type: vcpu ioctl |
| 3590 | Parameters: u64 mcg_cap (in) | 3975 | :Parameters: u64 mcg_cap (in) |
| 3591 | Returns: 0 on success, | 3976 | :Returns: 0 on success, |
| 3592 | -EFAULT if u64 mcg_cap cannot be read, | 3977 | -EFAULT if u64 mcg_cap cannot be read, |
| 3593 | -EINVAL if the requested number of banks is invalid, | 3978 | -EINVAL if the requested number of banks is invalid, |
| 3594 | -EINVAL if requested MCE capability is not supported. | 3979 | -EINVAL if requested MCE capability is not supported. |
| @@ -3601,20 +3986,21 @@ checking for KVM_CAP_MCE. The supported capabilities can be · 6 unmodified lines | |||
| 3601 | retrieved with KVM_X86_GET_MCE_CAP_SUPPORTED. | 3986 | retrieved with KVM_X86_GET_MCE_CAP_SUPPORTED. |
| 3602 | 3987 | ||
| 3603 | 4.106 KVM_X86_SET_MCE | 3988 | 4.106 KVM_X86_SET_MCE |
| 3989 | --------------------- | ||
| 3604 | 3990 | ||
| 3605 | Capability: KVM_CAP_MCE | 3991 | :Capability: KVM_CAP_MCE |
| 3606 | Architectures: x86 | 3992 | :Architectures: x86 |
| 3607 | Type: vcpu ioctl | 3993 | :Type: vcpu ioctl |
| 3608 | Parameters: struct kvm_x86_mce (in) | 3994 | :Parameters: struct kvm_x86_mce (in) |
| 3609 | Returns: 0 on success, | 3995 | :Returns: 0 on success, |
| 3610 | -EFAULT if struct kvm_x86_mce cannot be read, | 3996 | -EFAULT if struct kvm_x86_mce cannot be read, |
| 3611 | -EINVAL if the bank number is invalid, | 3997 | -EINVAL if the bank number is invalid, |
| 3612 | -EINVAL if VAL bit is not set in status field. | 3998 | -EINVAL if VAL bit is not set in status field. |
| 3613 | 3999 | ||
| 3614 | Inject a machine check error (MCE) into the guest. The input | 4000 | Inject a machine check error (MCE) into the guest. The input |
| 3615 | parameter is: | 4001 | parameter is:: |
| 3616 | 4002 | ||
| 3617 | struct kvm_x86_mce { | 4003 | struct kvm_x86_mce { |
| 3618 | __u64 status; | 4004 | __u64 status; |
| 3619 | __u64 addr; | 4005 | __u64 addr; |
| 3620 | __u64 misc; | 4006 | __u64 misc; |
| @@ -3622,7 +4008,7 @@ struct kvm_x86_mce { · 1 unmodified line | |||
| 3622 | __u8 bank; | 4008 | __u8 bank; |
| 3623 | __u8 pad1[7]; | 4009 | __u8 pad1[7]; |
| 3624 | __u64 pad2[3]; | 4010 | __u64 pad2[3]; |
| 3625 | }; | 4011 | }; |
| 3626 | 4012 | ||
| 3627 | If the MCE being reported is an uncorrected error, KVM will | 4013 | If the MCE being reported is an uncorrected error, KVM will |
| 3628 | inject it as an MCE exception into the guest. If the guest | 4014 | inject it as an MCE exception into the guest. If the guest |
| @@ -3634,15 +4020,17 @@ store it in the corresponding bank (provided this bank is · 5 unmodified lines | |||
| 3634 | not holding a previously reported uncorrected error). | 4020 | not holding a previously reported uncorrected error). |
| 3635 | 4021 | ||
| 3636 | 4.107 KVM_S390_GET_CMMA_BITS | 4022 | 4.107 KVM_S390_GET_CMMA_BITS |
| 4023 | ---------------------------- | ||
| 3637 | 4024 | ||
| 3638 | Capability: KVM_CAP_S390_CMMA_MIGRATION | 4025 | :Capability: KVM_CAP_S390_CMMA_MIGRATION |
| 3639 | Architectures: s390 | 4026 | :Architectures: s390 |
| 3640 | Type: vm ioctl | 4027 | :Type: vm ioctl |
| 3641 | Parameters: struct kvm_s390_cmma_log (in, out) | 4028 | :Parameters: struct kvm_s390_cmma_log (in, out) |
| 3642 | Returns: 0 on success, a negative value on error | 4029 | :Returns: 0 on success, a negative value on error |
| 3643 | 4030 | ||
| 3644 | This ioctl is used to get the values of the CMMA bits on the s390 | 4031 | This ioctl is used to get the values of the CMMA bits on the s390 |
| 3645 | architecture. It is meant to be used in two scenarios: | 4032 | architecture. It is meant to be used in two scenarios: |
| 4033 | |||
| 3646 | - During live migration to save the CMMA values. Live migration needs | 4034 | - During live migration to save the CMMA values. Live migration needs |
| 3647 | to be enabled via the KVM_REQ_START_MIGRATION VM property. | 4035 | to be enabled via the KVM_REQ_START_MIGRATION VM property. |
| 3648 | - To non-destructively peek at the CMMA values, with the flag | 4036 | - To non-destructively peek at the CMMA values, with the flag |
| @@ -3652,9 +4040,12 @@ The ioctl takes parameters via the kvm_s390_cmma_log struct. The desired · 3 unmodified lines | |||
| 3652 | values are written to a buffer whose location is indicated via the "values" | 4040 | values are written to a buffer whose location is indicated via the "values" |
| 3653 | member in the kvm_s390_cmma_log struct. The values in the input struct are | 4041 | member in the kvm_s390_cmma_log struct. The values in the input struct are |
| 3654 | also updated as needed. | 4042 | also updated as needed. |
| 4043 | |||
| 3655 | Each CMMA value takes up one byte. | 4044 | Each CMMA value takes up one byte. |
| 3656 | 4045 | ||
| 3657 | struct kvm_s390_cmma_log { | 4046 | :: |
| 4047 | |||
| 4048 | struct kvm_s390_cmma_log { | ||
| 3658 | __u64 start_gfn; | 4049 | __u64 start_gfn; |
| 3659 | __u32 count; | 4050 | __u32 count; |
| 3660 | __u32 flags; | 4051 | __u32 flags; |
| @@ -3663,7 +4054,7 @@ struct kvm_s390_cmma_log { · 2 unmodified lines | |||
| 3663 | __u64 mask; | 4054 | __u64 mask; |
| 3664 | }; | 4055 | }; |
| 3665 | __u64 values; | 4056 | __u64 values; |
| 3666 | }; | 4057 | }; |
| 3667 | 4058 | ||
| 3668 | start_gfn is the number of the first guest frame whose CMMA values are | 4059 | start_gfn is the number of the first guest frame whose CMMA values are |
| 3669 | to be retrieved, | 4060 | to be retrieved, |
| @@ -3724,12 +4115,13 @@ KVM_S390_CMMA_PEEK is not set but migration mode was not enabled, with · 54 unmodified lines | |||
| 3724 | present for the addresses (e.g. when using hugepages). | 4115 | present for the addresses (e.g. when using hugepages). |
| 3725 | 4116 | ||
| 3726 | 4.108 KVM_S390_SET_CMMA_BITS | 4117 | 4.108 KVM_S390_SET_CMMA_BITS |
| 4118 | ---------------------------- | ||
| 3727 | 4119 | ||
| 3728 | Capability: KVM_CAP_S390_CMMA_MIGRATION | 4120 | :Capability: KVM_CAP_S390_CMMA_MIGRATION |
| 3729 | Architectures: s390 | 4121 | :Architectures: s390 |
| 3730 | Type: vm ioctl | 4122 | :Type: vm ioctl |
| 3731 | Parameters: struct kvm_s390_cmma_log (in) | 4123 | :Parameters: struct kvm_s390_cmma_log (in) |
| 3732 | Returns: 0 on success, a negative value on error | 4124 | :Returns: 0 on success, a negative value on error |
| 3733 | 4125 | ||
| 3734 | This ioctl is used to set the values of the CMMA bits on the s390 | 4126 | This ioctl is used to set the values of the CMMA bits on the s390 |
| 3735 | architecture. It is meant to be used during live migration to restore | 4127 | architecture. It is meant to be used during live migration to restore |
| @@ -3737,16 +4129,18 @@ the CMMA values, but there are no restrictions on its use. · 1 unmodified line | |||
| 3737 | The ioctl takes parameters via the kvm_s390_cmma_values struct. | 4129 | The ioctl takes parameters via the kvm_s390_cmma_values struct. |
| 3738 | Each CMMA value takes up one byte. | 4130 | Each CMMA value takes up one byte. |
| 3739 | 4131 | ||
| 3740 | struct kvm_s390_cmma_log { | 4132 | :: |
| 4133 | |||
| 4134 | struct kvm_s390_cmma_log { | ||
| 3741 | __u64 start_gfn; | 4135 | __u64 start_gfn; |
| 3742 | __u32 count; | 4136 | __u32 count; |
| 3743 | __u32 flags; | 4137 | __u32 flags; |
| 3744 | union { | 4138 | union { |
| 3745 | __u64 remaining; | 4139 | __u64 remaining; |
| 3746 | __u64 mask; | 4140 | __u64 mask; |
| 3747 | }; | 4141 | }; |
| 3748 | __u64 values; | 4142 | __u64 values; |
| 3749 | }; | 4143 | }; |
| 3750 | 4144 | ||
| 3751 | start_gfn indicates the starting guest frame number, | 4145 | start_gfn indicates the starting guest frame number, |
| 3752 | 4146 | ||
| @@ -3769,26 +4163,27 @@ or if no page table is present for the addresses (e.g. when using · 16 unmodified lines | |||
| 3769 | hugepages). | 4163 | hugepages). |
| 3770 | 4164 | ||
| 3771 | 4.109 KVM_PPC_GET_CPU_CHAR | 4165 | 4.109 KVM_PPC_GET_CPU_CHAR |
| 4166 | -------------------------- | ||
| 3772 | 4167 | ||
| 3773 | Capability: KVM_CAP_PPC_GET_CPU_CHAR | 4168 | :Capability: KVM_CAP_PPC_GET_CPU_CHAR |
| 3774 | Architectures: powerpc | 4169 | :Architectures: powerpc |
| 3775 | Type: vm ioctl | 4170 | :Type: vm ioctl |
| 3776 | Parameters: struct kvm_ppc_cpu_char (out) | 4171 | :Parameters: struct kvm_ppc_cpu_char (out) |
| 3777 | Returns: 0 on successful completion | 4172 | :Returns: 0 on successful completion, |
| 3778 | -EFAULT if struct kvm_ppc_cpu_char cannot be written | 4173 | -EFAULT if struct kvm_ppc_cpu_char cannot be written |
| 3779 | 4174 | ||
| 3780 | This ioctl gives userspace information about certain characteristics | 4175 | This ioctl gives userspace information about certain characteristics |
| 3781 | of the CPU relating to speculative execution of instructions and | 4176 | of the CPU relating to speculative execution of instructions and |
| 3782 | possible information leakage resulting from speculative execution (see | 4177 | possible information leakage resulting from speculative execution (see |
| 3783 | CVE-2017-5715, CVE-2017-5753 and CVE-2017-5754). The information is | 4178 | CVE-2017-5715, CVE-2017-5753 and CVE-2017-5754). The information is |
| 3784 | returned in struct kvm_ppc_cpu_char, which looks like this: | 4179 | returned in struct kvm_ppc_cpu_char, which looks like this:: |
| 3785 | 4180 | ||
| 3786 | struct kvm_ppc_cpu_char { | 4181 | struct kvm_ppc_cpu_char { |
| 3787 | __u64 character; /* characteristics of the CPU */ | 4182 | __u64 character; /* characteristics of the CPU */ |
| 3788 | __u64 behaviour; /* recommended software behaviour */ | 4183 | __u64 behaviour; /* recommended software behaviour */ |
| 3789 | __u64 character_mask; /* valid bits in character */ | 4184 | __u64 character_mask; /* valid bits in character */ |
| 3790 | __u64 behaviour_mask; /* valid bits in behaviour */ | 4185 | __u64 behaviour_mask; /* valid bits in behaviour */ |
| 3791 | }; | 4186 | }; |
| 3792 | 4187 | ||
| 3793 | For extensibility, the character_mask and behaviour_mask fields | 4188 | For extensibility, the character_mask and behaviour_mask fields |
| 3794 | indicate which bits of character and behaviour have been filled in by | 4189 | indicate which bits of character and behaviour have been filled in by |
| @@ -3815,12 +4210,13 @@ These fields use the same bit definitions as the new · 20 unmodified lines | |||
| 3815 | H_GET_CPU_CHARACTERISTICS hypercall. | 4210 | H_GET_CPU_CHARACTERISTICS hypercall. |
| 3816 | 4211 | ||
| 3817 | 4.110 KVM_MEMORY_ENCRYPT_OP | 4212 | 4.110 KVM_MEMORY_ENCRYPT_OP |
| 4213 | --------------------------- | ||
| 3818 | 4214 | ||
| 3819 | Capability: basic | 4215 | :Capability: basic |
| 3820 | Architectures: x86 | 4216 | :Architectures: x86 |
| 3821 | Type: system | 4217 | :Type: system |
| 3822 | Parameters: an opaque platform specific structure (in/out) | 4218 | :Parameters: an opaque platform specific structure (in/out) |
| 3823 | Returns: 0 on success; -1 on error | 4219 | :Returns: 0 on success; -1 on error |
| 3824 | 4220 | ||
| 3825 | If the platform supports creating encrypted VMs then this ioctl can be used | 4221 | If the platform supports creating encrypted VMs then this ioctl can be used |
| 3826 | for issuing platform-specific memory encryption commands to manage those | 4222 | for issuing platform-specific memory encryption commands to manage those |
| @@ -3831,12 +4227,13 @@ Currently, this ioctl is used for issuing Secure Encrypted Virtualization · 4 unmodified lines | |||
| 3831 | Documentation/virt/kvm/amd-memory-encryption.rst. | 4227 | Documentation/virt/kvm/amd-memory-encryption.rst. |
| 3832 | 4228 | ||
| 3833 | 4.111 KVM_MEMORY_ENCRYPT_REG_REGION | 4229 | 4.111 KVM_MEMORY_ENCRYPT_REG_REGION |
| 4230 | ----------------------------------- | ||
| 3834 | 4231 | ||
| 3835 | Capability: basic | 4232 | :Capability: basic |
| 3836 | Architectures: x86 | 4233 | :Architectures: x86 |
| 3837 | Type: system | 4234 | :Type: system |
| 3838 | Parameters: struct kvm_enc_region (in) | 4235 | :Parameters: struct kvm_enc_region (in) |
| 3839 | Returns: 0 on success; -1 on error | 4236 | :Returns: 0 on success; -1 on error |
| 3840 | 4237 | ||
| 3841 | This ioctl can be used to register a guest memory region which may | 4238 | This ioctl can be used to register a guest memory region which may |
| 3842 | contain encrypted data (e.g. guest RAM, SMRAM etc). | 4239 | contain encrypted data (e.g. guest RAM, SMRAM etc). |
| @@ -3854,60 +4251,71 @@ swap or migrate (move) ciphertext pages. Hence, for now we pin the guest · 11 unmodified lines | |||
| 3854 | memory region registered with the ioctl. | 4251 | memory region registered with the ioctl. |
| 3855 | 4252 | ||
| 3856 | 4.112 KVM_MEMORY_ENCRYPT_UNREG_REGION | 4253 | 4.112 KVM_MEMORY_ENCRYPT_UNREG_REGION |
| 4254 | ------------------------------------- | ||
| 3857 | 4255 | ||
| 3858 | Capability: basic | 4256 | :Capability: basic |
| 3859 | Architectures: x86 | 4257 | :Architectures: x86 |
| 3860 | Type: system | 4258 | :Type: system |
| 3861 | Parameters: struct kvm_enc_region (in) | 4259 | :Parameters: struct kvm_enc_region (in) |
| 3862 | Returns: 0 on success; -1 on error | 4260 | :Returns: 0 on success; -1 on error |
| 3863 | 4261 | ||
| 3864 | This ioctl can be used to unregister the guest memory region registered | 4262 | This ioctl can be used to unregister the guest memory region registered |
| 3865 | with KVM_MEMORY_ENCRYPT_REG_REGION ioctl above. | 4263 | with KVM_MEMORY_ENCRYPT_REG_REGION ioctl above. |
| 3866 | 4264 | ||
| 3867 | 4.113 KVM_HYPERV_EVENTFD | 4265 | 4.113 KVM_HYPERV_EVENTFD |
| 4266 | ------------------------ | ||
| 3868 | 4267 | ||
| 3869 | Capability: KVM_CAP_HYPERV_EVENTFD | 4268 | :Capability: KVM_CAP_HYPERV_EVENTFD |
| 3870 | Architectures: x86 | 4269 | :Architectures: x86 |
| 3871 | Type: vm ioctl | 4270 | :Type: vm ioctl |
| 3872 | Parameters: struct kvm_hyperv_eventfd (in) | 4271 | :Parameters: struct kvm_hyperv_eventfd (in) |
| 3873 | 4272 | ||
| 3874 | This ioctl (un)registers an eventfd to receive notifications from the guest on | 4273 | This ioctl (un)registers an eventfd to receive notifications from the guest on |
| 3875 | the specified Hyper-V connection id through the SIGNAL_EVENT hypercall, without | 4274 | the specified Hyper-V connection id through the SIGNAL_EVENT hypercall, without |
| 3876 | causing a user exit. SIGNAL_EVENT hypercall with non-zero event flag number | 4275 | causing a user exit. SIGNAL_EVENT hypercall with non-zero event flag number |
| 3877 | (bits 24-31) still triggers a KVM_EXIT_HYPERV_HCALL user exit. | 4276 | (bits 24-31) still triggers a KVM_EXIT_HYPERV_HCALL user exit. |
| 3878 | 4277 | ||
| 3879 | struct kvm_hyperv_eventfd { | 4278 | :: |
| 4279 | |||
| 4280 | struct kvm_hyperv_eventfd { | ||
| 3880 | __u32 conn_id; | 4281 | __u32 conn_id; |
| 3881 | __s32 fd; | 4282 | __s32 fd; |
| 3882 | __u32 flags; | 4283 | __u32 flags; |
| 3883 | __u32 padding[3]; | 4284 | __u32 padding[3]; |
| 3884 | }; | 4285 | }; |
| 3885 | 4286 | ||
| 3886 | The conn_id field should fit within 24 bits: | 4287 | The conn_id field should fit within 24 bits:: |
| 3887 | 4288 | ||
| 3888 | #define KVM_HYPERV_CONN_ID_MASK 0x00ffffff | 4289 | #define KVM_HYPERV_CONN_ID_MASK 0x00ffffff |
| 3889 | 4290 | ||
| 3890 | The acceptable values for the flags field are: | 4291 | The acceptable values for the flags field are:: |
| 3891 | 4292 | ||
| 3892 | #define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0) | 4293 | #define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0) |
| 3893 | 4294 | ||
| 3894 | Returns: 0 on success, | 4295 | :Returns: 0 on success, |
| 3895 | -EINVAL if conn_id or flags is outside the allowed range | 4296 | -EINVAL if conn_id or flags is outside the allowed range, |
| 3896 | -ENOENT on deassign if the conn_id isn't registered | 4297 | -ENOENT on deassign if the conn_id isn't registered, |
| 3897 | -EEXIST on assign if the conn_id is already registered | 4298 | -EEXIST on assign if the conn_id is already registered |
| 3898 | 4299 | ||
| 3899 | 4.114 KVM_GET_NESTED_STATE | 4300 | 4.114 KVM_GET_NESTED_STATE |
| 4301 | -------------------------- | ||
| 4302 | |||
| 4303 | :Capability: KVM_CAP_NESTED_STATE | ||
| 4304 | :Architectures: x86 | ||
| 4305 | :Type: vcpu ioctl | ||
| 4306 | :Parameters: struct kvm_nested_state (in/out) | ||
| 4307 | :Returns: 0 on success, -1 on error | ||
| 3900 | 4308 | ||
| 3901 | Capability: KVM_CAP_NESTED_STATE | ||
| 3902 | Architectures: x86 | ||
| 3903 | Type: vcpu ioctl | ||
| 3904 | Parameters: struct kvm_nested_state (in/out) | ||
| 3905 | Returns: 0 on success, -1 on error | ||
| 3906 | Errors: | 4309 | Errors: |
| 3907 | E2BIG: the total state size exceeds the value of 'size' specified by | 4310 | |
| 4311 | ===== ============================================================= | ||
| 4312 | E2BIG the total state size exceeds the value of 'size' specified by | ||
| 3908 | the user; the size required will be written into size. | 4313 | the user; the size required will be written into size. |
| 4314 | ===== ============================================================= | ||
| 4315 | |||
| 4316 | :: | ||
| 3909 | 4317 | ||
| 3910 | struct kvm_nested_state { | 4318 | struct kvm_nested_state { |
| 3911 | __u16 flags; | 4319 | __u16 flags; |
| 3912 | __u16 format; | 4320 | __u16 format; |
| 3913 | __u32 size; | 4321 | __u32 size; |
| @@ -3924,33 +4332,33 @@ struct kvm_nested_state { · 10 unmodified lines | |||
| 3924 | struct kvm_vmx_nested_state_data vmx[0]; | 4332 | struct kvm_vmx_nested_state_data vmx[0]; |
| 3925 | struct kvm_svm_nested_state_data svm[0]; | 4333 | struct kvm_svm_nested_state_data svm[0]; |
| 3926 | } data; | 4334 | } data; |
| 3927 | }; | 4335 | }; |
| 3928 | 4336 | ||
| 3929 | #define KVM_STATE_NESTED_GUEST_MODE 0x00000001 | 4337 | #define KVM_STATE_NESTED_GUEST_MODE 0x00000001 |
| 3930 | #define KVM_STATE_NESTED_RUN_PENDING 0x00000002 | 4338 | #define KVM_STATE_NESTED_RUN_PENDING 0x00000002 |
| 3931 | #define KVM_STATE_NESTED_EVMCS 0x00000004 | 4339 | #define KVM_STATE_NESTED_EVMCS 0x00000004 |
| 3932 | 4340 | ||
| 3933 | #define KVM_STATE_NESTED_FORMAT_VMX 0 | 4341 | #define KVM_STATE_NESTED_FORMAT_VMX 0 |
| 3934 | #define KVM_STATE_NESTED_FORMAT_SVM 1 | 4342 | #define KVM_STATE_NESTED_FORMAT_SVM 1 |
| 3935 | 4343 | ||
| 3936 | #define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000 | 4344 | #define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000 |
| 3937 | 4345 | ||
| 3938 | #define KVM_STATE_NESTED_VMX_SMM_GUEST_MODE 0x00000001 | 4346 | #define KVM_STATE_NESTED_VMX_SMM_GUEST_MODE 0x00000001 |
| 3939 | #define KVM_STATE_NESTED_VMX_SMM_VMXON 0x00000002 | 4347 | #define KVM_STATE_NESTED_VMX_SMM_VMXON 0x00000002 |
| 3940 | 4348 | ||
| 3941 | struct kvm_vmx_nested_state_hdr { | 4349 | struct kvm_vmx_nested_state_hdr { |
| 3942 | __u64 vmxon_pa; | 4350 | __u64 vmxon_pa; |
| 3943 | __u64 vmcs12_pa; | 4351 | __u64 vmcs12_pa; |
| 3944 | 4352 | ||
| 3945 | struct { | 4353 | struct { |
| 3946 | __u16 flags; | 4354 | __u16 flags; |
| 3947 | } smm; | 4355 | } smm; |
| 3948 | }; | 4356 | }; |
| 3949 | 4357 | ||
| 3950 | struct kvm_vmx_nested_state_data { | 4358 | struct kvm_vmx_nested_state_data { |
| 3951 | __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; | 4359 | __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; |
| 3952 | __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; | 4360 | __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE]; |
| 3953 | }; | 4361 | }; |
| 3954 | 4362 | ||
| 3955 | This ioctl copies the vcpu's nested virtualization state from the kernel to | 4363 | This ioctl copies the vcpu's nested virtualization state from the kernel to |
| 3956 | userspace. | 4364 | userspace. |
| @@ -3959,24 +4367,26 @@ The maximum size of the state can be retrieved by passing KVM_CAP_NESTED_STATE · 2 unmodified lines | |||
| 3959 | to the KVM_CHECK_EXTENSION ioctl(). | 4367 | to the KVM_CHECK_EXTENSION ioctl(). |
| 3960 | 4368 | ||
| 3961 | 4.115 KVM_SET_NESTED_STATE | 4369 | 4.115 KVM_SET_NESTED_STATE |
| 4370 | -------------------------- | ||
| 3962 | 4371 | ||
| 3963 | Capability: KVM_CAP_NESTED_STATE | 4372 | :Capability: KVM_CAP_NESTED_STATE |
| 3964 | Architectures: x86 | 4373 | :Architectures: x86 |
| 3965 | Type: vcpu ioctl | 4374 | :Type: vcpu ioctl |
| 3966 | Parameters: struct kvm_nested_state (in) | 4375 | :Parameters: struct kvm_nested_state (in) |
| 3967 | Returns: 0 on success, -1 on error | 4376 | :Returns: 0 on success, -1 on error |
| 3968 | 4377 | ||
| 3969 | This copies the vcpu's kvm_nested_state struct from userspace to the kernel. | 4378 | This copies the vcpu's kvm_nested_state struct from userspace to the kernel. |
| 3970 | For the definition of struct kvm_nested_state, see KVM_GET_NESTED_STATE. | 4379 | For the definition of struct kvm_nested_state, see KVM_GET_NESTED_STATE. |
| 3971 | 4380 | ||
| 3972 | 4.116 KVM_(UN)REGISTER_COALESCED_MMIO | 4381 | 4.116 KVM_(UN)REGISTER_COALESCED_MMIO |
| 4382 | ------------------------------------- | ||
| 3973 | 4383 | ||
| 3974 | Capability: KVM_CAP_COALESCED_MMIO (for coalesced mmio) | 4384 | :Capability: KVM_CAP_COALESCED_MMIO (for coalesced mmio) |
| 3975 | KVM_CAP_COALESCED_PIO (for coalesced pio) | 4385 | KVM_CAP_COALESCED_PIO (for coalesced pio) |
| 3976 | Architectures: all | 4386 | :Architectures: all |
| 3977 | Type: vm ioctl | 4387 | :Type: vm ioctl |
| 3978 | Parameters: struct kvm_coalesced_mmio_zone | 4388 | :Parameters: struct kvm_coalesced_mmio_zone |
| 3979 | Returns: 0 on success, < 0 on error | 4389 | :Returns: 0 on success, < 0 on error |
| 3980 | 4390 | ||
| 3981 | Coalesced I/O is a performance optimization that defers hardware | 4391 | Coalesced I/O is a performance optimization that defers hardware |
| 3982 | register write emulation so that userspace exits are avoided. It is | 4392 | register write emulation so that userspace exits are avoided. It is |
| @@ -3998,15 +4408,18 @@ between coalesced mmio and pio except that coalesced pio records accesses · 15 unmodified lines | |||
| 3998 | to I/O ports. | 4408 | to I/O ports. |
| 3999 | 4409 | ||
| 4000 | 4.117 KVM_CLEAR_DIRTY_LOG (vm ioctl) | 4410 | 4.117 KVM_CLEAR_DIRTY_LOG (vm ioctl) |
| 4411 | ------------------------------------ | ||
| 4001 | 4412 | ||
| 4002 | Capability: KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 | 4413 | :Capability: KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 |
| 4003 | Architectures: x86, arm, arm64, mips | 4414 | :Architectures: x86, arm, arm64, mips |
| 4004 | Type: vm ioctl | 4415 | :Type: vm ioctl |
| 4005 | Parameters: struct kvm_dirty_log (in) | 4416 | :Parameters: struct kvm_dirty_log (in) |
| 4006 | Returns: 0 on success, -1 on error | 4417 | :Returns: 0 on success, -1 on error |
| 4007 | 4418 | ||
| 4008 | /* for KVM_CLEAR_DIRTY_LOG */ | 4419 | :: |
| 4009 | struct kvm_clear_dirty_log { | 4420 | |
| 4421 | /* for KVM_CLEAR_DIRTY_LOG */ | ||
| 4422 | struct kvm_clear_dirty_log { | ||
| 4010 | __u32 slot; | 4423 | __u32 slot; |
| 4011 | __u32 num_pages; | 4424 | __u32 num_pages; |
| 4012 | __u64 first_page; | 4425 | __u64 first_page; |
| @@ -4014,7 +4427,7 @@ struct kvm_clear_dirty_log { · 1 unmodified line | |||
| 4014 | void __user *dirty_bitmap; /* one bit per page */ | 4427 | void __user *dirty_bitmap; /* one bit per page */ |
| 4015 | __u64 padding; | 4428 | __u64 padding; |
| 4016 | }; | 4429 | }; |
| 4017 | }; | 4430 | }; |
| 4018 | 4431 | ||
| 4019 | The ioctl clears the dirty status of pages in a memory slot, according to | 4432 | The ioctl clears the dirty status of pages in a memory slot, according to |
| 4020 | the bitmap that is passed in struct kvm_clear_dirty_log's dirty_bitmap | 4433 | the bitmap that is passed in struct kvm_clear_dirty_log's dirty_bitmap |
| @@ -4038,20 +4451,23 @@ However, it can always be used as long as KVM_CHECK_EXTENSION confirms · 17 unmodified lines | |||
| 4038 | that KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is present. | 4451 | that KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is present. |
| 4039 | 4452 | ||
| 4040 | 4.118 KVM_GET_SUPPORTED_HV_CPUID | 4453 | 4.118 KVM_GET_SUPPORTED_HV_CPUID |
| 4454 | -------------------------------- | ||
| 4455 | |||
| 4456 | :Capability: KVM_CAP_HYPERV_CPUID | ||
| 4457 | :Architectures: x86 | ||
| 4458 | :Type: vcpu ioctl | ||
| 4459 | :Parameters: struct kvm_cpuid2 (in/out) | ||
| 4460 | :Returns: 0 on success, -1 on error | ||
| 4041 | 4461 | ||
| 4042 | Capability: KVM_CAP_HYPERV_CPUID | 4462 | :: |
| 4043 | Architectures: x86 | ||
| 4044 | Type: vcpu ioctl | ||
| 4045 | Parameters: struct kvm_cpuid2 (in/out) | ||
| 4046 | Returns: 0 on success, -1 on error | ||
| 4047 | 4463 | ||
| 4048 | struct kvm_cpuid2 { | 4464 | struct kvm_cpuid2 { |
| 4049 | __u32 nent; | 4465 | __u32 nent; |
| 4050 | __u32 padding; | 4466 | __u32 padding; |
| 4051 | struct kvm_cpuid_entry2 entries[0]; | 4467 | struct kvm_cpuid_entry2 entries[0]; |
| 4052 | }; | 4468 | }; |
| 4053 | 4469 | ||
| 4054 | struct kvm_cpuid_entry2 { | 4470 | struct kvm_cpuid_entry2 { |
| 4055 | __u32 function; | 4471 | __u32 function; |
| 4056 | __u32 index; | 4472 | __u32 index; |
| 4057 | __u32 flags; | 4473 | __u32 flags; |
| @@ -4060,7 +4476,7 @@ struct kvm_cpuid_entry2 { · 2 unmodified lines | |||
| 4060 | __u32 ecx; | 4476 | __u32 ecx; |
| 4061 | __u32 edx; | 4477 | __u32 edx; |
| 4062 | __u32 padding[3]; | 4478 | __u32 padding[3]; |
| 4063 | }; | 4479 | }; |
| 4064 | 4480 | ||
| 4065 | This ioctl returns x86 cpuid features leaves related to Hyper-V emulation in | 4481 | This ioctl returns x86 cpuid features leaves related to Hyper-V emulation in |
| 4066 | KVM. Userspace can use the information returned by this ioctl to construct | 4482 | KVM. Userspace can use the information returned by this ioctl to construct |
| @@ -4073,13 +4489,13 @@ KVM_GET_SUPPORTED_CPUID ioctl because some of them intersect with KVM feature · 6 unmodified lines | |||
| 4073 | leaves (0x40000000, 0x40000001). | 4489 | leaves (0x40000000, 0x40000001). |
| 4074 | 4490 | ||
| 4075 | Currently, the following list of CPUID leaves are returned: | 4491 | Currently, the following list of CPUID leaves are returned: |
| 4076 | HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS | 4492 | - HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS |
| 4077 | HYPERV_CPUID_INTERFACE | 4493 | - HYPERV_CPUID_INTERFACE |
| 4078 | HYPERV_CPUID_VERSION | 4494 | - HYPERV_CPUID_VERSION |
| 4079 | HYPERV_CPUID_FEATURES | 4495 | - HYPERV_CPUID_FEATURES |
| 4080 | HYPERV_CPUID_ENLIGHTMENT_INFO | 4496 | - HYPERV_CPUID_ENLIGHTMENT_INFO |
| 4081 | HYPERV_CPUID_IMPLEMENT_LIMITS | 4497 | - HYPERV_CPUID_IMPLEMENT_LIMITS |
| 4082 | HYPERV_CPUID_NESTED_FEATURES | 4498 | - HYPERV_CPUID_NESTED_FEATURES |
| 4083 | 4499 | ||
| 4084 | HYPERV_CPUID_NESTED_FEATURES leaf is only exposed when Enlightened VMCS was | 4500 | HYPERV_CPUID_NESTED_FEATURES leaf is only exposed when Enlightened VMCS was |
| 4085 | enabled on the corresponding vCPU (KVM_CAP_HYPERV_ENLIGHTENED_VMCS). | 4501 | enabled on the corresponding vCPU (KVM_CAP_HYPERV_ENLIGHTENED_VMCS). |
| @@ -4095,17 +4511,25 @@ number of valid entries in the 'entries' array, which is then filled. · 9 unmodified lines | |||
| 4095 | userspace should not expect to get any particular value there. | 4511 | userspace should not expect to get any particular value there. |
| 4096 | 4512 | ||
| 4097 | 4.119 KVM_ARM_VCPU_FINALIZE | 4513 | 4.119 KVM_ARM_VCPU_FINALIZE |
| 4514 | --------------------------- | ||
| 4515 | |||
| 4516 | :Architectures: arm, arm64 | ||
| 4517 | :Type: vcpu ioctl | ||
| 4518 | :Parameters: int feature (in) | ||
| 4519 | :Returns: 0 on success, -1 on error | ||
| 4098 | 4520 | ||
| 4099 | Architectures: arm, arm64 | ||
| 4100 | Type: vcpu ioctl | ||
| 4101 | Parameters: int feature (in) | ||
| 4102 | Returns: 0 on success, -1 on error | ||
| 4103 | Errors: | 4521 | Errors: |
| 4104 | EPERM: feature not enabled, needs configuration, or already finalized | 4522 | |
| 4105 | EINVAL: feature unknown or not present | 4523 | ====== ============================================================== |
| 4524 | EPERM feature not enabled, needs configuration, or already finalized | ||
| 4525 | EINVAL feature unknown or not present | ||
| 4526 | ====== ============================================================== | ||
| 4106 | 4527 | ||
| 4107 | Recognised values for feature: | 4528 | Recognised values for feature: |
| 4529 | |||
| 4530 | ===== =========================================== | ||
| 4108 | arm64 KVM_ARM_VCPU_SVE (requires KVM_CAP_ARM_SVE) | 4531 | arm64 KVM_ARM_VCPU_SVE (requires KVM_CAP_ARM_SVE) |
| 4532 | ===== =========================================== | ||
| 4109 | 4533 | ||
| 4110 | Finalizes the configuration of the specified vcpu feature. | 4534 | Finalizes the configuration of the specified vcpu feature. |
| 4111 | 4535 | ||
| @@ -4129,21 +4553,24 @@ See KVM_ARM_VCPU_INIT for details of vcpu features that require finalization · 17 unmodified lines | |||
| 4129 | using this ioctl. | 4553 | using this ioctl. |
| 4130 | 4554 | ||
| 4131 | 4.120 KVM_SET_PMU_EVENT_FILTER | 4555 | 4.120 KVM_SET_PMU_EVENT_FILTER |
| 4556 | ------------------------------ | ||
| 4132 | 4557 | ||
| 4133 | Capability: KVM_CAP_PMU_EVENT_FILTER | 4558 | :Capability: KVM_CAP_PMU_EVENT_FILTER |
| 4134 | Architectures: x86 | 4559 | :Architectures: x86 |
| 4135 | Type: vm ioctl | 4560 | :Type: vm ioctl |
| 4136 | Parameters: struct kvm_pmu_event_filter (in) | 4561 | :Parameters: struct kvm_pmu_event_filter (in) |
| 4137 | Returns: 0 on success, -1 on error | 4562 | :Returns: 0 on success, -1 on error |
| 4138 | 4563 | ||
| 4139 | struct kvm_pmu_event_filter { | 4564 | :: |
| 4565 | |||
| 4566 | struct kvm_pmu_event_filter { | ||
| 4140 | __u32 action; | 4567 | __u32 action; |
| 4141 | __u32 nevents; | 4568 | __u32 nevents; |
| 4142 | __u32 fixed_counter_bitmap; | 4569 | __u32 fixed_counter_bitmap; |
| 4143 | __u32 flags; | 4570 | __u32 flags; |
| 4144 | __u32 pad[4]; | 4571 | __u32 pad[4]; |
| 4145 | __u64 events[0]; | 4572 | __u64 events[0]; |
| 4146 | }; | 4573 | }; |
| 4147 | 4574 | ||
| 4148 | This ioctl restricts the set of PMU events that the guest can program. | 4575 | This ioctl restricts the set of PMU events that the guest can program. |
| 4149 | The argument holds a list of events which will be allowed or denied. | 4576 | The argument holds a list of events which will be allowed or denied. |
| @@ -4154,20 +4581,26 @@ counters are controlled by the fixed_counter_bitmap. · 4 unmodified lines | |||
| 4154 | 4581 | ||
| 4155 | No flags are defined yet, the field must be zero. | 4582 | No flags are defined yet, the field must be zero. |
| 4156 | 4583 | ||
| 4157 | Valid values for 'action': | 4584 | Valid values for 'action':: |
| 4158 | #define KVM_PMU_EVENT_ALLOW 0 | 4585 | |
| 4159 | #define KVM_PMU_EVENT_DENY 1 | 4586 | #define KVM_PMU_EVENT_ALLOW 0 |
| 4587 | #define KVM_PMU_EVENT_DENY 1 | ||
| 4160 | 4588 | ||
| 4161 | 4.121 KVM_PPC_SVM_OFF | 4589 | 4.121 KVM_PPC_SVM_OFF |
| 4590 | --------------------- | ||
| 4591 | |||
| 4592 | :Capability: basic | ||
| 4593 | :Architectures: powerpc | ||
| 4594 | :Type: vm ioctl | ||
| 4595 | :Parameters: none | ||
| 4596 | :Returns: 0 on successful completion, | ||
| 4162 | 4597 | ||
| 4163 | Capability: basic | ||
| 4164 | Architectures: powerpc | ||
| 4165 | Type: vm ioctl | ||
| 4166 | Parameters: none | ||
| 4167 | Returns: 0 on successful completion, | ||
| 4168 | Errors: | 4598 | Errors: |
| 4169 | EINVAL: if ultravisor failed to terminate the secure guest | 4599 | |
| 4170 | ENOMEM: if hypervisor failed to allocate new radix page tables for guest | 4600 | ====== ================================================================ |
| 4601 | EINVAL if ultravisor failed to terminate the secure guest | ||
| 4602 | ENOMEM if hypervisor failed to allocate new radix page tables for guest | ||
| 4603 | ====== ================================================================ | ||
| 4171 | 4604 | ||
| 4172 | This ioctl is used to turn off the secure mode of the guest or transition | 4605 | This ioctl is used to turn off the secure mode of the guest or transition |
| 4173 | the guest from secure mode to normal mode. This is invoked when the guest | 4606 | the guest from secure mode to normal mode. This is invoked when the guest |
| @@ -4178,35 +4611,38 @@ unpins the VPA pages and releases all the device pages that are used to · 4 unmodified lines | |||
| 4178 | track the secure pages by hypervisor. | 4611 | track the secure pages by hypervisor. |
| 4179 | 4612 | ||
| 4180 | 4.122 KVM_S390_NORMAL_RESET | 4613 | 4.122 KVM_S390_NORMAL_RESET |
| 4614 | --------------------------- | ||
| 4181 | 4615 | ||
| 4182 | Capability: KVM_CAP_S390_VCPU_RESETS | 4616 | :Capability: KVM_CAP_S390_VCPU_RESETS |
| 4183 | Architectures: s390 | 4617 | :Architectures: s390 |
| 4184 | Type: vcpu ioctl | 4618 | :Type: vcpu ioctl |
| 4185 | Parameters: none | 4619 | :Parameters: none |
| 4186 | Returns: 0 | 4620 | :Returns: 0 |
| 4187 | 4621 | ||
| 4188 | This ioctl resets VCPU registers and control structures according to | 4622 | This ioctl resets VCPU registers and control structures according to |
| 4189 | the cpu reset definition in the POP (Principles Of Operation). | 4623 | the cpu reset definition in the POP (Principles Of Operation). |
| 4190 | 4624 | ||
| 4191 | 4.123 KVM_S390_INITIAL_RESET | 4625 | 4.123 KVM_S390_INITIAL_RESET |
| 4626 | ---------------------------- | ||
| 4192 | 4627 | ||
| 4193 | Capability: none | 4628 | :Capability: none |
| 4194 | Architectures: s390 | 4629 | :Architectures: s390 |
| 4195 | Type: vcpu ioctl | 4630 | :Type: vcpu ioctl |
| 4196 | Parameters: none | 4631 | :Parameters: none |
| 4197 | Returns: 0 | 4632 | :Returns: 0 |
| 4198 | 4633 | ||
| 4199 | This ioctl resets VCPU registers and control structures according to | 4634 | This ioctl resets VCPU registers and control structures according to |
| 4200 | the initial cpu reset definition in the POP. However, the cpu is not | 4635 | the initial cpu reset definition in the POP. However, the cpu is not |
| 4201 | put into ESA mode. This reset is a superset of the normal reset. | 4636 | put into ESA mode. This reset is a superset of the normal reset. |
| 4202 | 4637 | ||
| 4203 | 4.124 KVM_S390_CLEAR_RESET | 4638 | 4.124 KVM_S390_CLEAR_RESET |
| 4639 | -------------------------- | ||
| 4204 | 4640 | ||
| 4205 | Capability: KVM_CAP_S390_VCPU_RESETS | 4641 | :Capability: KVM_CAP_S390_VCPU_RESETS |
| 4206 | Architectures: s390 | 4642 | :Architectures: s390 |
| 4207 | Type: vcpu ioctl | 4643 | :Type: vcpu ioctl |
| 4208 | Parameters: none | 4644 | :Parameters: none |
| 4209 | Returns: 0 | 4645 | :Returns: 0 |
| 4210 | 4646 | ||
| 4211 | This ioctl resets VCPU registers and control structures according to | 4647 | This ioctl resets VCPU registers and control structures according to |
| 4212 | the clear cpu reset definition in the POP. However, the cpu is not put | 4648 | the clear cpu reset definition in the POP. However, the cpu is not put |
| @@ -4214,7 +4650,7 @@ into ESA mode. This reset is a superset of the initial reset. · 1 unmodified line | |||
| 4214 | 4650 | ||
| 4215 | 4651 | ||
| 4216 | 5. The kvm_run structure | 4652 | 5. The kvm_run structure |
| 4217 | ------------------------ | 4653 | ======================== |
| 4218 | 4654 | ||
| 4219 | Application code obtains a pointer to the kvm_run structure by | 4655 | Application code obtains a pointer to the kvm_run structure by |
| 4220 | mmap()ing a vcpu fd. From that point, application code can control | 4656 | mmap()ing a vcpu fd. From that point, application code can control |
| @@ -4222,13 +4658,17 @@ execution by changing fields in kvm_run prior to calling the KVM_RUN · 1 unmodified line | |||
| 4222 | ioctl, and obtain information about the reason KVM_RUN returned by | 4658 | ioctl, and obtain information about the reason KVM_RUN returned by |
| 4223 | looking up structure members. | 4659 | looking up structure members. |
| 4224 | 4660 | ||
| 4225 | struct kvm_run { | 4661 | :: |
| 4662 | |||
| 4663 | struct kvm_run { | ||
| 4226 | /* in */ | 4664 | /* in */ |
| 4227 | __u8 request_interrupt_window; | 4665 | __u8 request_interrupt_window; |
| 4228 | 4666 | ||
| 4229 | Request that KVM_RUN return when it becomes possible to inject external | 4667 | Request that KVM_RUN return when it becomes possible to inject external |
| 4230 | interrupts into the guest. Useful in conjunction with KVM_INTERRUPT. | 4668 | interrupts into the guest. Useful in conjunction with KVM_INTERRUPT. |
| 4231 | 4669 | ||
| 4670 | :: | ||
| 4671 | |||
| 4232 | __u8 immediate_exit; | 4672 | __u8 immediate_exit; |
| 4233 | 4673 | ||
| 4234 | This field is polled once when KVM_RUN starts; if non-zero, KVM_RUN | 4674 | This field is polled once when KVM_RUN starts; if non-zero, KVM_RUN |
| @@ -4240,6 +4680,8 @@ a signal handler that sets run->immediate_exit to a non-zero value. · 5 unmodified lines | |||
| 4240 | 4680 | ||
| 4241 | This field is ignored if KVM_CAP_IMMEDIATE_EXIT is not available. | 4681 | This field is ignored if KVM_CAP_IMMEDIATE_EXIT is not available. |
| 4242 | 4682 | ||
| 4683 | :: | ||
| 4684 | |||
| 4243 | __u8 padding1[6]; | 4685 | __u8 padding1[6]; |
| 4244 | 4686 | ||
| 4245 | /* out */ | 4687 | /* out */ |
| @@ -4249,16 +4691,22 @@ When KVM_RUN has returned successfully (return value 0), this informs · 3 unmodified lines | |||
| 4249 | application code why KVM_RUN has returned. Allowable values for this | 4691 | application code why KVM_RUN has returned. Allowable values for this |
| 4250 | field are detailed below. | 4692 | field are detailed below. |
| 4251 | 4693 | ||
| 4694 | :: | ||
| 4695 | |||
| 4252 | __u8 ready_for_interrupt_injection; | 4696 | __u8 ready_for_interrupt_injection; |
| 4253 | 4697 | ||
| 4254 | If request_interrupt_window has been specified, this field indicates | 4698 | If request_interrupt_window has been specified, this field indicates |
| 4255 | an interrupt can be injected now with KVM_INTERRUPT. | 4699 | an interrupt can be injected now with KVM_INTERRUPT. |
| 4256 | 4700 | ||
| 4701 | :: | ||
| 4702 | |||
| 4257 | __u8 if_flag; | 4703 | __u8 if_flag; |
| 4258 | 4704 | ||
| 4259 | The value of the current interrupt flag. Only valid if in-kernel | 4705 | The value of the current interrupt flag. Only valid if in-kernel |
| 4260 | local APIC is not used. | 4706 | local APIC is not used. |
| 4261 | 4707 | ||
| 4708 | :: | ||
| 4709 | |||
| 4262 | __u16 flags; | 4710 | __u16 flags; |
| 4263 | 4711 | ||
| 4264 | More architecture-specific flags detailing state of the VCPU that may | 4712 | More architecture-specific flags detailing state of the VCPU that may |
| @@ -4266,17 +4714,23 @@ affect the device's behavior. The only currently defined flag is · 1 unmodified line | |||
| 4266 | KVM_RUN_X86_SMM, which is valid on x86 machines and is set if the | 4714 | KVM_RUN_X86_SMM, which is valid on x86 machines and is set if the |
| 4267 | VCPU is in system management mode. | 4715 | VCPU is in system management mode. |
| 4268 | 4716 | ||
| 4717 | :: | ||
| 4718 | |||
| 4269 | /* in (pre_kvm_run), out (post_kvm_run) */ | 4719 | /* in (pre_kvm_run), out (post_kvm_run) */ |
| 4270 | __u64 cr8; | 4720 | __u64 cr8; |
| 4271 | 4721 | ||
| 4272 | The value of the cr8 register. Only valid if in-kernel local APIC is | 4722 | The value of the cr8 register. Only valid if in-kernel local APIC is |
| 4273 | not used. Both input and output. | 4723 | not used. Both input and output. |
| 4274 | 4724 | ||
| 4725 | :: | ||
| 4726 | |||
| 4275 | __u64 apic_base; | 4727 | __u64 apic_base; |
| 4276 | 4728 | ||
| 4277 | The value of the APIC BASE msr. Only valid if in-kernel local | 4729 | The value of the APIC BASE msr. Only valid if in-kernel local |
| 4278 | APIC is not used. Both input and output. | 4730 | APIC is not used. Both input and output. |
| 4279 | 4731 | ||
| 4732 | :: | ||
| 4733 | |||
| 4280 | union { | 4734 | union { |
| 4281 | /* KVM_EXIT_UNKNOWN */ | 4735 | /* KVM_EXIT_UNKNOWN */ |
| 4282 | struct { | 4736 | struct { |
| @@ -4287,6 +4741,8 @@ If exit_reason is KVM_EXIT_UNKNOWN, the vcpu has exited due to unknown · 4 unmodified lines | |||
| 4287 | reasons. Further architecture-specific information is available in | 4741 | reasons. Further architecture-specific information is available in |
| 4288 | hardware_exit_reason. | 4742 | hardware_exit_reason. |
| 4289 | 4743 | ||
| 4744 | :: | ||
| 4745 | |||
| 4290 | /* KVM_EXIT_FAIL_ENTRY */ | 4746 | /* KVM_EXIT_FAIL_ENTRY */ |
| 4291 | struct { | 4747 | struct { |
| 4292 | __u64 hardware_entry_failure_reason; | 4748 | __u64 hardware_entry_failure_reason; |
| @@ -4296,6 +4752,8 @@ If exit_reason is KVM_EXIT_FAIL_ENTRY, the vcpu could not be run due · 3 unmodified lines | |||
| 4296 | to unknown reasons. Further architecture-specific information is | 4752 | to unknown reasons. Further architecture-specific information is |
| 4297 | available in hardware_entry_failure_reason. | 4753 | available in hardware_entry_failure_reason. |
| 4298 | 4754 | ||
| 4755 | :: | ||
| 4756 | |||
| 4299 | /* KVM_EXIT_EXCEPTION */ | 4757 | /* KVM_EXIT_EXCEPTION */ |
| 4300 | struct { | 4758 | struct { |
| 4301 | __u32 exception; | 4759 | __u32 exception; |
| @@ -4304,10 +4762,12 @@ available in hardware_entry_failure_reason. · 2 unmodified lines | |||
| 4304 | 4762 | ||
| 4305 | Unused. | 4763 | Unused. |
| 4306 | 4764 | ||
| 4765 | :: | ||
| 4766 | |||
| 4307 | /* KVM_EXIT_IO */ | 4767 | /* KVM_EXIT_IO */ |
| 4308 | struct { | 4768 | struct { |
| 4309 | #define KVM_EXIT_IO_IN 0 | 4769 | #define KVM_EXIT_IO_IN 0 |
| 4310 | #define KVM_EXIT_IO_OUT 1 | 4770 | #define KVM_EXIT_IO_OUT 1 |
| 4311 | __u8 direction; | 4771 | __u8 direction; |
| 4312 | __u8 size; /* bytes */ | 4772 | __u8 size; /* bytes */ |
| 4313 | __u16 port; | 4773 | __u16 port; |
| @@ -4321,6 +4781,8 @@ data_offset describes where the data is located (KVM_EXIT_IO_OUT) or · 7 unmodified lines | |||
| 4321 | where kvm expects application code to place the data for the next | 4781 | where kvm expects application code to place the data for the next |
| 4322 | KVM_RUN invocation (KVM_EXIT_IO_IN). Data format is a packed array. | 4782 | KVM_RUN invocation (KVM_EXIT_IO_IN). Data format is a packed array. |
| 4323 | 4783 | ||
| 4784 | :: | ||
| 4785 | |||
| 4324 | /* KVM_EXIT_DEBUG */ | 4786 | /* KVM_EXIT_DEBUG */ |
| 4325 | struct { | 4787 | struct { |
| 4326 | struct kvm_debug_exit_arch arch; | 4788 | struct kvm_debug_exit_arch arch; |
| @@ -4329,6 +4791,8 @@ KVM_RUN invocation (KVM_EXIT_IO_IN). Data format is a packed array. · 2 unmodified lines | |||
| 4329 | If the exit_reason is KVM_EXIT_DEBUG, then a vcpu is processing a debug event | 4791 | If the exit_reason is KVM_EXIT_DEBUG, then a vcpu is processing a debug event |
| 4330 | for which architecture specific information is returned. | 4792 | for which architecture specific information is returned. |
| 4331 | 4793 | ||
| 4794 | :: | ||
| 4795 | |||
| 4332 | /* KVM_EXIT_MMIO */ | 4796 | /* KVM_EXIT_MMIO */ |
| 4333 | struct { | 4797 | struct { |
| 4334 | __u64 phys_addr; | 4798 | __u64 phys_addr; |
| @@ -4346,14 +4810,19 @@ The 'data' member contains, in its first 'len' bytes, the value as it would · 11 unmodified lines | |||
| 4346 | appear if the VCPU performed a load or store of the appropriate width directly | 4810 | appear if the VCPU performed a load or store of the appropriate width directly |
| 4347 | to the byte array. | 4811 | to the byte array. |
| 4348 | 4812 | ||
| 4349 | NOTE: For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_PAPR and | 4813 | .. note:: |
| 4814 | |||
| 4815 | For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_PAPR and | ||
| 4350 | KVM_EXIT_EPR the corresponding | 4816 | KVM_EXIT_EPR the corresponding |
| 4817 | |||
| 4351 | operations are complete (and guest state is consistent) only after userspace | 4818 | operations are complete (and guest state is consistent) only after userspace |
| 4352 | has re-entered the kernel with KVM_RUN. The kernel side will first finish | 4819 | has re-entered the kernel with KVM_RUN. The kernel side will first finish |
| 4353 | incomplete operations and then check for pending signals. Userspace | 4820 | incomplete operations and then check for pending signals. Userspace |
| 4354 | can re-enter the guest with an unmasked signal pending to complete | 4821 | can re-enter the guest with an unmasked signal pending to complete |
| 4355 | pending operations. | 4822 | pending operations. |
| 4356 | 4823 | ||
| 4824 | :: | ||
| 4825 | |||
| 4357 | /* KVM_EXIT_HYPERCALL */ | 4826 | /* KVM_EXIT_HYPERCALL */ |
| 4358 | struct { | 4827 | struct { |
| 4359 | __u64 nr; | 4828 | __u64 nr; |
| @@ -4365,7 +4834,10 @@ pending operations. · 5 unmodified lines | |||
| 4365 | 4834 | ||
| 4366 | Unused. This was once used for 'hypercall to userspace'. To implement | 4835 | Unused. This was once used for 'hypercall to userspace'. To implement |
| 4367 | such functionality, use KVM_EXIT_IO (x86) or KVM_EXIT_MMIO (all except s390). | 4836 | such functionality, use KVM_EXIT_IO (x86) or KVM_EXIT_MMIO (all except s390). |
| 4368 | Note KVM_EXIT_IO is significantly faster than KVM_EXIT_MMIO. | 4837 | |
| 4838 | .. note:: KVM_EXIT_IO is significantly faster than KVM_EXIT_MMIO. | ||
| 4839 | |||
| 4840 | :: | ||
| 4369 | 4841 | ||
| 4370 | /* KVM_EXIT_TPR_ACCESS */ | 4842 | /* KVM_EXIT_TPR_ACCESS */ |
| 4371 | struct { | 4843 | struct { |
| @@ -4376,6 +4848,8 @@ Note KVM_EXIT_IO is significantly faster than KVM_EXIT_MMIO. · 4 unmodified lines | |||
| 4376 | 4848 | ||
| 4377 | To be documented (KVM_TPR_ACCESS_REPORTING). | 4849 | To be documented (KVM_TPR_ACCESS_REPORTING). |
| 4378 | 4850 | ||
| 4851 | :: | ||
| 4852 | |||
| 4379 | /* KVM_EXIT_S390_SIEIC */ | 4853 | /* KVM_EXIT_S390_SIEIC */ |
| 4380 | struct { | 4854 | struct { |
| 4381 | __u8 icptcode; | 4855 | __u8 icptcode; |
| @@ -4387,16 +4861,20 @@ To be documented (KVM_TPR_ACCESS_REPORTING). · 5 unmodified lines | |||
| 4387 | 4861 | ||
| 4388 | s390 specific. | 4862 | s390 specific. |
| 4389 | 4863 | ||
| 4864 | :: | ||
| 4865 | |||
| 4390 | /* KVM_EXIT_S390_RESET */ | 4866 | /* KVM_EXIT_S390_RESET */ |
| 4391 | #define KVM_S390_RESET_POR 1 | 4867 | #define KVM_S390_RESET_POR 1 |
| 4392 | #define KVM_S390_RESET_CLEAR 2 | 4868 | #define KVM_S390_RESET_CLEAR 2 |
| 4393 | #define KVM_S390_RESET_SUBSYSTEM 4 | 4869 | #define KVM_S390_RESET_SUBSYSTEM 4 |
| 4394 | #define KVM_S390_RESET_CPU_INIT 8 | 4870 | #define KVM_S390_RESET_CPU_INIT 8 |
| 4395 | #define KVM_S390_RESET_IPL 16 | 4871 | #define KVM_S390_RESET_IPL 16 |
| 4396 | __u64 s390_reset_flags; | 4872 | __u64 s390_reset_flags; |
| 4397 | 4873 | ||
| 4398 | s390 specific. | 4874 | s390 specific. |
| 4399 | 4875 | ||
| 4876 | :: | ||
| 4877 | |||
| 4400 | /* KVM_EXIT_S390_UCONTROL */ | 4878 | /* KVM_EXIT_S390_UCONTROL */ |
| 4401 | struct { | 4879 | struct { |
| 4402 | __u64 trans_exc_code; | 4880 | __u64 trans_exc_code; |
| @@ -4411,6 +4889,8 @@ in the cpu's lowcore are presented here as defined by the z Architecture · 8 unmodified lines | |||
| 4411 | Principles of Operation Book in the Chapter for Dynamic Address Translation | 4889 | Principles of Operation Book in the Chapter for Dynamic Address Translation |
| 4412 | (DAT) | 4890 | (DAT) |
1015 more lines aren’t shown here.
| @@ -1,4 +1,8 @@ | |||
| 1 | * Internal ABI between the kernel and HYP | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | |||
| 3 | ======================================= | ||
| 4 | Internal ABI between the kernel and HYP | ||
| 5 | ======================================= | ||
| 2 | 6 | ||
| 3 | This file documents the interaction between the Linux kernel and the | 7 | This file documents the interaction between the Linux kernel and the |
| 4 | hypervisor layer when running Linux as a hypervisor (for example | 8 | hypervisor layer when running Linux as a hypervisor (for example |
| @@ -19,25 +23,31 @@ and only act on individual CPUs. · 14 unmodified lines | |||
| 19 | Unless specified otherwise, any built-in hypervisor must implement | 23 | Unless specified otherwise, any built-in hypervisor must implement |
| 20 | these functions (see arch/arm{,64}/include/asm/virt.h): | 24 | these functions (see arch/arm{,64}/include/asm/virt.h): |
| 21 | 25 | ||
| 22 | * r0/x0 = HVC_SET_VECTORS | 26 | * :: |
| 23 | r1/x1 = vectors | 27 | |
| 28 | r0/x0 = HVC_SET_VECTORS | ||
| 29 | r1/x1 = vectors | ||
| 24 | 30 | ||
| 25 | Set HVBAR/VBAR_EL2 to 'vectors' to enable a hypervisor. 'vectors' | 31 | Set HVBAR/VBAR_EL2 to 'vectors' to enable a hypervisor. 'vectors' |
| 26 | must be a physical address, and respect the alignment requirements | 32 | must be a physical address, and respect the alignment requirements |
| 27 | of the architecture. Only implemented by the initial stubs, not by | 33 | of the architecture. Only implemented by the initial stubs, not by |
| 28 | Linux hypervisors. | 34 | Linux hypervisors. |
| 29 | 35 | ||
| 30 | * r0/x0 = HVC_RESET_VECTORS | 36 | * :: |
| 37 | |||
| 38 | r0/x0 = HVC_RESET_VECTORS | ||
| 31 | 39 | ||
| 32 | Turn HYP/EL2 MMU off, and reset HVBAR/VBAR_EL2 to the initials | 40 | Turn HYP/EL2 MMU off, and reset HVBAR/VBAR_EL2 to the initials |
| 33 | stubs' exception vector value. This effectively disables an existing | 41 | stubs' exception vector value. This effectively disables an existing |
| 34 | hypervisor. | 42 | hypervisor. |
| 35 | 43 | ||
| 36 | * r0/x0 = HVC_SOFT_RESTART | 44 | * :: |
| 37 | r1/x1 = restart address | 45 | |
| 38 | x2 = x0's value when entering the next payload (arm64) | 46 | r0/x0 = HVC_SOFT_RESTART |
| 39 | x3 = x1's value when entering the next payload (arm64) | 47 | r1/x1 = restart address |
| 40 | x4 = x2's value when entering the next payload (arm64) | 48 | x2 = x0's value when entering the next payload (arm64) |
| 49 | x3 = x1's value when entering the next payload (arm64) | ||
| 50 | x4 = x2's value when entering the next payload (arm64) | ||
| 41 | 51 | ||
| 42 | Mask all exceptions, disable the MMU, move the arguments into place | 52 | Mask all exceptions, disable the MMU, move the arguments into place |
| 43 | (arm64 only), and jump to the restart address while at HYP/EL2. This | 53 | (arm64 only), and jump to the restart address while at HYP/EL2. This |
| @@ -0,0 +1,12 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | === | ||
| 4 | ARM | ||
| 5 | === | ||
| 6 | |||
| 7 | .. toctree:: | ||
| 8 | :maxdepth: 2 | ||
| 9 | |||
| 10 | hyp-abi | ||
| 11 | psci | ||
| 12 | pvtime | ||
| @@ -1,3 +1,9 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ========================================= | ||
| 4 | Power State Coordination Interface (PSCI) | ||
| 5 | ========================================= | ||
| 6 | |||
| 1 | KVM implements the PSCI (Power State Coordination Interface) | 7 | KVM implements the PSCI (Power State Coordination Interface) |
| 2 | specification in order to provide services such as CPU on/off, reset | 8 | specification in order to provide services such as CPU on/off, reset |
| 3 | and power-off to the guest. | 9 | and power-off to the guest. |
| @@ -30,32 +36,42 @@ The following register is defined: · 26 unmodified lines | |||
| 30 | - Affects the whole VM (even if the register view is per-vcpu) | 36 | - Affects the whole VM (even if the register view is per-vcpu) |
| 31 | 37 | ||
| 32 | * KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1: | 38 | * KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1: |
| 33 | Holds the state of the firmware support to mitigate CVE-2017-5715, as | 39 | Holds the state of the firmware support to mitigate CVE-2017-5715, as |
| 34 | offered by KVM to the guest via a HVC call. The workaround is described | 40 | offered by KVM to the guest via a HVC call. The workaround is described |
| 35 | under SMCCC_ARCH_WORKAROUND_1 in [1]. | 41 | under SMCCC_ARCH_WORKAROUND_1 in [1]. |
| 42 | |||
| 36 | Accepted values are: | 43 | Accepted values are: |
| 37 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL: KVM does not offer | 44 | |
| 45 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL: | ||
| 46 | KVM does not offer | ||
| 38 | firmware support for the workaround. The mitigation status for the | 47 | firmware support for the workaround. The mitigation status for the |
| 39 | guest is unknown. | 48 | guest is unknown. |
| 40 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL: The workaround HVC call is | 49 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL: |
| 50 | The workaround HVC call is | ||
| 41 | available to the guest and required for the mitigation. | 51 | available to the guest and required for the mitigation. |
| 42 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED: The workaround HVC call | 52 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED: |
| 53 | The workaround HVC call | ||
| 43 | is available to the guest, but it is not needed on this VCPU. | 54 | is available to the guest, but it is not needed on this VCPU. |
| 44 | 55 | ||
| 45 | * KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2: | 56 | * KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2: |
| 46 | Holds the state of the firmware support to mitigate CVE-2018-3639, as | 57 | Holds the state of the firmware support to mitigate CVE-2018-3639, as |
| 47 | offered by KVM to the guest via a HVC call. The workaround is described | 58 | offered by KVM to the guest via a HVC call. The workaround is described |
| 48 | under SMCCC_ARCH_WORKAROUND_2 in [1]. | 59 | under SMCCC_ARCH_WORKAROUND_2 in [1]_. |
| 60 | |||
| 49 | Accepted values are: | 61 | Accepted values are: |
| 50 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL: A workaround is not | 62 | |
| 63 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL: | ||
| 64 | A workaround is not | ||
| 51 | available. KVM does not offer firmware support for the workaround. | 65 | available. KVM does not offer firmware support for the workaround. |
| 52 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN: The workaround state is | 66 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN: |
| 67 | The workaround state is | ||
| 53 | unknown. KVM does not offer firmware support for the workaround. | 68 | unknown. KVM does not offer firmware support for the workaround. |
| 54 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_AVAIL: The workaround is available, | 69 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_AVAIL: |
| 70 | The workaround is available, | ||
| 55 | and can be disabled by a vCPU. If | 71 | and can be disabled by a vCPU. If |
| 56 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_ENABLED is set, it is active for | 72 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_ENABLED is set, it is active for |
| 57 | this vCPU. | 73 | this vCPU. |
| 58 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_REQUIRED: The workaround is | 74 | KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_REQUIRED: |
| 59 | always active on this vCPU or it is not needed. | 75 | The workaround is always active on this vCPU or it is not needed. |
| 60 | 76 | ||
| 61 | [1] https://developer.arm.com/-/media/developer/pdf/ARM_DEN_0070A_Firmware_interfaces_for_mitigating_CVE-2017-5715.pdf | 77 | .. [1] https://developer.arm.com/-/media/developer/pdf/ARM_DEN_0070A_Firmware_interfaces_for_mitigating_CVE-2017-5715.pdf |
| @@ -1,3 +1,6 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | =============================================== | ||
| 1 | ARM Virtual Interrupt Translation Service (ITS) | 4 | ARM Virtual Interrupt Translation Service (ITS) |
| 2 | =============================================== | 5 | =============================================== |
| 3 | 6 | ||
| @@ -12,22 +15,32 @@ There can be multiple ITS controllers per guest, each of them has to have · 8 unmodified lines | |||
| 12 | a separate, non-overlapping MMIO region. | 15 | a separate, non-overlapping MMIO region. |
| 13 | 16 | ||
| 14 | 17 | ||
| 15 | Groups: | 18 | Groups |
| 16 | KVM_DEV_ARM_VGIC_GRP_ADDR | 19 | ====== |
| 20 | |||
| 21 | KVM_DEV_ARM_VGIC_GRP_ADDR | ||
| 22 | ------------------------- | ||
| 23 | |||
| 17 | Attributes: | 24 | Attributes: |
| 18 | KVM_VGIC_ITS_ADDR_TYPE (rw, 64-bit) | 25 | KVM_VGIC_ITS_ADDR_TYPE (rw, 64-bit) |
| 19 | Base address in the guest physical address space of the GICv3 ITS | 26 | Base address in the guest physical address space of the GICv3 ITS |
| 20 | control register frame. | 27 | control register frame. |
| 21 | This address needs to be 64K aligned and the region covers 128K. | 28 | This address needs to be 64K aligned and the region covers 128K. |
| 29 | |||
| 22 | Errors: | 30 | Errors: |
| 23 | -E2BIG: Address outside of addressable IPA range | ||
| 24 | -EINVAL: Incorrectly aligned address | ||
| 25 | -EEXIST: Address already configured | ||
| 26 | -EFAULT: Invalid user pointer for attr->addr. | ||
| 27 | -ENODEV: Incorrect attribute or the ITS is not supported. | ||
| 28 | 31 | ||
| 32 | ======= ================================================= | ||
| 33 | -E2BIG Address outside of addressable IPA range | ||
| 34 | -EINVAL Incorrectly aligned address | ||
| 35 | -EEXIST Address already configured | ||
| 36 | -EFAULT Invalid user pointer for attr->addr. | ||
| 37 | -ENODEV Incorrect attribute or the ITS is not supported. | ||
| 38 | ======= ================================================= | ||
| 39 | |||
| 40 | |||
| 41 | KVM_DEV_ARM_VGIC_GRP_CTRL | ||
| 42 | ------------------------- | ||
| 29 | 43 | ||
| 30 | KVM_DEV_ARM_VGIC_GRP_CTRL | ||
| 31 | Attributes: | 44 | Attributes: |
| 32 | KVM_DEV_ARM_VGIC_CTRL_INIT | 45 | KVM_DEV_ARM_VGIC_CTRL_INIT |
| 33 | request the initialization of the ITS, no additional parameter in | 46 | request the initialization of the ITS, no additional parameter in |
| @@ -58,16 +71,21 @@ Groups: · 24 unmodified lines | |||
| 58 | "ITS Restore Sequence". | 71 | "ITS Restore Sequence". |
| 59 | 72 | ||
| 60 | Errors: | 73 | Errors: |
| 61 | -ENXIO: ITS not properly configured as required prior to setting | 74 | |
| 75 | ======= ========================================================== | ||
| 76 | -ENXIO ITS not properly configured as required prior to setting | ||
| 62 | this attribute | 77 | this attribute |
| 63 | -ENOMEM: Memory shortage when allocating ITS internal data | 78 | -ENOMEM Memory shortage when allocating ITS internal data |
| 64 | -EINVAL: Inconsistent restored data | 79 | -EINVAL Inconsistent restored data |
| 65 | -EFAULT: Invalid guest ram access | 80 | -EFAULT Invalid guest ram access |
| 66 | -EBUSY: One or more VCPUS are running | 81 | -EBUSY One or more VCPUS are running |
| 67 | -EACCES: The virtual ITS is backed by a physical GICv4 ITS, and the | 82 | -EACCES The virtual ITS is backed by a physical GICv4 ITS, and the |
| 68 | state is not available | 83 | state is not available |
| 84 | ======= ========================================================== | ||
| 85 | |||
| 86 | KVM_DEV_ARM_VGIC_GRP_ITS_REGS | ||
| 87 | ----------------------------- | ||
| 69 | 88 | ||
| 70 | KVM_DEV_ARM_VGIC_GRP_ITS_REGS | ||
| 71 | Attributes: | 89 | Attributes: |
| 72 | The attr field of kvm_device_attr encodes the offset of the | 90 | The attr field of kvm_device_attr encodes the offset of the |
| 73 | ITS register, relative to the ITS control frame base address | 91 | ITS register, relative to the ITS control frame base address |
| @@ -78,6 +96,7 @@ Groups: · 4 unmodified lines | |||
| 78 | be accessed with full length. | 96 | be accessed with full length. |
| 79 | 97 | ||
| 80 | Writes to read-only registers are ignored by the kernel except for: | 98 | Writes to read-only registers are ignored by the kernel except for: |
| 99 | |||
| 81 | - GITS_CREADR. It must be restored otherwise commands in the queue | 100 | - GITS_CREADR. It must be restored otherwise commands in the queue |
| 82 | will be re-executed after restoring CWRITER. GITS_CREADR must be | 101 | will be re-executed after restoring CWRITER. GITS_CREADR must be |
| 83 | restored before restoring the GITS_CTLR which is likely to enable the | 102 | restored before restoring the GITS_CTLR which is likely to enable the |
| @@ -91,30 +110,36 @@ Groups: · 7 unmodified lines | |||
| 91 | 110 | ||
| 92 | For other registers, getting or setting a register has the same | 111 | For other registers, getting or setting a register has the same |
| 93 | effect as reading/writing the register on real hardware. | 112 | effect as reading/writing the register on real hardware. |
| 113 | |||
| 94 | Errors: | 114 | Errors: |
| 95 | -ENXIO: Offset does not correspond to any supported register | ||
| 96 | -EFAULT: Invalid user pointer for attr->addr | ||
| 97 | -EINVAL: Offset is not 64-bit aligned | ||
| 98 | -EBUSY: one or more VCPUS are running | ||
| 99 | 115 | ||
| 100 | ITS Restore Sequence: | 116 | ======= ==================================================== |
| 101 | ------------------------- | 117 | -ENXIO Offset does not correspond to any supported register |
| 118 | -EFAULT Invalid user pointer for attr->addr | ||
| 119 | -EINVAL Offset is not 64-bit aligned | ||
| 120 | -EBUSY one or more VCPUS are running | ||
| 121 | ======= ==================================================== | ||
| 122 | |||
| 123 | ITS Restore Sequence: | ||
| 124 | --------------------- | ||
| 102 | 125 | ||
| 103 | The following ordering must be followed when restoring the GIC and the ITS: | 126 | The following ordering must be followed when restoring the GIC and the ITS: |
| 127 | |||
| 104 | a) restore all guest memory and create vcpus | 128 | a) restore all guest memory and create vcpus |
| 105 | b) restore all redistributors | 129 | b) restore all redistributors |
| 106 | c) provide the ITS base address | 130 | c) provide the ITS base address |
| 107 | (KVM_DEV_ARM_VGIC_GRP_ADDR) | 131 | (KVM_DEV_ARM_VGIC_GRP_ADDR) |
| 108 | d) restore the ITS in the following order: | 132 | d) restore the ITS in the following order: |
| 109 | 1. Restore GITS_CBASER | 133 | |
| 110 | 2. Restore all other GITS_ registers, except GITS_CTLR! | 134 | 1. Restore GITS_CBASER |
| 111 | 3. Load the ITS table data (KVM_DEV_ARM_ITS_RESTORE_TABLES) | 135 | 2. Restore all other ``GITS_`` registers, except GITS_CTLR! |
| 112 | 4. Restore GITS_CTLR | 136 | 3. Load the ITS table data (KVM_DEV_ARM_ITS_RESTORE_TABLES) |
| 137 | 4. Restore GITS_CTLR | ||
| 113 | 138 | ||
| 114 | Then vcpus can be started. | 139 | Then vcpus can be started. |
| 115 | 140 | ||
| 116 | ITS Table ABI REV0: | 141 | ITS Table ABI REV0: |
| 117 | ------------------- | 142 | ------------------- |
| 118 | 143 | ||
| 119 | Revision 0 of the ABI only supports the features of a virtual GICv3, and does | 144 | Revision 0 of the ABI only supports the features of a virtual GICv3, and does |
| 120 | not support a virtual GICv4 with support for direct injection of virtual | 145 | not support a virtual GICv4 with support for direct injection of virtual |
| @@ -125,12 +150,13 @@ Then vcpus can be started. · 4 unmodified lines | |||
| 125 | entries in the collection are listed in no particular order. | 150 | entries in the collection are listed in no particular order. |
| 126 | All entries are 8 bytes. | 151 | All entries are 8 bytes. |
| 127 | 152 | ||
| 128 | Device Table Entry (DTE): | 153 | Device Table Entry (DTE):: |
| 129 | 154 | ||
| 130 | bits: | 63| 62 ... 49 | 48 ... 5 | 4 ... 0 | | 155 | bits: | 63| 62 ... 49 | 48 ... 5 | 4 ... 0 | |
| 131 | values: | V | next | ITT_addr | Size | | 156 | values: | V | next | ITT_addr | Size | |
| 157 | |||
| 158 | where: | ||
| 132 | 159 | ||
| 133 | where; | ||
| 134 | - V indicates whether the entry is valid. If not, other fields | 160 | - V indicates whether the entry is valid. If not, other fields |
| 135 | are not meaningful. | 161 | are not meaningful. |
| 136 | - next: equals to 0 if this entry is the last one; otherwise it | 162 | - next: equals to 0 if this entry is the last one; otherwise it |
| @@ -140,32 +166,34 @@ Then vcpus can be started. · 3 unmodified lines | |||
| 140 | - Size specifies the supported number of bits for the EventID, | 166 | - Size specifies the supported number of bits for the EventID, |
| 141 | minus one | 167 | minus one |
| 142 | 168 | ||
| 143 | Collection Table Entry (CTE): | 169 | Collection Table Entry (CTE):: |
| 144 | 170 | ||
| 145 | bits: | 63| 62 .. 52 | 51 ... 16 | 15 ... 0 | | 171 | bits: | 63| 62 .. 52 | 51 ... 16 | 15 ... 0 | |
| 146 | values: | V | RES0 | RDBase | ICID | | 172 | values: | V | RES0 | RDBase | ICID | |
| 147 | 173 | ||
| 148 | where: | 174 | where: |
| 175 | |||
| 149 | - V indicates whether the entry is valid. If not, other fields are | 176 | - V indicates whether the entry is valid. If not, other fields are |
| 150 | not meaningful. | 177 | not meaningful. |
| 151 | - RES0: reserved field with Should-Be-Zero-or-Preserved behavior. | 178 | - RES0: reserved field with Should-Be-Zero-or-Preserved behavior. |
| 152 | - RDBase is the PE number (GICR_TYPER.Processor_Number semantic), | 179 | - RDBase is the PE number (GICR_TYPER.Processor_Number semantic), |
| 153 | - ICID is the collection ID | 180 | - ICID is the collection ID |
| 154 | 181 | ||
| 155 | Interrupt Translation Entry (ITE): | 182 | Interrupt Translation Entry (ITE):: |
| 156 | 183 | ||
| 157 | bits: | 63 ... 48 | 47 ... 16 | 15 ... 0 | | 184 | bits: | 63 ... 48 | 47 ... 16 | 15 ... 0 | |
| 158 | values: | next | pINTID | ICID | | 185 | values: | next | pINTID | ICID | |
| 159 | 186 | ||
| 160 | where: | 187 | where: |
| 188 | |||
| 161 | - next: equals to 0 if this entry is the last one; otherwise it corresponds | 189 | - next: equals to 0 if this entry is the last one; otherwise it corresponds |
| 162 | to the EventID offset to the next ITE capped by 2^16 -1. | 190 | to the EventID offset to the next ITE capped by 2^16 -1. |
| 163 | - pINTID is the physical LPI ID; if zero, it means the entry is not valid | 191 | - pINTID is the physical LPI ID; if zero, it means the entry is not valid |
| 164 | and other fields are not meaningful. | 192 | and other fields are not meaningful. |
| 165 | - ICID is the collection ID | 193 | - ICID is the collection ID |
| 166 | 194 | ||
| 167 | ITS Reset State: | 195 | ITS Reset State: |
| 168 | ---------------- | 196 | ---------------- |
| 169 | 197 | ||
| 170 | RESET returns the ITS to the same state that it was when first created and | 198 | RESET returns the ITS to the same state that it was when first created and |
| 171 | initialized. When the RESET command returns, the following things are | 199 | initialized. When the RESET command returns, the following things are |
| @@ -1,9 +1,12 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ============================================================== | ||
| 1 | ARM Virtual Generic Interrupt Controller v3 and later (VGICv3) | 4 | ARM Virtual Generic Interrupt Controller v3 and later (VGICv3) |
| 2 | ============================================================== | 5 | ============================================================== |
| 3 | 6 | ||
| 4 | 7 | ||
| 5 | Device types supported: | 8 | Device types supported: |
| 6 | KVM_DEV_TYPE_ARM_VGIC_V3 ARM Generic Interrupt Controller v3.0 | 9 | - KVM_DEV_TYPE_ARM_VGIC_V3 ARM Generic Interrupt Controller v3.0 |
| 7 | 10 | ||
| 8 | Only one VGIC instance may be instantiated through this API. The created VGIC | 11 | Only one VGIC instance may be instantiated through this API. The created VGIC |
| 9 | will act as the VM interrupt controller, requiring emulated user-space devices | 12 | will act as the VM interrupt controller, requiring emulated user-space devices |
| @@ -15,7 +18,8 @@ Creating a guest GICv3 device requires a host GICv3 as well. · 5 unmodified lines | |||
| 15 | 18 | ||
| 16 | Groups: | 19 | Groups: |
| 17 | KVM_DEV_ARM_VGIC_GRP_ADDR | 20 | KVM_DEV_ARM_VGIC_GRP_ADDR |
| 18 | Attributes: | 21 | Attributes: |
| 22 | |||
| 19 | KVM_VGIC_V3_ADDR_TYPE_DIST (rw, 64-bit) | 23 | KVM_VGIC_V3_ADDR_TYPE_DIST (rw, 64-bit) |
| 20 | Base address in the guest physical address space of the GICv3 distributor | 24 | Base address in the guest physical address space of the GICv3 distributor |
| 21 | register mappings. Only valid for KVM_DEV_TYPE_ARM_VGIC_V3. | 25 | register mappings. Only valid for KVM_DEV_TYPE_ARM_VGIC_V3. |
| @@ -29,21 +33,25 @@ Groups: · 7 unmodified lines | |||
| 29 | This address needs to be 64K aligned. | 33 | This address needs to be 64K aligned. |
| 30 | 34 | ||
| 31 | KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION (rw, 64-bit) | 35 | KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION (rw, 64-bit) |
| 32 | The attribute data pointed to by kvm_device_attr.addr is a __u64 value: | 36 | The attribute data pointed to by kvm_device_attr.addr is a __u64 value:: |
| 33 | bits: | 63 .... 52 | 51 .... 16 | 15 - 12 |11 - 0 | 37 | |
| 34 | values: | count | base | flags | index | 38 | bits: | 63 .... 52 | 51 .... 16 | 15 - 12 |11 - 0 |
| 39 | values: | count | base | flags | index | ||
| 40 | |||
| 35 | - index encodes the unique redistributor region index | 41 | - index encodes the unique redistributor region index |
| 36 | - flags: reserved for future use, currently 0 | 42 | - flags: reserved for future use, currently 0 |
| 37 | - base field encodes bits [51:16] of the guest physical base address | 43 | - base field encodes bits [51:16] of the guest physical base address |
| 38 | of the first redistributor in the region. | 44 | of the first redistributor in the region. |
| 39 | - count encodes the number of redistributors in the region. Must be | 45 | - count encodes the number of redistributors in the region. Must be |
| 40 | greater than 0. | 46 | greater than 0. |
| 47 | |||
| 41 | There are two 64K pages for each redistributor in the region and | 48 | There are two 64K pages for each redistributor in the region and |
| 42 | redistributors are laid out contiguously within the region. Regions | 49 | redistributors are laid out contiguously within the region. Regions |
| 43 | are filled with redistributors in the index order. The sum of all | 50 | are filled with redistributors in the index order. The sum of all |
| 44 | region count fields must be greater than or equal to the number of | 51 | region count fields must be greater than or equal to the number of |
| 45 | VCPUs. Redistributor regions must be registered in the incremental | 52 | VCPUs. Redistributor regions must be registered in the incremental |
| 46 | index order, starting from index 0. | 53 | index order, starting from index 0. |
| 54 | |||
| 47 | The characteristics of a specific redistributor region can be read | 55 | The characteristics of a specific redistributor region can be read |
| 48 | by presetting the index field in the attr data. | 56 | by presetting the index field in the attr data. |
| 49 | Only valid for KVM_DEV_TYPE_ARM_VGIC_V3. | 57 | Only valid for KVM_DEV_TYPE_ARM_VGIC_V3. |
| @@ -52,23 +60,27 @@ Groups: · 2 unmodified lines | |||
| 52 | KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION attributes. | 60 | KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION attributes. |
| 53 | 61 | ||
| 54 | Errors: | 62 | Errors: |
| 55 | -E2BIG: Address outside of addressable IPA range | 63 | |
| 56 | -EINVAL: Incorrectly aligned address, bad redistributor region | 64 | ======= ============================================================= |
| 65 | -E2BIG Address outside of addressable IPA range | ||
| 66 | -EINVAL Incorrectly aligned address, bad redistributor region | ||
| 57 | count/index, mixed redistributor region attribute usage | 67 | count/index, mixed redistributor region attribute usage |
| 58 | -EEXIST: Address already configured | 68 | -EEXIST Address already configured |
| 59 | -ENOENT: Attempt to read the characteristics of a non existing | 69 | -ENOENT Attempt to read the characteristics of a non existing |
| 60 | redistributor region | 70 | redistributor region |
| 61 | -ENXIO: The group or attribute is unknown/unsupported for this device | 71 | -ENXIO The group or attribute is unknown/unsupported for this device |
| 62 | or hardware support is missing. | 72 | or hardware support is missing. |
| 63 | -EFAULT: Invalid user pointer for attr->addr. | 73 | -EFAULT Invalid user pointer for attr->addr. |
| 74 | ======= ============================================================= | ||
| 75 | |||
| 64 | 76 | ||
| 77 | KVM_DEV_ARM_VGIC_GRP_DIST_REGS, KVM_DEV_ARM_VGIC_GRP_REDIST_REGS | ||
| 78 | Attributes: | ||
| 65 | 79 | ||
| 66 | KVM_DEV_ARM_VGIC_GRP_DIST_REGS | 80 | The attr field of kvm_device_attr encodes two values:: |
| 67 | KVM_DEV_ARM_VGIC_GRP_REDIST_REGS | 81 | |
| 68 | Attributes: | 82 | bits: | 63 .... 32 | 31 .... 0 | |
| 69 | The attr field of kvm_device_attr encodes two values: | 83 | values: | mpidr | offset | |
| 70 | bits: | 63 .... 32 | 31 .... 0 | | ||
| 71 | values: | mpidr | offset | | ||
| 72 | 84 | ||
| 73 | All distributor regs are (rw, 32-bit) and kvm_device_attr.addr points to a | 85 | All distributor regs are (rw, 32-bit) and kvm_device_attr.addr points to a |
| 74 | __u32 value. 64-bit registers must be accessed by separately accessing the | 86 | __u32 value. 64-bit registers must be accessed by separately accessing the |
| @@ -93,7 +105,8 @@ Groups: · 18 unmodified lines | |||
| 93 | redistributor is accessed. The mpidr is ignored for the distributor. | 105 | redistributor is accessed. The mpidr is ignored for the distributor. |
| 94 | 106 | ||
| 95 | The mpidr encoding is based on the affinity information in the | 107 | The mpidr encoding is based on the affinity information in the |
| 96 | architecture defined MPIDR, and the field is encoded as follows: | 108 | architecture defined MPIDR, and the field is encoded as follows:: |
| 109 | |||
| 97 | | 63 .... 56 | 55 .... 48 | 47 .... 40 | 39 .... 32 | | 110 | | 63 .... 56 | 55 .... 48 | 47 .... 40 | 39 .... 32 | |
| 98 | | Aff3 | Aff2 | Aff1 | Aff0 | | 111 | | Aff3 | Aff2 | Aff1 | Aff0 | |
| 99 | 112 | ||
| @@ -148,24 +161,30 @@ Groups: · 48 unmodified lines | |||
| 148 | ignored. | 161 | ignored. |
| 149 | 162 | ||
| 150 | Errors: | 163 | Errors: |
| 151 | -ENXIO: Getting or setting this register is not yet supported | 164 | |
| 152 | -EBUSY: One or more VCPUs are running | 165 | ====== ===================================================== |
| 166 | -ENXIO Getting or setting this register is not yet supported | ||
| 167 | -EBUSY One or more VCPUs are running | ||
| 168 | ====== ===================================================== | ||
| 153 | 169 | ||
| 154 | 170 | ||
| 155 | KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS | 171 | KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS |
| 156 | Attributes: | 172 | Attributes: |
| 157 | The attr field of kvm_device_attr encodes two values: | 173 | |
| 158 | bits: | 63 .... 32 | 31 .... 16 | 15 .... 0 | | 174 | The attr field of kvm_device_attr encodes two values:: |
| 159 | values: | mpidr | RES | instr | | 175 | |
| 176 | bits: | 63 .... 32 | 31 .... 16 | 15 .... 0 | | ||
| 177 | values: | mpidr | RES | instr | | ||
| 160 | 178 | ||
| 161 | The mpidr field encodes the CPU ID based on the affinity information in the | 179 | The mpidr field encodes the CPU ID based on the affinity information in the |
| 162 | architecture defined MPIDR, and the field is encoded as follows: | 180 | architecture defined MPIDR, and the field is encoded as follows:: |
| 181 | |||
| 163 | | 63 .... 56 | 55 .... 48 | 47 .... 40 | 39 .... 32 | | 182 | | 63 .... 56 | 55 .... 48 | 47 .... 40 | 39 .... 32 | |
| 164 | | Aff3 | Aff2 | Aff1 | Aff0 | | 183 | | Aff3 | Aff2 | Aff1 | Aff0 | |
| 165 | 184 | ||
| 166 | The instr field encodes the system register to access based on the fields | 185 | The instr field encodes the system register to access based on the fields |
| 167 | defined in the A64 instruction set encoding for system register access | 186 | defined in the A64 instruction set encoding for system register access |
| 168 | (RES means the bits are reserved for future use and should be zero): | 187 | (RES means the bits are reserved for future use and should be zero):: |
| 169 | 188 | ||
| 170 | | 15 ... 14 | 13 ... 11 | 10 ... 7 | 6 ... 3 | 2 ... 0 | | 189 | | 15 ... 14 | 13 ... 11 | 10 ... 7 | 6 ... 3 | 2 ... 0 | |
| 171 | | Op 0 | Op1 | CRn | CRm | Op2 | | 190 | | Op 0 | Op1 | CRn | CRm | Op2 | |
| @@ -178,26 +197,35 @@ Groups: · 6 unmodified lines | |||
| 178 | 197 | ||
| 179 | CPU interface registers access is not implemented for AArch32 mode. | 198 | CPU interface registers access is not implemented for AArch32 mode. |
| 180 | Error -ENXIO is returned when accessed in AArch32 mode. | 199 | Error -ENXIO is returned when accessed in AArch32 mode. |
| 200 | |||
| 181 | Errors: | 201 | Errors: |
| 182 | -ENXIO: Getting or setting this register is not yet supported | 202 | |
| 183 | -EBUSY: VCPU is running | 203 | ======= ===================================================== |
| 184 | -EINVAL: Invalid mpidr or register value supplied | 204 | -ENXIO Getting or setting this register is not yet supported |
| 205 | -EBUSY VCPU is running | ||
| 206 | -EINVAL Invalid mpidr or register value supplied | ||
| 207 | ======= ===================================================== | ||
| 185 | 208 | ||
| 186 | 209 | ||
| 187 | KVM_DEV_ARM_VGIC_GRP_NR_IRQS | 210 | KVM_DEV_ARM_VGIC_GRP_NR_IRQS |
| 188 | Attributes: | 211 | Attributes: |
| 212 | |||
| 189 | A value describing the number of interrupts (SGI, PPI and SPI) for | 213 | A value describing the number of interrupts (SGI, PPI and SPI) for |
| 190 | this GIC instance, ranging from 64 to 1024, in increments of 32. | 214 | this GIC instance, ranging from 64 to 1024, in increments of 32. |
| 191 | 215 | ||
| 192 | kvm_device_attr.addr points to a __u32 value. | 216 | kvm_device_attr.addr points to a __u32 value. |
| 193 | 217 | ||
| 194 | Errors: | 218 | Errors: |
| 195 | -EINVAL: Value set is out of the expected range | 219 | |
| 196 | -EBUSY: Value has already be set. | 220 | ======= ====================================== |
| 221 | -EINVAL Value set is out of the expected range | ||
| 222 | -EBUSY Value has already be set. | ||
| 223 | ======= ====================================== | ||
| 197 | 224 | ||
| 198 | 225 | ||
| 199 | KVM_DEV_ARM_VGIC_GRP_CTRL | 226 | KVM_DEV_ARM_VGIC_GRP_CTRL |
| 200 | Attributes: | 227 | Attributes: |
| 228 | |||
| 201 | KVM_DEV_ARM_VGIC_CTRL_INIT | 229 | KVM_DEV_ARM_VGIC_CTRL_INIT |
| 202 | request the initialization of the VGIC, no additional parameter in | 230 | request the initialization of the VGIC, no additional parameter in |
| 203 | kvm_device_attr.addr. | 231 | kvm_device_attr.addr. |
| @@ -205,20 +233,26 @@ Groups: · 1 unmodified line | |||
| 205 | save all LPI pending bits into guest RAM pending tables. | 233 | save all LPI pending bits into guest RAM pending tables. |
| 206 | 234 | ||
| 207 | The first kB of the pending table is not altered by this operation. | 235 | The first kB of the pending table is not altered by this operation. |
| 236 | |||
| 208 | Errors: | 237 | Errors: |
| 209 | -ENXIO: VGIC not properly configured as required prior to calling | 238 | |
| 210 | this attribute | 239 | ======= ======================================================== |
| 211 | -ENODEV: no online VCPU | 240 | -ENXIO VGIC not properly configured as required prior to calling |
| 212 | -ENOMEM: memory shortage when allocating vgic internal data | 241 | this attribute |
| 213 | -EFAULT: Invalid guest ram access | 242 | -ENODEV no online VCPU |
| 214 | -EBUSY: One or more VCPUS are running | 243 | -ENOMEM memory shortage when allocating vgic internal data |
| 244 | -EFAULT Invalid guest ram access | ||
| 245 | -EBUSY One or more VCPUS are running | ||
| 246 | ======= ======================================================== | ||
| 215 | 247 | ||
| 216 | 248 | ||
| 217 | KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO | 249 | KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO |
| 218 | Attributes: | 250 | Attributes: |
| 219 | The attr field of kvm_device_attr encodes the following values: | 251 | |
| 220 | bits: | 63 .... 32 | 31 .... 10 | 9 .... 0 | | 252 | The attr field of kvm_device_attr encodes the following values:: |
| 221 | values: | mpidr | info | vINTID | | 253 | |
| 254 | bits: | 63 .... 32 | 31 .... 10 | 9 .... 0 | | ||
| 255 | values: | mpidr | info | vINTID | | ||
| 222 | 256 | ||
| 223 | The vINTID specifies which set of IRQs is reported on. | 257 | The vINTID specifies which set of IRQs is reported on. |
| 224 | 258 | ||
| @@ -228,6 +262,7 @@ Groups: · 3 unmodified lines | |||
| 228 | VGIC_LEVEL_INFO_LINE_LEVEL: | 262 | VGIC_LEVEL_INFO_LINE_LEVEL: |
| 229 | Get/Set the input level of the IRQ line for a set of 32 contiguously | 263 | Get/Set the input level of the IRQ line for a set of 32 contiguously |
| 230 | numbered interrupts. | 264 | numbered interrupts. |
| 265 | |||
| 231 | vINTID must be a multiple of 32. | 266 | vINTID must be a multiple of 32. |
| 232 | 267 | ||
| 233 | kvm_device_attr.addr points to a __u32 value which will contain a | 268 | kvm_device_attr.addr points to a __u32 value which will contain a |
| @@ -243,9 +278,14 @@ Groups: · 9 unmodified lines | |||
| 243 | reported with the same value regardless of the mpidr specified. | 278 | reported with the same value regardless of the mpidr specified. |
| 244 | 279 | ||
| 245 | The mpidr field encodes the CPU ID based on the affinity information in the | 280 | The mpidr field encodes the CPU ID based on the affinity information in the |
| 246 | architecture defined MPIDR, and the field is encoded as follows: | 281 | architecture defined MPIDR, and the field is encoded as follows:: |
| 282 | |||
| 247 | | 63 .... 56 | 55 .... 48 | 47 .... 40 | 39 .... 32 | | 283 | | 63 .... 56 | 55 .... 48 | 47 .... 40 | 39 .... 32 | |
| 248 | | Aff3 | Aff2 | Aff1 | Aff0 | | 284 | | Aff3 | Aff2 | Aff1 | Aff0 | |
| 285 | |||
| 249 | Errors: | 286 | Errors: |
| 250 | -EINVAL: vINTID is not multiple of 32 or | 287 | |
| 251 | info field is not VGIC_LEVEL_INFO_LINE_LEVEL | 288 | ======= ============================================= |
| 289 | -EINVAL vINTID is not multiple of 32 or info field is | ||
| 290 | not VGIC_LEVEL_INFO_LINE_LEVEL | ||
| 291 | ======= ============================================= | ||
| @@ -1,8 +1,12 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ================================================== | ||
| 1 | ARM Virtual Generic Interrupt Controller v2 (VGIC) | 4 | ARM Virtual Generic Interrupt Controller v2 (VGIC) |
| 2 | ================================================== | 5 | ================================================== |
| 3 | 6 | ||
| 4 | Device types supported: | 7 | Device types supported: |
| 5 | KVM_DEV_TYPE_ARM_VGIC_V2 ARM Generic Interrupt Controller v2.0 | 8 | |
| 9 | - KVM_DEV_TYPE_ARM_VGIC_V2 ARM Generic Interrupt Controller v2.0 | ||
| 6 | 10 | ||
| 7 | Only one VGIC instance may be instantiated through either this API or the | 11 | Only one VGIC instance may be instantiated through either this API or the |
| 8 | legacy KVM_CREATE_IRQCHIP API. The created VGIC will act as the VM interrupt | 12 | legacy KVM_CREATE_IRQCHIP API. The created VGIC will act as the VM interrupt |
| @@ -17,7 +21,8 @@ create both a GICv3 and GICv2 device on the same VM. · 8 unmodified lines | |||
| 17 | 21 | ||
| 18 | Groups: | 22 | Groups: |
| 19 | KVM_DEV_ARM_VGIC_GRP_ADDR | 23 | KVM_DEV_ARM_VGIC_GRP_ADDR |
| 20 | Attributes: | 24 | Attributes: |
| 25 | |||
| 21 | KVM_VGIC_V2_ADDR_TYPE_DIST (rw, 64-bit) | 26 | KVM_VGIC_V2_ADDR_TYPE_DIST (rw, 64-bit) |
| 22 | Base address in the guest physical address space of the GIC distributor | 27 | Base address in the guest physical address space of the GIC distributor |
| 23 | register mappings. Only valid for KVM_DEV_TYPE_ARM_VGIC_V2. | 28 | register mappings. Only valid for KVM_DEV_TYPE_ARM_VGIC_V2. |
| @@ -27,19 +32,25 @@ Groups: · 3 unmodified lines | |||
| 27 | Base address in the guest physical address space of the GIC virtual cpu | 32 | Base address in the guest physical address space of the GIC virtual cpu |
| 28 | interface register mappings. Only valid for KVM_DEV_TYPE_ARM_VGIC_V2. | 33 | interface register mappings. Only valid for KVM_DEV_TYPE_ARM_VGIC_V2. |
| 29 | This address needs to be 4K aligned and the region covers 4 KByte. | 34 | This address needs to be 4K aligned and the region covers 4 KByte. |
| 35 | |||
| 30 | Errors: | 36 | Errors: |
| 31 | -E2BIG: Address outside of addressable IPA range | 37 | |
| 32 | -EINVAL: Incorrectly aligned address | 38 | ======= ============================================================= |
| 33 | -EEXIST: Address already configured | 39 | -E2BIG Address outside of addressable IPA range |
| 34 | -ENXIO: The group or attribute is unknown/unsupported for this device | 40 | -EINVAL Incorrectly aligned address |
| 41 | -EEXIST Address already configured | ||
| 42 | -ENXIO The group or attribute is unknown/unsupported for this device | ||
| 35 | or hardware support is missing. | 43 | or hardware support is missing. |
| 36 | -EFAULT: Invalid user pointer for attr->addr. | 44 | -EFAULT Invalid user pointer for attr->addr. |
| 45 | ======= ============================================================= | ||
| 37 | 46 | ||
| 38 | KVM_DEV_ARM_VGIC_GRP_DIST_REGS | 47 | KVM_DEV_ARM_VGIC_GRP_DIST_REGS |
| 39 | Attributes: | 48 | Attributes: |
| 40 | The attr field of kvm_device_attr encodes two values: | 49 | |
| 41 | bits: | 63 .... 40 | 39 .. 32 | 31 .... 0 | | 50 | The attr field of kvm_device_attr encodes two values:: |
| 42 | values: | reserved | vcpu_index | offset | | 51 | |
| 52 | bits: | 63 .... 40 | 39 .. 32 | 31 .... 0 | | ||
| 53 | values: | reserved | vcpu_index | offset | | ||
| 43 | 54 | ||
| 44 | All distributor regs are (rw, 32-bit) | 55 | All distributor regs are (rw, 32-bit) |
| 45 | 56 | ||
| @@ -58,16 +69,22 @@ Groups: · 12 unmodified lines | |||
| 58 | KVM_DEV_ARM_VGIC_GRP_DIST_REGS and KVM_DEV_ARM_VGIC_GRP_CPU_REGS) to ensure | 69 | KVM_DEV_ARM_VGIC_GRP_DIST_REGS and KVM_DEV_ARM_VGIC_GRP_CPU_REGS) to ensure |
| 59 | the expected behavior. Unless GICD_IIDR has been set from userspace, writes | 70 | the expected behavior. Unless GICD_IIDR has been set from userspace, writes |
| 60 | to the interrupt group registers (GICD_IGROUPR) are ignored. | 71 | to the interrupt group registers (GICD_IGROUPR) are ignored. |
| 72 | |||
| 61 | Errors: | 73 | Errors: |
| 62 | -ENXIO: Getting or setting this register is not yet supported | 74 | |
| 63 | -EBUSY: One or more VCPUs are running | 75 | ======= ===================================================== |
| 64 | -EINVAL: Invalid vcpu_index supplied | 76 | -ENXIO Getting or setting this register is not yet supported |
| 77 | -EBUSY One or more VCPUs are running | ||
| 78 | -EINVAL Invalid vcpu_index supplied | ||
| 79 | ======= ===================================================== | ||
| 65 | 80 | ||
| 66 | KVM_DEV_ARM_VGIC_GRP_CPU_REGS | 81 | KVM_DEV_ARM_VGIC_GRP_CPU_REGS |
| 67 | Attributes: | 82 | Attributes: |
| 68 | The attr field of kvm_device_attr encodes two values: | 83 | |
| 69 | bits: | 63 .... 40 | 39 .. 32 | 31 .... 0 | | 84 | The attr field of kvm_device_attr encodes two values:: |
| 70 | values: | reserved | vcpu_index | offset | | 85 | |
| 86 | bits: | 63 .... 40 | 39 .. 32 | 31 .... 0 | | ||
| 87 | values: | reserved | vcpu_index | offset | | ||
| 71 | 88 | ||
| 72 | All CPU interface regs are (rw, 32-bit) | 89 | All CPU interface regs are (rw, 32-bit) |
| 73 | 90 | ||
| @@ -101,27 +118,39 @@ Groups: · 27 unmodified lines | |||
| 101 | value left by 3 places to obtain the actual priority mask level. | 118 | value left by 3 places to obtain the actual priority mask level. |
| 102 | 119 | ||
| 103 | Errors: | 120 | Errors: |
| 104 | -ENXIO: Getting or setting this register is not yet supported | 121 | |
| 105 | -EBUSY: One or more VCPUs are running | 122 | ======= ===================================================== |
| 106 | -EINVAL: Invalid vcpu_index supplied | 123 | -ENXIO Getting or setting this register is not yet supported |
| 124 | -EBUSY One or more VCPUs are running | ||
| 125 | -EINVAL Invalid vcpu_index supplied | ||
| 126 | ======= ===================================================== | ||
| 107 | 127 | ||
| 108 | KVM_DEV_ARM_VGIC_GRP_NR_IRQS | 128 | KVM_DEV_ARM_VGIC_GRP_NR_IRQS |
| 109 | Attributes: | 129 | Attributes: |
| 130 | |||
| 110 | A value describing the number of interrupts (SGI, PPI and SPI) for | 131 | A value describing the number of interrupts (SGI, PPI and SPI) for |
| 111 | this GIC instance, ranging from 64 to 1024, in increments of 32. | 132 | this GIC instance, ranging from 64 to 1024, in increments of 32. |
| 112 | 133 | ||
| 113 | Errors: | 134 | Errors: |
| 114 | -EINVAL: Value set is out of the expected range | 135 | |
| 115 | -EBUSY: Value has already be set, or GIC has already been initialized | 136 | ======= ============================================================= |
| 116 | with default values. | 137 | -EINVAL Value set is out of the expected range |
| 138 | -EBUSY Value has already be set, or GIC has already been initialized | ||
| 139 | with default values. | ||
| 140 | ======= ============================================================= | ||
| 117 | 141 | ||
| 118 | KVM_DEV_ARM_VGIC_GRP_CTRL | 142 | KVM_DEV_ARM_VGIC_GRP_CTRL |
| 119 | Attributes: | 143 | Attributes: |
| 144 | |||
| 120 | KVM_DEV_ARM_VGIC_CTRL_INIT | 145 | KVM_DEV_ARM_VGIC_CTRL_INIT |
| 121 | request the initialization of the VGIC or ITS, no additional parameter | 146 | request the initialization of the VGIC or ITS, no additional parameter |
| 122 | in kvm_device_attr.addr. | 147 | in kvm_device_attr.addr. |
| 148 | |||
| 123 | Errors: | 149 | Errors: |
| 124 | -ENXIO: VGIC not properly configured as required prior to calling | 150 | |
| 125 | this attribute | 151 | ======= ========================================================= |
| 126 | -ENODEV: no online VCPU | 152 | -ENXIO VGIC not properly configured as required prior to calling |
| 127 | -ENOMEM: memory shortage when allocating vgic internal data | 153 | this attribute |
| 154 | -ENODEV no online VCPU | ||
| 155 | -ENOMEM memory shortage when allocating vgic internal data | ||
| 156 | ======= ========================================================= | ||
| @@ -0,0 +1,19 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ======= | ||
| 4 | Devices | ||
| 5 | ======= | ||
| 6 | |||
| 7 | .. toctree:: | ||
| 8 | :maxdepth: 2 | ||
| 9 | |||
| 10 | arm-vgic-its | ||
| 11 | arm-vgic | ||
| 12 | arm-vgic-v3 | ||
| 13 | mpic | ||
| 14 | s390_flic | ||
| 15 | vcpu | ||
| 16 | vfio | ||
| 17 | vm | ||
| 18 | xics | ||
| 19 | xive | ||
| @@ -1,9 +1,13 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ========================= | ||
| 1 | MPIC interrupt controller | 4 | MPIC interrupt controller |
| 2 | ========================= | 5 | ========================= |
| 3 | 6 | ||
| 4 | Device types supported: | 7 | Device types supported: |
| 5 | KVM_DEV_TYPE_FSL_MPIC_20 Freescale MPIC v2.0 | 8 | |
| 6 | KVM_DEV_TYPE_FSL_MPIC_42 Freescale MPIC v4.2 | 9 | - KVM_DEV_TYPE_FSL_MPIC_20 Freescale MPIC v2.0 |
| 10 | - KVM_DEV_TYPE_FSL_MPIC_42 Freescale MPIC v4.2 | ||
| 7 | 11 | ||
| 8 | Only one MPIC instance, of any type, may be instantiated. The created | 12 | Only one MPIC instance, of any type, may be instantiated. The created |
| 9 | MPIC will act as the system interrupt controller, connecting to each | 13 | MPIC will act as the system interrupt controller, connecting to each |
| @@ -11,7 +15,8 @@ vcpu's interrupt inputs. · 1 unmodified line | |||
| 11 | 15 | ||
| 12 | Groups: | 16 | Groups: |
| 13 | KVM_DEV_MPIC_GRP_MISC | 17 | KVM_DEV_MPIC_GRP_MISC |
| 14 | Attributes: | 18 | Attributes: |
| 19 | |||
| 15 | KVM_DEV_MPIC_BASE_ADDR (rw, 64-bit) | 20 | KVM_DEV_MPIC_BASE_ADDR (rw, 64-bit) |
| 16 | Base address of the 256 KiB MPIC register space. Must be | 21 | Base address of the 256 KiB MPIC register space. Must be |
| 17 | naturally aligned. A value of zero disables the mapping. | 22 | naturally aligned. A value of zero disables the mapping. |
| @@ -1,3 +1,6 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ==================================== | ||
| 1 | FLIC (floating interrupt controller) | 4 | FLIC (floating interrupt controller) |
| 2 | ==================================== | 5 | ==================================== |
| 3 | 6 | ||
| @@ -31,8 +34,10 @@ Groups: · 27 unmodified lines | |||
| 31 | Copies all floating interrupts into a buffer provided by userspace. | 34 | Copies all floating interrupts into a buffer provided by userspace. |
| 32 | When the buffer is too small it returns -ENOMEM, which is the indication | 35 | When the buffer is too small it returns -ENOMEM, which is the indication |
| 33 | for userspace to try again with a bigger buffer. | 36 | for userspace to try again with a bigger buffer. |
| 37 | |||
| 34 | -ENOBUFS is returned when the allocation of a kernelspace buffer has | 38 | -ENOBUFS is returned when the allocation of a kernelspace buffer has |
| 35 | failed. | 39 | failed. |
| 40 | |||
| 36 | -EFAULT is returned when copying data to userspace failed. | 41 | -EFAULT is returned when copying data to userspace failed. |
| 37 | All interrupts remain pending, i.e. are not deleted from the list of | 42 | All interrupts remain pending, i.e. are not deleted from the list of |
| 38 | currently pending interrupts. | 43 | currently pending interrupts. |
| @@ -60,38 +65,41 @@ Groups: · 21 unmodified lines | |||
| 60 | 65 | ||
| 61 | KVM_DEV_FLIC_ADAPTER_REGISTER | 66 | KVM_DEV_FLIC_ADAPTER_REGISTER |
| 62 | Register an I/O adapter interrupt source. Takes a kvm_s390_io_adapter | 67 | Register an I/O adapter interrupt source. Takes a kvm_s390_io_adapter |
| 63 | describing the adapter to register: | 68 | describing the adapter to register:: |
| 64 | 69 | ||
| 65 | struct kvm_s390_io_adapter { | 70 | struct kvm_s390_io_adapter { |
| 66 | __u32 id; | 71 | __u32 id; |
| 67 | __u8 isc; | 72 | __u8 isc; |
| 68 | __u8 maskable; | 73 | __u8 maskable; |
| 69 | __u8 swap; | 74 | __u8 swap; |
| 70 | __u8 flags; | 75 | __u8 flags; |
| 71 | }; | 76 | }; |
| 72 | 77 | ||
| 73 | id contains the unique id for the adapter, isc the I/O interruption subclass | 78 | id contains the unique id for the adapter, isc the I/O interruption subclass |
| 74 | to use, maskable whether this adapter may be masked (interrupts turned off), | 79 | to use, maskable whether this adapter may be masked (interrupts turned off), |
| 75 | swap whether the indicators need to be byte swapped, and flags contains | 80 | swap whether the indicators need to be byte swapped, and flags contains |
| 76 | further characteristics of the adapter. | 81 | further characteristics of the adapter. |
| 82 | |||
| 77 | Currently defined values for 'flags' are: | 83 | Currently defined values for 'flags' are: |
| 84 | |||
| 78 | - KVM_S390_ADAPTER_SUPPRESSIBLE: adapter is subject to AIS | 85 | - KVM_S390_ADAPTER_SUPPRESSIBLE: adapter is subject to AIS |
| 79 | (adapter-interrupt-suppression) facility. This flag only has an effect if | 86 | (adapter-interrupt-suppression) facility. This flag only has an effect if |
| 80 | the AIS capability is enabled. | 87 | the AIS capability is enabled. |
| 88 | |||
| 81 | Unknown flag values are ignored. | 89 | Unknown flag values are ignored. |
| 82 | 90 | ||
| 83 | 91 | ||
| 84 | KVM_DEV_FLIC_ADAPTER_MODIFY | 92 | KVM_DEV_FLIC_ADAPTER_MODIFY |
| 85 | Modifies attributes of an existing I/O adapter interrupt source. Takes | 93 | Modifies attributes of an existing I/O adapter interrupt source. Takes |
| 86 | a kvm_s390_io_adapter_req specifying the adapter and the operation: | 94 | a kvm_s390_io_adapter_req specifying the adapter and the operation:: |
| 87 | 95 | ||
| 88 | struct kvm_s390_io_adapter_req { | 96 | struct kvm_s390_io_adapter_req { |
| 89 | __u32 id; | 97 | __u32 id; |
| 90 | __u8 type; | 98 | __u8 type; |
| 91 | __u8 mask; | 99 | __u8 mask; |
| 92 | __u16 pad0; | 100 | __u16 pad0; |
| 93 | __u64 addr; | 101 | __u64 addr; |
| 94 | }; | 102 | }; |
| 95 | 103 | ||
| 96 | id specifies the adapter and type the operation. The supported operations | 104 | id specifies the adapter and type the operation. The supported operations |
| 97 | are: | 105 | are: |
| @@ -103,8 +111,9 @@ struct kvm_s390_io_adapter_req { · 5 unmodified lines | |||
| 103 | perform a gmap translation for the guest address provided in addr, | 111 | perform a gmap translation for the guest address provided in addr, |
| 104 | pin a userspace page for the translated address and add it to the | 112 | pin a userspace page for the translated address and add it to the |
| 105 | list of mappings | 113 | list of mappings |
| 106 | Note: A new mapping will be created unconditionally; therefore, | 114 | |
| 107 | the calling code should avoid making duplicate mappings. | 115 | .. note:: A new mapping will be created unconditionally; therefore, |
| 116 | the calling code should avoid making duplicate mappings. | ||
| 108 | 117 | ||
| 109 | KVM_S390_IO_ADAPTER_UNMAP | 118 | KVM_S390_IO_ADAPTER_UNMAP |
| 110 | release a userspace page for the translated address specified in addr | 119 | release a userspace page for the translated address specified in addr |
| @@ -112,16 +121,17 @@ struct kvm_s390_io_adapter_req { · 1 unmodified line | |||
| 112 | 121 | ||
| 113 | KVM_DEV_FLIC_AISM | 122 | KVM_DEV_FLIC_AISM |
| 114 | modify the adapter-interruption-suppression mode for a given isc if the | 123 | modify the adapter-interruption-suppression mode for a given isc if the |
| 115 | AIS capability is enabled. Takes a kvm_s390_ais_req describing: | 124 | AIS capability is enabled. Takes a kvm_s390_ais_req describing:: |
| 116 | 125 | ||
| 117 | struct kvm_s390_ais_req { | 126 | struct kvm_s390_ais_req { |
| 118 | __u8 isc; | 127 | __u8 isc; |
| 119 | __u16 mode; | 128 | __u16 mode; |
| 120 | }; | 129 | }; |
| 121 | 130 | ||
| 122 | isc contains the target I/O interruption subclass, mode the target | 131 | isc contains the target I/O interruption subclass, mode the target |
| 123 | adapter-interruption-suppression mode. The following modes are | 132 | adapter-interruption-suppression mode. The following modes are |
| 124 | currently supported: | 133 | currently supported: |
| 134 | |||
| 125 | - KVM_S390_AIS_MODE_ALL: ALL-Interruptions Mode, i.e. airq injection | 135 | - KVM_S390_AIS_MODE_ALL: ALL-Interruptions Mode, i.e. airq injection |
| 126 | is always allowed; | 136 | is always allowed; |
| 127 | - KVM_S390_AIS_MODE_SINGLE: SINGLE-Interruption Mode, i.e. airq | 137 | - KVM_S390_AIS_MODE_SINGLE: SINGLE-Interruption Mode, i.e. airq |
| @@ -139,12 +149,12 @@ struct kvm_s390_ais_req { · 11 unmodified lines | |||
| 139 | 149 | ||
| 140 | KVM_DEV_FLIC_AISM_ALL | 150 | KVM_DEV_FLIC_AISM_ALL |
| 141 | Gets or sets the adapter-interruption-suppression mode for all ISCs. Takes | 151 | Gets or sets the adapter-interruption-suppression mode for all ISCs. Takes |
| 142 | a kvm_s390_ais_all describing: | 152 | a kvm_s390_ais_all describing:: |
| 143 | 153 | ||
| 144 | struct kvm_s390_ais_all { | 154 | struct kvm_s390_ais_all { |
| 145 | __u8 simm; /* Single-Interruption-Mode mask */ | 155 | __u8 simm; /* Single-Interruption-Mode mask */ |
| 146 | __u8 nimm; /* No-Interruption-Mode mask * | 156 | __u8 nimm; /* No-Interruption-Mode mask * |
| 147 | }; | 157 | }; |
| 148 | 158 | ||
| 149 | simm contains Single-Interruption-Mode mask for all ISCs, nimm contains | 159 | simm contains Single-Interruption-Mode mask for all ISCs, nimm contains |
| 150 | No-Interruption-Mode mask for all ISCs. Each bit in simm and nimm corresponds | 160 | No-Interruption-Mode mask for all ISCs. Each bit in simm and nimm corresponds |
| @@ -159,5 +169,5 @@ ENXIO, as specified in the API documentation). It is not possible to conclude · 8 unmodified lines | |||
| 159 | that a FLIC operation is unavailable based on the error code resulting from a | 169 | that a FLIC operation is unavailable based on the error code resulting from a |
| 160 | usage attempt. | 170 | usage attempt. |
| 161 | 171 | ||
| 162 | Note: The KVM_DEV_FLIC_CLEAR_IO_IRQ ioctl will return EINVAL in case a zero | 172 | .. note:: The KVM_DEV_FLIC_CLEAR_IO_IRQ ioctl will return EINVAL in case a |
| 163 | schid is specified. | 173 | zero schid is specified. |
| @@ -0,0 +1,114 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ====================== | ||
| 4 | Generic vcpu interface | ||
| 5 | ====================== | ||
| 6 | |||
| 7 | The virtual cpu "device" also accepts the ioctls KVM_SET_DEVICE_ATTR, | ||
| 8 | KVM_GET_DEVICE_ATTR, and KVM_HAS_DEVICE_ATTR. The interface uses the same struct | ||
| 9 | kvm_device_attr as other devices, but targets VCPU-wide settings and controls. | ||
| 10 | |||
| 11 | The groups and attributes per virtual cpu, if any, are architecture specific. | ||
| 12 | |||
| 13 | 1. GROUP: KVM_ARM_VCPU_PMU_V3_CTRL | ||
| 14 | ================================== | ||
| 15 | |||
| 16 | :Architectures: ARM64 | ||
| 17 | |||
| 18 | 1.1. ATTRIBUTE: KVM_ARM_VCPU_PMU_V3_IRQ | ||
| 19 | --------------------------------------- | ||
| 20 | |||
| 21 | :Parameters: in kvm_device_attr.addr the address for PMU overflow interrupt is a | ||
| 22 | pointer to an int | ||
| 23 | |||
| 24 | Returns: | ||
| 25 | |||
| 26 | ======= ======================================================== | ||
| 27 | -EBUSY The PMU overflow interrupt is already set | ||
| 28 | -ENXIO The overflow interrupt not set when attempting to get it | ||
| 29 | -ENODEV PMUv3 not supported | ||
| 30 | -EINVAL Invalid PMU overflow interrupt number supplied or | ||
| 31 | trying to set the IRQ number without using an in-kernel | ||
| 32 | irqchip. | ||
| 33 | ======= ======================================================== | ||
| 34 | |||
| 35 | A value describing the PMUv3 (Performance Monitor Unit v3) overflow interrupt | ||
| 36 | number for this vcpu. This interrupt could be a PPI or SPI, but the interrupt | ||
| 37 | type must be same for each vcpu. As a PPI, the interrupt number is the same for | ||
| 38 | all vcpus, while as an SPI it must be a separate number per vcpu. | ||
| 39 | |||
| 40 | 1.2 ATTRIBUTE: KVM_ARM_VCPU_PMU_V3_INIT | ||
| 41 | --------------------------------------- | ||
| 42 | |||
| 43 | :Parameters: no additional parameter in kvm_device_attr.addr | ||
| 44 | |||
| 45 | Returns: | ||
| 46 | |||
| 47 | ======= ====================================================== | ||
| 48 | -ENODEV PMUv3 not supported or GIC not initialized | ||
| 49 | -ENXIO PMUv3 not properly configured or in-kernel irqchip not | ||
| 50 | configured as required prior to calling this attribute | ||
| 51 | -EBUSY PMUv3 already initialized | ||
| 52 | ======= ====================================================== | ||
| 53 | |||
| 54 | Request the initialization of the PMUv3. If using the PMUv3 with an in-kernel | ||
| 55 | virtual GIC implementation, this must be done after initializing the in-kernel | ||
| 56 | irqchip. | ||
| 57 | |||
| 58 | |||
| 59 | 2. GROUP: KVM_ARM_VCPU_TIMER_CTRL | ||
| 60 | ================================= | ||
| 61 | |||
| 62 | :Architectures: ARM, ARM64 | ||
| 63 | |||
| 64 | 2.1. ATTRIBUTES: KVM_ARM_VCPU_TIMER_IRQ_VTIMER, KVM_ARM_VCPU_TIMER_IRQ_PTIMER | ||
| 65 | ----------------------------------------------------------------------------- | ||
| 66 | |||
| 67 | :Parameters: in kvm_device_attr.addr the address for the timer interrupt is a | ||
| 68 | pointer to an int | ||
| 69 | |||
| 70 | Returns: | ||
| 71 | |||
| 72 | ======= ================================= | ||
| 73 | -EINVAL Invalid timer interrupt number | ||
| 74 | -EBUSY One or more VCPUs has already run | ||
| 75 | ======= ================================= | ||
| 76 | |||
| 77 | A value describing the architected timer interrupt number when connected to an | ||
| 78 | in-kernel virtual GIC. These must be a PPI (16 <= intid < 32). Setting the | ||
| 79 | attribute overrides the default values (see below). | ||
| 80 | |||
| 81 | ============================= ========================================== | ||
| 82 | KVM_ARM_VCPU_TIMER_IRQ_VTIMER The EL1 virtual timer intid (default: 27) | ||
| 83 | KVM_ARM_VCPU_TIMER_IRQ_PTIMER The EL1 physical timer intid (default: 30) | ||
| 84 | ============================= ========================================== | ||
| 85 | |||
| 86 | Setting the same PPI for different timers will prevent the VCPUs from running. | ||
| 87 | Setting the interrupt number on a VCPU configures all VCPUs created at that | ||
| 88 | time to use the number provided for a given timer, overwriting any previously | ||
| 89 | configured values on other VCPUs. Userspace should configure the interrupt | ||
| 90 | numbers on at least one VCPU after creating all VCPUs and before running any | ||
| 91 | VCPUs. | ||
| 92 | |||
| 93 | 3. GROUP: KVM_ARM_VCPU_PVTIME_CTRL | ||
| 94 | ================================== | ||
| 95 | |||
| 96 | :Architectures: ARM64 | ||
| 97 | |||
| 98 | 3.1 ATTRIBUTE: KVM_ARM_VCPU_PVTIME_IPA | ||
| 99 | -------------------------------------- | ||
| 100 | |||
| 101 | :Parameters: 64-bit base address | ||
| 102 | |||
| 103 | Returns: | ||
| 104 | |||
| 105 | ======= ====================================== | ||
| 106 | -ENXIO Stolen time not implemented | ||
| 107 | -EEXIST Base address already set for this VCPU | ||
| 108 | -EINVAL Base address not 64 byte aligned | ||
| 109 | ======= ====================================== | ||
| 110 | |||
| 111 | Specifies the base address of the stolen time structure for this VCPU. The | ||
| 112 | base address must be 64 byte aligned and exist within a valid guest memory | ||
| 113 | region. See Documentation/virt/kvm/arm/pvtime.txt for more information | ||
| 114 | including the layout of the stolen time structure. | ||
| @@ -1,76 +0,0 @@ | |||
| 1 | Generic vcpu interface | ||
| 2 | ==================================== | ||
| 3 | |||
| 4 | The virtual cpu "device" also accepts the ioctls KVM_SET_DEVICE_ATTR, | ||
| 5 | KVM_GET_DEVICE_ATTR, and KVM_HAS_DEVICE_ATTR. The interface uses the same struct | ||
| 6 | kvm_device_attr as other devices, but targets VCPU-wide settings and controls. | ||
| 7 | |||
| 8 | The groups and attributes per virtual cpu, if any, are architecture specific. | ||
| 9 | |||
| 10 | 1. GROUP: KVM_ARM_VCPU_PMU_V3_CTRL | ||
| 11 | Architectures: ARM64 | ||
| 12 | |||
| 13 | 1.1. ATTRIBUTE: KVM_ARM_VCPU_PMU_V3_IRQ | ||
| 14 | Parameters: in kvm_device_attr.addr the address for PMU overflow interrupt is a | ||
| 15 | pointer to an int | ||
| 16 | Returns: -EBUSY: The PMU overflow interrupt is already set | ||
| 17 | -ENXIO: The overflow interrupt not set when attempting to get it | ||
| 18 | -ENODEV: PMUv3 not supported | ||
| 19 | -EINVAL: Invalid PMU overflow interrupt number supplied or | ||
| 20 | trying to set the IRQ number without using an in-kernel | ||
| 21 | irqchip. | ||
| 22 | |||
| 23 | A value describing the PMUv3 (Performance Monitor Unit v3) overflow interrupt | ||
| 24 | number for this vcpu. This interrupt could be a PPI or SPI, but the interrupt | ||
| 25 | type must be same for each vcpu. As a PPI, the interrupt number is the same for | ||
| 26 | all vcpus, while as an SPI it must be a separate number per vcpu. | ||
| 27 | |||
| 28 | 1.2 ATTRIBUTE: KVM_ARM_VCPU_PMU_V3_INIT | ||
| 29 | Parameters: no additional parameter in kvm_device_attr.addr | ||
| 30 | Returns: -ENODEV: PMUv3 not supported or GIC not initialized | ||
| 31 | -ENXIO: PMUv3 not properly configured or in-kernel irqchip not | ||
| 32 | configured as required prior to calling this attribute | ||
| 33 | -EBUSY: PMUv3 already initialized | ||
| 34 | |||
| 35 | Request the initialization of the PMUv3. If using the PMUv3 with an in-kernel | ||
| 36 | virtual GIC implementation, this must be done after initializing the in-kernel | ||
| 37 | irqchip. | ||
| 38 | |||
| 39 | |||
| 40 | 2. GROUP: KVM_ARM_VCPU_TIMER_CTRL | ||
| 41 | Architectures: ARM,ARM64 | ||
| 42 | |||
| 43 | 2.1. ATTRIBUTE: KVM_ARM_VCPU_TIMER_IRQ_VTIMER | ||
| 44 | 2.2. ATTRIBUTE: KVM_ARM_VCPU_TIMER_IRQ_PTIMER | ||
| 45 | Parameters: in kvm_device_attr.addr the address for the timer interrupt is a | ||
| 46 | pointer to an int | ||
| 47 | Returns: -EINVAL: Invalid timer interrupt number | ||
| 48 | -EBUSY: One or more VCPUs has already run | ||
| 49 | |||
| 50 | A value describing the architected timer interrupt number when connected to an | ||
| 51 | in-kernel virtual GIC. These must be a PPI (16 <= intid < 32). Setting the | ||
| 52 | attribute overrides the default values (see below). | ||
| 53 | |||
| 54 | KVM_ARM_VCPU_TIMER_IRQ_VTIMER: The EL1 virtual timer intid (default: 27) | ||
| 55 | KVM_ARM_VCPU_TIMER_IRQ_PTIMER: The EL1 physical timer intid (default: 30) | ||
| 56 | |||
| 57 | Setting the same PPI for different timers will prevent the VCPUs from running. | ||
| 58 | Setting the interrupt number on a VCPU configures all VCPUs created at that | ||
| 59 | time to use the number provided for a given timer, overwriting any previously | ||
| 60 | configured values on other VCPUs. Userspace should configure the interrupt | ||
| 61 | numbers on at least one VCPU after creating all VCPUs and before running any | ||
| 62 | VCPUs. | ||
| 63 | |||
| 64 | 3. GROUP: KVM_ARM_VCPU_PVTIME_CTRL | ||
| 65 | Architectures: ARM64 | ||
| 66 | |||
| 67 | 3.1 ATTRIBUTE: KVM_ARM_VCPU_PVTIME_IPA | ||
| 68 | Parameters: 64-bit base address | ||
| 69 | Returns: -ENXIO: Stolen time not implemented | ||
| 70 | -EEXIST: Base address already set for this VCPU | ||
| 71 | -EINVAL: Base address not 64 byte aligned | ||
| 72 | |||
| 73 | Specifies the base address of the stolen time structure for this VCPU. The | ||
| 74 | base address must be 64 byte aligned and exist within a valid guest memory | ||
| 75 | region. See Documentation/virt/kvm/arm/pvtime.txt for more information | ||
| 76 | including the layout of the stolen time structure. | ||
| @@ -1,8 +1,12 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | =================== | ||
| 1 | VFIO virtual device | 4 | VFIO virtual device |
| 2 | =================== | 5 | =================== |
| 3 | 6 | ||
| 4 | Device types supported: | 7 | Device types supported: |
| 5 | KVM_DEV_TYPE_VFIO | 8 | |
| 9 | - KVM_DEV_TYPE_VFIO | ||
| 6 | 10 | ||
| 7 | Only one VFIO instance may be created per VM. The created device | 11 | Only one VFIO instance may be created per VM. The created device |
| 8 | tracks VFIO groups in use by the VM and features of those groups | 12 | tracks VFIO groups in use by the VM and features of those groups |
| @@ -23,14 +27,15 @@ KVM_DEV_VFIO_GROUP attributes: · 14 unmodified lines | |||
| 23 | for the VFIO group. | 27 | for the VFIO group. |
| 24 | KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: attaches a guest visible TCE table | 28 | KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: attaches a guest visible TCE table |
| 25 | allocated by sPAPR KVM. | 29 | allocated by sPAPR KVM. |
| 26 | kvm_device_attr.addr points to a struct: | 30 | kvm_device_attr.addr points to a struct:: |
| 31 | |||
| 32 | struct kvm_vfio_spapr_tce { | ||
| 33 | __s32 groupfd; | ||
| 34 | __s32 tablefd; | ||
| 35 | }; | ||
| 27 | 36 | ||
| 28 | struct kvm_vfio_spapr_tce { | 37 | where: |
| 29 | __s32 groupfd; | ||
| 30 | __s32 tablefd; | ||
| 31 | }; | ||
| 32 | 38 | ||
| 33 | where | 39 | - @groupfd is a file descriptor for a VFIO group; |
| 34 | @groupfd is a file descriptor for a VFIO group; | 40 | - @tablefd is a file descriptor for a TCE table allocated via |
| 35 | @tablefd is a file descriptor for a TCE table allocated via | 41 | KVM_CREATE_SPAPR_TCE. |
| 36 | KVM_CREATE_SPAPR_TCE. | ||
| @@ -1,5 +1,8 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ==================== | ||
| 1 | Generic vm interface | 4 | Generic vm interface |
| 2 | ==================================== | 5 | ==================== |
| 3 | 6 | ||
| 4 | The virtual machine "device" also accepts the ioctls KVM_SET_DEVICE_ATTR, | 7 | The virtual machine "device" also accepts the ioctls KVM_SET_DEVICE_ATTR, |
| 5 | KVM_GET_DEVICE_ATTR, and KVM_HAS_DEVICE_ATTR. The interface uses the same | 8 | KVM_GET_DEVICE_ATTR, and KVM_HAS_DEVICE_ATTR. The interface uses the same |
| @@ -10,30 +13,38 @@ The groups and attributes per virtual machine, if any, are architecture · 4 unmodified lines | |||
| 10 | specific. | 13 | specific. |
| 11 | 14 | ||
| 12 | 1. GROUP: KVM_S390_VM_MEM_CTRL | 15 | 1. GROUP: KVM_S390_VM_MEM_CTRL |
| 13 | Architectures: s390 | 16 | ============================== |
| 17 | |||
| 18 | :Architectures: s390 | ||
| 14 | 19 | ||
| 15 | 1.1. ATTRIBUTE: KVM_S390_VM_MEM_ENABLE_CMMA | 20 | 1.1. ATTRIBUTE: KVM_S390_VM_MEM_ENABLE_CMMA |
| 16 | Parameters: none | 21 | ------------------------------------------- |
| 17 | Returns: -EBUSY if a vcpu is already defined, otherwise 0 | 22 | |
| 23 | :Parameters: none | ||
| 24 | :Returns: -EBUSY if a vcpu is already defined, otherwise 0 | ||
| 18 | 25 | ||
| 19 | Enables Collaborative Memory Management Assist (CMMA) for the virtual machine. | 26 | Enables Collaborative Memory Management Assist (CMMA) for the virtual machine. |
| 20 | 27 | ||
| 21 | 1.2. ATTRIBUTE: KVM_S390_VM_MEM_CLR_CMMA | 28 | 1.2. ATTRIBUTE: KVM_S390_VM_MEM_CLR_CMMA |
| 22 | Parameters: none | 29 | ---------------------------------------- |
| 23 | Returns: -EINVAL if CMMA was not enabled | 30 | |
| 24 | 0 otherwise | 31 | :Parameters: none |
| 32 | :Returns: -EINVAL if CMMA was not enabled; | ||
| 33 | 0 otherwise | ||
| 25 | 34 | ||
| 26 | Clear the CMMA status for all guest pages, so any pages the guest marked | 35 | Clear the CMMA status for all guest pages, so any pages the guest marked |
| 27 | as unused are again used any may not be reclaimed by the host. | 36 | as unused are again used any may not be reclaimed by the host. |
| 28 | 37 | ||
| 29 | 1.3. ATTRIBUTE KVM_S390_VM_MEM_LIMIT_SIZE | 38 | 1.3. ATTRIBUTE KVM_S390_VM_MEM_LIMIT_SIZE |
| 30 | Parameters: in attr->addr the address for the new limit of guest memory | 39 | ----------------------------------------- |
| 31 | Returns: -EFAULT if the given address is not accessible | 40 | |
| 32 | -EINVAL if the virtual machine is of type UCONTROL | 41 | :Parameters: in attr->addr the address for the new limit of guest memory |
| 33 | -E2BIG if the given guest memory is to big for that machine | 42 | :Returns: -EFAULT if the given address is not accessible; |
| 34 | -EBUSY if a vcpu is already defined | 43 | -EINVAL if the virtual machine is of type UCONTROL; |
| 35 | -ENOMEM if not enough memory is available for a new shadow guest mapping | 44 | -E2BIG if the given guest memory is to big for that machine; |
| 36 | 0 otherwise | 45 | -EBUSY if a vcpu is already defined; |
| 46 | -ENOMEM if not enough memory is available for a new shadow guest mapping; | ||
| 47 | 0 otherwise. | ||
| 37 | 48 | ||
| 38 | Allows userspace to query the actual limit and set a new limit for | 49 | Allows userspace to query the actual limit and set a new limit for |
| 39 | the maximum guest memory size. The limit will be rounded up to | 50 | the maximum guest memory size. The limit will be rounded up to |
| @@ -42,78 +53,92 @@ the number of page table levels. In the case that there is no limit we will set · 2 unmodified lines | |||
| 42 | the limit to KVM_S390_NO_MEM_LIMIT (U64_MAX). | 53 | the limit to KVM_S390_NO_MEM_LIMIT (U64_MAX). |
| 43 | 54 | ||
| 44 | 2. GROUP: KVM_S390_VM_CPU_MODEL | 55 | 2. GROUP: KVM_S390_VM_CPU_MODEL |
| 45 | Architectures: s390 | 56 | =============================== |
| 57 | |||
| 58 | :Architectures: s390 | ||
| 46 | 59 | ||
| 47 | 2.1. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE (r/o) | 60 | 2.1. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE (r/o) |
| 61 | --------------------------------------------- | ||
| 48 | 62 | ||
| 49 | Allows user space to retrieve machine and kvm specific cpu related information: | 63 | Allows user space to retrieve machine and kvm specific cpu related information:: |
| 50 | 64 | ||
| 51 | struct kvm_s390_vm_cpu_machine { | 65 | struct kvm_s390_vm_cpu_machine { |
| 52 | __u64 cpuid; # CPUID of host | 66 | __u64 cpuid; # CPUID of host |
| 53 | __u32 ibc; # IBC level range offered by host | 67 | __u32 ibc; # IBC level range offered by host |
| 54 | __u8 pad[4]; | 68 | __u8 pad[4]; |
| 55 | __u64 fac_mask[256]; # set of cpu facilities enabled by KVM | 69 | __u64 fac_mask[256]; # set of cpu facilities enabled by KVM |
| 56 | __u64 fac_list[256]; # set of cpu facilities offered by host | 70 | __u64 fac_list[256]; # set of cpu facilities offered by host |
| 57 | } | 71 | } |
| 58 | 72 | ||
| 59 | Parameters: address of buffer to store the machine related cpu data | 73 | :Parameters: address of buffer to store the machine related cpu data |
| 60 | of type struct kvm_s390_vm_cpu_machine* | 74 | of type struct kvm_s390_vm_cpu_machine* |
| 61 | Returns: -EFAULT if the given address is not accessible from kernel space | 75 | :Returns: -EFAULT if the given address is not accessible from kernel space; |
| 62 | -ENOMEM if not enough memory is available to process the ioctl | 76 | -ENOMEM if not enough memory is available to process the ioctl; |
| 63 | 0 in case of success | 77 | 0 in case of success. |
| 64 | 78 | ||
| 65 | 2.2. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR (r/w) | 79 | 2.2. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR (r/w) |
| 80 | =============================================== | ||
| 66 | 81 | ||
| 67 | Allows user space to retrieve or request to change cpu related information for a vcpu: | 82 | Allows user space to retrieve or request to change cpu related information for a vcpu:: |
| 68 | 83 | ||
| 69 | struct kvm_s390_vm_cpu_processor { | 84 | struct kvm_s390_vm_cpu_processor { |
| 70 | __u64 cpuid; # CPUID currently (to be) used by this vcpu | 85 | __u64 cpuid; # CPUID currently (to be) used by this vcpu |
| 71 | __u16 ibc; # IBC level currently (to be) used by this vcpu | 86 | __u16 ibc; # IBC level currently (to be) used by this vcpu |
| 72 | __u8 pad[6]; | 87 | __u8 pad[6]; |
| 73 | __u64 fac_list[256]; # set of cpu facilities currently (to be) used | 88 | __u64 fac_list[256]; # set of cpu facilities currently (to be) used |
| 74 | # by this vcpu | 89 | # by this vcpu |
| 75 | } | 90 | } |
| 76 | 91 | ||
| 77 | KVM does not enforce or limit the cpu model data in any form. Take the information | 92 | KVM does not enforce or limit the cpu model data in any form. Take the information |
| 78 | retrieved by means of KVM_S390_VM_CPU_MACHINE as hint for reasonable configuration | 93 | retrieved by means of KVM_S390_VM_CPU_MACHINE as hint for reasonable configuration |
| 79 | setups. Instruction interceptions triggered by additionally set facility bits that | 94 | setups. Instruction interceptions triggered by additionally set facility bits that |
| 80 | are not handled by KVM need to by imlemented in the VM driver code. | 95 | are not handled by KVM need to by imlemented in the VM driver code. |
| 81 | 96 | ||
| 82 | Parameters: address of buffer to store/set the processor related cpu | 97 | :Parameters: address of buffer to store/set the processor related cpu |
| 83 | data of type struct kvm_s390_vm_cpu_processor*. | 98 | data of type struct kvm_s390_vm_cpu_processor*. |
| 84 | Returns: -EBUSY in case 1 or more vcpus are already activated (only in write case) | 99 | :Returns: -EBUSY in case 1 or more vcpus are already activated (only in write case); |
| 85 | -EFAULT if the given address is not accessible from kernel space | 100 | -EFAULT if the given address is not accessible from kernel space; |
| 86 | -ENOMEM if not enough memory is available to process the ioctl | 101 | -ENOMEM if not enough memory is available to process the ioctl; |
| 87 | 0 in case of success | 102 | 0 in case of success. |
| 103 | |||
| 104 | .. _KVM_S390_VM_CPU_MACHINE_FEAT: | ||
| 88 | 105 | ||
| 89 | 2.3. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_FEAT (r/o) | 106 | 2.3. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_FEAT (r/o) |
| 107 | -------------------------------------------------- | ||
| 90 | 108 | ||
| 91 | Allows user space to retrieve available cpu features. A feature is available if | 109 | Allows user space to retrieve available cpu features. A feature is available if |
| 92 | provided by the hardware and supported by kvm. In theory, cpu features could | 110 | provided by the hardware and supported by kvm. In theory, cpu features could |
| 93 | even be completely emulated by kvm. | 111 | even be completely emulated by kvm. |
| 94 | 112 | ||
| 95 | struct kvm_s390_vm_cpu_feat { | 113 | :: |
| 96 | __u64 feat[16]; # Bitmap (1 = feature available), MSB 0 bit numbering | ||
| 97 | }; | ||
| 98 | 114 | ||
| 99 | Parameters: address of a buffer to load the feature list from. | 115 | struct kvm_s390_vm_cpu_feat { |
| 100 | Returns: -EFAULT if the given address is not accessible from kernel space. | 116 | __u64 feat[16]; # Bitmap (1 = feature available), MSB 0 bit numbering |
| 101 | 0 in case of success. | 117 | }; |
| 118 | |||
| 119 | :Parameters: address of a buffer to load the feature list from. | ||
| 120 | :Returns: -EFAULT if the given address is not accessible from kernel space; | ||
| 121 | 0 in case of success. | ||
| 102 | 122 | ||
| 103 | 2.4. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR_FEAT (r/w) | 123 | 2.4. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR_FEAT (r/w) |
| 124 | ---------------------------------------------------- | ||
| 104 | 125 | ||
| 105 | Allows user space to retrieve or change enabled cpu features for all VCPUs of a | 126 | Allows user space to retrieve or change enabled cpu features for all VCPUs of a |
| 106 | VM. Features that are not available cannot be enabled. | 127 | VM. Features that are not available cannot be enabled. |
| 107 | 128 | ||
| 108 | See 2.3. for a description of the parameter struct. | 129 | See :ref:`KVM_S390_VM_CPU_MACHINE_FEAT` for |
| 130 | a description of the parameter struct. | ||
| 109 | 131 | ||
| 110 | Parameters: address of a buffer to store/load the feature list from. | 132 | :Parameters: address of a buffer to store/load the feature list from. |
| 111 | Returns: -EFAULT if the given address is not accessible from kernel space. | 133 | :Returns: -EFAULT if the given address is not accessible from kernel space; |
| 112 | -EINVAL if a cpu feature that is not available is to be enabled. | 134 | -EINVAL if a cpu feature that is not available is to be enabled; |
| 113 | -EBUSY if at least one VCPU has already been defined. | 135 | -EBUSY if at least one VCPU has already been defined; |
| 114 | 0 in case of success. | 136 | 0 in case of success. |
| 115 | 137 | ||
| 138 | .. _KVM_S390_VM_CPU_MACHINE_SUBFUNC: | ||
| 139 | |||
| 116 | 2.5. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_SUBFUNC (r/o) | 140 | 2.5. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_SUBFUNC (r/o) |
| 141 | ----------------------------------------------------- | ||
| 117 | 142 | ||
| 118 | Allows user space to retrieve available cpu subfunctions without any filtering | 143 | Allows user space to retrieve available cpu subfunctions without any filtering |
| 119 | done by a set IBC. These subfunctions are indicated to the guest VCPU via | 144 | done by a set IBC. These subfunctions are indicated to the guest VCPU via |
| @@ -126,7 +151,9 @@ contained in the returned struct. If the affected instruction · 6 unmodified lines | |||
| 126 | indicates subfunctions via a "test bit" mechanism, the subfunction codes are | 151 | indicates subfunctions via a "test bit" mechanism, the subfunction codes are |
| 127 | contained in the returned struct in MSB 0 bit numbering. | 152 | contained in the returned struct in MSB 0 bit numbering. |
| 128 | 153 | ||
| 129 | struct kvm_s390_vm_cpu_subfunc { | 154 | :: |
| 155 | |||
| 156 | struct kvm_s390_vm_cpu_subfunc { | ||
| 130 | u8 plo[32]; # always valid (ESA/390 feature) | 157 | u8 plo[32]; # always valid (ESA/390 feature) |
| 131 | u8 ptff[16]; # valid with TOD-clock steering | 158 | u8 ptff[16]; # valid with TOD-clock steering |
| 132 | u8 kmac[16]; # valid with Message-Security-Assist | 159 | u8 kmac[16]; # valid with Message-Security-Assist |
| @@ -143,13 +170,14 @@ struct kvm_s390_vm_cpu_subfunc { · 10 unmodified lines | |||
| 143 | u8 kma[16]; # valid with Message-Security-Assist-Extension 8 | 170 | u8 kma[16]; # valid with Message-Security-Assist-Extension 8 |
| 144 | u8 kdsa[16]; # valid with Message-Security-Assist-Extension 9 | 171 | u8 kdsa[16]; # valid with Message-Security-Assist-Extension 9 |
| 145 | u8 reserved[1792]; # reserved for future instructions | 172 | u8 reserved[1792]; # reserved for future instructions |
| 146 | }; | 173 | }; |
| 147 | 174 | ||
| 148 | Parameters: address of a buffer to load the subfunction blocks from. | 175 | :Parameters: address of a buffer to load the subfunction blocks from. |
| 149 | Returns: -EFAULT if the given address is not accessible from kernel space. | 176 | :Returns: -EFAULT if the given address is not accessible from kernel space; |
| 150 | 0 in case of success. | 177 | 0 in case of success. |
| 151 | 178 | ||
| 152 | 2.6. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR_SUBFUNC (r/w) | 179 | 2.6. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR_SUBFUNC (r/w) |
| 180 | ------------------------------------------------------- | ||
| 153 | 181 | ||
| 154 | Allows user space to retrieve or change cpu subfunctions to be indicated for | 182 | Allows user space to retrieve or change cpu subfunctions to be indicated for |
| 155 | all VCPUs of a VM. This attribute will only be available if kernel and | 183 | all VCPUs of a VM. This attribute will only be available if kernel and |
| @@ -164,107 +192,125 @@ As long as no data has been written, a read will fail. The IBC will be used · 8 unmodified lines | |||
| 164 | to determine available subfunctions in this case, this will guarantee backward | 192 | to determine available subfunctions in this case, this will guarantee backward |
| 165 | compatibility. | 193 | compatibility. |
| 166 | 194 | ||
| 167 | See 2.5. for a description of the parameter struct. | 195 | See :ref:`KVM_S390_VM_CPU_MACHINE_SUBFUNC` for a |
| 196 | description of the parameter struct. | ||
| 168 | 197 | ||
| 169 | Parameters: address of a buffer to store/load the subfunction blocks from. | 198 | :Parameters: address of a buffer to store/load the subfunction blocks from. |
| 170 | Returns: -EFAULT if the given address is not accessible from kernel space. | 199 | :Returns: -EFAULT if the given address is not accessible from kernel space; |
| 171 | -EINVAL when reading, if there was no write yet. | 200 | -EINVAL when reading, if there was no write yet; |
| 172 | -EBUSY if at least one VCPU has already been defined. | 201 | -EBUSY if at least one VCPU has already been defined; |
| 173 | 0 in case of success. | 202 | 0 in case of success. |
| 174 | 203 | ||
| 175 | 3. GROUP: KVM_S390_VM_TOD | 204 | 3. GROUP: KVM_S390_VM_TOD |
| 176 | Architectures: s390 | 205 | ========================= |
| 206 | |||
| 207 | :Architectures: s390 | ||
| 177 | 208 | ||
| 178 | 3.1. ATTRIBUTE: KVM_S390_VM_TOD_HIGH | 209 | 3.1. ATTRIBUTE: KVM_S390_VM_TOD_HIGH |
| 210 | ------------------------------------ | ||
| 179 | 211 | ||
| 180 | Allows user space to set/get the TOD clock extension (u8) (superseded by | 212 | Allows user space to set/get the TOD clock extension (u8) (superseded by |
| 181 | KVM_S390_VM_TOD_EXT). | 213 | KVM_S390_VM_TOD_EXT). |
| 182 | 214 | ||
| 183 | Parameters: address of a buffer in user space to store the data (u8) to | 215 | :Parameters: address of a buffer in user space to store the data (u8) to |
| 184 | Returns: -EFAULT if the given address is not accessible from kernel space | 216 | :Returns: -EFAULT if the given address is not accessible from kernel space; |
| 185 | -EINVAL if setting the TOD clock extension to != 0 is not supported | 217 | -EINVAL if setting the TOD clock extension to != 0 is not supported |
| 186 | 218 | ||
| 187 | 3.2. ATTRIBUTE: KVM_S390_VM_TOD_LOW | 219 | 3.2. ATTRIBUTE: KVM_S390_VM_TOD_LOW |
| 220 | ----------------------------------- | ||
| 188 | 221 | ||
| 189 | Allows user space to set/get bits 0-63 of the TOD clock register as defined in | 222 | Allows user space to set/get bits 0-63 of the TOD clock register as defined in |
| 190 | the POP (u64). | 223 | the POP (u64). |
| 191 | 224 | ||
| 192 | Parameters: address of a buffer in user space to store the data (u64) to | 225 | :Parameters: address of a buffer in user space to store the data (u64) to |
| 193 | Returns: -EFAULT if the given address is not accessible from kernel space | 226 | :Returns: -EFAULT if the given address is not accessible from kernel space |
| 194 | 227 | ||
| 195 | 3.3. ATTRIBUTE: KVM_S390_VM_TOD_EXT | 228 | 3.3. ATTRIBUTE: KVM_S390_VM_TOD_EXT |
| 229 | ----------------------------------- | ||
| 230 | |||
| 196 | Allows user space to set/get bits 0-63 of the TOD clock register as defined in | 231 | Allows user space to set/get bits 0-63 of the TOD clock register as defined in |
| 197 | the POP (u64). If the guest CPU model supports the TOD clock extension (u8), it | 232 | the POP (u64). If the guest CPU model supports the TOD clock extension (u8), it |
| 198 | also allows user space to get/set it. If the guest CPU model does not support | 233 | also allows user space to get/set it. If the guest CPU model does not support |
| 199 | it, it is stored as 0 and not allowed to be set to a value != 0. | 234 | it, it is stored as 0 and not allowed to be set to a value != 0. |
| 200 | 235 | ||
| 201 | Parameters: address of a buffer in user space to store the data | 236 | :Parameters: address of a buffer in user space to store the data |
| 202 | (kvm_s390_vm_tod_clock) to | 237 | (kvm_s390_vm_tod_clock) to |
| 203 | Returns: -EFAULT if the given address is not accessible from kernel space | 238 | :Returns: -EFAULT if the given address is not accessible from kernel space; |
| 204 | -EINVAL if setting the TOD clock extension to != 0 is not supported | 239 | -EINVAL if setting the TOD clock extension to != 0 is not supported |
| 205 | 240 | ||
| 206 | 4. GROUP: KVM_S390_VM_CRYPTO | 241 | 4. GROUP: KVM_S390_VM_CRYPTO |
| 207 | Architectures: s390 | 242 | ============================ |
| 243 | |||
| 244 | :Architectures: s390 | ||
| 208 | 245 | ||
| 209 | 4.1. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_AES_KW (w/o) | 246 | 4.1. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_AES_KW (w/o) |
| 247 | ------------------------------------------------------ | ||
| 210 | 248 | ||
| 211 | Allows user space to enable aes key wrapping, including generating a new | 249 | Allows user space to enable aes key wrapping, including generating a new |
| 212 | wrapping key. | 250 | wrapping key. |
| 213 | 251 | ||
| 214 | Parameters: none | 252 | :Parameters: none |
| 215 | Returns: 0 | 253 | :Returns: 0 |
| 216 | 254 | ||
| 217 | 4.2. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_DEA_KW (w/o) | 255 | 4.2. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_DEA_KW (w/o) |
| 256 | ------------------------------------------------------ | ||
| 218 | 257 | ||
| 219 | Allows user space to enable dea key wrapping, including generating a new | 258 | Allows user space to enable dea key wrapping, including generating a new |
| 220 | wrapping key. | 259 | wrapping key. |
| 221 | 260 | ||
| 222 | Parameters: none | 261 | :Parameters: none |
| 223 | Returns: 0 | 262 | :Returns: 0 |
| 224 | 263 | ||
| 225 | 4.3. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_AES_KW (w/o) | 264 | 4.3. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_AES_KW (w/o) |
| 265 | ------------------------------------------------------- | ||
| 226 | 266 | ||
| 227 | Allows user space to disable aes key wrapping, clearing the wrapping key. | 267 | Allows user space to disable aes key wrapping, clearing the wrapping key. |
| 228 | 268 | ||
| 229 | Parameters: none | 269 | :Parameters: none |
| 230 | Returns: 0 | 270 | :Returns: 0 |
| 231 | 271 | ||
| 232 | 4.4. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_DEA_KW (w/o) | 272 | 4.4. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_DEA_KW (w/o) |
| 273 | ------------------------------------------------------- | ||
| 233 | 274 | ||
| 234 | Allows user space to disable dea key wrapping, clearing the wrapping key. | 275 | Allows user space to disable dea key wrapping, clearing the wrapping key. |
| 235 | 276 | ||
| 236 | Parameters: none | 277 | :Parameters: none |
| 237 | Returns: 0 | 278 | :Returns: 0 |
| 238 | 279 | ||
| 239 | 5. GROUP: KVM_S390_VM_MIGRATION | 280 | 5. GROUP: KVM_S390_VM_MIGRATION |
| 240 | Architectures: s390 | 281 | =============================== |
| 282 | |||
| 283 | :Architectures: s390 | ||
| 241 | 284 | ||
| 242 | 5.1. ATTRIBUTE: KVM_S390_VM_MIGRATION_STOP (w/o) | 285 | 5.1. ATTRIBUTE: KVM_S390_VM_MIGRATION_STOP (w/o) |
| 286 | ------------------------------------------------ | ||
| 243 | 287 | ||
| 244 | Allows userspace to stop migration mode, needed for PGSTE migration. | 288 | Allows userspace to stop migration mode, needed for PGSTE migration. |
| 245 | Setting this attribute when migration mode is not active will have no | 289 | Setting this attribute when migration mode is not active will have no |
| 246 | effects. | 290 | effects. |
| 247 | 291 | ||
| 248 | Parameters: none | 292 | :Parameters: none |
| 249 | Returns: 0 | 293 | :Returns: 0 |
| 250 | 294 | ||
| 251 | 5.2. ATTRIBUTE: KVM_S390_VM_MIGRATION_START (w/o) | 295 | 5.2. ATTRIBUTE: KVM_S390_VM_MIGRATION_START (w/o) |
| 296 | ------------------------------------------------- | ||
| 252 | 297 | ||
| 253 | Allows userspace to start migration mode, needed for PGSTE migration. | 298 | Allows userspace to start migration mode, needed for PGSTE migration. |
| 254 | Setting this attribute when migration mode is already active will have | 299 | Setting this attribute when migration mode is already active will have |
| 255 | no effects. | 300 | no effects. |
| 256 | 301 | ||
| 257 | Parameters: none | 302 | :Parameters: none |
| 258 | Returns: -ENOMEM if there is not enough free memory to start migration mode | 303 | :Returns: -ENOMEM if there is not enough free memory to start migration mode; |
| 259 | -EINVAL if the state of the VM is invalid (e.g. no memory defined) | 304 | -EINVAL if the state of the VM is invalid (e.g. no memory defined); |
| 260 | 0 in case of success. | 305 | 0 in case of success. |
| 261 | 306 | ||
| 262 | 5.3. ATTRIBUTE: KVM_S390_VM_MIGRATION_STATUS (r/o) | 307 | 5.3. ATTRIBUTE: KVM_S390_VM_MIGRATION_STATUS (r/o) |
| 308 | -------------------------------------------------- | ||
| 263 | 309 | ||
| 264 | Allows userspace to query the status of migration mode. | 310 | Allows userspace to query the status of migration mode. |
| 265 | 311 | ||
| 266 | Parameters: address of a buffer in user space to store the data (u64) to; | 312 | :Parameters: address of a buffer in user space to store the data (u64) to; |
| 267 | the data itself is either 0 if migration mode is disabled or 1 | 313 | the data itself is either 0 if migration mode is disabled or 1 |
| 268 | if it is enabled | 314 | if it is enabled |
| 269 | Returns: -EFAULT if the given address is not accessible from kernel space | 315 | :Returns: -EFAULT if the given address is not accessible from kernel space; |
| 270 | 0 in case of success. | 316 | 0 in case of success. |
| @@ -1,20 +1,31 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ========================= | ||
| 1 | XICS interrupt controller | 4 | XICS interrupt controller |
| 5 | ========================= | ||
| 2 | 6 | ||
| 3 | Device type supported: KVM_DEV_TYPE_XICS | 7 | Device type supported: KVM_DEV_TYPE_XICS |
| 4 | 8 | ||
| 5 | Groups: | 9 | Groups: |
| 6 | 1. KVM_DEV_XICS_GRP_SOURCES | 10 | 1. KVM_DEV_XICS_GRP_SOURCES |
| 7 | Attributes: One per interrupt source, indexed by the source number. | 11 | Attributes: |
| 8 | 12 | ||
| 13 | One per interrupt source, indexed by the source number. | ||
| 9 | 2. KVM_DEV_XICS_GRP_CTRL | 14 | 2. KVM_DEV_XICS_GRP_CTRL |
| 10 | Attributes: | 15 | Attributes: |
| 11 | 2.1 KVM_DEV_XICS_NR_SERVERS (write only) | 16 | |
| 17 | 2.1 KVM_DEV_XICS_NR_SERVERS (write only) | ||
| 18 | |||
| 12 | The kvm_device_attr.addr points to a __u32 value which is the number of | 19 | The kvm_device_attr.addr points to a __u32 value which is the number of |
| 13 | interrupt server numbers (ie, highest possible vcpu id plus one). | 20 | interrupt server numbers (ie, highest possible vcpu id plus one). |
| 21 | |||
| 14 | Errors: | 22 | Errors: |
| 15 | -EINVAL: Value greater than KVM_MAX_VCPU_ID. | 23 | |
| 16 | -EFAULT: Invalid user pointer for attr->addr. | 24 | ======= ========================================== |
| 17 | -EBUSY: A vcpu is already connected to the device. | 25 | -EINVAL Value greater than KVM_MAX_VCPU_ID. |
| 26 | -EFAULT Invalid user pointer for attr->addr. | ||
| 27 | -EBUSY A vcpu is already connected to the device. | ||
| 28 | ======= ========================================== | ||
| 18 | 29 | ||
| 19 | This device emulates the XICS (eXternal Interrupt Controller | 30 | This device emulates the XICS (eXternal Interrupt Controller |
| 20 | Specification) defined in PAPR. The XICS has a set of interrupt | 31 | Specification) defined in PAPR. The XICS has a set of interrupt |
| @@ -53,24 +64,29 @@ the interrupt source number. The 64 bit state word has the following · 32 unmodified lines | |||
| 53 | bitfields, starting from the least-significant end of the word: | 64 | bitfields, starting from the least-significant end of the word: |
| 54 | 65 | ||
| 55 | * Destination (server number), 32 bits | 66 | * Destination (server number), 32 bits |
| 67 | |||
| 56 | This specifies where the interrupt should be sent, and is the | 68 | This specifies where the interrupt should be sent, and is the |
| 57 | interrupt server number specified for the destination vcpu. | 69 | interrupt server number specified for the destination vcpu. |
| 58 | 70 | ||
| 59 | * Priority, 8 bits | 71 | * Priority, 8 bits |
| 72 | |||
| 60 | This is the priority specified for this interrupt source, where 0 is | 73 | This is the priority specified for this interrupt source, where 0 is |
| 61 | the highest priority and 255 is the lowest. An interrupt with a | 74 | the highest priority and 255 is the lowest. An interrupt with a |
| 62 | priority of 255 will never be delivered. | 75 | priority of 255 will never be delivered. |
| 63 | 76 | ||
| 64 | * Level sensitive flag, 1 bit | 77 | * Level sensitive flag, 1 bit |
| 78 | |||
| 65 | This bit is 1 for a level-sensitive interrupt source, or 0 for | 79 | This bit is 1 for a level-sensitive interrupt source, or 0 for |
| 66 | edge-sensitive (or MSI). | 80 | edge-sensitive (or MSI). |
| 67 | 81 | ||
| 68 | * Masked flag, 1 bit | 82 | * Masked flag, 1 bit |
| 83 | |||
| 69 | This bit is set to 1 if the interrupt is masked (cannot be delivered | 84 | This bit is set to 1 if the interrupt is masked (cannot be delivered |
| 70 | regardless of its priority), for example by the ibm,int-off RTAS | 85 | regardless of its priority), for example by the ibm,int-off RTAS |
| 71 | call, or 0 if it is not masked. | 86 | call, or 0 if it is not masked. |
| 72 | 87 | ||
| 73 | * Pending flag, 1 bit | 88 | * Pending flag, 1 bit |
| 89 | |||
| 74 | This bit is 1 if the source has a pending interrupt, otherwise 0. | 90 | This bit is 1 if the source has a pending interrupt, otherwise 0. |
| 75 | 91 | ||
| 76 | Only one XICS instance may be created per VM. | 92 | Only one XICS instance may be created per VM. |
| @@ -1,8 +1,11 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | =========================================================== | ||
| 1 | POWER9 eXternal Interrupt Virtualization Engine (XIVE Gen1) | 4 | POWER9 eXternal Interrupt Virtualization Engine (XIVE Gen1) |
| 2 | ========================================================== | 5 | =========================================================== |
| 3 | 6 | ||
| 4 | Device types supported: | 7 | Device types supported: |
| 5 | KVM_DEV_TYPE_XIVE POWER9 XIVE Interrupt Controller generation 1 | 8 | - KVM_DEV_TYPE_XIVE POWER9 XIVE Interrupt Controller generation 1 |
| 6 | 9 | ||
| 7 | This device acts as a VM interrupt controller. It provides the KVM | 10 | This device acts as a VM interrupt controller. It provides the KVM |
| 8 | interface to configure the interrupt sources of a VM in the underlying | 11 | interface to configure the interrupt sources of a VM in the underlying |
| @@ -64,72 +67,100 @@ the legacy interrupt mode, referred as XICS (POWER7/8). · 55 unmodified lines | |||
| 64 | 67 | ||
| 65 | * Groups: | 68 | * Groups: |
| 66 | 69 | ||
| 67 | 1. KVM_DEV_XIVE_GRP_CTRL | 70 | 1. KVM_DEV_XIVE_GRP_CTRL |
| 68 | Provides global controls on the device | 71 | Provides global controls on the device |
| 72 | |||
| 69 | Attributes: | 73 | Attributes: |
| 70 | 1.1 KVM_DEV_XIVE_RESET (write only) | 74 | 1.1 KVM_DEV_XIVE_RESET (write only) |
| 71 | Resets the interrupt controller configuration for sources and event | 75 | Resets the interrupt controller configuration for sources and event |
| 72 | queues. To be used by kexec and kdump. | 76 | queues. To be used by kexec and kdump. |
| 77 | |||
| 73 | Errors: none | 78 | Errors: none |
| 74 | 79 | ||
| 75 | 1.2 KVM_DEV_XIVE_EQ_SYNC (write only) | 80 | 1.2 KVM_DEV_XIVE_EQ_SYNC (write only) |
| 76 | Sync all the sources and queues and mark the EQ pages dirty. This | 81 | Sync all the sources and queues and mark the EQ pages dirty. This |
| 77 | to make sure that a consistent memory state is captured when | 82 | to make sure that a consistent memory state is captured when |
| 78 | migrating the VM. | 83 | migrating the VM. |
| 84 | |||
| 79 | Errors: none | 85 | Errors: none |
| 80 | 86 | ||
| 81 | 1.3 KVM_DEV_XIVE_NR_SERVERS (write only) | 87 | 1.3 KVM_DEV_XIVE_NR_SERVERS (write only) |
| 82 | The kvm_device_attr.addr points to a __u32 value which is the number of | 88 | The kvm_device_attr.addr points to a __u32 value which is the number of |
| 83 | interrupt server numbers (ie, highest possible vcpu id plus one). | 89 | interrupt server numbers (ie, highest possible vcpu id plus one). |
| 90 | |||
| 84 | Errors: | 91 | Errors: |
| 85 | -EINVAL: Value greater than KVM_MAX_VCPU_ID. | ||
| 86 | -EFAULT: Invalid user pointer for attr->addr. | ||
| 87 | -EBUSY: A vCPU is already connected to the device. | ||
| 88 | 92 | ||
| 89 | 2. KVM_DEV_XIVE_GRP_SOURCE (write only) | 93 | ======= ========================================== |
| 90 | Initializes a new source in the XIVE device and mask it. | 94 | -EINVAL Value greater than KVM_MAX_VCPU_ID. |
| 95 | -EFAULT Invalid user pointer for attr->addr. | ||
| 96 | -EBUSY A vCPU is already connected to the device. | ||
| 97 | ======= ========================================== | ||
| 98 | |||
| 99 | 2. KVM_DEV_XIVE_GRP_SOURCE (write only) | ||
| 100 | Initializes a new source in the XIVE device and mask it. | ||
| 101 | |||
| 91 | Attributes: | 102 | Attributes: |
| 92 | Interrupt source number (64-bit) | 103 | Interrupt source number (64-bit) |
| 93 | The kvm_device_attr.addr points to a __u64 value: | 104 | |
| 94 | bits: | 63 .... 2 | 1 | 0 | 105 | The kvm_device_attr.addr points to a __u64 value:: |
| 95 | values: | unused | level | type | 106 | |
| 107 | bits: | 63 .... 2 | 1 | 0 | ||
| 108 | values: | unused | level | type | ||
| 109 | |||
| 96 | - type: 0:MSI 1:LSI | 110 | - type: 0:MSI 1:LSI |
| 97 | - level: assertion level in case of an LSI. | 111 | - level: assertion level in case of an LSI. |
| 112 | |||
| 98 | Errors: | 113 | Errors: |
| 99 | -E2BIG: Interrupt source number is out of range | ||
| 100 | -ENOMEM: Could not create a new source block | ||
| 101 | -EFAULT: Invalid user pointer for attr->addr. | ||
| 102 | -ENXIO: Could not allocate underlying HW interrupt | ||
| 103 | 114 | ||
| 104 | 3. KVM_DEV_XIVE_GRP_SOURCE_CONFIG (write only) | 115 | ======= ========================================== |
| 105 | Configures source targeting | 116 | -E2BIG Interrupt source number is out of range |
| 117 | -ENOMEM Could not create a new source block | ||
| 118 | -EFAULT Invalid user pointer for attr->addr. | ||
| 119 | -ENXIO Could not allocate underlying HW interrupt | ||
| 120 | ======= ========================================== | ||
| 121 | |||
| 122 | 3. KVM_DEV_XIVE_GRP_SOURCE_CONFIG (write only) | ||
| 123 | Configures source targeting | ||
| 124 | |||
| 106 | Attributes: | 125 | Attributes: |
| 107 | Interrupt source number (64-bit) | 126 | Interrupt source number (64-bit) |
| 108 | The kvm_device_attr.addr points to a __u64 value: | 127 | |
| 109 | bits: | 63 .... 33 | 32 | 31 .. 3 | 2 .. 0 | 128 | The kvm_device_attr.addr points to a __u64 value:: |
| 110 | values: | eisn | mask | server | priority | 129 | |
| 130 | bits: | 63 .... 33 | 32 | 31 .. 3 | 2 .. 0 | ||
| 131 | values: | eisn | mask | server | priority | ||
| 132 | |||
| 111 | - priority: 0-7 interrupt priority level | 133 | - priority: 0-7 interrupt priority level |
| 112 | - server: CPU number chosen to handle the interrupt | 134 | - server: CPU number chosen to handle the interrupt |
| 113 | - mask: mask flag (unused) | 135 | - mask: mask flag (unused) |
| 114 | - eisn: Effective Interrupt Source Number | 136 | - eisn: Effective Interrupt Source Number |
| 137 | |||
| 115 | Errors: | 138 | Errors: |
| 116 | -ENOENT: Unknown source number | 139 | |
| 117 | -EINVAL: Not initialized source number | 140 | ======= ======================================================= |
| 118 | -EINVAL: Invalid priority | 141 | -ENOENT Unknown source number |
| 119 | -EINVAL: Invalid CPU number. | 142 | -EINVAL Not initialized source number |
| 120 | -EFAULT: Invalid user pointer for attr->addr. | 143 | -EINVAL Invalid priority |
| 121 | -ENXIO: CPU event queues not configured or configuration of the | 144 | -EINVAL Invalid CPU number. |
| 122 | underlying HW interrupt failed | 145 | -EFAULT Invalid user pointer for attr->addr. |
| 123 | -EBUSY: No CPU available to serve interrupt | 146 | -ENXIO CPU event queues not configured or configuration of the |
| 124 | 147 | underlying HW interrupt failed | |
| 125 | 4. KVM_DEV_XIVE_GRP_EQ_CONFIG (read-write) | 148 | -EBUSY No CPU available to serve interrupt |
| 126 | Configures an event queue of a CPU | 149 | ======= ======================================================= |
| 150 | |||
| 151 | 4. KVM_DEV_XIVE_GRP_EQ_CONFIG (read-write) | ||
| 152 | Configures an event queue of a CPU | ||
| 153 | |||
| 127 | Attributes: | 154 | Attributes: |
| 128 | EQ descriptor identifier (64-bit) | 155 | EQ descriptor identifier (64-bit) |
| 129 | The EQ descriptor identifier is a tuple (server, priority) : | 156 | |
| 130 | bits: | 63 .... 32 | 31 .. 3 | 2 .. 0 | 157 | The EQ descriptor identifier is a tuple (server, priority):: |
| 131 | values: | unused | server | priority | 158 | |
| 132 | The kvm_device_attr.addr points to : | 159 | bits: | 63 .... 32 | 31 .. 3 | 2 .. 0 |
| 160 | values: | unused | server | priority | ||
| 161 | |||
| 162 | The kvm_device_attr.addr points to:: | ||
| 163 | |||
| 133 | struct kvm_ppc_xive_eq { | 164 | struct kvm_ppc_xive_eq { |
| 134 | __u32 flags; | 165 | __u32 flags; |
| 135 | __u32 qshift; | 166 | __u32 qshift; |
| @@ -138,8 +169,9 @@ the legacy interrupt mode, referred as XICS (POWER7/8). · 2 unmodified lines | |||
| 138 | __u32 qindex; | 169 | __u32 qindex; |
| 139 | __u8 pad[40]; | 170 | __u8 pad[40]; |
| 140 | }; | 171 | }; |
| 172 | |||
| 141 | - flags: queue flags | 173 | - flags: queue flags |
| 142 | KVM_XIVE_EQ_ALWAYS_NOTIFY (required) | 174 | KVM_XIVE_EQ_ALWAYS_NOTIFY (required) |
| 143 | forces notification without using the coalescing mechanism | 175 | forces notification without using the coalescing mechanism |
| 144 | provided by the XIVE END ESBs. | 176 | provided by the XIVE END ESBs. |
| 145 | - qshift: queue size (power of 2) | 177 | - qshift: queue size (power of 2) |
| @@ -147,22 +179,31 @@ the legacy interrupt mode, referred as XICS (POWER7/8). · 1 unmodified line | |||
| 147 | - qtoggle: current queue toggle bit | 179 | - qtoggle: current queue toggle bit |
| 148 | - qindex: current queue index | 180 | - qindex: current queue index |
| 149 | - pad: reserved for future use | 181 | - pad: reserved for future use |
| 182 | |||
| 150 | Errors: | 183 | Errors: |
| 151 | -ENOENT: Invalid CPU number | 184 | |
| 152 | -EINVAL: Invalid priority | 185 | ======= ========================================= |
| 153 | -EINVAL: Invalid flags | 186 | -ENOENT Invalid CPU number |
| 154 | -EINVAL: Invalid queue size | 187 | -EINVAL Invalid priority |
| 155 | -EINVAL: Invalid queue address | 188 | -EINVAL Invalid flags |
| 156 | -EFAULT: Invalid user pointer for attr->addr. | 189 | -EINVAL Invalid queue size |
| 157 | -EIO: Configuration of the underlying HW failed | 190 | -EINVAL Invalid queue address |
| 158 | 191 | -EFAULT Invalid user pointer for attr->addr. | |
| 159 | 5. KVM_DEV_XIVE_GRP_SOURCE_SYNC (write only) | 192 | -EIO Configuration of the underlying HW failed |
| 160 | Synchronize the source to flush event notifications | 193 | ======= ========================================= |
| 194 | |||
| 195 | 5. KVM_DEV_XIVE_GRP_SOURCE_SYNC (write only) | ||
| 196 | Synchronize the source to flush event notifications | ||
| 197 | |||
| 161 | Attributes: | 198 | Attributes: |
| 162 | Interrupt source number (64-bit) | 199 | Interrupt source number (64-bit) |
| 200 | |||
| 163 | Errors: | 201 | Errors: |
| 164 | -ENOENT: Unknown source number | 202 | |
| 165 | -EINVAL: Not initialized source number | 203 | ======= ============================= |
| 204 | -ENOENT Unknown source number | ||
| 205 | -EINVAL Not initialized source number | ||
| 206 | ======= ============================= | ||
| 166 | 207 | ||
| 167 | * VCPU state | 208 | * VCPU state |
| 168 | 209 | ||
| @@ -175,11 +216,12 @@ the legacy interrupt mode, referred as XICS (POWER7/8). · 6 unmodified lines | |||
| 175 | as it synthesizes the priorities of the pending interrupts. We | 216 | as it synthesizes the priorities of the pending interrupts. We |
| 176 | capture a bit more to report debug information. | 217 | capture a bit more to report debug information. |
| 177 | 218 | ||
| 178 | KVM_REG_PPC_VP_STATE (2 * 64bits) | 219 | KVM_REG_PPC_VP_STATE (2 * 64bits):: |
| 179 | bits: | 63 .... 32 | 31 .... 0 | | 220 | |
| 180 | values: | TIMA word0 | TIMA word1 | | 221 | bits: | 63 .... 32 | 31 .... 0 | |
| 181 | bits: | 127 .......... 64 | | 222 | values: | TIMA word0 | TIMA word1 | |
| 182 | values: | unused | | 223 | bits: | 127 .......... 64 | |
| 224 | values: | unused | | ||
| 183 | 225 | ||
| 184 | * Migration: | 226 | * Migration: |
| 185 | 227 | ||
| @@ -196,7 +238,7 @@ the legacy interrupt mode, referred as XICS (POWER7/8). · 10 unmodified lines | |||
| 196 | 3. Capture the state of the source targeting, the EQs configuration | 238 | 3. Capture the state of the source targeting, the EQs configuration |
| 197 | and the state of thread interrupt context registers. | 239 | and the state of thread interrupt context registers. |
| 198 | 240 | ||
| 199 | Restore is similar : | 241 | Restore is similar: |
| 200 | 242 | ||
| 201 | 1. Restore the EQ configuration. As targeting depends on it. | 243 | 1. Restore the EQ configuration. As targeting depends on it. |
| 202 | 2. Restore targeting | 244 | 2. Restore targeting |
| @@ -1,3 +1,6 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | =========================== | ||
| 1 | The KVM halt polling system | 4 | The KVM halt polling system |
| 2 | =========================== | 5 | =========================== |
| 3 | 6 | ||
| @@ -68,7 +71,8 @@ steady state polling interval but will only really do a good job for wakeups · 64 unmodified lines | |||
| 68 | which come at an approximately constant rate, otherwise there will be constant | 71 | which come at an approximately constant rate, otherwise there will be constant |
| 69 | adjustment of the polling interval. | 72 | adjustment of the polling interval. |
| 70 | 73 | ||
| 71 | [0] total block time: the time between when the halt polling function is | 74 | [0] total block time: |
| 75 | the time between when the halt polling function is | ||
| 72 | invoked and a wakeup source received (irrespective of | 76 | invoked and a wakeup source received (irrespective of |
| 73 | whether the scheduler is invoked within that function). | 77 | whether the scheduler is invoked within that function). |
| 74 | 78 | ||
| @@ -81,31 +85,32 @@ shrunk. These variables are defined in include/linux/kvm_host.h and as module · 6 unmodified lines | |||
| 81 | parameters in virt/kvm/kvm_main.c, or arch/powerpc/kvm/book3s_hv.c in the | 85 | parameters in virt/kvm/kvm_main.c, or arch/powerpc/kvm/book3s_hv.c in the |
| 82 | powerpc kvm-hv case. | 86 | powerpc kvm-hv case. |
| 83 | 87 | ||
| 84 | Module Parameter | Description | Default Value | 88 | +-----------------------+---------------------------+-------------------------+ |
| 85 | -------------------------------------------------------------------------------- | 89 | |Module Parameter | Description | Default Value | |
| 86 | halt_poll_ns | The global max polling | KVM_HALT_POLL_NS_DEFAULT | 90 | +-----------------------+---------------------------+-------------------------+ |
| 87 | | interval which defines | | 91 | |halt_poll_ns | The global max polling | KVM_HALT_POLL_NS_DEFAULT| |
| 88 | | the ceiling value of the | | 92 | | | interval which defines | | |
| 89 | | polling interval for | (per arch value) | 93 | | | the ceiling value of the | | |
| 90 | | each vcpu. | | 94 | | | polling interval for | (per arch value) | |
| 91 | -------------------------------------------------------------------------------- | 95 | | | each vcpu. | | |
| 92 | halt_poll_ns_grow | The value by which the | 2 | 96 | +-----------------------+---------------------------+-------------------------+ |
| 93 | | halt polling interval is | | 97 | |halt_poll_ns_grow | The value by which the | 2 | |
| 94 | | multiplied in the | | 98 | | | halt polling interval is | | |
| 95 | | grow_halt_poll_ns() | | 99 | | | multiplied in the | | |
| 96 | | function. | | 100 | | | grow_halt_poll_ns() | | |
| 97 | -------------------------------------------------------------------------------- | 101 | | | function. | | |
| 98 | halt_poll_ns_grow_start | The initial value to grow | 10000 | 102 | +-----------------------+---------------------------+-------------------------+ |
| 99 | | to from zero in the | | 103 | |halt_poll_ns_grow_start| The initial value to grow | 10000 | |
| 100 | | grow_halt_poll_ns() | | 104 | | | to from zero in the | | |
| 101 | | function. | | 105 | | | grow_halt_poll_ns() | | |
| 102 | -------------------------------------------------------------------------------- | 106 | | | function. | | |
| 103 | halt_poll_ns_shrink | The value by which the | 0 | 107 | +-----------------------+---------------------------+-------------------------+ |
| 104 | | halt polling interval is | | 108 | |halt_poll_ns_shrink | The value by which the | 0 | |
| 105 | | divided in the | | 109 | | | halt polling interval is | | |
| 106 | | shrink_halt_poll_ns() | | 110 | | | divided in the | | |
| 107 | | function. | | 111 | | | shrink_halt_poll_ns() | | |
| 108 | -------------------------------------------------------------------------------- | 112 | | | function. | | |
| 113 | +-----------------------+---------------------------+-------------------------+ | ||
| 109 | 114 | ||
| 110 | These module parameters can be set from the debugfs files in: | 115 | These module parameters can be set from the debugfs files in: |
| 111 | 116 | ||
| @@ -117,20 +122,19 @@ Note: that these module parameters are system wide values and are not able to · 5 unmodified lines | |||
| 117 | Further Notes | 122 | Further Notes |
| 118 | ============= | 123 | ============= |
| 119 | 124 | ||
| 120 | - Care should be taken when setting the halt_poll_ns module parameter as a | 125 | - Care should be taken when setting the halt_poll_ns module parameter as a large value |
| 121 | large value has the potential to drive the cpu usage to 100% on a machine which | 126 | has the potential to drive the cpu usage to 100% on a machine which would be almost |
| 122 | would be almost entirely idle otherwise. This is because even if a guest has | 127 | entirely idle otherwise. This is because even if a guest has wakeups during which very |
| 123 | wakeups during which very little work is done and which are quite far apart, if | 128 | little work is done and which are quite far apart, if the period is shorter than the |
| 124 | the period is shorter than the global max polling interval (halt_poll_ns) then | 129 | global max polling interval (halt_poll_ns) then the host will always poll for the |
| 125 | the host will always poll for the entire block time and thus cpu utilisation | 130 | entire block time and thus cpu utilisation will go to 100%. |
| 126 | will go to 100%. | 131 | |
| 127 | 132 | - Halt polling essentially presents a trade off between power usage and latency and | |
| 128 | - Halt polling essentially presents a trade off between power usage and latency | 133 | the module parameters should be used to tune the affinity for this. Idle cpu time is |
| 129 | and the module parameters should be used to tune the affinity for this. Idle | 134 | essentially converted to host kernel time with the aim of decreasing latency when |
| 130 | cpu time is essentially converted to host kernel time with the aim of decreasing | 135 | entering the guest. |
| 131 | latency when entering the guest. | 136 | |
| 132 | 137 | - Halt polling will only be conducted by the host when no other tasks are runnable on | |
| 133 | - Halt polling will only be conducted by the host when no other tasks are | 138 | that cpu, otherwise the polling will cease immediately and schedule will be invoked to |
| 134 | runnable on that cpu, otherwise the polling will cease immediately and | 139 | allow that other task to run. Thus this doesn't allow a guest to denial of service the |
| 135 | schedule will be invoked to allow that other task to run. Thus this doesn't | 140 | cpu. |
| 136 | allow a guest to denial of service the cpu. | ||
| @@ -1,5 +1,9 @@ | |||
| 1 | Linux KVM Hypercall: | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | |||
| 3 | =================== | ||
| 4 | Linux KVM Hypercall | ||
| 2 | =================== | 5 | =================== |
| 6 | |||
| 3 | X86: | 7 | X86: |
| 4 | KVM Hypercalls have a three-byte sequence of either the vmcall or the vmmcall | 8 | KVM Hypercalls have a three-byte sequence of either the vmcall or the vmmcall |
| 5 | instruction. The hypervisor can replace it with instructions that are | 9 | instruction. The hypervisor can replace it with instructions that are |
| @@ -20,7 +24,7 @@ S390: · 14 unmodified lines | |||
| 20 | For further information on the S390 diagnose call as supported by KVM, | 24 | For further information on the S390 diagnose call as supported by KVM, |
| 21 | refer to Documentation/virt/kvm/s390-diag.txt. | 25 | refer to Documentation/virt/kvm/s390-diag.txt. |
| 22 | 26 | ||
| 23 | PowerPC: | 27 | PowerPC: |
| 24 | It uses R3-R10 and hypercall number in R11. R4-R11 are used as output registers. | 28 | It uses R3-R10 and hypercall number in R11. R4-R11 are used as output registers. |
| 25 | Return value is placed in R3. | 29 | Return value is placed in R3. |
| 26 | 30 | ||
| @@ -34,7 +38,8 @@ MIPS: · 7 unmodified lines | |||
| 34 | the return value is placed in $2 (v0). | 38 | the return value is placed in $2 (v0). |
| 35 | 39 | ||
| 36 | KVM Hypercalls Documentation | 40 | KVM Hypercalls Documentation |
| 37 | =========================== | 41 | ============================ |
| 42 | |||
| 38 | The template for each hypercall is: | 43 | The template for each hypercall is: |
| 39 | 1. Hypercall name. | 44 | 1. Hypercall name. |
| 40 | 2. Architecture(s) | 45 | 2. Architecture(s) |
| @@ -43,56 +48,64 @@ The template for each hypercall is: · 2 unmodified lines | |||
| 43 | 48 | ||
| 44 | 1. KVM_HC_VAPIC_POLL_IRQ | 49 | 1. KVM_HC_VAPIC_POLL_IRQ |
| 45 | ------------------------ | 50 | ------------------------ |
| 46 | Architecture: x86 | 51 | |
| 47 | Status: active | 52 | :Architecture: x86 |
| 48 | Purpose: Trigger guest exit so that the host can check for pending | 53 | :Status: active |
| 49 | interrupts on reentry. | 54 | :Purpose: Trigger guest exit so that the host can check for pending |
| 55 | interrupts on reentry. | ||
| 50 | 56 | ||
| 51 | 2. KVM_HC_MMU_OP | 57 | 2. KVM_HC_MMU_OP |
| 52 | ------------------------ | 58 | ---------------- |
| 53 | Architecture: x86 | 59 | |
| 54 | Status: deprecated. | 60 | :Architecture: x86 |
| 55 | Purpose: Support MMU operations such as writing to PTE, | 61 | :Status: deprecated. |
| 56 | flushing TLB, release PT. | 62 | :Purpose: Support MMU operations such as writing to PTE, |
| 63 | flushing TLB, release PT. | ||
| 57 | 64 | ||
| 58 | 3. KVM_HC_FEATURES | 65 | 3. KVM_HC_FEATURES |
| 59 | ------------------------ | 66 | ------------------ |
| 60 | Architecture: PPC | 67 | |
| 61 | Status: active | 68 | :Architecture: PPC |
| 62 | Purpose: Expose hypercall availability to the guest. On x86 platforms, cpuid | 69 | :Status: active |
| 63 | used to enumerate which hypercalls are available. On PPC, either device tree | 70 | :Purpose: Expose hypercall availability to the guest. On x86 platforms, cpuid |
| 64 | based lookup ( which is also what EPAPR dictates) OR KVM specific enumeration | 71 | used to enumerate which hypercalls are available. On PPC, either |
| 65 | mechanism (which is this hypercall) can be used. | 72 | device tree based lookup ( which is also what EPAPR dictates) |
| 73 | OR KVM specific enumeration mechanism (which is this hypercall) | ||
| 74 | can be used. | ||
| 66 | 75 | ||
| 67 | 4. KVM_HC_PPC_MAP_MAGIC_PAGE | 76 | 4. KVM_HC_PPC_MAP_MAGIC_PAGE |
| 68 | ------------------------ | 77 | ---------------------------- |
| 69 | Architecture: PPC | 78 | |
| 70 | Status: active | 79 | :Architecture: PPC |
| 71 | Purpose: To enable communication between the hypervisor and guest there is a | 80 | :Status: active |
| 72 | shared page that contains parts of supervisor visible register state. | 81 | :Purpose: To enable communication between the hypervisor and guest there is a |
| 73 | The guest can map this shared page to access its supervisor register through | 82 | shared page that contains parts of supervisor visible register state. |
| 74 | memory using this hypercall. | 83 | The guest can map this shared page to access its supervisor register |
| 84 | through memory using this hypercall. | ||
| 75 | 85 | ||
| 76 | 5. KVM_HC_KICK_CPU | 86 | 5. KVM_HC_KICK_CPU |
| 77 | ------------------------ | 87 | ------------------ |
| 78 | Architecture: x86 | 88 | |
| 79 | Status: active | 89 | :Architecture: x86 |
| 80 | Purpose: Hypercall used to wakeup a vcpu from HLT state | 90 | :Status: active |
| 81 | Usage example : A vcpu of a paravirtualized guest that is busywaiting in guest | 91 | :Purpose: Hypercall used to wakeup a vcpu from HLT state |
| 82 | kernel mode for an event to occur (ex: a spinlock to become available) can | 92 | :Usage example: |
| 83 | execute HLT instruction once it has busy-waited for more than a threshold | 93 | A vcpu of a paravirtualized guest that is busywaiting in guest |
| 84 | time-interval. Execution of HLT instruction would cause the hypervisor to put | 94 | kernel mode for an event to occur (ex: a spinlock to become available) can |
| 85 | the vcpu to sleep until occurrence of an appropriate event. Another vcpu of the | 95 | execute HLT instruction once it has busy-waited for more than a threshold |
| 86 | same guest can wakeup the sleeping vcpu by issuing KVM_HC_KICK_CPU hypercall, | 96 | time-interval. Execution of HLT instruction would cause the hypervisor to put |
| 87 | specifying APIC ID (a1) of the vcpu to be woken up. An additional argument (a0) | 97 | the vcpu to sleep until occurrence of an appropriate event. Another vcpu of the |
| 88 | is used in the hypercall for future use. | 98 | same guest can wakeup the sleeping vcpu by issuing KVM_HC_KICK_CPU hypercall, |
| 99 | specifying APIC ID (a1) of the vcpu to be woken up. An additional argument (a0) | ||
| 100 | is used in the hypercall for future use. | ||
| 89 | 101 | ||
| 90 | 102 | ||
| 91 | 6. KVM_HC_CLOCK_PAIRING | 103 | 6. KVM_HC_CLOCK_PAIRING |
| 92 | ------------------------ | 104 | ----------------------- |
| 93 | Architecture: x86 | 105 | :Architecture: x86 |
| 94 | Status: active | 106 | :Status: active |
| 95 | Purpose: Hypercall used to synchronize host and guest clocks. | 107 | :Purpose: Hypercall used to synchronize host and guest clocks. |
| 108 | |||
| 96 | Usage: | 109 | Usage: |
| 97 | 110 | ||
| 98 | a0: guest physical address where host copies | 111 | a0: guest physical address where host copies |
| @@ -101,6 +114,8 @@ a0: guest physical address where host copies · 2 unmodified lines | |||
| 101 | a1: clock_type, ATM only KVM_CLOCK_PAIRING_WALLCLOCK (0) | 114 | a1: clock_type, ATM only KVM_CLOCK_PAIRING_WALLCLOCK (0) |
| 102 | is supported (corresponding to the host's CLOCK_REALTIME clock). | 115 | is supported (corresponding to the host's CLOCK_REALTIME clock). |
| 103 | 116 | ||
| 117 | :: | ||
| 118 | |||
| 104 | struct kvm_clock_pairing { | 119 | struct kvm_clock_pairing { |
| 105 | __s64 sec; | 120 | __s64 sec; |
| 106 | __s64 nsec; | 121 | __s64 nsec; |
| @@ -123,15 +138,16 @@ Returns KVM_EOPNOTSUPP if the host does not use TSC clocksource, · 16 unmodified lines | |||
| 123 | or if clock type is different than KVM_CLOCK_PAIRING_WALLCLOCK. | 138 | or if clock type is different than KVM_CLOCK_PAIRING_WALLCLOCK. |
| 124 | 139 | ||
| 125 | 6. KVM_HC_SEND_IPI | 140 | 6. KVM_HC_SEND_IPI |
| 126 | ------------------------ | 141 | ------------------ |
| 127 | Architecture: x86 | 142 | |
| 128 | Status: active | 143 | :Architecture: x86 |
| 129 | Purpose: Send IPIs to multiple vCPUs. | 144 | :Status: active |
| 145 | :Purpose: Send IPIs to multiple vCPUs. | ||
| 130 | 146 | ||
| 131 | a0: lower part of the bitmap of destination APIC IDs | 147 | - a0: lower part of the bitmap of destination APIC IDs |
| 132 | a1: higher part of the bitmap of destination APIC IDs | 148 | - a1: higher part of the bitmap of destination APIC IDs |
| 133 | a2: the lowest APIC ID in bitmap | 149 | - a2: the lowest APIC ID in bitmap |
| 134 | a3: APIC ICR | 150 | - a3: APIC ICR |
| 135 | 151 | ||
| 136 | The hypercall lets a guest send multicast IPIs, with at most 128 | 152 | The hypercall lets a guest send multicast IPIs, with at most 128 |
| 137 | 128 destinations per hypercall in 64-bit mode and 64 vCPUs per | 153 | 128 destinations per hypercall in 64-bit mode and 64 vCPUs per |
| @@ -143,12 +159,13 @@ corresponds to the APIC ID a2+1, and so on. · 5 unmodified lines | |||
| 143 | Returns the number of CPUs to which the IPIs were delivered successfully. | 159 | Returns the number of CPUs to which the IPIs were delivered successfully. |
| 144 | 160 | ||
| 145 | 7. KVM_HC_SCHED_YIELD | 161 | 7. KVM_HC_SCHED_YIELD |
| 146 | ------------------------ | 162 | --------------------- |
| 147 | Architecture: x86 | 163 | |
| 148 | Status: active | 164 | :Architecture: x86 |
| 149 | Purpose: Hypercall used to yield if the IPI target vCPU is preempted | 165 | :Status: active |
| 166 | :Purpose: Hypercall used to yield if the IPI target vCPU is preempted | ||
| 150 | 167 | ||
| 151 | a0: destination APIC ID | 168 | a0: destination APIC ID |
| 152 | 169 | ||
| 153 | Usage example: When sending a call-function IPI-many to vCPUs, yield if | 170 | :Usage example: When sending a call-function IPI-many to vCPUs, yield if |
| 154 | any of the IPI target vCPUs was preempted. | 171 | any of the IPI target vCPUs was preempted. |
| @@ -7,6 +7,22 @@ KVM · 6 unmodified lines | |||
| 7 | .. toctree:: | 7 | .. toctree:: |
| 8 | :maxdepth: 2 | 8 | :maxdepth: 2 |
| 9 | 9 | ||
| 10 | api | ||
| 10 | amd-memory-encryption | 11 | amd-memory-encryption |
| 11 | cpuid | 12 | cpuid |
| 13 | halt-polling | ||
| 14 | hypercalls | ||
| 15 | locking | ||
| 16 | mmu | ||
| 17 | msr | ||
| 18 | nested-vmx | ||
| 19 | ppc-pv | ||
| 20 | s390-diag | ||
| 21 | timekeeping | ||
| 12 | vcpu-requests | 22 | vcpu-requests |
| 23 | |||
| 24 | review-checklist | ||
| 25 | |||
| 26 | arm/index | ||
| 27 | |||
| 28 | devices/index | ||
| @@ -0,0 +1,243 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ================= | ||
| 4 | KVM Lock Overview | ||
| 5 | ================= | ||
| 6 | |||
| 7 | 1. Acquisition Orders | ||
| 8 | --------------------- | ||
| 9 | |||
| 10 | The acquisition orders for mutexes are as follows: | ||
| 11 | |||
| 12 | - kvm->lock is taken outside vcpu->mutex | ||
| 13 | |||
| 14 | - kvm->lock is taken outside kvm->slots_lock and kvm->irq_lock | ||
| 15 | |||
| 16 | - kvm->slots_lock is taken outside kvm->irq_lock, though acquiring | ||
| 17 | them together is quite rare. | ||
| 18 | |||
| 19 | On x86, vcpu->mutex is taken outside kvm->arch.hyperv.hv_lock. | ||
| 20 | |||
| 21 | Everything else is a leaf: no other lock is taken inside the critical | ||
| 22 | sections. | ||
| 23 | |||
| 24 | 2. Exception | ||
| 25 | ------------ | ||
| 26 | |||
| 27 | Fast page fault: | ||
| 28 | |||
| 29 | Fast page fault is the fast path which fixes the guest page fault out of | ||
| 30 | the mmu-lock on x86. Currently, the page fault can be fast in one of the | ||
| 31 | following two cases: | ||
| 32 | |||
| 33 | 1. Access Tracking: The SPTE is not present, but it is marked for access | ||
| 34 | tracking i.e. the SPTE_SPECIAL_MASK is set. That means we need to | ||
| 35 | restore the saved R/X bits. This is described in more detail later below. | ||
| 36 | |||
| 37 | 2. Write-Protection: The SPTE is present and the fault is | ||
| 38 | caused by write-protect. That means we just need to change the W bit of | ||
| 39 | the spte. | ||
| 40 | |||
| 41 | What we use to avoid all the race is the SPTE_HOST_WRITEABLE bit and | ||
| 42 | SPTE_MMU_WRITEABLE bit on the spte: | ||
| 43 | |||
| 44 | - SPTE_HOST_WRITEABLE means the gfn is writable on host. | ||
| 45 | - SPTE_MMU_WRITEABLE means the gfn is writable on mmu. The bit is set when | ||
| 46 | the gfn is writable on guest mmu and it is not write-protected by shadow | ||
| 47 | page write-protection. | ||
| 48 | |||
| 49 | On fast page fault path, we will use cmpxchg to atomically set the spte W | ||
| 50 | bit if spte.SPTE_HOST_WRITEABLE = 1 and spte.SPTE_WRITE_PROTECT = 1, or | ||
| 51 | restore the saved R/X bits if VMX_EPT_TRACK_ACCESS mask is set, or both. This | ||
| 52 | is safe because whenever changing these bits can be detected by cmpxchg. | ||
| 53 | |||
| 54 | But we need carefully check these cases: | ||
| 55 | |||
| 56 | 1) The mapping from gfn to pfn | ||
| 57 | |||
| 58 | The mapping from gfn to pfn may be changed since we can only ensure the pfn | ||
| 59 | is not changed during cmpxchg. This is a ABA problem, for example, below case | ||
| 60 | will happen: | ||
| 61 | |||
| 62 | +------------------------------------------------------------------------+ | ||
| 63 | | At the beginning:: | | ||
| 64 | | | | ||
| 65 | | gpte = gfn1 | | ||
| 66 | | gfn1 is mapped to pfn1 on host | | ||
| 67 | | spte is the shadow page table entry corresponding with gpte and | | ||
| 68 | | spte = pfn1 | | ||
| 69 | +------------------------------------------------------------------------+ | ||
| 70 | | On fast page fault path: | | ||
| 71 | +------------------------------------+-----------------------------------+ | ||
| 72 | | CPU 0: | CPU 1: | | ||
| 73 | +------------------------------------+-----------------------------------+ | ||
| 74 | | :: | | | ||
| 75 | | | | | ||
| 76 | | old_spte = *spte; | | | ||
| 77 | +------------------------------------+-----------------------------------+ | ||
| 78 | | | pfn1 is swapped out:: | | ||
| 79 | | | | | ||
| 80 | | | spte = 0; | | ||
| 81 | | | | | ||
| 82 | | | pfn1 is re-alloced for gfn2. | | ||
| 83 | | | | | ||
| 84 | | | gpte is changed to point to | | ||
| 85 | | | gfn2 by the guest:: | | ||
| 86 | | | | | ||
| 87 | | | spte = pfn1; | | ||
| 88 | +------------------------------------+-----------------------------------+ | ||
| 89 | | :: | | ||
| 90 | | | | ||
| 91 | | if (cmpxchg(spte, old_spte, old_spte+W) | | ||
| 92 | | mark_page_dirty(vcpu->kvm, gfn1) | | ||
| 93 | | OOPS!!! | | ||
| 94 | +------------------------------------------------------------------------+ | ||
| 95 | |||
| 96 | We dirty-log for gfn1, that means gfn2 is lost in dirty-bitmap. | ||
| 97 | |||
| 98 | For direct sp, we can easily avoid it since the spte of direct sp is fixed | ||
| 99 | to gfn. For indirect sp, before we do cmpxchg, we call gfn_to_pfn_atomic() | ||
| 100 | to pin gfn to pfn, because after gfn_to_pfn_atomic(): | ||
| 101 | |||
| 102 | - We have held the refcount of pfn that means the pfn can not be freed and | ||
| 103 | be reused for another gfn. | ||
| 104 | - The pfn is writable that means it can not be shared between different gfns | ||
| 105 | by KSM. | ||
| 106 | |||
| 107 | Then, we can ensure the dirty bitmaps is correctly set for a gfn. | ||
| 108 | |||
| 109 | Currently, to simplify the whole things, we disable fast page fault for | ||
| 110 | indirect shadow page. | ||
| 111 | |||
| 112 | 2) Dirty bit tracking | ||
| 113 | |||
| 114 | In the origin code, the spte can be fast updated (non-atomically) if the | ||
| 115 | spte is read-only and the Accessed bit has already been set since the | ||
| 116 | Accessed bit and Dirty bit can not be lost. | ||
| 117 | |||
| 118 | But it is not true after fast page fault since the spte can be marked | ||
| 119 | writable between reading spte and updating spte. Like below case: | ||
| 120 | |||
| 121 | +------------------------------------------------------------------------+ | ||
| 122 | | At the beginning:: | | ||
| 123 | | | | ||
| 124 | | spte.W = 0 | | ||
| 125 | | spte.Accessed = 1 | | ||
| 126 | +------------------------------------+-----------------------------------+ | ||
| 127 | | CPU 0: | CPU 1: | | ||
| 128 | +------------------------------------+-----------------------------------+ | ||
| 129 | | In mmu_spte_clear_track_bits():: | | | ||
| 130 | | | | | ||
| 131 | | old_spte = *spte; | | | ||
| 132 | | | | | ||
| 133 | | | | | ||
| 134 | | /* 'if' condition is satisfied. */| | | ||
| 135 | | if (old_spte.Accessed == 1 && | | | ||
| 136 | | old_spte.W == 0) | | | ||
| 137 | | spte = 0ull; | | | ||
| 138 | +------------------------------------+-----------------------------------+ | ||
| 139 | | | on fast page fault path:: | | ||
| 140 | | | | | ||
| 141 | | | spte.W = 1 | | ||
| 142 | | | | | ||
| 143 | | | memory write on the spte:: | | ||
| 144 | | | | | ||
| 145 | | | spte.Dirty = 1 | | ||
| 146 | +------------------------------------+-----------------------------------+ | ||
| 147 | | :: | | | ||
| 148 | | | | | ||
| 149 | | else | | | ||
| 150 | | old_spte = xchg(spte, 0ull) | | | ||
| 151 | | if (old_spte.Accessed == 1) | | | ||
| 152 | | kvm_set_pfn_accessed(spte.pfn);| | | ||
| 153 | | if (old_spte.Dirty == 1) | | | ||
| 154 | | kvm_set_pfn_dirty(spte.pfn); | | | ||
| 155 | | OOPS!!! | | | ||
| 156 | +------------------------------------+-----------------------------------+ | ||
| 157 | |||
| 158 | The Dirty bit is lost in this case. | ||
| 159 | |||
| 160 | In order to avoid this kind of issue, we always treat the spte as "volatile" | ||
| 161 | if it can be updated out of mmu-lock, see spte_has_volatile_bits(), it means, | ||
| 162 | the spte is always atomically updated in this case. | ||
| 163 | |||
| 164 | 3) flush tlbs due to spte updated | ||
| 165 | |||
| 166 | If the spte is updated from writable to readonly, we should flush all TLBs, | ||
| 167 | otherwise rmap_write_protect will find a read-only spte, even though the | ||
| 168 | writable spte might be cached on a CPU's TLB. | ||
| 169 | |||
| 170 | As mentioned before, the spte can be updated to writable out of mmu-lock on | ||
| 171 | fast page fault path, in order to easily audit the path, we see if TLBs need | ||
| 172 | be flushed caused by this reason in mmu_spte_update() since this is a common | ||
| 173 | function to update spte (present -> present). | ||
| 174 | |||
| 175 | Since the spte is "volatile" if it can be updated out of mmu-lock, we always | ||
| 176 | atomically update the spte, the race caused by fast page fault can be avoided, | ||
| 177 | See the comments in spte_has_volatile_bits() and mmu_spte_update(). | ||
| 178 | |||
| 179 | Lockless Access Tracking: | ||
| 180 | |||
| 181 | This is used for Intel CPUs that are using EPT but do not support the EPT A/D | ||
| 182 | bits. In this case, when the KVM MMU notifier is called to track accesses to a | ||
| 183 | page (via kvm_mmu_notifier_clear_flush_young), it marks the PTE as not-present | ||
| 184 | by clearing the RWX bits in the PTE and storing the original R & X bits in | ||
| 185 | some unused/ignored bits. In addition, the SPTE_SPECIAL_MASK is also set on the | ||
| 186 | PTE (using the ignored bit 62). When the VM tries to access the page later on, | ||
| 187 | a fault is generated and the fast page fault mechanism described above is used | ||
| 188 | to atomically restore the PTE to a Present state. The W bit is not saved when | ||
| 189 | the PTE is marked for access tracking and during restoration to the Present | ||
| 190 | state, the W bit is set depending on whether or not it was a write access. If | ||
| 191 | it wasn't, then the W bit will remain clear until a write access happens, at | ||
| 192 | which time it will be set using the Dirty tracking mechanism described above. | ||
| 193 | |||
| 194 | 3. Reference | ||
| 195 | ------------ | ||
| 196 | |||
| 197 | :Name: kvm_lock | ||
| 198 | :Type: mutex | ||
| 199 | :Arch: any | ||
| 200 | :Protects: - vm_list | ||
| 201 | |||
| 202 | :Name: kvm_count_lock | ||
| 203 | :Type: raw_spinlock_t | ||
| 204 | :Arch: any | ||
| 205 | :Protects: - hardware virtualization enable/disable | ||
| 206 | :Comment: 'raw' because hardware enabling/disabling must be atomic /wrt | ||
| 207 | migration. | ||
| 208 | |||
| 209 | :Name: kvm_arch::tsc_write_lock | ||
| 210 | :Type: raw_spinlock | ||
| 211 | :Arch: x86 | ||
| 212 | :Protects: - kvm_arch::{last_tsc_write,last_tsc_nsec,last_tsc_offset} | ||
| 213 | - tsc offset in vmcb | ||
| 214 | :Comment: 'raw' because updating the tsc offsets must not be preempted. | ||
| 215 | |||
| 216 | :Name: kvm->mmu_lock | ||
| 217 | :Type: spinlock_t | ||
| 218 | :Arch: any | ||
| 219 | :Protects: -shadow page/shadow tlb entry | ||
| 220 | :Comment: it is a spinlock since it is used in mmu notifier. | ||
| 221 | |||
| 222 | :Name: kvm->srcu | ||
| 223 | :Type: srcu lock | ||
| 224 | :Arch: any | ||
| 225 | :Protects: - kvm->memslots | ||
| 226 | - kvm->buses | ||
| 227 | :Comment: The srcu read lock must be held while accessing memslots (e.g. | ||
| 228 | when using gfn_to_* functions) and while accessing in-kernel | ||
| 229 | MMIO/PIO address->device structure mapping (kvm->buses). | ||
| 230 | The srcu index can be stored in kvm_vcpu->srcu_idx per vcpu | ||
| 231 | if it is needed by multiple functions. | ||
| 232 | |||
| 233 | :Name: blocked_vcpu_on_cpu_lock | ||
| 234 | :Type: spinlock_t | ||
| 235 | :Arch: x86 | ||
| 236 | :Protects: blocked_vcpu_on_cpu | ||
| 237 | :Comment: This is a per-CPU lock and it is used for VT-d posted-interrupts. | ||
| 238 | When VT-d posted-interrupts is supported and the VM has assigned | ||
| 239 | devices, we put the blocked vCPU on the list blocked_vcpu_on_cpu | ||
| 240 | protected by blocked_vcpu_on_cpu_lock, when VT-d hardware issues | ||
| 241 | wakeup notification event since external interrupts from the | ||
| 242 | assigned devices happens, we will find the vCPU on the list to | ||
| 243 | wakeup. | ||
| @@ -1,215 +0,0 @@ | |||
| 1 | KVM Lock Overview | ||
| 2 | ================= | ||
| 3 | |||
| 4 | 1. Acquisition Orders | ||
| 5 | --------------------- | ||
| 6 | |||
| 7 | The acquisition orders for mutexes are as follows: | ||
| 8 | |||
| 9 | - kvm->lock is taken outside vcpu->mutex | ||
| 10 | |||
| 11 | - kvm->lock is taken outside kvm->slots_lock and kvm->irq_lock | ||
| 12 | |||
| 13 | - kvm->slots_lock is taken outside kvm->irq_lock, though acquiring | ||
| 14 | them together is quite rare. | ||
| 15 | |||
| 16 | On x86, vcpu->mutex is taken outside kvm->arch.hyperv.hv_lock. | ||
| 17 | |||
| 18 | Everything else is a leaf: no other lock is taken inside the critical | ||
| 19 | sections. | ||
| 20 | |||
| 21 | 2: Exception | ||
| 22 | ------------ | ||
| 23 | |||
| 24 | Fast page fault: | ||
| 25 | |||
| 26 | Fast page fault is the fast path which fixes the guest page fault out of | ||
| 27 | the mmu-lock on x86. Currently, the page fault can be fast in one of the | ||
| 28 | following two cases: | ||
| 29 | |||
| 30 | 1. Access Tracking: The SPTE is not present, but it is marked for access | ||
| 31 | tracking i.e. the SPTE_SPECIAL_MASK is set. That means we need to | ||
| 32 | restore the saved R/X bits. This is described in more detail later below. | ||
| 33 | |||
| 34 | 2. Write-Protection: The SPTE is present and the fault is | ||
| 35 | caused by write-protect. That means we just need to change the W bit of the | ||
| 36 | spte. | ||
| 37 | |||
| 38 | What we use to avoid all the race is the SPTE_HOST_WRITEABLE bit and | ||
| 39 | SPTE_MMU_WRITEABLE bit on the spte: | ||
| 40 | - SPTE_HOST_WRITEABLE means the gfn is writable on host. | ||
| 41 | - SPTE_MMU_WRITEABLE means the gfn is writable on mmu. The bit is set when | ||
| 42 | the gfn is writable on guest mmu and it is not write-protected by shadow | ||
| 43 | page write-protection. | ||
| 44 | |||
| 45 | On fast page fault path, we will use cmpxchg to atomically set the spte W | ||
| 46 | bit if spte.SPTE_HOST_WRITEABLE = 1 and spte.SPTE_WRITE_PROTECT = 1, or | ||
| 47 | restore the saved R/X bits if VMX_EPT_TRACK_ACCESS mask is set, or both. This | ||
| 48 | is safe because whenever changing these bits can be detected by cmpxchg. | ||
| 49 | |||
| 50 | But we need carefully check these cases: | ||
| 51 | 1): The mapping from gfn to pfn | ||
| 52 | The mapping from gfn to pfn may be changed since we can only ensure the pfn | ||
| 53 | is not changed during cmpxchg. This is a ABA problem, for example, below case | ||
| 54 | will happen: | ||
| 55 | |||
| 56 | At the beginning: | ||
| 57 | gpte = gfn1 | ||
| 58 | gfn1 is mapped to pfn1 on host | ||
| 59 | spte is the shadow page table entry corresponding with gpte and | ||
| 60 | spte = pfn1 | ||
| 61 | |||
| 62 | VCPU 0 VCPU0 | ||
| 63 | on fast page fault path: | ||
| 64 | |||
| 65 | old_spte = *spte; | ||
| 66 | pfn1 is swapped out: | ||
| 67 | spte = 0; | ||
| 68 | |||
| 69 | pfn1 is re-alloced for gfn2. | ||
| 70 | |||
| 71 | gpte is changed to point to | ||
| 72 | gfn2 by the guest: | ||
| 73 | spte = pfn1; | ||
| 74 | |||
| 75 | if (cmpxchg(spte, old_spte, old_spte+W) | ||
| 76 | mark_page_dirty(vcpu->kvm, gfn1) | ||
| 77 | OOPS!!! | ||
| 78 | |||
| 79 | We dirty-log for gfn1, that means gfn2 is lost in dirty-bitmap. | ||
| 80 | |||
| 81 | For direct sp, we can easily avoid it since the spte of direct sp is fixed | ||
| 82 | to gfn. For indirect sp, before we do cmpxchg, we call gfn_to_pfn_atomic() | ||
| 83 | to pin gfn to pfn, because after gfn_to_pfn_atomic(): | ||
| 84 | - We have held the refcount of pfn that means the pfn can not be freed and | ||
| 85 | be reused for another gfn. | ||
| 86 | - The pfn is writable that means it can not be shared between different gfns | ||
| 87 | by KSM. | ||
| 88 | |||
| 89 | Then, we can ensure the dirty bitmaps is correctly set for a gfn. | ||
| 90 | |||
| 91 | Currently, to simplify the whole things, we disable fast page fault for | ||
| 92 | indirect shadow page. | ||
| 93 | |||
| 94 | 2): Dirty bit tracking | ||
| 95 | In the origin code, the spte can be fast updated (non-atomically) if the | ||
| 96 | spte is read-only and the Accessed bit has already been set since the | ||
| 97 | Accessed bit and Dirty bit can not be lost. | ||
| 98 | |||
| 99 | But it is not true after fast page fault since the spte can be marked | ||
| 100 | writable between reading spte and updating spte. Like below case: | ||
| 101 | |||
| 102 | At the beginning: | ||
| 103 | spte.W = 0 | ||
| 104 | spte.Accessed = 1 | ||
| 105 | |||
| 106 | VCPU 0 VCPU0 | ||
| 107 | In mmu_spte_clear_track_bits(): | ||
| 108 | |||
| 109 | old_spte = *spte; | ||
| 110 | |||
| 111 | /* 'if' condition is satisfied. */ | ||
| 112 | if (old_spte.Accessed == 1 && | ||
| 113 | old_spte.W == 0) | ||
| 114 | spte = 0ull; | ||
| 115 | on fast page fault path: | ||
| 116 | spte.W = 1 | ||
| 117 | memory write on the spte: | ||
| 118 | spte.Dirty = 1 | ||
| 119 | |||
| 120 | |||
| 121 | else | ||
| 122 | old_spte = xchg(spte, 0ull) | ||
| 123 | |||
| 124 | |||
| 125 | if (old_spte.Accessed == 1) | ||
| 126 | kvm_set_pfn_accessed(spte.pfn); | ||
| 127 | if (old_spte.Dirty == 1) | ||
| 128 | kvm_set_pfn_dirty(spte.pfn); | ||
| 129 | OOPS!!! | ||
| 130 | |||
| 131 | The Dirty bit is lost in this case. | ||
| 132 | |||
| 133 | In order to avoid this kind of issue, we always treat the spte as "volatile" | ||
| 134 | if it can be updated out of mmu-lock, see spte_has_volatile_bits(), it means, | ||
| 135 | the spte is always atomically updated in this case. | ||
| 136 | |||
| 137 | 3): flush tlbs due to spte updated | ||
| 138 | If the spte is updated from writable to readonly, we should flush all TLBs, | ||
| 139 | otherwise rmap_write_protect will find a read-only spte, even though the | ||
| 140 | writable spte might be cached on a CPU's TLB. | ||
| 141 | |||
| 142 | As mentioned before, the spte can be updated to writable out of mmu-lock on | ||
| 143 | fast page fault path, in order to easily audit the path, we see if TLBs need | ||
| 144 | be flushed caused by this reason in mmu_spte_update() since this is a common | ||
| 145 | function to update spte (present -> present). | ||
| 146 | |||
| 147 | Since the spte is "volatile" if it can be updated out of mmu-lock, we always | ||
| 148 | atomically update the spte, the race caused by fast page fault can be avoided, | ||
| 149 | See the comments in spte_has_volatile_bits() and mmu_spte_update(). | ||
| 150 | |||
| 151 | Lockless Access Tracking: | ||
| 152 | |||
| 153 | This is used for Intel CPUs that are using EPT but do not support the EPT A/D | ||
| 154 | bits. In this case, when the KVM MMU notifier is called to track accesses to a | ||
| 155 | page (via kvm_mmu_notifier_clear_flush_young), it marks the PTE as not-present | ||
| 156 | by clearing the RWX bits in the PTE and storing the original R & X bits in | ||
| 157 | some unused/ignored bits. In addition, the SPTE_SPECIAL_MASK is also set on the | ||
| 158 | PTE (using the ignored bit 62). When the VM tries to access the page later on, | ||
| 159 | a fault is generated and the fast page fault mechanism described above is used | ||
| 160 | to atomically restore the PTE to a Present state. The W bit is not saved when | ||
| 161 | the PTE is marked for access tracking and during restoration to the Present | ||
| 162 | state, the W bit is set depending on whether or not it was a write access. If | ||
| 163 | it wasn't, then the W bit will remain clear until a write access happens, at | ||
| 164 | which time it will be set using the Dirty tracking mechanism described above. | ||
| 165 | |||
| 166 | 3. Reference | ||
| 167 | ------------ | ||
| 168 | |||
| 169 | Name: kvm_lock | ||
| 170 | Type: mutex | ||
| 171 | Arch: any | ||
| 172 | Protects: - vm_list | ||
| 173 | |||
| 174 | Name: kvm_count_lock | ||
| 175 | Type: raw_spinlock_t | ||
| 176 | Arch: any | ||
| 177 | Protects: - hardware virtualization enable/disable | ||
| 178 | Comment: 'raw' because hardware enabling/disabling must be atomic /wrt | ||
| 179 | migration. | ||
| 180 | |||
| 181 | Name: kvm_arch::tsc_write_lock | ||
| 182 | Type: raw_spinlock | ||
| 183 | Arch: x86 | ||
| 184 | Protects: - kvm_arch::{last_tsc_write,last_tsc_nsec,last_tsc_offset} | ||
| 185 | - tsc offset in vmcb | ||
| 186 | Comment: 'raw' because updating the tsc offsets must not be preempted. | ||
| 187 | |||
| 188 | Name: kvm->mmu_lock | ||
| 189 | Type: spinlock_t | ||
| 190 | Arch: any | ||
| 191 | Protects: -shadow page/shadow tlb entry | ||
| 192 | Comment: it is a spinlock since it is used in mmu notifier. | ||
| 193 | |||
| 194 | Name: kvm->srcu | ||
| 195 | Type: srcu lock | ||
| 196 | Arch: any | ||
| 197 | Protects: - kvm->memslots | ||
| 198 | - kvm->buses | ||
| 199 | Comment: The srcu read lock must be held while accessing memslots (e.g. | ||
| 200 | when using gfn_to_* functions) and while accessing in-kernel | ||
| 201 | MMIO/PIO address->device structure mapping (kvm->buses). | ||
| 202 | The srcu index can be stored in kvm_vcpu->srcu_idx per vcpu | ||
| 203 | if it is needed by multiple functions. | ||
| 204 | |||
| 205 | Name: blocked_vcpu_on_cpu_lock | ||
| 206 | Type: spinlock_t | ||
| 207 | Arch: x86 | ||
| 208 | Protects: blocked_vcpu_on_cpu | ||
| 209 | Comment: This is a per-CPU lock and it is used for VT-d posted-interrupts. | ||
| 210 | When VT-d posted-interrupts is supported and the VM has assigned | ||
| 211 | devices, we put the blocked vCPU on the list blocked_vcpu_on_cpu | ||
| 212 | protected by blocked_vcpu_on_cpu_lock, when VT-d hardware issues | ||
| 213 | wakeup notification event since external interrupts from the | ||
| 214 | assigned devices happens, we will find the vCPU on the list to | ||
| 215 | wakeup. | ||
| @@ -1,3 +1,6 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ====================== | ||
| 1 | The x86 kvm shadow mmu | 4 | The x86 kvm shadow mmu |
| 2 | ====================== | 5 | ====================== |
| 3 | 6 | ||
| @@ -7,27 +10,37 @@ physical addresses to host physical addresses. · 3 unmodified lines | |||
| 7 | 10 | ||
| 8 | The mmu code attempts to satisfy the following requirements: | 11 | The mmu code attempts to satisfy the following requirements: |
| 9 | 12 | ||
| 10 | - correctness: the guest should not be able to determine that it is running | 13 | - correctness: |
| 14 | the guest should not be able to determine that it is running | ||
| 11 | on an emulated mmu except for timing (we attempt to comply | 15 | on an emulated mmu except for timing (we attempt to comply |
| 12 | with the specification, not emulate the characteristics of | 16 | with the specification, not emulate the characteristics of |
| 13 | a particular implementation such as tlb size) | 17 | a particular implementation such as tlb size) |
| 14 | - security: the guest must not be able to touch host memory not assigned | 18 | - security: |
| 19 | the guest must not be able to touch host memory not assigned | ||
| 15 | to it | 20 | to it |
| 16 | - performance: minimize the performance penalty imposed by the mmu | 21 | - performance: |
| 17 | - scaling: need to scale to large memory and large vcpu guests | 22 | minimize the performance penalty imposed by the mmu |
| 18 | - hardware: support the full range of x86 virtualization hardware | 23 | - scaling: |
| 19 | - integration: Linux memory management code must be in control of guest memory | 24 | need to scale to large memory and large vcpu guests |
| 25 | - hardware: | ||
| 26 | support the full range of x86 virtualization hardware | ||
| 27 | - integration: | ||
| 28 | Linux memory management code must be in control of guest memory | ||
| 20 | so that swapping, page migration, page merging, transparent | 29 | so that swapping, page migration, page merging, transparent |
| 21 | hugepages, and similar features work without change | 30 | hugepages, and similar features work without change |
| 22 | - dirty tracking: report writes to guest memory to enable live migration | 31 | - dirty tracking: |
| 32 | report writes to guest memory to enable live migration | ||
| 23 | and framebuffer-based displays | 33 | and framebuffer-based displays |
| 24 | - footprint: keep the amount of pinned kernel memory low (most memory | 34 | - footprint: |
| 35 | keep the amount of pinned kernel memory low (most memory | ||
| 25 | should be shrinkable) | 36 | should be shrinkable) |
| 26 | - reliability: avoid multipage or GFP_ATOMIC allocations | 37 | - reliability: |
| 38 | avoid multipage or GFP_ATOMIC allocations | ||
| 27 | 39 | ||
| 28 | Acronyms | 40 | Acronyms |
| 29 | ======== | 41 | ======== |
| 30 | 42 | ||
| 43 | ==== ==================================================================== | ||
| 31 | pfn host page frame number | 44 | pfn host page frame number |
| 32 | hpa host physical address | 45 | hpa host physical address |
| 33 | hva host virtual address | 46 | hva host virtual address |
| @@ -41,6 +54,7 @@ pte page table entry (used also to refer generically to paging structure · 7 unmodified lines | |||
| 41 | gpte guest pte (referring to gfns) | 54 | gpte guest pte (referring to gfns) |
| 42 | spte shadow pte (referring to pfns) | 55 | spte shadow pte (referring to pfns) |
| 43 | tdp two dimensional paging (vendor neutral term for NPT and EPT) | 56 | tdp two dimensional paging (vendor neutral term for NPT and EPT) |
| 57 | ==== ==================================================================== | ||
| 44 | 58 | ||
| 45 | Virtual and real hardware supported | 59 | Virtual and real hardware supported |
| 46 | =================================== | 60 | =================================== |
| @@ -90,11 +104,13 @@ Events · 43 unmodified lines | |||
| 90 | The mmu is driven by events, some from the guest, some from the host. | 104 | The mmu is driven by events, some from the guest, some from the host. |
| 91 | 105 | ||
| 92 | Guest generated events: | 106 | Guest generated events: |
| 107 | |||
| 93 | - writes to control registers (especially cr3) | 108 | - writes to control registers (especially cr3) |
| 94 | - invlpg/invlpga instruction execution | 109 | - invlpg/invlpga instruction execution |
| 95 | - access to missing or protected translations | 110 | - access to missing or protected translations |
| 96 | 111 | ||
| 97 | Host generated events: | 112 | Host generated events: |
| 113 | |||
| 98 | - changes in the gpa->hpa translation (either through gpa->hva changes or | 114 | - changes in the gpa->hpa translation (either through gpa->hva changes or |
| 99 | through hva->hpa changes) | 115 | through hva->hpa changes) |
| 100 | - memory pressure (the shrinker) | 116 | - memory pressure (the shrinker) |
| @@ -117,16 +133,19 @@ Leaf ptes point at guest pages. · 16 unmodified lines | |||
| 117 | The following table shows translations encoded by leaf ptes, with higher-level | 133 | The following table shows translations encoded by leaf ptes, with higher-level |
| 118 | translations in parentheses: | 134 | translations in parentheses: |
| 119 | 135 | ||
| 120 | Non-nested guests: | 136 | Non-nested guests:: |
| 137 | |||
| 121 | nonpaging: gpa->hpa | 138 | nonpaging: gpa->hpa |
| 122 | paging: gva->gpa->hpa | 139 | paging: gva->gpa->hpa |
| 123 | paging, tdp: (gva->)gpa->hpa | 140 | paging, tdp: (gva->)gpa->hpa |
| 124 | Nested guests: | 141 | |
| 142 | Nested guests:: | ||
| 143 | |||
| 125 | non-tdp: ngva->gpa->hpa (*) | 144 | non-tdp: ngva->gpa->hpa (*) |
| 126 | tdp: (ngva->)ngpa->gpa->hpa | 145 | tdp: (ngva->)ngpa->gpa->hpa |
| 127 | 146 | ||
| 128 | (*) the guest hypervisor will encode the ngva->gpa translation into its page | 147 | (*) the guest hypervisor will encode the ngva->gpa translation into its page |
| 129 | tables if npt is not present | 148 | tables if npt is not present |
| 130 | 149 | ||
| 131 | Shadow pages contain the following information: | 150 | Shadow pages contain the following information: |
| 132 | role.level: | 151 | role.level: |
| @@ -291,28 +310,41 @@ Handling a page fault is performed as follows: · 158 unmodified lines | |||
| 291 | 310 | ||
| 292 | - if the RSV bit of the error code is set, the page fault is caused by guest | 311 | - if the RSV bit of the error code is set, the page fault is caused by guest |
| 293 | accessing MMIO and cached MMIO information is available. | 312 | accessing MMIO and cached MMIO information is available. |
| 313 | |||
| 294 | - walk shadow page table | 314 | - walk shadow page table |
| 295 | - check for valid generation number in the spte (see "Fast invalidation of | 315 | - check for valid generation number in the spte (see "Fast invalidation of |
| 296 | MMIO sptes" below) | 316 | MMIO sptes" below) |
| 297 | - cache the information to vcpu->arch.mmio_gva, vcpu->arch.mmio_access and | 317 | - cache the information to vcpu->arch.mmio_gva, vcpu->arch.mmio_access and |
| 298 | vcpu->arch.mmio_gfn, and call the emulator | 318 | vcpu->arch.mmio_gfn, and call the emulator |
| 319 | |||
| 299 | - If both P bit and R/W bit of error code are set, this could possibly | 320 | - If both P bit and R/W bit of error code are set, this could possibly |
| 300 | be handled as a "fast page fault" (fixed without taking the MMU lock). See | 321 | be handled as a "fast page fault" (fixed without taking the MMU lock). See |
| 301 | the description in Documentation/virt/kvm/locking.txt. | 322 | the description in Documentation/virt/kvm/locking.txt. |
| 323 | |||
| 302 | - if needed, walk the guest page tables to determine the guest translation | 324 | - if needed, walk the guest page tables to determine the guest translation |
| 303 | (gva->gpa or ngpa->gpa) | 325 | (gva->gpa or ngpa->gpa) |
| 326 | |||
| 304 | - if permissions are insufficient, reflect the fault back to the guest | 327 | - if permissions are insufficient, reflect the fault back to the guest |
| 328 | |||
| 305 | - determine the host page | 329 | - determine the host page |
| 330 | |||
| 306 | - if this is an mmio request, there is no host page; cache the info to | 331 | - if this is an mmio request, there is no host page; cache the info to |
| 307 | vcpu->arch.mmio_gva, vcpu->arch.mmio_access and vcpu->arch.mmio_gfn | 332 | vcpu->arch.mmio_gva, vcpu->arch.mmio_access and vcpu->arch.mmio_gfn |
| 333 | |||
| 308 | - walk the shadow page table to find the spte for the translation, | 334 | - walk the shadow page table to find the spte for the translation, |
| 309 | instantiating missing intermediate page tables as necessary | 335 | instantiating missing intermediate page tables as necessary |
| 336 | |||
| 310 | - If this is an mmio request, cache the mmio info to the spte and set some | 337 | - If this is an mmio request, cache the mmio info to the spte and set some |
| 311 | reserved bit on the spte (see callers of kvm_mmu_set_mmio_spte_mask) | 338 | reserved bit on the spte (see callers of kvm_mmu_set_mmio_spte_mask) |
| 339 | |||
| 312 | - try to unsynchronize the page | 340 | - try to unsynchronize the page |
| 341 | |||
| 313 | - if successful, we can let the guest continue and modify the gpte | 342 | - if successful, we can let the guest continue and modify the gpte |
| 343 | |||
| 314 | - emulate the instruction | 344 | - emulate the instruction |
| 345 | |||
| 315 | - if failed, unshadow the page and let the guest continue | 346 | - if failed, unshadow the page and let the guest continue |
| 347 | |||
| 316 | - update any translations that were modified by the instruction | 348 | - update any translations that were modified by the instruction |
| 317 | 349 | ||
| 318 | invlpg handling: | 350 | invlpg handling: |
| @@ -324,10 +356,12 @@ invlpg handling: · 5 unmodified lines | |||
| 324 | Guest control register updates: | 356 | Guest control register updates: |
| 325 | 357 | ||
| 326 | - mov to cr3 | 358 | - mov to cr3 |
| 359 | |||
| 327 | - look up new shadow roots | 360 | - look up new shadow roots |
| 328 | - synchronize newly reachable shadow pages | 361 | - synchronize newly reachable shadow pages |
| 329 | 362 | ||
| 330 | - mov to cr0/cr4/efer | 363 | - mov to cr0/cr4/efer |
| 364 | |||
| 331 | - set up mmu context for new paging mode | 365 | - set up mmu context for new paging mode |
| 332 | - look up new shadow roots | 366 | - look up new shadow roots |
| 333 | - synchronize newly reachable shadow pages | 367 | - synchronize newly reachable shadow pages |
| @@ -358,6 +392,7 @@ on fault type: · 24 unmodified lines | |||
| 358 | (user write faults generate a #PF) | 392 | (user write faults generate a #PF) |
| 359 | 393 | ||
| 360 | In the first case there are two additional complications: | 394 | In the first case there are two additional complications: |
| 395 | |||
| 361 | - if CR4.SMEP is enabled: since we've turned the page into a kernel page, | 396 | - if CR4.SMEP is enabled: since we've turned the page into a kernel page, |
| 362 | the kernel may now execute it. We handle this by also setting spte.nx. | 397 | the kernel may now execute it. We handle this by also setting spte.nx. |
| 363 | If we get a user fetch or read fault, we'll change spte.u=1 and | 398 | If we get a user fetch or read fault, we'll change spte.u=1 and |
| @@ -446,4 +481,3 @@ Further reading · 82 unmodified lines | |||
| 446 | 481 | ||
| 447 | - NPT presentation from KVM Forum 2008 | 482 | - NPT presentation from KVM Forum 2008 |
| 448 | http://www.linux-kvm.org/images/c/c8/KvmForum2008%24kdf2008_21.pdf | 483 | http://www.linux-kvm.org/images/c/c8/KvmForum2008%24kdf2008_21.pdf |
| 449 | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | KVM-specific MSRs. | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | Glauber Costa <glommer@redhat.com>, Red Hat Inc, 2010 | 2 | |
| 3 | ===================================================== | 3 | ================= |
| 4 | KVM-specific MSRs | ||
| 5 | ================= | ||
| 6 | |||
| 7 | :Author: Glauber Costa <glommer@redhat.com>, Red Hat Inc, 2010 | ||
| 4 | 8 | ||
| 5 | KVM makes use of some custom MSRs to service some requests. | 9 | KVM makes use of some custom MSRs to service some requests. |
| 6 | 10 | ||
| @@ -9,34 +13,39 @@ Custom MSRs have a range reserved for them, that goes from · 2 unmodified lines | |||
| 9 | but they are deprecated and their use is discouraged. | 13 | but they are deprecated and their use is discouraged. |
| 10 | 14 | ||
| 11 | Custom MSR list | 15 | Custom MSR list |
| 12 | -------- | 16 | --------------- |
| 13 | 17 | ||
| 14 | The current supported Custom MSR list is: | 18 | The current supported Custom MSR list is: |
| 15 | 19 | ||
| 16 | MSR_KVM_WALL_CLOCK_NEW: 0x4b564d00 | 20 | MSR_KVM_WALL_CLOCK_NEW: |
| 21 | 0x4b564d00 | ||
| 17 | 22 | ||
| 18 | data: 4-byte alignment physical address of a memory area which must be | 23 | data: |
| 24 | 4-byte alignment physical address of a memory area which must be | ||
| 19 | in guest RAM. This memory is expected to hold a copy of the following | 25 | in guest RAM. This memory is expected to hold a copy of the following |
| 20 | structure: | 26 | structure:: |
| 21 | 27 | ||
| 22 | struct pvclock_wall_clock { | 28 | struct pvclock_wall_clock { |
| 23 | u32 version; | 29 | u32 version; |
| 24 | u32 sec; | 30 | u32 sec; |
| 25 | u32 nsec; | 31 | u32 nsec; |
| 26 | } __attribute__((__packed__)); | 32 | } __attribute__((__packed__)); |
| 27 | 33 | ||
| 28 | whose data will be filled in by the hypervisor. The hypervisor is only | 34 | whose data will be filled in by the hypervisor. The hypervisor is only |
| 29 | guaranteed to update this data at the moment of MSR write. | 35 | guaranteed to update this data at the moment of MSR write. |
| 30 | Users that want to reliably query this information more than once have | 36 | Users that want to reliably query this information more than once have |
| 31 | to write more than once to this MSR. Fields have the following meanings: | 37 | to write more than once to this MSR. Fields have the following meanings: |
| 32 | 38 | ||
| 33 | version: guest has to check version before and after grabbing | 39 | version: |
| 40 | guest has to check version before and after grabbing | ||
| 34 | time information and check that they are both equal and even. | 41 | time information and check that they are both equal and even. |
| 35 | An odd version indicates an in-progress update. | 42 | An odd version indicates an in-progress update. |
| 36 | 43 | ||
| 37 | sec: number of seconds for wallclock at time of boot. | 44 | sec: |
| 45 | number of seconds for wallclock at time of boot. | ||
| 38 | 46 | ||
| 39 | nsec: number of nanoseconds for wallclock at time of boot. | 47 | nsec: |
| 48 | number of nanoseconds for wallclock at time of boot. | ||
| 40 | 49 | ||
| 41 | In order to get the current wallclock time, the system_time from | 50 | In order to get the current wallclock time, the system_time from |
| 42 | MSR_KVM_SYSTEM_TIME_NEW needs to be added. | 51 | MSR_KVM_SYSTEM_TIME_NEW needs to be added. |
| @@ -47,13 +56,15 @@ MSR_KVM_WALL_CLOCK_NEW: 0x4b564d00 · 4 unmodified lines | |||
| 47 | Availability of this MSR must be checked via bit 3 in 0x4000001 cpuid | 56 | Availability of this MSR must be checked via bit 3 in 0x4000001 cpuid |
| 48 | leaf prior to usage. | 57 | leaf prior to usage. |
| 49 | 58 | ||
| 50 | MSR_KVM_SYSTEM_TIME_NEW: 0x4b564d01 | 59 | MSR_KVM_SYSTEM_TIME_NEW: |
| 60 | 0x4b564d01 | ||
| 51 | 61 | ||
| 52 | data: 4-byte aligned physical address of a memory area which must be in | 62 | data: |
| 63 | 4-byte aligned physical address of a memory area which must be in | ||
| 53 | guest RAM, plus an enable bit in bit 0. This memory is expected to hold | 64 | guest RAM, plus an enable bit in bit 0. This memory is expected to hold |
| 54 | a copy of the following structure: | 65 | a copy of the following structure:: |
| 55 | 66 | ||
| 56 | struct pvclock_vcpu_time_info { | 67 | struct pvclock_vcpu_time_info { |
| 57 | u32 version; | 68 | u32 version; |
| 58 | u32 pad0; | 69 | u32 pad0; |
| 59 | u64 tsc_timestamp; | 70 | u64 tsc_timestamp; |
| @@ -62,7 +73,7 @@ MSR_KVM_SYSTEM_TIME_NEW: 0x4b564d01 · 2 unmodified lines | |||
| 62 | s8 tsc_shift; | 73 | s8 tsc_shift; |
| 63 | u8 flags; | 74 | u8 flags; |
| 64 | u8 pad[2]; | 75 | u8 pad[2]; |
| 65 | } __attribute__((__packed__)); /* 32 bytes */ | 76 | } __attribute__((__packed__)); /* 32 bytes */ |
| 66 | 77 | ||
| 67 | whose data will be filled in by the hypervisor periodically. Only one | 78 | whose data will be filled in by the hypervisor periodically. Only one |
| 68 | write, or registration, is needed for each VCPU. The interval between | 79 | write, or registration, is needed for each VCPU. The interval between |
| @@ -72,23 +83,28 @@ MSR_KVM_SYSTEM_TIME_NEW: 0x4b564d01 · 3 unmodified lines | |||
| 72 | 83 | ||
| 73 | Fields have the following meanings: | 84 | Fields have the following meanings: |
| 74 | 85 | ||
| 75 | version: guest has to check version before and after grabbing | 86 | version: |
| 87 | guest has to check version before and after grabbing | ||
| 76 | time information and check that they are both equal and even. | 88 | time information and check that they are both equal and even. |
| 77 | An odd version indicates an in-progress update. | 89 | An odd version indicates an in-progress update. |
| 78 | 90 | ||
| 79 | tsc_timestamp: the tsc value at the current VCPU at the time | 91 | tsc_timestamp: |
| 92 | the tsc value at the current VCPU at the time | ||
| 80 | of the update of this structure. Guests can subtract this value | 93 | of the update of this structure. Guests can subtract this value |
| 81 | from current tsc to derive a notion of elapsed time since the | 94 | from current tsc to derive a notion of elapsed time since the |
| 82 | structure update. | 95 | structure update. |
| 83 | 96 | ||
| 84 | system_time: a host notion of monotonic time, including sleep | 97 | system_time: |
| 98 | a host notion of monotonic time, including sleep | ||
| 85 | time at the time this structure was last updated. Unit is | 99 | time at the time this structure was last updated. Unit is |
| 86 | nanoseconds. | 100 | nanoseconds. |
| 87 | 101 | ||
| 88 | tsc_to_system_mul: multiplier to be used when converting | 102 | tsc_to_system_mul: |
| 103 | multiplier to be used when converting | ||
| 89 | tsc-related quantity to nanoseconds | 104 | tsc-related quantity to nanoseconds |
| 90 | 105 | ||
| 91 | tsc_shift: shift to be used when converting tsc-related | 106 | tsc_shift: |
| 107 | shift to be used when converting tsc-related | ||
| 92 | quantity to nanoseconds. This shift will ensure that | 108 | quantity to nanoseconds. This shift will ensure that |
| 93 | multiplication with tsc_to_system_mul does not overflow. | 109 | multiplication with tsc_to_system_mul does not overflow. |
| 94 | A positive value denotes a left shift, a negative value | 110 | A positive value denotes a left shift, a negative value |
| @@ -96,7 +112,7 @@ MSR_KVM_SYSTEM_TIME_NEW: 0x4b564d01 · 1 unmodified line | |||
| 96 | 112 | ||
| 97 | The conversion from tsc to nanoseconds involves an additional | 113 | The conversion from tsc to nanoseconds involves an additional |
| 98 | right shift by 32 bits. With this information, guests can | 114 | right shift by 32 bits. With this information, guests can |
| 99 | derive per-CPU time by doing: | 115 | derive per-CPU time by doing:: |
| 100 | 116 | ||
| 101 | time = (current_tsc - tsc_timestamp) | 117 | time = (current_tsc - tsc_timestamp) |
| 102 | if (tsc_shift >= 0) | 118 | if (tsc_shift >= 0) |
| @@ -106,29 +122,34 @@ MSR_KVM_SYSTEM_TIME_NEW: 0x4b564d01 · 3 unmodified lines | |||
| 106 | time = (time * tsc_to_system_mul) >> 32 | 122 | time = (time * tsc_to_system_mul) >> 32 |
| 107 | time = time + system_time | 123 | time = time + system_time |
| 108 | 124 | ||
| 109 | flags: bits in this field indicate extended capabilities | 125 | flags: |
| 126 | bits in this field indicate extended capabilities | ||
| 110 | coordinated between the guest and the hypervisor. Availability | 127 | coordinated between the guest and the hypervisor. Availability |
| 111 | of specific flags has to be checked in 0x40000001 cpuid leaf. | 128 | of specific flags has to be checked in 0x40000001 cpuid leaf. |
| 112 | Current flags are: | 129 | Current flags are: |
| 113 | 130 | ||
| 114 | flag bit | cpuid bit | meaning | 131 | |
| 115 | ------------------------------------------------------------- | 132 | +-----------+--------------+----------------------------------+ |
| 116 | | | time measures taken across | 133 | | flag bit | cpuid bit | meaning | |
| 117 | 0 | 24 | multiple cpus are guaranteed to | 134 | +-----------+--------------+----------------------------------+ |
| 118 | | | be monotonic | 135 | | | | time measures taken across | |
| 119 | ------------------------------------------------------------- | 136 | | 0 | 24 | multiple cpus are guaranteed to | |
| 120 | | | guest vcpu has been paused by | 137 | | | | be monotonic | |
| 121 | 1 | N/A | the host | 138 | +-----------+--------------+----------------------------------+ |
| 122 | | | See 4.70 in api.txt | 139 | | | | guest vcpu has been paused by | |
| 123 | ------------------------------------------------------------- | 140 | | 1 | N/A | the host | |
| 141 | | | | See 4.70 in api.txt | | ||
| 142 | +-----------+--------------+----------------------------------+ | ||
| 124 | 143 | ||
| 125 | Availability of this MSR must be checked via bit 3 in 0x4000001 cpuid | 144 | Availability of this MSR must be checked via bit 3 in 0x4000001 cpuid |
| 126 | leaf prior to usage. | 145 | leaf prior to usage. |
| 127 | 146 | ||
| 128 | 147 | ||
| 129 | MSR_KVM_WALL_CLOCK: 0x11 | 148 | MSR_KVM_WALL_CLOCK: |
| 149 | 0x11 | ||
| 130 | 150 | ||
| 131 | data and functioning: same as MSR_KVM_WALL_CLOCK_NEW. Use that instead. | 151 | data and functioning: |
| 152 | same as MSR_KVM_WALL_CLOCK_NEW. Use that instead. | ||
| 132 | 153 | ||
| 133 | This MSR falls outside the reserved KVM range and may be removed in the | 154 | This MSR falls outside the reserved KVM range and may be removed in the |
| 134 | future. Its usage is deprecated. | 155 | future. Its usage is deprecated. |
| @@ -136,9 +157,11 @@ MSR_KVM_WALL_CLOCK: 0x11 · 1 unmodified line | |||
| 136 | Availability of this MSR must be checked via bit 0 in 0x4000001 cpuid | 157 | Availability of this MSR must be checked via bit 0 in 0x4000001 cpuid |
| 137 | leaf prior to usage. | 158 | leaf prior to usage. |
| 138 | 159 | ||
| 139 | MSR_KVM_SYSTEM_TIME: 0x12 | 160 | MSR_KVM_SYSTEM_TIME: |
| 161 | 0x12 | ||
| 140 | 162 | ||
| 141 | data and functioning: same as MSR_KVM_SYSTEM_TIME_NEW. Use that instead. | 163 | data and functioning: |
| 164 | same as MSR_KVM_SYSTEM_TIME_NEW. Use that instead. | ||
| 142 | 165 | ||
| 143 | This MSR falls outside the reserved KVM range and may be removed in the | 166 | This MSR falls outside the reserved KVM range and may be removed in the |
| 144 | future. Its usage is deprecated. | 167 | future. Its usage is deprecated. |
| @@ -146,7 +169,7 @@ MSR_KVM_SYSTEM_TIME: 0x12 · 1 unmodified line | |||
| 146 | Availability of this MSR must be checked via bit 0 in 0x4000001 cpuid | 169 | Availability of this MSR must be checked via bit 0 in 0x4000001 cpuid |
| 147 | leaf prior to usage. | 170 | leaf prior to usage. |
| 148 | 171 | ||
| 149 | The suggested algorithm for detecting kvmclock presence is then: | 172 | The suggested algorithm for detecting kvmclock presence is then:: |
| 150 | 173 | ||
| 151 | if (!kvm_para_available()) /* refer to cpuid.txt */ | 174 | if (!kvm_para_available()) /* refer to cpuid.txt */ |
| 152 | return NON_PRESENT; | 175 | return NON_PRESENT; |
| @@ -163,8 +186,11 @@ MSR_KVM_SYSTEM_TIME: 0x12 · 10 unmodified lines | |||
| 163 | } else | 186 | } else |
| 164 | return NON_PRESENT; | 187 | return NON_PRESENT; |
| 165 | 188 | ||
| 166 | MSR_KVM_ASYNC_PF_EN: 0x4b564d02 | 189 | MSR_KVM_ASYNC_PF_EN: |
| 167 | data: Bits 63-6 hold 64-byte aligned physical address of a | 190 | 0x4b564d02 |
| 191 | |||
| 192 | data: | ||
| 193 | Bits 63-6 hold 64-byte aligned physical address of a | ||
| 168 | 64 byte memory area which must be in guest RAM and must be | 194 | 64 byte memory area which must be in guest RAM and must be |
| 169 | zeroed. Bits 5-3 are reserved and should be zero. Bit 0 is 1 | 195 | zeroed. Bits 5-3 are reserved and should be zero. Bit 0 is 1 |
| 170 | when asynchronous page faults are enabled on the vcpu 0 when | 196 | when asynchronous page faults are enabled on the vcpu 0 when |
| @@ -200,20 +226,22 @@ MSR_KVM_ASYNC_PF_EN: 0x4b564d02 · 29 unmodified lines | |||
| 200 | Currently type 2 APF will be always delivered on the same vcpu as | 226 | Currently type 2 APF will be always delivered on the same vcpu as |
| 201 | type 1 was, but guest should not rely on that. | 227 | type 1 was, but guest should not rely on that. |
| 202 | 228 | ||
| 203 | MSR_KVM_STEAL_TIME: 0x4b564d03 | 229 | MSR_KVM_STEAL_TIME: |
| 230 | 0x4b564d03 | ||
| 204 | 231 | ||
| 205 | data: 64-byte alignment physical address of a memory area which must be | 232 | data: |
| 233 | 64-byte alignment physical address of a memory area which must be | ||
| 206 | in guest RAM, plus an enable bit in bit 0. This memory is expected to | 234 | in guest RAM, plus an enable bit in bit 0. This memory is expected to |
| 207 | hold a copy of the following structure: | 235 | hold a copy of the following structure:: |
| 208 | 236 | ||
| 209 | struct kvm_steal_time { | 237 | struct kvm_steal_time { |
| 210 | __u64 steal; | 238 | __u64 steal; |
| 211 | __u32 version; | 239 | __u32 version; |
| 212 | __u32 flags; | 240 | __u32 flags; |
| 213 | __u8 preempted; | 241 | __u8 preempted; |
| 214 | __u8 u8_pad[3]; | 242 | __u8 u8_pad[3]; |
| 215 | __u32 pad[11]; | 243 | __u32 pad[11]; |
| 216 | } | 244 | } |
| 217 | 245 | ||
| 218 | whose data will be filled in by the hypervisor periodically. Only one | 246 | whose data will be filled in by the hypervisor periodically. Only one |
| 219 | write, or registration, is needed for each VCPU. The interval between | 247 | write, or registration, is needed for each VCPU. The interval between |
| @@ -224,25 +252,32 @@ MSR_KVM_STEAL_TIME: 0x4b564d03 · 4 unmodified lines | |||
| 224 | 252 | ||
| 225 | Fields have the following meanings: | 253 | Fields have the following meanings: |
| 226 | 254 | ||
| 227 | version: a sequence counter. In other words, guest has to check | 255 | version: |
| 256 | a sequence counter. In other words, guest has to check | ||
| 228 | this field before and after grabbing time information and make | 257 | this field before and after grabbing time information and make |
| 229 | sure they are both equal and even. An odd version indicates an | 258 | sure they are both equal and even. An odd version indicates an |
| 230 | in-progress update. | 259 | in-progress update. |
| 231 | 260 | ||
| 232 | flags: At this point, always zero. May be used to indicate | 261 | flags: |
| 262 | At this point, always zero. May be used to indicate | ||
| 233 | changes in this structure in the future. | 263 | changes in this structure in the future. |
| 234 | 264 | ||
| 235 | steal: the amount of time in which this vCPU did not run, in | 265 | steal: |
| 266 | the amount of time in which this vCPU did not run, in | ||
| 236 | nanoseconds. Time during which the vcpu is idle, will not be | 267 | nanoseconds. Time during which the vcpu is idle, will not be |
| 237 | reported as steal time. | 268 | reported as steal time. |
| 238 | 269 | ||
| 239 | preempted: indicate the vCPU who owns this struct is running or | 270 | preempted: |
| 271 | indicate the vCPU who owns this struct is running or | ||
| 240 | not. Non-zero values mean the vCPU has been preempted. Zero | 272 | not. Non-zero values mean the vCPU has been preempted. Zero |
| 241 | means the vCPU is not preempted. NOTE, it is always zero if the | 273 | means the vCPU is not preempted. NOTE, it is always zero if the |
| 242 | the hypervisor doesn't support this field. | 274 | the hypervisor doesn't support this field. |
| 243 | 275 | ||
| 244 | MSR_KVM_EOI_EN: 0x4b564d04 | 276 | MSR_KVM_EOI_EN: |
| 245 | data: Bit 0 is 1 when PV end of interrupt is enabled on the vcpu; 0 | 277 | 0x4b564d04 |
| 278 | |||
| 279 | data: | ||
| 280 | Bit 0 is 1 when PV end of interrupt is enabled on the vcpu; 0 | ||
| 246 | when disabled. Bit 1 is reserved and must be zero. When PV end of | 281 | when disabled. Bit 1 is reserved and must be zero. When PV end of |
| 247 | interrupt is enabled (bit 0 set), bits 63-2 hold a 4-byte aligned | 282 | interrupt is enabled (bit 0 set), bits 63-2 hold a 4-byte aligned |
| 248 | physical address of a 4 byte memory area which must be in guest RAM and | 283 | physical address of a 4 byte memory area which must be in guest RAM and |
| @@ -274,11 +309,13 @@ MSR_KVM_EOI_EN: 0x4b564d04 · 25 unmodified lines | |||
| 274 | clear it using a single CPU instruction, such as test and clear, or | 309 | clear it using a single CPU instruction, such as test and clear, or |
| 275 | compare and exchange. | 310 | compare and exchange. |
| 276 | 311 | ||
| 277 | MSR_KVM_POLL_CONTROL: 0x4b564d05 | 312 | MSR_KVM_POLL_CONTROL: |
| 313 | 0x4b564d05 | ||
| 314 | |||
| 278 | Control host-side polling. | 315 | Control host-side polling. |
| 279 | 316 | ||
| 280 | data: Bit 0 enables (1) or disables (0) host-side HLT polling logic. | 317 | data: |
| 318 | Bit 0 enables (1) or disables (0) host-side HLT polling logic. | ||
| 281 | 319 | ||
| 282 | KVM guests can request the host not to poll on HLT, for example if | 320 | KVM guests can request the host not to poll on HLT, for example if |
| 283 | they are performing polling themselves. | 321 | they are performing polling themselves. |
| 284 | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ========== | ||
| 1 | Nested VMX | 4 | Nested VMX |
| 2 | ========== | 5 | ========== |
| 3 | 6 | ||
| @@ -41,9 +44,9 @@ No modifications are required to user space (qemu). However, qemu's default · 37 unmodified lines | |||
| 41 | emulated CPU type (qemu64) does not list the "VMX" CPU feature, so it must be | 44 | emulated CPU type (qemu64) does not list the "VMX" CPU feature, so it must be |
| 42 | explicitly enabled, by giving qemu one of the following options: | 45 | explicitly enabled, by giving qemu one of the following options: |
| 43 | 46 | ||
| 44 | -cpu host (emulated CPU has all features of the real CPU) | 47 | - cpu host (emulated CPU has all features of the real CPU) |
| 45 | 48 | ||
| 46 | -cpu qemu64,+vmx (add just the vmx feature to a named CPU type) | 49 | - cpu qemu64,+vmx (add just the vmx feature to a named CPU type) |
| 47 | 50 | ||
| 48 | 51 | ||
| 49 | ABIs | 52 | ABIs |
| @@ -75,6 +78,8 @@ of this structure changes, this can break live migration across KVM versions. · 25 unmodified lines | |||
| 75 | VMCS12_REVISION (from vmx.c) should be changed if struct vmcs12 or its inner | 78 | VMCS12_REVISION (from vmx.c) should be changed if struct vmcs12 or its inner |
| 76 | struct shadow_vmcs is ever changed. | 79 | struct shadow_vmcs is ever changed. |
| 77 | 80 | ||
| 81 | :: | ||
| 82 | |||
| 78 | typedef u64 natural_width; | 83 | typedef u64 natural_width; |
| 79 | struct __packed vmcs12 { | 84 | struct __packed vmcs12 { |
| 80 | /* According to the Intel spec, a VMCS region must start with | 85 | /* According to the Intel spec, a VMCS region must start with |
| @@ -220,21 +225,21 @@ Authors · 139 unmodified lines | |||
| 220 | ------- | 225 | ------- |
| 221 | 226 | ||
| 222 | These patches were written by: | 227 | These patches were written by: |
| 223 | Abel Gordon, abelg <at> il.ibm.com | 228 | - Abel Gordon, abelg <at> il.ibm.com |
| 224 | Nadav Har'El, nyh <at> il.ibm.com | 229 | - Nadav Har'El, nyh <at> il.ibm.com |
| 225 | Orit Wasserman, oritw <at> il.ibm.com | 230 | - Orit Wasserman, oritw <at> il.ibm.com |
| 226 | Ben-Ami Yassor, benami <at> il.ibm.com | 231 | - Ben-Ami Yassor, benami <at> il.ibm.com |
| 227 | Muli Ben-Yehuda, muli <at> il.ibm.com | 232 | - Muli Ben-Yehuda, muli <at> il.ibm.com |
| 228 | 233 | ||
| 229 | With contributions by: | 234 | With contributions by: |
| 230 | Anthony Liguori, aliguori <at> us.ibm.com | 235 | - Anthony Liguori, aliguori <at> us.ibm.com |
| 231 | Mike Day, mdday <at> us.ibm.com | 236 | - Mike Day, mdday <at> us.ibm.com |
| 232 | Michael Factor, factor <at> il.ibm.com | 237 | - Michael Factor, factor <at> il.ibm.com |
| 233 | Zvi Dubitzky, dubi <at> il.ibm.com | 238 | - Zvi Dubitzky, dubi <at> il.ibm.com |
| 234 | 239 | ||
| 235 | And valuable reviews by: | 240 | And valuable reviews by: |
| 236 | Avi Kivity, avi <at> redhat.com | 241 | - Avi Kivity, avi <at> redhat.com |
| 237 | Gleb Natapov, gleb <at> redhat.com | 242 | - Gleb Natapov, gleb <at> redhat.com |
| 238 | Marcelo Tosatti, mtosatti <at> redhat.com | 243 | - Marcelo Tosatti, mtosatti <at> redhat.com |
| 239 | Kevin Tian, kevin.tian <at> intel.com | 244 | - Kevin Tian, kevin.tian <at> intel.com |
| 240 | and others. | 245 | - and others. |
| @@ -1,3 +1,6 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ================================= | ||
| 1 | The PPC KVM paravirtual interface | 4 | The PPC KVM paravirtual interface |
| 2 | ================================= | 5 | ================================= |
| 3 | 6 | ||
| @@ -34,8 +37,9 @@ up the hypercall. To call a hypercall, just call these instructions. · 30 unmodified lines | |||
| 34 | 37 | ||
| 35 | The parameters are as follows: | 38 | The parameters are as follows: |
| 36 | 39 | ||
| 40 | ======== ================ ================ | ||
| 37 | Register IN OUT | 41 | Register IN OUT |
| 38 | 42 | ======== ================ ================ | |
| 39 | r0 - volatile | 43 | r0 - volatile |
| 40 | r3 1st parameter Return code | 44 | r3 1st parameter Return code |
| 41 | r4 2nd parameter 1st output value | 45 | r4 2nd parameter 1st output value |
| @@ -47,6 +51,7 @@ The parameters are as follows: · 5 unmodified lines | |||
| 47 | r10 8th parameter 7th output value | 51 | r10 8th parameter 7th output value |
| 48 | r11 hypercall number 8th output value | 52 | r11 hypercall number 8th output value |
| 49 | r12 - volatile | 53 | r12 - volatile |
| 54 | ======== ================ ================ | ||
| 50 | 55 | ||
| 51 | Hypercall definitions are shared in generic code, so the same hypercall numbers | 56 | Hypercall definitions are shared in generic code, so the same hypercall numbers |
| 52 | apply for x86 and powerpc alike with the exception that each KVM hypercall | 57 | apply for x86 and powerpc alike with the exception that each KVM hypercall |
| @@ -54,11 +59,13 @@ also needs to be ORed with the KVM vendor code which is (42 << 16). · 1 unmodified line | |||
| 54 | 59 | ||
| 55 | Return codes can be as follows: | 60 | Return codes can be as follows: |
| 56 | 61 | ||
| 62 | ==== ========================= | ||
| 57 | Code Meaning | 63 | Code Meaning |
| 58 | 64 | ==== ========================= | |
| 59 | 0 Success | 65 | 0 Success |
| 60 | 12 Hypercall not implemented | 66 | 12 Hypercall not implemented |
| 61 | <0 Error | 67 | <0 Error |
| 68 | ==== ========================= | ||
| 62 | 69 | ||
| 63 | The magic page | 70 | The magic page |
| 64 | ============== | 71 | ============== |
| @@ -72,7 +79,7 @@ desired location. The first parameter indicates the effective address when the · 7 unmodified lines | |||
| 72 | MMU is enabled. The second parameter indicates the address in real mode, if | 79 | MMU is enabled. The second parameter indicates the address in real mode, if |
| 73 | applicable to the target. For now, we always map the page to -4096. This way we | 80 | applicable to the target. For now, we always map the page to -4096. This way we |
| 74 | can access it using absolute load and store functions. The following | 81 | can access it using absolute load and store functions. The following |
| 75 | instruction reads the first field of the magic page: | 82 | instruction reads the first field of the magic page:: |
| 76 | 83 | ||
| 77 | ld rX, -4096(0) | 84 | ld rX, -4096(0) |
| 78 | 85 | ||
| @@ -93,8 +100,10 @@ a bitmap of available features inside the magic page. · 14 unmodified lines | |||
| 93 | 100 | ||
| 94 | The following enhancements to the magic page are currently available: | 101 | The following enhancements to the magic page are currently available: |
| 95 | 102 | ||
| 103 | ============================ ======================================= | ||
| 96 | KVM_MAGIC_FEAT_SR Maps SR registers r/w in the magic page | 104 | KVM_MAGIC_FEAT_SR Maps SR registers r/w in the magic page |
| 97 | KVM_MAGIC_FEAT_MAS0_TO_SPRG7 Maps MASn, ESR, PIR and high SPRGs | 105 | KVM_MAGIC_FEAT_MAS0_TO_SPRG7 Maps MASn, ESR, PIR and high SPRGs |
| 106 | ============================ ======================================= | ||
| 98 | 107 | ||
| 99 | For enhanced features in the magic page, please check for the existence of the | 108 | For enhanced features in the magic page, please check for the existence of the |
| 100 | feature before using them! | 109 | feature before using them! |
| @@ -121,8 +130,8 @@ when entering the guest or don't have any impact on the hypervisor's behavior. · 20 unmodified lines | |||
| 121 | 130 | ||
| 122 | The following bits are safe to be set inside the guest: | 131 | The following bits are safe to be set inside the guest: |
| 123 | 132 | ||
| 124 | MSR_EE | 133 | - MSR_EE |
| 125 | MSR_RI | 134 | - MSR_RI |
| 126 | 135 | ||
| 127 | If any other bit changes in the MSR, please still use mtmsr(d). | 136 | If any other bit changes in the MSR, please still use mtmsr(d). |
| 128 | 137 | ||
| @@ -138,9 +147,9 @@ guest. Implementing any of those mappings is optional, as the instruction traps · 9 unmodified lines | |||
| 138 | also act on the shared page. So calling privileged instructions still works as | 147 | also act on the shared page. So calling privileged instructions still works as |
| 139 | before. | 148 | before. |
| 140 | 149 | ||
| 150 | ======================= ================================ | ||
| 141 | From To | 151 | From To |
| 142 | ==== == | 152 | ======================= ================================ |
| 143 | |||
| 144 | mfmsr rX ld rX, magic_page->msr | 153 | mfmsr rX ld rX, magic_page->msr |
| 145 | mfsprg rX, 0 ld rX, magic_page->sprg0 | 154 | mfsprg rX, 0 ld rX, magic_page->sprg0 |
| 146 | mfsprg rX, 1 ld rX, magic_page->sprg1 | 155 | mfsprg rX, 1 ld rX, magic_page->sprg1 |
| @@ -173,7 +182,7 @@ mtsrin rX, rY b <special mtsrin section> · 26 unmodified lines | |||
| 173 | 182 | ||
| 174 | [BookE only] | 183 | [BookE only] |
| 175 | wrteei [0|1] b <special wrteei section> | 184 | wrteei [0|1] b <special wrteei section> |
| 176 | 185 | ======================= ================================ | |
| 177 | 186 | ||
| 178 | Some instructions require more logic to determine what's going on than a load | 187 | Some instructions require more logic to determine what's going on than a load |
| 179 | or store instruction can deliver. To enable patching of those, we keep some | 188 | or store instruction can deliver. To enable patching of those, we keep some |
| @@ -191,6 +200,7 @@ for example. · 11 unmodified lines | |||
| 191 | 200 | ||
| 192 | Hypercall ABIs in KVM on PowerPC | 201 | Hypercall ABIs in KVM on PowerPC |
| 193 | ================================= | 202 | ================================= |
| 203 | |||
| 194 | 1) KVM hypercalls (ePAPR) | 204 | 1) KVM hypercalls (ePAPR) |
| 195 | 205 | ||
| 196 | These are ePAPR compliant hypercall implementation (mentioned above). Even | 206 | These are ePAPR compliant hypercall implementation (mentioned above). Even |
| @@ -1,3 +1,6 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ================================ | ||
| 1 | Review checklist for kvm patches | 4 | Review checklist for kvm patches |
| 2 | ================================ | 5 | ================================ |
| 3 | 6 | ||
| @@ -1,3 +1,6 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | ============================= | ||
| 1 | The s390 DIAGNOSE call on KVM | 4 | The s390 DIAGNOSE call on KVM |
| 2 | ============================= | 5 | ============================= |
| 3 | 6 | ||
| @@ -16,12 +19,12 @@ DIAGNOSE calls by the guest cause a mandatory intercept. This implies · 12 unmodified lines | |||
| 16 | all supported DIAGNOSE calls need to be handled by either KVM or its | 19 | all supported DIAGNOSE calls need to be handled by either KVM or its |
| 17 | userspace. | 20 | userspace. |
| 18 | 21 | ||
| 19 | All DIAGNOSE calls supported by KVM use the RS-a format: | 22 | All DIAGNOSE calls supported by KVM use the RS-a format:: |
| 20 | 23 | ||
| 21 | -------------------------------------- | 24 | -------------------------------------- |
| 22 | | '83' | R1 | R3 | B2 | D2 | | 25 | | '83' | R1 | R3 | B2 | D2 | |
| 23 | -------------------------------------- | 26 | -------------------------------------- |
| 24 | 0 8 12 16 20 31 | 27 | 0 8 12 16 20 31 |
| 25 | 28 | ||
| 26 | The second-operand address (obtained by the base/displacement calculation) | 29 | The second-operand address (obtained by the base/displacement calculation) |
| 27 | is not used to address data. Instead, bits 48-63 of this address specify | 30 | is not used to address data. Instead, bits 48-63 of this address specify |
| @@ -1,17 +1,21 @@ | |||
| 1 | .. SPDX-License-Identifier: GPL-2.0 | ||
| 1 | 2 | ||
| 2 | Timekeeping Virtualization for X86-Based Architectures | 3 | ====================================================== |
| 4 | Timekeeping Virtualization for X86-Based Architectures | ||
| 5 | ====================================================== | ||
| 3 | 6 | ||
| 4 | Zachary Amsden <zamsden@redhat.com> | 7 | :Author: Zachary Amsden <zamsden@redhat.com> |
| 5 | Copyright (c) 2010, Red Hat. All rights reserved. | 8 | :Copyright: (c) 2010, Red Hat. All rights reserved. |
| 6 | 9 | ||
| 7 | 1) Overview | 10 | .. Contents |
| 8 | 2) Timing Devices | ||
| 9 | 3) TSC Hardware | ||
| 10 | 4) Virtualization Problems | ||
| 11 | 11 | ||
| 12 | ========================================================================= | 12 | 1) Overview |
| 13 | 2) Timing Devices | ||
| 14 | 3) TSC Hardware | ||
| 15 | 4) Virtualization Problems | ||
| 13 | 16 | ||
| 14 | 1) Overview | 17 | 1. Overview |
| 18 | =========== | ||
| 15 | 19 | ||
| 16 | One of the most complicated parts of the X86 platform, and specifically, | 20 | One of the most complicated parts of the X86 platform, and specifically, |
| 17 | the virtualization of this platform is the plethora of timing devices available | 21 | the virtualization of this platform is the plethora of timing devices available |
| @@ -27,15 +31,15 @@ The purpose of this document is to collect data and information relevant to · 9 unmodified lines | |||
| 27 | timekeeping which may be difficult to find elsewhere, specifically, | 31 | timekeeping which may be difficult to find elsewhere, specifically, |
| 28 | information relevant to KVM and hardware-based virtualization. | 32 | information relevant to KVM and hardware-based virtualization. |
| 29 | 33 | ||
| 30 | ========================================================================= | 34 | 2. Timing Devices |
| 31 | 35 | ================= | |
| 32 | 2) Timing Devices | ||
| 33 | 36 | ||
| 34 | First we discuss the basic hardware devices available. TSC and the related | 37 | First we discuss the basic hardware devices available. TSC and the related |
| 35 | KVM clock are special enough to warrant a full exposition and are described in | 38 | KVM clock are special enough to warrant a full exposition and are described in |
| 36 | the following section. | 39 | the following section. |
| 37 | 40 | ||
| 38 | 2.1) i8254 - PIT | 41 | 2.1. i8254 - PIT |
| 42 | ---------------- | ||
| 39 | 43 | ||
| 40 | One of the first timer devices available is the programmable interrupt timer, | 44 | One of the first timer devices available is the programmable interrupt timer, |
| 41 | or PIT. The PIT has a fixed frequency 1.193182 MHz base clock and three | 45 | or PIT. The PIT has a fixed frequency 1.193182 MHz base clock and three |
| @@ -50,13 +54,13 @@ The PIT uses I/O ports 0x40 - 0x43. Access to the 16-bit counters is done · 8 unmodified lines | |||
| 50 | using single or multiple byte access to the I/O ports. There are 6 modes | 54 | using single or multiple byte access to the I/O ports. There are 6 modes |
| 51 | available, but not all modes are available to all timers, as only timer 2 | 55 | available, but not all modes are available to all timers, as only timer 2 |
| 52 | has a connected gate input, required for modes 1 and 5. The gate line is | 56 | has a connected gate input, required for modes 1 and 5. The gate line is |
| 53 | controlled by port 61h, bit 0, as illustrated in the following diagram. | 57 | controlled by port 61h, bit 0, as illustrated in the following diagram:: |
| 54 | 58 | ||
| 55 | -------------- ---------------- | 59 | -------------- ---------------- |
| 56 | | | | | | 60 | | | | | |
| 57 | | 1.1932 MHz |---------->| CLOCK OUT | ---------> IRQ 0 | 61 | | 1.1932 MHz|---------->| CLOCK OUT | ---------> IRQ 0 |
| 58 | | Clock | | | | | 62 | | Clock | | | | |
| 59 | -------------- | +->| GATE TIMER 0 | | 63 | -------------- | +->| GATE TIMER 0 | |
| 60 | | ---------------- | 64 | | ---------------- |
| 61 | | | 65 | | |
| 62 | | ---------------- | 66 | | ---------------- |
| @@ -70,29 +74,33 @@ controlled by port 61h, bit 0, as illustrated in the following diagram. · 7 unmodified lines | |||
| 70 | | | | | 74 | | | | |
| 71 | |------>| CLOCK OUT | ---------> Port 61h, bit 5 | 75 | |------>| CLOCK OUT | ---------> Port 61h, bit 5 |
| 72 | | | | | 76 | | | | |
| 73 | Port 61h, bit 0 ---------->| GATE TIMER 2 | \_.---- ____ | 77 | Port 61h, bit 0 -------->| GATE TIMER 2 | \_.---- ____ |
| 74 | ---------------- _| )--|LPF|---Speaker | 78 | ---------------- _| )--|LPF|---Speaker |
| 75 | / *---- \___/ | 79 | / *---- \___/ |
| 76 | Port 61h, bit 1 -----------------------------------/ | 80 | Port 61h, bit 1 ---------------------------------/ |
| 77 | 81 | ||
| 78 | The timer modes are now described. | 82 | The timer modes are now described. |
| 79 | 83 | ||
| 80 | Mode 0: Single Timeout. This is a one-shot software timeout that counts down | 84 | Mode 0: Single Timeout. |
| 85 | This is a one-shot software timeout that counts down | ||
| 81 | when the gate is high (always true for timers 0 and 1). When the count | 86 | when the gate is high (always true for timers 0 and 1). When the count |
| 82 | reaches zero, the output goes high. | 87 | reaches zero, the output goes high. |
| 83 | 88 | ||
| 84 | Mode 1: Triggered One-shot. The output is initially set high. When the gate | 89 | Mode 1: Triggered One-shot. |
| 90 | The output is initially set high. When the gate | ||
| 85 | line is set high, a countdown is initiated (which does not stop if the gate is | 91 | line is set high, a countdown is initiated (which does not stop if the gate is |
| 86 | lowered), during which the output is set low. When the count reaches zero, | 92 | lowered), during which the output is set low. When the count reaches zero, |
| 87 | the output goes high. | 93 | the output goes high. |
| 88 | 94 | ||
| 89 | Mode 2: Rate Generator. The output is initially set high. When the countdown | 95 | Mode 2: Rate Generator. |
| 96 | The output is initially set high. When the countdown | ||
| 90 | reaches 1, the output goes low for one count and then returns high. The value | 97 | reaches 1, the output goes low for one count and then returns high. The value |
| 91 | is reloaded and the countdown automatically resumes. If the gate line goes | 98 | is reloaded and the countdown automatically resumes. If the gate line goes |
| 92 | low, the count is halted. If the output is low when the gate is lowered, the | 99 | low, the count is halted. If the output is low when the gate is lowered, the |
| 93 | output automatically goes high (this only affects timer 2). | 100 | output automatically goes high (this only affects timer 2). |
| 94 | 101 | ||
| 95 | Mode 3: Square Wave. This generates a high / low square wave. The count | 102 | Mode 3: Square Wave. |
| 103 | This generates a high / low square wave. The count | ||
| 96 | determines the length of the pulse, which alternates between high and low | 104 | determines the length of the pulse, which alternates between high and low |
| 97 | when zero is reached. The count only proceeds when gate is high and is | 105 | when zero is reached. The count only proceeds when gate is high and is |
| 98 | automatically reloaded on reaching zero. The count is decremented twice at | 106 | automatically reloaded on reaching zero. The count is decremented twice at |
| @@ -103,12 +111,14 @@ Mode 3: Square Wave. This generates a high / low square wave. The count · 4 unmodified lines | |||
| 103 | values are not observed when reading. This is the intended mode for timer 2, | 111 | values are not observed when reading. This is the intended mode for timer 2, |
| 104 | which generates sine-like tones by low-pass filtering the square wave output. | 112 | which generates sine-like tones by low-pass filtering the square wave output. |
| 105 | 113 | ||
| 106 | Mode 4: Software Strobe. After programming this mode and loading the counter, | 114 | Mode 4: Software Strobe. |
| 115 | After programming this mode and loading the counter, | ||
| 107 | the output remains high until the counter reaches zero. Then the output | 116 | the output remains high until the counter reaches zero. Then the output |
| 108 | goes low for 1 clock cycle and returns high. The counter is not reloaded. | 117 | goes low for 1 clock cycle and returns high. The counter is not reloaded. |
| 109 | Counting only occurs when gate is high. | 118 | Counting only occurs when gate is high. |
| 110 | 119 | ||
| 111 | Mode 5: Hardware Strobe. After programming and loading the counter, the | 120 | Mode 5: Hardware Strobe. |
| 121 | After programming and loading the counter, the | ||
| 112 | output remains high. When the gate is raised, a countdown is initiated | 122 | output remains high. When the gate is raised, a countdown is initiated |
| 113 | (which does not stop if the gate is lowered). When the counter reaches zero, | 123 | (which does not stop if the gate is lowered). When the counter reaches zero, |
| 114 | the output goes low for 1 clock cycle and then returns high. The counter is | 124 | the output goes low for 1 clock cycle and then returns high. The counter is |
| @@ -118,49 +128,49 @@ In addition to normal binary counting, the PIT supports BCD counting. The · 3 unmodified lines | |||
| 118 | command port, 0x43 is used to set the counter and mode for each of the three | 128 | command port, 0x43 is used to set the counter and mode for each of the three |
| 119 | timers. | 129 | timers. |
| 120 | 130 | ||
| 121 | PIT commands, issued to port 0x43, using the following bit encoding: | 131 | PIT commands, issued to port 0x43, using the following bit encoding:: |
| 122 | 132 | ||
| 123 | Bit 7-4: Command (See table below) | 133 | Bit 7-4: Command (See table below) |
| 124 | Bit 3-1: Mode (000 = Mode 0, 101 = Mode 5, 11X = undefined) | 134 | Bit 3-1: Mode (000 = Mode 0, 101 = Mode 5, 11X = undefined) |
| 125 | Bit 0 : Binary (0) / BCD (1) | 135 | Bit 0 : Binary (0) / BCD (1) |
| 126 | 136 | ||
| 127 | Command table: | 137 | Command table:: |
| 128 | 138 | ||
| 129 | 0000 - Latch Timer 0 count for port 0x40 | 139 | 0000 - Latch Timer 0 count for port 0x40 |
| 130 | sample and hold the count to be read in port 0x40; | 140 | sample and hold the count to be read in port 0x40; |
| 131 | additional commands ignored until counter is read; | 141 | additional commands ignored until counter is read; |
| 132 | mode bits ignored. | 142 | mode bits ignored. |
| 133 | 143 | ||
| 134 | 0001 - Set Timer 0 LSB mode for port 0x40 | 144 | 0001 - Set Timer 0 LSB mode for port 0x40 |
| 135 | set timer to read LSB only and force MSB to zero; | 145 | set timer to read LSB only and force MSB to zero; |
| 136 | mode bits set timer mode | 146 | mode bits set timer mode |
| 137 | 147 | ||
| 138 | 0010 - Set Timer 0 MSB mode for port 0x40 | 148 | 0010 - Set Timer 0 MSB mode for port 0x40 |
| 139 | set timer to read MSB only and force LSB to zero; | 149 | set timer to read MSB only and force LSB to zero; |
| 140 | mode bits set timer mode | 150 | mode bits set timer mode |
| 141 | 151 | ||
| 142 | 0011 - Set Timer 0 16-bit mode for port 0x40 | 152 | 0011 - Set Timer 0 16-bit mode for port 0x40 |
| 143 | set timer to read / write LSB first, then MSB; | 153 | set timer to read / write LSB first, then MSB; |
| 144 | mode bits set timer mode | 154 | mode bits set timer mode |
| 145 | 155 | ||
| 146 | 0100 - Latch Timer 1 count for port 0x41 - as described above | 156 | 0100 - Latch Timer 1 count for port 0x41 - as described above |
| 147 | 0101 - Set Timer 1 LSB mode for port 0x41 - as described above | 157 | 0101 - Set Timer 1 LSB mode for port 0x41 - as described above |
| 148 | 0110 - Set Timer 1 MSB mode for port 0x41 - as described above | 158 | 0110 - Set Timer 1 MSB mode for port 0x41 - as described above |
| 149 | 0111 - Set Timer 1 16-bit mode for port 0x41 - as described above | 159 | 0111 - Set Timer 1 16-bit mode for port 0x41 - as described above |
| 150 | 160 | ||
| 151 | 1000 - Latch Timer 2 count for port 0x42 - as described above | 161 | 1000 - Latch Timer 2 count for port 0x42 - as described above |
| 152 | 1001 - Set Timer 2 LSB mode for port 0x42 - as described above | 162 | 1001 - Set Timer 2 LSB mode for port 0x42 - as described above |
| 153 | 1010 - Set Timer 2 MSB mode for port 0x42 - as described above | 163 | 1010 - Set Timer 2 MSB mode for port 0x42 - as described above |
| 154 | 1011 - Set Timer 2 16-bit mode for port 0x42 as described above | 164 | 1011 - Set Timer 2 16-bit mode for port 0x42 as described above |
| 155 | 165 | ||
| 156 | 1101 - General counter latch | 166 | 1101 - General counter latch |
| 157 | Latch combination of counters into corresponding ports | 167 | Latch combination of counters into corresponding ports |
| 158 | Bit 3 = Counter 2 | 168 | Bit 3 = Counter 2 |
| 159 | Bit 2 = Counter 1 | 169 | Bit 2 = Counter 1 |
| 160 | Bit 1 = Counter 0 | 170 | Bit 1 = Counter 0 |
| 161 | Bit 0 = Unused | 171 | Bit 0 = Unused |
| 162 | 172 | ||
| 163 | 1110 - Latch timer status | 173 | 1110 - Latch timer status |
| 164 | Latch combination of counter mode into corresponding ports | 174 | Latch combination of counter mode into corresponding ports |
| 165 | Bit 3 = Counter 2 | 175 | Bit 3 = Counter 2 |
| 166 | Bit 2 = Counter 1 | 176 | Bit 2 = Counter 1 |
| @@ -177,7 +187,8 @@ Command table: · 10 unmodified lines | |||
| 177 | Bit 3-1 = Mode | 187 | Bit 3-1 = Mode |
| 178 | Bit 0 = Binary (0) / BCD mode (1) | 188 | Bit 0 = Binary (0) / BCD mode (1) |
| 179 | 189 | ||
| 180 | 2.2) RTC | 190 | 2.2. RTC |
| 191 | -------- | ||
| 181 | 192 | ||
| 182 | The second device which was available in the original PC was the MC146818 real | 193 | The second device which was available in the original PC was the MC146818 real |
| 183 | time clock. The original device is now obsolete, and usually emulated by the | 194 | time clock. The original device is now obsolete, and usually emulated by the |
| @@ -201,21 +212,21 @@ in progress, as indicated in the status register. · 17 unmodified lines | |||
| 201 | The clock uses a 32.768kHz crystal, so bits 6-4 of register A should be | 212 | The clock uses a 32.768kHz crystal, so bits 6-4 of register A should be |
| 202 | programmed to a 32kHz divider if the RTC is to count seconds. | 213 | programmed to a 32kHz divider if the RTC is to count seconds. |
| 203 | 214 | ||
| 204 | This is the RAM map originally used for the RTC/CMOS: | 215 | This is the RAM map originally used for the RTC/CMOS:: |
| 205 | 216 | ||
| 206 | Location Size Description | 217 | Location Size Description |
| 207 | ------------------------------------------ | 218 | ------------------------------------------ |
| 208 | 00h byte Current second (BCD) | 219 | 00h byte Current second (BCD) |
| 209 | 01h byte Seconds alarm (BCD) | 220 | 01h byte Seconds alarm (BCD) |
| 210 | 02h byte Current minute (BCD) | 221 | 02h byte Current minute (BCD) |
| 211 | 03h byte Minutes alarm (BCD) | 222 | 03h byte Minutes alarm (BCD) |
| 212 | 04h byte Current hour (BCD) | 223 | 04h byte Current hour (BCD) |
| 213 | 05h byte Hours alarm (BCD) | 224 | 05h byte Hours alarm (BCD) |
| 214 | 06h byte Current day of week (BCD) | 225 | 06h byte Current day of week (BCD) |
| 215 | 07h byte Current day of month (BCD) | 226 | 07h byte Current day of month (BCD) |
| 216 | 08h byte Current month (BCD) | 227 | 08h byte Current month (BCD) |
| 217 | 09h byte Current year (BCD) | 228 | 09h byte Current year (BCD) |
| 218 | 0Ah byte Register A | 229 | 0Ah byte Register A |
| 219 | bit 7 = Update in progress | 230 | bit 7 = Update in progress |
| 220 | bit 6-4 = Divider for clock | 231 | bit 6-4 = Divider for clock |
| 221 | 000 = 4.194 MHz | 232 | 000 = 4.194 MHz |
| @@ -234,7 +245,7 @@ Location Size Description · 12 unmodified lines | |||
| 234 | 1101 = 125 mS | 245 | 1101 = 125 mS |
| 235 | 1110 = 250 mS | 246 | 1110 = 250 mS |
| 236 | 1111 = 500 mS | 247 | 1111 = 500 mS |
| 237 | 0Bh byte Register B | 248 | 0Bh byte Register B |
| 238 | bit 7 = Run (0) / Halt (1) | 249 | bit 7 = Run (0) / Halt (1) |
| 239 | bit 6 = Periodic interrupt enable | 250 | bit 6 = Periodic interrupt enable |
| 240 | bit 5 = Alarm interrupt enable | 251 | bit 5 = Alarm interrupt enable |
| @@ -243,19 +254,20 @@ Location Size Description · 2 unmodified lines | |||
| 243 | bit 2 = BCD calendar (0) / Binary (1) | 254 | bit 2 = BCD calendar (0) / Binary (1) |
| 244 | bit 1 = 12-hour mode (0) / 24-hour mode (1) | 255 | bit 1 = 12-hour mode (0) / 24-hour mode (1) |
| 245 | bit 0 = 0 (DST off) / 1 (DST enabled) | 256 | bit 0 = 0 (DST off) / 1 (DST enabled) |
| 246 | OCh byte Register C (read only) | 257 | OCh byte Register C (read only) |
| 247 | bit 7 = interrupt request flag (IRQF) | 258 | bit 7 = interrupt request flag (IRQF) |
| 248 | bit 6 = periodic interrupt flag (PF) | 259 | bit 6 = periodic interrupt flag (PF) |
| 249 | bit 5 = alarm interrupt flag (AF) | 260 | bit 5 = alarm interrupt flag (AF) |
| 250 | bit 4 = update interrupt flag (UF) | 261 | bit 4 = update interrupt flag (UF) |
| 251 | bit 3-0 = reserved | 262 | bit 3-0 = reserved |
| 252 | ODh byte Register D (read only) | 263 | ODh byte Register D (read only) |
| 253 | bit 7 = RTC has power | 264 | bit 7 = RTC has power |
| 254 | bit 6-0 = reserved | 265 | bit 6-0 = reserved |
| 255 | 32h byte Current century BCD (*) | 266 | 32h byte Current century BCD (*) |
| 256 | (*) location vendor specific and now determined from ACPI global tables | 267 | (*) location vendor specific and now determined from ACPI global tables |
| 257 | 268 | ||
| 258 | 2.3) APIC | 269 | 2.3. APIC |
| 270 | --------- | ||
| 259 | 271 | ||
| 260 | On Pentium and later processors, an on-board timer is available to each CPU | 272 | On Pentium and later processors, an on-board timer is available to each CPU |
| 261 | as part of the Advanced Programmable Interrupt Controller. The APIC is | 273 | as part of the Advanced Programmable Interrupt Controller. The APIC is |
| @@ -276,7 +288,8 @@ timer is programmed through the LVT (local vector timer) register, is capable · 14 unmodified lines | |||
| 276 | of one-shot or periodic operation, and is based on the bus clock divided down | 288 | of one-shot or periodic operation, and is based on the bus clock divided down |
| 277 | by the programmable divider register. | 289 | by the programmable divider register. |
| 278 | 290 | ||
| 279 | 2.4) HPET | 291 | 2.4. HPET |
| 292 | --------- | ||
| 280 | 293 | ||
| 281 | HPET is quite complex, and was originally intended to replace the PIT / RTC | 294 | HPET is quite complex, and was originally intended to replace the PIT / RTC |
| 282 | support of the X86 PC. It remains to be seen whether that will be the case, as | 295 | support of the X86 PC. It remains to be seen whether that will be the case, as |
| @@ -297,7 +310,8 @@ indicated through ACPI tables by the BIOS. · 14 unmodified lines | |||
| 297 | Detailed specification of the HPET is beyond the current scope of this | 310 | Detailed specification of the HPET is beyond the current scope of this |
| 298 | document, as it is also very well documented elsewhere. | 311 | document, as it is also very well documented elsewhere. |
| 299 | 312 | ||
| 300 | 2.5) Offboard Timers | 313 | 2.5. Offboard Timers |
| 314 | -------------------- | ||
| 301 | 315 | ||
| 302 | Several cards, both proprietary (watchdog boards) and commonplace (e1000) have | 316 | Several cards, both proprietary (watchdog boards) and commonplace (e1000) have |
| 303 | timing chips built into the cards which may have registers which are accessible | 317 | timing chips built into the cards which may have registers which are accessible |
| @@ -307,9 +321,8 @@ general frowned upon as not playing by the agreed rules of the game. Such a · 3 unmodified lines | |||
| 307 | timer device would require additional support to be virtualized properly and is | 321 | timer device would require additional support to be virtualized properly and is |
| 308 | not considered important at this time as no known operating system does this. | 322 | not considered important at this time as no known operating system does this. |
| 309 | 323 | ||
| 310 | ========================================================================= | 324 | 3. TSC Hardware |
| 311 | 325 | =============== | |
| 312 | 3) TSC Hardware | ||
| 313 | 326 | ||
| 314 | The TSC or time stamp counter is relatively simple in theory; it counts | 327 | The TSC or time stamp counter is relatively simple in theory; it counts |
| 315 | instruction cycles issued by the processor, which can be used as a measure of | 328 | instruction cycles issued by the processor, which can be used as a measure of |
| @@ -340,7 +353,8 @@ allows the guest visible TSC to be offset by a constant. Newer implementations · 24 unmodified lines | |||
| 340 | promise to allow the TSC to additionally be scaled, but this hardware is not | 353 | promise to allow the TSC to additionally be scaled, but this hardware is not |
| 341 | yet widely available. | 354 | yet widely available. |
| 342 | 355 | ||
| 343 | 3.1) TSC synchronization | 356 | 3.1. TSC synchronization |
| 357 | ------------------------ | ||
| 344 | 358 | ||
| 345 | The TSC is a CPU-local clock in most implementations. This means, on SMP | 359 | The TSC is a CPU-local clock in most implementations. This means, on SMP |
| 346 | platforms, the TSCs of different CPUs may start at different times depending | 360 | platforms, the TSCs of different CPUs may start at different times depending |
| @@ -357,7 +371,8 @@ practice, getting a perfectly synchronized TSC will not be possible unless all · 10 unmodified lines | |||
| 357 | values are read from the same clock, which generally only is possible on single | 371 | values are read from the same clock, which generally only is possible on single |
| 358 | socket systems or those with special hardware support. | 372 | socket systems or those with special hardware support. |
| 359 | 373 | ||
| 360 | 3.2) TSC and CPU hotplug | 374 | 3.2. TSC and CPU hotplug |
| 375 | ------------------------ | ||
| 361 | 376 | ||
| 362 | As touched on already, CPUs which arrive later than the boot time of the system | 377 | As touched on already, CPUs which arrive later than the boot time of the system |
| 363 | may not have a TSC value that is synchronized with the rest of the system. | 378 | may not have a TSC value that is synchronized with the rest of the system. |
| @@ -367,7 +382,8 @@ a guarantee. This can have the effect of bringing a system from a state where · 3 unmodified lines | |||
| 367 | TSC is synchronized back to a state where TSC synchronization flaws, however | 382 | TSC is synchronized back to a state where TSC synchronization flaws, however |
| 368 | small, may be exposed to the OS and any virtualization environment. | 383 | small, may be exposed to the OS and any virtualization environment. |
| 369 | 384 | ||
| 370 | 3.3) TSC and multi-socket / NUMA | 385 | 3.3. TSC and multi-socket / NUMA |
| 386 | -------------------------------- | ||
| 371 | 387 | ||
| 372 | Multi-socket systems, especially large multi-socket systems are likely to have | 388 | Multi-socket systems, especially large multi-socket systems are likely to have |
| 373 | individual clocksources rather than a single, universally distributed clock. | 389 | individual clocksources rather than a single, universally distributed clock. |
| @@ -385,7 +401,8 @@ standards for telecommunications and computer equipment. · 11 unmodified lines | |||
| 385 | It is recommended not to trust the TSCs to remain synchronized on NUMA or | 401 | It is recommended not to trust the TSCs to remain synchronized on NUMA or |
| 386 | multiple socket systems for these reasons. | 402 | multiple socket systems for these reasons. |
| 387 | 403 | ||
| 388 | 3.4) TSC and C-states | 404 | 3.4. TSC and C-states |
| 405 | --------------------- | ||
| 389 | 406 | ||
| 390 | C-states, or idling states of the processor, especially C1E and deeper sleep | 407 | C-states, or idling states of the processor, especially C1E and deeper sleep |
| 391 | states may be problematic for TSC as well. The TSC may stop advancing in such | 408 | states may be problematic for TSC as well. The TSC may stop advancing in such |
| @@ -396,7 +413,8 @@ based on CPU and chipset identifications. · 4 unmodified lines | |||
| 396 | The TSC in such a case may be corrected by catching it up to a known external | 413 | The TSC in such a case may be corrected by catching it up to a known external |
| 397 | clocksource. | 414 | clocksource. |
| 398 | 415 | ||
| 399 | 3.5) TSC frequency change / P-states | 416 | 3.5. TSC frequency change / P-states |
| 417 | ------------------------------------ | ||
| 400 | 418 | ||
| 401 | To make things slightly more interesting, some CPUs may change frequency. They | 419 | To make things slightly more interesting, some CPUs may change frequency. They |
| 402 | may or may not run the TSC at the same rate, and because the frequency change | 420 | may or may not run the TSC at the same rate, and because the frequency change |
| @@ -416,14 +434,16 @@ other processors. In such cases, the TSC on halted CPUs could advance faster · 13 unmodified lines | |||
| 416 | than that of non-halted processors. AMD Turion processors are known to have | 434 | than that of non-halted processors. AMD Turion processors are known to have |
| 417 | this problem. | 435 | this problem. |
| 418 | 436 | ||
| 419 | 3.6) TSC and STPCLK / T-states | 437 | 3.6. TSC and STPCLK / T-states |
| 438 | ------------------------------ | ||
| 420 | 439 | ||
| 421 | External signals given to the processor may also have the effect of stopping | 440 | External signals given to the processor may also have the effect of stopping |
| 422 | the TSC. This is typically done for thermal emergency power control to prevent | 441 | the TSC. This is typically done for thermal emergency power control to prevent |
| 423 | an overheating condition, and typically, there is no way to detect that this | 442 | an overheating condition, and typically, there is no way to detect that this |
| 424 | condition has happened. | 443 | condition has happened. |
| 425 | 444 | ||
| 426 | 3.7) TSC virtualization - VMX | 445 | 3.7. TSC virtualization - VMX |
| 446 | ----------------------------- | ||
| 427 | 447 | ||
| 428 | VMX provides conditional trapping of RDTSC, RDMSR, WRMSR and RDTSCP | 448 | VMX provides conditional trapping of RDTSC, RDMSR, WRMSR and RDTSCP |
| 429 | instructions, which is enough for full virtualization of TSC in any manner. In | 449 | instructions, which is enough for full virtualization of TSC in any manner. In |
| @@ -431,14 +451,16 @@ addition, VMX allows passing through the host TSC plus an additional TSC_OFFSET · 1 unmodified line | |||
| 431 | field specified in the VMCS. Special instructions must be used to read and | 451 | field specified in the VMCS. Special instructions must be used to read and |
| 432 | write the VMCS field. | 452 | write the VMCS field. |
| 433 | 453 | ||
| 434 | 3.8) TSC virtualization - SVM | 454 | 3.8. TSC virtualization - SVM |
| 455 | ----------------------------- | ||
| 435 | 456 | ||
| 436 | SVM provides conditional trapping of RDTSC, RDMSR, WRMSR and RDTSCP | 457 | SVM provides conditional trapping of RDTSC, RDMSR, WRMSR and RDTSCP |
| 437 | instructions, which is enough for full virtualization of TSC in any manner. In | 458 | instructions, which is enough for full virtualization of TSC in any manner. In |
| 438 | addition, SVM allows passing through the host TSC plus an additional offset | 459 | addition, SVM allows passing through the host TSC plus an additional offset |
| 439 | field specified in the SVM control block. | 460 | field specified in the SVM control block. |
| 440 | 461 | ||
| 441 | 3.9) TSC feature bits in Linux | 462 | 3.9. TSC feature bits in Linux |
| 463 | ------------------------------ | ||
| 442 | 464 | ||
| 443 | In summary, there is no way to guarantee the TSC remains in perfect | 465 | In summary, there is no way to guarantee the TSC remains in perfect |
| 444 | synchronization unless it is explicitly guaranteed by the architecture. Even | 466 | synchronization unless it is explicitly guaranteed by the architecture. Even |
| @@ -448,13 +470,16 @@ despite being locally consistent. · 3 unmodified lines | |||
| 448 | The following feature bits are used by Linux to signal various TSC attributes, | 470 | The following feature bits are used by Linux to signal various TSC attributes, |
| 449 | but they can only be taken to be meaningful for UP or single node systems. | 471 | but they can only be taken to be meaningful for UP or single node systems. |
| 450 | 472 | ||
| 451 | X86_FEATURE_TSC : The TSC is available in hardware | 473 | ========================= ======================================= |
| 452 | X86_FEATURE_RDTSCP : The RDTSCP instruction is available | 474 | X86_FEATURE_TSC The TSC is available in hardware |
| 453 | X86_FEATURE_CONSTANT_TSC : The TSC rate is unchanged with P-states | 475 | X86_FEATURE_RDTSCP The RDTSCP instruction is available |
| 454 | X86_FEATURE_NONSTOP_TSC : The TSC does not stop in C-states | 476 | X86_FEATURE_CONSTANT_TSC The TSC rate is unchanged with P-states |
| 455 | X86_FEATURE_TSC_RELIABLE : TSC sync checks are skipped (VMware) | 477 | X86_FEATURE_NONSTOP_TSC The TSC does not stop in C-states |
| 478 | X86_FEATURE_TSC_RELIABLE TSC sync checks are skipped (VMware) | ||
| 479 | ========================= ======================================= | ||
| 456 | 480 | ||
| 457 | 4) Virtualization Problems | 481 | 4. Virtualization Problems |
| 482 | ========================== | ||
| 458 | 483 | ||
| 459 | Timekeeping is especially problematic for virtualization because a number of | 484 | Timekeeping is especially problematic for virtualization because a number of |
| 460 | challenges arise. The most obvious problem is that time is now shared between | 485 | challenges arise. The most obvious problem is that time is now shared between |
| @@ -473,7 +498,8 @@ BIOS, but not in such an extreme fashion. However, the fact that SMM mode may · 12 unmodified lines | |||
| 473 | cause similar problems to virtualization makes it a good justification for | 498 | cause similar problems to virtualization makes it a good justification for |
| 474 | solving many of these problems on bare metal. | 499 | solving many of these problems on bare metal. |
| 475 | 500 | ||
| 476 | 4.1) Interrupt clocking | 501 | 4.1. Interrupt clocking |
| 502 | ----------------------- | ||
| 477 | 503 | ||
| 478 | One of the most immediate problems that occurs with legacy operating systems | 504 | One of the most immediate problems that occurs with legacy operating systems |
| 479 | is that the system timekeeping routines are often designed to keep track of | 505 | is that the system timekeeping routines are often designed to keep track of |
| @@ -502,7 +528,8 @@ thus requires interrupt slewing to keep proper time. It does use a low enough · 22 unmodified lines | |||
| 502 | rate (ed: is it 18.2 Hz?) however that it has not yet been a problem in | 528 | rate (ed: is it 18.2 Hz?) however that it has not yet been a problem in |
| 503 | practice. | 529 | practice. |
| 504 | 530 | ||
| 505 | 4.2) TSC sampling and serialization | 531 | 4.2. TSC sampling and serialization |
| 532 | ----------------------------------- | ||
| 506 | 533 | ||
| 507 | As the highest precision time source available, the cycle counter of the CPU | 534 | As the highest precision time source available, the cycle counter of the CPU |
| 508 | has aroused much interest from developers. As explained above, this timer has | 535 | has aroused much interest from developers. As explained above, this timer has |
| @@ -524,7 +551,8 @@ it may be necessary for an implementation to guard against "backwards" reads of · 15 unmodified lines | |||
| 524 | the TSC as seen from other CPUs, even in an otherwise perfectly synchronized | 551 | the TSC as seen from other CPUs, even in an otherwise perfectly synchronized |
| 525 | system. | 552 | system. |
| 526 | 553 | ||
| 527 | 4.3) Timespec aliasing | 554 | 4.3. Timespec aliasing |
| 555 | ---------------------- | ||
| 528 | 556 | ||
| 529 | Additionally, this lack of serialization from the TSC poses another challenge | 557 | Additionally, this lack of serialization from the TSC poses another challenge |
| 530 | when using results of the TSC when measured against another time source. As | 558 | when using results of the TSC when measured against another time source. As |
| @@ -548,7 +576,8 @@ This aliasing requires care in the computation and recalibration of kvmclock · 17 unmodified lines | |||
| 548 | and any other values derived from TSC computation (such as TSC virtualization | 576 | and any other values derived from TSC computation (such as TSC virtualization |
| 549 | itself). | 577 | itself). |
| 550 | 578 | ||
| 551 | 4.4) Migration | 579 | 4.4. Migration |
| 580 | -------------- | ||
| 552 | 581 | ||
| 553 | Migration of a virtual machine raises problems for timekeeping in two ways. | 582 | Migration of a virtual machine raises problems for timekeeping in two ways. |
| 554 | First, the migration itself may take time, during which interrupts cannot be | 583 | First, the migration itself may take time, during which interrupts cannot be |
| @@ -566,7 +595,8 @@ always be caught up to the original rate. KVM clock avoids these problems by · 11 unmodified lines | |||
| 566 | simply storing multipliers and offsets against the TSC for the guest to convert | 595 | simply storing multipliers and offsets against the TSC for the guest to convert |
| 567 | back into nanosecond resolution values. | 596 | back into nanosecond resolution values. |
| 568 | 597 | ||
| 569 | 4.5) Scheduling | 598 | 4.5. Scheduling |
| 599 | --------------- | ||
| 570 | 600 | ||
| 571 | Since scheduling may be based on precise timing and firing of interrupts, the | 601 | Since scheduling may be based on precise timing and firing of interrupts, the |
| 572 | scheduling algorithms of an operating system may be adversely affected by | 602 | scheduling algorithms of an operating system may be adversely affected by |
| @@ -579,7 +609,8 @@ In an attempt to work around this, several implementations have provided a · 6 unmodified lines | |||
| 579 | paravirtualized scheduler clock, which reveals the true amount of CPU time for | 609 | paravirtualized scheduler clock, which reveals the true amount of CPU time for |
| 580 | which a virtual machine has been running. | 610 | which a virtual machine has been running. |
| 581 | 611 | ||
| 582 | 4.6) Watchdogs | 612 | 4.6. Watchdogs |
| 613 | -------------- | ||
| 583 | 614 | ||
| 584 | Watchdog timers, such as the lock detector in Linux may fire accidentally when | 615 | Watchdog timers, such as the lock detector in Linux may fire accidentally when |
| 585 | running under hardware virtualization due to timer interrupts being delayed or | 616 | running under hardware virtualization due to timer interrupts being delayed or |
| @@ -587,7 +618,8 @@ misinterpretation of the passage of real time. Usually, these warnings are · 1 unmodified line | |||
| 587 | spurious and can be ignored, but in some circumstances it may be necessary to | 618 | spurious and can be ignored, but in some circumstances it may be necessary to |
| 588 | disable such detection. | 619 | disable such detection. |
| 589 | 620 | ||
| 590 | 4.7) Delays and precision timing | 621 | 4.7. Delays and precision timing |
| 622 | -------------------------------- | ||
| 591 | 623 | ||
| 592 | Precise timing and delays may not be possible in a virtualized system. This | 624 | Precise timing and delays may not be possible in a virtualized system. This |
| 593 | can happen if the system is controlling physical hardware, or issues delays to | 625 | can happen if the system is controlling physical hardware, or issues delays to |
| @@ -600,7 +632,8 @@ The second issue may cause performance problems, but this is unlikely to be a · 6 unmodified lines | |||
| 600 | significant issue. In many cases these delays may be eliminated through | 632 | significant issue. In many cases these delays may be eliminated through |
| 601 | configuration or paravirtualization. | 633 | configuration or paravirtualization. |
| 602 | 634 | ||
| 603 | 4.8) Covert channels and leaks | 635 | 4.8. Covert channels and leaks |
| 636 | ------------------------------ | ||
| 604 | 637 | ||
| 605 | In addition to the above problems, time information will inevitably leak to the | 638 | In addition to the above problems, time information will inevitably leak to the |
| 606 | guest about the host in anything but a perfect implementation of virtualized | 639 | guest about the host in anything but a perfect implementation of virtualized |
| @@ -1,12 +1,17 @@ | |||
| 1 | User Mode Linux HOWTO | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | User Mode Linux Core Team | ||
| 3 | Mon Nov 18 14:16:16 EST 2002 | ||
| 4 | 2 | ||
| 5 | This document describes the use and abuse of Jeff Dike's User Mode | 3 | ===================== |
| 6 | Linux: a port of the Linux kernel as a normal Intel Linux process. | 4 | User Mode Linux HOWTO |
| 7 | ______________________________________________________________________ | 5 | ===================== |
| 8 | 6 | ||
| 9 | Table of Contents | 7 | :Author: User Mode Linux Core Team |
| 8 | :Last-updated: Sat Jan 25 16:07:55 CET 2020 | ||
| 9 | |||
| 10 | This document describes the use and abuse of Jeff Dike's User Mode | ||
| 11 | Linux: a port of the Linux kernel as a normal Intel Linux process. | ||
| 12 | |||
| 13 | |||
| 14 | .. Table of Contents | ||
| 10 | 15 | ||
| 11 | 1. Introduction | 16 | 1. Introduction |
| 12 | 17 | ||
| @@ -132,19 +137,19 @@ · 119 unmodified lines | |||
| 132 | 15.5 Other contributions | 137 | 15.5 Other contributions |
| 133 | 138 | ||
| 134 | 139 | ||
| 135 | ______________________________________________________________________ | 140 | 1. Introduction |
| 136 | 141 | ================ | |
| 137 | 1. Introduction | ||
| 138 | 142 | ||
| 139 | Welcome to User Mode Linux. It's going to be fun. | 143 | Welcome to User Mode Linux. It's going to be fun. |
| 140 | 144 | ||
| 141 | 145 | ||
| 142 | 146 | ||
| 143 | 1.1. How is User Mode Linux Different? | 147 | 1.1. How is User Mode Linux Different? |
| 148 | --------------------------------------- | ||
| 144 | 149 | ||
| 145 | Normally, the Linux Kernel talks straight to your hardware (video | 150 | Normally, the Linux Kernel talks straight to your hardware (video |
| 146 | card, keyboard, hard drives, etc), and any programs which run ask the | 151 | card, keyboard, hard drives, etc), and any programs which run ask the |
| 147 | kernel to operate the hardware, like so: | 152 | kernel to operate the hardware, like so:: |
| 148 | 153 | ||
| 149 | 154 | ||
| 150 | 155 | ||
| @@ -160,10 +165,10 @@ · 9 unmodified lines | |||
| 160 | 165 | ||
| 161 | 166 | ||
| 162 | The User Mode Linux Kernel is different; instead of talking to the | 167 | The User Mode Linux Kernel is different; instead of talking to the |
| 163 | hardware, it talks to a `real' Linux kernel (called the `host kernel' | 168 | hardware, it talks to a `real` Linux kernel (called the `host kernel` |
| 164 | from now on), like any other program. Programs can then run inside | 169 | from now on), like any other program. Programs can then run inside |
| 165 | User-Mode Linux as if they were running under a normal kernel, like | 170 | User-Mode Linux as if they were running under a normal kernel, like |
| 166 | so: | 171 | so:: |
| 167 | 172 | ||
| 168 | 173 | ||
| 169 | 174 | ||
| @@ -181,7 +186,8 @@ · 11 unmodified lines | |||
| 181 | 186 | ||
| 182 | 187 | ||
| 183 | 188 | ||
| 184 | 1.2. Why Would I Want User Mode Linux? | 189 | 1.2. Why Would I Want User Mode Linux? |
| 190 | --------------------------------------- | ||
| 185 | 191 | ||
| 186 | 192 | ||
| 187 | 1. If User Mode Linux crashes, your host kernel is still fine. | 193 | 1. If User Mode Linux crashes, your host kernel is still fine. |
| @@ -204,83 +210,41 @@ · 16 unmodified lines | |||
| 204 | 210 | ||
| 205 | 211 | ||
| 206 | 212 | ||
| 213 | .. _Compiling_the_kernel_and_modules: | ||
| 207 | 214 | ||
| 208 | 215 | 2. Compiling the kernel and modules | |
| 209 | 2. Compiling the kernel and modules | 216 | ==================================== |
| 210 | 217 | ||
| 211 | 218 | ||
| 212 | 219 | ||
| 213 | 220 | ||
| 214 | 2.1. Compiling the kernel | 221 | 2.1. Compiling the kernel |
| 222 | -------------------------- | ||
| 215 | 223 | ||
| 216 | 224 | ||
| 217 | Compiling the user mode kernel is just like compiling any other | 225 | Compiling the user mode kernel is just like compiling any other |
| 218 | kernel. Let's go through the steps, using 2.4.0-prerelease (current | 226 | kernel. |
| 219 | as of this writing) as an example: | ||
| 220 | |||
| 221 | |||
| 222 | 1. Download the latest UML patch from | ||
| 223 | |||
| 224 | the download page <http://user-mode-linux.sourceforge.net/ | ||
| 225 | |||
| 226 | In this example, the file is uml-patch-2.4.0-prerelease.bz2. | ||
| 227 | 227 | ||
| 228 | 228 | ||
| 229 | 2. Download the matching kernel from your favourite kernel mirror, | 229 | 1. Download the latest kernel from your favourite kernel mirror, |
| 230 | such as: | 230 | such as: |
| 231 | 231 | ||
| 232 | ftp://ftp.ca.kernel.org/pub/kernel/v2.4/linux-2.4.0-prerelease.tar.bz2 | 232 | https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.4.14.tar.xz |
| 233 | <ftp://ftp.ca.kernel.org/pub/kernel/v2.4/linux-2.4.0-prerelease.tar.bz2> | ||
| 234 | . | ||
| 235 | |||
| 236 | |||
| 237 | 3. Make a directory and unpack the kernel into it. | ||
| 238 | |||
| 239 | 233 | ||
| 234 | 2. Make a directory and unpack the kernel into it:: | ||
| 240 | 235 | ||
| 241 | host% | 236 | host% |
| 242 | mkdir ~/uml | 237 | mkdir ~/uml |
| 243 | 238 | ||
| 244 | |||
| 245 | |||
| 246 | |||
| 247 | |||
| 248 | |||
| 249 | host% | 239 | host% |
| 250 | cd ~/uml | 240 | cd ~/uml |
| 251 | 241 | ||
| 252 | |||
| 253 | |||
| 254 | |||
| 255 | |||
| 256 | |||
| 257 | host% | ||
| 258 | tar -xzvf linux-2.4.0-prerelease.tar.bz2 | ||
| 259 | |||
| 260 | |||
| 261 | |||
| 262 | |||
| 263 | |||
| 264 | |||
| 265 | 4. Apply the patch using | ||
| 266 | |||
| 267 | |||
| 268 | |||
| 269 | host% | ||
| 270 | cd ~/uml/linux | ||
| 271 | |||
| 272 | |||
| 273 | |||
| 274 | host% | 242 | host% |
| 275 | bzcat uml-patch-2.4.0-prerelease.bz2 | patch -p1 | 243 | tar xvf linux-5.4.14.tar.xz |
| 276 | 244 | ||
| 277 | 245 | ||
| 278 | 246 | 3. Run your favorite config; ``make xconfig ARCH=um`` is the most | |
| 279 | 247 | convenient. ``make config ARCH=um`` and ``make menuconfig ARCH=um`` | |
| 280 | |||
| 281 | |||
| 282 | 5. Run your favorite config; `make xconfig ARCH=um' is the most | ||
| 283 | convenient. `make config ARCH=um' and 'make menuconfig ARCH=um' | ||
| 284 | will work as well. The defaults will give you a useful kernel. If | 248 | will work as well. The defaults will give you a useful kernel. If |
| 285 | you want to change something, go ahead, it probably won't hurt | 249 | you want to change something, go ahead, it probably won't hurt |
| 286 | anything. | 250 | anything. |
| @@ -288,44 +252,20 @@ · 1 unmodified line | |||
| 288 | 252 | ||
| 289 | Note: If the host is configured with a 2G/2G address space split | 253 | Note: If the host is configured with a 2G/2G address space split |
| 290 | rather than the usual 3G/1G split, then the packaged UML binaries | 254 | rather than the usual 3G/1G split, then the packaged UML binaries |
| 291 | will not run. They will immediately segfault. See ``UML on 2G/2G | 255 | will not run. They will immediately segfault. See |
| 292 | hosts'' for the scoop on running UML on your system. | 256 | :ref:`UML_on_2G/2G_hosts` for the scoop on running UML on your system. |
| 293 | |||
| 294 | |||
| 295 | |||
| 296 | 6. Finish with `make linux ARCH=um': the result is a file called | ||
| 297 | `linux' in the top directory of your source tree. | ||
| 298 | |||
| 299 | Make sure that you don't build this kernel in /usr/src/linux. On some | ||
| 300 | distributions, /usr/include/asm is a link into this pool. The user- | ||
| 301 | mode build changes the other end of that link, and things that include | ||
| 302 | <asm/anything.h> stop compiling. | ||
| 303 | |||
| 304 | The sources are also available from cvs at the project's cvs page, | ||
| 305 | which has directions on getting the sources. You can also browse the | ||
| 306 | CVS pool from there. | ||
| 307 | 257 | ||
| 308 | If you get the CVS sources, you will have to check them out into an | ||
| 309 | empty directory. You will then have to copy each file into the | ||
| 310 | corresponding directory in the appropriate kernel pool. | ||
| 311 | 258 | ||
| 312 | If you don't have the latest kernel pool, you can get the | ||
| 313 | corresponding user-mode sources with | ||
| 314 | 259 | ||
| 260 | 4. Finish with ``make linux ARCH=um``: the result is a file called | ||
| 261 | ``linux`` in the top directory of your source tree. | ||
| 315 | 262 | ||
| 316 | host% cvs co -r v_2_3_x linux | ||
| 317 | 263 | ||
| 318 | 264 | 2.2. Compiling and installing kernel modules | |
| 319 | 265 | --------------------------------------------- | |
| 320 | |||
| 321 | where 'x' is the version in your pool. Note that you will not get the | ||
| 322 | bug fixes and enhancements that have gone into subsequent releases. | ||
| 323 | |||
| 324 | |||
| 325 | 2.2. Compiling and installing kernel modules | ||
| 326 | 266 | ||
| 327 | UML modules are built in the same way as the native kernel (with the | 267 | UML modules are built in the same way as the native kernel (with the |
| 328 | exception of the 'ARCH=um' that you always need for UML): | 268 | exception of the 'ARCH=um' that you always need for UML):: |
| 329 | 269 | ||
| 330 | 270 | ||
| 331 | host% make modules ARCH=um | 271 | host% make modules ARCH=um |
| @@ -337,12 +277,12 @@ · 5 unmodified lines | |||
| 337 | the user-mode pool. Modules from the native kernel won't work. | 277 | the user-mode pool. Modules from the native kernel won't work. |
| 338 | 278 | ||
| 339 | You can install them by using ftp or something to copy them into the | 279 | You can install them by using ftp or something to copy them into the |
| 340 | virtual machine and dropping them into /lib/modules/`uname -r`. | 280 | virtual machine and dropping them into ``/lib/modules/$(uname -r)``. |
| 341 | 281 | ||
| 342 | You can also get the kernel build process to install them as follows: | 282 | You can also get the kernel build process to install them as follows: |
| 343 | 283 | ||
| 344 | 1. with the kernel not booted, mount the root filesystem in the top | 284 | 1. with the kernel not booted, mount the root filesystem in the top |
| 345 | level of the kernel pool: | 285 | level of the kernel pool:: |
| 346 | 286 | ||
| 347 | 287 | ||
| 348 | host% mount root_fs mnt -o loop | 288 | host% mount root_fs mnt -o loop |
| @@ -352,7 +292,7 @@ · 3 unmodified lines | |||
| 352 | 292 | ||
| 353 | 293 | ||
| 354 | 294 | ||
| 355 | 2. run | 295 | 2. run:: |
| 356 | 296 | ||
| 357 | 297 | ||
| 358 | host% | 298 | host% |
| @@ -363,7 +303,7 @@ · 4 unmodified lines | |||
| 363 | 303 | ||
| 364 | 304 | ||
| 365 | 305 | ||
| 366 | 3. unmount the filesystem | 306 | 3. unmount the filesystem:: |
| 367 | 307 | ||
| 368 | 308 | ||
| 369 | host% umount mnt | 309 | host% umount mnt |
| @@ -381,27 +321,28 @@ · 11 unmodified lines | |||
| 381 | as modules, especially filesystems and network protocols and filters, | 321 | as modules, especially filesystems and network protocols and filters, |
| 382 | so most symbols which need to be exported probably already are. | 322 | so most symbols which need to be exported probably already are. |
| 383 | However, if you do find symbols that need exporting, let us | 323 | However, if you do find symbols that need exporting, let us |
| 384 | <http://user-mode-linux.sourceforge.net/> know, and | 324 | know at http://user-mode-linux.sourceforge.net/, and |
| 385 | they'll be "taken care of". | 325 | they'll be "taken care of". |
| 386 | 326 | ||
| 387 | 327 | ||
| 388 | 328 | ||
| 389 | 2.3. Compiling and installing uml_utilities | 329 | 2.3. Compiling and installing uml_utilities |
| 330 | -------------------------------------------- | ||
| 390 | 331 | ||
| 391 | Many features of the UML kernel require a user-space helper program, | 332 | Many features of the UML kernel require a user-space helper program, |
| 392 | so a uml_utilities package is distributed separately from the kernel | 333 | so a uml_utilities package is distributed separately from the kernel |
| 393 | patch which provides these helpers. Included within this is: | 334 | patch which provides these helpers. Included within this is: |
| 394 | 335 | ||
| 395 | o port-helper - Used by consoles which connect to xterms or ports | 336 | - port-helper - Used by consoles which connect to xterms or ports |
| 396 | 337 | ||
| 397 | o tunctl - Configuration tool to create and delete tap devices | 338 | - tunctl - Configuration tool to create and delete tap devices |
| 398 | 339 | ||
| 399 | o uml_net - Setuid binary for automatic tap device configuration | 340 | - uml_net - Setuid binary for automatic tap device configuration |
| 400 | 341 | ||
| 401 | o uml_switch - User-space virtual switch required for daemon | 342 | - uml_switch - User-space virtual switch required for daemon |
| 402 | transport | 343 | transport |
| 403 | 344 | ||
| 404 | The uml_utilities tree is compiled with: | 345 | The uml_utilities tree is compiled with:: |
| 405 | 346 | ||
| 406 | 347 | ||
| 407 | host# | 348 | host# |
| @@ -423,38 +364,42 @@ · 15 unmodified lines | |||
| 423 | 364 | ||
| 424 | 365 | ||
| 425 | 366 | ||
| 426 | 3. Running UML and logging in | 367 | 3. Running UML and logging in |
| 368 | ============================== | ||
| 427 | 369 | ||
| 428 | 370 | ||
| 429 | 371 | ||
| 430 | 3.1. Running UML | 372 | 3.1. Running UML |
| 373 | ----------------- | ||
| 431 | 374 | ||
| 432 | It runs on 2.2.15 or later, and all 2.4 kernels. | 375 | It runs on 2.2.15 or later, and all kernel versions since 2.4. |
| 433 | 376 | ||
| 434 | 377 | ||
| 435 | Booting UML is straightforward. Simply run 'linux': it will try to | 378 | Booting UML is straightforward. Simply run 'linux': it will try to |
| 436 | mount the file `root_fs' in the current directory. You do not need to | 379 | mount the file ``root_fs`` in the current directory. You do not need to |
| 437 | run it as root. If your root filesystem is not named `root_fs', then | 380 | run it as root. If your root filesystem is not named ``root_fs``, then |
| 438 | you need to put a `ubd0=root_fs_whatever' switch on the linux command | 381 | you need to put a ``ubd0=root_fs_whatever`` switch on the linux command |
| 439 | line. | 382 | line. |
| 440 | 383 | ||
| 441 | 384 | ||
| 442 | You will need a filesystem to boot UML from. There are a number | 385 | You will need a filesystem to boot UML from. There are a number |
| 443 | available for download from here <http://user-mode- | 386 | available for download from http://user-mode-linux.sourceforge.net. |
| 444 | linux.sourceforge.net/> . There are also several tools | 387 | There are also several tools at |
| 445 | <http://user-mode-linux.sourceforge.net/> which can be | 388 | http://user-mode-linux.sourceforge.net/ which can be |
| 446 | used to generate UML-compatible filesystem images from media. | 389 | used to generate UML-compatible filesystem images from media. |
| 447 | The kernel will boot up and present you with a login prompt. | 390 | The kernel will boot up and present you with a login prompt. |
| 448 | 391 | ||
| 449 | 392 | ||
| 450 | Note: If the host is configured with a 2G/2G address space split | 393 | Note: |
| 394 | If the host is configured with a 2G/2G address space split | ||
| 451 | rather than the usual 3G/1G split, then the packaged UML binaries will | 395 | rather than the usual 3G/1G split, then the packaged UML binaries will |
| 452 | not run. They will immediately segfault. See ``UML on 2G/2G hosts'' | 396 | not run. They will immediately segfault. See :ref:`UML_on_2G/2G_hosts` |
| 453 | for the scoop on running UML on your system. | 397 | for the scoop on running UML on your system. |
| 454 | 398 | ||
| 455 | 399 | ||
| 456 | 400 | ||
| 457 | 3.2. Logging in | 401 | 3.2. Logging in |
| 402 | ---------------- | ||
| 458 | 403 | ||
| 459 | 404 | ||
| 460 | 405 | ||
| @@ -468,22 +413,22 @@ · 7 unmodified lines | |||
| 468 | 413 | ||
| 469 | There are a couple of other ways to log in: | 414 | There are a couple of other ways to log in: |
| 470 | 415 | ||
| 471 | o On a virtual console | 416 | - On a virtual console |
| 472 | 417 | ||
| 473 | 418 | ||
| 474 | 419 | ||
| 475 | Each virtual console that is configured (i.e. the device exists in | 420 | Each virtual console that is configured (i.e. the device exists in |
| 476 | /dev and /etc/inittab runs a getty on it) will come up in its own | 421 | /dev and /etc/inittab runs a getty on it) will come up in its own |
| 477 | xterm. If you get tired of the xterms, read ``Setting up serial | 422 | xterm. If you get tired of the xterms, read |
| 478 | lines and consoles'' to see how to attach the consoles to | 423 | :ref:`setting_up_serial_lines_and_consoles` to see how to attach |
| 479 | something else, like host ptys. | 424 | the consoles to something else, like host ptys. |
| 480 | 425 | ||
| 481 | 426 | ||
| 482 | 427 | ||
| 483 | o Over the serial line | 428 | - Over the serial line |
| 484 | 429 | ||
| 485 | 430 | ||
| 486 | In the boot output, find a line that looks like: | 431 | In the boot output, find a line that looks like:: |
| 487 | 432 | ||
| 488 | 433 | ||
| 489 | 434 | ||
| @@ -493,7 +438,7 @@ · 3 unmodified lines | |||
| 493 | 438 | ||
| 494 | 439 | ||
| 495 | Attach your favorite terminal program to the corresponding tty. I.e. | 440 | Attach your favorite terminal program to the corresponding tty. I.e. |
| 496 | for minicom, the command would be | 441 | for minicom, the command would be:: |
| 497 | 442 | ||
| 498 | 443 | ||
| 499 | host% minicom -o -p /dev/ttyp1 | 444 | host% minicom -o -p /dev/ttyp1 |
| @@ -503,37 +448,40 @@ · 3 unmodified lines | |||
| 503 | 448 | ||
| 504 | 449 | ||
| 505 | 450 | ||
| 506 | o Over the net | 451 | - Over the net |
| 507 | 452 | ||
| 508 | 453 | ||
| 509 | If the network is running, then you can telnet to the virtual | 454 | If the network is running, then you can telnet to the virtual |
| 510 | machine and log in to it. See ``Setting up the network'' to learn | 455 | machine and log in to it. See :ref:`Setting_up_the_network` to learn |
| 511 | about setting up a virtual network. | 456 | about setting up a virtual network. |
| 512 | 457 | ||
| 513 | When you're done using it, run halt, and the kernel will bring itself | 458 | When you're done using it, run halt, and the kernel will bring itself |
| 514 | down and the process will exit. | 459 | down and the process will exit. |
| 515 | 460 | ||
| 516 | 461 | ||
| 517 | 3.3. Examples | 462 | 3.3. Examples |
| 463 | -------------- | ||
| 518 | 464 | ||
| 519 | Here are some examples of UML in action: | 465 | Here are some examples of UML in action: |
| 520 | 466 | ||
| 521 | o A login session <http://user-mode-linux.sourceforge.net/login.html> | 467 | - A login session http://user-mode-linux.sourceforge.net/old/login.html |
| 522 | 468 | ||
| 523 | o A virtual network <http://user-mode-linux.sourceforge.net/net.html> | 469 | - A virtual network http://user-mode-linux.sourceforge.net/old/net.html |
| 524 | 470 | ||
| 525 | 471 | ||
| 526 | 472 | ||
| 527 | 473 | ||
| 528 | 474 | ||
| 475 | .. _UML_on_2G/2G_hosts: | ||
| 529 | 476 | ||
| 477 | 4. UML on 2G/2G hosts | ||
| 478 | ====================== | ||
| 530 | 479 | ||
| 531 | 4. UML on 2G/2G hosts | ||
| 532 | 480 | ||
| 533 | 481 | ||
| 534 | 482 | ||
| 535 | 483 | 4.1. Introduction | |
| 536 | 4.1. Introduction | 484 | ------------------ |
| 537 | 485 | ||
| 538 | 486 | ||
| 539 | Most Linux machines are configured so that the kernel occupies the | 487 | Most Linux machines are configured so that the kernel occupies the |
| @@ -546,7 +494,8 @@ · 6 unmodified lines | |||
| 546 | 494 | ||
| 547 | 495 | ||
| 548 | 496 | ||
| 549 | 4.2. The problem | 497 | 4.2. The problem |
| 498 | ----------------- | ||
| 550 | 499 | ||
| 551 | 500 | ||
| 552 | The prebuilt UML binaries on this site will not run on 2G/2G hosts | 501 | The prebuilt UML binaries on this site will not run on 2G/2G hosts |
| @@ -558,13 +507,14 @@ · 5 unmodified lines | |||
| 558 | 507 | ||
| 559 | 508 | ||
| 560 | 509 | ||
| 561 | 4.3. The solution | 510 | 4.3. The solution |
| 511 | ------------------ | ||
| 562 | 512 | ||
| 563 | 513 | ||
| 564 | The fix for this is to rebuild UML from source after enabling | 514 | The fix for this is to rebuild UML from source after enabling |
| 565 | CONFIG_HOST_2G_2G (under 'General Setup'). This will cause UML to | 515 | CONFIG_HOST_2G_2G (under 'General Setup'). This will cause UML to |
| 566 | load itself in the top .5G of that smaller process address space, | 516 | load itself in the top .5G of that smaller process address space, |
| 567 | where it will run fine. See ``Compiling the kernel and modules'' if | 517 | where it will run fine. See :ref:`Compiling_the_kernel_and_modules` if |
| 568 | you need help building UML from source. | 518 | you need help building UML from source. |
| 569 | 519 | ||
| 570 | 520 | ||
| @@ -573,10 +523,11 @@ · 2 unmodified lines | |||
| 573 | 523 | ||
| 574 | 524 | ||
| 575 | 525 | ||
| 526 | .. _setting_up_serial_lines_and_consoles: | ||
| 576 | 527 | ||
| 577 | 528 | ||
| 578 | 529 | 5. Setting up serial lines and consoles | |
| 579 | 5. Setting up serial lines and consoles | 530 | ======================================== |
| 580 | 531 | ||
| 581 | 532 | ||
| 582 | It is possible to attach UML serial lines and consoles to many types | 533 | It is possible to attach UML serial lines and consoles to many types |
| @@ -584,22 +535,23 @@ · 1 unmodified line | |||
| 584 | 535 | ||
| 585 | 536 | ||
| 586 | You can attach them to host ptys, ttys, file descriptors, and ports. | 537 | You can attach them to host ptys, ttys, file descriptors, and ports. |
| 587 | This allows you to do things like | 538 | This allows you to do things like: |
| 588 | 539 | ||
| 589 | o have a UML console appear on an unused host console, | 540 | - have a UML console appear on an unused host console, |
| 590 | 541 | ||
| 591 | o hook two virtual machines together by having one attach to a pty | 542 | - hook two virtual machines together by having one attach to a pty |
| 592 | and having the other attach to the corresponding tty | 543 | and having the other attach to the corresponding tty |
| 593 | 544 | ||
| 594 | o make a virtual machine accessible from the net by attaching a | 545 | - make a virtual machine accessible from the net by attaching a |
| 595 | console to a port on the host. | 546 | console to a port on the host. |
| 596 | 547 | ||
| 597 | 548 | ||
| 598 | The general format of the command line option is device=channel. | 549 | The general format of the command line option is ``device=channel``. |
| 599 | 550 | ||
| 600 | 551 | ||
| 601 | 552 | ||
| 602 | 5.1. Specifying the device | 553 | 5.1. Specifying the device |
| 554 | --------------------------- | ||
| 603 | 555 | ||
| 604 | Devices are specified with "con" or "ssl" (console or serial line, | 556 | Devices are specified with "con" or "ssl" (console or serial line, |
| 605 | respectively), optionally with a device number if you are talking | 557 | respectively), optionally with a device number if you are talking |
| @@ -613,7 +565,7 @@ · 7 unmodified lines | |||
| 613 | 565 | ||
| 614 | A specific device name will override a less general "con=" or "ssl=". | 566 | A specific device name will override a less general "con=" or "ssl=". |
| 615 | So, for example, you can assign a pty to each of the serial lines | 567 | So, for example, you can assign a pty to each of the serial lines |
| 616 | except for the first two like this: | 568 | except for the first two like this:: |
| 617 | 569 | ||
| 618 | 570 | ||
| 619 | ssl=pty ssl0=tty:/dev/tty0 ssl1=tty:/dev/tty1 | 571 | ssl=pty ssl0=tty:/dev/tty0 ssl1=tty:/dev/tty1 |
| @@ -626,13 +578,14 @@ · 6 unmodified lines | |||
| 626 | 578 | ||
| 627 | 579 | ||
| 628 | 580 | ||
| 629 | 5.2. Specifying the channel | 581 | 5.2. Specifying the channel |
| 582 | ---------------------------- | ||
| 630 | 583 | ||
| 631 | There are a number of different types of channels to attach a UML | 584 | There are a number of different types of channels to attach a UML |
| 632 | device to, each with a different way of specifying exactly what to | 585 | device to, each with a different way of specifying exactly what to |
| 633 | attach to. | 586 | attach to. |
| 634 | 587 | ||
| 635 | o pseudo-terminals - device=pty pts terminals - device=pts | 588 | - pseudo-terminals - device=pty pts terminals - device=pts |
| 636 | 589 | ||
| 637 | 590 | ||
| 638 | This will cause UML to allocate a free host pseudo-terminal for the | 591 | This will cause UML to allocate a free host pseudo-terminal for the |
| @@ -640,23 +593,23 @@ · 1 unmodified line | |||
| 640 | log. You access it by attaching a terminal program to the | 593 | log. You access it by attaching a terminal program to the |
| 641 | corresponding tty: | 594 | corresponding tty: |
| 642 | 595 | ||
| 643 | o screen /dev/pts/n | 596 | - screen /dev/pts/n |
| 644 | 597 | ||
| 645 | o screen /dev/ttyxx | 598 | - screen /dev/ttyxx |
| 646 | 599 | ||
| 647 | o minicom -o -p /dev/ttyxx - minicom seems not able to handle pts | 600 | - minicom -o -p /dev/ttyxx - minicom seems not able to handle pts |
| 648 | devices | 601 | devices |
| 649 | 602 | ||
| 650 | o kermit - start it up, 'open' the device, then 'connect' | 603 | - kermit - start it up, 'open' the device, then 'connect' |
| 651 | 604 | ||
| 652 | 605 | ||
| 653 | 606 | ||
| 654 | 607 | ||
| 655 | 608 | ||
| 656 | o terminals - device=tty:tty device file | 609 | - terminals - device=tty:tty device file |
| 657 | 610 | ||
| 658 | 611 | ||
| 659 | This will make UML attach the device to the specified tty (i.e | 612 | This will make UML attach the device to the specified tty (i.e:: |
| 660 | 613 | ||
| 661 | 614 | ||
| 662 | con1=tty:/dev/tty3 | 615 | con1=tty:/dev/tty3 |
| @@ -672,7 +625,7 @@ · 9 unmodified lines | |||
| 672 | 625 | ||
| 673 | 626 | ||
| 674 | 627 | ||
| 675 | o xterms - device=xterm | 628 | - xterms - device=xterm |
| 676 | 629 | ||
| 677 | 630 | ||
| 678 | UML will run an xterm and the device will be attached to it. | 631 | UML will run an xterm and the device will be attached to it. |
| @@ -681,12 +634,12 @@ · 2 unmodified lines | |||
| 681 | 634 | ||
| 682 | 635 | ||
| 683 | 636 | ||
| 684 | o Port - device=port:port number | 637 | - Port - device=port:port number |
| 685 | 638 | ||
| 686 | 639 | ||
| 687 | This will attach the UML devices to the specified host port. | 640 | This will attach the UML devices to the specified host port. |
| 688 | Attaching console 1 to the host's port 9000 would be done like | 641 | Attaching console 1 to the host's port 9000 would be done like |
| 689 | this: | 642 | this:: |
| 690 | 643 | ||
| 691 | 644 | ||
| 692 | con1=port:9000 | 645 | con1=port:9000 |
| @@ -694,7 +647,7 @@ · 1 unmodified line | |||
| 694 | 647 | ||
| 695 | 648 | ||
| 696 | 649 | ||
| 697 | Attaching all the serial lines to that port would be done similarly: | 650 | Attaching all the serial lines to that port would be done similarly:: |
| 698 | 651 | ||
| 699 | 652 | ||
| 700 | ssl=port:9000 | 653 | ssl=port:9000 |
| @@ -702,8 +655,8 @@ · 1 unmodified line | |||
| 702 | 655 | ||
| 703 | 656 | ||
| 704 | 657 | ||
| 705 | You access these devices by telnetting to that port. Each active tel- | 658 | You access these devices by telnetting to that port. Each active |
| 706 | net session gets a different device. If there are more telnets to a | 659 | telnet session gets a different device. If there are more telnets to a |
| 707 | port than UML devices attached to it, then the extra telnet sessions | 660 | port than UML devices attached to it, then the extra telnet sessions |
| 708 | will block until an existing telnet detaches, or until another device | 661 | will block until an existing telnet detaches, or until another device |
| 709 | becomes active (i.e. by being activated in /etc/inittab). | 662 | becomes active (i.e. by being activated in /etc/inittab). |
| @@ -725,13 +678,13 @@ · 15 unmodified lines | |||
| 725 | 678 | ||
| 726 | 679 | ||
| 727 | 680 | ||
| 728 | o already-existing file descriptors - device=file descriptor | 681 | - already-existing file descriptors - device=file descriptor |
| 729 | 682 | ||
| 730 | 683 | ||
| 731 | If you set up a file descriptor on the UML command line, you can | 684 | If you set up a file descriptor on the UML command line, you can |
| 732 | attach a UML device to it. This is most commonly used to put the | 685 | attach a UML device to it. This is most commonly used to put the |
| 733 | main console back on stdin and stdout after assigning all the other | 686 | main console back on stdin and stdout after assigning all the other |
| 734 | consoles to something else: | 687 | consoles to something else:: |
| 735 | 688 | ||
| 736 | 689 | ||
| 737 | con0=fd:0,fd:1 con=pts | 690 | con0=fd:0,fd:1 con=pts |
| @@ -743,7 +696,7 @@ · 5 unmodified lines | |||
| 743 | 696 | ||
| 744 | 697 | ||
| 745 | 698 | ||
| 746 | o Nothing - device=null | 699 | - Nothing - device=null |
| 747 | 700 | ||
| 748 | 701 | ||
| 749 | This allows the device to be opened, in contrast to 'none', but | 702 | This allows the device to be opened, in contrast to 'none', but |
| @@ -754,7 +707,7 @@ · 4 unmodified lines | |||
| 754 | 707 | ||
| 755 | 708 | ||
| 756 | 709 | ||
| 757 | o None - device=none | 710 | - None - device=none |
| 758 | 711 | ||
| 759 | 712 | ||
| 760 | This causes the device to disappear. | 713 | This causes the device to disappear. |
| @@ -762,7 +715,7 @@ · 1 unmodified line | |||
| 762 | 715 | ||
| 763 | 716 | ||
| 764 | You can also specify different input and output channels for a device | 717 | You can also specify different input and output channels for a device |
| 765 | by putting a comma between them: | 718 | by putting a comma between them:: |
| 766 | 719 | ||
| 767 | 720 | ||
| 768 | ssl3=tty:/dev/tty2,xterm | 721 | ssl3=tty:/dev/tty2,xterm |
| @@ -785,14 +738,15 @@ · 16 unmodified lines | |||
| 785 | 738 | ||
| 786 | 739 | ||
| 787 | 740 | ||
| 788 | 5.3. Examples | 741 | 5.3. Examples |
| 742 | -------------- | ||
| 789 | 743 | ||
| 790 | There are a number of interesting things you can do with this | 744 | There are a number of interesting things you can do with this |
| 791 | capability. | 745 | capability. |
| 792 | 746 | ||
| 793 | 747 | ||
| 794 | First, this is how you get rid of those bleeding console xterms by | 748 | First, this is how you get rid of those bleeding console xterms by |
| 795 | attaching them to host ptys: | 749 | attaching them to host ptys:: |
| 796 | 750 | ||
| 797 | 751 | ||
| 798 | con=pty con0=fd:0,fd:1 | 752 | con=pty con0=fd:0,fd:1 |
| @@ -802,7 +756,7 @@ · 3 unmodified lines | |||
| 802 | 756 | ||
| 803 | This will make a UML console take over an unused host virtual console, | 757 | This will make a UML console take over an unused host virtual console, |
| 804 | so that when you switch to it, you will see the UML login prompt | 758 | so that when you switch to it, you will see the UML login prompt |
| 805 | rather than the host login prompt: | 759 | rather than the host login prompt:: |
| 806 | 760 | ||
| 807 | 761 | ||
| 808 | con1=tty:/dev/tty6 | 762 | con1=tty:/dev/tty6 |
| @@ -813,7 +767,7 @@ · 4 unmodified lines | |||
| 813 | You can attach two virtual machines together with what amounts to a | 767 | You can attach two virtual machines together with what amounts to a |
| 814 | serial line as follows: | 768 | serial line as follows: |
| 815 | 769 | ||
| 816 | Run one UML with a serial line attached to a pty - | 770 | Run one UML with a serial line attached to a pty:: |
| 817 | 771 | ||
| 818 | 772 | ||
| 819 | ssl1=pty | 773 | ssl1=pty |
| @@ -825,7 +779,7 @@ · 5 unmodified lines | |||
| 825 | that it got /dev/ptyp1). | 779 | that it got /dev/ptyp1). |
| 826 | 780 | ||
| 827 | Boot the other UML with a serial line attached to the corresponding | 781 | Boot the other UML with a serial line attached to the corresponding |
| 828 | tty - | 782 | tty:: |
| 829 | 783 | ||
| 830 | 784 | ||
| 831 | ssl1=tty:/dev/ttyp1 | 785 | ssl1=tty:/dev/ttyp1 |
| @@ -838,7 +792,10 @@ · 6 unmodified lines | |||
| 838 | prompt of the other virtual machine. | 792 | prompt of the other virtual machine. |
| 839 | 793 | ||
| 840 | 794 | ||
| 841 | 6. Setting up the network | 795 | .. _setting_up_the_network: |
| 796 | |||
| 797 | 6. Setting up the network | ||
| 798 | ========================== | ||
| 842 | 799 | ||
| 843 | 800 | ||
| 844 | 801 | ||
| @@ -858,19 +815,19 @@ · 13 unmodified lines | |||
| 858 | There are currently five transport types available for a UML virtual | 815 | There are currently five transport types available for a UML virtual |
| 859 | machine to exchange packets with other hosts: | 816 | machine to exchange packets with other hosts: |
| 860 | 817 | ||
| 861 | o ethertap | 818 | - ethertap |
| 862 | 819 | ||
| 863 | o TUN/TAP | 820 | - TUN/TAP |
| 864 | 821 | ||
| 865 | o Multicast | 822 | - Multicast |
| 866 | 823 | ||
| 867 | o a switch daemon | 824 | - a switch daemon |
| 868 | 825 | ||
| 869 | o slip | 826 | - slip |
| 870 | 827 | ||
| 871 | o slirp | 828 | - slirp |
| 872 | 829 | ||
| 873 | o pcap | 830 | - pcap |
| 874 | 831 | ||
| 875 | The TUN/TAP, ethertap, slip, and slirp transports allow a UML | 832 | The TUN/TAP, ethertap, slip, and slirp transports allow a UML |
| 876 | instance to exchange packets with the host. They may be directed | 833 | instance to exchange packets with the host. They may be directed |
| @@ -893,28 +850,28 @@ · 16 unmodified lines | |||
| 893 | With so many host transports, which one should you use? Here's when | 850 | With so many host transports, which one should you use? Here's when |
| 894 | you should use each one: | 851 | you should use each one: |
| 895 | 852 | ||
| 896 | o ethertap - if you want access to the host networking and it is | 853 | - ethertap - if you want access to the host networking and it is |
| 897 | running 2.2 | 854 | running 2.2 |
| 898 | 855 | ||
| 899 | o TUN/TAP - if you want access to the host networking and it is | 856 | - TUN/TAP - if you want access to the host networking and it is |
| 900 | running 2.4. Also, the TUN/TAP transport is able to use a | 857 | running 2.4. Also, the TUN/TAP transport is able to use a |
| 901 | preconfigured device, allowing it to avoid using the setuid uml_net | 858 | preconfigured device, allowing it to avoid using the setuid uml_net |
| 902 | helper, which is a security advantage. | 859 | helper, which is a security advantage. |
| 903 | 860 | ||
| 904 | o Multicast - if you want a purely virtual network and you don't want | 861 | - Multicast - if you want a purely virtual network and you don't want |
| 905 | to set up anything but the UML | 862 | to set up anything but the UML |
| 906 | 863 | ||
| 907 | o a switch daemon - if you want a purely virtual network and you | 864 | - a switch daemon - if you want a purely virtual network and you |
| 908 | don't mind running the daemon in order to get somewhat better | 865 | don't mind running the daemon in order to get somewhat better |
| 909 | performance | 866 | performance |
| 910 | 867 | ||
| 911 | o slip - there is no particular reason to run the slip backend unless | 868 | - slip - there is no particular reason to run the slip backend unless |
| 912 | ethertap and TUN/TAP are just not available for some reason | 869 | ethertap and TUN/TAP are just not available for some reason |
| 913 | 870 | ||
| 914 | o slirp - if you don't have root access on the host to setup | 871 | - slirp - if you don't have root access on the host to setup |
| 915 | networking, or if you don't want to allocate an IP to your UML | 872 | networking, or if you don't want to allocate an IP to your UML |
| 916 | 873 | ||
| 917 | o pcap - not much use for actual network connectivity, but great for | 874 | - pcap - not much use for actual network connectivity, but great for |
| 918 | monitoring traffic on the host | 875 | monitoring traffic on the host |
| 919 | 876 | ||
| 920 | Ethertap is available on 2.4 and works fine. TUN/TAP is preferred | 877 | Ethertap is available on 2.4 and works fine. TUN/TAP is preferred |
| @@ -926,7 +883,8 @@ · 5 unmodified lines | |||
| 926 | exploit the helper's root privileges. | 883 | exploit the helper's root privileges. |
| 927 | 884 | ||
| 928 | 885 | ||
| 929 | 6.1. General setup | 886 | 6.1. General setup |
| 887 | ------------------- | ||
| 930 | 888 | ||
| 931 | First, you must have the virtual network enabled in your UML. If are | 889 | First, you must have the virtual network enabled in your UML. If are |
| 932 | running a prebuilt kernel from this site, everything is already | 890 | running a prebuilt kernel from this site, everything is already |
| @@ -938,7 +896,7 @@ · 5 unmodified lines | |||
| 938 | The next step is to provide a network device to the virtual machine. | 896 | The next step is to provide a network device to the virtual machine. |
| 939 | This is done by describing it on the kernel command line. | 897 | This is done by describing it on the kernel command line. |
| 940 | 898 | ||
| 941 | The general format is | 899 | The general format is:: |
| 942 | 900 | ||
| 943 | 901 | ||
| 944 | eth <n> = <transport> , <transport args> | 902 | eth <n> = <transport> , <transport args> |
| @@ -947,7 +905,7 @@ · 2 unmodified lines | |||
| 947 | 905 | ||
| 948 | 906 | ||
| 949 | For example, a virtual ethernet device may be attached to a host | 907 | For example, a virtual ethernet device may be attached to a host |
| 950 | ethertap device as follows: | 908 | ethertap device as follows:: |
| 951 | 909 | ||
| 952 | 910 | ||
| 953 | eth0=ethertap,tap0,fe:fd:0:0:0:1,192.168.0.254 | 911 | eth0=ethertap,tap0,fe:fd:0:0:0:1,192.168.0.254 |
| @@ -978,7 +936,7 @@ · 24 unmodified lines | |||
| 978 | 936 | ||
| 979 | 937 | ||
| 980 | You can also add devices to a UML and remove them at runtime. See the | 938 | You can also add devices to a UML and remove them at runtime. See the |
| 981 | ``The Management Console'' page for details. | 939 | :ref:`The_Management_Console` page for details. |
| 982 | 940 | ||
| 983 | 941 | ||
| 984 | The sections below describe this in more detail. | 942 | The sections below describe this in more detail. |
| @@ -995,7 +953,8 @@ · 10 unmodified lines | |||
| 995 | 953 | ||
| 996 | 954 | ||
| 997 | 955 | ||
| 998 | 6.2. Userspace daemons | 956 | 6.2. Userspace daemons |
| 957 | ----------------------- | ||
| 999 | 958 | ||
| 1000 | You will likely need the setuid helper, or the switch daemon, or both. | 959 | You will likely need the setuid helper, or the switch daemon, or both. |
| 1001 | They are both installed with the RPM and deb, so if you've installed | 960 | They are both installed with the RPM and deb, so if you've installed |
| @@ -1011,7 +970,8 @@ · 9 unmodified lines | |||
| 1011 | 970 | ||
| 1012 | 971 | ||
| 1013 | 972 | ||
| 1014 | 6.3. Specifying ethernet addresses | 973 | 6.3. Specifying ethernet addresses |
| 974 | ----------------------------------- | ||
| 1015 | 975 | ||
| 1016 | Below, you will see that the TUN/TAP, ethertap, and daemon interfaces | 976 | Below, you will see that the TUN/TAP, ethertap, and daemon interfaces |
| 1017 | allow you to specify hardware addresses for the virtual ethernet | 977 | allow you to specify hardware addresses for the virtual ethernet |
| @@ -1023,21 +983,21 @@ · 5 unmodified lines | |||
| 1023 | sufficient to guarantee a unique hardware address for the device. A | 983 | sufficient to guarantee a unique hardware address for the device. A |
| 1024 | couple of exceptions are: | 984 | couple of exceptions are: |
| 1025 | 985 | ||
| 1026 | o Another set of virtual ethernet devices are on the same network and | 986 | - Another set of virtual ethernet devices are on the same network and |
| 1027 | they are assigned hardware addresses using a different scheme which | 987 | they are assigned hardware addresses using a different scheme which |
| 1028 | may conflict with the UML IP address-based scheme | 988 | may conflict with the UML IP address-based scheme |
| 1029 | 989 | ||
| 1030 | o You aren't going to use the device for IP networking, so you don't | 990 | - You aren't going to use the device for IP networking, so you don't |
| 1031 | assign the device an IP address | 991 | assign the device an IP address |
| 1032 | 992 | ||
| 1033 | If you let the driver provide the hardware address, you should make | 993 | If you let the driver provide the hardware address, you should make |
| 1034 | sure that the device IP address is known before the interface is | 994 | sure that the device IP address is known before the interface is |
| 1035 | brought up. So, inside UML, this will guarantee that: | 995 | brought up. So, inside UML, this will guarantee that:: |
| 1036 | 996 | ||
| 1037 | 997 | ||
| 1038 | 998 | ||
| 1039 | UML# | 999 | UML# |
| 1040 | ifconfig eth0 192.168.0.250 up | 1000 | ifconfig eth0 192.168.0.250 up |
| 1041 | 1001 | ||
| 1042 | 1002 | ||
| 1043 | 1003 | ||
| @@ -1049,13 +1009,14 @@ · 5 unmodified lines | |||
| 1049 | 1009 | ||
| 1050 | 1010 | ||
| 1051 | 1011 | ||
| 1052 | 6.4. UML interface setup | 1012 | 6.4. UML interface setup |
| 1013 | ------------------------- | ||
| 1053 | 1014 | ||
| 1054 | Once the network devices have been described on the command line, you | 1015 | Once the network devices have been described on the command line, you |
| 1055 | should boot UML and log in. | 1016 | should boot UML and log in. |
| 1056 | 1017 | ||
| 1057 | 1018 | ||
| 1058 | The first thing to do is bring the interface up: | 1019 | The first thing to do is bring the interface up:: |
| 1059 | 1020 | ||
| 1060 | 1021 | ||
| 1061 | UML# ifconfig ethn ip-address up | 1022 | UML# ifconfig ethn ip-address up |
| @@ -1067,7 +1028,7 @@ · 5 unmodified lines | |||
| 1067 | 1028 | ||
| 1068 | 1029 | ||
| 1069 | To reach the rest of the world, you should set a default route to the | 1030 | To reach the rest of the world, you should set a default route to the |
| 1070 | host: | 1031 | host:: |
| 1071 | 1032 | ||
| 1072 | 1033 | ||
| 1073 | UML# route add default gw host ip | 1034 | UML# route add default gw host ip |
| @@ -1075,7 +1036,7 @@ · 1 unmodified line | |||
| 1075 | 1036 | ||
| 1076 | 1037 | ||
| 1077 | 1038 | ||
| 1078 | Again, with host ip of 192.168.0.4: | 1039 | Again, with host ip of 192.168.0.4:: |
| 1079 | 1040 | ||
| 1080 | 1041 | ||
| 1081 | UML# route add default gw 192.168.0.4 | 1042 | UML# route add default gw 192.168.0.4 |
| @@ -1097,29 +1058,25 @@ · 15 unmodified lines | |||
| 1097 | Note: If you can't communicate with other hosts on your physical | 1058 | Note: If you can't communicate with other hosts on your physical |
| 1098 | ethernet, it's probably because of a network route that's | 1059 | ethernet, it's probably because of a network route that's |
| 1099 | automatically set up. If you run 'route -n' and see a route that | 1060 | automatically set up. If you run 'route -n' and see a route that |
| 1100 | looks like this: | 1061 | looks like this:: |
| 1101 | 1062 | ||
| 1102 | 1063 | ||
| 1103 | 1064 | ||
| 1104 | 1065 | ||
| 1105 | Destination Gateway Genmask Flags Metric Ref Use Iface | 1066 | Destination Gateway Genmask Flags Metric Ref Use Iface |
| 1106 | 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 | 1067 | 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 |
| 1107 | 1068 | ||
| 1108 | 1069 | ||
| 1109 | 1070 | ||
| 1110 | 1071 | ||
| 1111 | with a mask that's not 255.255.255.255, then replace it with a route | 1072 | with a mask that's not 255.255.255.255, then replace it with a route |
| 1112 | to your host: | 1073 | to your host:: |
| 1113 | 1074 | ||
| 1114 | 1075 | ||
| 1115 | UML# | 1076 | UML# |
| 1116 | route del -net 192.168.0.0 dev eth0 netmask 255.255.255.0 | 1077 | route del -net 192.168.0.0 dev eth0 netmask 255.255.255.0 |
| 1117 | 1078 | ||
| 1118 | 1079 | ||
| 1119 | |||
| 1120 | |||
| 1121 | |||
| 1122 | |||
| 1123 | UML# | 1080 | UML# |
| 1124 | route add -host 192.168.0.4 dev eth0 | 1081 | route add -host 192.168.0.4 dev eth0 |
| 1125 | 1082 | ||
| @@ -1131,7 +1088,8 @@ · 5 unmodified lines | |||
| 1131 | 1088 | ||
| 1132 | 1089 | ||
| 1133 | 1090 | ||
| 1134 | 6.5. Multicast | 1091 | 6.5. Multicast |
| 1092 | --------------- | ||
| 1135 | 1093 | ||
| 1136 | The simplest way to set up a virtual network between multiple UMLs is | 1094 | The simplest way to set up a virtual network between multiple UMLs is |
| 1137 | to use the mcast transport. This was written by Harald Welte and is | 1095 | to use the mcast transport. This was written by Harald Welte and is |
| @@ -1142,7 +1100,7 @@ · 4 unmodified lines | |||
| 1142 | messages when you bring the device up inside UML. | 1100 | messages when you bring the device up inside UML. |
| 1143 | 1101 | ||
| 1144 | 1102 | ||
| 1145 | To use it, run two UMLs with | 1103 | To use it, run two UMLs with:: |
| 1146 | 1104 | ||
| 1147 | 1105 | ||
| 1148 | eth0=mcast | 1106 | eth0=mcast |
| @@ -1151,16 +1109,12 @@ · 2 unmodified lines | |||
| 1151 | 1109 | ||
| 1152 | 1110 | ||
| 1153 | on their command lines. Log in, configure the ethernet device in each | 1111 | on their command lines. Log in, configure the ethernet device in each |
| 1154 | machine with different IP addresses: | 1112 | machine with different IP addresses:: |
| 1155 | 1113 | ||
| 1156 | 1114 | ||
| 1157 | UML1# ifconfig eth0 192.168.0.254 | 1115 | UML1# ifconfig eth0 192.168.0.254 |
| 1158 | 1116 | ||
| 1159 | 1117 | ||
| 1160 | |||
| 1161 | |||
| 1162 | |||
| 1163 | |||
| 1164 | UML2# ifconfig eth0 192.168.0.253 | 1118 | UML2# ifconfig eth0 192.168.0.253 |
| 1165 | 1119 | ||
| 1166 | 1120 | ||
| @@ -1168,7 +1122,7 @@ · 1 unmodified line | |||
| 1168 | 1122 | ||
| 1169 | and they should be able to talk to each other. | 1123 | and they should be able to talk to each other. |
| 1170 | 1124 | ||
| 1171 | The full set of command line options for this transport are | 1125 | The full set of command line options for this transport are:: |
| 1172 | 1126 | ||
| 1173 | 1127 | ||
| 1174 | 1128 | ||
| @@ -1177,16 +1131,11 @@ · 2 unmodified lines | |||
| 1177 | 1131 | ||
| 1178 | 1132 | ||
| 1179 | 1133 | ||
| 1180 | |||
| 1181 | Harald's original README is here <http://user-mode-linux.source- | ||
| 1182 | forge.net/> and explains these in detail, as well as | ||
| 1183 | some other issues. | ||
| 1184 | |||
| 1185 | There is also a related point-to-point only "ucast" transport. | 1134 | There is also a related point-to-point only "ucast" transport. |
| 1186 | This is useful when your network does not support multicast, and | 1135 | This is useful when your network does not support multicast, and |
| 1187 | all network connections are simple point to point links. | 1136 | all network connections are simple point to point links. |
| 1188 | 1137 | ||
| 1189 | The full set of command line options for this transport are | 1138 | The full set of command line options for this transport are:: |
| 1190 | 1139 | ||
| 1191 | 1140 | ||
| 1192 | ethn=ucast,ethernet address,remote address,listen port,remote port | 1141 | ethn=ucast,ethernet address,remote address,listen port,remote port |
| @@ -1194,7 +1143,8 @@ · 1 unmodified line | |||
| 1194 | 1143 | ||
| 1195 | 1144 | ||
| 1196 | 1145 | ||
| 1197 | 6.6. TUN/TAP with the uml_net helper | 1146 | 6.6. TUN/TAP with the uml_net helper |
| 1147 | ------------------------------------- | ||
| 1198 | 1148 | ||
| 1199 | TUN/TAP is the preferred mechanism on 2.4 to exchange packets with the | 1149 | TUN/TAP is the preferred mechanism on 2.4 to exchange packets with the |
| 1200 | host. The TUN/TAP backend has been in UML since 2.4.9-3um. | 1150 | host. The TUN/TAP backend has been in UML since 2.4.9-3um. |
| @@ -1216,7 +1166,7 @@ · 15 unmodified lines | |||
| 1216 | kernel or as the tun.o module. | 1166 | kernel or as the tun.o module. |
| 1217 | 1167 | ||
| 1218 | The format of the command line switch to attach a device to a TUN/TAP | 1168 | The format of the command line switch to attach a device to a TUN/TAP |
| 1219 | device is | 1169 | device is:: |
| 1220 | 1170 | ||
| 1221 | 1171 | ||
| 1222 | eth <n> =tuntap,,, <IP address> | 1172 | eth <n> =tuntap,,, <IP address> |
| @@ -1226,7 +1176,7 @@ · 3 unmodified lines | |||
| 1226 | 1176 | ||
| 1227 | For example, this argument will attach the UML's eth0 to the next | 1177 | For example, this argument will attach the UML's eth0 to the next |
| 1228 | available tap device and assign an ethernet address to it based on its | 1178 | available tap device and assign an ethernet address to it based on its |
| 1229 | IP address | 1179 | IP address:: |
| 1230 | 1180 | ||
| 1231 | 1181 | ||
| 1232 | eth0=tuntap,,,192.168.0.254 | 1182 | eth0=tuntap,,,192.168.0.254 |
| @@ -1247,10 +1197,10 @@ · 14 unmodified lines | |||
| 1247 | There are a couple potential problems with running the TUN/TAP | 1197 | There are a couple potential problems with running the TUN/TAP |
| 1248 | transport on a 2.4 host kernel | 1198 | transport on a 2.4 host kernel |
| 1249 | 1199 | ||
| 1250 | o TUN/TAP seems not to work on 2.4.3 and earlier. Upgrade the host | 1200 | - TUN/TAP seems not to work on 2.4.3 and earlier. Upgrade the host |
| 1251 | kernel or use the ethertap transport. | 1201 | kernel or use the ethertap transport. |
| 1252 | 1202 | ||
| 1253 | o With an upgraded kernel, TUN/TAP may fail with | 1203 | - With an upgraded kernel, TUN/TAP may fail with:: |
| 1254 | 1204 | ||
| 1255 | 1205 | ||
| 1256 | File descriptor in bad state | 1206 | File descriptor in bad state |
| @@ -1263,13 +1213,12 @@ · 6 unmodified lines | |||
| 1263 | make sure that /usr/src/linux points to the headers for the running | 1213 | make sure that /usr/src/linux points to the headers for the running |
| 1264 | kernel. | 1214 | kernel. |
| 1265 | 1215 | ||
| 1266 | These were pointed out by Tim Robinson <timro at trkr dot net> in | 1216 | These were pointed out by Tim Robinson <timro at trkr dot net> in the past. |
| 1267 | <http://www.geocrawler.com/> name="this uml- | ||
| 1268 | user post"> . | ||
| 1269 | 1217 | ||
| 1270 | 1218 | ||
| 1271 | 1219 | ||
| 1272 | 6.7. TUN/TAP with a preconfigured tap device | 1220 | 6.7. TUN/TAP with a preconfigured tap device |
| 1221 | --------------------------------------------- | ||
| 1273 | 1222 | ||
| 1274 | If you prefer not to have UML use uml_net (which is somewhat | 1223 | If you prefer not to have UML use uml_net (which is somewhat |
| 1275 | insecure), with UML 2.4.17-11, you can set up a TUN/TAP device | 1224 | insecure), with UML 2.4.17-11, you can set up a TUN/TAP device |
| @@ -1277,8 +1226,8 @@ · 1 unmodified line | |||
| 1277 | there is no need for root assistance. Setting up the device is done | 1226 | there is no need for root assistance. Setting up the device is done |
| 1278 | as follows: | 1227 | as follows: |
| 1279 | 1228 | ||
| 1280 | o Create the device with tunctl (available from the UML utilities | 1229 | - Create the device with tunctl (available from the UML utilities |
| 1281 | tarball) | 1230 | tarball):: |
| 1282 | 1231 | ||
| 1283 | 1232 | ||
| 1284 | 1233 | ||
| @@ -1291,8 +1240,8 @@ · 6 unmodified lines | |||
| 1291 | where uid is the user id or username that UML will be run as. This | 1240 | where uid is the user id or username that UML will be run as. This |
| 1292 | will tell you what device was created. | 1241 | will tell you what device was created. |
| 1293 | 1242 | ||
| 1294 | o Configure the device IP (change IP addresses and device name to | 1243 | - Configure the device IP (change IP addresses and device name to |
| 1295 | suit) | 1244 | suit):: |
| 1296 | 1245 | ||
| 1297 | 1246 | ||
| 1298 | 1247 | ||
| @@ -1303,8 +1252,8 @@ · 4 unmodified lines | |||
| 1303 | 1252 | ||
| 1304 | 1253 | ||
| 1305 | 1254 | ||
| 1306 | o Set up routing and arping if desired - this is my recipe, there are | 1255 | - Set up routing and arping if desired - this is my recipe, there are |
| 1307 | other ways of doing the same thing | 1256 | other ways of doing the same thing:: |
| 1308 | 1257 | ||
| 1309 | 1258 | ||
| 1310 | host# | 1259 | host# |
| @@ -1313,19 +1262,9 @@ · 2 unmodified lines | |||
| 1313 | host# | 1262 | host# |
| 1314 | route add -host 192.168.0.253 dev tap0 | 1263 | route add -host 192.168.0.253 dev tap0 |
| 1315 | 1264 | ||
| 1316 | |||
| 1317 | |||
| 1318 | |||
| 1319 | |||
| 1320 | |||
| 1321 | host# | 1265 | host# |
| 1322 | bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp' | 1266 | bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp' |
| 1323 | 1267 | ||
| 1324 | |||
| 1325 | |||
| 1326 | |||
| 1327 | |||
| 1328 | |||
| 1329 | host# | 1268 | host# |
| 1330 | arp -Ds 192.168.0.253 eth0 pub | 1269 | arp -Ds 192.168.0.253 eth0 pub |
| 1331 | 1270 | ||
| @@ -1338,76 +1277,43 @@ · 6 unmodified lines | |||
| 1338 | utility which reads the information from a config file and sets up | 1277 | utility which reads the information from a config file and sets up |
| 1339 | devices at boot time. | 1278 | devices at boot time. |
| 1340 | 1279 | ||
| 1341 | o Rather than using up two IPs and ARPing for one of them, you can | 1280 | - Rather than using up two IPs and ARPing for one of them, you can |
| 1342 | also provide direct access to your LAN by the UML by using a | 1281 | also provide direct access to your LAN by the UML by using a |
| 1343 | bridge. | 1282 | bridge:: |
| 1344 | 1283 | ||
| 1345 | 1284 | ||
| 1346 | host# | 1285 | host# |
| 1347 | brctl addbr br0 | 1286 | brctl addbr br0 |
| 1348 | 1287 | ||
| 1349 | 1288 | ||
| 1350 | |||
| 1351 | |||
| 1352 | |||
| 1353 | |||
| 1354 | host# | 1289 | host# |
| 1355 | ifconfig eth0 0.0.0.0 promisc up | 1290 | ifconfig eth0 0.0.0.0 promisc up |
| 1356 | 1291 | ||
| 1357 | 1292 | ||
| 1358 | |||
| 1359 | |||
| 1360 | |||
| 1361 | |||
| 1362 | host# | 1293 | host# |
| 1363 | ifconfig tap0 0.0.0.0 promisc up | 1294 | ifconfig tap0 0.0.0.0 promisc up |
| 1364 | 1295 | ||
| 1365 | 1296 | ||
| 1366 | |||
| 1367 | |||
| 1368 | |||
| 1369 | |||
| 1370 | host# | 1297 | host# |
| 1371 | ifconfig br0 192.168.0.1 netmask 255.255.255.0 up | 1298 | ifconfig br0 192.168.0.1 netmask 255.255.255.0 up |
| 1372 | 1299 | ||
| 1373 | 1300 | ||
| 1374 | 1301 | host# | |
| 1375 | 1302 | brctl stp br0 off | |
| 1376 | |||
| 1377 | |||
| 1378 | |||
| 1379 | host# | ||
| 1380 | brctl stp br0 off | ||
| 1381 | |||
| 1382 | |||
| 1383 | |||
| 1384 | |||
| 1385 | 1303 | ||
| 1386 | 1304 | ||
| 1387 | host# | 1305 | host# |
| 1388 | brctl setfd br0 1 | 1306 | brctl setfd br0 1 |
| 1389 | 1307 | ||
| 1390 | 1308 | ||
| 1391 | |||
| 1392 | |||
| 1393 | |||
| 1394 | |||
| 1395 | host# | 1309 | host# |
| 1396 | brctl sethello br0 1 | 1310 | brctl sethello br0 1 |
| 1397 | 1311 | ||
| 1398 | 1312 | ||
| 1399 | |||
| 1400 | |||
| 1401 | |||
| 1402 | |||
| 1403 | host# | 1313 | host# |
| 1404 | brctl addif br0 eth0 | 1314 | brctl addif br0 eth0 |
| 1405 | 1315 | ||
| 1406 | 1316 | ||
| 1407 | |||
| 1408 | |||
| 1409 | |||
| 1410 | |||
| 1411 | host# | 1317 | host# |
| 1412 | brctl addif br0 tap0 | 1318 | brctl addif br0 tap0 |
| 1413 | 1319 | ||
| @@ -1417,12 +1323,12 @@ · 3 unmodified lines | |||
| 1417 | Note that 'br0' should be setup using ifconfig with the existing IP | 1323 | Note that 'br0' should be setup using ifconfig with the existing IP |
| 1418 | address of eth0, as eth0 no longer has its own IP. | 1324 | address of eth0, as eth0 no longer has its own IP. |
| 1419 | 1325 | ||
| 1420 | o | 1326 | - |
| 1421 | 1327 | ||
| 1422 | 1328 | ||
| 1423 | Also, the /dev/net/tun device must be writable by the user running | 1329 | Also, the /dev/net/tun device must be writable by the user running |
| 1424 | UML in order for the UML to use the device that's been configured | 1330 | UML in order for the UML to use the device that's been configured |
| 1425 | for it. The simplest thing to do is | 1331 | for it. The simplest thing to do is:: |
| 1426 | 1332 | ||
| 1427 | 1333 | ||
| 1428 | host# chmod 666 /dev/net/tun | 1334 | host# chmod 666 /dev/net/tun |
| @@ -1438,14 +1344,14 @@ · 9 unmodified lines | |||
| 1438 | devices and chgrp /dev/net/tun to that group with mode 664 or 660. | 1344 | devices and chgrp /dev/net/tun to that group with mode 664 or 660. |
| 1439 | 1345 | ||
| 1440 | 1346 | ||
| 1441 | o Once the device is set up, run UML with 'eth0=tuntap,device name' | 1347 | - Once the device is set up, run UML with 'eth0=tuntap,device name' |
| 1442 | (i.e. 'eth0=tuntap,tap0') on the command line (or do it with the | 1348 | (i.e. 'eth0=tuntap,tap0') on the command line (or do it with the |
| 1443 | mconsole config command). | 1349 | mconsole config command). |
| 1444 | 1350 | ||
| 1445 | o Bring the eth device up in UML and you're in business. | 1351 | - Bring the eth device up in UML and you're in business. |
| 1446 | 1352 | ||
| 1447 | If you don't want that tap device any more, you can make it non- | 1353 | If you don't want that tap device any more, you can make it non- |
| 1448 | persistent with | 1354 | persistent with:: |
| 1449 | 1355 | ||
| 1450 | 1356 | ||
| 1451 | host# tunctl -d tap device | 1357 | host# tunctl -d tap device |
| @@ -1455,7 +1361,7 @@ · 3 unmodified lines | |||
| 1455 | 1361 | ||
| 1456 | Finally, tunctl has a -b (for brief mode) switch which causes it to | 1362 | Finally, tunctl has a -b (for brief mode) switch which causes it to |
| 1457 | output only the name of the tap device it created. This makes it | 1363 | output only the name of the tap device it created. This makes it |
| 1458 | suitable for capture by a script: | 1364 | suitable for capture by a script:: |
| 1459 | 1365 | ||
| 1460 | 1366 | ||
| 1461 | host# TAP=`tunctl -u 1000 -b` | 1367 | host# TAP=`tunctl -u 1000 -b` |
| @@ -1465,7 +1371,8 @@ · 3 unmodified lines | |||
| 1465 | 1371 | ||
| 1466 | 1372 | ||
| 1467 | 1373 | ||
| 1468 | 6.8. Ethertap | 1374 | 6.8. Ethertap |
| 1375 | -------------- | ||
| 1469 | 1376 | ||
| 1470 | Ethertap is the general mechanism on 2.2 for userspace processes to | 1377 | Ethertap is the general mechanism on 2.2 for userspace processes to |
| 1471 | exchange packets with the kernel. | 1378 | exchange packets with the kernel. |
| @@ -1473,7 +1380,7 @@ · 1 unmodified line | |||
| 1473 | 1380 | ||
| 1474 | 1381 | ||
| 1475 | To use this transport, you need to describe the virtual network device | 1382 | To use this transport, you need to describe the virtual network device |
| 1476 | on the UML command line. The general format for this is | 1383 | on the UML command line. The general format for this is:: |
| 1477 | 1384 | ||
| 1478 | 1385 | ||
| 1479 | eth <n> =ethertap, <device> , <ethernet address> , <tap IP address> | 1386 | eth <n> =ethertap, <device> , <ethernet address> , <tap IP address> |
| @@ -1481,7 +1388,7 @@ · 1 unmodified line | |||
| 1481 | 1388 | ||
| 1482 | 1389 | ||
| 1483 | 1390 | ||
| 1484 | So, the previous example | 1391 | So, the previous example:: |
| 1485 | 1392 | ||
| 1486 | 1393 | ||
| 1487 | eth0=ethertap,tap0,fe:fd:0:0:0:1,192.168.0.254 | 1394 | eth0=ethertap,tap0,fe:fd:0:0:0:1,192.168.0.254 |
| @@ -1521,7 +1428,7 @@ · 33 unmodified lines | |||
| 1521 | 1428 | ||
| 1522 | If you want to set things up yourself, you need to make sure that the | 1429 | If you want to set things up yourself, you need to make sure that the |
| 1523 | appropriate /dev entry exists. If it doesn't, become root and create | 1430 | appropriate /dev entry exists. If it doesn't, become root and create |
| 1524 | it as follows: | 1431 | it as follows:: |
| 1525 | 1432 | ||
| 1526 | 1433 | ||
| 1527 | mknod /dev/tap <minor> c 36 <minor> + 16 | 1434 | mknod /dev/tap <minor> c 36 <minor> + 16 |
| @@ -1529,7 +1436,7 @@ · 1 unmodified line | |||
| 1529 | 1436 | ||
| 1530 | 1437 | ||
| 1531 | 1438 | ||
| 1532 | For example, this is how to create /dev/tap0: | 1439 | For example, this is how to create /dev/tap0:: |
| 1533 | 1440 | ||
| 1534 | 1441 | ||
| 1535 | mknod /dev/tap0 c 36 0 + 16 | 1442 | mknod /dev/tap0 c 36 0 + 16 |
| @@ -1539,7 +1446,7 @@ · 3 unmodified lines | |||
| 1539 | 1446 | ||
| 1540 | You also need to make sure that the host kernel has ethertap support. | 1447 | You also need to make sure that the host kernel has ethertap support. |
| 1541 | If ethertap is enabled as a module, you apparently need to insmod | 1448 | If ethertap is enabled as a module, you apparently need to insmod |
| 1542 | ethertap once for each ethertap device you want to enable. So, | 1449 | ethertap once for each ethertap device you want to enable. So,:: |
| 1543 | 1450 | ||
| 1544 | 1451 | ||
| 1545 | host# | 1452 | host# |
| @@ -1549,7 +1456,7 @@ · 3 unmodified lines | |||
| 1549 | 1456 | ||
| 1550 | 1457 | ||
| 1551 | will give you the tap0 interface. To get the tap1 interface, you need | 1458 | will give you the tap0 interface. To get the tap1 interface, you need |
| 1552 | to run | 1459 | to run:: |
| 1553 | 1460 | ||
| 1554 | 1461 | ||
| 1555 | host# | 1462 | host# |
| @@ -1561,7 +1468,8 @@ · 5 unmodified lines | |||
| 1561 | 1468 | ||
| 1562 | 1469 | ||
| 1563 | 1470 | ||
| 1564 | 6.9. The switch daemon | 1471 | 6.9. The switch daemon |
| 1472 | ----------------------- | ||
| 1565 | 1473 | ||
| 1566 | Note: This is the daemon formerly known as uml_router, but which was | 1474 | Note: This is the daemon formerly known as uml_router, but which was |
| 1567 | renamed so the network weenies of the world would stop growling at me. | 1475 | renamed so the network weenies of the world would stop growling at me. |
| @@ -1577,7 +1485,7 @@ · 9 unmodified lines | |||
| 1577 | sockets. | 1485 | sockets. |
| 1578 | 1486 | ||
| 1579 | 1487 | ||
| 1580 | If you want it to listen on a different pair of sockets, use | 1488 | If you want it to listen on a different pair of sockets, use:: |
| 1581 | 1489 | ||
| 1582 | 1490 | ||
| 1583 | -unix control socket data socket | 1491 | -unix control socket data socket |
| @@ -1586,7 +1494,7 @@ · 2 unmodified lines | |||
| 1586 | 1494 | ||
| 1587 | 1495 | ||
| 1588 | 1496 | ||
| 1589 | If you want it to act as a hub rather than a switch, use | 1497 | If you want it to act as a hub rather than a switch, use:: |
| 1590 | 1498 | ||
| 1591 | 1499 | ||
| 1592 | -hub | 1500 | -hub |
| @@ -1596,7 +1504,7 @@ · 3 unmodified lines | |||
| 1596 | 1504 | ||
| 1597 | 1505 | ||
| 1598 | If you want the switch to be connected to host networking (allowing | 1506 | If you want the switch to be connected to host networking (allowing |
| 1599 | the umls to get access to the outside world through the host), use | 1507 | the umls to get access to the outside world through the host), use:: |
| 1600 | 1508 | ||
| 1601 | 1509 | ||
| 1602 | -tap tap0 | 1510 | -tap tap0 |
| @@ -1610,7 +1518,7 @@ · 7 unmodified lines | |||
| 1610 | device than tap0, specify that instead of tap0. | 1518 | device than tap0, specify that instead of tap0. |
| 1611 | 1519 | ||
| 1612 | 1520 | ||
| 1613 | uml_switch can be backgrounded as follows | 1521 | uml_switch can be backgrounded as follows:: |
| 1614 | 1522 | ||
| 1615 | 1523 | ||
| 1616 | host% | 1524 | host% |
| @@ -1623,7 +1531,7 @@ · 6 unmodified lines | |||
| 1623 | stdin for EOF. When it sees that, it exits. | 1531 | stdin for EOF. When it sees that, it exits. |
| 1624 | 1532 | ||
| 1625 | 1533 | ||
| 1626 | The general format of the kernel command line switch is | 1534 | The general format of the kernel command line switch is:: |
| 1627 | 1535 | ||
| 1628 | 1536 | ||
| 1629 | 1537 | ||
| @@ -1639,7 +1547,8 @@ · 9 unmodified lines | |||
| 1639 | how to communicate with the daemon. You should only specify them if | 1547 | how to communicate with the daemon. You should only specify them if |
| 1640 | you told the daemon to use different sockets than the default. So, if | 1548 | you told the daemon to use different sockets than the default. So, if |
| 1641 | you ran the daemon with no arguments, running the UML on the same | 1549 | you ran the daemon with no arguments, running the UML on the same |
| 1642 | machine with | 1550 | machine with:: |
| 1551 | |||
| 1643 | eth0=daemon | 1552 | eth0=daemon |
| 1644 | 1553 | ||
| 1645 | 1554 | ||
| @@ -1649,7 +1558,8 @@ · 3 unmodified lines | |||
| 1649 | 1558 | ||
| 1650 | 1559 | ||
| 1651 | 1560 | ||
| 1652 | 6.10. Slip | 1561 | 6.10. Slip |
| 1562 | ----------- | ||
| 1653 | 1563 | ||
| 1654 | Slip is another, less general, mechanism for a process to communicate | 1564 | Slip is another, less general, mechanism for a process to communicate |
| 1655 | with the host networking. In contrast to the ethertap interface, | 1565 | with the host networking. In contrast to the ethertap interface, |
| @@ -1658,7 +1568,7 @@ · 2 unmodified lines | |||
| 1658 | IP. | 1568 | IP. |
| 1659 | 1569 | ||
| 1660 | 1570 | ||
| 1661 | The general format of the command line switch is | 1571 | The general format of the command line switch is:: |
| 1662 | 1572 | ||
| 1663 | 1573 | ||
| 1664 | 1574 | ||
| @@ -1681,7 +1591,8 @@ · 16 unmodified lines | |||
| 1681 | 1591 | ||
| 1682 | 1592 | ||
| 1683 | 1593 | ||
| 1684 | 6.11. Slirp | 1594 | 6.11. Slirp |
| 1595 | ------------ | ||
| 1685 | 1596 | ||
| 1686 | slirp uses an external program, usually /usr/bin/slirp, to provide IP | 1597 | slirp uses an external program, usually /usr/bin/slirp, to provide IP |
| 1687 | only networking connectivity through the host. This is similar to IP | 1598 | only networking connectivity through the host. This is similar to IP |
| @@ -1691,7 +1602,7 @@ · 3 unmodified lines | |||
| 1691 | root access or setuid binaries on the host. | 1602 | root access or setuid binaries on the host. |
| 1692 | 1603 | ||
| 1693 | 1604 | ||
| 1694 | The general format of the command line switch for slirp is: | 1605 | The general format of the command line switch for slirp is:: |
| 1695 | 1606 | ||
| 1696 | 1607 | ||
| 1697 | 1608 | ||
| @@ -1716,7 +1627,7 @@ · 18 unmodified lines | |||
| 1716 | The eth0 interface on UML should be set up with the IP 10.2.0.15, | 1627 | The eth0 interface on UML should be set up with the IP 10.2.0.15, |
| 1717 | although you can use anything as long as it is not used by a network | 1628 | although you can use anything as long as it is not used by a network |
| 1718 | you will be connecting to. The default route on UML should be set to | 1629 | you will be connecting to. The default route on UML should be set to |
| 1719 | use | 1630 | use:: |
| 1720 | 1631 | ||
| 1721 | 1632 | ||
| 1722 | UML# | 1633 | UML# |
| @@ -1737,10 +1648,11 @@ · 14 unmodified lines | |||
| 1737 | 1648 | ||
| 1738 | 1649 | ||
| 1739 | 1650 | ||
| 1740 | 6.12. pcap | 1651 | 6.12. pcap |
| 1652 | ----------- | ||
| 1741 | 1653 | ||
| 1742 | The pcap transport is attached to a UML ethernet device on the command | 1654 | The pcap transport is attached to a UML ethernet device on the command |
| 1743 | line or with uml_mconsole with the following syntax: | 1655 | line or with uml_mconsole with the following syntax:: |
| 1744 | 1656 | ||
| 1745 | 1657 | ||
| 1746 | 1658 | ||
| @@ -1762,7 +1674,7 @@ · 15 unmodified lines | |||
| 1762 | expression optimizer is used. | 1674 | expression optimizer is used. |
| 1763 | 1675 | ||
| 1764 | 1676 | ||
| 1765 | Example: | 1677 | Example:: |
| 1766 | 1678 | ||
| 1767 | 1679 | ||
| 1768 | 1680 | ||
| @@ -1777,7 +1689,8 @@ · 8 unmodified lines | |||
| 1777 | 1689 | ||
| 1778 | 1690 | ||
| 1779 | 1691 | ||
| 1780 | 6.13. Setting up the host yourself | 1692 | 6.13. Setting up the host yourself |
| 1693 | ----------------------------------- | ||
| 1781 | 1694 | ||
| 1782 | If you don't specify an address for the host side of the ethertap or | 1695 | If you don't specify an address for the host side of the ethertap or |
| 1783 | slip device, UML won't do any setup on the host. So this is what is | 1696 | slip device, UML won't do any setup on the host. So this is what is |
| @@ -1785,19 +1698,15 @@ · 1 unmodified line | |||
| 1785 | 192.168.0.251 and a UML-side IP of 192.168.0.250 - adjust to suit your | 1698 | 192.168.0.251 and a UML-side IP of 192.168.0.250 - adjust to suit your |
| 1786 | own network): | 1699 | own network): |
| 1787 | 1700 | ||
| 1788 | o The device needs to be configured with its IP address. Tap devices | 1701 | - The device needs to be configured with its IP address. Tap devices |
| 1789 | are also configured with an mtu of 1484. Slip devices are | 1702 | are also configured with an mtu of 1484. Slip devices are |
| 1790 | configured with a point-to-point address pointing at the UML ip | 1703 | configured with a point-to-point address pointing at the UML ip |
| 1791 | address. | 1704 | address:: |
| 1792 | 1705 | ||
| 1793 | 1706 | ||
| 1794 | host# ifconfig tap0 arp mtu 1484 192.168.0.251 up | 1707 | host# ifconfig tap0 arp mtu 1484 192.168.0.251 up |
| 1795 | 1708 | ||
| 1796 | 1709 | ||
| 1797 | |||
| 1798 | |||
| 1799 | |||
| 1800 | |||
| 1801 | host# | 1710 | host# |
| 1802 | ifconfig sl0 192.168.0.251 pointopoint 192.168.0.250 up | 1711 | ifconfig sl0 192.168.0.251 pointopoint 192.168.0.250 up |
| 1803 | 1712 | ||
| @@ -1805,7 +1714,7 @@ · 1 unmodified line | |||
| 1805 | 1714 | ||
| 1806 | 1715 | ||
| 1807 | 1716 | ||
| 1808 | o If a tap device is being set up, a route is set to the UML IP. | 1717 | - If a tap device is being set up, a route is set to the UML IP:: |
| 1809 | 1718 | ||
| 1810 | 1719 | ||
| 1811 | UML# route add -host 192.168.0.250 gw 192.168.0.251 | 1720 | UML# route add -host 192.168.0.250 gw 192.168.0.251 |
| @@ -1814,8 +1723,8 @@ · 2 unmodified lines | |||
| 1814 | 1723 | ||
| 1815 | 1724 | ||
| 1816 | 1725 | ||
| 1817 | o To allow other hosts on your network to see the virtual machine, | 1726 | - To allow other hosts on your network to see the virtual machine, |
| 1818 | proxy arp is set up for it. | 1727 | proxy arp is set up for it:: |
| 1819 | 1728 | ||
| 1820 | 1729 | ||
| 1821 | host# arp -Ds 192.168.0.250 eth0 pub | 1730 | host# arp -Ds 192.168.0.250 eth0 pub |
| @@ -1824,7 +1733,7 @@ · 2 unmodified lines | |||
| 1824 | 1733 | ||
| 1825 | 1734 | ||
| 1826 | 1735 | ||
| 1827 | o Finally, the host is set up to route packets. | 1736 | - Finally, the host is set up to route packets:: |
| 1828 | 1737 | ||
| 1829 | 1738 | ||
| 1830 | host# echo 1 > /proc/sys/net/ipv4/ip_forward | 1739 | host# echo 1 > /proc/sys/net/ipv4/ip_forward |
| @@ -1838,12 +1747,14 @@ · 7 unmodified lines | |||
| 1838 | 1747 | ||
| 1839 | 1748 | ||
| 1840 | 1749 | ||
| 1841 | 7. Sharing Filesystems between Virtual Machines | 1750 | 7. Sharing Filesystems between Virtual Machines |
| 1751 | ================================================ | ||
| 1842 | 1752 | ||
| 1843 | 1753 | ||
| 1844 | 1754 | ||
| 1845 | 1755 | ||
| 1846 | 7.1. A warning | 1756 | 7.1. A warning |
| 1757 | --------------- | ||
| 1847 | 1758 | ||
| 1848 | Don't attempt to share filesystems simply by booting two UMLs from the | 1759 | Don't attempt to share filesystems simply by booting two UMLs from the |
| 1849 | same file. That's the same thing as booting two physical machines | 1760 | same file. That's the same thing as booting two physical machines |
| @@ -1851,7 +1762,8 @@ · 1 unmodified line | |||
| 1851 | 1762 | ||
| 1852 | 1763 | ||
| 1853 | 1764 | ||
| 1854 | 7.2. Using layered block devices | 1765 | 7.2. Using layered block devices |
| 1766 | --------------------------------- | ||
| 1855 | 1767 | ||
| 1856 | The way to share a filesystem between two virtual machines is to use | 1768 | The way to share a filesystem between two virtual machines is to use |
| 1857 | the copy-on-write (COW) layering capability of the ubd block driver. | 1769 | the copy-on-write (COW) layering capability of the ubd block driver. |
| @@ -1872,7 +1784,7 @@ · 14 unmodified lines | |||
| 1872 | 1784 | ||
| 1873 | 1785 | ||
| 1874 | To add a copy-on-write layer to an existing block device file, simply | 1786 | To add a copy-on-write layer to an existing block device file, simply |
| 1875 | add the name of the COW file to the appropriate ubd switch: | 1787 | add the name of the COW file to the appropriate ubd switch:: |
| 1876 | 1788 | ||
| 1877 | 1789 | ||
| 1878 | ubd0=root_fs_cow,root_fs_debian_22 | 1790 | ubd0=root_fs_cow,root_fs_debian_22 |
| @@ -1883,7 +1795,7 @@ · 4 unmodified lines | |||
| 1883 | where 'root_fs_cow' is the private COW file and 'root_fs_debian_22' is | 1795 | where 'root_fs_cow' is the private COW file and 'root_fs_debian_22' is |
| 1884 | the existing shared filesystem. The COW file need not exist. If it | 1796 | the existing shared filesystem. The COW file need not exist. If it |
| 1885 | doesn't, the driver will create and initialize it. Once the COW file | 1797 | doesn't, the driver will create and initialize it. Once the COW file |
| 1886 | has been initialized, it can be used on its own on the command line: | 1798 | has been initialized, it can be used on its own on the command line:: |
| 1887 | 1799 | ||
| 1888 | 1800 | ||
| 1889 | ubd0=root_fs_cow | 1801 | ubd0=root_fs_cow |
| @@ -1896,14 +1808,16 @@ · 6 unmodified lines | |||
| 1896 | 1808 | ||
| 1897 | 1809 | ||
| 1898 | 1810 | ||
| 1899 | 7.3. Note! | 1811 | 7.3. Note! |
| 1812 | ----------- | ||
| 1900 | 1813 | ||
| 1901 | When checking the size of the COW file in order to see the gobs of | 1814 | When checking the size of the COW file in order to see the gobs of |
| 1902 | space that you're saving, make sure you use 'ls -ls' to see the actual | 1815 | space that you're saving, make sure you use 'ls -ls' to see the actual |
| 1903 | disk consumption rather than the length of the file. The COW file is | 1816 | disk consumption rather than the length of the file. The COW file is |
| 1904 | sparse, so the length will be very different from the disk usage. | 1817 | sparse, so the length will be very different from the disk usage. |
| 1905 | Here is a 'ls -l' of a COW file and backing file from one boot and | 1818 | Here is a 'ls -l' of a COW file and backing file from one boot and |
| 1906 | shutdown: | 1819 | shutdown:: |
| 1820 | |||
| 1907 | host% ls -l cow.debian debian2.2 | 1821 | host% ls -l cow.debian debian2.2 |
| 1908 | -rw-r--r-- 1 jdike jdike 492504064 Aug 6 21:16 cow.debian | 1822 | -rw-r--r-- 1 jdike jdike 492504064 Aug 6 21:16 cow.debian |
| 1909 | -rwxrw-rw- 1 jdike jdike 537919488 Aug 6 20:42 debian2.2 | 1823 | -rwxrw-rw- 1 jdike jdike 537919488 Aug 6 20:42 debian2.2 |
| @@ -1911,7 +1825,7 @@ · 1 unmodified line | |||
| 1911 | 1825 | ||
| 1912 | 1826 | ||
| 1913 | 1827 | ||
| 1914 | Doesn't look like much saved space, does it? Well, here's 'ls -ls': | 1828 | Doesn't look like much saved space, does it? Well, here's 'ls -ls':: |
| 1915 | 1829 | ||
| 1916 | 1830 | ||
| 1917 | host% ls -ls cow.debian debian2.2 | 1831 | host% ls -ls cow.debian debian2.2 |
| @@ -1926,7 +1840,8 @@ · 8 unmodified lines | |||
| 1926 | 1840 | ||
| 1927 | 1841 | ||
| 1928 | 1842 | ||
| 1929 | 7.4. Another warning | 1843 | 7.4. Another warning |
| 1844 | --------------------- | ||
| 1930 | 1845 | ||
| 1931 | Once a filesystem is being used as a readonly backing file for a COW | 1846 | Once a filesystem is being used as a readonly backing file for a COW |
| 1932 | file, do not boot directly from it or modify it in any way. Doing so | 1847 | file, do not boot directly from it or modify it in any way. Doing so |
| @@ -1952,7 +1867,8 @@ · 19 unmodified lines | |||
| 1952 | 1867 | ||
| 1953 | 1868 | ||
| 1954 | 1869 | ||
| 1955 | 7.5. uml_moo : Merging a COW file with its backing file | 1870 | 7.5. uml_moo : Merging a COW file with its backing file |
| 1871 | -------------------------------------------------------- | ||
| 1956 | 1872 | ||
| 1957 | Depending on how you use UML and COW devices, it may be advisable to | 1873 | Depending on how you use UML and COW devices, it may be advisable to |
| 1958 | merge the changes in the COW file into the backing file every once in | 1874 | merge the changes in the COW file into the backing file every once in |
| @@ -1961,7 +1877,7 @@ · 2 unmodified lines | |||
| 1961 | 1877 | ||
| 1962 | 1878 | ||
| 1963 | 1879 | ||
| 1964 | The utility that does this is uml_moo. Its usage is | 1880 | The utility that does this is uml_moo. Its usage is:: |
| 1965 | 1881 | ||
| 1966 | 1882 | ||
| 1967 | host% uml_moo COW file new backing file | 1883 | host% uml_moo COW file new backing file |
| @@ -1991,8 +1907,8 @@ · 23 unmodified lines | |||
| 1991 | 1907 | ||
| 1992 | uml_moo is installed with the UML deb and RPM. If you didn't install | 1908 | uml_moo is installed with the UML deb and RPM. If you didn't install |
| 1993 | UML from one of those packages, you can also get it from the UML | 1909 | UML from one of those packages, you can also get it from the UML |
| 1994 | utilities <http://user-mode-linux.sourceforge.net/ | 1910 | utilities http://user-mode-linux.sourceforge.net/utilities tar file |
| 1995 | utilities> tar file in tools/moo. | 1911 | in tools/moo. |
| 1996 | 1912 | ||
| 1997 | 1913 | ||
| 1998 | 1914 | ||
| @@ -2001,7 +1917,8 @@ · 2 unmodified lines | |||
| 2001 | 1917 | ||
| 2002 | 1918 | ||
| 2003 | 1919 | ||
| 2004 | 8. Creating filesystems | 1920 | 8. Creating filesystems |
| 1921 | ======================== | ||
| 2005 | 1922 | ||
| 2006 | 1923 | ||
| 2007 | You may want to create and mount new UML filesystems, either because | 1924 | You may want to create and mount new UML filesystems, either because |
| @@ -2015,13 +1932,14 @@ · 7 unmodified lines | |||
| 2015 | should be easy to translate to the filesystem of your choice. | 1932 | should be easy to translate to the filesystem of your choice. |
| 2016 | 1933 | ||
| 2017 | 1934 | ||
| 2018 | 8.1. Create the filesystem file | 1935 | 8.1. Create the filesystem file |
| 1936 | ================================ | ||
| 2019 | 1937 | ||
| 2020 | dd is your friend. All you need to do is tell dd to create an empty | 1938 | dd is your friend. All you need to do is tell dd to create an empty |
| 2021 | file of the appropriate size. I usually make it sparse to save time | 1939 | file of the appropriate size. I usually make it sparse to save time |
| 2022 | and to avoid allocating disk space until it's actually used. For | 1940 | and to avoid allocating disk space until it's actually used. For |
| 2023 | example, the following command will create a sparse 100 meg file full | 1941 | example, the following command will create a sparse 100 meg file full |
| 2024 | of zeroes. | 1942 | of zeroes:: |
| 2025 | 1943 | ||
| 2026 | 1944 | ||
| 2027 | host% | 1945 | host% |
| @@ -2034,9 +1952,9 @@ · 6 unmodified lines | |||
| 2034 | 1952 | ||
| 2035 | 8.2. Assign the file to a UML device | 1953 | 8.2. Assign the file to a UML device |
| 2036 | 1954 | ||
| 2037 | Add an argument like the following to the UML command line: | 1955 | Add an argument like the following to the UML command line:: |
| 2038 | 1956 | ||
| 2039 | ubd4=new_filesystem | 1957 | ubd4=new_filesystem |
| 2040 | 1958 | ||
| 2041 | 1959 | ||
| 2042 | 1960 | ||
| @@ -2053,7 +1971,7 @@ · 10 unmodified lines | |||
| 2053 | etc), then get them into UML by way of the net or hostfs. | 1971 | etc), then get them into UML by way of the net or hostfs. |
| 2054 | 1972 | ||
| 2055 | 1973 | ||
| 2056 | Make the new filesystem on the device assigned to the new file: | 1974 | Make the new filesystem on the device assigned to the new file:: |
| 2057 | 1975 | ||
| 2058 | 1976 | ||
| 2059 | host# mkreiserfs /dev/ubd/4 | 1977 | host# mkreiserfs /dev/ubd/4 |
| @@ -2077,7 +1995,7 @@ · 17 unmodified lines | |||
| 2077 | 1995 | ||
| 2078 | 1996 | ||
| 2079 | 1997 | ||
| 2080 | Now, mount it: | 1998 | Now, mount it:: |
| 2081 | 1999 | ||
| 2082 | 2000 | ||
| 2083 | UML# | 2001 | UML# |
| @@ -2096,7 +2014,8 @@ · 12 unmodified lines | |||
| 2096 | 2014 | ||
| 2097 | 2015 | ||
| 2098 | 2016 | ||
| 2099 | 9. Host file access | 2017 | 9. Host file access |
| 2018 | ==================== | ||
| 2100 | 2019 | ||
| 2101 | 2020 | ||
| 2102 | If you want to access files on the host machine from inside UML, you | 2021 | If you want to access files on the host machine from inside UML, you |
| @@ -2112,10 +2031,11 @@ · 9 unmodified lines | |||
| 2112 | files contained in it just as you would on the host. | 2031 | files contained in it just as you would on the host. |
| 2113 | 2032 | ||
| 2114 | 2033 | ||
| 2115 | 9.1. Using hostfs | 2034 | 9.1. Using hostfs |
| 2035 | ------------------ | ||
| 2116 | 2036 | ||
| 2117 | To begin with, make sure that hostfs is available inside the virtual | 2037 | To begin with, make sure that hostfs is available inside the virtual |
| 2118 | machine with | 2038 | machine with:: |
| 2119 | 2039 | ||
| 2120 | 2040 | ||
| 2121 | UML# cat /proc/filesystems | 2041 | UML# cat /proc/filesystems |
| @@ -2127,7 +2047,7 @@ · 5 unmodified lines | |||
| 2127 | module and available inside the virtual machine, and insmod it. | 2047 | module and available inside the virtual machine, and insmod it. |
| 2128 | 2048 | ||
| 2129 | 2049 | ||
| 2130 | Now all you need to do is run mount: | 2050 | Now all you need to do is run mount:: |
| 2131 | 2051 | ||
| 2132 | 2052 | ||
| 2133 | UML# mount none /mnt/host -t hostfs | 2053 | UML# mount none /mnt/host -t hostfs |
| @@ -2139,7 +2059,7 @@ · 5 unmodified lines | |||
| 2139 | 2059 | ||
| 2140 | 2060 | ||
| 2141 | If you don't want to mount the host root directory, then you can | 2061 | If you don't want to mount the host root directory, then you can |
| 2142 | specify a subdirectory to mount with the -o switch to mount: | 2062 | specify a subdirectory to mount with the -o switch to mount:: |
| 2143 | 2063 | ||
| 2144 | 2064 | ||
| 2145 | UML# mount none /mnt/home -t hostfs -o /home | 2065 | UML# mount none /mnt/home -t hostfs -o /home |
| @@ -2151,13 +2071,14 @@ · 5 unmodified lines | |||
| 2151 | 2071 | ||
| 2152 | 2072 | ||
| 2153 | 2073 | ||
| 2154 | 9.2. hostfs as the root filesystem | 2074 | 9.2. hostfs as the root filesystem |
| 2075 | ----------------------------------- | ||
| 2155 | 2076 | ||
| 2156 | It's possible to boot from a directory hierarchy on the host using | 2077 | It's possible to boot from a directory hierarchy on the host using |
| 2157 | hostfs rather than using the standard filesystem in a file. | 2078 | hostfs rather than using the standard filesystem in a file. |
| 2158 | 2079 | ||
| 2159 | To start, you need that hierarchy. The easiest way is to loop mount | 2080 | To start, you need that hierarchy. The easiest way is to loop mount |
| 2160 | an existing root_fs file: | 2081 | an existing root_fs file:: |
| 2161 | 2082 | ||
| 2162 | 2083 | ||
| 2163 | host# mount root_fs uml_root_dir -o loop | 2084 | host# mount root_fs uml_root_dir -o loop |
| @@ -2166,15 +2087,15 @@ · 2 unmodified lines | |||
| 2166 | 2087 | ||
| 2167 | 2088 | ||
| 2168 | You need to change the filesystem type of / in etc/fstab to be | 2089 | You need to change the filesystem type of / in etc/fstab to be |
| 2169 | 'hostfs', so that line looks like this: | 2090 | 'hostfs', so that line looks like this:: |
| 2170 | 2091 | ||
| 2171 | /dev/ubd/0 / hostfs defaults 1 1 | 2092 | /dev/ubd/0 / hostfs defaults 1 1 |
| 2172 | 2093 | ||
| 2173 | 2094 | ||
| 2174 | 2095 | ||
| 2175 | 2096 | ||
| 2176 | Then you need to chown to yourself all the files in that directory | 2097 | Then you need to chown to yourself all the files in that directory |
| 2177 | that are owned by root. This worked for me: | 2098 | that are owned by root. This worked for me:: |
| 2178 | 2099 | ||
| 2179 | 2100 | ||
| 2180 | host# find . -uid 0 -exec chown jdike {} \; | 2101 | host# find . -uid 0 -exec chown jdike {} \; |
| @@ -2183,7 +2104,7 @@ · 2 unmodified lines | |||
| 2183 | 2104 | ||
| 2184 | 2105 | ||
| 2185 | Next, make sure that your UML kernel has hostfs compiled in, not as a | 2106 | Next, make sure that your UML kernel has hostfs compiled in, not as a |
| 2186 | module. Then run UML with the boot device pointing at that directory: | 2107 | module. Then run UML with the boot device pointing at that directory:: |
| 2187 | 2108 | ||
| 2188 | 2109 | ||
| 2189 | ubd0=/path/to/uml/root/directory | 2110 | ubd0=/path/to/uml/root/directory |
| @@ -2194,41 +2115,35 @@ · 4 unmodified lines | |||
| 2194 | UML should then boot as it does normally. | 2115 | UML should then boot as it does normally. |
| 2195 | 2116 | ||
| 2196 | 2117 | ||
| 2197 | 9.3. Building hostfs | 2118 | 9.3. Building hostfs |
| 2119 | --------------------- | ||
| 2198 | 2120 | ||
| 2199 | If you need to build hostfs because it's not in your kernel, you have | 2121 | If you need to build hostfs because it's not in your kernel, you have |
| 2200 | two choices: | 2122 | two choices: |
| 2201 | 2123 | ||
| 2202 | 2124 | ||
| 2203 | 2125 | ||
| 2204 | o Compiling hostfs into the kernel: | 2126 | - Compiling hostfs into the kernel: |
| 2205 | 2127 | ||
| 2206 | 2128 | ||
| 2207 | Reconfigure the kernel and set the 'Host filesystem' option under | 2129 | Reconfigure the kernel and set the 'Host filesystem' option under |
| 2208 | 2130 | ||
| 2209 | 2131 | ||
| 2210 | o Compiling hostfs as a module: | 2132 | - Compiling hostfs as a module: |
| 2211 | 2133 | ||
| 2212 | 2134 | ||
| 2213 | Reconfigure the kernel and set the 'Host filesystem' option under | 2135 | Reconfigure the kernel and set the 'Host filesystem' option under |
| 2214 | be in arch/um/fs/hostfs/hostfs.o. Install that in | 2136 | be in arch/um/fs/hostfs/hostfs.o. Install that in |
| 2215 | /lib/modules/`uname -r`/fs in the virtual machine, boot it up, and | 2137 | ``/lib/modules/$(uname -r)/fs`` in the virtual machine, boot it up, and:: |
| 2216 | 2138 | ||
| 2217 | 2139 | ||
| 2218 | UML# insmod hostfs | 2140 | UML# insmod hostfs |
| 2219 | 2141 | ||
| 2220 | 2142 | ||
| 2143 | .. _The_Management_Console: | ||
| 2221 | 2144 | ||
| 2222 | 2145 | 10. The Management Console | |
| 2223 | 2146 | =========================== | |
| 2224 | |||
| 2225 | |||
| 2226 | |||
| 2227 | |||
| 2228 | |||
| 2229 | |||
| 2230 | |||
| 2231 | 10. The Management Console | ||
| 2232 | 2147 | ||
| 2233 | 2148 | ||
| 2234 | 2149 | ||
| @@ -2240,15 +2155,15 @@ · 5 unmodified lines | |||
| 2240 | 2155 | ||
| 2241 | There are a number of things you can do with the mconsole interface: | 2156 | There are a number of things you can do with the mconsole interface: |
| 2242 | 2157 | ||
| 2243 | o get the kernel version | 2158 | - get the kernel version |
| 2244 | 2159 | ||
| 2245 | o add and remove devices | 2160 | - add and remove devices |
| 2246 | 2161 | ||
| 2247 | o halt or reboot the machine | 2162 | - halt or reboot the machine |
| 2248 | 2163 | ||
| 2249 | o Send SysRq commands | 2164 | - Send SysRq commands |
| 2250 | 2165 | ||
| 2251 | o Pause and resume the UML | 2166 | - Pause and resume the UML |
| 2252 | 2167 | ||
| 2253 | 2168 | ||
| 2254 | You need the mconsole client (uml_mconsole) which is present in CVS | 2169 | You need the mconsole client (uml_mconsole) which is present in CVS |
| @@ -2257,7 +2172,7 @@ · 2 unmodified lines | |||
| 2257 | 2172 | ||
| 2258 | 2173 | ||
| 2259 | You also need CONFIG_MCONSOLE (under 'General Setup') enabled in UML. | 2174 | You also need CONFIG_MCONSOLE (under 'General Setup') enabled in UML. |
| 2260 | When you boot UML, you'll see a line like: | 2175 | When you boot UML, you'll see a line like:: |
| 2261 | 2176 | ||
| 2262 | 2177 | ||
| 2263 | mconsole initialized on /home/jdike/.uml/umlNJ32yL/mconsole | 2178 | mconsole initialized on /home/jdike/.uml/umlNJ32yL/mconsole |
| @@ -2265,7 +2180,7 @@ · 1 unmodified line | |||
| 2265 | 2180 | ||
| 2266 | 2181 | ||
| 2267 | 2182 | ||
| 2268 | If you specify a unique machine id one the UML command line, i.e. | 2183 | If you specify a unique machine id one the UML command line, i.e.:: |
| 2269 | 2184 | ||
| 2270 | 2185 | ||
| 2271 | umid=debian | 2186 | umid=debian |
| @@ -2273,7 +2188,7 @@ · 1 unmodified line | |||
| 2273 | 2188 | ||
| 2274 | 2189 | ||
| 2275 | 2190 | ||
| 2276 | you'll see this | 2191 | you'll see this:: |
| 2277 | 2192 | ||
| 2278 | 2193 | ||
| 2279 | mconsole initialized on /home/jdike/.uml/debian/mconsole | 2194 | mconsole initialized on /home/jdike/.uml/debian/mconsole |
| @@ -2282,7 +2197,7 @@ · 2 unmodified lines | |||
| 2282 | 2197 | ||
| 2283 | 2198 | ||
| 2284 | That file is the socket that uml_mconsole will use to communicate with | 2199 | That file is the socket that uml_mconsole will use to communicate with |
| 2285 | UML. Run it with either the umid or the full path as its argument: | 2200 | UML. Run it with either the umid or the full path as its argument:: |
| 2286 | 2201 | ||
| 2287 | 2202 | ||
| 2288 | host% uml_mconsole debian | 2203 | host% uml_mconsole debian |
| @@ -2290,7 +2205,7 @@ · 1 unmodified line | |||
| 2290 | 2205 | ||
| 2291 | 2206 | ||
| 2292 | 2207 | ||
| 2293 | or | 2208 | or:: |
| 2294 | 2209 | ||
| 2295 | 2210 | ||
| 2296 | host% uml_mconsole /home/jdike/.uml/debian/mconsole | 2211 | host% uml_mconsole /home/jdike/.uml/debian/mconsole |
| @@ -2300,30 +2215,31 @@ · 3 unmodified lines | |||
| 2300 | 2215 | ||
| 2301 | You'll get a prompt, at which you can run one of these commands: | 2216 | You'll get a prompt, at which you can run one of these commands: |
| 2302 | 2217 | ||
| 2303 | o version | 2218 | - version |
| 2304 | 2219 | ||
| 2305 | o halt | 2220 | - halt |
| 2306 | 2221 | ||
| 2307 | o reboot | 2222 | - reboot |
| 2308 | 2223 | ||
| 2309 | o config | 2224 | - config |
| 2310 | 2225 | ||
| 2311 | o remove | 2226 | - remove |
| 2312 | 2227 | ||
| 2313 | o sysrq | 2228 | - sysrq |
| 2314 | 2229 | ||
| 2315 | o help | 2230 | - help |
| 2316 | 2231 | ||
| 2317 | o cad | 2232 | - cad |
| 2318 | 2233 | ||
| 2319 | o stop | 2234 | - stop |
| 2320 | 2235 | ||
| 2321 | o go | 2236 | - go |
| 2322 | 2237 | ||
| 2323 | 2238 | ||
| 2324 | 10.1. version | 2239 | 10.1. version |
| 2240 | -------------- | ||
| 2325 | 2241 | ||
| 2326 | This takes no arguments. It prints the UML version. | 2242 | This takes no arguments. It prints the UML version:: |
| 2327 | 2243 | ||
| 2328 | 2244 | ||
| 2329 | (mconsole) version | 2245 | (mconsole) version |
| @@ -2342,11 +2258,12 @@ · 12 unmodified lines | |||
| 2342 | 2258 | ||
| 2343 | 2259 | ||
| 2344 | 2260 | ||
| 2345 | 10.2. halt and reboot | 2261 | 10.2. halt and reboot |
| 2262 | ---------------------- | ||
| 2346 | 2263 | ||
| 2347 | These take no arguments. They shut the machine down immediately, with | 2264 | These take no arguments. They shut the machine down immediately, with |
| 2348 | no syncing of disks and no clean shutdown of userspace. So, they are | 2265 | no syncing of disks and no clean shutdown of userspace. So, they are |
| 2349 | pretty close to crashing the machine. | 2266 | pretty close to crashing the machine:: |
| 2350 | 2267 | ||
| 2351 | 2268 | ||
| 2352 | (mconsole) halt | 2269 | (mconsole) halt |
| @@ -2357,34 +2274,36 @@ · 4 unmodified lines | |||
| 2357 | 2274 | ||
| 2358 | 2275 | ||
| 2359 | 2276 | ||
| 2360 | 10.3. config | 2277 | 10.3. config |
| 2278 | ------------- | ||
| 2361 | 2279 | ||
| 2362 | "config" adds a new device to the virtual machine. Currently the ubd | 2280 | "config" adds a new device to the virtual machine. Currently the ubd |
| 2363 | and network drivers support this. It takes one argument, which is the | 2281 | and network drivers support this. It takes one argument, which is the |
| 2364 | device to add, with the same syntax as the kernel command line. | 2282 | device to add, with the same syntax as the kernel command line:: |
| 2365 | 2283 | ||
| 2366 | 2284 | ||
| 2367 | 2285 | ||
| 2368 | 2286 | ||
| 2369 | (mconsole) | 2287 | (mconsole) |
| 2370 | config ubd3=/home/jdike/incoming/roots/root_fs_debian22 | 2288 | config ubd3=/home/jdike/incoming/roots/root_fs_debian22 |
| 2371 | 2289 | ||
| 2372 | OK | 2290 | OK |
| 2373 | (mconsole) config eth1=mcast | 2291 | (mconsole) config eth1=mcast |
| 2374 | OK | 2292 | OK |
| 2375 | 2293 | ||
| 2376 | 2294 | ||
| 2377 | 2295 | ||
| 2378 | 2296 | ||
| 2379 | 2297 | ||
| 2380 | 2298 | ||
| 2381 | 10.4. remove | 2299 | 10.4. remove |
| 2300 | ------------- | ||
| 2382 | 2301 | ||
| 2383 | "remove" deletes a device from the system. Its argument is just the | 2302 | "remove" deletes a device from the system. Its argument is just the |
| 2384 | name of the device to be removed. The device must be idle in whatever | 2303 | name of the device to be removed. The device must be idle in whatever |
| 2385 | sense the driver considers necessary. In the case of the ubd driver, | 2304 | sense the driver considers necessary. In the case of the ubd driver, |
| 2386 | the removed block device must not be mounted, swapped on, or otherwise | 2305 | the removed block device must not be mounted, swapped on, or otherwise |
| 2387 | open, and in the case of the network driver, the device must be down. | 2306 | open, and in the case of the network driver, the device must be down:: |
| 2388 | 2307 | ||
| 2389 | 2308 | ||
| 2390 | (mconsole) remove ubd3 | 2309 | (mconsole) remove ubd3 |
| @@ -2397,7 +2316,8 @@ · 6 unmodified lines | |||
| 2397 | 2316 | ||
| 2398 | 2317 | ||
| 2399 | 2318 | ||
| 2400 | 10.5. sysrq | 2319 | 10.5. sysrq |
| 2320 | ------------ | ||
| 2401 | 2321 | ||
| 2402 | This takes one argument, which is a single letter. It calls the | 2322 | This takes one argument, which is a single letter. It calls the |
| 2403 | generic kernel's SysRq driver, which does whatever is called for by | 2323 | generic kernel's SysRq driver, which does whatever is called for by |
| @@ -2407,19 +2327,21 @@ · 3 unmodified lines | |||
| 2407 | 2327 | ||
| 2408 | 2328 | ||
| 2409 | 2329 | ||
| 2410 | 10.6. help | 2330 | 10.6. help |
| 2331 | ----------- | ||
| 2411 | 2332 | ||
| 2412 | "help" returns a string listing the valid commands and what each one | 2333 | "help" returns a string listing the valid commands and what each one |
| 2413 | does. | 2334 | does. |
| 2414 | 2335 | ||
| 2415 | 2336 | ||
| 2416 | 2337 | ||
| 2417 | 10.7. cad | 2338 | 10.7. cad |
| 2339 | ---------- | ||
| 2418 | 2340 | ||
| 2419 | This invokes the Ctl-Alt-Del action on init. What exactly this ends | 2341 | This invokes the Ctl-Alt-Del action on init. What exactly this ends |
| 2420 | up doing is up to /etc/inittab. Normally, it reboots the machine. | 2342 | up doing is up to /etc/inittab. Normally, it reboots the machine. |
| 2421 | With UML, this is usually not desired, so if a halt would be better, | 2343 | With UML, this is usually not desired, so if a halt would be better, |
| 2422 | then find the section of inittab that looks like this | 2344 | then find the section of inittab that looks like this:: |
| 2423 | 2345 | ||
| 2424 | 2346 | ||
| 2425 | # What to do when CTRL-ALT-DEL is pressed. | 2347 | # What to do when CTRL-ALT-DEL is pressed. |
| @@ -2432,7 +2354,8 @@ · 6 unmodified lines | |||
| 2432 | 2354 | ||
| 2433 | 2355 | ||
| 2434 | 2356 | ||
| 2435 | 10.8. stop | 2357 | 10.8. stop |
| 2358 | ----------- | ||
| 2436 | 2359 | ||
| 2437 | This puts the UML in a loop reading mconsole requests until a 'go' | 2360 | This puts the UML in a loop reading mconsole requests until a 'go' |
| 2438 | mconsole command is received. This is very useful for making backups | 2361 | mconsole command is received. This is very useful for making backups |
| @@ -2448,7 +2371,8 @@ · 9 unmodified lines | |||
| 2448 | 2371 | ||
| 2449 | 2372 | ||
| 2450 | 2373 | ||
| 2451 | 10.9. go | 2374 | 10.9. go |
| 2375 | --------- | ||
| 2452 | 2376 | ||
| 2453 | This resumes a UML after being paused by a 'stop' command. Note that | 2377 | This resumes a UML after being paused by a 'stop' command. Note that |
| 2454 | when the UML has resumed, TCP connections may have timed out and if | 2378 | when the UML has resumed, TCP connections may have timed out and if |
| @@ -2460,9 +2384,10 @@ · 5 unmodified lines | |||
| 2460 | 2384 | ||
| 2461 | 2385 | ||
| 2462 | 2386 | ||
| 2387 | .. _Kernel_debugging: | ||
| 2463 | 2388 | ||
| 2464 | 2389 | 11. Kernel debugging | |
| 2465 | 11. Kernel debugging | 2390 | ===================== |
| 2466 | 2391 | ||
| 2467 | 2392 | ||
| 2468 | Note: The interface that makes debugging, as described here, possible | 2393 | Note: The interface that makes debugging, as described here, possible |
| @@ -2477,15 +2402,16 @@ · 8 unmodified lines | |||
| 2477 | 2402 | ||
| 2478 | 2403 | ||
| 2479 | In order to debug the kernel, you need build it from source. See | 2404 | In order to debug the kernel, you need build it from source. See |
| 2480 | ``Compiling the kernel and modules'' for information on doing that. | 2405 | :ref:`Compiling_the_kernel_and_modules` for information on doing that. |
| 2481 | Make sure that you enable CONFIG_DEBUGSYM and CONFIG_PT_PROXY during | 2406 | Make sure that you enable CONFIG_DEBUGSYM and CONFIG_PT_PROXY during |
| 2482 | the config. These will compile the kernel with -g, and enable the | 2407 | the config. These will compile the kernel with ``-g``, and enable the |
| 2483 | ptrace proxy so that gdb works with UML, respectively. | 2408 | ptrace proxy so that gdb works with UML, respectively. |
| 2484 | 2409 | ||
| 2485 | 2410 | ||
| 2486 | 2411 | ||
| 2487 | 2412 | ||
| 2488 | 11.1. Starting the kernel under gdb | 2413 | 11.1. Starting the kernel under gdb |
| 2414 | ------------------------------------ | ||
| 2489 | 2415 | ||
| 2490 | You can have the kernel running under the control of gdb from the | 2416 | You can have the kernel running under the control of gdb from the |
| 2491 | beginning by putting 'debug' on the command line. You will get an | 2417 | beginning by putting 'debug' on the command line. You will get an |
| @@ -2498,7 +2424,11 @@ · 6 unmodified lines | |||
| 2498 | There is a transcript of a debugging session here <debug- | 2424 | There is a transcript of a debugging session here <debug- |
| 2499 | session.html> , with breakpoints being set in the scheduler and in an | 2425 | session.html> , with breakpoints being set in the scheduler and in an |
| 2500 | interrupt handler. | 2426 | interrupt handler. |
| 2501 | 11.2. Examining sleeping processes | 2427 | |
| 2428 | |||
| 2429 | 11.2. Examining sleeping processes | ||
| 2430 | ----------------------------------- | ||
| 2431 | |||
| 2502 | 2432 | ||
| 2503 | Not every bug is evident in the currently running process. Sometimes, | 2433 | Not every bug is evident in the currently running process. Sometimes, |
| 2504 | processes hang in the kernel when they shouldn't because they've | 2434 | processes hang in the kernel when they shouldn't because they've |
| @@ -2516,7 +2446,7 @@ · 11 unmodified lines | |||
| 2516 | 2446 | ||
| 2517 | Now what you do is this: | 2447 | Now what you do is this: |
| 2518 | 2448 | ||
| 2519 | o detach from the current thread | 2449 | - detach from the current thread:: |
| 2520 | 2450 | ||
| 2521 | 2451 | ||
| 2522 | (UML gdb) det | 2452 | (UML gdb) det |
| @@ -2525,7 +2455,7 @@ · 2 unmodified lines | |||
| 2525 | 2455 | ||
| 2526 | 2456 | ||
| 2527 | 2457 | ||
| 2528 | o attach to the thread you are interested in | 2458 | - attach to the thread you are interested in:: |
| 2529 | 2459 | ||
| 2530 | 2460 | ||
| 2531 | (UML gdb) att <host pid> | 2461 | (UML gdb) att <host pid> |
| @@ -2534,7 +2464,7 @@ · 2 unmodified lines | |||
| 2534 | 2464 | ||
| 2535 | 2465 | ||
| 2536 | 2466 | ||
| 2537 | o look at its stack and anything else of interest | 2467 | - look at its stack and anything else of interest:: |
| 2538 | 2468 | ||
| 2539 | 2469 | ||
| 2540 | (UML gdb) bt | 2470 | (UML gdb) bt |
| @@ -2545,18 +2475,14 @@ · 4 unmodified lines | |||
| 2545 | Note that you can't do anything at this point that requires that a | 2475 | Note that you can't do anything at this point that requires that a |
| 2546 | process execute, e.g. calling a function | 2476 | process execute, e.g. calling a function |
| 2547 | 2477 | ||
| 2548 | o when you're done looking at that process, reattach to the current | 2478 | - when you're done looking at that process, reattach to the current |
| 2549 | thread and continue it | 2479 | thread and continue it:: |
| 2550 | 2480 | ||
| 2551 | 2481 | ||
| 2552 | (UML gdb) | 2482 | (UML gdb) |
| 2553 | att 1 | 2483 | att 1 |
| 2554 | 2484 | ||
| 2555 | 2485 | ||
| 2556 | |||
| 2557 | |||
| 2558 | |||
| 2559 | |||
| 2560 | (UML gdb) | 2486 | (UML gdb) |
| 2561 | c | 2487 | c |
| 2562 | 2488 | ||
| @@ -2569,12 +2495,13 @@ · 6 unmodified lines | |||
| 2569 | 2495 | ||
| 2570 | 2496 | ||
| 2571 | 2497 | ||
| 2572 | 11.3. Running ddd on UML | 2498 | 11.3. Running ddd on UML |
| 2499 | ------------------------- | ||
| 2573 | 2500 | ||
| 2574 | ddd works on UML, but requires a special kludge. The process goes | 2501 | ddd works on UML, but requires a special kludge. The process goes |
| 2575 | like this: | 2502 | like this: |
| 2576 | 2503 | ||
| 2577 | o Start ddd | 2504 | - Start ddd:: |
| 2578 | 2505 | ||
| 2579 | 2506 | ||
| 2580 | host% ddd linux | 2507 | host% ddd linux |
| @@ -2583,14 +2510,14 @@ · 2 unmodified lines | |||
| 2583 | 2510 | ||
| 2584 | 2511 | ||
| 2585 | 2512 | ||
| 2586 | o With ps, get the pid of the gdb that ddd started. You can ask the | 2513 | - With ps, get the pid of the gdb that ddd started. You can ask the |
| 2587 | gdb to tell you, but for some reason that confuses things and | 2514 | gdb to tell you, but for some reason that confuses things and |
| 2588 | causes a hang. | 2515 | causes a hang. |
| 2589 | 2516 | ||
| 2590 | o run UML with 'debug=parent gdb-pid=<pid>' added to the command line | 2517 | - run UML with 'debug=parent gdb-pid=<pid>' added to the command line |
| 2591 | - it will just sit there after you hit return | 2518 | - it will just sit there after you hit return |
| 2592 | 2519 | ||
| 2593 | o type 'att 1' to the ddd gdb and you will see something like | 2520 | - type 'att 1' to the ddd gdb and you will see something like:: |
| 2594 | 2521 | ||
| 2595 | 2522 | ||
| 2596 | 0xa013dc51 in __kill () | 2523 | 0xa013dc51 in __kill () |
| @@ -2602,12 +2529,14 @@ · 5 unmodified lines | |||
| 2602 | 2529 | ||
| 2603 | 2530 | ||
| 2604 | 2531 | ||
| 2605 | o At this point, type 'c', UML will boot up, and you can use ddd just | 2532 | - At this point, type 'c', UML will boot up, and you can use ddd just |
| 2606 | as you do on any other process. | 2533 | as you do on any other process. |
| 2607 | 2534 | ||
| 2608 | 2535 | ||
| 2609 | 2536 | ||
| 2610 | 11.4. Debugging modules | 2537 | 11.4. Debugging modules |
| 2538 | ------------------------ | ||
| 2539 | |||
| 2611 | 2540 | ||
| 2612 | gdb has support for debugging code which is dynamically loaded into | 2541 | gdb has support for debugging code which is dynamically loaded into |
| 2613 | the process. This support is what is needed to debug kernel modules | 2542 | the process. This support is what is needed to debug kernel modules |
| @@ -2629,7 +2558,8 @@ · 15 unmodified lines | |||
| 2629 | 2558 | ||
| 2630 | 2559 | ||
| 2631 | First, you must tell it where your modules are. There is a list in | 2560 | First, you must tell it where your modules are. There is a list in |
| 2632 | the script that looks like this: | 2561 | the script that looks like this:: |
| 2562 | |||
| 2633 | set MODULE_PATHS { | 2563 | set MODULE_PATHS { |
| 2634 | "fat" "/usr/src/uml/linux-2.4.18/fs/fat/fat.o" | 2564 | "fat" "/usr/src/uml/linux-2.4.18/fs/fat/fat.o" |
| 2635 | "isofs" "/usr/src/uml/linux-2.4.18/fs/isofs/isofs.o" | 2565 | "isofs" "/usr/src/uml/linux-2.4.18/fs/isofs/isofs.o" |
| @@ -2641,9 +2571,7 @@ · 5 unmodified lines | |||
| 2641 | 2571 | ||
| 2642 | You change that to list the names and paths of the modules that you | 2572 | You change that to list the names and paths of the modules that you |
| 2643 | are going to debug. Then you run it from the toplevel directory of | 2573 | are going to debug. Then you run it from the toplevel directory of |
| 2644 | your UML pool and it basically tells you what to do: | 2574 | your UML pool and it basically tells you what to do:: |
| 2645 | |||
| 2646 | |||
| 2647 | 2575 | ||
| 2648 | 2576 | ||
| 2649 | ******** GDB pid is 21903 ******** | 2577 | ******** GDB pid is 21903 ******** |
| @@ -2666,7 +2594,7 @@ · 16 unmodified lines | |||
| 2666 | 2594 | ||
| 2667 | 2595 | ||
| 2668 | After you run UML and it sits there doing nothing, you hit return at | 2596 | After you run UML and it sits there doing nothing, you hit return at |
| 2669 | the 'att 1' and continue it: | 2597 | the 'att 1' and continue it:: |
| 2670 | 2598 | ||
| 2671 | 2599 | ||
| 2672 | Attaching to program: /home/jdike/linux/2.4/um/./linux, process 1 | 2600 | Attaching to program: /home/jdike/linux/2.4/um/./linux, process 1 |
| @@ -2678,63 +2606,48 @@ · 5 unmodified lines | |||
| 2678 | 2606 | ||
| 2679 | 2607 | ||
| 2680 | At this point, you debug normally. When you insmod something, the | 2608 | At this point, you debug normally. When you insmod something, the |
| 2681 | expect magic will kick in and you'll see something like: | 2609 | expect magic will kick in and you'll see something like:: |
| 2682 | 2610 | ||
| 2683 | 2611 | ||
| 2684 | 2612 | *** Module hostfs loaded *** | |
| 2685 | 2613 | Breakpoint 1, sys_init_module (name_user=0x805abb0 "hostfs", | |
| 2686 | 2614 | mod_user=0x8070e00) at module.c:349 | |
| 2687 | 2615 | 349 char *name, *n_name, *name_tmp = NULL; | |
| 2688 | 2616 | (UML gdb) finish | |
| 2689 | 2617 | Run till exit from #0 sys_init_module (name_user=0x805abb0 "hostfs", | |
| 2690 | 2618 | mod_user=0x8070e00) at module.c:349 | |
| 2691 | 2619 | 0xa00e2e23 in execute_syscall (r=0xa8140284) at syscall_kern.c:411 | |
| 2692 | 2620 | 411 else res = EXECUTE_SYSCALL(syscall, regs); | |
| 2693 | 2621 | Value returned is $1 = 0 | |
| 2694 | 2622 | (UML gdb) | |
| 2695 | 2623 | p/x (int)module_list + module_list->size_of_struct | |
| 2696 | 2624 | ||
| 2697 | 2625 | $2 = 0xa9021054 | |
| 2698 | 2626 | (UML gdb) symbol-file ./linux | |
| 2699 | *** Module hostfs loaded *** | 2627 | Load new symbol table from "./linux"? (y or n) y |
| 2700 | Breakpoint 1, sys_init_module (name_user=0x805abb0 "hostfs", | 2628 | Reading symbols from ./linux... |
| 2701 | mod_user=0x8070e00) at module.c:349 | 2629 | done. |
| 2702 | 349 char *name, *n_name, *name_tmp = NULL; | 2630 | (UML gdb) |
| 2703 | (UML gdb) finish | 2631 | add-symbol-file /home/jdike/linux/2.4/um/arch/um/fs/hostfs/hostfs.o 0xa9021054 |
| 2704 | Run till exit from #0 sys_init_module (name_user=0x805abb0 "hostfs", | 2632 | |
| 2705 | mod_user=0x8070e00) at module.c:349 | 2633 | add symbol table from file "/home/jdike/linux/2.4/um/arch/um/fs/hostfs/hostfs.o" at |
| 2706 | 0xa00e2e23 in execute_syscall (r=0xa8140284) at syscall_kern.c:411 | 2634 | .text_addr = 0xa9021054 |
| 2707 | 411 else res = EXECUTE_SYSCALL(syscall, regs); | 2635 | (y or n) y |
| 2708 | Value returned is $1 = 0 | 2636 | |
| 2709 | (UML gdb) | 2637 | Reading symbols from /home/jdike/linux/2.4/um/arch/um/fs/hostfs/hostfs.o... |
| 2710 | p/x (int)module_list + module_list->size_of_struct | 2638 | done. |
| 2711 | 2639 | (UML gdb) p *module_list | |
| 2712 | $2 = 0xa9021054 | 2640 | $1 = {size_of_struct = 84, next = 0xa0178720, name = 0xa9022de0 "hostfs", |
| 2713 | (UML gdb) symbol-file ./linux | 2641 | size = 9016, uc = {usecount = {counter = 0}, pad = 0}, flags = 1, |
| 2714 | Load new symbol table from "./linux"? (y or n) y | 2642 | nsyms = 57, ndeps = 0, syms = 0xa9023170, deps = 0x0, refs = 0x0, |
| 2715 | Reading symbols from ./linux... | 2643 | init = 0xa90221f0 <init_hostfs>, cleanup = 0xa902222c <exit_hostfs>, |
| 2716 | done. | 2644 | ex_table_start = 0x0, ex_table_end = 0x0, persist_start = 0x0, |
| 2717 | (UML gdb) | 2645 | persist_end = 0x0, can_unload = 0, runsize = 0, kallsyms_start = 0x0, |
| 2718 | add-symbol-file /home/jdike/linux/2.4/um/arch/um/fs/hostfs/hostfs.o 0xa9021054 | 2646 | kallsyms_end = 0x0, |
| 2719 | 2647 | archdata_start = 0x1b855 <Address 0x1b855 out of bounds>, | |
| 2720 | add symbol table from file "/home/jdike/linux/2.4/um/arch/um/fs/hostfs/hostfs.o" at | 2648 | archdata_end = 0xe5890000 <Address 0xe5890000 out of bounds>, |
| 2721 | .text_addr = 0xa9021054 | 2649 | kernel_data = 0xf689c35d <Address 0xf689c35d out of bounds>} |
| 2722 | (y or n) y | 2650 | >> Finished loading symbols for hostfs ... |
| 2723 | |||
| 2724 | Reading symbols from /home/jdike/linux/2.4/um/arch/um/fs/hostfs/hostfs.o... | ||
| 2725 | done. | ||
| 2726 | (UML gdb) p *module_list | ||
| 2727 | $1 = {size_of_struct = 84, next = 0xa0178720, name = 0xa9022de0 "hostfs", | ||
| 2728 | size = 9016, uc = {usecount = {counter = 0}, pad = 0}, flags = 1, | ||
| 2729 | nsyms = 57, ndeps = 0, syms = 0xa9023170, deps = 0x0, refs = 0x0, | ||
| 2730 | init = 0xa90221f0 <init_hostfs>, cleanup = 0xa902222c <exit_hostfs>, | ||
| 2731 | ex_table_start = 0x0, ex_table_end = 0x0, persist_start = 0x0, | ||
| 2732 | persist_end = 0x0, can_unload = 0, runsize = 0, kallsyms_start = 0x0, | ||
| 2733 | kallsyms_end = 0x0, | ||
| 2734 | archdata_start = 0x1b855 <Address 0x1b855 out of bounds>, | ||
| 2735 | archdata_end = 0xe5890000 <Address 0xe5890000 out of bounds>, | ||
| 2736 | kernel_data = 0xf689c35d <Address 0xf689c35d out of bounds>} | ||
| 2737 | >> Finished loading symbols for hostfs ... | ||
| 2738 | 2651 | ||
| 2739 | 2652 | ||
| 2740 | 2653 | ||
| @@ -2744,7 +2657,7 @@ · 3 unmodified lines | |||
| 2744 | 2657 | ||
| 2745 | 2658 | ||
| 2746 | Boot the kernel under the debugger and load the module with insmod or | 2659 | Boot the kernel under the debugger and load the module with insmod or |
| 2747 | modprobe. With gdb, do: | 2660 | modprobe. With gdb, do:: |
| 2748 | 2661 | ||
| 2749 | 2662 | ||
| 2750 | (UML gdb) p module_list | 2663 | (UML gdb) p module_list |
| @@ -2758,12 +2671,12 @@ · 7 unmodified lines | |||
| 2758 | the name fields until find the module you want to debug. Take the | 2671 | the name fields until find the module you want to debug. Take the |
| 2759 | address of that structure, and add module.size_of_struct (which in | 2672 | address of that structure, and add module.size_of_struct (which in |
| 2760 | 2.4.10 kernels is 96 (0x60)) to it. Gdb can make this hard addition | 2673 | 2.4.10 kernels is 96 (0x60)) to it. Gdb can make this hard addition |
| 2761 | for you :-): | 2674 | for you :-):: |
| 2762 | 2675 | ||
| 2763 | 2676 | ||
| 2764 | 2677 | ||
| 2765 | (UML gdb) | 2678 | (UML gdb) |
| 2766 | printf "%#x\n", (int)module_list module_list->size_of_struct | 2679 | printf "%#x\n", (int)module_list module_list->size_of_struct |
| 2767 | 2680 | ||
| 2768 | 2681 | ||
| 2769 | 2682 | ||
| @@ -2771,7 +2684,7 @@ · 1 unmodified line | |||
| 2771 | The offset from the module start occasionally changes (before 2.4.0, | 2684 | The offset from the module start occasionally changes (before 2.4.0, |
| 2772 | it was module.size_of_struct + 4), so it's a good idea to check the | 2685 | it was module.size_of_struct + 4), so it's a good idea to check the |
| 2773 | init and cleanup addresses once in a while, as describe below. Now | 2686 | init and cleanup addresses once in a while, as describe below. Now |
| 2774 | do: | 2687 | do:: |
| 2775 | 2688 | ||
| 2776 | 2689 | ||
| 2777 | (UML gdb) | 2690 | (UML gdb) |
| @@ -2786,7 +2699,7 @@ · 8 unmodified lines | |||
| 2786 | If there's any doubt that you got the offset right, like breakpoints | 2699 | If there's any doubt that you got the offset right, like breakpoints |
| 2787 | appear not to work, or they're appearing in the wrong place, you can | 2700 | appear not to work, or they're appearing in the wrong place, you can |
| 2788 | check it by looking at the module structure. The init and cleanup | 2701 | check it by looking at the module structure. The init and cleanup |
| 2789 | fields should look like: | 2702 | fields should look like:: |
| 2790 | 2703 | ||
| 2791 | 2704 | ||
| 2792 | init = 0x588066b0 <init_hostfs>, cleanup = 0x588066c0 <exit_hostfs> | 2705 | init = 0x588066b0 <init_hostfs>, cleanup = 0x588066c0 <exit_hostfs> |
| @@ -2801,7 +2714,7 @@ · 8 unmodified lines | |||
| 2801 | 2714 | ||
| 2802 | When you want to load in a new version of the module, you need to get | 2715 | When you want to load in a new version of the module, you need to get |
| 2803 | gdb to forget about the old one. The only way I've found to do that | 2716 | gdb to forget about the old one. The only way I've found to do that |
| 2804 | is to tell gdb to forget about all symbols that it knows about: | 2717 | is to tell gdb to forget about all symbols that it knows about:: |
| 2805 | 2718 | ||
| 2806 | 2719 | ||
| 2807 | (UML gdb) symbol-file | 2720 | (UML gdb) symbol-file |
| @@ -2809,7 +2722,7 @@ · 1 unmodified line | |||
| 2809 | 2722 | ||
| 2810 | 2723 | ||
| 2811 | 2724 | ||
| 2812 | Then reload the symbols from the kernel binary: | 2725 | Then reload the symbols from the kernel binary:: |
| 2813 | 2726 | ||
| 2814 | 2727 | ||
| 2815 | (UML gdb) symbol-file /path/to/kernel | 2728 | (UML gdb) symbol-file /path/to/kernel |
| @@ -2823,17 +2736,19 @@ · 7 unmodified lines | |||
| 2823 | 2736 | ||
| 2824 | 2737 | ||
| 2825 | 2738 | ||
| 2826 | 11.5. Attaching gdb to the kernel | 2739 | 11.5. Attaching gdb to the kernel |
| 2740 | ---------------------------------- | ||
| 2827 | 2741 | ||
| 2828 | If you don't have the kernel running under gdb, you can attach gdb to | 2742 | If you don't have the kernel running under gdb, you can attach gdb to |
| 2829 | it later by sending the tracing thread a SIGUSR1. The first line of | 2743 | it later by sending the tracing thread a SIGUSR1. The first line of |
| 2830 | the console output identifies its pid: | 2744 | the console output identifies its pid:: |
| 2745 | |||
| 2831 | tracing thread pid = 20093 | 2746 | tracing thread pid = 20093 |
| 2832 | 2747 | ||
| 2833 | 2748 | ||
| 2834 | 2749 | ||
| 2835 | 2750 | ||
| 2836 | When you send it the signal: | 2751 | When you send it the signal:: |
| 2837 | 2752 | ||
| 2838 | 2753 | ||
| 2839 | host% kill -USR1 20093 | 2754 | host% kill -USR1 20093 |
| @@ -2845,7 +2760,7 @@ · 5 unmodified lines | |||
| 2845 | 2760 | ||
| 2846 | 2761 | ||
| 2847 | If you have the mconsole compiled into UML, then the mconsole client | 2762 | If you have the mconsole compiled into UML, then the mconsole client |
| 2848 | can be used to start gdb: | 2763 | can be used to start gdb:: |
| 2849 | 2764 | ||
| 2850 | 2765 | ||
| 2851 | (mconsole) (mconsole) config gdb=xterm | 2766 | (mconsole) (mconsole) config gdb=xterm |
| @@ -2857,7 +2772,8 @@ · 5 unmodified lines | |||
| 2857 | 2772 | ||
| 2858 | 2773 | ||
| 2859 | 2774 | ||
| 2860 | 11.6. Using alternate debuggers | 2775 | 11.6. Using alternate debuggers |
| 2776 | -------------------------------- | ||
| 2861 | 2777 | ||
| 2862 | UML has support for attaching to an already running debugger rather | 2778 | UML has support for attaching to an already running debugger rather |
| 2863 | than starting gdb itself. This is present in CVS as of 17 Apr 2001. | 2779 | than starting gdb itself. This is present in CVS as of 17 Apr 2001. |
| @@ -2886,7 +2802,7 @@ · 22 unmodified lines | |||
| 2886 | An example of an alternate debugger is strace. You can strace the | 2802 | An example of an alternate debugger is strace. You can strace the |
| 2887 | actual kernel as follows: | 2803 | actual kernel as follows: |
| 2888 | 2804 | ||
| 2889 | o Run the following in a shell | 2805 | - Run the following in a shell:: |
| 2890 | 2806 | ||
| 2891 | 2807 | ||
| 2892 | host% | 2808 | host% |
| @@ -2894,13 +2810,13 @@ · 1 unmodified line | |||
| 2894 | 2810 | ||
| 2895 | 2811 | ||
| 2896 | 2812 | ||
| 2897 | o Run UML with 'debug' and 'gdb-pid=<pid>' with the pid printed out | 2813 | - Run UML with 'debug' and 'gdb-pid=<pid>' with the pid printed out |
| 2898 | by the previous command | 2814 | by the previous command |
| 2899 | 2815 | ||
| 2900 | o Hit return in the shell, and UML will start running, and strace | 2816 | - Hit return in the shell, and UML will start running, and strace |
| 2901 | output will start accumulating in the output file. | 2817 | output will start accumulating in the output file. |
| 2902 | 2818 | ||
| 2903 | Note that this is different from running | 2819 | Note that this is different from running:: |
| 2904 | 2820 | ||
| 2905 | 2821 | ||
| 2906 | host% strace ./linux | 2822 | host% strace ./linux |
| @@ -2917,95 +2833,57 @@ · 10 unmodified lines | |||
| 2917 | 2833 | ||
| 2918 | 2834 | ||
| 2919 | 2835 | ||
| 2920 | 12. Kernel debugging examples | 2836 | 12. Kernel debugging examples |
| 2837 | ============================== | ||
| 2921 | 2838 | ||
| 2922 | 12.1. The case of the hung fsck | 2839 | 12.1. The case of the hung fsck |
| 2840 | -------------------------------- | ||
| 2923 | 2841 | ||
| 2924 | When booting up the kernel, fsck failed, and dropped me into a shell | 2842 | When booting up the kernel, fsck failed, and dropped me into a shell |
| 2925 | to fix things up. I ran fsck -y, which hung: | 2843 | to fix things up. I ran fsck -y, which hung:: |
| 2926 | |||
| 2927 | |||
| 2928 | |||
| 2929 | |||
| 2930 | |||
| 2931 | |||
| 2932 | |||
| 2933 | |||
| 2934 | |||
| 2935 | |||
| 2936 | |||
| 2937 | |||
| 2938 | |||
| 2939 | |||
| 2940 | |||
| 2941 | |||
| 2942 | |||
| 2943 | |||
| 2944 | |||
| 2945 | |||
| 2946 | |||
| 2947 | |||
| 2948 | |||
| 2949 | |||
| 2950 | |||
| 2951 | 2844 | ||
| 2952 | 2845 | ||
| 2846 | Setting hostname uml [ OK ] | ||
| 2847 | Checking root filesystem | ||
| 2848 | /dev/fhd0 was not cleanly unmounted, check forced. | ||
| 2849 | Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780. | ||
| 2953 | 2850 | ||
| 2851 | /dev/fhd0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. | ||
| 2852 | (i.e., without -a or -p options) | ||
| 2853 | [ FAILED ] | ||
| 2954 | 2854 | ||
| 2855 | *** An error occurred during the file system check. | ||
| 2856 | *** Dropping you to a shell; the system will reboot | ||
| 2857 | *** when you leave the shell. | ||
| 2858 | Give root password for maintenance | ||
| 2859 | (or type Control-D for normal startup): | ||
| 2955 | 2860 | ||
| 2861 | [root@uml /root]# fsck -y /dev/fhd0 | ||
| 2862 | fsck -y /dev/fhd0 | ||
| 2863 | Parallelizing fsck version 1.14 (9-Jan-1999) | ||
| 2864 | e2fsck 1.14, 9-Jan-1999 for EXT2 FS 0.5b, 95/08/09 | ||
| 2865 | /dev/fhd0 contains a file system with errors, check forced. | ||
| 2866 | Pass 1: Checking inodes, blocks, and sizes | ||
| 2867 | Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780. Ignore error? yes | ||
| 2956 | 2868 | ||
| 2869 | Inode 19780, i_blocks is 1548, should be 540. Fix? yes | ||
| 2957 | 2870 | ||
| 2871 | Pass 2: Checking directory structure | ||
| 2872 | Error reading block 49405 (Attempt to read block from filesystem resulted in short read). Ignore error? yes | ||
| 2958 | 2873 | ||
| 2874 | Directory inode 11858, block 0, offset 0: directory corrupted | ||
| 2875 | Salvage? yes | ||
| 2959 | 2876 | ||
| 2877 | Missing '.' in directory inode 11858. | ||
| 2878 | Fix? yes | ||
| 2960 | 2879 | ||
| 2961 | 2880 | Missing '..' in directory inode 11858. | |
| 2962 | 2881 | Fix? yes | |
| 2963 | Setting hostname uml [ OK ] | ||
| 2964 | Checking root filesystem | ||
| 2965 | /dev/fhd0 was not cleanly unmounted, check forced. | ||
| 2966 | Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780. | ||
| 2967 | |||
| 2968 | /dev/fhd0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. | ||
| 2969 | (i.e., without -a or -p options) | ||
| 2970 | [ FAILED ] | ||
| 2971 | |||
| 2972 | *** An error occurred during the file system check. | ||
| 2973 | *** Dropping you to a shell; the system will reboot | ||
| 2974 | *** when you leave the shell. | ||
| 2975 | Give root password for maintenance | ||
| 2976 | (or type Control-D for normal startup): | ||
| 2977 | |||
| 2978 | [root@uml /root]# fsck -y /dev/fhd0 | ||
| 2979 | fsck -y /dev/fhd0 | ||
| 2980 | Parallelizing fsck version 1.14 (9-Jan-1999) | ||
| 2981 | e2fsck 1.14, 9-Jan-1999 for EXT2 FS 0.5b, 95/08/09 | ||
| 2982 | /dev/fhd0 contains a file system with errors, check forced. | ||
| 2983 | Pass 1: Checking inodes, blocks, and sizes | ||
| 2984 | Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780. Ignore error? yes | ||
| 2985 | |||
| 2986 | Inode 19780, i_blocks is 1548, should be 540. Fix? yes | ||
| 2987 | |||
| 2988 | Pass 2: Checking directory structure | ||
| 2989 | Error reading block 49405 (Attempt to read block from filesystem resulted in short read). Ignore error? yes | ||
| 2990 | |||
| 2991 | Directory inode 11858, block 0, offset 0: directory corrupted | ||
| 2992 | Salvage? yes | ||
| 2993 | |||
| 2994 | Missing '.' in directory inode 11858. | ||
| 2995 | Fix? yes | ||
| 2996 | |||
| 2997 | Missing '..' in directory inode 11858. | ||
| 2998 | Fix? yes | ||
| 2999 | |||
| 3000 | |||
| 3001 | |||
| 3002 | 2882 | ||
| 3003 | 2883 | ||
| 3004 | The standard drill in this sort of situation is to fire up gdb on the | 2884 | The standard drill in this sort of situation is to fire up gdb on the |
| 3005 | signal thread, which, in this case, was pid 1935. In another window, | 2885 | signal thread, which, in this case, was pid 1935. In another window, |
| 3006 | I run gdb and attach pid 1935. | 2886 | I run gdb and attach pid 1935:: |
| 3007 | |||
| 3008 | |||
| 3009 | 2887 | ||
| 3010 | 2888 | ||
| 3011 | ~/linux/2.3.26/um 1016: gdb linux | 2889 | ~/linux/2.3.26/um 1016: gdb linux |
| @@ -3022,11 +2900,7 @@ · 10 unmodified lines | |||
| 3022 | 0x100756d9 in __wait4 () | 2900 | 0x100756d9 in __wait4 () |
| 3023 | 2901 | ||
| 3024 | 2902 | ||
| 3025 | 2903 | Let's see what's currently running:: | |
| 3026 | |||
| 3027 | |||
| 3028 | |||
| 3029 | Let's see what's currently running: | ||
| 3030 | 2904 | ||
| 3031 | 2905 | ||
| 3032 | 2906 | ||
| @@ -3041,7 +2915,7 @@ · 8 unmodified lines | |||
| 3041 | reason and never woke up. | 2915 | reason and never woke up. |
| 3042 | 2916 | ||
| 3043 | 2917 | ||
| 3044 | Let's guess that the last process in the process list is fsck: | 2918 | Let's guess that the last process in the process list is fsck:: |
| 3045 | 2919 | ||
| 3046 | 2920 | ||
| 3047 | 2921 | ||
| @@ -3052,7 +2926,7 @@ · 4 unmodified lines | |||
| 3052 | 2926 | ||
| 3053 | 2927 | ||
| 3054 | 2928 | ||
| 3055 | It is, so let's see what it thinks it's up to: | 2929 | It is, so let's see what it thinks it's up to:: |
| 3056 | 2930 | ||
| 3057 | 2931 | ||
| 3058 | 2932 | ||
| @@ -3068,8 +2942,6 @@ · 9 unmodified lines | |||
| 3068 | 2942 | ||
| 3069 | 2943 | ||
| 3070 | 2944 | ||
| 3071 | |||
| 3072 | |||
| 3073 | The interesting things here are the fact that its .thread.syscall.id | 2945 | The interesting things here are the fact that its .thread.syscall.id |
| 3074 | is __NR_write (see the big switch in arch/um/kernel/syscall_kern.c or | 2946 | is __NR_write (see the big switch in arch/um/kernel/syscall_kern.c or |
| 3075 | the defines in include/asm-um/arch/unistd.h), and that it never | 2947 | the defines in include/asm-um/arch/unistd.h), and that it never |
| @@ -3081,30 +2953,20 @@ · 5 unmodified lines | |||
| 3081 | The fact that it never returned from write means that its stack should | 2953 | The fact that it never returned from write means that its stack should |
| 3082 | be fairly interesting. Its pid is 1980 (.thread.extern_pid). That | 2954 | be fairly interesting. Its pid is 1980 (.thread.extern_pid). That |
| 3083 | process is being ptraced by the signal thread, so it must be detached | 2955 | process is being ptraced by the signal thread, so it must be detached |
| 3084 | before gdb can attach it: | 2956 | before gdb can attach it:: |
| 3085 | |||
| 3086 | |||
| 3087 | |||
| 3088 | |||
| 3089 | |||
| 3090 | |||
| 3091 | 2957 | ||
| 3092 | 2958 | ||
| 3093 | 2959 | ||
| 2960 | (gdb) call detach(1980) | ||
| 3094 | 2961 | ||
| 3095 | (gdb) call detach(1980) | 2962 | Program received signal SIGSEGV, Segmentation fault. |
| 3096 | 2963 | <function called from gdb> | |
| 3097 | Program received signal SIGSEGV, Segmentation fault. | 2964 | The program being debugged stopped while in a function called from GDB. |
| 3098 | <function called from gdb> | 2965 | When the function (detach) is done executing, GDB will silently |
| 3099 | The program being debugged stopped while in a function called from GDB. | 2966 | stop (instead of continuing to evaluate the expression containing |
| 3100 | When the function (detach) is done executing, GDB will silently | 2967 | the function call). |
| 3101 | stop (instead of continuing to evaluate the expression containing | 2968 | (gdb) call detach(1980) |
| 3102 | the function call). | 2969 | $15 = 0 |
| 3103 | (gdb) call detach(1980) | ||
| 3104 | $15 = 0 | ||
| 3105 | |||
| 3106 | |||
| 3107 | |||
| 3108 | 2970 | ||
| 3109 | 2971 | ||
| 3110 | The first detach segfaults for some reason, and the second one | 2972 | The first detach segfaults for some reason, and the second one |
| @@ -3112,7 +2974,7 @@ · 1 unmodified line | |||
| 3112 | 2974 | ||
| 3113 | 2975 | ||
| 3114 | Now I detach from the signal thread, attach to the fsck thread, and | 2976 | Now I detach from the signal thread, attach to the fsck thread, and |
| 3115 | look at its stack: | 2977 | look at its stack:: |
| 3116 | 2978 | ||
| 3117 | 2979 | ||
| 3118 | (gdb) det | 2980 | (gdb) det |
| @@ -3152,14 +3014,14 @@ · 33 unmodified lines | |||
| 3152 | 3014 | ||
| 3153 | 3015 | ||
| 3154 | 3016 | ||
| 3155 | The interesting things here are : | 3017 | The interesting things here are: |
| 3156 | 3018 | ||
| 3157 | o There are two segfaults on this stack (frames 9 and 14) | 3019 | - There are two segfaults on this stack (frames 9 and 14) |
| 3158 | 3020 | ||
| 3159 | o The first faulting address (frame 11) is 0x50000800 | 3021 | - The first faulting address (frame 11) is 0x50000800:: |
| 3160 | 3022 | ||
| 3161 | (gdb) p (void *)1342179328 | 3023 | (gdb) p (void *)1342179328 |
| 3162 | $16 = (void *) 0x50000800 | 3024 | $16 = (void *) 0x50000800 |
| 3163 | 3025 | ||
| 3164 | 3026 | ||
| 3165 | 3027 | ||
| @@ -3175,7 +3037,7 @@ · 9 unmodified lines | |||
| 3175 | 3037 | ||
| 3176 | However, the more immediate problem is that second segfault and I'm | 3038 | However, the more immediate problem is that second segfault and I'm |
| 3177 | going to concentrate on that. First, I want to see where the fault | 3039 | going to concentrate on that. First, I want to see where the fault |
| 3178 | happened, so I have to go look at the sigcontent struct in frame 8: | 3040 | happened, so I have to go look at the sigcontent struct in frame 8:: |
| 3179 | 3041 | ||
| 3180 | 3042 | ||
| 3181 | 3043 | ||
| @@ -3211,7 +3073,7 @@ · 29 unmodified lines | |||
| 3211 | 3073 | ||
| 3212 | 3074 | ||
| 3213 | 3075 | ||
| 3214 | That's not very useful, so I'll try a more manual method: | 3076 | That's not very useful, so I'll try a more manual method:: |
| 3215 | 3077 | ||
| 3216 | 3078 | ||
| 3217 | (gdb) p *((struct sigcontext *) (&sig + 1)) | 3079 | (gdb) p *((struct sigcontext *) (&sig + 1)) |
| @@ -3224,7 +3086,7 @@ · 6 unmodified lines | |||
| 3224 | 3086 | ||
| 3225 | 3087 | ||
| 3226 | 3088 | ||
| 3227 | The ip is in handle_mm_fault: | 3089 | The ip is in handle_mm_fault:: |
| 3228 | 3090 | ||
| 3229 | 3091 | ||
| 3230 | (gdb) p (void *)268480945 | 3092 | (gdb) p (void *)268480945 |
| @@ -3236,7 +3098,7 @@ · 5 unmodified lines | |||
| 3236 | 3098 | ||
| 3237 | 3099 | ||
| 3238 | 3100 | ||
| 3239 | Specifically, it's in pte_alloc: | 3101 | Specifically, it's in pte_alloc:: |
| 3240 | 3102 | ||
| 3241 | 3103 | ||
| 3242 | (gdb) i line *$20 | 3104 | (gdb) i line *$20 |
| @@ -3249,7 +3111,7 @@ · 6 unmodified lines | |||
| 3249 | 3111 | ||
| 3250 | 3112 | ||
| 3251 | To find where in handle_mm_fault this is, I'll jump forward in the | 3113 | To find where in handle_mm_fault this is, I'll jump forward in the |
| 3252 | code until I see an address in that procedure: | 3114 | code until I see an address in that procedure:: |
| 3253 | 3115 | ||
| 3254 | 3116 | ||
| 3255 | 3117 | ||
| @@ -3286,21 +3148,21 @@ · 30 unmodified lines | |||
| 3286 | 3148 | ||
| 3287 | 3149 | ||
| 3288 | Something is apparently wrong with the page tables or vma_structs, so | 3150 | Something is apparently wrong with the page tables or vma_structs, so |
| 3289 | lets go back to frame 11 and have a look at them: | 3151 | lets go back to frame 11 and have a look at them:: |
| 3290 | 3152 | ||
| 3291 | 3153 | ||
| 3292 | 3154 | ||
| 3293 | #11 0x1006c0aa in segv (address=1342179328, is_write=2) at trap_kern.c:50 | 3155 | #11 0x1006c0aa in segv (address=1342179328, is_write=2) at trap_kern.c:50 |
| 3294 | 50 handle_mm_fault(current, vma, address, is_write); | 3156 | 50 handle_mm_fault(current, vma, address, is_write); |
| 3295 | (gdb) call pgd_offset_proc(vma->vm_mm, address) | 3157 | (gdb) call pgd_offset_proc(vma->vm_mm, address) |
| 3296 | $22 = (pgd_t *) 0x80a548c | 3158 | $22 = (pgd_t *) 0x80a548c |
| 3297 | 3159 | ||
| 3298 | 3160 | ||
| 3299 | 3161 | ||
| 3300 | 3162 | ||
| 3301 | 3163 | ||
| 3302 | That's pretty bogus. Page tables aren't supposed to be in process | 3164 | That's pretty bogus. Page tables aren't supposed to be in process |
| 3303 | text or data areas. Let's see what's in the vma: | 3165 | text or data areas. Let's see what's in the vma:: |
| 3304 | 3166 | ||
| 3305 | 3167 | ||
| 3306 | (gdb) p *vma | 3168 | (gdb) p *vma |
| @@ -3325,12 +3187,9 @@ · 18 unmodified lines | |||
| 3325 | 3187 | ||
| 3326 | 3188 | ||
| 3327 | 3189 | ||
| 3328 | |||
| 3329 | |||
| 3330 | This also pretty bogus. With all of the 0x80xxxxx and 0xaffffxxx | 3190 | This also pretty bogus. With all of the 0x80xxxxx and 0xaffffxxx |
| 3331 | addresses, this is looking like a stack was plonked down on top of | 3191 | addresses, this is looking like a stack was plonked down on top of |
| 3332 | these structures. Maybe it's a stack overflow from the next page: | 3192 | these structures. Maybe it's a stack overflow from the next page:: |
| 3333 | |||
| 3334 | 3193 | ||
| 3335 | 3194 | ||
| 3336 | (gdb) p vma | 3195 | (gdb) p vma |
| @@ -3338,52 +3197,36 @@ · 1 unmodified line | |||
| 3338 | 3197 | ||
| 3339 | 3198 | ||
| 3340 | 3199 | ||
| 3341 | |||
| 3342 | |||
| 3343 | That's towards the lower quarter of the page, so that would have to | 3200 | That's towards the lower quarter of the page, so that would have to |
| 3344 | have been pretty heavy stack overflow: | 3201 | have been pretty heavy stack overflow:: |
| 3345 | 3202 | ||
| 3346 | 3203 | ||
| 3347 | 3204 | (gdb) x/100x $25 | |
| 3348 | 3205 | 0x507d2434: 0x507d2434 0x00000000 0x08048000 0x080a4f8c | |
| 3349 | 3206 | 0x507d2444: 0x00000000 0x080a79e0 0x080a8c94 0x080d1000 | |
| 3350 | 3207 | 0x507d2454: 0xaffffdb0 0xaffffe63 0xaffffe7a 0xaffffe7a | |
| 3351 | 3208 | 0x507d2464: 0xafffffec 0x00000062 0x0000008a 0x00000000 | |
| 3352 | 3209 | 0x507d2474: 0x00000000 0x00000000 0x00000000 0x00000000 | |
| 3353 | 3210 | 0x507d2484: 0x00000000 0x00000000 0x00000000 0x00000000 | |
| 3354 | 3211 | 0x507d2494: 0x00000000 0x00000000 0x507d2fe0 0x00000000 | |
| 3355 | 3212 | 0x507d24a4: 0x00000000 0x00000000 0x00000000 0x00000000 | |
| 3356 | 3213 | 0x507d24b4: 0x00000000 0x00000000 0x00000000 0x00000000 | |
| 3357 | 3214 | 0x507d24c4: 0x00000000 0x00000000 0x00000000 0x00000000 | |
| 3358 | 3215 | 0x507d24d4: 0x00000000 0x00000000 0x00000000 0x00000000 | |
| 3359 | (gdb) x/100x $25 | 3216 | 0x507d24e4: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3360 | 0x507d2434: 0x507d2434 0x00000000 0x08048000 0x080a4f8c | 3217 | 0x507d24f4: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3361 | 0x507d2444: 0x00000000 0x080a79e0 0x080a8c94 0x080d1000 | 3218 | 0x507d2504: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3362 | 0x507d2454: 0xaffffdb0 0xaffffe63 0xaffffe7a 0xaffffe7a | 3219 | 0x507d2514: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3363 | 0x507d2464: 0xafffffec 0x00000062 0x0000008a 0x00000000 | 3220 | 0x507d2524: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3364 | 0x507d2474: 0x00000000 0x00000000 0x00000000 0x00000000 | 3221 | 0x507d2534: 0x00000000 0x00000000 0x507d25dc 0x00000000 |
| 3365 | 0x507d2484: 0x00000000 0x00000000 0x00000000 0x00000000 | 3222 | 0x507d2544: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3366 | 0x507d2494: 0x00000000 0x00000000 0x507d2fe0 0x00000000 | 3223 | 0x507d2554: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3367 | 0x507d24a4: 0x00000000 0x00000000 0x00000000 0x00000000 | 3224 | 0x507d2564: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3368 | 0x507d24b4: 0x00000000 0x00000000 0x00000000 0x00000000 | 3225 | 0x507d2574: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3369 | 0x507d24c4: 0x00000000 0x00000000 0x00000000 0x00000000 | 3226 | 0x507d2584: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3370 | 0x507d24d4: 0x00000000 0x00000000 0x00000000 0x00000000 | 3227 | 0x507d2594: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3371 | 0x507d24e4: 0x00000000 0x00000000 0x00000000 0x00000000 | 3228 | 0x507d25a4: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3372 | 0x507d24f4: 0x00000000 0x00000000 0x00000000 0x00000000 | 3229 | 0x507d25b4: 0x00000000 0x00000000 0x00000000 0x00000000 |
| 3373 | 0x507d2504: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
| 3374 | 0x507d2514: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
| 3375 | 0x507d2524: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
| 3376 | 0x507d2534: 0x00000000 0x00000000 0x507d25dc 0x00000000 | ||
| 3377 | 0x507d2544: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
| 3378 | 0x507d2554: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
| 3379 | 0x507d2564: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
| 3380 | 0x507d2574: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
| 3381 | 0x507d2584: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
| 3382 | 0x507d2594: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
| 3383 | 0x507d25a4: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
| 3384 | 0x507d25b4: 0x00000000 0x00000000 0x00000000 0x00000000 | ||
| 3385 | |||
| 3386 | |||
| 3387 | 3230 | ||
| 3388 | 3231 | ||
| 3389 | 3232 | ||
| @@ -3399,65 +3242,53 @@ · 9 unmodified lines | |||
| 3399 | on will be somewhat clearer. | 3242 | on will be somewhat clearer. |
| 3400 | 3243 | ||
| 3401 | 3244 | ||
| 3402 | 12.2. Episode 2: The case of the hung fsck | 3245 | 12.2. Episode 2: The case of the hung fsck |
| 3246 | ------------------------------------------- | ||
| 3403 | 3247 | ||
| 3404 | After setting a trap in the SEGV handler for accesses to the signal | 3248 | After setting a trap in the SEGV handler for accesses to the signal |
| 3405 | thread's stack, I reran the kernel. | 3249 | thread's stack, I reran the kernel. |
| 3406 | 3250 | ||
| 3407 | 3251 | ||
| 3408 | fsck hung again, this time by hitting the trap: | 3252 | fsck hung again, this time by hitting the trap:: |
| 3409 | |||
| 3410 | |||
| 3411 | 3253 | ||
| 3412 | 3254 | ||
| 3413 | 3255 | ||
| 3256 | Setting hostname uml [ OK ] | ||
| 3257 | Checking root filesystem | ||
| 3258 | /dev/fhd0 contains a file system with errors, check forced. | ||
| 3259 | Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780. | ||
| 3414 | 3260 | ||
| 3261 | /dev/fhd0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. | ||
| 3262 | (i.e., without -a or -p options) | ||
| 3263 | [ FAILED ] | ||
| 3415 | 3264 | ||
| 3265 | *** An error occurred during the file system check. | ||
| 3266 | *** Dropping you to a shell; the system will reboot | ||
| 3267 | *** when you leave the shell. | ||
| 3268 | Give root password for maintenance | ||
| 3269 | (or type Control-D for normal startup): | ||
| 3416 | 3270 | ||
| 3271 | [root@uml /root]# fsck -y /dev/fhd0 | ||
| 3272 | fsck -y /dev/fhd0 | ||
| 3273 | Parallelizing fsck version 1.14 (9-Jan-1999) | ||
| 3274 | e2fsck 1.14, 9-Jan-1999 for EXT2 FS 0.5b, 95/08/09 | ||
| 3275 | /dev/fhd0 contains a file system with errors, check forced. | ||
| 3276 | Pass 1: Checking inodes, blocks, and sizes | ||
| 3277 | Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780. Ignore error? yes | ||
| 3417 | 3278 | ||
| 3279 | Pass 2: Checking directory structure | ||
| 3280 | Error reading block 49405 (Attempt to read block from filesystem resulted in short read). Ignore error? yes | ||
| 3418 | 3281 | ||
| 3282 | Directory inode 11858, block 0, offset 0: directory corrupted | ||
| 3283 | Salvage? yes | ||
| 3419 | 3284 | ||
| 3285 | Missing '.' in directory inode 11858. | ||
| 3286 | Fix? yes | ||
| 3420 | 3287 | ||
| 3288 | Missing '..' in directory inode 11858. | ||
| 3289 | Fix? yes | ||
| 3421 | 3290 | ||
| 3422 | 3291 | Untested (4127) [100fe44c]: trap_kern.c line 31 | |
| 3423 | |||
| 3424 | |||
| 3425 | Setting hostname uml [ OK ] | ||
| 3426 | Checking root filesystem | ||
| 3427 | /dev/fhd0 contains a file system with errors, check forced. | ||
| 3428 | Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780. | ||
| 3429 | |||
| 3430 | /dev/fhd0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. | ||
| 3431 | (i.e., without -a or -p options) | ||
| 3432 | [ FAILED ] | ||
| 3433 | |||
| 3434 | *** An error occurred during the file system check. | ||
| 3435 | *** Dropping you to a shell; the system will reboot | ||
| 3436 | *** when you leave the shell. | ||
| 3437 | Give root password for maintenance | ||
| 3438 | (or type Control-D for normal startup): | ||
| 3439 | |||
| 3440 | [root@uml /root]# fsck -y /dev/fhd0 | ||
| 3441 | fsck -y /dev/fhd0 | ||
| 3442 | Parallelizing fsck version 1.14 (9-Jan-1999) | ||
| 3443 | e2fsck 1.14, 9-Jan-1999 for EXT2 FS 0.5b, 95/08/09 | ||
| 3444 | /dev/fhd0 contains a file system with errors, check forced. | ||
| 3445 | Pass 1: Checking inodes, blocks, and sizes | ||
| 3446 | Error reading block 86894 (Attempt to read block from filesystem resulted in short read) while reading indirect blocks of inode 19780. Ignore error? yes | ||
| 3447 | |||
| 3448 | Pass 2: Checking directory structure | ||
| 3449 | Error reading block 49405 (Attempt to read block from filesystem resulted in short read). Ignore error? yes | ||
| 3450 | |||
| 3451 | Directory inode 11858, block 0, offset 0: directory corrupted | ||
| 3452 | Salvage? yes | ||
| 3453 | |||
| 3454 | Missing '.' in directory inode 11858. | ||
| 3455 | Fix? yes | ||
| 3456 | |||
| 3457 | Missing '..' in directory inode 11858. | ||
| 3458 | Fix? yes | ||
| 3459 | |||
| 3460 | Untested (4127) [100fe44c]: trap_kern.c line 31 | ||
| 3461 | 3292 | ||
| 3462 | 3293 | ||
| 3463 | 3294 | ||
| @@ -3465,7 +3296,7 @@ · 1 unmodified line | |||
| 3465 | 3296 | ||
| 3466 | I need to get the signal thread to detach from pid 4127 so that I can | 3297 | I need to get the signal thread to detach from pid 4127 so that I can |
| 3467 | attach to it with gdb. This is done by sending it a SIGUSR1, which is | 3298 | attach to it with gdb. This is done by sending it a SIGUSR1, which is |
| 3468 | caught by the signal thread, which detaches the process: | 3299 | caught by the signal thread, which detaches the process:: |
| 3469 | 3300 | ||
| 3470 | 3301 | ||
| 3471 | kill -USR1 4127 | 3302 | kill -USR1 4127 |
| @@ -3474,31 +3305,20 @@ · 2 unmodified lines | |||
| 3474 | 3305 | ||
| 3475 | 3306 | ||
| 3476 | 3307 | ||
| 3477 | Now I can run gdb on it: | 3308 | Now I can run gdb on it:: |
| 3478 | |||
| 3479 | |||
| 3480 | |||
| 3481 | |||
| 3482 | |||
| 3483 | |||
| 3484 | |||
| 3485 | 3309 | ||
| 3486 | 3310 | ||
| 3487 | 3311 | ~/linux/2.3.26/um 1034: gdb linux | |
| 3488 | 3312 | GNU gdb 4.17.0.11 with Linux support | |
| 3489 | 3313 | Copyright 1998 Free Software Foundation, Inc. | |
| 3490 | 3314 | GDB is free software, covered by the GNU General Public License, and you are | |
| 3491 | ~/linux/2.3.26/um 1034: gdb linux | 3315 | welcome to change it and/or distribute copies of it under certain conditions. |
| 3492 | GNU gdb 4.17.0.11 with Linux support | 3316 | Type "show copying" to see the conditions. |
| 3493 | Copyright 1998 Free Software Foundation, Inc. | 3317 | There is absolutely no warranty for GDB. Type "show warranty" for details. |
| 3494 | GDB is free software, covered by the GNU General Public License, and you are | 3318 | This GDB was configured as "i386-redhat-linux"... |
| 3495 | welcome to change it and/or distribute copies of it under certain conditions. | 3319 | (gdb) att 4127 |
| 3496 | Type "show copying" to see the conditions. | 3320 | Attaching to program `/home/dike/linux/2.3.26/um/linux', Pid 4127 |
| 3497 | There is absolutely no warranty for GDB. Type "show warranty" for details. | 3321 | 0x10075891 in __libc_nanosleep () |
| 3498 | This GDB was configured as "i386-redhat-linux"... | ||
| 3499 | (gdb) att 4127 | ||
| 3500 | Attaching to program `/home/dike/linux/2.3.26/um/linux', Pid 4127 | ||
| 3501 | 0x10075891 in __libc_nanosleep () | ||
| 3502 | 3322 | ||
| 3503 | 3323 | ||
| 3504 | 3324 | ||
| @@ -3506,7 +3326,7 @@ · 1 unmodified line | |||
| 3506 | 3326 | ||
| 3507 | The backtrace shows that it was in a write and that the fault address | 3327 | The backtrace shows that it was in a write and that the fault address |
| 3508 | (address in frame 3) is 0x50000800, which is right in the middle of | 3328 | (address in frame 3) is 0x50000800, which is right in the middle of |
| 3509 | the signal thread's stack page: | 3329 | the signal thread's stack page:: |
| 3510 | 3330 | ||
| 3511 | 3331 | ||
| 3512 | (gdb) bt | 3332 | (gdb) bt |
| @@ -3540,58 +3360,48 @@ · 27 unmodified lines | |||
| 3540 | 3360 | ||
| 3541 | 3361 | ||
| 3542 | 3362 | ||
| 3543 | |||
| 3544 | |||
| 3545 | Going up the stack to the segv_handler frame and looking at where in | 3363 | Going up the stack to the segv_handler frame and looking at where in |
| 3546 | the code the access happened shows that it happened near line 110 of | 3364 | the code the access happened shows that it happened near line 110 of |
| 3547 | block_dev.c: | 3365 | block_dev.c:: |
| 3548 | 3366 | ||
| 3549 | 3367 | ||
| 3550 | 3368 | ||
| 3551 | 3369 | (gdb) up | |
| 3552 | 3370 | #1 0x1007584d in __sleep (seconds=1000000) | |
| 3553 | 3371 | at ../sysdeps/unix/sysv/linux/sleep.c:78 | |
| 3554 | 3372 | ../sysdeps/unix/sysv/linux/sleep.c:78: No such file or directory. | |
| 3555 | 3373 | (gdb) | |
| 3556 | 3374 | #2 0x1006ce9a in stop () at user_util.c:191 | |
| 3557 | (gdb) up | 3375 | 191 while(1) sleep(1000000); |
| 3558 | #1 0x1007584d in __sleep (seconds=1000000) | 3376 | (gdb) |
| 3559 | at ../sysdeps/unix/sysv/linux/sleep.c:78 | 3377 | #3 0x1006bf88 in segv (address=1342179328, is_write=2) at trap_kern.c:31 |
| 3560 | ../sysdeps/unix/sysv/linux/sleep.c:78: No such file or directory. | 3378 | 31 KERN_UNTESTED(); |
| 3561 | (gdb) | 3379 | (gdb) |
| 3562 | #2 0x1006ce9a in stop () at user_util.c:191 | 3380 | #4 0x1006c628 in segv_handler (sc=0x5006eaf8) at trap_user.c:174 |
| 3563 | 191 while(1) sleep(1000000); | 3381 | 174 segv(sc->cr2, sc->err & 2); |
| 3564 | (gdb) | 3382 | (gdb) p *sc |
| 3565 | #3 0x1006bf88 in segv (address=1342179328, is_write=2) at trap_kern.c:31 | 3383 | $1 = {gs = 0, __gsh = 0, fs = 0, __fsh = 0, es = 43, __esh = 0, ds = 43, |
| 3566 | 31 KERN_UNTESTED(); | 3384 | __dsh = 0, edi = 1342179328, esi = 134973440, ebp = 1342631484, |
| 3567 | (gdb) | 3385 | esp = 1342630864, ebx = 256, edx = 0, ecx = 256, eax = 1024, trapno = 14, |
| 3568 | #4 0x1006c628 in segv_handler (sc=0x5006eaf8) at trap_user.c:174 | 3386 | err = 6, eip = 268550834, cs = 35, __csh = 0, eflags = 66070, |
| 3569 | 174 segv(sc->cr2, sc->err & 2); | 3387 | esp_at_signal = 1342630864, ss = 43, __ssh = 0, fpstate = 0x0, oldmask = 0, |
| 3570 | (gdb) p *sc | 3388 | cr2 = 1342179328} |
| 3571 | $1 = {gs = 0, __gsh = 0, fs = 0, __fsh = 0, es = 43, __esh = 0, ds = 43, | 3389 | (gdb) p (void *)268550834 |
| 3572 | __dsh = 0, edi = 1342179328, esi = 134973440, ebp = 1342631484, | 3390 | $2 = (void *) 0x1001c2b2 |
| 3573 | esp = 1342630864, ebx = 256, edx = 0, ecx = 256, eax = 1024, trapno = 14, | 3391 | (gdb) i sym $2 |
| 3574 | err = 6, eip = 268550834, cs = 35, __csh = 0, eflags = 66070, | 3392 | block_write + 1090 in section .text |
| 3575 | esp_at_signal = 1342630864, ss = 43, __ssh = 0, fpstate = 0x0, oldmask = 0, | 3393 | (gdb) i line *$2 |
| 3576 | cr2 = 1342179328} | 3394 | Line 209 of "/home/dike/linux/2.3.26/um/include/asm/arch/string.h" |
| 3577 | (gdb) p (void *)268550834 | 3395 | starts at address 0x1001c2a1 <block_write+1073> |
| 3578 | $2 = (void *) 0x1001c2b2 | 3396 | and ends at 0x1001c2bf <block_write+1103>. |
| 3579 | (gdb) i sym $2 | 3397 | (gdb) i line *0x1001c2c0 |
| 3580 | block_write + 1090 in section .text | 3398 | Line 110 of "block_dev.c" starts at address 0x1001c2bf <block_write+1103> |
| 3581 | (gdb) i line *$2 | 3399 | and ends at 0x1001c2e3 <block_write+1139>. |
| 3582 | Line 209 of "/home/dike/linux/2.3.26/um/include/asm/arch/string.h" | ||
| 3583 | starts at address 0x1001c2a1 <block_write+1073> | ||
| 3584 | and ends at 0x1001c2bf <block_write+1103>. | ||
| 3585 | (gdb) i line *0x1001c2c0 | ||
| 3586 | Line 110 of "block_dev.c" starts at address 0x1001c2bf <block_write+1103> | ||
| 3587 | and ends at 0x1001c2e3 <block_write+1139>. | ||
| 3588 | |||
| 3589 | |||
| 3590 | 3400 | ||
| 3591 | 3401 | ||
| 3592 | 3402 | ||
| 3593 | Looking at the source shows that the fault happened during a call to | 3403 | Looking at the source shows that the fault happened during a call to |
| 3594 | copy_from_user to copy the data into the kernel: | 3404 | copy_from_user to copy the data into the kernel:: |
| 3595 | 3405 | ||
| 3596 | 3406 | ||
| 3597 | 107 count -= chars; | 3407 | 107 count -= chars; |
| @@ -3601,10 +3411,8 @@ · 3 unmodified lines | |||
| 3601 | 3411 | ||
| 3602 | 3412 | ||
| 3603 | 3413 | ||
| 3604 | |||
| 3605 | |||
| 3606 | p is the pointer which must contain 0x50000800, since buf contains | 3414 | p is the pointer which must contain 0x50000800, since buf contains |
| 3607 | 0x80b8800 (frame 8 above). It is defined as: | 3415 | 0x80b8800 (frame 8 above). It is defined as:: |
| 3608 | 3416 | ||
| 3609 | 3417 | ||
| 3610 | p = offset + bh->b_data; | 3418 | p = offset + bh->b_data; |
| @@ -3615,24 +3423,22 @@ · 4 unmodified lines | |||
| 3615 | 3423 | ||
| 3616 | I need to figure out what bh is, and it just so happens that bh is | 3424 | I need to figure out what bh is, and it just so happens that bh is |
| 3617 | passed as an argument to mark_buffer_uptodate and mark_buffer_dirty a | 3425 | passed as an argument to mark_buffer_uptodate and mark_buffer_dirty a |
| 3618 | few lines later, so I do a little disassembly: | 3426 | few lines later, so I do a little disassembly:: |
| 3619 | |||
| 3620 | |||
| 3621 | 3427 | ||
| 3622 | 3428 | ||
| 3623 | (gdb) disas 0x1001c2bf 0x1001c2e0 | 3429 | (gdb) disas 0x1001c2bf 0x1001c2e0 |
| 3624 | Dump of assembler code from 0x1001c2bf to 0x1001c2d0: | 3430 | Dump of assembler code from 0x1001c2bf to 0x1001c2d0: |
| 3625 | 0x1001c2bf <block_write+1103>: addl %eax,0xc(%ebp) | 3431 | 0x1001c2bf <block_write+1103>: addl %eax,0xc(%ebp) |
| 3626 | 0x1001c2c2 <block_write+1106>: movl 0xfffffdd4(%ebp),%edx | 3432 | 0x1001c2c2 <block_write+1106>: movl 0xfffffdd4(%ebp),%edx |
| 3627 | 0x1001c2c8 <block_write+1112>: btsl $0x0,0x18(%edx) | 3433 | 0x1001c2c8 <block_write+1112>: btsl $0x0,0x18(%edx) |
| 3628 | 0x1001c2cd <block_write+1117>: btsl $0x1,0x18(%edx) | 3434 | 0x1001c2cd <block_write+1117>: btsl $0x1,0x18(%edx) |
| 3629 | 0x1001c2d2 <block_write+1122>: sbbl %ecx,%ecx | 3435 | 0x1001c2d2 <block_write+1122>: sbbl %ecx,%ecx |
| 3630 | 0x1001c2d4 <block_write+1124>: testl %ecx,%ecx | 3436 | 0x1001c2d4 <block_write+1124>: testl %ecx,%ecx |
| 3631 | 0x1001c2d6 <block_write+1126>: jne 0x1001c2e3 <block_write+1139> | 3437 | 0x1001c2d6 <block_write+1126>: jne 0x1001c2e3 <block_write+1139> |
| 3632 | 0x1001c2d8 <block_write+1128>: pushl $0x0 | 3438 | 0x1001c2d8 <block_write+1128>: pushl $0x0 |
| 3633 | 0x1001c2da <block_write+1130>: pushl %edx | 3439 | 0x1001c2da <block_write+1130>: pushl %edx |
| 3634 | 0x1001c2db <block_write+1131>: call 0x1001819c <__mark_buffer_dirty> | 3440 | 0x1001c2db <block_write+1131>: call 0x1001819c <__mark_buffer_dirty> |
| 3635 | End of assembler dump. | 3441 | End of assembler dump. |
| 3636 | 3442 | ||
| 3637 | 3443 | ||
| 3638 | 3444 | ||
| @@ -3640,7 +3446,7 @@ · 1 unmodified line | |||
| 3640 | 3446 | ||
| 3641 | At that point, bh is in %edx (address 0x1001c2da), which is calculated | 3447 | At that point, bh is in %edx (address 0x1001c2da), which is calculated |
| 3642 | at 0x1001c2c2 as %ebp + 0xfffffdd4, so I figure exactly what that is, | 3448 | at 0x1001c2c2 as %ebp + 0xfffffdd4, so I figure exactly what that is, |
| 3643 | taking %ebp from the sigcontext_struct above: | 3449 | taking %ebp from the sigcontext_struct above:: |
| 3644 | 3450 | ||
| 3645 | 3451 | ||
| 3646 | (gdb) p (void *)1342631484 | 3452 | (gdb) p (void *)1342631484 |
| @@ -3657,7 +3463,7 @@ · 10 unmodified lines | |||
| 3657 | 3463 | ||
| 3658 | 3464 | ||
| 3659 | Now, I look at the structure to see what's in it, and particularly, | 3465 | Now, I look at the structure to see what's in it, and particularly, |
| 3660 | what its b_data field contains: | 3466 | what its b_data field contains:: |
| 3661 | 3467 | ||
| 3662 | 3468 | ||
| 3663 | (gdb) p *((struct buffer_head *)0x50100200) | 3469 | (gdb) p *((struct buffer_head *)0x50100200) |
| @@ -3682,18 +3488,18 @@ · 18 unmodified lines | |||
| 3682 | 3488 | ||
| 3683 | The b_page field is a pointer to the page_struct representing the | 3489 | The b_page field is a pointer to the page_struct representing the |
| 3684 | 0x50000000 page. Looking at it shows the kernel's idea of the state | 3490 | 0x50000000 page. Looking at it shows the kernel's idea of the state |
| 3685 | of that page: | 3491 | of that page:: |
| 3686 | 3492 | ||
| 3687 | 3493 | ||
| 3688 | 3494 | ||
| 3689 | (gdb) p *$13.b_page | 3495 | (gdb) p *$13.b_page |
| 3690 | $17 = {list = {next = 0x50004a5c, prev = 0x100c5174}, mapping = 0x0, | 3496 | $17 = {list = {next = 0x50004a5c, prev = 0x100c5174}, mapping = 0x0, |
| 3691 | index = 0, next_hash = 0x0, count = {counter = 1}, flags = 132, lru = { | 3497 | index = 0, next_hash = 0x0, count = {counter = 1}, flags = 132, lru = { |
| 3692 | next = 0x50008460, prev = 0x50019350}, wait = { | 3498 | next = 0x50008460, prev = 0x50019350}, wait = { |
| 3693 | lock = <optimized out or zero length>, task_list = {next = 0x50004024, | 3499 | lock = <optimized out or zero length>, task_list = {next = 0x50004024, |
| 3694 | prev = 0x50004024}, __magic = 1342193708, __creator = 0}, | 3500 | prev = 0x50004024}, __magic = 1342193708, __creator = 0}, |
| 3695 | pprev_hash = 0x0, buffers = 0x501002c0, virtual = 1342177280, | 3501 | pprev_hash = 0x0, buffers = 0x501002c0, virtual = 1342177280, |
| 3696 | zone = 0x100c5160} | 3502 | zone = 0x100c5160} |
| 3697 | 3503 | ||
| 3698 | 3504 | ||
| 3699 | 3505 | ||
| @@ -3702,7 +3508,7 @@ · 2 unmodified lines | |||
| 3702 | Some sanity-checking: the virtual field shows the "virtual" address of | 3508 | Some sanity-checking: the virtual field shows the "virtual" address of |
| 3703 | this page, which in this kernel is the same as its "physical" address, | 3509 | this page, which in this kernel is the same as its "physical" address, |
| 3704 | and the page_struct itself should be mem_map[0], since it represents | 3510 | and the page_struct itself should be mem_map[0], since it represents |
| 3705 | the first page of memory: | 3511 | the first page of memory:: |
| 3706 | 3512 | ||
| 3707 | 3513 | ||
| 3708 | 3514 | ||
| @@ -3719,7 +3525,7 @@ · 10 unmodified lines | |||
| 3719 | 3525 | ||
| 3720 | 3526 | ||
| 3721 | Now to check out the page_struct itself. In particular, the flags | 3527 | Now to check out the page_struct itself. In particular, the flags |
| 3722 | field shows whether the page is considered free or not: | 3528 | field shows whether the page is considered free or not:: |
| 3723 | 3529 | ||
| 3724 | 3530 | ||
| 3725 | (gdb) p (void *)132 | 3531 | (gdb) p (void *)132 |
| @@ -3739,7 +3545,7 @@ · 13 unmodified lines | |||
| 3739 | 3545 | ||
| 3740 | 3546 | ||
| 3741 | In my setup_arch procedure, I have the following code which looks just | 3547 | In my setup_arch procedure, I have the following code which looks just |
| 3742 | fine: | 3548 | fine:: |
| 3743 | 3549 | ||
| 3744 | 3550 | ||
| 3745 | 3551 | ||
| @@ -3762,7 +3568,7 @@ · 16 unmodified lines | |||
| 3762 | 3568 | ||
| 3763 | 3569 | ||
| 3764 | Stepping into init_bootmem, and looking at bootmem_map before looking | 3570 | Stepping into init_bootmem, and looking at bootmem_map before looking |
| 3765 | at what it contains shows the following: | 3571 | at what it contains shows the following:: |
| 3766 | 3572 | ||
| 3767 | 3573 | ||
| 3768 | 3574 | ||
| @@ -3788,18 +3594,20 @@ · 19 unmodified lines | |||
| 3788 | 3594 | ||
| 3789 | 3595 | ||
| 3790 | 3596 | ||
| 3791 | 13. What to do when UML doesn't work | 3597 | 13. What to do when UML doesn't work |
| 3598 | ===================================== | ||
| 3792 | 3599 | ||
| 3793 | 3600 | ||
| 3794 | 3601 | ||
| 3795 | 3602 | ||
| 3796 | 13.1. Strange compilation errors when you build from source | 3603 | 13.1. Strange compilation errors when you build from source |
| 3604 | ------------------------------------------------------------ | ||
| 3797 | 3605 | ||
| 3798 | As of test11, it is necessary to have "ARCH=um" in the environment or | 3606 | As of test11, it is necessary to have "ARCH=um" in the environment or |
| 3799 | on the make command line for all steps in building UML, including | 3607 | on the make command line for all steps in building UML, including |
| 3800 | clean, distclean, or mrproper, config, menuconfig, or xconfig, dep, | 3608 | clean, distclean, or mrproper, config, menuconfig, or xconfig, dep, |
| 3801 | and linux. If you forget for any of them, the i386 build seems to | 3609 | and linux. If you forget for any of them, the i386 build seems to |
| 3802 | contaminate the UML build. If this happens, start from scratch with | 3610 | contaminate the UML build. If this happens, start from scratch with:: |
| 3803 | 3611 | ||
| 3804 | 3612 | ||
| 3805 | host% | 3613 | host% |
| @@ -3811,7 +3619,7 @@ · 5 unmodified lines | |||
| 3811 | and repeat the build process with ARCH=um on all the steps. | 3619 | and repeat the build process with ARCH=um on all the steps. |
| 3812 | 3620 | ||
| 3813 | 3621 | ||
| 3814 | See ``Compiling the kernel and modules'' for more details. | 3622 | See :ref:`Compiling_the_kernel_and_modules` for more details. |
| 3815 | 3623 | ||
| 3816 | 3624 | ||
| 3817 | Another cause of strange compilation errors is building UML in | 3625 | Another cause of strange compilation errors is building UML in |
| @@ -3824,11 +3632,11 @@ · 6 unmodified lines | |||
| 3824 | 3632 | ||
| 3825 | 3633 | ||
| 3826 | 3634 | ||
| 3827 | 13.3. A variety of panics and hangs with /tmp on a reiserfs filesys- | 3635 | 13.3. A variety of panics and hangs with /tmp on a reiserfs filesystem |
| 3828 | tem | 3636 | ----------------------------------------------------------------------- |
| 3829 | 3637 | ||
| 3830 | I saw this on reiserfs 3.5.21 and it seems to be fixed in 3.5.27. | 3638 | I saw this on reiserfs 3.5.21 and it seems to be fixed in 3.5.27. |
| 3831 | Panics preceded by | 3639 | Panics preceded by:: |
| 3832 | 3640 | ||
| 3833 | 3641 | ||
| 3834 | Detaching pid nnnn | 3642 | Detaching pid nnnn |
| @@ -3854,17 +3662,19 @@ · 19 unmodified lines | |||
| 3854 | 3662 | ||
| 3855 | 3663 | ||
| 3856 | 3664 | ||
| 3857 | 13.5. UML doesn't work when /tmp is an NFS filesystem | 3665 | 13.5. UML doesn't work when /tmp is an NFS filesystem |
| 3666 | ------------------------------------------------------ | ||
| 3858 | 3667 | ||
| 3859 | This seems to be a similar situation with the ReiserFS problem above. | 3668 | This seems to be a similar situation with the ReiserFS problem above. |
| 3860 | Some versions of NFS seems not to handle mmap correctly, which UML | 3669 | Some versions of NFS seems not to handle mmap correctly, which UML |
| 3861 | depends on. The workaround is have /tmp be a non-NFS directory. | 3670 | depends on. The workaround is have /tmp be a non-NFS directory. |
| 3862 | 3671 | ||
| 3863 | 3672 | ||
| 3864 | 13.6. UML hangs on boot when compiled with gprof support | 3673 | 13.6. UML hangs on boot when compiled with gprof support |
| 3674 | --------------------------------------------------------- | ||
| 3865 | 3675 | ||
| 3866 | If you build UML with gprof support and, early in the boot, it does | 3676 | If you build UML with gprof support and, early in the boot, it does |
| 3867 | this | 3677 | this:: |
| 3868 | 3678 | ||
| 3869 | 3679 | ||
| 3870 | kernel BUG at page_alloc.c:100! | 3680 | kernel BUG at page_alloc.c:100! |
| @@ -3878,10 +3688,11 @@ · 7 unmodified lines | |||
| 3878 | 3688 | ||
| 3879 | 3689 | ||
| 3880 | 3690 | ||
| 3881 | 13.7. syslogd dies with a SIGTERM on startup | 3691 | 13.7. syslogd dies with a SIGTERM on startup |
| 3692 | --------------------------------------------- | ||
| 3882 | 3693 | ||
| 3883 | The exact boot error depends on the distribution that you're booting, | 3694 | The exact boot error depends on the distribution that you're booting, |
| 3884 | but Debian produces this: | 3695 | but Debian produces this:: |
| 3885 | 3696 | ||
| 3886 | 3697 | ||
| 3887 | /etc/rc2.d/S10sysklogd: line 49: 93 Terminated | 3698 | /etc/rc2.d/S10sysklogd: line 49: 93 Terminated |
| @@ -3891,23 +3702,21 @@ · 3 unmodified lines | |||
| 3891 | 3702 | ||
| 3892 | 3703 | ||
| 3893 | This is a syslogd bug. There's a race between a parent process | 3704 | This is a syslogd bug. There's a race between a parent process |
| 3894 | installing a signal handler and its child sending the signal. See | 3705 | installing a signal handler and its child sending the signal. |
| 3895 | this uml-devel post <http://www.geocrawler.com/lists/3/Source- | ||
| 3896 | Forge/709/0/6612801> for the details. | ||
| 3897 | 3706 | ||
| 3898 | 3707 | ||
| 3899 | 3708 | ||
| 3900 | 13.8. TUN/TAP networking doesn't work on a 2.4 host | 3709 | 13.8. TUN/TAP networking doesn't work on a 2.4 host |
| 3710 | ---------------------------------------------------- | ||
| 3901 | 3711 | ||
| 3902 | There are a couple of problems which were | 3712 | There are a couple of problems which were reported by |
| 3903 | <http://www.geocrawler.com/lists/3/SourceForge/597/0/> name="pointed | 3713 | Tim Robinson <timro at trkr dot net> |
| 3904 | out"> by Tim Robinson <timro at trkr dot net> | ||
| 3905 | 3714 | ||
| 3906 | o It doesn't work on hosts running 2.4.7 (or thereabouts) or earlier. | 3715 | - It doesn't work on hosts running 2.4.7 (or thereabouts) or earlier. |
| 3907 | The fix is to upgrade to something more recent and then read the | 3716 | The fix is to upgrade to something more recent and then read the |
| 3908 | next item. | 3717 | next item. |
| 3909 | 3718 | ||
| 3910 | o If you see | 3719 | - If you see:: |
| 3911 | 3720 | ||
| 3912 | 3721 | ||
| 3913 | File descriptor in bad state | 3722 | File descriptor in bad state |
| @@ -3921,8 +3730,8 @@ · 7 unmodified lines | |||
| 3921 | 3730 | ||
| 3922 | 3731 | ||
| 3923 | 3732 | ||
| 3924 | 13.9. You can network to the host but not to other machines on the | 3733 | 13.9. You can network to the host but not to other machines on the net |
| 3925 | net | 3734 | ======================================================================= |
| 3926 | 3735 | ||
| 3927 | If you can connect to the host, and the host can connect to UML, but | 3736 | If you can connect to the host, and the host can connect to UML, but |
| 3928 | you cannot connect to any other machines, then you may need to enable | 3737 | you cannot connect to any other machines, then you may need to enable |
| @@ -3930,7 +3739,7 @@ · 1 unmodified line | |||
| 3930 | using private IP addresses (192.168.x.x or 10.x.x.x) for host/UML | 3739 | using private IP addresses (192.168.x.x or 10.x.x.x) for host/UML |
| 3931 | networking, rather than the public address space that your host is | 3740 | networking, rather than the public address space that your host is |
| 3932 | connected to. UML does not enable IP Masquerading, so you will need | 3741 | connected to. UML does not enable IP Masquerading, so you will need |
| 3933 | to create a static rule to enable it: | 3742 | to create a static rule to enable it:: |
| 3934 | 3743 | ||
| 3935 | 3744 | ||
| 3936 | host% | 3745 | host% |
| @@ -3944,11 +3753,11 @@ · 7 unmodified lines | |||
| 3944 | 3753 | ||
| 3945 | 3754 | ||
| 3946 | Documentation on IP Masquerading, and SNAT, can be found at | 3755 | Documentation on IP Masquerading, and SNAT, can be found at |
| 3947 | www.netfilter.org <http://www.netfilter.org> . | 3756 | http://www.netfilter.org. |
| 3948 | 3757 | ||
| 3949 | 3758 | ||
| 3950 | If you can reach the local net, but not the outside Internet, then | 3759 | If you can reach the local net, but not the outside Internet, then |
| 3951 | that is usually a routing problem. The UML needs a default route: | 3760 | that is usually a routing problem. The UML needs a default route:: |
| 3952 | 3761 | ||
| 3953 | 3762 | ||
| 3954 | UML# | 3763 | UML# |
| @@ -3972,7 +3781,8 @@ · 17 unmodified lines | |||
| 3972 | 3781 | ||
| 3973 | 3782 | ||
| 3974 | 3783 | ||
| 3975 | 13.10. I have no root and I want to scream | 3784 | 13.10. I have no root and I want to scream |
| 3785 | =========================================== | ||
| 3976 | 3786 | ||
| 3977 | Thanks to Birgit Wahlich for telling me about this strange one. It | 3787 | Thanks to Birgit Wahlich for telling me about this strange one. It |
| 3978 | turns out that there's a limit of six environment variables on the | 3788 | turns out that there's a limit of six environment variables on the |
| @@ -3987,14 +3797,16 @@ · 8 unmodified lines | |||
| 3987 | 3797 | ||
| 3988 | 3798 | ||
| 3989 | 3799 | ||
| 3990 | 13.11. UML build conflict between ptrace.h and ucontext.h | 3800 | 13.11. UML build conflict between ptrace.h and ucontext.h |
| 3801 | ========================================================== | ||
| 3991 | 3802 | ||
| 3992 | On some older systems, /usr/include/asm/ptrace.h and | 3803 | On some older systems, /usr/include/asm/ptrace.h and |
| 3993 | /usr/include/sys/ucontext.h define the same names. So, when they're | 3804 | /usr/include/sys/ucontext.h define the same names. So, when they're |
| 3994 | included together, the defines from one completely mess up the parsing | 3805 | included together, the defines from one completely mess up the parsing |
| 3995 | of the other, producing errors like: | 3806 | of the other, producing errors like:: |
| 3807 | |||
| 3996 | /usr/include/sys/ucontext.h:47: parse error before | 3808 | /usr/include/sys/ucontext.h:47: parse error before |
| 3997 | `10' | 3809 | `10` |
| 3998 | 3810 | ||
| 3999 | 3811 | ||
| 4000 | 3812 | ||
| @@ -4007,7 +3819,8 @@ · 6 unmodified lines | |||
| 4007 | 3819 | ||
| 4008 | 3820 | ||
| 4009 | 3821 | ||
| 4010 | 13.12. The UML BogoMips is exactly half the host's BogoMips | 3822 | 13.12. The UML BogoMips is exactly half the host's BogoMips |
| 3823 | ------------------------------------------------------------ | ||
| 4011 | 3824 | ||
| 4012 | On i386 kernels, there are two ways of running the loop that is used | 3825 | On i386 kernels, there are two ways of running the loop that is used |
| 4013 | to calculate the BogoMips rating, using the TSC if it's there or using | 3826 | to calculate the BogoMips rating, using the TSC if it's there or using |
| @@ -4019,15 +3832,17 @@ · 5 unmodified lines | |||
| 4019 | 3832 | ||
| 4020 | 3833 | ||
| 4021 | 3834 | ||
| 4022 | 13.13. When you run UML, it immediately segfaults | 3835 | 13.13. When you run UML, it immediately segfaults |
| 3836 | -------------------------------------------------- | ||
| 4023 | 3837 | ||
| 4024 | If the host is configured with the 2G/2G address space split, that's | 3838 | If the host is configured with the 2G/2G address space split, that's |
| 4025 | why. See ``UML on 2G/2G hosts'' for the details on getting UML to | 3839 | why. See ref:`UML_on_2G/2G_hosts` for the details on getting UML to |
| 4026 | run on your host. | 3840 | run on your host. |
| 4027 | 3841 | ||
| 4028 | 3842 | ||
| 4029 | 3843 | ||
| 4030 | 13.14. xterms appear, then immediately disappear | 3844 | 13.14. xterms appear, then immediately disappear |
| 3845 | ------------------------------------------------- | ||
| 4031 | 3846 | ||
| 4032 | If you're running an up to date kernel with an old release of | 3847 | If you're running an up to date kernel with an old release of |
| 4033 | uml_utilities, the port-helper program will not work properly, so | 3848 | uml_utilities, the port-helper program will not work properly, so |
| @@ -4039,7 +3854,8 @@ · 5 unmodified lines | |||
| 4039 | 3854 | ||
| 4040 | 3855 | ||
| 4041 | 3856 | ||
| 4042 | 13.15. Any other panic, hang, or strange behavior | 3857 | 13.15. Any other panic, hang, or strange behavior |
| 3858 | -------------------------------------------------- | ||
| 4043 | 3859 | ||
| 4044 | If you're seeing truly strange behavior, such as hangs or panics that | 3860 | If you're seeing truly strange behavior, such as hangs or panics that |
| 4045 | happen in random places, or you try running the debugger to see what's | 3861 | happen in random places, or you try running the debugger to see what's |
| @@ -4057,9 +3873,13 @@ · 11 unmodified lines | |||
| 4057 | it and that a fix is imminent. | 3873 | it and that a fix is imminent. |
| 4058 | 3874 | ||
| 4059 | 3875 | ||
| 4060 | If you want to be super-helpful, read ``Diagnosing Problems'' and | 3876 | If you want to be super-helpful, read :ref:`Diagnosing_Problems` and |
| 4061 | follow the instructions contained therein. | 3877 | follow the instructions contained therein. |
| 4062 | 14. Diagnosing Problems | 3878 | |
| 3879 | .. _Diagnosing_Problems: | ||
| 3880 | |||
| 3881 | 14. Diagnosing Problems | ||
| 3882 | ======================== | ||
| 4063 | 3883 | ||
| 4064 | 3884 | ||
| 4065 | If you get UML to crash, hang, or otherwise misbehave, you should | 3885 | If you get UML to crash, hang, or otherwise misbehave, you should |
| @@ -4074,21 +3894,22 @@ · 8 unmodified lines | |||
| 4074 | 3894 | ||
| 4075 | For any diagnosis, you're going to need to build a debugging kernel. | 3895 | For any diagnosis, you're going to need to build a debugging kernel. |
| 4076 | The binaries from this site aren't debuggable. If you haven't done | 3896 | The binaries from this site aren't debuggable. If you haven't done |
| 4077 | this before, read about ``Compiling the kernel and modules'' and | 3897 | this before, read about :ref:`Compiling_the_kernel_and_modules` and |
| 4078 | ``Kernel debugging'' UML first. | 3898 | :ref:`Kernel_debugging` UML first. |
| 4079 | 3899 | ||
| 4080 | 3900 | ||
| 4081 | 14.1. Case 1 : Normal kernel panics | 3901 | 14.1. Case 1 : Normal kernel panics |
| 3902 | ------------------------------------ | ||
| 4082 | 3903 | ||
| 4083 | The most common case is for a normal thread to panic. To debug this, | 3904 | The most common case is for a normal thread to panic. To debug this, |
| 4084 | you will need to run it under the debugger (add 'debug' to the command | 3905 | you will need to run it under the debugger (add 'debug' to the command |
| 4085 | line). An xterm will start up with gdb running inside it. Continue | 3906 | line). An xterm will start up with gdb running inside it. Continue |
| 4086 | it when it stops in start_kernel and make it crash. Now ^C gdb and | 3907 | it when it stops in start_kernel and make it crash. Now ``^C gdb`` and |
| 4087 | 3908 | ||
| 4088 | 3909 | ||
| 4089 | If the panic was a "Kernel mode fault", then there will be a segv | 3910 | If the panic was a "Kernel mode fault", then there will be a segv |
| 4090 | frame on the stack and I'm going to want some more information. The | 3911 | frame on the stack and I'm going to want some more information. The |
| 4091 | stack might look something like this: | 3912 | stack might look something like this:: |
| 4092 | 3913 | ||
| 4093 | 3914 | ||
| 4094 | (UML gdb) backtrace | 3915 | (UML gdb) backtrace |
| @@ -4107,7 +3928,7 @@ · 12 unmodified lines | |||
| 4107 | 3928 | ||
| 4108 | 3929 | ||
| 4109 | I'm going to want to see the symbol and line information for the value | 3930 | I'm going to want to see the symbol and line information for the value |
| 4110 | of ip in the segv frame. In this case, you would do the following: | 3931 | of ip in the segv frame. In this case, you would do the following:: |
| 4111 | 3932 | ||
| 4112 | 3933 | ||
| 4113 | (UML gdb) i sym 268849158 | 3934 | (UML gdb) i sym 268849158 |
| @@ -4115,7 +3936,7 @@ · 1 unmodified line | |||
| 4115 | 3936 | ||
| 4116 | 3937 | ||
| 4117 | 3938 | ||
| 4118 | and | 3939 | and:: |
| 4119 | 3940 | ||
| 4120 | 3941 | ||
| 4121 | (UML gdb) i line *268849158 | 3942 | (UML gdb) i line *268849158 |
| @@ -4128,7 +3949,8 @@ · 6 unmodified lines | |||
| 4128 | to get that information from the faulting ip. | 3949 | to get that information from the faulting ip. |
| 4129 | 3950 | ||
| 4130 | 3951 | ||
| 4131 | 14.2. Case 2 : Tracing thread panics | 3952 | 14.2. Case 2 : Tracing thread panics |
| 3953 | ------------------------------------- | ||
| 4132 | 3954 | ||
| 4133 | The less common and more painful case is when the tracing thread | 3955 | The less common and more painful case is when the tracing thread |
| 4134 | panics. In this case, the kernel debugger will be useless because it | 3956 | panics. In this case, the kernel debugger will be useless because it |
| @@ -4136,7 +3958,7 @@ · 1 unmodified line | |||
| 4136 | do is get a backtrace from the tracing thread. This is done by | 3958 | do is get a backtrace from the tracing thread. This is done by |
| 4137 | figuring out what its pid is, firing up gdb, and attaching it to that | 3959 | figuring out what its pid is, firing up gdb, and attaching it to that |
| 4138 | pid. You can figure out the tracing thread pid by looking at the | 3960 | pid. You can figure out the tracing thread pid by looking at the |
| 4139 | first line of the console output, which will look like this: | 3961 | first line of the console output, which will look like this:: |
| 4140 | 3962 | ||
| 4141 | 3963 | ||
| 4142 | tracing thread pid = 15851 | 3964 | tracing thread pid = 15851 |
| @@ -4145,7 +3967,7 @@ · 2 unmodified lines | |||
| 4145 | 3967 | ||
| 4146 | 3968 | ||
| 4147 | or by running ps on the host and finding the line that looks like | 3969 | or by running ps on the host and finding the line that looks like |
| 4148 | this: | 3970 | this:: |
| 4149 | 3971 | ||
| 4150 | 3972 | ||
| 4151 | jdike 15851 4.5 0.4 132568 1104 pts/0 S 21:34 0:05 ./linux [(tracing thread)] | 3973 | jdike 15851 4.5 0.4 132568 1104 pts/0 S 21:34 0:05 ./linux [(tracing thread)] |
| @@ -4164,7 +3986,7 @@ · 12 unmodified lines | |||
| 4164 | 14.3. Case 3 : Tracing thread panics caused by other threads | 3986 | 14.3. Case 3 : Tracing thread panics caused by other threads |
| 4165 | 3987 | ||
| 4166 | However, there are cases where the misbehavior of another thread | 3988 | However, there are cases where the misbehavior of another thread |
| 4167 | caused the problem. The most common panic of this type is: | 3989 | caused the problem. The most common panic of this type is:: |
| 4168 | 3990 | ||
| 4169 | 3991 | ||
| 4170 | wait_for_stop failed to wait for <pid> to stop with <signal number> | 3992 | wait_for_stop failed to wait for <pid> to stop with <signal number> |
| @@ -4177,7 +3999,7 @@ · 6 unmodified lines | |||
| 4177 | debugger is defunct and without some fancy footwork, another gdb can't | 3999 | debugger is defunct and without some fancy footwork, another gdb can't |
| 4178 | attach to it. So, this is how the fancy footwork goes: | 4000 | attach to it. So, this is how the fancy footwork goes: |
| 4179 | 4001 | ||
| 4180 | In a shell: | 4002 | In a shell:: |
| 4181 | 4003 | ||
| 4182 | 4004 | ||
| 4183 | host% kill -STOP pid | 4005 | host% kill -STOP pid |
| @@ -4185,7 +4007,7 @@ · 1 unmodified line | |||
| 4185 | 4007 | ||
| 4186 | 4008 | ||
| 4187 | 4009 | ||
| 4188 | Run gdb on the tracing thread as described in case 2 and do: | 4010 | Run gdb on the tracing thread as described in case 2 and do:: |
| 4189 | 4011 | ||
| 4190 | 4012 | ||
| 4191 | (host gdb) call detach(pid) | 4013 | (host gdb) call detach(pid) |
| @@ -4193,7 +4015,7 @@ · 1 unmodified line | |||
| 4193 | 4015 | ||
| 4194 | If you get a segfault, do it again. It always works the second time. | 4016 | If you get a segfault, do it again. It always works the second time. |
| 4195 | 4017 | ||
| 4196 | Detach from the tracing thread and attach to that other thread: | 4018 | Detach from the tracing thread and attach to that other thread:: |
| 4197 | 4019 | ||
| 4198 | 4020 | ||
| 4199 | (host gdb) detach | 4021 | (host gdb) detach |
| @@ -4209,7 +4031,7 @@ · 9 unmodified lines | |||
| 4209 | 4031 | ||
| 4210 | 4032 | ||
| 4211 | If gdb hangs when attaching to that process, go back to a shell and | 4033 | If gdb hangs when attaching to that process, go back to a shell and |
| 4212 | do: | 4034 | do:: |
| 4213 | 4035 | ||
| 4214 | 4036 | ||
| 4215 | host% | 4037 | host% |
| @@ -4218,7 +4040,7 @@ · 2 unmodified lines | |||
| 4218 | 4040 | ||
| 4219 | 4041 | ||
| 4220 | 4042 | ||
| 4221 | And then get the backtrace: | 4043 | And then get the backtrace:: |
| 4222 | 4044 | ||
| 4223 | 4045 | ||
| 4224 | (host gdb) backtrace | 4046 | (host gdb) backtrace |
| @@ -4227,13 +4049,14 @@ · 2 unmodified lines | |||
| 4227 | 4049 | ||
| 4228 | 4050 | ||
| 4229 | 4051 | ||
| 4230 | 14.4. Case 4 : Hangs | 4052 | 14.4. Case 4 : Hangs |
| 4053 | --------------------- | ||
| 4231 | 4054 | ||
| 4232 | Hangs seem to be fairly rare, but they sometimes happen. When a hang | 4055 | Hangs seem to be fairly rare, but they sometimes happen. When a hang |
| 4233 | happens, we need a backtrace from the offending process. Run the | 4056 | happens, we need a backtrace from the offending process. Run the |
| 4234 | kernel debugger as described in case 1 and get a backtrace. If the | 4057 | kernel debugger as described in case 1 and get a backtrace. If the |
| 4235 | current process is not the idle thread, then send in the backtrace. | 4058 | current process is not the idle thread, then send in the backtrace. |
| 4236 | You can tell that it's the idle thread if the stack looks like this: | 4059 | You can tell that it's the idle thread if the stack looks like this:: |
| 4237 | 4060 | ||
| 4238 | 4061 | ||
| 4239 | #0 0x100b1401 in __libc_nanosleep () | 4062 | #0 0x100b1401 in __libc_nanosleep () |
| @@ -4257,7 +4080,8 @@ · 17 unmodified lines | |||
| 4257 | 4080 | ||
| 4258 | 4081 | ||
| 4259 | 4082 | ||
| 4260 | 15. Thanks | 4083 | 15. Thanks |
| 4084 | =========== | ||
| 4261 | 4085 | ||
| 4262 | 4086 | ||
| 4263 | A number of people have helped this project in various ways, and this | 4087 | A number of people have helped this project in various ways, and this |
| @@ -4274,20 +4098,21 @@ · 10 unmodified lines | |||
| 4274 | bookkeeping lapses and I forget about contributions. | 4098 | bookkeeping lapses and I forget about contributions. |
| 4275 | 4099 | ||
| 4276 | 4100 | ||
| 4277 | 15.1. Code and Documentation | 4101 | 15.1. Code and Documentation |
| 4102 | ----------------------------- | ||
| 4278 | 4103 | ||
| 4279 | Rusty Russell <rusty at linuxcare.com.au> - | 4104 | Rusty Russell <rusty at linuxcare.com.au> - |
| 4280 | 4105 | ||
| 4281 | o wrote the HOWTO <http://user-mode- | 4106 | - wrote the HOWTO |
| 4282 | linux.sourceforge.net/UserModeLinux-HOWTO.html> | 4107 | http://user-mode-linux.sourceforge.net/old/UserModeLinux-HOWTO.html |
| 4283 | 4108 | ||
| 4284 | o prodded me into making this project official and putting it on | 4109 | - prodded me into making this project official and putting it on |
| 4285 | SourceForge | 4110 | SourceForge |
| 4286 | 4111 | ||
| 4287 | o came up with the way cool UML logo <http://user-mode- | 4112 | - came up with the way cool UML logo |
| 4288 | linux.sourceforge.net/uml-small.png> | 4113 | http://user-mode-linux.sourceforge.net/uml-small.png |
| 4289 | 4114 | ||
| 4290 | o redid the config process | 4115 | - redid the config process |
| 4291 | 4116 | ||
| 4292 | 4117 | ||
| 4293 | Peter Moulder <reiter at netspace.net.au> - Fixed my config and build | 4118 | Peter Moulder <reiter at netspace.net.au> - Fixed my config and build |
| @@ -4296,34 +4121,32 @@ · 2 unmodified lines | |||
| 4296 | 4121 | ||
| 4297 | Bill Stearns <wstearns at pobox.com> - | 4122 | Bill Stearns <wstearns at pobox.com> - |
| 4298 | 4123 | ||
| 4299 | o HOWTO updates | 4124 | - HOWTO updates |
| 4300 | 4125 | ||
| 4301 | o lots of bug reports | 4126 | - lots of bug reports |
| 4302 | 4127 | ||
| 4303 | o lots of testing | 4128 | - lots of testing |
| 4304 | 4129 | ||
| 4305 | o dedicated a box (uml.ists.dartmouth.edu) to support UML development | 4130 | - dedicated a box (uml.ists.dartmouth.edu) to support UML development |
| 4306 | 4131 | ||
| 4307 | o wrote the mkrootfs script, which allows bootable filesystems of | 4132 | - wrote the mkrootfs script, which allows bootable filesystems of |
| 4308 | RPM-based distributions to be cranked out | 4133 | RPM-based distributions to be cranked out |
| 4309 | 4134 | ||
| 4310 | o cranked out a large number of filesystems with said script | 4135 | - cranked out a large number of filesystems with said script |
| 4311 | 4136 | ||
| 4312 | 4137 | ||
| 4313 | Jim Leu <jleu at mindspring.com> - Wrote the virtual ethernet driver | 4138 | Jim Leu <jleu at mindspring.com> - Wrote the virtual ethernet driver |
| 4314 | and associated usermode tools | 4139 | and associated usermode tools |
| 4315 | 4140 | ||
| 4316 | Lars Brinkhoff <http://lars.nocrew.org/> - Contributed the ptrace | 4141 | Lars Brinkhoff http://lars.nocrew.org/ - Contributed the ptrace |
| 4317 | proxy from his own project <http://a386.nocrew.org/> to allow easier | 4142 | proxy from his own project to allow easier kernel debugging |
| 4318 | kernel debugging | ||
| 4319 | 4143 | ||
| 4320 | 4144 | ||
| 4321 | Andrea Arcangeli <andrea at suse.de> - Redid some of the early boot | 4145 | Andrea Arcangeli <andrea at suse.de> - Redid some of the early boot |
| 4322 | code so that it would work on machines with Large File Support | 4146 | code so that it would work on machines with Large File Support |
| 4323 | 4147 | ||
| 4324 | 4148 | ||
| 4325 | Chris Emerson <http://www.chiark.greenend.org.uk/~cemerson/> - Did | 4149 | Chris Emerson - Did the first UML port to Linux/ppc |
| 4326 | the first UML port to Linux/ppc | ||
| 4327 | 4150 | ||
| 4328 | 4151 | ||
| 4329 | Harald Welte <laforge at gnumonks.org> - Wrote the multicast | 4152 | Harald Welte <laforge at gnumonks.org> - Wrote the multicast |
| @@ -4338,7 +4161,7 @@ · 8 unmodified lines | |||
| 4338 | wrote the iomem emulation support | 4161 | wrote the iomem emulation support |
| 4339 | 4162 | ||
| 4340 | 4163 | ||
| 4341 | Henrik Nordstrom <http://hem.passagen.se/hno/> - Provided a variety | 4164 | Henrik Nordstrom http://hem.passagen.se/hno/ - Provided a variety |
| 4342 | of patches, fixes, and clues | 4165 | of patches, fixes, and clues |
| 4343 | 4166 | ||
| 4344 | 4167 | ||
| @@ -4373,190 +4196,193 @@ · 28 unmodified lines | |||
| 4373 | submitted patches for the slip transport and lots of other things. | 4196 | submitted patches for the slip transport and lots of other things. |
| 4374 | 4197 | ||
| 4375 | 4198 | ||
| 4376 | David Coulson <http://davidcoulson.net> - | 4199 | David Coulson http://davidcoulson.net - |
| 4377 | 4200 | ||
| 4378 | o Set up the usermodelinux.org <http://usermodelinux.org> site, | 4201 | - Set up the http://usermodelinux.org site, |
| 4379 | which is a great way of keeping the UML user community on top of | 4202 | which is a great way of keeping the UML user community on top of |
| 4380 | UML goings-on. | 4203 | UML goings-on. |
| 4381 | 4204 | ||
| 4382 | o Site documentation and updates | 4205 | - Site documentation and updates |
| 4383 | 4206 | ||
| 4384 | o Nifty little UML management daemon UMLd | 4207 | - Nifty little UML management daemon UMLd |
| 4385 | <http://uml.openconsultancy.com/umld/> | ||
| 4386 | 4208 | ||
| 4387 | o Lots of testing and bug reports | 4209 | - Lots of testing and bug reports |
| 4388 | 4210 | ||
| 4389 | 4211 | ||
| 4390 | 4212 | ||
| 4391 | 4213 | ||
| 4392 | 15.2. Flushing out bugs | 4214 | 15.2. Flushing out bugs |
| 4215 | ------------------------ | ||
| 4393 | 4216 | ||
| 4394 | 4217 | ||
| 4395 | 4218 | ||
| 4396 | o Yuri Pudgorodsky | 4219 | - Yuri Pudgorodsky |
| 4397 | 4220 | ||
| 4398 | o Gerald Britton | 4221 | - Gerald Britton |
| 4399 | 4222 | ||
| 4400 | o Ian Wehrman | 4223 | - Ian Wehrman |
| 4401 | 4224 | ||
| 4402 | o Gord Lamb | 4225 | - Gord Lamb |
| 4403 | 4226 | ||
| 4404 | o Eugene Koontz | 4227 | - Eugene Koontz |
| 4405 | 4228 | ||
| 4406 | o John H. Hartman | 4229 | - John H. Hartman |
| 4407 | 4230 | ||
| 4408 | o Anders Karlsson | 4231 | - Anders Karlsson |
| 4409 | 4232 | ||
| 4410 | o Daniel Phillips | 4233 | - Daniel Phillips |
| 4411 | 4234 | ||
| 4412 | o John Fremlin | 4235 | - John Fremlin |
| 4413 | 4236 | ||
| 4414 | o Rainer Burgstaller | 4237 | - Rainer Burgstaller |
| 4415 | 4238 | ||
| 4416 | o James Stevenson | 4239 | - James Stevenson |
| 4417 | 4240 | ||
| 4418 | o Matt Clay | 4241 | - Matt Clay |
| 4419 | 4242 | ||
| 4420 | o Cliff Jefferies | 4243 | - Cliff Jefferies |
| 4421 | 4244 | ||
| 4422 | o Geoff Hoff | 4245 | - Geoff Hoff |
| 4423 | 4246 | ||
| 4424 | o Lennert Buytenhek | 4247 | - Lennert Buytenhek |
| 4425 | 4248 | ||
| 4426 | o Al Viro | 4249 | - Al Viro |
| 4427 | 4250 | ||
| 4428 | o Frank Klingenhoefer | 4251 | - Frank Klingenhoefer |
| 4429 | 4252 | ||
| 4430 | o Livio Baldini Soares | 4253 | - Livio Baldini Soares |
| 4431 | 4254 | ||
| 4432 | o Jon Burgess | 4255 | - Jon Burgess |
| 4433 | 4256 | ||
| 4434 | o Petru Paler | 4257 | - Petru Paler |
| 4435 | 4258 | ||
| 4436 | o Paul | 4259 | - Paul |
| 4437 | 4260 | ||
| 4438 | o Chris Reahard | 4261 | - Chris Reahard |
| 4439 | 4262 | ||
| 4440 | o Sverker Nilsson | 4263 | - Sverker Nilsson |
| 4441 | 4264 | ||
| 4442 | o Gong Su | 4265 | - Gong Su |
| 4443 | 4266 | ||
| 4444 | o johan verrept | 4267 | - johan verrept |
| 4445 | 4268 | ||
| 4446 | o Bjorn Eriksson | 4269 | - Bjorn Eriksson |
| 4447 | 4270 | ||
| 4448 | o Lorenzo Allegrucci | 4271 | - Lorenzo Allegrucci |
| 4449 | 4272 | ||
| 4450 | o Muli Ben-Yehuda | 4273 | - Muli Ben-Yehuda |
| 4451 | 4274 | ||
| 4452 | o David Mansfield | 4275 | - David Mansfield |
| 4453 | 4276 | ||
| 4454 | o Howard Goff | 4277 | - Howard Goff |
| 4455 | 4278 | ||
| 4456 | o Mike Anderson | 4279 | - Mike Anderson |
| 4457 | 4280 | ||
| 4458 | o John Byrne | 4281 | - John Byrne |
| 4459 | 4282 | ||
| 4460 | o Sapan J. Batia | 4283 | - Sapan J. Batia |
| 4461 | 4284 | ||
| 4462 | o Iris Huang | 4285 | - Iris Huang |
| 4463 | 4286 | ||
| 4464 | o Jan Hudec | 4287 | - Jan Hudec |
| 4465 | 4288 | ||
| 4466 | o Voluspa | 4289 | - Voluspa |
| 4467 | 4290 | ||
| 4468 | 4291 | ||
| 4469 | 4292 | ||
| 4470 | 4293 | ||
| 4471 | 15.3. Buglets and clean-ups | 4294 | 15.3. Buglets and clean-ups |
| 4295 | ---------------------------- | ||
| 4472 | 4296 | ||
| 4473 | 4297 | ||
| 4474 | 4298 | ||
| 4475 | o Dave Zarzycki | 4299 | - Dave Zarzycki |
| 4476 | 4300 | ||
| 4477 | o Adam Lazur | 4301 | - Adam Lazur |
| 4478 | 4302 | ||
| 4479 | o Boria Feigin | 4303 | - Boria Feigin |
| 4480 | 4304 | ||
| 4481 | o Brian J. Murrell | 4305 | - Brian J. Murrell |
| 4482 | 4306 | ||
| 4483 | o JS | 4307 | - JS |
| 4484 | 4308 | ||
| 4485 | o Roman Zippel | 4309 | - Roman Zippel |
| 4486 | 4310 | ||
| 4487 | o Wil Cooley | 4311 | - Wil Cooley |
| 4488 | 4312 | ||
| 4489 | o Ayelet Shemesh | 4313 | - Ayelet Shemesh |
| 4490 | 4314 | ||
| 4491 | o Will Dyson | 4315 | - Will Dyson |
| 4492 | 4316 | ||
| 4493 | o Sverker Nilsson | 4317 | - Sverker Nilsson |
| 4494 | 4318 | ||
| 4495 | o dvorak | 4319 | - dvorak |
| 4496 | 4320 | ||
| 4497 | o v.naga srinivas | 4321 | - v.naga srinivas |
| 4498 | 4322 | ||
| 4499 | o Shlomi Fish | 4323 | - Shlomi Fish |
| 4500 | 4324 | ||
| 4501 | o Roger Binns | 4325 | - Roger Binns |
| 4502 | 4326 | ||
| 4503 | o johan verrept | 4327 | - johan verrept |
| 4504 | 4328 | ||
| 4505 | o MrChuoi | 4329 | - MrChuoi |
| 4506 | 4330 | ||
| 4507 | o Peter Cleve | 4331 | - Peter Cleve |
| 4508 | 4332 | ||
| 4509 | o Vincent Guffens | 4333 | - Vincent Guffens |
| 4510 | 4334 | ||
| 4511 | o Nathan Scott | 4335 | - Nathan Scott |
| 4512 | 4336 | ||
| 4513 | o Patrick Caulfield | 4337 | - Patrick Caulfield |
| 4514 | 4338 | ||
| 4515 | o jbearce | 4339 | - jbearce |
| 4516 | 4340 | ||
| 4517 | o Catalin Marinas | 4341 | - Catalin Marinas |
| 4518 | 4342 | ||
| 4519 | o Shane Spencer | 4343 | - Shane Spencer |
| 4520 | 4344 | ||
| 4521 | o Zou Min | 4345 | - Zou Min |
| 4522 | 4346 | ||
| 4523 | 4347 | ||
| 4524 | o Ryan Boder | 4348 | - Ryan Boder |
| 4525 | 4349 | ||
| 4526 | o Lorenzo Colitti | 4350 | - Lorenzo Colitti |
| 4527 | 4351 | ||
| 4528 | o Gwendal Grignou | 4352 | - Gwendal Grignou |
| 4529 | 4353 | ||
| 4530 | o Andre' Breiler | 4354 | - Andre' Breiler |
| 4531 | 4355 | ||
| 4532 | o Tsutomu Yasuda | 4356 | - Tsutomu Yasuda |
| 4533 | 4357 | ||
| 4534 | 4358 | ||
| 4535 | 4359 | ||
| 4536 | 15.4. Case Studies | 4360 | 15.4. Case Studies |
| 4361 | ------------------- | ||
| 4537 | 4362 | ||
| 4538 | 4363 | ||
| 4539 | o Jon Wright | 4364 | - Jon Wright |
| 4540 | 4365 | ||
| 4541 | o William McEwan | 4366 | - William McEwan |
| 4542 | 4367 | ||
| 4543 | o Michael Richardson | 4368 | - Michael Richardson |
| 4544 | 4369 | ||
| 4545 | 4370 | ||
| 4546 | 4371 | ||
| 4547 | 15.5. Other contributions | 4372 | 15.5. Other contributions |
| 4373 | -------------------------- | ||
| 4548 | 4374 | ||
| 4549 | 4375 | ||
| 4550 | Bill Carr <Bill.Carr at compaq.com> made the Red Hat mkrootfs script | 4376 | Bill Carr <Bill.Carr at compaq.com> made the Red Hat mkrootfs script |
| 4551 | work with RH 6.2. | 4377 | work with RH 6.2. |
| 4552 | 4378 | ||
| 4553 | Michael Jennings <mikejen at hevanet.com> sent in some material which | 4379 | Michael Jennings <mikejen at hevanet.com> sent in some material which |
| 4554 | is now gracing the top of the index page <http://user-mode- | 4380 | is now gracing the top of the index page |
| 4555 | linux.sourceforge.net/> of this site. | 4381 | http://user-mode-linux.sourceforge.net/ of this site. |
| 4556 | 4382 | ||
| 4557 | SGI <http://www.sgi.com> (and more specifically Ralf Baechle <ralf at | 4383 | SGI (and more specifically Ralf Baechle <ralf at |
| 4558 | uni-koblenz.de> ) gave me an account on oss.sgi.com | 4384 | uni-koblenz.de> ) gave me an account on oss.sgi.com. |
| 4559 | <http://www.oss.sgi.com> . The bandwidth there made it possible to | 4385 | The bandwidth there made it possible to |
| 4560 | produce most of the filesystems available on the project download | 4386 | produce most of the filesystems available on the project download |
| 4561 | page. | 4387 | page. |
| 4562 | 4388 | ||
| @@ -4573,17 +4399,5 @@ · 10 unmodified lines | |||
| 4573 | 4399 | ||
| 4574 | Chris Reahard built a specialized root filesystem for running a DNS | 4400 | Chris Reahard built a specialized root filesystem for running a DNS |
| 4575 | server jailed inside UML. It's available from the download | 4401 | server jailed inside UML. It's available from the download |
| 4576 | <http://user-mode-linux.sourceforge.net/dl-sf.html> page in the Jail | 4402 | http://user-mode-linux.sourceforge.net/old/dl-sf.html page in the Jail |
| 4577 | Filesystems section. | 4403 | Filesystems section. |
| 4578 | |||
| 4579 | |||
| 4580 | |||
| 4581 | |||
| 4582 | |||
| 4583 | |||
| 4584 | |||
| 4585 | |||
| 4586 | |||
| 4587 | |||
| 4588 | |||
| 4589 | |||
| @@ -19,7 +19,6 @@ x86-specific Documentation · 18 unmodified lines | |||
| 19 | tlb | 19 | tlb |
| 20 | mtrr | 20 | mtrr |
| 21 | pat | 21 | pat |
| 22 | intel_mpx | ||
| 23 | intel-iommu | 22 | intel-iommu |
| 24 | intel_txt | 23 | intel_txt |
| 25 | amd-memory-encryption | 24 | amd-memory-encryption |
| @@ -2796,11 +2796,11 @@ F: drivers/block/aoe/ · 2795 unmodified lines | |||
| 2796 | 2796 | ||
| 2797 | ATHEROS 71XX/9XXX GPIO DRIVER | 2797 | ATHEROS 71XX/9XXX GPIO DRIVER |
| 2798 | M: Alban Bedel <albeu@free.fr> | 2798 | M: Alban Bedel <albeu@free.fr> |
| 2799 | S: Maintained | ||
| 2799 | W: https://github.com/AlbanBedel/linux | 2800 | W: https://github.com/AlbanBedel/linux |
| 2800 | T: git git://github.com/AlbanBedel/linux | 2801 | T: git git://github.com/AlbanBedel/linux |
| 2801 | S: Maintained | ||
| 2802 | F: drivers/gpio/gpio-ath79.c | ||
| 2803 | F: Documentation/devicetree/bindings/gpio/gpio-ath79.txt | 2802 | F: Documentation/devicetree/bindings/gpio/gpio-ath79.txt |
| 2803 | F: drivers/gpio/gpio-ath79.c | ||
| 2804 | 2804 | ||
| 2805 | ATHEROS 71XX/9XXX USB PHY DRIVER | 2805 | ATHEROS 71XX/9XXX USB PHY DRIVER |
| 2806 | M: Alban Bedel <albeu@free.fr> | 2806 | M: Alban Bedel <albeu@free.fr> |
| @@ -3422,8 +3422,8 @@ BROADCOM BRCMSTB GPIO DRIVER · 615 unmodified lines | |||
| 3422 | M: Gregory Fong <gregory.0xf0@gmail.com> | 3422 | M: Gregory Fong <gregory.0xf0@gmail.com> |
| 3423 | L: bcm-kernel-feedback-list@broadcom.com | 3423 | L: bcm-kernel-feedback-list@broadcom.com |
| 3424 | S: Supported | 3424 | S: Supported |
| 3425 | F: drivers/gpio/gpio-brcmstb.c | ||
| 3426 | F: Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.txt | 3425 | F: Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.txt |
| 3426 | F: drivers/gpio/gpio-brcmstb.c | ||
| 3427 | 3427 | ||
| 3428 | BROADCOM BRCMSTB I2C DRIVER | 3428 | BROADCOM BRCMSTB I2C DRIVER |
| 3429 | M: Kamal Dasu <kdasu.kdev@gmail.com> | 3429 | M: Kamal Dasu <kdasu.kdev@gmail.com> |
| @@ -3481,8 +3481,8 @@ BROADCOM KONA GPIO DRIVER · 51 unmodified lines | |||
| 3481 | M: Ray Jui <rjui@broadcom.com> | 3481 | M: Ray Jui <rjui@broadcom.com> |
| 3482 | L: bcm-kernel-feedback-list@broadcom.com | 3482 | L: bcm-kernel-feedback-list@broadcom.com |
| 3483 | S: Supported | 3483 | S: Supported |
| 3484 | F: drivers/gpio/gpio-bcm-kona.c | ||
| 3485 | F: Documentation/devicetree/bindings/gpio/brcm,kona-gpio.txt | 3484 | F: Documentation/devicetree/bindings/gpio/brcm,kona-gpio.txt |
| 3485 | F: drivers/gpio/gpio-bcm-kona.c | ||
| 3486 | 3486 | ||
| 3487 | BROADCOM NETXTREME-E ROCE DRIVER | 3487 | BROADCOM NETXTREME-E ROCE DRIVER |
| 3488 | M: Selvin Xavier <selvin.xavier@broadcom.com> | 3488 | M: Selvin Xavier <selvin.xavier@broadcom.com> |
| @@ -3597,8 +3597,8 @@ F: sound/pci/bt87x.c · 108 unmodified lines | |||
| 3597 | 3597 | ||
| 3598 | BT8XXGPIO DRIVER | 3598 | BT8XXGPIO DRIVER |
| 3599 | M: Michael Buesch <m@bues.ch> | 3599 | M: Michael Buesch <m@bues.ch> |
| 3600 | W: http://bu3sch.de/btgpio.php | ||
| 3601 | S: Maintained | 3600 | S: Maintained |
| 3601 | W: http://bu3sch.de/btgpio.php | ||
| 3602 | F: drivers/gpio/gpio-bt8xx.c | 3602 | F: drivers/gpio/gpio-bt8xx.c |
| 3603 | 3603 | ||
| 3604 | BTRFS FILE SYSTEM | 3604 | BTRFS FILE SYSTEM |
| @@ -3649,6 +3649,7 @@ F: sound/pci/oxygen/ · 44 unmodified lines | |||
| 3649 | 3649 | ||
| 3650 | C-SKY ARCHITECTURE | 3650 | C-SKY ARCHITECTURE |
| 3651 | M: Guo Ren <guoren@kernel.org> | 3651 | M: Guo Ren <guoren@kernel.org> |
| 3652 | L: linux-csky@vger.kernel.org | ||
| 3652 | T: git https://github.com/c-sky/csky-linux.git | 3653 | T: git https://github.com/c-sky/csky-linux.git |
| 3653 | S: Supported | 3654 | S: Supported |
| 3654 | F: arch/csky/ | 3655 | F: arch/csky/ |
| @@ -3909,7 +3910,7 @@ S: Supported · 254 unmodified lines | |||
| 3909 | F: Documentation/filesystems/ceph.txt | 3910 | F: Documentation/filesystems/ceph.txt |
| 3910 | F: fs/ceph/ | 3911 | F: fs/ceph/ |
| 3911 | 3912 | ||
| 3912 | CERTIFICATE HANDLING: | 3913 | CERTIFICATE HANDLING |
| 3913 | M: David Howells <dhowells@redhat.com> | 3914 | M: David Howells <dhowells@redhat.com> |
| 3914 | M: David Woodhouse <dwmw2@infradead.org> | 3915 | M: David Woodhouse <dwmw2@infradead.org> |
| 3915 | L: keyrings@vger.kernel.org | 3916 | L: keyrings@vger.kernel.org |
| @@ -3919,7 +3920,7 @@ F: certs/ · 3 unmodified lines | |||
| 3919 | F: scripts/sign-file.c | 3920 | F: scripts/sign-file.c |
| 3920 | F: scripts/extract-cert.c | 3921 | F: scripts/extract-cert.c |
| 3921 | 3922 | ||
| 3922 | CERTIFIED WIRELESS USB (WUSB) SUBSYSTEM: | 3923 | CERTIFIED WIRELESS USB (WUSB) SUBSYSTEM |
| 3923 | L: devel@driverdev.osuosl.org | 3924 | L: devel@driverdev.osuosl.org |
| 3924 | S: Obsolete | 3925 | S: Obsolete |
| 3925 | F: drivers/staging/wusbcore/ | 3926 | F: drivers/staging/wusbcore/ |
| @@ -5932,12 +5933,12 @@ S: Maintained · 2006 unmodified lines | |||
| 5932 | F: drivers/media/dvb-frontends/ec100* | 5933 | F: drivers/media/dvb-frontends/ec100* |
| 5933 | 5934 | ||
| 5934 | ECRYPT FILE SYSTEM | 5935 | ECRYPT FILE SYSTEM |
| 5935 | M: Tyler Hicks <tyhicks@canonical.com> | 5936 | M: Tyler Hicks <code@tyhicks.com> |
| 5936 | L: ecryptfs@vger.kernel.org | 5937 | L: ecryptfs@vger.kernel.org |
| 5937 | W: http://ecryptfs.org | 5938 | W: http://ecryptfs.org |
| 5938 | W: https://launchpad.net/ecryptfs | 5939 | W: https://launchpad.net/ecryptfs |
| 5939 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs.git | 5940 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs.git |
| 5940 | S: Supported | 5941 | S: Odd Fixes |
| 5941 | F: Documentation/filesystems/ecryptfs.txt | 5942 | F: Documentation/filesystems/ecryptfs.txt |
| 5942 | F: fs/ecryptfs/ | 5943 | F: fs/ecryptfs/ |
| 5943 | 5944 | ||
| @@ -7047,7 +7048,7 @@ L: kvm@vger.kernel.org · 1103 unmodified lines | |||
| 7047 | S: Supported | 7048 | S: Supported |
| 7048 | F: drivers/uio/uio_pci_generic.c | 7049 | F: drivers/uio/uio_pci_generic.c |
| 7049 | 7050 | ||
| 7050 | GENERIC VDSO LIBRARY: | 7051 | GENERIC VDSO LIBRARY |
| 7051 | M: Andy Lutomirski <luto@kernel.org> | 7052 | M: Andy Lutomirski <luto@kernel.org> |
| 7052 | M: Thomas Gleixner <tglx@linutronix.de> | 7053 | M: Thomas Gleixner <tglx@linutronix.de> |
| 7053 | M: Vincenzo Frascino <vincenzo.frascino@arm.com> | 7054 | M: Vincenzo Frascino <vincenzo.frascino@arm.com> |
| @@ -7143,18 +7144,18 @@ GPIO SUBSYSTEM · 89 unmodified lines | |||
| 7143 | M: Linus Walleij <linus.walleij@linaro.org> | 7144 | M: Linus Walleij <linus.walleij@linaro.org> |
| 7144 | M: Bartosz Golaszewski <bgolaszewski@baylibre.com> | 7145 | M: Bartosz Golaszewski <bgolaszewski@baylibre.com> |
| 7145 | L: linux-gpio@vger.kernel.org | 7146 | L: linux-gpio@vger.kernel.org |
| 7146 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git | ||
| 7147 | S: Maintained | 7147 | S: Maintained |
| 7148 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git | ||
| 7149 | F: Documentation/ABI/obsolete/sysfs-gpio | ||
| 7150 | F: Documentation/ABI/testing/gpio-cdev | ||
| 7151 | F: Documentation/admin-guide/gpio/ | ||
| 7148 | F: Documentation/devicetree/bindings/gpio/ | 7152 | F: Documentation/devicetree/bindings/gpio/ |
| 7149 | F: Documentation/driver-api/gpio/ | 7153 | F: Documentation/driver-api/gpio/ |
| 7150 | F: Documentation/admin-guide/gpio/ | ||
| 7151 | F: Documentation/ABI/testing/gpio-cdev | ||
| 7152 | F: Documentation/ABI/obsolete/sysfs-gpio | ||
| 7153 | F: drivers/gpio/ | 7154 | F: drivers/gpio/ |
| 7155 | F: include/asm-generic/gpio.h | ||
| 7154 | F: include/linux/gpio/ | 7156 | F: include/linux/gpio/ |
| 7155 | F: include/linux/gpio.h | 7157 | F: include/linux/gpio.h |
| 7156 | F: include/linux/of_gpio.h | 7158 | F: include/linux/of_gpio.h |
| 7157 | F: include/asm-generic/gpio.h | ||
| 7158 | F: include/uapi/linux/gpio.h | 7159 | F: include/uapi/linux/gpio.h |
| 7159 | F: tools/gpio/ | 7160 | F: tools/gpio/ |
| 7160 | 7161 | ||
| @@ -8055,8 +8056,8 @@ F: drivers/scsi/ips.* · 894 unmodified lines | |||
| 8055 | ICH LPC AND GPIO DRIVER | 8056 | ICH LPC AND GPIO DRIVER |
| 8056 | M: Peter Tyser <ptyser@xes-inc.com> | 8057 | M: Peter Tyser <ptyser@xes-inc.com> |
| 8057 | S: Maintained | 8058 | S: Maintained |
| 8058 | F: drivers/mfd/lpc_ich.c | ||
| 8059 | F: drivers/gpio/gpio-ich.c | 8059 | F: drivers/gpio/gpio-ich.c |
| 8060 | F: drivers/mfd/lpc_ich.c | ||
| 8060 | 8061 | ||
| 8061 | ICY I2C DRIVER | 8062 | ICY I2C DRIVER |
| 8062 | M: Max Staudt <max@enpas.org> | 8063 | M: Max Staudt <max@enpas.org> |
| @@ -8392,7 +8393,7 @@ M: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> · 329 unmodified lines | |||
| 8392 | M: Rodrigo Vivi <rodrigo.vivi@intel.com> | 8393 | M: Rodrigo Vivi <rodrigo.vivi@intel.com> |
| 8393 | L: intel-gfx@lists.freedesktop.org | 8394 | L: intel-gfx@lists.freedesktop.org |
| 8394 | W: https://01.org/linuxgraphics/ | 8395 | W: https://01.org/linuxgraphics/ |
| 8395 | B: https://01.org/linuxgraphics/documentation/how-report-bugs | 8396 | B: https://gitlab.freedesktop.org/drm/intel/-/wikis/How-to-file-i915-bugs |
| 8396 | C: irc://chat.freenode.net/intel-gfx | 8397 | C: irc://chat.freenode.net/intel-gfx |
| 8397 | Q: http://patchwork.freedesktop.org/project/intel-gfx/ | 8398 | Q: http://patchwork.freedesktop.org/project/intel-gfx/ |
| 8398 | T: git git://anongit.freedesktop.org/drm-intel | 8399 | T: git git://anongit.freedesktop.org/drm-intel |
| @@ -9278,7 +9279,7 @@ F: include/keys/trusted-type.h · 879 unmodified lines | |||
| 9278 | F: security/keys/trusted.c | 9279 | F: security/keys/trusted.c |
| 9279 | F: include/keys/trusted.h | 9280 | F: include/keys/trusted.h |
| 9280 | 9281 | ||
| 9281 | KEYS/KEYRINGS: | 9282 | KEYS/KEYRINGS |
| 9282 | M: David Howells <dhowells@redhat.com> | 9283 | M: David Howells <dhowells@redhat.com> |
| 9283 | M: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 9284 | M: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
| 9284 | L: keyrings@vger.kernel.org | 9285 | L: keyrings@vger.kernel.org |
| @@ -11114,14 +11115,12 @@ S: Maintained · 1829 unmodified lines | |||
| 11114 | F: drivers/usb/image/microtek.* | 11115 | F: drivers/usb/image/microtek.* |
| 11115 | 11116 | ||
| 11116 | MIPS | 11117 | MIPS |
| 11117 | M: Ralf Baechle <ralf@linux-mips.org> | 11118 | M: Thomas Bogendoerfer <tsbogend@alpha.franken.de> |
| 11118 | M: Paul Burton <paulburton@kernel.org> | ||
| 11119 | L: linux-mips@vger.kernel.org | 11119 | L: linux-mips@vger.kernel.org |
| 11120 | W: http://www.linux-mips.org/ | 11120 | W: http://www.linux-mips.org/ |
| 11121 | T: git git://git.linux-mips.org/pub/scm/ralf/linux.git | ||
| 11122 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git | 11121 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git |
| 11123 | Q: http://patchwork.linux-mips.org/project/linux-mips/list/ | 11122 | Q: http://patchwork.linux-mips.org/project/linux-mips/list/ |
| 11124 | S: Supported | 11123 | S: Maintained |
| 11125 | F: Documentation/devicetree/bindings/mips/ | 11124 | F: Documentation/devicetree/bindings/mips/ |
| 11126 | F: Documentation/mips/ | 11125 | F: Documentation/mips/ |
| 11127 | F: arch/mips/ | 11126 | F: arch/mips/ |
| @@ -11485,7 +11484,7 @@ F: drivers/scsi/mac_scsi.* · 357 unmodified lines | |||
| 11485 | F: drivers/scsi/sun3_scsi.* | 11484 | F: drivers/scsi/sun3_scsi.* |
| 11486 | F: drivers/scsi/sun3_scsi_vme.c | 11485 | F: drivers/scsi/sun3_scsi_vme.c |
| 11487 | 11486 | ||
| 11488 | NCSI LIBRARY: | 11487 | NCSI LIBRARY |
| 11489 | M: Samuel Mendoza-Jonas <sam@mendozajonas.com> | 11488 | M: Samuel Mendoza-Jonas <sam@mendozajonas.com> |
| 11490 | S: Maintained | 11489 | S: Maintained |
| 11491 | F: net/ncsi/ | 11490 | F: net/ncsi/ |
| @@ -12741,7 +12740,7 @@ M: Tom Joseph <tjoseph@cadence.com> · 1249 unmodified lines | |||
| 12741 | L: linux-pci@vger.kernel.org | 12740 | L: linux-pci@vger.kernel.org |
| 12742 | S: Maintained | 12741 | S: Maintained |
| 12743 | F: Documentation/devicetree/bindings/pci/cdns,*.txt | 12742 | F: Documentation/devicetree/bindings/pci/cdns,*.txt |
| 12744 | F: drivers/pci/controller/pcie-cadence* | 12743 | F: drivers/pci/controller/cadence/ |
| 12745 | 12744 | ||
| 12746 | PCI DRIVER FOR FREESCALE LAYERSCAPE | 12745 | PCI DRIVER FOR FREESCALE LAYERSCAPE |
| 12747 | M: Minghuan Lian <minghuan.Lian@nxp.com> | 12746 | M: Minghuan Lian <minghuan.Lian@nxp.com> |
| @@ -13513,7 +13512,7 @@ L: linuxppc-dev@lists.ozlabs.org · 765 unmodified lines | |||
| 13513 | S: Maintained | 13512 | S: Maintained |
| 13514 | F: drivers/block/ps3vram.c | 13513 | F: drivers/block/ps3vram.c |
| 13515 | 13514 | ||
| 13516 | PSAMPLE PACKET SAMPLING SUPPORT: | 13515 | PSAMPLE PACKET SAMPLING SUPPORT |
| 13517 | M: Yotam Gigi <yotam.gi@gmail.com> | 13516 | M: Yotam Gigi <yotam.gi@gmail.com> |
| 13518 | S: Maintained | 13517 | S: Maintained |
| 13519 | F: net/psample | 13518 | F: net/psample |
| @@ -14583,10 +14582,10 @@ F: drivers/media/pci/saa7146/ · 1063 unmodified lines | |||
| 14583 | F: include/media/drv-intf/saa7146* | 14582 | F: include/media/drv-intf/saa7146* |
| 14584 | 14583 | ||
| 14585 | SAFESETID SECURITY MODULE | 14584 | SAFESETID SECURITY MODULE |
| 14586 | M: Micah Morton <mortonm@chromium.org> | 14585 | M: Micah Morton <mortonm@chromium.org> |
| 14587 | S: Supported | 14586 | S: Supported |
| 14588 | F: security/safesetid/ | 14587 | F: security/safesetid/ |
| 14589 | F: Documentation/admin-guide/LSM/SafeSetID.rst | 14588 | F: Documentation/admin-guide/LSM/SafeSetID.rst |
| 14590 | 14589 | ||
| 14591 | SAMSUNG AUDIO (ASoC) DRIVERS | 14590 | SAMSUNG AUDIO (ASoC) DRIVERS |
| 14592 | M: Krzysztof Kozlowski <krzk@kernel.org> | 14591 | M: Krzysztof Kozlowski <krzk@kernel.org> |
| @@ -16076,8 +16075,8 @@ F: Documentation/devicetree/bindings/reset/snps,axs10x-reset.txt · 1483 unmodified lines | |||
| 16076 | SYNOPSYS CREG GPIO DRIVER | 16075 | SYNOPSYS CREG GPIO DRIVER |
| 16077 | M: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> | 16076 | M: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> |
| 16078 | S: Maintained | 16077 | S: Maintained |
| 16079 | F: drivers/gpio/gpio-creg-snps.c | ||
| 16080 | F: Documentation/devicetree/bindings/gpio/snps,creg-gpio.txt | 16078 | F: Documentation/devicetree/bindings/gpio/snps,creg-gpio.txt |
| 16079 | F: drivers/gpio/gpio-creg-snps.c | ||
| 16081 | 16080 | ||
| 16082 | SYNOPSYS DESIGNWARE 8250 UART DRIVER | 16081 | SYNOPSYS DESIGNWARE 8250 UART DRIVER |
| 16083 | R: Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 16082 | R: Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
| @@ -16088,8 +16087,8 @@ SYNOPSYS DESIGNWARE APB GPIO DRIVER · 4 unmodified lines | |||
| 16088 | M: Hoan Tran <hoan@os.amperecomputing.com> | 16087 | M: Hoan Tran <hoan@os.amperecomputing.com> |
| 16089 | L: linux-gpio@vger.kernel.org | 16088 | L: linux-gpio@vger.kernel.org |
| 16090 | S: Maintained | 16089 | S: Maintained |
| 16091 | F: drivers/gpio/gpio-dwapb.c | ||
| 16092 | F: Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt | 16090 | F: Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt |
| 16091 | F: drivers/gpio/gpio-dwapb.c | ||
| 16093 | 16092 | ||
| 16094 | SYNOPSYS DESIGNWARE AXI DMAC DRIVER | 16093 | SYNOPSYS DESIGNWARE AXI DMAC DRIVER |
| 16095 | M: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> | 16094 | M: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> |
| @@ -16553,8 +16552,8 @@ M: Michael Jamet <michael.jamet@intel.com> · 457 unmodified lines | |||
| 16553 | M: Mika Westerberg <mika.westerberg@linux.intel.com> | 16552 | M: Mika Westerberg <mika.westerberg@linux.intel.com> |
| 16554 | M: Yehezkel Bernat <YehezkelShB@gmail.com> | 16553 | M: Yehezkel Bernat <YehezkelShB@gmail.com> |
| 16555 | L: linux-usb@vger.kernel.org | 16554 | L: linux-usb@vger.kernel.org |
| 16556 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt.git | ||
| 16557 | S: Maintained | 16555 | S: Maintained |
| 16556 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt.git | ||
| 16558 | F: Documentation/admin-guide/thunderbolt.rst | 16557 | F: Documentation/admin-guide/thunderbolt.rst |
| 16559 | F: drivers/thunderbolt/ | 16558 | F: drivers/thunderbolt/ |
| 16560 | F: include/linux/thunderbolt.h | 16559 | F: include/linux/thunderbolt.h |
| @@ -17081,7 +17080,7 @@ S: Maintained · 520 unmodified lines | |||
| 17081 | F: Documentation/admin-guide/ufs.rst | 17080 | F: Documentation/admin-guide/ufs.rst |
| 17082 | F: fs/ufs/ | 17081 | F: fs/ufs/ |
| 17083 | 17082 | ||
| 17084 | UHID USERSPACE HID IO DRIVER: | 17083 | UHID USERSPACE HID IO DRIVER |
| 17085 | M: David Herrmann <dh.herrmann@googlemail.com> | 17084 | M: David Herrmann <dh.herrmann@googlemail.com> |
| 17086 | L: linux-input@vger.kernel.org | 17085 | L: linux-input@vger.kernel.org |
| 17087 | S: Maintained | 17086 | S: Maintained |
| @@ -17095,18 +17094,18 @@ S: Maintained · 7 unmodified lines | |||
| 17095 | F: drivers/usb/common/ulpi.c | 17094 | F: drivers/usb/common/ulpi.c |
| 17096 | F: include/linux/ulpi/ | 17095 | F: include/linux/ulpi/ |
| 17097 | 17096 | ||
| 17098 | ULTRA-WIDEBAND (UWB) SUBSYSTEM: | 17097 | ULTRA-WIDEBAND (UWB) SUBSYSTEM |
| 17099 | L: devel@driverdev.osuosl.org | 17098 | L: devel@driverdev.osuosl.org |
| 17100 | S: Obsolete | 17099 | S: Obsolete |
| 17101 | F: drivers/staging/uwb/ | 17100 | F: drivers/staging/uwb/ |
| 17102 | 17101 | ||
| 17103 | UNICODE SUBSYSTEM: | 17102 | UNICODE SUBSYSTEM |
| 17104 | M: Gabriel Krisman Bertazi <krisman@collabora.com> | 17103 | M: Gabriel Krisman Bertazi <krisman@collabora.com> |
| 17105 | L: linux-fsdevel@vger.kernel.org | 17104 | L: linux-fsdevel@vger.kernel.org |
| 17106 | S: Supported | 17105 | S: Supported |
| 17107 | F: fs/unicode/ | 17106 | F: fs/unicode/ |
| 17108 | 17107 | ||
| 17109 | UNICORE32 ARCHITECTURE: | 17108 | UNICORE32 ARCHITECTURE |
| 17110 | M: Guan Xuetao <gxt@pku.edu.cn> | 17109 | M: Guan Xuetao <gxt@pku.edu.cn> |
| 17111 | W: http://mprc.pku.edu.cn/~guanxuetao/linux | 17110 | W: http://mprc.pku.edu.cn/~guanxuetao/linux |
| 17112 | S: Maintained | 17111 | S: Maintained |
| @@ -17393,11 +17392,14 @@ F: drivers/usb/ · 280 unmodified lines | |||
| 17393 | F: include/linux/usb.h | 17392 | F: include/linux/usb.h |
| 17394 | F: include/linux/usb/ | 17393 | F: include/linux/usb/ |
| 17395 | 17394 | ||
| 17396 | USB TYPEC PI3USB30532 MUX DRIVER | 17395 | USB TYPEC BUS FOR ALTERNATE MODES |
| 17397 | M: Hans de Goede <hdegoede@redhat.com> | 17396 | M: Heikki Krogerus <heikki.krogerus@linux.intel.com> |
| 17398 | L: linux-usb@vger.kernel.org | 17397 | L: linux-usb@vger.kernel.org |
| 17399 | S: Maintained | 17398 | S: Maintained |
| 17400 | F: drivers/usb/typec/mux/pi3usb30532.c | 17399 | F: Documentation/ABI/testing/sysfs-bus-typec |
| 17400 | F: Documentation/driver-api/usb/typec_bus.rst | ||
| 17401 | F: drivers/usb/typec/altmodes/ | ||
| 17402 | F: include/linux/usb/typec_altmode.h | ||
| 17401 | 17403 | ||
| 17402 | USB TYPEC CLASS | 17404 | USB TYPEC CLASS |
| 17403 | M: Heikki Krogerus <heikki.krogerus@linux.intel.com> | 17405 | M: Heikki Krogerus <heikki.krogerus@linux.intel.com> |
| @@ -17408,14 +17410,11 @@ F: Documentation/driver-api/usb/typec.rst · 4 unmodified lines | |||
| 17408 | F: drivers/usb/typec/ | 17410 | F: drivers/usb/typec/ |
| 17409 | F: include/linux/usb/typec.h | 17411 | F: include/linux/usb/typec.h |
| 17410 | 17412 | ||
| 17411 | USB TYPEC BUS FOR ALTERNATE MODES | 17413 | USB TYPEC PI3USB30532 MUX DRIVER |
| 17412 | M: Heikki Krogerus <heikki.krogerus@linux.intel.com> | 17414 | M: Hans de Goede <hdegoede@redhat.com> |
| 17413 | L: linux-usb@vger.kernel.org | 17415 | L: linux-usb@vger.kernel.org |
| 17414 | S: Maintained | 17416 | S: Maintained |
| 17415 | F: Documentation/ABI/testing/sysfs-bus-typec | 17417 | F: drivers/usb/typec/mux/pi3usb30532.c |
| 17416 | F: Documentation/driver-api/usb/typec_bus.rst | ||
| 17417 | F: drivers/usb/typec/altmodes/ | ||
| 17418 | F: include/linux/usb/typec_altmode.h | ||
| 17419 | 17418 | ||
| 17420 | USB TYPEC PORT CONTROLLER DRIVERS | 17419 | USB TYPEC PORT CONTROLLER DRIVERS |
| 17421 | M: Guenter Roeck <linux@roeck-us.net> | 17420 | M: Guenter Roeck <linux@roeck-us.net> |
| @@ -17792,7 +17791,7 @@ F: include/linux/vbox_utils.h · 370 unmodified lines | |||
| 17792 | F: include/uapi/linux/vbox*.h | 17791 | F: include/uapi/linux/vbox*.h |
| 17793 | F: drivers/virt/vboxguest/ | 17792 | F: drivers/virt/vboxguest/ |
| 17794 | 17793 | ||
| 17795 | VIRTUAL BOX SHARED FOLDER VFS DRIVER: | 17794 | VIRTUAL BOX SHARED FOLDER VFS DRIVER |
| 17796 | M: Hans de Goede <hdegoede@redhat.com> | 17795 | M: Hans de Goede <hdegoede@redhat.com> |
| 17797 | L: linux-fsdevel@vger.kernel.org | 17796 | L: linux-fsdevel@vger.kernel.org |
| 17798 | S: Maintained | 17797 | S: Maintained |
| @@ -18415,8 +18414,8 @@ M: Nandor Han <nandor.han@ge.com> · 616 unmodified lines | |||
| 18415 | M: Semi Malinen <semi.malinen@ge.com> | 18414 | M: Semi Malinen <semi.malinen@ge.com> |
| 18416 | L: linux-gpio@vger.kernel.org | 18415 | L: linux-gpio@vger.kernel.org |
| 18417 | S: Maintained | 18416 | S: Maintained |
| 18418 | F: drivers/gpio/gpio-xra1403.c | ||
| 18419 | F: Documentation/devicetree/bindings/gpio/gpio-xra1403.txt | 18417 | F: Documentation/devicetree/bindings/gpio/gpio-xra1403.txt |
| 18418 | F: drivers/gpio/gpio-xra1403.c | ||
| 18420 | 18419 | ||
| 18421 | XTENSA XTFPGA PLATFORM SUPPORT | 18420 | XTENSA XTFPGA PLATFORM SUPPORT |
| 18422 | M: Max Filippov <jcmvbkbc@gmail.com> | 18421 | M: Max Filippov <jcmvbkbc@gmail.com> |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | VERSION = 5 | 2 | VERSION = 5 |
| 3 | PATCHLEVEL = 6 | 3 | PATCHLEVEL = 6 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc1 | 5 | EXTRAVERSION = -rc4 |
| 6 | NAME = Kleptomaniac Octopus | 6 | NAME = Kleptomaniac Octopus |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
| @@ -68,6 +68,7 @@ unexport GREP_OPTIONS · 59 unmodified lines | |||
| 68 | # | 68 | # |
| 69 | # If KBUILD_VERBOSE equals 0 then the above command will be hidden. | 69 | # If KBUILD_VERBOSE equals 0 then the above command will be hidden. |
| 70 | # If KBUILD_VERBOSE equals 1 then the above command is displayed. | 70 | # If KBUILD_VERBOSE equals 1 then the above command is displayed. |
| 71 | # If KBUILD_VERBOSE equals 2 then give the reason why each target is rebuilt. | ||
| 71 | # | 72 | # |
| 72 | # To put more focus on warnings, be less verbose as default | 73 | # To put more focus on warnings, be less verbose as default |
| 73 | # Use 'make V=1' to see the full commands | 74 | # Use 'make V=1' to see the full commands |
| @@ -1238,7 +1239,7 @@ ifneq ($(dtstree),) · 1164 unmodified lines | |||
| 1238 | %.dtb: include/config/kernel.release scripts_dtc | 1239 | %.dtb: include/config/kernel.release scripts_dtc |
| 1239 | $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ | 1240 | $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ |
| 1240 | 1241 | ||
| 1241 | PHONY += dtbs dtbs_install dt_binding_check | 1242 | PHONY += dtbs dtbs_install dtbs_check |
| 1242 | dtbs dtbs_check: include/config/kernel.release scripts_dtc | 1243 | dtbs dtbs_check: include/config/kernel.release scripts_dtc |
| 1243 | $(Q)$(MAKE) $(build)=$(dtstree) | 1244 | $(Q)$(MAKE) $(build)=$(dtstree) |
| 1244 | 1245 | ||
| @@ -1258,6 +1259,7 @@ PHONY += scripts_dtc · 13 unmodified lines | |||
| 1258 | scripts_dtc: scripts_basic | 1259 | scripts_dtc: scripts_basic |
| 1259 | $(Q)$(MAKE) $(build)=scripts/dtc | 1260 | $(Q)$(MAKE) $(build)=scripts/dtc |
| 1260 | 1261 | ||
| 1262 | PHONY += dt_binding_check | ||
| 1261 | dt_binding_check: scripts_dtc | 1263 | dt_binding_check: scripts_dtc |
| 1262 | $(Q)$(MAKE) $(build)=Documentation/devicetree/bindings | 1264 | $(Q)$(MAKE) $(build)=Documentation/devicetree/bindings |
| 1263 | 1265 | ||
| @@ -178,9 +178,6 @@ · 177 unmodified lines | |||
| 178 | phy-mode = "rgmii"; | 178 | phy-mode = "rgmii"; |
| 179 | pinctrl-0 = <&pinctrl_rgmii1 &pinctrl_rgmii1_mdio_1>; | 179 | pinctrl-0 = <&pinctrl_rgmii1 &pinctrl_rgmii1_mdio_1>; |
| 180 | 180 | ||
| 181 | snps,phy-bus-name = "stmmac"; | ||
| 182 | snps,phy-bus-id = <0>; | ||
| 183 | snps,phy-addr = <0>; | ||
| 184 | snps,reset-gpio = <&pio0 7 0>; | 181 | snps,reset-gpio = <&pio0 7 0>; |
| 185 | snps,reset-active-low; | 182 | snps,reset-active-low; |
| 186 | snps,reset-delays-us = <0 10000 1000000>; | 183 | snps,reset-delays-us = <0 10000 1000000>; |
| @@ -46,7 +46,7 @@ · 45 unmodified lines | |||
| 46 | /* DAC */ | 46 | /* DAC */ |
| 47 | format = "i2s"; | 47 | format = "i2s"; |
| 48 | mclk-fs = <256>; | 48 | mclk-fs = <256>; |
| 49 | frame-inversion = <1>; | 49 | frame-inversion; |
| 50 | cpu { | 50 | cpu { |
| 51 | sound-dai = <&sti_uni_player2>; | 51 | sound-dai = <&sti_uni_player2>; |
| 52 | }; | 52 | }; |
| @@ -11,8 +11,6 @@ CONFIG_SLAB=y · 10 unmodified lines | |||
| 11 | CONFIG_MODULES=y | 11 | CONFIG_MODULES=y |
| 12 | CONFIG_MODULE_UNLOAD=y | 12 | CONFIG_MODULE_UNLOAD=y |
| 13 | # CONFIG_BLK_DEV_BSG is not set | 13 | # CONFIG_BLK_DEV_BSG is not set |
| 14 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 15 | # CONFIG_IOSCHED_CFQ is not set | ||
| 16 | CONFIG_ARCH_PXA=y | 14 | CONFIG_ARCH_PXA=y |
| 17 | CONFIG_ARCH_GUMSTIX=y | 15 | CONFIG_ARCH_GUMSTIX=y |
| 18 | CONFIG_PCCARD=y | 16 | CONFIG_PCCARD=y |
| @@ -25,7 +25,6 @@ CONFIG_EMBEDDED=y · 24 unmodified lines | |||
| 25 | CONFIG_PROFILING=y | 25 | CONFIG_PROFILING=y |
| 26 | CONFIG_MODULES=y | 26 | CONFIG_MODULES=y |
| 27 | CONFIG_MODULE_UNLOAD=y | 27 | CONFIG_MODULE_UNLOAD=y |
| 28 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 29 | CONFIG_ARCH_AXXIA=y | 28 | CONFIG_ARCH_AXXIA=y |
| 30 | CONFIG_GPIO_PCA953X=y | 29 | CONFIG_GPIO_PCA953X=y |
| 31 | CONFIG_ARM_LPAE=y | 30 | CONFIG_ARM_LPAE=y |
| @@ -7,7 +7,6 @@ CONFIG_EMBEDDED=y · 6 unmodified lines | |||
| 7 | CONFIG_SLOB=y | 7 | CONFIG_SLOB=y |
| 8 | CONFIG_JUMP_LABEL=y | 8 | CONFIG_JUMP_LABEL=y |
| 9 | CONFIG_PARTITION_ADVANCED=y | 9 | CONFIG_PARTITION_ADVANCED=y |
| 10 | # CONFIG_IOSCHED_CFQ is not set | ||
| 11 | CONFIG_ARCH_CLPS711X=y | 10 | CONFIG_ARCH_CLPS711X=y |
| 12 | CONFIG_ARCH_AUTCPU12=y | 11 | CONFIG_ARCH_AUTCPU12=y |
| 13 | CONFIG_ARCH_CDB89712=y | 12 | CONFIG_ARCH_CDB89712=y |
| @@ -17,7 +17,7 @@ CONFIG_MODULE_UNLOAD=y · 16 unmodified lines | |||
| 17 | CONFIG_MODULE_FORCE_UNLOAD=y | 17 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 18 | CONFIG_MODVERSIONS=y | 18 | CONFIG_MODVERSIONS=y |
| 19 | # CONFIG_BLK_DEV_BSG is not set | 19 | # CONFIG_BLK_DEV_BSG is not set |
| 20 | CONFIG_IOSCHED_CFQ=m | 20 | CONFIG_IOSCHED_BFQ=m |
| 21 | CONFIG_ARCH_MULTI_V6=y | 21 | CONFIG_ARCH_MULTI_V6=y |
| 22 | #CONFIG_ARCH_MULTI_V7 is not set | 22 | #CONFIG_ARCH_MULTI_V7 is not set |
| 23 | CONFIG_ARCH_CNS3XXX=y | 23 | CONFIG_ARCH_CNS3XXX=y |
| @@ -43,7 +43,6 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y · 42 unmodified lines | |||
| 43 | CONFIG_USB_MON=y | 43 | CONFIG_USB_MON=y |
| 44 | CONFIG_USB_STORAGE=y | 44 | CONFIG_USB_STORAGE=y |
| 45 | CONFIG_MMC=y | 45 | CONFIG_MMC=y |
| 46 | # CONFIG_MMC_BLOCK_BOUNCE is not set | ||
| 47 | CONFIG_MMC_PXA=y | 46 | CONFIG_MMC_PXA=y |
| 48 | CONFIG_EXT3_FS=y | 47 | CONFIG_EXT3_FS=y |
| 49 | CONFIG_NFS_FS=y | 48 | CONFIG_NFS_FS=y |
| @@ -7,8 +7,6 @@ CONFIG_EXPERT=y · 6 unmodified lines | |||
| 7 | # CONFIG_BASE_FULL is not set | 7 | # CONFIG_BASE_FULL is not set |
| 8 | # CONFIG_EPOLL is not set | 8 | # CONFIG_EPOLL is not set |
| 9 | CONFIG_SLOB=y | 9 | CONFIG_SLOB=y |
| 10 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 11 | # CONFIG_IOSCHED_CFQ is not set | ||
| 12 | CONFIG_ARCH_SA1100=y | 10 | CONFIG_ARCH_SA1100=y |
| 13 | CONFIG_SA1100_COLLIE=y | 11 | CONFIG_SA1100_COLLIE=y |
| 14 | CONFIG_PCCARD=y | 12 | CONFIG_PCCARD=y |
| @@ -15,8 +15,6 @@ CONFIG_MODULE_UNLOAD=y · 14 unmodified lines | |||
| 15 | CONFIG_MODULE_FORCE_UNLOAD=y | 15 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 16 | CONFIG_MODVERSIONS=y | 16 | CONFIG_MODVERSIONS=y |
| 17 | CONFIG_PARTITION_ADVANCED=y | 17 | CONFIG_PARTITION_ADVANCED=y |
| 18 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 19 | # CONFIG_IOSCHED_CFQ is not set | ||
| 20 | CONFIG_ARCH_MULTIPLATFORM=y | 18 | CONFIG_ARCH_MULTIPLATFORM=y |
| 21 | CONFIG_ARCH_MULTI_V7=n | 19 | CONFIG_ARCH_MULTI_V7=n |
| 22 | CONFIG_ARCH_MULTI_V5=y | 20 | CONFIG_ARCH_MULTI_V5=y |
| @@ -12,8 +12,6 @@ CONFIG_EMBEDDED=y · 11 unmodified lines | |||
| 12 | # CONFIG_VM_EVENT_COUNTERS is not set | 12 | # CONFIG_VM_EVENT_COUNTERS is not set |
| 13 | # CONFIG_SLUB_DEBUG is not set | 13 | # CONFIG_SLUB_DEBUG is not set |
| 14 | # CONFIG_BLK_DEV_BSG is not set | 14 | # CONFIG_BLK_DEV_BSG is not set |
| 15 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 16 | # CONFIG_IOSCHED_CFQ is not set | ||
| 17 | # CONFIG_MMU is not set | 15 | # CONFIG_MMU is not set |
| 18 | CONFIG_ARM_SINGLE_ARMV7M=y | 16 | CONFIG_ARM_SINGLE_ARMV7M=y |
| 19 | CONFIG_ARCH_EFM32=y | 17 | CONFIG_ARCH_EFM32=y |
| @@ -11,7 +11,6 @@ CONFIG_MODULE_UNLOAD=y · 10 unmodified lines | |||
| 11 | CONFIG_MODULE_FORCE_UNLOAD=y | 11 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 12 | # CONFIG_BLK_DEV_BSG is not set | 12 | # CONFIG_BLK_DEV_BSG is not set |
| 13 | CONFIG_PARTITION_ADVANCED=y | 13 | CONFIG_PARTITION_ADVANCED=y |
| 14 | # CONFIG_IOSCHED_CFQ is not set | ||
| 15 | CONFIG_ARCH_EP93XX=y | 14 | CONFIG_ARCH_EP93XX=y |
| 16 | CONFIG_CRUNCH=y | 15 | CONFIG_CRUNCH=y |
| 17 | CONFIG_MACH_ADSSPHERE=y | 16 | CONFIG_MACH_ADSSPHERE=y |
| @@ -9,8 +9,6 @@ CONFIG_MODULES=y · 8 unmodified lines | |||
| 9 | CONFIG_MODULE_UNLOAD=y | 9 | CONFIG_MODULE_UNLOAD=y |
| 10 | CONFIG_MODULE_FORCE_UNLOAD=y | 10 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 11 | # CONFIG_BLK_DEV_BSG is not set | 11 | # CONFIG_BLK_DEV_BSG is not set |
| 12 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 13 | # CONFIG_IOSCHED_CFQ is not set | ||
| 14 | CONFIG_ARCH_PXA=y | 12 | CONFIG_ARCH_PXA=y |
| 15 | CONFIG_ARCH_PXA_ESERIES=y | 13 | CONFIG_ARCH_PXA_ESERIES=y |
| 16 | # CONFIG_ARM_THUMB is not set | 14 | # CONFIG_ARM_THUMB is not set |
| @@ -14,7 +14,6 @@ CONFIG_MODULE_UNLOAD=y · 13 unmodified lines | |||
| 14 | CONFIG_MODULE_FORCE_UNLOAD=y | 14 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 15 | CONFIG_MODVERSIONS=y | 15 | CONFIG_MODVERSIONS=y |
| 16 | # CONFIG_BLK_DEV_BSG is not set | 16 | # CONFIG_BLK_DEV_BSG is not set |
| 17 | # CONFIG_IOSCHED_CFQ is not set | ||
| 18 | CONFIG_ARCH_PXA=y | 17 | CONFIG_ARCH_PXA=y |
| 19 | CONFIG_PXA_EZX=y | 18 | CONFIG_PXA_EZX=y |
| 20 | CONFIG_NO_HZ=y | 19 | CONFIG_NO_HZ=y |
| @@ -5,8 +5,6 @@ CONFIG_LOG_BUF_SHIFT=14 · 4 unmodified lines | |||
| 5 | CONFIG_BLK_DEV_INITRD=y | 5 | CONFIG_BLK_DEV_INITRD=y |
| 6 | CONFIG_MODULES=y | 6 | CONFIG_MODULES=y |
| 7 | # CONFIG_BLK_DEV_BSG is not set | 7 | # CONFIG_BLK_DEV_BSG is not set |
| 8 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 9 | # CONFIG_IOSCHED_CFQ is not set | ||
| 10 | CONFIG_ARCH_SA1100=y | 8 | CONFIG_ARCH_SA1100=y |
| 11 | CONFIG_SA1100_H3600=y | 9 | CONFIG_SA1100_H3600=y |
| 12 | CONFIG_PCCARD=y | 10 | CONFIG_PCCARD=y |
| @@ -10,7 +10,6 @@ CONFIG_MODULES=y · 9 unmodified lines | |||
| 10 | CONFIG_MODULE_UNLOAD=y | 10 | CONFIG_MODULE_UNLOAD=y |
| 11 | CONFIG_MODULE_FORCE_UNLOAD=y | 11 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 12 | # CONFIG_BLK_DEV_BSG is not set | 12 | # CONFIG_BLK_DEV_BSG is not set |
| 13 | # CONFIG_IOSCHED_CFQ is not set | ||
| 14 | CONFIG_ARCH_PXA=y | 13 | CONFIG_ARCH_PXA=y |
| 15 | CONFIG_MACH_H5000=y | 14 | CONFIG_MACH_H5000=y |
| 16 | CONFIG_AEABI=y | 15 | CONFIG_AEABI=y |
| @@ -13,7 +13,6 @@ CONFIG_MODULE_UNLOAD=y · 12 unmodified lines | |||
| 13 | CONFIG_MODULE_FORCE_UNLOAD=y | 13 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 14 | CONFIG_MODVERSIONS=y | 14 | CONFIG_MODVERSIONS=y |
| 15 | # CONFIG_BLK_DEV_BSG is not set | 15 | # CONFIG_BLK_DEV_BSG is not set |
| 16 | # CONFIG_IOSCHED_CFQ is not set | ||
| 17 | CONFIG_ARCH_PXA=y | 16 | CONFIG_ARCH_PXA=y |
| 18 | CONFIG_MACH_INTELMOTE2=y | 17 | CONFIG_MACH_INTELMOTE2=y |
| 19 | CONFIG_NO_HZ=y | 18 | CONFIG_NO_HZ=y |
| @@ -32,8 +32,6 @@ CONFIG_KPROBES=y · 31 unmodified lines | |||
| 32 | CONFIG_MODULES=y | 32 | CONFIG_MODULES=y |
| 33 | CONFIG_MODULE_UNLOAD=y | 33 | CONFIG_MODULE_UNLOAD=y |
| 34 | # CONFIG_BLK_DEV_BSG is not set | 34 | # CONFIG_BLK_DEV_BSG is not set |
| 35 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 36 | # CONFIG_IOSCHED_CFQ is not set | ||
| 37 | CONFIG_NET=y | 35 | CONFIG_NET=y |
| 38 | CONFIG_PACKET=y | 36 | CONFIG_PACKET=y |
| 39 | CONFIG_UNIX=y | 37 | CONFIG_UNIX=y |
| @@ -1,4 +1,3 @@ | |||
| 1 | CONFIG_CROSS_COMPILE="arm-linux-gnueabihf-" | ||
| 2 | CONFIG_HIGH_RES_TIMERS=y | 1 | CONFIG_HIGH_RES_TIMERS=y |
| 3 | CONFIG_PREEMPT=y | 2 | CONFIG_PREEMPT=y |
| 4 | CONFIG_BLK_DEV_INITRD=y | 3 | CONFIG_BLK_DEV_INITRD=y |
| @@ -28,10 +27,7 @@ CONFIG_FLASH_SIZE=0x00080000 · 23 unmodified lines | |||
| 28 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 27 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
| 29 | CONFIG_ZBOOT_ROM_BSS=0x0 | 28 | CONFIG_ZBOOT_ROM_BSS=0x0 |
| 30 | CONFIG_ARM_APPENDED_DTB=y | 29 | CONFIG_ARM_APPENDED_DTB=y |
| 31 | # CONFIG_LBDAF is not set | ||
| 32 | # CONFIG_BLK_DEV_BSG is not set | 30 | # CONFIG_BLK_DEV_BSG is not set |
| 33 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 34 | # CONFIG_IOSCHED_CFQ is not set | ||
| 35 | CONFIG_BINFMT_FLAT=y | 31 | CONFIG_BINFMT_FLAT=y |
| 36 | CONFIG_BINFMT_ZFLAT=y | 32 | CONFIG_BINFMT_ZFLAT=y |
| 37 | CONFIG_BINFMT_SHARED_FLAT=y | 33 | CONFIG_BINFMT_SHARED_FLAT=y |
| @@ -9,8 +9,6 @@ CONFIG_SLAB=y · 8 unmodified lines | |||
| 9 | CONFIG_MODULES=y | 9 | CONFIG_MODULES=y |
| 10 | CONFIG_MODULE_UNLOAD=y | 10 | CONFIG_MODULE_UNLOAD=y |
| 11 | # CONFIG_BLK_DEV_BSG is not set | 11 | # CONFIG_BLK_DEV_BSG is not set |
| 12 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 13 | # CONFIG_IOSCHED_CFQ is not set | ||
| 14 | CONFIG_ARCH_PXA=y | 12 | CONFIG_ARCH_PXA=y |
| 15 | CONFIG_MACH_H4700=y | 13 | CONFIG_MACH_H4700=y |
| 16 | CONFIG_MACH_MAGICIAN=y | 14 | CONFIG_MACH_MAGICIAN=y |
| @@ -15,7 +15,6 @@ CONFIG_EMBEDDED=y · 14 unmodified lines | |||
| 15 | # CONFIG_SLUB_DEBUG is not set | 15 | # CONFIG_SLUB_DEBUG is not set |
| 16 | # CONFIG_COMPAT_BRK is not set | 16 | # CONFIG_COMPAT_BRK is not set |
| 17 | # CONFIG_BLK_DEV_BSG is not set | 17 | # CONFIG_BLK_DEV_BSG is not set |
| 18 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 19 | CONFIG_ARCH_MULTI_V4=y | 18 | CONFIG_ARCH_MULTI_V4=y |
| 20 | # CONFIG_ARCH_MULTI_V7 is not set | 19 | # CONFIG_ARCH_MULTI_V7 is not set |
| 21 | CONFIG_ARCH_MOXART=y | 20 | CONFIG_ARCH_MOXART=y |
| @@ -25,8 +25,6 @@ CONFIG_MODULE_UNLOAD=y · 24 unmodified lines | |||
| 25 | CONFIG_MODULE_FORCE_UNLOAD=y | 25 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 26 | CONFIG_MODVERSIONS=y | 26 | CONFIG_MODVERSIONS=y |
| 27 | CONFIG_BLK_DEV_INTEGRITY=y | 27 | CONFIG_BLK_DEV_INTEGRITY=y |
| 28 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 29 | # CONFIG_IOSCHED_CFQ is not set | ||
| 30 | CONFIG_NET=y | 28 | CONFIG_NET=y |
| 31 | CONFIG_PACKET=y | 29 | CONFIG_PACKET=y |
| 32 | CONFIG_UNIX=y | 30 | CONFIG_UNIX=y |
| @@ -18,8 +18,6 @@ CONFIG_MODULES=y · 17 unmodified lines | |||
| 18 | CONFIG_MODULE_UNLOAD=y | 18 | CONFIG_MODULE_UNLOAD=y |
| 19 | CONFIG_MODULE_FORCE_UNLOAD=y | 19 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 20 | # CONFIG_BLK_DEV_BSG is not set | 20 | # CONFIG_BLK_DEV_BSG is not set |
| 21 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 22 | # CONFIG_IOSCHED_CFQ is not set | ||
| 23 | CONFIG_ARCH_OMAP=y | 21 | CONFIG_ARCH_OMAP=y |
| 24 | CONFIG_ARCH_OMAP1=y | 22 | CONFIG_ARCH_OMAP1=y |
| 25 | CONFIG_OMAP_RESET_CLOCKS=y | 23 | CONFIG_OMAP_RESET_CLOCKS=y |
| @@ -7,8 +7,6 @@ CONFIG_SLAB=y · 6 unmodified lines | |||
| 7 | CONFIG_MODULES=y | 7 | CONFIG_MODULES=y |
| 8 | CONFIG_MODULE_UNLOAD=y | 8 | CONFIG_MODULE_UNLOAD=y |
| 9 | # CONFIG_BLK_DEV_BSG is not set | 9 | # CONFIG_BLK_DEV_BSG is not set |
| 10 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 11 | # CONFIG_IOSCHED_CFQ is not set | ||
| 12 | CONFIG_ARCH_PXA=y | 10 | CONFIG_ARCH_PXA=y |
| 13 | CONFIG_ARCH_PXA_PALM=y | 11 | CONFIG_ARCH_PXA_PALM=y |
| 14 | # CONFIG_MACH_PALMTX is not set | 12 | # CONFIG_MACH_PALMTX is not set |
| @@ -13,8 +13,6 @@ CONFIG_MODULES=y · 12 unmodified lines | |||
| 13 | CONFIG_MODULE_UNLOAD=y | 13 | CONFIG_MODULE_UNLOAD=y |
| 14 | CONFIG_MODULE_FORCE_UNLOAD=y | 14 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 15 | # CONFIG_BLK_DEV_BSG is not set | 15 | # CONFIG_BLK_DEV_BSG is not set |
| 16 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 17 | # CONFIG_IOSCHED_CFQ is not set | ||
| 18 | CONFIG_ARCH_PXA=y | 16 | CONFIG_ARCH_PXA=y |
| 19 | CONFIG_MACH_PCM027=y | 17 | CONFIG_MACH_PCM027=y |
| 20 | CONFIG_MACH_PCM990_BASEBOARD=y | 18 | CONFIG_MACH_PCM990_BASEBOARD=y |
| @@ -6,8 +6,6 @@ CONFIG_EXPERT=y · 5 unmodified lines | |||
| 6 | # CONFIG_HOTPLUG is not set | 6 | # CONFIG_HOTPLUG is not set |
| 7 | # CONFIG_SHMEM is not set | 7 | # CONFIG_SHMEM is not set |
| 8 | CONFIG_MODULES=y | 8 | CONFIG_MODULES=y |
| 9 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 10 | # CONFIG_IOSCHED_CFQ is not set | ||
| 11 | CONFIG_ARCH_SA1100=y | 9 | CONFIG_ARCH_SA1100=y |
| 12 | CONFIG_SA1100_PLEB=y | 10 | CONFIG_SA1100_PLEB=y |
| 13 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 11 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
| @@ -8,7 +8,6 @@ CONFIG_SLAB=y · 7 unmodified lines | |||
| 8 | CONFIG_MODULES=y | 8 | CONFIG_MODULES=y |
| 9 | CONFIG_MODULE_UNLOAD=y | 9 | CONFIG_MODULE_UNLOAD=y |
| 10 | # CONFIG_BLK_DEV_BSG is not set | 10 | # CONFIG_BLK_DEV_BSG is not set |
| 11 | # CONFIG_IOSCHED_CFQ is not set | ||
| 12 | CONFIG_ARCH_MULTI_V6=y | 11 | CONFIG_ARCH_MULTI_V6=y |
| 13 | CONFIG_ARCH_REALVIEW=y | 12 | CONFIG_ARCH_REALVIEW=y |
| 14 | CONFIG_MACH_REALVIEW_EB=y | 13 | CONFIG_MACH_REALVIEW_EB=y |
| @@ -14,8 +14,6 @@ CONFIG_MODULE_FORCE_LOAD=y · 13 unmodified lines | |||
| 14 | CONFIG_MODULE_UNLOAD=y | 14 | CONFIG_MODULE_UNLOAD=y |
| 15 | CONFIG_MODULE_FORCE_UNLOAD=y | 15 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 16 | # CONFIG_BLK_DEV_BSG is not set | 16 | # CONFIG_BLK_DEV_BSG is not set |
| 17 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 18 | # CONFIG_IOSCHED_CFQ is not set | ||
| 19 | CONFIG_ARCH_AT91=y | 17 | CONFIG_ARCH_AT91=y |
| 20 | CONFIG_SOC_SAMA5D2=y | 18 | CONFIG_SOC_SAMA5D2=y |
| 21 | CONFIG_SOC_SAMA5D3=y | 19 | CONFIG_SOC_SAMA5D3=y |
| @@ -182,7 +180,6 @@ CONFIG_USB_GADGET=y · 160 unmodified lines | |||
| 182 | CONFIG_USB_ATMEL_USBA=y | 180 | CONFIG_USB_ATMEL_USBA=y |
| 183 | CONFIG_USB_G_SERIAL=y | 181 | CONFIG_USB_G_SERIAL=y |
| 184 | CONFIG_MMC=y | 182 | CONFIG_MMC=y |
| 185 | # CONFIG_MMC_BLOCK_BOUNCE is not set | ||
| 186 | CONFIG_MMC_SDHCI=y | 183 | CONFIG_MMC_SDHCI=y |
| 187 | CONFIG_MMC_SDHCI_PLTFM=y | 184 | CONFIG_MMC_SDHCI_PLTFM=y |
| 188 | CONFIG_MMC_SDHCI_OF_AT91=y | 185 | CONFIG_MMC_SDHCI_OF_AT91=y |
| @@ -14,8 +14,6 @@ CONFIG_EMBEDDED=y · 13 unmodified lines | |||
| 14 | # CONFIG_VM_EVENT_COUNTERS is not set | 14 | # CONFIG_VM_EVENT_COUNTERS is not set |
| 15 | # CONFIG_SLUB_DEBUG is not set | 15 | # CONFIG_SLUB_DEBUG is not set |
| 16 | # CONFIG_BLK_DEV_BSG is not set | 16 | # CONFIG_BLK_DEV_BSG is not set |
| 17 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 18 | # CONFIG_IOSCHED_CFQ is not set | ||
| 19 | # CONFIG_MMU is not set | 17 | # CONFIG_MMU is not set |
| 20 | CONFIG_ARCH_STM32=y | 18 | CONFIG_ARCH_STM32=y |
| 21 | CONFIG_CPU_V7M_NUM_IRQ=240 | 19 | CONFIG_CPU_V7M_NUM_IRQ=240 |
| @@ -85,6 +85,7 @@ CONFIG_BATTERY_AXP20X=y · 84 unmodified lines | |||
| 85 | CONFIG_AXP20X_POWER=y | 85 | CONFIG_AXP20X_POWER=y |
| 86 | CONFIG_THERMAL=y | 86 | CONFIG_THERMAL=y |
| 87 | CONFIG_CPU_THERMAL=y | 87 | CONFIG_CPU_THERMAL=y |
| 88 | CONFIG_SUN8I_THERMAL=y | ||
| 88 | CONFIG_WATCHDOG=y | 89 | CONFIG_WATCHDOG=y |
| 89 | CONFIG_SUNXI_WATCHDOG=y | 90 | CONFIG_SUNXI_WATCHDOG=y |
| 90 | CONFIG_MFD_AC100=y | 91 | CONFIG_MFD_AC100=y |
| @@ -11,7 +11,6 @@ CONFIG_MODULES=y · 10 unmodified lines | |||
| 11 | CONFIG_MODULE_UNLOAD=y | 11 | CONFIG_MODULE_UNLOAD=y |
| 12 | # CONFIG_BLK_DEV_BSG is not set | 12 | # CONFIG_BLK_DEV_BSG is not set |
| 13 | CONFIG_PARTITION_ADVANCED=y | 13 | CONFIG_PARTITION_ADVANCED=y |
| 14 | # CONFIG_IOSCHED_CFQ is not set | ||
| 15 | # CONFIG_ARCH_MULTI_V7 is not set | 14 | # CONFIG_ARCH_MULTI_V7 is not set |
| 16 | CONFIG_ARCH_U300=y | 15 | CONFIG_ARCH_U300=y |
| 17 | CONFIG_MACH_U300_SPIDUMMY=y | 16 | CONFIG_MACH_U300_SPIDUMMY=y |
| @@ -46,7 +45,6 @@ CONFIG_FB=y · 28 unmodified lines | |||
| 46 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | 45 | CONFIG_BACKLIGHT_CLASS_DEVICE=y |
| 47 | # CONFIG_USB_SUPPORT is not set | 46 | # CONFIG_USB_SUPPORT is not set |
| 48 | CONFIG_MMC=y | 47 | CONFIG_MMC=y |
| 49 | # CONFIG_MMC_BLOCK_BOUNCE is not set | ||
| 50 | CONFIG_MMC_ARMMMCI=y | 48 | CONFIG_MMC_ARMMMCI=y |
| 51 | CONFIG_RTC_CLASS=y | 49 | CONFIG_RTC_CLASS=y |
| 52 | # CONFIG_RTC_HCTOSYS is not set | 50 | # CONFIG_RTC_HCTOSYS is not set |
| @@ -15,8 +15,6 @@ CONFIG_OPROFILE=y · 14 unmodified lines | |||
| 15 | CONFIG_MODULES=y | 15 | CONFIG_MODULES=y |
| 16 | CONFIG_MODULE_UNLOAD=y | 16 | CONFIG_MODULE_UNLOAD=y |
| 17 | # CONFIG_BLK_DEV_BSG is not set | 17 | # CONFIG_BLK_DEV_BSG is not set |
| 18 | # CONFIG_IOSCHED_DEADLINE is not set | ||
| 19 | # CONFIG_IOSCHED_CFQ is not set | ||
| 20 | CONFIG_ARCH_VEXPRESS=y | 18 | CONFIG_ARCH_VEXPRESS=y |
| 21 | CONFIG_ARCH_VEXPRESS_DCSCB=y | 19 | CONFIG_ARCH_VEXPRESS_DCSCB=y |
| 22 | CONFIG_ARCH_VEXPRESS_TC2_PM=y | 20 | CONFIG_ARCH_VEXPRESS_TC2_PM=y |
| @@ -9,7 +9,6 @@ CONFIG_SLAB=y · 8 unmodified lines | |||
| 9 | CONFIG_MODULES=y | 9 | CONFIG_MODULES=y |
| 10 | CONFIG_MODULE_UNLOAD=y | 10 | CONFIG_MODULE_UNLOAD=y |
| 11 | # CONFIG_BLK_DEV_BSG is not set | 11 | # CONFIG_BLK_DEV_BSG is not set |
| 12 | # CONFIG_IOSCHED_CFQ is not set | ||
| 13 | CONFIG_ARCH_PXA=y | 12 | CONFIG_ARCH_PXA=y |
| 14 | CONFIG_ARCH_VIPER=y | 13 | CONFIG_ARCH_VIPER=y |
| 15 | CONFIG_IWMMXT=y | 14 | CONFIG_IWMMXT=y |
| @@ -4,7 +4,6 @@ CONFIG_LOG_BUF_SHIFT=13 · 3 unmodified lines | |||
| 4 | CONFIG_MODULES=y | 4 | CONFIG_MODULES=y |
| 5 | CONFIG_MODULE_UNLOAD=y | 5 | CONFIG_MODULE_UNLOAD=y |
| 6 | # CONFIG_BLK_DEV_BSG is not set | 6 | # CONFIG_BLK_DEV_BSG is not set |
| 7 | # CONFIG_IOSCHED_CFQ is not set | ||
| 8 | CONFIG_ARCH_PXA=y | 7 | CONFIG_ARCH_PXA=y |
| 9 | CONFIG_MACH_ARCOM_ZEUS=y | 8 | CONFIG_MACH_ARCOM_ZEUS=y |
| 10 | CONFIG_PCCARD=m | 9 | CONFIG_PCCARD=m |
| @@ -137,7 +136,6 @@ CONFIG_USB_MASS_STORAGE=m · 126 unmodified lines | |||
| 137 | CONFIG_USB_G_SERIAL=m | 136 | CONFIG_USB_G_SERIAL=m |
| 138 | CONFIG_USB_G_PRINTER=m | 137 | CONFIG_USB_G_PRINTER=m |
| 139 | CONFIG_MMC=y | 138 | CONFIG_MMC=y |
| 140 | # CONFIG_MMC_BLOCK_BOUNCE is not set | ||
| 141 | CONFIG_MMC_PXA=y | 139 | CONFIG_MMC_PXA=y |
| 142 | CONFIG_NEW_LEDS=y | 140 | CONFIG_NEW_LEDS=y |
| 143 | CONFIG_LEDS_CLASS=m | 141 | CONFIG_LEDS_CLASS=m |
| @@ -16,7 +16,6 @@ CONFIG_EMBEDDED=y · 15 unmodified lines | |||
| 16 | CONFIG_PERF_EVENTS=y | 16 | CONFIG_PERF_EVENTS=y |
| 17 | CONFIG_SLAB=y | 17 | CONFIG_SLAB=y |
| 18 | # CONFIG_BLK_DEV_BSG is not set | 18 | # CONFIG_BLK_DEV_BSG is not set |
| 19 | # CONFIG_IOSCHED_CFQ is not set | ||
| 20 | CONFIG_ARCH_ZX=y | 19 | CONFIG_ARCH_ZX=y |
| 21 | CONFIG_SOC_ZX296702=y | 20 | CONFIG_SOC_ZX296702=y |
| 22 | # CONFIG_SWP_EMULATE is not set | 21 | # CONFIG_SWP_EMULATE is not set |
| @@ -392,9 +392,6 @@ static inline void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu) {} · 391 unmodified lines | |||
| 392 | static inline void kvm_vcpu_pmu_restore_guest(struct kvm_vcpu *vcpu) {} | 392 | static inline void kvm_vcpu_pmu_restore_guest(struct kvm_vcpu *vcpu) {} |
| 393 | static inline void kvm_vcpu_pmu_restore_host(struct kvm_vcpu *vcpu) {} | 393 | static inline void kvm_vcpu_pmu_restore_host(struct kvm_vcpu *vcpu) {} |
| 394 | 394 | ||
| 395 | static inline void kvm_arm_vhe_guest_enter(void) {} | ||
| 396 | static inline void kvm_arm_vhe_guest_exit(void) {} | ||
| 397 | |||
| 398 | #define KVM_BP_HARDEN_UNKNOWN -1 | 395 | #define KVM_BP_HARDEN_UNKNOWN -1 |
| 399 | #define KVM_BP_HARDEN_WA_NEEDED 0 | 396 | #define KVM_BP_HARDEN_WA_NEEDED 0 |
| 400 | #define KVM_BP_HARDEN_NOT_REQUIRED 1 | 397 | #define KVM_BP_HARDEN_NOT_REQUIRED 1 |
| @@ -78,13 +78,10 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old, · 77 unmodified lines | |||
| 78 | { | 78 | { |
| 79 | unsigned long replaced; | 79 | unsigned long replaced; |
| 80 | 80 | ||
| 81 | if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { | 81 | if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) |
| 82 | old = __opcode_to_mem_thumb32(old); | 82 | old = __opcode_to_mem_thumb32(old); |
| 83 | new = __opcode_to_mem_thumb32(new); | 83 | else |
| 84 | } else { | ||
| 85 | old = __opcode_to_mem_arm(old); | 84 | old = __opcode_to_mem_arm(old); |
| 86 | new = __opcode_to_mem_arm(new); | ||
| 87 | } | ||
| 88 | 85 | ||
| 89 | if (validate) { | 86 | if (validate) { |
| 90 | if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE)) | 87 | if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE)) |
| @@ -16,10 +16,10 @@ struct patch { · 15 unmodified lines | |||
| 16 | unsigned int insn; | 16 | unsigned int insn; |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | #ifdef CONFIG_MMU | ||
| 19 | static DEFINE_RAW_SPINLOCK(patch_lock); | 20 | static DEFINE_RAW_SPINLOCK(patch_lock); |
| 20 | 21 | ||
| 21 | static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) | 22 | static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) |
| 22 | __acquires(&patch_lock) | ||
| 23 | { | 23 | { |
| 24 | unsigned int uintaddr = (uintptr_t) addr; | 24 | unsigned int uintaddr = (uintptr_t) addr; |
| 25 | bool module = !core_kernel_text(uintaddr); | 25 | bool module = !core_kernel_text(uintaddr); |
| @@ -34,8 +34,6 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) · 8 unmodified lines | |||
| 34 | 34 | ||
| 35 | if (flags) | 35 | if (flags) |
| 36 | raw_spin_lock_irqsave(&patch_lock, *flags); | 36 | raw_spin_lock_irqsave(&patch_lock, *flags); |
| 37 | else | ||
| 38 | __acquire(&patch_lock); | ||
| 39 | 37 | ||
| 40 | set_fixmap(fixmap, page_to_phys(page)); | 38 | set_fixmap(fixmap, page_to_phys(page)); |
| 41 | 39 | ||
| @@ -43,15 +41,19 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) · 1 unmodified line | |||
| 43 | } | 41 | } |
| 44 | 42 | ||
| 45 | static void __kprobes patch_unmap(int fixmap, unsigned long *flags) | 43 | static void __kprobes patch_unmap(int fixmap, unsigned long *flags) |
| 46 | __releases(&patch_lock) | ||
| 47 | { | 44 | { |
| 48 | clear_fixmap(fixmap); | 45 | clear_fixmap(fixmap); |
| 49 | 46 | ||
| 50 | if (flags) | 47 | if (flags) |
| 51 | raw_spin_unlock_irqrestore(&patch_lock, *flags); | 48 | raw_spin_unlock_irqrestore(&patch_lock, *flags); |
| 52 | else | ||
| 53 | __release(&patch_lock); | ||
| 54 | } | 49 | } |
| 50 | #else | ||
| 51 | static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) | ||
| 52 | { | ||
| 53 | return addr; | ||
| 54 | } | ||
| 55 | static void __kprobes patch_unmap(int fixmap, unsigned long *flags) { } | ||
| 56 | #endif | ||
| 55 | 57 | ||
| 56 | void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap) | 58 | void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap) |
| 57 | { | 59 | { |
| @@ -64,8 +66,6 @@ void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap) · 6 unmodified lines | |||
| 64 | 66 | ||
| 65 | if (remap) | 67 | if (remap) |
| 66 | waddr = patch_map(addr, FIX_TEXT_POKE0, &flags); | 68 | waddr = patch_map(addr, FIX_TEXT_POKE0, &flags); |
| 67 | else | ||
| 68 | __acquire(&patch_lock); | ||
| 69 | 69 | ||
| 70 | if (thumb2 && __opcode_is_thumb16(insn)) { | 70 | if (thumb2 && __opcode_is_thumb16(insn)) { |
| 71 | *(u16 *)waddr = __opcode_to_mem_thumb16(insn); | 71 | *(u16 *)waddr = __opcode_to_mem_thumb16(insn); |
| @@ -102,8 +102,7 @@ void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap) · 30 unmodified lines | |||
| 102 | if (waddr != addr) { | 102 | if (waddr != addr) { |
| 103 | flush_kernel_vmap_range(waddr, twopage ? size / 2 : size); | 103 | flush_kernel_vmap_range(waddr, twopage ? size / 2 : size); |
| 104 | patch_unmap(FIX_TEXT_POKE0, &flags); | 104 | patch_unmap(FIX_TEXT_POKE0, &flags); |
| 105 | } else | 105 | } |
| 106 | __release(&patch_lock); | ||
| 107 | 106 | ||
| 108 | flush_icache_range((uintptr_t)(addr), | 107 | flush_icache_range((uintptr_t)(addr), |
| 109 | (uintptr_t)(addr) + size); | 108 | (uintptr_t)(addr) + size); |
| @@ -11,7 +11,7 @@ config ARCH_NPCM7XX · 10 unmodified lines | |||
| 11 | depends on ARCH_MULTI_V7 | 11 | depends on ARCH_MULTI_V7 |
| 12 | select PINCTRL_NPCM7XX | 12 | select PINCTRL_NPCM7XX |
| 13 | select NPCM7XX_TIMER | 13 | select NPCM7XX_TIMER |
| 14 | select ARCH_REQUIRE_GPIOLIB | 14 | select GPIOLIB |
| 15 | select CACHE_L2X0 | 15 | select CACHE_L2X0 |
| 16 | select ARM_GIC | 16 | select ARM_GIC |
| 17 | select HAVE_ARM_TWD if SMP | 17 | select HAVE_ARM_TWD if SMP |
| @@ -161,10 +161,10 @@ · 160 unmodified lines | |||
| 161 | bus-range = <0x0 0x1>; | 161 | bus-range = <0x0 0x1>; |
| 162 | reg = <0x0 0x40000000 0x0 0x10000000>; | 162 | reg = <0x0 0x40000000 0x0 0x10000000>; |
| 163 | ranges = <0x2000000 0x0 0x50000000 0x0 0x50000000 0x0 0x10000000>; | 163 | ranges = <0x2000000 0x0 0x50000000 0x0 0x50000000 0x0 0x10000000>; |
| 164 | interrupt-map = <0 0 0 1 &gic GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, | 164 | interrupt-map = <0 0 0 1 &gic 0 0 GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, |
| 165 | <0 0 0 2 &gic GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>, | 165 | <0 0 0 2 &gic 0 0 GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>, |
| 166 | <0 0 0 3 &gic GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, | 166 | <0 0 0 3 &gic 0 0 GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, |
| 167 | <0 0 0 4 &gic GIC_SPI 171 IRQ_TYPE_LEVEL_HIGH>; | 167 | <0 0 0 4 &gic 0 0 GIC_SPI 171 IRQ_TYPE_LEVEL_HIGH>; |
| 168 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; | 168 | interrupt-map-mask = <0x0 0x0 0x0 0x7>; |
| 169 | msi-map = <0x0 &its 0x0 0x10000>; | 169 | msi-map = <0x0 &its 0x0 0x10000>; |
| 170 | iommu-map = <0x0 &smmu 0x0 0x10000>; | 170 | iommu-map = <0x0 &smmu 0x0 0x10000>; |
| @@ -452,6 +452,7 @@ CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y · 451 unmodified lines | |||
| 452 | CONFIG_CPU_THERMAL=y | 452 | CONFIG_CPU_THERMAL=y |
| 453 | CONFIG_THERMAL_EMULATION=y | 453 | CONFIG_THERMAL_EMULATION=y |
| 454 | CONFIG_QORIQ_THERMAL=m | 454 | CONFIG_QORIQ_THERMAL=m |
| 455 | CONFIG_SUN8I_THERMAL=y | ||
| 455 | CONFIG_ROCKCHIP_THERMAL=m | 456 | CONFIG_ROCKCHIP_THERMAL=m |
| 456 | CONFIG_RCAR_THERMAL=y | 457 | CONFIG_RCAR_THERMAL=y |
| 457 | CONFIG_RCAR_GEN3_THERMAL=y | 458 | CONFIG_RCAR_GEN3_THERMAL=y |
| @@ -547,6 +548,7 @@ CONFIG_ROCKCHIP_DW_MIPI_DSI=y · 89 unmodified lines | |||
| 547 | CONFIG_ROCKCHIP_INNO_HDMI=y | 548 | CONFIG_ROCKCHIP_INNO_HDMI=y |
| 548 | CONFIG_DRM_RCAR_DU=m | 549 | CONFIG_DRM_RCAR_DU=m |
| 549 | CONFIG_DRM_SUN4I=m | 550 | CONFIG_DRM_SUN4I=m |
| 551 | CONFIG_DRM_SUN6I_DSI=m | ||
| 550 | CONFIG_DRM_SUN8I_DW_HDMI=m | 552 | CONFIG_DRM_SUN8I_DW_HDMI=m |
| 551 | CONFIG_DRM_SUN8I_MIXER=m | 553 | CONFIG_DRM_SUN8I_MIXER=m |
| 552 | CONFIG_DRM_MSM=m | 554 | CONFIG_DRM_MSM=m |
| @@ -681,7 +683,7 @@ CONFIG_RTC_DRV_SNVS=m · 128 unmodified lines | |||
| 681 | CONFIG_RTC_DRV_IMX_SC=m | 683 | CONFIG_RTC_DRV_IMX_SC=m |
| 682 | CONFIG_RTC_DRV_XGENE=y | 684 | CONFIG_RTC_DRV_XGENE=y |
| 683 | CONFIG_DMADEVICES=y | 685 | CONFIG_DMADEVICES=y |
| 684 | CONFIG_DMA_BCM2835=m | 686 | CONFIG_DMA_BCM2835=y |
| 685 | CONFIG_DMA_SUN6I=m | 687 | CONFIG_DMA_SUN6I=m |
| 686 | CONFIG_FSL_EDMA=y | 688 | CONFIG_FSL_EDMA=y |
| 687 | CONFIG_IMX_SDMA=y | 689 | CONFIG_IMX_SDMA=y |
| @@ -32,7 +32,7 @@ static inline void gic_write_eoir(u32 irq) · 31 unmodified lines | |||
| 32 | isb(); | 32 | isb(); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | static inline void gic_write_dir(u32 irq) | 35 | static __always_inline void gic_write_dir(u32 irq) |
| 36 | { | 36 | { |
| 37 | write_sysreg_s(irq, SYS_ICC_DIR_EL1); | 37 | write_sysreg_s(irq, SYS_ICC_DIR_EL1); |
| 38 | isb(); | 38 | isb(); |
| @@ -69,7 +69,7 @@ static inline int icache_is_aliasing(void) · 68 unmodified lines | |||
| 69 | return test_bit(ICACHEF_ALIASING, &__icache_flags); | 69 | return test_bit(ICACHEF_ALIASING, &__icache_flags); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | static inline int icache_is_vpipt(void) | 72 | static __always_inline int icache_is_vpipt(void) |
| 73 | { | 73 | { |
| 74 | return test_bit(ICACHEF_VPIPT, &__icache_flags); | 74 | return test_bit(ICACHEF_VPIPT, &__icache_flags); |
| 75 | } | 75 | } |
| @@ -145,7 +145,7 @@ extern void copy_to_user_page(struct vm_area_struct *, struct page *, · 144 unmodified lines | |||
| 145 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | 145 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 |
| 146 | extern void flush_dcache_page(struct page *); | 146 | extern void flush_dcache_page(struct page *); |
| 147 | 147 | ||
| 148 | static inline void __flush_icache_all(void) | 148 | static __always_inline void __flush_icache_all(void) |
| 149 | { | 149 | { |
| 150 | if (cpus_have_const_cap(ARM64_HAS_CACHE_DIC)) | 150 | if (cpus_have_const_cap(ARM64_HAS_CACHE_DIC)) |
| 151 | return; | 151 | return; |
| @@ -435,13 +435,13 @@ cpuid_feature_extract_signed_field(u64 features, int field) · 434 unmodified lines | |||
| 435 | return cpuid_feature_extract_signed_field_width(features, field, 4); | 435 | return cpuid_feature_extract_signed_field_width(features, field, 4); |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | static inline unsigned int __attribute_const__ | 438 | static __always_inline unsigned int __attribute_const__ |
| 439 | cpuid_feature_extract_unsigned_field_width(u64 features, int field, int width) | 439 | cpuid_feature_extract_unsigned_field_width(u64 features, int field, int width) |
| 440 | { | 440 | { |
| 441 | return (u64)(features << (64 - width - field)) >> (64 - width); | 441 | return (u64)(features << (64 - width - field)) >> (64 - width); |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | static inline unsigned int __attribute_const__ | 444 | static __always_inline unsigned int __attribute_const__ |
| 445 | cpuid_feature_extract_unsigned_field(u64 features, int field) | 445 | cpuid_feature_extract_unsigned_field(u64 features, int field) |
| 446 | { | 446 | { |
| 447 | return cpuid_feature_extract_unsigned_field_width(features, field, 4); | 447 | return cpuid_feature_extract_unsigned_field_width(features, field, 4); |
| @@ -564,7 +564,7 @@ static inline bool system_supports_mixed_endian(void) · 116 unmodified lines | |||
| 564 | return val == 0x1; | 564 | return val == 0x1; |
| 565 | } | 565 | } |
| 566 | 566 | ||
| 567 | static inline bool system_supports_fpsimd(void) | 567 | static __always_inline bool system_supports_fpsimd(void) |
| 568 | { | 568 | { |
| 569 | return !cpus_have_const_cap(ARM64_HAS_NO_FPSIMD); | 569 | return !cpus_have_const_cap(ARM64_HAS_NO_FPSIMD); |
| 570 | } | 570 | } |
| @@ -575,13 +575,13 @@ static inline bool system_uses_ttbr0_pan(void) · 4 unmodified lines | |||
| 575 | !cpus_have_const_cap(ARM64_HAS_PAN); | 575 | !cpus_have_const_cap(ARM64_HAS_PAN); |
| 576 | } | 576 | } |
| 577 | 577 | ||
| 578 | static inline bool system_supports_sve(void) | 578 | static __always_inline bool system_supports_sve(void) |
| 579 | { | 579 | { |
| 580 | return IS_ENABLED(CONFIG_ARM64_SVE) && | 580 | return IS_ENABLED(CONFIG_ARM64_SVE) && |
| 581 | cpus_have_const_cap(ARM64_SVE); | 581 | cpus_have_const_cap(ARM64_SVE); |
| 582 | } | 582 | } |
| 583 | 583 | ||
| 584 | static inline bool system_supports_cnp(void) | 584 | static __always_inline bool system_supports_cnp(void) |
| 585 | { | 585 | { |
| 586 | return IS_ENABLED(CONFIG_ARM64_CNP) && | 586 | return IS_ENABLED(CONFIG_ARM64_CNP) && |
| 587 | cpus_have_const_cap(ARM64_HAS_CNP); | 587 | cpus_have_const_cap(ARM64_HAS_CNP); |
| @@ -33,7 +33,6 @@ static inline u32 disr_to_esr(u64 disr) · 32 unmodified lines | |||
| 33 | 33 | ||
| 34 | asmlinkage void enter_from_user_mode(void); | 34 | asmlinkage void enter_from_user_mode(void); |
| 35 | void do_mem_abort(unsigned long addr, unsigned int esr, struct pt_regs *regs); | 35 | void do_mem_abort(unsigned long addr, unsigned int esr, struct pt_regs *regs); |
| 36 | void do_sp_pc_abort(unsigned long addr, unsigned int esr, struct pt_regs *regs); | ||
| 37 | void do_undefinstr(struct pt_regs *regs); | 36 | void do_undefinstr(struct pt_regs *regs); |
| 38 | asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr); | 37 | asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr); |
| 39 | void do_debug_exception(unsigned long addr_if_watchpoint, unsigned int esr, | 38 | void do_debug_exception(unsigned long addr_if_watchpoint, unsigned int esr, |
| @@ -47,7 +46,4 @@ void bad_el0_sync(struct pt_regs *regs, int reason, unsigned int esr); · 7 unmodified lines | |||
| 47 | void do_cp15instr(unsigned int esr, struct pt_regs *regs); | 46 | void do_cp15instr(unsigned int esr, struct pt_regs *regs); |
| 48 | void do_el0_svc(struct pt_regs *regs); | 47 | void do_el0_svc(struct pt_regs *regs); |
| 49 | void do_el0_svc_compat(struct pt_regs *regs); | 48 | void do_el0_svc_compat(struct pt_regs *regs); |
| 50 | void do_el0_ia_bp_hardening(unsigned long addr, unsigned int esr, | ||
| 51 | struct pt_regs *regs); | ||
| 52 | |||
| 53 | #endif /* __ASM_EXCEPTION_H */ | 49 | #endif /* __ASM_EXCEPTION_H */ |
| @@ -34,7 +34,7 @@ static inline void __raw_writew(u16 val, volatile void __iomem *addr) · 33 unmodified lines | |||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | #define __raw_writel __raw_writel | 36 | #define __raw_writel __raw_writel |
| 37 | static inline void __raw_writel(u32 val, volatile void __iomem *addr) | 37 | static __always_inline void __raw_writel(u32 val, volatile void __iomem *addr) |
| 38 | { | 38 | { |
| 39 | asm volatile("str %w0, [%1]" : : "rZ" (val), "r" (addr)); | 39 | asm volatile("str %w0, [%1]" : : "rZ" (val), "r" (addr)); |
| 40 | } | 40 | } |
| @@ -69,7 +69,7 @@ static inline u16 __raw_readw(const volatile void __iomem *addr) · 28 unmodified lines | |||
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | #define __raw_readl __raw_readl | 71 | #define __raw_readl __raw_readl |
| 72 | static inline u32 __raw_readl(const volatile void __iomem *addr) | 72 | static __always_inline u32 __raw_readl(const volatile void __iomem *addr) |
| 73 | { | 73 | { |
| 74 | u32 val; | 74 | u32 val; |
| 75 | asm volatile(ALTERNATIVE("ldr %w0, [%1]", | 75 | asm volatile(ALTERNATIVE("ldr %w0, [%1]", |
| @@ -36,7 +36,7 @@ void kvm_inject_undef32(struct kvm_vcpu *vcpu); · 35 unmodified lines | |||
| 36 | void kvm_inject_dabt32(struct kvm_vcpu *vcpu, unsigned long addr); | 36 | void kvm_inject_dabt32(struct kvm_vcpu *vcpu, unsigned long addr); |
| 37 | void kvm_inject_pabt32(struct kvm_vcpu *vcpu, unsigned long addr); | 37 | void kvm_inject_pabt32(struct kvm_vcpu *vcpu, unsigned long addr); |
| 38 | 38 | ||
| 39 | static inline bool vcpu_el1_is_32bit(struct kvm_vcpu *vcpu) | 39 | static __always_inline bool vcpu_el1_is_32bit(struct kvm_vcpu *vcpu) |
| 40 | { | 40 | { |
| 41 | return !(vcpu->arch.hcr_el2 & HCR_RW); | 41 | return !(vcpu->arch.hcr_el2 & HCR_RW); |
| 42 | } | 42 | } |
| @@ -127,7 +127,7 @@ static inline void vcpu_set_vsesr(struct kvm_vcpu *vcpu, u64 vsesr) · 84 unmodified lines | |||
| 127 | vcpu->arch.vsesr_el2 = vsesr; | 127 | vcpu->arch.vsesr_el2 = vsesr; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | static inline unsigned long *vcpu_pc(const struct kvm_vcpu *vcpu) | 130 | static __always_inline unsigned long *vcpu_pc(const struct kvm_vcpu *vcpu) |
| 131 | { | 131 | { |
| 132 | return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.pc; | 132 | return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.pc; |
| 133 | } | 133 | } |
| @@ -153,17 +153,17 @@ static inline void vcpu_write_elr_el1(const struct kvm_vcpu *vcpu, unsigned long · 19 unmodified lines | |||
| 153 | *__vcpu_elr_el1(vcpu) = v; | 153 | *__vcpu_elr_el1(vcpu) = v; |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | static inline unsigned long *vcpu_cpsr(const struct kvm_vcpu *vcpu) | 156 | static __always_inline unsigned long *vcpu_cpsr(const struct kvm_vcpu *vcpu) |
| 157 | { | 157 | { |
| 158 | return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.pstate; | 158 | return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.pstate; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | static inline bool vcpu_mode_is_32bit(const struct kvm_vcpu *vcpu) | 161 | static __always_inline bool vcpu_mode_is_32bit(const struct kvm_vcpu *vcpu) |
| 162 | { | 162 | { |
| 163 | return !!(*vcpu_cpsr(vcpu) & PSR_MODE32_BIT); | 163 | return !!(*vcpu_cpsr(vcpu) & PSR_MODE32_BIT); |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | static inline bool kvm_condition_valid(const struct kvm_vcpu *vcpu) | 166 | static __always_inline bool kvm_condition_valid(const struct kvm_vcpu *vcpu) |
| 167 | { | 167 | { |
| 168 | if (vcpu_mode_is_32bit(vcpu)) | 168 | if (vcpu_mode_is_32bit(vcpu)) |
| 169 | return kvm_condition_valid32(vcpu); | 169 | return kvm_condition_valid32(vcpu); |
| @@ -181,13 +181,13 @@ static inline void vcpu_set_thumb(struct kvm_vcpu *vcpu) · 11 unmodified lines | |||
| 181 | * coming from a read of ESR_EL2. Otherwise, it may give the wrong result on | 181 | * coming from a read of ESR_EL2. Otherwise, it may give the wrong result on |
| 182 | * AArch32 with banked registers. | 182 | * AArch32 with banked registers. |
| 183 | */ | 183 | */ |
| 184 | static inline unsigned long vcpu_get_reg(const struct kvm_vcpu *vcpu, | 184 | static __always_inline unsigned long vcpu_get_reg(const struct kvm_vcpu *vcpu, |
| 185 | u8 reg_num) | 185 | u8 reg_num) |
| 186 | { | 186 | { |
| 187 | return (reg_num == 31) ? 0 : vcpu_gp_regs(vcpu)->regs.regs[reg_num]; | 187 | return (reg_num == 31) ? 0 : vcpu_gp_regs(vcpu)->regs.regs[reg_num]; |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | static inline void vcpu_set_reg(struct kvm_vcpu *vcpu, u8 reg_num, | 190 | static __always_inline void vcpu_set_reg(struct kvm_vcpu *vcpu, u8 reg_num, |
| 191 | unsigned long val) | 191 | unsigned long val) |
| 192 | { | 192 | { |
| 193 | if (reg_num != 31) | 193 | if (reg_num != 31) |
| @@ -264,12 +264,12 @@ static inline bool vcpu_mode_priv(const struct kvm_vcpu *vcpu) · 70 unmodified lines | |||
| 264 | return mode != PSR_MODE_EL0t; | 264 | return mode != PSR_MODE_EL0t; |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | static inline u32 kvm_vcpu_get_hsr(const struct kvm_vcpu *vcpu) | 267 | static __always_inline u32 kvm_vcpu_get_hsr(const struct kvm_vcpu *vcpu) |
| 268 | { | 268 | { |
| 269 | return vcpu->arch.fault.esr_el2; | 269 | return vcpu->arch.fault.esr_el2; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | static inline int kvm_vcpu_get_condition(const struct kvm_vcpu *vcpu) | 272 | static __always_inline int kvm_vcpu_get_condition(const struct kvm_vcpu *vcpu) |
| 273 | { | 273 | { |
| 274 | u32 esr = kvm_vcpu_get_hsr(vcpu); | 274 | u32 esr = kvm_vcpu_get_hsr(vcpu); |
| 275 | 275 | ||
| @@ -279,12 +279,12 @@ static inline int kvm_vcpu_get_condition(const struct kvm_vcpu *vcpu) · 3 unmodified lines | |||
| 279 | return -1; | 279 | return -1; |
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | static inline unsigned long kvm_vcpu_get_hfar(const struct kvm_vcpu *vcpu) | 282 | static __always_inline unsigned long kvm_vcpu_get_hfar(const struct kvm_vcpu *vcpu) |
| 283 | { | 283 | { |
| 284 | return vcpu->arch.fault.far_el2; | 284 | return vcpu->arch.fault.far_el2; |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | static inline phys_addr_t kvm_vcpu_get_fault_ipa(const struct kvm_vcpu *vcpu) | 287 | static __always_inline phys_addr_t kvm_vcpu_get_fault_ipa(const struct kvm_vcpu *vcpu) |
| 288 | { | 288 | { |
| 289 | return ((phys_addr_t)vcpu->arch.fault.hpfar_el2 & HPFAR_MASK) << 8; | 289 | return ((phys_addr_t)vcpu->arch.fault.hpfar_el2 & HPFAR_MASK) << 8; |
| 290 | } | 290 | } |
| @@ -299,7 +299,7 @@ static inline u32 kvm_vcpu_hvc_get_imm(const struct kvm_vcpu *vcpu) · 8 unmodified lines | |||
| 299 | return kvm_vcpu_get_hsr(vcpu) & ESR_ELx_xVC_IMM_MASK; | 299 | return kvm_vcpu_get_hsr(vcpu) & ESR_ELx_xVC_IMM_MASK; |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | static inline bool kvm_vcpu_dabt_isvalid(const struct kvm_vcpu *vcpu) | 302 | static __always_inline bool kvm_vcpu_dabt_isvalid(const struct kvm_vcpu *vcpu) |
| 303 | { | 303 | { |
| 304 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_ISV); | 304 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_ISV); |
| 305 | } | 305 | } |
| @@ -319,17 +319,17 @@ static inline bool kvm_vcpu_dabt_issf(const struct kvm_vcpu *vcpu) · 13 unmodified lines | |||
| 319 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_SF); | 319 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_SF); |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | static inline int kvm_vcpu_dabt_get_rd(const struct kvm_vcpu *vcpu) | 322 | static __always_inline int kvm_vcpu_dabt_get_rd(const struct kvm_vcpu *vcpu) |
| 323 | { | 323 | { |
| 324 | return (kvm_vcpu_get_hsr(vcpu) & ESR_ELx_SRT_MASK) >> ESR_ELx_SRT_SHIFT; | 324 | return (kvm_vcpu_get_hsr(vcpu) & ESR_ELx_SRT_MASK) >> ESR_ELx_SRT_SHIFT; |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | static inline bool kvm_vcpu_dabt_iss1tw(const struct kvm_vcpu *vcpu) | 327 | static __always_inline bool kvm_vcpu_dabt_iss1tw(const struct kvm_vcpu *vcpu) |
| 328 | { | 328 | { |
| 329 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_S1PTW); | 329 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_S1PTW); |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | static inline bool kvm_vcpu_dabt_iswrite(const struct kvm_vcpu *vcpu) | 332 | static __always_inline bool kvm_vcpu_dabt_iswrite(const struct kvm_vcpu *vcpu) |
| 333 | { | 333 | { |
| 334 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_WNR) || | 334 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_WNR) || |
| 335 | kvm_vcpu_dabt_iss1tw(vcpu); /* AF/DBM update */ | 335 | kvm_vcpu_dabt_iss1tw(vcpu); /* AF/DBM update */ |
| @@ -340,18 +340,18 @@ static inline bool kvm_vcpu_dabt_is_cm(const struct kvm_vcpu *vcpu) · 4 unmodified lines | |||
| 340 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_CM); | 340 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_CM); |
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | static inline unsigned int kvm_vcpu_dabt_get_as(const struct kvm_vcpu *vcpu) | 343 | static __always_inline unsigned int kvm_vcpu_dabt_get_as(const struct kvm_vcpu *vcpu) |
| 344 | { | 344 | { |
| 345 | return 1 << ((kvm_vcpu_get_hsr(vcpu) & ESR_ELx_SAS) >> ESR_ELx_SAS_SHIFT); | 345 | return 1 << ((kvm_vcpu_get_hsr(vcpu) & ESR_ELx_SAS) >> ESR_ELx_SAS_SHIFT); |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | /* This one is not specific to Data Abort */ | 348 | /* This one is not specific to Data Abort */ |
| 349 | static inline bool kvm_vcpu_trap_il_is32bit(const struct kvm_vcpu *vcpu) | 349 | static __always_inline bool kvm_vcpu_trap_il_is32bit(const struct kvm_vcpu *vcpu) |
| 350 | { | 350 | { |
| 351 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_IL); | 351 | return !!(kvm_vcpu_get_hsr(vcpu) & ESR_ELx_IL); |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | static inline u8 kvm_vcpu_trap_get_class(const struct kvm_vcpu *vcpu) | 354 | static __always_inline u8 kvm_vcpu_trap_get_class(const struct kvm_vcpu *vcpu) |
| 355 | { | 355 | { |
| 356 | return ESR_ELx_EC(kvm_vcpu_get_hsr(vcpu)); | 356 | return ESR_ELx_EC(kvm_vcpu_get_hsr(vcpu)); |
| 357 | } | 357 | } |
| @@ -361,17 +361,17 @@ static inline bool kvm_vcpu_trap_is_iabt(const struct kvm_vcpu *vcpu) · 3 unmodified lines | |||
| 361 | return kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_IABT_LOW; | 361 | return kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_IABT_LOW; |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | static inline u8 kvm_vcpu_trap_get_fault(const struct kvm_vcpu *vcpu) | 364 | static __always_inline u8 kvm_vcpu_trap_get_fault(const struct kvm_vcpu *vcpu) |
| 365 | { | 365 | { |
| 366 | return kvm_vcpu_get_hsr(vcpu) & ESR_ELx_FSC; | 366 | return kvm_vcpu_get_hsr(vcpu) & ESR_ELx_FSC; |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | static inline u8 kvm_vcpu_trap_get_fault_type(const struct kvm_vcpu *vcpu) | 369 | static __always_inline u8 kvm_vcpu_trap_get_fault_type(const struct kvm_vcpu *vcpu) |
| 370 | { | 370 | { |
| 371 | return kvm_vcpu_get_hsr(vcpu) & ESR_ELx_FSC_TYPE; | 371 | return kvm_vcpu_get_hsr(vcpu) & ESR_ELx_FSC_TYPE; |
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | static inline bool kvm_vcpu_dabt_isextabt(const struct kvm_vcpu *vcpu) | 374 | static __always_inline bool kvm_vcpu_dabt_isextabt(const struct kvm_vcpu *vcpu) |
| 375 | { | 375 | { |
| 376 | switch (kvm_vcpu_trap_get_fault(vcpu)) { | 376 | switch (kvm_vcpu_trap_get_fault(vcpu)) { |
| 377 | case FSC_SEA: | 377 | case FSC_SEA: |
| @@ -390,7 +390,7 @@ static inline bool kvm_vcpu_dabt_isextabt(const struct kvm_vcpu *vcpu) · 12 unmodified lines | |||
| 390 | } | 390 | } |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | static inline int kvm_vcpu_sys_get_rt(struct kvm_vcpu *vcpu) | 393 | static __always_inline int kvm_vcpu_sys_get_rt(struct kvm_vcpu *vcpu) |
| 394 | { | 394 | { |
| 395 | u32 esr = kvm_vcpu_get_hsr(vcpu); | 395 | u32 esr = kvm_vcpu_get_hsr(vcpu); |
| 396 | return ESR_ELx_SYS64_ISS_RT(esr); | 396 | return ESR_ELx_SYS64_ISS_RT(esr); |
| @@ -504,7 +504,7 @@ static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu, · 107 unmodified lines | |||
| 504 | return data; /* Leave LE untouched */ | 504 | return data; /* Leave LE untouched */ |
| 505 | } | 505 | } |
| 506 | 506 | ||
| 507 | static inline void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr) | 507 | static __always_inline void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr) |
| 508 | { | 508 | { |
| 509 | if (vcpu_mode_is_32bit(vcpu)) | 509 | if (vcpu_mode_is_32bit(vcpu)) |
| 510 | kvm_skip_instr32(vcpu, is_wide_instr); | 510 | kvm_skip_instr32(vcpu, is_wide_instr); |
| @@ -519,7 +519,7 @@ static inline void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr) · 8 unmodified lines | |||
| 519 | * Skip an instruction which has been emulated at hyp while most guest sysregs | 519 | * Skip an instruction which has been emulated at hyp while most guest sysregs |
| 520 | * are live. | 520 | * are live. |
| 521 | */ | 521 | */ |
| 522 | static inline void __hyp_text __kvm_skip_instr(struct kvm_vcpu *vcpu) | 522 | static __always_inline void __hyp_text __kvm_skip_instr(struct kvm_vcpu *vcpu) |
| 523 | { | 523 | { |
| 524 | *vcpu_pc(vcpu) = read_sysreg_el2(SYS_ELR); | 524 | *vcpu_pc(vcpu) = read_sysreg_el2(SYS_ELR); |
| 525 | vcpu->arch.ctxt.gp_regs.regs.pstate = read_sysreg_el2(SYS_SPSR); | 525 | vcpu->arch.ctxt.gp_regs.regs.pstate = read_sysreg_el2(SYS_SPSR); |
| @@ -626,38 +626,6 @@ static inline void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr) {} · 625 unmodified lines | |||
| 626 | static inline void kvm_clr_pmu_events(u32 clr) {} | 626 | static inline void kvm_clr_pmu_events(u32 clr) {} |
| 627 | #endif | 627 | #endif |
| 628 | 628 | ||
| 629 | static inline void kvm_arm_vhe_guest_enter(void) | ||
| 630 | { | ||
| 631 | local_daif_mask(); | ||
| 632 | |||
| 633 | /* | ||
| 634 | * Having IRQs masked via PMR when entering the guest means the GIC | ||
| 635 | * will not signal the CPU of interrupts of lower priority, and the | ||
| 636 | * only way to get out will be via guest exceptions. | ||
| 637 | * Naturally, we want to avoid this. | ||
| 638 | * | ||
| 639 | * local_daif_mask() already sets GIC_PRIO_PSR_I_SET, we just need a | ||
| 640 | * dsb to ensure the redistributor is forwards EL2 IRQs to the CPU. | ||
| 641 | */ | ||
| 642 | pmr_sync(); | ||
| 643 | } | ||
| 644 | |||
| 645 | static inline void kvm_arm_vhe_guest_exit(void) | ||
| 646 | { | ||
| 647 | /* | ||
| 648 | * local_daif_restore() takes care to properly restore PSTATE.DAIF | ||
| 649 | * and the GIC PMR if the host is using IRQ priorities. | ||
| 650 | */ | ||
| 651 | local_daif_restore(DAIF_PROCCTX_NOIRQ); | ||
| 652 | |||
| 653 | /* | ||
| 654 | * When we exit from the guest we change a number of CPU configuration | ||
| 655 | * parameters, such as traps. Make sure these changes take effect | ||
| 656 | * before running the host or additional guests. | ||
| 657 | */ | ||
| 658 | isb(); | ||
| 659 | } | ||
| 660 | |||
| 661 | #define KVM_BP_HARDEN_UNKNOWN -1 | 629 | #define KVM_BP_HARDEN_UNKNOWN -1 |
| 662 | #define KVM_BP_HARDEN_WA_NEEDED 0 | 630 | #define KVM_BP_HARDEN_WA_NEEDED 0 |
| 663 | #define KVM_BP_HARDEN_NOT_REQUIRED 1 | 631 | #define KVM_BP_HARDEN_NOT_REQUIRED 1 |
| @@ -47,6 +47,13 @@ · 46 unmodified lines | |||
| 47 | #define read_sysreg_el2(r) read_sysreg_elx(r, _EL2, _EL1) | 47 | #define read_sysreg_el2(r) read_sysreg_elx(r, _EL2, _EL1) |
| 48 | #define write_sysreg_el2(v,r) write_sysreg_elx(v, r, _EL2, _EL1) | 48 | #define write_sysreg_el2(v,r) write_sysreg_elx(v, r, _EL2, _EL1) |
| 49 | 49 | ||
| 50 | /* | ||
| 51 | * Without an __arch_swab32(), we fall back to ___constant_swab32(), but the | ||
| 52 | * static inline can allow the compiler to out-of-line this. KVM always wants | ||
| 53 | * the macro version as its always inlined. | ||
| 54 | */ | ||
| 55 | #define __kvm_swab32(x) ___constant_swab32(x) | ||
| 56 | |||
| 50 | int __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu); | 57 | int __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu); |
| 51 | 58 | ||
| 52 | void __vgic_v3_save_state(struct kvm_vcpu *vcpu); | 59 | void __vgic_v3_save_state(struct kvm_vcpu *vcpu); |
| @@ -93,7 +93,7 @@ void kvm_update_va_mask(struct alt_instr *alt, · 92 unmodified lines | |||
| 93 | __le32 *origptr, __le32 *updptr, int nr_inst); | 93 | __le32 *origptr, __le32 *updptr, int nr_inst); |
| 94 | void kvm_compute_layout(void); | 94 | void kvm_compute_layout(void); |
| 95 | 95 | ||
| 96 | static inline unsigned long __kern_hyp_va(unsigned long v) | 96 | static __always_inline unsigned long __kern_hyp_va(unsigned long v) |
| 97 | { | 97 | { |
| 98 | asm volatile(ALTERNATIVE_CB("and %0, %0, #1\n" | 98 | asm volatile(ALTERNATIVE_CB("and %0, %0, #1\n" |
| 99 | "ror %0, %0, #1\n" | 99 | "ror %0, %0, #1\n" |
| @@ -473,6 +473,7 @@ static inline int kvm_write_guest_lock(struct kvm *kvm, gpa_t gpa, · 373 unmodified lines | |||
| 473 | extern void *__kvm_bp_vect_base; | 473 | extern void *__kvm_bp_vect_base; |
| 474 | extern int __kvm_harden_el2_vector_slot; | 474 | extern int __kvm_harden_el2_vector_slot; |
| 475 | 475 | ||
| 476 | /* This is only called on a VHE system */ | ||
| 476 | static inline void *kvm_get_hyp_vector(void) | 477 | static inline void *kvm_get_hyp_vector(void) |
| 477 | { | 478 | { |
| 478 | struct bp_hardening_data *data = arm64_get_bp_hardening_data(); | 479 | struct bp_hardening_data *data = arm64_get_bp_hardening_data(); |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | #ifdef CONFIG_ARM64_LSE_ATOMICS | 7 | #ifdef CONFIG_ARM64_LSE_ATOMICS |
| 8 | 8 | ||
| 9 | #define __LSE_PREAMBLE ".arch armv8-a+lse\n" | 9 | #define __LSE_PREAMBLE ".arch_extension lse\n" |
| 10 | 10 | ||
| 11 | #include <linux/compiler_types.h> | 11 | #include <linux/compiler_types.h> |
| 12 | #include <linux/export.h> | 12 | #include <linux/export.h> |
| @@ -213,7 +213,7 @@ static inline unsigned long kaslr_offset(void) · 212 unmodified lines | |||
| 213 | ((__force __typeof__(addr))sign_extend64((__force u64)(addr), 55)) | 213 | ((__force __typeof__(addr))sign_extend64((__force u64)(addr), 55)) |
| 214 | 214 | ||
| 215 | #define untagged_addr(addr) ({ \ | 215 | #define untagged_addr(addr) ({ \ |
| 216 | u64 __addr = (__force u64)addr; \ | 216 | u64 __addr = (__force u64)(addr); \ |
| 217 | __addr &= __untagged_addr(__addr); \ | 217 | __addr &= __untagged_addr(__addr); \ |
| 218 | (__force __typeof__(addr))__addr; \ | 218 | (__force __typeof__(addr))__addr; \ |
| 219 | }) | 219 | }) |
| @@ -18,6 +18,10 @@ · 17 unmodified lines | |||
| 18 | * See: | 18 | * See: |
| 19 | * https://lore.kernel.org/lkml/20200110100612.GC2827@hirez.programming.kicks-ass.net | 19 | * https://lore.kernel.org/lkml/20200110100612.GC2827@hirez.programming.kicks-ass.net |
| 20 | */ | 20 | */ |
| 21 | #define vcpu_is_preempted(cpu) false | 21 | #define vcpu_is_preempted vcpu_is_preempted |
| 22 | static inline bool vcpu_is_preempted(int cpu) | ||
| 23 | { | ||
| 24 | return false; | ||
| 25 | } | ||
| 22 | 26 | ||
| 23 | #endif /* __ASM_SPINLOCK_H */ | 27 | #endif /* __ASM_SPINLOCK_H */ |
| @@ -83,7 +83,7 @@ static inline bool is_kernel_in_hyp_mode(void) · 82 unmodified lines | |||
| 83 | return read_sysreg(CurrentEL) == CurrentEL_EL2; | 83 | return read_sysreg(CurrentEL) == CurrentEL_EL2; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | static inline bool has_vhe(void) | 86 | static __always_inline bool has_vhe(void) |
| 87 | { | 87 | { |
| 88 | if (cpus_have_const_cap(ARM64_HAS_VIRT_HOST_EXTN)) | 88 | if (cpus_have_const_cap(ARM64_HAS_VIRT_HOST_EXTN)) |
| 89 | return true; | 89 | return true; |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
| 12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 13 | 13 | ||
| 14 | #include <asm/archrandom.h> | ||
| 14 | #include <asm/cacheflush.h> | 15 | #include <asm/cacheflush.h> |
| 15 | #include <asm/fixmap.h> | 16 | #include <asm/fixmap.h> |
| 16 | #include <asm/kernel-pgtable.h> | 17 | #include <asm/kernel-pgtable.h> |
| @@ -466,6 +466,13 @@ static void ssbs_thread_switch(struct task_struct *next) · 465 unmodified lines | |||
| 466 | if (unlikely(next->flags & PF_KTHREAD)) | 466 | if (unlikely(next->flags & PF_KTHREAD)) |
| 467 | return; | 467 | return; |
| 468 | 468 | ||
| 469 | /* | ||
| 470 | * If all CPUs implement the SSBS extension, then we just need to | ||
| 471 | * context-switch the PSTATE field. | ||
| 472 | */ | ||
| 473 | if (cpu_have_feature(cpu_feature(SSBS))) | ||
| 474 | return; | ||
| 475 | |||
| 469 | /* If the mitigation is enabled, then we leave SSBS clear. */ | 476 | /* If the mitigation is enabled, then we leave SSBS clear. */ |
| 470 | if ((arm64_get_ssbd_state() == ARM64_SSBD_FORCE_ENABLE) || | 477 | if ((arm64_get_ssbd_state() == ARM64_SSBD_FORCE_ENABLE) || |
| 471 | test_tsk_thread_flag(next, TIF_SSBD)) | 478 | test_tsk_thread_flag(next, TIF_SSBD)) |
| @@ -608,8 +615,6 @@ long get_tagged_addr_ctrl(void) · 136 unmodified lines | |||
| 608 | * only prevents the tagged address ABI enabling via prctl() and does not | 615 | * only prevents the tagged address ABI enabling via prctl() and does not |
| 609 | * disable it for tasks that already opted in to the relaxed ABI. | 616 | * disable it for tasks that already opted in to the relaxed ABI. |
| 610 | */ | 617 | */ |
| 611 | static int zero; | ||
| 612 | static int one = 1; | ||
| 613 | 618 | ||
| 614 | static struct ctl_table tagged_addr_sysctl_table[] = { | 619 | static struct ctl_table tagged_addr_sysctl_table[] = { |
| 615 | { | 620 | { |
| @@ -618,8 +623,8 @@ static struct ctl_table tagged_addr_sysctl_table[] = { · 2 unmodified lines | |||
| 618 | .data = &tagged_addr_disabled, | 623 | .data = &tagged_addr_disabled, |
| 619 | .maxlen = sizeof(int), | 624 | .maxlen = sizeof(int), |
| 620 | .proc_handler = proc_dointvec_minmax, | 625 | .proc_handler = proc_dointvec_minmax, |
| 621 | .extra1 = &zero, | 626 | .extra1 = SYSCTL_ZERO, |
| 622 | .extra2 = &one, | 627 | .extra2 = SYSCTL_ONE, |
| 623 | }, | 628 | }, |
| 624 | { } | 629 | { } |
| 625 | }; | 630 | }; |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
| 24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
| 25 | #include <linux/clocksource.h> | 25 | #include <linux/clocksource.h> |
| 26 | #include <linux/clk-provider.h> | 26 | #include <linux/of_clk.h> |
| 27 | #include <linux/acpi.h> | 27 | #include <linux/acpi.h> |
| 28 | 28 | ||
| 29 | #include <clocksource/arm_arch_timer.h> | 29 | #include <clocksource/arm_arch_timer.h> |
| @@ -625,7 +625,7 @@ static void __hyp_text __pmu_switch_to_host(struct kvm_cpu_context *host_ctxt) · 624 unmodified lines | |||
| 625 | } | 625 | } |
| 626 | 626 | ||
| 627 | /* Switch to the guest for VHE systems running in EL2 */ | 627 | /* Switch to the guest for VHE systems running in EL2 */ |
| 628 | int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) | 628 | static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) |
| 629 | { | 629 | { |
| 630 | struct kvm_cpu_context *host_ctxt; | 630 | struct kvm_cpu_context *host_ctxt; |
| 631 | struct kvm_cpu_context *guest_ctxt; | 631 | struct kvm_cpu_context *guest_ctxt; |
| @@ -678,7 +678,42 @@ int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) · 46 unmodified lines | |||
| 678 | 678 | ||
| 679 | return exit_code; | 679 | return exit_code; |
| 680 | } | 680 | } |
| 681 | NOKPROBE_SYMBOL(kvm_vcpu_run_vhe); | 681 | NOKPROBE_SYMBOL(__kvm_vcpu_run_vhe); |
| 682 | |||
| 683 | int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) | ||
| 684 | { | ||
| 685 | int ret; | ||
| 686 | |||
| 687 | local_daif_mask(); | ||
| 688 | |||
| 689 | /* | ||
| 690 | * Having IRQs masked via PMR when entering the guest means the GIC | ||
| 691 | * will not signal the CPU of interrupts of lower priority, and the | ||
| 692 | * only way to get out will be via guest exceptions. | ||
| 693 | * Naturally, we want to avoid this. | ||
| 694 | * | ||
| 695 | * local_daif_mask() already sets GIC_PRIO_PSR_I_SET, we just need a | ||
| 696 | * dsb to ensure the redistributor is forwards EL2 IRQs to the CPU. | ||
| 697 | */ | ||
| 698 | pmr_sync(); | ||
| 699 | |||
| 700 | ret = __kvm_vcpu_run_vhe(vcpu); | ||
| 701 | |||
| 702 | /* | ||
| 703 | * local_daif_restore() takes care to properly restore PSTATE.DAIF | ||
| 704 | * and the GIC PMR if the host is using IRQ priorities. | ||
| 705 | */ | ||
| 706 | local_daif_restore(DAIF_PROCCTX_NOIRQ); | ||
| 707 | |||
| 708 | /* | ||
| 709 | * When we exit from the guest we change a number of CPU configuration | ||
| 710 | * parameters, such as traps. Make sure these changes take effect | ||
| 711 | * before running the host or additional guests. | ||
| 712 | */ | ||
| 713 | isb(); | ||
| 714 | |||
| 715 | return ret; | ||
| 716 | } | ||
| 682 | 717 | ||
| 683 | /* Switch to the guest for legacy non-VHE systems */ | 718 | /* Switch to the guest for legacy non-VHE systems */ |
| 684 | int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu) | 719 | int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu) |
| @@ -69,14 +69,14 @@ int __hyp_text __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu) · 68 unmodified lines | |||
| 69 | u32 data = vcpu_get_reg(vcpu, rd); | 69 | u32 data = vcpu_get_reg(vcpu, rd); |
| 70 | if (__is_be(vcpu)) { | 70 | if (__is_be(vcpu)) { |
| 71 | /* guest pre-swabbed data, undo this for writel() */ | 71 | /* guest pre-swabbed data, undo this for writel() */ |
| 72 | data = swab32(data); | 72 | data = __kvm_swab32(data); |
| 73 | } | 73 | } |
| 74 | writel_relaxed(data, addr); | 74 | writel_relaxed(data, addr); |
| 75 | } else { | 75 | } else { |
| 76 | u32 data = readl_relaxed(addr); | 76 | u32 data = readl_relaxed(addr); |
| 77 | if (__is_be(vcpu)) { | 77 | if (__is_be(vcpu)) { |
| 78 | /* guest expects swabbed data */ | 78 | /* guest expects swabbed data */ |
| 79 | data = swab32(data); | 79 | data = __kvm_swab32(data); |
| 80 | } | 80 | } |
| 81 | vcpu_set_reg(vcpu, rd, data); | 81 | vcpu_set_reg(vcpu, rd, data); |
| 82 | } | 82 | } |
| @@ -9,7 +9,6 @@ config CSKY · 8 unmodified lines | |||
| 9 | select ARCH_USE_QUEUED_RWLOCKS if NR_CPUS>2 | 9 | select ARCH_USE_QUEUED_RWLOCKS if NR_CPUS>2 |
| 10 | select COMMON_CLK | 10 | select COMMON_CLK |
| 11 | select CLKSRC_MMIO | 11 | select CLKSRC_MMIO |
| 12 | select CLKSRC_OF | ||
| 13 | select CSKY_MPINTC if CPU_CK860 | 12 | select CSKY_MPINTC if CPU_CK860 |
| 14 | select CSKY_MP_TIMER if CPU_CK860 | 13 | select CSKY_MP_TIMER if CPU_CK860 |
| 15 | select CSKY_APB_INTC | 14 | select CSKY_APB_INTC |
| @@ -37,6 +36,7 @@ config CSKY · 21 unmodified lines | |||
| 37 | select GX6605S_TIMER if CPU_CK610 | 36 | select GX6605S_TIMER if CPU_CK610 |
| 38 | select HAVE_ARCH_TRACEHOOK | 37 | select HAVE_ARCH_TRACEHOOK |
| 39 | select HAVE_ARCH_AUDITSYSCALL | 38 | select HAVE_ARCH_AUDITSYSCALL |
| 39 | select HAVE_COPY_THREAD_TLS | ||
| 40 | select HAVE_DYNAMIC_FTRACE | 40 | select HAVE_DYNAMIC_FTRACE |
| 41 | select HAVE_FUNCTION_TRACER | 41 | select HAVE_FUNCTION_TRACER |
| 42 | select HAVE_FUNCTION_GRAPH_TRACER | 42 | select HAVE_FUNCTION_GRAPH_TRACER |
| @@ -47,8 +47,8 @@ config CSKY · 4 unmodified lines | |||
| 47 | select HAVE_PERF_EVENTS | 47 | select HAVE_PERF_EVENTS |
| 48 | select HAVE_PERF_REGS | 48 | select HAVE_PERF_REGS |
| 49 | select HAVE_PERF_USER_STACK_DUMP | 49 | select HAVE_PERF_USER_STACK_DUMP |
| 50 | select HAVE_DMA_API_DEBUG | ||
| 51 | select HAVE_DMA_CONTIGUOUS | 50 | select HAVE_DMA_CONTIGUOUS |
| 51 | select HAVE_STACKPROTECTOR | ||
| 52 | select HAVE_SYSCALL_TRACEPOINTS | 52 | select HAVE_SYSCALL_TRACEPOINTS |
| 53 | select MAY_HAVE_SPARSE_IRQ | 53 | select MAY_HAVE_SPARSE_IRQ |
| 54 | select MODULES_USE_ELF_RELA if MODULES | 54 | select MODULES_USE_ELF_RELA if MODULES |
| @@ -59,6 +59,11 @@ config CSKY · 4 unmodified lines | |||
| 59 | select TIMER_OF | 59 | select TIMER_OF |
| 60 | select USB_ARCH_HAS_EHCI | 60 | select USB_ARCH_HAS_EHCI |
| 61 | select USB_ARCH_HAS_OHCI | 61 | select USB_ARCH_HAS_OHCI |
| 62 | select GENERIC_PCI_IOMAP | ||
| 63 | select HAVE_PCI | ||
| 64 | select PCI_DOMAINS_GENERIC if PCI | ||
| 65 | select PCI_SYSCALL if PCI | ||
| 66 | select PCI_MSI if PCI | ||
| 62 | 67 | ||
| 63 | config CPU_HAS_CACHEV2 | 68 | config CPU_HAS_CACHEV2 |
| 64 | bool | 69 | bool |
| @@ -75,7 +80,7 @@ config CPU_HAS_TLBI · 10 unmodified lines | |||
| 75 | config CPU_HAS_LDSTEX | 80 | config CPU_HAS_LDSTEX |
| 76 | bool | 81 | bool |
| 77 | help | 82 | help |
| 78 | For SMP, CPU needs "ldex&stex" instrcutions to atomic operations. | 83 | For SMP, CPU needs "ldex&stex" instructions for atomic operations. |
| 79 | 84 | ||
| 80 | config CPU_NEED_TLBSYNC | 85 | config CPU_NEED_TLBSYNC |
| 81 | bool | 86 | bool |
| @@ -188,6 +193,40 @@ config CPU_PM_STOP · 106 unmodified lines | |||
| 188 | bool "stop" | 193 | bool "stop" |
| 189 | endchoice | 194 | endchoice |
| 190 | 195 | ||
| 196 | menuconfig HAVE_TCM | ||
| 197 | bool "Tightly-Coupled/Sram Memory" | ||
| 198 | select GENERIC_ALLOCATOR | ||
| 199 | help | ||
| 200 | The implementation are not only used by TCM (Tightly-Coupled Meory) | ||
| 201 | but also used by sram on SOC bus. It follow existed linux tcm | ||
| 202 | software interface, so that old tcm application codes could be | ||
| 203 | re-used directly. | ||
| 204 | |||
| 205 | if HAVE_TCM | ||
| 206 | config ITCM_RAM_BASE | ||
| 207 | hex "ITCM ram base" | ||
| 208 | default 0xffffffff | ||
| 209 | |||
| 210 | config ITCM_NR_PAGES | ||
| 211 | int "Page count of ITCM size: NR*4KB" | ||
| 212 | range 1 256 | ||
| 213 | default 32 | ||
| 214 | |||
| 215 | config HAVE_DTCM | ||
| 216 | bool "DTCM Support" | ||
| 217 | |||
| 218 | config DTCM_RAM_BASE | ||
| 219 | hex "DTCM ram base" | ||
| 220 | depends on HAVE_DTCM | ||
| 221 | default 0xffffffff | ||
| 222 | |||
| 223 | config DTCM_NR_PAGES | ||
| 224 | int "Page count of DTCM size: NR*4KB" | ||
| 225 | depends on HAVE_DTCM | ||
| 226 | range 1 256 | ||
| 227 | default 32 | ||
| 228 | endif | ||
| 229 | |||
| 191 | config CPU_HAS_VDSP | 230 | config CPU_HAS_VDSP |
| 192 | bool "CPU has VDSP coprocessor" | 231 | bool "CPU has VDSP coprocessor" |
| 193 | depends on CPU_HAS_FPU && CPU_HAS_FPUV2 | 232 | depends on CPU_HAS_FPU && CPU_HAS_FPUV2 |
| @@ -196,6 +235,10 @@ config CPU_HAS_FPU · 2 unmodified lines | |||
| 196 | bool "CPU has FPU coprocessor" | 235 | bool "CPU has FPU coprocessor" |
| 197 | depends on CPU_CK807 || CPU_CK810 || CPU_CK860 | 236 | depends on CPU_CK807 || CPU_CK810 || CPU_CK860 |
| 198 | 237 | ||
| 238 | config CPU_HAS_ICACHE_INS | ||
| 239 | bool "CPU has Icache invalidate instructions" | ||
| 240 | depends on CPU_HAS_CACHEV2 | ||
| 241 | |||
| 199 | config CPU_HAS_TEE | 242 | config CPU_HAS_TEE |
| 200 | bool "CPU has Trusted Execution Environment" | 243 | bool "CPU has Trusted Execution Environment" |
| 201 | depends on CPU_CK810 | 244 | depends on CPU_CK810 |
| @@ -235,4 +278,6 @@ config HOTPLUG_CPU · 33 unmodified lines | |||
| 235 | Say N if you want to disable CPU hotplug. | 278 | Say N if you want to disable CPU hotplug. |
| 236 | endmenu | 279 | endmenu |
| 237 | 280 | ||
| 281 | source "arch/csky/Kconfig.platforms" | ||
| 282 | |||
| 238 | source "kernel/Kconfig.hz" | 283 | source "kernel/Kconfig.hz" |
| @@ -0,0 +1,9 @@ | |||
| 1 | menu "Platform drivers selection" | ||
| 2 | |||
| 3 | config ARCH_CSKY_DW_APB_ICTL | ||
| 4 | bool "Select dw-apb interrupt controller" | ||
| 5 | select DW_APB_ICTL | ||
| 6 | default y | ||
| 7 | help | ||
| 8 | This enables support for snps dw-apb-ictl | ||
| 9 | endmenu | ||
| @@ -48,9 +48,8 @@ extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, u · 47 unmodified lines | |||
| 48 | 48 | ||
| 49 | #define flush_icache_page(vma, page) do {} while (0); | 49 | #define flush_icache_page(vma, page) do {} while (0); |
| 50 | #define flush_icache_range(start, end) cache_wbinv_range(start, end) | 50 | #define flush_icache_range(start, end) cache_wbinv_range(start, end) |
| 51 | 51 | #define flush_icache_mm_range(mm, start, end) cache_wbinv_range(start, end) | |
| 52 | #define flush_icache_user_range(vma,page,addr,len) \ | 52 | #define flush_icache_deferred(mm) do {} while (0); |
| 53 | flush_dcache_page(page) | ||
| 54 | 53 | ||
| 55 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | 54 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ |
| 56 | do { \ | 55 | do { \ |
| @@ -16,14 +16,16 @@ · 15 unmodified lines | |||
| 16 | #define LSAVE_A4 40 | 16 | #define LSAVE_A4 40 |
| 17 | #define LSAVE_A5 44 | 17 | #define LSAVE_A5 44 |
| 18 | 18 | ||
| 19 | #define usp ss1 | ||
| 20 | |||
| 19 | .macro USPTOKSP | 21 | .macro USPTOKSP |
| 20 | mtcr sp, ss1 | 22 | mtcr sp, usp |
| 21 | mfcr sp, ss0 | 23 | mfcr sp, ss0 |
| 22 | .endm | 24 | .endm |
| 23 | 25 | ||
| 24 | .macro KSPTOUSP | 26 | .macro KSPTOUSP |
| 25 | mtcr sp, ss0 | 27 | mtcr sp, ss0 |
| 26 | mfcr sp, ss1 | 28 | mfcr sp, usp |
| 27 | .endm | 29 | .endm |
| 28 | 30 | ||
| 29 | .macro SAVE_ALL epc_inc | 31 | .macro SAVE_ALL epc_inc |
| @@ -45,7 +47,13 @@ · 15 unmodified lines | |||
| 45 | add lr, r13 | 47 | add lr, r13 |
| 46 | stw lr, (sp, 8) | 48 | stw lr, (sp, 8) |
| 47 | 49 | ||
| 50 | mov lr, sp | ||
| 51 | addi lr, 32 | ||
| 52 | addi lr, 32 | ||
| 53 | addi lr, 16 | ||
| 54 | bt 2f | ||
| 48 | mfcr lr, ss1 | 55 | mfcr lr, ss1 |
| 56 | 2: | ||
| 49 | stw lr, (sp, 16) | 57 | stw lr, (sp, 16) |
| 50 | 58 | ||
| 51 | stw a0, (sp, 20) | 59 | stw a0, (sp, 20) |
| @@ -79,9 +87,10 @@ · 27 unmodified lines | |||
| 79 | ldw a0, (sp, 12) | 87 | ldw a0, (sp, 12) |
| 80 | mtcr a0, epsr | 88 | mtcr a0, epsr |
| 81 | btsti a0, 31 | 89 | btsti a0, 31 |
| 90 | bt 1f | ||
| 82 | ldw a0, (sp, 16) | 91 | ldw a0, (sp, 16) |
| 83 | mtcr a0, ss1 | 92 | mtcr a0, ss1 |
| 84 | 93 | 1: | |
| 85 | ldw a0, (sp, 24) | 94 | ldw a0, (sp, 24) |
| 86 | ldw a1, (sp, 28) | 95 | ldw a1, (sp, 28) |
| 87 | ldw a2, (sp, 32) | 96 | ldw a2, (sp, 32) |
| @@ -102,9 +111,9 @@ · 14 unmodified lines | |||
| 102 | addi sp, 32 | 111 | addi sp, 32 |
| 103 | addi sp, 8 | 112 | addi sp, 8 |
| 104 | 113 | ||
| 105 | bt 1f | 114 | bt 2f |
| 106 | KSPTOUSP | 115 | KSPTOUSP |
| 107 | 1: | 116 | 2: |
| 108 | rte | 117 | rte |
| 109 | .endm | 118 | .endm |
| 110 | 119 | ||
| @@ -6,46 +6,80 @@ · 5 unmodified lines | |||
| 6 | #include <linux/mm.h> | 6 | #include <linux/mm.h> |
| 7 | #include <asm/cache.h> | 7 | #include <asm/cache.h> |
| 8 | 8 | ||
| 9 | void flush_icache_page(struct vm_area_struct *vma, struct page *page) | 9 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, |
| 10 | pte_t *pte) | ||
| 10 | { | 11 | { |
| 11 | unsigned long start; | 12 | unsigned long addr; |
| 13 | struct page *page; | ||
| 12 | 14 | ||
| 13 | start = (unsigned long) kmap_atomic(page); | 15 | page = pfn_to_page(pte_pfn(*pte)); |
| 16 | if (page == ZERO_PAGE(0)) | ||
| 17 | return; | ||
| 14 | 18 | ||
| 15 | cache_wbinv_range(start, start + PAGE_SIZE); | 19 | if (test_and_set_bit(PG_dcache_clean, &page->flags)) |
| 20 | return; | ||
| 16 | 21 | ||
| 17 | kunmap_atomic((void *)start); | 22 | addr = (unsigned long) kmap_atomic(page); |
| 18 | } | ||
| 19 | 23 | ||
| 20 | void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, | 24 | dcache_wb_range(addr, addr + PAGE_SIZE); |
| 21 | unsigned long vaddr, int len) | ||
| 22 | { | ||
| 23 | unsigned long kaddr; | ||
| 24 | 25 | ||
| 25 | kaddr = (unsigned long) kmap_atomic(page) + (vaddr & ~PAGE_MASK); | 26 | if (vma->vm_flags & VM_EXEC) |
| 27 | icache_inv_range(addr, addr + PAGE_SIZE); | ||
| 28 | |||
| 29 | kunmap_atomic((void *) addr); | ||
| 30 | } | ||
| 26 | 31 | ||
| 27 | cache_wbinv_range(kaddr, kaddr + len); | 32 | void flush_icache_deferred(struct mm_struct *mm) |
| 33 | { | ||
| 34 | unsigned int cpu = smp_processor_id(); | ||
| 35 | cpumask_t *mask = &mm->context.icache_stale_mask; | ||
| 28 | 36 | ||
| 29 | kunmap_atomic((void *)kaddr); | 37 | if (cpumask_test_cpu(cpu, mask)) { |
| 38 | cpumask_clear_cpu(cpu, mask); | ||
| 39 | /* | ||
| 40 | * Ensure the remote hart's writes are visible to this hart. | ||
| 41 | * This pairs with a barrier in flush_icache_mm. | ||
| 42 | */ | ||
| 43 | smp_mb(); | ||
| 44 | local_icache_inv_all(NULL); | ||
| 45 | } | ||
| 30 | } | 46 | } |
| 31 | 47 | ||
| 32 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, | 48 | void flush_icache_mm_range(struct mm_struct *mm, |
| 33 | pte_t *pte) | 49 | unsigned long start, unsigned long end) |
| 34 | { | 50 | { |
| 35 | unsigned long addr, pfn; | 51 | unsigned int cpu; |
| 36 | struct page *page; | 52 | cpumask_t others, *mask; |
| 37 | 53 | ||
| 38 | pfn = pte_pfn(*pte); | 54 | preempt_disable(); |
| 39 | if (unlikely(!pfn_valid(pfn))) | ||
| 40 | return; | ||
| 41 | 55 | ||
| 42 | page = pfn_to_page(pfn); | 56 | #ifdef CONFIG_CPU_HAS_ICACHE_INS |
| 43 | if (page == ZERO_PAGE(0)) | 57 | if (mm == current->mm) { |
| 58 | icache_inv_range(start, end); | ||
| 59 | preempt_enable(); | ||
| 44 | return; | 60 | return; |
| 61 | } | ||
| 62 | #endif | ||
| 45 | 63 | ||
| 46 | addr = (unsigned long) kmap_atomic(page); | 64 | /* Mark every hart's icache as needing a flush for this MM. */ |
| 65 | mask = &mm->context.icache_stale_mask; | ||
| 66 | cpumask_setall(mask); | ||
| 47 | 67 | ||
| 48 | cache_wbinv_range(addr, addr + PAGE_SIZE); | 68 | /* Flush this hart's I$ now, and mark it as flushed. */ |
| 69 | cpu = smp_processor_id(); | ||
| 70 | cpumask_clear_cpu(cpu, mask); | ||
| 71 | local_icache_inv_all(NULL); | ||
| 49 | 72 | ||
| 50 | kunmap_atomic((void *) addr); | 73 | /* |
| 74 | * Flush the I$ of other harts concurrently executing, and mark them as | ||
| 75 | * flushed. | ||
| 76 | */ | ||
| 77 | cpumask_andnot(&others, mm_cpumask(mm), cpumask_of(cpu)); | ||
| 78 | |||
| 79 | if (mm != current->active_mm || !cpumask_empty(&others)) { | ||
| 80 | on_each_cpu_mask(&others, local_icache_inv_all, NULL, 1); | ||
| 81 | cpumask_clear(mask); | ||
| 82 | } | ||
| 83 | |||
| 84 | preempt_enable(); | ||
| 51 | } | 85 | } |
| @@ -13,24 +13,27 @@ · 12 unmodified lines | |||
| 13 | #define flush_cache_all() do { } while (0) | 13 | #define flush_cache_all() do { } while (0) |
| 14 | #define flush_cache_mm(mm) do { } while (0) | 14 | #define flush_cache_mm(mm) do { } while (0) |
| 15 | #define flush_cache_dup_mm(mm) do { } while (0) | 15 | #define flush_cache_dup_mm(mm) do { } while (0) |
| 16 | #define flush_cache_range(vma, start, end) do { } while (0) | ||
| 17 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) | ||
| 16 | 18 | ||
| 17 | #define flush_cache_range(vma, start, end) \ | 19 | #define PG_dcache_clean PG_arch_1 |
| 18 | do { \ | 20 | |
| 19 | if (vma->vm_flags & VM_EXEC) \ | 21 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 |
| 20 | icache_inv_all(); \ | 22 | static inline void flush_dcache_page(struct page *page) |
| 21 | } while (0) | 23 | { |
| 24 | if (test_bit(PG_dcache_clean, &page->flags)) | ||
| 25 | clear_bit(PG_dcache_clean, &page->flags); | ||
| 26 | } | ||
| 22 | 27 | ||
| 23 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) | ||
| 24 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 | ||
| 25 | #define flush_dcache_page(page) do { } while (0) | ||
| 26 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | 28 | #define flush_dcache_mmap_lock(mapping) do { } while (0) |
| 27 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | 29 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) |
| 30 | #define flush_icache_page(vma, page) do { } while (0) | ||
| 28 | 31 | ||
| 29 | #define flush_icache_range(start, end) cache_wbinv_range(start, end) | 32 | #define flush_icache_range(start, end) cache_wbinv_range(start, end) |
| 30 | 33 | ||
| 31 | void flush_icache_page(struct vm_area_struct *vma, struct page *page); | 34 | void flush_icache_mm_range(struct mm_struct *mm, |
| 32 | void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, | 35 | unsigned long start, unsigned long end); |
| 33 | unsigned long vaddr, int len); | 36 | void flush_icache_deferred(struct mm_struct *mm); |
| 34 | 37 | ||
| 35 | #define flush_cache_vmap(start, end) do { } while (0) | 38 | #define flush_cache_vmap(start, end) do { } while (0) |
| 36 | #define flush_cache_vunmap(start, end) do { } while (0) | 39 | #define flush_cache_vunmap(start, end) do { } while (0) |
| @@ -38,7 +41,13 @@ void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, · 1 unmodified line | |||
| 38 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | 41 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ |
| 39 | do { \ | 42 | do { \ |
| 40 | memcpy(dst, src, len); \ | 43 | memcpy(dst, src, len); \ |
| 41 | cache_wbinv_range((unsigned long)dst, (unsigned long)dst + len); \ | 44 | if (vma->vm_flags & VM_EXEC) { \ |
| 45 | dcache_wb_range((unsigned long)dst, \ | ||
| 46 | (unsigned long)dst + len); \ | ||
| 47 | flush_icache_mm_range(current->mm, \ | ||
| 48 | (unsigned long)dst, \ | ||
| 49 | (unsigned long)dst + len); \ | ||
| 50 | } \ | ||
| 42 | } while (0) | 51 | } while (0) |
| 43 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | 52 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ |
| 44 | memcpy(dst, src, len) | 53 | memcpy(dst, src, len) |
| @@ -31,7 +31,13 @@ · 30 unmodified lines | |||
| 31 | 31 | ||
| 32 | mfcr lr, epsr | 32 | mfcr lr, epsr |
| 33 | stw lr, (sp, 12) | 33 | stw lr, (sp, 12) |
| 34 | btsti lr, 31 | ||
| 35 | bf 1f | ||
| 36 | addi lr, sp, 152 | ||
| 37 | br 2f | ||
| 38 | 1: | ||
| 34 | mfcr lr, usp | 39 | mfcr lr, usp |
| 40 | 2: | ||
| 35 | stw lr, (sp, 16) | 41 | stw lr, (sp, 16) |
| 36 | 42 | ||
| 37 | stw a0, (sp, 20) | 43 | stw a0, (sp, 20) |
| @@ -64,8 +70,10 @@ · 26 unmodified lines | |||
| 64 | mtcr a0, epc | 70 | mtcr a0, epc |
| 65 | ldw a0, (sp, 12) | 71 | ldw a0, (sp, 12) |
| 66 | mtcr a0, epsr | 72 | mtcr a0, epsr |
| 73 | btsti a0, 31 | ||
| 67 | ldw a0, (sp, 16) | 74 | ldw a0, (sp, 16) |
| 68 | mtcr a0, usp | 75 | mtcr a0, usp |
| 76 | mtcr a0, ss0 | ||
| 69 | 77 | ||
| 70 | #ifdef CONFIG_CPU_HAS_HILO | 78 | #ifdef CONFIG_CPU_HAS_HILO |
| 71 | ldw a0, (sp, 140) | 79 | ldw a0, (sp, 140) |
| @@ -86,6 +94,9 @@ · 14 unmodified lines | |||
| 86 | addi sp, 40 | 94 | addi sp, 40 |
| 87 | ldm r16-r30, (sp) | 95 | ldm r16-r30, (sp) |
| 88 | addi sp, 72 | 96 | addi sp, 72 |
| 97 | bf 1f | ||
| 98 | mfcr sp, ss0 | ||
| 99 | 1: | ||
| 89 | rte | 100 | rte |
| 90 | .endm | 101 | .endm |
| 91 | 102 | ||
| @@ -10,9 +10,6 @@ CONFIG_BSD_PROCESS_ACCT=y · 9 unmodified lines | |||
| 10 | CONFIG_BSD_PROCESS_ACCT_V3=y | 10 | CONFIG_BSD_PROCESS_ACCT_V3=y |
| 11 | CONFIG_MODULES=y | 11 | CONFIG_MODULES=y |
| 12 | CONFIG_MODULE_UNLOAD=y | 12 | CONFIG_MODULE_UNLOAD=y |
| 13 | CONFIG_DEFAULT_DEADLINE=y | ||
| 14 | CONFIG_CPU_CK807=y | ||
| 15 | CONFIG_CPU_HAS_FPU=y | ||
| 16 | CONFIG_NET=y | 13 | CONFIG_NET=y |
| 17 | CONFIG_PACKET=y | 14 | CONFIG_PACKET=y |
| 18 | CONFIG_UNIX=y | 15 | CONFIG_UNIX=y |
| @@ -27,10 +24,7 @@ CONFIG_SERIAL_NONSTANDARD=y · 8 unmodified lines | |||
| 27 | CONFIG_SERIAL_8250=y | 24 | CONFIG_SERIAL_8250=y |
| 28 | CONFIG_SERIAL_8250_CONSOLE=y | 25 | CONFIG_SERIAL_8250_CONSOLE=y |
| 29 | CONFIG_SERIAL_OF_PLATFORM=y | 26 | CONFIG_SERIAL_OF_PLATFORM=y |
| 30 | CONFIG_TTY_PRINTK=y | ||
| 31 | # CONFIG_VGA_CONSOLE is not set | 27 | # CONFIG_VGA_CONSOLE is not set |
| 32 | CONFIG_CSKY_MPTIMER=y | ||
| 33 | CONFIG_GX6605S_TIMER=y | ||
| 34 | CONFIG_PM_DEVFREQ=y | 28 | CONFIG_PM_DEVFREQ=y |
| 35 | CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y | 29 | CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y |
| 36 | CONFIG_DEVFREQ_GOV_PERFORMANCE=y | 30 | CONFIG_DEVFREQ_GOV_PERFORMANCE=y |
| @@ -56,6 +50,4 @@ CONFIG_CRAMFS=y · 19 unmodified lines | |||
| 56 | CONFIG_ROMFS_FS=y | 50 | CONFIG_ROMFS_FS=y |
| 57 | CONFIG_NFS_FS=y | 51 | CONFIG_NFS_FS=y |
| 58 | CONFIG_PRINTK_TIME=y | 52 | CONFIG_PRINTK_TIME=y |
| 59 | CONFIG_DEBUG_INFO=y | ||
| 60 | CONFIG_DEBUG_FS=y | ||
| 61 | CONFIG_MAGIC_SYSRQ=y | 53 | CONFIG_MAGIC_SYSRQ=y |
| @@ -28,7 +28,6 @@ generic-y += local64.h · 27 unmodified lines | |||
| 28 | generic-y += mm-arch-hooks.h | 28 | generic-y += mm-arch-hooks.h |
| 29 | generic-y += mmiowb.h | 29 | generic-y += mmiowb.h |
| 30 | generic-y += module.h | 30 | generic-y += module.h |
| 31 | generic-y += pci.h | ||
| 32 | generic-y += percpu.h | 31 | generic-y += percpu.h |
| 33 | generic-y += preempt.h | 32 | generic-y += preempt.h |
| 34 | generic-y += qrwlock.h | 33 | generic-y += qrwlock.h |
| @@ -16,6 +16,7 @@ void dcache_wb_line(unsigned long start); · 15 unmodified lines | |||
| 16 | 16 | ||
| 17 | void icache_inv_range(unsigned long start, unsigned long end); | 17 | void icache_inv_range(unsigned long start, unsigned long end); |
| 18 | void icache_inv_all(void); | 18 | void icache_inv_all(void); |
| 19 | void local_icache_inv_all(void *priv); | ||
| 19 | 20 | ||
| 20 | void dcache_wb_range(unsigned long start, unsigned long end); | 21 | void dcache_wb_range(unsigned long start, unsigned long end); |
| 21 | void dcache_wbinv_all(void); | 22 | void dcache_wbinv_all(void); |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | |||
| 4 | #ifndef __ASM_CSKY_CACHEFLUSH_H | 4 | #ifndef __ASM_CSKY_CACHEFLUSH_H |
| 5 | #define __ASM_CSKY_CACHEFLUSH_H | 5 | #define __ASM_CSKY_CACHEFLUSH_H |
| 6 | 6 | ||
| 7 | #include <linux/mm.h> | ||
| 7 | #include <abi/cacheflush.h> | 8 | #include <abi/cacheflush.h> |
| 8 | 9 | ||
| 9 | #endif /* __ASM_CSKY_CACHEFLUSH_H */ | 10 | #endif /* __ASM_CSKY_CACHEFLUSH_H */ |
| @@ -5,12 +5,16 @@ · 4 unmodified lines | |||
| 5 | #define __ASM_CSKY_FIXMAP_H | 5 | #define __ASM_CSKY_FIXMAP_H |
| 6 | 6 | ||
| 7 | #include <asm/page.h> | 7 | #include <asm/page.h> |
| 8 | #include <asm/memory.h> | ||
| 8 | #ifdef CONFIG_HIGHMEM | 9 | #ifdef CONFIG_HIGHMEM |
| 9 | #include <linux/threads.h> | 10 | #include <linux/threads.h> |
| 10 | #include <asm/kmap_types.h> | 11 | #include <asm/kmap_types.h> |
| 11 | #endif | 12 | #endif |
| 12 | 13 | ||
| 13 | enum fixed_addresses { | 14 | enum fixed_addresses { |
| 15 | #ifdef CONFIG_HAVE_TCM | ||
| 16 | FIX_TCM = TCM_NR_PAGES, | ||
| 17 | #endif | ||
| 14 | #ifdef CONFIG_HIGHMEM | 18 | #ifdef CONFIG_HIGHMEM |
| 15 | FIX_KMAP_BEGIN, | 19 | FIX_KMAP_BEGIN, |
| 16 | FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1, | 20 | FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1, |
| @@ -18,10 +22,13 @@ enum fixed_addresses { · 1 unmodified line | |||
| 18 | __end_of_fixed_addresses | 22 | __end_of_fixed_addresses |
| 19 | }; | 23 | }; |
| 20 | 24 | ||
| 21 | #define FIXADDR_TOP 0xffffc000 | ||
| 22 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | 25 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) |
| 23 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | 26 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) |
| 24 | 27 | ||
| 25 | #include <asm-generic/fixmap.h> | 28 | #include <asm-generic/fixmap.h> |
| 26 | 29 | ||
| 30 | extern void fixrange_init(unsigned long start, unsigned long end, | ||
| 31 | pgd_t *pgd_base); | ||
| 32 | extern void __init fixaddr_init(void); | ||
| 33 | |||
| 27 | #endif /* __ASM_CSKY_FIXMAP_H */ | 34 | #endif /* __ASM_CSKY_FIXMAP_H */ |
| @@ -0,0 +1,25 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | |||
| 3 | #ifndef __ASM_CSKY_MEMORY_H | ||
| 4 | #define __ASM_CSKY_MEMORY_H | ||
| 5 | |||
| 6 | #include <linux/compiler.h> | ||
| 7 | #include <linux/const.h> | ||
| 8 | #include <linux/types.h> | ||
| 9 | #include <linux/sizes.h> | ||
| 10 | |||
| 11 | #define FIXADDR_TOP _AC(0xffffc000, UL) | ||
| 12 | #define PKMAP_BASE _AC(0xff800000, UL) | ||
| 13 | #define VMALLOC_START _AC(0xc0008000, UL) | ||
| 14 | #define VMALLOC_END (PKMAP_BASE - (PAGE_SIZE * 2)) | ||
| 15 | |||
| 16 | #ifdef CONFIG_HAVE_TCM | ||
| 17 | #ifdef CONFIG_HAVE_DTCM | ||
| 18 | #define TCM_NR_PAGES (CONFIG_ITCM_NR_PAGES + CONFIG_DTCM_NR_PAGES) | ||
| 19 | #else | ||
| 20 | #define TCM_NR_PAGES (CONFIG_ITCM_NR_PAGES) | ||
| 21 | #endif | ||
| 22 | #define FIXADDR_TCM _AC(FIXADDR_TOP - (TCM_NR_PAGES * PAGE_SIZE), UL) | ||
| 23 | #endif | ||
| 24 | |||
| 25 | #endif | ||
| @@ -7,6 +7,7 @@ · 6 unmodified lines | |||
| 7 | typedef struct { | 7 | typedef struct { |
| 8 | atomic64_t asid; | 8 | atomic64_t asid; |
| 9 | void *vdso; | 9 | void *vdso; |
| 10 | cpumask_t icache_stale_mask; | ||
| 10 | } mm_context_t; | 11 | } mm_context_t; |
| 11 | 12 | ||
| 12 | #endif /* __ASM_CSKY_MMU_H */ | 13 | #endif /* __ASM_CSKY_MMU_H */ |
| @@ -43,5 +43,7 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, · 42 unmodified lines | |||
| 43 | 43 | ||
| 44 | TLBMISS_HANDLER_SETUP_PGD(next->pgd); | 44 | TLBMISS_HANDLER_SETUP_PGD(next->pgd); |
| 45 | write_mmu_entryhi(next->context.asid.counter); | 45 | write_mmu_entryhi(next->context.asid.counter); |
| 46 | |||
| 47 | flush_icache_deferred(next); | ||
| 46 | } | 48 | } |
| 47 | #endif /* __ASM_CSKY_MMU_CONTEXT_H */ | 49 | #endif /* __ASM_CSKY_MMU_CONTEXT_H */ |
| @@ -0,0 +1,34 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | |||
| 3 | #ifndef __ASM_CSKY_PCI_H | ||
| 4 | #define __ASM_CSKY_PCI_H | ||
| 5 | |||
| 6 | #include <linux/types.h> | ||
| 7 | #include <linux/slab.h> | ||
| 8 | #include <linux/dma-mapping.h> | ||
| 9 | |||
| 10 | #include <asm/io.h> | ||
| 11 | |||
| 12 | #define PCIBIOS_MIN_IO 0 | ||
| 13 | #define PCIBIOS_MIN_MEM 0 | ||
| 14 | |||
| 15 | /* C-SKY shim does not initialize PCI bus */ | ||
| 16 | #define pcibios_assign_all_busses() 1 | ||
| 17 | |||
| 18 | extern int isa_dma_bridge_buggy; | ||
| 19 | |||
| 20 | #ifdef CONFIG_PCI | ||
| 21 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | ||
| 22 | { | ||
| 23 | /* no legacy IRQ on csky */ | ||
| 24 | return -ENODEV; | ||
| 25 | } | ||
| 26 | |||
| 27 | static inline int pci_proc_domain(struct pci_bus *bus) | ||
| 28 | { | ||
| 29 | /* always show the domain in /proc */ | ||
| 30 | return 1; | ||
| 31 | } | ||
| 32 | #endif /* CONFIG_PCI */ | ||
| 33 | |||
| 34 | #endif /* __ASM_CSKY_PCI_H */ | ||
| @@ -5,6 +5,7 @@ · 4 unmodified lines | |||
| 5 | #define __ASM_CSKY_PGTABLE_H | 5 | #define __ASM_CSKY_PGTABLE_H |
| 6 | 6 | ||
| 7 | #include <asm/fixmap.h> | 7 | #include <asm/fixmap.h> |
| 8 | #include <asm/memory.h> | ||
| 8 | #include <asm/addrspace.h> | 9 | #include <asm/addrspace.h> |
| 9 | #include <abi/pgtable-bits.h> | 10 | #include <abi/pgtable-bits.h> |
| 10 | #include <asm-generic/pgtable-nopmd.h> | 11 | #include <asm-generic/pgtable-nopmd.h> |
| @@ -16,11 +17,6 @@ · 5 unmodified lines | |||
| 16 | #define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE) | 17 | #define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE) |
| 17 | #define FIRST_USER_ADDRESS 0UL | 18 | #define FIRST_USER_ADDRESS 0UL |
| 18 | 19 | ||
| 19 | #define PKMAP_BASE (0xff800000) | ||
| 20 | |||
| 21 | #define VMALLOC_START (0xc0008000) | ||
| 22 | #define VMALLOC_END (PKMAP_BASE - 2*PAGE_SIZE) | ||
| 23 | |||
| 24 | /* | 20 | /* |
| 25 | * C-SKY is two-level paging structure: | 21 | * C-SKY is two-level paging structure: |
| 26 | */ | 22 | */ |
| @@ -0,0 +1,29 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_STACKPROTECTOR_H | ||
| 3 | #define _ASM_STACKPROTECTOR_H 1 | ||
| 4 | |||
| 5 | #include <linux/random.h> | ||
| 6 | #include <linux/version.h> | ||
| 7 | |||
| 8 | extern unsigned long __stack_chk_guard; | ||
| 9 | |||
| 10 | /* | ||
| 11 | * Initialize the stackprotector canary value. | ||
| 12 | * | ||
| 13 | * NOTE: this must only be called from functions that never return, | ||
| 14 | * and it must always be inlined. | ||
| 15 | */ | ||
| 16 | static __always_inline void boot_init_stack_canary(void) | ||
| 17 | { | ||
| 18 | unsigned long canary; | ||
| 19 | |||
| 20 | /* Try to get a semi random initial value. */ | ||
| 21 | get_random_bytes(&canary, sizeof(canary)); | ||
| 22 | canary ^= LINUX_VERSION_CODE; | ||
| 23 | canary &= CANARY_MASK; | ||
| 24 | |||
| 25 | current->stack_canary = canary; | ||
| 26 | __stack_chk_guard = current->stack_canary; | ||
| 27 | } | ||
| 28 | |||
| 29 | #endif /* __ASM_SH_STACKPROTECTOR_H */ | ||
| @@ -0,0 +1,24 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | |||
| 3 | #ifndef __ASM_CSKY_TCM_H | ||
| 4 | #define __ASM_CSKY_TCM_H | ||
| 5 | |||
| 6 | #ifndef CONFIG_HAVE_TCM | ||
| 7 | #error "You should not be including tcm.h unless you have a TCM!" | ||
| 8 | #endif | ||
| 9 | |||
| 10 | #include <linux/compiler.h> | ||
| 11 | |||
| 12 | /* Tag variables with this */ | ||
| 13 | #define __tcmdata __section(.tcm.data) | ||
| 14 | /* Tag constants with this */ | ||
| 15 | #define __tcmconst __section(.tcm.rodata) | ||
| 16 | /* Tag functions inside TCM called from outside TCM with this */ | ||
| 17 | #define __tcmfunc __section(.tcm.text) noinline | ||
| 18 | /* Tag function inside TCM called from inside TCM with this */ | ||
| 19 | #define __tcmlocalfunc __section(.tcm.text) | ||
| 20 | |||
| 21 | void *tcm_alloc(size_t len); | ||
| 22 | void tcm_free(void *addr, size_t len); | ||
| 23 | |||
| 24 | #endif | ||
| @@ -1,7 +1,10 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
| 2 | // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. | 2 | // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. |
| 3 | 3 | ||
| 4 | #define __ARCH_WANT_STAT64 | ||
| 5 | #define __ARCH_WANT_NEW_STAT | ||
| 4 | #define __ARCH_WANT_SYS_CLONE | 6 | #define __ARCH_WANT_SYS_CLONE |
| 7 | #define __ARCH_WANT_SYS_CLONE3 | ||
| 5 | #define __ARCH_WANT_SET_GET_RLIMIT | 8 | #define __ARCH_WANT_SET_GET_RLIMIT |
| 6 | #define __ARCH_WANT_TIME32_SYSCALLS | 9 | #define __ARCH_WANT_TIME32_SYSCALLS |
| 7 | #include <asm-generic/unistd.h> | 10 | #include <asm-generic/unistd.h> |
| @@ -17,10 +17,12 @@ ENTRY(csky_cmpxchg) · 16 unmodified lines | |||
| 17 | mfcr a3, epc | 17 | mfcr a3, epc |
| 18 | addi a3, TRAP0_SIZE | 18 | addi a3, TRAP0_SIZE |
| 19 | 19 | ||
| 20 | subi sp, 8 | 20 | subi sp, 16 |
| 21 | stw a3, (sp, 0) | 21 | stw a3, (sp, 0) |
| 22 | mfcr a3, epsr | 22 | mfcr a3, epsr |
| 23 | stw a3, (sp, 4) | 23 | stw a3, (sp, 4) |
| 24 | mfcr a3, usp | ||
| 25 | stw a3, (sp, 8) | ||
| 24 | 26 | ||
| 25 | psrset ee | 27 | psrset ee |
| 26 | #ifdef CONFIG_CPU_HAS_LDSTEX | 28 | #ifdef CONFIG_CPU_HAS_LDSTEX |
| @@ -47,7 +49,9 @@ ENTRY(csky_cmpxchg) · 20 unmodified lines | |||
| 47 | mtcr a3, epc | 49 | mtcr a3, epc |
| 48 | ldw a3, (sp, 4) | 50 | ldw a3, (sp, 4) |
| 49 | mtcr a3, epsr | 51 | mtcr a3, epsr |
| 50 | addi sp, 8 | 52 | ldw a3, (sp, 8) |
| 53 | mtcr a3, usp | ||
| 54 | addi sp, 16 | ||
| 51 | KSPTOUSP | 55 | KSPTOUSP |
| 52 | rte | 56 | rte |
| 53 | END(csky_cmpxchg) | 57 | END(csky_cmpxchg) |
| @@ -16,6 +16,12 @@ · 15 unmodified lines | |||
| 16 | 16 | ||
| 17 | struct cpuinfo_csky cpu_data[NR_CPUS]; | 17 | struct cpuinfo_csky cpu_data[NR_CPUS]; |
| 18 | 18 | ||
| 19 | #ifdef CONFIG_STACKPROTECTOR | ||
| 20 | #include <linux/stackprotector.h> | ||
| 21 | unsigned long __stack_chk_guard __read_mostly; | ||
| 22 | EXPORT_SYMBOL(__stack_chk_guard); | ||
| 23 | #endif | ||
| 24 | |||
| 19 | asmlinkage void ret_from_fork(void); | 25 | asmlinkage void ret_from_fork(void); |
| 20 | asmlinkage void ret_from_kernel_thread(void); | 26 | asmlinkage void ret_from_kernel_thread(void); |
| 21 | 27 | ||
| @@ -34,10 +40,11 @@ unsigned long thread_saved_pc(struct task_struct *tsk) · 12 unmodified lines | |||
| 34 | return sw->r15; | 40 | return sw->r15; |
| 35 | } | 41 | } |
| 36 | 42 | ||
| 37 | int copy_thread(unsigned long clone_flags, | 43 | int copy_thread_tls(unsigned long clone_flags, |
| 38 | unsigned long usp, | 44 | unsigned long usp, |
| 39 | unsigned long kthread_arg, | 45 | unsigned long kthread_arg, |
| 40 | struct task_struct *p) | 46 | struct task_struct *p, |
| 47 | unsigned long tls) | ||
| 41 | { | 48 | { |
| 42 | struct switch_stack *childstack; | 49 | struct switch_stack *childstack; |
| 43 | struct pt_regs *childregs = task_pt_regs(p); | 50 | struct pt_regs *childregs = task_pt_regs(p); |
| @@ -64,7 +71,7 @@ int copy_thread(unsigned long clone_flags, · 20 unmodified lines | |||
| 64 | childregs->usp = usp; | 71 | childregs->usp = usp; |
| 65 | if (clone_flags & CLONE_SETTLS) | 72 | if (clone_flags & CLONE_SETTLS) |
| 66 | task_thread_info(p)->tp_value = childregs->tls | 73 | task_thread_info(p)->tp_value = childregs->tls |
| 67 | = childregs->regs[0]; | 74 | = tls; |
| 68 | 75 | ||
| 69 | childregs->a0 = 0; | 76 | childregs->a0 = 0; |
| 70 | childstack->r15 = (unsigned long) ret_from_fork; | 77 | childstack->r15 = (unsigned long) ret_from_fork; |
| @@ -47,9 +47,6 @@ static void __init csky_memblock_init(void) · 46 unmodified lines | |||
| 47 | signed long size; | 47 | signed long size; |
| 48 | 48 | ||
| 49 | memblock_reserve(__pa(_stext), _end - _stext); | 49 | memblock_reserve(__pa(_stext), _end - _stext); |
| 50 | #ifdef CONFIG_BLK_DEV_INITRD | ||
| 51 | memblock_reserve(__pa(initrd_start), initrd_end - initrd_start); | ||
| 52 | #endif | ||
| 53 | 50 | ||
| 54 | early_init_fdt_reserve_self(); | 51 | early_init_fdt_reserve_self(); |
| 55 | early_init_fdt_scan_reserved_mem(); | 52 | early_init_fdt_scan_reserved_mem(); |
| @@ -133,6 +130,8 @@ void __init setup_arch(char **cmdline_p) · 77 unmodified lines | |||
| 133 | 130 | ||
| 134 | sparse_init(); | 131 | sparse_init(); |
| 135 | 132 | ||
| 133 | fixaddr_init(); | ||
| 134 | |||
| 136 | #ifdef CONFIG_HIGHMEM | 135 | #ifdef CONFIG_HIGHMEM |
| 137 | kmap_init(); | 136 | kmap_init(); |
| 138 | #endif | 137 | #endif |
| @@ -120,7 +120,7 @@ void __init setup_smp_ipi(void) · 119 unmodified lines | |||
| 120 | int rc; | 120 | int rc; |
| 121 | 121 | ||
| 122 | if (ipi_irq == 0) | 122 | if (ipi_irq == 0) |
| 123 | panic("%s IRQ mapping failed\n", __func__); | 123 | return; |
| 124 | 124 | ||
| 125 | rc = request_percpu_irq(ipi_irq, handle_ipi, "IPI Interrupt", | 125 | rc = request_percpu_irq(ipi_irq, handle_ipi, "IPI Interrupt", |
| 126 | &ipi_dummy_dev); | 126 | &ipi_dummy_dev); |
| @@ -1,8 +1,8 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. | 2 | // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. |
| 3 | 3 | ||
| 4 | #include <linux/clk-provider.h> | ||
| 5 | #include <linux/clocksource.h> | 4 | #include <linux/clocksource.h> |
| 5 | #include <linux/of_clk.h> | ||
| 6 | 6 | ||
| 7 | void __init time_init(void) | 7 | void __init time_init(void) |
| 8 | { | 8 | { |
| @@ -2,6 +2,7 @@ · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | #include <asm/vmlinux.lds.h> | 3 | #include <asm/vmlinux.lds.h> |
| 4 | #include <asm/page.h> | 4 | #include <asm/page.h> |
| 5 | #include <asm/memory.h> | ||
| 5 | 6 | ||
| 6 | OUTPUT_ARCH(csky) | 7 | OUTPUT_ARCH(csky) |
| 7 | ENTRY(_start) | 8 | ENTRY(_start) |
| @@ -53,6 +54,54 @@ SECTIONS · 45 unmodified lines | |||
| 53 | RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) | 54 | RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) |
| 54 | _edata = .; | 55 | _edata = .; |
| 55 | 56 | ||
| 57 | #ifdef CONFIG_HAVE_TCM | ||
| 58 | .tcm_start : { | ||
| 59 | . = ALIGN(PAGE_SIZE); | ||
| 60 | __tcm_start = .; | ||
| 61 | } | ||
| 62 | |||
| 63 | .text_data_tcm FIXADDR_TCM : AT(__tcm_start) | ||
| 64 | { | ||
| 65 | . = ALIGN(4); | ||
| 66 | __stcm_text_data = .; | ||
| 67 | *(.tcm.text) | ||
| 68 | *(.tcm.rodata) | ||
| 69 | #ifndef CONFIG_HAVE_DTCM | ||
| 70 | *(.tcm.data) | ||
| 71 | #endif | ||
| 72 | . = ALIGN(4); | ||
| 73 | __etcm_text_data = .; | ||
| 74 | } | ||
| 75 | |||
| 76 | . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_data_tcm); | ||
| 77 | |||
| 78 | #ifdef CONFIG_HAVE_DTCM | ||
| 79 | #define ITCM_SIZE CONFIG_ITCM_NR_PAGES * PAGE_SIZE | ||
| 80 | |||
| 81 | .dtcm_start : { | ||
| 82 | __dtcm_start = .; | ||
| 83 | } | ||
| 84 | |||
| 85 | .data_tcm FIXADDR_TCM + ITCM_SIZE : AT(__dtcm_start) | ||
| 86 | { | ||
| 87 | . = ALIGN(4); | ||
| 88 | __stcm_data = .; | ||
| 89 | *(.tcm.data) | ||
| 90 | . = ALIGN(4); | ||
| 91 | __etcm_data = .; | ||
| 92 | } | ||
| 93 | |||
| 94 | . = ADDR(.dtcm_start) + SIZEOF(.data_tcm); | ||
| 95 | |||
| 96 | .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_tcm)) { | ||
| 97 | #else | ||
| 98 | .tcm_end : AT(ADDR(.tcm_start) + SIZEOF(.text_data_tcm)) { | ||
| 99 | #endif | ||
| 100 | . = ALIGN(PAGE_SIZE); | ||
| 101 | __tcm_end = .; | ||
| 102 | } | ||
| 103 | #endif | ||
| 104 | |||
| 56 | EXCEPTION_TABLE(L1_CACHE_BYTES) | 105 | EXCEPTION_TABLE(L1_CACHE_BYTES) |
| 57 | BSS_SECTION(L1_CACHE_BYTES, PAGE_SIZE, L1_CACHE_BYTES) | 106 | BSS_SECTION(L1_CACHE_BYTES, PAGE_SIZE, L1_CACHE_BYTES) |
| 58 | VBR_BASE | 107 | VBR_BASE |
| @@ -1,8 +1,10 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | ifeq ($(CONFIG_CPU_HAS_CACHEV2),y) | 2 | ifeq ($(CONFIG_CPU_HAS_CACHEV2),y) |
| 3 | obj-y += cachev2.o | 3 | obj-y += cachev2.o |
| 4 | CFLAGS_REMOVE_cachev2.o = $(CC_FLAGS_FTRACE) | ||
| 4 | else | 5 | else |
| 5 | obj-y += cachev1.o | 6 | obj-y += cachev1.o |
| 7 | CFLAGS_REMOVE_cachev1.o = $(CC_FLAGS_FTRACE) | ||
| 6 | endif | 8 | endif |
| 7 | 9 | ||
| 8 | obj-y += dma-mapping.o | 10 | obj-y += dma-mapping.o |
| @@ -14,3 +16,4 @@ obj-y += syscache.o · 5 unmodified lines | |||
| 14 | obj-y += tlb.o | 16 | obj-y += tlb.o |
| 15 | obj-y += asid.o | 17 | obj-y += asid.o |
| 16 | obj-y += context.o | 18 | obj-y += context.o |
| 19 | obj-$(CONFIG_HAVE_TCM) += tcm.o | ||
| @@ -94,6 +94,11 @@ void icache_inv_all(void) · 93 unmodified lines | |||
| 94 | cache_op_all(INS_CACHE|CACHE_INV, 0); | 94 | cache_op_all(INS_CACHE|CACHE_INV, 0); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | void local_icache_inv_all(void *priv) | ||
| 98 | { | ||
| 99 | cache_op_all(INS_CACHE|CACHE_INV, 0); | ||
| 100 | } | ||
| 101 | |||
| 97 | void dcache_wb_range(unsigned long start, unsigned long end) | 102 | void dcache_wb_range(unsigned long start, unsigned long end) |
| 98 | { | 103 | { |
| 99 | cache_op_range(start, end, DATA_CACHE|CACHE_CLR, 0); | 104 | cache_op_range(start, end, DATA_CACHE|CACHE_CLR, 0); |
| @@ -3,15 +3,25 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
| 5 | #include <linux/smp.h> | 5 | #include <linux/smp.h> |
| 6 | #include <linux/mm.h> | ||
| 6 | #include <asm/cache.h> | 7 | #include <asm/cache.h> |
| 7 | #include <asm/barrier.h> | 8 | #include <asm/barrier.h> |
| 8 | 9 | ||
| 9 | inline void dcache_wb_line(unsigned long start) | 10 | #define INS_CACHE (1 << 0) |
| 11 | #define CACHE_INV (1 << 4) | ||
| 12 | |||
| 13 | void local_icache_inv_all(void *priv) | ||
| 10 | { | 14 | { |
| 11 | asm volatile("dcache.cval1 %0\n"::"r"(start):"memory"); | 15 | mtcr("cr17", INS_CACHE|CACHE_INV); |
| 12 | sync_is(); | 16 | sync_is(); |
| 13 | } | 17 | } |
| 14 | 18 | ||
| 19 | void icache_inv_all(void) | ||
| 20 | { | ||
| 21 | on_each_cpu(local_icache_inv_all, NULL, 1); | ||
| 22 | } | ||
| 23 | |||
| 24 | #ifdef CONFIG_CPU_HAS_ICACHE_INS | ||
| 15 | void icache_inv_range(unsigned long start, unsigned long end) | 25 | void icache_inv_range(unsigned long start, unsigned long end) |
| 16 | { | 26 | { |
| 17 | unsigned long i = start & ~(L1_CACHE_BYTES - 1); | 27 | unsigned long i = start & ~(L1_CACHE_BYTES - 1); |
| @@ -20,43 +30,32 @@ void icache_inv_range(unsigned long start, unsigned long end) · 2 unmodified lines | |||
| 20 | asm volatile("icache.iva %0\n"::"r"(i):"memory"); | 30 | asm volatile("icache.iva %0\n"::"r"(i):"memory"); |
| 21 | sync_is(); | 31 | sync_is(); |
| 22 | } | 32 | } |
| 23 | 33 | #else | |
| 24 | void icache_inv_all(void) | 34 | void icache_inv_range(unsigned long start, unsigned long end) |
| 25 | { | 35 | { |
| 26 | asm volatile("icache.ialls\n":::"memory"); | 36 | icache_inv_all(); |
| 27 | sync_is(); | ||
| 28 | } | 37 | } |
| 38 | #endif | ||
| 29 | 39 | ||
| 30 | void dcache_wb_range(unsigned long start, unsigned long end) | 40 | inline void dcache_wb_line(unsigned long start) |
| 31 | { | 41 | { |
| 32 | unsigned long i = start & ~(L1_CACHE_BYTES - 1); | 42 | asm volatile("dcache.cval1 %0\n"::"r"(start):"memory"); |
| 33 | |||
| 34 | for (; i < end; i += L1_CACHE_BYTES) | ||
| 35 | asm volatile("dcache.cval1 %0\n"::"r"(i):"memory"); | ||
| 36 | sync_is(); | 43 | sync_is(); |
| 37 | } | 44 | } |
| 38 | 45 | ||
| 39 | void dcache_inv_range(unsigned long start, unsigned long end) | 46 | void dcache_wb_range(unsigned long start, unsigned long end) |
| 40 | { | 47 | { |
| 41 | unsigned long i = start & ~(L1_CACHE_BYTES - 1); | 48 | unsigned long i = start & ~(L1_CACHE_BYTES - 1); |
| 42 | 49 | ||
| 43 | for (; i < end; i += L1_CACHE_BYTES) | 50 | for (; i < end; i += L1_CACHE_BYTES) |
| 44 | asm volatile("dcache.civa %0\n"::"r"(i):"memory"); | 51 | asm volatile("dcache.cval1 %0\n"::"r"(i):"memory"); |
| 45 | sync_is(); | 52 | sync_is(); |
| 46 | } | 53 | } |
| 47 | 54 | ||
| 48 | void cache_wbinv_range(unsigned long start, unsigned long end) | 55 | void cache_wbinv_range(unsigned long start, unsigned long end) |
| 49 | { | 56 | { |
| 50 | unsigned long i = start & ~(L1_CACHE_BYTES - 1); | 57 | dcache_wb_range(start, end); |
| 51 | 58 | icache_inv_range(start, end); | |
| 52 | for (; i < end; i += L1_CACHE_BYTES) | ||
| 53 | asm volatile("dcache.cval1 %0\n"::"r"(i):"memory"); | ||
| 54 | sync_is(); | ||
| 55 | |||
| 56 | i = start & ~(L1_CACHE_BYTES - 1); | ||
| 57 | for (; i < end; i += L1_CACHE_BYTES) | ||
| 58 | asm volatile("icache.iva %0\n"::"r"(i):"memory"); | ||
| 59 | sync_is(); | ||
| 60 | } | 59 | } |
| 61 | EXPORT_SYMBOL(cache_wbinv_range); | 60 | EXPORT_SYMBOL(cache_wbinv_range); |
| 62 | 61 | ||
| @@ -117,85 +117,29 @@ struct page *kmap_atomic_to_page(void *ptr) · 116 unmodified lines | |||
| 117 | return pte_page(*pte); | 117 | return pte_page(*pte); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | static void __init fixrange_init(unsigned long start, unsigned long end, | 120 | static void __init kmap_pages_init(void) |
| 121 | pgd_t *pgd_base) | ||
| 122 | { | 121 | { |
| 123 | #ifdef CONFIG_HIGHMEM | ||
| 124 | pgd_t *pgd; | ||
| 125 | pud_t *pud; | ||
| 126 | pmd_t *pmd; | ||
| 127 | pte_t *pte; | ||
| 128 | int i, j, k; | ||
| 129 | unsigned long vaddr; | 122 | unsigned long vaddr; |
| 130 | |||
| 131 | vaddr = start; | ||
| 132 | i = __pgd_offset(vaddr); | ||
| 133 | j = __pud_offset(vaddr); | ||
| 134 | k = __pmd_offset(vaddr); | ||
| 135 | pgd = pgd_base + i; | ||
| 136 | |||
| 137 | for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) { | ||
| 138 | pud = (pud_t *)pgd; | ||
| 139 | for ( ; (j < PTRS_PER_PUD) && (vaddr != end); pud++, j++) { | ||
| 140 | pmd = (pmd_t *)pud; | ||
| 141 | for (; (k < PTRS_PER_PMD) && (vaddr != end); pmd++, k++) { | ||
| 142 | if (pmd_none(*pmd)) { | ||
| 143 | pte = (pte_t *) memblock_alloc_low(PAGE_SIZE, PAGE_SIZE); | ||
| 144 | if (!pte) | ||
| 145 | panic("%s: Failed to allocate %lu bytes align=%lx\n", | ||
| 146 | __func__, PAGE_SIZE, | ||
| 147 | PAGE_SIZE); | ||
| 148 | |||
| 149 | set_pmd(pmd, __pmd(__pa(pte))); | ||
| 150 | BUG_ON(pte != pte_offset_kernel(pmd, 0)); | ||
| 151 | } | ||
| 152 | vaddr += PMD_SIZE; | ||
| 153 | } | ||
| 154 | k = 0; | ||
| 155 | } | ||
| 156 | j = 0; | ||
| 157 | } | ||
| 158 | #endif | ||
| 159 | } | ||
| 160 | |||
| 161 | void __init fixaddr_kmap_pages_init(void) | ||
| 162 | { | ||
| 163 | unsigned long vaddr; | ||
| 164 | pgd_t *pgd_base; | ||
| 165 | #ifdef CONFIG_HIGHMEM | ||
| 166 | pgd_t *pgd; | 123 | pgd_t *pgd; |
| 167 | pmd_t *pmd; | 124 | pmd_t *pmd; |
| 168 | pud_t *pud; | 125 | pud_t *pud; |
| 169 | pte_t *pte; | 126 | pte_t *pte; |
| 170 | #endif | 127 | |
| 171 | pgd_base = swapper_pg_dir; | ||
| 172 | |||
| 173 | /* | ||
| 174 | * Fixed mappings: | ||
| 175 | */ | ||
| 176 | vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; | ||
| 177 | fixrange_init(vaddr, 0, pgd_base); | ||
| 178 | |||
| 179 | #ifdef CONFIG_HIGHMEM | ||
| 180 | /* | ||
| 181 | * Permanent kmaps: | ||
| 182 | */ | ||
| 183 | vaddr = PKMAP_BASE; | 128 | vaddr = PKMAP_BASE; |
| 184 | fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base); | 129 | fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, swapper_pg_dir); |
| 185 | 130 | ||
| 186 | pgd = swapper_pg_dir + __pgd_offset(vaddr); | 131 | pgd = swapper_pg_dir + __pgd_offset(vaddr); |
| 187 | pud = (pud_t *)pgd; | 132 | pud = (pud_t *)pgd; |
| 188 | pmd = pmd_offset(pud, vaddr); | 133 | pmd = pmd_offset(pud, vaddr); |
| 189 | pte = pte_offset_kernel(pmd, vaddr); | 134 | pte = pte_offset_kernel(pmd, vaddr); |
| 190 | pkmap_page_table = pte; | 135 | pkmap_page_table = pte; |
| 191 | #endif | ||
| 192 | } | 136 | } |
| 193 | 137 | ||
| 194 | void __init kmap_init(void) | 138 | void __init kmap_init(void) |
| 195 | { | 139 | { |
| 196 | unsigned long vaddr; | 140 | unsigned long vaddr; |
| 197 | 141 | ||
| 198 | fixaddr_kmap_pages_init(); | 142 | kmap_pages_init(); |
| 199 | 143 | ||
| 200 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN); | 144 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN); |
| 201 | 145 | ||
| @@ -19,6 +19,7 @@ · 18 unmodified lines | |||
| 19 | #include <linux/swap.h> | 19 | #include <linux/swap.h> |
| 20 | #include <linux/proc_fs.h> | 20 | #include <linux/proc_fs.h> |
| 21 | #include <linux/pfn.h> | 21 | #include <linux/pfn.h> |
| 22 | #include <linux/initrd.h> | ||
| 22 | 23 | ||
| 23 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
| 24 | #include <asm/cachectl.h> | 25 | #include <asm/cachectl.h> |
| @@ -31,10 +32,50 @@ · 6 unmodified lines | |||
| 31 | 32 | ||
| 32 | pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_bss; | 33 | pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_bss; |
| 33 | pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned_bss; | 34 | pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned_bss; |
| 35 | EXPORT_SYMBOL(invalid_pte_table); | ||
| 34 | unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] | 36 | unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] |
| 35 | __page_aligned_bss; | 37 | __page_aligned_bss; |
| 36 | EXPORT_SYMBOL(empty_zero_page); | 38 | EXPORT_SYMBOL(empty_zero_page); |
| 37 | 39 | ||
| 40 | #ifdef CONFIG_BLK_DEV_INITRD | ||
| 41 | static void __init setup_initrd(void) | ||
| 42 | { | ||
| 43 | unsigned long size; | ||
| 44 | |||
| 45 | if (initrd_start >= initrd_end) { | ||
| 46 | pr_err("initrd not found or empty"); | ||
| 47 | goto disable; | ||
| 48 | } | ||
| 49 | |||
| 50 | if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) { | ||
| 51 | pr_err("initrd extends beyond end of memory"); | ||
| 52 | goto disable; | ||
| 53 | } | ||
| 54 | |||
| 55 | size = initrd_end - initrd_start; | ||
| 56 | |||
| 57 | if (memblock_is_region_reserved(__pa(initrd_start), size)) { | ||
| 58 | pr_err("INITRD: 0x%08lx+0x%08lx overlaps in-use memory region", | ||
| 59 | __pa(initrd_start), size); | ||
| 60 | goto disable; | ||
| 61 | } | ||
| 62 | |||
| 63 | memblock_reserve(__pa(initrd_start), size); | ||
| 64 | |||
| 65 | pr_info("Initial ramdisk at: 0x%p (%lu bytes)\n", | ||
| 66 | (void *)(initrd_start), size); | ||
| 67 | |||
| 68 | initrd_below_start_ok = 1; | ||
| 69 | |||
| 70 | return; | ||
| 71 | |||
| 72 | disable: | ||
| 73 | initrd_start = initrd_end = 0; | ||
| 74 | |||
| 75 | pr_err(" - disabling initrd\n"); | ||
| 76 | } | ||
| 77 | #endif | ||
| 78 | |||
| 38 | void __init mem_init(void) | 79 | void __init mem_init(void) |
| 39 | { | 80 | { |
| 40 | #ifdef CONFIG_HIGHMEM | 81 | #ifdef CONFIG_HIGHMEM |
| @@ -46,6 +87,10 @@ void __init mem_init(void) · 5 unmodified lines | |||
| 46 | #endif | 87 | #endif |
| 47 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); | 88 | high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); |
| 48 | 89 | ||
| 90 | #ifdef CONFIG_BLK_DEV_INITRD | ||
| 91 | setup_initrd(); | ||
| 92 | #endif | ||
| 93 | |||
| 49 | memblock_free_all(); | 94 | memblock_free_all(); |
| 50 | 95 | ||
| 51 | #ifdef CONFIG_HIGHMEM | 96 | #ifdef CONFIG_HIGHMEM |
| @@ -101,3 +146,50 @@ void __init pre_mmu_init(void) · 49 unmodified lines | |||
| 101 | /* Setup page mask to 4k */ | 146 | /* Setup page mask to 4k */ |
| 102 | write_mmu_pagemask(0); | 147 | write_mmu_pagemask(0); |
| 103 | } | 148 | } |
| 149 | |||
| 150 | void __init fixrange_init(unsigned long start, unsigned long end, | ||
| 151 | pgd_t *pgd_base) | ||
| 152 | { | ||
| 153 | pgd_t *pgd; | ||
| 154 | pud_t *pud; | ||
| 155 | pmd_t *pmd; | ||
| 156 | pte_t *pte; | ||
| 157 | int i, j, k; | ||
| 158 | unsigned long vaddr; | ||
| 159 | |||
| 160 | vaddr = start; | ||
| 161 | i = __pgd_offset(vaddr); | ||
| 162 | j = __pud_offset(vaddr); | ||
| 163 | k = __pmd_offset(vaddr); | ||
| 164 | pgd = pgd_base + i; | ||
| 165 | |||
| 166 | for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) { | ||
| 167 | pud = (pud_t *)pgd; | ||
| 168 | for ( ; (j < PTRS_PER_PUD) && (vaddr != end); pud++, j++) { | ||
| 169 | pmd = (pmd_t *)pud; | ||
| 170 | for (; (k < PTRS_PER_PMD) && (vaddr != end); pmd++, k++) { | ||
| 171 | if (pmd_none(*pmd)) { | ||
| 172 | pte = (pte_t *) memblock_alloc_low(PAGE_SIZE, PAGE_SIZE); | ||
| 173 | if (!pte) | ||
| 174 | panic("%s: Failed to allocate %lu bytes align=%lx\n", | ||
| 175 | __func__, PAGE_SIZE, | ||
| 176 | PAGE_SIZE); | ||
| 177 | |||
| 178 | set_pmd(pmd, __pmd(__pa(pte))); | ||
| 179 | BUG_ON(pte != pte_offset_kernel(pmd, 0)); | ||
| 180 | } | ||
| 181 | vaddr += PMD_SIZE; | ||
| 182 | } | ||
| 183 | k = 0; | ||
| 184 | } | ||
| 185 | j = 0; | ||
| 186 | } | ||
| 187 | } | ||
| 188 | |||
| 189 | void __init fixaddr_init(void) | ||
| 190 | { | ||
| 191 | unsigned long vaddr; | ||
| 192 | |||
| 193 | vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; | ||
| 194 | fixrange_init(vaddr, vaddr + PMD_SIZE, swapper_pg_dir); | ||
| 195 | } | ||
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | #include <linux/syscalls.h> | 4 | #include <linux/syscalls.h> |
| 5 | #include <asm/page.h> | 5 | #include <asm/page.h> |
| 6 | #include <asm/cache.h> | 6 | #include <asm/cacheflush.h> |
| 7 | #include <asm/cachectl.h> | 7 | #include <asm/cachectl.h> |
| 8 | 8 | ||
| 9 | SYSCALL_DEFINE3(cacheflush, | 9 | SYSCALL_DEFINE3(cacheflush, |
| @@ -13,17 +13,14 @@ SYSCALL_DEFINE3(cacheflush, · 3 unmodified lines | |||
| 13 | { | 13 | { |
| 14 | switch (cache) { | 14 | switch (cache) { |
| 15 | case ICACHE: | 15 | case ICACHE: |
| 16 | icache_inv_range((unsigned long)addr, | 16 | case BCACHE: |
| 17 | (unsigned long)addr + bytes); | 17 | flush_icache_mm_range(current->mm, |
| 18 | break; | 18 | (unsigned long)addr, |
| 19 | (unsigned long)addr + bytes); | ||
| 19 | case DCACHE: | 20 | case DCACHE: |
| 20 | dcache_wb_range((unsigned long)addr, | 21 | dcache_wb_range((unsigned long)addr, |
| 21 | (unsigned long)addr + bytes); | 22 | (unsigned long)addr + bytes); |
| 22 | break; | 23 | break; |
| 23 | case BCACHE: | ||
| 24 | cache_wbinv_range((unsigned long)addr, | ||
| 25 | (unsigned long)addr + bytes); | ||
| 26 | break; | ||
| 27 | default: | 24 | default: |
| 28 | return -EINVAL; | 25 | return -EINVAL; |
| 29 | } | 26 | } |
| @@ -0,0 +1,169 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | #include <linux/highmem.h> | ||
| 4 | #include <linux/genalloc.h> | ||
| 5 | #include <asm/tlbflush.h> | ||
| 6 | #include <asm/fixmap.h> | ||
| 7 | |||
| 8 | #if (CONFIG_ITCM_RAM_BASE == 0xffffffff) | ||
| 9 | #error "You should define ITCM_RAM_BASE" | ||
| 10 | #endif | ||
| 11 | |||
| 12 | #ifdef CONFIG_HAVE_DTCM | ||
| 13 | #if (CONFIG_DTCM_RAM_BASE == 0xffffffff) | ||
| 14 | #error "You should define DTCM_RAM_BASE" | ||
| 15 | #endif | ||
| 16 | |||
| 17 | #if (CONFIG_DTCM_RAM_BASE == CONFIG_ITCM_RAM_BASE) | ||
| 18 | #error "You should define correct DTCM_RAM_BASE" | ||
| 19 | #endif | ||
| 20 | #endif | ||
| 21 | |||
| 22 | extern char __tcm_start, __tcm_end, __dtcm_start; | ||
| 23 | |||
| 24 | static struct gen_pool *tcm_pool; | ||
| 25 | |||
| 26 | static void __init tcm_mapping_init(void) | ||
| 27 | { | ||
| 28 | pte_t *tcm_pte; | ||
| 29 | unsigned long vaddr, paddr; | ||
| 30 | int i; | ||
| 31 | |||
| 32 | paddr = CONFIG_ITCM_RAM_BASE; | ||
| 33 | |||
| 34 | if (pfn_valid(PFN_DOWN(CONFIG_ITCM_RAM_BASE))) | ||
| 35 | goto panic; | ||
| 36 | |||
| 37 | #ifndef CONFIG_HAVE_DTCM | ||
| 38 | for (i = 0; i < TCM_NR_PAGES; i++) { | ||
| 39 | #else | ||
| 40 | for (i = 0; i < CONFIG_ITCM_NR_PAGES; i++) { | ||
| 41 | #endif | ||
| 42 | vaddr = __fix_to_virt(FIX_TCM - i); | ||
| 43 | |||
| 44 | tcm_pte = | ||
| 45 | pte_offset_kernel((pmd_t *)pgd_offset_k(vaddr), vaddr); | ||
| 46 | |||
| 47 | set_pte(tcm_pte, pfn_pte(__phys_to_pfn(paddr), PAGE_KERNEL)); | ||
| 48 | |||
| 49 | flush_tlb_one(vaddr); | ||
| 50 | |||
| 51 | paddr = paddr + PAGE_SIZE; | ||
| 52 | } | ||
| 53 | |||
| 54 | #ifdef CONFIG_HAVE_DTCM | ||
| 55 | if (pfn_valid(PFN_DOWN(CONFIG_DTCM_RAM_BASE))) | ||
| 56 | goto panic; | ||
| 57 | |||
| 58 | paddr = CONFIG_DTCM_RAM_BASE; | ||
| 59 | |||
| 60 | for (i = 0; i < CONFIG_DTCM_NR_PAGES; i++) { | ||
| 61 | vaddr = __fix_to_virt(FIX_TCM - CONFIG_ITCM_NR_PAGES - i); | ||
| 62 | |||
| 63 | tcm_pte = | ||
| 64 | pte_offset_kernel((pmd_t *) pgd_offset_k(vaddr), vaddr); | ||
| 65 | |||
| 66 | set_pte(tcm_pte, pfn_pte(__phys_to_pfn(paddr), PAGE_KERNEL)); | ||
| 67 | |||
| 68 | flush_tlb_one(vaddr); | ||
| 69 | |||
| 70 | paddr = paddr + PAGE_SIZE; | ||
| 71 | } | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #ifndef CONFIG_HAVE_DTCM | ||
| 75 | memcpy((void *)__fix_to_virt(FIX_TCM), | ||
| 76 | &__tcm_start, &__tcm_end - &__tcm_start); | ||
| 77 | |||
| 78 | pr_info("%s: mapping tcm va:0x%08lx to pa:0x%08x\n", | ||
| 79 | __func__, __fix_to_virt(FIX_TCM), CONFIG_ITCM_RAM_BASE); | ||
| 80 | |||
| 81 | pr_info("%s: __tcm_start va:0x%08lx size:%d\n", | ||
| 82 | __func__, (unsigned long)&__tcm_start, &__tcm_end - &__tcm_start); | ||
| 83 | #else | ||
| 84 | memcpy((void *)__fix_to_virt(FIX_TCM), | ||
| 85 | &__tcm_start, &__dtcm_start - &__tcm_start); | ||
| 86 | |||
| 87 | pr_info("%s: mapping itcm va:0x%08lx to pa:0x%08x\n", | ||
| 88 | __func__, __fix_to_virt(FIX_TCM), CONFIG_ITCM_RAM_BASE); | ||
| 89 | |||
| 90 | pr_info("%s: __itcm_start va:0x%08lx size:%d\n", | ||
| 91 | __func__, (unsigned long)&__tcm_start, &__dtcm_start - &__tcm_start); | ||
| 92 | |||
| 93 | memcpy((void *)__fix_to_virt(FIX_TCM - CONFIG_ITCM_NR_PAGES), | ||
| 94 | &__dtcm_start, &__tcm_end - &__dtcm_start); | ||
| 95 | |||
| 96 | pr_info("%s: mapping dtcm va:0x%08lx to pa:0x%08x\n", | ||
| 97 | __func__, __fix_to_virt(FIX_TCM - CONFIG_ITCM_NR_PAGES), | ||
| 98 | CONFIG_DTCM_RAM_BASE); | ||
| 99 | |||
| 100 | pr_info("%s: __dtcm_start va:0x%08lx size:%d\n", | ||
| 101 | __func__, (unsigned long)&__dtcm_start, &__tcm_end - &__dtcm_start); | ||
| 102 | |||
| 103 | #endif | ||
| 104 | return; | ||
| 105 | panic: | ||
| 106 | panic("TCM init error"); | ||
| 107 | } | ||
| 108 | |||
| 109 | void *tcm_alloc(size_t len) | ||
| 110 | { | ||
| 111 | unsigned long vaddr; | ||
| 112 | |||
| 113 | if (!tcm_pool) | ||
| 114 | return NULL; | ||
| 115 | |||
| 116 | vaddr = gen_pool_alloc(tcm_pool, len); | ||
| 117 | if (!vaddr) | ||
| 118 | return NULL; | ||
| 119 | |||
| 120 | return (void *) vaddr; | ||
| 121 | } | ||
| 122 | EXPORT_SYMBOL(tcm_alloc); | ||
| 123 | |||
| 124 | void tcm_free(void *addr, size_t len) | ||
| 125 | { | ||
| 126 | gen_pool_free(tcm_pool, (unsigned long) addr, len); | ||
| 127 | } | ||
| 128 | EXPORT_SYMBOL(tcm_free); | ||
| 129 | |||
| 130 | static int __init tcm_setup_pool(void) | ||
| 131 | { | ||
| 132 | #ifndef CONFIG_HAVE_DTCM | ||
| 133 | u32 pool_size = (u32) (TCM_NR_PAGES * PAGE_SIZE) | ||
| 134 | - (u32) (&__tcm_end - &__tcm_start); | ||
| 135 | |||
| 136 | u32 tcm_pool_start = __fix_to_virt(FIX_TCM) | ||
| 137 | + (u32) (&__tcm_end - &__tcm_start); | ||
| 138 | #else | ||
| 139 | u32 pool_size = (u32) (CONFIG_DTCM_NR_PAGES * PAGE_SIZE) | ||
| 140 | - (u32) (&__tcm_end - &__dtcm_start); | ||
| 141 | |||
| 142 | u32 tcm_pool_start = __fix_to_virt(FIX_TCM - CONFIG_ITCM_NR_PAGES) | ||
| 143 | + (u32) (&__tcm_end - &__dtcm_start); | ||
| 144 | #endif | ||
| 145 | int ret; | ||
| 146 | |||
| 147 | tcm_pool = gen_pool_create(2, -1); | ||
| 148 | |||
| 149 | ret = gen_pool_add(tcm_pool, tcm_pool_start, pool_size, -1); | ||
| 150 | if (ret) { | ||
| 151 | pr_err("%s: gen_pool add failed!\n", __func__); | ||
| 152 | return ret; | ||
| 153 | } | ||
| 154 | |||
| 155 | pr_info("%s: Added %d bytes @ 0x%08x to memory pool\n", | ||
| 156 | __func__, pool_size, tcm_pool_start); | ||
| 157 | |||
| 158 | return 0; | ||
| 159 | } | ||
| 160 | |||
| 161 | static int __init tcm_init(void) | ||
| 162 | { | ||
| 163 | tcm_mapping_init(); | ||
| 164 | |||
| 165 | tcm_setup_pool(); | ||
| 166 | |||
| 167 | return 0; | ||
| 168 | } | ||
| 169 | arch_initcall(tcm_init); | ||
| @@ -1,5 +1,6 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | #include <dt-bindings/clock/jz4740-cgu.h> | 2 | #include <dt-bindings/clock/jz4740-cgu.h> |
| 3 | #include <dt-bindings/clock/ingenic,tcu.h> | ||
| 3 | 4 | ||
| 4 | / { | 5 | / { |
| 5 | #address-cells = <1>; | 6 | #address-cells = <1>; |
| @@ -45,14 +46,6 @@ · 39 unmodified lines | |||
| 45 | #clock-cells = <1>; | 46 | #clock-cells = <1>; |
| 46 | }; | 47 | }; |
| 47 | 48 | ||
| 48 | watchdog: watchdog@10002000 { | ||
| 49 | compatible = "ingenic,jz4740-watchdog"; | ||
| 50 | reg = <0x10002000 0x10>; | ||
| 51 | |||
| 52 | clocks = <&cgu JZ4740_CLK_RTC>; | ||
| 53 | clock-names = "rtc"; | ||
| 54 | }; | ||
| 55 | |||
| 56 | tcu: timer@10002000 { | 49 | tcu: timer@10002000 { |
| 57 | compatible = "ingenic,jz4740-tcu", "simple-mfd"; | 50 | compatible = "ingenic,jz4740-tcu", "simple-mfd"; |
| 58 | reg = <0x10002000 0x1000>; | 51 | reg = <0x10002000 0x1000>; |
| @@ -73,6 +66,14 @@ · 14 unmodified lines | |||
| 73 | 66 | ||
| 74 | interrupt-parent = <&intc>; | 67 | interrupt-parent = <&intc>; |
| 75 | interrupts = <23 22 21>; | 68 | interrupts = <23 22 21>; |
| 69 | |||
| 70 | watchdog: watchdog@0 { | ||
| 71 | compatible = "ingenic,jz4740-watchdog"; | ||
| 72 | reg = <0x0 0xc>; | ||
| 73 | |||
| 74 | clocks = <&tcu TCU_CLK_WDT>; | ||
| 75 | clock-names = "wdt"; | ||
| 76 | }; | ||
| 76 | }; | 77 | }; |
| 77 | 78 | ||
| 78 | rtc_dev: rtc@10003000 { | 79 | rtc_dev: rtc@10003000 { |
| @@ -1,5 +1,6 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | #include <dt-bindings/clock/jz4780-cgu.h> | 2 | #include <dt-bindings/clock/jz4780-cgu.h> |
| 3 | #include <dt-bindings/clock/ingenic,tcu.h> | ||
| 3 | #include <dt-bindings/dma/jz4780-dma.h> | 4 | #include <dt-bindings/dma/jz4780-dma.h> |
| 4 | 5 | ||
| 5 | / { | 6 | / { |
| @@ -67,6 +68,14 @@ · 61 unmodified lines | |||
| 67 | 68 | ||
| 68 | interrupt-parent = <&intc>; | 69 | interrupt-parent = <&intc>; |
| 69 | interrupts = <27 26 25>; | 70 | interrupts = <27 26 25>; |
| 71 | |||
| 72 | watchdog: watchdog@0 { | ||
| 73 | compatible = "ingenic,jz4780-watchdog"; | ||
| 74 | reg = <0x0 0xc>; | ||
| 75 | |||
| 76 | clocks = <&tcu TCU_CLK_WDT>; | ||
| 77 | clock-names = "wdt"; | ||
| 78 | }; | ||
| 70 | }; | 79 | }; |
| 71 | 80 | ||
| 72 | rtc_dev: rtc@10003000 { | 81 | rtc_dev: rtc@10003000 { |
| @@ -348,14 +357,6 @@ · 275 unmodified lines | |||
| 348 | status = "disabled"; | 357 | status = "disabled"; |
| 349 | }; | 358 | }; |
| 350 | 359 | ||
| 351 | watchdog: watchdog@10002000 { | ||
| 352 | compatible = "ingenic,jz4780-watchdog"; | ||
| 353 | reg = <0x10002000 0x10>; | ||
| 354 | |||
| 355 | clocks = <&cgu JZ4780_CLK_RTCLK>; | ||
| 356 | clock-names = "rtc"; | ||
| 357 | }; | ||
| 358 | |||
| 359 | nemc: nemc@13410000 { | 360 | nemc: nemc@13410000 { |
| 360 | compatible = "ingenic,jz4780-nemc"; | 361 | compatible = "ingenic,jz4780-nemc"; |
| 361 | reg = <0x13410000 0x10000>; | 362 | reg = <0x13410000 0x10000>; |
| @@ -1,4 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | #include <dt-bindings/clock/ingenic,tcu.h> | ||
| 2 | #include <dt-bindings/clock/x1000-cgu.h> | 3 | #include <dt-bindings/clock/x1000-cgu.h> |
| 3 | #include <dt-bindings/dma/x1000-dma.h> | 4 | #include <dt-bindings/dma/x1000-dma.h> |
| 4 | 5 | ||
| @@ -72,7 +73,7 @@ · 67 unmodified lines | |||
| 72 | compatible = "ingenic,x1000-watchdog", "ingenic,jz4780-watchdog"; | 73 | compatible = "ingenic,x1000-watchdog", "ingenic,jz4780-watchdog"; |
| 73 | reg = <0x0 0x10>; | 74 | reg = <0x0 0x10>; |
| 74 | 75 | ||
| 75 | clocks = <&cgu X1000_CLK_RTCLK>; | 76 | clocks = <&tcu TCU_CLK_WDT>; |
| 76 | clock-names = "wdt"; | 77 | clock-names = "wdt"; |
| 77 | }; | 78 | }; |
| 78 | }; | 79 | }; |
| @@ -158,7 +159,6 @@ · 79 unmodified lines | |||
| 158 | i2c0: i2c-controller@10050000 { | 159 | i2c0: i2c-controller@10050000 { |
| 159 | compatible = "ingenic,x1000-i2c"; | 160 | compatible = "ingenic,x1000-i2c"; |
| 160 | reg = <0x10050000 0x1000>; | 161 | reg = <0x10050000 0x1000>; |
| 161 | |||
| 162 | #address-cells = <1>; | 162 | #address-cells = <1>; |
| 163 | #size-cells = <0>; | 163 | #size-cells = <0>; |
| 164 | 164 | ||
| @@ -173,7 +173,6 @@ · 8 unmodified lines | |||
| 173 | i2c1: i2c-controller@10051000 { | 173 | i2c1: i2c-controller@10051000 { |
| 174 | compatible = "ingenic,x1000-i2c"; | 174 | compatible = "ingenic,x1000-i2c"; |
| 175 | reg = <0x10051000 0x1000>; | 175 | reg = <0x10051000 0x1000>; |
| 176 | |||
| 177 | #address-cells = <1>; | 176 | #address-cells = <1>; |
| 178 | #size-cells = <0>; | 177 | #size-cells = <0>; |
| 179 | 178 | ||
| @@ -188,7 +187,6 @@ · 8 unmodified lines | |||
| 188 | i2c2: i2c-controller@10052000 { | 187 | i2c2: i2c-controller@10052000 { |
| 189 | compatible = "ingenic,x1000-i2c"; | 188 | compatible = "ingenic,x1000-i2c"; |
| 190 | reg = <0x10052000 0x1000>; | 189 | reg = <0x10052000 0x1000>; |
| 191 | |||
| 192 | #address-cells = <1>; | 190 | #address-cells = <1>; |
| 193 | #size-cells = <0>; | 191 | #size-cells = <0>; |
| 194 | 192 | ||
| @@ -155,9 +155,11 @@ · 154 unmodified lines | |||
| 155 | * effective barrier as noted by commit 6b07d38aaa52 ("MIPS: Octeon: Use | 155 | * effective barrier as noted by commit 6b07d38aaa52 ("MIPS: Octeon: Use |
| 156 | * optimized memory barrier primitives."). Here we specify that the affected | 156 | * optimized memory barrier primitives."). Here we specify that the affected |
| 157 | * sync instructions should be emitted twice. | 157 | * sync instructions should be emitted twice. |
| 158 | * Note that this expression is evaluated by the assembler (not the compiler), | ||
| 159 | * and that the assembler evaluates '==' as 0 or -1, not 0 or 1. | ||
| 158 | */ | 160 | */ |
| 159 | #ifdef CONFIG_CPU_CAVIUM_OCTEON | 161 | #ifdef CONFIG_CPU_CAVIUM_OCTEON |
| 160 | # define __SYNC_rpt(type) (1 + (type == __SYNC_wmb)) | 162 | # define __SYNC_rpt(type) (1 - (type == __SYNC_wmb)) |
| 161 | #else | 163 | #else |
| 162 | # define __SYNC_rpt(type) 1 | 164 | # define __SYNC_rpt(type) 1 |
| 163 | #endif | 165 | #endif |
| @@ -134,7 +134,7 @@ void release_vpe(struct vpe *v) · 133 unmodified lines | |||
| 134 | { | 134 | { |
| 135 | list_del(&v->list); | 135 | list_del(&v->list); |
| 136 | if (v->load_addr) | 136 | if (v->load_addr) |
| 137 | release_progmem(v); | 137 | release_progmem(v->load_addr); |
| 138 | kfree(v); | 138 | kfree(v); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| @@ -33,6 +33,7 @@ endif · 32 unmodified lines | |||
| 33 | cflags-vdso := $(ccflags-vdso) \ | 33 | cflags-vdso := $(ccflags-vdso) \ |
| 34 | $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \ | 34 | $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \ |
| 35 | -O3 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \ | 35 | -O3 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \ |
| 36 | -mrelax-pic-calls $(call cc-option, -mexplicit-relocs) \ | ||
| 36 | -fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \ | 37 | -fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \ |
| 37 | $(call cc-option, -fno-asynchronous-unwind-tables) \ | 38 | $(call cc-option, -fno-asynchronous-unwind-tables) \ |
| 38 | $(call cc-option, -fno-stack-protector) | 39 | $(call cc-option, -fno-stack-protector) |
| @@ -51,6 +52,8 @@ endif · 12 unmodified lines | |||
| 51 | 52 | ||
| 52 | CFLAGS_REMOVE_vgettimeofday.o = -pg | 53 | CFLAGS_REMOVE_vgettimeofday.o = -pg |
| 53 | 54 | ||
| 55 | DISABLE_VDSO := n | ||
| 56 | |||
| 54 | # | 57 | # |
| 55 | # For the pre-R6 code in arch/mips/vdso/vdso.h for locating | 58 | # For the pre-R6 code in arch/mips/vdso/vdso.h for locating |
| 56 | # the base address of VDSO, the linker will emit a R_MIPS_PC32 | 59 | # the base address of VDSO, the linker will emit a R_MIPS_PC32 |
| @@ -64,11 +67,24 @@ CFLAGS_REMOVE_vgettimeofday.o = -pg · 7 unmodified lines | |||
| 64 | ifndef CONFIG_CPU_MIPSR6 | 67 | ifndef CONFIG_CPU_MIPSR6 |
| 65 | ifeq ($(call ld-ifversion, -lt, 225000000, y),y) | 68 | ifeq ($(call ld-ifversion, -lt, 225000000, y),y) |
| 66 | $(warning MIPS VDSO requires binutils >= 2.25) | 69 | $(warning MIPS VDSO requires binutils >= 2.25) |
| 67 | obj-vdso-y := $(filter-out vgettimeofday.o, $(obj-vdso-y)) | 70 | DISABLE_VDSO := y |
| 68 | ccflags-vdso += -DDISABLE_MIPS_VDSO | ||
| 69 | endif | 71 | endif |
| 70 | endif | 72 | endif |
| 71 | 73 | ||
| 74 | # | ||
| 75 | # GCC (at least up to version 9.2) appears to emit function calls that make use | ||
| 76 | # of the GOT when targeting microMIPS, which we can't use in the VDSO due to | ||
| 77 | # the lack of relocations. As such, we disable the VDSO for microMIPS builds. | ||
| 78 | # | ||
| 79 | ifdef CONFIG_CPU_MICROMIPS | ||
| 80 | DISABLE_VDSO := y | ||
| 81 | endif | ||
| 82 | |||
| 83 | ifeq ($(DISABLE_VDSO),y) | ||
| 84 | obj-vdso-y := $(filter-out vgettimeofday.o, $(obj-vdso-y)) | ||
| 85 | ccflags-vdso += -DDISABLE_MIPS_VDSO | ||
| 86 | endif | ||
| 87 | |||
| 72 | # VDSO linker flags. | 88 | # VDSO linker flags. |
| 73 | VDSO_LDFLAGS := \ | 89 | VDSO_LDFLAGS := \ |
| 74 | -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1 \ | 90 | -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1 \ |
| @@ -81,12 +97,18 @@ GCOV_PROFILE := n · 6 unmodified lines | |||
| 81 | UBSAN_SANITIZE := n | 97 | UBSAN_SANITIZE := n |
| 82 | KCOV_INSTRUMENT := n | 98 | KCOV_INSTRUMENT := n |
| 83 | 99 | ||
| 100 | # Check that we don't have PIC 'jalr t9' calls left | ||
| 101 | quiet_cmd_vdso_mips_check = VDSOCHK $@ | ||
| 102 | cmd_vdso_mips_check = if $(OBJDUMP) --disassemble $@ | egrep -h "jalr.*t9" > /dev/null; \ | ||
| 103 | then (echo >&2 "$@: PIC 'jalr t9' calls are not supported"; \ | ||
| 104 | rm -f $@; /bin/false); fi | ||
| 105 | |||
| 84 | # | 106 | # |
| 85 | # Shared build commands. | 107 | # Shared build commands. |
| 86 | # | 108 | # |
| 87 | 109 | ||
| 88 | quiet_cmd_vdsold_and_vdso_check = LD $@ | 110 | quiet_cmd_vdsold_and_vdso_check = LD $@ |
| 89 | cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check) | 111 | cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check); $(cmd_vdso_mips_check) |
| 90 | 112 | ||
| 91 | quiet_cmd_vdsold = VDSO $@ | 113 | quiet_cmd_vdsold = VDSO $@ |
| 92 | cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \ | 114 | cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \ |
| @@ -295,8 +295,13 @@ static inline bool pfn_valid(unsigned long pfn) · 294 unmodified lines | |||
| 295 | /* | 295 | /* |
| 296 | * Some number of bits at the level of the page table that points to | 296 | * Some number of bits at the level of the page table that points to |
| 297 | * a hugepte are used to encode the size. This masks those bits. | 297 | * a hugepte are used to encode the size. This masks those bits. |
| 298 | * On 8xx, HW assistance requires 4k alignment for the hugepte. | ||
| 298 | */ | 299 | */ |
| 300 | #ifdef CONFIG_PPC_8xx | ||
| 301 | #define HUGEPD_SHIFT_MASK 0xfff | ||
| 302 | #else | ||
| 299 | #define HUGEPD_SHIFT_MASK 0x3f | 303 | #define HUGEPD_SHIFT_MASK 0x3f |
| 304 | #endif | ||
| 300 | 305 | ||
| 301 | #ifndef __ASSEMBLY__ | 306 | #ifndef __ASSEMBLY__ |
| 302 | 307 | ||
| @@ -168,6 +168,10 @@ struct thread_struct { · 167 unmodified lines | |||
| 168 | unsigned long srr1; | 168 | unsigned long srr1; |
| 169 | unsigned long dar; | 169 | unsigned long dar; |
| 170 | unsigned long dsisr; | 170 | unsigned long dsisr; |
| 171 | #ifdef CONFIG_PPC_BOOK3S_32 | ||
| 172 | unsigned long r0, r3, r4, r5, r6, r8, r9, r11; | ||
| 173 | unsigned long lr, ctr; | ||
| 174 | #endif | ||
| 171 | #endif | 175 | #endif |
| 172 | /* Debug Registers */ | 176 | /* Debug Registers */ |
| 173 | struct debug_reg debug; | 177 | struct debug_reg debug; |
| @@ -132,6 +132,18 @@ int main(void) · 131 unmodified lines | |||
| 132 | OFFSET(SRR1, thread_struct, srr1); | 132 | OFFSET(SRR1, thread_struct, srr1); |
| 133 | OFFSET(DAR, thread_struct, dar); | 133 | OFFSET(DAR, thread_struct, dar); |
| 134 | OFFSET(DSISR, thread_struct, dsisr); | 134 | OFFSET(DSISR, thread_struct, dsisr); |
| 135 | #ifdef CONFIG_PPC_BOOK3S_32 | ||
| 136 | OFFSET(THR0, thread_struct, r0); | ||
| 137 | OFFSET(THR3, thread_struct, r3); | ||
| 138 | OFFSET(THR4, thread_struct, r4); | ||
| 139 | OFFSET(THR5, thread_struct, r5); | ||
| 140 | OFFSET(THR6, thread_struct, r6); | ||
| 141 | OFFSET(THR8, thread_struct, r8); | ||
| 142 | OFFSET(THR9, thread_struct, r9); | ||
| 143 | OFFSET(THR11, thread_struct, r11); | ||
| 144 | OFFSET(THLR, thread_struct, lr); | ||
| 145 | OFFSET(THCTR, thread_struct, ctr); | ||
| 146 | #endif | ||
| 135 | #endif | 147 | #endif |
| 136 | #ifdef CONFIG_SPE | 148 | #ifdef CONFIG_SPE |
| 137 | OFFSET(THREAD_EVR0, thread_struct, evr[0]); | 149 | OFFSET(THREAD_EVR0, thread_struct, evr[0]); |
| @@ -1184,6 +1184,17 @@ void eeh_handle_special_event(void) · 1183 unmodified lines | |||
| 1184 | eeh_pe_state_mark(pe, EEH_PE_RECOVERING); | 1184 | eeh_pe_state_mark(pe, EEH_PE_RECOVERING); |
| 1185 | eeh_handle_normal_event(pe); | 1185 | eeh_handle_normal_event(pe); |
| 1186 | } else { | 1186 | } else { |
| 1187 | eeh_for_each_pe(pe, tmp_pe) | ||
| 1188 | eeh_pe_for_each_dev(tmp_pe, edev, tmp_edev) | ||
| 1189 | edev->mode &= ~EEH_DEV_NO_HANDLER; | ||
| 1190 | |||
| 1191 | /* Notify all devices to be down */ | ||
| 1192 | eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true); | ||
| 1193 | eeh_set_channel_state(pe, pci_channel_io_perm_failure); | ||
| 1194 | eeh_pe_report( | ||
| 1195 | "error_detected(permanent failure)", pe, | ||
| 1196 | eeh_report_failure, NULL); | ||
| 1197 | |||
| 1187 | pci_lock_rescan_remove(); | 1198 | pci_lock_rescan_remove(); |
| 1188 | list_for_each_entry(hose, &hose_list, list_node) { | 1199 | list_for_each_entry(hose, &hose_list, list_node) { |
| 1189 | phb_pe = eeh_phb_pe_get(hose); | 1200 | phb_pe = eeh_phb_pe_get(hose); |
| @@ -1192,16 +1203,6 @@ void eeh_handle_special_event(void) · 2 unmodified lines | |||
| 1192 | (phb_pe->state & EEH_PE_RECOVERING)) | 1203 | (phb_pe->state & EEH_PE_RECOVERING)) |
| 1193 | continue; | 1204 | continue; |
| 1194 | 1205 | ||
| 1195 | eeh_for_each_pe(pe, tmp_pe) | ||
| 1196 | eeh_pe_for_each_dev(tmp_pe, edev, tmp_edev) | ||
| 1197 | edev->mode &= ~EEH_DEV_NO_HANDLER; | ||
| 1198 | |||
| 1199 | /* Notify all devices to be down */ | ||
| 1200 | eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true); | ||
| 1201 | eeh_set_channel_state(pe, pci_channel_io_perm_failure); | ||
| 1202 | eeh_pe_report( | ||
| 1203 | "error_detected(permanent failure)", pe, | ||
| 1204 | eeh_report_failure, NULL); | ||
| 1205 | bus = eeh_pe_bus_get(phb_pe); | 1206 | bus = eeh_pe_bus_get(phb_pe); |
| 1206 | if (!bus) { | 1207 | if (!bus) { |
| 1207 | pr_err("%s: Cannot find PCI bus for " | 1208 | pr_err("%s: Cannot find PCI bus for " |
| @@ -783,7 +783,7 @@ fast_exception_return: · 782 unmodified lines | |||
| 783 | 1: lis r3,exc_exit_restart_end@ha | 783 | 1: lis r3,exc_exit_restart_end@ha |
| 784 | addi r3,r3,exc_exit_restart_end@l | 784 | addi r3,r3,exc_exit_restart_end@l |
| 785 | cmplw r12,r3 | 785 | cmplw r12,r3 |
| 786 | #if CONFIG_PPC_BOOK3S_601 | 786 | #ifdef CONFIG_PPC_BOOK3S_601 |
| 787 | bge 2b | 787 | bge 2b |
| 788 | #else | 788 | #else |
| 789 | bge 3f | 789 | bge 3f |
| @@ -791,7 +791,7 @@ fast_exception_return: · 1 unmodified line | |||
| 791 | lis r4,exc_exit_restart@ha | 791 | lis r4,exc_exit_restart@ha |
| 792 | addi r4,r4,exc_exit_restart@l | 792 | addi r4,r4,exc_exit_restart@l |
| 793 | cmplw r12,r4 | 793 | cmplw r12,r4 |
| 794 | #if CONFIG_PPC_BOOK3S_601 | 794 | #ifdef CONFIG_PPC_BOOK3S_601 |
| 795 | blt 2b | 795 | blt 2b |
| 796 | #else | 796 | #else |
| 797 | blt 3f | 797 | blt 3f |
| @@ -1354,12 +1354,17 @@ _GLOBAL(enter_rtas) · 556 unmodified lines | |||
| 1354 | mtspr SPRN_SRR0,r8 | 1354 | mtspr SPRN_SRR0,r8 |
| 1355 | mtspr SPRN_SRR1,r9 | 1355 | mtspr SPRN_SRR1,r9 |
| 1356 | RFI | 1356 | RFI |
| 1357 | 1: tophys(r9,r1) | 1357 | 1: tophys_novmstack r9, r1 |
| 1358 | #ifdef CONFIG_VMAP_STACK | ||
| 1359 | li r0, MSR_KERNEL & ~MSR_IR /* can take DTLB miss */ | ||
| 1360 | mtmsr r0 | ||
| 1361 | isync | ||
| 1362 | #endif | ||
| 1358 | lwz r8,INT_FRAME_SIZE+4(r9) /* get return address */ | 1363 | lwz r8,INT_FRAME_SIZE+4(r9) /* get return address */ |
| 1359 | lwz r9,8(r9) /* original msr value */ | 1364 | lwz r9,8(r9) /* original msr value */ |
| 1360 | addi r1,r1,INT_FRAME_SIZE | 1365 | addi r1,r1,INT_FRAME_SIZE |
| 1361 | li r0,0 | 1366 | li r0,0 |
| 1362 | tophys(r7, r2) | 1367 | tophys_novmstack r7, r2 |
| 1363 | stw r0, THREAD + RTAS_SP(r7) | 1368 | stw r0, THREAD + RTAS_SP(r7) |
| 1364 | mtspr SPRN_SRR0,r8 | 1369 | mtspr SPRN_SRR0,r8 |
| 1365 | mtspr SPRN_SRR1,r9 | 1370 | mtspr SPRN_SRR1,r9 |
| @@ -290,17 +290,55 @@ MachineCheck: · 289 unmodified lines | |||
| 290 | 7: EXCEPTION_PROLOG_2 | 290 | 7: EXCEPTION_PROLOG_2 |
| 291 | addi r3,r1,STACK_FRAME_OVERHEAD | 291 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 292 | #ifdef CONFIG_PPC_CHRP | 292 | #ifdef CONFIG_PPC_CHRP |
| 293 | bne cr1,1f | 293 | #ifdef CONFIG_VMAP_STACK |
| 294 | mfspr r4, SPRN_SPRG_THREAD | ||
| 295 | tovirt(r4, r4) | ||
| 296 | lwz r4, RTAS_SP(r4) | ||
| 297 | cmpwi cr1, r4, 0 | ||
| 294 | #endif | 298 | #endif |
| 295 | EXC_XFER_STD(0x200, machine_check_exception) | 299 | beq cr1, machine_check_tramp |
| 296 | #ifdef CONFIG_PPC_CHRP | 300 | b machine_check_in_rtas |
| 297 | 1: b machine_check_in_rtas | 301 | #else |
| 302 | b machine_check_tramp | ||
| 298 | #endif | 303 | #endif |
| 299 | 304 | ||
| 300 | /* Data access exception. */ | 305 | /* Data access exception. */ |
| 301 | . = 0x300 | 306 | . = 0x300 |
| 302 | DO_KVM 0x300 | 307 | DO_KVM 0x300 |
| 303 | DataAccess: | 308 | DataAccess: |
| 309 | #ifdef CONFIG_VMAP_STACK | ||
| 310 | mtspr SPRN_SPRG_SCRATCH0,r10 | ||
| 311 | mfspr r10, SPRN_SPRG_THREAD | ||
| 312 | BEGIN_MMU_FTR_SECTION | ||
| 313 | stw r11, THR11(r10) | ||
| 314 | mfspr r10, SPRN_DSISR | ||
| 315 | mfcr r11 | ||
| 316 | #ifdef CONFIG_PPC_KUAP | ||
| 317 | andis. r10, r10, (DSISR_BAD_FAULT_32S | DSISR_DABRMATCH | DSISR_PROTFAULT)@h | ||
| 318 | #else | ||
| 319 | andis. r10, r10, (DSISR_BAD_FAULT_32S | DSISR_DABRMATCH)@h | ||
| 320 | #endif | ||
| 321 | mfspr r10, SPRN_SPRG_THREAD | ||
| 322 | beq hash_page_dsi | ||
| 323 | .Lhash_page_dsi_cont: | ||
| 324 | mtcr r11 | ||
| 325 | lwz r11, THR11(r10) | ||
| 326 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) | ||
| 327 | mtspr SPRN_SPRG_SCRATCH1,r11 | ||
| 328 | mfspr r11, SPRN_DAR | ||
| 329 | stw r11, DAR(r10) | ||
| 330 | mfspr r11, SPRN_DSISR | ||
| 331 | stw r11, DSISR(r10) | ||
| 332 | mfspr r11, SPRN_SRR0 | ||
| 333 | stw r11, SRR0(r10) | ||
| 334 | mfspr r11, SPRN_SRR1 /* check whether user or kernel */ | ||
| 335 | stw r11, SRR1(r10) | ||
| 336 | mfcr r10 | ||
| 337 | andi. r11, r11, MSR_PR | ||
| 338 | |||
| 339 | EXCEPTION_PROLOG_1 | ||
| 340 | b handle_page_fault_tramp_1 | ||
| 341 | #else /* CONFIG_VMAP_STACK */ | ||
| 304 | EXCEPTION_PROLOG handle_dar_dsisr=1 | 342 | EXCEPTION_PROLOG handle_dar_dsisr=1 |
| 305 | get_and_save_dar_dsisr_on_stack r4, r5, r11 | 343 | get_and_save_dar_dsisr_on_stack r4, r5, r11 |
| 306 | BEGIN_MMU_FTR_SECTION | 344 | BEGIN_MMU_FTR_SECTION |
| @@ -316,11 +354,32 @@ BEGIN_MMU_FTR_SECTION · 9 unmodified lines | |||
| 316 | FTR_SECTION_ELSE | 354 | FTR_SECTION_ELSE |
| 317 | b handle_page_fault_tramp_2 | 355 | b handle_page_fault_tramp_2 |
| 318 | ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_HPTE_TABLE) | 356 | ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_HPTE_TABLE) |
| 357 | #endif /* CONFIG_VMAP_STACK */ | ||
| 319 | 358 | ||
| 320 | /* Instruction access exception. */ | 359 | /* Instruction access exception. */ |
| 321 | . = 0x400 | 360 | . = 0x400 |
| 322 | DO_KVM 0x400 | 361 | DO_KVM 0x400 |
| 323 | InstructionAccess: | 362 | InstructionAccess: |
| 363 | #ifdef CONFIG_VMAP_STACK | ||
| 364 | mtspr SPRN_SPRG_SCRATCH0,r10 | ||
| 365 | mtspr SPRN_SPRG_SCRATCH1,r11 | ||
| 366 | mfspr r10, SPRN_SPRG_THREAD | ||
| 367 | mfspr r11, SPRN_SRR0 | ||
| 368 | stw r11, SRR0(r10) | ||
| 369 | mfspr r11, SPRN_SRR1 /* check whether user or kernel */ | ||
| 370 | stw r11, SRR1(r10) | ||
| 371 | mfcr r10 | ||
| 372 | BEGIN_MMU_FTR_SECTION | ||
| 373 | andis. r11, r11, SRR1_ISI_NOPT@h /* no pte found? */ | ||
| 374 | bne hash_page_isi | ||
| 375 | .Lhash_page_isi_cont: | ||
| 376 | mfspr r11, SPRN_SRR1 /* check whether user or kernel */ | ||
| 377 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) | ||
| 378 | andi. r11, r11, MSR_PR | ||
| 379 | |||
| 380 | EXCEPTION_PROLOG_1 | ||
| 381 | EXCEPTION_PROLOG_2 | ||
| 382 | #else /* CONFIG_VMAP_STACK */ | ||
| 324 | EXCEPTION_PROLOG | 383 | EXCEPTION_PROLOG |
| 325 | andis. r0,r9,SRR1_ISI_NOPT@h /* no pte found? */ | 384 | andis. r0,r9,SRR1_ISI_NOPT@h /* no pte found? */ |
| 326 | beq 1f /* if so, try to put a PTE */ | 385 | beq 1f /* if so, try to put a PTE */ |
| @@ -329,6 +388,7 @@ InstructionAccess: · 2 unmodified lines | |||
| 329 | BEGIN_MMU_FTR_SECTION | 388 | BEGIN_MMU_FTR_SECTION |
| 330 | bl hash_page | 389 | bl hash_page |
| 331 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) | 390 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) |
| 391 | #endif /* CONFIG_VMAP_STACK */ | ||
| 332 | 1: mr r4,r12 | 392 | 1: mr r4,r12 |
| 333 | andis. r5,r9,DSISR_SRR1_MATCH_32S@h /* Filter relevant SRR1 bits */ | 393 | andis. r5,r9,DSISR_SRR1_MATCH_32S@h /* Filter relevant SRR1 bits */ |
| 334 | stw r4, _DAR(r11) | 394 | stw r4, _DAR(r11) |
| @@ -344,7 +404,7 @@ Alignment: · 9 unmodified lines | |||
| 344 | EXCEPTION_PROLOG handle_dar_dsisr=1 | 404 | EXCEPTION_PROLOG handle_dar_dsisr=1 |
| 345 | save_dar_dsisr_on_stack r4, r5, r11 | 405 | save_dar_dsisr_on_stack r4, r5, r11 |
| 346 | addi r3,r1,STACK_FRAME_OVERHEAD | 406 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 347 | EXC_XFER_STD(0x600, alignment_exception) | 407 | b alignment_exception_tramp |
| 348 | 408 | ||
| 349 | /* Program check exception */ | 409 | /* Program check exception */ |
| 350 | EXCEPTION(0x700, ProgramCheck, program_check_exception, EXC_XFER_STD) | 410 | EXCEPTION(0x700, ProgramCheck, program_check_exception, EXC_XFER_STD) |
| @@ -645,15 +705,100 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_NEED_DTLB_SW_LRU) · 294 unmodified lines | |||
| 645 | 705 | ||
| 646 | . = 0x3000 | 706 | . = 0x3000 |
| 647 | 707 | ||
| 708 | machine_check_tramp: | ||
| 709 | EXC_XFER_STD(0x200, machine_check_exception) | ||
| 710 | |||
| 711 | alignment_exception_tramp: | ||
| 712 | EXC_XFER_STD(0x600, alignment_exception) | ||
| 713 | |||
| 648 | handle_page_fault_tramp_1: | 714 | handle_page_fault_tramp_1: |
| 715 | #ifdef CONFIG_VMAP_STACK | ||
| 716 | EXCEPTION_PROLOG_2 handle_dar_dsisr=1 | ||
| 717 | #endif | ||
| 649 | lwz r4, _DAR(r11) | 718 | lwz r4, _DAR(r11) |
| 650 | lwz r5, _DSISR(r11) | 719 | lwz r5, _DSISR(r11) |
| 651 | /* fall through */ | 720 | /* fall through */ |
| 652 | handle_page_fault_tramp_2: | 721 | handle_page_fault_tramp_2: |
| 653 | EXC_XFER_LITE(0x300, handle_page_fault) | 722 | EXC_XFER_LITE(0x300, handle_page_fault) |
| 654 | 723 | ||
| 724 | #ifdef CONFIG_VMAP_STACK | ||
| 725 | .macro save_regs_thread thread | ||
| 726 | stw r0, THR0(\thread) | ||
| 727 | stw r3, THR3(\thread) | ||
| 728 | stw r4, THR4(\thread) | ||
| 729 | stw r5, THR5(\thread) | ||
| 730 | stw r6, THR6(\thread) | ||
| 731 | stw r8, THR8(\thread) | ||
| 732 | stw r9, THR9(\thread) | ||
| 733 | mflr r0 | ||
| 734 | stw r0, THLR(\thread) | ||
| 735 | mfctr r0 | ||
| 736 | stw r0, THCTR(\thread) | ||
| 737 | .endm | ||
| 738 | |||
| 739 | .macro restore_regs_thread thread | ||
| 740 | lwz r0, THLR(\thread) | ||
| 741 | mtlr r0 | ||
| 742 | lwz r0, THCTR(\thread) | ||
| 743 | mtctr r0 | ||
| 744 | lwz r0, THR0(\thread) | ||
| 745 | lwz r3, THR3(\thread) | ||
| 746 | lwz r4, THR4(\thread) | ||
| 747 | lwz r5, THR5(\thread) | ||
| 748 | lwz r6, THR6(\thread) | ||
| 749 | lwz r8, THR8(\thread) | ||
| 750 | lwz r9, THR9(\thread) | ||
| 751 | .endm | ||
| 752 | |||
| 753 | hash_page_dsi: | ||
| 754 | save_regs_thread r10 | ||
| 755 | mfdsisr r3 | ||
| 756 | mfdar r4 | ||
| 757 | mfsrr0 r5 | ||
| 758 | mfsrr1 r9 | ||
| 759 | rlwinm r3, r3, 32 - 15, _PAGE_RW /* DSISR_STORE -> _PAGE_RW */ | ||
| 760 | bl hash_page | ||
| 761 | mfspr r10, SPRN_SPRG_THREAD | ||
| 762 | restore_regs_thread r10 | ||
| 763 | b .Lhash_page_dsi_cont | ||
| 764 | |||
| 765 | hash_page_isi: | ||
| 766 | mr r11, r10 | ||
| 767 | mfspr r10, SPRN_SPRG_THREAD | ||
| 768 | save_regs_thread r10 | ||
| 769 | li r3, 0 | ||
| 770 | lwz r4, SRR0(r10) | ||
| 771 | lwz r9, SRR1(r10) | ||
| 772 | bl hash_page | ||
| 773 | mfspr r10, SPRN_SPRG_THREAD | ||
| 774 | restore_regs_thread r10 | ||
| 775 | mr r10, r11 | ||
| 776 | b .Lhash_page_isi_cont | ||
| 777 | |||
| 778 | .globl fast_hash_page_return | ||
| 779 | fast_hash_page_return: | ||
| 780 | andis. r10, r9, SRR1_ISI_NOPT@h /* Set on ISI, cleared on DSI */ | ||
| 781 | mfspr r10, SPRN_SPRG_THREAD | ||
| 782 | restore_regs_thread r10 | ||
| 783 | bne 1f | ||
| 784 | |||
| 785 | /* DSI */ | ||
| 786 | mtcr r11 | ||
| 787 | lwz r11, THR11(r10) | ||
| 788 | mfspr r10, SPRN_SPRG_SCRATCH0 | ||
| 789 | SYNC | ||
| 790 | RFI | ||
| 791 | |||
| 792 | 1: /* ISI */ | ||
| 793 | mtcr r11 | ||
| 794 | mfspr r11, SPRN_SPRG_SCRATCH1 | ||
| 795 | mfspr r10, SPRN_SPRG_SCRATCH0 | ||
| 796 | SYNC | ||
| 797 | RFI | ||
| 798 | |||
| 655 | stack_overflow: | 799 | stack_overflow: |
| 656 | vmap_stack_overflow_exception | 800 | vmap_stack_overflow_exception |
| 801 | #endif | ||
| 657 | 802 | ||
| 658 | AltiVecUnavailable: | 803 | AltiVecUnavailable: |
| 659 | EXCEPTION_PROLOG | 804 | EXCEPTION_PROLOG |
| @@ -64,11 +64,25 @@ · 63 unmodified lines | |||
| 64 | .endm | 64 | .endm |
| 65 | 65 | ||
| 66 | .macro EXCEPTION_PROLOG_2 handle_dar_dsisr=0 | 66 | .macro EXCEPTION_PROLOG_2 handle_dar_dsisr=0 |
| 67 | #if defined(CONFIG_VMAP_STACK) && defined(CONFIG_PPC_BOOK3S) | ||
| 68 | BEGIN_MMU_FTR_SECTION | ||
| 69 | mtcr r10 | ||
| 70 | FTR_SECTION_ELSE | ||
| 71 | stw r10, _CCR(r11) | ||
| 72 | ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_HPTE_TABLE) | ||
| 73 | #else | ||
| 67 | stw r10,_CCR(r11) /* save registers */ | 74 | stw r10,_CCR(r11) /* save registers */ |
| 75 | #endif | ||
| 76 | mfspr r10, SPRN_SPRG_SCRATCH0 | ||
| 68 | stw r12,GPR12(r11) | 77 | stw r12,GPR12(r11) |
| 69 | stw r9,GPR9(r11) | 78 | stw r9,GPR9(r11) |
| 70 | mfspr r10,SPRN_SPRG_SCRATCH0 | ||
| 71 | stw r10,GPR10(r11) | 79 | stw r10,GPR10(r11) |
| 80 | #if defined(CONFIG_VMAP_STACK) && defined(CONFIG_PPC_BOOK3S) | ||
| 81 | BEGIN_MMU_FTR_SECTION | ||
| 82 | mfcr r10 | ||
| 83 | stw r10, _CCR(r11) | ||
| 84 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) | ||
| 85 | #endif | ||
| 72 | mfspr r12,SPRN_SPRG_SCRATCH1 | 86 | mfspr r12,SPRN_SPRG_SCRATCH1 |
| 73 | stw r12,GPR11(r11) | 87 | stw r12,GPR11(r11) |
| 74 | mflr r10 | 88 | mflr r10 |
| @@ -83,6 +97,11 @@ · 8 unmodified lines | |||
| 83 | stw r10, _DSISR(r11) | 97 | stw r10, _DSISR(r11) |
| 84 | .endif | 98 | .endif |
| 85 | lwz r9, SRR1(r12) | 99 | lwz r9, SRR1(r12) |
| 100 | #if defined(CONFIG_VMAP_STACK) && defined(CONFIG_PPC_BOOK3S) | ||
| 101 | BEGIN_MMU_FTR_SECTION | ||
| 102 | andi. r10, r9, MSR_PR | ||
| 103 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) | ||
| 104 | #endif | ||
| 86 | lwz r12, SRR0(r12) | 105 | lwz r12, SRR0(r12) |
| 87 | #else | 106 | #else |
| 88 | mfspr r12,SPRN_SRR0 | 107 | mfspr r12,SPRN_SRR0 |
| @@ -256,7 +256,7 @@ InstructionTLBMiss: · 255 unmodified lines | |||
| 256 | * set. All other Linux PTE bits control the behavior | 256 | * set. All other Linux PTE bits control the behavior |
| 257 | * of the MMU. | 257 | * of the MMU. |
| 258 | */ | 258 | */ |
| 259 | rlwimi r10, r10, 0, 0x0f00 /* Clear bits 20-23 */ | 259 | rlwinm r10, r10, 0, ~0x0f00 /* Clear bits 20-23 */ |
| 260 | rlwimi r10, r10, 4, 0x0400 /* Copy _PAGE_EXEC into bit 21 */ | 260 | rlwimi r10, r10, 4, 0x0400 /* Copy _PAGE_EXEC into bit 21 */ |
| 261 | ori r10, r10, RPN_PATTERN | 0x200 /* Set 22 and 24-27 */ | 261 | ori r10, r10, RPN_PATTERN | 0x200 /* Set 22 and 24-27 */ |
| 262 | mtspr SPRN_MI_RPN, r10 /* Update TLB entry */ | 262 | mtspr SPRN_MI_RPN, r10 /* Update TLB entry */ |
| @@ -166,7 +166,11 @@ BEGIN_FTR_SECTION · 165 unmodified lines | |||
| 166 | mfspr r9,SPRN_HID0 | 166 | mfspr r9,SPRN_HID0 |
| 167 | andis. r9,r9,HID0_NAP@h | 167 | andis. r9,r9,HID0_NAP@h |
| 168 | beq 1f | 168 | beq 1f |
| 169 | #ifdef CONFIG_VMAP_STACK | ||
| 170 | addis r9, r11, nap_save_msscr0@ha | ||
| 171 | #else | ||
| 169 | addis r9,r11,(nap_save_msscr0-KERNELBASE)@ha | 172 | addis r9,r11,(nap_save_msscr0-KERNELBASE)@ha |
| 173 | #endif | ||
| 170 | lwz r9,nap_save_msscr0@l(r9) | 174 | lwz r9,nap_save_msscr0@l(r9) |
| 171 | mtspr SPRN_MSSCR0, r9 | 175 | mtspr SPRN_MSSCR0, r9 |
| 172 | sync | 176 | sync |
| @@ -174,7 +178,11 @@ BEGIN_FTR_SECTION · 1 unmodified line | |||
| 174 | 1: | 178 | 1: |
| 175 | END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR) | 179 | END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR) |
| 176 | BEGIN_FTR_SECTION | 180 | BEGIN_FTR_SECTION |
| 181 | #ifdef CONFIG_VMAP_STACK | ||
| 182 | addis r9, r11, nap_save_hid1@ha | ||
| 183 | #else | ||
| 177 | addis r9,r11,(nap_save_hid1-KERNELBASE)@ha | 184 | addis r9,r11,(nap_save_hid1-KERNELBASE)@ha |
| 185 | #endif | ||
| 178 | lwz r9,nap_save_hid1@l(r9) | 186 | lwz r9,nap_save_hid1@l(r9) |
| 179 | mtspr SPRN_HID1, r9 | 187 | mtspr SPRN_HID1, r9 |
| 180 | END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX) | 188 | END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX) |
| @@ -200,14 +200,27 @@ unsigned long get_tm_stackpointer(struct task_struct *tsk) · 199 unmodified lines | |||
| 200 | * normal/non-checkpointed stack pointer. | 200 | * normal/non-checkpointed stack pointer. |
| 201 | */ | 201 | */ |
| 202 | 202 | ||
| 203 | unsigned long ret = tsk->thread.regs->gpr[1]; | ||
| 204 | |||
| 203 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | 205 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
| 204 | BUG_ON(tsk != current); | 206 | BUG_ON(tsk != current); |
| 205 | 207 | ||
| 206 | if (MSR_TM_ACTIVE(tsk->thread.regs->msr)) { | 208 | if (MSR_TM_ACTIVE(tsk->thread.regs->msr)) { |
| 209 | preempt_disable(); | ||
| 207 | tm_reclaim_current(TM_CAUSE_SIGNAL); | 210 | tm_reclaim_current(TM_CAUSE_SIGNAL); |
| 208 | if (MSR_TM_TRANSACTIONAL(tsk->thread.regs->msr)) | 211 | if (MSR_TM_TRANSACTIONAL(tsk->thread.regs->msr)) |
| 209 | return tsk->thread.ckpt_regs.gpr[1]; | 212 | ret = tsk->thread.ckpt_regs.gpr[1]; |
| 213 | |||
| 214 | /* | ||
| 215 | * If we treclaim, we must clear the current thread's TM bits | ||
| 216 | * before re-enabling preemption. Otherwise we might be | ||
| 217 | * preempted and have the live MSR[TS] changed behind our back | ||
| 218 | * (tm_recheckpoint_new_task() would recheckpoint). Besides, we | ||
| 219 | * enter the signal handler in non-transactional state. | ||
| 220 | */ | ||
| 221 | tsk->thread.regs->msr &= ~MSR_TS_MASK; | ||
| 222 | preempt_enable(); | ||
| 210 | } | 223 | } |
| 211 | #endif | 224 | #endif |
| 212 | return tsk->thread.regs->gpr[1]; | 225 | return ret; |
| 213 | } | 226 | } |
| @@ -489,19 +489,11 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, · 488 unmodified lines | |||
| 489 | */ | 489 | */ |
| 490 | static int save_tm_user_regs(struct pt_regs *regs, | 490 | static int save_tm_user_regs(struct pt_regs *regs, |
| 491 | struct mcontext __user *frame, | 491 | struct mcontext __user *frame, |
| 492 | struct mcontext __user *tm_frame, int sigret) | 492 | struct mcontext __user *tm_frame, int sigret, |
| 493 | unsigned long msr) | ||
| 493 | { | 494 | { |
| 494 | unsigned long msr = regs->msr; | ||
| 495 | |||
| 496 | WARN_ON(tm_suspend_disabled); | 495 | WARN_ON(tm_suspend_disabled); |
| 497 | 496 | ||
| 498 | /* Remove TM bits from thread's MSR. The MSR in the sigcontext | ||
| 499 | * just indicates to userland that we were doing a transaction, but we | ||
| 500 | * don't want to return in transactional state. This also ensures | ||
| 501 | * that flush_fp_to_thread won't set TIF_RESTORE_TM again. | ||
| 502 | */ | ||
| 503 | regs->msr &= ~MSR_TS_MASK; | ||
| 504 | |||
| 505 | /* Save both sets of general registers */ | 497 | /* Save both sets of general registers */ |
| 506 | if (save_general_regs(¤t->thread.ckpt_regs, frame) | 498 | if (save_general_regs(¤t->thread.ckpt_regs, frame) |
| 507 | || save_general_regs(regs, tm_frame)) | 499 | || save_general_regs(regs, tm_frame)) |
| @@ -912,6 +904,10 @@ int handle_rt_signal32(struct ksignal *ksig, sigset_t *oldset, · 404 unmodified lines | |||
| 912 | int sigret; | 904 | int sigret; |
| 913 | unsigned long tramp; | 905 | unsigned long tramp; |
| 914 | struct pt_regs *regs = tsk->thread.regs; | 906 | struct pt_regs *regs = tsk->thread.regs; |
| 907 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | ||
| 908 | /* Save the thread's msr before get_tm_stackpointer() changes it */ | ||
| 909 | unsigned long msr = regs->msr; | ||
| 910 | #endif | ||
| 915 | 911 | ||
| 916 | BUG_ON(tsk != current); | 912 | BUG_ON(tsk != current); |
| 917 | 913 | ||
| @@ -944,13 +940,13 @@ int handle_rt_signal32(struct ksignal *ksig, sigset_t *oldset, · 26 unmodified lines | |||
| 944 | 940 | ||
| 945 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | 941 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
| 946 | tm_frame = &rt_sf->uc_transact.uc_mcontext; | 942 | tm_frame = &rt_sf->uc_transact.uc_mcontext; |
| 947 | if (MSR_TM_ACTIVE(regs->msr)) { | 943 | if (MSR_TM_ACTIVE(msr)) { |
| 948 | if (__put_user((unsigned long)&rt_sf->uc_transact, | 944 | if (__put_user((unsigned long)&rt_sf->uc_transact, |
| 949 | &rt_sf->uc.uc_link) || | 945 | &rt_sf->uc.uc_link) || |
| 950 | __put_user((unsigned long)tm_frame, | 946 | __put_user((unsigned long)tm_frame, |
| 951 | &rt_sf->uc_transact.uc_regs)) | 947 | &rt_sf->uc_transact.uc_regs)) |
| 952 | goto badframe; | 948 | goto badframe; |
| 953 | if (save_tm_user_regs(regs, frame, tm_frame, sigret)) | 949 | if (save_tm_user_regs(regs, frame, tm_frame, sigret, msr)) |
| 954 | goto badframe; | 950 | goto badframe; |
| 955 | } | 951 | } |
| 956 | else | 952 | else |
| @@ -1369,6 +1365,10 @@ int handle_signal32(struct ksignal *ksig, sigset_t *oldset, · 412 unmodified lines | |||
| 1369 | int sigret; | 1365 | int sigret; |
| 1370 | unsigned long tramp; | 1366 | unsigned long tramp; |
| 1371 | struct pt_regs *regs = tsk->thread.regs; | 1367 | struct pt_regs *regs = tsk->thread.regs; |
| 1368 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | ||
| 1369 | /* Save the thread's msr before get_tm_stackpointer() changes it */ | ||
| 1370 | unsigned long msr = regs->msr; | ||
| 1371 | #endif | ||
| 1372 | 1372 | ||
| 1373 | BUG_ON(tsk != current); | 1373 | BUG_ON(tsk != current); |
| 1374 | 1374 | ||
| @@ -1402,9 +1402,9 @@ int handle_signal32(struct ksignal *ksig, sigset_t *oldset, · 27 unmodified lines | |||
| 1402 | 1402 | ||
| 1403 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | 1403 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
| 1404 | tm_mctx = &frame->mctx_transact; | 1404 | tm_mctx = &frame->mctx_transact; |
| 1405 | if (MSR_TM_ACTIVE(regs->msr)) { | 1405 | if (MSR_TM_ACTIVE(msr)) { |
| 1406 | if (save_tm_user_regs(regs, &frame->mctx, &frame->mctx_transact, | 1406 | if (save_tm_user_regs(regs, &frame->mctx, &frame->mctx_transact, |
| 1407 | sigret)) | 1407 | sigret, msr)) |
| 1408 | goto badframe; | 1408 | goto badframe; |
| 1409 | } | 1409 | } |
| 1410 | else | 1410 | else |
| @@ -192,7 +192,8 @@ static long setup_sigcontext(struct sigcontext __user *sc, · 191 unmodified lines | |||
| 192 | static long setup_tm_sigcontexts(struct sigcontext __user *sc, | 192 | static long setup_tm_sigcontexts(struct sigcontext __user *sc, |
| 193 | struct sigcontext __user *tm_sc, | 193 | struct sigcontext __user *tm_sc, |
| 194 | struct task_struct *tsk, | 194 | struct task_struct *tsk, |
| 195 | int signr, sigset_t *set, unsigned long handler) | 195 | int signr, sigset_t *set, unsigned long handler, |
| 196 | unsigned long msr) | ||
| 196 | { | 197 | { |
| 197 | /* When CONFIG_ALTIVEC is set, we _always_ setup v_regs even if the | 198 | /* When CONFIG_ALTIVEC is set, we _always_ setup v_regs even if the |
| 198 | * process never used altivec yet (MSR_VEC is zero in pt_regs of | 199 | * process never used altivec yet (MSR_VEC is zero in pt_regs of |
| @@ -207,12 +208,11 @@ static long setup_tm_sigcontexts(struct sigcontext __user *sc, · 8 unmodified lines | |||
| 207 | elf_vrreg_t __user *tm_v_regs = sigcontext_vmx_regs(tm_sc); | 208 | elf_vrreg_t __user *tm_v_regs = sigcontext_vmx_regs(tm_sc); |
| 208 | #endif | 209 | #endif |
| 209 | struct pt_regs *regs = tsk->thread.regs; | 210 | struct pt_regs *regs = tsk->thread.regs; |
| 210 | unsigned long msr = tsk->thread.regs->msr; | ||
| 211 | long err = 0; | 211 | long err = 0; |
| 212 | 212 | ||
| 213 | BUG_ON(tsk != current); | 213 | BUG_ON(tsk != current); |
| 214 | 214 | ||
| 215 | BUG_ON(!MSR_TM_ACTIVE(regs->msr)); | 215 | BUG_ON(!MSR_TM_ACTIVE(msr)); |
| 216 | 216 | ||
| 217 | WARN_ON(tm_suspend_disabled); | 217 | WARN_ON(tm_suspend_disabled); |
| 218 | 218 | ||
| @@ -222,13 +222,6 @@ static long setup_tm_sigcontexts(struct sigcontext __user *sc, · 3 unmodified lines | |||
| 222 | */ | 222 | */ |
| 223 | msr |= tsk->thread.ckpt_regs.msr & (MSR_FP | MSR_VEC | MSR_VSX); | 223 | msr |= tsk->thread.ckpt_regs.msr & (MSR_FP | MSR_VEC | MSR_VSX); |
| 224 | 224 | ||
| 225 | /* Remove TM bits from thread's MSR. The MSR in the sigcontext | ||
| 226 | * just indicates to userland that we were doing a transaction, but we | ||
| 227 | * don't want to return in transactional state. This also ensures | ||
| 228 | * that flush_fp_to_thread won't set TIF_RESTORE_TM again. | ||
| 229 | */ | ||
| 230 | regs->msr &= ~MSR_TS_MASK; | ||
| 231 | |||
| 232 | #ifdef CONFIG_ALTIVEC | 225 | #ifdef CONFIG_ALTIVEC |
| 233 | err |= __put_user(v_regs, &sc->v_regs); | 226 | err |= __put_user(v_regs, &sc->v_regs); |
| 234 | err |= __put_user(tm_v_regs, &tm_sc->v_regs); | 227 | err |= __put_user(tm_v_regs, &tm_sc->v_regs); |
| @@ -824,6 +817,10 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set, · 589 unmodified lines | |||
| 824 | unsigned long newsp = 0; | 817 | unsigned long newsp = 0; |
| 825 | long err = 0; | 818 | long err = 0; |
| 826 | struct pt_regs *regs = tsk->thread.regs; | 819 | struct pt_regs *regs = tsk->thread.regs; |
| 820 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | ||
| 821 | /* Save the thread's msr before get_tm_stackpointer() changes it */ | ||
| 822 | unsigned long msr = regs->msr; | ||
| 823 | #endif | ||
| 827 | 824 | ||
| 828 | BUG_ON(tsk != current); | 825 | BUG_ON(tsk != current); |
| 829 | 826 | ||
| @@ -841,7 +838,7 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set, · 11 unmodified lines | |||
| 841 | err |= __put_user(0, &frame->uc.uc_flags); | 838 | err |= __put_user(0, &frame->uc.uc_flags); |
| 842 | err |= __save_altstack(&frame->uc.uc_stack, regs->gpr[1]); | 839 | err |= __save_altstack(&frame->uc.uc_stack, regs->gpr[1]); |
| 843 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | 840 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
| 844 | if (MSR_TM_ACTIVE(regs->msr)) { | 841 | if (MSR_TM_ACTIVE(msr)) { |
| 845 | /* The ucontext_t passed to userland points to the second | 842 | /* The ucontext_t passed to userland points to the second |
| 846 | * ucontext_t (for transactional state) with its uc_link ptr. | 843 | * ucontext_t (for transactional state) with its uc_link ptr. |
| 847 | */ | 844 | */ |
| @@ -849,7 +846,8 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set, · 1 unmodified line | |||
| 849 | err |= setup_tm_sigcontexts(&frame->uc.uc_mcontext, | 846 | err |= setup_tm_sigcontexts(&frame->uc.uc_mcontext, |
| 850 | &frame->uc_transact.uc_mcontext, | 847 | &frame->uc_transact.uc_mcontext, |
| 851 | tsk, ksig->sig, NULL, | 848 | tsk, ksig->sig, NULL, |
| 852 | (unsigned long)ksig->ka.sa.sa_handler); | 849 | (unsigned long)ksig->ka.sa.sa_handler, |
| 850 | msr); | ||
| 853 | } else | 851 | } else |
| 854 | #endif | 852 | #endif |
| 855 | { | 853 | { |
| @@ -25,12 +25,6 @@ · 24 unmodified lines | |||
| 25 | #include <asm/feature-fixups.h> | 25 | #include <asm/feature-fixups.h> |
| 26 | #include <asm/code-patching-asm.h> | 26 | #include <asm/code-patching-asm.h> |
| 27 | 27 | ||
| 28 | #ifdef CONFIG_VMAP_STACK | ||
| 29 | #define ADDR_OFFSET 0 | ||
| 30 | #else | ||
| 31 | #define ADDR_OFFSET PAGE_OFFSET | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #ifdef CONFIG_SMP | 28 | #ifdef CONFIG_SMP |
| 35 | .section .bss | 29 | .section .bss |
| 36 | .align 2 | 30 | .align 2 |
| @@ -53,8 +47,8 @@ mmu_hash_lock: · 16 unmodified lines | |||
| 53 | .text | 47 | .text |
| 54 | _GLOBAL(hash_page) | 48 | _GLOBAL(hash_page) |
| 55 | #ifdef CONFIG_SMP | 49 | #ifdef CONFIG_SMP |
| 56 | lis r8, (mmu_hash_lock - ADDR_OFFSET)@h | 50 | lis r8, (mmu_hash_lock - PAGE_OFFSET)@h |
| 57 | ori r8, r8, (mmu_hash_lock - ADDR_OFFSET)@l | 51 | ori r8, r8, (mmu_hash_lock - PAGE_OFFSET)@l |
| 58 | lis r0,0x0fff | 52 | lis r0,0x0fff |
| 59 | b 10f | 53 | b 10f |
| 60 | 11: lwz r6,0(r8) | 54 | 11: lwz r6,0(r8) |
| @@ -72,12 +66,9 @@ _GLOBAL(hash_page) · 11 unmodified lines | |||
| 72 | cmplw 0,r4,r0 | 66 | cmplw 0,r4,r0 |
| 73 | ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */ | 67 | ori r3,r3,_PAGE_USER|_PAGE_PRESENT /* test low addresses as user */ |
| 74 | mfspr r5, SPRN_SPRG_PGDIR /* phys page-table root */ | 68 | mfspr r5, SPRN_SPRG_PGDIR /* phys page-table root */ |
| 75 | #ifdef CONFIG_VMAP_STACK | ||
| 76 | tovirt(r5, r5) | ||
| 77 | #endif | ||
| 78 | blt+ 112f /* assume user more likely */ | 69 | blt+ 112f /* assume user more likely */ |
| 79 | lis r5, (swapper_pg_dir - ADDR_OFFSET)@ha /* if kernel address, use */ | 70 | lis r5, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ |
| 80 | addi r5 ,r5 ,(swapper_pg_dir - ADDR_OFFSET)@l /* kernel page table */ | 71 | addi r5 ,r5 ,(swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ |
| 81 | rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */ | 72 | rlwimi r3,r9,32-12,29,29 /* MSR_PR -> _PAGE_USER */ |
| 82 | 112: | 73 | 112: |
| 83 | #ifndef CONFIG_PTE_64BIT | 74 | #ifndef CONFIG_PTE_64BIT |
| @@ -89,9 +80,6 @@ _GLOBAL(hash_page) · 5 unmodified lines | |||
| 89 | lwzx r8,r8,r5 /* Get L1 entry */ | 80 | lwzx r8,r8,r5 /* Get L1 entry */ |
| 90 | rlwinm. r8,r8,0,0,20 /* extract pt base address */ | 81 | rlwinm. r8,r8,0,0,20 /* extract pt base address */ |
| 91 | #endif | 82 | #endif |
| 92 | #ifdef CONFIG_VMAP_STACK | ||
| 93 | tovirt(r8, r8) | ||
| 94 | #endif | ||
| 95 | #ifdef CONFIG_SMP | 83 | #ifdef CONFIG_SMP |
| 96 | beq- hash_page_out /* return if no mapping */ | 84 | beq- hash_page_out /* return if no mapping */ |
| 97 | #else | 85 | #else |
| @@ -143,30 +131,36 @@ retry: · 45 unmodified lines | |||
| 143 | bne- retry /* retry if someone got there first */ | 131 | bne- retry /* retry if someone got there first */ |
| 144 | 132 | ||
| 145 | mfsrin r3,r4 /* get segment reg for segment */ | 133 | mfsrin r3,r4 /* get segment reg for segment */ |
| 134 | #ifndef CONFIG_VMAP_STACK | ||
| 146 | mfctr r0 | 135 | mfctr r0 |
| 147 | stw r0,_CTR(r11) | 136 | stw r0,_CTR(r11) |
| 137 | #endif | ||
| 148 | bl create_hpte /* add the hash table entry */ | 138 | bl create_hpte /* add the hash table entry */ |
| 149 | 139 | ||
| 150 | #ifdef CONFIG_SMP | 140 | #ifdef CONFIG_SMP |
| 151 | eieio | 141 | eieio |
| 152 | lis r8, (mmu_hash_lock - ADDR_OFFSET)@ha | 142 | lis r8, (mmu_hash_lock - PAGE_OFFSET)@ha |
| 153 | li r0,0 | 143 | li r0,0 |
| 154 | stw r0, (mmu_hash_lock - ADDR_OFFSET)@l(r8) | 144 | stw r0, (mmu_hash_lock - PAGE_OFFSET)@l(r8) |
| 155 | #endif | 145 | #endif |
| 156 | 146 | ||
| 147 | #ifdef CONFIG_VMAP_STACK | ||
| 148 | b fast_hash_page_return | ||
| 149 | #else | ||
| 157 | /* Return from the exception */ | 150 | /* Return from the exception */ |
| 158 | lwz r5,_CTR(r11) | 151 | lwz r5,_CTR(r11) |
| 159 | mtctr r5 | 152 | mtctr r5 |
| 160 | lwz r0,GPR0(r11) | 153 | lwz r0,GPR0(r11) |
| 161 | lwz r8,GPR8(r11) | 154 | lwz r8,GPR8(r11) |
| 162 | b fast_exception_return | 155 | b fast_exception_return |
| 156 | #endif | ||
| 163 | 157 | ||
| 164 | #ifdef CONFIG_SMP | 158 | #ifdef CONFIG_SMP |
| 165 | hash_page_out: | 159 | hash_page_out: |
| 166 | eieio | 160 | eieio |
| 167 | lis r8, (mmu_hash_lock - ADDR_OFFSET)@ha | 161 | lis r8, (mmu_hash_lock - PAGE_OFFSET)@ha |
| 168 | li r0,0 | 162 | li r0,0 |
| 169 | stw r0, (mmu_hash_lock - ADDR_OFFSET)@l(r8) | 163 | stw r0, (mmu_hash_lock - PAGE_OFFSET)@l(r8) |
| 170 | blr | 164 | blr |
| 171 | #endif /* CONFIG_SMP */ | 165 | #endif /* CONFIG_SMP */ |
| 172 | 166 | ||
| @@ -341,7 +335,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) · 168 unmodified lines | |||
| 341 | patch_site 1f, patch__hash_page_A1 | 335 | patch_site 1f, patch__hash_page_A1 |
| 342 | patch_site 2f, patch__hash_page_A2 | 336 | patch_site 2f, patch__hash_page_A2 |
| 343 | /* Get the address of the primary PTE group in the hash table (r3) */ | 337 | /* Get the address of the primary PTE group in the hash table (r3) */ |
| 344 | 0: lis r0, (Hash_base - ADDR_OFFSET)@h /* base address of hash table */ | 338 | 0: lis r0, (Hash_base - PAGE_OFFSET)@h /* base address of hash table */ |
| 345 | 1: rlwimi r0,r3,LG_PTEG_SIZE,HASH_LEFT,HASH_RIGHT /* VSID -> hash */ | 339 | 1: rlwimi r0,r3,LG_PTEG_SIZE,HASH_LEFT,HASH_RIGHT /* VSID -> hash */ |
| 346 | 2: rlwinm r3,r4,20+LG_PTEG_SIZE,HASH_LEFT,HASH_RIGHT /* PI -> hash */ | 340 | 2: rlwinm r3,r4,20+LG_PTEG_SIZE,HASH_LEFT,HASH_RIGHT /* PI -> hash */ |
| 347 | xor r3,r3,r0 /* make primary hash */ | 341 | xor r3,r3,r0 /* make primary hash */ |
| @@ -355,10 +349,10 @@ END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) · 7 unmodified lines | |||
| 355 | beq+ 10f /* no PTE: go look for an empty slot */ | 349 | beq+ 10f /* no PTE: go look for an empty slot */ |
| 356 | tlbie r4 | 350 | tlbie r4 |
| 357 | 351 | ||
| 358 | lis r4, (htab_hash_searches - ADDR_OFFSET)@ha | 352 | lis r4, (htab_hash_searches - PAGE_OFFSET)@ha |
| 359 | lwz r6, (htab_hash_searches - ADDR_OFFSET)@l(r4) | 353 | lwz r6, (htab_hash_searches - PAGE_OFFSET)@l(r4) |
| 360 | addi r6,r6,1 /* count how many searches we do */ | 354 | addi r6,r6,1 /* count how many searches we do */ |
| 361 | stw r6, (htab_hash_searches - ADDR_OFFSET)@l(r4) | 355 | stw r6, (htab_hash_searches - PAGE_OFFSET)@l(r4) |
| 362 | 356 | ||
| 363 | /* Search the primary PTEG for a PTE whose 1st (d)word matches r5 */ | 357 | /* Search the primary PTEG for a PTE whose 1st (d)word matches r5 */ |
| 364 | mtctr r0 | 358 | mtctr r0 |
| @@ -390,10 +384,10 @@ END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) · 25 unmodified lines | |||
| 390 | beq+ found_empty | 384 | beq+ found_empty |
| 391 | 385 | ||
| 392 | /* update counter of times that the primary PTEG is full */ | 386 | /* update counter of times that the primary PTEG is full */ |
| 393 | lis r4, (primary_pteg_full - ADDR_OFFSET)@ha | 387 | lis r4, (primary_pteg_full - PAGE_OFFSET)@ha |
| 394 | lwz r6, (primary_pteg_full - ADDR_OFFSET)@l(r4) | 388 | lwz r6, (primary_pteg_full - PAGE_OFFSET)@l(r4) |
| 395 | addi r6,r6,1 | 389 | addi r6,r6,1 |
| 396 | stw r6, (primary_pteg_full - ADDR_OFFSET)@l(r4) | 390 | stw r6, (primary_pteg_full - PAGE_OFFSET)@l(r4) |
| 397 | 391 | ||
| 398 | patch_site 0f, patch__hash_page_C | 392 | patch_site 0f, patch__hash_page_C |
| 399 | /* Search the secondary PTEG for an empty slot */ | 393 | /* Search the secondary PTEG for an empty slot */ |
| @@ -427,8 +421,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_NEED_COHERENT) · 27 unmodified lines | |||
| 427 | * lockup here but that shouldn't happen | 421 | * lockup here but that shouldn't happen |
| 428 | */ | 422 | */ |
| 429 | 423 | ||
| 430 | 1: lis r4, (next_slot - ADDR_OFFSET)@ha /* get next evict slot */ | 424 | 1: lis r4, (next_slot - PAGE_OFFSET)@ha /* get next evict slot */ |
| 431 | lwz r6, (next_slot - ADDR_OFFSET)@l(r4) | 425 | lwz r6, (next_slot - PAGE_OFFSET)@l(r4) |
| 432 | addi r6,r6,HPTE_SIZE /* search for candidate */ | 426 | addi r6,r6,HPTE_SIZE /* search for candidate */ |
| 433 | andi. r6,r6,7*HPTE_SIZE | 427 | andi. r6,r6,7*HPTE_SIZE |
| 434 | stw r6,next_slot@l(r4) | 428 | stw r6,next_slot@l(r4) |
| @@ -413,7 +413,7 @@ void __init MMU_init_hw(void) · 412 unmodified lines | |||
| 413 | void __init MMU_init_hw_patch(void) | 413 | void __init MMU_init_hw_patch(void) |
| 414 | { | 414 | { |
| 415 | unsigned int hmask = Hash_mask >> (16 - LG_HPTEG_SIZE); | 415 | unsigned int hmask = Hash_mask >> (16 - LG_HPTEG_SIZE); |
| 416 | unsigned int hash; | 416 | unsigned int hash = (unsigned int)Hash - PAGE_OFFSET; |
| 417 | 417 | ||
| 418 | if (ppc_md.progress) | 418 | if (ppc_md.progress) |
| 419 | ppc_md.progress("hash:patch", 0x345); | 419 | ppc_md.progress("hash:patch", 0x345); |
| @@ -425,11 +425,6 @@ void __init MMU_init_hw_patch(void) · 5 unmodified lines | |||
| 425 | /* | 425 | /* |
| 426 | * Patch up the instructions in hashtable.S:create_hpte | 426 | * Patch up the instructions in hashtable.S:create_hpte |
| 427 | */ | 427 | */ |
| 428 | if (IS_ENABLED(CONFIG_VMAP_STACK)) | ||
| 429 | hash = (unsigned int)Hash; | ||
| 430 | else | ||
| 431 | hash = (unsigned int)Hash - PAGE_OFFSET; | ||
| 432 | |||
| 433 | modify_instruction_site(&patch__hash_page_A0, 0xffff, hash >> 16); | 428 | modify_instruction_site(&patch__hash_page_A0, 0xffff, hash >> 16); |
| 434 | modify_instruction_site(&patch__hash_page_A1, 0x7c0, hash_mb << 6); | 429 | modify_instruction_site(&patch__hash_page_A1, 0x7c0, hash_mb << 6); |
| 435 | modify_instruction_site(&patch__hash_page_A2, 0x7c0, hash_mb2 << 6); | 430 | modify_instruction_site(&patch__hash_page_A2, 0x7c0, hash_mb2 << 6); |
| @@ -439,8 +434,7 @@ void __init MMU_init_hw_patch(void) · 3 unmodified lines | |||
| 439 | /* | 434 | /* |
| 440 | * Patch up the instructions in hashtable.S:flush_hash_page | 435 | * Patch up the instructions in hashtable.S:flush_hash_page |
| 441 | */ | 436 | */ |
| 442 | modify_instruction_site(&patch__flush_hash_A0, 0xffff, | 437 | modify_instruction_site(&patch__flush_hash_A0, 0xffff, hash >> 16); |
| 443 | ((unsigned int)Hash - PAGE_OFFSET) >> 16); | ||
| 444 | modify_instruction_site(&patch__flush_hash_A1, 0x7c0, hash_mb << 6); | 438 | modify_instruction_site(&patch__flush_hash_A1, 0x7c0, hash_mb << 6); |
| 445 | modify_instruction_site(&patch__flush_hash_A2, 0x7c0, hash_mb2 << 6); | 439 | modify_instruction_site(&patch__flush_hash_A2, 0x7c0, hash_mb2 << 6); |
| 446 | modify_instruction_site(&patch__flush_hash_B, 0xffff, hmask); | 440 | modify_instruction_site(&patch__flush_hash_B, 0xffff, hmask); |
| @@ -53,20 +53,24 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, · 52 unmodified lines | |||
| 53 | if (pshift >= pdshift) { | 53 | if (pshift >= pdshift) { |
| 54 | cachep = PGT_CACHE(PTE_T_ORDER); | 54 | cachep = PGT_CACHE(PTE_T_ORDER); |
| 55 | num_hugepd = 1 << (pshift - pdshift); | 55 | num_hugepd = 1 << (pshift - pdshift); |
| 56 | new = NULL; | ||
| 56 | } else if (IS_ENABLED(CONFIG_PPC_8xx)) { | 57 | } else if (IS_ENABLED(CONFIG_PPC_8xx)) { |
| 57 | cachep = PGT_CACHE(PTE_INDEX_SIZE); | 58 | cachep = NULL; |
| 58 | num_hugepd = 1; | 59 | num_hugepd = 1; |
| 60 | new = pte_alloc_one(mm); | ||
| 59 | } else { | 61 | } else { |
| 60 | cachep = PGT_CACHE(pdshift - pshift); | 62 | cachep = PGT_CACHE(pdshift - pshift); |
| 61 | num_hugepd = 1; | 63 | num_hugepd = 1; |
| 64 | new = NULL; | ||
| 62 | } | 65 | } |
| 63 | 66 | ||
| 64 | if (!cachep) { | 67 | if (!cachep && !new) { |
| 65 | WARN_ONCE(1, "No page table cache created for hugetlb tables"); | 68 | WARN_ONCE(1, "No page table cache created for hugetlb tables"); |
| 66 | return -ENOMEM; | 69 | return -ENOMEM; |
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | new = kmem_cache_alloc(cachep, pgtable_gfp_flags(mm, GFP_KERNEL)); | 72 | if (cachep) |
| 73 | new = kmem_cache_alloc(cachep, pgtable_gfp_flags(mm, GFP_KERNEL)); | ||
| 70 | 74 | ||
| 71 | BUG_ON(pshift > HUGEPD_SHIFT_MASK); | 75 | BUG_ON(pshift > HUGEPD_SHIFT_MASK); |
| 72 | BUG_ON((unsigned long)new & HUGEPD_SHIFT_MASK); | 76 | BUG_ON((unsigned long)new & HUGEPD_SHIFT_MASK); |
| @@ -97,7 +101,10 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, · 24 unmodified lines | |||
| 97 | if (i < num_hugepd) { | 101 | if (i < num_hugepd) { |
| 98 | for (i = i - 1 ; i >= 0; i--, hpdp--) | 102 | for (i = i - 1 ; i >= 0; i--, hpdp--) |
| 99 | *hpdp = __hugepd(0); | 103 | *hpdp = __hugepd(0); |
| 100 | kmem_cache_free(cachep, new); | 104 | if (cachep) |
| 105 | kmem_cache_free(cachep, new); | ||
| 106 | else | ||
| 107 | pte_free(mm, new); | ||
| 101 | } else { | 108 | } else { |
| 102 | kmemleak_ignore(new); | 109 | kmemleak_ignore(new); |
| 103 | } | 110 | } |
| @@ -324,8 +331,7 @@ static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshif · 220 unmodified lines | |||
| 324 | if (shift >= pdshift) | 331 | if (shift >= pdshift) |
| 325 | hugepd_free(tlb, hugepte); | 332 | hugepd_free(tlb, hugepte); |
| 326 | else if (IS_ENABLED(CONFIG_PPC_8xx)) | 333 | else if (IS_ENABLED(CONFIG_PPC_8xx)) |
| 327 | pgtable_free_tlb(tlb, hugepte, | 334 | pgtable_free_tlb(tlb, hugepte, 0); |
| 328 | get_hugepd_cache_index(PTE_INDEX_SIZE)); | ||
| 329 | else | 335 | else |
| 330 | pgtable_free_tlb(tlb, hugepte, | 336 | pgtable_free_tlb(tlb, hugepte, |
| 331 | get_hugepd_cache_index(pdshift - shift)); | 337 | get_hugepd_cache_index(pdshift - shift)); |
| @@ -639,12 +645,13 @@ static int __init hugetlbpage_init(void) · 307 unmodified lines | |||
| 639 | * if we have pdshift and shift value same, we don't | 645 | * if we have pdshift and shift value same, we don't |
| 640 | * use pgt cache for hugepd. | 646 | * use pgt cache for hugepd. |
| 641 | */ | 647 | */ |
| 642 | if (pdshift > shift && IS_ENABLED(CONFIG_PPC_8xx)) | 648 | if (pdshift > shift) { |
| 643 | pgtable_cache_add(PTE_INDEX_SIZE); | 649 | if (!IS_ENABLED(CONFIG_PPC_8xx)) |
| 644 | else if (pdshift > shift) | 650 | pgtable_cache_add(pdshift - shift); |
| 645 | pgtable_cache_add(pdshift - shift); | 651 | } else if (IS_ENABLED(CONFIG_PPC_FSL_BOOK3E) || |
| 646 | else if (IS_ENABLED(CONFIG_PPC_FSL_BOOK3E) || IS_ENABLED(CONFIG_PPC_8xx)) | 652 | IS_ENABLED(CONFIG_PPC_8xx)) { |
| 647 | pgtable_cache_add(PTE_T_ORDER); | 653 | pgtable_cache_add(PTE_T_ORDER); |
| 654 | } | ||
| 648 | 655 | ||
| 649 | configured = true; | 656 | configured = true; |
| 650 | } | 657 | } |
| @@ -185,8 +185,7 @@ u8 __initdata early_hash[256 << 10] __aligned(256 << 10) = {0}; · 184 unmodified lines | |||
| 185 | 185 | ||
| 186 | static void __init kasan_early_hash_table(void) | 186 | static void __init kasan_early_hash_table(void) |
| 187 | { | 187 | { |
| 188 | unsigned int hash = IS_ENABLED(CONFIG_VMAP_STACK) ? (unsigned int)early_hash : | 188 | unsigned int hash = __pa(early_hash); |
| 189 | __pa(early_hash); | ||
| 190 | 189 | ||
| 191 | modify_instruction_site(&patch__hash_page_A0, 0xffff, hash >> 16); | 190 | modify_instruction_site(&patch__hash_page_A0, 0xffff, hash >> 16); |
| 192 | modify_instruction_site(&patch__flush_hash_A0, 0xffff, hash >> 16); | 191 | modify_instruction_site(&patch__flush_hash_A0, 0xffff, hash >> 16); |
| @@ -3435,6 +3435,11 @@ getstring(char *s, int size) · 3434 unmodified lines | |||
| 3435 | int c; | 3435 | int c; |
| 3436 | 3436 | ||
| 3437 | c = skipbl(); | 3437 | c = skipbl(); |
| 3438 | if (c == '\n') { | ||
| 3439 | *s = 0; | ||
| 3440 | return; | ||
| 3441 | } | ||
| 3442 | |||
| 3438 | do { | 3443 | do { |
| 3439 | if( size > 1 ){ | 3444 | if( size > 1 ){ |
| 3440 | *s++ = c; | 3445 | *s++ = c; |
| @@ -1,2 +1,4 @@ | |||
| 1 | Image | 1 | Image |
| 2 | Image.gz | 2 | Image.gz |
| 3 | loader | ||
| 4 | loader.lds | ||
| @@ -72,6 +72,16 @@ · 71 unmodified lines | |||
| 72 | #define EXC_LOAD_PAGE_FAULT 13 | 72 | #define EXC_LOAD_PAGE_FAULT 13 |
| 73 | #define EXC_STORE_PAGE_FAULT 15 | 73 | #define EXC_STORE_PAGE_FAULT 15 |
| 74 | 74 | ||
| 75 | /* PMP configuration */ | ||
| 76 | #define PMP_R 0x01 | ||
| 77 | #define PMP_W 0x02 | ||
| 78 | #define PMP_X 0x04 | ||
| 79 | #define PMP_A 0x18 | ||
| 80 | #define PMP_A_TOR 0x08 | ||
| 81 | #define PMP_A_NA4 0x10 | ||
| 82 | #define PMP_A_NAPOT 0x18 | ||
| 83 | #define PMP_L 0x80 | ||
| 84 | |||
| 75 | /* symbolic CSR names: */ | 85 | /* symbolic CSR names: */ |
| 76 | #define CSR_CYCLE 0xc00 | 86 | #define CSR_CYCLE 0xc00 |
| 77 | #define CSR_TIME 0xc01 | 87 | #define CSR_TIME 0xc01 |
| @@ -100,6 +110,8 @@ · 22 unmodified lines | |||
| 100 | #define CSR_MCAUSE 0x342 | 110 | #define CSR_MCAUSE 0x342 |
| 101 | #define CSR_MTVAL 0x343 | 111 | #define CSR_MTVAL 0x343 |
| 102 | #define CSR_MIP 0x344 | 112 | #define CSR_MIP 0x344 |
| 113 | #define CSR_PMPCFG0 0x3a0 | ||
| 114 | #define CSR_PMPADDR0 0x3b0 | ||
| 103 | #define CSR_MHARTID 0xf14 | 115 | #define CSR_MHARTID 0xf14 |
| 104 | 116 | ||
| 105 | #ifdef CONFIG_RISCV_M_MODE | 117 | #ifdef CONFIG_RISCV_M_MODE |
| @@ -58,6 +58,12 @@ _start_kernel: · 57 unmodified lines | |||
| 58 | /* Reset all registers except ra, a0, a1 */ | 58 | /* Reset all registers except ra, a0, a1 */ |
| 59 | call reset_regs | 59 | call reset_regs |
| 60 | 60 | ||
| 61 | /* Setup a PMP to permit access to all of memory. */ | ||
| 62 | li a0, -1 | ||
| 63 | csrw CSR_PMPADDR0, a0 | ||
| 64 | li a0, (PMP_A_NAPOT | PMP_R | PMP_W | PMP_X) | ||
| 65 | csrw CSR_PMPCFG0, a0 | ||
| 66 | |||
| 61 | /* | 67 | /* |
| 62 | * The hartid in a0 is expected later on, and we have no firmware | 68 | * The hartid in a0 is expected later on, and we have no firmware |
| 63 | * to hand it to us. | 69 | * to hand it to us. |
| @@ -156,6 +156,6 @@ void __init trap_init(void) · 155 unmodified lines | |||
| 156 | csr_write(CSR_SCRATCH, 0); | 156 | csr_write(CSR_SCRATCH, 0); |
| 157 | /* Set the exception vector address */ | 157 | /* Set the exception vector address */ |
| 158 | csr_write(CSR_TVEC, &handle_exception); | 158 | csr_write(CSR_TVEC, &handle_exception); |
| 159 | /* Enable all interrupts */ | 159 | /* Enable interrupts */ |
| 160 | csr_write(CSR_IE, -1); | 160 | csr_write(CSR_IE, IE_SIE | IE_EIE); |
| 161 | } | 161 | } |
| @@ -19,18 +19,20 @@ asmlinkage void __init kasan_early_init(void) · 18 unmodified lines | |||
| 19 | for (i = 0; i < PTRS_PER_PTE; ++i) | 19 | for (i = 0; i < PTRS_PER_PTE; ++i) |
| 20 | set_pte(kasan_early_shadow_pte + i, | 20 | set_pte(kasan_early_shadow_pte + i, |
| 21 | mk_pte(virt_to_page(kasan_early_shadow_page), | 21 | mk_pte(virt_to_page(kasan_early_shadow_page), |
| 22 | PAGE_KERNEL)); | 22 | PAGE_KERNEL)); |
| 23 | 23 | ||
| 24 | for (i = 0; i < PTRS_PER_PMD; ++i) | 24 | for (i = 0; i < PTRS_PER_PMD; ++i) |
| 25 | set_pmd(kasan_early_shadow_pmd + i, | 25 | set_pmd(kasan_early_shadow_pmd + i, |
| 26 | pfn_pmd(PFN_DOWN(__pa((uintptr_t)kasan_early_shadow_pte)), | 26 | pfn_pmd(PFN_DOWN |
| 27 | __pgprot(_PAGE_TABLE))); | 27 | (__pa((uintptr_t) kasan_early_shadow_pte)), |
| 28 | __pgprot(_PAGE_TABLE))); | ||
| 28 | 29 | ||
| 29 | for (i = KASAN_SHADOW_START; i < KASAN_SHADOW_END; | 30 | for (i = KASAN_SHADOW_START; i < KASAN_SHADOW_END; |
| 30 | i += PGDIR_SIZE, ++pgd) | 31 | i += PGDIR_SIZE, ++pgd) |
| 31 | set_pgd(pgd, | 32 | set_pgd(pgd, |
| 32 | pfn_pgd(PFN_DOWN(__pa(((uintptr_t)kasan_early_shadow_pmd))), | 33 | pfn_pgd(PFN_DOWN |
| 33 | __pgprot(_PAGE_TABLE))); | 34 | (__pa(((uintptr_t) kasan_early_shadow_pmd))), |
| 35 | __pgprot(_PAGE_TABLE))); | ||
| 34 | 36 | ||
| 35 | /* init for swapper_pg_dir */ | 37 | /* init for swapper_pg_dir */ |
| 36 | pgd = pgd_offset_k(KASAN_SHADOW_START); | 38 | pgd = pgd_offset_k(KASAN_SHADOW_START); |
| @@ -38,37 +40,43 @@ asmlinkage void __init kasan_early_init(void) · 1 unmodified line | |||
| 38 | for (i = KASAN_SHADOW_START; i < KASAN_SHADOW_END; | 40 | for (i = KASAN_SHADOW_START; i < KASAN_SHADOW_END; |
| 39 | i += PGDIR_SIZE, ++pgd) | 41 | i += PGDIR_SIZE, ++pgd) |
| 40 | set_pgd(pgd, | 42 | set_pgd(pgd, |
| 41 | pfn_pgd(PFN_DOWN(__pa(((uintptr_t)kasan_early_shadow_pmd))), | 43 | pfn_pgd(PFN_DOWN |
| 42 | __pgprot(_PAGE_TABLE))); | 44 | (__pa(((uintptr_t) kasan_early_shadow_pmd))), |
| 45 | __pgprot(_PAGE_TABLE))); | ||
| 43 | 46 | ||
| 44 | flush_tlb_all(); | 47 | flush_tlb_all(); |
| 45 | } | 48 | } |
| 46 | 49 | ||
| 47 | static void __init populate(void *start, void *end) | 50 | static void __init populate(void *start, void *end) |
| 48 | { | 51 | { |
| 49 | unsigned long i; | 52 | unsigned long i, offset; |
| 50 | unsigned long vaddr = (unsigned long)start & PAGE_MASK; | 53 | unsigned long vaddr = (unsigned long)start & PAGE_MASK; |
| 51 | unsigned long vend = PAGE_ALIGN((unsigned long)end); | 54 | unsigned long vend = PAGE_ALIGN((unsigned long)end); |
| 52 | unsigned long n_pages = (vend - vaddr) / PAGE_SIZE; | 55 | unsigned long n_pages = (vend - vaddr) / PAGE_SIZE; |
| 56 | unsigned long n_ptes = | ||
| 57 | ((n_pages + PTRS_PER_PTE) & -PTRS_PER_PTE) / PTRS_PER_PTE; | ||
| 53 | unsigned long n_pmds = | 58 | unsigned long n_pmds = |
| 54 | (n_pages % PTRS_PER_PTE) ? n_pages / PTRS_PER_PTE + 1 : | 59 | ((n_ptes + PTRS_PER_PMD) & -PTRS_PER_PMD) / PTRS_PER_PMD; |
| 55 | n_pages / PTRS_PER_PTE; | 60 | |
| 61 | pte_t *pte = | ||
| 62 | memblock_alloc(n_ptes * PTRS_PER_PTE * sizeof(pte_t), PAGE_SIZE); | ||
| 63 | pmd_t *pmd = | ||
| 64 | memblock_alloc(n_pmds * PTRS_PER_PMD * sizeof(pmd_t), PAGE_SIZE); | ||
| 56 | pgd_t *pgd = pgd_offset_k(vaddr); | 65 | pgd_t *pgd = pgd_offset_k(vaddr); |
| 57 | pmd_t *pmd = memblock_alloc(n_pmds * sizeof(pmd_t), PAGE_SIZE); | ||
| 58 | pte_t *pte = memblock_alloc(n_pages * sizeof(pte_t), PAGE_SIZE); | ||
| 59 | 66 | ||
| 60 | for (i = 0; i < n_pages; i++) { | 67 | for (i = 0; i < n_pages; i++) { |
| 61 | phys_addr_t phys = memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE); | 68 | phys_addr_t phys = memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE); |
| 62 | 69 | set_pte(&pte[i], pfn_pte(PHYS_PFN(phys), PAGE_KERNEL)); | |
| 63 | set_pte(pte + i, pfn_pte(PHYS_PFN(phys), PAGE_KERNEL)); | ||
| 64 | } | 70 | } |
| 65 | 71 | ||
| 66 | for (i = 0; i < n_pmds; ++pgd, i += PTRS_PER_PMD) | 72 | for (i = 0, offset = 0; i < n_ptes; i++, offset += PTRS_PER_PTE) |
| 67 | set_pgd(pgd, pfn_pgd(PFN_DOWN(__pa(((uintptr_t)(pmd + i)))), | 73 | set_pmd(&pmd[i], |
| 74 | pfn_pmd(PFN_DOWN(__pa(&pte[offset])), | ||
| 68 | __pgprot(_PAGE_TABLE))); | 75 | __pgprot(_PAGE_TABLE))); |
| 69 | 76 | ||
| 70 | for (i = 0; i < n_pages; ++pmd, i += PTRS_PER_PTE) | 77 | for (i = 0, offset = 0; i < n_pmds; i++, offset += PTRS_PER_PMD) |
| 71 | set_pmd(pmd, pfn_pmd(PFN_DOWN(__pa((uintptr_t)(pte + i))), | 78 | set_pgd(&pgd[i], |
| 79 | pfn_pgd(PFN_DOWN(__pa(&pmd[offset])), | ||
| 72 | __pgprot(_PAGE_TABLE))); | 80 | __pgprot(_PAGE_TABLE))); |
| 73 | 81 | ||
| 74 | flush_tlb_all(); | 82 | flush_tlb_all(); |
| @@ -81,7 +89,8 @@ void __init kasan_init(void) · 6 unmodified lines | |||
| 81 | unsigned long i; | 89 | unsigned long i; |
| 82 | 90 | ||
| 83 | kasan_populate_early_shadow((void *)KASAN_SHADOW_START, | 91 | kasan_populate_early_shadow((void *)KASAN_SHADOW_START, |
| 84 | (void *)kasan_mem_to_shadow((void *)VMALLOC_END)); | 92 | (void *)kasan_mem_to_shadow((void *) |
| 93 | VMALLOC_END)); | ||
| 85 | 94 | ||
| 86 | for_each_memblock(memory, reg) { | 95 | for_each_memblock(memory, reg) { |
| 87 | void *start = (void *)__va(reg->base); | 96 | void *start = (void *)__va(reg->base); |
| @@ -90,14 +99,14 @@ void __init kasan_init(void) · 2 unmodified lines | |||
| 90 | if (start >= end) | 99 | if (start >= end) |
| 91 | break; | 100 | break; |
| 92 | 101 | ||
| 93 | populate(kasan_mem_to_shadow(start), | 102 | populate(kasan_mem_to_shadow(start), kasan_mem_to_shadow(end)); |
| 94 | kasan_mem_to_shadow(end)); | ||
| 95 | }; | 103 | }; |
| 96 | 104 | ||
| 97 | for (i = 0; i < PTRS_PER_PTE; i++) | 105 | for (i = 0; i < PTRS_PER_PTE; i++) |
| 98 | set_pte(&kasan_early_shadow_pte[i], | 106 | set_pte(&kasan_early_shadow_pte[i], |
| 99 | mk_pte(virt_to_page(kasan_early_shadow_page), | 107 | mk_pte(virt_to_page(kasan_early_shadow_page), |
| 100 | __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_ACCESSED))); | 108 | __pgprot(_PAGE_PRESENT | _PAGE_READ | |
| 109 | _PAGE_ACCESSED))); | ||
| 101 | 110 | ||
| 102 | memset(kasan_early_shadow_page, 0, PAGE_SIZE); | 111 | memset(kasan_early_shadow_page, 0, PAGE_SIZE); |
| 103 | init_task.kasan_depth = 0; | 112 | init_task.kasan_depth = 0; |
| @@ -146,7 +146,7 @@ all: bzImage · 145 unmodified lines | |||
| 146 | #KBUILD_IMAGE is necessary for packaging targets like rpm-pkg, deb-pkg... | 146 | #KBUILD_IMAGE is necessary for packaging targets like rpm-pkg, deb-pkg... |
| 147 | KBUILD_IMAGE := $(boot)/bzImage | 147 | KBUILD_IMAGE := $(boot)/bzImage |
| 148 | 148 | ||
| 149 | install: vmlinux | 149 | install: |
| 150 | $(Q)$(MAKE) $(build)=$(boot) $@ | 150 | $(Q)$(MAKE) $(build)=$(boot) $@ |
| 151 | 151 | ||
| 152 | bzImage: vmlinux | 152 | bzImage: vmlinux |
| @@ -70,7 +70,7 @@ $(obj)/compressed/vmlinux: $(obj)/startup.a FORCE · 69 unmodified lines | |||
| 70 | $(obj)/startup.a: $(OBJECTS) FORCE | 70 | $(obj)/startup.a: $(OBJECTS) FORCE |
| 71 | $(call if_changed,ar) | 71 | $(call if_changed,ar) |
| 72 | 72 | ||
| 73 | install: $(CONFIGURE) $(obj)/bzImage | 73 | install: |
| 74 | sh -x $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/bzImage \ | 74 | sh -x $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/bzImage \ |
| 75 | System.map "$(INSTALL_PATH)" | 75 | System.map "$(INSTALL_PATH)" |
| 76 | 76 | ||
| @@ -75,7 +75,7 @@ static unsigned long get_random(unsigned long limit) · 74 unmodified lines | |||
| 75 | *(unsigned long *) prng.parm_block ^= seed; | 75 | *(unsigned long *) prng.parm_block ^= seed; |
| 76 | for (i = 0; i < 16; i++) { | 76 | for (i = 0; i < 16; i++) { |
| 77 | cpacf_kmc(CPACF_KMC_PRNG, prng.parm_block, | 77 | cpacf_kmc(CPACF_KMC_PRNG, prng.parm_block, |
| 78 | (char *) entropy, (char *) entropy, | 78 | (u8 *) entropy, (u8 *) entropy, |
| 79 | sizeof(entropy)); | 79 | sizeof(entropy)); |
| 80 | memcpy(prng.parm_block, entropy, sizeof(entropy)); | 80 | memcpy(prng.parm_block, entropy, sizeof(entropy)); |
| 81 | } | 81 | } |
| @@ -15,7 +15,8 @@ void uv_query_info(void) · 14 unmodified lines | |||
| 15 | if (!test_facility(158)) | 15 | if (!test_facility(158)) |
| 16 | return; | 16 | return; |
| 17 | 17 | ||
| 18 | if (uv_call(0, (uint64_t)&uvcb)) | 18 | /* rc==0x100 means that there is additional data we do not process */ |
| 19 | if (uv_call(0, (uint64_t)&uvcb) && uvcb.header.rc != 0x100) | ||
| 19 | return; | 20 | return; |
| 20 | 21 | ||
| 21 | if (test_bit_inv(BIT_UVC_CMD_SET_SHARED_ACCESS, (unsigned long *)uvcb.inst_calls_list) && | 22 | if (test_bit_inv(BIT_UVC_CMD_SET_SHARED_ACCESS, (unsigned long *)uvcb.inst_calls_list) && |
| @@ -53,6 +53,7 @@ CONFIG_VFIO_AP=m · 52 unmodified lines | |||
| 53 | CONFIG_CRASH_DUMP=y | 53 | CONFIG_CRASH_DUMP=y |
| 54 | CONFIG_HIBERNATION=y | 54 | CONFIG_HIBERNATION=y |
| 55 | CONFIG_PM_DEBUG=y | 55 | CONFIG_PM_DEBUG=y |
| 56 | CONFIG_PROTECTED_VIRTUALIZATION_GUEST=y | ||
| 56 | CONFIG_CMM=m | 57 | CONFIG_CMM=m |
| 57 | CONFIG_APPLDATA_BASE=y | 58 | CONFIG_APPLDATA_BASE=y |
| 58 | CONFIG_KVM=m | 59 | CONFIG_KVM=m |
| @@ -474,7 +475,6 @@ CONFIG_NLMON=m · 415 unmodified lines | |||
| 474 | # CONFIG_NET_VENDOR_EMULEX is not set | 475 | # CONFIG_NET_VENDOR_EMULEX is not set |
| 475 | # CONFIG_NET_VENDOR_EZCHIP is not set | 476 | # CONFIG_NET_VENDOR_EZCHIP is not set |
| 476 | # CONFIG_NET_VENDOR_GOOGLE is not set | 477 | # CONFIG_NET_VENDOR_GOOGLE is not set |
| 477 | # CONFIG_NET_VENDOR_HP is not set | ||
| 478 | # CONFIG_NET_VENDOR_HUAWEI is not set | 478 | # CONFIG_NET_VENDOR_HUAWEI is not set |
| 479 | # CONFIG_NET_VENDOR_INTEL is not set | 479 | # CONFIG_NET_VENDOR_INTEL is not set |
| 480 | # CONFIG_NET_VENDOR_MARVELL is not set | 480 | # CONFIG_NET_VENDOR_MARVELL is not set |
| @@ -684,7 +684,6 @@ CONFIG_CRYPTO_ADIANTUM=m · 203 unmodified lines | |||
| 684 | CONFIG_CRYPTO_XCBC=m | 684 | CONFIG_CRYPTO_XCBC=m |
| 685 | CONFIG_CRYPTO_VMAC=m | 685 | CONFIG_CRYPTO_VMAC=m |
| 686 | CONFIG_CRYPTO_CRC32=m | 686 | CONFIG_CRYPTO_CRC32=m |
| 687 | CONFIG_CRYPTO_XXHASH=m | ||
| 688 | CONFIG_CRYPTO_MICHAEL_MIC=m | 687 | CONFIG_CRYPTO_MICHAEL_MIC=m |
| 689 | CONFIG_CRYPTO_RMD128=m | 688 | CONFIG_CRYPTO_RMD128=m |
| 690 | CONFIG_CRYPTO_RMD160=m | 689 | CONFIG_CRYPTO_RMD160=m |
| @@ -748,7 +747,6 @@ CONFIG_DEBUG_INFO_DWARF4=y · 57 unmodified lines | |||
| 748 | CONFIG_GDB_SCRIPTS=y | 747 | CONFIG_GDB_SCRIPTS=y |
| 749 | CONFIG_FRAME_WARN=1024 | 748 | CONFIG_FRAME_WARN=1024 |
| 750 | CONFIG_HEADERS_INSTALL=y | 749 | CONFIG_HEADERS_INSTALL=y |
| 751 | CONFIG_HEADERS_CHECK=y | ||
| 752 | CONFIG_DEBUG_SECTION_MISMATCH=y | 750 | CONFIG_DEBUG_SECTION_MISMATCH=y |
| 753 | CONFIG_MAGIC_SYSRQ=y | 751 | CONFIG_MAGIC_SYSRQ=y |
| 754 | CONFIG_DEBUG_PAGEALLOC=y | 752 | CONFIG_DEBUG_PAGEALLOC=y |
| @@ -772,9 +770,9 @@ CONFIG_DEBUG_MEMORY_INIT=y · 17 unmodified lines | |||
| 772 | CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m | 770 | CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m |
| 773 | CONFIG_DEBUG_PER_CPU_MAPS=y | 771 | CONFIG_DEBUG_PER_CPU_MAPS=y |
| 774 | CONFIG_DEBUG_SHIRQ=y | 772 | CONFIG_DEBUG_SHIRQ=y |
| 773 | CONFIG_PANIC_ON_OOPS=y | ||
| 775 | CONFIG_DETECT_HUNG_TASK=y | 774 | CONFIG_DETECT_HUNG_TASK=y |
| 776 | CONFIG_WQ_WATCHDOG=y | 775 | CONFIG_WQ_WATCHDOG=y |
| 777 | CONFIG_PANIC_ON_OOPS=y | ||
| 778 | CONFIG_DEBUG_TIMEKEEPING=y | 776 | CONFIG_DEBUG_TIMEKEEPING=y |
| 779 | CONFIG_PROVE_LOCKING=y | 777 | CONFIG_PROVE_LOCKING=y |
| 780 | CONFIG_LOCK_STAT=y | 778 | CONFIG_LOCK_STAT=y |
| @@ -783,9 +781,20 @@ CONFIG_DEBUG_ATOMIC_SLEEP=y · 2 unmodified lines | |||
| 783 | CONFIG_DEBUG_LOCKING_API_SELFTESTS=y | 781 | CONFIG_DEBUG_LOCKING_API_SELFTESTS=y |
| 784 | CONFIG_DEBUG_SG=y | 782 | CONFIG_DEBUG_SG=y |
| 785 | CONFIG_DEBUG_NOTIFIERS=y | 783 | CONFIG_DEBUG_NOTIFIERS=y |
| 784 | CONFIG_BUG_ON_DATA_CORRUPTION=y | ||
| 786 | CONFIG_DEBUG_CREDENTIALS=y | 785 | CONFIG_DEBUG_CREDENTIALS=y |
| 787 | CONFIG_RCU_TORTURE_TEST=m | 786 | CONFIG_RCU_TORTURE_TEST=m |
| 788 | CONFIG_RCU_CPU_STALL_TIMEOUT=300 | 787 | CONFIG_RCU_CPU_STALL_TIMEOUT=300 |
| 788 | CONFIG_LATENCYTOP=y | ||
| 789 | CONFIG_FUNCTION_PROFILER=y | ||
| 790 | CONFIG_STACK_TRACER=y | ||
| 791 | CONFIG_IRQSOFF_TRACER=y | ||
| 792 | CONFIG_PREEMPT_TRACER=y | ||
| 793 | CONFIG_SCHED_TRACER=y | ||
| 794 | CONFIG_FTRACE_SYSCALLS=y | ||
| 795 | CONFIG_BLK_DEV_IO_TRACE=y | ||
| 796 | CONFIG_HIST_TRIGGERS=y | ||
| 797 | CONFIG_S390_PTDUMP=y | ||
| 789 | CONFIG_NOTIFIER_ERROR_INJECTION=m | 798 | CONFIG_NOTIFIER_ERROR_INJECTION=m |
| 790 | CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m | 799 | CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m |
| 791 | CONFIG_FAULT_INJECTION=y | 800 | CONFIG_FAULT_INJECTION=y |
| @@ -796,15 +805,6 @@ CONFIG_FAIL_IO_TIMEOUT=y · 4 unmodified lines | |||
| 796 | CONFIG_FAIL_FUTEX=y | 805 | CONFIG_FAIL_FUTEX=y |
| 797 | CONFIG_FAULT_INJECTION_DEBUG_FS=y | 806 | CONFIG_FAULT_INJECTION_DEBUG_FS=y |
| 798 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y | 807 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y |
| 799 | CONFIG_LATENCYTOP=y | ||
| 800 | CONFIG_IRQSOFF_TRACER=y | ||
| 801 | CONFIG_PREEMPT_TRACER=y | ||
| 802 | CONFIG_SCHED_TRACER=y | ||
| 803 | CONFIG_FTRACE_SYSCALLS=y | ||
| 804 | CONFIG_STACK_TRACER=y | ||
| 805 | CONFIG_BLK_DEV_IO_TRACE=y | ||
| 806 | CONFIG_FUNCTION_PROFILER=y | ||
| 807 | CONFIG_HIST_TRIGGERS=y | ||
| 808 | CONFIG_LKDTM=m | 808 | CONFIG_LKDTM=m |
| 809 | CONFIG_TEST_LIST_SORT=y | 809 | CONFIG_TEST_LIST_SORT=y |
| 810 | CONFIG_TEST_SORT=y | 810 | CONFIG_TEST_SORT=y |
| @@ -814,5 +814,3 @@ CONFIG_INTERVAL_TREE_TEST=m · 3 unmodified lines | |||
| 814 | CONFIG_PERCPU_TEST=m | 814 | CONFIG_PERCPU_TEST=m |
| 815 | CONFIG_ATOMIC64_SELFTEST=y | 815 | CONFIG_ATOMIC64_SELFTEST=y |
| 816 | CONFIG_TEST_BPF=m | 816 | CONFIG_TEST_BPF=m |
| 817 | CONFIG_BUG_ON_DATA_CORRUPTION=y | ||
| 818 | CONFIG_S390_PTDUMP=y | ||
| @@ -53,6 +53,7 @@ CONFIG_VFIO_AP=m · 52 unmodified lines | |||
| 53 | CONFIG_CRASH_DUMP=y | 53 | CONFIG_CRASH_DUMP=y |
| 54 | CONFIG_HIBERNATION=y | 54 | CONFIG_HIBERNATION=y |
| 55 | CONFIG_PM_DEBUG=y | 55 | CONFIG_PM_DEBUG=y |
| 56 | CONFIG_PROTECTED_VIRTUALIZATION_GUEST=y | ||
| 56 | CONFIG_CMM=m | 57 | CONFIG_CMM=m |
| 57 | CONFIG_APPLDATA_BASE=y | 58 | CONFIG_APPLDATA_BASE=y |
| 58 | CONFIG_KVM=m | 59 | CONFIG_KVM=m |
| @@ -470,7 +471,6 @@ CONFIG_NLMON=m · 411 unmodified lines | |||
| 470 | # CONFIG_NET_VENDOR_EMULEX is not set | 471 | # CONFIG_NET_VENDOR_EMULEX is not set |
| 471 | # CONFIG_NET_VENDOR_EZCHIP is not set | 472 | # CONFIG_NET_VENDOR_EZCHIP is not set |
| 472 | # CONFIG_NET_VENDOR_GOOGLE is not set | 473 | # CONFIG_NET_VENDOR_GOOGLE is not set |
| 473 | # CONFIG_NET_VENDOR_HP is not set | ||
| 474 | # CONFIG_NET_VENDOR_HUAWEI is not set | 474 | # CONFIG_NET_VENDOR_HUAWEI is not set |
| 475 | # CONFIG_NET_VENDOR_INTEL is not set | 475 | # CONFIG_NET_VENDOR_INTEL is not set |
| 476 | # CONFIG_NET_VENDOR_MARVELL is not set | 476 | # CONFIG_NET_VENDOR_MARVELL is not set |
| @@ -677,7 +677,6 @@ CONFIG_CRYPTO_ADIANTUM=m · 200 unmodified lines | |||
| 677 | CONFIG_CRYPTO_XCBC=m | 677 | CONFIG_CRYPTO_XCBC=m |
| 678 | CONFIG_CRYPTO_VMAC=m | 678 | CONFIG_CRYPTO_VMAC=m |
| 679 | CONFIG_CRYPTO_CRC32=m | 679 | CONFIG_CRYPTO_CRC32=m |
| 680 | CONFIG_CRYPTO_XXHASH=m | ||
| 681 | CONFIG_CRYPTO_MICHAEL_MIC=m | 680 | CONFIG_CRYPTO_MICHAEL_MIC=m |
| 682 | CONFIG_CRYPTO_RMD128=m | 681 | CONFIG_CRYPTO_RMD128=m |
| 683 | CONFIG_CRYPTO_RMD160=m | 682 | CONFIG_CRYPTO_RMD160=m |
| @@ -739,18 +738,18 @@ CONFIG_DEBUG_SECTION_MISMATCH=y · 55 unmodified lines | |||
| 739 | CONFIG_MAGIC_SYSRQ=y | 738 | CONFIG_MAGIC_SYSRQ=y |
| 740 | CONFIG_DEBUG_MEMORY_INIT=y | 739 | CONFIG_DEBUG_MEMORY_INIT=y |
| 741 | CONFIG_PANIC_ON_OOPS=y | 740 | CONFIG_PANIC_ON_OOPS=y |
| 741 | CONFIG_BUG_ON_DATA_CORRUPTION=y | ||
| 742 | CONFIG_RCU_TORTURE_TEST=m | 742 | CONFIG_RCU_TORTURE_TEST=m |
| 743 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 | 743 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 744 | CONFIG_LATENCYTOP=y | 744 | CONFIG_LATENCYTOP=y |
| 745 | CONFIG_FUNCTION_PROFILER=y | ||
| 746 | CONFIG_STACK_TRACER=y | ||
| 745 | CONFIG_SCHED_TRACER=y | 747 | CONFIG_SCHED_TRACER=y |
| 746 | CONFIG_FTRACE_SYSCALLS=y | 748 | CONFIG_FTRACE_SYSCALLS=y |
| 747 | CONFIG_STACK_TRACER=y | ||
| 748 | CONFIG_BLK_DEV_IO_TRACE=y | 749 | CONFIG_BLK_DEV_IO_TRACE=y |
| 749 | CONFIG_FUNCTION_PROFILER=y | ||
| 750 | CONFIG_HIST_TRIGGERS=y | 750 | CONFIG_HIST_TRIGGERS=y |
| 751 | CONFIG_S390_PTDUMP=y | ||
| 751 | CONFIG_LKDTM=m | 752 | CONFIG_LKDTM=m |
| 752 | CONFIG_PERCPU_TEST=m | 753 | CONFIG_PERCPU_TEST=m |
| 753 | CONFIG_ATOMIC64_SELFTEST=y | 754 | CONFIG_ATOMIC64_SELFTEST=y |
| 754 | CONFIG_TEST_BPF=m | 755 | CONFIG_TEST_BPF=m |
| 755 | CONFIG_BUG_ON_DATA_CORRUPTION=y | ||
| 756 | CONFIG_S390_PTDUMP=y | ||
| @@ -42,7 +42,7 @@ void __storage_key_init_range(unsigned long start, unsigned long end); · 41 unmodified lines | |||
| 42 | 42 | ||
| 43 | static inline void storage_key_init_range(unsigned long start, unsigned long end) | 43 | static inline void storage_key_init_range(unsigned long start, unsigned long end) |
| 44 | { | 44 | { |
| 45 | if (PAGE_DEFAULT_KEY) | 45 | if (PAGE_DEFAULT_KEY != 0) |
| 46 | __storage_key_init_range(start, end); | 46 | __storage_key_init_range(start, end); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| @@ -84,7 +84,6 @@ void s390_update_cpu_mhz(void); · 83 unmodified lines | |||
| 84 | void cpu_detect_mhz_feature(void); | 84 | void cpu_detect_mhz_feature(void); |
| 85 | 85 | ||
| 86 | extern const struct seq_operations cpuinfo_op; | 86 | extern const struct seq_operations cpuinfo_op; |
| 87 | extern int sysctl_ieee_emulation_warnings; | ||
| 88 | extern void execve_tail(void); | 87 | extern void execve_tail(void); |
| 89 | extern void __bpon(void); | 88 | extern void __bpon(void); |
| 90 | 89 | ||
| @@ -201,7 +201,7 @@ struct slib { · 200 unmodified lines | |||
| 201 | * @scount: SBAL count | 201 | * @scount: SBAL count |
| 202 | * @sflags: whole SBAL flags | 202 | * @sflags: whole SBAL flags |
| 203 | * @length: length | 203 | * @length: length |
| 204 | * @addr: address | 204 | * @addr: absolute data address |
| 205 | */ | 205 | */ |
| 206 | struct qdio_buffer_element { | 206 | struct qdio_buffer_element { |
| 207 | u8 eflags; | 207 | u8 eflags; |
| @@ -211,7 +211,7 @@ struct qdio_buffer_element { · 3 unmodified lines | |||
| 211 | u8 scount; | 211 | u8 scount; |
| 212 | u8 sflags; | 212 | u8 sflags; |
| 213 | u32 length; | 213 | u32 length; |
| 214 | void *addr; | 214 | u64 addr; |
| 215 | } __attribute__ ((packed, aligned(16))); | 215 | } __attribute__ ((packed, aligned(16))); |
| 216 | 216 | ||
| 217 | /** | 217 | /** |
| @@ -227,7 +227,7 @@ struct qdio_buffer { · 9 unmodified lines | |||
| 227 | * @sbal: absolute SBAL address | 227 | * @sbal: absolute SBAL address |
| 228 | */ | 228 | */ |
| 229 | struct sl_element { | 229 | struct sl_element { |
| 230 | unsigned long sbal; | 230 | u64 sbal; |
| 231 | } __attribute__ ((packed)); | 231 | } __attribute__ ((packed)); |
| 232 | 232 | ||
| 233 | /** | 233 | /** |
| @@ -155,7 +155,7 @@ static inline void get_tod_clock_ext(char *clk) · 154 unmodified lines | |||
| 155 | 155 | ||
| 156 | static inline unsigned long long get_tod_clock(void) | 156 | static inline unsigned long long get_tod_clock(void) |
| 157 | { | 157 | { |
| 158 | unsigned char clk[STORE_CLOCK_EXT_SIZE]; | 158 | char clk[STORE_CLOCK_EXT_SIZE]; |
| 159 | 159 | ||
| 160 | get_tod_clock_ext(clk); | 160 | get_tod_clock_ext(clk); |
| 161 | return *((unsigned long long *)&clk[1]); | 161 | return *((unsigned long long *)&clk[1]); |
| @@ -29,9 +29,6 @@ · 28 unmodified lines | |||
| 29 | #define __PAGE_OFFSET __PAGE_OFFSET_BASE | 29 | #define __PAGE_OFFSET __PAGE_OFFSET_BASE |
| 30 | #include "../../mm/ident_map.c" | 30 | #include "../../mm/ident_map.c" |
| 31 | 31 | ||
| 32 | /* Used by pgtable.h asm code to force instruction serialization. */ | ||
| 33 | unsigned long __force_order; | ||
| 34 | |||
| 35 | /* Used to track our page table allocation area. */ | 32 | /* Used to track our page table allocation area. */ |
| 36 | struct alloc_pgt_data { | 33 | struct alloc_pgt_data { |
| 37 | unsigned char *pgt_buf; | 34 | unsigned char *pgt_buf; |
| @@ -250,6 +250,7 @@ static const u64 amd_f17h_perfmon_event_map[PERF_COUNT_HW_MAX] = · 249 unmodified lines | |||
| 250 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, | 250 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
| 251 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | 251 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
| 252 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0xff60, | 252 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0xff60, |
| 253 | [PERF_COUNT_HW_CACHE_MISSES] = 0x0964, | ||
| 253 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, | 254 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, |
| 254 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, | 255 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, |
| 255 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x0287, | 256 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x0287, |
| @@ -4765,6 +4765,7 @@ __init int intel_pmu_init(void) · 4764 unmodified lines | |||
| 4765 | break; | 4765 | break; |
| 4766 | 4766 | ||
| 4767 | case INTEL_FAM6_ATOM_TREMONT_D: | 4767 | case INTEL_FAM6_ATOM_TREMONT_D: |
| 4768 | case INTEL_FAM6_ATOM_TREMONT: | ||
| 4768 | x86_pmu.late_ack = true; | 4769 | x86_pmu.late_ack = true; |
| 4769 | memcpy(hw_cache_event_ids, glp_hw_cache_event_ids, | 4770 | memcpy(hw_cache_event_ids, glp_hw_cache_event_ids, |
| 4770 | sizeof(hw_cache_event_ids)); | 4771 | sizeof(hw_cache_event_ids)); |
| @@ -40,17 +40,18 @@ · 39 unmodified lines | |||
| 40 | * Model specific counters: | 40 | * Model specific counters: |
| 41 | * MSR_CORE_C1_RES: CORE C1 Residency Counter | 41 | * MSR_CORE_C1_RES: CORE C1 Residency Counter |
| 42 | * perf code: 0x00 | 42 | * perf code: 0x00 |
| 43 | * Available model: SLM,AMT,GLM,CNL | 43 | * Available model: SLM,AMT,GLM,CNL,TNT |
| 44 | * Scope: Core (each processor core has a MSR) | 44 | * Scope: Core (each processor core has a MSR) |
| 45 | * MSR_CORE_C3_RESIDENCY: CORE C3 Residency Counter | 45 | * MSR_CORE_C3_RESIDENCY: CORE C3 Residency Counter |
| 46 | * perf code: 0x01 | 46 | * perf code: 0x01 |
| 47 | * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,GLM, | 47 | * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,GLM, |
| 48 | * CNL,KBL,CML | 48 | * CNL,KBL,CML,TNT |
| 49 | * Scope: Core | 49 | * Scope: Core |
| 50 | * MSR_CORE_C6_RESIDENCY: CORE C6 Residency Counter | 50 | * MSR_CORE_C6_RESIDENCY: CORE C6 Residency Counter |
| 51 | * perf code: 0x02 | 51 | * perf code: 0x02 |
| 52 | * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW, | 52 | * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW, |
| 53 | * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL | 53 | * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL, |
| 54 | * TNT | ||
| 54 | * Scope: Core | 55 | * Scope: Core |
| 55 | * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter | 56 | * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter |
| 56 | * perf code: 0x03 | 57 | * perf code: 0x03 |
| @@ -60,17 +61,18 @@ · 3 unmodified lines | |||
| 60 | * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter. | 61 | * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter. |
| 61 | * perf code: 0x00 | 62 | * perf code: 0x00 |
| 62 | * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL, | 63 | * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL, |
| 63 | * KBL,CML,ICL,TGL | 64 | * KBL,CML,ICL,TGL,TNT |
| 64 | * Scope: Package (physical package) | 65 | * Scope: Package (physical package) |
| 65 | * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter. | 66 | * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter. |
| 66 | * perf code: 0x01 | 67 | * perf code: 0x01 |
| 67 | * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL, | 68 | * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL, |
| 68 | * GLM,CNL,KBL,CML,ICL,TGL | 69 | * GLM,CNL,KBL,CML,ICL,TGL,TNT |
| 69 | * Scope: Package (physical package) | 70 | * Scope: Package (physical package) |
| 70 | * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter. | 71 | * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter. |
| 71 | * perf code: 0x02 | 72 | * perf code: 0x02 |
| 72 | * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW | 73 | * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW, |
| 73 | * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL | 74 | * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL, |
| 75 | * TNT | ||
| 74 | * Scope: Package (physical package) | 76 | * Scope: Package (physical package) |
| 75 | * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter. | 77 | * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter. |
| 76 | * perf code: 0x03 | 78 | * perf code: 0x03 |
| @@ -87,7 +89,8 @@ · 10 unmodified lines | |||
| 87 | * Scope: Package (physical package) | 89 | * Scope: Package (physical package) |
| 88 | * MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter. | 90 | * MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter. |
| 89 | * perf code: 0x06 | 91 | * perf code: 0x06 |
| 90 | * Available model: HSW ULT,KBL,GLM,CNL,CML,ICL,TGL | 92 | * Available model: HSW ULT,KBL,GLM,CNL,CML,ICL,TGL, |
| 93 | * TNT | ||
| 91 | * Scope: Package (physical package) | 94 | * Scope: Package (physical package) |
| 92 | * | 95 | * |
| 93 | */ | 96 | */ |
| @@ -640,8 +643,9 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = { · 546 unmodified lines | |||
| 640 | 643 | ||
| 641 | X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT, glm_cstates), | 644 | X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT, glm_cstates), |
| 642 | X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_D, glm_cstates), | 645 | X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_D, glm_cstates), |
| 643 | |||
| 644 | X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_PLUS, glm_cstates), | 646 | X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_PLUS, glm_cstates), |
| 647 | X86_CSTATES_MODEL(INTEL_FAM6_ATOM_TREMONT_D, glm_cstates), | ||
| 648 | X86_CSTATES_MODEL(INTEL_FAM6_ATOM_TREMONT, glm_cstates), | ||
| 645 | 649 | ||
| 646 | X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE_L, icl_cstates), | 650 | X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE_L, icl_cstates), |
| 647 | X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE, icl_cstates), | 651 | X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE, icl_cstates), |
| @@ -1714,6 +1714,8 @@ intel_pmu_save_and_restart_reload(struct perf_event *event, int count) · 1713 unmodified lines | |||
| 1714 | old = ((s64)(prev_raw_count << shift) >> shift); | 1714 | old = ((s64)(prev_raw_count << shift) >> shift); |
| 1715 | local64_add(new - old + count * period, &event->count); | 1715 | local64_add(new - old + count * period, &event->count); |
| 1716 | 1716 | ||
| 1717 | local64_set(&hwc->period_left, -new); | ||
| 1718 | |||
| 1717 | perf_event_update_userpage(event); | 1719 | perf_event_update_userpage(event); |
| 1718 | 1720 | ||
| 1719 | return 0; | 1721 | return 0; |
| @@ -75,8 +75,9 @@ static bool test_intel(int idx, void *data) · 74 unmodified lines | |||
| 75 | 75 | ||
| 76 | case INTEL_FAM6_ATOM_GOLDMONT: | 76 | case INTEL_FAM6_ATOM_GOLDMONT: |
| 77 | case INTEL_FAM6_ATOM_GOLDMONT_D: | 77 | case INTEL_FAM6_ATOM_GOLDMONT_D: |
| 78 | |||
| 79 | case INTEL_FAM6_ATOM_GOLDMONT_PLUS: | 78 | case INTEL_FAM6_ATOM_GOLDMONT_PLUS: |
| 79 | case INTEL_FAM6_ATOM_TREMONT_D: | ||
| 80 | case INTEL_FAM6_ATOM_TREMONT: | ||
| 80 | 81 | ||
| 81 | case INTEL_FAM6_XEON_PHI_KNL: | 82 | case INTEL_FAM6_XEON_PHI_KNL: |
| 82 | case INTEL_FAM6_XEON_PHI_KNM: | 83 | case INTEL_FAM6_XEON_PHI_KNM: |
| @@ -19,7 +19,14 @@ struct task_struct; · 18 unmodified lines | |||
| 19 | void io_bitmap_share(struct task_struct *tsk); | 19 | void io_bitmap_share(struct task_struct *tsk); |
| 20 | void io_bitmap_exit(void); | 20 | void io_bitmap_exit(void); |
| 21 | 21 | ||
| 22 | void tss_update_io_bitmap(void); | 22 | void native_tss_update_io_bitmap(void); |
| 23 | |||
| 24 | #ifdef CONFIG_PARAVIRT_XXL | ||
| 25 | #include <asm/paravirt.h> | ||
| 26 | #else | ||
| 27 | #define tss_update_io_bitmap native_tss_update_io_bitmap | ||
| 28 | #endif | ||
| 29 | |||
| 23 | #else | 30 | #else |
| 24 | static inline void io_bitmap_share(struct task_struct *tsk) { } | 31 | static inline void io_bitmap_share(struct task_struct *tsk) { } |
| 25 | static inline void io_bitmap_exit(void) { } | 32 | static inline void io_bitmap_exit(void) { } |
| @@ -292,6 +292,14 @@ enum x86emul_mode { · 291 unmodified lines | |||
| 292 | #define X86EMUL_SMM_MASK (1 << 6) | 292 | #define X86EMUL_SMM_MASK (1 << 6) |
| 293 | #define X86EMUL_SMM_INSIDE_NMI_MASK (1 << 7) | 293 | #define X86EMUL_SMM_INSIDE_NMI_MASK (1 << 7) |
| 294 | 294 | ||
| 295 | /* | ||
| 296 | * fastop functions are declared as taking a never-defined fastop parameter, | ||
| 297 | * so they can't be called from C directly. | ||
| 298 | */ | ||
| 299 | struct fastop; | ||
| 300 | |||
| 301 | typedef void (*fastop_t)(struct fastop *); | ||
| 302 | |||
| 295 | struct x86_emulate_ctxt { | 303 | struct x86_emulate_ctxt { |
| 296 | const struct x86_emulate_ops *ops; | 304 | const struct x86_emulate_ops *ops; |
| 297 | 305 | ||
| @@ -324,7 +332,10 @@ struct x86_emulate_ctxt { · 26 unmodified lines | |||
| 324 | struct operand src; | 332 | struct operand src; |
| 325 | struct operand src2; | 333 | struct operand src2; |
| 326 | struct operand dst; | 334 | struct operand dst; |
| 327 | int (*execute)(struct x86_emulate_ctxt *ctxt); | 335 | union { |
| 336 | int (*execute)(struct x86_emulate_ctxt *ctxt); | ||
| 337 | fastop_t fop; | ||
| 338 | }; | ||
| 328 | int (*check_perm)(struct x86_emulate_ctxt *ctxt); | 339 | int (*check_perm)(struct x86_emulate_ctxt *ctxt); |
| 329 | /* | 340 | /* |
| 330 | * The following six fields are cleared together, | 341 | * The following six fields are cleared together, |
| @@ -781,9 +781,19 @@ struct kvm_vcpu_arch { · 780 unmodified lines | |||
| 781 | u64 msr_kvm_poll_control; | 781 | u64 msr_kvm_poll_control; |
| 782 | 782 | ||
| 783 | /* | 783 | /* |
| 784 | * Indicate whether the access faults on its page table in guest | 784 | * Indicates the guest is trying to write a gfn that contains one or |
| 785 | * which is set when fix page fault and used to detect unhandeable | 785 | * more of the PTEs used to translate the write itself, i.e. the access |
| 786 | * instruction. | 786 | * is changing its own translation in the guest page tables. KVM exits |
| 787 | * to userspace if emulation of the faulting instruction fails and this | ||
| 788 | * flag is set, as KVM cannot make forward progress. | ||
| 789 | * | ||
| 790 | * If emulation fails for a write to guest page tables, KVM unprotects | ||
| 791 | * (zaps) the shadow page for the target gfn and resumes the guest to | ||
| 792 | * retry the non-emulatable instruction (on hardware). Unprotecting the | ||
| 793 | * gfn doesn't allow forward progress for a self-changing access because | ||
| 794 | * doing so also zaps the translation for the gfn, i.e. retrying the | ||
| 795 | * instruction will hit a !PRESENT fault, which results in a new shadow | ||
| 796 | * page and sends KVM back to square one. | ||
| 787 | */ | 797 | */ |
| 788 | bool write_fault_to_shadow_pgtable; | 798 | bool write_fault_to_shadow_pgtable; |
| 789 | 799 | ||
| @@ -1112,6 +1122,7 @@ struct kvm_x86_ops { · 322 unmodified lines | |||
| 1112 | int (*handle_exit)(struct kvm_vcpu *vcpu, | 1122 | int (*handle_exit)(struct kvm_vcpu *vcpu, |
| 1113 | enum exit_fastpath_completion exit_fastpath); | 1123 | enum exit_fastpath_completion exit_fastpath); |
| 1114 | int (*skip_emulated_instruction)(struct kvm_vcpu *vcpu); | 1124 | int (*skip_emulated_instruction)(struct kvm_vcpu *vcpu); |
| 1125 | void (*update_emulated_instruction)(struct kvm_vcpu *vcpu); | ||
| 1115 | void (*set_interrupt_shadow)(struct kvm_vcpu *vcpu, int mask); | 1126 | void (*set_interrupt_shadow)(struct kvm_vcpu *vcpu, int mask); |
| 1116 | u32 (*get_interrupt_shadow)(struct kvm_vcpu *vcpu); | 1127 | u32 (*get_interrupt_shadow)(struct kvm_vcpu *vcpu); |
| 1117 | void (*patch_hypercall)(struct kvm_vcpu *vcpu, | 1128 | void (*patch_hypercall)(struct kvm_vcpu *vcpu, |
| @@ -1136,7 +1147,7 @@ struct kvm_x86_ops { · 18 unmodified lines | |||
| 1136 | void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap); | 1147 | void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap); |
| 1137 | void (*set_virtual_apic_mode)(struct kvm_vcpu *vcpu); | 1148 | void (*set_virtual_apic_mode)(struct kvm_vcpu *vcpu); |
| 1138 | void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu, hpa_t hpa); | 1149 | void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu, hpa_t hpa); |
| 1139 | void (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector); | 1150 | int (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector); |
| 1140 | int (*sync_pir_to_irr)(struct kvm_vcpu *vcpu); | 1151 | int (*sync_pir_to_irr)(struct kvm_vcpu *vcpu); |
| 1141 | int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); | 1152 | int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); |
| 1142 | int (*set_identity_map_addr)(struct kvm *kvm, u64 ident_addr); | 1153 | int (*set_identity_map_addr)(struct kvm *kvm, u64 ident_addr); |
| @@ -512,6 +512,8 @@ · 511 unmodified lines | |||
| 512 | #define MSR_K7_HWCR 0xc0010015 | 512 | #define MSR_K7_HWCR 0xc0010015 |
| 513 | #define MSR_K7_HWCR_SMMLOCK_BIT 0 | 513 | #define MSR_K7_HWCR_SMMLOCK_BIT 0 |
| 514 | #define MSR_K7_HWCR_SMMLOCK BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT) | 514 | #define MSR_K7_HWCR_SMMLOCK BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT) |
| 515 | #define MSR_K7_HWCR_IRPERF_EN_BIT 30 | ||
| 516 | #define MSR_K7_HWCR_IRPERF_EN BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT) | ||
| 515 | #define MSR_K7_FID_VID_CTL 0xc0010041 | 517 | #define MSR_K7_FID_VID_CTL 0xc0010041 |
| 516 | #define MSR_K7_FID_VID_STATUS 0xc0010042 | 518 | #define MSR_K7_FID_VID_STATUS 0xc0010042 |
| 517 | 519 | ||
| @@ -295,6 +295,13 @@ static inline void write_idt_entry(gate_desc *dt, int entry, const gate_desc *g) · 294 unmodified lines | |||
| 295 | PVOP_VCALL3(cpu.write_idt_entry, dt, entry, g); | 295 | PVOP_VCALL3(cpu.write_idt_entry, dt, entry, g); |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | #ifdef CONFIG_X86_IOPL_IOPERM | ||
| 299 | static inline void tss_update_io_bitmap(void) | ||
| 300 | { | ||
| 301 | PVOP_VCALL0(cpu.update_io_bitmap); | ||
| 302 | } | ||
| 303 | #endif | ||
| 304 | |||
| 298 | static inline void paravirt_activate_mm(struct mm_struct *prev, | 305 | static inline void paravirt_activate_mm(struct mm_struct *prev, |
| 299 | struct mm_struct *next) | 306 | struct mm_struct *next) |
| 300 | { | 307 | { |
| @@ -140,6 +140,10 @@ struct pv_cpu_ops { · 139 unmodified lines | |||
| 140 | 140 | ||
| 141 | void (*load_sp0)(unsigned long sp0); | 141 | void (*load_sp0)(unsigned long sp0); |
| 142 | 142 | ||
| 143 | #ifdef CONFIG_X86_IOPL_IOPERM | ||
| 144 | void (*update_io_bitmap)(void); | ||
| 145 | #endif | ||
| 146 | |||
| 143 | void (*wbinvd)(void); | 147 | void (*wbinvd)(void); |
| 144 | 148 | ||
| 145 | /* cpuid emulation, mostly so that caps bits can be disabled */ | 149 | /* cpuid emulation, mostly so that caps bits can be disabled */ |
| @@ -72,7 +72,7 @@ · 71 unmodified lines | |||
| 72 | #define SECONDARY_EXEC_MODE_BASED_EPT_EXEC VMCS_CONTROL_BIT(MODE_BASED_EPT_EXEC) | 72 | #define SECONDARY_EXEC_MODE_BASED_EPT_EXEC VMCS_CONTROL_BIT(MODE_BASED_EPT_EXEC) |
| 73 | #define SECONDARY_EXEC_PT_USE_GPA VMCS_CONTROL_BIT(PT_USE_GPA) | 73 | #define SECONDARY_EXEC_PT_USE_GPA VMCS_CONTROL_BIT(PT_USE_GPA) |
| 74 | #define SECONDARY_EXEC_TSC_SCALING VMCS_CONTROL_BIT(TSC_SCALING) | 74 | #define SECONDARY_EXEC_TSC_SCALING VMCS_CONTROL_BIT(TSC_SCALING) |
| 75 | #define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE 0x04000000 | 75 | #define SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE VMCS_CONTROL_BIT(USR_WAIT_PAUSE) |
| 76 | 76 | ||
| 77 | #define PIN_BASED_EXT_INTR_MASK VMCS_CONTROL_BIT(INTR_EXITING) | 77 | #define PIN_BASED_EXT_INTR_MASK VMCS_CONTROL_BIT(INTR_EXITING) |
| 78 | #define PIN_BASED_NMI_EXITING VMCS_CONTROL_BIT(NMI_EXITING) | 78 | #define PIN_BASED_NMI_EXITING VMCS_CONTROL_BIT(NMI_EXITING) |
| @@ -81,6 +81,7 @@ · 80 unmodified lines | |||
| 81 | #define VMX_FEATURE_MODE_BASED_EPT_EXEC ( 2*32+ 22) /* "ept_mode_based_exec" Enable separate EPT EXEC bits for supervisor vs. user */ | 81 | #define VMX_FEATURE_MODE_BASED_EPT_EXEC ( 2*32+ 22) /* "ept_mode_based_exec" Enable separate EPT EXEC bits for supervisor vs. user */ |
| 82 | #define VMX_FEATURE_PT_USE_GPA ( 2*32+ 24) /* "" Processor Trace logs GPAs */ | 82 | #define VMX_FEATURE_PT_USE_GPA ( 2*32+ 24) /* "" Processor Trace logs GPAs */ |
| 83 | #define VMX_FEATURE_TSC_SCALING ( 2*32+ 25) /* Scale hardware TSC when read in guest */ | 83 | #define VMX_FEATURE_TSC_SCALING ( 2*32+ 25) /* Scale hardware TSC when read in guest */ |
| 84 | #define VMX_FEATURE_USR_WAIT_PAUSE ( 2*32+ 26) /* Enable TPAUSE, UMONITOR, UMWAIT in guest */ | ||
| 84 | #define VMX_FEATURE_ENCLV_EXITING ( 2*32+ 28) /* "" VM-Exit on ENCLV (leaf dependent) */ | 85 | #define VMX_FEATURE_ENCLV_EXITING ( 2*32+ 28) /* "" VM-Exit on ENCLV (leaf dependent) */ |
| 85 | 86 | ||
| 86 | #endif /* _ASM_X86_VMXFEATURES_H */ | 87 | #endif /* _ASM_X86_VMXFEATURES_H */ |
| @@ -390,6 +390,7 @@ struct kvm_sync_regs { · 389 unmodified lines | |||
| 390 | #define KVM_STATE_NESTED_GUEST_MODE 0x00000001 | 390 | #define KVM_STATE_NESTED_GUEST_MODE 0x00000001 |
| 391 | #define KVM_STATE_NESTED_RUN_PENDING 0x00000002 | 391 | #define KVM_STATE_NESTED_RUN_PENDING 0x00000002 |
| 392 | #define KVM_STATE_NESTED_EVMCS 0x00000004 | 392 | #define KVM_STATE_NESTED_EVMCS 0x00000004 |
| 393 | #define KVM_STATE_NESTED_MTF_PENDING 0x00000008 | ||
| 393 | 394 | ||
| 394 | #define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001 | 395 | #define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001 |
| 395 | #define KVM_STATE_NESTED_SMM_VMXON 0x00000002 | 396 | #define KVM_STATE_NESTED_SMM_VMXON 0x00000002 |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | static const int amd_erratum_383[]; | 29 | static const int amd_erratum_383[]; |
| 30 | static const int amd_erratum_400[]; | 30 | static const int amd_erratum_400[]; |
| 31 | static const int amd_erratum_1054[]; | ||
| 31 | static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum); | 32 | static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum); |
| 32 | 33 | ||
| 33 | /* | 34 | /* |
| @@ -972,6 +973,15 @@ static void init_amd(struct cpuinfo_x86 *c) · 938 unmodified lines | |||
| 972 | /* AMD CPUs don't reset SS attributes on SYSRET, Xen does. */ | 973 | /* AMD CPUs don't reset SS attributes on SYSRET, Xen does. */ |
| 973 | if (!cpu_has(c, X86_FEATURE_XENPV)) | 974 | if (!cpu_has(c, X86_FEATURE_XENPV)) |
| 974 | set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS); | 975 | set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS); |
| 976 | |||
| 977 | /* | ||
| 978 | * Turn on the Instructions Retired free counter on machines not | ||
| 979 | * susceptible to erratum #1054 "Instructions Retired Performance | ||
| 980 | * Counter May Be Inaccurate". | ||
| 981 | */ | ||
| 982 | if (cpu_has(c, X86_FEATURE_IRPERF) && | ||
| 983 | !cpu_has_amd_erratum(c, amd_erratum_1054)) | ||
| 984 | msr_set_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT); | ||
| 975 | } | 985 | } |
| 976 | 986 | ||
| 977 | #ifdef CONFIG_X86_32 | 987 | #ifdef CONFIG_X86_32 |
| @@ -1099,6 +1109,10 @@ static const int amd_erratum_400[] = · 121 unmodified lines | |||
| 1099 | static const int amd_erratum_383[] = | 1109 | static const int amd_erratum_383[] = |
| 1100 | AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf)); | 1110 | AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf)); |
| 1101 | 1111 | ||
| 1112 | /* #1054: Instructions Retired Performance Counter May Be Inaccurate */ | ||
| 1113 | static const int amd_erratum_1054[] = | ||
| 1114 | AMD_OSVW_ERRATUM(0, AMD_MODEL_RANGE(0x17, 0, 0, 0x2f, 0xf)); | ||
| 1115 | |||
| 1102 | 1116 | ||
| 1103 | static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum) | 1117 | static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum) |
| 1104 | { | 1118 | { |
| @@ -445,7 +445,7 @@ static __always_inline void setup_pku(struct cpuinfo_x86 *c) · 444 unmodified lines | |||
| 445 | * cpuid bit to be set. We need to ensure that we | 445 | * cpuid bit to be set. We need to ensure that we |
| 446 | * update that bit in this CPU's "cpu_info". | 446 | * update that bit in this CPU's "cpu_info". |
| 447 | */ | 447 | */ |
| 448 | get_cpu_cap(c); | 448 | set_cpu_cap(c, X86_FEATURE_OSPKE); |
| 449 | } | 449 | } |
| 450 | 450 | ||
| 451 | #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS | 451 | #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS |
| @@ -1163,9 +1163,12 @@ static const struct sysfs_ops threshold_ops = { · 1162 unmodified lines | |||
| 1163 | .store = store, | 1163 | .store = store, |
| 1164 | }; | 1164 | }; |
| 1165 | 1165 | ||
| 1166 | static void threshold_block_release(struct kobject *kobj); | ||
| 1167 | |||
| 1166 | static struct kobj_type threshold_ktype = { | 1168 | static struct kobj_type threshold_ktype = { |
| 1167 | .sysfs_ops = &threshold_ops, | 1169 | .sysfs_ops = &threshold_ops, |
| 1168 | .default_attrs = default_attrs, | 1170 | .default_attrs = default_attrs, |
| 1171 | .release = threshold_block_release, | ||
| 1169 | }; | 1172 | }; |
| 1170 | 1173 | ||
| 1171 | static const char *get_name(unsigned int bank, struct threshold_block *b) | 1174 | static const char *get_name(unsigned int bank, struct threshold_block *b) |
| @@ -1198,8 +1201,9 @@ static const char *get_name(unsigned int bank, struct threshold_block *b) · 26 unmodified lines | |||
| 1198 | return buf_mcatype; | 1201 | return buf_mcatype; |
| 1199 | } | 1202 | } |
| 1200 | 1203 | ||
| 1201 | static int allocate_threshold_blocks(unsigned int cpu, unsigned int bank, | 1204 | static int allocate_threshold_blocks(unsigned int cpu, struct threshold_bank *tb, |
| 1202 | unsigned int block, u32 address) | 1205 | unsigned int bank, unsigned int block, |
| 1206 | u32 address) | ||
| 1203 | { | 1207 | { |
| 1204 | struct threshold_block *b = NULL; | 1208 | struct threshold_block *b = NULL; |
| 1205 | u32 low, high; | 1209 | u32 low, high; |
| @@ -1243,16 +1247,12 @@ static int allocate_threshold_blocks(unsigned int cpu, unsigned int bank, · 37 unmodified lines | |||
| 1243 | 1247 | ||
| 1244 | INIT_LIST_HEAD(&b->miscj); | 1248 | INIT_LIST_HEAD(&b->miscj); |
| 1245 | 1249 | ||
| 1246 | if (per_cpu(threshold_banks, cpu)[bank]->blocks) { | 1250 | if (tb->blocks) |
| 1247 | list_add(&b->miscj, | 1251 | list_add(&b->miscj, &tb->blocks->miscj); |
| 1248 | &per_cpu(threshold_banks, cpu)[bank]->blocks->miscj); | 1252 | else |
| 1249 | } else { | 1253 | tb->blocks = b; |
| 1250 | per_cpu(threshold_banks, cpu)[bank]->blocks = b; | ||
| 1251 | } | ||
| 1252 | 1254 | ||
| 1253 | err = kobject_init_and_add(&b->kobj, &threshold_ktype, | 1255 | err = kobject_init_and_add(&b->kobj, &threshold_ktype, tb->kobj, get_name(bank, b)); |
| 1254 | per_cpu(threshold_banks, cpu)[bank]->kobj, | ||
| 1255 | get_name(bank, b)); | ||
| 1256 | if (err) | 1256 | if (err) |
| 1257 | goto out_free; | 1257 | goto out_free; |
| 1258 | recurse: | 1258 | recurse: |
| @@ -1260,7 +1260,7 @@ recurse: · 1 unmodified line | |||
| 1260 | if (!address) | 1260 | if (!address) |
| 1261 | return 0; | 1261 | return 0; |
| 1262 | 1262 | ||
| 1263 | err = allocate_threshold_blocks(cpu, bank, block, address); | 1263 | err = allocate_threshold_blocks(cpu, tb, bank, block, address); |
| 1264 | if (err) | 1264 | if (err) |
| 1265 | goto out_free; | 1265 | goto out_free; |
| 1266 | 1266 | ||
| @@ -1345,8 +1345,6 @@ static int threshold_create_bank(unsigned int cpu, unsigned int bank) · 78 unmodified lines | |||
| 1345 | goto out_free; | 1345 | goto out_free; |
| 1346 | } | 1346 | } |
| 1347 | 1347 | ||
| 1348 | per_cpu(threshold_banks, cpu)[bank] = b; | ||
| 1349 | |||
| 1350 | if (is_shared_bank(bank)) { | 1348 | if (is_shared_bank(bank)) { |
| 1351 | refcount_set(&b->cpus, 1); | 1349 | refcount_set(&b->cpus, 1); |
| 1352 | 1350 | ||
| @@ -1357,9 +1355,13 @@ static int threshold_create_bank(unsigned int cpu, unsigned int bank) · 4 unmodified lines | |||
| 1357 | } | 1355 | } |
| 1358 | } | 1356 | } |
| 1359 | 1357 | ||
| 1360 | err = allocate_threshold_blocks(cpu, bank, 0, msr_ops.misc(bank)); | 1358 | err = allocate_threshold_blocks(cpu, b, bank, 0, msr_ops.misc(bank)); |
| 1361 | if (!err) | 1359 | if (err) |
| 1362 | goto out; | 1360 | goto out_free; |
| 1361 | |||
| 1362 | per_cpu(threshold_banks, cpu)[bank] = b; | ||
| 1363 | |||
| 1364 | return 0; | ||
| 1363 | 1365 | ||
| 1364 | out_free: | 1366 | out_free: |
| 1365 | kfree(b); | 1367 | kfree(b); |
| @@ -1368,8 +1370,12 @@ static int threshold_create_bank(unsigned int cpu, unsigned int bank) · 2 unmodified lines | |||
| 1368 | return err; | 1370 | return err; |
| 1369 | } | 1371 | } |
| 1370 | 1372 | ||
| 1371 | static void deallocate_threshold_block(unsigned int cpu, | 1373 | static void threshold_block_release(struct kobject *kobj) |
| 1372 | unsigned int bank) | 1374 | { |
| 1375 | kfree(to_block(kobj)); | ||
| 1376 | } | ||
| 1377 | |||
| 1378 | static void deallocate_threshold_block(unsigned int cpu, unsigned int bank) | ||
| 1373 | { | 1379 | { |
| 1374 | struct threshold_block *pos = NULL; | 1380 | struct threshold_block *pos = NULL; |
| 1375 | struct threshold_block *tmp = NULL; | 1381 | struct threshold_block *tmp = NULL; |
| @@ -1379,13 +1385,11 @@ static void deallocate_threshold_block(unsigned int cpu, · 3 unmodified lines | |||
| 1379 | return; | 1385 | return; |
| 1380 | 1386 | ||
| 1381 | list_for_each_entry_safe(pos, tmp, &head->blocks->miscj, miscj) { | 1387 | list_for_each_entry_safe(pos, tmp, &head->blocks->miscj, miscj) { |
| 1382 | kobject_put(&pos->kobj); | ||
| 1383 | list_del(&pos->miscj); | 1388 | list_del(&pos->miscj); |
| 1384 | kfree(pos); | 1389 | kobject_put(&pos->kobj); |
| 1385 | } | 1390 | } |
| 1386 | 1391 | ||
| 1387 | kfree(per_cpu(threshold_banks, cpu)[bank]->blocks); | 1392 | kobject_put(&head->blocks->kobj); |
| 1388 | per_cpu(threshold_banks, cpu)[bank]->blocks = NULL; | ||
| 1389 | } | 1393 | } |
| 1390 | 1394 | ||
| 1391 | static void __threshold_remove_blocks(struct threshold_bank *b) | 1395 | static void __threshold_remove_blocks(struct threshold_bank *b) |
| @@ -10,8 +10,6 @@ extern struct boot_params boot_params; · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | static enum efi_secureboot_mode get_sb_mode(void) | 11 | static enum efi_secureboot_mode get_sb_mode(void) |
| 12 | { | 12 | { |
| 13 | efi_char16_t efi_SecureBoot_name[] = L"SecureBoot"; | ||
| 14 | efi_char16_t efi_SetupMode_name[] = L"SecureBoot"; | ||
| 15 | efi_guid_t efi_variable_guid = EFI_GLOBAL_VARIABLE_GUID; | 13 | efi_guid_t efi_variable_guid = EFI_GLOBAL_VARIABLE_GUID; |
| 16 | efi_status_t status; | 14 | efi_status_t status; |
| 17 | unsigned long size; | 15 | unsigned long size; |
| @@ -25,7 +23,7 @@ static enum efi_secureboot_mode get_sb_mode(void) · 7 unmodified lines | |||
| 25 | } | 23 | } |
| 26 | 24 | ||
| 27 | /* Get variable contents into buffer */ | 25 | /* Get variable contents into buffer */ |
| 28 | status = efi.get_variable(efi_SecureBoot_name, &efi_variable_guid, | 26 | status = efi.get_variable(L"SecureBoot", &efi_variable_guid, |
| 29 | NULL, &size, &secboot); | 27 | NULL, &size, &secboot); |
| 30 | if (status == EFI_NOT_FOUND) { | 28 | if (status == EFI_NOT_FOUND) { |
| 31 | pr_info("ima: secureboot mode disabled\n"); | 29 | pr_info("ima: secureboot mode disabled\n"); |
| @@ -38,7 +36,7 @@ static enum efi_secureboot_mode get_sb_mode(void) · 6 unmodified lines | |||
| 38 | } | 36 | } |
| 39 | 37 | ||
| 40 | size = sizeof(setupmode); | 38 | size = sizeof(setupmode); |
| 41 | status = efi.get_variable(efi_SetupMode_name, &efi_variable_guid, | 39 | status = efi.get_variable(L"SetupMode", &efi_variable_guid, |
| 42 | NULL, &size, &setupmode); | 40 | NULL, &size, &setupmode); |
| 43 | 41 | ||
| 44 | if (status != EFI_SUCCESS) /* ignore unknown SetupMode */ | 42 | if (status != EFI_SUCCESS) /* ignore unknown SetupMode */ |
| @@ -425,7 +425,29 @@ static void __init sev_map_percpu_data(void) · 424 unmodified lines | |||
| 425 | } | 425 | } |
| 426 | } | 426 | } |
| 427 | 427 | ||
| 428 | static bool pv_tlb_flush_supported(void) | ||
| 429 | { | ||
| 430 | return (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) && | ||
| 431 | !kvm_para_has_hint(KVM_HINTS_REALTIME) && | ||
| 432 | kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)); | ||
| 433 | } | ||
| 434 | |||
| 435 | static DEFINE_PER_CPU(cpumask_var_t, __pv_cpu_mask); | ||
| 436 | |||
| 428 | #ifdef CONFIG_SMP | 437 | #ifdef CONFIG_SMP |
| 438 | |||
| 439 | static bool pv_ipi_supported(void) | ||
| 440 | { | ||
| 441 | return kvm_para_has_feature(KVM_FEATURE_PV_SEND_IPI); | ||
| 442 | } | ||
| 443 | |||
| 444 | static bool pv_sched_yield_supported(void) | ||
| 445 | { | ||
| 446 | return (kvm_para_has_feature(KVM_FEATURE_PV_SCHED_YIELD) && | ||
| 447 | !kvm_para_has_hint(KVM_HINTS_REALTIME) && | ||
| 448 | kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)); | ||
| 449 | } | ||
| 450 | |||
| 429 | #define KVM_IPI_CLUSTER_SIZE (2 * BITS_PER_LONG) | 451 | #define KVM_IPI_CLUSTER_SIZE (2 * BITS_PER_LONG) |
| 430 | 452 | ||
| 431 | static void __send_ipi_mask(const struct cpumask *mask, int vector) | 453 | static void __send_ipi_mask(const struct cpumask *mask, int vector) |
| @@ -490,12 +512,12 @@ static void kvm_send_ipi_mask(const struct cpumask *mask, int vector) · 58 unmodified lines | |||
| 490 | static void kvm_send_ipi_mask_allbutself(const struct cpumask *mask, int vector) | 512 | static void kvm_send_ipi_mask_allbutself(const struct cpumask *mask, int vector) |
| 491 | { | 513 | { |
| 492 | unsigned int this_cpu = smp_processor_id(); | 514 | unsigned int this_cpu = smp_processor_id(); |
| 493 | struct cpumask new_mask; | 515 | struct cpumask *new_mask = this_cpu_cpumask_var_ptr(__pv_cpu_mask); |
| 494 | const struct cpumask *local_mask; | 516 | const struct cpumask *local_mask; |
| 495 | 517 | ||
| 496 | cpumask_copy(&new_mask, mask); | 518 | cpumask_copy(new_mask, mask); |
| 497 | cpumask_clear_cpu(this_cpu, &new_mask); | 519 | cpumask_clear_cpu(this_cpu, new_mask); |
| 498 | local_mask = &new_mask; | 520 | local_mask = new_mask; |
| 499 | __send_ipi_mask(local_mask, vector); | 521 | __send_ipi_mask(local_mask, vector); |
| 500 | } | 522 | } |
| 501 | 523 | ||
| @@ -575,7 +597,6 @@ static void __init kvm_apf_trap_init(void) · 73 unmodified lines | |||
| 575 | update_intr_gate(X86_TRAP_PF, async_page_fault); | 597 | update_intr_gate(X86_TRAP_PF, async_page_fault); |
| 576 | } | 598 | } |
| 577 | 599 | ||
| 578 | static DEFINE_PER_CPU(cpumask_var_t, __pv_tlb_mask); | ||
| 579 | 600 | ||
| 580 | static void kvm_flush_tlb_others(const struct cpumask *cpumask, | 601 | static void kvm_flush_tlb_others(const struct cpumask *cpumask, |
| 581 | const struct flush_tlb_info *info) | 602 | const struct flush_tlb_info *info) |
| @@ -583,7 +604,7 @@ static void kvm_flush_tlb_others(const struct cpumask *cpumask, · 1 unmodified line | |||
| 583 | u8 state; | 604 | u8 state; |
| 584 | int cpu; | 605 | int cpu; |
| 585 | struct kvm_steal_time *src; | 606 | struct kvm_steal_time *src; |
| 586 | struct cpumask *flushmask = this_cpu_cpumask_var_ptr(__pv_tlb_mask); | 607 | struct cpumask *flushmask = this_cpu_cpumask_var_ptr(__pv_cpu_mask); |
| 587 | 608 | ||
| 588 | cpumask_copy(flushmask, cpumask); | 609 | cpumask_copy(flushmask, cpumask); |
| 589 | /* | 610 | /* |
| @@ -619,11 +640,10 @@ static void __init kvm_guest_init(void) · 29 unmodified lines | |||
| 619 | pv_ops.time.steal_clock = kvm_steal_clock; | 640 | pv_ops.time.steal_clock = kvm_steal_clock; |
| 620 | } | 641 | } |
| 621 | 642 | ||
| 622 | if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) && | 643 | if (pv_tlb_flush_supported()) { |
| 623 | !kvm_para_has_hint(KVM_HINTS_REALTIME) && | ||
| 624 | kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) { | ||
| 625 | pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others; | 644 | pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others; |
| 626 | pv_ops.mmu.tlb_remove_table = tlb_remove_table; | 645 | pv_ops.mmu.tlb_remove_table = tlb_remove_table; |
| 646 | pr_info("KVM setup pv remote TLB flush\n"); | ||
| 627 | } | 647 | } |
| 628 | 648 | ||
| 629 | if (kvm_para_has_feature(KVM_FEATURE_PV_EOI)) | 649 | if (kvm_para_has_feature(KVM_FEATURE_PV_EOI)) |
| @@ -632,9 +652,7 @@ static void __init kvm_guest_init(void) · 2 unmodified lines | |||
| 632 | #ifdef CONFIG_SMP | 652 | #ifdef CONFIG_SMP |
| 633 | smp_ops.smp_prepare_cpus = kvm_smp_prepare_cpus; | 653 | smp_ops.smp_prepare_cpus = kvm_smp_prepare_cpus; |
| 634 | smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu; | 654 | smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu; |
| 635 | if (kvm_para_has_feature(KVM_FEATURE_PV_SCHED_YIELD) && | 655 | if (pv_sched_yield_supported()) { |
| 636 | !kvm_para_has_hint(KVM_HINTS_REALTIME) && | ||
| 637 | kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) { | ||
| 638 | smp_ops.send_call_func_ipi = kvm_smp_send_call_func_ipi; | 656 | smp_ops.send_call_func_ipi = kvm_smp_send_call_func_ipi; |
| 639 | pr_info("KVM setup pv sched yield\n"); | 657 | pr_info("KVM setup pv sched yield\n"); |
| 640 | } | 658 | } |
| @@ -700,7 +718,7 @@ static uint32_t __init kvm_detect(void) · 59 unmodified lines | |||
| 700 | static void __init kvm_apic_init(void) | 718 | static void __init kvm_apic_init(void) |
| 701 | { | 719 | { |
| 702 | #if defined(CONFIG_SMP) | 720 | #if defined(CONFIG_SMP) |
| 703 | if (kvm_para_has_feature(KVM_FEATURE_PV_SEND_IPI)) | 721 | if (pv_ipi_supported()) |
| 704 | kvm_setup_pv_ipi(); | 722 | kvm_setup_pv_ipi(); |
| 705 | #endif | 723 | #endif |
| 706 | } | 724 | } |
| @@ -732,26 +750,31 @@ static __init int activate_jump_labels(void) · 25 unmodified lines | |||
| 732 | } | 750 | } |
| 733 | arch_initcall(activate_jump_labels); | 751 | arch_initcall(activate_jump_labels); |
| 734 | 752 | ||
| 735 | static __init int kvm_setup_pv_tlb_flush(void) | 753 | static __init int kvm_alloc_cpumask(void) |
| 736 | { | 754 | { |
| 737 | int cpu; | 755 | int cpu; |
| 756 | bool alloc = false; | ||
| 738 | 757 | ||
| 739 | if (!kvm_para_available() || nopv) | 758 | if (!kvm_para_available() || nopv) |
| 740 | return 0; | 759 | return 0; |
| 741 | 760 | ||
| 742 | if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) && | 761 | if (pv_tlb_flush_supported()) |
| 743 | !kvm_para_has_hint(KVM_HINTS_REALTIME) && | 762 | alloc = true; |
| 744 | kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) { | 763 | |
| 764 | #if defined(CONFIG_SMP) | ||
| 765 | if (pv_ipi_supported()) | ||
| 766 | alloc = true; | ||
| 767 | #endif | ||
| 768 | |||
| 769 | if (alloc) | ||
| 745 | for_each_possible_cpu(cpu) { | 770 | for_each_possible_cpu(cpu) { |
| 746 | zalloc_cpumask_var_node(per_cpu_ptr(&__pv_tlb_mask, cpu), | 771 | zalloc_cpumask_var_node(per_cpu_ptr(&__pv_cpu_mask, cpu), |
| 747 | GFP_KERNEL, cpu_to_node(cpu)); | 772 | GFP_KERNEL, cpu_to_node(cpu)); |
| 748 | } | 773 | } |
| 749 | pr_info("KVM setup pv remote TLB flush\n"); | ||
| 750 | } | ||
| 751 | 774 | ||
| 752 | return 0; | 775 | return 0; |
| 753 | } | 776 | } |
| 754 | arch_initcall(kvm_setup_pv_tlb_flush); | 777 | arch_initcall(kvm_alloc_cpumask); |
| 755 | 778 | ||
| 756 | #ifdef CONFIG_PARAVIRT_SPINLOCKS | 779 | #ifdef CONFIG_PARAVIRT_SPINLOCKS |
| 757 | 780 | ||
| @@ -30,6 +30,7 @@ · 29 unmodified lines | |||
| 30 | #include <asm/timer.h> | 30 | #include <asm/timer.h> |
| 31 | #include <asm/special_insns.h> | 31 | #include <asm/special_insns.h> |
| 32 | #include <asm/tlb.h> | 32 | #include <asm/tlb.h> |
| 33 | #include <asm/io_bitmap.h> | ||
| 33 | 34 | ||
| 34 | /* | 35 | /* |
| 35 | * nop stub, which must not clobber anything *including the stack* to | 36 | * nop stub, which must not clobber anything *including the stack* to |
| @@ -341,6 +342,10 @@ struct paravirt_patch_template pv_ops = { · 305 unmodified lines | |||
| 341 | .cpu.iret = native_iret, | 342 | .cpu.iret = native_iret, |
| 342 | .cpu.swapgs = native_swapgs, | 343 | .cpu.swapgs = native_swapgs, |
| 343 | 344 | ||
| 345 | #ifdef CONFIG_X86_IOPL_IOPERM | ||
| 346 | .cpu.update_io_bitmap = native_tss_update_io_bitmap, | ||
| 347 | #endif | ||
| 348 | |||
| 344 | .cpu.start_context_switch = paravirt_nop, | 349 | .cpu.start_context_switch = paravirt_nop, |
| 345 | .cpu.end_context_switch = paravirt_nop, | 350 | .cpu.end_context_switch = paravirt_nop, |
| 346 | 351 | ||
| @@ -374,7 +374,7 @@ static void tss_copy_io_bitmap(struct tss_struct *tss, struct io_bitmap *iobm) · 373 unmodified lines | |||
| 374 | /** | 374 | /** |
| 375 | * tss_update_io_bitmap - Update I/O bitmap before exiting to usermode | 375 | * tss_update_io_bitmap - Update I/O bitmap before exiting to usermode |
| 376 | */ | 376 | */ |
| 377 | void tss_update_io_bitmap(void) | 377 | void native_tss_update_io_bitmap(void) |
| 378 | { | 378 | { |
| 379 | struct tss_struct *tss = this_cpu_ptr(&cpu_tss_rw); | 379 | struct tss_struct *tss = this_cpu_ptr(&cpu_tss_rw); |
| 380 | struct thread_struct *t = ¤t->thread; | 380 | struct thread_struct *t = ¤t->thread; |
| @@ -59,6 +59,19 @@ config KVM · 58 unmodified lines | |||
| 59 | 59 | ||
| 60 | If unsure, say N. | 60 | If unsure, say N. |
| 61 | 61 | ||
| 62 | config KVM_WERROR | ||
| 63 | bool "Compile KVM with -Werror" | ||
| 64 | # KASAN may cause the build to fail due to larger frames | ||
| 65 | default y if X86_64 && !KASAN | ||
| 66 | # We use the dependency on !COMPILE_TEST to not be enabled | ||
| 67 | # blindly in allmodconfig or allyesconfig configurations | ||
| 68 | depends on (X86_64 && !KASAN) || !COMPILE_TEST | ||
| 69 | depends on EXPERT | ||
| 70 | help | ||
| 71 | Add -Werror to the build flags for (and only for) i915.ko. | ||
| 72 | |||
| 73 | If in doubt, say "N". | ||
| 74 | |||
| 62 | config KVM_INTEL | 75 | config KVM_INTEL |
| 63 | tristate "KVM for Intel (and compatible) processors support" | 76 | tristate "KVM for Intel (and compatible) processors support" |
| 64 | depends on KVM && IA32_FEAT_CTL | 77 | depends on KVM && IA32_FEAT_CTL |
| @@ -1,6 +1,7 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | ||
| 3 | ccflags-y += -Iarch/x86/kvm | 3 | ccflags-y += -Iarch/x86/kvm |
| 4 | ccflags-$(CONFIG_KVM_WERROR) += -Werror | ||
| 4 | 5 | ||
| 5 | KVM := ../../../virt/kvm | 6 | KVM := ../../../virt/kvm |
| 6 | 7 | ||
| @@ -191,25 +191,6 @@ · 190 unmodified lines | |||
| 191 | #define NR_FASTOP (ilog2(sizeof(ulong)) + 1) | 191 | #define NR_FASTOP (ilog2(sizeof(ulong)) + 1) |
| 192 | #define FASTOP_SIZE 8 | 192 | #define FASTOP_SIZE 8 |
| 193 | 193 | ||
| 194 | /* | ||
| 195 | * fastop functions have a special calling convention: | ||
| 196 | * | ||
| 197 | * dst: rax (in/out) | ||
| 198 | * src: rdx (in/out) | ||
| 199 | * src2: rcx (in) | ||
| 200 | * flags: rflags (in/out) | ||
| 201 | * ex: rsi (in:fastop pointer, out:zero if exception) | ||
| 202 | * | ||
| 203 | * Moreover, they are all exactly FASTOP_SIZE bytes long, so functions for | ||
| 204 | * different operand sizes can be reached by calculation, rather than a jump | ||
| 205 | * table (which would be bigger than the code). | ||
| 206 | * | ||
| 207 | * fastop functions are declared as taking a never-defined fastop parameter, | ||
| 208 | * so they can't be called from C directly. | ||
| 209 | */ | ||
| 210 | |||
| 211 | struct fastop; | ||
| 212 | |||
| 213 | struct opcode { | 194 | struct opcode { |
| 214 | u64 flags : 56; | 195 | u64 flags : 56; |
| 215 | u64 intercept : 8; | 196 | u64 intercept : 8; |
| @@ -311,8 +292,19 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt) · 95 unmodified lines | |||
| 311 | #define ON64(x) | 292 | #define ON64(x) |
| 312 | #endif | 293 | #endif |
| 313 | 294 | ||
| 314 | typedef void (*fastop_t)(struct fastop *); | 295 | /* |
| 315 | 296 | * fastop functions have a special calling convention: | |
| 297 | * | ||
| 298 | * dst: rax (in/out) | ||
| 299 | * src: rdx (in/out) | ||
| 300 | * src2: rcx (in) | ||
| 301 | * flags: rflags (in/out) | ||
| 302 | * ex: rsi (in:fastop pointer, out:zero if exception) | ||
| 303 | * | ||
| 304 | * Moreover, they are all exactly FASTOP_SIZE bytes long, so functions for | ||
| 305 | * different operand sizes can be reached by calculation, rather than a jump | ||
| 306 | * table (which would be bigger than the code). | ||
| 307 | */ | ||
| 316 | static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop); | 308 | static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop); |
| 317 | 309 | ||
| 318 | #define __FOP_FUNC(name) \ | 310 | #define __FOP_FUNC(name) \ |
| @@ -5683,7 +5675,7 @@ special_insn: · 5364 unmodified lines | |||
| 5683 | 5675 | ||
| 5684 | if (ctxt->execute) { | 5676 | if (ctxt->execute) { |
| 5685 | if (ctxt->d & Fastop) | 5677 | if (ctxt->d & Fastop) |
| 5686 | rc = fastop(ctxt, (fastop_t)ctxt->execute); | 5678 | rc = fastop(ctxt, ctxt->fop); |
| 5687 | else | 5679 | else |
| 5688 | rc = ctxt->execute(ctxt); | 5680 | rc = ctxt->execute(ctxt); |
| 5689 | if (rc != X86EMUL_CONTINUE) | 5681 | if (rc != X86EMUL_CONTINUE) |
| @@ -417,7 +417,7 @@ void kvm_scan_ioapic_routes(struct kvm_vcpu *vcpu, · 416 unmodified lines | |||
| 417 | 417 | ||
| 418 | kvm_set_msi_irq(vcpu->kvm, entry, &irq); | 418 | kvm_set_msi_irq(vcpu->kvm, entry, &irq); |
| 419 | 419 | ||
| 420 | if (irq.level && | 420 | if (irq.trig_mode && |
| 421 | kvm_apic_match_dest(vcpu, NULL, APIC_DEST_NOSHORT, | 421 | kvm_apic_match_dest(vcpu, NULL, APIC_DEST_NOSHORT, |
| 422 | irq.dest_id, irq.dest_mode)) | 422 | irq.dest_id, irq.dest_mode)) |
| 423 | __set_bit(irq.vector, ioapic_handled_vectors); | 423 | __set_bit(irq.vector, ioapic_handled_vectors); |
| @@ -627,9 +627,11 @@ static inline bool pv_eoi_enabled(struct kvm_vcpu *vcpu) · 626 unmodified lines | |||
| 627 | static bool pv_eoi_get_pending(struct kvm_vcpu *vcpu) | 627 | static bool pv_eoi_get_pending(struct kvm_vcpu *vcpu) |
| 628 | { | 628 | { |
| 629 | u8 val; | 629 | u8 val; |
| 630 | if (pv_eoi_get_user(vcpu, &val) < 0) | 630 | if (pv_eoi_get_user(vcpu, &val) < 0) { |
| 631 | printk(KERN_WARNING "Can't read EOI MSR value: 0x%llx\n", | 631 | printk(KERN_WARNING "Can't read EOI MSR value: 0x%llx\n", |
| 632 | (unsigned long long)vcpu->arch.pv_eoi.msr_val); | 632 | (unsigned long long)vcpu->arch.pv_eoi.msr_val); |
| 633 | return false; | ||
| 634 | } | ||
| 633 | return val & 0x1; | 635 | return val & 0x1; |
| 634 | } | 636 | } |
| 635 | 637 | ||
| @@ -1046,11 +1048,8 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, · 410 unmodified lines | |||
| 1046 | apic->regs + APIC_TMR); | 1048 | apic->regs + APIC_TMR); |
| 1047 | } | 1049 | } |
| 1048 | 1050 | ||
| 1049 | if (vcpu->arch.apicv_active) | 1051 | if (kvm_x86_ops->deliver_posted_interrupt(vcpu, vector)) { |
| 1050 | kvm_x86_ops->deliver_posted_interrupt(vcpu, vector); | ||
| 1051 | else { | ||
| 1052 | kvm_lapic_set_irr(vector, apic); | 1052 | kvm_lapic_set_irr(vector, apic); |
| 1053 | |||
| 1054 | kvm_make_request(KVM_REQ_EVENT, vcpu); | 1053 | kvm_make_request(KVM_REQ_EVENT, vcpu); |
| 1055 | kvm_vcpu_kick(vcpu); | 1054 | kvm_vcpu_kick(vcpu); |
| 1056 | } | 1055 | } |
| @@ -1080,9 +1079,6 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, · 23 unmodified lines | |||
| 1080 | result = 1; | 1079 | result = 1; |
| 1081 | /* assumes that there are only KVM_APIC_INIT/SIPI */ | 1080 | /* assumes that there are only KVM_APIC_INIT/SIPI */ |
| 1082 | apic->pending_events = (1UL << KVM_APIC_INIT); | 1081 | apic->pending_events = (1UL << KVM_APIC_INIT); |
| 1083 | /* make sure pending_events is visible before sending | ||
| 1084 | * the request */ | ||
| 1085 | smp_wmb(); | ||
| 1086 | kvm_make_request(KVM_REQ_EVENT, vcpu); | 1082 | kvm_make_request(KVM_REQ_EVENT, vcpu); |
| 1087 | kvm_vcpu_kick(vcpu); | 1083 | kvm_vcpu_kick(vcpu); |
| 1088 | } | 1084 | } |
| @@ -102,6 +102,19 @@ static inline void kvm_mmu_load_cr3(struct kvm_vcpu *vcpu) · 101 unmodified lines | |||
| 102 | kvm_get_active_pcid(vcpu)); | 102 | kvm_get_active_pcid(vcpu)); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | int kvm_tdp_page_fault(struct kvm_vcpu *vcpu, gpa_t gpa, u32 error_code, | ||
| 106 | bool prefault); | ||
| 107 | |||
| 108 | static inline int kvm_mmu_do_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, | ||
| 109 | u32 err, bool prefault) | ||
| 110 | { | ||
| 111 | #ifdef CONFIG_RETPOLINE | ||
| 112 | if (likely(vcpu->arch.mmu->page_fault == kvm_tdp_page_fault)) | ||
| 113 | return kvm_tdp_page_fault(vcpu, cr2_or_gpa, err, prefault); | ||
| 114 | #endif | ||
| 115 | return vcpu->arch.mmu->page_fault(vcpu, cr2_or_gpa, err, prefault); | ||
| 116 | } | ||
| 117 | |||
| 105 | /* | 118 | /* |
| 106 | * Currently, we have two sorts of write-protection, a) the first one | 119 | * Currently, we have two sorts of write-protection, a) the first one |
| 107 | * write-protects guest page to sync the guest modification, b) another one is | 120 | * write-protects guest page to sync the guest modification, b) another one is |
| @@ -4219,8 +4219,8 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code, · 4218 unmodified lines | |||
| 4219 | } | 4219 | } |
| 4220 | EXPORT_SYMBOL_GPL(kvm_handle_page_fault); | 4220 | EXPORT_SYMBOL_GPL(kvm_handle_page_fault); |
| 4221 | 4221 | ||
| 4222 | static int tdp_page_fault(struct kvm_vcpu *vcpu, gpa_t gpa, u32 error_code, | 4222 | int kvm_tdp_page_fault(struct kvm_vcpu *vcpu, gpa_t gpa, u32 error_code, |
| 4223 | bool prefault) | 4223 | bool prefault) |
| 4224 | { | 4224 | { |
| 4225 | int max_level; | 4225 | int max_level; |
| 4226 | 4226 | ||
| @@ -4925,7 +4925,7 @@ static void init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) · 698 unmodified lines | |||
| 4925 | return; | 4925 | return; |
| 4926 | 4926 | ||
| 4927 | context->mmu_role.as_u64 = new_role.as_u64; | 4927 | context->mmu_role.as_u64 = new_role.as_u64; |
| 4928 | context->page_fault = tdp_page_fault; | 4928 | context->page_fault = kvm_tdp_page_fault; |
| 4929 | context->sync_page = nonpaging_sync_page; | 4929 | context->sync_page = nonpaging_sync_page; |
| 4930 | context->invlpg = nonpaging_invlpg; | 4930 | context->invlpg = nonpaging_invlpg; |
| 4931 | context->update_pte = nonpaging_update_pte; | 4931 | context->update_pte = nonpaging_update_pte; |
| @@ -5436,9 +5436,8 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, u64 error_code, · 504 unmodified lines | |||
| 5436 | } | 5436 | } |
| 5437 | 5437 | ||
| 5438 | if (r == RET_PF_INVALID) { | 5438 | if (r == RET_PF_INVALID) { |
| 5439 | r = vcpu->arch.mmu->page_fault(vcpu, cr2_or_gpa, | 5439 | r = kvm_mmu_do_page_fault(vcpu, cr2_or_gpa, |
| 5440 | lower_32_bits(error_code), | 5440 | lower_32_bits(error_code), false); |
| 5441 | false); | ||
| 5442 | WARN_ON(r == RET_PF_INVALID); | 5441 | WARN_ON(r == RET_PF_INVALID); |
| 5443 | } | 5442 | } |
| 5444 | 5443 | ||
| @@ -33,7 +33,7 @@ · 32 unmodified lines | |||
| 33 | #define PT_GUEST_ACCESSED_SHIFT PT_ACCESSED_SHIFT | 33 | #define PT_GUEST_ACCESSED_SHIFT PT_ACCESSED_SHIFT |
| 34 | #define PT_HAVE_ACCESSED_DIRTY(mmu) true | 34 | #define PT_HAVE_ACCESSED_DIRTY(mmu) true |
| 35 | #ifdef CONFIG_X86_64 | 35 | #ifdef CONFIG_X86_64 |
| 36 | #define PT_MAX_FULL_LEVELS 4 | 36 | #define PT_MAX_FULL_LEVELS PT64_ROOT_MAX_LEVEL |
| 37 | #define CMPXCHG cmpxchg | 37 | #define CMPXCHG cmpxchg |
| 38 | #else | 38 | #else |
| 39 | #define CMPXCHG cmpxchg64 | 39 | #define CMPXCHG cmpxchg64 |
| @@ -339,7 +339,7 @@ TRACE_EVENT( · 338 unmodified lines | |||
| 339 | /* These depend on page entry type, so compute them now. */ | 339 | /* These depend on page entry type, so compute them now. */ |
| 340 | __field(bool, r) | 340 | __field(bool, r) |
| 341 | __field(bool, x) | 341 | __field(bool, x) |
| 342 | __field(u8, u) | 342 | __field(signed char, u) |
| 343 | ), | 343 | ), |
| 344 | 344 | ||
| 345 | TP_fast_assign( | 345 | TP_fast_assign( |
| @@ -57,11 +57,13 @@ · 56 unmodified lines | |||
| 57 | MODULE_AUTHOR("Qumranet"); | 57 | MODULE_AUTHOR("Qumranet"); |
| 58 | MODULE_LICENSE("GPL"); | 58 | MODULE_LICENSE("GPL"); |
| 59 | 59 | ||
| 60 | #ifdef MODULE | ||
| 60 | static const struct x86_cpu_id svm_cpu_id[] = { | 61 | static const struct x86_cpu_id svm_cpu_id[] = { |
| 61 | X86_FEATURE_MATCH(X86_FEATURE_SVM), | 62 | X86_FEATURE_MATCH(X86_FEATURE_SVM), |
| 62 | {} | 63 | {} |
| 63 | }; | 64 | }; |
| 64 | MODULE_DEVICE_TABLE(x86cpu, svm_cpu_id); | 65 | MODULE_DEVICE_TABLE(x86cpu, svm_cpu_id); |
| 66 | #endif | ||
| 65 | 67 | ||
| 66 | #define IOPM_ALLOC_ORDER 2 | 68 | #define IOPM_ALLOC_ORDER 2 |
| 67 | #define MSRPM_ALLOC_ORDER 1 | 69 | #define MSRPM_ALLOC_ORDER 1 |
| @@ -1005,33 +1007,32 @@ static void svm_cpu_uninit(int cpu) · 937 unmodified lines | |||
| 1005 | static int svm_cpu_init(int cpu) | 1007 | static int svm_cpu_init(int cpu) |
| 1006 | { | 1008 | { |
| 1007 | struct svm_cpu_data *sd; | 1009 | struct svm_cpu_data *sd; |
| 1008 | int r; | ||
| 1009 | 1010 | ||
| 1010 | sd = kzalloc(sizeof(struct svm_cpu_data), GFP_KERNEL); | 1011 | sd = kzalloc(sizeof(struct svm_cpu_data), GFP_KERNEL); |
| 1011 | if (!sd) | 1012 | if (!sd) |
| 1012 | return -ENOMEM; | 1013 | return -ENOMEM; |
| 1013 | sd->cpu = cpu; | 1014 | sd->cpu = cpu; |
| 1014 | r = -ENOMEM; | ||
| 1015 | sd->save_area = alloc_page(GFP_KERNEL); | 1015 | sd->save_area = alloc_page(GFP_KERNEL); |
| 1016 | if (!sd->save_area) | 1016 | if (!sd->save_area) |
| 1017 | goto err_1; | 1017 | goto free_cpu_data; |
| 1018 | 1018 | ||
| 1019 | if (svm_sev_enabled()) { | 1019 | if (svm_sev_enabled()) { |
| 1020 | r = -ENOMEM; | ||
| 1021 | sd->sev_vmcbs = kmalloc_array(max_sev_asid + 1, | 1020 | sd->sev_vmcbs = kmalloc_array(max_sev_asid + 1, |
| 1022 | sizeof(void *), | 1021 | sizeof(void *), |
| 1023 | GFP_KERNEL); | 1022 | GFP_KERNEL); |
| 1024 | if (!sd->sev_vmcbs) | 1023 | if (!sd->sev_vmcbs) |
| 1025 | goto err_1; | 1024 | goto free_save_area; |
| 1026 | } | 1025 | } |
| 1027 | 1026 | ||
| 1028 | per_cpu(svm_data, cpu) = sd; | 1027 | per_cpu(svm_data, cpu) = sd; |
| 1029 | 1028 | ||
| 1030 | return 0; | 1029 | return 0; |
| 1031 | 1030 | ||
| 1032 | err_1: | 1031 | free_save_area: |
| 1032 | __free_page(sd->save_area); | ||
| 1033 | free_cpu_data: | ||
| 1033 | kfree(sd); | 1034 | kfree(sd); |
| 1034 | return r; | 1035 | return -ENOMEM; |
| 1035 | 1036 | ||
| 1036 | } | 1037 | } |
| 1037 | 1038 | ||
| @@ -1350,6 +1351,24 @@ static __init void svm_adjust_mmio_mask(void) · 312 unmodified lines | |||
| 1350 | kvm_mmu_set_mmio_spte_mask(mask, mask, PT_WRITABLE_MASK | PT_USER_MASK); | 1351 | kvm_mmu_set_mmio_spte_mask(mask, mask, PT_WRITABLE_MASK | PT_USER_MASK); |
| 1351 | } | 1352 | } |
| 1352 | 1353 | ||
| 1354 | static void svm_hardware_teardown(void) | ||
| 1355 | { | ||
| 1356 | int cpu; | ||
| 1357 | |||
| 1358 | if (svm_sev_enabled()) { | ||
| 1359 | bitmap_free(sev_asid_bitmap); | ||
| 1360 | bitmap_free(sev_reclaim_asid_bitmap); | ||
| 1361 | |||
| 1362 | sev_flush_asids(); | ||
| 1363 | } | ||
| 1364 | |||
| 1365 | for_each_possible_cpu(cpu) | ||
| 1366 | svm_cpu_uninit(cpu); | ||
| 1367 | |||
| 1368 | __free_pages(pfn_to_page(iopm_base >> PAGE_SHIFT), IOPM_ALLOC_ORDER); | ||
| 1369 | iopm_base = 0; | ||
| 1370 | } | ||
| 1371 | |||
| 1353 | static __init int svm_hardware_setup(void) | 1372 | static __init int svm_hardware_setup(void) |
| 1354 | { | 1373 | { |
| 1355 | int cpu; | 1374 | int cpu; |
| @@ -1463,29 +1482,10 @@ static __init int svm_hardware_setup(void) · 107 unmodified lines | |||
| 1463 | return 0; | 1482 | return 0; |
| 1464 | 1483 | ||
| 1465 | err: | 1484 | err: |
| 1466 | __free_pages(iopm_pages, IOPM_ALLOC_ORDER); | 1485 | svm_hardware_teardown(); |
| 1467 | iopm_base = 0; | ||
| 1468 | return r; | 1486 | return r; |
| 1469 | } | 1487 | } |
| 1470 | 1488 | ||
| 1471 | static __exit void svm_hardware_unsetup(void) | ||
| 1472 | { | ||
| 1473 | int cpu; | ||
| 1474 | |||
| 1475 | if (svm_sev_enabled()) { | ||
| 1476 | bitmap_free(sev_asid_bitmap); | ||
| 1477 | bitmap_free(sev_reclaim_asid_bitmap); | ||
| 1478 | |||
| 1479 | sev_flush_asids(); | ||
| 1480 | } | ||
| 1481 | |||
| 1482 | for_each_possible_cpu(cpu) | ||
| 1483 | svm_cpu_uninit(cpu); | ||
| 1484 | |||
| 1485 | __free_pages(pfn_to_page(iopm_base >> PAGE_SHIFT), IOPM_ALLOC_ORDER); | ||
| 1486 | iopm_base = 0; | ||
| 1487 | } | ||
| 1488 | |||
| 1489 | static void init_seg(struct vmcb_seg *seg) | 1489 | static void init_seg(struct vmcb_seg *seg) |
| 1490 | { | 1490 | { |
| 1491 | seg->selector = 0; | 1491 | seg->selector = 0; |
| @@ -2175,7 +2175,6 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) · 683 unmodified lines | |||
| 2175 | u32 dummy; | 2175 | u32 dummy; |
| 2176 | u32 eax = 1; | 2176 | u32 eax = 1; |
| 2177 | 2177 | ||
| 2178 | vcpu->arch.microcode_version = 0x01000065; | ||
| 2179 | svm->spec_ctrl = 0; | 2178 | svm->spec_ctrl = 0; |
| 2180 | svm->virt_spec_ctrl = 0; | 2179 | svm->virt_spec_ctrl = 0; |
| 2181 | 2180 | ||
| @@ -2197,8 +2196,9 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) · 15 unmodified lines | |||
| 2197 | static int avic_init_vcpu(struct vcpu_svm *svm) | 2196 | static int avic_init_vcpu(struct vcpu_svm *svm) |
| 2198 | { | 2197 | { |
| 2199 | int ret; | 2198 | int ret; |
| 2199 | struct kvm_vcpu *vcpu = &svm->vcpu; | ||
| 2200 | 2200 | ||
| 2201 | if (!kvm_vcpu_apicv_active(&svm->vcpu)) | 2201 | if (!avic || !irqchip_in_kernel(vcpu->kvm)) |
| 2202 | return 0; | 2202 | return 0; |
| 2203 | 2203 | ||
| 2204 | ret = avic_init_backing_page(&svm->vcpu); | 2204 | ret = avic_init_backing_page(&svm->vcpu); |
| @@ -2266,6 +2266,7 @@ static int svm_create_vcpu(struct kvm_vcpu *vcpu) · 61 unmodified lines | |||
| 2266 | init_vmcb(svm); | 2266 | init_vmcb(svm); |
| 2267 | 2267 | ||
| 2268 | svm_init_osvw(vcpu); | 2268 | svm_init_osvw(vcpu); |
| 2269 | vcpu->arch.microcode_version = 0x01000065; | ||
| 2269 | 2270 | ||
| 2270 | return 0; | 2271 | return 0; |
| 2271 | 2272 | ||
| @@ -5232,6 +5233,9 @@ static void svm_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu) · 2960 unmodified lines | |||
| 5232 | struct vmcb *vmcb = svm->vmcb; | 5233 | struct vmcb *vmcb = svm->vmcb; |
| 5233 | bool activated = kvm_vcpu_apicv_active(vcpu); | 5234 | bool activated = kvm_vcpu_apicv_active(vcpu); |
| 5234 | 5235 | ||
| 5236 | if (!avic) | ||
| 5237 | return; | ||
| 5238 | |||
| 5235 | if (activated) { | 5239 | if (activated) { |
| 5236 | /** | 5240 | /** |
| 5237 | * During AVIC temporary deactivation, guest could update | 5241 | * During AVIC temporary deactivation, guest could update |
| @@ -5255,8 +5259,11 @@ static void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) · 17 unmodified lines | |||
| 5255 | return; | 5259 | return; |
| 5256 | } | 5260 | } |
| 5257 | 5261 | ||
| 5258 | static void svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec) | 5262 | static int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec) |
| 5259 | { | 5263 | { |
| 5264 | if (!vcpu->arch.apicv_active) | ||
| 5265 | return -1; | ||
| 5266 | |||
| 5260 | kvm_lapic_set_irr(vec, vcpu->arch.apic); | 5267 | kvm_lapic_set_irr(vec, vcpu->arch.apic); |
| 5261 | smp_mb__after_atomic(); | 5268 | smp_mb__after_atomic(); |
| 5262 | 5269 | ||
| @@ -5268,6 +5275,8 @@ static void svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec) · 5 unmodified lines | |||
| 5268 | put_cpu(); | 5275 | put_cpu(); |
| 5269 | } else | 5276 | } else |
| 5270 | kvm_vcpu_wake_up(vcpu); | 5277 | kvm_vcpu_wake_up(vcpu); |
| 5278 | |||
| 5279 | return 0; | ||
| 5271 | } | 5280 | } |
| 5272 | 5281 | ||
| 5273 | static bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu) | 5282 | static bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu) |
| @@ -7378,7 +7387,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = { · 2104 unmodified lines | |||
| 7378 | .cpu_has_kvm_support = has_svm, | 7387 | .cpu_has_kvm_support = has_svm, |
| 7379 | .disabled_by_bios = is_disabled, | 7388 | .disabled_by_bios = is_disabled, |
| 7380 | .hardware_setup = svm_hardware_setup, | 7389 | .hardware_setup = svm_hardware_setup, |
| 7381 | .hardware_unsetup = svm_hardware_unsetup, | 7390 | .hardware_unsetup = svm_hardware_teardown, |
| 7382 | .check_processor_compatibility = svm_check_processor_compat, | 7391 | .check_processor_compatibility = svm_check_processor_compat, |
| 7383 | .hardware_enable = svm_hardware_enable, | 7392 | .hardware_enable = svm_hardware_enable, |
| 7384 | .hardware_disable = svm_hardware_disable, | 7393 | .hardware_disable = svm_hardware_disable, |
| @@ -7433,6 +7442,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = { · 48 unmodified lines | |||
| 7433 | .run = svm_vcpu_run, | 7442 | .run = svm_vcpu_run, |
| 7434 | .handle_exit = handle_exit, | 7443 | .handle_exit = handle_exit, |
| 7435 | .skip_emulated_instruction = skip_emulated_instruction, | 7444 | .skip_emulated_instruction = skip_emulated_instruction, |
| 7445 | .update_emulated_instruction = NULL, | ||
| 7436 | .set_interrupt_shadow = svm_set_interrupt_shadow, | 7446 | .set_interrupt_shadow = svm_set_interrupt_shadow, |
| 7437 | .get_interrupt_shadow = svm_get_interrupt_shadow, | 7447 | .get_interrupt_shadow = svm_get_interrupt_shadow, |
| 7438 | .patch_hypercall = svm_patch_hypercall, | 7448 | .patch_hypercall = svm_patch_hypercall, |
| @@ -12,6 +12,7 @@ extern bool __read_mostly enable_ept; · 11 unmodified lines | |||
| 12 | extern bool __read_mostly enable_unrestricted_guest; | 12 | extern bool __read_mostly enable_unrestricted_guest; |
| 13 | extern bool __read_mostly enable_ept_ad_bits; | 13 | extern bool __read_mostly enable_ept_ad_bits; |
| 14 | extern bool __read_mostly enable_pml; | 14 | extern bool __read_mostly enable_pml; |
| 15 | extern bool __read_mostly enable_apicv; | ||
| 15 | extern int __read_mostly pt_mode; | 16 | extern int __read_mostly pt_mode; |
| 16 | 17 | ||
| 17 | #define PT_MODE_SYSTEM 0 | 18 | #define PT_MODE_SYSTEM 0 |
| @@ -544,7 +544,8 @@ static void nested_vmx_disable_intercept_for_msr(unsigned long *msr_bitmap_l1, · 543 unmodified lines | |||
| 544 | } | 544 | } |
| 545 | } | 545 | } |
| 546 | 546 | ||
| 547 | static inline void enable_x2apic_msr_intercepts(unsigned long *msr_bitmap) { | 547 | static inline void enable_x2apic_msr_intercepts(unsigned long *msr_bitmap) |
| 548 | { | ||
| 548 | int msr; | 549 | int msr; |
| 549 | 550 | ||
| 550 | for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) { | 551 | for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) { |
| @@ -1981,7 +1982,7 @@ static int nested_vmx_handle_enlightened_vmptrld(struct kvm_vcpu *vcpu, · 1430 unmodified lines | |||
| 1981 | } | 1982 | } |
| 1982 | 1983 | ||
| 1983 | /* | 1984 | /* |
| 1984 | * Clean fields data can't de used on VMLAUNCH and when we switch | 1985 | * Clean fields data can't be used on VMLAUNCH and when we switch |
| 1985 | * between different L2 guests as KVM keeps a single VMCS12 per L1. | 1986 | * between different L2 guests as KVM keeps a single VMCS12 per L1. |
| 1986 | */ | 1987 | */ |
| 1987 | if (from_launch || evmcs_gpa_changed) | 1988 | if (from_launch || evmcs_gpa_changed) |
| @@ -3160,10 +3161,10 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu, · 1172 unmodified lines | |||
| 3160 | * or KVM_SET_NESTED_STATE). Otherwise it's called from vmlaunch/vmresume. | 3161 | * or KVM_SET_NESTED_STATE). Otherwise it's called from vmlaunch/vmresume. |
| 3161 | * | 3162 | * |
| 3162 | * Returns: | 3163 | * Returns: |
| 3163 | * NVMX_ENTRY_SUCCESS: Entered VMX non-root mode | 3164 | * NVMX_VMENTRY_SUCCESS: Entered VMX non-root mode |
| 3164 | * NVMX_ENTRY_VMFAIL: Consistency check VMFail | 3165 | * NVMX_VMENTRY_VMFAIL: Consistency check VMFail |
| 3165 | * NVMX_ENTRY_VMEXIT: Consistency check VMExit | 3166 | * NVMX_VMENTRY_VMEXIT: Consistency check VMExit |
| 3166 | * NVMX_ENTRY_KVM_INTERNAL_ERROR: KVM internal error | 3167 | * NVMX_VMENTRY_KVM_INTERNAL_ERROR: KVM internal error |
| 3167 | */ | 3168 | */ |
| 3168 | enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, | 3169 | enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, |
| 3169 | bool from_vmentry) | 3170 | bool from_vmentry) |
| @@ -3575,25 +3576,80 @@ static void nested_vmx_inject_exception_vmexit(struct kvm_vcpu *vcpu, · 405 unmodified lines | |||
| 3575 | nested_vmx_vmexit(vcpu, EXIT_REASON_EXCEPTION_NMI, intr_info, exit_qual); | 3576 | nested_vmx_vmexit(vcpu, EXIT_REASON_EXCEPTION_NMI, intr_info, exit_qual); |
| 3576 | } | 3577 | } |
| 3577 | 3578 | ||
| 3579 | /* | ||
| 3580 | * Returns true if a debug trap is pending delivery. | ||
| 3581 | * | ||
| 3582 | * In KVM, debug traps bear an exception payload. As such, the class of a #DB | ||
| 3583 | * exception may be inferred from the presence of an exception payload. | ||
| 3584 | */ | ||
| 3585 | static inline bool vmx_pending_dbg_trap(struct kvm_vcpu *vcpu) | ||
| 3586 | { | ||
| 3587 | return vcpu->arch.exception.pending && | ||
| 3588 | vcpu->arch.exception.nr == DB_VECTOR && | ||
| 3589 | vcpu->arch.exception.payload; | ||
| 3590 | } | ||
| 3591 | |||
| 3592 | /* | ||
| 3593 | * Certain VM-exits set the 'pending debug exceptions' field to indicate a | ||
| 3594 | * recognized #DB (data or single-step) that has yet to be delivered. Since KVM | ||
| 3595 | * represents these debug traps with a payload that is said to be compatible | ||
| 3596 | * with the 'pending debug exceptions' field, write the payload to the VMCS | ||
| 3597 | * field if a VM-exit is delivered before the debug trap. | ||
| 3598 | */ | ||
| 3599 | static void nested_vmx_update_pending_dbg(struct kvm_vcpu *vcpu) | ||
| 3600 | { | ||
| 3601 | if (vmx_pending_dbg_trap(vcpu)) | ||
| 3602 | vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS, | ||
| 3603 | vcpu->arch.exception.payload); | ||
| 3604 | } | ||
| 3605 | |||
| 3578 | static int vmx_check_nested_events(struct kvm_vcpu *vcpu, bool external_intr) | 3606 | static int vmx_check_nested_events(struct kvm_vcpu *vcpu, bool external_intr) |
| 3579 | { | 3607 | { |
| 3580 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 3608 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
| 3581 | unsigned long exit_qual; | 3609 | unsigned long exit_qual; |
| 3582 | bool block_nested_events = | 3610 | bool block_nested_events = |
| 3583 | vmx->nested.nested_run_pending || kvm_event_needs_reinjection(vcpu); | 3611 | vmx->nested.nested_run_pending || kvm_event_needs_reinjection(vcpu); |
| 3612 | bool mtf_pending = vmx->nested.mtf_pending; | ||
| 3584 | struct kvm_lapic *apic = vcpu->arch.apic; | 3613 | struct kvm_lapic *apic = vcpu->arch.apic; |
| 3585 | 3614 | ||
| 3615 | /* | ||
| 3616 | * Clear the MTF state. If a higher priority VM-exit is delivered first, | ||
| 3617 | * this state is discarded. | ||
| 3618 | */ | ||
| 3619 | vmx->nested.mtf_pending = false; | ||
| 3620 | |||
| 3586 | if (lapic_in_kernel(vcpu) && | 3621 | if (lapic_in_kernel(vcpu) && |
| 3587 | test_bit(KVM_APIC_INIT, &apic->pending_events)) { | 3622 | test_bit(KVM_APIC_INIT, &apic->pending_events)) { |
| 3588 | if (block_nested_events) | 3623 | if (block_nested_events) |
| 3589 | return -EBUSY; | 3624 | return -EBUSY; |
| 3625 | nested_vmx_update_pending_dbg(vcpu); | ||
| 3590 | clear_bit(KVM_APIC_INIT, &apic->pending_events); | 3626 | clear_bit(KVM_APIC_INIT, &apic->pending_events); |
| 3591 | nested_vmx_vmexit(vcpu, EXIT_REASON_INIT_SIGNAL, 0, 0); | 3627 | nested_vmx_vmexit(vcpu, EXIT_REASON_INIT_SIGNAL, 0, 0); |
| 3592 | return 0; | 3628 | return 0; |
| 3593 | } | 3629 | } |
| 3594 | 3630 | ||
| 3631 | /* | ||
| 3632 | * Process any exceptions that are not debug traps before MTF. | ||
| 3633 | */ | ||
| 3634 | if (vcpu->arch.exception.pending && | ||
| 3635 | !vmx_pending_dbg_trap(vcpu) && | ||
| 3636 | nested_vmx_check_exception(vcpu, &exit_qual)) { | ||
| 3637 | if (block_nested_events) | ||
| 3638 | return -EBUSY; | ||
| 3639 | nested_vmx_inject_exception_vmexit(vcpu, exit_qual); | ||
| 3640 | return 0; | ||
| 3641 | } | ||
| 3642 | |||
| 3643 | if (mtf_pending) { | ||
| 3644 | if (block_nested_events) | ||
| 3645 | return -EBUSY; | ||
| 3646 | nested_vmx_update_pending_dbg(vcpu); | ||
| 3647 | nested_vmx_vmexit(vcpu, EXIT_REASON_MONITOR_TRAP_FLAG, 0, 0); | ||
| 3648 | return 0; | ||
| 3649 | } | ||
| 3650 | |||
| 3595 | if (vcpu->arch.exception.pending && | 3651 | if (vcpu->arch.exception.pending && |
| 3596 | nested_vmx_check_exception(vcpu, &exit_qual)) { | 3652 | nested_vmx_check_exception(vcpu, &exit_qual)) { |
| 3597 | if (block_nested_events) | 3653 | if (block_nested_events) |
| 3598 | return -EBUSY; | 3654 | return -EBUSY; |
| 3599 | nested_vmx_inject_exception_vmexit(vcpu, exit_qual); | 3655 | nested_vmx_inject_exception_vmexit(vcpu, exit_qual); |
| @@ -5256,24 +5312,17 @@ fail: · 1656 unmodified lines | |||
| 5256 | return 1; | 5312 | return 1; |
| 5257 | } | 5313 | } |
| 5258 | 5314 | ||
| 5259 | 5315 | /* | |
| 5260 | static bool nested_vmx_exit_handled_io(struct kvm_vcpu *vcpu, | 5316 | * Return true if an IO instruction with the specified port and size should cause |
| 5261 | struct vmcs12 *vmcs12) | 5317 | * a VM-exit into L1. |
| 5318 | */ | ||
| 5319 | bool nested_vmx_check_io_bitmaps(struct kvm_vcpu *vcpu, unsigned int port, | ||
| 5320 | int size) | ||
| 5262 | { | 5321 | { |
| 5263 | unsigned long exit_qualification; | 5322 | struct vmcs12 *vmcs12 = get_vmcs12(vcpu); |
| 5264 | gpa_t bitmap, last_bitmap; | 5323 | gpa_t bitmap, last_bitmap; |
| 5265 | unsigned int port; | ||
| 5266 | int size; | ||
| 5267 | u8 b; | 5324 | u8 b; |
| 5268 | 5325 | ||
| 5269 | if (!nested_cpu_has(vmcs12, CPU_BASED_USE_IO_BITMAPS)) | ||
| 5270 | return nested_cpu_has(vmcs12, CPU_BASED_UNCOND_IO_EXITING); | ||
| 5271 | |||
| 5272 | exit_qualification = vmcs_readl(EXIT_QUALIFICATION); | ||
| 5273 | |||
| 5274 | port = exit_qualification >> 16; | ||
| 5275 | size = (exit_qualification & 7) + 1; | ||
| 5276 | |||
| 5277 | last_bitmap = (gpa_t)-1; | 5326 | last_bitmap = (gpa_t)-1; |
| 5278 | b = -1; | 5327 | b = -1; |
| 5279 | 5328 | ||
| @@ -5300,8 +5349,26 @@ static bool nested_vmx_exit_handled_io(struct kvm_vcpu *vcpu, · 20 unmodified lines | |||
| 5300 | return false; | 5349 | return false; |
| 5301 | } | 5350 | } |
| 5302 | 5351 | ||
| 5352 | static bool nested_vmx_exit_handled_io(struct kvm_vcpu *vcpu, | ||
| 5353 | struct vmcs12 *vmcs12) | ||
| 5354 | { | ||
| 5355 | unsigned long exit_qualification; | ||
| 5356 | unsigned short port; | ||
| 5357 | int size; | ||
| 5358 | |||
| 5359 | if (!nested_cpu_has(vmcs12, CPU_BASED_USE_IO_BITMAPS)) | ||
| 5360 | return nested_cpu_has(vmcs12, CPU_BASED_UNCOND_IO_EXITING); | ||
| 5361 | |||
| 5362 | exit_qualification = vmcs_readl(EXIT_QUALIFICATION); | ||
| 5363 | |||
| 5364 | port = exit_qualification >> 16; | ||
| 5365 | size = (exit_qualification & 7) + 1; | ||
| 5366 | |||
| 5367 | return nested_vmx_check_io_bitmaps(vcpu, port, size); | ||
| 5368 | } | ||
| 5369 | |||
| 5303 | /* | 5370 | /* |
| 5304 | * Return 1 if we should exit from L2 to L1 to handle an MSR access access, | 5371 | * Return 1 if we should exit from L2 to L1 to handle an MSR access, |
| 5305 | * rather than handle it ourselves in L0. I.e., check whether L1 expressed | 5372 | * rather than handle it ourselves in L0. I.e., check whether L1 expressed |
| 5306 | * disinterest in the current event (read or write a specific MSR) by using an | 5373 | * disinterest in the current event (read or write a specific MSR) by using an |
| 5307 | * MSR bitmap. This may be the case even when L0 doesn't use MSR bitmaps. | 5374 | * MSR bitmap. This may be the case even when L0 doesn't use MSR bitmaps. |
| @@ -5683,6 +5750,9 @@ static int vmx_get_nested_state(struct kvm_vcpu *vcpu, · 375 unmodified lines | |||
| 5683 | 5750 | ||
| 5684 | if (vmx->nested.nested_run_pending) | 5751 | if (vmx->nested.nested_run_pending) |
| 5685 | kvm_state.flags |= KVM_STATE_NESTED_RUN_PENDING; | 5752 | kvm_state.flags |= KVM_STATE_NESTED_RUN_PENDING; |
| 5753 | |||
| 5754 | if (vmx->nested.mtf_pending) | ||
| 5755 | kvm_state.flags |= KVM_STATE_NESTED_MTF_PENDING; | ||
| 5686 | } | 5756 | } |
| 5687 | } | 5757 | } |
| 5688 | 5758 | ||
| @@ -5863,6 +5933,9 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, · 174 unmodified lines | |||
| 5863 | vmx->nested.nested_run_pending = | 5933 | vmx->nested.nested_run_pending = |
| 5864 | !!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING); | 5934 | !!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING); |
| 5865 | 5935 | ||
| 5936 | vmx->nested.mtf_pending = | ||
| 5937 | !!(kvm_state->flags & KVM_STATE_NESTED_MTF_PENDING); | ||
| 5938 | |||
| 5866 | ret = -EINVAL; | 5939 | ret = -EINVAL; |
| 5867 | if (nested_cpu_has_shadow_vmcs(vmcs12) && | 5940 | if (nested_cpu_has_shadow_vmcs(vmcs12) && |
| 5868 | vmcs12->vmcs_link_pointer != -1ull) { | 5941 | vmcs12->vmcs_link_pointer != -1ull) { |
| @@ -5920,8 +5993,7 @@ void nested_vmx_set_vmcs_shadowing_bitmap(void) · 51 unmodified lines | |||
| 5920 | * bit in the high half is on if the corresponding bit in the control field | 5993 | * bit in the high half is on if the corresponding bit in the control field |
| 5921 | * may be on. See also vmx_control_verify(). | 5994 | * may be on. See also vmx_control_verify(). |
| 5922 | */ | 5995 | */ |
| 5923 | void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps, | 5996 | void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps) |
| 5924 | bool apicv) | ||
| 5925 | { | 5997 | { |
| 5926 | /* | 5998 | /* |
| 5927 | * Note that as a general rule, the high half of the MSRs (bits in | 5999 | * Note that as a general rule, the high half of the MSRs (bits in |
| @@ -5948,7 +6020,7 @@ void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps, · 20 unmodified lines | |||
| 5948 | PIN_BASED_EXT_INTR_MASK | | 6020 | PIN_BASED_EXT_INTR_MASK | |
| 5949 | PIN_BASED_NMI_EXITING | | 6021 | PIN_BASED_NMI_EXITING | |
| 5950 | PIN_BASED_VIRTUAL_NMIS | | 6022 | PIN_BASED_VIRTUAL_NMIS | |
| 5951 | (apicv ? PIN_BASED_POSTED_INTR : 0); | 6023 | (enable_apicv ? PIN_BASED_POSTED_INTR : 0); |
| 5952 | msrs->pinbased_ctls_high |= | 6024 | msrs->pinbased_ctls_high |= |
| 5953 | PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR | | 6025 | PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR | |
| 5954 | PIN_BASED_VMX_PREEMPTION_TIMER; | 6026 | PIN_BASED_VMX_PREEMPTION_TIMER; |
| @@ -17,8 +17,7 @@ enum nvmx_vmentry_status { · 16 unmodified lines | |||
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | void vmx_leave_nested(struct kvm_vcpu *vcpu); | 19 | void vmx_leave_nested(struct kvm_vcpu *vcpu); |
| 20 | void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps, | 20 | void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps); |
| 21 | bool apicv); | ||
| 22 | void nested_vmx_hardware_unsetup(void); | 21 | void nested_vmx_hardware_unsetup(void); |
| 23 | __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *)); | 22 | __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *)); |
| 24 | void nested_vmx_set_vmcs_shadowing_bitmap(void); | 23 | void nested_vmx_set_vmcs_shadowing_bitmap(void); |
| @@ -34,6 +33,8 @@ int vmx_get_vmx_msr(struct nested_vmx_msrs *msrs, u32 msr_index, u64 *pdata); · 9 unmodified lines | |||
| 34 | int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification, | 33 | int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification, |
| 35 | u32 vmx_instruction_info, bool wr, int len, gva_t *ret); | 34 | u32 vmx_instruction_info, bool wr, int len, gva_t *ret); |
| 36 | void nested_vmx_pmu_entry_exit_ctls_update(struct kvm_vcpu *vcpu); | 35 | void nested_vmx_pmu_entry_exit_ctls_update(struct kvm_vcpu *vcpu); |
| 36 | bool nested_vmx_check_io_bitmaps(struct kvm_vcpu *vcpu, unsigned int port, | ||
| 37 | int size); | ||
| 37 | 38 | ||
| 38 | static inline struct vmcs12 *get_vmcs12(struct kvm_vcpu *vcpu) | 39 | static inline struct vmcs12 *get_vmcs12(struct kvm_vcpu *vcpu) |
| 39 | { | 40 | { |
| @@ -175,6 +176,11 @@ static inline bool nested_cpu_has_virtual_nmis(struct vmcs12 *vmcs12) · 135 unmodified lines | |||
| 175 | return vmcs12->pin_based_vm_exec_control & PIN_BASED_VIRTUAL_NMIS; | 176 | return vmcs12->pin_based_vm_exec_control & PIN_BASED_VIRTUAL_NMIS; |
| 176 | } | 177 | } |
| 177 | 178 | ||
| 179 | static inline int nested_cpu_has_mtf(struct vmcs12 *vmcs12) | ||
| 180 | { | ||
| 181 | return nested_cpu_has(vmcs12, CPU_BASED_MONITOR_TRAP_FLAG); | ||
| 182 | } | ||
| 183 | |||
| 178 | static inline int nested_cpu_has_ept(struct vmcs12 *vmcs12) | 184 | static inline int nested_cpu_has_ept(struct vmcs12 *vmcs12) |
| 179 | { | 185 | { |
| 180 | return nested_cpu_has2(vmcs12, SECONDARY_EXEC_ENABLE_EPT); | 186 | return nested_cpu_has2(vmcs12, SECONDARY_EXEC_ENABLE_EPT); |
| @@ -64,11 +64,13 @@ · 63 unmodified lines | |||
| 64 | MODULE_AUTHOR("Qumranet"); | 64 | MODULE_AUTHOR("Qumranet"); |
| 65 | MODULE_LICENSE("GPL"); | 65 | MODULE_LICENSE("GPL"); |
| 66 | 66 | ||
| 67 | #ifdef MODULE | ||
| 67 | static const struct x86_cpu_id vmx_cpu_id[] = { | 68 | static const struct x86_cpu_id vmx_cpu_id[] = { |
| 68 | X86_FEATURE_MATCH(X86_FEATURE_VMX), | 69 | X86_FEATURE_MATCH(X86_FEATURE_VMX), |
| 69 | {} | 70 | {} |
| 70 | }; | 71 | }; |
| 71 | MODULE_DEVICE_TABLE(x86cpu, vmx_cpu_id); | 72 | MODULE_DEVICE_TABLE(x86cpu, vmx_cpu_id); |
| 73 | #endif | ||
| 72 | 74 | ||
| 73 | bool __read_mostly enable_vpid = 1; | 75 | bool __read_mostly enable_vpid = 1; |
| 74 | module_param_named(vpid, enable_vpid, bool, 0444); | 76 | module_param_named(vpid, enable_vpid, bool, 0444); |
| @@ -95,7 +97,7 @@ module_param(emulate_invalid_guest_state, bool, S_IRUGO); · 20 unmodified lines | |||
| 95 | static bool __read_mostly fasteoi = 1; | 97 | static bool __read_mostly fasteoi = 1; |
| 96 | module_param(fasteoi, bool, S_IRUGO); | 98 | module_param(fasteoi, bool, S_IRUGO); |
| 97 | 99 | ||
| 98 | static bool __read_mostly enable_apicv = 1; | 100 | bool __read_mostly enable_apicv = 1; |
| 99 | module_param(enable_apicv, bool, S_IRUGO); | 101 | module_param(enable_apicv, bool, S_IRUGO); |
| 100 | 102 | ||
| 101 | /* | 103 | /* |
| @@ -1175,6 +1177,10 @@ void vmx_prepare_switch_to_guest(struct kvm_vcpu *vcpu) · 1073 unmodified lines | |||
| 1175 | vmx->guest_msrs[i].mask); | 1177 | vmx->guest_msrs[i].mask); |
| 1176 | 1178 | ||
| 1177 | } | 1179 | } |
| 1180 | |||
| 1181 | if (vmx->nested.need_vmcs12_to_shadow_sync) | ||
| 1182 | nested_sync_vmcs12_to_shadow(vcpu); | ||
| 1183 | |||
| 1178 | if (vmx->guest_state_loaded) | 1184 | if (vmx->guest_state_loaded) |
| 1179 | return; | 1185 | return; |
| 1180 | 1186 | ||
| @@ -1599,6 +1605,40 @@ static int skip_emulated_instruction(struct kvm_vcpu *vcpu) · 418 unmodified lines | |||
| 1599 | return 1; | 1605 | return 1; |
| 1600 | } | 1606 | } |
| 1601 | 1607 | ||
| 1608 | |||
| 1609 | /* | ||
| 1610 | * Recognizes a pending MTF VM-exit and records the nested state for later | ||
| 1611 | * delivery. | ||
| 1612 | */ | ||
| 1613 | static void vmx_update_emulated_instruction(struct kvm_vcpu *vcpu) | ||
| 1614 | { | ||
| 1615 | struct vmcs12 *vmcs12 = get_vmcs12(vcpu); | ||
| 1616 | struct vcpu_vmx *vmx = to_vmx(vcpu); | ||
| 1617 | |||
| 1618 | if (!is_guest_mode(vcpu)) | ||
| 1619 | return; | ||
| 1620 | |||
| 1621 | /* | ||
| 1622 | * Per the SDM, MTF takes priority over debug-trap exceptions besides | ||
| 1623 | * T-bit traps. As instruction emulation is completed (i.e. at the | ||
| 1624 | * instruction boundary), any #DB exception pending delivery must be a | ||
| 1625 | * debug-trap. Record the pending MTF state to be delivered in | ||
| 1626 | * vmx_check_nested_events(). | ||
| 1627 | */ | ||
| 1628 | if (nested_cpu_has_mtf(vmcs12) && | ||
| 1629 | (!vcpu->arch.exception.pending || | ||
| 1630 | vcpu->arch.exception.nr == DB_VECTOR)) | ||
| 1631 | vmx->nested.mtf_pending = true; | ||
| 1632 | else | ||
| 1633 | vmx->nested.mtf_pending = false; | ||
| 1634 | } | ||
| 1635 | |||
| 1636 | static int vmx_skip_emulated_instruction(struct kvm_vcpu *vcpu) | ||
| 1637 | { | ||
| 1638 | vmx_update_emulated_instruction(vcpu); | ||
| 1639 | return skip_emulated_instruction(vcpu); | ||
| 1640 | } | ||
| 1641 | |||
| 1602 | static void vmx_clear_hlt(struct kvm_vcpu *vcpu) | 1642 | static void vmx_clear_hlt(struct kvm_vcpu *vcpu) |
| 1603 | { | 1643 | { |
| 1604 | /* | 1644 | /* |
| @@ -2947,6 +2987,9 @@ void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) · 1342 unmodified lines | |||
| 2947 | 2987 | ||
| 2948 | static int get_ept_level(struct kvm_vcpu *vcpu) | 2988 | static int get_ept_level(struct kvm_vcpu *vcpu) |
| 2949 | { | 2989 | { |
| 2990 | /* Nested EPT currently only supports 4-level walks. */ | ||
| 2991 | if (is_guest_mode(vcpu) && nested_cpu_has_ept(get_vmcs12(vcpu))) | ||
| 2992 | return 4; | ||
| 2950 | if (cpu_has_vmx_ept_5levels() && (cpuid_maxphyaddr(vcpu) > 48)) | 2993 | if (cpu_has_vmx_ept_5levels() && (cpuid_maxphyaddr(vcpu) > 48)) |
| 2951 | return 5; | 2994 | return 5; |
| 2952 | return 4; | 2995 | return 4; |
| @@ -3815,24 +3858,29 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, · 862 unmodified lines | |||
| 3815 | * 2. If target vcpu isn't running(root mode), kick it to pick up the | 3858 | * 2. If target vcpu isn't running(root mode), kick it to pick up the |
| 3816 | * interrupt from PIR in next vmentry. | 3859 | * interrupt from PIR in next vmentry. |
| 3817 | */ | 3860 | */ |
| 3818 | static void vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) | 3861 | static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) |
| 3819 | { | 3862 | { |
| 3820 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 3863 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
| 3821 | int r; | 3864 | int r; |
| 3822 | 3865 | ||
| 3823 | r = vmx_deliver_nested_posted_interrupt(vcpu, vector); | 3866 | r = vmx_deliver_nested_posted_interrupt(vcpu, vector); |
| 3824 | if (!r) | 3867 | if (!r) |
| 3825 | return; | 3868 | return 0; |
| 3869 | |||
| 3870 | if (!vcpu->arch.apicv_active) | ||
| 3871 | return -1; | ||
| 3826 | 3872 | ||
| 3827 | if (pi_test_and_set_pir(vector, &vmx->pi_desc)) | 3873 | if (pi_test_and_set_pir(vector, &vmx->pi_desc)) |
| 3828 | return; | 3874 | return 0; |
| 3829 | 3875 | ||
| 3830 | /* If a previous notification has sent the IPI, nothing to do. */ | 3876 | /* If a previous notification has sent the IPI, nothing to do. */ |
| 3831 | if (pi_test_and_set_on(&vmx->pi_desc)) | 3877 | if (pi_test_and_set_on(&vmx->pi_desc)) |
| 3832 | return; | 3878 | return 0; |
| 3833 | 3879 | ||
| 3834 | if (!kvm_vcpu_trigger_posted_interrupt(vcpu, false)) | 3880 | if (!kvm_vcpu_trigger_posted_interrupt(vcpu, false)) |
| 3835 | kvm_vcpu_kick(vcpu); | 3881 | kvm_vcpu_kick(vcpu); |
| 3882 | |||
| 3883 | return 0; | ||
| 3836 | } | 3884 | } |
| 3837 | 3885 | ||
| 3838 | /* | 3886 | /* |
| @@ -4238,7 +4286,6 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) · 399 unmodified lines | |||
| 4238 | 4286 | ||
| 4239 | vmx->msr_ia32_umwait_control = 0; | 4287 | vmx->msr_ia32_umwait_control = 0; |
| 4240 | 4288 | ||
| 4241 | vcpu->arch.microcode_version = 0x100000000ULL; | ||
| 4242 | vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val(); | 4289 | vmx->vcpu.arch.regs[VCPU_REGS_RDX] = get_rdx_init_val(); |
| 4243 | vmx->hv_deadline_tsc = -1; | 4290 | vmx->hv_deadline_tsc = -1; |
| 4244 | kvm_set_cr8(vcpu, 0); | 4291 | kvm_set_cr8(vcpu, 0); |
| @@ -6480,8 +6527,11 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) · 2235 unmodified lines | |||
| 6480 | vmcs_write32(PLE_WINDOW, vmx->ple_window); | 6527 | vmcs_write32(PLE_WINDOW, vmx->ple_window); |
| 6481 | } | 6528 | } |
| 6482 | 6529 | ||
| 6483 | if (vmx->nested.need_vmcs12_to_shadow_sync) | 6530 | /* |
| 6484 | nested_sync_vmcs12_to_shadow(vcpu); | 6531 | * We did this in prepare_switch_to_guest, because it needs to |
| 6532 | * be within srcu_read_lock. | ||
| 6533 | */ | ||
| 6534 | WARN_ON_ONCE(vmx->nested.need_vmcs12_to_shadow_sync); | ||
| 6485 | 6535 | ||
| 6486 | if (kvm_register_is_dirty(vcpu, VCPU_REGS_RSP)) | 6536 | if (kvm_register_is_dirty(vcpu, VCPU_REGS_RSP)) |
| 6487 | vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]); | 6537 | vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]); |
| @@ -6755,14 +6805,14 @@ static int vmx_create_vcpu(struct kvm_vcpu *vcpu) · 267 unmodified lines | |||
| 6755 | 6805 | ||
| 6756 | if (nested) | 6806 | if (nested) |
| 6757 | nested_vmx_setup_ctls_msrs(&vmx->nested.msrs, | 6807 | nested_vmx_setup_ctls_msrs(&vmx->nested.msrs, |
| 6758 | vmx_capability.ept, | 6808 | vmx_capability.ept); |
| 6759 | kvm_vcpu_apicv_active(vcpu)); | ||
| 6760 | else | 6809 | else |
| 6761 | memset(&vmx->nested.msrs, 0, sizeof(vmx->nested.msrs)); | 6810 | memset(&vmx->nested.msrs, 0, sizeof(vmx->nested.msrs)); |
| 6762 | 6811 | ||
| 6763 | vmx->nested.posted_intr_nv = -1; | 6812 | vmx->nested.posted_intr_nv = -1; |
| 6764 | vmx->nested.current_vmptr = -1ull; | 6813 | vmx->nested.current_vmptr = -1ull; |
| 6765 | 6814 | ||
| 6815 | vcpu->arch.microcode_version = 0x100000000ULL; | ||
| 6766 | vmx->msr_ia32_feature_control_valid_bits = FEAT_CTL_LOCKED; | 6816 | vmx->msr_ia32_feature_control_valid_bits = FEAT_CTL_LOCKED; |
| 6767 | 6817 | ||
| 6768 | /* | 6818 | /* |
| @@ -6836,8 +6886,7 @@ static int __init vmx_check_processor_compat(void) · 67 unmodified lines | |||
| 6836 | if (setup_vmcs_config(&vmcs_conf, &vmx_cap) < 0) | 6886 | if (setup_vmcs_config(&vmcs_conf, &vmx_cap) < 0) |
| 6837 | return -EIO; | 6887 | return -EIO; |
| 6838 | if (nested) | 6888 | if (nested) |
| 6839 | nested_vmx_setup_ctls_msrs(&vmcs_conf.nested, vmx_cap.ept, | 6889 | nested_vmx_setup_ctls_msrs(&vmcs_conf.nested, vmx_cap.ept); |
| 6840 | enable_apicv); | ||
| 6841 | if (memcmp(&vmcs_config, &vmcs_conf, sizeof(struct vmcs_config)) != 0) { | 6890 | if (memcmp(&vmcs_config, &vmcs_conf, sizeof(struct vmcs_config)) != 0) { |
| 6842 | printk(KERN_ERR "kvm: CPU %d feature inconsistency!\n", | 6891 | printk(KERN_ERR "kvm: CPU %d feature inconsistency!\n", |
| 6843 | smp_processor_id()); | 6892 | smp_processor_id()); |
| @@ -7098,6 +7147,40 @@ static void vmx_request_immediate_exit(struct kvm_vcpu *vcpu) · 254 unmodified lines | |||
| 7098 | to_vmx(vcpu)->req_immediate_exit = true; | 7147 | to_vmx(vcpu)->req_immediate_exit = true; |
| 7099 | } | 7148 | } |
| 7100 | 7149 | ||
| 7150 | static int vmx_check_intercept_io(struct kvm_vcpu *vcpu, | ||
| 7151 | struct x86_instruction_info *info) | ||
| 7152 | { | ||
| 7153 | struct vmcs12 *vmcs12 = get_vmcs12(vcpu); | ||
| 7154 | unsigned short port; | ||
| 7155 | bool intercept; | ||
| 7156 | int size; | ||
| 7157 | |||
| 7158 | if (info->intercept == x86_intercept_in || | ||
| 7159 | info->intercept == x86_intercept_ins) { | ||
| 7160 | port = info->src_val; | ||
| 7161 | size = info->dst_bytes; | ||
| 7162 | } else { | ||
| 7163 | port = info->dst_val; | ||
| 7164 | size = info->src_bytes; | ||
| 7165 | } | ||
| 7166 | |||
| 7167 | /* | ||
| 7168 | * If the 'use IO bitmaps' VM-execution control is 0, IO instruction | ||
| 7169 | * VM-exits depend on the 'unconditional IO exiting' VM-execution | ||
| 7170 | * control. | ||
| 7171 | * | ||
| 7172 | * Otherwise, IO instruction VM-exits are controlled by the IO bitmaps. | ||
| 7173 | */ | ||
| 7174 | if (!nested_cpu_has(vmcs12, CPU_BASED_USE_IO_BITMAPS)) | ||
| 7175 | intercept = nested_cpu_has(vmcs12, | ||
| 7176 | CPU_BASED_UNCOND_IO_EXITING); | ||
| 7177 | else | ||
| 7178 | intercept = nested_vmx_check_io_bitmaps(vcpu, port, size); | ||
| 7179 | |||
| 7180 | /* FIXME: produce nested vmexit and return X86EMUL_INTERCEPTED. */ | ||
| 7181 | return intercept ? X86EMUL_UNHANDLEABLE : X86EMUL_CONTINUE; | ||
| 7182 | } | ||
| 7183 | |||
| 7101 | static int vmx_check_intercept(struct kvm_vcpu *vcpu, | 7184 | static int vmx_check_intercept(struct kvm_vcpu *vcpu, |
| 7102 | struct x86_instruction_info *info, | 7185 | struct x86_instruction_info *info, |
| 7103 | enum x86_intercept_stage stage) | 7186 | enum x86_intercept_stage stage) |
| @@ -7105,19 +7188,45 @@ static int vmx_check_intercept(struct kvm_vcpu *vcpu, · 1 unmodified line | |||
| 7105 | struct vmcs12 *vmcs12 = get_vmcs12(vcpu); | 7188 | struct vmcs12 *vmcs12 = get_vmcs12(vcpu); |
| 7106 | struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt; | 7189 | struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt; |
| 7107 | 7190 | ||
| 7191 | switch (info->intercept) { | ||
| 7108 | /* | 7192 | /* |
| 7109 | * RDPID causes #UD if disabled through secondary execution controls. | 7193 | * RDPID causes #UD if disabled through secondary execution controls. |
| 7110 | * Because it is marked as EmulateOnUD, we need to intercept it here. | 7194 | * Because it is marked as EmulateOnUD, we need to intercept it here. |
| 7111 | */ | 7195 | */ |
| 7112 | if (info->intercept == x86_intercept_rdtscp && | 7196 | case x86_intercept_rdtscp: |
| 7113 | !nested_cpu_has2(vmcs12, SECONDARY_EXEC_RDTSCP)) { | 7197 | if (!nested_cpu_has2(vmcs12, SECONDARY_EXEC_RDTSCP)) { |
| 7114 | ctxt->exception.vector = UD_VECTOR; | 7198 | ctxt->exception.vector = UD_VECTOR; |
| 7115 | ctxt->exception.error_code_valid = false; | 7199 | ctxt->exception.error_code_valid = false; |
| 7116 | return X86EMUL_PROPAGATE_FAULT; | 7200 | return X86EMUL_PROPAGATE_FAULT; |
| 7117 | } | 7201 | } |
| 7202 | break; | ||
| 7203 | |||
| 7204 | case x86_intercept_in: | ||
| 7205 | case x86_intercept_ins: | ||
| 7206 | case x86_intercept_out: | ||
| 7207 | case x86_intercept_outs: | ||
| 7208 | return vmx_check_intercept_io(vcpu, info); | ||
| 7209 | |||
| 7210 | case x86_intercept_lgdt: | ||
| 7211 | case x86_intercept_lidt: | ||
| 7212 | case x86_intercept_lldt: | ||
| 7213 | case x86_intercept_ltr: | ||
| 7214 | case x86_intercept_sgdt: | ||
| 7215 | case x86_intercept_sidt: | ||
| 7216 | case x86_intercept_sldt: | ||
| 7217 | case x86_intercept_str: | ||
| 7218 | if (!nested_cpu_has2(vmcs12, SECONDARY_EXEC_DESC)) | ||
| 7219 | return X86EMUL_CONTINUE; | ||
| 7220 | |||
| 7221 | /* FIXME: produce nested vmexit and return X86EMUL_INTERCEPTED. */ | ||
| 7222 | break; | ||
| 7118 | 7223 | ||
| 7119 | /* TODO: check more intercepts... */ | 7224 | /* TODO: check more intercepts... */ |
| 7120 | return X86EMUL_CONTINUE; | 7225 | default: |
| 7226 | break; | ||
| 7227 | } | ||
| 7228 | |||
| 7229 | return X86EMUL_UNHANDLEABLE; | ||
| 7121 | } | 7230 | } |
| 7122 | 7231 | ||
| 7123 | #ifdef CONFIG_X86_64 | 7232 | #ifdef CONFIG_X86_64 |
| @@ -7699,7 +7808,7 @@ static __init int hardware_setup(void) · 575 unmodified lines | |||
| 7699 | 7808 | ||
| 7700 | if (nested) { | 7809 | if (nested) { |
| 7701 | nested_vmx_setup_ctls_msrs(&vmcs_config.nested, | 7810 | nested_vmx_setup_ctls_msrs(&vmcs_config.nested, |
| 7702 | vmx_capability.ept, enable_apicv); | 7811 | vmx_capability.ept); |
| 7703 | 7812 | ||
| 7704 | r = nested_vmx_hardware_setup(kvm_vmx_exit_handlers); | 7813 | r = nested_vmx_hardware_setup(kvm_vmx_exit_handlers); |
| 7705 | if (r) | 7814 | if (r) |
| @@ -7783,7 +7892,8 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = { · 77 unmodified lines | |||
| 7783 | 7892 | ||
| 7784 | .run = vmx_vcpu_run, | 7893 | .run = vmx_vcpu_run, |
| 7785 | .handle_exit = vmx_handle_exit, | 7894 | .handle_exit = vmx_handle_exit, |
| 7786 | .skip_emulated_instruction = skip_emulated_instruction, | 7895 | .skip_emulated_instruction = vmx_skip_emulated_instruction, |
| 7896 | .update_emulated_instruction = vmx_update_emulated_instruction, | ||
| 7787 | .set_interrupt_shadow = vmx_set_interrupt_shadow, | 7897 | .set_interrupt_shadow = vmx_set_interrupt_shadow, |
| 7788 | .get_interrupt_shadow = vmx_get_interrupt_shadow, | 7898 | .get_interrupt_shadow = vmx_get_interrupt_shadow, |
| 7789 | .patch_hypercall = vmx_patch_hypercall, | 7899 | .patch_hypercall = vmx_patch_hypercall, |
| @@ -150,6 +150,9 @@ struct nested_vmx { · 149 unmodified lines | |||
| 150 | /* L2 must run next, and mustn't decide to exit to L1. */ | 150 | /* L2 must run next, and mustn't decide to exit to L1. */ |
| 151 | bool nested_run_pending; | 151 | bool nested_run_pending; |
| 152 | 152 | ||
| 153 | /* Pending MTF VM-exit into L1. */ | ||
| 154 | bool mtf_pending; | ||
| 155 | |||
| 153 | struct loaded_vmcs vmcs02; | 156 | struct loaded_vmcs vmcs02; |
| 154 | 157 | ||
| 155 | /* | 158 | /* |
| @@ -438,6 +438,14 @@ void kvm_deliver_exception_payload(struct kvm_vcpu *vcpu) · 437 unmodified lines | |||
| 438 | * for #DB exceptions under VMX. | 438 | * for #DB exceptions under VMX. |
| 439 | */ | 439 | */ |
| 440 | vcpu->arch.dr6 ^= payload & DR6_RTM; | 440 | vcpu->arch.dr6 ^= payload & DR6_RTM; |
| 441 | |||
| 442 | /* | ||
| 443 | * The #DB payload is defined as compatible with the 'pending | ||
| 444 | * debug exceptions' field under VMX, not DR6. While bit 12 is | ||
| 445 | * defined in the 'pending debug exceptions' field (enabled | ||
| 446 | * breakpoint), it is reserved and must be zero in DR6. | ||
| 447 | */ | ||
| 448 | vcpu->arch.dr6 &= ~BIT(12); | ||
| 441 | break; | 449 | break; |
| 442 | case PF_VECTOR: | 450 | case PF_VECTOR: |
| 443 | vcpu->arch.cr2 = payload; | 451 | vcpu->arch.cr2 = payload; |
| @@ -490,19 +498,7 @@ static void kvm_multiple_exception(struct kvm_vcpu *vcpu, · 46 unmodified lines | |||
| 490 | vcpu->arch.exception.error_code = error_code; | 498 | vcpu->arch.exception.error_code = error_code; |
| 491 | vcpu->arch.exception.has_payload = has_payload; | 499 | vcpu->arch.exception.has_payload = has_payload; |
| 492 | vcpu->arch.exception.payload = payload; | 500 | vcpu->arch.exception.payload = payload; |
| 493 | /* | 501 | if (!is_guest_mode(vcpu)) |
| 494 | * In guest mode, payload delivery should be deferred, | ||
| 495 | * so that the L1 hypervisor can intercept #PF before | ||
| 496 | * CR2 is modified (or intercept #DB before DR6 is | ||
| 497 | * modified under nVMX). However, for ABI | ||
| 498 | * compatibility with KVM_GET_VCPU_EVENTS and | ||
| 499 | * KVM_SET_VCPU_EVENTS, we can't delay payload | ||
| 500 | * delivery unless userspace has enabled this | ||
| 501 | * functionality via the per-VM capability, | ||
| 502 | * KVM_CAP_EXCEPTION_PAYLOAD. | ||
| 503 | */ | ||
| 504 | if (!vcpu->kvm->arch.exception_payload_enabled || | ||
| 505 | !is_guest_mode(vcpu)) | ||
| 506 | kvm_deliver_exception_payload(vcpu); | 502 | kvm_deliver_exception_payload(vcpu); |
| 507 | return; | 503 | return; |
| 508 | } | 504 | } |
| @@ -2448,7 +2444,7 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) · 1939 unmodified lines | |||
| 2448 | vcpu->hv_clock.tsc_timestamp = tsc_timestamp; | 2444 | vcpu->hv_clock.tsc_timestamp = tsc_timestamp; |
| 2449 | vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset; | 2445 | vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset; |
| 2450 | vcpu->last_guest_tsc = tsc_timestamp; | 2446 | vcpu->last_guest_tsc = tsc_timestamp; |
| 2451 | WARN_ON(vcpu->hv_clock.system_time < 0); | 2447 | WARN_ON((s64)vcpu->hv_clock.system_time < 0); |
| 2452 | 2448 | ||
| 2453 | /* If the host uses TSC clocksource, then it is stable */ | 2449 | /* If the host uses TSC clocksource, then it is stable */ |
| 2454 | pvclock_flags = 0; | 2450 | pvclock_flags = 0; |
| @@ -3795,6 +3791,21 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, · 1340 unmodified lines | |||
| 3795 | { | 3791 | { |
| 3796 | process_nmi(vcpu); | 3792 | process_nmi(vcpu); |
| 3797 | 3793 | ||
| 3794 | /* | ||
| 3795 | * In guest mode, payload delivery should be deferred, | ||
| 3796 | * so that the L1 hypervisor can intercept #PF before | ||
| 3797 | * CR2 is modified (or intercept #DB before DR6 is | ||
| 3798 | * modified under nVMX). Unless the per-VM capability, | ||
| 3799 | * KVM_CAP_EXCEPTION_PAYLOAD, is set, we may not defer the delivery of | ||
| 3800 | * an exception payload and handle after a KVM_GET_VCPU_EVENTS. Since we | ||
| 3801 | * opportunistically defer the exception payload, deliver it if the | ||
| 3802 | * capability hasn't been requested before processing a | ||
| 3803 | * KVM_GET_VCPU_EVENTS. | ||
| 3804 | */ | ||
| 3805 | if (!vcpu->kvm->arch.exception_payload_enabled && | ||
| 3806 | vcpu->arch.exception.pending && vcpu->arch.exception.has_payload) | ||
| 3807 | kvm_deliver_exception_payload(vcpu); | ||
| 3808 | |||
| 3798 | /* | 3809 | /* |
| 3799 | * The API doesn't provide the instruction length for software | 3810 | * The API doesn't provide the instruction length for software |
| 3800 | * exceptions, so don't report them. As long as the guest RIP | 3811 | * exceptions, so don't report them. As long as the guest RIP |
| @@ -6880,6 +6891,8 @@ restart: · 3079 unmodified lines | |||
| 6880 | kvm_rip_write(vcpu, ctxt->eip); | 6891 | kvm_rip_write(vcpu, ctxt->eip); |
| 6881 | if (r && ctxt->tf) | 6892 | if (r && ctxt->tf) |
| 6882 | r = kvm_vcpu_do_singlestep(vcpu); | 6893 | r = kvm_vcpu_do_singlestep(vcpu); |
| 6894 | if (kvm_x86_ops->update_emulated_instruction) | ||
| 6895 | kvm_x86_ops->update_emulated_instruction(vcpu); | ||
| 6883 | __kvm_set_rflags(vcpu, ctxt->eflags); | 6896 | __kvm_set_rflags(vcpu, ctxt->eflags); |
| 6884 | } | 6897 | } |
| 6885 | 6898 | ||
| @@ -7177,15 +7190,15 @@ static void kvm_timer_init(void) · 291 unmodified lines | |||
| 7177 | 7190 | ||
| 7178 | if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) { | 7191 | if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) { |
| 7179 | #ifdef CONFIG_CPU_FREQ | 7192 | #ifdef CONFIG_CPU_FREQ |
| 7180 | struct cpufreq_policy policy; | 7193 | struct cpufreq_policy *policy; |
| 7181 | int cpu; | 7194 | int cpu; |
| 7182 | 7195 | ||
| 7183 | memset(&policy, 0, sizeof(policy)); | ||
| 7184 | cpu = get_cpu(); | 7196 | cpu = get_cpu(); |
| 7185 | cpufreq_get_policy(&policy, cpu); | 7197 | policy = cpufreq_cpu_get(cpu); |
| 7186 | if (policy.cpuinfo.max_freq) | 7198 | if (policy && policy->cpuinfo.max_freq) |
| 7187 | max_tsc_khz = policy.cpuinfo.max_freq; | 7199 | max_tsc_khz = policy->cpuinfo.max_freq; |
| 7188 | put_cpu(); | 7200 | put_cpu(); |
| 7201 | cpufreq_cpu_put(policy); | ||
| 7189 | #endif | 7202 | #endif |
| 7190 | cpufreq_register_notifier(&kvmclock_cpufreq_notifier_block, | 7203 | cpufreq_register_notifier(&kvmclock_cpufreq_notifier_block, |
| 7191 | CPUFREQ_TRANSITION_NOTIFIER); | 7204 | CPUFREQ_TRANSITION_NOTIFIER); |
| @@ -7295,12 +7308,12 @@ int kvm_arch_init(void *opaque) · 103 unmodified lines | |||
| 7295 | } | 7308 | } |
| 7296 | 7309 | ||
| 7297 | if (!ops->cpu_has_kvm_support()) { | 7310 | if (!ops->cpu_has_kvm_support()) { |
| 7298 | printk(KERN_ERR "kvm: no hardware support\n"); | 7311 | pr_err_ratelimited("kvm: no hardware support\n"); |
| 7299 | r = -EOPNOTSUPP; | 7312 | r = -EOPNOTSUPP; |
| 7300 | goto out; | 7313 | goto out; |
| 7301 | } | 7314 | } |
| 7302 | if (ops->disabled_by_bios()) { | 7315 | if (ops->disabled_by_bios()) { |
| 7303 | printk(KERN_ERR "kvm: disabled by bios\n"); | 7316 | pr_err_ratelimited("kvm: disabled by bios\n"); |
| 7304 | r = -EOPNOTSUPP; | 7317 | r = -EOPNOTSUPP; |
| 7305 | goto out; | 7318 | goto out; |
| 7306 | } | 7319 | } |
| @@ -8942,7 +8955,6 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int idt_index, · 1635 unmodified lines | |||
| 8942 | 8955 | ||
| 8943 | kvm_rip_write(vcpu, ctxt->eip); | 8956 | kvm_rip_write(vcpu, ctxt->eip); |
| 8944 | kvm_set_rflags(vcpu, ctxt->eflags); | 8957 | kvm_set_rflags(vcpu, ctxt->eflags); |
| 8945 | kvm_make_request(KVM_REQ_EVENT, vcpu); | ||
| 8946 | return 1; | 8958 | return 1; |
| 8947 | } | 8959 | } |
| 8948 | EXPORT_SYMBOL_GPL(kvm_task_switch); | 8960 | EXPORT_SYMBOL_GPL(kvm_task_switch); |
| @@ -10182,7 +10194,7 @@ void kvm_arch_async_page_ready(struct kvm_vcpu *vcpu, struct kvm_async_pf *work) · 1233 unmodified lines | |||
| 10182 | work->arch.cr3 != vcpu->arch.mmu->get_cr3(vcpu)) | 10194 | work->arch.cr3 != vcpu->arch.mmu->get_cr3(vcpu)) |
| 10183 | return; | 10195 | return; |
| 10184 | 10196 | ||
| 10185 | vcpu->arch.mmu->page_fault(vcpu, work->cr2_or_gpa, 0, true); | 10197 | kvm_mmu_do_page_fault(vcpu, work->cr2_or_gpa, 0, true); |
| 10186 | } | 10198 | } |
| 10187 | 10199 | ||
| 10188 | static inline u32 kvm_async_pf_hash_fn(gfn_t gfn) | 10200 | static inline u32 kvm_async_pf_hash_fn(gfn_t gfn) |
| @@ -363,13 +363,8 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m, · 362 unmodified lines | |||
| 363 | { | 363 | { |
| 364 | const struct ptdump_range ptdump_ranges[] = { | 364 | const struct ptdump_range ptdump_ranges[] = { |
| 365 | #ifdef CONFIG_X86_64 | 365 | #ifdef CONFIG_X86_64 |
| 366 | |||
| 367 | #define normalize_addr_shift (64 - (__VIRTUAL_MASK_SHIFT + 1)) | ||
| 368 | #define normalize_addr(u) ((signed long)((u) << normalize_addr_shift) >> \ | ||
| 369 | normalize_addr_shift) | ||
| 370 | |||
| 371 | {0, PTRS_PER_PGD * PGD_LEVEL_MULT / 2}, | 366 | {0, PTRS_PER_PGD * PGD_LEVEL_MULT / 2}, |
| 372 | {normalize_addr(PTRS_PER_PGD * PGD_LEVEL_MULT / 2), ~0UL}, | 367 | {GUARD_HOLE_END_ADDR, ~0UL}, |
| 373 | #else | 368 | #else |
| 374 | {0, ~0UL}, | 369 | {0, ~0UL}, |
| 375 | #endif | 370 | #endif |
| @@ -180,7 +180,7 @@ void efi_sync_low_kernel_mappings(void) · 179 unmodified lines | |||
| 180 | static inline phys_addr_t | 180 | static inline phys_addr_t |
| 181 | virt_to_phys_or_null_size(void *va, unsigned long size) | 181 | virt_to_phys_or_null_size(void *va, unsigned long size) |
| 182 | { | 182 | { |
| 183 | bool bad_size; | 183 | phys_addr_t pa; |
| 184 | 184 | ||
| 185 | if (!va) | 185 | if (!va) |
| 186 | return 0; | 186 | return 0; |
| @@ -188,16 +188,13 @@ virt_to_phys_or_null_size(void *va, unsigned long size) · 1 unmodified line | |||
| 188 | if (virt_addr_valid(va)) | 188 | if (virt_addr_valid(va)) |
| 189 | return virt_to_phys(va); | 189 | return virt_to_phys(va); |
| 190 | 190 | ||
| 191 | /* | 191 | pa = slow_virt_to_phys(va); |
| 192 | * A fully aligned variable on the stack is guaranteed not to | ||
| 193 | * cross a page bounary. Try to catch strings on the stack by | ||
| 194 | * checking that 'size' is a power of two. | ||
| 195 | */ | ||
| 196 | bad_size = size > PAGE_SIZE || !is_power_of_2(size); | ||
| 197 | 192 | ||
| 198 | WARN_ON(!IS_ALIGNED((unsigned long)va, size) || bad_size); | 193 | /* check if the object crosses a page boundary */ |
| 194 | if (WARN_ON((pa ^ (pa + size - 1)) & PAGE_MASK)) | ||
| 195 | return 0; | ||
| 199 | 196 | ||
| 200 | return slow_virt_to_phys(va); | 197 | return pa; |
| 201 | } | 198 | } |
| 202 | 199 | ||
| 203 | #define virt_to_phys_or_null(addr) \ | 200 | #define virt_to_phys_or_null(addr) \ |
| @@ -568,85 +565,25 @@ efi_thunk_set_virtual_address_map(unsigned long memory_map_size, · 364 unmodified lines | |||
| 568 | 565 | ||
| 569 | static efi_status_t efi_thunk_get_time(efi_time_t *tm, efi_time_cap_t *tc) | 566 | static efi_status_t efi_thunk_get_time(efi_time_t *tm, efi_time_cap_t *tc) |
| 570 | { | 567 | { |
| 571 | efi_status_t status; | 568 | return EFI_UNSUPPORTED; |
| 572 | u32 phys_tm, phys_tc; | ||
| 573 | unsigned long flags; | ||
| 574 | |||
| 575 | spin_lock(&rtc_lock); | ||
| 576 | spin_lock_irqsave(&efi_runtime_lock, flags); | ||
| 577 | |||
| 578 | phys_tm = virt_to_phys_or_null(tm); | ||
| 579 | phys_tc = virt_to_phys_or_null(tc); | ||
| 580 | |||
| 581 | status = efi_thunk(get_time, phys_tm, phys_tc); | ||
| 582 | |||
| 583 | spin_unlock_irqrestore(&efi_runtime_lock, flags); | ||
| 584 | spin_unlock(&rtc_lock); | ||
| 585 | |||
| 586 | return status; | ||
| 587 | } | 569 | } |
| 588 | 570 | ||
| 589 | static efi_status_t efi_thunk_set_time(efi_time_t *tm) | 571 | static efi_status_t efi_thunk_set_time(efi_time_t *tm) |
| 590 | { | 572 | { |
| 591 | efi_status_t status; | 573 | return EFI_UNSUPPORTED; |
| 592 | u32 phys_tm; | ||
| 593 | unsigned long flags; | ||
| 594 | |||
| 595 | spin_lock(&rtc_lock); | ||
| 596 | spin_lock_irqsave(&efi_runtime_lock, flags); | ||
| 597 | |||
| 598 | phys_tm = virt_to_phys_or_null(tm); | ||
| 599 | |||
| 600 | status = efi_thunk(set_time, phys_tm); | ||
| 601 | |||
| 602 | spin_unlock_irqrestore(&efi_runtime_lock, flags); | ||
| 603 | spin_unlock(&rtc_lock); | ||
| 604 | |||
| 605 | return status; | ||
| 606 | } | 574 | } |
| 607 | 575 | ||
| 608 | static efi_status_t | 576 | static efi_status_t |
| 609 | efi_thunk_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, | 577 | efi_thunk_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, |
| 610 | efi_time_t *tm) | 578 | efi_time_t *tm) |
| 611 | { | 579 | { |
| 612 | efi_status_t status; | 580 | return EFI_UNSUPPORTED; |
| 613 | u32 phys_enabled, phys_pending, phys_tm; | ||
| 614 | unsigned long flags; | ||
| 615 | |||
| 616 | spin_lock(&rtc_lock); | ||
| 617 | spin_lock_irqsave(&efi_runtime_lock, flags); | ||
| 618 | |||
| 619 | phys_enabled = virt_to_phys_or_null(enabled); | ||
| 620 | phys_pending = virt_to_phys_or_null(pending); | ||
| 621 | phys_tm = virt_to_phys_or_null(tm); | ||
| 622 | |||
| 623 | status = efi_thunk(get_wakeup_time, phys_enabled, | ||
| 624 | phys_pending, phys_tm); | ||
| 625 | |||
| 626 | spin_unlock_irqrestore(&efi_runtime_lock, flags); | ||
| 627 | spin_unlock(&rtc_lock); | ||
| 628 | |||
| 629 | return status; | ||
| 630 | } | 581 | } |
| 631 | 582 | ||
| 632 | static efi_status_t | 583 | static efi_status_t |
| 633 | efi_thunk_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) | 584 | efi_thunk_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) |
| 634 | { | 585 | { |
| 635 | efi_status_t status; | 586 | return EFI_UNSUPPORTED; |
| 636 | u32 phys_tm; | ||
| 637 | unsigned long flags; | ||
| 638 | |||
| 639 | spin_lock(&rtc_lock); | ||
| 640 | spin_lock_irqsave(&efi_runtime_lock, flags); | ||
| 641 | |||
| 642 | phys_tm = virt_to_phys_or_null(tm); | ||
| 643 | |||
| 644 | status = efi_thunk(set_wakeup_time, enabled, phys_tm); | ||
| 645 | |||
| 646 | spin_unlock_irqrestore(&efi_runtime_lock, flags); | ||
| 647 | spin_unlock(&rtc_lock); | ||
| 648 | |||
| 649 | return status; | ||
| 650 | } | 587 | } |
| 651 | 588 | ||
| 652 | static unsigned long efi_name_size(efi_char16_t *name) | 589 | static unsigned long efi_name_size(efi_char16_t *name) |
| @@ -658,6 +595,8 @@ static efi_status_t · 5 unmodified lines | |||
| 658 | efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor, | 595 | efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor, |
| 659 | u32 *attr, unsigned long *data_size, void *data) | 596 | u32 *attr, unsigned long *data_size, void *data) |
| 660 | { | 597 | { |
| 598 | u8 buf[24] __aligned(8); | ||
| 599 | efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd)); | ||
| 661 | efi_status_t status; | 600 | efi_status_t status; |
| 662 | u32 phys_name, phys_vendor, phys_attr; | 601 | u32 phys_name, phys_vendor, phys_attr; |
| 663 | u32 phys_data_size, phys_data; | 602 | u32 phys_data_size, phys_data; |
| @@ -665,14 +604,19 @@ efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor, · 1 unmodified line | |||
| 665 | 604 | ||
| 666 | spin_lock_irqsave(&efi_runtime_lock, flags); | 605 | spin_lock_irqsave(&efi_runtime_lock, flags); |
| 667 | 606 | ||
| 607 | *vnd = *vendor; | ||
| 608 | |||
| 668 | phys_data_size = virt_to_phys_or_null(data_size); | 609 | phys_data_size = virt_to_phys_or_null(data_size); |
| 669 | phys_vendor = virt_to_phys_or_null(vendor); | 610 | phys_vendor = virt_to_phys_or_null(vnd); |
| 670 | phys_name = virt_to_phys_or_null_size(name, efi_name_size(name)); | 611 | phys_name = virt_to_phys_or_null_size(name, efi_name_size(name)); |
| 671 | phys_attr = virt_to_phys_or_null(attr); | 612 | phys_attr = virt_to_phys_or_null(attr); |
| 672 | phys_data = virt_to_phys_or_null_size(data, *data_size); | 613 | phys_data = virt_to_phys_or_null_size(data, *data_size); |
| 673 | 614 | ||
| 674 | status = efi_thunk(get_variable, phys_name, phys_vendor, | 615 | if (!phys_name || (data && !phys_data)) |
| 675 | phys_attr, phys_data_size, phys_data); | 616 | status = EFI_INVALID_PARAMETER; |
| 617 | else | ||
| 618 | status = efi_thunk(get_variable, phys_name, phys_vendor, | ||
| 619 | phys_attr, phys_data_size, phys_data); | ||
| 676 | 620 | ||
| 677 | spin_unlock_irqrestore(&efi_runtime_lock, flags); | 621 | spin_unlock_irqrestore(&efi_runtime_lock, flags); |
| 678 | 622 | ||
| @@ -683,19 +627,25 @@ static efi_status_t · 4 unmodified lines | |||
| 683 | efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor, | 627 | efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor, |
| 684 | u32 attr, unsigned long data_size, void *data) | 628 | u32 attr, unsigned long data_size, void *data) |
| 685 | { | 629 | { |
| 630 | u8 buf[24] __aligned(8); | ||
| 631 | efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd)); | ||
| 686 | u32 phys_name, phys_vendor, phys_data; | 632 | u32 phys_name, phys_vendor, phys_data; |
| 687 | efi_status_t status; | 633 | efi_status_t status; |
| 688 | unsigned long flags; | 634 | unsigned long flags; |
| 689 | 635 | ||
| 690 | spin_lock_irqsave(&efi_runtime_lock, flags); | 636 | spin_lock_irqsave(&efi_runtime_lock, flags); |
| 691 | 637 | ||
| 638 | *vnd = *vendor; | ||
| 639 | |||
| 692 | phys_name = virt_to_phys_or_null_size(name, efi_name_size(name)); | 640 | phys_name = virt_to_phys_or_null_size(name, efi_name_size(name)); |
| 693 | phys_vendor = virt_to_phys_or_null(vendor); | 641 | phys_vendor = virt_to_phys_or_null(vnd); |
| 694 | phys_data = virt_to_phys_or_null_size(data, data_size); | 642 | phys_data = virt_to_phys_or_null_size(data, data_size); |
| 695 | 643 | ||
| 696 | /* If data_size is > sizeof(u32) we've got problems */ | 644 | if (!phys_name || !phys_data) |
| 697 | status = efi_thunk(set_variable, phys_name, phys_vendor, | 645 | status = EFI_INVALID_PARAMETER; |
| 698 | attr, data_size, phys_data); | 646 | else |
| 647 | status = efi_thunk(set_variable, phys_name, phys_vendor, | ||
| 648 | attr, data_size, phys_data); | ||
| 699 | 649 | ||
| 700 | spin_unlock_irqrestore(&efi_runtime_lock, flags); | 650 | spin_unlock_irqrestore(&efi_runtime_lock, flags); |
| 701 | 651 | ||
| @@ -707,6 +657,8 @@ efi_thunk_set_variable_nonblocking(efi_char16_t *name, efi_guid_t *vendor, · 5 unmodified lines | |||
| 707 | u32 attr, unsigned long data_size, | 657 | u32 attr, unsigned long data_size, |
| 708 | void *data) | 658 | void *data) |
| 709 | { | 659 | { |
| 660 | u8 buf[24] __aligned(8); | ||
| 661 | efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd)); | ||
| 710 | u32 phys_name, phys_vendor, phys_data; | 662 | u32 phys_name, phys_vendor, phys_data; |
| 711 | efi_status_t status; | 663 | efi_status_t status; |
| 712 | unsigned long flags; | 664 | unsigned long flags; |
| @@ -714,13 +666,17 @@ efi_thunk_set_variable_nonblocking(efi_char16_t *name, efi_guid_t *vendor, · 1 unmodified line | |||
| 714 | if (!spin_trylock_irqsave(&efi_runtime_lock, flags)) | 666 | if (!spin_trylock_irqsave(&efi_runtime_lock, flags)) |
| 715 | return EFI_NOT_READY; | 667 | return EFI_NOT_READY; |
| 716 | 668 | ||
| 669 | *vnd = *vendor; | ||
| 670 | |||
| 717 | phys_name = virt_to_phys_or_null_size(name, efi_name_size(name)); | 671 | phys_name = virt_to_phys_or_null_size(name, efi_name_size(name)); |
| 718 | phys_vendor = virt_to_phys_or_null(vendor); | 672 | phys_vendor = virt_to_phys_or_null(vnd); |
| 719 | phys_data = virt_to_phys_or_null_size(data, data_size); | 673 | phys_data = virt_to_phys_or_null_size(data, data_size); |
| 720 | 674 | ||
| 721 | /* If data_size is > sizeof(u32) we've got problems */ | 675 | if (!phys_name || !phys_data) |
| 722 | status = efi_thunk(set_variable, phys_name, phys_vendor, | 676 | status = EFI_INVALID_PARAMETER; |
| 723 | attr, data_size, phys_data); | 677 | else |
| 678 | status = efi_thunk(set_variable, phys_name, phys_vendor, | ||
| 679 | attr, data_size, phys_data); | ||
| 724 | 680 | ||
| 725 | spin_unlock_irqrestore(&efi_runtime_lock, flags); | 681 | spin_unlock_irqrestore(&efi_runtime_lock, flags); |
| 726 | 682 | ||
| @@ -732,39 +688,36 @@ efi_thunk_get_next_variable(unsigned long *name_size, · 5 unmodified lines | |||
| 732 | efi_char16_t *name, | 688 | efi_char16_t *name, |
| 733 | efi_guid_t *vendor) | 689 | efi_guid_t *vendor) |
| 734 | { | 690 | { |
| 691 | u8 buf[24] __aligned(8); | ||
| 692 | efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd)); | ||
| 735 | efi_status_t status; | 693 | efi_status_t status; |
| 736 | u32 phys_name_size, phys_name, phys_vendor; | 694 | u32 phys_name_size, phys_name, phys_vendor; |
| 737 | unsigned long flags; | 695 | unsigned long flags; |
| 738 | 696 | ||
| 739 | spin_lock_irqsave(&efi_runtime_lock, flags); | 697 | spin_lock_irqsave(&efi_runtime_lock, flags); |
| 740 | 698 | ||
| 699 | *vnd = *vendor; | ||
| 700 | |||
| 741 | phys_name_size = virt_to_phys_or_null(name_size); | 701 | phys_name_size = virt_to_phys_or_null(name_size); |
| 742 | phys_vendor = virt_to_phys_or_null(vendor); | 702 | phys_vendor = virt_to_phys_or_null(vnd); |
| 743 | phys_name = virt_to_phys_or_null_size(name, *name_size); | 703 | phys_name = virt_to_phys_or_null_size(name, *name_size); |
| 744 | 704 | ||
| 745 | status = efi_thunk(get_next_variable, phys_name_size, | 705 | if (!phys_name) |
| 746 | phys_name, phys_vendor); | 706 | status = EFI_INVALID_PARAMETER; |
| 707 | else | ||
| 708 | status = efi_thunk(get_next_variable, phys_name_size, | ||
| 709 | phys_name, phys_vendor); | ||
| 747 | 710 | ||
| 748 | spin_unlock_irqrestore(&efi_runtime_lock, flags); | 711 | spin_unlock_irqrestore(&efi_runtime_lock, flags); |
| 749 | 712 | ||
| 713 | *vendor = *vnd; | ||
| 750 | return status; | 714 | return status; |
| 751 | } | 715 | } |
| 752 | 716 | ||
| 753 | static efi_status_t | 717 | static efi_status_t |
| 754 | efi_thunk_get_next_high_mono_count(u32 *count) | 718 | efi_thunk_get_next_high_mono_count(u32 *count) |
| 755 | { | 719 | { |
| 756 | efi_status_t status; | 720 | return EFI_UNSUPPORTED; |
| 757 | u32 phys_count; | ||
| 758 | unsigned long flags; | ||
| 759 | |||
| 760 | spin_lock_irqsave(&efi_runtime_lock, flags); | ||
| 761 | |||
| 762 | phys_count = virt_to_phys_or_null(count); | ||
| 763 | status = efi_thunk(get_next_high_mono_count, phys_count); | ||
| 764 | |||
| 765 | spin_unlock_irqrestore(&efi_runtime_lock, flags); | ||
| 766 | |||
| 767 | return status; | ||
| 768 | } | 721 | } |
| 769 | 722 | ||
| 770 | static void | 723 | static void |
| @@ -72,6 +72,9 @@ · 71 unmodified lines | |||
| 72 | #include <asm/mwait.h> | 72 | #include <asm/mwait.h> |
| 73 | #include <asm/pci_x86.h> | 73 | #include <asm/pci_x86.h> |
| 74 | #include <asm/cpu.h> | 74 | #include <asm/cpu.h> |
| 75 | #ifdef CONFIG_X86_IOPL_IOPERM | ||
| 76 | #include <asm/io_bitmap.h> | ||
| 77 | #endif | ||
| 75 | 78 | ||
| 76 | #ifdef CONFIG_ACPI | 79 | #ifdef CONFIG_ACPI |
| 77 | #include <linux/acpi.h> | 80 | #include <linux/acpi.h> |
| @@ -837,6 +840,25 @@ static void xen_load_sp0(unsigned long sp0) · 759 unmodified lines | |||
| 837 | this_cpu_write(cpu_tss_rw.x86_tss.sp0, sp0); | 840 | this_cpu_write(cpu_tss_rw.x86_tss.sp0, sp0); |
| 838 | } | 841 | } |
| 839 | 842 | ||
| 843 | #ifdef CONFIG_X86_IOPL_IOPERM | ||
| 844 | static void xen_update_io_bitmap(void) | ||
| 845 | { | ||
| 846 | struct physdev_set_iobitmap iobitmap; | ||
| 847 | struct tss_struct *tss = this_cpu_ptr(&cpu_tss_rw); | ||
| 848 | |||
| 849 | native_tss_update_io_bitmap(); | ||
| 850 | |||
| 851 | iobitmap.bitmap = (uint8_t *)(&tss->x86_tss) + | ||
| 852 | tss->x86_tss.io_bitmap_base; | ||
| 853 | if (tss->x86_tss.io_bitmap_base == IO_BITMAP_OFFSET_INVALID) | ||
| 854 | iobitmap.nr_ports = 0; | ||
| 855 | else | ||
| 856 | iobitmap.nr_ports = IO_BITMAP_BITS; | ||
| 857 | |||
| 858 | HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &iobitmap); | ||
| 859 | } | ||
| 860 | #endif | ||
| 861 | |||
| 840 | static void xen_io_delay(void) | 862 | static void xen_io_delay(void) |
| 841 | { | 863 | { |
| 842 | } | 864 | } |
| @@ -896,14 +918,15 @@ static u64 xen_read_msr_safe(unsigned int msr, int *err) · 53 unmodified lines | |||
| 896 | static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high) | 918 | static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high) |
| 897 | { | 919 | { |
| 898 | int ret; | 920 | int ret; |
| 921 | #ifdef CONFIG_X86_64 | ||
| 922 | unsigned int which; | ||
| 923 | u64 base; | ||
| 924 | #endif | ||
| 899 | 925 | ||
| 900 | ret = 0; | 926 | ret = 0; |
| 901 | 927 | ||
| 902 | switch (msr) { | 928 | switch (msr) { |
| 903 | #ifdef CONFIG_X86_64 | 929 | #ifdef CONFIG_X86_64 |
| 904 | unsigned which; | ||
| 905 | u64 base; | ||
| 906 | |||
| 907 | case MSR_FS_BASE: which = SEGBASE_FS; goto set; | 930 | case MSR_FS_BASE: which = SEGBASE_FS; goto set; |
| 908 | case MSR_KERNEL_GS_BASE: which = SEGBASE_GS_USER; goto set; | 931 | case MSR_KERNEL_GS_BASE: which = SEGBASE_GS_USER; goto set; |
| 909 | case MSR_GS_BASE: which = SEGBASE_GS_KERNEL; goto set; | 932 | case MSR_GS_BASE: which = SEGBASE_GS_KERNEL; goto set; |
| @@ -1046,6 +1069,9 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = { · 136 unmodified lines | |||
| 1046 | .write_idt_entry = xen_write_idt_entry, | 1069 | .write_idt_entry = xen_write_idt_entry, |
| 1047 | .load_sp0 = xen_load_sp0, | 1070 | .load_sp0 = xen_load_sp0, |
| 1048 | 1071 | ||
| 1072 | #ifdef CONFIG_X86_IOPL_IOPERM | ||
| 1073 | .update_io_bitmap = xen_update_io_bitmap, | ||
| 1074 | #endif | ||
| 1049 | .io_delay = xen_io_delay, | 1075 | .io_delay = xen_io_delay, |
| 1050 | 1076 | ||
| 1051 | /* Xen takes care of %gs when switching to usermode for us */ | 1077 | /* Xen takes care of %gs when switching to usermode for us */ |
| @@ -412,7 +412,7 @@ void blk_insert_flush(struct request *rq) · 411 unmodified lines | |||
| 412 | */ | 412 | */ |
| 413 | if ((policy & REQ_FSEQ_DATA) && | 413 | if ((policy & REQ_FSEQ_DATA) && |
| 414 | !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) { | 414 | !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) { |
| 415 | blk_mq_request_bypass_insert(rq, false); | 415 | blk_mq_request_bypass_insert(rq, false, false); |
| 416 | return; | 416 | return; |
| 417 | } | 417 | } |
| 418 | 418 | ||
| @@ -361,13 +361,19 @@ static bool blk_mq_sched_bypass_insert(struct blk_mq_hw_ctx *hctx, · 360 unmodified lines | |||
| 361 | bool has_sched, | 361 | bool has_sched, |
| 362 | struct request *rq) | 362 | struct request *rq) |
| 363 | { | 363 | { |
| 364 | /* dispatch flush rq directly */ | 364 | /* |
| 365 | if (rq->rq_flags & RQF_FLUSH_SEQ) { | 365 | * dispatch flush and passthrough rq directly |
| 366 | spin_lock(&hctx->lock); | 366 | * |
| 367 | list_add(&rq->queuelist, &hctx->dispatch); | 367 | * passthrough request has to be added to hctx->dispatch directly. |
| 368 | spin_unlock(&hctx->lock); | 368 | * For some reason, device may be in one situation which can't |
| 369 | * handle FS request, so STS_RESOURCE is always returned and the | ||
| 370 | * FS request will be added to hctx->dispatch. However passthrough | ||
| 371 | * request may be required at that time for fixing the problem. If | ||
| 372 | * passthrough request is added to scheduler queue, there isn't any | ||
| 373 | * chance to dispatch it given we prioritize requests in hctx->dispatch. | ||
| 374 | */ | ||
| 375 | if ((rq->rq_flags & RQF_FLUSH_SEQ) || blk_rq_is_passthrough(rq)) | ||
| 369 | return true; | 376 | return true; |
| 370 | } | ||
| 371 | 377 | ||
| 372 | if (has_sched) | 378 | if (has_sched) |
| 373 | rq->rq_flags |= RQF_SORTED; | 379 | rq->rq_flags |= RQF_SORTED; |
| @@ -391,8 +397,10 @@ void blk_mq_sched_insert_request(struct request *rq, bool at_head, · 17 unmodified lines | |||
| 391 | 397 | ||
| 392 | WARN_ON(e && (rq->tag != -1)); | 398 | WARN_ON(e && (rq->tag != -1)); |
| 393 | 399 | ||
| 394 | if (blk_mq_sched_bypass_insert(hctx, !!e, rq)) | 400 | if (blk_mq_sched_bypass_insert(hctx, !!e, rq)) { |
| 401 | blk_mq_request_bypass_insert(rq, at_head, false); | ||
| 395 | goto run; | 402 | goto run; |
| 403 | } | ||
| 396 | 404 | ||
| 397 | if (e && e->type->ops.insert_requests) { | 405 | if (e && e->type->ops.insert_requests) { |
| 398 | LIST_HEAD(list); | 406 | LIST_HEAD(list); |
| @@ -183,8 +183,8 @@ found_tag: · 182 unmodified lines | |||
| 183 | return tag + tag_offset; | 183 | return tag + tag_offset; |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | void blk_mq_put_tag(struct blk_mq_hw_ctx *hctx, struct blk_mq_tags *tags, | 186 | void blk_mq_put_tag(struct blk_mq_tags *tags, struct blk_mq_ctx *ctx, |
| 187 | struct blk_mq_ctx *ctx, unsigned int tag) | 187 | unsigned int tag) |
| 188 | { | 188 | { |
| 189 | if (!blk_mq_tag_is_reserved(tags, tag)) { | 189 | if (!blk_mq_tag_is_reserved(tags, tag)) { |
| 190 | const int real_tag = tag - tags->nr_reserved_tags; | 190 | const int real_tag = tag - tags->nr_reserved_tags; |
| @@ -26,8 +26,8 @@ extern struct blk_mq_tags *blk_mq_init_tags(unsigned int nr_tags, unsigned int r · 25 unmodified lines | |||
| 26 | extern void blk_mq_free_tags(struct blk_mq_tags *tags); | 26 | extern void blk_mq_free_tags(struct blk_mq_tags *tags); |
| 27 | 27 | ||
| 28 | extern unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data); | 28 | extern unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data); |
| 29 | extern void blk_mq_put_tag(struct blk_mq_hw_ctx *hctx, struct blk_mq_tags *tags, | 29 | extern void blk_mq_put_tag(struct blk_mq_tags *tags, struct blk_mq_ctx *ctx, |
| 30 | struct blk_mq_ctx *ctx, unsigned int tag); | 30 | unsigned int tag); |
| 31 | extern int blk_mq_tag_update_depth(struct blk_mq_hw_ctx *hctx, | 31 | extern int blk_mq_tag_update_depth(struct blk_mq_hw_ctx *hctx, |
| 32 | struct blk_mq_tags **tags, | 32 | struct blk_mq_tags **tags, |
| 33 | unsigned int depth, bool can_grow); | 33 | unsigned int depth, bool can_grow); |
| @@ -477,9 +477,9 @@ static void __blk_mq_free_request(struct request *rq) · 476 unmodified lines | |||
| 477 | blk_pm_mark_last_busy(rq); | 477 | blk_pm_mark_last_busy(rq); |
| 478 | rq->mq_hctx = NULL; | 478 | rq->mq_hctx = NULL; |
| 479 | if (rq->tag != -1) | 479 | if (rq->tag != -1) |
| 480 | blk_mq_put_tag(hctx, hctx->tags, ctx, rq->tag); | 480 | blk_mq_put_tag(hctx->tags, ctx, rq->tag); |
| 481 | if (sched_tag != -1) | 481 | if (sched_tag != -1) |
| 482 | blk_mq_put_tag(hctx, hctx->sched_tags, ctx, sched_tag); | 482 | blk_mq_put_tag(hctx->sched_tags, ctx, sched_tag); |
| 483 | blk_mq_sched_restart(hctx); | 483 | blk_mq_sched_restart(hctx); |
| 484 | blk_queue_exit(q); | 484 | blk_queue_exit(q); |
| 485 | } | 485 | } |
| @@ -735,7 +735,7 @@ static void blk_mq_requeue_work(struct work_struct *work) · 249 unmodified lines | |||
| 735 | * merge. | 735 | * merge. |
| 736 | */ | 736 | */ |
| 737 | if (rq->rq_flags & RQF_DONTPREP) | 737 | if (rq->rq_flags & RQF_DONTPREP) |
| 738 | blk_mq_request_bypass_insert(rq, false); | 738 | blk_mq_request_bypass_insert(rq, false, false); |
| 739 | else | 739 | else |
| 740 | blk_mq_sched_insert_request(rq, true, false, false); | 740 | blk_mq_sched_insert_request(rq, true, false, false); |
| 741 | } | 741 | } |
| @@ -1286,7 +1286,7 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, · 544 unmodified lines | |||
| 1286 | q->mq_ops->commit_rqs(hctx); | 1286 | q->mq_ops->commit_rqs(hctx); |
| 1287 | 1287 | ||
| 1288 | spin_lock(&hctx->lock); | 1288 | spin_lock(&hctx->lock); |
| 1289 | list_splice_init(list, &hctx->dispatch); | 1289 | list_splice_tail_init(list, &hctx->dispatch); |
| 1290 | spin_unlock(&hctx->lock); | 1290 | spin_unlock(&hctx->lock); |
| 1291 | 1291 | ||
| 1292 | /* | 1292 | /* |
| @@ -1677,12 +1677,16 @@ void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, · 384 unmodified lines | |||
| 1677 | * Should only be used carefully, when the caller knows we want to | 1677 | * Should only be used carefully, when the caller knows we want to |
| 1678 | * bypass a potential IO scheduler on the target device. | 1678 | * bypass a potential IO scheduler on the target device. |
| 1679 | */ | 1679 | */ |
| 1680 | void blk_mq_request_bypass_insert(struct request *rq, bool run_queue) | 1680 | void blk_mq_request_bypass_insert(struct request *rq, bool at_head, |
| 1681 | bool run_queue) | ||
| 1681 | { | 1682 | { |
| 1682 | struct blk_mq_hw_ctx *hctx = rq->mq_hctx; | 1683 | struct blk_mq_hw_ctx *hctx = rq->mq_hctx; |
| 1683 | 1684 | ||
| 1684 | spin_lock(&hctx->lock); | 1685 | spin_lock(&hctx->lock); |
| 1685 | list_add_tail(&rq->queuelist, &hctx->dispatch); | 1686 | if (at_head) |
| 1687 | list_add(&rq->queuelist, &hctx->dispatch); | ||
| 1688 | else | ||
| 1689 | list_add_tail(&rq->queuelist, &hctx->dispatch); | ||
| 1686 | spin_unlock(&hctx->lock); | 1690 | spin_unlock(&hctx->lock); |
| 1687 | 1691 | ||
| 1688 | if (run_queue) | 1692 | if (run_queue) |
| @@ -1849,7 +1853,7 @@ insert: · 160 unmodified lines | |||
| 1849 | if (bypass_insert) | 1853 | if (bypass_insert) |
| 1850 | return BLK_STS_RESOURCE; | 1854 | return BLK_STS_RESOURCE; |
| 1851 | 1855 | ||
| 1852 | blk_mq_request_bypass_insert(rq, run_queue); | 1856 | blk_mq_request_bypass_insert(rq, false, run_queue); |
| 1853 | return BLK_STS_OK; | 1857 | return BLK_STS_OK; |
| 1854 | } | 1858 | } |
| 1855 | 1859 | ||
| @@ -1876,7 +1880,7 @@ static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, · 20 unmodified lines | |||
| 1876 | 1880 | ||
| 1877 | ret = __blk_mq_try_issue_directly(hctx, rq, cookie, false, true); | 1881 | ret = __blk_mq_try_issue_directly(hctx, rq, cookie, false, true); |
| 1878 | if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE) | 1882 | if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE) |
| 1879 | blk_mq_request_bypass_insert(rq, true); | 1883 | blk_mq_request_bypass_insert(rq, false, true); |
| 1880 | else if (ret != BLK_STS_OK) | 1884 | else if (ret != BLK_STS_OK) |
| 1881 | blk_mq_end_request(rq, ret); | 1885 | blk_mq_end_request(rq, ret); |
| 1882 | 1886 | ||
| @@ -1910,7 +1914,7 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx, · 27 unmodified lines | |||
| 1910 | if (ret != BLK_STS_OK) { | 1914 | if (ret != BLK_STS_OK) { |
| 1911 | if (ret == BLK_STS_RESOURCE || | 1915 | if (ret == BLK_STS_RESOURCE || |
| 1912 | ret == BLK_STS_DEV_RESOURCE) { | 1916 | ret == BLK_STS_DEV_RESOURCE) { |
| 1913 | blk_mq_request_bypass_insert(rq, | 1917 | blk_mq_request_bypass_insert(rq, false, |
| 1914 | list_empty(list)); | 1918 | list_empty(list)); |
| 1915 | break; | 1919 | break; |
| 1916 | } | 1920 | } |
| @@ -3398,7 +3402,6 @@ static void blk_mq_poll_stats_fn(struct blk_stat_callback *cb) · 1481 unmodified lines | |||
| 3398 | } | 3402 | } |
| 3399 | 3403 | ||
| 3400 | static unsigned long blk_mq_poll_nsecs(struct request_queue *q, | 3404 | static unsigned long blk_mq_poll_nsecs(struct request_queue *q, |
| 3401 | struct blk_mq_hw_ctx *hctx, | ||
| 3402 | struct request *rq) | 3405 | struct request *rq) |
| 3403 | { | 3406 | { |
| 3404 | unsigned long ret = 0; | 3407 | unsigned long ret = 0; |
| @@ -3431,7 +3434,6 @@ static unsigned long blk_mq_poll_nsecs(struct request_queue *q, · 26 unmodified lines | |||
| 3431 | } | 3434 | } |
| 3432 | 3435 | ||
| 3433 | static bool blk_mq_poll_hybrid_sleep(struct request_queue *q, | 3436 | static bool blk_mq_poll_hybrid_sleep(struct request_queue *q, |
| 3434 | struct blk_mq_hw_ctx *hctx, | ||
| 3435 | struct request *rq) | 3437 | struct request *rq) |
| 3436 | { | 3438 | { |
| 3437 | struct hrtimer_sleeper hs; | 3439 | struct hrtimer_sleeper hs; |
| @@ -3451,7 +3453,7 @@ static bool blk_mq_poll_hybrid_sleep(struct request_queue *q, · 13 unmodified lines | |||
| 3451 | if (q->poll_nsec > 0) | 3453 | if (q->poll_nsec > 0) |
| 3452 | nsecs = q->poll_nsec; | 3454 | nsecs = q->poll_nsec; |
| 3453 | else | 3455 | else |
| 3454 | nsecs = blk_mq_poll_nsecs(q, hctx, rq); | 3456 | nsecs = blk_mq_poll_nsecs(q, rq); |
| 3455 | 3457 | ||
| 3456 | if (!nsecs) | 3458 | if (!nsecs) |
| 3457 | return false; | 3459 | return false; |
| @@ -3506,7 +3508,7 @@ static bool blk_mq_poll_hybrid(struct request_queue *q, · 48 unmodified lines | |||
| 3506 | return false; | 3508 | return false; |
| 3507 | } | 3509 | } |
| 3508 | 3510 | ||
| 3509 | return blk_mq_poll_hybrid_sleep(q, hctx, rq); | 3511 | return blk_mq_poll_hybrid_sleep(q, rq); |
| 3510 | } | 3512 | } |
| 3511 | 3513 | ||
| 3512 | /** | 3514 | /** |
| @@ -66,7 +66,8 @@ int blk_mq_alloc_rqs(struct blk_mq_tag_set *set, struct blk_mq_tags *tags, · 65 unmodified lines | |||
| 66 | */ | 66 | */ |
| 67 | void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, | 67 | void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, |
| 68 | bool at_head); | 68 | bool at_head); |
| 69 | void blk_mq_request_bypass_insert(struct request *rq, bool run_queue); | 69 | void blk_mq_request_bypass_insert(struct request *rq, bool at_head, |
| 70 | bool run_queue); | ||
| 70 | void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, | 71 | void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, |
| 71 | struct list_head *list); | 72 | struct list_head *list); |
| 72 | 73 | ||
| @@ -199,7 +200,7 @@ static inline bool blk_mq_get_dispatch_budget(struct blk_mq_hw_ctx *hctx) · 126 unmodified lines | |||
| 199 | static inline void __blk_mq_put_driver_tag(struct blk_mq_hw_ctx *hctx, | 200 | static inline void __blk_mq_put_driver_tag(struct blk_mq_hw_ctx *hctx, |
| 200 | struct request *rq) | 201 | struct request *rq) |
| 201 | { | 202 | { |
| 202 | blk_mq_put_tag(hctx, hctx->tags, rq->mq_ctx, rq->tag); | 203 | blk_mq_put_tag(hctx->tags, rq->mq_ctx, rq->tag); |
| 203 | rq->tag = -1; | 204 | rq->tag = -1; |
| 204 | 205 | ||
| 205 | if (rq->rq_flags & RQF_MQ_INFLIGHT) { | 206 | if (rq->rq_flags & RQF_MQ_INFLIGHT) { |
| @@ -136,8 +136,6 @@ config CRYPTO_USER · 135 unmodified lines | |||
| 136 | Userspace configuration for cryptographic instantiations such as | 136 | Userspace configuration for cryptographic instantiations such as |
| 137 | cbc(aes). | 137 | cbc(aes). |
| 138 | 138 | ||
| 139 | if CRYPTO_MANAGER2 | ||
| 140 | |||
| 141 | config CRYPTO_MANAGER_DISABLE_TESTS | 139 | config CRYPTO_MANAGER_DISABLE_TESTS |
| 142 | bool "Disable run-time self tests" | 140 | bool "Disable run-time self tests" |
| 143 | default y | 141 | default y |
| @@ -155,8 +153,6 @@ config CRYPTO_MANAGER_EXTRA_TESTS · 11 unmodified lines | |||
| 155 | This is intended for developer use only, as these tests take much | 153 | This is intended for developer use only, as these tests take much |
| 156 | longer to run than the normal self tests. | 154 | longer to run than the normal self tests. |
| 157 | 155 | ||
| 158 | endif # if CRYPTO_MANAGER2 | ||
| 159 | |||
| 160 | config CRYPTO_GF128MUL | 156 | config CRYPTO_GF128MUL |
| 161 | tristate | 157 | tristate |
| 162 | 158 | ||
| @@ -26,7 +26,7 @@ const char *const hash_algo_name[HASH_ALGO__LAST] = { · 25 unmodified lines | |||
| 26 | [HASH_ALGO_TGR_128] = "tgr128", | 26 | [HASH_ALGO_TGR_128] = "tgr128", |
| 27 | [HASH_ALGO_TGR_160] = "tgr160", | 27 | [HASH_ALGO_TGR_160] = "tgr160", |
| 28 | [HASH_ALGO_TGR_192] = "tgr192", | 28 | [HASH_ALGO_TGR_192] = "tgr192", |
| 29 | [HASH_ALGO_SM3_256] = "sm3-256", | 29 | [HASH_ALGO_SM3_256] = "sm3", |
| 30 | [HASH_ALGO_STREEBOG_256] = "streebog256", | 30 | [HASH_ALGO_STREEBOG_256] = "streebog256", |
| 31 | [HASH_ALGO_STREEBOG_512] = "streebog512", | 31 | [HASH_ALGO_STREEBOG_512] = "streebog512", |
| 32 | }; | 32 | }; |
| @@ -4436,6 +4436,15 @@ static const struct alg_test_desc alg_test_descs[] = { · 4435 unmodified lines | |||
| 4436 | .cipher = __VECS(tf_cbc_tv_template) | 4436 | .cipher = __VECS(tf_cbc_tv_template) |
| 4437 | }, | 4437 | }, |
| 4438 | }, { | 4438 | }, { |
| 4439 | #if IS_ENABLED(CONFIG_CRYPTO_PAES_S390) | ||
| 4440 | .alg = "cbc-paes-s390", | ||
| 4441 | .fips_allowed = 1, | ||
| 4442 | .test = alg_test_skcipher, | ||
| 4443 | .suite = { | ||
| 4444 | .cipher = __VECS(aes_cbc_tv_template) | ||
| 4445 | } | ||
| 4446 | }, { | ||
| 4447 | #endif | ||
| 4439 | .alg = "cbcmac(aes)", | 4448 | .alg = "cbcmac(aes)", |
| 4440 | .fips_allowed = 1, | 4449 | .fips_allowed = 1, |
| 4441 | .test = alg_test_hash, | 4450 | .test = alg_test_hash, |
| @@ -4587,6 +4596,15 @@ static const struct alg_test_desc alg_test_descs[] = { · 145 unmodified lines | |||
| 4587 | .cipher = __VECS(tf_ctr_tv_template) | 4596 | .cipher = __VECS(tf_ctr_tv_template) |
| 4588 | } | 4597 | } |
| 4589 | }, { | 4598 | }, { |
| 4599 | #if IS_ENABLED(CONFIG_CRYPTO_PAES_S390) | ||
| 4600 | .alg = "ctr-paes-s390", | ||
| 4601 | .fips_allowed = 1, | ||
| 4602 | .test = alg_test_skcipher, | ||
| 4603 | .suite = { | ||
| 4604 | .cipher = __VECS(aes_ctr_tv_template) | ||
| 4605 | } | ||
| 4606 | }, { | ||
| 4607 | #endif | ||
| 4590 | .alg = "cts(cbc(aes))", | 4608 | .alg = "cts(cbc(aes))", |
| 4591 | .test = alg_test_skcipher, | 4609 | .test = alg_test_skcipher, |
| 4592 | .fips_allowed = 1, | 4610 | .fips_allowed = 1, |
| @@ -4879,6 +4897,15 @@ static const struct alg_test_desc alg_test_descs[] = { · 286 unmodified lines | |||
| 4879 | .cipher = __VECS(xtea_tv_template) | 4897 | .cipher = __VECS(xtea_tv_template) |
| 4880 | } | 4898 | } |
| 4881 | }, { | 4899 | }, { |
| 4900 | #if IS_ENABLED(CONFIG_CRYPTO_PAES_S390) | ||
| 4901 | .alg = "ecb-paes-s390", | ||
| 4902 | .fips_allowed = 1, | ||
| 4903 | .test = alg_test_skcipher, | ||
| 4904 | .suite = { | ||
| 4905 | .cipher = __VECS(aes_tv_template) | ||
| 4906 | } | ||
| 4907 | }, { | ||
| 4908 | #endif | ||
| 4882 | .alg = "ecdh", | 4909 | .alg = "ecdh", |
| 4883 | .test = alg_test_kpp, | 4910 | .test = alg_test_kpp, |
| 4884 | .fips_allowed = 1, | 4911 | .fips_allowed = 1, |
| @@ -5465,6 +5492,15 @@ static const struct alg_test_desc alg_test_descs[] = { · 580 unmodified lines | |||
| 5465 | .cipher = __VECS(tf_xts_tv_template) | 5492 | .cipher = __VECS(tf_xts_tv_template) |
| 5466 | } | 5493 | } |
| 5467 | }, { | 5494 | }, { |
| 5495 | #if IS_ENABLED(CONFIG_CRYPTO_PAES_S390) | ||
| 5496 | .alg = "xts-paes-s390", | ||
| 5497 | .fips_allowed = 1, | ||
| 5498 | .test = alg_test_skcipher, | ||
| 5499 | .suite = { | ||
| 5500 | .cipher = __VECS(aes_xts_tv_template) | ||
| 5501 | } | ||
| 5502 | }, { | ||
| 5503 | #endif | ||
| 5468 | .alg = "xts4096(paes)", | 5504 | .alg = "xts4096(paes)", |
| 5469 | .test = alg_test_null, | 5505 | .test = alg_test_null, |
| 5470 | .fips_allowed = 1, | 5506 | .fips_allowed = 1, |
| @@ -55,12 +55,14 @@ static bool acpi_watchdog_uses_rtc(const struct acpi_table_wdat *wdat) · 54 unmodified lines | |||
| 55 | } | 55 | } |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | static bool acpi_no_watchdog; | ||
| 59 | |||
| 58 | static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) | 60 | static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) |
| 59 | { | 61 | { |
| 60 | const struct acpi_table_wdat *wdat = NULL; | 62 | const struct acpi_table_wdat *wdat = NULL; |
| 61 | acpi_status status; | 63 | acpi_status status; |
| 62 | 64 | ||
| 63 | if (acpi_disabled) | 65 | if (acpi_disabled || acpi_no_watchdog) |
| 64 | return NULL; | 66 | return NULL; |
| 65 | 67 | ||
| 66 | status = acpi_get_table(ACPI_SIG_WDAT, 0, | 68 | status = acpi_get_table(ACPI_SIG_WDAT, 0, |
| @@ -88,6 +90,14 @@ bool acpi_has_watchdog(void) · 21 unmodified lines | |||
| 88 | } | 90 | } |
| 89 | EXPORT_SYMBOL_GPL(acpi_has_watchdog); | 91 | EXPORT_SYMBOL_GPL(acpi_has_watchdog); |
| 90 | 92 | ||
| 93 | /* ACPI watchdog can be disabled on boot command line */ | ||
| 94 | static int __init disable_acpi_watchdog(char *str) | ||
| 95 | { | ||
| 96 | acpi_no_watchdog = true; | ||
| 97 | return 1; | ||
| 98 | } | ||
| 99 | __setup("acpi_no_watchdog", disable_acpi_watchdog); | ||
| 100 | |||
| 91 | void __init acpi_watchdog_init(void) | 101 | void __init acpi_watchdog_init(void) |
| 92 | { | 102 | { |
| 93 | const struct acpi_wdat_entry *entries; | 103 | const struct acpi_wdat_entry *entries; |
| @@ -126,12 +136,11 @@ void __init acpi_watchdog_init(void) · 32 unmodified lines | |||
| 126 | gas = &entries[i].register_region; | 136 | gas = &entries[i].register_region; |
| 127 | 137 | ||
| 128 | res.start = gas->address; | 138 | res.start = gas->address; |
| 139 | res.end = res.start + ACPI_ACCESS_BYTE_WIDTH(gas->access_width) - 1; | ||
| 129 | if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { | 140 | if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { |
| 130 | res.flags = IORESOURCE_MEM; | 141 | res.flags = IORESOURCE_MEM; |
| 131 | res.end = res.start + ALIGN(gas->access_width, 4) - 1; | ||
| 132 | } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { | 142 | } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { |
| 133 | res.flags = IORESOURCE_IO; | 143 | res.flags = IORESOURCE_IO; |
| 134 | res.end = res.start + gas->access_width - 1; | ||
| 135 | } else { | 144 | } else { |
| 136 | pr_warn("Unsupported address space: %u\n", | 145 | pr_warn("Unsupported address space: %u\n", |
| 137 | gas->space_id); | 146 | gas->space_id); |
| @@ -101,6 +101,8 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void); · 100 unmodified lines | |||
| 101 | 101 | ||
| 102 | acpi_status acpi_hw_enable_all_wakeup_gpes(void); | 102 | acpi_status acpi_hw_enable_all_wakeup_gpes(void); |
| 103 | 103 | ||
| 104 | u8 acpi_hw_check_all_gpes(void); | ||
| 105 | |||
| 104 | acpi_status | 106 | acpi_status |
| 105 | acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 107 | acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
| 106 | struct acpi_gpe_block_info *gpe_block, | 108 | struct acpi_gpe_block_info *gpe_block, |
| @@ -265,4 +265,49 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event) · 264 unmodified lines | |||
| 265 | handler) (acpi_gbl_fixed_event_handlers[event].context)); | 265 | handler) (acpi_gbl_fixed_event_handlers[event].context)); |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | /******************************************************************************* | ||
| 269 | * | ||
| 270 | * FUNCTION: acpi_any_fixed_event_status_set | ||
| 271 | * | ||
| 272 | * PARAMETERS: None | ||
| 273 | * | ||
| 274 | * RETURN: TRUE or FALSE | ||
| 275 | * | ||
| 276 | * DESCRIPTION: Checks the PM status register for active fixed events | ||
| 277 | * | ||
| 278 | ******************************************************************************/ | ||
| 279 | |||
| 280 | u32 acpi_any_fixed_event_status_set(void) | ||
| 281 | { | ||
| 282 | acpi_status status; | ||
| 283 | u32 in_status; | ||
| 284 | u32 in_enable; | ||
| 285 | u32 i; | ||
| 286 | |||
| 287 | status = acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &in_enable); | ||
| 288 | if (ACPI_FAILURE(status)) { | ||
| 289 | return (FALSE); | ||
| 290 | } | ||
| 291 | |||
| 292 | status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &in_status); | ||
| 293 | if (ACPI_FAILURE(status)) { | ||
| 294 | return (FALSE); | ||
| 295 | } | ||
| 296 | |||
| 297 | /* | ||
| 298 | * Check for all possible Fixed Events and dispatch those that are active | ||
| 299 | */ | ||
| 300 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { | ||
| 301 | |||
| 302 | /* Both the status and enable bits must be on for this event */ | ||
| 303 | |||
| 304 | if ((in_status & acpi_gbl_fixed_event_info[i].status_bit_mask) && | ||
| 305 | (in_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) { | ||
| 306 | return (TRUE); | ||
| 307 | } | ||
| 308 | } | ||
| 309 | |||
| 310 | return (FALSE); | ||
| 311 | } | ||
| 312 | |||
| 268 | #endif /* !ACPI_REDUCED_HARDWARE */ | 313 | #endif /* !ACPI_REDUCED_HARDWARE */ |
| @@ -795,6 +795,38 @@ acpi_status acpi_enable_all_wakeup_gpes(void) · 794 unmodified lines | |||
| 795 | 795 | ||
| 796 | ACPI_EXPORT_SYMBOL(acpi_enable_all_wakeup_gpes) | 796 | ACPI_EXPORT_SYMBOL(acpi_enable_all_wakeup_gpes) |
| 797 | 797 | ||
| 798 | /****************************************************************************** | ||
| 799 | * | ||
| 800 | * FUNCTION: acpi_any_gpe_status_set | ||
| 801 | * | ||
| 802 | * PARAMETERS: None | ||
| 803 | * | ||
| 804 | * RETURN: Whether or not the status bit is set for any GPE | ||
| 805 | * | ||
| 806 | * DESCRIPTION: Check the status bits of all enabled GPEs and return TRUE if any | ||
| 807 | * of them is set or FALSE otherwise. | ||
| 808 | * | ||
| 809 | ******************************************************************************/ | ||
| 810 | u32 acpi_any_gpe_status_set(void) | ||
| 811 | { | ||
| 812 | acpi_status status; | ||
| 813 | u8 ret; | ||
| 814 | |||
| 815 | ACPI_FUNCTION_TRACE(acpi_any_gpe_status_set); | ||
| 816 | |||
| 817 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
| 818 | if (ACPI_FAILURE(status)) { | ||
| 819 | return (FALSE); | ||
| 820 | } | ||
| 821 | |||
| 822 | ret = acpi_hw_check_all_gpes(); | ||
| 823 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
| 824 | |||
| 825 | return (ret); | ||
| 826 | } | ||
| 827 | |||
| 828 | ACPI_EXPORT_SYMBOL(acpi_any_gpe_status_set) | ||
| 829 | |||
| 798 | /******************************************************************************* | 830 | /******************************************************************************* |
| 799 | * | 831 | * |
| 800 | * FUNCTION: acpi_install_gpe_block | 832 | * FUNCTION: acpi_install_gpe_block |
| @@ -444,6 +444,53 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, · 443 unmodified lines | |||
| 444 | return (AE_OK); | 444 | return (AE_OK); |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | /****************************************************************************** | ||
| 448 | * | ||
| 449 | * FUNCTION: acpi_hw_get_gpe_block_status | ||
| 450 | * | ||
| 451 | * PARAMETERS: gpe_xrupt_info - GPE Interrupt info | ||
| 452 | * gpe_block - Gpe Block info | ||
| 453 | * | ||
| 454 | * RETURN: Success | ||
| 455 | * | ||
| 456 | * DESCRIPTION: Produce a combined GPE status bits mask for the given block. | ||
| 457 | * | ||
| 458 | ******************************************************************************/ | ||
| 459 | |||
| 460 | static acpi_status | ||
| 461 | acpi_hw_get_gpe_block_status(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
| 462 | struct acpi_gpe_block_info *gpe_block, | ||
| 463 | void *ret_ptr) | ||
| 464 | { | ||
| 465 | struct acpi_gpe_register_info *gpe_register_info; | ||
| 466 | u64 in_enable, in_status; | ||
| 467 | acpi_status status; | ||
| 468 | u8 *ret = ret_ptr; | ||
| 469 | u32 i; | ||
| 470 | |||
| 471 | /* Examine each GPE Register within the block */ | ||
| 472 | |||
| 473 | for (i = 0; i < gpe_block->register_count; i++) { | ||
| 474 | gpe_register_info = &gpe_block->register_info[i]; | ||
| 475 | |||
| 476 | status = acpi_hw_read(&in_enable, | ||
| 477 | &gpe_register_info->enable_address); | ||
| 478 | if (ACPI_FAILURE(status)) { | ||
| 479 | continue; | ||
| 480 | } | ||
| 481 | |||
| 482 | status = acpi_hw_read(&in_status, | ||
| 483 | &gpe_register_info->status_address); | ||
| 484 | if (ACPI_FAILURE(status)) { | ||
| 485 | continue; | ||
| 486 | } | ||
| 487 | |||
| 488 | *ret |= in_enable & in_status; | ||
| 489 | } | ||
| 490 | |||
| 491 | return (AE_OK); | ||
| 492 | } | ||
| 493 | |||
| 447 | /****************************************************************************** | 494 | /****************************************************************************** |
| 448 | * | 495 | * |
| 449 | * FUNCTION: acpi_hw_disable_all_gpes | 496 | * FUNCTION: acpi_hw_disable_all_gpes |
| @@ -510,4 +557,28 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void) · 60 unmodified lines | |||
| 510 | return_ACPI_STATUS(status); | 557 | return_ACPI_STATUS(status); |
| 511 | } | 558 | } |
| 512 | 559 | ||
| 560 | /****************************************************************************** | ||
| 561 | * | ||
| 562 | * FUNCTION: acpi_hw_check_all_gpes | ||
| 563 | * | ||
| 564 | * PARAMETERS: None | ||
| 565 | * | ||
| 566 | * RETURN: Combined status of all GPEs | ||
| 567 | * | ||
| 568 | * DESCRIPTION: Check all enabled GPEs in all GPE blocks and return TRUE if the | ||
| 569 | * status bit is set for at least one of them of FALSE otherwise. | ||
| 570 | * | ||
| 571 | ******************************************************************************/ | ||
| 572 | |||
| 573 | u8 acpi_hw_check_all_gpes(void) | ||
| 574 | { | ||
| 575 | u8 ret = 0; | ||
| 576 | |||
| 577 | ACPI_FUNCTION_TRACE(acpi_hw_check_all_gpes); | ||
| 578 | |||
| 579 | (void)acpi_ev_walk_gpe_list(acpi_hw_get_gpe_block_status, &ret); | ||
| 580 | |||
| 581 | return (ret != 0); | ||
| 582 | } | ||
| 583 | |||
| 513 | #endif /* !ACPI_REDUCED_HARDWARE */ | 584 | #endif /* !ACPI_REDUCED_HARDWARE */ |
| @@ -179,6 +179,7 @@ EXPORT_SYMBOL(first_ec); · 178 unmodified lines | |||
| 179 | 179 | ||
| 180 | static struct acpi_ec *boot_ec; | 180 | static struct acpi_ec *boot_ec; |
| 181 | static bool boot_ec_is_ecdt = false; | 181 | static bool boot_ec_is_ecdt = false; |
| 182 | static struct workqueue_struct *ec_wq; | ||
| 182 | static struct workqueue_struct *ec_query_wq; | 183 | static struct workqueue_struct *ec_query_wq; |
| 183 | 184 | ||
| 184 | static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */ | 185 | static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */ |
| @@ -469,7 +470,7 @@ static void acpi_ec_submit_query(struct acpi_ec *ec) · 284 unmodified lines | |||
| 469 | ec_dbg_evt("Command(%s) submitted/blocked", | 470 | ec_dbg_evt("Command(%s) submitted/blocked", |
| 470 | acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY)); | 471 | acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY)); |
| 471 | ec->nr_pending_queries++; | 472 | ec->nr_pending_queries++; |
| 472 | schedule_work(&ec->work); | 473 | queue_work(ec_wq, &ec->work); |
| 473 | } | 474 | } |
| 474 | } | 475 | } |
| 475 | 476 | ||
| @@ -535,7 +536,7 @@ static void acpi_ec_enable_event(struct acpi_ec *ec) · 59 unmodified lines | |||
| 535 | #ifdef CONFIG_PM_SLEEP | 536 | #ifdef CONFIG_PM_SLEEP |
| 536 | static void __acpi_ec_flush_work(void) | 537 | static void __acpi_ec_flush_work(void) |
| 537 | { | 538 | { |
| 538 | flush_scheduled_work(); /* flush ec->work */ | 539 | drain_workqueue(ec_wq); /* flush ec->work */ |
| 539 | flush_workqueue(ec_query_wq); /* flush queries */ | 540 | flush_workqueue(ec_query_wq); /* flush queries */ |
| 540 | } | 541 | } |
| 541 | 542 | ||
| @@ -556,8 +557,8 @@ static void acpi_ec_disable_event(struct acpi_ec *ec) · 14 unmodified lines | |||
| 556 | 557 | ||
| 557 | void acpi_ec_flush_work(void) | 558 | void acpi_ec_flush_work(void) |
| 558 | { | 559 | { |
| 559 | /* Without ec_query_wq there is nothing to flush. */ | 560 | /* Without ec_wq there is nothing to flush. */ |
| 560 | if (!ec_query_wq) | 561 | if (!ec_wq) |
| 561 | return; | 562 | return; |
| 562 | 563 | ||
| 563 | __acpi_ec_flush_work(); | 564 | __acpi_ec_flush_work(); |
| @@ -2107,25 +2108,33 @@ static struct acpi_driver acpi_ec_driver = { · 1543 unmodified lines | |||
| 2107 | .drv.pm = &acpi_ec_pm, | 2108 | .drv.pm = &acpi_ec_pm, |
| 2108 | }; | 2109 | }; |
| 2109 | 2110 | ||
| 2110 | static inline int acpi_ec_query_init(void) | 2111 | static void acpi_ec_destroy_workqueues(void) |
| 2111 | { | 2112 | { |
| 2112 | if (!ec_query_wq) { | 2113 | if (ec_wq) { |
| 2113 | ec_query_wq = alloc_workqueue("kec_query", 0, | 2114 | destroy_workqueue(ec_wq); |
| 2114 | ec_max_queries); | 2115 | ec_wq = NULL; |
| 2115 | if (!ec_query_wq) | ||
| 2116 | return -ENODEV; | ||
| 2117 | } | 2116 | } |
| 2118 | return 0; | ||
| 2119 | } | ||
| 2120 | |||
| 2121 | static inline void acpi_ec_query_exit(void) | ||
| 2122 | { | ||
| 2123 | if (ec_query_wq) { | 2117 | if (ec_query_wq) { |
| 2124 | destroy_workqueue(ec_query_wq); | 2118 | destroy_workqueue(ec_query_wq); |
| 2125 | ec_query_wq = NULL; | 2119 | ec_query_wq = NULL; |
| 2126 | } | 2120 | } |
| 2127 | } | 2121 | } |
| 2128 | 2122 | ||
| 2123 | static int acpi_ec_init_workqueues(void) | ||
| 2124 | { | ||
| 2125 | if (!ec_wq) | ||
| 2126 | ec_wq = alloc_ordered_workqueue("kec", 0); | ||
| 2127 | |||
| 2128 | if (!ec_query_wq) | ||
| 2129 | ec_query_wq = alloc_workqueue("kec_query", 0, ec_max_queries); | ||
| 2130 | |||
| 2131 | if (!ec_wq || !ec_query_wq) { | ||
| 2132 | acpi_ec_destroy_workqueues(); | ||
| 2133 | return -ENODEV; | ||
| 2134 | } | ||
| 2135 | return 0; | ||
| 2136 | } | ||
| 2137 | |||
| 2129 | static const struct dmi_system_id acpi_ec_no_wakeup[] = { | 2138 | static const struct dmi_system_id acpi_ec_no_wakeup[] = { |
| 2130 | { | 2139 | { |
| 2131 | .ident = "Thinkpad X1 Carbon 6th", | 2140 | .ident = "Thinkpad X1 Carbon 6th", |
| @@ -2156,8 +2165,7 @@ int __init acpi_ec_init(void) · 24 unmodified lines | |||
| 2156 | int result; | 2165 | int result; |
| 2157 | int ecdt_fail, dsdt_fail; | 2166 | int ecdt_fail, dsdt_fail; |
| 2158 | 2167 | ||
| 2159 | /* register workqueue for _Qxx evaluations */ | 2168 | result = acpi_ec_init_workqueues(); |
| 2160 | result = acpi_ec_query_init(); | ||
| 2161 | if (result) | 2169 | if (result) |
| 2162 | return result; | 2170 | return result; |
| 2163 | 2171 | ||
| @@ -2188,6 +2196,6 @@ static void __exit acpi_ec_exit(void) · 24 unmodified lines | |||
| 2188 | { | 2196 | { |
| 2189 | 2197 | ||
| 2190 | acpi_bus_unregister_driver(&acpi_ec_driver); | 2198 | acpi_bus_unregister_driver(&acpi_ec_driver); |
| 2191 | acpi_ec_query_exit(); | 2199 | acpi_ec_destroy_workqueues(); |
| 2192 | } | 2200 | } |
| 2193 | #endif /* 0 */ | 2201 | #endif /* 0 */ |
| @@ -990,21 +990,41 @@ static void acpi_s2idle_sync(void) · 989 unmodified lines | |||
| 990 | acpi_os_wait_events_complete(); /* synchronize Notify handling */ | 990 | acpi_os_wait_events_complete(); /* synchronize Notify handling */ |
| 991 | } | 991 | } |
| 992 | 992 | ||
| 993 | static void acpi_s2idle_wake(void) | 993 | static bool acpi_s2idle_wake(void) |
| 994 | { | 994 | { |
| 995 | /* | 995 | if (!acpi_sci_irq_valid()) |
| 996 | * If IRQD_WAKEUP_ARMED is set for the SCI at this point, the SCI has | 996 | return pm_wakeup_pending(); |
| 997 | * not triggered while suspended, so bail out. | 997 | |
| 998 | */ | 998 | while (pm_wakeup_pending()) { |
| 999 | if (!acpi_sci_irq_valid() || | 999 | /* |
| 1000 | irqd_is_wakeup_armed(irq_get_irq_data(acpi_sci_irq))) | 1000 | * If IRQD_WAKEUP_ARMED is set for the SCI at this point, the |
| 1001 | return; | 1001 | * SCI has not triggered while suspended, so bail out (the |
| 1002 | * wakeup is pending anyway and the SCI is not the source of | ||
| 1003 | * it). | ||
| 1004 | */ | ||
| 1005 | if (irqd_is_wakeup_armed(irq_get_irq_data(acpi_sci_irq))) | ||
| 1006 | return true; | ||
49 more lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
File renamed without changes.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 92 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 207 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 163 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 602 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 294 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 203 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 100 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 92 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 103 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 143 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 112 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 151 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 216 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 131 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 92 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 209 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 570 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 206 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 630 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 485 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 183 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 358 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 344 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 142 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 266 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 296 lines aren’t shown here.
This diff is large: its 1150 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 115 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 127 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 208 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 112 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 153 lines aren’t shown here.
This diff is large: its 92 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 303 lines aren’t shown here.
This diff is large: its 273 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 1164 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 243 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 94 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 173 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 156 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 144 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 126 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 336 lines aren’t shown here.
This diff is large: its 114 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 425 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 189 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 1139 lines aren’t shown here.
This diff is large: its 238 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 735 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 210 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 192 lines aren’t shown here.
This diff is large: its 4 lines aren’t shown here.
This diff is large: its 4 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 318 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 156 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 303 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 298 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 162 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 143 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.