1
The following changes since commit b7c359c748a2e3ccb97a184b9739feb2cd48de2f:
1
The following changes since commit 003ba52a8b327180e284630b289c6ece5a3e08b9:
2
2
3
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.0-pull-request' into staging (2020-01-23 14:38:43 +0000)
3
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-02-16 11:16:39 +0000)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200123
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230216
8
8
9
for you to fetch changes up to 53c75ad8e72dc3a5102de7ed21e4990969cb0a19:
9
for you to fetch changes up to caf01d6a435d9f4a95aeae2f9fc6cb8b889b1fb8:
10
10
11
hw/arm/exynos4210: Connect serial port DMA busy signals with pl330 (2020-01-23 15:22:42 +0000)
11
tests/qtest: Restrict tpm-tis-devices-{swtpm}-test to CONFIG_TCG (2023-02-16 16:28:53 +0000)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
target-arm queue:
14
target-arm queue:
15
* fix bug in PAuth emulation
15
* Some mostly M-profile-related code cleanups
16
* add PMU to Cortex-R5, Cortex-R5F
16
* avocado: Retire the boot_linux.py AArch64 TCG tests
17
* qemu-nbd: Convert documentation to rST
17
* hw/arm/smmuv3: Add GBPA register
18
* qemu-block-drivers: Convert documentation to rST
18
* arm/virt: don't try to spell out the accelerator
19
* Fix Exynos4210 UART DMA support
19
* hw/arm: Attach PSPI module to NPCM7XX SoC
20
* Various minor code cleanups
20
* Some cleanup/refactoring patches aiming towards
21
allowing building Arm targets without CONFIG_TCG
21
22
22
----------------------------------------------------------------
23
----------------------------------------------------------------
23
Andrew Jones (1):
24
Alex Bennée (1):
24
target/arm/arch_dump: Add SVE notes
25
tests/avocado: retire the Aarch64 TCG tests from boot_linux.py
25
26
26
Clement Deschamps (1):
27
Claudio Fontana (3):
27
target/arm: add PMU feature to cortex-r5 and cortex-r5f
28
target/arm: rename handle_semihosting to tcg_handle_semihosting
29
target/arm: wrap psci call with tcg_enabled
30
target/arm: wrap call to aarch64_sve_change_el in tcg_enabled()
28
31
29
Guenter Roeck (8):
32
Cornelia Huck (1):
30
dma/pl330: Convert to support tracing
33
arm/virt: don't try to spell out the accelerator
31
hw/core/or-irq: Increase limit of or-lines to 48
32
hw/arm/exynos4210: Fix DMA initialization
33
hw/char/exynos4210_uart: Convert to support tracing
34
hw/char/exynos4210_uart: Implement post_load function
35
hw/char/exynos4210_uart: Implement Rx FIFO level triggers and timeouts
36
hw/char/exynos4210_uart: Add receive DMA support
37
hw/arm/exynos4210: Connect serial port DMA busy signals with pl330
38
34
39
Keqian Zhu (2):
35
Fabiano Rosas (7):
40
hw/acpi: Remove extra indent in ACPI GED hotplug cb
36
target/arm: Move PC alignment check
41
hw/arm: Use helper function to trigger hotplug handler plug
37
target/arm: Move cpregs code out of cpu.h
38
tests/avocado: Skip tests that require a missing accelerator
39
tests/avocado: Tag TCG tests with accel:tcg
40
target/arm: Use "max" as default cpu for the virt machine with KVM
41
tests/qtest: arm-cpu-features: Match tests to required accelerators
42
tests/qtest: Restrict tpm-tis-devices-{swtpm}-test to CONFIG_TCG
42
43
43
Peter Maydell (3):
44
Hao Wu (3):
44
qemu-nbd: Convert invocation documentation to rST
45
MAINTAINERS: Add myself to maintainers and remove Havard
45
docs: Create stub system manual
46
hw/ssi: Add Nuvoton PSPI Module
46
qemu-block-drivers: Convert to rST
47
hw/arm: Attach PSPI module to NPCM7XX SoC
47
48
48
Philippe Mathieu-Daudé (1):
49
Jean-Philippe Brucker (2):
49
hw/misc/stm32f4xx_syscfg: Fix copy/paste error
50
hw/arm/smmu-common: Support 64-bit addresses
51
hw/arm/smmu-common: Fix TTB1 handling
50
52
51
Richard Henderson (3):
53
Mostafa Saleh (1):
52
tests/tcg/aarch64: Fix compilation parameters for pauth-%
54
hw/arm/smmuv3: Add GBPA register
53
tests/tcg/aarch64: Add pauth-3
54
tests/tcg/aarch64: Add pauth-4
55
55
56
Vincent Dehors (1):
56
Philippe Mathieu-Daudé (12):
57
target/arm: Fix PAuth sbox functions
57
hw/intc/armv7m_nvic: Use OBJECT_DECLARE_SIMPLE_TYPE() macro
58
target/arm: Simplify arm_v7m_mmu_idx_for_secstate() for user emulation
59
target/arm: Reduce arm_v7m_mmu_idx_[all/for_secstate_and_priv]() scope
60
target/arm: Constify ID_PFR1 on user emulation
61
target/arm: Convert CPUARMState::eabi to boolean
62
target/arm: Avoid resetting CPUARMState::eabi field
63
target/arm: Restrict CPUARMState::gicv3state to sysemu
64
target/arm: Restrict CPUARMState::arm_boot_info to sysemu
65
target/arm: Restrict CPUARMState::nvic to sysemu
66
target/arm: Store CPUARMState::nvic as NVICState*
67
target/arm: Declare CPU <-> NVIC helpers in 'hw/intc/armv7m_nvic.h'
68
hw/arm: Add missing XLNX_ZYNQMP_ARM -> USB_DWC3 Kconfig dependency
58
69
59
Makefile | 37 +-
70
MAINTAINERS | 8 +-
60
tests/tcg/aarch64/Makefile.softmmu-target | 5 +-
71
docs/system/arm/nuvoton.rst | 2 +-
61
tests/tcg/aarch64/Makefile.target | 3 +-
72
hw/arm/smmuv3-internal.h | 7 +
62
include/elf.h | 1 +
73
include/hw/arm/npcm7xx.h | 2 +
63
include/hw/arm/exynos4210.h | 4 +
74
include/hw/arm/smmu-common.h | 2 -
64
include/hw/or-irq.h | 2 +-
75
include/hw/arm/smmuv3.h | 1 +
65
target/arm/cpu.h | 25 +
76
include/hw/intc/armv7m_nvic.h | 128 +++++++++++++++++-
66
hw/acpi/generic_event_device.c | 2 +-
77
include/hw/ssi/npcm_pspi.h | 53 ++++++++
67
hw/arm/exynos4210.c | 77 ++-
78
linux-user/user-internals.h | 2 +-
68
hw/arm/virt.c | 6 +-
79
target/arm/cpregs.h | 98 ++++++++++++++
69
hw/char/exynos4210_uart.c | 245 +++++---
80
target/arm/cpu.h | 228 ++-------------------------------
70
hw/dma/pl330.c | 88 +--
81
target/arm/internals.h | 14 --
71
hw/misc/stm32f4xx_syscfg.c | 2 +-
82
hw/arm/npcm7xx.c | 25 +++-
72
target/arm/arch_dump.c | 124 +++-
83
hw/arm/smmu-common.c | 4 +-
73
target/arm/cpu.c | 1 +
84
hw/arm/smmuv3.c | 43 ++++++-
74
target/arm/kvm64.c | 24 -
85
hw/arm/virt.c | 10 +-
75
target/arm/pauth_helper.c | 4 +-
86
hw/intc/armv7m_nvic.c | 38 ++----
76
tests/tcg/aarch64/pauth-1.c | 2 -
87
hw/ssi/npcm_pspi.c | 221 ++++++++++++++++++++++++++++++++
77
tests/tcg/aarch64/pauth-2.c | 2 -
88
linux-user/arm/cpu_loop.c | 4 +-
78
tests/tcg/aarch64/pauth-4.c | 25 +
89
target/arm/cpu.c | 5 +-
79
tests/tcg/aarch64/system/pauth-3.c | 40 ++
90
target/arm/cpu_tcg.c | 3 +
80
MAINTAINERS | 1 +
91
target/arm/helper.c | 31 +++--
81
docs/index.html.in | 1 +
92
target/arm/m_helper.c | 86 +++++++------
82
docs/interop/conf.py | 4 +-
93
target/arm/machine.c | 18 +--
83
docs/interop/index.rst | 1 +
94
tests/qtest/arm-cpu-features.c | 28 ++--
84
docs/interop/qemu-nbd.rst | 263 ++++++++
95
hw/arm/Kconfig | 1 +
85
docs/interop/qemu-option-trace.rst.inc | 30 +
96
hw/ssi/meson.build | 2 +-
86
docs/qemu-block-drivers.texi | 889 ---------------------------
97
hw/ssi/trace-events | 5 +
87
docs/system/conf.py | 22 +
98
tests/avocado/avocado_qemu/__init__.py | 4 +
88
docs/system/index.rst | 17 +
99
tests/avocado/boot_linux.py | 48 ++-----
89
docs/system/qemu-block-drivers.rst | 985 ++++++++++++++++++++++++++++++
100
tests/avocado/boot_linux_console.py | 1 +
90
hw/char/trace-events | 20 +
101
tests/avocado/machine_aarch64_virt.py | 63 ++++++++-
91
hw/dma/trace-events | 24 +
102
tests/avocado/reverse_debugging.py | 8 ++
92
qemu-doc.texi | 18 -
103
tests/qtest/meson.build | 4 +-
93
qemu-nbd.texi | 214 -------
104
34 files changed, 798 insertions(+), 399 deletions(-)
94
qemu-option-trace.texi | 4 +
105
create mode 100644 include/hw/ssi/npcm_pspi.h
95
qemu-options.hx | 2 +-
106
create mode 100644 hw/ssi/npcm_pspi.c
96
37 files changed, 1897 insertions(+), 1317 deletions(-)
97
create mode 100644 tests/tcg/aarch64/pauth-4.c
98
create mode 100644 tests/tcg/aarch64/system/pauth-3.c
99
create mode 100644 docs/interop/qemu-nbd.rst
100
create mode 100644 docs/interop/qemu-option-trace.rst.inc
101
delete mode 100644 docs/qemu-block-drivers.texi
102
create mode 100644 docs/system/conf.py
103
create mode 100644 docs/system/index.rst
104
create mode 100644 docs/system/qemu-block-drivers.rst
105
delete mode 100644 qemu-nbd.texi
106
107
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The Exynos4210 serial driver uses an interrupt line to signal if receive
3
Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro,
4
data is available. Connect that interrupt with the DMA controller's
4
similarly to automatic conversion from commit 8063396bf3
5
'peripheral busy' gpio pin to stop the DMA if there is no more receive
5
("Use OBJECT_DECLARE_SIMPLE_TYPE when possible").
6
data available. Without this patch, receive DMA runs wild and fills the
7
entire receive DMA buffer with invalid data.
8
6
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20200123052540.6132-9-linux@roeck-us.net
9
Message-id: 20230206223502.25122-2-philmd@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
11
---
14
hw/arm/exynos4210.c | 42 +++++++++++++++++++++++++++++-------------
12
include/hw/intc/armv7m_nvic.h | 5 +----
15
1 file changed, 29 insertions(+), 13 deletions(-)
13
1 file changed, 1 insertion(+), 4 deletions(-)
16
14
17
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
15
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
18
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/exynos4210.c
17
--- a/include/hw/intc/armv7m_nvic.h
20
+++ b/hw/arm/exynos4210.c
18
+++ b/include/hw/intc/armv7m_nvic.h
21
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_calc_affinity(int cpu)
19
@@ -XXX,XX +XXX,XX @@
22
return (0x9 << ARM_AFF1_SHIFT) | cpu;
20
#include "qom/object.h"
23
}
21
24
22
#define TYPE_NVIC "armv7m_nvic"
25
-static void pl330_create(uint32_t base, qemu_or_irq *orgate, qemu_irq irq,
23
-
26
- int nreq, int nevents, int width)
24
-typedef struct NVICState NVICState;
27
+static DeviceState *pl330_create(uint32_t base, qemu_or_irq *orgate,
25
-DECLARE_INSTANCE_CHECKER(NVICState, NVIC,
28
+ qemu_irq irq, int nreq, int nevents, int width)
26
- TYPE_NVIC)
29
{
27
+OBJECT_DECLARE_SIMPLE_TYPE(NVICState, NVIC)
30
SysBusDevice *busdev;
28
31
DeviceState *dev;
29
/* Highest permitted number of exceptions (architectural limit) */
32
@@ -XXX,XX +XXX,XX @@ static void pl330_create(uint32_t base, qemu_or_irq *orgate, qemu_irq irq,
30
#define NVIC_MAX_VECTORS 512
33
sysbus_connect_irq(busdev, i, qdev_get_gpio_in(DEVICE(orgate), i));
34
}
35
qdev_connect_gpio_out(DEVICE(orgate), 0, irq);
36
+ return dev;
37
}
38
39
static void exynos4210_realize(DeviceState *socdev, Error **errp)
40
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
41
MemoryRegion *system_mem = get_system_memory();
42
qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS];
43
SysBusDevice *busdev;
44
- DeviceState *dev;
45
+ DeviceState *dev, *uart[4], *pl330[3];
46
int i, n;
47
48
for (n = 0; n < EXYNOS4210_NCPUS; n++) {
49
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
50
51
52
/*** UARTs ***/
53
- exynos4210_uart_create(EXYNOS4210_UART0_BASE_ADDR,
54
+ uart[0] = exynos4210_uart_create(EXYNOS4210_UART0_BASE_ADDR,
55
EXYNOS4210_UART0_FIFO_SIZE, 0, serial_hd(0),
56
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 0)]);
57
58
- exynos4210_uart_create(EXYNOS4210_UART1_BASE_ADDR,
59
+ uart[1] = exynos4210_uart_create(EXYNOS4210_UART1_BASE_ADDR,
60
EXYNOS4210_UART1_FIFO_SIZE, 1, serial_hd(1),
61
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 1)]);
62
63
- exynos4210_uart_create(EXYNOS4210_UART2_BASE_ADDR,
64
+ uart[2] = exynos4210_uart_create(EXYNOS4210_UART2_BASE_ADDR,
65
EXYNOS4210_UART2_FIFO_SIZE, 2, serial_hd(2),
66
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 2)]);
67
68
- exynos4210_uart_create(EXYNOS4210_UART3_BASE_ADDR,
69
+ uart[3] = exynos4210_uart_create(EXYNOS4210_UART3_BASE_ADDR,
70
EXYNOS4210_UART3_FIFO_SIZE, 3, serial_hd(3),
71
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 3)]);
72
73
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
74
s->irq_table[exynos4210_get_irq(28, 3)]);
75
76
/*** DMA controllers ***/
77
- pl330_create(EXYNOS4210_PL330_BASE0_ADDR, &s->pl330_irq_orgate[0],
78
- s->irq_table[exynos4210_get_irq(21, 0)], 32, 32, 32);
79
- pl330_create(EXYNOS4210_PL330_BASE1_ADDR, &s->pl330_irq_orgate[1],
80
- s->irq_table[exynos4210_get_irq(21, 1)], 32, 32, 32);
81
- pl330_create(EXYNOS4210_PL330_BASE2_ADDR, &s->pl330_irq_orgate[2],
82
- s->irq_table[exynos4210_get_irq(20, 1)], 1, 31, 64);
83
+ pl330[0] = pl330_create(EXYNOS4210_PL330_BASE0_ADDR,
84
+ &s->pl330_irq_orgate[0],
85
+ s->irq_table[exynos4210_get_irq(21, 0)],
86
+ 32, 32, 32);
87
+ pl330[1] = pl330_create(EXYNOS4210_PL330_BASE1_ADDR,
88
+ &s->pl330_irq_orgate[1],
89
+ s->irq_table[exynos4210_get_irq(21, 1)],
90
+ 32, 32, 32);
91
+ pl330[2] = pl330_create(EXYNOS4210_PL330_BASE2_ADDR,
92
+ &s->pl330_irq_orgate[2],
93
+ s->irq_table[exynos4210_get_irq(20, 1)],
94
+ 1, 31, 64);
95
+
96
+ sysbus_connect_irq(SYS_BUS_DEVICE(uart[0]), 1,
97
+ qdev_get_gpio_in(pl330[0], 15));
98
+ sysbus_connect_irq(SYS_BUS_DEVICE(uart[1]), 1,
99
+ qdev_get_gpio_in(pl330[1], 15));
100
+ sysbus_connect_irq(SYS_BUS_DEVICE(uart[2]), 1,
101
+ qdev_get_gpio_in(pl330[0], 17));
102
+ sysbus_connect_irq(SYS_BUS_DEVICE(uart[3]), 1,
103
+ qdev_get_gpio_in(pl330[1], 17));
104
}
105
106
static void exynos4210_init(Object *obj)
107
--
31
--
108
2.20.1
32
2.34.1
109
33
110
34
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The driver already implements a receive FIFO, but it does not
3
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
4
handle receive FIFO trigger levels and timeout. Implement the
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
missing functionality.
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20230206223502.25122-3-philmd@linaro.org
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
9
target/arm/m_helper.c | 11 ++++++++---
10
1 file changed, 8 insertions(+), 3 deletions(-)
6
11
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
12
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
8
Message-id: 20200123052540.6132-7-linux@roeck-us.net
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
hw/char/exynos4210_uart.c | 117 ++++++++++++++++++++++++++++++--------
13
hw/char/trace-events | 3 +-
14
2 files changed, 94 insertions(+), 26 deletions(-)
15
16
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
17
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/char/exynos4210_uart.c
14
--- a/target/arm/m_helper.c
19
+++ b/hw/char/exynos4210_uart.c
15
+++ b/target/arm/m_helper.c
20
@@ -XXX,XX +XXX,XX @@
16
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
21
#include "migration/vmstate.h"
17
return 0;
22
#include "qemu/error-report.h"
23
#include "qemu/module.h"
24
+#include "qemu/timer.h"
25
#include "chardev/char-fe.h"
26
#include "chardev/char-serial.h"
27
28
@@ -XXX,XX +XXX,XX @@ static const Exynos4210UartReg exynos4210_uart_regs[] = {
29
#define ULCON_STOP_BIT_SHIFT 1
30
31
/* UART Tx/Rx Status */
32
+#define UTRSTAT_Rx_TIMEOUT 0x8
33
#define UTRSTAT_TRANSMITTER_EMPTY 0x4
34
#define UTRSTAT_Tx_BUFFER_EMPTY 0x2
35
#define UTRSTAT_Rx_BUFFER_DATA_READY 0x1
36
@@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210UartState {
37
Exynos4210UartFIFO rx;
38
Exynos4210UartFIFO tx;
39
40
+ QEMUTimer *fifo_timeout_timer;
41
+ uint64_t wordtime; /* word time in ns */
42
+
43
CharBackend chr;
44
qemu_irq irq;
45
46
@@ -XXX,XX +XXX,XX @@ static void fifo_reset(Exynos4210UartFIFO *q)
47
q->rp = 0;
48
}
18
}
49
19
50
-static uint32_t exynos4210_uart_Tx_FIFO_trigger_level(const Exynos4210UartState *s)
20
-#else
51
+static uint32_t exynos4210_uart_FIFO_trigger_level(uint32_t channel,
21
+ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
52
+ uint32_t reg)
53
{
54
- uint32_t level = 0;
55
- uint32_t reg;
56
+ uint32_t level;
57
58
- reg = (s->reg[I_(UFCON)] & UFCON_Tx_FIFO_TRIGGER_LEVEL) >>
59
- UFCON_Tx_FIFO_TRIGGER_LEVEL_SHIFT;
60
-
61
- switch (s->channel) {
62
+ switch (channel) {
63
case 0:
64
level = reg * 32;
65
break;
66
@@ -XXX,XX +XXX,XX @@ static uint32_t exynos4210_uart_Tx_FIFO_trigger_level(const Exynos4210UartState
67
break;
68
default:
69
level = 0;
70
- trace_exynos_uart_channel_error(s->channel);
71
+ trace_exynos_uart_channel_error(channel);
72
+ break;
73
}
74
-
75
return level;
76
}
77
78
+static uint32_t
79
+exynos4210_uart_Tx_FIFO_trigger_level(const Exynos4210UartState *s)
80
+{
22
+{
81
+ uint32_t reg;
23
+ return ARMMMUIdx_MUser;
82
+
83
+ reg = (s->reg[I_(UFCON)] & UFCON_Tx_FIFO_TRIGGER_LEVEL) >>
84
+ UFCON_Tx_FIFO_TRIGGER_LEVEL_SHIFT;
85
+
86
+ return exynos4210_uart_FIFO_trigger_level(s->channel, reg);
87
+}
24
+}
88
+
25
+
89
+static uint32_t
26
+#else /* !CONFIG_USER_ONLY */
90
+exynos4210_uart_Rx_FIFO_trigger_level(const Exynos4210UartState *s)
27
91
+{
28
/*
92
+ uint32_t reg;
29
* What kind of stack write are we doing? This affects how exceptions
93
+
30
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
94
+ reg = ((s->reg[I_(UFCON)] & UFCON_Rx_FIFO_TRIGGER_LEVEL) >>
31
return tt_resp;
95
+ UFCON_Rx_FIFO_TRIGGER_LEVEL_SHIFT) + 1;
32
}
96
+
33
97
+ return exynos4210_uart_FIFO_trigger_level(s->channel, reg);
34
-#endif /* !CONFIG_USER_ONLY */
98
+}
35
-
99
+
36
ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
100
static void exynos4210_uart_update_irq(Exynos4210UartState *s)
37
bool secstate, bool priv, bool negpri)
101
{
38
{
102
/*
39
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
103
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_update_irq(Exynos4210UartState *s)
40
104
* transmit FIFO is smaller than the trigger level.
41
return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
105
*/
106
if (s->reg[I_(UFCON)] & UFCON_FIFO_ENABLE) {
107
-
108
uint32_t count = (s->reg[I_(UFSTAT)] & UFSTAT_Tx_FIFO_COUNT) >>
109
UFSTAT_Tx_FIFO_COUNT_SHIFT;
110
111
if (count <= exynos4210_uart_Tx_FIFO_trigger_level(s)) {
112
s->reg[I_(UINTSP)] |= UINTSP_TXD;
113
}
114
+
115
+ /*
116
+ * Rx interrupt if trigger level is reached or if rx timeout
117
+ * interrupt is disabled and there is data in the receive buffer
118
+ */
119
+ count = fifo_elements_number(&s->rx);
120
+ if ((count && !(s->reg[I_(UCON)] & 0x80)) ||
121
+ count >= exynos4210_uart_Rx_FIFO_trigger_level(s)) {
122
+ s->reg[I_(UINTSP)] |= UINTSP_RXD;
123
+ timer_del(s->fifo_timeout_timer);
124
+ }
125
+ } else if (s->reg[I_(UTRSTAT)] & UTRSTAT_Rx_BUFFER_DATA_READY) {
126
+ s->reg[I_(UINTSP)] |= UINTSP_RXD;
127
}
128
129
s->reg[I_(UINTP)] = s->reg[I_(UINTSP)] & ~s->reg[I_(UINTM)];
130
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_update_irq(Exynos4210UartState *s)
131
}
132
}
133
134
+static void exynos4210_uart_timeout_int(void *opaque)
135
+{
136
+ Exynos4210UartState *s = opaque;
137
+
138
+ trace_exynos_uart_rx_timeout(s->channel, s->reg[I_(UTRSTAT)],
139
+ s->reg[I_(UINTSP)]);
140
+
141
+ if ((s->reg[I_(UTRSTAT)] & UTRSTAT_Rx_BUFFER_DATA_READY) ||
142
+ (s->reg[I_(UCON)] & (1 << 11))) {
143
+ s->reg[I_(UINTSP)] |= UINTSP_RXD;
144
+ s->reg[I_(UTRSTAT)] |= UTRSTAT_Rx_TIMEOUT;
145
+ exynos4210_uart_update_irq(s);
146
+ }
147
+}
148
+
149
static void exynos4210_uart_update_parameters(Exynos4210UartState *s)
150
{
151
int speed, parity, data_bits, stop_bits;
152
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_update_parameters(Exynos4210UartState *s)
153
ssp.data_bits = data_bits;
154
ssp.stop_bits = stop_bits;
155
156
+ s->wordtime = NANOSECONDS_PER_SECOND * (data_bits + stop_bits + 1) / speed;
157
+
158
qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
159
160
trace_exynos_uart_update_params(
161
- s->channel, speed, parity, data_bits, stop_bits);
162
+ s->channel, speed, parity, data_bits, stop_bits, s->wordtime);
163
+}
164
+
165
+static void exynos4210_uart_rx_timeout_set(Exynos4210UartState *s)
166
+{
167
+ if (s->reg[I_(UCON)] & 0x80) {
168
+ uint32_t timeout = ((s->reg[I_(UCON)] >> 12) & 0x0f) * s->wordtime;
169
+
170
+ timer_mod(s->fifo_timeout_timer,
171
+ qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + timeout);
172
+ } else {
173
+ timer_del(s->fifo_timeout_timer);
174
+ }
175
}
176
177
static void exynos4210_uart_write(void *opaque, hwaddr offset,
178
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_write(void *opaque, hwaddr offset,
179
exynos4210_uart_update_irq(s);
180
break;
181
case UTRSTAT:
182
+ if (val & UTRSTAT_Rx_TIMEOUT) {
183
+ s->reg[I_(UTRSTAT)] &= ~UTRSTAT_Rx_TIMEOUT;
184
+ }
185
+ break;
186
case UERSTAT:
187
case UFSTAT:
188
case UMSTAT:
189
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_write(void *opaque, hwaddr offset,
190
break;
191
}
192
}
42
}
193
+
43
+
194
static uint64_t exynos4210_uart_read(void *opaque, hwaddr offset,
44
+#endif /* !CONFIG_USER_ONLY */
195
unsigned size)
196
{
197
@@ -XXX,XX +XXX,XX @@ static int exynos4210_uart_can_receive(void *opaque)
198
return fifo_empty_elements_number(&s->rx);
199
}
200
201
-
202
static void exynos4210_uart_receive(void *opaque, const uint8_t *buf, int size)
203
{
204
Exynos4210UartState *s = (Exynos4210UartState *)opaque;
205
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_receive(void *opaque, const uint8_t *buf, int size)
206
207
if (s->reg[I_(UFCON)] & UFCON_FIFO_ENABLE) {
208
if (fifo_empty_elements_number(&s->rx) < size) {
209
- for (i = 0; i < fifo_empty_elements_number(&s->rx); i++) {
210
- fifo_store(&s->rx, buf[i]);
211
- }
212
+ size = fifo_empty_elements_number(&s->rx);
213
s->reg[I_(UINTSP)] |= UINTSP_ERROR;
214
- s->reg[I_(UTRSTAT)] |= UTRSTAT_Rx_BUFFER_DATA_READY;
215
- } else {
216
- for (i = 0; i < size; i++) {
217
- fifo_store(&s->rx, buf[i]);
218
- }
219
- s->reg[I_(UTRSTAT)] |= UTRSTAT_Rx_BUFFER_DATA_READY;
220
}
221
- /* XXX: Around here we maybe should check Rx trigger level */
222
- s->reg[I_(UINTSP)] |= UINTSP_RXD;
223
+ for (i = 0; i < size; i++) {
224
+ fifo_store(&s->rx, buf[i]);
225
+ }
226
+ exynos4210_uart_rx_timeout_set(s);
227
} else {
228
s->reg[I_(URXH)] = buf[0];
229
- s->reg[I_(UINTSP)] |= UINTSP_RXD;
230
- s->reg[I_(UTRSTAT)] |= UTRSTAT_Rx_BUFFER_DATA_READY;
231
}
232
+ s->reg[I_(UTRSTAT)] |= UTRSTAT_Rx_BUFFER_DATA_READY;
233
234
exynos4210_uart_update_irq(s);
235
}
236
@@ -XXX,XX +XXX,XX @@ static int exynos4210_uart_post_load(void *opaque, int version_id)
237
Exynos4210UartState *s = (Exynos4210UartState *)opaque;
238
239
exynos4210_uart_update_parameters(s);
240
+ exynos4210_uart_rx_timeout_set(s);
241
242
return 0;
243
}
244
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_init(Object *obj)
245
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
246
Exynos4210UartState *s = EXYNOS4210_UART(dev);
247
248
+ s->fifo_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
249
+ exynos4210_uart_timeout_int, s);
250
+ s->wordtime = NANOSECONDS_PER_SECOND * 10 / 9600;
251
+
252
/* memory mapping */
253
memory_region_init_io(&s->iomem, obj, &exynos4210_uart_ops, s,
254
"exynos4210.uart", EXYNOS4210_UART_REGS_MEM_SIZE);
255
diff --git a/hw/char/trace-events b/hw/char/trace-events
256
index XXXXXXX..XXXXXXX 100644
257
--- a/hw/char/trace-events
258
+++ b/hw/char/trace-events
259
@@ -XXX,XX +XXX,XX @@ nrf51_uart_write(uint64_t addr, uint64_t value, unsigned int size) "addr 0x%" PR
260
# exynos4210_uart.c
261
exynos_uart_irq_raised(uint32_t channel, uint32_t reg) "UART%d: IRQ raised: 0x%08"PRIx32
262
exynos_uart_irq_lowered(uint32_t channel) "UART%d: IRQ lowered"
263
-exynos_uart_update_params(uint32_t channel, int speed, uint8_t parity, int data, int stop) "UART%d: speed: %d, parity: %c, data bits: %d, stop bits: %d"
264
+exynos_uart_update_params(uint32_t channel, int speed, uint8_t parity, int data, int stop, uint64_t wordtime) "UART%d: speed: %d, parity: %c, data bits: %d, stop bits: %d wordtime: %"PRId64"ns"
265
exynos_uart_write(uint32_t channel, uint32_t offset, const char *name, uint64_t val) "UART%d: <0x%04x> %s <- 0x%" PRIx64
266
exynos_uart_read(uint32_t channel, uint32_t offset, const char *name, uint64_t val) "UART%d: <0x%04x> %s -> 0x%" PRIx64
267
exynos_uart_rx_fifo_reset(uint32_t channel) "UART%d: Rx FIFO Reset"
268
@@ -XXX,XX +XXX,XX @@ exynos_uart_rx_error(uint32_t channel) "UART%d: Rx error"
269
exynos_uart_wo_read(uint32_t channel, const char *name, uint32_t reg) "UART%d: Trying to read from WO register: %s [0x%04"PRIx32"]"
270
exynos_uart_rxsize(uint32_t channel, uint32_t size) "UART%d: Rx FIFO size: %d"
271
exynos_uart_channel_error(uint32_t channel) "Wrong UART channel number: %d"
272
+exynos_uart_rx_timeout(uint32_t channel, uint32_t stat, uint32_t intsp) "UART%d: Rx timeout stat=0x%x intsp=0x%x"
273
--
45
--
274
2.20.1
46
2.34.1
275
47
276
48
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
When dumping a guest with dump-guest-memory also dump the SVE
3
arm_v7m_mmu_idx_all() and arm_v7m_mmu_idx_for_secstate_and_priv()
4
registers if they are in use.
4
are only used for system emulation in m_helper.c.
5
Move the definitions to avoid prototype forward declarations.
5
6
6
Signed-off-by: Andrew Jones <drjones@redhat.com>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200120101832.18781-1-drjones@redhat.com
9
Message-id: 20230206223502.25122-4-philmd@linaro.org
9
[PMM: fixed checkpatch nits]
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
11
---
12
include/elf.h | 1 +
12
target/arm/internals.h | 14 --------
13
target/arm/cpu.h | 25 +++++++++
13
target/arm/m_helper.c | 74 +++++++++++++++++++++---------------------
14
target/arm/arch_dump.c | 124 ++++++++++++++++++++++++++++++++++++++++-
14
2 files changed, 37 insertions(+), 51 deletions(-)
15
target/arm/kvm64.c | 24 --------
16
4 files changed, 148 insertions(+), 26 deletions(-)
17
15
18
diff --git a/include/elf.h b/include/elf.h
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
19
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
20
--- a/include/elf.h
18
--- a/target/arm/internals.h
21
+++ b/include/elf.h
19
+++ b/target/arm/internals.h
22
@@ -XXX,XX +XXX,XX @@ typedef struct elf64_shdr {
20
@@ -XXX,XX +XXX,XX @@ static inline ARMMMUIdx core_to_aa64_mmu_idx(int mmu_idx)
23
#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
21
24
#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
22
int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx);
25
#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
23
26
+#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension regs */
24
-/*
27
25
- * Return the MMU index for a v7M CPU with all relevant information
28
/*
26
- * manually specified.
29
* Physical entry point into the kernel.
27
- */
30
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
28
-ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
29
- bool secstate, bool priv, bool negpri);
30
-
31
-/*
32
- * Return the MMU index for a v7M CPU in the specified security and
33
- * privilege state.
34
- */
35
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
36
- bool secstate, bool priv);
37
-
38
/* Return the MMU index for a v7M CPU in the specified security state */
39
ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate);
40
41
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
31
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/cpu.h
43
--- a/target/arm/m_helper.c
33
+++ b/target/arm/cpu.h
44
+++ b/target/arm/m_helper.c
34
@@ -XXX,XX +XXX,XX @@ void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq);
45
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
35
void aarch64_sve_change_el(CPUARMState *env, int old_el,
46
36
int new_el, bool el0_a64);
47
#else /* !CONFIG_USER_ONLY */
37
void aarch64_add_sve_properties(Object *obj);
48
49
+static ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
50
+ bool secstate, bool priv, bool negpri)
51
+{
52
+ ARMMMUIdx mmu_idx = ARM_MMU_IDX_M;
38
+
53
+
39
+/*
54
+ if (priv) {
40
+ * SVE registers are encoded in KVM's memory in an endianness-invariant format.
55
+ mmu_idx |= ARM_MMU_IDX_M_PRIV;
41
+ * The byte at offset i from the start of the in-memory representation contains
42
+ * the bits [(7 + 8 * i) : (8 * i)] of the register value. As this means the
43
+ * lowest offsets are stored in the lowest memory addresses, then that nearly
44
+ * matches QEMU's representation, which is to use an array of host-endian
45
+ * uint64_t's, where the lower offsets are at the lower indices. To complete
46
+ * the translation we just need to byte swap the uint64_t's on big-endian hosts.
47
+ */
48
+static inline uint64_t *sve_bswap64(uint64_t *dst, uint64_t *src, int nr)
49
+{
50
+#ifdef HOST_WORDS_BIGENDIAN
51
+ int i;
52
+
53
+ for (i = 0; i < nr; ++i) {
54
+ dst[i] = bswap64(src[i]);
55
+ }
56
+ }
56
+
57
+
57
+ return dst;
58
+ if (negpri) {
58
+#else
59
+ mmu_idx |= ARM_MMU_IDX_M_NEGPRI;
59
+ return src;
60
+ }
60
+#endif
61
+
62
+ if (secstate) {
63
+ mmu_idx |= ARM_MMU_IDX_M_S;
64
+ }
65
+
66
+ return mmu_idx;
61
+}
67
+}
62
+
68
+
63
#else
69
+static ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
64
static inline void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq) { }
70
+ bool secstate, bool priv)
65
static inline void aarch64_sve_change_el(CPUARMState *env, int o,
71
+{
66
diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c
72
+ bool negpri = armv7m_nvic_neg_prio_requested(env->nvic, secstate);
67
index XXXXXXX..XXXXXXX 100644
68
--- a/target/arm/arch_dump.c
69
+++ b/target/arm/arch_dump.c
70
@@ -XXX,XX +XXX,XX @@ struct aarch64_user_vfp_state {
71
72
QEMU_BUILD_BUG_ON(sizeof(struct aarch64_user_vfp_state) != 528);
73
74
+/* struct user_sve_header from arch/arm64/include/uapi/asm/ptrace.h */
75
+struct aarch64_user_sve_header {
76
+ uint32_t size;
77
+ uint32_t max_size;
78
+ uint16_t vl;
79
+ uint16_t max_vl;
80
+ uint16_t flags;
81
+ uint16_t reserved;
82
+} QEMU_PACKED;
83
+
73
+
84
struct aarch64_note {
74
+ return arm_v7m_mmu_idx_all(env, secstate, priv, negpri);
85
Elf64_Nhdr hdr;
86
char name[8]; /* align_up(sizeof("CORE"), 4) */
87
union {
88
struct aarch64_elf_prstatus prstatus;
89
struct aarch64_user_vfp_state vfp;
90
+ struct aarch64_user_sve_header sve;
91
};
92
} QEMU_PACKED;
93
94
@@ -XXX,XX +XXX,XX @@ struct aarch64_note {
95
(AARCH64_NOTE_HEADER_SIZE + sizeof(struct aarch64_elf_prstatus))
96
#define AARCH64_PRFPREG_NOTE_SIZE \
97
(AARCH64_NOTE_HEADER_SIZE + sizeof(struct aarch64_user_vfp_state))
98
+#define AARCH64_SVE_NOTE_SIZE(env) \
99
+ (AARCH64_NOTE_HEADER_SIZE + sve_size(env))
100
101
static void aarch64_note_init(struct aarch64_note *note, DumpState *s,
102
const char *name, Elf64_Word namesz,
103
@@ -XXX,XX +XXX,XX @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f,
104
return 0;
105
}
106
107
+#ifdef TARGET_AARCH64
108
+static off_t sve_zreg_offset(uint32_t vq, int n)
109
+{
110
+ off_t off = sizeof(struct aarch64_user_sve_header);
111
+ return ROUND_UP(off, 16) + vq * 16 * n;
112
+}
75
+}
113
+
76
+
114
+static off_t sve_preg_offset(uint32_t vq, int n)
77
+/* Return the MMU index for a v7M CPU in the specified security state */
78
+ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
115
+{
79
+{
116
+ return sve_zreg_offset(vq, 32) + vq * 16 / 8 * n;
80
+ bool priv = arm_v7m_is_handler_mode(env) ||
81
+ !(env->v7m.control[secstate] & 1);
82
+
83
+ return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
117
+}
84
+}
118
+
85
+
119
+static off_t sve_fpsr_offset(uint32_t vq)
86
/*
120
+{
87
* What kind of stack write are we doing? This affects how exceptions
121
+ off_t off = sve_preg_offset(vq, 17);
88
* generated during the stacking are treated.
122
+ return ROUND_UP(off, 16);
89
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
123
+}
90
return tt_resp;
124
+
125
+static off_t sve_fpcr_offset(uint32_t vq)
126
+{
127
+ return sve_fpsr_offset(vq) + sizeof(uint32_t);
128
+}
129
+
130
+static uint32_t sve_current_vq(CPUARMState *env)
131
+{
132
+ return sve_zcr_len_for_el(env, arm_current_el(env)) + 1;
133
+}
134
+
135
+static size_t sve_size_vq(uint32_t vq)
136
+{
137
+ off_t off = sve_fpcr_offset(vq) + sizeof(uint32_t);
138
+ return ROUND_UP(off, 16);
139
+}
140
+
141
+static size_t sve_size(CPUARMState *env)
142
+{
143
+ return sve_size_vq(sve_current_vq(env));
144
+}
145
+
146
+static int aarch64_write_elf64_sve(WriteCoreDumpFunction f,
147
+ CPUARMState *env, int cpuid,
148
+ DumpState *s)
149
+{
150
+ struct aarch64_note *note;
151
+ ARMCPU *cpu = env_archcpu(env);
152
+ uint32_t vq = sve_current_vq(env);
153
+ uint64_t tmp[ARM_MAX_VQ * 2], *r;
154
+ uint32_t fpr;
155
+ uint8_t *buf;
156
+ int ret, i;
157
+
158
+ note = g_malloc0(AARCH64_SVE_NOTE_SIZE(env));
159
+ buf = (uint8_t *)&note->sve;
160
+
161
+ aarch64_note_init(note, s, "LINUX", 6, NT_ARM_SVE, sve_size_vq(vq));
162
+
163
+ note->sve.size = cpu_to_dump32(s, sve_size_vq(vq));
164
+ note->sve.max_size = cpu_to_dump32(s, sve_size_vq(cpu->sve_max_vq));
165
+ note->sve.vl = cpu_to_dump16(s, vq * 16);
166
+ note->sve.max_vl = cpu_to_dump16(s, cpu->sve_max_vq * 16);
167
+ note->sve.flags = cpu_to_dump16(s, 1);
168
+
169
+ for (i = 0; i < 32; ++i) {
170
+ r = sve_bswap64(tmp, &env->vfp.zregs[i].d[0], vq * 2);
171
+ memcpy(&buf[sve_zreg_offset(vq, i)], r, vq * 16);
172
+ }
173
+
174
+ for (i = 0; i < 17; ++i) {
175
+ r = sve_bswap64(tmp, r = &env->vfp.pregs[i].p[0],
176
+ DIV_ROUND_UP(vq * 2, 8));
177
+ memcpy(&buf[sve_preg_offset(vq, i)], r, vq * 16 / 8);
178
+ }
179
+
180
+ fpr = cpu_to_dump32(s, vfp_get_fpsr(env));
181
+ memcpy(&buf[sve_fpsr_offset(vq)], &fpr, sizeof(uint32_t));
182
+
183
+ fpr = cpu_to_dump32(s, vfp_get_fpcr(env));
184
+ memcpy(&buf[sve_fpcr_offset(vq)], &fpr, sizeof(uint32_t));
185
+
186
+ ret = f(note, AARCH64_SVE_NOTE_SIZE(env), s);
187
+ g_free(note);
188
+
189
+ if (ret < 0) {
190
+ return -1;
191
+ }
192
+
193
+ return 0;
194
+}
195
+#endif
196
+
197
int arm_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
198
int cpuid, void *opaque)
199
{
200
struct aarch64_note note;
201
- CPUARMState *env = &ARM_CPU(cs)->env;
202
+ ARMCPU *cpu = ARM_CPU(cs);
203
+ CPUARMState *env = &cpu->env;
204
DumpState *s = opaque;
205
uint64_t pstate, sp;
206
int ret, i;
207
@@ -XXX,XX +XXX,XX @@ int arm_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
208
return -1;
209
}
210
211
- return aarch64_write_elf64_prfpreg(f, env, cpuid, s);
212
+ ret = aarch64_write_elf64_prfpreg(f, env, cpuid, s);
213
+ if (ret) {
214
+ return ret;
215
+ }
216
+
217
+#ifdef TARGET_AARCH64
218
+ if (cpu_isar_feature(aa64_sve, cpu)) {
219
+ ret = aarch64_write_elf64_sve(f, env, cpuid, s);
220
+ }
221
+#endif
222
+
223
+ return ret;
224
}
91
}
225
92
226
/* struct pt_regs from arch/arm/include/asm/ptrace.h */
93
-ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
227
@@ -XXX,XX +XXX,XX @@ ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
94
- bool secstate, bool priv, bool negpri)
228
if (class == ELFCLASS64) {
229
note_size = AARCH64_PRSTATUS_NOTE_SIZE;
230
note_size += AARCH64_PRFPREG_NOTE_SIZE;
231
+#ifdef TARGET_AARCH64
232
+ if (cpu_isar_feature(aa64_sve, cpu)) {
233
+ note_size += AARCH64_SVE_NOTE_SIZE(env);
234
+ }
235
+#endif
236
} else {
237
note_size = ARM_PRSTATUS_NOTE_SIZE;
238
if (arm_feature(env, ARM_FEATURE_VFP)) {
239
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
240
index XXXXXXX..XXXXXXX 100644
241
--- a/target/arm/kvm64.c
242
+++ b/target/arm/kvm64.c
243
@@ -XXX,XX +XXX,XX @@ static int kvm_arch_put_fpsimd(CPUState *cs)
244
return 0;
245
}
246
247
-/*
248
- * SVE registers are encoded in KVM's memory in an endianness-invariant format.
249
- * The byte at offset i from the start of the in-memory representation contains
250
- * the bits [(7 + 8 * i) : (8 * i)] of the register value. As this means the
251
- * lowest offsets are stored in the lowest memory addresses, then that nearly
252
- * matches QEMU's representation, which is to use an array of host-endian
253
- * uint64_t's, where the lower offsets are at the lower indices. To complete
254
- * the translation we just need to byte swap the uint64_t's on big-endian hosts.
255
- */
256
-static uint64_t *sve_bswap64(uint64_t *dst, uint64_t *src, int nr)
257
-{
95
-{
258
-#ifdef HOST_WORDS_BIGENDIAN
96
- ARMMMUIdx mmu_idx = ARM_MMU_IDX_M;
259
- int i;
260
-
97
-
261
- for (i = 0; i < nr; ++i) {
98
- if (priv) {
262
- dst[i] = bswap64(src[i]);
99
- mmu_idx |= ARM_MMU_IDX_M_PRIV;
263
- }
100
- }
264
-
101
-
265
- return dst;
102
- if (negpri) {
266
-#else
103
- mmu_idx |= ARM_MMU_IDX_M_NEGPRI;
267
- return src;
104
- }
268
-#endif
105
-
106
- if (secstate) {
107
- mmu_idx |= ARM_MMU_IDX_M_S;
108
- }
109
-
110
- return mmu_idx;
269
-}
111
-}
270
-
112
-
271
/*
113
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
272
* KVM SVE registers come in slices where ZREGs have a slice size of 2048 bits
114
- bool secstate, bool priv)
273
* and PREGS and the FFR have a slice size of 256 bits. However we simply hard
115
-{
116
- bool negpri = armv7m_nvic_neg_prio_requested(env->nvic, secstate);
117
-
118
- return arm_v7m_mmu_idx_all(env, secstate, priv, negpri);
119
-}
120
-
121
-/* Return the MMU index for a v7M CPU in the specified security state */
122
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
123
-{
124
- bool priv = arm_v7m_is_handler_mode(env) ||
125
- !(env->v7m.control[secstate] & 1);
126
-
127
- return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
128
-}
129
-
130
#endif /* !CONFIG_USER_ONLY */
274
--
131
--
275
2.20.1
132
2.34.1
276
133
277
134
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
To support receive DMA, we need to inform the DMA controller if receive data
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
is available. Otherwise the DMA controller keeps requesting data, causing
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
receive errors.
5
Message-id: 20230206223502.25122-5-philmd@linaro.org
6
7
Implement this using an interrupt line. The instantiating code then needs
8
to connect the interrupt with the matching DMA controller GPIO pin.
9
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
12
Message-id: 20200123052540.6132-8-linux@roeck-us.net
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
7
---
15
hw/char/exynos4210_uart.c | 24 ++++++++++++++++++++++++
8
target/arm/helper.c | 12 ++++++++++--
16
hw/char/trace-events | 2 ++
9
1 file changed, 10 insertions(+), 2 deletions(-)
17
2 files changed, 26 insertions(+)
18
10
19
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
11
diff --git a/target/arm/helper.c b/target/arm/helper.c
20
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/char/exynos4210_uart.c
13
--- a/target/arm/helper.c
22
+++ b/hw/char/exynos4210_uart.c
14
+++ b/target/arm/helper.c
23
@@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210UartState {
15
@@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu)
24
25
CharBackend chr;
26
qemu_irq irq;
27
+ qemu_irq dmairq;
28
29
uint32_t channel;
30
31
@@ -XXX,XX +XXX,XX @@ exynos4210_uart_Rx_FIFO_trigger_level(const Exynos4210UartState *s)
32
return exynos4210_uart_FIFO_trigger_level(s->channel, reg);
33
}
34
35
+/*
36
+ * Update Rx DMA busy signal if Rx DMA is enabled. For simplicity,
37
+ * mark DMA as busy if DMA is enabled and the receive buffer is empty.
38
+ */
39
+static void exynos4210_uart_update_dmabusy(Exynos4210UartState *s)
40
+{
41
+ bool rx_dma_enabled = (s->reg[I_(UCON)] & 0x03) == 0x02;
42
+ uint32_t count = fifo_elements_number(&s->rx);
43
+
44
+ if (rx_dma_enabled && !count) {
45
+ qemu_irq_raise(s->dmairq);
46
+ trace_exynos_uart_dmabusy(s->channel);
47
+ } else {
48
+ qemu_irq_lower(s->dmairq);
49
+ trace_exynos_uart_dmaready(s->channel);
50
+ }
51
+}
52
+
53
static void exynos4210_uart_update_irq(Exynos4210UartState *s)
54
{
55
/*
56
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_update_irq(Exynos4210UartState *s)
57
count = fifo_elements_number(&s->rx);
58
if ((count && !(s->reg[I_(UCON)] & 0x80)) ||
59
count >= exynos4210_uart_Rx_FIFO_trigger_level(s)) {
60
+ exynos4210_uart_update_dmabusy(s);
61
s->reg[I_(UINTSP)] |= UINTSP_RXD;
62
timer_del(s->fifo_timeout_timer);
63
}
64
} else if (s->reg[I_(UTRSTAT)] & UTRSTAT_Rx_BUFFER_DATA_READY) {
65
+ exynos4210_uart_update_dmabusy(s);
66
s->reg[I_(UINTSP)] |= UINTSP_RXD;
67
}
68
69
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_timeout_int(void *opaque)
70
(s->reg[I_(UCON)] & (1 << 11))) {
71
s->reg[I_(UINTSP)] |= UINTSP_RXD;
72
s->reg[I_(UTRSTAT)] |= UTRSTAT_Rx_TIMEOUT;
73
+ exynos4210_uart_update_dmabusy(s);
74
exynos4210_uart_update_irq(s);
75
}
16
}
76
}
17
}
77
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_uart_read(void *opaque, hwaddr offset,
18
78
s->reg[I_(UTRSTAT)] &= ~UTRSTAT_Rx_BUFFER_DATA_READY;
19
+#ifndef CONFIG_USER_ONLY
79
res = s->reg[I_(URXH)];
20
/*
80
}
21
* We don't know until after realize whether there's a GICv3
81
+ exynos4210_uart_update_dmabusy(s);
22
* attached, and that is what registers the gicv3 sysregs.
82
trace_exynos_uart_read(s->channel, offset,
23
@@ -XXX,XX +XXX,XX @@ static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri)
83
exynos4210_uart_regname(offset), res);
24
return pfr1;
84
return res;
85
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_init(Object *obj)
86
sysbus_init_mmio(dev, &s->iomem);
87
88
sysbus_init_irq(dev, &s->irq);
89
+ sysbus_init_irq(dev, &s->dmairq);
90
}
25
}
91
26
92
static void exynos4210_uart_realize(DeviceState *dev, Error **errp)
27
-#ifndef CONFIG_USER_ONLY
93
diff --git a/hw/char/trace-events b/hw/char/trace-events
28
static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri)
94
index XXXXXXX..XXXXXXX 100644
29
{
95
--- a/hw/char/trace-events
30
ARMCPU *cpu = env_archcpu(env);
96
+++ b/hw/char/trace-events
31
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
97
@@ -XXX,XX +XXX,XX @@ nrf51_uart_read(uint64_t addr, uint64_t r, unsigned int size) "addr 0x%" PRIx64
32
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1,
98
nrf51_uart_write(uint64_t addr, uint64_t value, unsigned int size) "addr 0x%" PRIx64 " value 0x%" PRIx64 " size %u"
33
.access = PL1_R, .type = ARM_CP_NO_RAW,
99
34
.accessfn = access_aa32_tid3,
100
# exynos4210_uart.c
35
+#ifdef CONFIG_USER_ONLY
101
+exynos_uart_dmabusy(uint32_t channel) "UART%d: DMA busy (Rx buffer empty)"
36
+ .type = ARM_CP_CONST,
102
+exynos_uart_dmaready(uint32_t channel) "UART%d: DMA ready"
37
+ .resetvalue = cpu->isar.id_pfr1,
103
exynos_uart_irq_raised(uint32_t channel, uint32_t reg) "UART%d: IRQ raised: 0x%08"PRIx32
38
+#else
104
exynos_uart_irq_lowered(uint32_t channel) "UART%d: IRQ lowered"
39
+ .type = ARM_CP_NO_RAW,
105
exynos_uart_update_params(uint32_t channel, int speed, uint8_t parity, int data, int stop, uint64_t wordtime) "UART%d: speed: %d, parity: %c, data bits: %d, stop bits: %d wordtime: %"PRId64"ns"
40
+ .accessfn = access_aa32_tid3,
41
.readfn = id_pfr1_read,
42
- .writefn = arm_cp_write_ignore },
43
+ .writefn = arm_cp_write_ignore
44
+#endif
45
+ },
46
{ .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH,
47
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2,
48
.access = PL1_R, .type = ARM_CP_CONST,
106
--
49
--
107
2.20.1
50
2.34.1
108
51
109
52
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
After restoring a VM, serial parameters need to be updated to reflect
3
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
4
restored register values. Implement a post_load function to handle this
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
situation.
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
6
Message-id: 20230206223502.25122-6-philmd@linaro.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
9
Message-id: 20200123052540.6132-6-linux@roeck-us.net
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
8
---
12
hw/char/exynos4210_uart.c | 10 ++++++++++
9
linux-user/user-internals.h | 2 +-
13
1 file changed, 10 insertions(+)
10
target/arm/cpu.h | 2 +-
11
linux-user/arm/cpu_loop.c | 4 ++--
12
3 files changed, 4 insertions(+), 4 deletions(-)
14
13
15
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
14
diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
16
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/char/exynos4210_uart.c
16
--- a/linux-user/user-internals.h
18
+++ b/hw/char/exynos4210_uart.c
17
+++ b/linux-user/user-internals.h
19
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_reset(DeviceState *dev)
18
@@ -XXX,XX +XXX,XX @@ void print_termios(void *arg);
20
trace_exynos_uart_rxsize(s->channel, s->rx.size);
19
#ifdef TARGET_ARM
20
static inline int regpairs_aligned(CPUArchState *cpu_env, int num)
21
{
22
- return cpu_env->eabi == 1;
23
+ return cpu_env->eabi;
21
}
24
}
22
25
#elif defined(TARGET_MIPS) && defined(TARGET_ABI_MIPSO32)
23
+static int exynos4210_uart_post_load(void *opaque, int version_id)
26
static inline int regpairs_aligned(CPUArchState *cpu_env, int num) { return 1; }
24
+{
27
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
25
+ Exynos4210UartState *s = (Exynos4210UartState *)opaque;
28
index XXXXXXX..XXXXXXX 100644
26
+
29
--- a/target/arm/cpu.h
27
+ exynos4210_uart_update_parameters(s);
30
+++ b/target/arm/cpu.h
28
+
31
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
29
+ return 0;
32
30
+}
33
#if defined(CONFIG_USER_ONLY)
31
+
34
/* For usermode syscall translation. */
32
static const VMStateDescription vmstate_exynos4210_uart_fifo = {
35
- int eabi;
33
.name = "exynos4210.uart.fifo",
36
+ bool eabi;
34
.version_id = 1,
37
#endif
35
.minimum_version_id = 1,
38
36
+ .post_load = exynos4210_uart_post_load,
39
struct CPUBreakpoint *cpu_breakpoint[16];
37
.fields = (VMStateField[]) {
40
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
38
VMSTATE_UINT32(sp, Exynos4210UartFIFO),
41
index XXXXXXX..XXXXXXX 100644
39
VMSTATE_UINT32(rp, Exynos4210UartFIFO),
42
--- a/linux-user/arm/cpu_loop.c
43
+++ b/linux-user/arm/cpu_loop.c
44
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
45
break;
46
case EXCP_SWI:
47
{
48
- env->eabi = 1;
49
+ env->eabi = true;
50
/* system call */
51
if (env->thumb) {
52
/* Thumb is always EABI style with syscall number in r7 */
53
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
54
* > 0xfffff and are handled below as out-of-range.
55
*/
56
n ^= ARM_SYSCALL_BASE;
57
- env->eabi = 0;
58
+ env->eabi = false;
59
}
60
}
61
40
--
62
--
41
2.20.1
63
2.34.1
42
64
43
65
diff view generated by jsdifflib
1
The qemu-block-drivers documentation is currently in
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
docs/qemu-block-drivers.texi in Texinfo format, which we present
3
to the user as:
4
* a qemu-block-drivers manpage
5
* a section of the main qemu-doc HTML documentation
6
2
7
Convert the documentation to rST format, and present it to
3
Although the 'eabi' field is only used in user emulation where
8
the user as:
4
CPU reset doesn't occur, it doesn't belong to the area to reset.
9
* a qemu-block-drivers manpage
5
Move it after the 'end_reset_fields' for consistency.
10
* part of the system/ Sphinx manual
11
6
12
This follows the same pattern we've done for qemu-ga and qemu-nbd.
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Message-id: 20230206223502.25122-7-philmd@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
target/arm/cpu.h | 9 ++++-----
13
1 file changed, 4 insertions(+), 5 deletions(-)
13
14
14
We have to drop a cross-reference from the documentation of the
15
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
-cdrom option back to the qemu-block-drivers documentation, since
16
they're no longer within the same texinfo document.
17
18
As noted in a comment, the manpage output is slightly compromised
19
due to limitations in Sphinx. In an ideal world, the HTML output
20
would have the various headings like 'Disk image file formats'
21
as top-level section headings (which then appear in the overall
22
system manual's table-of-contents), and it would not have the
23
section headings which make sense only for the manpage like
24
'synopsis', 'description', and 'see also'. Unfortunately, the
25
mechanism Sphinx provides for restricting pieces of documentation
26
is limited to the point of being flawed: the 'only::' directive
27
is implemented as a filter that is applied at a very late stage
28
in the document processing pipeline, rather than as an early
29
equivalent of an #ifdef. This means that Sphinx's process of
30
identifying which section heading markup styles are which levels
31
of heading gets confused if the 'only::' directive contains
32
section headings which would affect the heading-level of a
33
later heading. I have opted to prioritise making the HTML format
34
look better, with the compromise being that in the manpage
35
the 'Disk image file formats' &c headings are top-level headings
36
rather than being sub-headings under the traditional 'Description'
37
top-level section title.
38
39
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
40
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
41
Tested-by: Alex Bennée <alex.bennee@linaro.org>
42
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
43
Message-id: 20200116141511.16849-4-peter.maydell@linaro.org
44
---
45
Makefile | 11 +-
46
docs/qemu-block-drivers.texi | 889 --------------------------
47
docs/system/conf.py | 7 +
48
docs/system/index.rst | 1 +
49
docs/system/qemu-block-drivers.rst | 985 +++++++++++++++++++++++++++++
50
qemu-doc.texi | 12 -
51
qemu-options.hx | 2 +-
52
7 files changed, 1000 insertions(+), 907 deletions(-)
53
delete mode 100644 docs/qemu-block-drivers.texi
54
create mode 100644 docs/system/qemu-block-drivers.rst
55
56
diff --git a/Makefile b/Makefile
57
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
58
--- a/Makefile
17
--- a/target/arm/cpu.h
59
+++ b/Makefile
18
+++ b/target/arm/cpu.h
60
@@ -XXX,XX +XXX,XX @@ ifdef BUILD_DOCS
19
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
61
DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1
20
ARMVectorReg zarray[ARM_MAX_VQ * 16];
62
DOCS+=$(MANUAL_BUILDDIR)/interop/qemu-nbd.8
21
#endif
63
DOCS+=$(MANUAL_BUILDDIR)/interop/qemu-ga.8
22
64
+DOCS+=$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7
23
-#if defined(CONFIG_USER_ONLY)
65
DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
24
- /* For usermode syscall translation. */
66
DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
25
- bool eabi;
67
-DOCS+=docs/qemu-block-drivers.7
26
-#endif
68
DOCS+=docs/qemu-cpu-models.7
69
DOCS+=$(MANUAL_BUILDDIR)/index.html
70
ifdef CONFIG_VIRTFS
71
@@ -XXX,XX +XXX,XX @@ distclean: clean
72
    rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
73
    rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
74
    rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
75
-    rm -f docs/qemu-block-drivers.7
76
    rm -f docs/qemu-cpu-models.7
77
    rm -rf .doctrees
78
    $(call clean-manual,devel)
79
@@ -XXX,XX +XXX,XX @@ ifdef CONFIG_POSIX
80
    $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
81
    $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
82
    $(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
83
-    $(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
84
+    $(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
85
    $(INSTALL_DATA) docs/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
86
ifeq ($(CONFIG_TOOLS),y)
87
    $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
88
@@ -XXX,XX +XXX,XX @@ $(MANUAL_BUILDDIR)/interop/qemu-ga.8: $(call manual-deps,interop)
89
$(MANUAL_BUILDDIR)/interop/qemu-nbd.8: $(call manual-deps,interop)
90
    $(call build-manual,interop,man)
91
92
+$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7: $(call manual-deps,system)
93
+    $(call build-manual,system,man)
94
+
95
$(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h
96
    @mkdir -p "$(MANUAL_BUILDDIR)"
97
    $(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \
98
@@ -XXX,XX +XXX,XX @@ qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
99
qemu.1: qemu-option-trace.texi
100
qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
101
fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
102
-docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
103
docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
104
scripts/qemu-trace-stap.1: scripts/qemu-trace-stap.texi
105
106
@@ -XXX,XX +XXX,XX @@ qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
107
    qemu-img.texi qemu-options.texi \
108
    qemu-tech.texi qemu-option-trace.texi \
109
    qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi \
110
-    qemu-monitor-info.texi docs/qemu-block-drivers.texi \
111
+    qemu-monitor-info.texi \
112
    docs/qemu-cpu-models.texi docs/security.texi
113
114
docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
115
diff --git a/docs/qemu-block-drivers.texi b/docs/qemu-block-drivers.texi
116
deleted file mode 100644
117
index XXXXXXX..XXXXXXX
118
--- a/docs/qemu-block-drivers.texi
119
+++ /dev/null
120
@@ -XXX,XX +XXX,XX @@
121
-@c man begin SYNOPSIS
122
-QEMU block driver reference manual
123
-@c man end
124
-
27
-
125
-@set qemu_system qemu-system-x86_64
28
struct CPUBreakpoint *cpu_breakpoint[16];
126
-
29
struct CPUWatchpoint *cpu_watchpoint[16];
127
-@c man begin DESCRIPTION
30
128
-
31
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
129
-@node disk_images_formats
32
const struct arm_boot_info *boot_info;
130
-@subsection Disk image file formats
33
/* Store GICv3CPUState to access from this struct */
131
-
34
void *gicv3state;
132
-QEMU supports many image file formats that can be used with VMs as well as with
35
+#if defined(CONFIG_USER_ONLY)
133
-any of the tools (like @code{qemu-img}). This includes the preferred formats
36
+ /* For usermode syscall translation. */
134
-raw and qcow2 as well as formats that are supported for compatibility with
37
+ bool eabi;
135
-older QEMU versions or other hypervisors.
38
+#endif /* CONFIG_USER_ONLY */
136
-
39
137
-Depending on the image format, different options can be passed to
40
#ifdef TARGET_TAGGED_ADDRESSES
138
-@code{qemu-img create} and @code{qemu-img convert} using the @code{-o} option.
41
/* Linux syscall tagged address support */
139
-This section describes each format and the options that are supported for it.
140
-
141
-@table @option
142
-@item raw
143
-
144
-Raw disk image format. This format has the advantage of
145
-being simple and easily exportable to all other emulators. If your
146
-file system supports @emph{holes} (for example in ext2 or ext3 on
147
-Linux or NTFS on Windows), then only the written sectors will reserve
148
-space. Use @code{qemu-img info} to know the real size used by the
149
-image or @code{ls -ls} on Unix/Linux.
150
-
151
-Supported options:
152
-@table @code
153
-@item preallocation
154
-Preallocation mode (allowed values: @code{off}, @code{falloc}, @code{full}).
155
-@code{falloc} mode preallocates space for image by calling posix_fallocate().
156
-@code{full} mode preallocates space for image by writing data to underlying
157
-storage. This data may or may not be zero, depending on the storage location.
158
-@end table
159
-
160
-@item qcow2
161
-QEMU image format, the most versatile format. Use it to have smaller
162
-images (useful if your filesystem does not supports holes, for example
163
-on Windows), zlib based compression and support of multiple VM
164
-snapshots.
165
-
166
-Supported options:
167
-@table @code
168
-@item compat
169
-Determines the qcow2 version to use. @code{compat=0.10} uses the
170
-traditional image format that can be read by any QEMU since 0.10.
171
-@code{compat=1.1} enables image format extensions that only QEMU 1.1 and
172
-newer understand (this is the default). Amongst others, this includes
173
-zero clusters, which allow efficient copy-on-read for sparse images.
174
-
175
-@item backing_file
176
-File name of a base image (see @option{create} subcommand)
177
-@item backing_fmt
178
-Image format of the base image
179
-@item encryption
180
-This option is deprecated and equivalent to @code{encrypt.format=aes}
181
-
182
-@item encrypt.format
183
-
184
-If this is set to @code{luks}, it requests that the qcow2 payload (not
185
-qcow2 header) be encrypted using the LUKS format. The passphrase to
186
-use to unlock the LUKS key slot is given by the @code{encrypt.key-secret}
187
-parameter. LUKS encryption parameters can be tuned with the other
188
-@code{encrypt.*} parameters.
189
-
190
-If this is set to @code{aes}, the image is encrypted with 128-bit AES-CBC.
191
-The encryption key is given by the @code{encrypt.key-secret} parameter.
192
-This encryption format is considered to be flawed by modern cryptography
193
-standards, suffering from a number of design problems:
194
-
195
-@itemize @minus
196
-@item The AES-CBC cipher is used with predictable initialization vectors based
197
-on the sector number. This makes it vulnerable to chosen plaintext attacks
198
-which can reveal the existence of encrypted data.
199
-@item The user passphrase is directly used as the encryption key. A poorly
200
-chosen or short passphrase will compromise the security of the encryption.
201
-@item In the event of the passphrase being compromised there is no way to
202
-change the passphrase to protect data in any qcow images. The files must
203
-be cloned, using a different encryption passphrase in the new file. The
204
-original file must then be securely erased using a program like shred,
205
-though even this is ineffective with many modern storage technologies.
206
-@end itemize
207
-
208
-The use of this is no longer supported in system emulators. Support only
209
-remains in the command line utilities, for the purposes of data liberation
210
-and interoperability with old versions of QEMU. The @code{luks} format
211
-should be used instead.
212
-
213
-@item encrypt.key-secret
214
-
215
-Provides the ID of a @code{secret} object that contains the passphrase
216
-(@code{encrypt.format=luks}) or encryption key (@code{encrypt.format=aes}).
217
-
218
-@item encrypt.cipher-alg
219
-
220
-Name of the cipher algorithm and key length. Currently defaults
221
-to @code{aes-256}. Only used when @code{encrypt.format=luks}.
222
-
223
-@item encrypt.cipher-mode
224
-
225
-Name of the encryption mode to use. Currently defaults to @code{xts}.
226
-Only used when @code{encrypt.format=luks}.
227
-
228
-@item encrypt.ivgen-alg
229
-
230
-Name of the initialization vector generator algorithm. Currently defaults
231
-to @code{plain64}. Only used when @code{encrypt.format=luks}.
232
-
233
-@item encrypt.ivgen-hash-alg
234
-
235
-Name of the hash algorithm to use with the initialization vector generator
236
-(if required). Defaults to @code{sha256}. Only used when @code{encrypt.format=luks}.
237
-
238
-@item encrypt.hash-alg
239
-
240
-Name of the hash algorithm to use for PBKDF algorithm
241
-Defaults to @code{sha256}. Only used when @code{encrypt.format=luks}.
242
-
243
-@item encrypt.iter-time
244
-
245
-Amount of time, in milliseconds, to use for PBKDF algorithm per key slot.
246
-Defaults to @code{2000}. Only used when @code{encrypt.format=luks}.
247
-
248
-@item cluster_size
249
-Changes the qcow2 cluster size (must be between 512 and 2M). Smaller cluster
250
-sizes can improve the image file size whereas larger cluster sizes generally
251
-provide better performance.
252
-
253
-@item preallocation
254
-Preallocation mode (allowed values: @code{off}, @code{metadata}, @code{falloc},
255
-@code{full}). An image with preallocated metadata is initially larger but can
256
-improve performance when the image needs to grow. @code{falloc} and @code{full}
257
-preallocations are like the same options of @code{raw} format, but sets up
258
-metadata also.
259
-
260
-@item lazy_refcounts
261
-If this option is set to @code{on}, reference count updates are postponed with
262
-the goal of avoiding metadata I/O and improving performance. This is
263
-particularly interesting with @option{cache=writethrough} which doesn't batch
264
-metadata updates. The tradeoff is that after a host crash, the reference count
265
-tables must be rebuilt, i.e. on the next open an (automatic) @code{qemu-img
266
-check -r all} is required, which may take some time.
267
-
268
-This option can only be enabled if @code{compat=1.1} is specified.
269
-
270
-@item nocow
271
-If this option is set to @code{on}, it will turn off COW of the file. It's only
272
-valid on btrfs, no effect on other file systems.
273
-
274
-Btrfs has low performance when hosting a VM image file, even more when the guest
275
-on the VM also using btrfs as file system. Turning off COW is a way to mitigate
276
-this bad performance. Generally there are two ways to turn off COW on btrfs:
277
-a) Disable it by mounting with nodatacow, then all newly created files will be
278
-NOCOW. b) For an empty file, add the NOCOW file attribute. That's what this option
279
-does.
280
-
281
-Note: this option is only valid to new or empty files. If there is an existing
282
-file which is COW and has data blocks already, it couldn't be changed to NOCOW
283
-by setting @code{nocow=on}. One can issue @code{lsattr filename} to check if
284
-the NOCOW flag is set or not (Capital 'C' is NOCOW flag).
285
-
286
-@end table
287
-
288
-@item qed
289
-Old QEMU image format with support for backing files and compact image files
290
-(when your filesystem or transport medium does not support holes).
291
-
292
-When converting QED images to qcow2, you might want to consider using the
293
-@code{lazy_refcounts=on} option to get a more QED-like behaviour.
294
-
295
-Supported options:
296
-@table @code
297
-@item backing_file
298
-File name of a base image (see @option{create} subcommand).
299
-@item backing_fmt
300
-Image file format of backing file (optional). Useful if the format cannot be
301
-autodetected because it has no header, like some vhd/vpc files.
302
-@item cluster_size
303
-Changes the cluster size (must be power-of-2 between 4K and 64K). Smaller
304
-cluster sizes can improve the image file size whereas larger cluster sizes
305
-generally provide better performance.
306
-@item table_size
307
-Changes the number of clusters per L1/L2 table (must be power-of-2 between 1
308
-and 16). There is normally no need to change this value but this option can be
309
-used for performance benchmarking.
310
-@end table
311
-
312
-@item qcow
313
-Old QEMU image format with support for backing files, compact image files,
314
-encryption and compression.
315
-
316
-Supported options:
317
-@table @code
318
-@item backing_file
319
-File name of a base image (see @option{create} subcommand)
320
-@item encryption
321
-This option is deprecated and equivalent to @code{encrypt.format=aes}
322
-
323
-@item encrypt.format
324
-If this is set to @code{aes}, the image is encrypted with 128-bit AES-CBC.
325
-The encryption key is given by the @code{encrypt.key-secret} parameter.
326
-This encryption format is considered to be flawed by modern cryptography
327
-standards, suffering from a number of design problems enumerated previously
328
-against the @code{qcow2} image format.
329
-
330
-The use of this is no longer supported in system emulators. Support only
331
-remains in the command line utilities, for the purposes of data liberation
332
-and interoperability with old versions of QEMU.
333
-
334
-Users requiring native encryption should use the @code{qcow2} format
335
-instead with @code{encrypt.format=luks}.
336
-
337
-@item encrypt.key-secret
338
-
339
-Provides the ID of a @code{secret} object that contains the encryption
340
-key (@code{encrypt.format=aes}).
341
-
342
-@end table
343
-
344
-@item luks
345
-
346
-LUKS v1 encryption format, compatible with Linux dm-crypt/cryptsetup
347
-
348
-Supported options:
349
-@table @code
350
-
351
-@item key-secret
352
-
353
-Provides the ID of a @code{secret} object that contains the passphrase.
354
-
355
-@item cipher-alg
356
-
357
-Name of the cipher algorithm and key length. Currently defaults
358
-to @code{aes-256}.
359
-
360
-@item cipher-mode
361
-
362
-Name of the encryption mode to use. Currently defaults to @code{xts}.
363
-
364
-@item ivgen-alg
365
-
366
-Name of the initialization vector generator algorithm. Currently defaults
367
-to @code{plain64}.
368
-
369
-@item ivgen-hash-alg
370
-
371
-Name of the hash algorithm to use with the initialization vector generator
372
-(if required). Defaults to @code{sha256}.
373
-
374
-@item hash-alg
375
-
376
-Name of the hash algorithm to use for PBKDF algorithm
377
-Defaults to @code{sha256}.
378
-
379
-@item iter-time
380
-
381
-Amount of time, in milliseconds, to use for PBKDF algorithm per key slot.
382
-Defaults to @code{2000}.
383
-
384
-@end table
385
-
386
-@item vdi
387
-VirtualBox 1.1 compatible image format.
388
-Supported options:
389
-@table @code
390
-@item static
391
-If this option is set to @code{on}, the image is created with metadata
392
-preallocation.
393
-@end table
394
-
395
-@item vmdk
396
-VMware 3 and 4 compatible image format.
397
-
398
-Supported options:
399
-@table @code
400
-@item backing_file
401
-File name of a base image (see @option{create} subcommand).
402
-@item compat6
403
-Create a VMDK version 6 image (instead of version 4)
404
-@item hwversion
405
-Specify vmdk virtual hardware version. Compat6 flag cannot be enabled
406
-if hwversion is specified.
407
-@item subformat
408
-Specifies which VMDK subformat to use. Valid options are
409
-@code{monolithicSparse} (default),
410
-@code{monolithicFlat},
411
-@code{twoGbMaxExtentSparse},
412
-@code{twoGbMaxExtentFlat} and
413
-@code{streamOptimized}.
414
-@end table
415
-
416
-@item vpc
417
-VirtualPC compatible image format (VHD).
418
-Supported options:
419
-@table @code
420
-@item subformat
421
-Specifies which VHD subformat to use. Valid options are
422
-@code{dynamic} (default) and @code{fixed}.
423
-@end table
424
-
425
-@item VHDX
426
-Hyper-V compatible image format (VHDX).
427
-Supported options:
428
-@table @code
429
-@item subformat
430
-Specifies which VHDX subformat to use. Valid options are
431
-@code{dynamic} (default) and @code{fixed}.
432
-@item block_state_zero
433
-Force use of payload blocks of type 'ZERO'. Can be set to @code{on} (default)
434
-or @code{off}. When set to @code{off}, new blocks will be created as
435
-@code{PAYLOAD_BLOCK_NOT_PRESENT}, which means parsers are free to return
436
-arbitrary data for those blocks. Do not set to @code{off} when using
437
-@code{qemu-img convert} with @code{subformat=dynamic}.
438
-@item block_size
439
-Block size; min 1 MB, max 256 MB. 0 means auto-calculate based on image size.
440
-@item log_size
441
-Log size; min 1 MB.
442
-@end table
443
-@end table
444
-
445
-@subsubsection Read-only formats
446
-More disk image file formats are supported in a read-only mode.
447
-@table @option
448
-@item bochs
449
-Bochs images of @code{growing} type.
450
-@item cloop
451
-Linux Compressed Loop image, useful only to reuse directly compressed
452
-CD-ROM images present for example in the Knoppix CD-ROMs.
453
-@item dmg
454
-Apple disk image.
455
-@item parallels
456
-Parallels disk image format.
457
-@end table
458
-
459
-
460
-@node host_drives
461
-@subsection Using host drives
462
-
463
-In addition to disk image files, QEMU can directly access host
464
-devices. We describe here the usage for QEMU version >= 0.8.3.
465
-
466
-@subsubsection Linux
467
-
468
-On Linux, you can directly use the host device filename instead of a
469
-disk image filename provided you have enough privileges to access
470
-it. For example, use @file{/dev/cdrom} to access to the CDROM.
471
-
472
-@table @code
473
-@item CD
474
-You can specify a CDROM device even if no CDROM is loaded. QEMU has
475
-specific code to detect CDROM insertion or removal. CDROM ejection by
476
-the guest OS is supported. Currently only data CDs are supported.
477
-@item Floppy
478
-You can specify a floppy device even if no floppy is loaded. Floppy
479
-removal is currently not detected accurately (if you change floppy
480
-without doing floppy access while the floppy is not loaded, the guest
481
-OS will think that the same floppy is loaded).
482
-Use of the host's floppy device is deprecated, and support for it will
483
-be removed in a future release.
484
-@item Hard disks
485
-Hard disks can be used. Normally you must specify the whole disk
486
-(@file{/dev/hdb} instead of @file{/dev/hdb1}) so that the guest OS can
487
-see it as a partitioned disk. WARNING: unless you know what you do, it
488
-is better to only make READ-ONLY accesses to the hard disk otherwise
489
-you may corrupt your host data (use the @option{-snapshot} command
490
-line option or modify the device permissions accordingly).
491
-@end table
492
-
493
-@subsubsection Windows
494
-
495
-@table @code
496
-@item CD
497
-The preferred syntax is the drive letter (e.g. @file{d:}). The
498
-alternate syntax @file{\\.\d:} is supported. @file{/dev/cdrom} is
499
-supported as an alias to the first CDROM drive.
500
-
501
-Currently there is no specific code to handle removable media, so it
502
-is better to use the @code{change} or @code{eject} monitor commands to
503
-change or eject media.
504
-@item Hard disks
505
-Hard disks can be used with the syntax: @file{\\.\PhysicalDrive@var{N}}
506
-where @var{N} is the drive number (0 is the first hard disk).
507
-
508
-WARNING: unless you know what you do, it is better to only make
509
-READ-ONLY accesses to the hard disk otherwise you may corrupt your
510
-host data (use the @option{-snapshot} command line so that the
511
-modifications are written in a temporary file).
512
-@end table
513
-
514
-
515
-@subsubsection Mac OS X
516
-
517
-@file{/dev/cdrom} is an alias to the first CDROM.
518
-
519
-Currently there is no specific code to handle removable media, so it
520
-is better to use the @code{change} or @code{eject} monitor commands to
521
-change or eject media.
522
-
523
-@node disk_images_fat_images
524
-@subsection Virtual FAT disk images
525
-
526
-QEMU can automatically create a virtual FAT disk image from a
527
-directory tree. In order to use it, just type:
528
-
529
-@example
530
-@value{qemu_system} linux.img -hdb fat:/my_directory
531
-@end example
532
-
533
-Then you access access to all the files in the @file{/my_directory}
534
-directory without having to copy them in a disk image or to export
535
-them via SAMBA or NFS. The default access is @emph{read-only}.
536
-
537
-Floppies can be emulated with the @code{:floppy:} option:
538
-
539
-@example
540
-@value{qemu_system} linux.img -fda fat:floppy:/my_directory
541
-@end example
542
-
543
-A read/write support is available for testing (beta stage) with the
544
-@code{:rw:} option:
545
-
546
-@example
547
-@value{qemu_system} linux.img -fda fat:floppy:rw:/my_directory
548
-@end example
549
-
550
-What you should @emph{never} do:
551
-@itemize
552
-@item use non-ASCII filenames ;
553
-@item use "-snapshot" together with ":rw:" ;
554
-@item expect it to work when loadvm'ing ;
555
-@item write to the FAT directory on the host system while accessing it with the guest system.
556
-@end itemize
557
-
558
-@node disk_images_nbd
559
-@subsection NBD access
560
-
561
-QEMU can access directly to block device exported using the Network Block Device
562
-protocol.
563
-
564
-@example
565
-@value{qemu_system} linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/
566
-@end example
567
-
568
-If the NBD server is located on the same host, you can use an unix socket instead
569
-of an inet socket:
570
-
571
-@example
572
-@value{qemu_system} linux.img -hdb nbd+unix://?socket=/tmp/my_socket
573
-@end example
574
-
575
-In this case, the block device must be exported using qemu-nbd:
576
-
577
-@example
578
-qemu-nbd --socket=/tmp/my_socket my_disk.qcow2
579
-@end example
580
-
581
-The use of qemu-nbd allows sharing of a disk between several guests:
582
-@example
583
-qemu-nbd --socket=/tmp/my_socket --share=2 my_disk.qcow2
584
-@end example
585
-
586
-@noindent
587
-and then you can use it with two guests:
588
-@example
589
-@value{qemu_system} linux1.img -hdb nbd+unix://?socket=/tmp/my_socket
590
-@value{qemu_system} linux2.img -hdb nbd+unix://?socket=/tmp/my_socket
591
-@end example
592
-
593
-If the nbd-server uses named exports (supported since NBD 2.9.18, or with QEMU's
594
-own embedded NBD server), you must specify an export name in the URI:
595
-@example
596
-@value{qemu_system} -cdrom nbd://localhost/debian-500-ppc-netinst
597
-@value{qemu_system} -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst
598
-@end example
599
-
600
-The URI syntax for NBD is supported since QEMU 1.3. An alternative syntax is
601
-also available. Here are some example of the older syntax:
602
-@example
603
-@value{qemu_system} linux.img -hdb nbd:my_nbd_server.mydomain.org:1024
604
-@value{qemu_system} linux2.img -hdb nbd:unix:/tmp/my_socket
605
-@value{qemu_system} -cdrom nbd:localhost:10809:exportname=debian-500-ppc-netinst
606
-@end example
607
-
608
-@node disk_images_sheepdog
609
-@subsection Sheepdog disk images
610
-
611
-Sheepdog is a distributed storage system for QEMU. It provides highly
612
-available block level storage volumes that can be attached to
613
-QEMU-based virtual machines.
614
-
615
-You can create a Sheepdog disk image with the command:
616
-@example
617
-qemu-img create sheepdog:///@var{image} @var{size}
618
-@end example
619
-where @var{image} is the Sheepdog image name and @var{size} is its
620
-size.
621
-
622
-To import the existing @var{filename} to Sheepdog, you can use a
623
-convert command.
624
-@example
625
-qemu-img convert @var{filename} sheepdog:///@var{image}
626
-@end example
627
-
628
-You can boot from the Sheepdog disk image with the command:
629
-@example
630
-@value{qemu_system} sheepdog:///@var{image}
631
-@end example
632
-
633
-You can also create a snapshot of the Sheepdog image like qcow2.
634
-@example
635
-qemu-img snapshot -c @var{tag} sheepdog:///@var{image}
636
-@end example
637
-where @var{tag} is a tag name of the newly created snapshot.
638
-
639
-To boot from the Sheepdog snapshot, specify the tag name of the
640
-snapshot.
641
-@example
642
-@value{qemu_system} sheepdog:///@var{image}#@var{tag}
643
-@end example
644
-
645
-You can create a cloned image from the existing snapshot.
646
-@example
647
-qemu-img create -b sheepdog:///@var{base}#@var{tag} sheepdog:///@var{image}
648
-@end example
649
-where @var{base} is an image name of the source snapshot and @var{tag}
650
-is its tag name.
651
-
652
-You can use an unix socket instead of an inet socket:
653
-
654
-@example
655
-@value{qemu_system} sheepdog+unix:///@var{image}?socket=@var{path}
656
-@end example
657
-
658
-If the Sheepdog daemon doesn't run on the local host, you need to
659
-specify one of the Sheepdog servers to connect to.
660
-@example
661
-qemu-img create sheepdog://@var{hostname}:@var{port}/@var{image} @var{size}
662
-@value{qemu_system} sheepdog://@var{hostname}:@var{port}/@var{image}
663
-@end example
664
-
665
-@node disk_images_iscsi
666
-@subsection iSCSI LUNs
667
-
668
-iSCSI is a popular protocol used to access SCSI devices across a computer
669
-network.
670
-
671
-There are two different ways iSCSI devices can be used by QEMU.
672
-
673
-The first method is to mount the iSCSI LUN on the host, and make it appear as
674
-any other ordinary SCSI device on the host and then to access this device as a
675
-/dev/sd device from QEMU. How to do this differs between host OSes.
676
-
677
-The second method involves using the iSCSI initiator that is built into
678
-QEMU. This provides a mechanism that works the same way regardless of which
679
-host OS you are running QEMU on. This section will describe this second method
680
-of using iSCSI together with QEMU.
681
-
682
-In QEMU, iSCSI devices are described using special iSCSI URLs
683
-
684
-@example
685
-URL syntax:
686
-iscsi://[<username>[%<password>]@@]<host>[:<port>]/<target-iqn-name>/<lun>
687
-@end example
688
-
689
-Username and password are optional and only used if your target is set up
690
-using CHAP authentication for access control.
691
-Alternatively the username and password can also be set via environment
692
-variables to have these not show up in the process list
693
-
694
-@example
695
-export LIBISCSI_CHAP_USERNAME=<username>
696
-export LIBISCSI_CHAP_PASSWORD=<password>
697
-iscsi://<host>/<target-iqn-name>/<lun>
698
-@end example
699
-
700
-Various session related parameters can be set via special options, either
701
-in a configuration file provided via '-readconfig' or directly on the
702
-command line.
703
-
704
-If the initiator-name is not specified qemu will use a default name
705
-of 'iqn.2008-11.org.linux-kvm[:<uuid>'] where <uuid> is the UUID of the
706
-virtual machine. If the UUID is not specified qemu will use
707
-'iqn.2008-11.org.linux-kvm[:<name>'] where <name> is the name of the
708
-virtual machine.
709
-
710
-@example
711
-Setting a specific initiator name to use when logging in to the target
712
--iscsi initiator-name=iqn.qemu.test:my-initiator
713
-@end example
714
-
715
-@example
716
-Controlling which type of header digest to negotiate with the target
717
--iscsi header-digest=CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
718
-@end example
719
-
720
-These can also be set via a configuration file
721
-@example
722
-[iscsi]
723
- user = "CHAP username"
724
- password = "CHAP password"
725
- initiator-name = "iqn.qemu.test:my-initiator"
726
- # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
727
- header-digest = "CRC32C"
728
-@end example
729
-
730
-
731
-Setting the target name allows different options for different targets
732
-@example
733
-[iscsi "iqn.target.name"]
734
- user = "CHAP username"
735
- password = "CHAP password"
736
- initiator-name = "iqn.qemu.test:my-initiator"
737
- # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
738
- header-digest = "CRC32C"
739
-@end example
740
-
741
-
742
-Howto use a configuration file to set iSCSI configuration options:
743
-@example
744
-cat >iscsi.conf <<EOF
745
-[iscsi]
746
- user = "me"
747
- password = "my password"
748
- initiator-name = "iqn.qemu.test:my-initiator"
749
- header-digest = "CRC32C"
750
-EOF
751
-
752
-@value{qemu_system} -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
753
- -readconfig iscsi.conf
754
-@end example
755
-
756
-
757
-How to set up a simple iSCSI target on loopback and access it via QEMU:
758
-@example
759
-This example shows how to set up an iSCSI target with one CDROM and one DISK
760
-using the Linux STGT software target. This target is available on Red Hat based
761
-systems as the package 'scsi-target-utils'.
762
-
763
-tgtd --iscsi portal=127.0.0.1:3260
764
-tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.qemu.test
765
-tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \
766
- -b /IMAGES/disk.img --device-type=disk
767
-tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \
768
- -b /IMAGES/cd.iso --device-type=cd
769
-tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
770
-
771
-@value{qemu_system} -iscsi initiator-name=iqn.qemu.test:my-initiator \
772
- -boot d -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
773
- -cdrom iscsi://127.0.0.1/iqn.qemu.test/2
774
-@end example
775
-
776
-@node disk_images_gluster
777
-@subsection GlusterFS disk images
778
-
779
-GlusterFS is a user space distributed file system.
780
-
781
-You can boot from the GlusterFS disk image with the command:
782
-@example
783
-URI:
784
-@value{qemu_system} -drive file=gluster[+@var{type}]://[@var{host}[:@var{port}]]/@var{volume}/@var{path}
785
- [?socket=...][,file.debug=9][,file.logfile=...]
786
-
787
-JSON:
788
-@value{qemu_system} 'json:@{"driver":"qcow2",
789
- "file":@{"driver":"gluster",
790
- "volume":"testvol","path":"a.img","debug":9,"logfile":"...",
791
- "server":[@{"type":"tcp","host":"...","port":"..."@},
792
- @{"type":"unix","socket":"..."@}]@}@}'
793
-@end example
794
-
795
-@var{gluster} is the protocol.
796
-
797
-@var{type} specifies the transport type used to connect to gluster
798
-management daemon (glusterd). Valid transport types are
799
-tcp and unix. In the URI form, if a transport type isn't specified,
800
-then tcp type is assumed.
801
-
802
-@var{host} specifies the server where the volume file specification for
803
-the given volume resides. This can be either a hostname or an ipv4 address.
804
-If transport type is unix, then @var{host} field should not be specified.
805
-Instead @var{socket} field needs to be populated with the path to unix domain
806
-socket.
807
-
808
-@var{port} is the port number on which glusterd is listening. This is optional
809
-and if not specified, it defaults to port 24007. If the transport type is unix,
810
-then @var{port} should not be specified.
811
-
812
-@var{volume} is the name of the gluster volume which contains the disk image.
813
-
814
-@var{path} is the path to the actual disk image that resides on gluster volume.
815
-
816
-@var{debug} is the logging level of the gluster protocol driver. Debug levels
817
-are 0-9, with 9 being the most verbose, and 0 representing no debugging output.
818
-The default level is 4. The current logging levels defined in the gluster source
819
-are 0 - None, 1 - Emergency, 2 - Alert, 3 - Critical, 4 - Error, 5 - Warning,
820
-6 - Notice, 7 - Info, 8 - Debug, 9 - Trace
821
-
822
-@var{logfile} is a commandline option to mention log file path which helps in
823
-logging to the specified file and also help in persisting the gfapi logs. The
824
-default is stderr.
825
-
826
-
827
-
828
-
829
-You can create a GlusterFS disk image with the command:
830
-@example
831
-qemu-img create gluster://@var{host}/@var{volume}/@var{path} @var{size}
832
-@end example
833
-
834
-Examples
835
-@example
836
-@value{qemu_system} -drive file=gluster://1.2.3.4/testvol/a.img
837
-@value{qemu_system} -drive file=gluster+tcp://1.2.3.4/testvol/a.img
838
-@value{qemu_system} -drive file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img
839
-@value{qemu_system} -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img
840
-@value{qemu_system} -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img
841
-@value{qemu_system} -drive file=gluster+tcp://server.domain.com:24007/testvol/dir/a.img
842
-@value{qemu_system} -drive file=gluster+unix:///testvol/dir/a.img?socket=/tmp/glusterd.socket
843
-@value{qemu_system} -drive file=gluster+rdma://1.2.3.4:24007/testvol/a.img
844
-@value{qemu_system} -drive file=gluster://1.2.3.4/testvol/a.img,file.debug=9,file.logfile=/var/log/qemu-gluster.log
845
-@value{qemu_system} 'json:@{"driver":"qcow2",
846
- "file":@{"driver":"gluster",
847
- "volume":"testvol","path":"a.img",
848
- "debug":9,"logfile":"/var/log/qemu-gluster.log",
849
- "server":[@{"type":"tcp","host":"1.2.3.4","port":24007@},
850
- @{"type":"unix","socket":"/var/run/glusterd.socket"@}]@}@}'
851
-@value{qemu_system} -drive driver=qcow2,file.driver=gluster,file.volume=testvol,file.path=/path/a.img,
852
- file.debug=9,file.logfile=/var/log/qemu-gluster.log,
853
- file.server.0.type=tcp,file.server.0.host=1.2.3.4,file.server.0.port=24007,
854
- file.server.1.type=unix,file.server.1.socket=/var/run/glusterd.socket
855
-@end example
856
-
857
-@node disk_images_ssh
858
-@subsection Secure Shell (ssh) disk images
859
-
860
-You can access disk images located on a remote ssh server
861
-by using the ssh protocol:
862
-
863
-@example
864
-@value{qemu_system} -drive file=ssh://[@var{user}@@]@var{server}[:@var{port}]/@var{path}[?host_key_check=@var{host_key_check}]
865
-@end example
866
-
867
-Alternative syntax using properties:
868
-
869
-@example
870
-@value{qemu_system} -drive file.driver=ssh[,file.user=@var{user}],file.host=@var{server}[,file.port=@var{port}],file.path=@var{path}[,file.host_key_check=@var{host_key_check}]
871
-@end example
872
-
873
-@var{ssh} is the protocol.
874
-
875
-@var{user} is the remote user. If not specified, then the local
876
-username is tried.
877
-
878
-@var{server} specifies the remote ssh server. Any ssh server can be
879
-used, but it must implement the sftp-server protocol. Most Unix/Linux
880
-systems should work without requiring any extra configuration.
881
-
882
-@var{port} is the port number on which sshd is listening. By default
883
-the standard ssh port (22) is used.
884
-
885
-@var{path} is the path to the disk image.
886
-
887
-The optional @var{host_key_check} parameter controls how the remote
888
-host's key is checked. The default is @code{yes} which means to use
889
-the local @file{.ssh/known_hosts} file. Setting this to @code{no}
890
-turns off known-hosts checking. Or you can check that the host key
891
-matches a specific fingerprint:
892
-@code{host_key_check=md5:78:45:8e:14:57:4f:d5:45:83:0a:0e:f3:49:82:c9:c8}
893
-(@code{sha1:} can also be used as a prefix, but note that OpenSSH
894
-tools only use MD5 to print fingerprints).
895
-
896
-Currently authentication must be done using ssh-agent. Other
897
-authentication methods may be supported in future.
898
-
899
-Note: Many ssh servers do not support an @code{fsync}-style operation.
900
-The ssh driver cannot guarantee that disk flush requests are
901
-obeyed, and this causes a risk of disk corruption if the remote
902
-server or network goes down during writes. The driver will
903
-print a warning when @code{fsync} is not supported:
904
-
905
-warning: ssh server @code{ssh.example.com:22} does not support fsync
906
-
907
-With sufficiently new versions of libssh and OpenSSH, @code{fsync} is
908
-supported.
909
-
910
-@node disk_images_nvme
911
-@subsection NVMe disk images
912
-
913
-NVM Express (NVMe) storage controllers can be accessed directly by a userspace
914
-driver in QEMU. This bypasses the host kernel file system and block layers
915
-while retaining QEMU block layer functionalities, such as block jobs, I/O
916
-throttling, image formats, etc. Disk I/O performance is typically higher than
917
-with @code{-drive file=/dev/sda} using either thread pool or linux-aio.
918
-
919
-The controller will be exclusively used by the QEMU process once started. To be
920
-able to share storage between multiple VMs and other applications on the host,
921
-please use the file based protocols.
922
-
923
-Before starting QEMU, bind the host NVMe controller to the host vfio-pci
924
-driver. For example:
925
-
926
-@example
927
-# modprobe vfio-pci
928
-# lspci -n -s 0000:06:0d.0
929
-06:0d.0 0401: 1102:0002 (rev 08)
930
-# echo 0000:06:0d.0 > /sys/bus/pci/devices/0000:06:0d.0/driver/unbind
931
-# echo 1102 0002 > /sys/bus/pci/drivers/vfio-pci/new_id
932
-
933
-# @value{qemu_system} -drive file=nvme://@var{host}:@var{bus}:@var{slot}.@var{func}/@var{namespace}
934
-@end example
935
-
936
-Alternative syntax using properties:
937
-
938
-@example
939
-@value{qemu_system} -drive file.driver=nvme,file.device=@var{host}:@var{bus}:@var{slot}.@var{func},file.namespace=@var{namespace}
940
-@end example
941
-
942
-@var{host}:@var{bus}:@var{slot}.@var{func} is the NVMe controller's PCI device
943
-address on the host.
944
-
945
-@var{namespace} is the NVMe namespace number, starting from 1.
946
-
947
-@node disk_image_locking
948
-@subsection Disk image file locking
949
-
950
-By default, QEMU tries to protect image files from unexpected concurrent
951
-access, as long as it's supported by the block protocol driver and host
952
-operating system. If multiple QEMU processes (including QEMU emulators and
953
-utilities) try to open the same image with conflicting accessing modes, all but
954
-the first one will get an error.
955
-
956
-This feature is currently supported by the file protocol on Linux with the Open
957
-File Descriptor (OFD) locking API, and can be configured to fall back to POSIX
958
-locking if the POSIX host doesn't support Linux OFD locking.
959
-
960
-To explicitly enable image locking, specify "locking=on" in the file protocol
961
-driver options. If OFD locking is not possible, a warning will be printed and
962
-the POSIX locking API will be used. In this case there is a risk that the lock
963
-will get silently lost when doing hot plugging and block jobs, due to the
964
-shortcomings of the POSIX locking API.
965
-
966
-QEMU transparently handles lock handover during shared storage migration. For
967
-shared virtual disk images between multiple VMs, the "share-rw" device option
968
-should be used.
969
-
970
-By default, the guest has exclusive write access to its disk image. If the
971
-guest can safely share the disk image with other writers the @code{-device
972
-...,share-rw=on} parameter can be used. This is only safe if the guest is
973
-running software, such as a cluster file system, that coordinates disk accesses
974
-to avoid corruption.
975
-
976
-Note that share-rw=on only declares the guest's ability to share the disk.
977
-Some QEMU features, such as image file formats, require exclusive write access
978
-to the disk image and this is unaffected by the share-rw=on option.
979
-
980
-Alternatively, locking can be fully disabled by "locking=off" block device
981
-option. In the command line, the option is usually in the form of
982
-"file.locking=off" as the protocol driver is normally placed as a "file" child
983
-under a format driver. For example:
984
-
985
-@code{-blockdev driver=qcow2,file.filename=/path/to/image,file.locking=off,file.driver=file}
986
-
987
-To check if image locking is active, check the output of the "lslocks" command
988
-on host and see if there are locks held by the QEMU process on the image file.
989
-More than one byte could be locked by the QEMU instance, each byte of which
990
-reflects a particular permission that is acquired or protected by the running
991
-block driver.
992
-
993
-@c man end
994
-
995
-@ignore
996
-
997
-@setfilename qemu-block-drivers
998
-@settitle QEMU block drivers reference
999
-
1000
-@c man begin SEEALSO
1001
-The HTML documentation of QEMU for more precise information and Linux
1002
-user mode emulator invocation.
1003
-@c man end
1004
-
1005
-@c man begin AUTHOR
1006
-Fabrice Bellard and the QEMU Project developers
1007
-@c man end
1008
-
1009
-@end ignore
1010
diff --git a/docs/system/conf.py b/docs/system/conf.py
1011
index XXXXXXX..XXXXXXX 100644
1012
--- a/docs/system/conf.py
1013
+++ b/docs/system/conf.py
1014
@@ -XXX,XX +XXX,XX @@ exec(compile(open(parent_config, "rb").read(), parent_config, 'exec'))
1015
# This slightly misuses the 'description', but is the best way to get
1016
# the manual title to appear in the sidebar.
1017
html_theme_options['description'] = u'System Emulation User''s Guide'
1018
+# One entry per manual page. List of tuples
1019
+# (source start file, name, description, authors, manual section).
1020
+man_pages = [
1021
+ ('qemu-block-drivers', 'qemu-block-drivers',
1022
+ u'QEMU block drivers reference',
1023
+ ['Fabrice Bellard and the QEMU Project developers'], 7)
1024
+]
1025
diff --git a/docs/system/index.rst b/docs/system/index.rst
1026
index XXXXXXX..XXXXXXX 100644
1027
--- a/docs/system/index.rst
1028
+++ b/docs/system/index.rst
1029
@@ -XXX,XX +XXX,XX @@ Contents:
1030
.. toctree::
1031
:maxdepth: 2
1032
1033
+ qemu-block-drivers
1034
diff --git a/docs/system/qemu-block-drivers.rst b/docs/system/qemu-block-drivers.rst
1035
new file mode 100644
1036
index XXXXXXX..XXXXXXX
1037
--- /dev/null
1038
+++ b/docs/system/qemu-block-drivers.rst
1039
@@ -XXX,XX +XXX,XX @@
1040
+QEMU block drivers reference
1041
+============================
1042
+
1043
+.. |qemu_system| replace:: qemu-system-x86_64
1044
+
1045
+..
1046
+ We put the 'Synopsis' and 'See also' sections into the manpage, but not
1047
+ the HTML. This makes the HTML docs read better and means the ToC in
1048
+ the index has a more useful set of entries. Ideally, the section
1049
+ headings 'Disk image file formats' would be top-level headings for
1050
+ the HTML, but sub-headings of the conventional manpage 'Description'
1051
+ header for the manpage. Unfortunately, due to deficiencies in
1052
+ the Sphinx 'only' directive, this isn't possible: they must be headers
1053
+ at the same level as 'Synopsis' and 'See also', otherwise Sphinx's
1054
+ identification of which header underline style is which gets confused.
1055
+
1056
+.. only:: man
1057
+
1058
+ Synopsis
1059
+ --------
1060
+
1061
+ QEMU block driver reference manual
1062
+
1063
+Disk image file formats
1064
+-----------------------
1065
+
1066
+QEMU supports many image file formats that can be used with VMs as well as with
1067
+any of the tools (like ``qemu-img``). This includes the preferred formats
1068
+raw and qcow2 as well as formats that are supported for compatibility with
1069
+older QEMU versions or other hypervisors.
1070
+
1071
+Depending on the image format, different options can be passed to
1072
+``qemu-img create`` and ``qemu-img convert`` using the ``-o`` option.
1073
+This section describes each format and the options that are supported for it.
1074
+
1075
+.. program:: image-formats
1076
+.. option:: raw
1077
+
1078
+ Raw disk image format. This format has the advantage of
1079
+ being simple and easily exportable to all other emulators. If your
1080
+ file system supports *holes* (for example in ext2 or ext3 on
1081
+ Linux or NTFS on Windows), then only the written sectors will reserve
1082
+ space. Use ``qemu-img info`` to know the real size used by the
1083
+ image or ``ls -ls`` on Unix/Linux.
1084
+
1085
+ Supported options:
1086
+
1087
+ .. program:: raw
1088
+ .. option:: preallocation
1089
+
1090
+ Preallocation mode (allowed values: ``off``, ``falloc``,
1091
+ ``full``). ``falloc`` mode preallocates space for image by
1092
+ calling ``posix_fallocate()``. ``full`` mode preallocates space
1093
+ for image by writing data to underlying storage. This data may or
1094
+ may not be zero, depending on the storage location.
1095
+
1096
+.. program:: image-formats
1097
+.. option:: qcow2
1098
+
1099
+ QEMU image format, the most versatile format. Use it to have smaller
1100
+ images (useful if your filesystem does not supports holes, for example
1101
+ on Windows), zlib based compression and support of multiple VM
1102
+ snapshots.
1103
+
1104
+ Supported options:
1105
+
1106
+ .. program:: qcow2
1107
+ .. option:: compat
1108
+
1109
+ Determines the qcow2 version to use. ``compat=0.10`` uses the
1110
+ traditional image format that can be read by any QEMU since 0.10.
1111
+ ``compat=1.1`` enables image format extensions that only QEMU 1.1 and
1112
+ newer understand (this is the default). Amongst others, this includes
1113
+ zero clusters, which allow efficient copy-on-read for sparse images.
1114
+
1115
+ .. option:: backing_file
1116
+
1117
+ File name of a base image (see ``create`` subcommand)
1118
+
1119
+ .. option:: backing_fmt
1120
+
1121
+ Image format of the base image
1122
+
1123
+ .. option:: encryption
1124
+
1125
+ This option is deprecated and equivalent to ``encrypt.format=aes``
1126
+
1127
+ .. option:: encrypt.format
1128
+
1129
+ If this is set to ``luks``, it requests that the qcow2 payload (not
1130
+ qcow2 header) be encrypted using the LUKS format. The passphrase to
1131
+ use to unlock the LUKS key slot is given by the ``encrypt.key-secret``
1132
+ parameter. LUKS encryption parameters can be tuned with the other
1133
+ ``encrypt.*`` parameters.
1134
+
1135
+ If this is set to ``aes``, the image is encrypted with 128-bit AES-CBC.
1136
+ The encryption key is given by the ``encrypt.key-secret`` parameter.
1137
+ This encryption format is considered to be flawed by modern cryptography
1138
+ standards, suffering from a number of design problems:
1139
+
1140
+ - The AES-CBC cipher is used with predictable initialization vectors based
1141
+ on the sector number. This makes it vulnerable to chosen plaintext attacks
1142
+ which can reveal the existence of encrypted data.
1143
+ - The user passphrase is directly used as the encryption key. A poorly
1144
+ chosen or short passphrase will compromise the security of the encryption.
1145
+ - In the event of the passphrase being compromised there is no way to
1146
+ change the passphrase to protect data in any qcow images. The files must
1147
+ be cloned, using a different encryption passphrase in the new file. The
1148
+ original file must then be securely erased using a program like shred,
1149
+ though even this is ineffective with many modern storage technologies.
1150
+
1151
+ The use of this is no longer supported in system emulators. Support only
1152
+ remains in the command line utilities, for the purposes of data liberation
1153
+ and interoperability with old versions of QEMU. The ``luks`` format
1154
+ should be used instead.
1155
+
1156
+ .. option:: encrypt.key-secret
1157
+
1158
+ Provides the ID of a ``secret`` object that contains the passphrase
1159
+ (``encrypt.format=luks``) or encryption key (``encrypt.format=aes``).
1160
+
1161
+ .. option:: encrypt.cipher-alg
1162
+
1163
+ Name of the cipher algorithm and key length. Currently defaults
1164
+ to ``aes-256``. Only used when ``encrypt.format=luks``.
1165
+
1166
+ .. option:: encrypt.cipher-mode
1167
+
1168
+ Name of the encryption mode to use. Currently defaults to ``xts``.
1169
+ Only used when ``encrypt.format=luks``.
1170
+
1171
+ .. option:: encrypt.ivgen-alg
1172
+
1173
+ Name of the initialization vector generator algorithm. Currently defaults
1174
+ to ``plain64``. Only used when ``encrypt.format=luks``.
1175
+
1176
+ .. option:: encrypt.ivgen-hash-alg
1177
+
1178
+ Name of the hash algorithm to use with the initialization vector generator
1179
+ (if required). Defaults to ``sha256``. Only used when ``encrypt.format=luks``.
1180
+
1181
+ .. option:: encrypt.hash-alg
1182
+
1183
+ Name of the hash algorithm to use for PBKDF algorithm
1184
+ Defaults to ``sha256``. Only used when ``encrypt.format=luks``.
1185
+
1186
+ .. option:: encrypt.iter-time
1187
+
1188
+ Amount of time, in milliseconds, to use for PBKDF algorithm per key slot.
1189
+ Defaults to ``2000``. Only used when ``encrypt.format=luks``.
1190
+
1191
+ .. option:: cluster_size
1192
+
1193
+ Changes the qcow2 cluster size (must be between 512 and 2M). Smaller cluster
1194
+ sizes can improve the image file size whereas larger cluster sizes generally
1195
+ provide better performance.
1196
+
1197
+ .. option:: preallocation
1198
+
1199
+ Preallocation mode (allowed values: ``off``, ``metadata``, ``falloc``,
1200
+ ``full``). An image with preallocated metadata is initially larger but can
1201
+ improve performance when the image needs to grow. ``falloc`` and ``full``
1202
+ preallocations are like the same options of ``raw`` format, but sets up
1203
+ metadata also.
1204
+
1205
+ .. option:: lazy_refcounts
1206
+
1207
+ If this option is set to ``on``, reference count updates are postponed with
1208
+ the goal of avoiding metadata I/O and improving performance. This is
1209
+ particularly interesting with :option:`cache=writethrough` which doesn't batch
1210
+ metadata updates. The tradeoff is that after a host crash, the reference count
1211
+ tables must be rebuilt, i.e. on the next open an (automatic) ``qemu-img
1212
+ check -r all`` is required, which may take some time.
1213
+
1214
+ This option can only be enabled if ``compat=1.1`` is specified.
1215
+
1216
+ .. option:: nocow
1217
+
1218
+ If this option is set to ``on``, it will turn off COW of the file. It's only
1219
+ valid on btrfs, no effect on other file systems.
1220
+
1221
+ Btrfs has low performance when hosting a VM image file, even more
1222
+ when the guest on the VM also using btrfs as file system. Turning off
1223
+ COW is a way to mitigate this bad performance. Generally there are two
1224
+ ways to turn off COW on btrfs:
1225
+
1226
+ - Disable it by mounting with nodatacow, then all newly created files
1227
+ will be NOCOW.
1228
+ - For an empty file, add the NOCOW file attribute. That's what this
1229
+ option does.
1230
+
1231
+ Note: this option is only valid to new or empty files. If there is
1232
+ an existing file which is COW and has data blocks already, it couldn't
1233
+ be changed to NOCOW by setting ``nocow=on``. One can issue ``lsattr
1234
+ filename`` to check if the NOCOW flag is set or not (Capital 'C' is
1235
+ NOCOW flag).
1236
+
1237
+.. program:: image-formats
1238
+.. option:: qed
1239
+
1240
+ Old QEMU image format with support for backing files and compact image files
1241
+ (when your filesystem or transport medium does not support holes).
1242
+
1243
+ When converting QED images to qcow2, you might want to consider using the
1244
+ ``lazy_refcounts=on`` option to get a more QED-like behaviour.
1245
+
1246
+ Supported options:
1247
+
1248
+ .. program:: qed
1249
+ .. option:: backing_file
1250
+
1251
+ File name of a base image (see ``create`` subcommand).
1252
+
1253
+ .. option:: backing_fmt
1254
+
1255
+ Image file format of backing file (optional). Useful if the format cannot be
1256
+ autodetected because it has no header, like some vhd/vpc files.
1257
+
1258
+ .. option:: cluster_size
1259
+
1260
+ Changes the cluster size (must be power-of-2 between 4K and 64K). Smaller
1261
+ cluster sizes can improve the image file size whereas larger cluster sizes
1262
+ generally provide better performance.
1263
+
1264
+ .. option:: table_size
1265
+
1266
+ Changes the number of clusters per L1/L2 table (must be
1267
+ power-of-2 between 1 and 16). There is normally no need to
1268
+ change this value but this option can between used for
1269
+ performance benchmarking.
1270
+
1271
+.. program:: image-formats
1272
+.. option:: qcow
1273
+
1274
+ Old QEMU image format with support for backing files, compact image files,
1275
+ encryption and compression.
1276
+
1277
+ Supported options:
1278
+
1279
+ .. program:: qcow
1280
+ .. option:: backing_file
1281
+
1282
+ File name of a base image (see ``create`` subcommand)
1283
+
1284
+ .. option:: encryption
1285
+
1286
+ This option is deprecated and equivalent to ``encrypt.format=aes``
1287
+
1288
+ .. option:: encrypt.format
1289
+
1290
+ If this is set to ``aes``, the image is encrypted with 128-bit AES-CBC.
1291
+ The encryption key is given by the ``encrypt.key-secret`` parameter.
1292
+ This encryption format is considered to be flawed by modern cryptography
1293
+ standards, suffering from a number of design problems enumerated previously
1294
+ against the ``qcow2`` image format.
1295
+
1296
+ The use of this is no longer supported in system emulators. Support only
1297
+ remains in the command line utilities, for the purposes of data liberation
1298
+ and interoperability with old versions of QEMU.
1299
+
1300
+ Users requiring native encryption should use the ``qcow2`` format
1301
+ instead with ``encrypt.format=luks``.
1302
+
1303
+ .. option:: encrypt.key-secret
1304
+
1305
+ Provides the ID of a ``secret`` object that contains the encryption
1306
+ key (``encrypt.format=aes``).
1307
+
1308
+.. program:: image-formats
1309
+.. option:: luks
1310
+
1311
+ LUKS v1 encryption format, compatible with Linux dm-crypt/cryptsetup
1312
+
1313
+ Supported options:
1314
+
1315
+ .. program:: luks
1316
+ .. option:: key-secret
1317
+
1318
+ Provides the ID of a ``secret`` object that contains the passphrase.
1319
+
1320
+ .. option:: cipher-alg
1321
+
1322
+ Name of the cipher algorithm and key length. Currently defaults
1323
+ to ``aes-256``.
1324
+
1325
+ .. option:: cipher-mode
1326
+
1327
+ Name of the encryption mode to use. Currently defaults to ``xts``.
1328
+
1329
+ .. option:: ivgen-alg
1330
+
1331
+ Name of the initialization vector generator algorithm. Currently defaults
1332
+ to ``plain64``.
1333
+
1334
+ .. option:: ivgen-hash-alg
1335
+
1336
+ Name of the hash algorithm to use with the initialization vector generator
1337
+ (if required). Defaults to ``sha256``.
1338
+
1339
+ .. option:: hash-alg
1340
+
1341
+ Name of the hash algorithm to use for PBKDF algorithm
1342
+ Defaults to ``sha256``.
1343
+
1344
+ .. option:: iter-time
1345
+
1346
+ Amount of time, in milliseconds, to use for PBKDF algorithm per key slot.
1347
+ Defaults to ``2000``.
1348
+
1349
+.. program:: image-formats
1350
+.. option:: vdi
1351
+
1352
+ VirtualBox 1.1 compatible image format.
1353
+
1354
+ Supported options:
1355
+
1356
+ .. program:: vdi
1357
+ .. option:: static
1358
+
1359
+ If this option is set to ``on``, the image is created with metadata
1360
+ preallocation.
1361
+
1362
+.. program:: image-formats
1363
+.. option:: vmdk
1364
+
1365
+ VMware 3 and 4 compatible image format.
1366
+
1367
+ Supported options:
1368
+
1369
+ .. program: vmdk
1370
+ .. option:: backing_file
1371
+
1372
+ File name of a base image (see ``create`` subcommand).
1373
+
1374
+ .. option:: compat6
1375
+
1376
+ Create a VMDK version 6 image (instead of version 4)
1377
+
1378
+ .. option:: hwversion
1379
+
1380
+ Specify vmdk virtual hardware version. Compat6 flag cannot be enabled
1381
+ if hwversion is specified.
1382
+
1383
+ .. option:: subformat
1384
+
1385
+ Specifies which VMDK subformat to use. Valid options are
1386
+ ``monolithicSparse`` (default),
1387
+ ``monolithicFlat``,
1388
+ ``twoGbMaxExtentSparse``,
1389
+ ``twoGbMaxExtentFlat`` and
1390
+ ``streamOptimized``.
1391
+
1392
+.. program:: image-formats
1393
+.. option:: vpc
1394
+
1395
+ VirtualPC compatible image format (VHD).
1396
+
1397
+ Supported options:
1398
+
1399
+ .. program:: vpc
1400
+ .. option:: subformat
1401
+
1402
+ Specifies which VHD subformat to use. Valid options are
1403
+ ``dynamic`` (default) and ``fixed``.
1404
+
1405
+.. program:: image-formats
1406
+.. option:: VHDX
1407
+
1408
+ Hyper-V compatible image format (VHDX).
1409
+
1410
+ Supported options:
1411
+
1412
+ .. program:: VHDX
1413
+ .. option:: subformat
1414
+
1415
+ Specifies which VHDX subformat to use. Valid options are
1416
+ ``dynamic`` (default) and ``fixed``.
1417
+
1418
+ .. option:: block_state_zero
1419
+
1420
+ Force use of payload blocks of type 'ZERO'. Can be set to ``on`` (default)
1421
+ or ``off``. When set to ``off``, new blocks will be created as
1422
+ ``PAYLOAD_BLOCK_NOT_PRESENT``, which means parsers are free to return
1423
+ arbitrary data for those blocks. Do not set to ``off`` when using
1424
+ ``qemu-img convert`` with ``subformat=dynamic``.
1425
+
1426
+ .. option:: block_size
1427
+
1428
+ Block size; min 1 MB, max 256 MB. 0 means auto-calculate based on
1429
+ image size.
1430
+
1431
+ .. option:: log_size
1432
+
1433
+ Log size; min 1 MB.
1434
+
1435
+Read-only formats
1436
+-----------------
1437
+
1438
+More disk image file formats are supported in a read-only mode.
1439
+
1440
+.. program:: image-formats
1441
+.. option:: bochs
1442
+
1443
+ Bochs images of ``growing`` type.
1444
+
1445
+.. program:: image-formats
1446
+.. option:: cloop
1447
+
1448
+ Linux Compressed Loop image, useful only to reuse directly compressed
1449
+ CD-ROM images present for example in the Knoppix CD-ROMs.
1450
+
1451
+.. program:: image-formats
1452
+.. option:: dmg
1453
+
1454
+ Apple disk image.
1455
+
1456
+.. program:: image-formats
1457
+.. option:: parallels
1458
+
1459
+ Parallels disk image format.
1460
+
1461
+Using host drives
1462
+-----------------
1463
+
1464
+In addition to disk image files, QEMU can directly access host
1465
+devices. We describe here the usage for QEMU version >= 0.8.3.
1466
+
1467
+Linux
1468
+'''''
1469
+
1470
+On Linux, you can directly use the host device filename instead of a
1471
+disk image filename provided you have enough privileges to access
1472
+it. For example, use ``/dev/cdrom`` to access to the CDROM.
1473
+
1474
+CD
1475
+ You can specify a CDROM device even if no CDROM is loaded. QEMU has
1476
+ specific code to detect CDROM insertion or removal. CDROM ejection by
1477
+ the guest OS is supported. Currently only data CDs are supported.
1478
+
1479
+Floppy
1480
+ You can specify a floppy device even if no floppy is loaded. Floppy
1481
+ removal is currently not detected accurately (if you change floppy
1482
+ without doing floppy access while the floppy is not loaded, the guest
1483
+ OS will think that the same floppy is loaded).
1484
+ Use of the host's floppy device is deprecated, and support for it will
1485
+ be removed in a future release.
1486
+
1487
+Hard disks
1488
+ Hard disks can be used. Normally you must specify the whole disk
1489
+ (``/dev/hdb`` instead of ``/dev/hdb1``) so that the guest OS can
1490
+ see it as a partitioned disk. WARNING: unless you know what you do, it
1491
+ is better to only make READ-ONLY accesses to the hard disk otherwise
1492
+ you may corrupt your host data (use the ``-snapshot`` command
1493
+ line option or modify the device permissions accordingly).
1494
+
1495
+Windows
1496
+'''''''
1497
+
1498
+CD
1499
+ The preferred syntax is the drive letter (e.g. ``d:``). The
1500
+ alternate syntax ``\\.\d:`` is supported. ``/dev/cdrom`` is
1501
+ supported as an alias to the first CDROM drive.
1502
+
1503
+ Currently there is no specific code to handle removable media, so it
1504
+ is better to use the ``change`` or ``eject`` monitor commands to
1505
+ change or eject media.
1506
+
1507
+Hard disks
1508
+ Hard disks can be used with the syntax: ``\\.\PhysicalDriveN``
1509
+ where *N* is the drive number (0 is the first hard disk).
1510
+
1511
+ WARNING: unless you know what you do, it is better to only make
1512
+ READ-ONLY accesses to the hard disk otherwise you may corrupt your
1513
+ host data (use the ``-snapshot`` command line so that the
1514
+ modifications are written in a temporary file).
1515
+
1516
+Mac OS X
1517
+''''''''
1518
+
1519
+``/dev/cdrom`` is an alias to the first CDROM.
1520
+
1521
+Currently there is no specific code to handle removable media, so it
1522
+is better to use the ``change`` or ``eject`` monitor commands to
1523
+change or eject media.
1524
+
1525
+Virtual FAT disk images
1526
+-----------------------
1527
+
1528
+QEMU can automatically create a virtual FAT disk image from a
1529
+directory tree. In order to use it, just type:
1530
+
1531
+.. parsed-literal::
1532
+
1533
+ |qemu_system| linux.img -hdb fat:/my_directory
1534
+
1535
+Then you access access to all the files in the ``/my_directory``
1536
+directory without having to copy them in a disk image or to export
1537
+them via SAMBA or NFS. The default access is *read-only*.
1538
+
1539
+Floppies can be emulated with the ``:floppy:`` option:
1540
+
1541
+.. parsed-literal::
1542
+
1543
+ |qemu_system| linux.img -fda fat:floppy:/my_directory
1544
+
1545
+A read/write support is available for testing (beta stage) with the
1546
+``:rw:`` option:
1547
+
1548
+.. parsed-literal::
1549
+
1550
+ |qemu_system| linux.img -fda fat:floppy:rw:/my_directory
1551
+
1552
+What you should *never* do:
1553
+
1554
+- use non-ASCII filenames
1555
+- use "-snapshot" together with ":rw:"
1556
+- expect it to work when loadvm'ing
1557
+- write to the FAT directory on the host system while accessing it with the guest system
1558
+
1559
+NBD access
1560
+----------
1561
+
1562
+QEMU can access directly to block device exported using the Network Block Device
1563
+protocol.
1564
+
1565
+.. parsed-literal::
1566
+
1567
+ |qemu_system| linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/
1568
+
1569
+If the NBD server is located on the same host, you can use an unix socket instead
1570
+of an inet socket:
1571
+
1572
+.. parsed-literal::
1573
+
1574
+ |qemu_system| linux.img -hdb nbd+unix://?socket=/tmp/my_socket
1575
+
1576
+In this case, the block device must be exported using qemu-nbd:
1577
+
1578
+.. parsed-literal::
1579
+
1580
+ qemu-nbd --socket=/tmp/my_socket my_disk.qcow2
1581
+
1582
+The use of qemu-nbd allows sharing of a disk between several guests:
1583
+
1584
+.. parsed-literal::
1585
+
1586
+ qemu-nbd --socket=/tmp/my_socket --share=2 my_disk.qcow2
1587
+
1588
+and then you can use it with two guests:
1589
+
1590
+.. parsed-literal::
1591
+
1592
+ |qemu_system| linux1.img -hdb nbd+unix://?socket=/tmp/my_socket
1593
+ |qemu_system| linux2.img -hdb nbd+unix://?socket=/tmp/my_socket
1594
+
1595
+If the nbd-server uses named exports (supported since NBD 2.9.18, or with QEMU's
1596
+own embedded NBD server), you must specify an export name in the URI:
1597
+
1598
+.. parsed-literal::
1599
+
1600
+ |qemu_system| -cdrom nbd://localhost/debian-500-ppc-netinst
1601
+ |qemu_system| -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst
1602
+
1603
+The URI syntax for NBD is supported since QEMU 1.3. An alternative syntax is
1604
+also available. Here are some example of the older syntax:
1605
+
1606
+.. parsed-literal::
1607
+
1608
+ |qemu_system| linux.img -hdb nbd:my_nbd_server.mydomain.org:1024
1609
+ |qemu_system| linux2.img -hdb nbd:unix:/tmp/my_socket
1610
+ |qemu_system| -cdrom nbd:localhost:10809:exportname=debian-500-ppc-netinst
1611
+
1612
+
1613
+
1614
+Sheepdog disk images
1615
+--------------------
1616
+
1617
+Sheepdog is a distributed storage system for QEMU. It provides highly
1618
+available block level storage volumes that can be attached to
1619
+QEMU-based virtual machines.
1620
+
1621
+You can create a Sheepdog disk image with the command:
1622
+
1623
+.. parsed-literal::
1624
+
1625
+ qemu-img create sheepdog:///IMAGE SIZE
1626
+
1627
+where *IMAGE* is the Sheepdog image name and *SIZE* is its
1628
+size.
1629
+
1630
+To import the existing *FILENAME* to Sheepdog, you can use a
1631
+convert command.
1632
+
1633
+.. parsed-literal::
1634
+
1635
+ qemu-img convert FILENAME sheepdog:///IMAGE
1636
+
1637
+You can boot from the Sheepdog disk image with the command:
1638
+
1639
+.. parsed-literal::
1640
+
1641
+ |qemu_system| sheepdog:///IMAGE
1642
+
1643
+You can also create a snapshot of the Sheepdog image like qcow2.
1644
+
1645
+.. parsed-literal::
1646
+
1647
+ qemu-img snapshot -c TAG sheepdog:///IMAGE
1648
+
1649
+where *TAG* is a tag name of the newly created snapshot.
1650
+
1651
+To boot from the Sheepdog snapshot, specify the tag name of the
1652
+snapshot.
1653
+
1654
+.. parsed-literal::
1655
+
1656
+ |qemu_system| sheepdog:///IMAGE#TAG
1657
+
1658
+You can create a cloned image from the existing snapshot.
1659
+
1660
+.. parsed-literal::
1661
+
1662
+ qemu-img create -b sheepdog:///BASE#TAG sheepdog:///IMAGE
1663
+
1664
+where *BASE* is an image name of the source snapshot and *TAG*
1665
+is its tag name.
1666
+
1667
+You can use an unix socket instead of an inet socket:
1668
+
1669
+.. parsed-literal::
1670
+
1671
+ |qemu_system| sheepdog+unix:///IMAGE?socket=PATH
1672
+
1673
+If the Sheepdog daemon doesn't run on the local host, you need to
1674
+specify one of the Sheepdog servers to connect to.
1675
+
1676
+.. parsed-literal::
1677
+
1678
+ qemu-img create sheepdog://HOSTNAME:PORT/IMAGE SIZE
1679
+ |qemu_system| sheepdog://HOSTNAME:PORT/IMAGE
1680
+
1681
+iSCSI LUNs
1682
+----------
1683
+
1684
+iSCSI is a popular protocol used to access SCSI devices across a computer
1685
+network.
1686
+
1687
+There are two different ways iSCSI devices can be used by QEMU.
1688
+
1689
+The first method is to mount the iSCSI LUN on the host, and make it appear as
1690
+any other ordinary SCSI device on the host and then to access this device as a
1691
+/dev/sd device from QEMU. How to do this differs between host OSes.
1692
+
1693
+The second method involves using the iSCSI initiator that is built into
1694
+QEMU. This provides a mechanism that works the same way regardless of which
1695
+host OS you are running QEMU on. This section will describe this second method
1696
+of using iSCSI together with QEMU.
1697
+
1698
+In QEMU, iSCSI devices are described using special iSCSI URLs. URL syntax:
1699
+
1700
+::
1701
+
1702
+ iscsi://[<username>[%<password>]@]<host>[:<port>]/<target-iqn-name>/<lun>
1703
+
1704
+Username and password are optional and only used if your target is set up
1705
+using CHAP authentication for access control.
1706
+Alternatively the username and password can also be set via environment
1707
+variables to have these not show up in the process list:
1708
+
1709
+::
1710
+
1711
+ export LIBISCSI_CHAP_USERNAME=<username>
1712
+ export LIBISCSI_CHAP_PASSWORD=<password>
1713
+ iscsi://<host>/<target-iqn-name>/<lun>
1714
+
1715
+Various session related parameters can be set via special options, either
1716
+in a configuration file provided via '-readconfig' or directly on the
1717
+command line.
1718
+
1719
+If the initiator-name is not specified qemu will use a default name
1720
+of 'iqn.2008-11.org.linux-kvm[:<uuid>'] where <uuid> is the UUID of the
1721
+virtual machine. If the UUID is not specified qemu will use
1722
+'iqn.2008-11.org.linux-kvm[:<name>'] where <name> is the name of the
1723
+virtual machine.
1724
+
1725
+Setting a specific initiator name to use when logging in to the target:
1726
+
1727
+::
1728
+
1729
+ -iscsi initiator-name=iqn.qemu.test:my-initiator
1730
+
1731
+Controlling which type of header digest to negotiate with the target:
1732
+
1733
+::
1734
+
1735
+ -iscsi header-digest=CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
1736
+
1737
+These can also be set via a configuration file:
1738
+
1739
+::
1740
+
1741
+ [iscsi]
1742
+ user = "CHAP username"
1743
+ password = "CHAP password"
1744
+ initiator-name = "iqn.qemu.test:my-initiator"
1745
+ # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
1746
+ header-digest = "CRC32C"
1747
+
1748
+Setting the target name allows different options for different targets:
1749
+
1750
+::
1751
+
1752
+ [iscsi "iqn.target.name"]
1753
+ user = "CHAP username"
1754
+ password = "CHAP password"
1755
+ initiator-name = "iqn.qemu.test:my-initiator"
1756
+ # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
1757
+ header-digest = "CRC32C"
1758
+
1759
+How to use a configuration file to set iSCSI configuration options:
1760
+
1761
+.. parsed-literal::
1762
+
1763
+ cat >iscsi.conf <<EOF
1764
+ [iscsi]
1765
+ user = "me"
1766
+ password = "my password"
1767
+ initiator-name = "iqn.qemu.test:my-initiator"
1768
+ header-digest = "CRC32C"
1769
+ EOF
1770
+
1771
+ |qemu_system| -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \\
1772
+ -readconfig iscsi.conf
1773
+
1774
+How to set up a simple iSCSI target on loopback and access it via QEMU:
1775
+this example shows how to set up an iSCSI target with one CDROM and one DISK
1776
+using the Linux STGT software target. This target is available on Red Hat based
1777
+systems as the package 'scsi-target-utils'.
1778
+
1779
+.. parsed-literal::
1780
+
1781
+ tgtd --iscsi portal=127.0.0.1:3260
1782
+ tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.qemu.test
1783
+ tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \\
1784
+ -b /IMAGES/disk.img --device-type=disk
1785
+ tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \\
1786
+ -b /IMAGES/cd.iso --device-type=cd
1787
+ tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
1788
+
1789
+ |qemu_system| -iscsi initiator-name=iqn.qemu.test:my-initiator \\
1790
+ -boot d -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \\
1791
+ -cdrom iscsi://127.0.0.1/iqn.qemu.test/2
1792
+
1793
+GlusterFS disk images
1794
+---------------------
1795
+
1796
+GlusterFS is a user space distributed file system.
1797
+
1798
+You can boot from the GlusterFS disk image with the command:
1799
+
1800
+URI:
1801
+
1802
+.. parsed-literal::
1803
+
1804
+ |qemu_system| -drive file=gluster[+TYPE]://[HOST}[:PORT]]/VOLUME/PATH
1805
+ [?socket=...][,file.debug=9][,file.logfile=...]
1806
+
1807
+JSON:
1808
+
1809
+.. parsed-literal::
1810
+
1811
+ |qemu_system| 'json:{"driver":"qcow2",
1812
+ "file":{"driver":"gluster",
1813
+ "volume":"testvol","path":"a.img","debug":9,"logfile":"...",
1814
+ "server":[{"type":"tcp","host":"...","port":"..."},
1815
+ {"type":"unix","socket":"..."}]}}'
1816
+
1817
+*gluster* is the protocol.
1818
+
1819
+*TYPE* specifies the transport type used to connect to gluster
1820
+management daemon (glusterd). Valid transport types are
1821
+tcp and unix. In the URI form, if a transport type isn't specified,
1822
+then tcp type is assumed.
1823
+
1824
+*HOST* specifies the server where the volume file specification for
1825
+the given volume resides. This can be either a hostname or an ipv4 address.
1826
+If transport type is unix, then *HOST* field should not be specified.
1827
+Instead *socket* field needs to be populated with the path to unix domain
1828
+socket.
1829
+
1830
+*PORT* is the port number on which glusterd is listening. This is optional
1831
+and if not specified, it defaults to port 24007. If the transport type is unix,
1832
+then *PORT* should not be specified.
1833
+
1834
+*VOLUME* is the name of the gluster volume which contains the disk image.
1835
+
1836
+*PATH* is the path to the actual disk image that resides on gluster volume.
1837
+
1838
+*debug* is the logging level of the gluster protocol driver. Debug levels
1839
+are 0-9, with 9 being the most verbose, and 0 representing no debugging output.
1840
+The default level is 4. The current logging levels defined in the gluster source
1841
+are 0 - None, 1 - Emergency, 2 - Alert, 3 - Critical, 4 - Error, 5 - Warning,
1842
+6 - Notice, 7 - Info, 8 - Debug, 9 - Trace
1843
+
1844
+*logfile* is a commandline option to mention log file path which helps in
1845
+logging to the specified file and also help in persisting the gfapi logs. The
1846
+default is stderr.
1847
+
1848
+You can create a GlusterFS disk image with the command:
1849
+
1850
+.. parsed-literal::
1851
+
1852
+ qemu-img create gluster://HOST/VOLUME/PATH SIZE
1853
+
1854
+Examples
1855
+
1856
+.. parsed-literal::
1857
+
1858
+ |qemu_system| -drive file=gluster://1.2.3.4/testvol/a.img
1859
+ |qemu_system| -drive file=gluster+tcp://1.2.3.4/testvol/a.img
1860
+ |qemu_system| -drive file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img
1861
+ |qemu_system| -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img
1862
+ |qemu_system| -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img
1863
+ |qemu_system| -drive file=gluster+tcp://server.domain.com:24007/testvol/dir/a.img
1864
+ |qemu_system| -drive file=gluster+unix:///testvol/dir/a.img?socket=/tmp/glusterd.socket
1865
+ |qemu_system| -drive file=gluster+rdma://1.2.3.4:24007/testvol/a.img
1866
+ |qemu_system| -drive file=gluster://1.2.3.4/testvol/a.img,file.debug=9,file.logfile=/var/log/qemu-gluster.log
1867
+ |qemu_system| 'json:{"driver":"qcow2",
1868
+ "file":{"driver":"gluster",
1869
+ "volume":"testvol","path":"a.img",
1870
+ "debug":9,"logfile":"/var/log/qemu-gluster.log",
1871
+ "server":[{"type":"tcp","host":"1.2.3.4","port":24007},
1872
+ {"type":"unix","socket":"/var/run/glusterd.socket"}]}}'
1873
+ |qemu_system| -drive driver=qcow2,file.driver=gluster,file.volume=testvol,file.path=/path/a.img,
1874
+ file.debug=9,file.logfile=/var/log/qemu-gluster.log,
1875
+ file.server.0.type=tcp,file.server.0.host=1.2.3.4,file.server.0.port=24007,
1876
+ file.server.1.type=unix,file.server.1.socket=/var/run/glusterd.socket
1877
+
1878
+Secure Shell (ssh) disk images
1879
+------------------------------
1880
+
1881
+You can access disk images located on a remote ssh server
1882
+by using the ssh protocol:
1883
+
1884
+.. parsed-literal::
1885
+
1886
+ |qemu_system| -drive file=ssh://[USER@]SERVER[:PORT]/PATH[?host_key_check=HOST_KEY_CHECK]
1887
+
1888
+Alternative syntax using properties:
1889
+
1890
+.. parsed-literal::
1891
+
1892
+ |qemu_system| -drive file.driver=ssh[,file.user=USER],file.host=SERVER[,file.port=PORT],file.path=PATH[,file.host_key_check=HOST_KEY_CHECK]
1893
+
1894
+*ssh* is the protocol.
1895
+
1896
+*USER* is the remote user. If not specified, then the local
1897
+username is tried.
1898
+
1899
+*SERVER* specifies the remote ssh server. Any ssh server can be
1900
+used, but it must implement the sftp-server protocol. Most Unix/Linux
1901
+systems should work without requiring any extra configuration.
1902
+
1903
+*PORT* is the port number on which sshd is listening. By default
1904
+the standard ssh port (22) is used.
1905
+
1906
+*PATH* is the path to the disk image.
1907
+
1908
+The optional *HOST_KEY_CHECK* parameter controls how the remote
1909
+host's key is checked. The default is ``yes`` which means to use
1910
+the local ``.ssh/known_hosts`` file. Setting this to ``no``
1911
+turns off known-hosts checking. Or you can check that the host key
1912
+matches a specific fingerprint:
1913
+``host_key_check=md5:78:45:8e:14:57:4f:d5:45:83:0a:0e:f3:49:82:c9:c8``
1914
+(``sha1:`` can also be used as a prefix, but note that OpenSSH
1915
+tools only use MD5 to print fingerprints).
1916
+
1917
+Currently authentication must be done using ssh-agent. Other
1918
+authentication methods may be supported in future.
1919
+
1920
+Note: Many ssh servers do not support an ``fsync``-style operation.
1921
+The ssh driver cannot guarantee that disk flush requests are
1922
+obeyed, and this causes a risk of disk corruption if the remote
1923
+server or network goes down during writes. The driver will
1924
+print a warning when ``fsync`` is not supported:
1925
+
1926
+::
1927
+
1928
+ warning: ssh server ssh.example.com:22 does not support fsync
1929
+
1930
+With sufficiently new versions of libssh and OpenSSH, ``fsync`` is
1931
+supported.
1932
+
1933
+NVMe disk images
1934
+----------------
1935
+
1936
+NVM Express (NVMe) storage controllers can be accessed directly by a userspace
1937
+driver in QEMU. This bypasses the host kernel file system and block layers
1938
+while retaining QEMU block layer functionalities, such as block jobs, I/O
1939
+throttling, image formats, etc. Disk I/O performance is typically higher than
1940
+with ``-drive file=/dev/sda`` using either thread pool or linux-aio.
1941
+
1942
+The controller will be exclusively used by the QEMU process once started. To be
1943
+able to share storage between multiple VMs and other applications on the host,
1944
+please use the file based protocols.
1945
+
1946
+Before starting QEMU, bind the host NVMe controller to the host vfio-pci
1947
+driver. For example:
1948
+
1949
+.. parsed-literal::
1950
+
1951
+ # modprobe vfio-pci
1952
+ # lspci -n -s 0000:06:0d.0
1953
+ 06:0d.0 0401: 1102:0002 (rev 08)
1954
+ # echo 0000:06:0d.0 > /sys/bus/pci/devices/0000:06:0d.0/driver/unbind
1955
+ # echo 1102 0002 > /sys/bus/pci/drivers/vfio-pci/new_id
1956
+
1957
+ # |qemu_system| -drive file=nvme://HOST:BUS:SLOT.FUNC/NAMESPACE
1958
+
1959
+Alternative syntax using properties:
1960
+
1961
+.. parsed-literal::
1962
+
1963
+ |qemu_system| -drive file.driver=nvme,file.device=HOST:BUS:SLOT.FUNC,file.namespace=NAMESPACE
1964
+
1965
+*HOST*:*BUS*:*SLOT*.\ *FUNC* is the NVMe controller's PCI device
1966
+address on the host.
1967
+
1968
+*NAMESPACE* is the NVMe namespace number, starting from 1.
1969
+
1970
+Disk image file locking
1971
+-----------------------
1972
+
1973
+By default, QEMU tries to protect image files from unexpected concurrent
1974
+access, as long as it's supported by the block protocol driver and host
1975
+operating system. If multiple QEMU processes (including QEMU emulators and
1976
+utilities) try to open the same image with conflicting accessing modes, all but
1977
+the first one will get an error.
1978
+
1979
+This feature is currently supported by the file protocol on Linux with the Open
1980
+File Descriptor (OFD) locking API, and can be configured to fall back to POSIX
1981
+locking if the POSIX host doesn't support Linux OFD locking.
1982
+
1983
+To explicitly enable image locking, specify "locking=on" in the file protocol
1984
+driver options. If OFD locking is not possible, a warning will be printed and
1985
+the POSIX locking API will be used. In this case there is a risk that the lock
1986
+will get silently lost when doing hot plugging and block jobs, due to the
1987
+shortcomings of the POSIX locking API.
1988
+
1989
+QEMU transparently handles lock handover during shared storage migration. For
1990
+shared virtual disk images between multiple VMs, the "share-rw" device option
1991
+should be used.
1992
+
1993
+By default, the guest has exclusive write access to its disk image. If the
1994
+guest can safely share the disk image with other writers the
1995
+``-device ...,share-rw=on`` parameter can be used. This is only safe if
1996
+the guest is running software, such as a cluster file system, that
1997
+coordinates disk accesses to avoid corruption.
1998
+
1999
+Note that share-rw=on only declares the guest's ability to share the disk.
2000
+Some QEMU features, such as image file formats, require exclusive write access
2001
+to the disk image and this is unaffected by the share-rw=on option.
2002
+
2003
+Alternatively, locking can be fully disabled by "locking=off" block device
2004
+option. In the command line, the option is usually in the form of
2005
+"file.locking=off" as the protocol driver is normally placed as a "file" child
2006
+under a format driver. For example:
2007
+
2008
+::
2009
+
2010
+ -blockdev driver=qcow2,file.filename=/path/to/image,file.locking=off,file.driver=file
2011
+
2012
+To check if image locking is active, check the output of the "lslocks" command
2013
+on host and see if there are locks held by the QEMU process on the image file.
2014
+More than one byte could be locked by the QEMU instance, each byte of which
2015
+reflects a particular permission that is acquired or protected by the running
2016
+block driver.
2017
+
2018
+.. only:: man
2019
+
2020
+ See also
2021
+ --------
2022
+
2023
+ The HTML documentation of QEMU for more precise information and Linux
2024
+ user mode emulator invocation.
2025
diff --git a/qemu-doc.texi b/qemu-doc.texi
2026
index XXXXXXX..XXXXXXX 100644
2027
--- a/qemu-doc.texi
2028
+++ b/qemu-doc.texi
2029
@@ -XXX,XX +XXX,XX @@ encrypted disk images.
2030
* disk_images_snapshot_mode:: Snapshot mode
2031
* vm_snapshots:: VM snapshots
2032
* qemu_img_invocation:: qemu-img Invocation
2033
-* disk_images_formats:: Disk image file formats
2034
-* host_drives:: Using host drives
2035
-* disk_images_fat_images:: Virtual FAT disk images
2036
-* disk_images_nbd:: NBD access
2037
-* disk_images_sheepdog:: Sheepdog disk images
2038
-* disk_images_iscsi:: iSCSI LUNs
2039
-* disk_images_gluster:: GlusterFS disk images
2040
-* disk_images_ssh:: Secure Shell (ssh) disk images
2041
-* disk_images_nvme:: NVMe userspace driver
2042
-* disk_image_locking:: Disk image file locking
2043
@end menu
2044
2045
@node disk_images_quickstart
2046
@@ -XXX,XX +XXX,XX @@ state is not saved or restored properly (in particular USB).
2047
2048
@include qemu-img.texi
2049
2050
-@include docs/qemu-block-drivers.texi
2051
-
2052
@node pcsys_network
2053
@section Network emulation
2054
2055
diff --git a/qemu-options.hx b/qemu-options.hx
2056
index XXXXXXX..XXXXXXX 100644
2057
--- a/qemu-options.hx
2058
+++ b/qemu-options.hx
2059
@@ -XXX,XX +XXX,XX @@ STEXI
2060
@findex -cdrom
2061
Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and
2062
@option{-cdrom} at the same time). You can use the host CD-ROM by
2063
-using @file{/dev/cdrom} as filename (@pxref{host_drives}).
2064
+using @file{/dev/cdrom} as filename.
2065
ETEXI
2066
2067
DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev,
2068
--
42
--
2069
2.20.1
43
2.34.1
2070
44
2071
45
diff view generated by jsdifflib
1
We want a user-facing manual which contains system emulation
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
documentation. Create an empty one which we can populate.
3
2
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Message-id: 20230206223502.25122-8-philmd@linaro.org
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7
Message-id: 20200116141511.16849-3-peter.maydell@linaro.org
8
---
7
---
9
Makefile | 10 +++++++++-
8
target/arm/cpu.h | 3 ++-
10
docs/index.html.in | 1 +
9
1 file changed, 2 insertions(+), 1 deletion(-)
11
docs/system/conf.py | 15 +++++++++++++++
12
docs/system/index.rst | 16 ++++++++++++++++
13
4 files changed, 41 insertions(+), 1 deletion(-)
14
create mode 100644 docs/system/conf.py
15
create mode 100644 docs/system/index.rst
16
10
17
diff --git a/Makefile b/Makefile
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
19
--- a/Makefile
13
--- a/target/arm/cpu.h
20
+++ b/Makefile
14
+++ b/target/arm/cpu.h
21
@@ -XXX,XX +XXX,XX @@ distclean: clean
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
22
    $(call clean-manual,devel)
16
23
    $(call clean-manual,interop)
17
void *nvic;
24
    $(call clean-manual,specs)
18
const struct arm_boot_info *boot_info;
25
+    $(call clean-manual,system)
19
+#if !defined(CONFIG_USER_ONLY)
26
    for d in $(TARGET_DIRS); do \
20
/* Store GICv3CPUState to access from this struct */
27
    rm -rf $$d || exit 1 ; \
21
void *gicv3state;
28
done
22
-#if defined(CONFIG_USER_ONLY)
29
@@ -XXX,XX +XXX,XX @@ endef
23
+#else /* CONFIG_USER_ONLY */
30
install-sphinxdocs: sphinxdocs
24
/* For usermode syscall translation. */
31
    $(call install-manual,interop)
25
bool eabi;
32
    $(call install-manual,specs)
26
#endif /* CONFIG_USER_ONLY */
33
+    $(call install-manual,system)
34
35
install-doc: $(DOCS) install-sphinxdocs
36
    $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
37
@@ -XXX,XX +XXX,XX @@ docs/version.texi: $(SRC_PATH)/VERSION config-host.mak
38
# and handles "don't rebuild things unless necessary" itself.
39
# The '.doctrees' files are cached information to speed this up.
40
.PHONY: sphinxdocs
41
-sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MANUAL_BUILDDIR)/interop/index.html $(MANUAL_BUILDDIR)/specs/index.html
42
+sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \
43
+ $(MANUAL_BUILDDIR)/interop/index.html \
44
+ $(MANUAL_BUILDDIR)/specs/index.html \
45
+ $(MANUAL_BUILDDIR)/system/index.html
46
47
# Canned command to build a single manual
48
# Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
49
@@ -XXX,XX +XXX,XX @@ $(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop)
50
$(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
51
    $(call build-manual,specs,html)
52
53
+$(MANUAL_BUILDDIR)/system/index.html: $(call manual-deps,system)
54
+    $(call build-manual,system,html)
55
+
56
$(MANUAL_BUILDDIR)/interop/qemu-ga.8: $(call manual-deps,interop)
57
    $(call build-manual,interop,man)
58
59
diff --git a/docs/index.html.in b/docs/index.html.in
60
index XXXXXXX..XXXXXXX 100644
61
--- a/docs/index.html.in
62
+++ b/docs/index.html.in
63
@@ -XXX,XX +XXX,XX @@
64
<li><a href="qemu-ga-ref.html">Guest Agent Protocol Reference</a></li>
65
<li><a href="interop/index.html">System Emulation Management and Interoperability Guide</a></li>
66
<li><a href="specs/index.html">System Emulation Guest Hardware Specifications</a></li>
67
+ <li><a href="system/index.html">System Emulation User's Guide</a></li>
68
</ul>
69
</body>
70
</html>
71
diff --git a/docs/system/conf.py b/docs/system/conf.py
72
new file mode 100644
73
index XXXXXXX..XXXXXXX
74
--- /dev/null
75
+++ b/docs/system/conf.py
76
@@ -XXX,XX +XXX,XX @@
77
+# -*- coding: utf-8 -*-
78
+#
79
+# QEMU documentation build configuration file for the 'system' manual.
80
+#
81
+# This includes the top level conf file and then makes any necessary tweaks.
82
+import sys
83
+import os
84
+
85
+qemu_docdir = os.path.abspath("..")
86
+parent_config = os.path.join(qemu_docdir, "conf.py")
87
+exec(compile(open(parent_config, "rb").read(), parent_config, 'exec'))
88
+
89
+# This slightly misuses the 'description', but is the best way to get
90
+# the manual title to appear in the sidebar.
91
+html_theme_options['description'] = u'System Emulation User''s Guide'
92
diff --git a/docs/system/index.rst b/docs/system/index.rst
93
new file mode 100644
94
index XXXXXXX..XXXXXXX
95
--- /dev/null
96
+++ b/docs/system/index.rst
97
@@ -XXX,XX +XXX,XX @@
98
+.. This is the top level page for the 'system' manual.
99
+
100
+
101
+QEMU System Emulation User's Guide
102
+==================================
103
+
104
+This manual is the overall guide for users using QEMU
105
+for full system emulation (as opposed to user-mode emulation).
106
+This includes working with hypervisors such as KVM, Xen, Hax
107
+or Hypervisor.Framework.
108
+
109
+Contents:
110
+
111
+.. toctree::
112
+ :maxdepth: 2
113
+
114
--
27
--
115
2.20.1
28
2.34.1
116
29
117
30
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Exynos DMA requires up to 33 interrupt lines (32 event interrupts
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
plus abort interrupt), which all need to be wired together. Increase
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
the maximum number of or-irq lines to 48 to support this configuration.
5
Message-id: 20230206223502.25122-9-philmd@linaro.org
6
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8
Message-id: 20200123052540.6132-3-linux@roeck-us.net
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
---
7
---
12
include/hw/or-irq.h | 2 +-
8
target/arm/cpu.h | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
9
1 file changed, 1 insertion(+), 1 deletion(-)
14
10
15
diff --git a/include/hw/or-irq.h b/include/hw/or-irq.h
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
16
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/or-irq.h
13
--- a/target/arm/cpu.h
18
+++ b/include/hw/or-irq.h
14
+++ b/target/arm/cpu.h
19
@@ -XXX,XX +XXX,XX @@
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
20
/* This can safely be increased if necessary without breaking
16
} sau;
21
* migration compatibility (as long as it remains greater than 15).
17
22
*/
18
void *nvic;
23
-#define MAX_OR_LINES 32
19
- const struct arm_boot_info *boot_info;
24
+#define MAX_OR_LINES 48
20
#if !defined(CONFIG_USER_ONLY)
25
21
+ const struct arm_boot_info *boot_info;
26
typedef struct OrIRQState qemu_or_irq;
22
/* Store GICv3CPUState to access from this struct */
27
23
void *gicv3state;
24
#else /* CONFIG_USER_ONLY */
28
--
25
--
29
2.20.1
26
2.34.1
30
27
31
28
diff view generated by jsdifflib
1
From: Keqian Zhu <zhukeqian1@huawei.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
There is extra indent in ACPI GED hotplug cb that should be
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
deleted.
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
5
Message-id: 20230206223502.25122-10-philmd@linaro.org
6
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
7
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
8
Message-id: 20200120012755.44581-2-zhukeqian1@huawei.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
7
---
11
hw/acpi/generic_event_device.c | 2 +-
8
target/arm/cpu.h | 2 +-
12
1 file changed, 1 insertion(+), 1 deletion(-)
9
1 file changed, 1 insertion(+), 1 deletion(-)
13
10
14
diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/acpi/generic_event_device.c
13
--- a/target/arm/cpu.h
17
+++ b/hw/acpi/generic_event_device.c
14
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@ static void acpi_ged_device_plug_cb(HotplugHandler *hotplug_dev,
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
19
AcpiGedState *s = ACPI_GED(hotplug_dev);
16
uint32_t ctrl;
20
17
} sau;
21
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
18
22
- acpi_memory_plug_cb(hotplug_dev, &s->memhp_state, dev, errp);
19
- void *nvic;
23
+ acpi_memory_plug_cb(hotplug_dev, &s->memhp_state, dev, errp);
20
#if !defined(CONFIG_USER_ONLY)
24
} else {
21
+ void *nvic;
25
error_setg(errp, "virt: device plug request for unsupported device"
22
const struct arm_boot_info *boot_info;
26
" type: %s", object_get_typename(OBJECT(dev)));
23
/* Store GICv3CPUState to access from this struct */
24
void *gicv3state;
27
--
25
--
28
2.20.1
26
2.34.1
29
27
30
28
diff view generated by jsdifflib
New patch
1
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
3
There is no point in using a void pointer to access the NVIC.
4
Use the real type to avoid casting it while debugging.
5
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20230206223502.25122-11-philmd@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/cpu.h | 46 ++++++++++++++++++++++---------------------
12
hw/intc/armv7m_nvic.c | 38 ++++++++++++-----------------------
13
target/arm/cpu.c | 1 +
14
target/arm/m_helper.c | 2 +-
15
4 files changed, 39 insertions(+), 48 deletions(-)
16
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/cpu.h
20
+++ b/target/arm/cpu.h
21
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMTBFlags {
22
23
typedef struct ARMMMUFaultInfo ARMMMUFaultInfo;
24
25
+typedef struct NVICState NVICState;
26
+
27
typedef struct CPUArchState {
28
/* Regs for current mode. */
29
uint32_t regs[16];
30
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
31
} sau;
32
33
#if !defined(CONFIG_USER_ONLY)
34
- void *nvic;
35
+ NVICState *nvic;
36
const struct arm_boot_info *boot_info;
37
/* Store GICv3CPUState to access from this struct */
38
void *gicv3state;
39
@@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
40
41
/* Interface between CPU and Interrupt controller. */
42
#ifndef CONFIG_USER_ONLY
43
-bool armv7m_nvic_can_take_pending_exception(void *opaque);
44
+bool armv7m_nvic_can_take_pending_exception(NVICState *s);
45
#else
46
-static inline bool armv7m_nvic_can_take_pending_exception(void *opaque)
47
+static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s)
48
{
49
return true;
50
}
51
#endif
52
/**
53
* armv7m_nvic_set_pending: mark the specified exception as pending
54
- * @opaque: the NVIC
55
+ * @s: the NVIC
56
* @irq: the exception number to mark pending
57
* @secure: false for non-banked exceptions or for the nonsecure
58
* version of a banked exception, true for the secure version of a banked
59
@@ -XXX,XX +XXX,XX @@ static inline bool armv7m_nvic_can_take_pending_exception(void *opaque)
60
* if @secure is true and @irq does not specify one of the fixed set
61
* of architecturally banked exceptions.
62
*/
63
-void armv7m_nvic_set_pending(void *opaque, int irq, bool secure);
64
+void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure);
65
/**
66
* armv7m_nvic_set_pending_derived: mark this derived exception as pending
67
- * @opaque: the NVIC
68
+ * @s: the NVIC
69
* @irq: the exception number to mark pending
70
* @secure: false for non-banked exceptions or for the nonsecure
71
* version of a banked exception, true for the secure version of a banked
72
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending(void *opaque, int irq, bool secure);
73
* exceptions (exceptions generated in the course of trying to take
74
* a different exception).
75
*/
76
-void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure);
77
+void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure);
78
/**
79
* armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending
80
- * @opaque: the NVIC
81
+ * @s: the NVIC
82
* @irq: the exception number to mark pending
83
* @secure: false for non-banked exceptions or for the nonsecure
84
* version of a banked exception, true for the secure version of a banked
85
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure);
86
* Similar to armv7m_nvic_set_pending(), but specifically for exceptions
87
* generated in the course of lazy stacking of FP registers.
88
*/
89
-void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure);
90
+void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure);
91
/**
92
* armv7m_nvic_get_pending_irq_info: return highest priority pending
93
* exception, and whether it targets Secure state
94
- * @opaque: the NVIC
95
+ * @s: the NVIC
96
* @pirq: set to pending exception number
97
* @ptargets_secure: set to whether pending exception targets Secure
98
*
99
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure);
100
* to true if the current highest priority pending exception should
101
* be taken to Secure state, false for NS.
102
*/
103
-void armv7m_nvic_get_pending_irq_info(void *opaque, int *pirq,
104
+void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq,
105
bool *ptargets_secure);
106
/**
107
* armv7m_nvic_acknowledge_irq: make highest priority pending exception active
108
- * @opaque: the NVIC
109
+ * @s: the NVIC
110
*
111
* Move the current highest priority pending exception from the pending
112
* state to the active state, and update v7m.exception to indicate that
113
* it is the exception currently being handled.
114
*/
115
-void armv7m_nvic_acknowledge_irq(void *opaque);
116
+void armv7m_nvic_acknowledge_irq(NVICState *s);
117
/**
118
* armv7m_nvic_complete_irq: complete specified interrupt or exception
119
- * @opaque: the NVIC
120
+ * @s: the NVIC
121
* @irq: the exception number to complete
122
* @secure: true if this exception was secure
123
*
124
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque);
125
* 0 if there is still an irq active after this one was completed
126
* (Ignoring -1, this is the same as the RETTOBASE value before completion.)
127
*/
128
-int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure);
129
+int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure);
130
/**
131
* armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
132
- * @opaque: the NVIC
133
+ * @s: the NVIC
134
* @irq: the exception number to mark pending
135
* @secure: false for non-banked exceptions or for the nonsecure
136
* version of a banked exception, true for the secure version of a banked
137
@@ -XXX,XX +XXX,XX @@ int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure);
138
* interrupt the current execution priority. This controls whether the
139
* RDY bit for it in the FPCCR is set.
140
*/
141
-bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure);
142
+bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure);
143
/**
144
* armv7m_nvic_raw_execution_priority: return the raw execution priority
145
- * @opaque: the NVIC
146
+ * @s: the NVIC
147
*
148
* Returns: the raw execution priority as defined by the v8M architecture.
149
* This is the execution priority minus the effects of AIRCR.PRIS,
150
* and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting.
151
* (v8M ARM ARM I_PKLD.)
152
*/
153
-int armv7m_nvic_raw_execution_priority(void *opaque);
154
+int armv7m_nvic_raw_execution_priority(NVICState *s);
155
/**
156
* armv7m_nvic_neg_prio_requested: return true if the requested execution
157
* priority is negative for the specified security state.
158
- * @opaque: the NVIC
159
+ * @s: the NVIC
160
* @secure: the security state to test
161
* This corresponds to the pseudocode IsReqExecPriNeg().
162
*/
163
#ifndef CONFIG_USER_ONLY
164
-bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure);
165
+bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure);
166
#else
167
-static inline bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
168
+static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
169
{
170
return false;
171
}
172
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
173
index XXXXXXX..XXXXXXX 100644
174
--- a/hw/intc/armv7m_nvic.c
175
+++ b/hw/intc/armv7m_nvic.c
176
@@ -XXX,XX +XXX,XX @@ static inline int nvic_exec_prio(NVICState *s)
177
return MIN(running, s->exception_prio);
178
}
179
180
-bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
181
+bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
182
{
183
/* Return true if the requested execution priority is negative
184
* for the specified security state, ie that security state
185
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
186
* mean we don't allow FAULTMASK_NS to actually make the execution
187
* priority negative). Compare pseudocode IsReqExcPriNeg().
188
*/
189
- NVICState *s = opaque;
190
-
191
if (s->cpu->env.v7m.faultmask[secure]) {
192
return true;
193
}
194
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
195
return false;
196
}
197
198
-bool armv7m_nvic_can_take_pending_exception(void *opaque)
199
+bool armv7m_nvic_can_take_pending_exception(NVICState *s)
200
{
201
- NVICState *s = opaque;
202
-
203
return nvic_exec_prio(s) > nvic_pending_prio(s);
204
}
205
206
-int armv7m_nvic_raw_execution_priority(void *opaque)
207
+int armv7m_nvic_raw_execution_priority(NVICState *s)
208
{
209
- NVICState *s = opaque;
210
-
211
return s->exception_prio;
212
}
213
214
@@ -XXX,XX +XXX,XX @@ static void nvic_irq_update(NVICState *s)
215
* if @secure is true and @irq does not specify one of the fixed set
216
* of architecturally banked exceptions.
217
*/
218
-static void armv7m_nvic_clear_pending(void *opaque, int irq, bool secure)
219
+static void armv7m_nvic_clear_pending(NVICState *s, int irq, bool secure)
220
{
221
- NVICState *s = (NVICState *)opaque;
222
VecInfo *vec;
223
224
assert(irq > ARMV7M_EXCP_RESET && irq < s->num_irq);
225
@@ -XXX,XX +XXX,XX @@ static void do_armv7m_nvic_set_pending(void *opaque, int irq, bool secure,
226
}
227
}
228
229
-void armv7m_nvic_set_pending(void *opaque, int irq, bool secure)
230
+void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure)
231
{
232
- do_armv7m_nvic_set_pending(opaque, irq, secure, false);
233
+ do_armv7m_nvic_set_pending(s, irq, secure, false);
234
}
235
236
-void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure)
237
+void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure)
238
{
239
- do_armv7m_nvic_set_pending(opaque, irq, secure, true);
240
+ do_armv7m_nvic_set_pending(s, irq, secure, true);
241
}
242
243
-void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
244
+void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure)
245
{
246
/*
247
* Pend an exception during lazy FP stacking. This differs
248
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
249
* whether we should escalate depends on the saved context
250
* in the FPCCR register, not on the current state of the CPU/NVIC.
251
*/
252
- NVICState *s = (NVICState *)opaque;
253
bool banked = exc_is_banked(irq);
254
VecInfo *vec;
255
bool targets_secure;
256
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
257
}
258
259
/* Make pending IRQ active. */
260
-void armv7m_nvic_acknowledge_irq(void *opaque)
261
+void armv7m_nvic_acknowledge_irq(NVICState *s)
262
{
263
- NVICState *s = (NVICState *)opaque;
264
CPUARMState *env = &s->cpu->env;
265
const int pending = s->vectpending;
266
const int running = nvic_exec_prio(s);
267
@@ -XXX,XX +XXX,XX @@ static bool vectpending_targets_secure(NVICState *s)
268
exc_targets_secure(s, s->vectpending);
269
}
270
271
-void armv7m_nvic_get_pending_irq_info(void *opaque,
272
+void armv7m_nvic_get_pending_irq_info(NVICState *s,
273
int *pirq, bool *ptargets_secure)
274
{
275
- NVICState *s = (NVICState *)opaque;
276
const int pending = s->vectpending;
277
bool targets_secure;
278
279
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_get_pending_irq_info(void *opaque,
280
*pirq = pending;
281
}
282
283
-int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure)
284
+int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure)
285
{
286
- NVICState *s = (NVICState *)opaque;
287
VecInfo *vec = NULL;
288
int ret = 0;
289
290
@@ -XXX,XX +XXX,XX @@ int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure)
291
return ret;
292
}
293
294
-bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
295
+bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure)
296
{
297
/*
298
* Return whether an exception is "ready", i.e. it is enabled and is
299
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
300
* for non-banked exceptions secure is always false; for banked exceptions
301
* it indicates which of the exceptions is required.
302
*/
303
- NVICState *s = (NVICState *)opaque;
304
bool banked = exc_is_banked(irq);
305
VecInfo *vec;
306
int running = nvic_exec_prio(s);
307
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
308
index XXXXXXX..XXXXXXX 100644
309
--- a/target/arm/cpu.c
310
+++ b/target/arm/cpu.c
311
@@ -XXX,XX +XXX,XX @@
312
#if !defined(CONFIG_USER_ONLY)
313
#include "hw/loader.h"
314
#include "hw/boards.h"
315
+#include "hw/intc/armv7m_nvic.h"
316
#endif
317
#include "sysemu/tcg.h"
318
#include "sysemu/qtest.h"
319
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
320
index XXXXXXX..XXXXXXX 100644
321
--- a/target/arm/m_helper.c
322
+++ b/target/arm/m_helper.c
323
@@ -XXX,XX +XXX,XX @@ static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr,
324
* that we will need later in order to do lazy FP reg stacking.
325
*/
326
bool is_secure = env->v7m.secure;
327
- void *nvic = env->nvic;
328
+ NVICState *nvic = env->nvic;
329
/*
330
* Some bits are unbanked and live always in fpccr[M_REG_S]; some bits
331
* are banked and we want to update the bit in the bank for the
332
--
333
2.34.1
334
335
diff view generated by jsdifflib
1
From: Clement Deschamps <clement.deschamps@greensocs.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The PMU is not optional on cortex-r5 and cortex-r5f (see
3
While dozens of files include "cpu.h", only 3 files require
4
the "Features" chapter of the Technical Reference Manual).
4
these NVIC helper declarations.
5
5
6
Signed-off-by: Clement Deschamps <clement.deschamps@greensocs.com>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Message-id: 20200114105918.2366370-1-clement.deschamps@greensocs.com
8
Message-id: 20230206223502.25122-12-philmd@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
10
---
11
target/arm/cpu.c | 1 +
11
include/hw/intc/armv7m_nvic.h | 123 ++++++++++++++++++++++++++++++++++
12
1 file changed, 1 insertion(+)
12
target/arm/cpu.h | 123 ----------------------------------
13
13
target/arm/cpu.c | 4 +-
14
target/arm/cpu_tcg.c | 3 +
15
target/arm/m_helper.c | 3 +
16
5 files changed, 132 insertions(+), 124 deletions(-)
17
18
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/intc/armv7m_nvic.h
21
+++ b/include/hw/intc/armv7m_nvic.h
22
@@ -XXX,XX +XXX,XX @@ struct NVICState {
23
qemu_irq sysresetreq;
24
};
25
26
+/* Interface between CPU and Interrupt controller. */
27
+/**
28
+ * armv7m_nvic_set_pending: mark the specified exception as pending
29
+ * @s: the NVIC
30
+ * @irq: the exception number to mark pending
31
+ * @secure: false for non-banked exceptions or for the nonsecure
32
+ * version of a banked exception, true for the secure version of a banked
33
+ * exception.
34
+ *
35
+ * Marks the specified exception as pending. Note that we will assert()
36
+ * if @secure is true and @irq does not specify one of the fixed set
37
+ * of architecturally banked exceptions.
38
+ */
39
+void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure);
40
+/**
41
+ * armv7m_nvic_set_pending_derived: mark this derived exception as pending
42
+ * @s: the NVIC
43
+ * @irq: the exception number to mark pending
44
+ * @secure: false for non-banked exceptions or for the nonsecure
45
+ * version of a banked exception, true for the secure version of a banked
46
+ * exception.
47
+ *
48
+ * Similar to armv7m_nvic_set_pending(), but specifically for derived
49
+ * exceptions (exceptions generated in the course of trying to take
50
+ * a different exception).
51
+ */
52
+void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure);
53
+/**
54
+ * armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending
55
+ * @s: the NVIC
56
+ * @irq: the exception number to mark pending
57
+ * @secure: false for non-banked exceptions or for the nonsecure
58
+ * version of a banked exception, true for the secure version of a banked
59
+ * exception.
60
+ *
61
+ * Similar to armv7m_nvic_set_pending(), but specifically for exceptions
62
+ * generated in the course of lazy stacking of FP registers.
63
+ */
64
+void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure);
65
+/**
66
+ * armv7m_nvic_get_pending_irq_info: return highest priority pending
67
+ * exception, and whether it targets Secure state
68
+ * @s: the NVIC
69
+ * @pirq: set to pending exception number
70
+ * @ptargets_secure: set to whether pending exception targets Secure
71
+ *
72
+ * This function writes the number of the highest priority pending
73
+ * exception (the one which would be made active by
74
+ * armv7m_nvic_acknowledge_irq()) to @pirq, and sets @ptargets_secure
75
+ * to true if the current highest priority pending exception should
76
+ * be taken to Secure state, false for NS.
77
+ */
78
+void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq,
79
+ bool *ptargets_secure);
80
+/**
81
+ * armv7m_nvic_acknowledge_irq: make highest priority pending exception active
82
+ * @s: the NVIC
83
+ *
84
+ * Move the current highest priority pending exception from the pending
85
+ * state to the active state, and update v7m.exception to indicate that
86
+ * it is the exception currently being handled.
87
+ */
88
+void armv7m_nvic_acknowledge_irq(NVICState *s);
89
+/**
90
+ * armv7m_nvic_complete_irq: complete specified interrupt or exception
91
+ * @s: the NVIC
92
+ * @irq: the exception number to complete
93
+ * @secure: true if this exception was secure
94
+ *
95
+ * Returns: -1 if the irq was not active
96
+ * 1 if completing this irq brought us back to base (no active irqs)
97
+ * 0 if there is still an irq active after this one was completed
98
+ * (Ignoring -1, this is the same as the RETTOBASE value before completion.)
99
+ */
100
+int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure);
101
+/**
102
+ * armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
103
+ * @s: the NVIC
104
+ * @irq: the exception number to mark pending
105
+ * @secure: false for non-banked exceptions or for the nonsecure
106
+ * version of a banked exception, true for the secure version of a banked
107
+ * exception.
108
+ *
109
+ * Return whether an exception is "ready", i.e. whether the exception is
110
+ * enabled and is configured at a priority which would allow it to
111
+ * interrupt the current execution priority. This controls whether the
112
+ * RDY bit for it in the FPCCR is set.
113
+ */
114
+bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure);
115
+/**
116
+ * armv7m_nvic_raw_execution_priority: return the raw execution priority
117
+ * @s: the NVIC
118
+ *
119
+ * Returns: the raw execution priority as defined by the v8M architecture.
120
+ * This is the execution priority minus the effects of AIRCR.PRIS,
121
+ * and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting.
122
+ * (v8M ARM ARM I_PKLD.)
123
+ */
124
+int armv7m_nvic_raw_execution_priority(NVICState *s);
125
+/**
126
+ * armv7m_nvic_neg_prio_requested: return true if the requested execution
127
+ * priority is negative for the specified security state.
128
+ * @s: the NVIC
129
+ * @secure: the security state to test
130
+ * This corresponds to the pseudocode IsReqExecPriNeg().
131
+ */
132
+#ifndef CONFIG_USER_ONLY
133
+bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure);
134
+#else
135
+static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
136
+{
137
+ return false;
138
+}
139
+#endif
140
+#ifndef CONFIG_USER_ONLY
141
+bool armv7m_nvic_can_take_pending_exception(NVICState *s);
142
+#else
143
+static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s)
144
+{
145
+ return true;
146
+}
147
+#endif
148
+
149
#endif
150
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
151
index XXXXXXX..XXXXXXX 100644
152
--- a/target/arm/cpu.h
153
+++ b/target/arm/cpu.h
154
@@ -XXX,XX +XXX,XX @@ void arm_cpu_list(void);
155
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
156
uint32_t cur_el, bool secure);
157
158
-/* Interface between CPU and Interrupt controller. */
159
-#ifndef CONFIG_USER_ONLY
160
-bool armv7m_nvic_can_take_pending_exception(NVICState *s);
161
-#else
162
-static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s)
163
-{
164
- return true;
165
-}
166
-#endif
167
-/**
168
- * armv7m_nvic_set_pending: mark the specified exception as pending
169
- * @s: the NVIC
170
- * @irq: the exception number to mark pending
171
- * @secure: false for non-banked exceptions or for the nonsecure
172
- * version of a banked exception, true for the secure version of a banked
173
- * exception.
174
- *
175
- * Marks the specified exception as pending. Note that we will assert()
176
- * if @secure is true and @irq does not specify one of the fixed set
177
- * of architecturally banked exceptions.
178
- */
179
-void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure);
180
-/**
181
- * armv7m_nvic_set_pending_derived: mark this derived exception as pending
182
- * @s: the NVIC
183
- * @irq: the exception number to mark pending
184
- * @secure: false for non-banked exceptions or for the nonsecure
185
- * version of a banked exception, true for the secure version of a banked
186
- * exception.
187
- *
188
- * Similar to armv7m_nvic_set_pending(), but specifically for derived
189
- * exceptions (exceptions generated in the course of trying to take
190
- * a different exception).
191
- */
192
-void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure);
193
-/**
194
- * armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending
195
- * @s: the NVIC
196
- * @irq: the exception number to mark pending
197
- * @secure: false for non-banked exceptions or for the nonsecure
198
- * version of a banked exception, true for the secure version of a banked
199
- * exception.
200
- *
201
- * Similar to armv7m_nvic_set_pending(), but specifically for exceptions
202
- * generated in the course of lazy stacking of FP registers.
203
- */
204
-void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure);
205
-/**
206
- * armv7m_nvic_get_pending_irq_info: return highest priority pending
207
- * exception, and whether it targets Secure state
208
- * @s: the NVIC
209
- * @pirq: set to pending exception number
210
- * @ptargets_secure: set to whether pending exception targets Secure
211
- *
212
- * This function writes the number of the highest priority pending
213
- * exception (the one which would be made active by
214
- * armv7m_nvic_acknowledge_irq()) to @pirq, and sets @ptargets_secure
215
- * to true if the current highest priority pending exception should
216
- * be taken to Secure state, false for NS.
217
- */
218
-void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq,
219
- bool *ptargets_secure);
220
-/**
221
- * armv7m_nvic_acknowledge_irq: make highest priority pending exception active
222
- * @s: the NVIC
223
- *
224
- * Move the current highest priority pending exception from the pending
225
- * state to the active state, and update v7m.exception to indicate that
226
- * it is the exception currently being handled.
227
- */
228
-void armv7m_nvic_acknowledge_irq(NVICState *s);
229
-/**
230
- * armv7m_nvic_complete_irq: complete specified interrupt or exception
231
- * @s: the NVIC
232
- * @irq: the exception number to complete
233
- * @secure: true if this exception was secure
234
- *
235
- * Returns: -1 if the irq was not active
236
- * 1 if completing this irq brought us back to base (no active irqs)
237
- * 0 if there is still an irq active after this one was completed
238
- * (Ignoring -1, this is the same as the RETTOBASE value before completion.)
239
- */
240
-int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure);
241
-/**
242
- * armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
243
- * @s: the NVIC
244
- * @irq: the exception number to mark pending
245
- * @secure: false for non-banked exceptions or for the nonsecure
246
- * version of a banked exception, true for the secure version of a banked
247
- * exception.
248
- *
249
- * Return whether an exception is "ready", i.e. whether the exception is
250
- * enabled and is configured at a priority which would allow it to
251
- * interrupt the current execution priority. This controls whether the
252
- * RDY bit for it in the FPCCR is set.
253
- */
254
-bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure);
255
-/**
256
- * armv7m_nvic_raw_execution_priority: return the raw execution priority
257
- * @s: the NVIC
258
- *
259
- * Returns: the raw execution priority as defined by the v8M architecture.
260
- * This is the execution priority minus the effects of AIRCR.PRIS,
261
- * and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting.
262
- * (v8M ARM ARM I_PKLD.)
263
- */
264
-int armv7m_nvic_raw_execution_priority(NVICState *s);
265
-/**
266
- * armv7m_nvic_neg_prio_requested: return true if the requested execution
267
- * priority is negative for the specified security state.
268
- * @s: the NVIC
269
- * @secure: the security state to test
270
- * This corresponds to the pseudocode IsReqExecPriNeg().
271
- */
272
-#ifndef CONFIG_USER_ONLY
273
-bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure);
274
-#else
275
-static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
276
-{
277
- return false;
278
-}
279
-#endif
280
-
281
/* Interface for defining coprocessor registers.
282
* Registers are defined in tables of arm_cp_reginfo structs
283
* which are passed to define_arm_cp_regs().
14
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
284
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
15
index XXXXXXX..XXXXXXX 100644
285
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.c
286
--- a/target/arm/cpu.c
17
+++ b/target/arm/cpu.c
287
+++ b/target/arm/cpu.c
18
@@ -XXX,XX +XXX,XX @@ static void cortex_r5_initfn(Object *obj)
288
@@ -XXX,XX +XXX,XX @@
19
set_feature(&cpu->env, ARM_FEATURE_V7);
289
#if !defined(CONFIG_USER_ONLY)
20
set_feature(&cpu->env, ARM_FEATURE_V7MP);
290
#include "hw/loader.h"
21
set_feature(&cpu->env, ARM_FEATURE_PMSA);
291
#include "hw/boards.h"
22
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
292
+#ifdef CONFIG_TCG
23
cpu->midr = 0x411fc153; /* r1p3 */
293
#include "hw/intc/armv7m_nvic.h"
24
cpu->id_pfr0 = 0x0131;
294
-#endif
25
cpu->id_pfr1 = 0x001;
295
+#endif /* CONFIG_TCG */
296
+#endif /* !CONFIG_USER_ONLY */
297
#include "sysemu/tcg.h"
298
#include "sysemu/qtest.h"
299
#include "sysemu/hw_accel.h"
300
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
301
index XXXXXXX..XXXXXXX 100644
302
--- a/target/arm/cpu_tcg.c
303
+++ b/target/arm/cpu_tcg.c
304
@@ -XXX,XX +XXX,XX @@
305
#include "hw/boards.h"
306
#endif
307
#include "cpregs.h"
308
+#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
309
+#include "hw/intc/armv7m_nvic.h"
310
+#endif
311
312
313
/* Share AArch32 -cpu max features with AArch64. */
314
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
315
index XXXXXXX..XXXXXXX 100644
316
--- a/target/arm/m_helper.c
317
+++ b/target/arm/m_helper.c
318
@@ -XXX,XX +XXX,XX @@
319
#include "exec/cpu_ldst.h"
320
#include "semihosting/common-semi.h"
321
#endif
322
+#if !defined(CONFIG_USER_ONLY)
323
+#include "hw/intc/armv7m_nvic.h"
324
+#endif
325
326
static void v7m_msr_xpsr(CPUARMState *env, uint32_t mask,
327
uint32_t reg, uint32_t val)
26
--
328
--
27
2.20.1
329
2.34.1
28
330
29
331
diff view generated by jsdifflib
New patch
1
1
From: Alex Bennée <alex.bennee@linaro.org>
2
3
The two TCG tests for GICv2 and GICv3 are very heavy weight distros
4
that take a long time to boot up, especially for an --enable-debug
5
build. The total code coverage they give is:
6
7
Overall coverage rate:
8
lines......: 11.2% (59584 of 530123 lines)
9
functions..: 15.0% (7436 of 49443 functions)
10
branches...: 6.3% (19273 of 303933 branches)
11
12
We already get pretty close to that with the machine_aarch64_virt
13
tests which only does one full boot (~120s vs ~600s) of alpine. We
14
expand the kernel+initrd boot (~8s) to test both GICs and also add an
15
RNG device and a block device to generate a few IRQs and exercise the
16
storage layer. With that we get to a coverage of:
17
18
Overall coverage rate:
19
lines......: 11.0% (58121 of 530123 lines)
20
functions..: 14.9% (7343 of 49443 functions)
21
branches...: 6.0% (18269 of 303933 branches)
22
23
which I feel is close enough given the massive time saving. If we want
24
to target any more sub-systems we can use lighter weight more directed
25
tests.
26
27
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
28
Reviewed-by: Fabiano Rosas <farosas@suse.de>
29
Acked-by: Richard Henderson <richard.henderson@linaro.org>
30
Message-id: 20230203181632.2919715-1-alex.bennee@linaro.org
31
Cc: Peter Maydell <peter.maydell@linaro.org>
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
---
34
tests/avocado/boot_linux.py | 48 ++++----------------
35
tests/avocado/machine_aarch64_virt.py | 63 ++++++++++++++++++++++++---
36
2 files changed, 65 insertions(+), 46 deletions(-)
37
38
diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py
39
index XXXXXXX..XXXXXXX 100644
40
--- a/tests/avocado/boot_linux.py
41
+++ b/tests/avocado/boot_linux.py
42
@@ -XXX,XX +XXX,XX @@ def test_pc_q35_kvm(self):
43
self.launch_and_wait(set_up_ssh_connection=False)
44
45
46
-# For Aarch64 we only boot KVM tests in CI as the TCG tests are very
47
-# heavyweight. There are lighter weight distros which we use in the
48
-# machine_aarch64_virt.py tests.
49
+# For Aarch64 we only boot KVM tests in CI as booting the current
50
+# Fedora OS in TCG tests is very heavyweight. There are lighter weight
51
+# distros which we use in the machine_aarch64_virt.py tests.
52
class BootLinuxAarch64(LinuxTest):
53
"""
54
:avocado: tags=arch:aarch64
55
:avocado: tags=machine:virt
56
- :avocado: tags=machine:gic-version=2
57
"""
58
timeout = 720
59
60
- def add_common_args(self):
61
- self.vm.add_args('-bios',
62
- os.path.join(BUILD_DIR, 'pc-bios',
63
- 'edk2-aarch64-code.fd'))
64
- self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
65
- self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom')
66
-
67
- @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
68
- def test_fedora_cloud_tcg_gicv2(self):
69
- """
70
- :avocado: tags=accel:tcg
71
- :avocado: tags=cpu:max
72
- :avocado: tags=device:gicv2
73
- """
74
- self.require_accelerator("tcg")
75
- self.vm.add_args("-accel", "tcg")
76
- self.vm.add_args("-cpu", "max,lpa2=off")
77
- self.vm.add_args("-machine", "virt,gic-version=2")
78
- self.add_common_args()
79
- self.launch_and_wait(set_up_ssh_connection=False)
80
-
81
- @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
82
- def test_fedora_cloud_tcg_gicv3(self):
83
- """
84
- :avocado: tags=accel:tcg
85
- :avocado: tags=cpu:max
86
- :avocado: tags=device:gicv3
87
- """
88
- self.require_accelerator("tcg")
89
- self.vm.add_args("-accel", "tcg")
90
- self.vm.add_args("-cpu", "max,lpa2=off")
91
- self.vm.add_args("-machine", "virt,gic-version=3")
92
- self.add_common_args()
93
- self.launch_and_wait(set_up_ssh_connection=False)
94
-
95
def test_virt_kvm(self):
96
"""
97
:avocado: tags=accel:kvm
98
@@ -XXX,XX +XXX,XX @@ def test_virt_kvm(self):
99
self.require_accelerator("kvm")
100
self.vm.add_args("-accel", "kvm")
101
self.vm.add_args("-machine", "virt,gic-version=host")
102
- self.add_common_args()
103
+ self.vm.add_args('-bios',
104
+ os.path.join(BUILD_DIR, 'pc-bios',
105
+ 'edk2-aarch64-code.fd'))
106
+ self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
107
+ self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom')
108
self.launch_and_wait(set_up_ssh_connection=False)
109
110
111
diff --git a/tests/avocado/machine_aarch64_virt.py b/tests/avocado/machine_aarch64_virt.py
112
index XXXXXXX..XXXXXXX 100644
113
--- a/tests/avocado/machine_aarch64_virt.py
114
+++ b/tests/avocado/machine_aarch64_virt.py
115
@@ -XXX,XX +XXX,XX @@
116
117
import time
118
import os
119
+import logging
120
121
from avocado_qemu import QemuSystemTest
122
from avocado_qemu import wait_for_console_pattern
123
from avocado_qemu import exec_command
124
from avocado_qemu import BUILD_DIR
125
+from avocado.utils import process
126
+from avocado.utils.path import find_command
127
128
class Aarch64VirtMachine(QemuSystemTest):
129
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
130
@@ -XXX,XX +XXX,XX @@ def test_alpine_virt_tcg_gic_max(self):
131
self.wait_for_console_pattern('Welcome to Alpine Linux 3.16')
132
133
134
- def test_aarch64_virt(self):
135
+ def common_aarch64_virt(self, machine):
136
"""
137
- :avocado: tags=arch:aarch64
138
- :avocado: tags=machine:virt
139
- :avocado: tags=accel:tcg
140
- :avocado: tags=cpu:max
141
+ Common code to launch basic virt machine with kernel+initrd
142
+ and a scratch disk.
143
"""
144
+ logger = logging.getLogger('aarch64_virt')
145
+
146
kernel_url = ('https://fileserver.linaro.org/s/'
147
'z6B2ARM7DQT3HWN/download')
148
-
149
kernel_hash = 'ed11daab50c151dde0e1e9c9cb8b2d9bd3215347'
150
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
151
152
@@ -XXX,XX +XXX,XX @@ def test_aarch64_virt(self):
153
'console=ttyAMA0')
154
self.require_accelerator("tcg")
155
self.vm.add_args('-cpu', 'max,pauth-impdef=on',
156
+ '-machine', machine,
157
'-accel', 'tcg',
158
'-kernel', kernel_path,
159
'-append', kernel_command_line)
160
+
161
+ # A RNG offers an easy way to generate a few IRQs
162
+ self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
163
+ self.vm.add_args('-object',
164
+ 'rng-random,id=rng0,filename=/dev/urandom')
165
+
166
+ # Also add a scratch block device
167
+ logger.info('creating scratch qcow2 image')
168
+ image_path = os.path.join(self.workdir, 'scratch.qcow2')
169
+ qemu_img = os.path.join(BUILD_DIR, 'qemu-img')
170
+ if not os.path.exists(qemu_img):
171
+ qemu_img = find_command('qemu-img', False)
172
+ if qemu_img is False:
173
+ self.cancel('Could not find "qemu-img", which is required to '
174
+ 'create the temporary qcow2 image')
175
+ cmd = '%s create -f qcow2 %s 8M' % (qemu_img, image_path)
176
+ process.run(cmd)
177
+
178
+ # Add the device
179
+ self.vm.add_args('-blockdev',
180
+ f"driver=qcow2,file.driver=file,file.filename={image_path},node-name=scratch")
181
+ self.vm.add_args('-device',
182
+ 'virtio-blk-device,drive=scratch')
183
+
184
self.vm.launch()
185
self.wait_for_console_pattern('Welcome to Buildroot')
186
time.sleep(0.1)
187
exec_command(self, 'root')
188
time.sleep(0.1)
189
+ exec_command(self, 'dd if=/dev/hwrng of=/dev/vda bs=512 count=4')
190
+ time.sleep(0.1)
191
+ exec_command(self, 'md5sum /dev/vda')
192
+ time.sleep(0.1)
193
+ exec_command(self, 'cat /proc/interrupts')
194
+ time.sleep(0.1)
195
exec_command(self, 'cat /proc/self/maps')
196
time.sleep(0.1)
197
+
198
+ def test_aarch64_virt_gicv3(self):
199
+ """
200
+ :avocado: tags=arch:aarch64
201
+ :avocado: tags=machine:virt
202
+ :avocado: tags=accel:tcg
203
+ :avocado: tags=cpu:max
204
+ """
205
+ self.common_aarch64_virt("virt,gic_version=3")
206
+
207
+ def test_aarch64_virt_gicv2(self):
208
+ """
209
+ :avocado: tags=arch:aarch64
210
+ :avocado: tags=machine:virt
211
+ :avocado: tags=accel:tcg
212
+ :avocado: tags=cpu:max
213
+ """
214
+ self.common_aarch64_virt("virt,gic-version=2")
215
--
216
2.34.1
217
218
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
First parameter to exynos4210_get_irq() is not the SPI port number,
3
GBPA register can be used to globally abort all
4
but the interrupt group number. Interrupt groups are 20 for mdma
4
transactions.
5
and 21 for pdma. Interrupts are not inverted. Controllers support 32
6
events (pdma) or 31 events (mdma). Events must all be routed to a single
7
interrupt line. Set other parameters as documented in Exynos4210 datasheet,
8
section 8 (DMA controller).
9
5
10
Fixes: 59520dc65e ("hw/arm/exynos4210: Add DMA support for the Exynos4210")
6
It is described in the SMMU manual in "6.3.14 SMMU_GBPA".
7
ABORT reset value is IMPLEMENTATION DEFINED, it is chosen to
8
be zero(Do not abort incoming transactions).
9
10
Other fields have default values of Use Incoming.
11
12
If UPDATE is not set, the write is ignored. This is the only permitted
13
behavior in SMMUv3.2 and later.(6.3.14.1 Update procedure)
14
15
As this patch adds a new state to the SMMU (GBPA), it is added
16
in a new subsection for forward migration compatibility.
17
GBPA is only migrated if its value is different from the reset value.
18
It does this to be backward migration compatible if SW didn't write
19
the register.
20
21
Signed-off-by: Mostafa Saleh <smostafa@google.com>
22
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
23
Reviewed-by: Eric Auger <eric.auger@redhat.com>
24
Message-id: 20230214094009.2445653-1-smostafa@google.com
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
25
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
13
Message-id: 20200123052540.6132-4-linux@roeck-us.net
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
27
---
16
include/hw/arm/exynos4210.h | 4 +++
28
hw/arm/smmuv3-internal.h | 7 +++++++
17
hw/arm/exynos4210.c | 51 +++++++++++++++++++++++++++++++------
29
include/hw/arm/smmuv3.h | 1 +
18
2 files changed, 47 insertions(+), 8 deletions(-)
30
hw/arm/smmuv3.c | 43 +++++++++++++++++++++++++++++++++++++++-
31
3 files changed, 50 insertions(+), 1 deletion(-)
19
32
20
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
33
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
21
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/arm/exynos4210.h
35
--- a/hw/arm/smmuv3-internal.h
23
+++ b/include/hw/arm/exynos4210.h
36
+++ b/hw/arm/smmuv3-internal.h
24
@@ -XXX,XX +XXX,XX @@
37
@@ -XXX,XX +XXX,XX @@ REG32(CR0ACK, 0x24)
25
#ifndef EXYNOS4210_H
38
REG32(CR1, 0x28)
26
#define EXYNOS4210_H
39
REG32(CR2, 0x2c)
27
40
REG32(STATUSR, 0x40)
28
+#include "hw/or-irq.h"
41
+REG32(GBPA, 0x44)
29
#include "hw/sysbus.h"
42
+ FIELD(GBPA, ABORT, 20, 1)
30
#include "target/arm/cpu-qom.h"
43
+ FIELD(GBPA, UPDATE, 31, 1)
31
32
@@ -XXX,XX +XXX,XX @@
33
34
#define EXYNOS4210_I2C_NUMBER 9
35
36
+#define EXYNOS4210_NUM_DMA 3
37
+
44
+
38
typedef struct Exynos4210Irq {
45
+/* Use incoming. */
39
qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
46
+#define SMMU_GBPA_RESET_VAL 0x1000
40
qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ];
47
+
41
@@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210State {
48
REG32(IRQ_CTRL, 0x50)
42
MemoryRegion boot_secondary;
49
FIELD(IRQ_CTRL, GERROR_IRQEN, 0, 1)
43
MemoryRegion bootreg_mem;
50
FIELD(IRQ_CTRL, PRI_IRQEN, 1, 1)
44
I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER];
51
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
45
+ qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA];
46
} Exynos4210State;
47
48
#define TYPE_EXYNOS4210_SOC "exynos4210"
49
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
50
index XXXXXXX..XXXXXXX 100644
52
index XXXXXXX..XXXXXXX 100644
51
--- a/hw/arm/exynos4210.c
53
--- a/include/hw/arm/smmuv3.h
52
+++ b/hw/arm/exynos4210.c
54
+++ b/include/hw/arm/smmuv3.h
53
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_calc_affinity(int cpu)
55
@@ -XXX,XX +XXX,XX @@ struct SMMUv3State {
54
return (0x9 << ARM_AFF1_SHIFT) | cpu;
56
uint32_t cr[3];
57
uint32_t cr0ack;
58
uint32_t statusr;
59
+ uint32_t gbpa;
60
uint32_t irq_ctrl;
61
uint32_t gerror;
62
uint32_t gerrorn;
63
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
64
index XXXXXXX..XXXXXXX 100644
65
--- a/hw/arm/smmuv3.c
66
+++ b/hw/arm/smmuv3.c
67
@@ -XXX,XX +XXX,XX @@ static void smmuv3_init_regs(SMMUv3State *s)
68
s->gerror = 0;
69
s->gerrorn = 0;
70
s->statusr = 0;
71
+ s->gbpa = SMMU_GBPA_RESET_VAL;
55
}
72
}
56
73
57
-static void pl330_create(uint32_t base, qemu_irq irq, int nreq)
74
static int smmu_get_ste(SMMUv3State *s, dma_addr_t addr, STE *buf,
58
+static void pl330_create(uint32_t base, qemu_or_irq *orgate, qemu_irq irq,
75
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
59
+ int nreq, int nevents, int width)
76
qemu_mutex_lock(&s->mutex);
60
{
77
61
SysBusDevice *busdev;
78
if (!smmu_enabled(s)) {
62
DeviceState *dev;
79
- status = SMMU_TRANS_DISABLE;
63
+ int i;
80
+ if (FIELD_EX32(s->gbpa, GBPA, ABORT)) {
64
81
+ status = SMMU_TRANS_ABORT;
65
dev = qdev_create(NULL, "pl330");
82
+ } else {
66
+ qdev_prop_set_uint8(dev, "num_events", nevents);
83
+ status = SMMU_TRANS_DISABLE;
67
+ qdev_prop_set_uint8(dev, "num_chnls", 8);
84
+ }
68
qdev_prop_set_uint8(dev, "num_periph_req", nreq);
85
goto epilogue;
86
}
87
88
@@ -XXX,XX +XXX,XX @@ static MemTxResult smmu_writel(SMMUv3State *s, hwaddr offset,
89
case A_GERROR_IRQ_CFG2:
90
s->gerror_irq_cfg2 = data;
91
return MEMTX_OK;
92
+ case A_GBPA:
93
+ /*
94
+ * If UPDATE is not set, the write is ignored. This is the only
95
+ * permitted behavior in SMMUv3.2 and later.
96
+ */
97
+ if (data & R_GBPA_UPDATE_MASK) {
98
+ /* Ignore update bit as write is synchronous. */
99
+ s->gbpa = data & ~R_GBPA_UPDATE_MASK;
100
+ }
101
+ return MEMTX_OK;
102
case A_STRTAB_BASE: /* 64b */
103
s->strtab_base = deposit64(s->strtab_base, 0, 32, data);
104
return MEMTX_OK;
105
@@ -XXX,XX +XXX,XX @@ static MemTxResult smmu_readl(SMMUv3State *s, hwaddr offset,
106
case A_STATUSR:
107
*data = s->statusr;
108
return MEMTX_OK;
109
+ case A_GBPA:
110
+ *data = s->gbpa;
111
+ return MEMTX_OK;
112
case A_IRQ_CTRL:
113
case A_IRQ_CTRL_ACK:
114
*data = s->irq_ctrl;
115
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3_queue = {
116
},
117
};
118
119
+static bool smmuv3_gbpa_needed(void *opaque)
120
+{
121
+ SMMUv3State *s = opaque;
69
+
122
+
70
+ qdev_prop_set_uint8(dev, "wr_cap", 4);
123
+ /* Only migrate GBPA if it has different reset value. */
71
+ qdev_prop_set_uint8(dev, "wr_q_dep", 8);
124
+ return s->gbpa != SMMU_GBPA_RESET_VAL;
72
+ qdev_prop_set_uint8(dev, "rd_cap", 4);
73
+ qdev_prop_set_uint8(dev, "rd_q_dep", 8);
74
+ qdev_prop_set_uint8(dev, "data_width", width);
75
+ qdev_prop_set_uint16(dev, "data_buffer_dep", width);
76
qdev_init_nofail(dev);
77
busdev = SYS_BUS_DEVICE(dev);
78
sysbus_mmio_map(busdev, 0, base);
79
- sysbus_connect_irq(busdev, 0, irq);
80
+
81
+ object_property_set_int(OBJECT(orgate), nevents + 1, "num-lines",
82
+ &error_abort);
83
+ object_property_set_bool(OBJECT(orgate), true, "realized", &error_abort);
84
+
85
+ for (i = 0; i < nevents + 1; i++) {
86
+ sysbus_connect_irq(busdev, i, qdev_get_gpio_in(DEVICE(orgate), i));
87
+ }
88
+ qdev_connect_gpio_out(DEVICE(orgate), 0, irq);
89
}
90
91
static void exynos4210_realize(DeviceState *socdev, Error **errp)
92
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
93
s->irq_table[exynos4210_get_irq(28, 3)]);
94
95
/*** DMA controllers ***/
96
- pl330_create(EXYNOS4210_PL330_BASE0_ADDR,
97
- qemu_irq_invert(s->irq_table[exynos4210_get_irq(35, 1)]), 32);
98
- pl330_create(EXYNOS4210_PL330_BASE1_ADDR,
99
- qemu_irq_invert(s->irq_table[exynos4210_get_irq(36, 1)]), 32);
100
- pl330_create(EXYNOS4210_PL330_BASE2_ADDR,
101
- qemu_irq_invert(s->irq_table[exynos4210_get_irq(34, 1)]), 1);
102
+ pl330_create(EXYNOS4210_PL330_BASE0_ADDR, &s->pl330_irq_orgate[0],
103
+ s->irq_table[exynos4210_get_irq(21, 0)], 32, 32, 32);
104
+ pl330_create(EXYNOS4210_PL330_BASE1_ADDR, &s->pl330_irq_orgate[1],
105
+ s->irq_table[exynos4210_get_irq(21, 1)], 32, 32, 32);
106
+ pl330_create(EXYNOS4210_PL330_BASE2_ADDR, &s->pl330_irq_orgate[2],
107
+ s->irq_table[exynos4210_get_irq(20, 1)], 1, 31, 64);
108
+}
125
+}
109
+
126
+
110
+static void exynos4210_init(Object *obj)
127
+static const VMStateDescription vmstate_gbpa = {
111
+{
128
+ .name = "smmuv3/gbpa",
112
+ Exynos4210State *s = EXYNOS4210_SOC(obj);
129
+ .version_id = 1,
113
+ int i;
130
+ .minimum_version_id = 1,
131
+ .needed = smmuv3_gbpa_needed,
132
+ .fields = (VMStateField[]) {
133
+ VMSTATE_UINT32(gbpa, SMMUv3State),
134
+ VMSTATE_END_OF_LIST()
135
+ }
136
+};
114
+
137
+
115
+ for (i = 0; i < ARRAY_SIZE(s->pl330_irq_orgate); i++) {
138
static const VMStateDescription vmstate_smmuv3 = {
116
+ char *name = g_strdup_printf("pl330-irq-orgate%d", i);
139
.name = "smmuv3",
117
+ qemu_or_irq *orgate = &s->pl330_irq_orgate[i];
140
.version_id = 1,
118
+
141
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3 = {
119
+ object_initialize_child(obj, name, orgate, sizeof(*orgate),
142
120
+ TYPE_OR_IRQ, &error_abort, NULL);
143
VMSTATE_END_OF_LIST(),
121
+ g_free(name);
144
},
145
+ .subsections = (const VMStateDescription * []) {
146
+ &vmstate_gbpa,
147
+ NULL
122
+ }
148
+ }
123
}
124
125
static void exynos4210_class_init(ObjectClass *klass, void *data)
126
@@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_info = {
127
.name = TYPE_EXYNOS4210_SOC,
128
.parent = TYPE_SYS_BUS_DEVICE,
129
.instance_size = sizeof(Exynos4210State),
130
+ .instance_init = exynos4210_init,
131
.class_init = exynos4210_class_init,
132
};
149
};
133
150
151
static void smmuv3_instance_init(Object *obj)
134
--
152
--
135
2.20.1
153
2.34.1
136
137
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
This is the test vector from the QARMA paper, run through PACGA.
3
Since commit acc0b8b05a when running the ZynqMP ZCU102 board with
4
a QEMU configured using --without-default-devices, we get:
4
5
5
Suggested-by: Vincent Dehors <vincent.dehors@smile.fr>
6
$ qemu-system-aarch64 -M xlnx-zcu102
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
qemu-system-aarch64: missing object type 'usb_dwc3'
7
Message-id: 20200116230809.19078-4-richard.henderson@linaro.org
8
Abort trap: 6
9
10
Fix by adding the missing Kconfig dependency.
11
12
Fixes: acc0b8b05a ("hw/arm/xlnx-zynqmp: Connect ZynqMP's USB controllers")
13
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Message-id: 20230216092327.2203-1-philmd@linaro.org
15
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
17
---
10
tests/tcg/aarch64/Makefile.softmmu-target | 5 ++-
18
hw/arm/Kconfig | 1 +
11
tests/tcg/aarch64/system/pauth-3.c | 40 +++++++++++++++++++++++
19
1 file changed, 1 insertion(+)
12
2 files changed, 44 insertions(+), 1 deletion(-)
13
create mode 100644 tests/tcg/aarch64/system/pauth-3.c
14
20
15
diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target
21
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
16
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
17
--- a/tests/tcg/aarch64/Makefile.softmmu-target
23
--- a/hw/arm/Kconfig
18
+++ b/tests/tcg/aarch64/Makefile.softmmu-target
24
+++ b/hw/arm/Kconfig
19
@@ -XXX,XX +XXX,XX @@ run-memory-replay: memory-replay run-memory-record
25
@@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM
20
          $(QEMU_OPTS) memory, \
26
select XLNX_CSU_DMA
21
     "$< on $(TARGET_NAME)")
27
select XLNX_ZYNQMP
22
28
select XLNX_ZDMA
23
-EXTRA_TESTS+=memory-record memory-replay
29
+ select USB_DWC3
24
+run-pauth-3: pauth-3
30
25
+pauth-3: CFLAGS += -march=armv8.3-a
31
config XLNX_VERSAL
26
+
32
bool
27
+EXTRA_TESTS+=memory-record memory-replay pauth-3
28
diff --git a/tests/tcg/aarch64/system/pauth-3.c b/tests/tcg/aarch64/system/pauth-3.c
29
new file mode 100644
30
index XXXXXXX..XXXXXXX
31
--- /dev/null
32
+++ b/tests/tcg/aarch64/system/pauth-3.c
33
@@ -XXX,XX +XXX,XX @@
34
+#include <inttypes.h>
35
+#include <minilib.h>
36
+
37
+int main()
38
+{
39
+ /*
40
+ * Test vector from QARMA paper (https://eprint.iacr.org/2016/444.pdf)
41
+ * to verify one computation of the pauth_computepac() function,
42
+ * which uses sbox2.
43
+ *
44
+ * Use PACGA, because it returns the most bits from ComputePAC.
45
+ * We still only get the most significant 32-bits of the result.
46
+ */
47
+
48
+ static const uint64_t d[5] = {
49
+ 0xfb623599da6e8127ull,
50
+ 0x477d469dec0b8762ull,
51
+ 0x84be85ce9804e94bull,
52
+ 0xec2802d4e0a488e9ull,
53
+ 0xc003b93999b33765ull & 0xffffffff00000000ull
54
+ };
55
+ uint64_t r;
56
+
57
+ asm("msr apgakeyhi_el1, %[w0]\n\t"
58
+ "msr apgakeylo_el1, %[k0]\n\t"
59
+ "pacga %[r], %[P], %[T]"
60
+ : [r] "=r"(r)
61
+ : [P] "r" (d[0]),
62
+ [T] "r" (d[1]),
63
+ [w0] "r" (d[2]),
64
+ [k0] "r" (d[3]));
65
+
66
+ if (r == d[4]) {
67
+ ml_printf("OK\n");
68
+ return 0;
69
+ } else {
70
+ ml_printf("FAIL: %lx != %lx\n", r, d[4]);
71
+ return 1;
72
+ }
73
+}
74
--
33
--
75
2.20.1
34
2.34.1
76
35
77
36
diff view generated by jsdifflib
1
From: Keqian Zhu <zhukeqian1@huawei.com>
1
From: Cornelia Huck <cohuck@redhat.com>
2
2
3
We can use existing helper function to trigger hotplug handler
3
Just use current_accel_name() directly.
4
plug, which makes code clearer.
5
4
6
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
7
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
6
Reviewed-by: Eric Auger <eric.auger@redhat.com>
8
Message-id: 20200120012755.44581-3-zhukeqian1@huawei.com
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
9
---
11
hw/arm/virt.c | 6 +++---
10
hw/arm/virt.c | 6 +++---
12
1 file changed, 3 insertions(+), 3 deletions(-)
11
1 file changed, 3 insertions(+), 3 deletions(-)
13
12
14
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
13
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/virt.c
15
--- a/hw/arm/virt.c
17
+++ b/hw/arm/virt.c
16
+++ b/hw/arm/virt.c
18
@@ -XXX,XX +XXX,XX @@ static void virt_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
17
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
19
static void virt_memory_plug(HotplugHandler *hotplug_dev,
18
if (vms->secure && (kvm_enabled() || hvf_enabled())) {
20
DeviceState *dev, Error **errp)
19
error_report("mach-virt: %s does not support providing "
21
{
20
"Security extensions (TrustZone) to the guest CPU",
22
- HotplugHandlerClass *hhc;
21
- kvm_enabled() ? "KVM" : "HVF");
23
VirtMachineState *vms = VIRT_MACHINE(hotplug_dev);
22
+ current_accel_name());
24
Error *local_err = NULL;
23
exit(1);
25
26
@@ -XXX,XX +XXX,XX @@ static void virt_memory_plug(HotplugHandler *hotplug_dev,
27
goto out;
28
}
24
}
29
25
30
- hhc = HOTPLUG_HANDLER_GET_CLASS(vms->acpi_dev);
26
if (vms->virt && (kvm_enabled() || hvf_enabled())) {
31
- hhc->plug(HOTPLUG_HANDLER(vms->acpi_dev), dev, &error_abort);
27
error_report("mach-virt: %s does not support providing "
32
+ hotplug_handler_plug(HOTPLUG_HANDLER(vms->acpi_dev),
28
"Virtualization extensions to the guest CPU",
33
+ dev, &error_abort);
29
- kvm_enabled() ? "KVM" : "HVF");
34
+
30
+ current_accel_name());
35
out:
31
exit(1);
36
error_propagate(errp, local_err);
32
}
37
}
33
34
if (vms->mte && (kvm_enabled() || hvf_enabled())) {
35
error_report("mach-virt: %s does not support providing "
36
"MTE to the guest CPU",
37
- kvm_enabled() ? "KVM" : "HVF");
38
+ current_accel_name());
39
exit(1);
40
}
41
38
--
42
--
39
2.20.1
43
2.34.1
40
41
diff view generated by jsdifflib
New patch
1
From: Hao Wu <wuhaotsh@google.com>
1
2
3
Havard is no longer working on the Nuvoton systems for a while
4
and won't be able to do any work on it in the future. So I'll
5
take over maintaining the Nuvoton system from him.
6
7
Signed-off-by: Hao Wu <wuhaotsh@google.com>
8
Acked-by: Havard Skinnemoen <hskinnemoen@google.com>
9
Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org>
10
Message-id: 20230208235433.3989937-2-wuhaotsh@google.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
MAINTAINERS | 2 +-
14
1 file changed, 1 insertion(+), 1 deletion(-)
15
16
diff --git a/MAINTAINERS b/MAINTAINERS
17
index XXXXXXX..XXXXXXX 100644
18
--- a/MAINTAINERS
19
+++ b/MAINTAINERS
20
@@ -XXX,XX +XXX,XX @@ F: include/hw/net/mv88w8618_eth.h
21
F: docs/system/arm/musicpal.rst
22
23
Nuvoton NPCM7xx
24
-M: Havard Skinnemoen <hskinnemoen@google.com>
25
M: Tyrone Ting <kfting@nuvoton.com>
26
+M: Hao Wu <wuhaotsh@google.com>
27
L: qemu-arm@nongnu.org
28
S: Supported
29
F: hw/*/npcm7xx*
30
--
31
2.34.1
diff view generated by jsdifflib
1
The qemu-nbd documentation is currently in qemu-nbd.texi in Texinfo
1
From: Hao Wu <wuhaotsh@google.com>
2
format, which we present to the user as:
3
* a qemu-nbd manpage
4
* a section of the main qemu-doc HTML documentation
5
2
6
Convert the documentation to rST format, and present it to the user as:
3
Nuvoton's PSPI is a general purpose SPI module which enables
7
* a qemu-nbd manpage
4
connections to SPI-based peripheral devices.
8
* part of the interop/ Sphinx manual
9
5
10
This follows the same pattern as commit 27a296fce982 did for the
6
Signed-off-by: Hao Wu <wuhaotsh@google.com>
11
qemu-ga manpage.
7
Reviewed-by: Chris Rauer <crauer@google.com>
8
Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org>
9
Message-id: 20230208235433.3989937-3-wuhaotsh@google.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
MAINTAINERS | 6 +-
13
include/hw/ssi/npcm_pspi.h | 53 +++++++++
14
hw/ssi/npcm_pspi.c | 221 +++++++++++++++++++++++++++++++++++++
15
hw/ssi/meson.build | 2 +-
16
hw/ssi/trace-events | 5 +
17
5 files changed, 283 insertions(+), 4 deletions(-)
18
create mode 100644 include/hw/ssi/npcm_pspi.h
19
create mode 100644 hw/ssi/npcm_pspi.c
12
20
13
All the content of the old manpage is retained, except that I have
14
dropped the "This is free software; see the source for copying
15
conditions. There is NO warranty..." text that was in the old AUTHOR
16
section; Sphinx's manpage builder doesn't expect that much text in
17
the AUTHOR section, and since none of our other manpages have it it
18
seems easiest to delete it rather than try to figure out where else
19
in the manpage to put it.
20
21
The only other textual change is that I have had to give the
22
--nocache option its own description ("Equivalent to --cache=none")
23
because Sphinx doesn't have an equivalent of using item/itemx
24
to share a description between two options.
25
26
Some minor aspects of the formatting have changed, to suit what is
27
easiest for Sphinx to output. (The most notable is that Sphinx
28
option section option syntax doesn't support '--option foo=bar'
29
with bar underlined rather than bold, so we have to switch to
30
'--option foo=BAR' instead.)
31
32
The contents of qemu-option-trace.texi are now duplicated in
33
docs/interop/qemu-option-trace.rst.inc, until such time as we complete
34
the conversion of the other files which use it; since it has had only
35
3 changes in 3 years, this shouldn't be too awkward a burden.
36
(We use .rst.inc because if this file fragment has a .rst extension
37
then Sphinx complains about not seeing it in a toctree.)
38
39
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
40
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
41
Reviewed-by: Eric Blake <eblake@redhat.com>
42
Tested-by: Alex Bennée <alex.bennee@linaro.org>
43
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
44
Message-id: 20200116141511.16849-2-peter.maydell@linaro.org
45
---
46
Makefile | 16 +-
47
MAINTAINERS | 1 +
48
docs/interop/conf.py | 4 +-
49
docs/interop/index.rst | 1 +
50
docs/interop/qemu-nbd.rst | 263 +++++++++++++++++++++++++
51
docs/interop/qemu-option-trace.rst.inc | 30 +++
52
qemu-doc.texi | 6 -
53
qemu-nbd.texi | 214 --------------------
54
qemu-option-trace.texi | 4 +
55
9 files changed, 313 insertions(+), 226 deletions(-)
56
create mode 100644 docs/interop/qemu-nbd.rst
57
create mode 100644 docs/interop/qemu-option-trace.rst.inc
58
delete mode 100644 qemu-nbd.texi
59
60
diff --git a/Makefile b/Makefile
61
index XXXXXXX..XXXXXXX 100644
62
--- a/Makefile
63
+++ b/Makefile
64
@@ -XXX,XX +XXX,XX @@ MANUAL_BUILDDIR := docs
65
endif
66
67
ifdef BUILD_DOCS
68
-DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 $(MANUAL_BUILDDIR)/interop/qemu-ga.8
69
+DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1
70
+DOCS+=$(MANUAL_BUILDDIR)/interop/qemu-nbd.8
71
+DOCS+=$(MANUAL_BUILDDIR)/interop/qemu-ga.8
72
DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
73
DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
74
DOCS+=docs/qemu-block-drivers.7
75
@@ -XXX,XX +XXX,XX @@ ifdef CONFIG_POSIX
76
ifeq ($(CONFIG_TOOLS),y)
77
    $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
78
    $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
79
-    $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
80
+    $(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
81
endif
82
ifdef CONFIG_TRACE_SYSTEMTAP
83
    $(INSTALL_DATA) scripts/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
84
@@ -XXX,XX +XXX,XX @@ sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MANUAL_BUILDDIR)/interop/index
85
# a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
86
build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" sphinx-build $(if $(V),,-q) -W -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
87
# We assume all RST files in the manual's directory are used in it
88
-manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py
89
+manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst) \
90
+ $(wildcard $(SRC_PATH)/docs/$1/*.rst.inc) \
91
+ $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py
92
93
$(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel)
94
    $(call build-manual,devel,html)
95
@@ -XXX,XX +XXX,XX @@ $(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
96
$(MANUAL_BUILDDIR)/interop/qemu-ga.8: $(call manual-deps,interop)
97
    $(call build-manual,interop,man)
98
99
+$(MANUAL_BUILDDIR)/interop/qemu-nbd.8: $(call manual-deps,interop)
100
+    $(call build-manual,interop,man)
101
+
102
$(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version.h
103
    @mkdir -p "$(MANUAL_BUILDDIR)"
104
    $(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \
105
@@ -XXX,XX +XXX,XX @@ qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
106
qemu.1: qemu-option-trace.texi
107
qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
108
fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
109
-qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
110
docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
111
docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
112
scripts/qemu-trace-stap.1: scripts/qemu-trace-stap.texi
113
@@ -XXX,XX +XXX,XX @@ pdf: qemu-doc.pdf docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
114
txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
115
116
qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
117
-    qemu-img.texi qemu-nbd.texi qemu-options.texi \
118
+    qemu-img.texi qemu-options.texi \
119
    qemu-tech.texi qemu-option-trace.texi \
120
    qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi \
121
    qemu-monitor-info.texi docs/qemu-block-drivers.texi \
122
diff --git a/MAINTAINERS b/MAINTAINERS
21
diff --git a/MAINTAINERS b/MAINTAINERS
123
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
124
--- a/MAINTAINERS
23
--- a/MAINTAINERS
125
+++ b/MAINTAINERS
24
+++ b/MAINTAINERS
126
@@ -XXX,XX +XXX,XX @@ F: include/block/nbd*
25
@@ -XXX,XX +XXX,XX @@ M: Tyrone Ting <kfting@nuvoton.com>
127
F: qemu-nbd.*
26
M: Hao Wu <wuhaotsh@google.com>
128
F: blockdev-nbd.c
27
L: qemu-arm@nongnu.org
129
F: docs/interop/nbd.txt
28
S: Supported
130
+F: docs/interop/qemu-nbd.rst
29
-F: hw/*/npcm7xx*
131
T: git https://repo.or.cz/qemu/ericb.git nbd
30
-F: include/hw/*/npcm7xx*
132
31
-F: tests/qtest/npcm7xx*
133
NFS
32
+F: hw/*/npcm*
134
diff --git a/docs/interop/conf.py b/docs/interop/conf.py
33
+F: include/hw/*/npcm*
135
index XXXXXXX..XXXXXXX 100644
34
+F: tests/qtest/npcm*
136
--- a/docs/interop/conf.py
35
F: pc-bios/npcm7xx_bootrom.bin
137
+++ b/docs/interop/conf.py
36
F: roms/vbootrom
138
@@ -XXX,XX +XXX,XX @@ html_theme_options['description'] = u'System Emulation Management and Interopera
37
F: docs/system/arm/nuvoton.rst
139
# (source start file, name, description, authors, manual section).
38
diff --git a/include/hw/ssi/npcm_pspi.h b/include/hw/ssi/npcm_pspi.h
140
man_pages = [
141
('qemu-ga', 'qemu-ga', u'QEMU Guest Agent',
142
- ['Michael Roth <mdroth@linux.vnet.ibm.com>'], 8)
143
+ ['Michael Roth <mdroth@linux.vnet.ibm.com>'], 8),
144
+ ('qemu-nbd', 'qemu-nbd', u'QEMU Disk Network Block Device Server',
145
+ ['Anthony Liguori <anthony@codemonkey.ws>'], 8)
146
]
147
diff --git a/docs/interop/index.rst b/docs/interop/index.rst
148
index XXXXXXX..XXXXXXX 100644
149
--- a/docs/interop/index.rst
150
+++ b/docs/interop/index.rst
151
@@ -XXX,XX +XXX,XX @@ Contents:
152
live-block-operations
153
pr-helper
154
qemu-ga
155
+ qemu-nbd
156
vhost-user
157
vhost-user-gpu
158
diff --git a/docs/interop/qemu-nbd.rst b/docs/interop/qemu-nbd.rst
159
new file mode 100644
39
new file mode 100644
160
index XXXXXXX..XXXXXXX
40
index XXXXXXX..XXXXXXX
161
--- /dev/null
41
--- /dev/null
162
+++ b/docs/interop/qemu-nbd.rst
42
+++ b/include/hw/ssi/npcm_pspi.h
163
@@ -XXX,XX +XXX,XX @@
43
@@ -XXX,XX +XXX,XX @@
164
+QEMU Disk Network Block Device Server
44
+/*
165
+=====================================
45
+ * Nuvoton Peripheral SPI Module
166
+
46
+ *
167
+Synopsis
47
+ * Copyright 2023 Google LLC
168
+--------
48
+ *
169
+
49
+ * This program is free software; you can redistribute it and/or modify it
170
+**qemu-nbd** [*OPTION*]... *filename*
50
+ * under the terms of the GNU General Public License as published by the
171
+
51
+ * Free Software Foundation; either version 2 of the License, or
172
+**qemu-nbd** -L [*OPTION*]...
52
+ * (at your option) any later version.
173
+
53
+ *
174
+**qemu-nbd** -d *dev*
54
+ * This program is distributed in the hope that it will be useful, but WITHOUT
175
+
55
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
176
+Description
56
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
177
+-----------
57
+ * for more details.
178
+
58
+ */
179
+Export a QEMU disk image using the NBD protocol.
59
+#ifndef NPCM_PSPI_H
180
+
60
+#define NPCM_PSPI_H
181
+Other uses:
61
+
182
+
62
+#include "hw/ssi/ssi.h"
183
+- Bind a /dev/nbdX block device to a QEMU server (on Linux).
63
+#include "hw/sysbus.h"
184
+- As a client to query exports of a remote NBD server.
64
+
185
+
65
+/*
186
+Options
66
+ * Number of registers in our device state structure. Don't change this without
187
+-------
67
+ * incrementing the version_id in the vmstate.
188
+
68
+ */
189
+.. program:: qemu-nbd
69
+#define NPCM_PSPI_NR_REGS 3
190
+
70
+
191
+*filename* is a disk image filename, or a set of block
71
+/**
192
+driver options if ``--image-opts`` is specified.
72
+ * NPCMPSPIState - Device state for one Flash Interface Unit.
193
+
73
+ * @parent: System bus device.
194
+*dev* is an NBD device.
74
+ * @mmio: Memory region for register access.
195
+
75
+ * @spi: The SPI bus mastered by this controller.
196
+.. option:: --object type,id=ID,...props...
76
+ * @regs: Register contents.
197
+
77
+ * @irq: The interrupt request queue for this module.
198
+ Define a new instance of the *type* object class identified by *ID*.
78
+ *
199
+ See the :manpage:`qemu(1)` manual page for full details of the properties
79
+ * Each PSPI has a shared bank of registers, and controls up to four chip
200
+ supported. The common object types that it makes sense to define are the
80
+ * selects. Each chip select has a dedicated memory region which may be used to
201
+ ``secret`` object, which is used to supply passwords and/or encryption
81
+ * read and write the flash connected to that chip select as if it were memory.
202
+ keys, and the ``tls-creds`` object, which is used to supply TLS
82
+ */
203
+ credentials for the qemu-nbd server or client.
83
+typedef struct NPCMPSPIState {
204
+
84
+ SysBusDevice parent;
205
+.. option:: -p, --port=PORT
85
+
206
+
86
+ MemoryRegion mmio;
207
+ TCP port to listen on as a server, or connect to as a client
87
+
208
+ (default ``10809``).
88
+ SSIBus *spi;
209
+
89
+ uint16_t regs[NPCM_PSPI_NR_REGS];
210
+.. option:: -o, --offset=OFFSET
90
+ qemu_irq irq;
211
+
91
+} NPCMPSPIState;
212
+ The offset into the image.
92
+
213
+
93
+#define TYPE_NPCM_PSPI "npcm-pspi"
214
+.. option:: -b, --bind=IFACE
94
+OBJECT_DECLARE_SIMPLE_TYPE(NPCMPSPIState, NPCM_PSPI)
215
+
95
+
216
+ The interface to bind to as a server, or connect to as a client
96
+#endif /* NPCM_PSPI_H */
217
+ (default ``0.0.0.0``).
97
diff --git a/hw/ssi/npcm_pspi.c b/hw/ssi/npcm_pspi.c
218
+
219
+.. option:: -k, --socket=PATH
220
+
221
+ Use a unix socket with path *PATH*.
222
+
223
+.. option:: --image-opts
224
+
225
+ Treat *filename* as a set of image options, instead of a plain
226
+ filename. If this flag is specified, the ``-f`` flag should
227
+ not be used, instead the :option:`format=` option should be set.
228
+
229
+.. option:: -f, --format=FMT
230
+
231
+ Force the use of the block driver for format *FMT* instead of
232
+ auto-detecting.
233
+
234
+.. option:: -r, --read-only
235
+
236
+ Export the disk as read-only.
237
+
238
+.. option:: -P, --partition=NUM
239
+
240
+ Deprecated: Only expose MBR partition *NUM*. Understands physical
241
+ partitions 1-4 and logical partition 5. New code should instead use
242
+ :option:`--image-opts` with the raw driver wrapping a subset of the
243
+ original image.
244
+
245
+.. option:: -B, --bitmap=NAME
246
+
247
+ If *filename* has a qcow2 persistent bitmap *NAME*, expose
248
+ that bitmap via the ``qemu:dirty-bitmap:NAME`` context
249
+ accessible through NBD_OPT_SET_META_CONTEXT.
250
+
251
+.. option:: -s, --snapshot
252
+
253
+ Use *filename* as an external snapshot, create a temporary
254
+ file with ``backing_file=``\ *filename*, redirect the write to
255
+ the temporary one.
256
+
257
+.. option:: -l, --load-snapshot=SNAPSHOT_PARAM
258
+
259
+ Load an internal snapshot inside *filename* and export it
260
+ as an read-only device, SNAPSHOT_PARAM format is
261
+ ``snapshot.id=[ID],snapshot.name=[NAME]`` or ``[ID_OR_NAME]``
262
+
263
+.. option:: --cache=CACHE
264
+
265
+ The cache mode to be used with the file. See the documentation of
266
+ the emulator's ``-drive cache=...`` option for allowed values.
267
+
268
+.. option:: -n, --nocache
269
+
270
+ Equivalent to :option:`--cache=none`.
271
+
272
+.. option:: --aio=AIO
273
+
274
+ Set the asynchronous I/O mode between ``threads`` (the default)
275
+ and ``native`` (Linux only).
276
+
277
+.. option:: --discard=DISCARD
278
+
279
+ Control whether ``discard`` (also known as ``trim`` or ``unmap``)
280
+ requests are ignored or passed to the filesystem. *DISCARD* is one of
281
+ ``ignore`` (or ``off``), ``unmap`` (or ``on``). The default is
282
+ ``ignore``.
283
+
284
+.. option:: --detect-zeroes=DETECT_ZEROES
285
+
286
+ Control the automatic conversion of plain zero writes by the OS to
287
+ driver-specific optimized zero write commands. *DETECT_ZEROES* is one of
288
+ ``off``, ``on``, or ``unmap``. ``unmap``
289
+ converts a zero write to an unmap operation and can only be used if
290
+ *DISCARD* is set to ``unmap``. The default is ``off``.
291
+
292
+.. option:: -c, --connect=DEV
293
+
294
+ Connect *filename* to NBD device *DEV* (Linux only).
295
+
296
+.. option:: -d, --disconnect
297
+
298
+ Disconnect the device *DEV* (Linux only).
299
+
300
+.. option:: -e, --shared=NUM
301
+
302
+ Allow up to *NUM* clients to share the device (default
303
+ ``1``). Safe for readers, but for now, consistency is not
304
+ guaranteed between multiple writers.
305
+
306
+.. option:: -t, --persistent
307
+
308
+ Don't exit on the last connection.
309
+
310
+.. option:: -x, --export-name=NAME
311
+
312
+ Set the NBD volume export name (default of a zero-length string).
313
+
314
+.. option:: -D, --description=DESCRIPTION
315
+
316
+ Set the NBD volume export description, as a human-readable
317
+ string.
318
+
319
+.. option:: -L, --list
320
+
321
+ Connect as a client and list all details about the exports exposed by
322
+ a remote NBD server. This enables list mode, and is incompatible
323
+ with options that change behavior related to a specific export (such as
324
+ :option:`--export-name`, :option:`--offset`, ...).
325
+
326
+.. option:: --tls-creds=ID
327
+
328
+ Enable mandatory TLS encryption for the server by setting the ID
329
+ of the TLS credentials object previously created with the --object
330
+ option; or provide the credentials needed for connecting as a client
331
+ in list mode.
332
+
333
+.. option:: --fork
334
+
335
+ Fork off the server process and exit the parent once the server is running.
336
+
337
+.. option:: --pid-file=PATH
338
+
339
+ Store the server's process ID in the given file.
340
+
341
+.. option:: --tls-authz=ID
342
+
343
+ Specify the ID of a qauthz object previously created with the
344
+ :option:`--object` option. This will be used to authorize connecting users
345
+ against their x509 distinguished name.
346
+
347
+.. option:: -v, --verbose
348
+
349
+ Display extra debugging information.
350
+
351
+.. option:: -h, --help
352
+
353
+ Display this help and exit.
354
+
355
+.. option:: -V, --version
356
+
357
+ Display version information and exit.
358
+
359
+.. option:: -T, --trace [[enable=]PATTERN][,events=FILE][,file=FILE]
360
+
361
+ .. include:: qemu-option-trace.rst.inc
362
+
363
+Examples
364
+--------
365
+
366
+Start a server listening on port 10809 that exposes only the
367
+guest-visible contents of a qcow2 file, with no TLS encryption, and
368
+with the default export name (an empty string). The command is
369
+one-shot, and will block until the first successful client
370
+disconnects:
371
+
372
+::
373
+
374
+ qemu-nbd -f qcow2 file.qcow2
375
+
376
+Start a long-running server listening with encryption on port 10810,
377
+and whitelist clients with a specific X.509 certificate to connect to
378
+a 1 megabyte subset of a raw file, using the export name 'subset':
379
+
380
+::
381
+
382
+ qemu-nbd \
383
+ --object tls-creds-x509,id=tls0,endpoint=server,dir=/path/to/qemutls \
384
+ --object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,\
385
+ O=Example Org,,L=London,,ST=London,,C=GB' \
386
+ --tls-creds tls0 --tls-authz auth0 \
387
+ -t -x subset -p 10810 \
388
+ --image-opts driver=raw,offset=1M,size=1M,file.driver=file,file.filename=file.raw
389
+
390
+Serve a read-only copy of just the first MBR partition of a guest
391
+image over a Unix socket with as many as 5 simultaneous readers, with
392
+a persistent process forked as a daemon:
393
+
394
+::
395
+
396
+ qemu-nbd --fork --persistent --shared=5 --socket=/path/to/sock \
397
+ --partition=1 --read-only --format=qcow2 file.qcow2
398
+
399
+Expose the guest-visible contents of a qcow2 file via a block device
400
+/dev/nbd0 (and possibly creating /dev/nbd0p1 and friends for
401
+partitions found within), then disconnect the device when done.
402
+Access to bind qemu-nbd to an /dev/nbd device generally requires root
403
+privileges, and may also require the execution of ``modprobe nbd``
404
+to enable the kernel NBD client module. *CAUTION*: Do not use
405
+this method to mount filesystems from an untrusted guest image - a
406
+malicious guest may have prepared the image to attempt to trigger
407
+kernel bugs in partition probing or file system mounting.
408
+
409
+::
410
+
411
+ qemu-nbd -c /dev/nbd0 -f qcow2 file.qcow2
412
+ qemu-nbd -d /dev/nbd0
413
+
414
+Query a remote server to see details about what export(s) it is
415
+serving on port 10809, and authenticating via PSK:
416
+
417
+::
418
+
419
+ qemu-nbd \
420
+ --object tls-creds-psk,id=tls0,dir=/tmp/keys,username=eblake,endpoint=client \
421
+ --tls-creds tls0 -L -b remote.example.com
422
+
423
+See also
424
+--------
425
+
426
+:manpage:`qemu(1)`, :manpage:`qemu-img(1)`
427
diff --git a/docs/interop/qemu-option-trace.rst.inc b/docs/interop/qemu-option-trace.rst.inc
428
new file mode 100644
98
new file mode 100644
429
index XXXXXXX..XXXXXXX
99
index XXXXXXX..XXXXXXX
430
--- /dev/null
100
--- /dev/null
431
+++ b/docs/interop/qemu-option-trace.rst.inc
101
+++ b/hw/ssi/npcm_pspi.c
432
@@ -XXX,XX +XXX,XX @@
102
@@ -XXX,XX +XXX,XX @@
433
+..
103
+/*
434
+ The contents of this file must be kept in sync with qemu-option-trace.texi
104
+ * Nuvoton NPCM Peripheral SPI Module (PSPI)
435
+ until all the users of the texi file have been converted to rst and
105
+ *
436
+ the texi file can be removed.
106
+ * Copyright 2023 Google LLC
437
+
107
+ *
438
+Specify tracing options.
108
+ * This program is free software; you can redistribute it and/or modify it
439
+
109
+ * under the terms of the GNU General Public License as published by the
440
+.. option:: [enable=]PATTERN
110
+ * Free Software Foundation; either version 2 of the License, or
441
+
111
+ * (at your option) any later version.
442
+ Immediately enable events matching *PATTERN*
112
+ *
443
+ (either event name or a globbing pattern). This option is only
113
+ * This program is distributed in the hope that it will be useful, but WITHOUT
444
+ available if QEMU has been compiled with the ``simple``, ``log``
114
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
445
+ or ``ftrace`` tracing backend. To specify multiple events or patterns,
115
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
446
+ specify the :option:`-trace` option multiple times.
116
+ * for more details.
447
+
117
+ */
448
+ Use :option:`-trace help` to print a list of names of trace points.
118
+
449
+
119
+#include "qemu/osdep.h"
450
+.. option:: events=FILE
120
+
451
+
121
+#include "hw/irq.h"
452
+ Immediately enable events listed in *FILE*.
122
+#include "hw/registerfields.h"
453
+ The file must contain one event name (as listed in the ``trace-events-all``
123
+#include "hw/ssi/npcm_pspi.h"
454
+ file) per line; globbing patterns are accepted too. This option is only
124
+#include "migration/vmstate.h"
455
+ available if QEMU has been compiled with the ``simple``, ``log`` or
125
+#include "qapi/error.h"
456
+ ``ftrace`` tracing backend.
126
+#include "qemu/error-report.h"
457
+
127
+#include "qemu/log.h"
458
+.. option:: file=FILE
128
+#include "qemu/module.h"
459
+
129
+#include "qemu/units.h"
460
+ Log output traces to *FILE*.
130
+
461
+ This option is only available if QEMU has been compiled with
131
+#include "trace.h"
462
+ the ``simple`` tracing backend.
132
+
463
diff --git a/qemu-doc.texi b/qemu-doc.texi
133
+REG16(PSPI_DATA, 0x0)
134
+REG16(PSPI_CTL1, 0x2)
135
+ FIELD(PSPI_CTL1, SPIEN, 0, 1)
136
+ FIELD(PSPI_CTL1, MOD, 2, 1)
137
+ FIELD(PSPI_CTL1, EIR, 5, 1)
138
+ FIELD(PSPI_CTL1, EIW, 6, 1)
139
+ FIELD(PSPI_CTL1, SCM, 7, 1)
140
+ FIELD(PSPI_CTL1, SCIDL, 8, 1)
141
+ FIELD(PSPI_CTL1, SCDV, 9, 7)
142
+REG16(PSPI_STAT, 0x4)
143
+ FIELD(PSPI_STAT, BSY, 0, 1)
144
+ FIELD(PSPI_STAT, RBF, 1, 1)
145
+
146
+static void npcm_pspi_update_irq(NPCMPSPIState *s)
147
+{
148
+ int level = 0;
149
+
150
+ /* Only fire IRQ when the module is enabled. */
151
+ if (FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, SPIEN)) {
152
+ /* Update interrupt as BSY is cleared. */
153
+ if ((!FIELD_EX16(s->regs[R_PSPI_STAT], PSPI_STAT, BSY)) &&
154
+ FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, EIW)) {
155
+ level = 1;
156
+ }
157
+
158
+ /* Update interrupt as RBF is set. */
159
+ if (FIELD_EX16(s->regs[R_PSPI_STAT], PSPI_STAT, RBF) &&
160
+ FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, EIR)) {
161
+ level = 1;
162
+ }
163
+ }
164
+ qemu_set_irq(s->irq, level);
165
+}
166
+
167
+static uint16_t npcm_pspi_read_data(NPCMPSPIState *s)
168
+{
169
+ uint16_t value = s->regs[R_PSPI_DATA];
170
+
171
+ /* Clear stat bits as the value are read out. */
172
+ s->regs[R_PSPI_STAT] = 0;
173
+
174
+ return value;
175
+}
176
+
177
+static void npcm_pspi_write_data(NPCMPSPIState *s, uint16_t data)
178
+{
179
+ uint16_t value = 0;
180
+
181
+ if (FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, MOD)) {
182
+ value = ssi_transfer(s->spi, extract16(data, 8, 8)) << 8;
183
+ }
184
+ value |= ssi_transfer(s->spi, extract16(data, 0, 8));
185
+ s->regs[R_PSPI_DATA] = value;
186
+
187
+ /* Mark data as available */
188
+ s->regs[R_PSPI_STAT] = R_PSPI_STAT_BSY_MASK | R_PSPI_STAT_RBF_MASK;
189
+}
190
+
191
+/* Control register read handler. */
192
+static uint64_t npcm_pspi_ctrl_read(void *opaque, hwaddr addr,
193
+ unsigned int size)
194
+{
195
+ NPCMPSPIState *s = opaque;
196
+ uint16_t value;
197
+
198
+ switch (addr) {
199
+ case A_PSPI_DATA:
200
+ value = npcm_pspi_read_data(s);
201
+ break;
202
+
203
+ case A_PSPI_CTL1:
204
+ value = s->regs[R_PSPI_CTL1];
205
+ break;
206
+
207
+ case A_PSPI_STAT:
208
+ value = s->regs[R_PSPI_STAT];
209
+ break;
210
+
211
+ default:
212
+ qemu_log_mask(LOG_GUEST_ERROR,
213
+ "%s: write to invalid offset 0x%" PRIx64 "\n",
214
+ DEVICE(s)->canonical_path, addr);
215
+ return 0;
216
+ }
217
+ trace_npcm_pspi_ctrl_read(DEVICE(s)->canonical_path, addr, value);
218
+ npcm_pspi_update_irq(s);
219
+
220
+ return value;
221
+}
222
+
223
+/* Control register write handler. */
224
+static void npcm_pspi_ctrl_write(void *opaque, hwaddr addr, uint64_t v,
225
+ unsigned int size)
226
+{
227
+ NPCMPSPIState *s = opaque;
228
+ uint16_t value = v;
229
+
230
+ trace_npcm_pspi_ctrl_write(DEVICE(s)->canonical_path, addr, value);
231
+
232
+ switch (addr) {
233
+ case A_PSPI_DATA:
234
+ npcm_pspi_write_data(s, value);
235
+ break;
236
+
237
+ case A_PSPI_CTL1:
238
+ s->regs[R_PSPI_CTL1] = value;
239
+ break;
240
+
241
+ case A_PSPI_STAT:
242
+ qemu_log_mask(LOG_GUEST_ERROR,
243
+ "%s: write to read-only register PSPI_STAT: 0x%08"
244
+ PRIx64 "\n", DEVICE(s)->canonical_path, v);
245
+ break;
246
+
247
+ default:
248
+ qemu_log_mask(LOG_GUEST_ERROR,
249
+ "%s: write to invalid offset 0x%" PRIx64 "\n",
250
+ DEVICE(s)->canonical_path, addr);
251
+ return;
252
+ }
253
+ npcm_pspi_update_irq(s);
254
+}
255
+
256
+static const MemoryRegionOps npcm_pspi_ctrl_ops = {
257
+ .read = npcm_pspi_ctrl_read,
258
+ .write = npcm_pspi_ctrl_write,
259
+ .endianness = DEVICE_LITTLE_ENDIAN,
260
+ .valid = {
261
+ .min_access_size = 1,
262
+ .max_access_size = 2,
263
+ .unaligned = false,
264
+ },
265
+ .impl = {
266
+ .min_access_size = 2,
267
+ .max_access_size = 2,
268
+ .unaligned = false,
269
+ },
270
+};
271
+
272
+static void npcm_pspi_enter_reset(Object *obj, ResetType type)
273
+{
274
+ NPCMPSPIState *s = NPCM_PSPI(obj);
275
+
276
+ trace_npcm_pspi_enter_reset(DEVICE(obj)->canonical_path, type);
277
+ memset(s->regs, 0, sizeof(s->regs));
278
+}
279
+
280
+static void npcm_pspi_realize(DeviceState *dev, Error **errp)
281
+{
282
+ NPCMPSPIState *s = NPCM_PSPI(dev);
283
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
284
+ Object *obj = OBJECT(dev);
285
+
286
+ s->spi = ssi_create_bus(dev, "pspi");
287
+ memory_region_init_io(&s->mmio, obj, &npcm_pspi_ctrl_ops, s,
288
+ "mmio", 4 * KiB);
289
+ sysbus_init_mmio(sbd, &s->mmio);
290
+ sysbus_init_irq(sbd, &s->irq);
291
+}
292
+
293
+static const VMStateDescription vmstate_npcm_pspi = {
294
+ .name = "npcm-pspi",
295
+ .version_id = 0,
296
+ .minimum_version_id = 0,
297
+ .fields = (VMStateField[]) {
298
+ VMSTATE_UINT16_ARRAY(regs, NPCMPSPIState, NPCM_PSPI_NR_REGS),
299
+ VMSTATE_END_OF_LIST(),
300
+ },
301
+};
302
+
303
+
304
+static void npcm_pspi_class_init(ObjectClass *klass, void *data)
305
+{
306
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
307
+ DeviceClass *dc = DEVICE_CLASS(klass);
308
+
309
+ dc->desc = "NPCM Peripheral SPI Module";
310
+ dc->realize = npcm_pspi_realize;
311
+ dc->vmsd = &vmstate_npcm_pspi;
312
+ rc->phases.enter = npcm_pspi_enter_reset;
313
+}
314
+
315
+static const TypeInfo npcm_pspi_types[] = {
316
+ {
317
+ .name = TYPE_NPCM_PSPI,
318
+ .parent = TYPE_SYS_BUS_DEVICE,
319
+ .instance_size = sizeof(NPCMPSPIState),
320
+ .class_init = npcm_pspi_class_init,
321
+ },
322
+};
323
+DEFINE_TYPES(npcm_pspi_types);
324
diff --git a/hw/ssi/meson.build b/hw/ssi/meson.build
464
index XXXXXXX..XXXXXXX 100644
325
index XXXXXXX..XXXXXXX 100644
465
--- a/qemu-doc.texi
326
--- a/hw/ssi/meson.build
466
+++ b/qemu-doc.texi
327
+++ b/hw/ssi/meson.build
467
@@ -XXX,XX +XXX,XX @@ encrypted disk images.
468
* disk_images_snapshot_mode:: Snapshot mode
469
* vm_snapshots:: VM snapshots
470
* qemu_img_invocation:: qemu-img Invocation
471
-* qemu_nbd_invocation:: qemu-nbd Invocation
472
* disk_images_formats:: Disk image file formats
473
* host_drives:: Using host drives
474
* disk_images_fat_images:: Virtual FAT disk images
475
@@ -XXX,XX +XXX,XX @@ state is not saved or restored properly (in particular USB).
476
477
@include qemu-img.texi
478
479
-@node qemu_nbd_invocation
480
-@subsection @code{qemu-nbd} Invocation
481
-
482
-@include qemu-nbd.texi
483
-
484
@include docs/qemu-block-drivers.texi
485
486
@node pcsys_network
487
diff --git a/qemu-nbd.texi b/qemu-nbd.texi
488
deleted file mode 100644
489
index XXXXXXX..XXXXXXX
490
--- a/qemu-nbd.texi
491
+++ /dev/null
492
@@ -XXX,XX +XXX,XX @@
328
@@ -XXX,XX +XXX,XX @@
493
-@example
329
softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_smc.c'))
494
-@c man begin SYNOPSIS
330
softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('mss-spi.c'))
495
-@command{qemu-nbd} [OPTION]... @var{filename}
331
-softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_fiu.c'))
496
-
332
+softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_fiu.c', 'npcm_pspi.c'))
497
-@command{qemu-nbd} @option{-L} [OPTION]...
333
softmmu_ss.add(when: 'CONFIG_PL022', if_true: files('pl022.c'))
498
-
334
softmmu_ss.add(when: 'CONFIG_SIFIVE_SPI', if_true: files('sifive_spi.c'))
499
-@command{qemu-nbd} @option{-d} @var{dev}
335
softmmu_ss.add(when: 'CONFIG_SSI', if_true: files('ssi.c'))
500
-@c man end
336
diff --git a/hw/ssi/trace-events b/hw/ssi/trace-events
501
-@end example
502
-
503
-@c man begin DESCRIPTION
504
-
505
-Export a QEMU disk image using the NBD protocol.
506
-
507
-Other uses:
508
-@itemize
509
-@item
510
-Bind a /dev/nbdX block device to a QEMU server (on Linux).
511
-@item
512
-As a client to query exports of a remote NBD server.
513
-@end itemize
514
-
515
-@c man end
516
-
517
-@c man begin OPTIONS
518
-@var{filename} is a disk image filename, or a set of block
519
-driver options if @option{--image-opts} is specified.
520
-
521
-@var{dev} is an NBD device.
522
-
523
-@table @option
524
-@item --object type,id=@var{id},...props...
525
-Define a new instance of the @var{type} object class identified by @var{id}.
526
-See the @code{qemu(1)} manual page for full details of the properties
527
-supported. The common object types that it makes sense to define are the
528
-@code{secret} object, which is used to supply passwords and/or encryption
529
-keys, and the @code{tls-creds} object, which is used to supply TLS
530
-credentials for the qemu-nbd server or client.
531
-@item -p, --port=@var{port}
532
-The TCP port to listen on as a server, or connect to as a client
533
-(default @samp{10809}).
534
-@item -o, --offset=@var{offset}
535
-The offset into the image.
536
-@item -b, --bind=@var{iface}
537
-The interface to bind to as a server, or connect to as a client
538
-(default @samp{0.0.0.0}).
539
-@item -k, --socket=@var{path}
540
-Use a unix socket with path @var{path}.
541
-@item --image-opts
542
-Treat @var{filename} as a set of image options, instead of a plain
543
-filename. If this flag is specified, the @var{-f} flag should
544
-not be used, instead the '@code{format=}' option should be set.
545
-@item -f, --format=@var{fmt}
546
-Force the use of the block driver for format @var{fmt} instead of
547
-auto-detecting.
548
-@item -r, --read-only
549
-Export the disk as read-only.
550
-@item -P, --partition=@var{num}
551
-Deprecated: Only expose MBR partition @var{num}. Understands physical
552
-partitions 1-4 and logical partition 5. New code should instead use
553
-@option{--image-opts} with the raw driver wrapping a subset of the
554
-original image.
555
-@item -B, --bitmap=@var{name}
556
-If @var{filename} has a qcow2 persistent bitmap @var{name}, expose
557
-that bitmap via the ``qemu:dirty-bitmap:@var{name}'' context
558
-accessible through NBD_OPT_SET_META_CONTEXT.
559
-@item -s, --snapshot
560
-Use @var{filename} as an external snapshot, create a temporary
561
-file with backing_file=@var{filename}, redirect the write to
562
-the temporary one.
563
-@item -l, --load-snapshot=@var{snapshot_param}
564
-Load an internal snapshot inside @var{filename} and export it
565
-as an read-only device, @var{snapshot_param} format is
566
-'snapshot.id=[ID],snapshot.name=[NAME]' or '[ID_OR_NAME]'
567
-@item -n, --nocache
568
-@itemx --cache=@var{cache}
569
-The cache mode to be used with the file. See the documentation of
570
-the emulator's @code{-drive cache=...} option for allowed values.
571
-@item --aio=@var{aio}
572
-Set the asynchronous I/O mode between @samp{threads} (the default)
573
-and @samp{native} (Linux only).
574
-@item --discard=@var{discard}
575
-Control whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap})
576
-requests are ignored or passed to the filesystem. @var{discard} is one of
577
-@samp{ignore} (or @samp{off}), @samp{unmap} (or @samp{on}). The default is
578
-@samp{ignore}.
579
-@item --detect-zeroes=@var{detect-zeroes}
580
-Control the automatic conversion of plain zero writes by the OS to
581
-driver-specific optimized zero write commands. @var{detect-zeroes} is one of
582
-@samp{off}, @samp{on} or @samp{unmap}. @samp{unmap}
583
-converts a zero write to an unmap operation and can only be used if
584
-@var{discard} is set to @samp{unmap}. The default is @samp{off}.
585
-@item -c, --connect=@var{dev}
586
-Connect @var{filename} to NBD device @var{dev} (Linux only).
587
-@item -d, --disconnect
588
-Disconnect the device @var{dev} (Linux only).
589
-@item -e, --shared=@var{num}
590
-Allow up to @var{num} clients to share the device (default
591
-@samp{1}). Safe for readers, but for now, consistency is not
592
-guaranteed between multiple writers.
593
-@item -t, --persistent
594
-Don't exit on the last connection.
595
-@item -x, --export-name=@var{name}
596
-Set the NBD volume export name (default of a zero-length string).
597
-@item -D, --description=@var{description}
598
-Set the NBD volume export description, as a human-readable
599
-string.
600
-@item -L, --list
601
-Connect as a client and list all details about the exports exposed by
602
-a remote NBD server. This enables list mode, and is incompatible
603
-with options that change behavior related to a specific export (such as
604
-@option{--export-name}, @option{--offset}, ...).
605
-@item --tls-creds=ID
606
-Enable mandatory TLS encryption for the server by setting the ID
607
-of the TLS credentials object previously created with the --object
608
-option; or provide the credentials needed for connecting as a client
609
-in list mode.
610
-@item --fork
611
-Fork off the server process and exit the parent once the server is running.
612
-@item --pid-file=PATH
613
-Store the server's process ID in the given file.
614
-@item --tls-authz=ID
615
-Specify the ID of a qauthz object previously created with the
616
---object option. This will be used to authorize connecting users
617
-against their x509 distinguished name.
618
-@item -v, --verbose
619
-Display extra debugging information.
620
-@item -h, --help
621
-Display this help and exit.
622
-@item -V, --version
623
-Display version information and exit.
624
-@item -T, --trace [[enable=]@var{pattern}][,events=@var{file}][,file=@var{file}]
625
-@findex --trace
626
-@include qemu-option-trace.texi
627
-@end table
628
-
629
-@c man end
630
-
631
-@c man begin EXAMPLES
632
-Start a server listening on port 10809 that exposes only the
633
-guest-visible contents of a qcow2 file, with no TLS encryption, and
634
-with the default export name (an empty string). The command is
635
-one-shot, and will block until the first successful client
636
-disconnects:
637
-
638
-@example
639
-qemu-nbd -f qcow2 file.qcow2
640
-@end example
641
-
642
-Start a long-running server listening with encryption on port 10810,
643
-and whitelist clients with a specific X.509 certificate to connect to
644
-a 1 megabyte subset of a raw file, using the export name 'subset':
645
-
646
-@example
647
-qemu-nbd \
648
- --object tls-creds-x509,id=tls0,endpoint=server,dir=/path/to/qemutls \
649
- --object 'authz-simple,id=auth0,identity=CN=laptop.example.com,,\
650
- O=Example Org,,L=London,,ST=London,,C=GB' \
651
- --tls-creds tls0 --tls-authz auth0 \
652
- -t -x subset -p 10810 \
653
- --image-opts driver=raw,offset=1M,size=1M,file.driver=file,file.filename=file.raw
654
-@end example
655
-
656
-Serve a read-only copy of just the first MBR partition of a guest
657
-image over a Unix socket with as many as 5 simultaneous readers, with
658
-a persistent process forked as a daemon:
659
-
660
-@example
661
-qemu-nbd --fork --persistent --shared=5 --socket=/path/to/sock \
662
- --partition=1 --read-only --format=qcow2 file.qcow2
663
-@end example
664
-
665
-Expose the guest-visible contents of a qcow2 file via a block device
666
-/dev/nbd0 (and possibly creating /dev/nbd0p1 and friends for
667
-partitions found within), then disconnect the device when done.
668
-Access to bind qemu-nbd to an /dev/nbd device generally requires root
669
-privileges, and may also require the execution of @code{modprobe nbd}
670
-to enable the kernel NBD client module. @emph{CAUTION}: Do not use
671
-this method to mount filesystems from an untrusted guest image - a
672
-malicious guest may have prepared the image to attempt to trigger
673
-kernel bugs in partition probing or file system mounting.
674
-
675
-@example
676
-qemu-nbd -c /dev/nbd0 -f qcow2 file.qcow2
677
-qemu-nbd -d /dev/nbd0
678
-@end example
679
-
680
-Query a remote server to see details about what export(s) it is
681
-serving on port 10809, and authenticating via PSK:
682
-
683
-@example
684
-qemu-nbd \
685
- --object tls-creds-psk,id=tls0,dir=/tmp/keys,username=eblake,endpoint=client \
686
- --tls-creds tls0 -L -b remote.example.com
687
-@end example
688
-
689
-@c man end
690
-
691
-@ignore
692
-
693
-@setfilename qemu-nbd
694
-@settitle QEMU Disk Network Block Device Server
695
-
696
-@c man begin AUTHOR
697
-Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>.
698
-This is free software; see the source for copying conditions. There is NO
699
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
700
-@c man end
701
-
702
-@c man begin SEEALSO
703
-qemu(1), qemu-img(1)
704
-@c man end
705
-
706
-@end ignore
707
diff --git a/qemu-option-trace.texi b/qemu-option-trace.texi
708
index XXXXXXX..XXXXXXX 100644
337
index XXXXXXX..XXXXXXX 100644
709
--- a/qemu-option-trace.texi
338
--- a/hw/ssi/trace-events
710
+++ b/qemu-option-trace.texi
339
+++ b/hw/ssi/trace-events
711
@@ -XXX,XX +XXX,XX @@
340
@@ -XXX,XX +XXX,XX @@ npcm7xx_fiu_ctrl_write(const char *id, uint64_t addr, uint32_t data) "%s offset:
712
+@c The contents of this file must be kept in sync with qemu-option-trace.rst.inc
341
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
713
+@c until all the users of the texi file have been converted to rst and
342
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
714
+@c the texi file can be removed.
343
715
+
344
+# npcm_pspi.c
716
Specify tracing options.
345
+npcm_pspi_enter_reset(const char *id, int reset_type) "%s reset type: %d"
717
346
+npcm_pspi_ctrl_read(const char *id, uint64_t addr, uint16_t data) "%s offset: 0x%03" PRIx64 " value: 0x%04" PRIx16
718
@table @option
347
+npcm_pspi_ctrl_write(const char *id, uint64_t addr, uint16_t data) "%s offset: 0x%03" PRIx64 " value: 0x%04" PRIx16
348
+
349
# ibex_spi_host.c
350
351
ibex_spi_host_reset(const char *msg) "%s"
719
--
352
--
720
2.20.1
353
2.34.1
721
722
diff view generated by jsdifflib
New patch
1
From: Hao Wu <wuhaotsh@google.com>
1
2
3
Signed-off-by: Hao Wu <wuhaotsh@google.com>
4
Reviewed-by: Titus Rwantare <titusr@google.com>
5
Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org>
6
Message-id: 20230208235433.3989937-4-wuhaotsh@google.com
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
9
docs/system/arm/nuvoton.rst | 2 +-
10
include/hw/arm/npcm7xx.h | 2 ++
11
hw/arm/npcm7xx.c | 25 +++++++++++++++++++++++--
12
3 files changed, 26 insertions(+), 3 deletions(-)
13
14
diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst
15
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/arm/nuvoton.rst
17
+++ b/docs/system/arm/nuvoton.rst
18
@@ -XXX,XX +XXX,XX @@ Supported devices
19
* SMBus controller (SMBF)
20
* Ethernet controller (EMC)
21
* Tachometer
22
+ * Peripheral SPI controller (PSPI)
23
24
Missing devices
25
---------------
26
@@ -XXX,XX +XXX,XX @@ Missing devices
27
28
* Ethernet controller (GMAC)
29
* USB device (USBD)
30
- * Peripheral SPI controller (PSPI)
31
* SD/MMC host
32
* PECI interface
33
* PCI and PCIe root complex and bridges
34
diff --git a/include/hw/arm/npcm7xx.h b/include/hw/arm/npcm7xx.h
35
index XXXXXXX..XXXXXXX 100644
36
--- a/include/hw/arm/npcm7xx.h
37
+++ b/include/hw/arm/npcm7xx.h
38
@@ -XXX,XX +XXX,XX @@
39
#include "hw/nvram/npcm7xx_otp.h"
40
#include "hw/timer/npcm7xx_timer.h"
41
#include "hw/ssi/npcm7xx_fiu.h"
42
+#include "hw/ssi/npcm_pspi.h"
43
#include "hw/usb/hcd-ehci.h"
44
#include "hw/usb/hcd-ohci.h"
45
#include "target/arm/cpu.h"
46
@@ -XXX,XX +XXX,XX @@ struct NPCM7xxState {
47
NPCM7xxFIUState fiu[2];
48
NPCM7xxEMCState emc[2];
49
NPCM7xxSDHCIState mmc;
50
+ NPCMPSPIState pspi[2];
51
};
52
53
#define TYPE_NPCM7XX "npcm7xx"
54
diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c
55
index XXXXXXX..XXXXXXX 100644
56
--- a/hw/arm/npcm7xx.c
57
+++ b/hw/arm/npcm7xx.c
58
@@ -XXX,XX +XXX,XX @@ enum NPCM7xxInterrupt {
59
NPCM7XX_EMC1RX_IRQ = 15,
60
NPCM7XX_EMC1TX_IRQ,
61
NPCM7XX_MMC_IRQ = 26,
62
+ NPCM7XX_PSPI2_IRQ = 28,
63
+ NPCM7XX_PSPI1_IRQ = 31,
64
NPCM7XX_TIMER0_IRQ = 32, /* Timer Module 0 */
65
NPCM7XX_TIMER1_IRQ,
66
NPCM7XX_TIMER2_IRQ,
67
@@ -XXX,XX +XXX,XX @@ static const hwaddr npcm7xx_emc_addr[] = {
68
0xf0826000,
69
};
70
71
+/* Register base address for each PSPI Module */
72
+static const hwaddr npcm7xx_pspi_addr[] = {
73
+ 0xf0200000,
74
+ 0xf0201000,
75
+};
76
+
77
static const struct {
78
hwaddr regs_addr;
79
uint32_t unconnected_pins;
80
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_init(Object *obj)
81
object_initialize_child(obj, "emc[*]", &s->emc[i], TYPE_NPCM7XX_EMC);
82
}
83
84
+ for (i = 0; i < ARRAY_SIZE(s->pspi); i++) {
85
+ object_initialize_child(obj, "pspi[*]", &s->pspi[i], TYPE_NPCM_PSPI);
86
+ }
87
+
88
object_initialize_child(obj, "mmc", &s->mmc, TYPE_NPCM7XX_SDHCI);
89
}
90
91
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
92
sysbus_connect_irq(SYS_BUS_DEVICE(&s->mmc), 0,
93
npcm7xx_irq(s, NPCM7XX_MMC_IRQ));
94
95
+ /* PSPI */
96
+ QEMU_BUILD_BUG_ON(ARRAY_SIZE(npcm7xx_pspi_addr) != ARRAY_SIZE(s->pspi));
97
+ for (i = 0; i < ARRAY_SIZE(s->pspi); i++) {
98
+ SysBusDevice *sbd = SYS_BUS_DEVICE(&s->pspi[i]);
99
+ int irq = (i == 0) ? NPCM7XX_PSPI1_IRQ : NPCM7XX_PSPI2_IRQ;
100
+
101
+ sysbus_realize(sbd, &error_abort);
102
+ sysbus_mmio_map(sbd, 0, npcm7xx_pspi_addr[i]);
103
+ sysbus_connect_irq(sbd, 0, npcm7xx_irq(s, irq));
104
+ }
105
+
106
create_unimplemented_device("npcm7xx.shm", 0xc0001000, 4 * KiB);
107
create_unimplemented_device("npcm7xx.vdmx", 0xe0800000, 4 * KiB);
108
create_unimplemented_device("npcm7xx.pcierc", 0xe1000000, 64 * KiB);
109
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
110
create_unimplemented_device("npcm7xx.peci", 0xf0100000, 4 * KiB);
111
create_unimplemented_device("npcm7xx.siox[1]", 0xf0101000, 4 * KiB);
112
create_unimplemented_device("npcm7xx.siox[2]", 0xf0102000, 4 * KiB);
113
- create_unimplemented_device("npcm7xx.pspi1", 0xf0200000, 4 * KiB);
114
- create_unimplemented_device("npcm7xx.pspi2", 0xf0201000, 4 * KiB);
115
create_unimplemented_device("npcm7xx.ahbpci", 0xf0400000, 1 * MiB);
116
create_unimplemented_device("npcm7xx.mcphy", 0xf05f0000, 64 * KiB);
117
create_unimplemented_device("npcm7xx.gmac1", 0xf0802000, 8 * KiB);
118
--
119
2.34.1
diff view generated by jsdifflib
New patch
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
2
3
Addresses targeting the second translation table (TTB1) in the SMMU have
4
all upper bits set. Ensure the IOMMU region covers all 64 bits.
5
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Message-id: 20230214171921.1917916-2-jean-philippe@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
include/hw/arm/smmu-common.h | 2 --
13
hw/arm/smmu-common.c | 2 +-
14
2 files changed, 1 insertion(+), 3 deletions(-)
15
16
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/smmu-common.h
19
+++ b/include/hw/arm/smmu-common.h
20
@@ -XXX,XX +XXX,XX @@
21
#define SMMU_PCI_DEVFN_MAX 256
22
#define SMMU_PCI_DEVFN(sid) (sid & 0xFF)
23
24
-#define SMMU_MAX_VA_BITS 48
25
-
26
/*
27
* Page table walk error types
28
*/
29
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
30
index XXXXXXX..XXXXXXX 100644
31
--- a/hw/arm/smmu-common.c
32
+++ b/hw/arm/smmu-common.c
33
@@ -XXX,XX +XXX,XX @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
34
35
memory_region_init_iommu(&sdev->iommu, sizeof(sdev->iommu),
36
s->mrtypename,
37
- OBJECT(s), name, 1ULL << SMMU_MAX_VA_BITS);
38
+ OBJECT(s), name, UINT64_MAX);
39
address_space_init(&sdev->as,
40
MEMORY_REGION(&sdev->iommu), name);
41
trace_smmu_add_mr(name);
42
--
43
2.34.1
diff view generated by jsdifflib
New patch
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
2
3
Addresses targeting the second translation table (TTB1) in the SMMU have
4
all upper bits set (except for the top byte when TBI is enabled). Fix
5
the TTB1 check.
6
7
Reported-by: Ola Hugosson <ola.hugosson@arm.com>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
11
Message-id: 20230214171921.1917916-3-jean-philippe@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
hw/arm/smmu-common.c | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
16
17
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/smmu-common.c
20
+++ b/hw/arm/smmu-common.c
21
@@ -XXX,XX +XXX,XX @@ SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova)
22
/* there is a ttbr0 region and we are in it (high bits all zero) */
23
return &cfg->tt[0];
24
} else if (cfg->tt[1].tsz &&
25
- !extract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte)) {
26
+ sextract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte) == -1) {
27
/* there is a ttbr1 region and we are in it (high bits all one) */
28
return &cfg->tt[1];
29
} else if (!cfg->tt[0].tsz) {
30
--
31
2.34.1
diff view generated by jsdifflib
1
From: Vincent Dehors <vincent.dehors@smile.fr>
1
From: Claudio Fontana <cfontana@suse.de>
2
2
3
In the PAC computation, sbox was applied over wrong bits.
3
make it clearer from the name that this is a tcg-only function.
4
As this is a 4-bit sbox, bit index should be incremented by 4 instead of 16.
5
4
6
Test vector from QARMA paper (https://eprint.iacr.org/2016/444.pdf) was
5
Signed-off-by: Claudio Fontana <cfontana@suse.de>
7
used to verify one computation of the pauth_computepac() function which
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
8
uses sbox2.
9
10
Launchpad: https://bugs.launchpad.net/bugs/1859713
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Signed-off-by: Vincent DEHORS <vincent.dehors@smile.fr>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Signed-off-by: Adrien GRASSEIN <adrien.grassein@smile.fr>
9
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Message-id: 20200116230809.19078-2-richard.henderson@linaro.org
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
11
---
18
target/arm/pauth_helper.c | 4 ++--
12
target/arm/helper.c | 4 ++--
19
1 file changed, 2 insertions(+), 2 deletions(-)
13
1 file changed, 2 insertions(+), 2 deletions(-)
20
14
21
diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
22
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/pauth_helper.c
17
--- a/target/arm/helper.c
24
+++ b/target/arm/pauth_helper.c
18
+++ b/target/arm/helper.c
25
@@ -XXX,XX +XXX,XX @@ static uint64_t pac_sub(uint64_t i)
19
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
26
uint64_t o = 0;
20
* trapped to the hypervisor in KVM.
27
int b;
21
*/
28
22
#ifdef CONFIG_TCG
29
- for (b = 0; b < 64; b += 16) {
23
-static void handle_semihosting(CPUState *cs)
30
+ for (b = 0; b < 64; b += 4) {
24
+static void tcg_handle_semihosting(CPUState *cs)
31
o |= (uint64_t)sub[(i >> b) & 0xf] << b;
25
{
26
ARMCPU *cpu = ARM_CPU(cs);
27
CPUARMState *env = &cpu->env;
28
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs)
29
*/
30
#ifdef CONFIG_TCG
31
if (cs->exception_index == EXCP_SEMIHOST) {
32
- handle_semihosting(cs);
33
+ tcg_handle_semihosting(cs);
34
return;
32
}
35
}
33
return o;
36
#endif
34
@@ -XXX,XX +XXX,XX @@ static uint64_t pac_inv_sub(uint64_t i)
35
uint64_t o = 0;
36
int b;
37
38
- for (b = 0; b < 64; b += 16) {
39
+ for (b = 0; b < 64; b += 4) {
40
o |= (uint64_t)inv_sub[(i >> b) & 0xf] << b;
41
}
42
return o;
43
--
37
--
44
2.20.1
38
2.34.1
45
39
46
40
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Claudio Fontana <cfontana@suse.de>
2
2
3
Replace debug code with tracing to aid debugging.
3
for "all" builds (tcg + kvm), we want to avoid doing
4
the psci check if tcg is built-in, but not enabled.
4
5
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Claudio Fontana <cfontana@suse.de>
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20200123052540.6132-5-linux@roeck-us.net
8
Signed-off-by: Fabiano Rosas <farosas@suse.de>
9
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
11
---
10
hw/char/exynos4210_uart.c | 96 ++++++++++++---------------------------
12
target/arm/helper.c | 3 ++-
11
hw/char/trace-events | 17 +++++++
13
1 file changed, 2 insertions(+), 1 deletion(-)
12
2 files changed, 47 insertions(+), 66 deletions(-)
13
14
14
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/char/exynos4210_uart.c
17
--- a/target/arm/helper.c
17
+++ b/hw/char/exynos4210_uart.c
18
+++ b/target/arm/helper.c
18
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@
19
#include "hw/irq.h"
20
#include "hw/irq.h"
20
#include "hw/qdev-properties.h"
21
#include "sysemu/cpu-timers.h"
21
22
#include "sysemu/kvm.h"
22
-#undef DEBUG_UART
23
+#include "sysemu/tcg.h"
23
-#undef DEBUG_UART_EXTEND
24
#include "qapi/qapi-commands-machine-target.h"
24
-#undef DEBUG_IRQ
25
#include "qapi/error.h"
25
-#undef DEBUG_Rx_DATA
26
#include "qemu/guest-random.h"
26
-#undef DEBUG_Tx_DATA
27
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs)
27
-
28
env->exception.syndrome);
28
-#define DEBUG_UART 0
29
-#define DEBUG_UART_EXTEND 0
30
-#define DEBUG_IRQ 0
31
-#define DEBUG_Rx_DATA 0
32
-#define DEBUG_Tx_DATA 0
33
-
34
-#if DEBUG_UART
35
-#define PRINT_DEBUG(fmt, args...) \
36
- do { \
37
- fprintf(stderr, " [%s:%d] "fmt, __func__, __LINE__, ##args); \
38
- } while (0)
39
-
40
-#if DEBUG_UART_EXTEND
41
-#define PRINT_DEBUG_EXTEND(fmt, args...) \
42
- do { \
43
- fprintf(stderr, " [%s:%d] "fmt, __func__, __LINE__, ##args); \
44
- } while (0)
45
-#else
46
-#define PRINT_DEBUG_EXTEND(fmt, args...) \
47
- do {} while (0)
48
-#endif /* EXTEND */
49
-
50
-#else
51
-#define PRINT_DEBUG(fmt, args...) \
52
- do {} while (0)
53
-#define PRINT_DEBUG_EXTEND(fmt, args...) \
54
- do {} while (0)
55
-#endif
56
-
57
-#define PRINT_ERROR(fmt, args...) \
58
- do { \
59
- fprintf(stderr, " [%s:%d] "fmt, __func__, __LINE__, ##args); \
60
- } while (0)
61
+#include "trace.h"
62
63
/*
64
* Offsets for UART registers relative to SFR base address
65
@@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210UartState {
66
} Exynos4210UartState;
67
68
69
-#if DEBUG_UART
70
-/* Used only for debugging inside PRINT_DEBUG_... macros */
71
+/* Used only for tracing */
72
static const char *exynos4210_uart_regname(hwaddr offset)
73
{
74
75
@@ -XXX,XX +XXX,XX @@ static const char *exynos4210_uart_regname(hwaddr offset)
76
77
return NULL;
78
}
79
-#endif
80
81
82
static void fifo_store(Exynos4210UartFIFO *q, uint8_t ch)
83
@@ -XXX,XX +XXX,XX @@ static uint32_t exynos4210_uart_Tx_FIFO_trigger_level(const Exynos4210UartState
84
break;
85
default:
86
level = 0;
87
- PRINT_ERROR("Wrong UART channel number: %d\n", s->channel);
88
+ trace_exynos_uart_channel_error(s->channel);
89
}
29
}
90
30
91
return level;
31
- if (arm_is_psci_call(cpu, cs->exception_index)) {
92
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_update_irq(Exynos4210UartState *s)
32
+ if (tcg_enabled() && arm_is_psci_call(cpu, cs->exception_index)) {
93
33
arm_handle_psci_call(cpu);
94
if (s->reg[I_(UINTP)]) {
34
qemu_log_mask(CPU_LOG_INT, "...handled as PSCI call\n");
95
qemu_irq_raise(s->irq);
35
return;
96
-
97
-#if DEBUG_IRQ
98
- fprintf(stderr, "UART%d: IRQ has been raised: %08x\n",
99
- s->channel, s->reg[I_(UINTP)]);
100
-#endif
101
-
102
+ trace_exynos_uart_irq_raised(s->channel, s->reg[I_(UINTP)]);
103
} else {
104
qemu_irq_lower(s->irq);
105
+ trace_exynos_uart_irq_lowered(s->channel);
106
}
107
}
108
109
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_update_parameters(Exynos4210UartState *s)
110
111
qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
112
113
- PRINT_DEBUG("UART%d: speed: %d, parity: %c, data: %d, stop: %d\n",
114
+ trace_exynos_uart_update_params(
115
s->channel, speed, parity, data_bits, stop_bits);
116
}
117
118
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_write(void *opaque, hwaddr offset,
119
Exynos4210UartState *s = (Exynos4210UartState *)opaque;
120
uint8_t ch;
121
122
- PRINT_DEBUG_EXTEND("UART%d: <0x%04x> %s <- 0x%08llx\n", s->channel,
123
- offset, exynos4210_uart_regname(offset), (long long unsigned int)val);
124
+ trace_exynos_uart_write(s->channel, offset,
125
+ exynos4210_uart_regname(offset), val);
126
127
switch (offset) {
128
case ULCON:
129
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_write(void *opaque, hwaddr offset,
130
if (val & UFCON_Rx_FIFO_RESET) {
131
fifo_reset(&s->rx);
132
s->reg[I_(UFCON)] &= ~UFCON_Rx_FIFO_RESET;
133
- PRINT_DEBUG("UART%d: Rx FIFO Reset\n", s->channel);
134
+ trace_exynos_uart_rx_fifo_reset(s->channel);
135
}
136
if (val & UFCON_Tx_FIFO_RESET) {
137
fifo_reset(&s->tx);
138
s->reg[I_(UFCON)] &= ~UFCON_Tx_FIFO_RESET;
139
- PRINT_DEBUG("UART%d: Tx FIFO Reset\n", s->channel);
140
+ trace_exynos_uart_tx_fifo_reset(s->channel);
141
}
142
break;
143
144
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_write(void *opaque, hwaddr offset,
145
/* XXX this blocks entire thread. Rewrite to use
146
* qemu_chr_fe_write and background I/O callbacks */
147
qemu_chr_fe_write_all(&s->chr, &ch, 1);
148
-#if DEBUG_Tx_DATA
149
- fprintf(stderr, "%c", ch);
150
-#endif
151
+ trace_exynos_uart_tx(s->channel, ch);
152
s->reg[I_(UTRSTAT)] |= UTRSTAT_TRANSMITTER_EMPTY |
153
UTRSTAT_Tx_BUFFER_EMPTY;
154
s->reg[I_(UINTSP)] |= UINTSP_TXD;
155
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_write(void *opaque, hwaddr offset,
156
case UINTP:
157
s->reg[I_(UINTP)] &= ~val;
158
s->reg[I_(UINTSP)] &= ~val;
159
- PRINT_DEBUG("UART%d: UINTP [%04x] have been cleared: %08x\n",
160
- s->channel, offset, s->reg[I_(UINTP)]);
161
+ trace_exynos_uart_intclr(s->channel, s->reg[I_(UINTP)]);
162
exynos4210_uart_update_irq(s);
163
break;
164
case UTRSTAT:
165
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_write(void *opaque, hwaddr offset,
166
case UFSTAT:
167
case UMSTAT:
168
case URXH:
169
- PRINT_DEBUG("UART%d: Trying to write into RO register: %s [%04x]\n",
170
+ trace_exynos_uart_ro_write(
171
s->channel, exynos4210_uart_regname(offset), offset);
172
break;
173
case UINTSP:
174
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_uart_read(void *opaque, hwaddr offset,
175
case UERSTAT: /* Read Only */
176
res = s->reg[I_(UERSTAT)];
177
s->reg[I_(UERSTAT)] = 0;
178
+ trace_exynos_uart_read(s->channel, offset,
179
+ exynos4210_uart_regname(offset), res);
180
return res;
181
case UFSTAT: /* Read Only */
182
s->reg[I_(UFSTAT)] = fifo_elements_number(&s->rx) & 0xff;
183
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_uart_read(void *opaque, hwaddr offset,
184
s->reg[I_(UFSTAT)] |= UFSTAT_Rx_FIFO_FULL;
185
s->reg[I_(UFSTAT)] &= ~0xff;
186
}
187
+ trace_exynos_uart_read(s->channel, offset,
188
+ exynos4210_uart_regname(offset),
189
+ s->reg[I_(UFSTAT)]);
190
return s->reg[I_(UFSTAT)];
191
case URXH:
192
if (s->reg[I_(UFCON)] & UFCON_FIFO_ENABLE) {
193
if (fifo_elements_number(&s->rx)) {
194
res = fifo_retrieve(&s->rx);
195
-#if DEBUG_Rx_DATA
196
- fprintf(stderr, "%c", res);
197
-#endif
198
+ trace_exynos_uart_rx(s->channel, res);
199
if (!fifo_elements_number(&s->rx)) {
200
s->reg[I_(UTRSTAT)] &= ~UTRSTAT_Rx_BUFFER_DATA_READY;
201
} else {
202
s->reg[I_(UTRSTAT)] |= UTRSTAT_Rx_BUFFER_DATA_READY;
203
}
204
} else {
205
+ trace_exynos_uart_rx_error(s->channel);
206
s->reg[I_(UINTSP)] |= UINTSP_ERROR;
207
exynos4210_uart_update_irq(s);
208
res = 0;
209
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_uart_read(void *opaque, hwaddr offset,
210
s->reg[I_(UTRSTAT)] &= ~UTRSTAT_Rx_BUFFER_DATA_READY;
211
res = s->reg[I_(URXH)];
212
}
213
+ trace_exynos_uart_read(s->channel, offset,
214
+ exynos4210_uart_regname(offset), res);
215
return res;
216
case UTXH:
217
- PRINT_DEBUG("UART%d: Trying to read from WO register: %s [%04x]\n",
218
- s->channel, exynos4210_uart_regname(offset), offset);
219
+ trace_exynos_uart_wo_read(s->channel, exynos4210_uart_regname(offset),
220
+ offset);
221
break;
222
default:
223
+ trace_exynos_uart_read(s->channel, offset,
224
+ exynos4210_uart_regname(offset),
225
+ s->reg[I_(offset)]);
226
return s->reg[I_(offset)];
227
}
228
229
+ trace_exynos_uart_read(s->channel, offset, exynos4210_uart_regname(offset),
230
+ 0);
231
return 0;
232
}
233
234
@@ -XXX,XX +XXX,XX @@ static void exynos4210_uart_reset(DeviceState *dev)
235
fifo_reset(&s->rx);
236
fifo_reset(&s->tx);
237
238
- PRINT_DEBUG("UART%d: Rx FIFO size: %d\n", s->channel, s->rx.size);
239
+ trace_exynos_uart_rxsize(s->channel, s->rx.size);
240
}
241
242
static const VMStateDescription vmstate_exynos4210_uart_fifo = {
243
diff --git a/hw/char/trace-events b/hw/char/trace-events
244
index XXXXXXX..XXXXXXX 100644
245
--- a/hw/char/trace-events
246
+++ b/hw/char/trace-events
247
@@ -XXX,XX +XXX,XX @@ cmsdk_apb_uart_set_params(int speed) "CMSDK APB UART: params set to %d 8N1"
248
# nrf51_uart.c
249
nrf51_uart_read(uint64_t addr, uint64_t r, unsigned int size) "addr 0x%" PRIx64 " value 0x%" PRIx64 " size %u"
250
nrf51_uart_write(uint64_t addr, uint64_t value, unsigned int size) "addr 0x%" PRIx64 " value 0x%" PRIx64 " size %u"
251
+
252
+# exynos4210_uart.c
253
+exynos_uart_irq_raised(uint32_t channel, uint32_t reg) "UART%d: IRQ raised: 0x%08"PRIx32
254
+exynos_uart_irq_lowered(uint32_t channel) "UART%d: IRQ lowered"
255
+exynos_uart_update_params(uint32_t channel, int speed, uint8_t parity, int data, int stop) "UART%d: speed: %d, parity: %c, data bits: %d, stop bits: %d"
256
+exynos_uart_write(uint32_t channel, uint32_t offset, const char *name, uint64_t val) "UART%d: <0x%04x> %s <- 0x%" PRIx64
257
+exynos_uart_read(uint32_t channel, uint32_t offset, const char *name, uint64_t val) "UART%d: <0x%04x> %s -> 0x%" PRIx64
258
+exynos_uart_rx_fifo_reset(uint32_t channel) "UART%d: Rx FIFO Reset"
259
+exynos_uart_tx_fifo_reset(uint32_t channel) "UART%d: Tx FIFO Reset"
260
+exynos_uart_tx(uint32_t channel, uint8_t ch) "UART%d: Tx 0x%02"PRIx32
261
+exynos_uart_intclr(uint32_t channel, uint32_t reg) "UART%d: interrupts cleared: 0x%08"PRIx32
262
+exynos_uart_ro_write(uint32_t channel, const char *name, uint32_t reg) "UART%d: Trying to write into RO register: %s [0x%04"PRIx32"]"
263
+exynos_uart_rx(uint32_t channel, uint8_t ch) "UART%d: Rx 0x%02"PRIx32
264
+exynos_uart_rx_error(uint32_t channel) "UART%d: Rx error"
265
+exynos_uart_wo_read(uint32_t channel, const char *name, uint32_t reg) "UART%d: Trying to read from WO register: %s [0x%04"PRIx32"]"
266
+exynos_uart_rxsize(uint32_t channel, uint32_t size) "UART%d: Rx FIFO size: %d"
267
+exynos_uart_channel_error(uint32_t channel) "Wrong UART channel number: %d"
268
--
36
--
269
2.20.1
37
2.34.1
270
38
271
39
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Claudio Fontana <cfontana@suse.de>
2
2
3
Perform the set of operations and test described in LP 1859713.
3
Signed-off-by: Claudio Fontana <cfontana@suse.de>
4
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Suggested-by: Adrien GRASSEIN <adrien.grassein@smile.fr>
5
Signed-off-by: Fabiano Rosas <farosas@suse.de>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Message-id: 20200116230809.19078-5-richard.henderson@linaro.org
8
[PMM: fixed hard-coded tabs]
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
8
---
11
tests/tcg/aarch64/Makefile.target | 2 +-
9
target/arm/helper.c | 12 +++++++-----
12
tests/tcg/aarch64/pauth-4.c | 25 +++++++++++++++++++++++++
10
1 file changed, 7 insertions(+), 5 deletions(-)
13
2 files changed, 26 insertions(+), 1 deletion(-)
14
create mode 100644 tests/tcg/aarch64/pauth-4.c
15
11
16
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
12
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
18
--- a/tests/tcg/aarch64/Makefile.target
14
--- a/target/arm/helper.c
19
+++ b/tests/tcg/aarch64/Makefile.target
15
+++ b/target/arm/helper.c
20
@@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt
16
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
21
    $(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref)
17
unsigned int cur_el = arm_current_el(env);
22
18
int rt;
23
# Pauth Tests
19
24
-AARCH64_TESTS += pauth-1 pauth-2
20
- /*
25
+AARCH64_TESTS += pauth-1 pauth-2 pauth-4
21
- * Note that new_el can never be 0. If cur_el is 0, then
26
run-pauth-%: QEMU_OPTS += -cpu max
22
- * el0_a64 is is_a64(), else el0_a64 is ignored.
27
pauth-%: CFLAGS += -march=armv8.3-a
23
- */
28
24
- aarch64_sve_change_el(env, cur_el, new_el, is_a64(env));
29
diff --git a/tests/tcg/aarch64/pauth-4.c b/tests/tcg/aarch64/pauth-4.c
25
+ if (tcg_enabled()) {
30
new file mode 100644
26
+ /*
31
index XXXXXXX..XXXXXXX
27
+ * Note that new_el can never be 0. If cur_el is 0, then
32
--- /dev/null
28
+ * el0_a64 is is_a64(), else el0_a64 is ignored.
33
+++ b/tests/tcg/aarch64/pauth-4.c
29
+ */
34
@@ -XXX,XX +XXX,XX @@
30
+ aarch64_sve_change_el(env, cur_el, new_el, is_a64(env));
35
+#include <stdint.h>
31
+ }
36
+#include <assert.h>
32
37
+
33
if (cur_el < new_el) {
38
+int main()
34
/*
39
+{
40
+ uintptr_t x, y;
41
+
42
+ asm("mov %0, lr\n\t"
43
+ "pacia %0, sp\n\t" /* sigill if pauth not supported */
44
+ "eor %0, %0, #4\n\t" /* corrupt single bit */
45
+ "mov %1, %0\n\t"
46
+ "autia %1, sp\n\t" /* validate corrupted pointer */
47
+ "xpaci %0\n\t" /* strip pac from corrupted pointer */
48
+ : "=r"(x), "=r"(y));
49
+
50
+ /*
51
+ * Once stripped, the corrupted pointer is of the form 0x0000...wxyz.
52
+ * We expect the autia to indicate failure, producing a pointer of the
53
+ * form 0x000e....wxyz. Use xpaci and != for the test, rather than
54
+ * extracting explicit bits from the top, because the location of the
55
+ * error code "e" depends on the configuration of virtual memory.
56
+ */
57
+ assert(x != y);
58
+ return 0;
59
+}
60
--
35
--
61
2.20.1
36
2.34.1
62
37
63
38
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Replace debug logging code with tracing.
3
Move this earlier to make the next patch diff cleaner. While here
4
update the comment slightly to not give the impression that the
5
misalignment affects only TCG.
4
6
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Message-id: 20200123052540.6132-2-linux@roeck-us.net
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
10
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
12
---
10
hw/dma/pl330.c | 88 ++++++++++++++++++++++++---------------------
13
target/arm/machine.c | 18 +++++++++---------
11
hw/dma/trace-events | 24 +++++++++++++
14
1 file changed, 9 insertions(+), 9 deletions(-)
12
2 files changed, 72 insertions(+), 40 deletions(-)
13
15
14
diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c
16
diff --git a/target/arm/machine.c b/target/arm/machine.c
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/dma/pl330.c
18
--- a/target/arm/machine.c
17
+++ b/hw/dma/pl330.c
19
+++ b/target/arm/machine.c
18
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
19
#include "sysemu/dma.h"
20
#include "qemu/log.h"
21
#include "qemu/module.h"
22
+#include "trace.h"
23
24
#ifndef PL330_ERR_DEBUG
25
#define PL330_ERR_DEBUG 0
26
#endif
27
28
-#define DB_PRINT_L(lvl, fmt, args...) do {\
29
- if (PL330_ERR_DEBUG >= lvl) {\
30
- fprintf(stderr, "PL330: %s:" fmt, __func__, ## args);\
31
- } \
32
-} while (0)
33
-
34
-#define DB_PRINT(fmt, args...) DB_PRINT_L(1, fmt, ## args)
35
-
36
#define PL330_PERIPH_NUM 32
37
#define PL330_MAX_BURST_LEN 128
38
#define PL330_INSN_MAXSIZE 6
39
@@ -XXX,XX +XXX,XX @@ typedef struct PL330InsnDesc {
40
void (*exec)(PL330Chan *, uint8_t opcode, uint8_t *args, int len);
41
} PL330InsnDesc;
42
43
+static void pl330_hexdump(uint8_t *buf, size_t size)
44
+{
45
+ unsigned int b, i, len;
46
+ char tmpbuf[80];
47
+
48
+ for (b = 0; b < size; b += 16) {
49
+ len = size - b;
50
+ if (len > 16) {
51
+ len = 16;
52
+ }
53
+ tmpbuf[0] = '\0';
54
+ for (i = 0; i < len; i++) {
55
+ if ((i % 4) == 0) {
56
+ strcat(tmpbuf, " ");
57
+ }
58
+ sprintf(tmpbuf + strlen(tmpbuf), " %02x", buf[b + i]);
59
+ }
60
+ trace_pl330_hexdump(b, tmpbuf);
61
+ }
62
+}
63
64
/* MFIFO Implementation
65
*
66
@@ -XXX,XX +XXX,XX @@ static inline void pl330_queue_remove_tagged(PL330Queue *s, uint8_t tag)
67
68
static inline void pl330_fault(PL330Chan *ch, uint32_t flags)
69
{
70
- DB_PRINT("ch: %p, flags: %" PRIx32 "\n", ch, flags);
71
+ trace_pl330_fault(ch, flags);
72
ch->fault_type |= flags;
73
if (ch->state == pl330_chan_fault) {
74
return;
75
@@ -XXX,XX +XXX,XX @@ static inline void pl330_fault(PL330Chan *ch, uint32_t flags)
76
ch->state = pl330_chan_fault;
77
ch->parent->num_faulting++;
78
if (ch->parent->num_faulting == 1) {
79
- DB_PRINT("abort interrupt raised\n");
80
+ trace_pl330_fault_abort();
81
qemu_irq_raise(ch->parent->irq_abort);
82
}
83
}
84
@@ -XXX,XX +XXX,XX @@ static void pl330_dmaend(PL330Chan *ch, uint8_t opcode,
85
return;
86
}
21
}
87
}
22
}
88
- DB_PRINT("DMA ending!\n");
23
89
+ trace_pl330_dmaend();
24
+ /*
90
pl330_fifo_tagged_remove(&s->fifo, ch->tag);
25
+ * Misaligned thumb pc is architecturally impossible. Fail the
91
pl330_queue_remove_tagged(&s->read_queue, ch->tag);
26
+ * incoming migration. For TCG it would trigger the assert in
92
pl330_queue_remove_tagged(&s->write_queue, ch->tag);
27
+ * thumb_tr_translate_insn().
93
@@ -XXX,XX +XXX,XX @@ static void pl330_dmago(PL330Chan *ch, uint8_t opcode, uint8_t *args, int len)
28
+ */
94
uint32_t pc;
29
+ if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) {
95
PL330Chan *s;
30
+ return -1;
96
31
+ }
97
- DB_PRINT("\n");
32
+
98
+ trace_pl330_dmago();
33
hw_breakpoint_update_all(cpu);
99
34
hw_watchpoint_update_all(cpu);
100
if (!ch->is_manager) {
35
101
pl330_fault(ch, PL330_FAULT_UNDEF_INSTR);
36
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
102
@@ -XXX,XX +XXX,XX @@ static void pl330_dmald(PL330Chan *ch, uint8_t opcode, uint8_t *args, int len)
103
ch->stall = pl330_queue_put_insn(&ch->parent->read_queue, ch->src,
104
size, num, inc, 0, ch->tag);
105
if (!ch->stall) {
106
- DB_PRINT("channel:%" PRId8 " address:%08" PRIx32 " size:%" PRIx32
107
- " num:%" PRId32 " %c\n",
108
- ch->tag, ch->src, size, num, inc ? 'Y' : 'N');
109
+ trace_pl330_dmald(ch->tag, ch->src, size, num, inc ? 'Y' : 'N');
110
ch->src += inc ? size * num - (ch->src & (size - 1)) : 0;
111
}
112
}
113
@@ -XXX,XX +XXX,XX @@ static void pl330_dmakill(PL330Chan *ch, uint8_t opcode, uint8_t *args, int len)
114
ch->fault_type = 0;
115
ch->parent->num_faulting--;
116
if (ch->parent->num_faulting == 0) {
117
- DB_PRINT("abort interrupt lowered\n");
118
+ trace_pl330_dmakill();
119
qemu_irq_lower(ch->parent->irq_abort);
120
}
37
}
121
}
38
}
122
@@ -XXX,XX +XXX,XX @@ static void pl330_dmalpend(PL330Chan *ch, uint8_t opcode,
39
123
uint8_t bs = opcode & 3;
40
- /*
124
uint8_t lc = (opcode & 4) >> 2;
41
- * Misaligned thumb pc is architecturally impossible.
125
42
- * We have an assert in thumb_tr_translate_insn to verify this.
126
+ trace_pl330_dmalpend(nf, bs, lc, ch->lc[lc], ch->request_flag);
43
- * Fail an incoming migrate to avoid this assert.
127
+
44
- */
128
if (bs == 2) {
45
- if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) {
129
pl330_fault(ch, PL330_FAULT_OPERAND_INVALID);
46
- return -1;
130
return;
47
- }
131
@@ -XXX,XX +XXX,XX @@ static void pl330_dmalpend(PL330Chan *ch, uint8_t opcode,
48
-
132
if (nf) {
49
if (!kvm_enabled()) {
133
ch->lc[lc]--;
50
pmu_op_finish(&cpu->env);
134
}
135
- DB_PRINT("loop reiteration\n");
136
+ trace_pl330_dmalpiter();
137
ch->pc -= args[0];
138
ch->pc -= len + 1;
139
/* "ch->pc -= args[0] + len + 1" is incorrect when args[0] == 256 */
140
} else {
141
- DB_PRINT("loop fallthrough\n");
142
+ trace_pl330_dmalpfallthrough();
143
}
51
}
144
}
145
146
@@ -XXX,XX +XXX,XX @@ static void pl330_dmasev(PL330Chan *ch, uint8_t opcode, uint8_t *args, int len)
147
}
148
if (ch->parent->inten & (1 << ev_id)) {
149
ch->parent->int_status |= (1 << ev_id);
150
- DB_PRINT("event interrupt raised %" PRId8 "\n", ev_id);
151
+ trace_pl330_dmasev_evirq(ev_id);
152
qemu_irq_raise(ch->parent->irq[ev_id]);
153
}
154
- DB_PRINT("event raised %" PRId8 "\n", ev_id);
155
+ trace_pl330_dmasev_event(ev_id);
156
ch->parent->ev_status |= (1 << ev_id);
157
}
158
159
@@ -XXX,XX +XXX,XX @@ static void pl330_dmast(PL330Chan *ch, uint8_t opcode, uint8_t *args, int len)
160
ch->stall = pl330_queue_put_insn(&ch->parent->write_queue, ch->dst,
161
size, num, inc, 0, ch->tag);
162
if (!ch->stall) {
163
- DB_PRINT("channel:%" PRId8 " address:%08" PRIx32 " size:%" PRIx32
164
- " num:%" PRId32 " %c\n",
165
- ch->tag, ch->dst, size, num, inc ? 'Y' : 'N');
166
+ trace_pl330_dmast(ch->tag, ch->dst, size, num, inc ? 'Y' : 'N');
167
ch->dst += inc ? size * num - (ch->dst & (size - 1)) : 0;
168
}
169
}
170
@@ -XXX,XX +XXX,XX @@ static void pl330_dmawfe(PL330Chan *ch, uint8_t opcode,
171
}
172
}
173
ch->parent->ev_status &= ~(1 << ev_id);
174
- DB_PRINT("event lowered %" PRIx8 "\n", ev_id);
175
+ trace_pl330_dmawfe(ev_id);
176
} else {
177
ch->stall = 1;
178
}
179
@@ -XXX,XX +XXX,XX @@ static int pl330_chan_exec(PL330Chan *ch)
180
ch->stall = 0;
181
insn = pl330_fetch_insn(ch);
182
if (!insn) {
183
- DB_PRINT("pl330 undefined instruction\n");
184
+ trace_pl330_chan_exec_undef();
185
pl330_fault(ch, PL330_FAULT_UNDEF_INSTR);
186
return 0;
187
}
188
@@ -XXX,XX +XXX,XX @@ static int pl330_exec_cycle(PL330Chan *channel)
189
int len = q->len - (q->addr & (q->len - 1));
190
191
dma_memory_read(&address_space_memory, q->addr, buf, len);
192
- if (PL330_ERR_DEBUG > 1) {
193
- DB_PRINT("PL330 read from memory @%08" PRIx32 " (size = %08x):\n",
194
- q->addr, len);
195
- qemu_hexdump((char *)buf, stderr, "", len);
196
+ trace_pl330_exec_cycle(q->addr, len);
197
+ if (trace_event_get_state_backends(TRACE_PL330_HEXDUMP)) {
198
+ pl330_hexdump(buf, len);
199
}
200
fifo_res = pl330_fifo_push(&s->fifo, buf, len, q->tag);
201
if (fifo_res == PL330_FIFO_OK) {
202
@@ -XXX,XX +XXX,XX @@ static int pl330_exec_cycle(PL330Chan *channel)
203
}
204
if (fifo_res == PL330_FIFO_OK || q->z) {
205
dma_memory_write(&address_space_memory, q->addr, buf, len);
206
- if (PL330_ERR_DEBUG > 1) {
207
- DB_PRINT("PL330 read from memory @%08" PRIx32
208
- " (size = %08x):\n", q->addr, len);
209
- qemu_hexdump((char *)buf, stderr, "", len);
210
+ trace_pl330_exec_cycle(q->addr, len);
211
+ if (trace_event_get_state_backends(TRACE_PL330_HEXDUMP)) {
212
+ pl330_hexdump(buf, len);
213
}
214
if (q->inc) {
215
q->addr += len;
216
@@ -XXX,XX +XXX,XX @@ static int pl330_exec_channel(PL330Chan *channel)
217
218
static inline void pl330_exec(PL330State *s)
219
{
220
- DB_PRINT("\n");
221
int i, insr_exec;
222
+ trace_pl330_exec();
223
do {
224
insr_exec = pl330_exec_channel(&s->manager);
225
226
@@ -XXX,XX +XXX,XX @@ static void pl330_debug_exec(PL330State *s)
227
args[2] = (s->dbg[1] >> 8) & 0xff;
228
args[3] = (s->dbg[1] >> 16) & 0xff;
229
args[4] = (s->dbg[1] >> 24) & 0xff;
230
- DB_PRINT("chan id: %" PRIx8 "\n", chan_id);
231
+ trace_pl330_debug_exec(chan_id);
232
if (s->dbg[0] & 1) {
233
ch = &s->chan[chan_id];
234
} else {
235
@@ -XXX,XX +XXX,XX @@ static void pl330_debug_exec(PL330State *s)
236
ch->fault_type |= PL330_FAULT_DBG_INSTR;
237
}
238
if (ch->stall) {
239
+ trace_pl330_debug_exec_stall();
240
qemu_log_mask(LOG_UNIMP, "pl330: stall of debug instruction not "
241
"implemented\n");
242
}
243
@@ -XXX,XX +XXX,XX @@ static void pl330_iomem_write(void *opaque, hwaddr offset,
244
PL330State *s = (PL330State *) opaque;
245
int i;
246
247
- DB_PRINT("addr: %08x data: %08x\n", (unsigned)offset, (unsigned)value);
248
+ trace_pl330_iomem_write((unsigned)offset, (unsigned)value);
249
250
switch (offset) {
251
case PL330_REG_INTEN:
252
@@ -XXX,XX +XXX,XX @@ static void pl330_iomem_write(void *opaque, hwaddr offset,
253
case PL330_REG_INTCLR:
254
for (i = 0; i < s->num_events; i++) {
255
if (s->int_status & s->inten & value & (1 << i)) {
256
- DB_PRINT("event interrupt lowered %d\n", i);
257
+ trace_pl330_iomem_write_clr(i);
258
qemu_irq_lower(s->irq[i]);
259
}
260
}
261
@@ -XXX,XX +XXX,XX @@ static void pl330_iomem_write(void *opaque, hwaddr offset,
262
}
263
break;
264
case PL330_REG_DBGINST0:
265
- DB_PRINT("s->dbg[0] = %08x\n", (unsigned)value);
266
s->dbg[0] = value;
267
break;
268
case PL330_REG_DBGINST1:
269
- DB_PRINT("s->dbg[1] = %08x\n", (unsigned)value);
270
s->dbg[1] = value;
271
break;
272
default:
273
@@ -XXX,XX +XXX,XX @@ static uint64_t pl330_iomem_read(void *opaque, hwaddr offset,
274
unsigned size)
275
{
276
uint32_t ret = pl330_iomem_read_imp(opaque, offset);
277
- DB_PRINT("addr: %08" HWADDR_PRIx " data: %08" PRIx32 "\n", offset, ret);
278
+ trace_pl330_iomem_read((uint32_t)offset, ret);
279
return ret;
280
}
281
282
diff --git a/hw/dma/trace-events b/hw/dma/trace-events
283
index XXXXXXX..XXXXXXX 100644
284
--- a/hw/dma/trace-events
285
+++ b/hw/dma/trace-events
286
@@ -XXX,XX +XXX,XX @@ sparc32_dma_enable_lower(void) "Lower DMA enable"
287
288
# i8257.c
289
i8257_unregistered_dma(int nchan, int dma_pos, int dma_len) "unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d"
290
+
291
+# pl330.c
292
+pl330_fault(void *ptr, uint32_t flags) "ch: %p, flags: 0x%"PRIx32
293
+pl330_fault_abort(void) "abort interrupt raised"
294
+pl330_dmaend(void) "DMA ending"
295
+pl330_dmago(void) "DMA run"
296
+pl330_dmald(uint32_t chan, uint32_t addr, uint32_t size, uint32_t num, uint32_t ch) "channel:%"PRId8" address:0x%08"PRIx32" size:0x%"PRIx32" num:%"PRId32"%c"
297
+pl330_dmakill(void) "abort interrupt lowered"
298
+pl330_dmalpend(uint8_t nf, uint8_t bs, uint8_t lc, uint8_t ch, uint8_t flag) "nf=0x%02x bs=0x%02x lc=0x%02x ch=0x%02x flag=0x%02x"
299
+pl330_dmalpiter(void) "loop reiteration"
300
+pl330_dmalpfallthrough(void) "loop fallthrough"
301
+pl330_dmasev_evirq(uint8_t ev_id) "event interrupt raised %"PRId8
302
+pl330_dmasev_event(uint8_t ev_id) "event raised %"PRId8
303
+pl330_dmast(uint32_t chn, uint32_t addr, uint32_t sz, uint32_t num, uint32_t c) "channel:%"PRId8" address:0x%08"PRIx32" size:0x%"PRIx32" num:%"PRId32" %c"
304
+pl330_dmawfe(uint8_t ev_id) "event lowered 0x%"PRIx8
305
+pl330_chan_exec_undef(void) "undefined instruction"
306
+pl330_exec_cycle(uint32_t addr, uint32_t size) "PL330 read from memory @0x%08"PRIx32" (size = 0x%08"PRIx32")"
307
+pl330_hexdump(uint32_t offset, char *str) " 0x%04"PRIx32":%s"
308
+pl330_exec(void) "pl330_exec"
309
+pl330_debug_exec(uint8_t ch) "chan id: 0x%"PRIx8
310
+pl330_debug_exec_stall(void) "stall of debug instruction not implemented"
311
+pl330_iomem_write(uint32_t offset, uint32_t value) "addr: 0x%08"PRIx32" data: 0x%08"PRIx32
312
+pl330_iomem_write_clr(int i) "event interrupt lowered %d"
313
+pl330_iomem_read(uint32_t addr, uint32_t data) "addr: 0x%08"PRIx32" data: 0x%08"PRIx32
314
--
52
--
315
2.20.1
53
2.34.1
316
54
317
55
diff view generated by jsdifflib
New patch
1
1
From: Fabiano Rosas <farosas@suse.de>
2
3
Since commit cf7c6d1004 ("target/arm: Split out cpregs.h") we now have
4
a cpregs.h header which is more suitable for this code.
5
6
Code moved verbatim.
7
8
Signed-off-by: Fabiano Rosas <farosas@suse.de>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
target/arm/cpregs.h | 98 +++++++++++++++++++++++++++++++++++++++++++++
15
target/arm/cpu.h | 91 -----------------------------------------
16
2 files changed, 98 insertions(+), 91 deletions(-)
17
18
diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/cpregs.h
21
+++ b/target/arm/cpregs.h
22
@@ -XXX,XX +XXX,XX @@ enum {
23
ARM_CP_SME = 1 << 19,
24
};
25
26
+/*
27
+ * Interface for defining coprocessor registers.
28
+ * Registers are defined in tables of arm_cp_reginfo structs
29
+ * which are passed to define_arm_cp_regs().
30
+ */
31
+
32
+/*
33
+ * When looking up a coprocessor register we look for it
34
+ * via an integer which encodes all of:
35
+ * coprocessor number
36
+ * Crn, Crm, opc1, opc2 fields
37
+ * 32 or 64 bit register (ie is it accessed via MRC/MCR
38
+ * or via MRRC/MCRR?)
39
+ * non-secure/secure bank (AArch32 only)
40
+ * We allow 4 bits for opc1 because MRRC/MCRR have a 4 bit field.
41
+ * (In this case crn and opc2 should be zero.)
42
+ * For AArch64, there is no 32/64 bit size distinction;
43
+ * instead all registers have a 2 bit op0, 3 bit op1 and op2,
44
+ * and 4 bit CRn and CRm. The encoding patterns are chosen
45
+ * to be easy to convert to and from the KVM encodings, and also
46
+ * so that the hashtable can contain both AArch32 and AArch64
47
+ * registers (to allow for interprocessing where we might run
48
+ * 32 bit code on a 64 bit core).
49
+ */
50
+/*
51
+ * This bit is private to our hashtable cpreg; in KVM register
52
+ * IDs the AArch64/32 distinction is the KVM_REG_ARM/ARM64
53
+ * in the upper bits of the 64 bit ID.
54
+ */
55
+#define CP_REG_AA64_SHIFT 28
56
+#define CP_REG_AA64_MASK (1 << CP_REG_AA64_SHIFT)
57
+
58
+/*
59
+ * To enable banking of coprocessor registers depending on ns-bit we
60
+ * add a bit to distinguish between secure and non-secure cpregs in the
61
+ * hashtable.
62
+ */
63
+#define CP_REG_NS_SHIFT 29
64
+#define CP_REG_NS_MASK (1 << CP_REG_NS_SHIFT)
65
+
66
+#define ENCODE_CP_REG(cp, is64, ns, crn, crm, opc1, opc2) \
67
+ ((ns) << CP_REG_NS_SHIFT | ((cp) << 16) | ((is64) << 15) | \
68
+ ((crn) << 11) | ((crm) << 7) | ((opc1) << 3) | (opc2))
69
+
70
+#define ENCODE_AA64_CP_REG(cp, crn, crm, op0, op1, op2) \
71
+ (CP_REG_AA64_MASK | \
72
+ ((cp) << CP_REG_ARM_COPROC_SHIFT) | \
73
+ ((op0) << CP_REG_ARM64_SYSREG_OP0_SHIFT) | \
74
+ ((op1) << CP_REG_ARM64_SYSREG_OP1_SHIFT) | \
75
+ ((crn) << CP_REG_ARM64_SYSREG_CRN_SHIFT) | \
76
+ ((crm) << CP_REG_ARM64_SYSREG_CRM_SHIFT) | \
77
+ ((op2) << CP_REG_ARM64_SYSREG_OP2_SHIFT))
78
+
79
+/*
80
+ * Convert a full 64 bit KVM register ID to the truncated 32 bit
81
+ * version used as a key for the coprocessor register hashtable
82
+ */
83
+static inline uint32_t kvm_to_cpreg_id(uint64_t kvmid)
84
+{
85
+ uint32_t cpregid = kvmid;
86
+ if ((kvmid & CP_REG_ARCH_MASK) == CP_REG_ARM64) {
87
+ cpregid |= CP_REG_AA64_MASK;
88
+ } else {
89
+ if ((kvmid & CP_REG_SIZE_MASK) == CP_REG_SIZE_U64) {
90
+ cpregid |= (1 << 15);
91
+ }
92
+
93
+ /*
94
+ * KVM is always non-secure so add the NS flag on AArch32 register
95
+ * entries.
96
+ */
97
+ cpregid |= 1 << CP_REG_NS_SHIFT;
98
+ }
99
+ return cpregid;
100
+}
101
+
102
+/*
103
+ * Convert a truncated 32 bit hashtable key into the full
104
+ * 64 bit KVM register ID.
105
+ */
106
+static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
107
+{
108
+ uint64_t kvmid;
109
+
110
+ if (cpregid & CP_REG_AA64_MASK) {
111
+ kvmid = cpregid & ~CP_REG_AA64_MASK;
112
+ kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM64;
113
+ } else {
114
+ kvmid = cpregid & ~(1 << 15);
115
+ if (cpregid & (1 << 15)) {
116
+ kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM;
117
+ } else {
118
+ kvmid |= CP_REG_SIZE_U32 | CP_REG_ARM;
119
+ }
120
+ }
121
+ return kvmid;
122
+}
123
+
124
/*
125
* Valid values for ARMCPRegInfo state field, indicating which of
126
* the AArch32 and AArch64 execution states this register is visible in.
127
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
128
index XXXXXXX..XXXXXXX 100644
129
--- a/target/arm/cpu.h
130
+++ b/target/arm/cpu.h
131
@@ -XXX,XX +XXX,XX @@ void arm_cpu_list(void);
132
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
133
uint32_t cur_el, bool secure);
134
135
-/* Interface for defining coprocessor registers.
136
- * Registers are defined in tables of arm_cp_reginfo structs
137
- * which are passed to define_arm_cp_regs().
138
- */
139
-
140
-/* When looking up a coprocessor register we look for it
141
- * via an integer which encodes all of:
142
- * coprocessor number
143
- * Crn, Crm, opc1, opc2 fields
144
- * 32 or 64 bit register (ie is it accessed via MRC/MCR
145
- * or via MRRC/MCRR?)
146
- * non-secure/secure bank (AArch32 only)
147
- * We allow 4 bits for opc1 because MRRC/MCRR have a 4 bit field.
148
- * (In this case crn and opc2 should be zero.)
149
- * For AArch64, there is no 32/64 bit size distinction;
150
- * instead all registers have a 2 bit op0, 3 bit op1 and op2,
151
- * and 4 bit CRn and CRm. The encoding patterns are chosen
152
- * to be easy to convert to and from the KVM encodings, and also
153
- * so that the hashtable can contain both AArch32 and AArch64
154
- * registers (to allow for interprocessing where we might run
155
- * 32 bit code on a 64 bit core).
156
- */
157
-/* This bit is private to our hashtable cpreg; in KVM register
158
- * IDs the AArch64/32 distinction is the KVM_REG_ARM/ARM64
159
- * in the upper bits of the 64 bit ID.
160
- */
161
-#define CP_REG_AA64_SHIFT 28
162
-#define CP_REG_AA64_MASK (1 << CP_REG_AA64_SHIFT)
163
-
164
-/* To enable banking of coprocessor registers depending on ns-bit we
165
- * add a bit to distinguish between secure and non-secure cpregs in the
166
- * hashtable.
167
- */
168
-#define CP_REG_NS_SHIFT 29
169
-#define CP_REG_NS_MASK (1 << CP_REG_NS_SHIFT)
170
-
171
-#define ENCODE_CP_REG(cp, is64, ns, crn, crm, opc1, opc2) \
172
- ((ns) << CP_REG_NS_SHIFT | ((cp) << 16) | ((is64) << 15) | \
173
- ((crn) << 11) | ((crm) << 7) | ((opc1) << 3) | (opc2))
174
-
175
-#define ENCODE_AA64_CP_REG(cp, crn, crm, op0, op1, op2) \
176
- (CP_REG_AA64_MASK | \
177
- ((cp) << CP_REG_ARM_COPROC_SHIFT) | \
178
- ((op0) << CP_REG_ARM64_SYSREG_OP0_SHIFT) | \
179
- ((op1) << CP_REG_ARM64_SYSREG_OP1_SHIFT) | \
180
- ((crn) << CP_REG_ARM64_SYSREG_CRN_SHIFT) | \
181
- ((crm) << CP_REG_ARM64_SYSREG_CRM_SHIFT) | \
182
- ((op2) << CP_REG_ARM64_SYSREG_OP2_SHIFT))
183
-
184
-/* Convert a full 64 bit KVM register ID to the truncated 32 bit
185
- * version used as a key for the coprocessor register hashtable
186
- */
187
-static inline uint32_t kvm_to_cpreg_id(uint64_t kvmid)
188
-{
189
- uint32_t cpregid = kvmid;
190
- if ((kvmid & CP_REG_ARCH_MASK) == CP_REG_ARM64) {
191
- cpregid |= CP_REG_AA64_MASK;
192
- } else {
193
- if ((kvmid & CP_REG_SIZE_MASK) == CP_REG_SIZE_U64) {
194
- cpregid |= (1 << 15);
195
- }
196
-
197
- /* KVM is always non-secure so add the NS flag on AArch32 register
198
- * entries.
199
- */
200
- cpregid |= 1 << CP_REG_NS_SHIFT;
201
- }
202
- return cpregid;
203
-}
204
-
205
-/* Convert a truncated 32 bit hashtable key into the full
206
- * 64 bit KVM register ID.
207
- */
208
-static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
209
-{
210
- uint64_t kvmid;
211
-
212
- if (cpregid & CP_REG_AA64_MASK) {
213
- kvmid = cpregid & ~CP_REG_AA64_MASK;
214
- kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM64;
215
- } else {
216
- kvmid = cpregid & ~(1 << 15);
217
- if (cpregid & (1 << 15)) {
218
- kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM;
219
- } else {
220
- kvmid |= CP_REG_SIZE_U32 | CP_REG_ARM;
221
- }
222
- }
223
- return kvmid;
224
-}
225
-
226
/* Return the highest implemented Exception Level */
227
static inline int arm_highest_el(CPUARMState *env)
228
{
229
--
230
2.34.1
231
232
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Missed in 870c034da0b, hopefully reported by Coverity.
3
If a test was tagged with the "accel" tag and the specified
4
accelerator it not present in the qemu binary, cancel the test.
4
5
5
Fixes: Coverity CID 1412793 (Incorrect expression)
6
We can now write tests without explicit calls to require_accelerator,
6
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
just the tag is enough.
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
8
Reviewed-by: Thomas Huth <thuth@redhat.com>
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
9
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20200121213853.9601-1-f4bug@amsat.org
11
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
---
13
hw/misc/stm32f4xx_syscfg.c | 2 +-
14
tests/avocado/avocado_qemu/__init__.py | 4 ++++
14
1 file changed, 1 insertion(+), 1 deletion(-)
15
1 file changed, 4 insertions(+)
15
16
16
diff --git a/hw/misc/stm32f4xx_syscfg.c b/hw/misc/stm32f4xx_syscfg.c
17
diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
17
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/misc/stm32f4xx_syscfg.c
19
--- a/tests/avocado/avocado_qemu/__init__.py
19
+++ b/hw/misc/stm32f4xx_syscfg.c
20
+++ b/tests/avocado/avocado_qemu/__init__.py
20
@@ -XXX,XX +XXX,XX @@ static void stm32f4xx_syscfg_set_irq(void *opaque, int irq, int level)
21
@@ -XXX,XX +XXX,XX @@ def setUp(self):
21
STM32F4xxSyscfgState *s = opaque;
22
22
int icrreg = irq / 4;
23
super().setUp('qemu-system-')
23
int startbit = (irq & 3) * 4;
24
24
- uint8_t config = config = irq / 16;
25
+ accel_required = self._get_unique_tag_val('accel')
25
+ uint8_t config = irq / 16;
26
+ if accel_required:
26
27
+ self.require_accelerator(accel_required)
27
trace_stm32f4xx_syscfg_set_irq(irq / 16, irq % 16, level);
28
+
29
self.machine = self.params.get('machine',
30
default=self._get_unique_tag_val('machine'))
28
31
29
--
32
--
30
2.20.1
33
2.34.1
31
34
32
35
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
We were incorrectly requiring ARMv8.4 support for the pauth
3
This allows the test to be skipped when TCG is not present in the QEMU
4
tests, but Pointer Authentication is an ARMv8.3 extension.
4
binary.
5
Further, hiding the required architecture within asm() is
6
not correct.
7
5
8
Correct the architecture version requested, and specify it
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
9
in the cflags of the (cross-) compiler rather than in the asm.
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
8
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Message-id: 20200116230809.19078-3-richard.henderson@linaro.org
14
[PMM: tweaked commit message]
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
10
---
17
tests/tcg/aarch64/Makefile.target | 1 +
11
tests/avocado/boot_linux_console.py | 1 +
18
tests/tcg/aarch64/pauth-1.c | 2 --
12
tests/avocado/reverse_debugging.py | 8 ++++++++
19
tests/tcg/aarch64/pauth-2.c | 2 --
13
2 files changed, 9 insertions(+)
20
3 files changed, 1 insertion(+), 4 deletions(-)
21
14
22
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
15
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
23
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
24
--- a/tests/tcg/aarch64/Makefile.target
17
--- a/tests/avocado/boot_linux_console.py
25
+++ b/tests/tcg/aarch64/Makefile.target
18
+++ b/tests/avocado/boot_linux_console.py
26
@@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt
19
@@ -XXX,XX +XXX,XX @@ def test_arm_orangepi_uboot_netbsd9(self):
27
# Pauth Tests
20
28
AARCH64_TESTS += pauth-1 pauth-2
21
def test_aarch64_raspi3_atf(self):
29
run-pauth-%: QEMU_OPTS += -cpu max
22
"""
30
+pauth-%: CFLAGS += -march=armv8.3-a
23
+ :avocado: tags=accel:tcg
31
24
:avocado: tags=arch:aarch64
32
# Semihosting smoke test for linux-user
25
:avocado: tags=machine:raspi3b
33
AARCH64_TESTS += semihosting
26
:avocado: tags=cpu:cortex-a53
34
diff --git a/tests/tcg/aarch64/pauth-1.c b/tests/tcg/aarch64/pauth-1.c
27
diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_debugging.py
35
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
36
--- a/tests/tcg/aarch64/pauth-1.c
29
--- a/tests/avocado/reverse_debugging.py
37
+++ b/tests/tcg/aarch64/pauth-1.c
30
+++ b/tests/avocado/reverse_debugging.py
38
@@ -XXX,XX +XXX,XX @@
31
@@ -XXX,XX +XXX,XX @@ def reverse_debugging(self, shift=7, args=None):
39
#include <sys/prctl.h>
32
vm.shutdown()
40
#include <stdio.h>
33
41
34
class ReverseDebugging_X86_64(ReverseDebugging):
42
-asm(".arch armv8.4-a");
35
+ """
43
-
36
+ :avocado: tags=accel:tcg
44
#ifndef PR_PAC_RESET_KEYS
37
+ """
45
#define PR_PAC_RESET_KEYS 54
38
+
46
#define PR_PAC_APDAKEY (1 << 2)
39
REG_PC = 0x10
47
diff --git a/tests/tcg/aarch64/pauth-2.c b/tests/tcg/aarch64/pauth-2.c
40
REG_CS = 0x12
48
index XXXXXXX..XXXXXXX 100644
41
def get_pc(self, g):
49
--- a/tests/tcg/aarch64/pauth-2.c
42
@@ -XXX,XX +XXX,XX @@ def test_x86_64_pc(self):
50
+++ b/tests/tcg/aarch64/pauth-2.c
43
self.reverse_debugging()
51
@@ -XXX,XX +XXX,XX @@
44
52
#include <stdint.h>
45
class ReverseDebugging_AArch64(ReverseDebugging):
53
#include <assert.h>
46
+ """
54
47
+ :avocado: tags=accel:tcg
55
-asm(".arch armv8.4-a");
48
+ """
56
-
49
+
57
void do_test(uint64_t value)
50
REG_PC = 32
58
{
51
59
uint64_t salt1, salt2;
52
# unidentified gitlab timeout problem
60
--
53
--
61
2.20.1
54
2.34.1
62
55
63
56
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
3
Now that the cortex-a15 is under CONFIG_TCG, use as default CPU for a
4
KVM-only build the 'max' cpu.
5
6
Note that we cannot use 'host' here because the qtests can run without
7
any other accelerator (than qtest) and 'host' depends on KVM being
8
enabled.
9
10
Signed-off-by: Fabiano Rosas <farosas@suse.de>
11
Acked-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Thomas Huth <thuth@redhat.com>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
15
hw/arm/virt.c | 4 ++++
16
1 file changed, 4 insertions(+)
17
18
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/arm/virt.c
21
+++ b/hw/arm/virt.c
22
@@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
23
mc->minimum_page_bits = 12;
24
mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids;
25
mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
26
+#ifdef CONFIG_TCG
27
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
28
+#else
29
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("max");
30
+#endif
31
mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
32
mc->kvm_type = virt_kvm_type;
33
assert(!mc->get_hotplug_handler);
34
--
35
2.34.1
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
3
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Acked-by: Thomas Huth <thuth@redhat.com>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
tests/qtest/arm-cpu-features.c | 28 ++++++++++++++++++----------
9
1 file changed, 18 insertions(+), 10 deletions(-)
10
11
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/tests/qtest/arm-cpu-features.c
14
+++ b/tests/qtest/arm-cpu-features.c
15
@@ -XXX,XX +XXX,XX @@
16
#define SVE_MAX_VQ 16
17
18
#define MACHINE "-machine virt,gic-version=max -accel tcg "
19
-#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm -accel tcg "
20
+#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm "
21
#define QUERY_HEAD "{ 'execute': 'query-cpu-model-expansion', " \
22
" 'arguments': { 'type': 'full', "
23
#define QUERY_TAIL "}}"
24
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
25
{
26
g_test_init(&argc, &argv, NULL);
27
28
- qtest_add_data_func("/arm/query-cpu-model-expansion",
29
- NULL, test_query_cpu_model_expansion);
30
+ if (qtest_has_accel("tcg")) {
31
+ qtest_add_data_func("/arm/query-cpu-model-expansion",
32
+ NULL, test_query_cpu_model_expansion);
33
+ }
34
+
35
+ if (!g_str_equal(qtest_get_arch(), "aarch64")) {
36
+ goto out;
37
+ }
38
39
/*
40
* For now we only run KVM specific tests with AArch64 QEMU in
41
* order avoid attempting to run an AArch32 QEMU with KVM on
42
* AArch64 hosts. That won't work and isn't easy to detect.
43
*/
44
- if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("kvm")) {
45
+ if (qtest_has_accel("kvm")) {
46
/*
47
* This tests target the 'host' CPU type, so register it only if
48
* KVM is available.
49
*/
50
qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
51
NULL, test_query_cpu_model_expansion_kvm);
52
- }
53
54
- if (g_str_equal(qtest_get_arch(), "aarch64")) {
55
- qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8",
56
- NULL, sve_tests_sve_max_vq_8);
57
- qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
58
- NULL, sve_tests_sve_off);
59
qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
60
NULL, sve_tests_sve_off_kvm);
61
}
62
63
+ if (qtest_has_accel("tcg")) {
64
+ qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8",
65
+ NULL, sve_tests_sve_max_vq_8);
66
+ qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
67
+ NULL, sve_tests_sve_off);
68
+ }
69
+
70
+out:
71
return g_test_run();
72
}
73
--
74
2.34.1
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
3
These tests set -accel tcg, so restrict them to when TCG is present.
4
5
Signed-off-by: Fabiano Rosas <farosas@suse.de>
6
Acked-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Thomas Huth <thuth@redhat.com>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
tests/qtest/meson.build | 4 ++--
11
1 file changed, 2 insertions(+), 2 deletions(-)
12
13
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
14
index XXXXXXX..XXXXXXX 100644
15
--- a/tests/qtest/meson.build
16
+++ b/tests/qtest/meson.build
17
@@ -XXX,XX +XXX,XX @@ qtests_arm = \
18
# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
19
qtests_aarch64 = \
20
(cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \
21
- (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) + \
22
- (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) + \
23
+ (config_all.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \
24
+ ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \
25
(config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \
26
(config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \
27
['arm-cpu-features',
28
--
29
2.34.1
diff view generated by jsdifflib