1 | The following changes since commit 6eeea6725a70e6fcb5abba0764496bdab07ddfb3: | 1 | Massively slimmed down v2: MemTag broke bsd-user, and the npcm7xx |
---|---|---|---|
2 | ethernet device failed 'make check' on big-endian hosts. | ||
2 | 3 | ||
3 | Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-10-06' into staging (2020-10-06 21:13:34 +0100) | 4 | -- PMM |
5 | |||
6 | The following changes since commit 83339e21d05c824ebc9131d644f25c23d0e41ecf: | ||
7 | |||
8 | Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-request' into staging (2021-02-10 15:42:20 +0000) | ||
4 | 9 | ||
5 | are available in the Git repository at: | 10 | are available in the Git repository at: |
6 | 11 | ||
7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201008 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210211-1 |
8 | 13 | ||
9 | for you to fetch changes up to ba118c26e16a97e6ff6de8184057d3420ce16a23: | 14 | for you to fetch changes up to d3c1183ffeb71ca3a783eae3d7e1c51e71e8a621: |
10 | 15 | ||
11 | target/arm: Make '-cpu max' have a 48-bit PA (2020-10-08 15:24:32 +0100) | 16 | target/arm: Correctly initialize MDCR_EL2.HPMN (2021-02-11 19:48:09 +0000) |
12 | 17 | ||
13 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
14 | target-arm queue: | 19 | target-arm queue: |
15 | * hw/ssi/npcm7xx_fiu: Fix handling of unsigned integer | 20 | * Correctly initialize MDCR_EL2.HPMN |
16 | * hw/arm/fsl-imx25: Fix a typo | 21 | * versal: Use nr_apu_cpus in favor of hard coding 2 |
17 | * hw/arm/sbsa-ref : Fix SMMUv3 Initialisation | 22 | * accel/tcg: Add URL of clang bug to comment about our workaround |
18 | * hw/arm/sbsa-ref : allocate IRQs for SMMUv3 | 23 | * Add support for FEAT_DIT, Data Independent Timing |
19 | * hw/char/bcm2835_aux: Allow less than 32-bit accesses | 24 | * Remove GPIO from unimplemented NPCM7XX |
20 | * hw/arm/virt: Implement kvm-steal-time | 25 | * Fix SCR RES1 handling |
21 | * target/arm: Make '-cpu max' have a 48-bit PA | 26 | * Don't migrate CPUARMState.features |
22 | 27 | ||
23 | ---------------------------------------------------------------- | 28 | ---------------------------------------------------------------- |
24 | Andrew Jones (6): | 29 | Aaron Lindsay (1): |
25 | linux headers: sync to 5.9-rc7 | 30 | target/arm: Don't migrate CPUARMState.features |
26 | target/arm/kvm: Make uncalled stubs explicitly unreachable | ||
27 | hw/arm/virt: Move post cpu realize check into its own function | ||
28 | hw/arm/virt: Move kvm pmu setup to virt_cpu_post_init | ||
29 | tests/qtest: Restore aarch64 arm-cpu-features test | ||
30 | hw/arm/virt: Implement kvm-steal-time | ||
31 | 31 | ||
32 | Graeme Gregory (2): | 32 | Daniel Müller (1): |
33 | hw/arm/sbsa-ref : Fix SMMUv3 Initialisation | 33 | target/arm: Correctly initialize MDCR_EL2.HPMN |
34 | hw/arm/sbsa-ref : allocate IRQs for SMMUv3 | ||
35 | 34 | ||
36 | Peter Maydell (1): | 35 | Edgar E. Iglesias (1): |
37 | target/arm: Make '-cpu max' have a 48-bit PA | 36 | hw/arm: versal: Use nr_apu_cpus in favor of hard coding 2 |
38 | 37 | ||
39 | Philippe Mathieu-Daudé (3): | 38 | Hao Wu (1): |
40 | hw/ssi/npcm7xx_fiu: Fix handling of unsigned integer | 39 | hw/arm: Remove GPIO from unimplemented NPCM7XX |
41 | hw/arm/fsl-imx25: Fix a typo | ||
42 | hw/char/bcm2835_aux: Allow less than 32-bit accesses | ||
43 | 40 | ||
44 | docs/system/arm/cpu-features.rst | 11 ++++ | 41 | Mike Nawrocki (1): |
45 | include/hw/arm/fsl-imx25.h | 2 +- | 42 | target/arm: Fix SCR RES1 handling |
46 | include/hw/arm/virt.h | 5 ++ | ||
47 | linux-headers/linux/kvm.h | 6 ++- | ||
48 | target/arm/cpu.h | 4 ++ | ||
49 | target/arm/kvm_arm.h | 94 ++++++++++++++++++++++++++------- | ||
50 | hw/arm/sbsa-ref.c | 3 +- | ||
51 | hw/arm/virt.c | 110 ++++++++++++++++++++++++++++----------- | ||
52 | hw/char/bcm2835_aux.c | 4 +- | ||
53 | hw/ssi/npcm7xx_fiu.c | 12 ++--- | ||
54 | target/arm/cpu.c | 8 +++ | ||
55 | target/arm/cpu64.c | 4 ++ | ||
56 | target/arm/kvm.c | 16 ++++++ | ||
57 | target/arm/kvm64.c | 64 +++++++++++++++++++++-- | ||
58 | target/arm/monitor.c | 2 +- | ||
59 | tests/qtest/arm-cpu-features.c | 25 +++++++-- | ||
60 | hw/ssi/trace-events | 2 +- | ||
61 | tests/qtest/meson.build | 3 +- | ||
62 | 18 files changed, 303 insertions(+), 72 deletions(-) | ||
63 | 43 | ||
44 | Peter Maydell (2): | ||
45 | arm: Update infocenter.arm.com URLs | ||
46 | accel/tcg: Add URL of clang bug to comment about our workaround | ||
47 | |||
48 | Rebecca Cran (4): | ||
49 | target/arm: Add support for FEAT_DIT, Data Independent Timing | ||
50 | target/arm: Support AA32 DIT by moving PSTATE_SS from cpsr into env->pstate | ||
51 | target/arm: Set ID_AA64PFR0.DIT and ID_PFR0.DIT to 1 for "max" AA64 CPU | ||
52 | target/arm: Set ID_PFR0.DIT to 1 for "max" 32-bit CPU | ||
53 | |||
54 | include/hw/dma/pl080.h | 7 ++-- | ||
55 | include/hw/misc/arm_integrator_debug.h | 2 +- | ||
56 | include/hw/ssi/pl022.h | 5 ++- | ||
57 | target/arm/cpu.h | 17 ++++++++ | ||
58 | target/arm/internals.h | 6 +++ | ||
59 | accel/tcg/cpu-exec.c | 25 +++++++++--- | ||
60 | hw/arm/aspeed_ast2600.c | 2 +- | ||
61 | hw/arm/musca.c | 4 +- | ||
62 | hw/arm/npcm7xx.c | 8 ---- | ||
63 | hw/arm/xlnx-versal.c | 4 +- | ||
64 | hw/misc/arm_integrator_debug.c | 2 +- | ||
65 | hw/timer/arm_timer.c | 7 ++-- | ||
66 | target/arm/cpu.c | 4 ++ | ||
67 | target/arm/cpu64.c | 5 +++ | ||
68 | target/arm/helper-a64.c | 27 +++++++++++-- | ||
69 | target/arm/helper.c | 71 +++++++++++++++++++++++++++------- | ||
70 | target/arm/machine.c | 2 +- | ||
71 | target/arm/op_helper.c | 9 +---- | ||
72 | target/arm/translate-a64.c | 12 ++++++ | ||
73 | 19 files changed, 164 insertions(+), 55 deletions(-) | ||
74 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | Fix integer handling issues handling issue reported by Coverity: | ||
4 | |||
5 | hw/ssi/npcm7xx_fiu.c: 162 in npcm7xx_fiu_flash_read() | ||
6 | >>> CID 1432730: Integer handling issues (NEGATIVE_RETURNS) | ||
7 | >>> "npcm7xx_fiu_cs_index(fiu, f)" is passed to a parameter that cannot be negative. | ||
8 | 162 npcm7xx_fiu_select(fiu, npcm7xx_fiu_cs_index(fiu, f)); | ||
9 | |||
10 | hw/ssi/npcm7xx_fiu.c: 221 in npcm7xx_fiu_flash_write() | ||
11 | 218 cs_id = npcm7xx_fiu_cs_index(fiu, f); | ||
12 | 219 trace_npcm7xx_fiu_flash_write(DEVICE(fiu)->canonical_path, cs_id, addr, | ||
13 | 220 size, v); | ||
14 | >>> CID 1432729: Integer handling issues (NEGATIVE_RETURNS) | ||
15 | >>> "cs_id" is passed to a parameter that cannot be negative. | ||
16 | 221 npcm7xx_fiu_select(fiu, cs_id); | ||
17 | |||
18 | Since the index of the flash can not be negative, return an | ||
19 | unsigned type. | ||
20 | |||
21 | Reported-by: Coverity (CID 1432729 & 1432730: NEGATIVE_RETURNS) | ||
22 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
23 | Reviewed-by: Havard Skinnemoen <hskinnemoen@google.com> | ||
24 | Message-id: 20200919132435.310527-1-f4bug@amsat.org | ||
25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
26 | --- | ||
27 | hw/ssi/npcm7xx_fiu.c | 12 ++++++------ | ||
28 | hw/ssi/trace-events | 2 +- | ||
29 | 2 files changed, 7 insertions(+), 7 deletions(-) | ||
30 | |||
31 | diff --git a/hw/ssi/npcm7xx_fiu.c b/hw/ssi/npcm7xx_fiu.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/hw/ssi/npcm7xx_fiu.c | ||
34 | +++ b/hw/ssi/npcm7xx_fiu.c | ||
35 | @@ -XXX,XX +XXX,XX @@ enum NPCM7xxFIURegister { | ||
36 | * Returns the index of flash in the fiu->flash array. This corresponds to the | ||
37 | * chip select ID of the flash. | ||
38 | */ | ||
39 | -static int npcm7xx_fiu_cs_index(NPCM7xxFIUState *fiu, NPCM7xxFIUFlash *flash) | ||
40 | +static unsigned npcm7xx_fiu_cs_index(NPCM7xxFIUState *fiu, | ||
41 | + NPCM7xxFIUFlash *flash) | ||
42 | { | ||
43 | int index = flash - fiu->flash; | ||
44 | |||
45 | @@ -XXX,XX +XXX,XX @@ static int npcm7xx_fiu_cs_index(NPCM7xxFIUState *fiu, NPCM7xxFIUFlash *flash) | ||
46 | } | ||
47 | |||
48 | /* Assert the chip select specified in the UMA Control/Status Register. */ | ||
49 | -static void npcm7xx_fiu_select(NPCM7xxFIUState *s, int cs_id) | ||
50 | +static void npcm7xx_fiu_select(NPCM7xxFIUState *s, unsigned cs_id) | ||
51 | { | ||
52 | trace_npcm7xx_fiu_select(DEVICE(s)->canonical_path, cs_id); | ||
53 | |||
54 | if (cs_id < s->cs_count) { | ||
55 | qemu_irq_lower(s->cs_lines[cs_id]); | ||
56 | + s->active_cs = cs_id; | ||
57 | } else { | ||
58 | qemu_log_mask(LOG_GUEST_ERROR, | ||
59 | "%s: UMA to CS%d; this module has only %d chip selects", | ||
60 | DEVICE(s)->canonical_path, cs_id, s->cs_count); | ||
61 | - cs_id = -1; | ||
62 | + s->active_cs = -1; | ||
63 | } | ||
64 | - | ||
65 | - s->active_cs = cs_id; | ||
66 | } | ||
67 | |||
68 | /* Deassert the currently active chip select. */ | ||
69 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_fiu_flash_write(void *opaque, hwaddr addr, uint64_t v, | ||
70 | NPCM7xxFIUFlash *f = opaque; | ||
71 | NPCM7xxFIUState *fiu = f->fiu; | ||
72 | uint32_t dwr_cfg; | ||
73 | - int cs_id; | ||
74 | + unsigned cs_id; | ||
75 | int i; | ||
76 | |||
77 | if (fiu->active_cs != -1) { | ||
78 | diff --git a/hw/ssi/trace-events b/hw/ssi/trace-events | ||
79 | index XXXXXXX..XXXXXXX 100644 | ||
80 | --- a/hw/ssi/trace-events | ||
81 | +++ b/hw/ssi/trace-events | ||
82 | @@ -XXX,XX +XXX,XX @@ npcm7xx_fiu_deselect(const char *id, int cs) "%s deselect CS%d" | ||
83 | npcm7xx_fiu_ctrl_read(const char *id, uint64_t addr, uint32_t data) "%s offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 | ||
84 | npcm7xx_fiu_ctrl_write(const char *id, uint64_t addr, uint32_t data) "%s offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 | ||
85 | npcm7xx_fiu_flash_read(const char *id, int cs, uint64_t addr, unsigned int size, uint64_t value) "%s[%d] offset: 0x%08" PRIx64 " size: %u value: 0x%" PRIx64 | ||
86 | -npcm7xx_fiu_flash_write(const char *id, int cs, uint64_t addr, unsigned int size, uint64_t value) "%s[%d] offset: 0x%08" PRIx64 " size: %u value: 0x%" PRIx64 | ||
87 | +npcm7xx_fiu_flash_write(const char *id, unsigned cs, uint64_t addr, unsigned int size, uint64_t value) "%s[%d] offset: 0x%08" PRIx64 " size: %u value: 0x%" PRIx64 | ||
88 | -- | ||
89 | 2.20.1 | ||
90 | |||
91 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Message-id: 20201002080935.1660005-1-f4bug@amsat.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | include/hw/arm/fsl-imx25.h | 2 +- | ||
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/include/hw/arm/fsl-imx25.h | ||
14 | +++ b/include/hw/arm/fsl-imx25.h | ||
15 | @@ -XXX,XX +XXX,XX @@ struct FslIMX25State { | ||
16 | * 0xBB00_0000 0xBB00_0FFF 4 Kbytes NAND flash main area buffer | ||
17 | * 0xBB00_1000 0xBB00_11FF 512 B NAND flash spare area buffer | ||
18 | * 0xBB00_1200 0xBB00_1DFF 3 Kbytes Reserved | ||
19 | - * 0xBB00_1E00 0xBB00_1FFF 512 B NAND flash control regisers | ||
20 | + * 0xBB00_1E00 0xBB00_1FFF 512 B NAND flash control registers | ||
21 | * 0xBB01_2000 0xBFFF_FFFF 96 Mbytes (minus 8 Kbytes) Reserved | ||
22 | * 0xC000_0000 0xFFFF_FFFF 1024 Mbytes Reserved | ||
23 | */ | ||
24 | -- | ||
25 | 2.20.1 | ||
26 | |||
27 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Graeme Gregory <graeme@nuviainc.com> | ||
2 | 1 | ||
3 | SMMUv3 has an error in a previous patch where an i was transposed to a 1 | ||
4 | meaning interrupts would not have been correctly assigned to the SMMUv3 | ||
5 | instance. | ||
6 | |||
7 | Fixes: 48ba18e6d3f3 ("hw/arm/sbsa-ref: Simplify by moving the gic in the machine state") | ||
8 | Signed-off-by: Graeme Gregory <graeme@nuviainc.com> | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
11 | Message-id: 20201007100732.4103790-2-graeme@nuviainc.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/sbsa-ref.c | 2 +- | ||
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/sbsa-ref.c | ||
20 | +++ b/hw/arm/sbsa-ref.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus) | ||
22 | sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); | ||
23 | for (i = 0; i < NUM_SMMU_IRQS; i++) { | ||
24 | sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, | ||
25 | - qdev_get_gpio_in(sms->gic, irq + 1)); | ||
26 | + qdev_get_gpio_in(sms->gic, irq + i)); | ||
27 | } | ||
28 | } | ||
29 | |||
30 | -- | ||
31 | 2.20.1 | ||
32 | |||
33 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Graeme Gregory <graeme@nuviainc.com> | ||
2 | 1 | ||
3 | Original commit did not allocate IRQs for the SMMUv3 in the irqmap | ||
4 | effectively using irq 0->3 (shared with other devices). Assuming | ||
5 | original intent was to allocate unique IRQs then add an allocation | ||
6 | to the irqmap. | ||
7 | |||
8 | Fixes: e9fdf453240 ("hw/arm: Add arm SBSA reference machine, devices part") | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Signed-off-by: Graeme Gregory <graeme@nuviainc.com> | ||
11 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
12 | Message-id: 20201007100732.4103790-3-graeme@nuviainc.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/arm/sbsa-ref.c | 1 + | ||
16 | 1 file changed, 1 insertion(+) | ||
17 | |||
18 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/arm/sbsa-ref.c | ||
21 | +++ b/hw/arm/sbsa-ref.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static const int sbsa_ref_irqmap[] = { | ||
23 | [SBSA_SECURE_UART_MM] = 9, | ||
24 | [SBSA_AHCI] = 10, | ||
25 | [SBSA_EHCI] = 11, | ||
26 | + [SBSA_SMMU] = 12, /* ... to 15 */ | ||
27 | }; | ||
28 | |||
29 | static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx) | ||
30 | -- | ||
31 | 2.20.1 | ||
32 | |||
33 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | The "BCM2835 ARM Peripherals" datasheet [*] chapter 2 | ||
4 | ("Auxiliaries: UART1 & SPI1, SPI2"), list the register | ||
5 | sizes as 3/8/16/32 bits. We assume this means this | ||
6 | peripheral allows 8-bit accesses. | ||
7 | |||
8 | This was not an issue until commit 5d971f9e67 which reverted | ||
9 | ("memory: accept mismatching sizes in memory_region_access_valid"). | ||
10 | |||
11 | The model is implemented as 32-bit accesses (see commit 97398d900c, | ||
12 | all registers are 32-bit) so replace MemoryRegionOps.valid as | ||
13 | MemoryRegionOps.impl, and re-introduce MemoryRegionOps.valid | ||
14 | with a 8/32-bit range. | ||
15 | |||
16 | [*] https://www.raspberrypi.org/app/uploads/2012/02/BCM2835-ARM-Peripherals.pdf | ||
17 | |||
18 | Fixes: 97398d900c ("bcm2835_aux: add emulation of BCM2835 AUX (aka UART1) block") | ||
19 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
20 | Message-id: 20201002181032.1899463-1-f4bug@amsat.org | ||
21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
23 | --- | ||
24 | hw/char/bcm2835_aux.c | 4 +++- | ||
25 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
26 | |||
27 | diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/hw/char/bcm2835_aux.c | ||
30 | +++ b/hw/char/bcm2835_aux.c | ||
31 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps bcm2835_aux_ops = { | ||
32 | .read = bcm2835_aux_read, | ||
33 | .write = bcm2835_aux_write, | ||
34 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
35 | - .valid.min_access_size = 4, | ||
36 | + .impl.min_access_size = 4, | ||
37 | + .impl.max_access_size = 4, | ||
38 | + .valid.min_access_size = 1, | ||
39 | .valid.max_access_size = 4, | ||
40 | }; | ||
41 | |||
42 | -- | ||
43 | 2.20.1 | ||
44 | |||
45 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
2 | 1 | ||
3 | Update against Linux 5.9-rc7. | ||
4 | |||
5 | Cc: Paolo Bonzini <pbonzini@redhat.com> | ||
6 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
7 | Message-id: 20201001061718.101915-2-drjones@redhat.com | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | linux-headers/linux/kvm.h | 6 ++++-- | ||
11 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/linux-headers/linux/kvm.h | ||
16 | +++ b/linux-headers/linux/kvm.h | ||
17 | @@ -XXX,XX +XXX,XX @@ struct kvm_ppc_resize_hpt { | ||
18 | #define KVM_VM_PPC_HV 1 | ||
19 | #define KVM_VM_PPC_PR 2 | ||
20 | |||
21 | -/* on MIPS, 0 forces trap & emulate, 1 forces VZ ASE */ | ||
22 | -#define KVM_VM_MIPS_TE 0 | ||
23 | +/* on MIPS, 0 indicates auto, 1 forces VZ ASE, 2 forces trap & emulate */ | ||
24 | +#define KVM_VM_MIPS_AUTO 0 | ||
25 | #define KVM_VM_MIPS_VZ 1 | ||
26 | +#define KVM_VM_MIPS_TE 2 | ||
27 | |||
28 | #define KVM_S390_SIE_PAGE_OFFSET 1 | ||
29 | |||
30 | @@ -XXX,XX +XXX,XX @@ struct kvm_ppc_resize_hpt { | ||
31 | #define KVM_CAP_LAST_CPU 184 | ||
32 | #define KVM_CAP_SMALLER_MAXPHYADDR 185 | ||
33 | #define KVM_CAP_S390_DIAG318 186 | ||
34 | +#define KVM_CAP_STEAL_TIME 187 | ||
35 | |||
36 | #ifdef KVM_CAP_IRQ_ROUTING | ||
37 | |||
38 | -- | ||
39 | 2.20.1 | ||
40 | |||
41 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
2 | 1 | ||
3 | When we compile without KVM support !defined(CONFIG_KVM) we generate | ||
4 | stubs for functions that the linker will still encounter. Sometimes | ||
5 | these stubs can be executed safely and are placed in paths where they | ||
6 | get executed with or without KVM. Other functions should never be | ||
7 | called without KVM. Those functions should be guarded by kvm_enabled(), | ||
8 | but should also be robust to refactoring mistakes. Putting a | ||
9 | g_assert_not_reached() in the function should help. Additionally, | ||
10 | the g_assert_not_reached() calls may actually help the linker remove | ||
11 | some code. | ||
12 | |||
13 | We remove the stubs for kvm_arm_get/put_virtual_time(), as they aren't | ||
14 | necessary at all - the only caller is in kvm.c | ||
15 | |||
16 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
17 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
18 | Message-id: 20201001061718.101915-3-drjones@redhat.com | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | --- | ||
21 | target/arm/kvm_arm.h | 51 +++++++++++++++++++++++++++----------------- | ||
22 | 1 file changed, 32 insertions(+), 19 deletions(-) | ||
23 | |||
24 | diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/target/arm/kvm_arm.h | ||
27 | +++ b/target/arm/kvm_arm.h | ||
28 | @@ -XXX,XX +XXX,XX @@ int kvm_arm_set_irq(int cpu, int irqtype, int irq, int level); | ||
29 | |||
30 | #else | ||
31 | |||
32 | -static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu) | ||
33 | -{ | ||
34 | - /* | ||
35 | - * This should never actually be called in the "not KVM" case, | ||
36 | - * but set up the fields to indicate an error anyway. | ||
37 | - */ | ||
38 | - cpu->kvm_target = QEMU_KVM_ARM_TARGET_NONE; | ||
39 | - cpu->host_cpu_probe_failed = true; | ||
40 | -} | ||
41 | - | ||
42 | -static inline void kvm_arm_add_vcpu_properties(Object *obj) {} | ||
43 | - | ||
44 | +/* | ||
45 | + * It's safe to call these functions without KVM support. | ||
46 | + * They should either do nothing or return "not supported". | ||
47 | + */ | ||
48 | static inline bool kvm_arm_aarch32_supported(void) | ||
49 | { | ||
50 | return false; | ||
51 | @@ -XXX,XX +XXX,XX @@ static inline bool kvm_arm_sve_supported(void) | ||
52 | return false; | ||
53 | } | ||
54 | |||
55 | +/* | ||
56 | + * These functions should never actually be called without KVM support. | ||
57 | + */ | ||
58 | +static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu) | ||
59 | +{ | ||
60 | + g_assert_not_reached(); | ||
61 | +} | ||
62 | + | ||
63 | +static inline void kvm_arm_add_vcpu_properties(Object *obj) | ||
64 | +{ | ||
65 | + g_assert_not_reached(); | ||
66 | +} | ||
67 | + | ||
68 | static inline int kvm_arm_get_max_vm_ipa_size(MachineState *ms) | ||
69 | { | ||
70 | - return -ENOENT; | ||
71 | + g_assert_not_reached(); | ||
72 | } | ||
73 | |||
74 | static inline int kvm_arm_vgic_probe(void) | ||
75 | { | ||
76 | - return 0; | ||
77 | + g_assert_not_reached(); | ||
78 | } | ||
79 | |||
80 | -static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq) {} | ||
81 | -static inline void kvm_arm_pmu_init(CPUState *cs) {} | ||
82 | +static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq) | ||
83 | +{ | ||
84 | + g_assert_not_reached(); | ||
85 | +} | ||
86 | |||
87 | -static inline void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) {} | ||
88 | +static inline void kvm_arm_pmu_init(CPUState *cs) | ||
89 | +{ | ||
90 | + g_assert_not_reached(); | ||
91 | +} | ||
92 | + | ||
93 | +static inline void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) | ||
94 | +{ | ||
95 | + g_assert_not_reached(); | ||
96 | +} | ||
97 | |||
98 | -static inline void kvm_arm_get_virtual_time(CPUState *cs) {} | ||
99 | -static inline void kvm_arm_put_virtual_time(CPUState *cs) {} | ||
100 | #endif | ||
101 | |||
102 | static inline const char *gic_class_name(void) | ||
103 | -- | ||
104 | 2.20.1 | ||
105 | |||
106 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
2 | 1 | ||
3 | We'll add more to this new function in coming patches so we also | ||
4 | state the gic must be created and call it below create_gic(). | ||
5 | |||
6 | No functional change intended. | ||
7 | |||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
11 | Message-id: 20201001061718.101915-4-drjones@redhat.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/virt.c | 43 +++++++++++++++++++++++++++---------------- | ||
15 | 1 file changed, 27 insertions(+), 16 deletions(-) | ||
16 | |||
17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/virt.c | ||
20 | +++ b/hw/arm/virt.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void finalize_gic_version(VirtMachineState *vms) | ||
22 | } | ||
23 | } | ||
24 | |||
25 | +/* | ||
26 | + * virt_cpu_post_init() must be called after the CPUs have | ||
27 | + * been realized and the GIC has been created. | ||
28 | + */ | ||
29 | +static void virt_cpu_post_init(VirtMachineState *vms) | ||
30 | +{ | ||
31 | + bool aarch64; | ||
32 | + | ||
33 | + aarch64 = object_property_get_bool(OBJECT(first_cpu), "aarch64", NULL); | ||
34 | + | ||
35 | + if (!kvm_enabled()) { | ||
36 | + if (aarch64 && vms->highmem) { | ||
37 | + int requested_pa_size = 64 - clz64(vms->highest_gpa); | ||
38 | + int pamax = arm_pamax(ARM_CPU(first_cpu)); | ||
39 | + | ||
40 | + if (pamax < requested_pa_size) { | ||
41 | + error_report("VCPU supports less PA bits (%d) than " | ||
42 | + "requested by the memory map (%d)", | ||
43 | + pamax, requested_pa_size); | ||
44 | + exit(1); | ||
45 | + } | ||
46 | + } | ||
47 | + } | ||
48 | +} | ||
49 | + | ||
50 | static void machvirt_init(MachineState *machine) | ||
51 | { | ||
52 | VirtMachineState *vms = VIRT_MACHINE(machine); | ||
53 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
54 | fdt_add_timer_nodes(vms); | ||
55 | fdt_add_cpu_nodes(vms); | ||
56 | |||
57 | - if (!kvm_enabled()) { | ||
58 | - ARMCPU *cpu = ARM_CPU(first_cpu); | ||
59 | - bool aarch64 = object_property_get_bool(OBJECT(cpu), "aarch64", NULL); | ||
60 | - | ||
61 | - if (aarch64 && vms->highmem) { | ||
62 | - int requested_pa_size, pamax = arm_pamax(cpu); | ||
63 | - | ||
64 | - requested_pa_size = 64 - clz64(vms->highest_gpa); | ||
65 | - if (pamax < requested_pa_size) { | ||
66 | - error_report("VCPU supports less PA bits (%d) than requested " | ||
67 | - "by the memory map (%d)", pamax, requested_pa_size); | ||
68 | - exit(1); | ||
69 | - } | ||
70 | - } | ||
71 | - } | ||
72 | - | ||
73 | memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, | ||
74 | machine->ram); | ||
75 | if (machine->device_memory) { | ||
76 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
77 | |||
78 | create_gic(vms); | ||
79 | |||
80 | + virt_cpu_post_init(vms); | ||
81 | + | ||
82 | fdt_add_pmu_nodes(vms); | ||
83 | |||
84 | create_uart(vms, VIRT_UART, sysmem, serial_hd(0)); | ||
85 | -- | ||
86 | 2.20.1 | ||
87 | |||
88 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
2 | 1 | ||
3 | Move the KVM PMU setup part of fdt_add_pmu_nodes() to | ||
4 | virt_cpu_post_init(), which is a more appropriate location. Now | ||
5 | fdt_add_pmu_nodes() is also named more appropriately, because it | ||
6 | no longer does anything but fdt node creation. | ||
7 | |||
8 | No functional change intended. | ||
9 | |||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
12 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
13 | Message-id: 20201001061718.101915-5-drjones@redhat.com | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | hw/arm/virt.c | 34 ++++++++++++++++++---------------- | ||
17 | 1 file changed, 18 insertions(+), 16 deletions(-) | ||
18 | |||
19 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/arm/virt.c | ||
22 | +++ b/hw/arm/virt.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_gic_node(VirtMachineState *vms) | ||
24 | |||
25 | static void fdt_add_pmu_nodes(const VirtMachineState *vms) | ||
26 | { | ||
27 | - CPUState *cpu; | ||
28 | - ARMCPU *armcpu; | ||
29 | + ARMCPU *armcpu = ARM_CPU(first_cpu); | ||
30 | uint32_t irqflags = GIC_FDT_IRQ_FLAGS_LEVEL_HI; | ||
31 | |||
32 | - CPU_FOREACH(cpu) { | ||
33 | - armcpu = ARM_CPU(cpu); | ||
34 | - if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU)) { | ||
35 | - return; | ||
36 | - } | ||
37 | - if (kvm_enabled()) { | ||
38 | - if (kvm_irqchip_in_kernel()) { | ||
39 | - kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ)); | ||
40 | - } | ||
41 | - kvm_arm_pmu_init(cpu); | ||
42 | - } | ||
43 | + if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU)) { | ||
44 | + assert(!object_property_get_bool(OBJECT(armcpu), "pmu", NULL)); | ||
45 | + return; | ||
46 | } | ||
47 | |||
48 | if (vms->gic_version == VIRT_GIC_VERSION_2) { | ||
49 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms) | ||
50 | (1 << vms->smp_cpus) - 1); | ||
51 | } | ||
52 | |||
53 | - armcpu = ARM_CPU(qemu_get_cpu(0)); | ||
54 | qemu_fdt_add_subnode(vms->fdt, "/pmu"); | ||
55 | if (arm_feature(&armcpu->env, ARM_FEATURE_V8)) { | ||
56 | const char compat[] = "arm,armv8-pmuv3"; | ||
57 | @@ -XXX,XX +XXX,XX @@ static void finalize_gic_version(VirtMachineState *vms) | ||
58 | */ | ||
59 | static void virt_cpu_post_init(VirtMachineState *vms) | ||
60 | { | ||
61 | - bool aarch64; | ||
62 | + bool aarch64, pmu; | ||
63 | + CPUState *cpu; | ||
64 | |||
65 | aarch64 = object_property_get_bool(OBJECT(first_cpu), "aarch64", NULL); | ||
66 | + pmu = object_property_get_bool(OBJECT(first_cpu), "pmu", NULL); | ||
67 | |||
68 | - if (!kvm_enabled()) { | ||
69 | + if (kvm_enabled()) { | ||
70 | + CPU_FOREACH(cpu) { | ||
71 | + if (pmu) { | ||
72 | + assert(arm_feature(&ARM_CPU(cpu)->env, ARM_FEATURE_PMU)); | ||
73 | + if (kvm_irqchip_in_kernel()) { | ||
74 | + kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ)); | ||
75 | + } | ||
76 | + kvm_arm_pmu_init(cpu); | ||
77 | + } | ||
78 | + } | ||
79 | + } else { | ||
80 | if (aarch64 && vms->highmem) { | ||
81 | int requested_pa_size = 64 - clz64(vms->highest_gpa); | ||
82 | int pamax = arm_pamax(ARM_CPU(first_cpu)); | ||
83 | -- | ||
84 | 2.20.1 | ||
85 | |||
86 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
2 | 1 | ||
3 | arm-cpu-features got dropped from the AArch64 tests during the meson | ||
4 | conversion shuffle. | ||
5 | |||
6 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
7 | Message-id: 20201001061718.101915-6-drjones@redhat.com | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | tests/qtest/meson.build | 3 ++- | ||
12 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/tests/qtest/meson.build | ||
17 | +++ b/tests/qtest/meson.build | ||
18 | @@ -XXX,XX +XXX,XX @@ qtests_aarch64 = \ | ||
19 | (cpu != 'arm' ? ['bios-tables-test'] : []) + \ | ||
20 | (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) + \ | ||
21 | (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) + \ | ||
22 | - ['numa-test', | ||
23 | + ['arm-cpu-features', | ||
24 | + 'numa-test', | ||
25 | 'boot-serial-test', | ||
26 | 'migration-test'] | ||
27 | |||
28 | -- | ||
29 | 2.20.1 | ||
30 | |||
31 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
2 | 1 | ||
3 | We add the kvm-steal-time CPU property and implement it for machvirt. | ||
4 | A tiny bit of refactoring was also done to allow pmu and pvtime to | ||
5 | use the same vcpu device helper functions. | ||
6 | |||
7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
8 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
9 | Message-id: 20201001061718.101915-7-drjones@redhat.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | docs/system/arm/cpu-features.rst | 11 ++++++ | ||
13 | include/hw/arm/virt.h | 5 +++ | ||
14 | target/arm/cpu.h | 4 ++ | ||
15 | target/arm/kvm_arm.h | 43 +++++++++++++++++++++ | ||
16 | hw/arm/virt.c | 43 +++++++++++++++++++-- | ||
17 | target/arm/cpu.c | 8 ++++ | ||
18 | target/arm/kvm.c | 16 ++++++++ | ||
19 | target/arm/kvm64.c | 64 +++++++++++++++++++++++++++++--- | ||
20 | target/arm/monitor.c | 2 +- | ||
21 | tests/qtest/arm-cpu-features.c | 25 +++++++++++-- | ||
22 | 10 files changed, 208 insertions(+), 13 deletions(-) | ||
23 | |||
24 | diff --git a/docs/system/arm/cpu-features.rst b/docs/system/arm/cpu-features.rst | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/docs/system/arm/cpu-features.rst | ||
27 | +++ b/docs/system/arm/cpu-features.rst | ||
28 | @@ -XXX,XX +XXX,XX @@ the list of KVM VCPU features and their descriptions. | ||
29 | adjustment, also restoring the legacy (pre-5.0) | ||
30 | behavior. | ||
31 | |||
32 | + kvm-steal-time Since v5.2, kvm-steal-time is enabled by | ||
33 | + default when KVM is enabled, the feature is | ||
34 | + supported, and the guest is 64-bit. | ||
35 | + | ||
36 | + When kvm-steal-time is enabled a 64-bit guest | ||
37 | + can account for time its CPUs were not running | ||
38 | + due to the host not scheduling the corresponding | ||
39 | + VCPU threads. The accounting statistics may | ||
40 | + influence the guest scheduler behavior and/or be | ||
41 | + exposed to the guest userspace. | ||
42 | + | ||
43 | SVE CPU Properties | ||
44 | ================== | ||
45 | |||
46 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/include/hw/arm/virt.h | ||
49 | +++ b/include/hw/arm/virt.h | ||
50 | @@ -XXX,XX +XXX,XX @@ | ||
51 | |||
52 | #define PPI(irq) ((irq) + 16) | ||
53 | |||
54 | +/* See Linux kernel arch/arm64/include/asm/pvclock-abi.h */ | ||
55 | +#define PVTIME_SIZE_PER_CPU 64 | ||
56 | + | ||
57 | enum { | ||
58 | VIRT_FLASH, | ||
59 | VIRT_MEM, | ||
60 | @@ -XXX,XX +XXX,XX @@ enum { | ||
61 | VIRT_PCDIMM_ACPI, | ||
62 | VIRT_ACPI_GED, | ||
63 | VIRT_NVDIMM_ACPI, | ||
64 | + VIRT_PVTIME, | ||
65 | VIRT_LOWMEMMAP_LAST, | ||
66 | }; | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ struct VirtMachineClass { | ||
69 | bool no_highmem_ecam; | ||
70 | bool no_ged; /* Machines < 4.2 has no support for ACPI GED device */ | ||
71 | bool kvm_no_adjvtime; | ||
72 | + bool no_kvm_steal_time; | ||
73 | bool acpi_expose_flash; | ||
74 | }; | ||
75 | |||
76 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
77 | index XXXXXXX..XXXXXXX 100644 | ||
78 | --- a/target/arm/cpu.h | ||
79 | +++ b/target/arm/cpu.h | ||
80 | @@ -XXX,XX +XXX,XX @@ | ||
81 | #include "hw/registerfields.h" | ||
82 | #include "cpu-qom.h" | ||
83 | #include "exec/cpu-defs.h" | ||
84 | +#include "qapi/qapi-types-common.h" | ||
85 | |||
86 | /* ARM processors have a weak memory model */ | ||
87 | #define TCG_GUEST_DEFAULT_MO (0) | ||
88 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | ||
89 | bool kvm_vtime_dirty; | ||
90 | uint64_t kvm_vtime; | ||
91 | |||
92 | + /* KVM steal time */ | ||
93 | + OnOffAuto kvm_steal_time; | ||
94 | + | ||
95 | /* Uniprocessor system with MP extensions */ | ||
96 | bool mp_is_up; | ||
97 | |||
98 | diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h | ||
99 | index XXXXXXX..XXXXXXX 100644 | ||
100 | --- a/target/arm/kvm_arm.h | ||
101 | +++ b/target/arm/kvm_arm.h | ||
102 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu); | ||
103 | */ | ||
104 | void kvm_arm_add_vcpu_properties(Object *obj); | ||
105 | |||
106 | +/** | ||
107 | + * kvm_arm_steal_time_finalize: | ||
108 | + * @cpu: ARMCPU for which to finalize kvm-steal-time | ||
109 | + * @errp: Pointer to Error* for error propagation | ||
110 | + * | ||
111 | + * Validate the kvm-steal-time property selection and set its default | ||
112 | + * based on KVM support and guest configuration. | ||
113 | + */ | ||
114 | +void kvm_arm_steal_time_finalize(ARMCPU *cpu, Error **errp); | ||
115 | + | ||
116 | +/** | ||
117 | + * kvm_arm_steal_time_supported: | ||
118 | + * | ||
119 | + * Returns: true if KVM can enable steal time reporting | ||
120 | + * and false otherwise. | ||
121 | + */ | ||
122 | +bool kvm_arm_steal_time_supported(void); | ||
123 | + | ||
124 | /** | ||
125 | * kvm_arm_aarch32_supported: | ||
126 | * | ||
127 | @@ -XXX,XX +XXX,XX @@ int kvm_arm_vgic_probe(void); | ||
128 | |||
129 | void kvm_arm_pmu_set_irq(CPUState *cs, int irq); | ||
130 | void kvm_arm_pmu_init(CPUState *cs); | ||
131 | + | ||
132 | +/** | ||
133 | + * kvm_arm_pvtime_init: | ||
134 | + * @cs: CPUState | ||
135 | + * @ipa: Per-vcpu guest physical base address of the pvtime structures | ||
136 | + * | ||
137 | + * Initializes PVTIME for the VCPU, setting the PVTIME IPA to @ipa. | ||
138 | + */ | ||
139 | +void kvm_arm_pvtime_init(CPUState *cs, uint64_t ipa); | ||
140 | + | ||
141 | int kvm_arm_set_irq(int cpu, int irqtype, int irq, int level); | ||
142 | |||
143 | #else | ||
144 | @@ -XXX,XX +XXX,XX @@ static inline bool kvm_arm_sve_supported(void) | ||
145 | return false; | ||
146 | } | ||
147 | |||
148 | +static inline bool kvm_arm_steal_time_supported(void) | ||
149 | +{ | ||
150 | + return false; | ||
151 | +} | ||
152 | + | ||
153 | /* | ||
154 | * These functions should never actually be called without KVM support. | ||
155 | */ | ||
156 | @@ -XXX,XX +XXX,XX @@ static inline void kvm_arm_pmu_init(CPUState *cs) | ||
157 | g_assert_not_reached(); | ||
158 | } | ||
159 | |||
160 | +static inline void kvm_arm_pvtime_init(CPUState *cs, uint64_t ipa) | ||
161 | +{ | ||
162 | + g_assert_not_reached(); | ||
163 | +} | ||
164 | + | ||
165 | +static inline void kvm_arm_steal_time_finalize(ARMCPU *cpu, Error **errp) | ||
166 | +{ | ||
167 | + g_assert_not_reached(); | ||
168 | +} | ||
169 | + | ||
170 | static inline void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) | ||
171 | { | ||
172 | g_assert_not_reached(); | ||
173 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
174 | index XXXXXXX..XXXXXXX 100644 | ||
175 | --- a/hw/arm/virt.c | ||
176 | +++ b/hw/arm/virt.c | ||
177 | @@ -XXX,XX +XXX,XX @@ static const MemMapEntry base_memmap[] = { | ||
178 | [VIRT_PCDIMM_ACPI] = { 0x09070000, MEMORY_HOTPLUG_IO_LEN }, | ||
179 | [VIRT_ACPI_GED] = { 0x09080000, ACPI_GED_EVT_SEL_LEN }, | ||
180 | [VIRT_NVDIMM_ACPI] = { 0x09090000, NVDIMM_ACPI_IO_LEN}, | ||
181 | + [VIRT_PVTIME] = { 0x090a0000, 0x00010000 }, | ||
182 | [VIRT_MMIO] = { 0x0a000000, 0x00000200 }, | ||
183 | /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */ | ||
184 | [VIRT_PLATFORM_BUS] = { 0x0c000000, 0x02000000 }, | ||
185 | @@ -XXX,XX +XXX,XX @@ static void finalize_gic_version(VirtMachineState *vms) | ||
186 | * virt_cpu_post_init() must be called after the CPUs have | ||
187 | * been realized and the GIC has been created. | ||
188 | */ | ||
189 | -static void virt_cpu_post_init(VirtMachineState *vms) | ||
190 | +static void virt_cpu_post_init(VirtMachineState *vms, int max_cpus, | ||
191 | + MemoryRegion *sysmem) | ||
192 | { | ||
193 | - bool aarch64, pmu; | ||
194 | + bool aarch64, pmu, steal_time; | ||
195 | CPUState *cpu; | ||
196 | |||
197 | aarch64 = object_property_get_bool(OBJECT(first_cpu), "aarch64", NULL); | ||
198 | pmu = object_property_get_bool(OBJECT(first_cpu), "pmu", NULL); | ||
199 | + steal_time = object_property_get_bool(OBJECT(first_cpu), | ||
200 | + "kvm-steal-time", NULL); | ||
201 | |||
202 | if (kvm_enabled()) { | ||
203 | + hwaddr pvtime_reg_base = vms->memmap[VIRT_PVTIME].base; | ||
204 | + hwaddr pvtime_reg_size = vms->memmap[VIRT_PVTIME].size; | ||
205 | + | ||
206 | + if (steal_time) { | ||
207 | + MemoryRegion *pvtime = g_new(MemoryRegion, 1); | ||
208 | + hwaddr pvtime_size = max_cpus * PVTIME_SIZE_PER_CPU; | ||
209 | + | ||
210 | + /* The memory region size must be a multiple of host page size. */ | ||
211 | + pvtime_size = REAL_HOST_PAGE_ALIGN(pvtime_size); | ||
212 | + | ||
213 | + if (pvtime_size > pvtime_reg_size) { | ||
214 | + error_report("pvtime requires a %ld byte memory region for " | ||
215 | + "%d CPUs, but only %ld has been reserved", | ||
216 | + pvtime_size, max_cpus, pvtime_reg_size); | ||
217 | + exit(1); | ||
218 | + } | ||
219 | + | ||
220 | + memory_region_init_ram(pvtime, NULL, "pvtime", pvtime_size, NULL); | ||
221 | + memory_region_add_subregion(sysmem, pvtime_reg_base, pvtime); | ||
222 | + } | ||
223 | + | ||
224 | CPU_FOREACH(cpu) { | ||
225 | if (pmu) { | ||
226 | assert(arm_feature(&ARM_CPU(cpu)->env, ARM_FEATURE_PMU)); | ||
227 | @@ -XXX,XX +XXX,XX @@ static void virt_cpu_post_init(VirtMachineState *vms) | ||
228 | } | ||
229 | kvm_arm_pmu_init(cpu); | ||
230 | } | ||
231 | + if (steal_time) { | ||
232 | + kvm_arm_pvtime_init(cpu, pvtime_reg_base + | ||
233 | + cpu->cpu_index * PVTIME_SIZE_PER_CPU); | ||
234 | + } | ||
235 | } | ||
236 | } else { | ||
237 | if (aarch64 && vms->highmem) { | ||
238 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
239 | object_property_set_bool(cpuobj, "kvm-no-adjvtime", true, NULL); | ||
240 | } | ||
241 | |||
242 | + if (vmc->no_kvm_steal_time && | ||
243 | + object_property_find(cpuobj, "kvm-steal-time")) { | ||
244 | + object_property_set_bool(cpuobj, "kvm-steal-time", false, NULL); | ||
245 | + } | ||
246 | + | ||
247 | if (vmc->no_pmu && object_property_find(cpuobj, "pmu")) { | ||
248 | object_property_set_bool(cpuobj, "pmu", false, NULL); | ||
249 | } | ||
250 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
251 | |||
252 | create_gic(vms); | ||
253 | |||
254 | - virt_cpu_post_init(vms); | ||
255 | + virt_cpu_post_init(vms, possible_cpus->len, sysmem); | ||
256 | |||
257 | fdt_add_pmu_nodes(vms); | ||
258 | |||
259 | @@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(5, 2) | ||
260 | |||
261 | static void virt_machine_5_1_options(MachineClass *mc) | ||
262 | { | ||
263 | + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); | ||
264 | + | ||
265 | virt_machine_5_2_options(mc); | ||
266 | compat_props_add(mc->compat_props, hw_compat_5_1, hw_compat_5_1_len); | ||
267 | + vmc->no_kvm_steal_time = true; | ||
268 | } | ||
269 | DEFINE_VIRT_MACHINE(5, 1) | ||
270 | |||
271 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
272 | index XXXXXXX..XXXXXXX 100644 | ||
273 | --- a/target/arm/cpu.c | ||
274 | +++ b/target/arm/cpu.c | ||
275 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp) | ||
276 | return; | ||
277 | } | ||
278 | } | ||
279 | + | ||
280 | + if (kvm_enabled()) { | ||
281 | + kvm_arm_steal_time_finalize(cpu, &local_err); | ||
282 | + if (local_err != NULL) { | ||
283 | + error_propagate(errp, local_err); | ||
284 | + return; | ||
285 | + } | ||
286 | + } | ||
287 | } | ||
288 | |||
289 | static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | ||
290 | diff --git a/target/arm/kvm.c b/target/arm/kvm.c | ||
291 | index XXXXXXX..XXXXXXX 100644 | ||
292 | --- a/target/arm/kvm.c | ||
293 | +++ b/target/arm/kvm.c | ||
294 | @@ -XXX,XX +XXX,XX @@ static void kvm_no_adjvtime_set(Object *obj, bool value, Error **errp) | ||
295 | ARM_CPU(obj)->kvm_adjvtime = !value; | ||
296 | } | ||
297 | |||
298 | +static bool kvm_steal_time_get(Object *obj, Error **errp) | ||
299 | +{ | ||
300 | + return ARM_CPU(obj)->kvm_steal_time != ON_OFF_AUTO_OFF; | ||
301 | +} | ||
302 | + | ||
303 | +static void kvm_steal_time_set(Object *obj, bool value, Error **errp) | ||
304 | +{ | ||
305 | + ARM_CPU(obj)->kvm_steal_time = value ? ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF; | ||
306 | +} | ||
307 | + | ||
308 | /* KVM VCPU properties should be prefixed with "kvm-". */ | ||
309 | void kvm_arm_add_vcpu_properties(Object *obj) | ||
310 | { | ||
311 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_add_vcpu_properties(Object *obj) | ||
312 | "the virtual counter. VM stopped time " | ||
313 | "will be counted."); | ||
314 | } | ||
315 | + | ||
316 | + cpu->kvm_steal_time = ON_OFF_AUTO_AUTO; | ||
317 | + object_property_add_bool(obj, "kvm-steal-time", kvm_steal_time_get, | ||
318 | + kvm_steal_time_set); | ||
319 | + object_property_set_description(obj, "kvm-steal-time", | ||
320 | + "Set off to disable KVM steal time."); | ||
321 | } | ||
322 | |||
323 | bool kvm_arm_pmu_supported(void) | ||
324 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
325 | index XXXXXXX..XXXXXXX 100644 | ||
326 | --- a/target/arm/kvm64.c | ||
327 | +++ b/target/arm/kvm64.c | ||
328 | @@ -XXX,XX +XXX,XX @@ | ||
329 | #include <linux/kvm.h> | ||
330 | |||
331 | #include "qemu-common.h" | ||
332 | +#include "qapi/error.h" | ||
333 | #include "cpu.h" | ||
334 | #include "qemu/timer.h" | ||
335 | #include "qemu/error-report.h" | ||
336 | @@ -XXX,XX +XXX,XX @@ static CPUWatchpoint *find_hw_watchpoint(CPUState *cpu, target_ulong addr) | ||
337 | return NULL; | ||
338 | } | ||
339 | |||
340 | -static bool kvm_arm_pmu_set_attr(CPUState *cs, struct kvm_device_attr *attr) | ||
341 | +static bool kvm_arm_set_device_attr(CPUState *cs, struct kvm_device_attr *attr, | ||
342 | + const char *name) | ||
343 | { | ||
344 | int err; | ||
345 | |||
346 | err = kvm_vcpu_ioctl(cs, KVM_HAS_DEVICE_ATTR, attr); | ||
347 | if (err != 0) { | ||
348 | - error_report("PMU: KVM_HAS_DEVICE_ATTR: %s", strerror(-err)); | ||
349 | + error_report("%s: KVM_HAS_DEVICE_ATTR: %s", name, strerror(-err)); | ||
350 | return false; | ||
351 | } | ||
352 | |||
353 | err = kvm_vcpu_ioctl(cs, KVM_SET_DEVICE_ATTR, attr); | ||
354 | if (err != 0) { | ||
355 | - error_report("PMU: KVM_SET_DEVICE_ATTR: %s", strerror(-err)); | ||
356 | + error_report("%s: KVM_SET_DEVICE_ATTR: %s", name, strerror(-err)); | ||
357 | return false; | ||
358 | } | ||
359 | |||
360 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_pmu_init(CPUState *cs) | ||
361 | if (!ARM_CPU(cs)->has_pmu) { | ||
362 | return; | ||
363 | } | ||
364 | - if (!kvm_arm_pmu_set_attr(cs, &attr)) { | ||
365 | + if (!kvm_arm_set_device_attr(cs, &attr, "PMU")) { | ||
366 | error_report("failed to init PMU"); | ||
367 | abort(); | ||
368 | } | ||
369 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_pmu_set_irq(CPUState *cs, int irq) | ||
370 | if (!ARM_CPU(cs)->has_pmu) { | ||
371 | return; | ||
372 | } | ||
373 | - if (!kvm_arm_pmu_set_attr(cs, &attr)) { | ||
374 | + if (!kvm_arm_set_device_attr(cs, &attr, "PMU")) { | ||
375 | error_report("failed to set irq for PMU"); | ||
376 | abort(); | ||
377 | } | ||
378 | } | ||
379 | |||
380 | +void kvm_arm_pvtime_init(CPUState *cs, uint64_t ipa) | ||
381 | +{ | ||
382 | + struct kvm_device_attr attr = { | ||
383 | + .group = KVM_ARM_VCPU_PVTIME_CTRL, | ||
384 | + .attr = KVM_ARM_VCPU_PVTIME_IPA, | ||
385 | + .addr = (uint64_t)&ipa, | ||
386 | + }; | ||
387 | + | ||
388 | + if (ARM_CPU(cs)->kvm_steal_time == ON_OFF_AUTO_OFF) { | ||
389 | + return; | ||
390 | + } | ||
391 | + if (!kvm_arm_set_device_attr(cs, &attr, "PVTIME IPA")) { | ||
392 | + error_report("failed to init PVTIME IPA"); | ||
393 | + abort(); | ||
394 | + } | ||
395 | +} | ||
396 | + | ||
397 | static int read_sys_reg32(int fd, uint32_t *pret, uint64_t id) | ||
398 | { | ||
399 | uint64_t ret; | ||
400 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | ||
401 | return true; | ||
402 | } | ||
403 | |||
404 | +void kvm_arm_steal_time_finalize(ARMCPU *cpu, Error **errp) | ||
405 | +{ | ||
406 | + bool has_steal_time = kvm_arm_steal_time_supported(); | ||
407 | + | ||
408 | + if (cpu->kvm_steal_time == ON_OFF_AUTO_AUTO) { | ||
409 | + if (!has_steal_time || !arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { | ||
410 | + cpu->kvm_steal_time = ON_OFF_AUTO_OFF; | ||
411 | + } else { | ||
412 | + cpu->kvm_steal_time = ON_OFF_AUTO_ON; | ||
413 | + } | ||
414 | + } else if (cpu->kvm_steal_time == ON_OFF_AUTO_ON) { | ||
415 | + if (!has_steal_time) { | ||
416 | + error_setg(errp, "'kvm-steal-time' cannot be enabled " | ||
417 | + "on this host"); | ||
418 | + return; | ||
419 | + } else if (!arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { | ||
420 | + /* | ||
421 | + * DEN0057A chapter 2 says "This specification only covers | ||
422 | + * systems in which the Execution state of the hypervisor | ||
423 | + * as well as EL1 of virtual machines is AArch64.". And, | ||
424 | + * to ensure that, the smc/hvc calls are only specified as | ||
425 | + * smc64/hvc64. | ||
426 | + */ | ||
427 | + error_setg(errp, "'kvm-steal-time' cannot be enabled " | ||
428 | + "for AArch32 guests"); | ||
429 | + return; | ||
430 | + } | ||
431 | + } | ||
432 | +} | ||
433 | + | ||
434 | bool kvm_arm_aarch32_supported(void) | ||
435 | { | ||
436 | return kvm_check_extension(kvm_state, KVM_CAP_ARM_EL1_32BIT); | ||
437 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_sve_supported(void) | ||
438 | return kvm_check_extension(kvm_state, KVM_CAP_ARM_SVE); | ||
439 | } | ||
440 | |||
441 | +bool kvm_arm_steal_time_supported(void) | ||
442 | +{ | ||
443 | + return kvm_check_extension(kvm_state, KVM_CAP_STEAL_TIME); | ||
444 | +} | ||
445 | + | ||
446 | QEMU_BUILD_BUG_ON(KVM_ARM64_SVE_VQ_MIN != 1); | ||
447 | |||
448 | void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) | ||
449 | diff --git a/target/arm/monitor.c b/target/arm/monitor.c | ||
450 | index XXXXXXX..XXXXXXX 100644 | ||
451 | --- a/target/arm/monitor.c | ||
452 | +++ b/target/arm/monitor.c | ||
453 | @@ -XXX,XX +XXX,XX @@ static const char *cpu_model_advertised_features[] = { | ||
454 | "sve128", "sve256", "sve384", "sve512", | ||
455 | "sve640", "sve768", "sve896", "sve1024", "sve1152", "sve1280", | ||
456 | "sve1408", "sve1536", "sve1664", "sve1792", "sve1920", "sve2048", | ||
457 | - "kvm-no-adjvtime", | ||
458 | + "kvm-no-adjvtime", "kvm-steal-time", | ||
459 | NULL | ||
460 | }; | ||
461 | |||
462 | diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c | ||
463 | index XXXXXXX..XXXXXXX 100644 | ||
464 | --- a/tests/qtest/arm-cpu-features.c | ||
465 | +++ b/tests/qtest/arm-cpu-features.c | ||
466 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion(const void *data) | ||
467 | assert_set_feature(qts, "max", "pmu", true); | ||
468 | |||
469 | assert_has_not_feature(qts, "max", "kvm-no-adjvtime"); | ||
470 | + assert_has_not_feature(qts, "max", "kvm-steal-time"); | ||
471 | |||
472 | if (g_str_equal(qtest_get_arch(), "aarch64")) { | ||
473 | assert_has_feature_enabled(qts, "max", "aarch64"); | ||
474 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data) | ||
475 | assert_set_feature(qts, "host", "kvm-no-adjvtime", false); | ||
476 | |||
477 | if (g_str_equal(qtest_get_arch(), "aarch64")) { | ||
478 | + bool kvm_supports_steal_time; | ||
479 | bool kvm_supports_sve; | ||
480 | char max_name[8], name[8]; | ||
481 | uint32_t max_vq, vq; | ||
482 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data) | ||
483 | QDict *resp; | ||
484 | char *error; | ||
485 | |||
486 | + assert_error(qts, "cortex-a15", | ||
487 | + "We cannot guarantee the CPU type 'cortex-a15' works " | ||
488 | + "with KVM on this host", NULL); | ||
489 | + | ||
490 | assert_has_feature_enabled(qts, "host", "aarch64"); | ||
491 | |||
492 | /* Enabling and disabling pmu should always work. */ | ||
493 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data) | ||
494 | assert_set_feature(qts, "host", "pmu", false); | ||
495 | assert_set_feature(qts, "host", "pmu", true); | ||
496 | |||
497 | - assert_error(qts, "cortex-a15", | ||
498 | - "We cannot guarantee the CPU type 'cortex-a15' works " | ||
499 | - "with KVM on this host", NULL); | ||
500 | - | ||
501 | + /* | ||
502 | + * Some features would be enabled by default, but they're disabled | ||
503 | + * because this instance of KVM doesn't support them. Test that the | ||
504 | + * features are present, and, when enabled, issue further tests. | ||
505 | + */ | ||
506 | + assert_has_feature(qts, "host", "kvm-steal-time"); | ||
507 | assert_has_feature(qts, "host", "sve"); | ||
508 | + | ||
509 | resp = do_query_no_props(qts, "host"); | ||
510 | + kvm_supports_steal_time = resp_get_feature(resp, "kvm-steal-time"); | ||
511 | kvm_supports_sve = resp_get_feature(resp, "sve"); | ||
512 | vls = resp_get_sve_vls(resp); | ||
513 | qobject_unref(resp); | ||
514 | |||
515 | + if (kvm_supports_steal_time) { | ||
516 | + /* If we have steal-time then we should be able to toggle it. */ | ||
517 | + assert_set_feature(qts, "host", "kvm-steal-time", false); | ||
518 | + assert_set_feature(qts, "host", "kvm-steal-time", true); | ||
519 | + } | ||
520 | + | ||
521 | if (kvm_supports_sve) { | ||
522 | g_assert(vls != 0); | ||
523 | max_vq = 64 - __builtin_clzll(vls); | ||
524 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data) | ||
525 | assert_has_not_feature(qts, "host", "aarch64"); | ||
526 | assert_has_not_feature(qts, "host", "pmu"); | ||
527 | assert_has_not_feature(qts, "host", "sve"); | ||
528 | + assert_has_not_feature(qts, "host", "kvm-steal-time"); | ||
529 | } | ||
530 | |||
531 | qtest_quit(qts); | ||
532 | -- | ||
533 | 2.20.1 | ||
534 | |||
535 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | QEMU supports a 48-bit physical address range, but we don't currently | ||
2 | expose it in the '-cpu max' ID registers (you get the same range as | ||
3 | Cortex-A57, which is 44 bits). | ||
4 | 1 | ||
5 | Set the ID_AA64MMFR0.PARange field to indicate 48 bits. | ||
6 | |||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20201001160116.18095-1-peter.maydell@linaro.org | ||
10 | --- | ||
11 | target/arm/cpu64.c | 4 ++++ | ||
12 | 1 file changed, 4 insertions(+) | ||
13 | |||
14 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/cpu64.c | ||
17 | +++ b/target/arm/cpu64.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
19 | t = FIELD_DP64(t, ID_AA64PFR1, MTE, 2); | ||
20 | cpu->isar.id_aa64pfr1 = t; | ||
21 | |||
22 | + t = cpu->isar.id_aa64mmfr0; | ||
23 | + t = FIELD_DP64(t, ID_AA64MMFR0, PARANGE, 5); /* PARange: 48 bits */ | ||
24 | + cpu->isar.id_aa64mmfr0 = t; | ||
25 | + | ||
26 | t = cpu->isar.id_aa64mmfr1; | ||
27 | t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ | ||
28 | t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); | ||
29 | -- | ||
30 | 2.20.1 | ||
31 | |||
32 | diff view generated by jsdifflib |