1
Patches for rc1: nothing major, just some minor bugfixes and
1
Hi; here's the latest batch of arm changes. The big thing
2
code cleanups.
2
in here is the SMMUv3 changes to add stage-2 translation support.
3
3
4
thanks
4
-- PMM
5
-- PMM
5
6
6
The following changes since commit f7e1914adad8885a5d4c70239ab90d901ed97e9f:
7
The following changes since commit aa9bbd865502ed517624ab6fe7d4b5d89ca95e43:
7
8
8
Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-20201109' into staging (2020-11-10 09:24:56 +0000)
9
Merge tag 'pull-ppc-20230528' of https://gitlab.com/danielhb/qemu into staging (2023-05-29 14:31:52 -0700)
9
10
10
are available in the Git repository at:
11
are available in the Git repository at:
11
12
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201110
13
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230530
13
14
14
for you to fetch changes up to b6c56c8a9a4064ea783f352f43c5df6231a110fa:
15
for you to fetch changes up to b03d0d4f531a8b867e0aac1fab0b876903015680:
15
16
16
target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check (2020-11-10 11:03:48 +0000)
17
docs: sbsa: correct graphics card name (2023-05-30 13:32:46 +0100)
17
18
18
----------------------------------------------------------------
19
----------------------------------------------------------------
19
target-arm queue:
20
target-arm queue:
20
* hw/arm/Kconfig: ARM_V7M depends on PTIMER
21
* fsl-imx6: Add SNVS support for i.MX6 boards
21
* Minor coding style fixes
22
* smmuv3: Add support for stage 2 translations
22
* docs: add some notes on the sbsa-ref machine
23
* hw/dma/xilinx_axidma: Check DMASR.HALTED to prevent infinite loop
23
* hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals
24
* hw/arm/xlnx-zynqmp: fix unsigned error when checking the RPUs number
24
* target/arm: Fix neon VTBL/VTBX for len > 1
25
* cleanups for recent Kconfig changes
25
* hw/arm/armsse: Correct expansion MPC interrupt lines
26
* target/arm: Explicitly select short-format FSR for M-profile
26
* hw/misc/stm32f2xx_syscfg: Remove extraneous IRQ
27
* tests/qtest: Run arm-specific tests only if the required machine is available
27
* hw/arm/nseries: Remove invalid/unnecessary n8x0_uart_setup()
28
* hw/arm/sbsa-ref: add GIC node into DT
28
* hw/arm/musicpal: Don't connect two qemu_irqs directly to the same input
29
* docs: sbsa: correct graphics card name
29
* hw/arm/musicpal: Only use qdev_get_gpio_in() when necessary
30
* Update copyright dates to 2023
30
* hw/arm/nseries: Check return value from load_image_targphys()
31
* tests/qtest/npcm7xx_rng-test: count runs properly
32
* target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check
33
31
34
----------------------------------------------------------------
32
----------------------------------------------------------------
35
Alex Bennée (1):
33
Clément Chigot (1):
36
docs: add some notes on the sbsa-ref machine
34
hw/arm/xlnx-zynqmp: fix unsigned error when checking the RPUs number
37
35
38
AlexChen (1):
36
Enze Li (1):
39
ssi: Fix bad printf format specifiers
37
Update copyright dates to 2023
40
38
41
Andrew Jones (1):
39
Fabiano Rosas (3):
42
hw/arm/Kconfig: ARM_V7M depends on PTIMER
40
target/arm: Explain why we need to select ARM_V7M
41
arm/Kconfig: Keep Kconfig default entries in default.mak as documentation
42
arm/Kconfig: Make TCG dependence explicit
43
43
44
Havard Skinnemoen (1):
44
Marcin Juszkiewicz (2):
45
tests/qtest/npcm7xx_rng-test: count runs properly
45
hw/arm/sbsa-ref: add GIC node into DT
46
docs: sbsa: correct graphics card name
46
47
47
Peter Maydell (2):
48
Mostafa Saleh (10):
48
hw/arm/nseries: Check return value from load_image_targphys()
49
hw/arm/smmuv3: Add missing fields for IDR0
49
target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check
50
hw/arm/smmuv3: Update translation config to hold stage-2
51
hw/arm/smmuv3: Refactor stage-1 PTW
52
hw/arm/smmuv3: Add page table walk for stage-2
53
hw/arm/smmuv3: Parse STE config for stage-2
54
hw/arm/smmuv3: Make TLB lookup work for stage-2
55
hw/arm/smmuv3: Add VMID to TLB tagging
56
hw/arm/smmuv3: Add CMDs related to stage-2
57
hw/arm/smmuv3: Add stage-2 support in iova notifier
58
hw/arm/smmuv3: Add knob to choose translation stage and enable stage-2
50
59
51
Philippe Mathieu-Daudé (6):
60
Peter Maydell (1):
52
hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals
61
target/arm: Explicitly select short-format FSR for M-profile
53
hw/arm/armsse: Correct expansion MPC interrupt lines
54
hw/misc/stm32f2xx_syscfg: Remove extraneous IRQ
55
hw/arm/nseries: Remove invalid/unnecessary n8x0_uart_setup()
56
hw/arm/musicpal: Don't connect two qemu_irqs directly to the same input
57
hw/arm/musicpal: Only use qdev_get_gpio_in() when necessary
58
62
59
Richard Henderson (1):
63
Thomas Huth (1):
60
target/arm: Fix neon VTBL/VTBX for len > 1
64
tests/qtest: Run arm-specific tests only if the required machine is available
61
65
62
Xinhao Zhang (3):
66
Tommy Wu (1):
63
target/arm: add spaces around operator
67
hw/dma/xilinx_axidma: Check DMASR.HALTED to prevent infinite loop.
64
target/arm: Don't use '#' flag of printf format
65
target/arm: add space before the open parenthesis '('
66
68
67
docs/system/arm/sbsa.rst | 32 ++++++++++++++++++++++
69
Vitaly Cheptsov (1):
68
docs/system/target-arm.rst | 1 +
70
fsl-imx6: Add SNVS support for i.MX6 boards
69
include/hw/misc/stm32f2xx_syscfg.h | 2 --
70
target/arm/helper.h | 2 +-
71
hw/arm/armsse.c | 3 +-
72
hw/arm/musicpal.c | 40 +++++++++++++++++----------
73
hw/arm/nseries.c | 26 ++++++++----------
74
hw/arm/stm32f205_soc.c | 1 -
75
hw/misc/stm32f2xx_syscfg.c | 2 --
76
hw/ssi/imx_spi.c | 2 +-
77
hw/ssi/xilinx_spi.c | 2 +-
78
target/arm/arch_dump.c | 8 +++---
79
target/arm/arm-semi.c | 8 +++---
80
target/arm/helper.c | 2 +-
81
target/arm/op_helper.c | 23 +++++++++-------
82
target/arm/translate-a64.c | 4 +--
83
target/arm/translate.c | 2 +-
84
tests/qtest/npcm7xx_rng-test.c | 2 +-
85
hw/arm/Kconfig | 3 +-
86
target/arm/translate-neon.c.inc | 56 ++++++++++++++------------------------
87
20 files changed, 123 insertions(+), 98 deletions(-)
88
create mode 100644 docs/system/arm/sbsa.rst
89
71
72
docs/conf.py | 2 +-
73
docs/system/arm/sbsa.rst | 2 +-
74
configs/devices/aarch64-softmmu/default.mak | 6 +
75
configs/devices/arm-softmmu/default.mak | 40 ++++
76
hw/arm/smmu-internal.h | 37 +++
77
hw/arm/smmuv3-internal.h | 12 +-
78
include/hw/arm/fsl-imx6.h | 2 +
79
include/hw/arm/smmu-common.h | 45 +++-
80
include/hw/arm/smmuv3.h | 4 +
81
include/qemu/help-texts.h | 2 +-
82
hw/arm/fsl-imx6.c | 8 +
83
hw/arm/sbsa-ref.c | 19 +-
84
hw/arm/smmu-common.c | 209 ++++++++++++++--
85
hw/arm/smmuv3.c | 357 ++++++++++++++++++++++++----
86
hw/arm/xlnx-zynqmp.c | 2 +-
87
hw/dma/xilinx_axidma.c | 11 +-
88
target/arm/tcg/tlb_helper.c | 13 +-
89
hw/arm/Kconfig | 123 ++++++----
90
hw/arm/trace-events | 14 +-
91
target/arm/Kconfig | 3 +
92
tests/qtest/meson.build | 7 +-
93
21 files changed, 773 insertions(+), 145 deletions(-)
94
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Vitaly Cheptsov <cheptsov@ispras.ru>
2
2
3
We don't need to fill the full pic[] array if we only use
3
SNVS is supported on both i.MX6 and i.MX6UL and is needed
4
few of the interrupt lines. Directly call qdev_get_gpio_in()
4
to support shutdown on the board.
5
when necessary.
6
5
7
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Cc: Peter Maydell <peter.maydell@linaro.org> (odd fixer:SABRELITE / i.MX6)
8
Message-id: 20201107193403.436146-6-f4bug@amsat.org
7
Cc: Jean-Christophe Dubois <jcd@tribudubois.net> (reviewer:SABRELITE / i.MX6)
8
Cc: qemu-arm@nongnu.org (open list:SABRELITE / i.MX6)
9
Cc: qemu-devel@nongnu.org (open list:All patches CC here)
10
Signed-off-by: Vitaly Cheptsov <cheptsov@ispras.ru>
11
Message-id: 20230515095015.66860-1-cheptsov@ispras.ru
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
14
---
12
hw/arm/musicpal.c | 25 +++++++++++++------------
15
include/hw/arm/fsl-imx6.h | 2 ++
13
1 file changed, 13 insertions(+), 12 deletions(-)
16
hw/arm/fsl-imx6.c | 8 ++++++++
17
2 files changed, 10 insertions(+)
14
18
15
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
19
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
16
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/musicpal.c
21
--- a/include/hw/arm/fsl-imx6.h
18
+++ b/hw/arm/musicpal.c
22
+++ b/include/hw/arm/fsl-imx6.h
19
@@ -XXX,XX +XXX,XX @@ static struct arm_boot_info musicpal_binfo = {
23
@@ -XXX,XX +XXX,XX @@
20
static void musicpal_init(MachineState *machine)
24
#include "hw/cpu/a9mpcore.h"
21
{
25
#include "hw/misc/imx6_ccm.h"
22
ARMCPU *cpu;
26
#include "hw/misc/imx6_src.h"
23
- qemu_irq pic[32];
27
+#include "hw/misc/imx7_snvs.h"
24
DeviceState *dev;
28
#include "hw/watchdog/wdt_imx2.h"
25
+ DeviceState *pic;
29
#include "hw/char/imx_serial.h"
26
DeviceState *uart_orgate;
30
#include "hw/timer/imx_gpt.h"
27
DeviceState *i2c_dev;
31
@@ -XXX,XX +XXX,XX @@ struct FslIMX6State {
28
DeviceState *lcd_dev;
32
A9MPPrivState a9mpcore;
29
@@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine)
33
IMX6CCMState ccm;
30
&error_fatal);
34
IMX6SRCState src;
31
memory_region_add_subregion(address_space_mem, MP_SRAM_BASE, sram);
35
+ IMX7SNVSState snvs;
32
36
IMXSerialState uart[FSL_IMX6_NUM_UARTS];
33
- dev = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE,
37
IMXGPTState gpt;
34
+ pic = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE,
38
IMXEPITState epit[FSL_IMX6_NUM_EPITS];
35
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));
39
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
36
- for (i = 0; i < 32; i++) {
40
index XXXXXXX..XXXXXXX 100644
37
- pic[i] = qdev_get_gpio_in(dev, i);
41
--- a/hw/arm/fsl-imx6.c
38
- }
42
+++ b/hw/arm/fsl-imx6.c
39
- sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE, pic[MP_TIMER1_IRQ],
43
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj)
40
- pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ],
44
41
- pic[MP_TIMER4_IRQ], NULL);
45
object_initialize_child(obj, "src", &s->src, TYPE_IMX6_SRC);
42
+ sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE,
46
43
+ qdev_get_gpio_in(pic, MP_TIMER1_IRQ),
47
+ object_initialize_child(obj, "snvs", &s->snvs, TYPE_IMX7_SNVS);
44
+ qdev_get_gpio_in(pic, MP_TIMER2_IRQ),
48
+
45
+ qdev_get_gpio_in(pic, MP_TIMER3_IRQ),
49
for (i = 0; i < FSL_IMX6_NUM_UARTS; i++) {
46
+ qdev_get_gpio_in(pic, MP_TIMER4_IRQ), NULL);
50
snprintf(name, NAME_SIZE, "uart%d", i + 1);
47
51
object_initialize_child(obj, name, &s->uart[i], TYPE_IMX_SERIAL);
48
/* Logically OR both UART IRQs together */
52
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
49
uart_orgate = DEVICE(object_new(TYPE_OR_IRQ));
53
qdev_get_gpio_in(DEVICE(&s->a9mpcore),
50
object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal);
54
FSL_IMX6_ENET_MAC_1588_IRQ));
51
qdev_realize_and_unref(uart_orgate, NULL, &error_fatal);
55
52
- qdev_connect_gpio_out(DEVICE(uart_orgate), 0, pic[MP_UART_SHARED_IRQ]);
56
+ /*
53
+ qdev_connect_gpio_out(DEVICE(uart_orgate), 0,
57
+ * SNVS
54
+ qdev_get_gpio_in(pic, MP_UART_SHARED_IRQ));
58
+ */
55
59
+ sysbus_realize(SYS_BUS_DEVICE(&s->snvs), &error_abort);
56
serial_mm_init(address_space_mem, MP_UART1_BASE, 2,
60
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->snvs), 0, FSL_IMX6_SNVSHP_ADDR);
57
qdev_get_gpio_in(uart_orgate, 0),
61
+
58
@@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine)
62
/*
59
OBJECT(get_system_memory()), &error_fatal);
63
* Watchdog
60
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
64
*/
61
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, MP_ETH_BASE);
62
- sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[MP_ETH_IRQ]);
63
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
64
+ qdev_get_gpio_in(pic, MP_ETH_IRQ));
65
66
sysbus_create_simple("mv88w8618_wlan", MP_WLAN_BASE, NULL);
67
68
sysbus_create_simple(TYPE_MUSICPAL_MISC, MP_MISC_BASE, NULL);
69
70
dev = sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE,
71
- pic[MP_GPIO_IRQ]);
72
+ qdev_get_gpio_in(pic, MP_GPIO_IRQ));
73
i2c_dev = sysbus_create_simple("gpio_i2c", -1, NULL);
74
i2c = (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c");
75
76
@@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine)
77
NULL);
78
sysbus_realize_and_unref(s, &error_fatal);
79
sysbus_mmio_map(s, 0, MP_AUDIO_BASE);
80
- sysbus_connect_irq(s, 0, pic[MP_AUDIO_IRQ]);
81
+ sysbus_connect_irq(s, 0, qdev_get_gpio_in(pic, MP_AUDIO_IRQ));
82
83
musicpal_binfo.ram_size = MP_RAM_DEFAULT_SIZE;
84
arm_load_kernel(cpu, machine, &musicpal_binfo);
85
--
65
--
86
2.20.1
66
2.34.1
87
88
diff view generated by jsdifflib
New patch
1
From: Mostafa Saleh <smostafa@google.com>
1
2
3
In preparation for adding stage-2 support.
4
Add IDR0 fields related to stage-2.
5
6
VMID16: 16-bit VMID supported.
7
S2P: Stage-2 translation supported.
8
9
They are described in 6.3.1 SMMU_IDR0.
10
11
No functional change intended.
12
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Eric Auger <eric.auger@redhat.com>
15
Signed-off-by: Mostafa Saleh <smostafa@google.com>
16
Tested-by: Eric Auger <eric.auger@redhat.com>
17
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
18
Message-id: 20230516203327.2051088-2-smostafa@google.com
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
21
hw/arm/smmuv3-internal.h | 2 ++
22
1 file changed, 2 insertions(+)
23
24
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
25
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/arm/smmuv3-internal.h
27
+++ b/hw/arm/smmuv3-internal.h
28
@@ -XXX,XX +XXX,XX @@ typedef enum SMMUTranslationStatus {
29
/* MMIO Registers */
30
31
REG32(IDR0, 0x0)
32
+ FIELD(IDR0, S2P, 0 , 1)
33
FIELD(IDR0, S1P, 1 , 1)
34
FIELD(IDR0, TTF, 2 , 2)
35
FIELD(IDR0, COHACC, 4 , 1)
36
FIELD(IDR0, ASID16, 12, 1)
37
+ FIELD(IDR0, VMID16, 18, 1)
38
FIELD(IDR0, TTENDIAN, 21, 2)
39
FIELD(IDR0, STALL_MODEL, 24, 2)
40
FIELD(IDR0, TERM_MODEL, 26, 1)
41
--
42
2.34.1
diff view generated by jsdifflib
New patch
1
From: Mostafa Saleh <smostafa@google.com>
1
2
3
In preparation for adding stage-2 support, add a S2 config
4
struct(SMMUS2Cfg), composed of the following fields and embedded in
5
the main SMMUTransCfg:
6
-tsz: Size of IPA input region (S2T0SZ)
7
-sl0: Start level of translation (S2SL0)
8
-affd: AF Fault Disable (S2AFFD)
9
-record_faults: Record fault events (S2R)
10
-granule_sz: Granule page shift (based on S2TG)
11
-vmid: Virtual Machine ID (S2VMID)
12
-vttb: Address of translation table base (S2TTB)
13
-eff_ps: Effective PA output range (based on S2PS)
14
15
They will be used in the next patches in stage-2 address translation.
16
17
The fields in SMMUS2Cfg, are reordered to make the shared and stage-1
18
fields next to each other, this reordering didn't change the struct
19
size (104 bytes before and after).
20
21
Stage-1 only fields: aa64, asid, tt, ttb, tbi, record_faults, oas.
22
oas is stage-1 output address size. However, it is used to check
23
input address in case stage-1 is unimplemented or bypassed according
24
to SMMUv3 manual IHI0070.E "3.4. Address sizes"
25
26
Shared fields: stage, disabled, bypassed, aborted, iotlb_*.
27
28
No functional change intended.
29
30
Reviewed-by: Eric Auger <eric.auger@redhat.com>
31
Signed-off-by: Mostafa Saleh <smostafa@google.com>
32
Tested-by: Eric Auger <eric.auger@redhat.com>
33
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
34
Message-id: 20230516203327.2051088-3-smostafa@google.com
35
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
36
---
37
include/hw/arm/smmu-common.h | 22 +++++++++++++++++++---
38
1 file changed, 19 insertions(+), 3 deletions(-)
39
40
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
41
index XXXXXXX..XXXXXXX 100644
42
--- a/include/hw/arm/smmu-common.h
43
+++ b/include/hw/arm/smmu-common.h
44
@@ -XXX,XX +XXX,XX @@ typedef struct SMMUTLBEntry {
45
uint8_t granule;
46
} SMMUTLBEntry;
47
48
+/* Stage-2 configuration. */
49
+typedef struct SMMUS2Cfg {
50
+ uint8_t tsz; /* Size of IPA input region (S2T0SZ) */
51
+ uint8_t sl0; /* Start level of translation (S2SL0) */
52
+ bool affd; /* AF Fault Disable (S2AFFD) */
53
+ bool record_faults; /* Record fault events (S2R) */
54
+ uint8_t granule_sz; /* Granule page shift (based on S2TG) */
55
+ uint8_t eff_ps; /* Effective PA output range (based on S2PS) */
56
+ uint16_t vmid; /* Virtual Machine ID (S2VMID) */
57
+ uint64_t vttb; /* Address of translation table base (S2TTB) */
58
+} SMMUS2Cfg;
59
+
60
/*
61
* Generic structure populated by derived SMMU devices
62
* after decoding the configuration information and used as
63
* input to the page table walk
64
*/
65
typedef struct SMMUTransCfg {
66
+ /* Shared fields between stage-1 and stage-2. */
67
int stage; /* translation stage */
68
- bool aa64; /* arch64 or aarch32 translation table */
69
bool disabled; /* smmu is disabled */
70
bool bypassed; /* translation is bypassed */
71
bool aborted; /* translation is aborted */
72
+ uint32_t iotlb_hits; /* counts IOTLB hits */
73
+ uint32_t iotlb_misses; /* counts IOTLB misses*/
74
+ /* Used by stage-1 only. */
75
+ bool aa64; /* arch64 or aarch32 translation table */
76
bool record_faults; /* record fault events */
77
uint64_t ttb; /* TT base address */
78
uint8_t oas; /* output address width */
79
uint8_t tbi; /* Top Byte Ignore */
80
uint16_t asid;
81
SMMUTransTableInfo tt[2];
82
- uint32_t iotlb_hits; /* counts IOTLB hits for this asid */
83
- uint32_t iotlb_misses; /* counts IOTLB misses for this asid */
84
+ /* Used by stage-2 only. */
85
+ struct SMMUS2Cfg s2cfg;
86
} SMMUTransCfg;
87
88
typedef struct SMMUDevice {
89
--
90
2.34.1
diff view generated by jsdifflib
1
Checks for UNDEF cases should go before the "is VFP enabled?" access
1
From: Mostafa Saleh <smostafa@google.com>
2
check, except in special cases. Move a stray UNDEF check in the VTBL
3
trans function up above the access check.
4
2
3
In preparation for adding stage-2 support, rename smmu_ptw_64 to
4
smmu_ptw_64_s1 and refactor some of the code so it can be reused in
5
stage-2 page table walk.
6
7
Remove AA64 check from PTW as decode_cd already ensures that AA64 is
8
used, otherwise it faults with C_BAD_CD.
9
10
A stage member is added to SMMUPTWEventInfo to differentiate
11
between stage-1 and stage-2 ptw faults.
12
13
Add stage argument to trace_smmu_ptw_level be consistent with other
14
trace events.
15
16
Signed-off-by: Mostafa Saleh <smostafa@google.com>
17
Reviewed-by: Eric Auger <eric.auger@redhat.com>
18
Tested-by: Eric Auger <eric.auger@redhat.com>
19
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
20
Message-id: 20230516203327.2051088-4-smostafa@google.com
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20201109145324.2859-1-peter.maydell@linaro.org
8
---
22
---
9
target/arm/translate-neon.c.inc | 8 ++++----
23
include/hw/arm/smmu-common.h | 16 +++++++++++++---
10
1 file changed, 4 insertions(+), 4 deletions(-)
24
hw/arm/smmu-common.c | 27 ++++++++++-----------------
25
hw/arm/smmuv3.c | 2 ++
26
hw/arm/trace-events | 2 +-
27
4 files changed, 26 insertions(+), 21 deletions(-)
11
28
12
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
29
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
13
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/translate-neon.c.inc
31
--- a/include/hw/arm/smmu-common.h
15
+++ b/target/arm/translate-neon.c.inc
32
+++ b/include/hw/arm/smmu-common.h
16
@@ -XXX,XX +XXX,XX @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a)
33
@@ -XXX,XX +XXX,XX @@
17
return false;
34
#include "hw/pci/pci.h"
35
#include "qom/object.h"
36
37
-#define SMMU_PCI_BUS_MAX 256
38
-#define SMMU_PCI_DEVFN_MAX 256
39
-#define SMMU_PCI_DEVFN(sid) (sid & 0xFF)
40
+#define SMMU_PCI_BUS_MAX 256
41
+#define SMMU_PCI_DEVFN_MAX 256
42
+#define SMMU_PCI_DEVFN(sid) (sid & 0xFF)
43
+
44
+/* VMSAv8-64 Translation constants and functions */
45
+#define VMSA_LEVELS 4
46
+
47
+#define VMSA_STRIDE(gran) ((gran) - VMSA_LEVELS + 1)
48
+#define VMSA_BIT_LVL(isz, strd, lvl) ((isz) - (strd) * \
49
+ (VMSA_LEVELS - (lvl)))
50
+#define VMSA_IDXMSK(isz, strd, lvl) ((1ULL << \
51
+ VMSA_BIT_LVL(isz, strd, lvl)) - 1)
52
53
/*
54
* Page table walk error types
55
@@ -XXX,XX +XXX,XX @@ typedef enum {
56
} SMMUPTWEventType;
57
58
typedef struct SMMUPTWEventInfo {
59
+ int stage;
60
SMMUPTWEventType type;
61
dma_addr_t addr; /* fetched address that induced an abort, if any */
62
} SMMUPTWEventInfo;
63
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
64
index XXXXXXX..XXXXXXX 100644
65
--- a/hw/arm/smmu-common.c
66
+++ b/hw/arm/smmu-common.c
67
@@ -XXX,XX +XXX,XX @@ SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova)
68
}
69
70
/**
71
- * smmu_ptw_64 - VMSAv8-64 Walk of the page tables for a given IOVA
72
+ * smmu_ptw_64_s1 - VMSAv8-64 Walk of the page tables for a given IOVA
73
* @cfg: translation config
74
* @iova: iova to translate
75
* @perm: access type
76
@@ -XXX,XX +XXX,XX @@ SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova)
77
* Upon success, @tlbe is filled with translated_addr and entry
78
* permission rights.
79
*/
80
-static int smmu_ptw_64(SMMUTransCfg *cfg,
81
- dma_addr_t iova, IOMMUAccessFlags perm,
82
- SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
83
+static int smmu_ptw_64_s1(SMMUTransCfg *cfg,
84
+ dma_addr_t iova, IOMMUAccessFlags perm,
85
+ SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
86
{
87
dma_addr_t baseaddr, indexmask;
88
int stage = cfg->stage;
89
@@ -XXX,XX +XXX,XX @@ static int smmu_ptw_64(SMMUTransCfg *cfg,
18
}
90
}
19
91
20
- if (!vfp_access_check(s)) {
92
granule_sz = tt->granule_sz;
21
- return true;
93
- stride = granule_sz - 3;
94
+ stride = VMSA_STRIDE(granule_sz);
95
inputsize = 64 - tt->tsz;
96
level = 4 - (inputsize - 4) / stride;
97
- indexmask = (1ULL << (inputsize - (stride * (4 - level)))) - 1;
98
+ indexmask = VMSA_IDXMSK(inputsize, stride, level);
99
baseaddr = extract64(tt->ttb, 0, 48);
100
baseaddr &= ~indexmask;
101
102
- while (level <= 3) {
103
+ while (level < VMSA_LEVELS) {
104
uint64_t subpage_size = 1ULL << level_shift(level, granule_sz);
105
uint64_t mask = subpage_size - 1;
106
uint32_t offset = iova_level_offset(iova, inputsize, level, granule_sz);
107
@@ -XXX,XX +XXX,XX @@ static int smmu_ptw_64(SMMUTransCfg *cfg,
108
if (get_pte(baseaddr, offset, &pte, info)) {
109
goto error;
110
}
111
- trace_smmu_ptw_level(level, iova, subpage_size,
112
+ trace_smmu_ptw_level(stage, level, iova, subpage_size,
113
baseaddr, offset, pte);
114
115
if (is_invalid_pte(pte) || is_reserved_pte(pte, level)) {
116
@@ -XXX,XX +XXX,XX @@ static int smmu_ptw_64(SMMUTransCfg *cfg,
117
info->type = SMMU_PTW_ERR_TRANSLATION;
118
119
error:
120
+ info->stage = 1;
121
tlbe->entry.perm = IOMMU_NONE;
122
return -EINVAL;
123
}
124
@@ -XXX,XX +XXX,XX @@ error:
125
int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
126
SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
127
{
128
- if (!cfg->aa64) {
129
- /*
130
- * This code path is not entered as we check this while decoding
131
- * the configuration data in the derived SMMU model.
132
- */
133
- g_assert_not_reached();
22
- }
134
- }
23
-
135
-
24
if ((a->vn + a->len + 1) > 32) {
136
- return smmu_ptw_64(cfg, iova, perm, tlbe, info);
25
/*
137
+ return smmu_ptw_64_s1(cfg, iova, perm, tlbe, info);
26
* This is UNPREDICTABLE; we choose to UNDEF to avoid the
138
}
27
@@ -XXX,XX +XXX,XX @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a)
139
28
return false;
140
/**
29
}
141
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
30
142
index XXXXXXX..XXXXXXX 100644
31
+ if (!vfp_access_check(s)) {
143
--- a/hw/arm/smmuv3.c
32
+ return true;
144
+++ b/hw/arm/smmuv3.c
33
+ }
145
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
34
+
146
cached_entry = g_new0(SMMUTLBEntry, 1);
35
desc = tcg_const_i32((a->vn << 2) | a->len);
147
36
def = tcg_temp_new_i64();
148
if (smmu_ptw(cfg, aligned_addr, flag, cached_entry, &ptw_info)) {
37
if (a->op) {
149
+ /* All faults from PTW has S2 field. */
150
+ event.u.f_walk_eabt.s2 = (ptw_info.stage == 2);
151
g_free(cached_entry);
152
switch (ptw_info.type) {
153
case SMMU_PTW_ERR_WALK_EABT:
154
diff --git a/hw/arm/trace-events b/hw/arm/trace-events
155
index XXXXXXX..XXXXXXX 100644
156
--- a/hw/arm/trace-events
157
+++ b/hw/arm/trace-events
158
@@ -XXX,XX +XXX,XX @@ virt_acpi_setup(void) "No fw cfg or ACPI disabled. Bailing out."
159
160
# smmu-common.c
161
smmu_add_mr(const char *name) "%s"
162
-smmu_ptw_level(int level, uint64_t iova, size_t subpage_size, uint64_t baseaddr, uint32_t offset, uint64_t pte) "level=%d iova=0x%"PRIx64" subpage_sz=0x%zx baseaddr=0x%"PRIx64" offset=%d => pte=0x%"PRIx64
163
+smmu_ptw_level(int stage, int level, uint64_t iova, size_t subpage_size, uint64_t baseaddr, uint32_t offset, uint64_t pte) "stage=%d level=%d iova=0x%"PRIx64" subpage_sz=0x%zx baseaddr=0x%"PRIx64" offset=%d => pte=0x%"PRIx64
164
smmu_ptw_invalid_pte(int stage, int level, uint64_t baseaddr, uint64_t pteaddr, uint32_t offset, uint64_t pte) "stage=%d level=%d base@=0x%"PRIx64" pte@=0x%"PRIx64" offset=%d pte=0x%"PRIx64
165
smmu_ptw_page_pte(int stage, int level, uint64_t iova, uint64_t baseaddr, uint64_t pteaddr, uint64_t pte, uint64_t address) "stage=%d level=%d iova=0x%"PRIx64" base@=0x%"PRIx64" pte@=0x%"PRIx64" pte=0x%"PRIx64" page address = 0x%"PRIx64
166
smmu_ptw_block_pte(int stage, int level, uint64_t baseaddr, uint64_t pteaddr, uint64_t pte, uint64_t iova, uint64_t gpa, int bsize_mb) "stage=%d level=%d base@=0x%"PRIx64" pte@=0x%"PRIx64" pte=0x%"PRIx64" iova=0x%"PRIx64" block address = 0x%"PRIx64" block size = %d MiB"
38
--
167
--
39
2.20.1
168
2.34.1
40
41
diff view generated by jsdifflib
New patch
1
1
From: Mostafa Saleh <smostafa@google.com>
2
3
In preparation for adding stage-2 support, add Stage-2 PTW code.
4
Only Aarch64 format is supported as stage-1.
5
6
Nesting stage-1 and stage-2 is not supported right now.
7
8
HTTU is not supported, SW is expected to maintain the Access flag.
9
This is described in the SMMUv3 manual(IHI 0070.E.a)
10
"5.2. Stream Table Entry" in "[181] S2AFFD".
11
This flag determines the behavior on access of a stage-2 page whose
12
descriptor has AF == 0:
13
- 0b0: An Access flag fault occurs (stall not supported).
14
- 0b1: An Access flag fault never occurs.
15
An Access fault takes priority over a Permission fault.
16
17
There are 3 address size checks for stage-2 according to
18
(IHI 0070.E.a) in "3.4. Address sizes".
19
- As nesting is not supported, input address is passed directly to
20
stage-2, and is checked against IAS.
21
We use cfg->oas to hold the OAS when stage-1 is not used, this is set
22
in the next patch.
23
This check is done outside of smmu_ptw_64_s2 as it is not part of
24
stage-2(it throws stage-1 fault), and the stage-2 function shouldn't
25
change it's behavior when nesting is supported.
26
When nesting is supported and we figure out how to combine TLB for
27
stage-1 and stage-2 we can move this check into the stage-1 function
28
as described in ARM DDI0487I.a in pseudocode
29
aarch64/translation/vmsa_translation/AArch64.S1Translate
30
aarch64/translation/vmsa_translation/AArch64.S1DisabledOutput
31
32
- Input to stage-2 is checked against s2t0sz, and throws stage-2
33
transaltion fault if exceeds it.
34
35
- Output of stage-2 is checked against effective PA output range.
36
37
Reviewed-by: Eric Auger <eric.auger@redhat.com>
38
Signed-off-by: Mostafa Saleh <smostafa@google.com>
39
Tested-by: Eric Auger <eric.auger@redhat.com>
40
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
41
Message-id: 20230516203327.2051088-5-smostafa@google.com
42
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
43
---
44
hw/arm/smmu-internal.h | 35 ++++++++++
45
hw/arm/smmu-common.c | 142 ++++++++++++++++++++++++++++++++++++++++-
46
2 files changed, 176 insertions(+), 1 deletion(-)
47
48
diff --git a/hw/arm/smmu-internal.h b/hw/arm/smmu-internal.h
49
index XXXXXXX..XXXXXXX 100644
50
--- a/hw/arm/smmu-internal.h
51
+++ b/hw/arm/smmu-internal.h
52
@@ -XXX,XX +XXX,XX @@
53
#define PTE_APTABLE(pte) \
54
(extract64(pte, 61, 2))
55
56
+#define PTE_AF(pte) \
57
+ (extract64(pte, 10, 1))
58
/*
59
* TODO: At the moment all transactions are considered as privileged (EL1)
60
* as IOMMU translation callback does not pass user/priv attributes.
61
@@ -XXX,XX +XXX,XX @@
62
#define is_permission_fault(ap, perm) \
63
(((perm) & IOMMU_WO) && ((ap) & 0x2))
64
65
+#define is_permission_fault_s2(s2ap, perm) \
66
+ (!(((s2ap) & (perm)) == (perm)))
67
+
68
#define PTE_AP_TO_PERM(ap) \
69
(IOMMU_ACCESS_FLAG(true, !((ap) & 0x2)))
70
71
@@ -XXX,XX +XXX,XX @@ uint64_t iova_level_offset(uint64_t iova, int inputsize,
72
MAKE_64BIT_MASK(0, gsz - 3);
73
}
74
75
+/* FEAT_LPA2 and FEAT_TTST are not implemented. */
76
+static inline int get_start_level(int sl0 , int granule_sz)
77
+{
78
+ /* ARM DDI0487I.a: Table D8-12. */
79
+ if (granule_sz == 12) {
80
+ return 2 - sl0;
81
+ }
82
+ /* ARM DDI0487I.a: Table D8-22 and Table D8-31. */
83
+ return 3 - sl0;
84
+}
85
+
86
+/*
87
+ * Index in a concatenated first level stage-2 page table.
88
+ * ARM DDI0487I.a: D8.2.2 Concatenated translation tables.
89
+ */
90
+static inline int pgd_concat_idx(int start_level, int granule_sz,
91
+ dma_addr_t ipa)
92
+{
93
+ uint64_t ret;
94
+ /*
95
+ * Get the number of bits handled by next levels, then any extra bits in
96
+ * the address should index the concatenated tables. This relation can be
97
+ * deduced from tables in ARM DDI0487I.a: D8.2.7-9
98
+ */
99
+ int shift = level_shift(start_level - 1, granule_sz);
100
+
101
+ ret = ipa >> shift;
102
+ return ret;
103
+}
104
+
105
#define SMMU_IOTLB_ASID(key) ((key).asid)
106
107
typedef struct SMMUIOTLBPageInvInfo {
108
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
109
index XXXXXXX..XXXXXXX 100644
110
--- a/hw/arm/smmu-common.c
111
+++ b/hw/arm/smmu-common.c
112
@@ -XXX,XX +XXX,XX @@ error:
113
return -EINVAL;
114
}
115
116
+/**
117
+ * smmu_ptw_64_s2 - VMSAv8-64 Walk of the page tables for a given ipa
118
+ * for stage-2.
119
+ * @cfg: translation config
120
+ * @ipa: ipa to translate
121
+ * @perm: access type
122
+ * @tlbe: SMMUTLBEntry (out)
123
+ * @info: handle to an error info
124
+ *
125
+ * Return 0 on success, < 0 on error. In case of error, @info is filled
126
+ * and tlbe->perm is set to IOMMU_NONE.
127
+ * Upon success, @tlbe is filled with translated_addr and entry
128
+ * permission rights.
129
+ */
130
+static int smmu_ptw_64_s2(SMMUTransCfg *cfg,
131
+ dma_addr_t ipa, IOMMUAccessFlags perm,
132
+ SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
133
+{
134
+ const int stage = 2;
135
+ int granule_sz = cfg->s2cfg.granule_sz;
136
+ /* ARM DDI0487I.a: Table D8-7. */
137
+ int inputsize = 64 - cfg->s2cfg.tsz;
138
+ int level = get_start_level(cfg->s2cfg.sl0, granule_sz);
139
+ int stride = VMSA_STRIDE(granule_sz);
140
+ int idx = pgd_concat_idx(level, granule_sz, ipa);
141
+ /*
142
+ * Get the ttb from concatenated structure.
143
+ * The offset is the idx * size of each ttb(number of ptes * (sizeof(pte))
144
+ */
145
+ uint64_t baseaddr = extract64(cfg->s2cfg.vttb, 0, 48) + (1 << stride) *
146
+ idx * sizeof(uint64_t);
147
+ dma_addr_t indexmask = VMSA_IDXMSK(inputsize, stride, level);
148
+
149
+ baseaddr &= ~indexmask;
150
+
151
+ /*
152
+ * On input, a stage 2 Translation fault occurs if the IPA is outside the
153
+ * range configured by the relevant S2T0SZ field of the STE.
154
+ */
155
+ if (ipa >= (1ULL << inputsize)) {
156
+ info->type = SMMU_PTW_ERR_TRANSLATION;
157
+ goto error;
158
+ }
159
+
160
+ while (level < VMSA_LEVELS) {
161
+ uint64_t subpage_size = 1ULL << level_shift(level, granule_sz);
162
+ uint64_t mask = subpage_size - 1;
163
+ uint32_t offset = iova_level_offset(ipa, inputsize, level, granule_sz);
164
+ uint64_t pte, gpa;
165
+ dma_addr_t pte_addr = baseaddr + offset * sizeof(pte);
166
+ uint8_t s2ap;
167
+
168
+ if (get_pte(baseaddr, offset, &pte, info)) {
169
+ goto error;
170
+ }
171
+ trace_smmu_ptw_level(stage, level, ipa, subpage_size,
172
+ baseaddr, offset, pte);
173
+ if (is_invalid_pte(pte) || is_reserved_pte(pte, level)) {
174
+ trace_smmu_ptw_invalid_pte(stage, level, baseaddr,
175
+ pte_addr, offset, pte);
176
+ break;
177
+ }
178
+
179
+ if (is_table_pte(pte, level)) {
180
+ baseaddr = get_table_pte_address(pte, granule_sz);
181
+ level++;
182
+ continue;
183
+ } else if (is_page_pte(pte, level)) {
184
+ gpa = get_page_pte_address(pte, granule_sz);
185
+ trace_smmu_ptw_page_pte(stage, level, ipa,
186
+ baseaddr, pte_addr, pte, gpa);
187
+ } else {
188
+ uint64_t block_size;
189
+
190
+ gpa = get_block_pte_address(pte, level, granule_sz,
191
+ &block_size);
192
+ trace_smmu_ptw_block_pte(stage, level, baseaddr,
193
+ pte_addr, pte, ipa, gpa,
194
+ block_size >> 20);
195
+ }
196
+
197
+ /*
198
+ * If S2AFFD and PTE.AF are 0 => fault. (5.2. Stream Table Entry)
199
+ * An Access fault takes priority over a Permission fault.
200
+ */
201
+ if (!PTE_AF(pte) && !cfg->s2cfg.affd) {
202
+ info->type = SMMU_PTW_ERR_ACCESS;
203
+ goto error;
204
+ }
205
+
206
+ s2ap = PTE_AP(pte);
207
+ if (is_permission_fault_s2(s2ap, perm)) {
208
+ info->type = SMMU_PTW_ERR_PERMISSION;
209
+ goto error;
210
+ }
211
+
212
+ /*
213
+ * The address output from the translation causes a stage 2 Address
214
+ * Size fault if it exceeds the effective PA output range.
215
+ */
216
+ if (gpa >= (1ULL << cfg->s2cfg.eff_ps)) {
217
+ info->type = SMMU_PTW_ERR_ADDR_SIZE;
218
+ goto error;
219
+ }
220
+
221
+ tlbe->entry.translated_addr = gpa;
222
+ tlbe->entry.iova = ipa & ~mask;
223
+ tlbe->entry.addr_mask = mask;
224
+ tlbe->entry.perm = s2ap;
225
+ tlbe->level = level;
226
+ tlbe->granule = granule_sz;
227
+ return 0;
228
+ }
229
+ info->type = SMMU_PTW_ERR_TRANSLATION;
230
+
231
+error:
232
+ info->stage = 2;
233
+ tlbe->entry.perm = IOMMU_NONE;
234
+ return -EINVAL;
235
+}
236
+
237
/**
238
* smmu_ptw - Walk the page tables for an IOVA, according to @cfg
239
*
240
@@ -XXX,XX +XXX,XX @@ error:
241
int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
242
SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
243
{
244
- return smmu_ptw_64_s1(cfg, iova, perm, tlbe, info);
245
+ if (cfg->stage == 1) {
246
+ return smmu_ptw_64_s1(cfg, iova, perm, tlbe, info);
247
+ } else if (cfg->stage == 2) {
248
+ /*
249
+ * If bypassing stage 1(or unimplemented), the input address is passed
250
+ * directly to stage 2 as IPA. If the input address of a transaction
251
+ * exceeds the size of the IAS, a stage 1 Address Size fault occurs.
252
+ * For AA64, IAS = OAS according to (IHI 0070.E.a) "3.4 Address sizes"
253
+ */
254
+ if (iova >= (1ULL << cfg->oas)) {
255
+ info->type = SMMU_PTW_ERR_ADDR_SIZE;
256
+ info->stage = 1;
257
+ tlbe->entry.perm = IOMMU_NONE;
258
+ return -EINVAL;
259
+ }
260
+
261
+ return smmu_ptw_64_s2(cfg, iova, perm, tlbe, info);
262
+ }
263
+
264
+ g_assert_not_reached();
265
}
266
267
/**
268
--
269
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
The helper function did not get updated when we reorganized
3
Parse stage-2 configuration from STE and populate it in SMMUS2Cfg.
4
the vector register file for SVE. Since then, the neon dregs
4
Validity of field values are checked when possible.
5
are non-sequential and cannot be simply indexed.
5
6
6
Only AA64 tables are supported and Small Translation Tables (STT) are
7
At the same time, make the helper function operate on 64-bit
7
not supported.
8
quantities so that we do not have to call it twice.
8
9
9
According to SMMUv3 UM(IHI0070E) "5.2 Stream Table Entry": All fields
10
Fixes: c39c2b9043e
10
with an S2 prefix (with the exception of S2VMID) are IGNORED when
11
Reported-by: Ard Biesheuvel <ardb@kernel.org>
11
stage-2 bypasses translation (Config[1] == 0).
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
13
[PMM: use aa32_vfp_dreg() rather than opencoding]
13
Which means that VMID can be used(for TLB tagging) even if stage-2 is
14
Message-id: 20201105171126.88014-1-richard.henderson@linaro.org
14
bypassed, so we parse it unconditionally when S2P exists. Otherwise
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
it is set to -1.(only S1P)
16
17
As stall is not supported, if S2S is set the translation would abort.
18
For S2R, we reuse the same code used for stage-1 with flag
19
record_faults. However when nested translation is supported we would
20
need to separate stage-1 and stage-2 faults.
21
22
Fix wrong shift in STE_S2HD, STE_S2HA, STE_S2S.
23
24
Signed-off-by: Mostafa Saleh <smostafa@google.com>
25
Tested-by: Eric Auger <eric.auger@redhat.com>
26
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
27
Reviewed-by: Eric Auger <eric.auger@redhat.com>
28
Message-id: 20230516203327.2051088-6-smostafa@google.com
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
30
---
18
target/arm/helper.h | 2 +-
31
hw/arm/smmuv3-internal.h | 10 +-
19
target/arm/op_helper.c | 23 +++++++++--------
32
include/hw/arm/smmu-common.h | 1 +
20
target/arm/translate-neon.c.inc | 44 +++++++++++----------------------
33
include/hw/arm/smmuv3.h | 3 +
21
3 files changed, 29 insertions(+), 40 deletions(-)
34
hw/arm/smmuv3.c | 181 +++++++++++++++++++++++++++++++++--
22
35
4 files changed, 185 insertions(+), 10 deletions(-)
23
diff --git a/target/arm/helper.h b/target/arm/helper.h
36
37
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
24
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/helper.h
39
--- a/hw/arm/smmuv3-internal.h
26
+++ b/target/arm/helper.h
40
+++ b/hw/arm/smmuv3-internal.h
27
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_2(rsqrte_f32, TCG_CALL_NO_RWG, f32, f32, ptr)
41
@@ -XXX,XX +XXX,XX @@ typedef struct CD {
28
DEF_HELPER_FLAGS_2(rsqrte_f64, TCG_CALL_NO_RWG, f64, f64, ptr)
42
#define STE_S2TG(x) extract32((x)->word[5], 14, 2)
29
DEF_HELPER_FLAGS_1(recpe_u32, TCG_CALL_NO_RWG, i32, i32)
43
#define STE_S2PS(x) extract32((x)->word[5], 16, 3)
30
DEF_HELPER_FLAGS_1(rsqrte_u32, TCG_CALL_NO_RWG, i32, i32)
44
#define STE_S2AA64(x) extract32((x)->word[5], 19, 1)
31
-DEF_HELPER_FLAGS_4(neon_tbl, TCG_CALL_NO_RWG, i32, i32, i32, ptr, i32)
45
-#define STE_S2HD(x) extract32((x)->word[5], 24, 1)
32
+DEF_HELPER_FLAGS_4(neon_tbl, TCG_CALL_NO_RWG, i64, env, i32, i64, i64)
46
-#define STE_S2HA(x) extract32((x)->word[5], 25, 1)
33
47
-#define STE_S2S(x) extract32((x)->word[5], 26, 1)
34
DEF_HELPER_3(shl_cc, i32, env, i32, i32)
48
+#define STE_S2ENDI(x) extract32((x)->word[5], 20, 1)
35
DEF_HELPER_3(shr_cc, i32, env, i32, i32)
49
+#define STE_S2AFFD(x) extract32((x)->word[5], 21, 1)
36
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
50
+#define STE_S2HD(x) extract32((x)->word[5], 23, 1)
51
+#define STE_S2HA(x) extract32((x)->word[5], 24, 1)
52
+#define STE_S2S(x) extract32((x)->word[5], 25, 1)
53
+#define STE_S2R(x) extract32((x)->word[5], 26, 1)
54
+
55
#define STE_CTXPTR(x) \
56
({ \
57
unsigned long addr; \
58
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
37
index XXXXXXX..XXXXXXX 100644
59
index XXXXXXX..XXXXXXX 100644
38
--- a/target/arm/op_helper.c
60
--- a/include/hw/arm/smmu-common.h
39
+++ b/target/arm/op_helper.c
61
+++ b/include/hw/arm/smmu-common.h
40
@@ -XXX,XX +XXX,XX @@ void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome,
62
@@ -XXX,XX +XXX,XX @@
41
cpu_loop_exit_restore(cs, ra);
63
64
/* VMSAv8-64 Translation constants and functions */
65
#define VMSA_LEVELS 4
66
+#define VMSA_MAX_S2_CONCAT 16
67
68
#define VMSA_STRIDE(gran) ((gran) - VMSA_LEVELS + 1)
69
#define VMSA_BIT_LVL(isz, strd, lvl) ((isz) - (strd) * \
70
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
71
index XXXXXXX..XXXXXXX 100644
72
--- a/include/hw/arm/smmuv3.h
73
+++ b/include/hw/arm/smmuv3.h
74
@@ -XXX,XX +XXX,XX @@ struct SMMUv3Class {
75
#define TYPE_ARM_SMMUV3 "arm-smmuv3"
76
OBJECT_DECLARE_TYPE(SMMUv3State, SMMUv3Class, ARM_SMMUV3)
77
78
+#define STAGE1_SUPPORTED(s) FIELD_EX32(s->idr[0], IDR0, S1P)
79
+#define STAGE2_SUPPORTED(s) FIELD_EX32(s->idr[0], IDR0, S2P)
80
+
81
#endif
82
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
83
index XXXXXXX..XXXXXXX 100644
84
--- a/hw/arm/smmuv3.c
85
+++ b/hw/arm/smmuv3.c
86
@@ -XXX,XX +XXX,XX @@
87
#include "smmuv3-internal.h"
88
#include "smmu-internal.h"
89
90
+#define PTW_RECORD_FAULT(cfg) (((cfg)->stage == 1) ? (cfg)->record_faults : \
91
+ (cfg)->s2cfg.record_faults)
92
+
93
/**
94
* smmuv3_trigger_irq - pulse @irq if enabled and update
95
* GERROR register in case of GERROR interrupt
96
@@ -XXX,XX +XXX,XX @@ static int smmu_get_cd(SMMUv3State *s, STE *ste, uint32_t ssid,
97
return 0;
42
}
98
}
43
99
44
-uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def, void *vn,
100
+/*
45
- uint32_t maxindex)
101
+ * Max valid value is 39 when SMMU_IDR3.STT == 0.
46
+uint64_t HELPER(neon_tbl)(CPUARMState *env, uint32_t desc,
102
+ * In architectures after SMMUv3.0:
47
+ uint64_t ireg, uint64_t def)
103
+ * - If STE.S2TG selects a 4KB or 16KB granule, the minimum valid value for this
104
+ * field is MAX(16, 64-IAS)
105
+ * - If STE.S2TG selects a 64KB granule, the minimum valid value for this field
106
+ * is (64-IAS).
107
+ * As we only support AA64, IAS = OAS.
108
+ */
109
+static bool s2t0sz_valid(SMMUTransCfg *cfg)
110
+{
111
+ if (cfg->s2cfg.tsz > 39) {
112
+ return false;
113
+ }
114
+
115
+ if (cfg->s2cfg.granule_sz == 16) {
116
+ return (cfg->s2cfg.tsz >= 64 - oas2bits(SMMU_IDR5_OAS));
117
+ }
118
+
119
+ return (cfg->s2cfg.tsz >= MAX(64 - oas2bits(SMMU_IDR5_OAS), 16));
120
+}
121
+
122
+/*
123
+ * Return true if s2 page table config is valid.
124
+ * This checks with the configured start level, ias_bits and granularity we can
125
+ * have a valid page table as described in ARM ARM D8.2 Translation process.
126
+ * The idea here is to see for the highest possible number of IPA bits, how
127
+ * many concatenated tables we would need, if it is more than 16, then this is
128
+ * not possible.
129
+ */
130
+static bool s2_pgtable_config_valid(uint8_t sl0, uint8_t t0sz, uint8_t gran)
131
+{
132
+ int level = get_start_level(sl0, gran);
133
+ uint64_t ipa_bits = 64 - t0sz;
134
+ uint64_t max_ipa = (1ULL << ipa_bits) - 1;
135
+ int nr_concat = pgd_concat_idx(level, gran, max_ipa) + 1;
136
+
137
+ return nr_concat <= VMSA_MAX_S2_CONCAT;
138
+}
139
+
140
+static int decode_ste_s2_cfg(SMMUTransCfg *cfg, STE *ste)
141
+{
142
+ cfg->stage = 2;
143
+
144
+ if (STE_S2AA64(ste) == 0x0) {
145
+ qemu_log_mask(LOG_UNIMP,
146
+ "SMMUv3 AArch32 tables not supported\n");
147
+ g_assert_not_reached();
148
+ }
149
+
150
+ switch (STE_S2TG(ste)) {
151
+ case 0x0: /* 4KB */
152
+ cfg->s2cfg.granule_sz = 12;
153
+ break;
154
+ case 0x1: /* 64KB */
155
+ cfg->s2cfg.granule_sz = 16;
156
+ break;
157
+ case 0x2: /* 16KB */
158
+ cfg->s2cfg.granule_sz = 14;
159
+ break;
160
+ default:
161
+ qemu_log_mask(LOG_GUEST_ERROR,
162
+ "SMMUv3 bad STE S2TG: %x\n", STE_S2TG(ste));
163
+ goto bad_ste;
164
+ }
165
+
166
+ cfg->s2cfg.vttb = STE_S2TTB(ste);
167
+
168
+ cfg->s2cfg.sl0 = STE_S2SL0(ste);
169
+ /* FEAT_TTST not supported. */
170
+ if (cfg->s2cfg.sl0 == 0x3) {
171
+ qemu_log_mask(LOG_UNIMP, "SMMUv3 S2SL0 = 0x3 has no meaning!\n");
172
+ goto bad_ste;
173
+ }
174
+
175
+ /* For AA64, The effective S2PS size is capped to the OAS. */
176
+ cfg->s2cfg.eff_ps = oas2bits(MIN(STE_S2PS(ste), SMMU_IDR5_OAS));
177
+ /*
178
+ * It is ILLEGAL for the address in S2TTB to be outside the range
179
+ * described by the effective S2PS value.
180
+ */
181
+ if (cfg->s2cfg.vttb & ~(MAKE_64BIT_MASK(0, cfg->s2cfg.eff_ps))) {
182
+ qemu_log_mask(LOG_GUEST_ERROR,
183
+ "SMMUv3 S2TTB too large 0x%lx, effective PS %d bits\n",
184
+ cfg->s2cfg.vttb, cfg->s2cfg.eff_ps);
185
+ goto bad_ste;
186
+ }
187
+
188
+ cfg->s2cfg.tsz = STE_S2T0SZ(ste);
189
+
190
+ if (!s2t0sz_valid(cfg)) {
191
+ qemu_log_mask(LOG_GUEST_ERROR, "SMMUv3 bad STE S2T0SZ = %d\n",
192
+ cfg->s2cfg.tsz);
193
+ goto bad_ste;
194
+ }
195
+
196
+ if (!s2_pgtable_config_valid(cfg->s2cfg.sl0, cfg->s2cfg.tsz,
197
+ cfg->s2cfg.granule_sz)) {
198
+ qemu_log_mask(LOG_GUEST_ERROR,
199
+ "SMMUv3 STE stage 2 config not valid!\n");
200
+ goto bad_ste;
201
+ }
202
+
203
+ /* Only LE supported(IDR0.TTENDIAN). */
204
+ if (STE_S2ENDI(ste)) {
205
+ qemu_log_mask(LOG_GUEST_ERROR,
206
+ "SMMUv3 STE_S2ENDI only supports LE!\n");
207
+ goto bad_ste;
208
+ }
209
+
210
+ cfg->s2cfg.affd = STE_S2AFFD(ste);
211
+
212
+ cfg->s2cfg.record_faults = STE_S2R(ste);
213
+ /* As stall is not supported. */
214
+ if (STE_S2S(ste)) {
215
+ qemu_log_mask(LOG_UNIMP, "SMMUv3 Stall not implemented!\n");
216
+ goto bad_ste;
217
+ }
218
+
219
+ /* This is still here as stage 2 has not been fully enabled yet. */
220
+ qemu_log_mask(LOG_UNIMP, "SMMUv3 does not support stage 2 yet\n");
221
+ goto bad_ste;
222
+
223
+ return 0;
224
+
225
+bad_ste:
226
+ return -EINVAL;
227
+}
228
+
229
/* Returns < 0 in case of invalid STE, 0 otherwise */
230
static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg,
231
STE *ste, SMMUEventInfo *event)
48
{
232
{
49
- uint32_t val, shift;
233
uint32_t config;
50
- uint64_t *table = vn;
234
+ int ret;
51
+ uint64_t tmp, val = 0;
235
52
+ uint32_t maxindex = ((desc & 3) + 1) * 8;
236
if (!STE_VALID(ste)) {
53
+ uint32_t base_reg = desc >> 2;
237
if (!event->inval_ste_allowed) {
54
+ uint32_t shift, index, reg;
238
@@ -XXX,XX +XXX,XX @@ static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg,
55
239
return 0;
56
- val = 0;
57
- for (shift = 0; shift < 32; shift += 8) {
58
- uint32_t index = (ireg >> shift) & 0xff;
59
+ for (shift = 0; shift < 64; shift += 8) {
60
+ index = (ireg >> shift) & 0xff;
61
if (index < maxindex) {
62
- uint32_t tmp = (table[index >> 3] >> ((index & 7) << 3)) & 0xff;
63
- val |= tmp << shift;
64
+ reg = base_reg + (index >> 3);
65
+ tmp = *aa32_vfp_dreg(env, reg);
66
+ tmp = ((tmp >> ((index & 7) << 3)) & 0xff) << shift;
67
} else {
68
- val |= def & (0xff << shift);
69
+ tmp = def & (0xffull << shift);
70
}
71
+ val |= tmp;
72
}
240
}
73
return val;
241
74
}
242
- if (STE_CFG_S2_ENABLED(config)) {
75
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
243
- qemu_log_mask(LOG_UNIMP, "SMMUv3 does not support stage 2 yet\n");
76
index XXXXXXX..XXXXXXX 100644
244
+ /*
77
--- a/target/arm/translate-neon.c.inc
245
+ * If a stage is enabled in SW while not advertised, throw bad ste
78
+++ b/target/arm/translate-neon.c.inc
246
+ * according to user manual(IHI0070E) "5.2 Stream Table Entry".
79
@@ -XXX,XX +XXX,XX @@ static bool trans_VEXT(DisasContext *s, arg_VEXT *a)
247
+ */
80
248
+ if (!STAGE1_SUPPORTED(s) && STE_CFG_S1_ENABLED(config)) {
81
static bool trans_VTBL(DisasContext *s, arg_VTBL *a)
249
+ qemu_log_mask(LOG_GUEST_ERROR, "SMMUv3 S1 used but not supported.\n");
82
{
250
goto bad_ste;
83
- int n;
84
- TCGv_i32 tmp, tmp2, tmp3, tmp4;
85
- TCGv_ptr ptr1;
86
+ TCGv_i64 val, def;
87
+ TCGv_i32 desc;
88
89
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
90
return false;
91
@@ -XXX,XX +XXX,XX @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a)
92
return true;
93
}
251
}
94
252
+ if (!STAGE2_SUPPORTED(s) && STE_CFG_S2_ENABLED(config)) {
95
- n = a->len + 1;
253
+ qemu_log_mask(LOG_GUEST_ERROR, "SMMUv3 S2 used but not supported.\n");
96
- if ((a->vn + n) > 32) {
254
+ goto bad_ste;
97
+ if ((a->vn + a->len + 1) > 32) {
255
+ }
98
/*
256
+
99
* This is UNPREDICTABLE; we choose to UNDEF to avoid the
257
+ if (STAGE2_SUPPORTED(s)) {
100
* helper function running off the end of the register file.
258
+ /* VMID is considered even if s2 is disabled. */
101
*/
259
+ cfg->s2cfg.vmid = STE_S2VMID(ste);
102
return false;
260
+ } else {
103
}
261
+ /* Default to -1 */
104
- n <<= 3;
262
+ cfg->s2cfg.vmid = -1;
105
- tmp = tcg_temp_new_i32();
263
+ }
106
- if (a->op) {
264
+
107
- read_neon_element32(tmp, a->vd, 0, MO_32);
265
+ if (STE_CFG_S2_ENABLED(config)) {
108
- } else {
266
+ /*
109
- tcg_gen_movi_i32(tmp, 0);
267
+ * Stage-1 OAS defaults to OAS even if not enabled as it would be used
110
- }
268
+ * in input address check for stage-2.
111
- tmp2 = tcg_temp_new_i32();
269
+ */
112
- read_neon_element32(tmp2, a->vm, 0, MO_32);
270
+ cfg->oas = oas2bits(SMMU_IDR5_OAS);
113
- ptr1 = vfp_reg_ptr(true, a->vn);
271
+ ret = decode_ste_s2_cfg(cfg, ste);
114
- tmp4 = tcg_const_i32(n);
272
+ if (ret) {
115
- gen_helper_neon_tbl(tmp2, tmp2, tmp, ptr1, tmp4);
273
+ goto bad_ste;
116
274
+ }
117
+ desc = tcg_const_i32((a->vn << 2) | a->len);
275
+ }
118
+ def = tcg_temp_new_i64();
276
119
if (a->op) {
277
if (STE_S1CDMAX(ste) != 0) {
120
- read_neon_element32(tmp, a->vd, 1, MO_32);
278
qemu_log_mask(LOG_UNIMP,
121
+ read_neon_element64(def, a->vd, 0, MO_64);
279
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
122
} else {
280
if (cached_entry) {
123
- tcg_gen_movi_i32(tmp, 0);
281
if ((flag & IOMMU_WO) && !(cached_entry->entry.perm & IOMMU_WO)) {
124
+ tcg_gen_movi_i64(def, 0);
282
status = SMMU_TRANS_ERROR;
125
}
283
- if (cfg->record_faults) {
126
- tmp3 = tcg_temp_new_i32();
284
+ /*
127
- read_neon_element32(tmp3, a->vm, 1, MO_32);
285
+ * We know that the TLB only contains either stage-1 or stage-2 as
128
- gen_helper_neon_tbl(tmp3, tmp3, tmp, ptr1, tmp4);
286
+ * nesting is not supported. So it is sufficient to check the
129
- tcg_temp_free_i32(tmp);
287
+ * translation stage to know the TLB stage for now.
130
- tcg_temp_free_i32(tmp4);
288
+ */
131
- tcg_temp_free_ptr(ptr1);
289
+ event.u.f_walk_eabt.s2 = (cfg->stage == 2);
132
+ val = tcg_temp_new_i64();
290
+ if (PTW_RECORD_FAULT(cfg)) {
133
+ read_neon_element64(val, a->vm, 0, MO_64);
291
event.type = SMMU_EVT_F_PERMISSION;
134
292
event.u.f_permission.addr = addr;
135
- write_neon_element32(tmp2, a->vd, 0, MO_32);
293
event.u.f_permission.rnw = flag & 0x1;
136
- write_neon_element32(tmp3, a->vd, 1, MO_32);
294
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
137
- tcg_temp_free_i32(tmp2);
295
event.u.f_walk_eabt.addr2 = ptw_info.addr;
138
- tcg_temp_free_i32(tmp3);
296
break;
139
+ gen_helper_neon_tbl(val, cpu_env, desc, val, def);
297
case SMMU_PTW_ERR_TRANSLATION:
140
+ write_neon_element64(val, a->vd, 0, MO_64);
298
- if (cfg->record_faults) {
141
+
299
+ if (PTW_RECORD_FAULT(cfg)) {
142
+ tcg_temp_free_i64(def);
300
event.type = SMMU_EVT_F_TRANSLATION;
143
+ tcg_temp_free_i64(val);
301
event.u.f_translation.addr = addr;
144
+ tcg_temp_free_i32(desc);
302
event.u.f_translation.rnw = flag & 0x1;
145
return true;
303
}
146
}
304
break;
147
305
case SMMU_PTW_ERR_ADDR_SIZE:
306
- if (cfg->record_faults) {
307
+ if (PTW_RECORD_FAULT(cfg)) {
308
event.type = SMMU_EVT_F_ADDR_SIZE;
309
event.u.f_addr_size.addr = addr;
310
event.u.f_addr_size.rnw = flag & 0x1;
311
}
312
break;
313
case SMMU_PTW_ERR_ACCESS:
314
- if (cfg->record_faults) {
315
+ if (PTW_RECORD_FAULT(cfg)) {
316
event.type = SMMU_EVT_F_ACCESS;
317
event.u.f_access.addr = addr;
318
event.u.f_access.rnw = flag & 0x1;
319
}
320
break;
321
case SMMU_PTW_ERR_PERMISSION:
322
- if (cfg->record_faults) {
323
+ if (PTW_RECORD_FAULT(cfg)) {
324
event.type = SMMU_EVT_F_PERMISSION;
325
event.u.f_permission.addr = addr;
326
event.u.f_permission.rnw = flag & 0x1;
148
--
327
--
149
2.20.1
328
2.34.1
150
151
diff view generated by jsdifflib
1
From: Xinhao Zhang <zhangxinhao1@huawei.com>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
Fix code style. Don't use '#' flag of printf format ('%#') in
3
Right now, either stage-1 or stage-2 are supported, this simplifies
4
format strings, use '0x' prefix instead
4
how we can deal with TLBs.
5
This patch makes TLB lookup work if stage-2 is enabled instead of
6
stage-1.
7
TLB lookup is done before a PTW, if a valid entry is found we won't
8
do the PTW.
9
To be able to do TLB lookup, we need the correct tagging info, as
10
granularity and input size, so we get this based on the supported
11
translation stage. The TLB entries are added correctly from each
12
stage PTW.
5
13
6
Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com>
14
When nested translation is supported, this would need to change, for
7
Signed-off-by: Kai Deng <dengkai1@huawei.com>
15
example if we go with a combined TLB implementation, we would need to
8
Message-id: 20201103114529.638233-2-zhangxinhao1@huawei.com
16
use the min of the granularities in TLB.
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
18
As stage-2 shouldn't be tagged by ASID, it will be set to -1 if S1P
19
is not enabled.
20
21
Signed-off-by: Mostafa Saleh <smostafa@google.com>
22
Reviewed-by: Eric Auger <eric.auger@redhat.com>
23
Tested-by: Eric Auger <eric.auger@redhat.com>
24
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
25
Message-id: 20230516203327.2051088-7-smostafa@google.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
27
---
12
target/arm/translate-a64.c | 4 ++--
28
hw/arm/smmuv3.c | 44 +++++++++++++++++++++++++++++++++-----------
13
1 file changed, 2 insertions(+), 2 deletions(-)
29
1 file changed, 33 insertions(+), 11 deletions(-)
14
30
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
31
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
16
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-a64.c
33
--- a/hw/arm/smmuv3.c
18
+++ b/target/arm/translate-a64.c
34
+++ b/hw/arm/smmuv3.c
19
@@ -XXX,XX +XXX,XX @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn)
35
@@ -XXX,XX +XXX,XX @@ static int smmuv3_decode_config(IOMMUMemoryRegion *mr, SMMUTransCfg *cfg,
20
gen_helper_advsimd_acgt_f16(tcg_res, tcg_op1, tcg_op2, fpst);
36
STE ste;
21
break;
37
CD cd;
22
default:
38
23
- fprintf(stderr, "%s: insn %#04x, fpop %#2x @ %#" PRIx64 "\n",
39
+ /* ASID defaults to -1 (if s1 is not supported). */
24
+ fprintf(stderr, "%s: insn 0x%04x, fpop 0x%2x @ 0x%" PRIx64 "\n",
40
+ cfg->asid = -1;
25
__func__, insn, fpopcode, s->pc_curr);
41
+
26
g_assert_not_reached();
42
ret = smmu_find_ste(s, sid, &ste, event);
27
}
43
if (ret) {
28
@@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn)
44
return ret;
29
case 0x7f: /* FSQRT (vector) */
45
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
30
break;
46
.addr_mask = ~(hwaddr)0,
31
default:
47
.perm = IOMMU_NONE,
32
- fprintf(stderr, "%s: insn %#04x fpop %#2x\n", __func__, insn, fpop);
48
};
33
+ fprintf(stderr, "%s: insn 0x%04x fpop 0x%2x\n", __func__, insn, fpop);
49
+ /*
34
g_assert_not_reached();
50
+ * Combined attributes used for TLB lookup, as only one stage is supported,
51
+ * it will hold attributes based on the enabled stage.
52
+ */
53
+ SMMUTransTableInfo tt_combined;
54
55
qemu_mutex_lock(&s->mutex);
56
57
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
58
goto epilogue;
35
}
59
}
36
60
61
- tt = select_tt(cfg, addr);
62
- if (!tt) {
63
- if (cfg->record_faults) {
64
- event.type = SMMU_EVT_F_TRANSLATION;
65
- event.u.f_translation.addr = addr;
66
- event.u.f_translation.rnw = flag & 0x1;
67
+ if (cfg->stage == 1) {
68
+ /* Select stage1 translation table. */
69
+ tt = select_tt(cfg, addr);
70
+ if (!tt) {
71
+ if (cfg->record_faults) {
72
+ event.type = SMMU_EVT_F_TRANSLATION;
73
+ event.u.f_translation.addr = addr;
74
+ event.u.f_translation.rnw = flag & 0x1;
75
+ }
76
+ status = SMMU_TRANS_ERROR;
77
+ goto epilogue;
78
}
79
- status = SMMU_TRANS_ERROR;
80
- goto epilogue;
81
- }
82
+ tt_combined.granule_sz = tt->granule_sz;
83
+ tt_combined.tsz = tt->tsz;
84
85
- page_mask = (1ULL << (tt->granule_sz)) - 1;
86
+ } else {
87
+ /* Stage2. */
88
+ tt_combined.granule_sz = cfg->s2cfg.granule_sz;
89
+ tt_combined.tsz = cfg->s2cfg.tsz;
90
+ }
91
+ /*
92
+ * TLB lookup looks for granule and input size for a translation stage,
93
+ * as only one stage is supported right now, choose the right values
94
+ * from the configuration.
95
+ */
96
+ page_mask = (1ULL << tt_combined.granule_sz) - 1;
97
aligned_addr = addr & ~page_mask;
98
99
- cached_entry = smmu_iotlb_lookup(bs, cfg, tt, aligned_addr);
100
+ cached_entry = smmu_iotlb_lookup(bs, cfg, &tt_combined, aligned_addr);
101
if (cached_entry) {
102
if ((flag & IOMMU_WO) && !(cached_entry->entry.perm & IOMMU_WO)) {
103
status = SMMU_TRANS_ERROR;
37
--
104
--
38
2.20.1
105
2.34.1
39
40
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
The MusicPal board code connects both of the IRQ outputs of the UART
3
Allow TLB to be tagged with VMID.
4
to the same INTC qemu_irq. Connecting two qemu_irqs outputs directly
4
5
to the same input is not valid as it produces subtly wrong behaviour
5
If stage-1 is only supported, VMID is set to -1 and ignored from STE
6
(for instance if both the IRQ lines are high, and then one goes
6
and CMD_TLBI_NH* cmds.
7
low, the INTC input will see this as a high-to-low transition
7
8
even though the second IRQ line should still be holding it high).
8
Update smmu_iotlb_insert trace event to have vmid.
9
9
10
This kind of wiring needs an explicitly created OR gate; add one.
10
Signed-off-by: Mostafa Saleh <smostafa@google.com>
11
11
Reviewed-by: Eric Auger <eric.auger@redhat.com>
12
Inspired-by: Peter Maydell <peter.maydell@linaro.org>
12
Tested-by: Eric Auger <eric.auger@redhat.com>
13
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
14
Message-id: 20201107193403.436146-5-f4bug@amsat.org
14
Message-id: 20230516203327.2051088-8-smostafa@google.com
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
16
---
18
hw/arm/musicpal.c | 17 +++++++++++++----
17
hw/arm/smmu-internal.h | 2 ++
19
hw/arm/Kconfig | 1 +
18
include/hw/arm/smmu-common.h | 5 +++--
20
2 files changed, 14 insertions(+), 4 deletions(-)
19
hw/arm/smmu-common.c | 36 ++++++++++++++++++++++--------------
21
20
hw/arm/smmuv3.c | 12 +++++++++---
22
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
21
hw/arm/trace-events | 6 +++---
23
index XXXXXXX..XXXXXXX 100644
22
5 files changed, 39 insertions(+), 22 deletions(-)
24
--- a/hw/arm/musicpal.c
23
25
+++ b/hw/arm/musicpal.c
24
diff --git a/hw/arm/smmu-internal.h b/hw/arm/smmu-internal.h
26
@@ -XXX,XX +XXX,XX @@
25
index XXXXXXX..XXXXXXX 100644
27
#include "ui/console.h"
26
--- a/hw/arm/smmu-internal.h
28
#include "hw/i2c/i2c.h"
27
+++ b/hw/arm/smmu-internal.h
29
#include "hw/irq.h"
28
@@ -XXX,XX +XXX,XX @@ static inline int pgd_concat_idx(int start_level, int granule_sz,
30
+#include "hw/or-irq.h"
29
}
31
#include "hw/audio/wm8750.h"
30
32
#include "sysemu/block-backend.h"
31
#define SMMU_IOTLB_ASID(key) ((key).asid)
33
#include "sysemu/runstate.h"
32
+#define SMMU_IOTLB_VMID(key) ((key).vmid)
34
@@ -XXX,XX +XXX,XX @@
33
35
#define MP_TIMER4_IRQ 7
34
typedef struct SMMUIOTLBPageInvInfo {
36
#define MP_EHCI_IRQ 8
35
int asid;
37
#define MP_ETH_IRQ 9
36
+ int vmid;
38
-#define MP_UART1_IRQ 11
37
uint64_t iova;
39
-#define MP_UART2_IRQ 11
38
uint64_t mask;
40
+#define MP_UART_SHARED_IRQ 11
39
} SMMUIOTLBPageInvInfo;
41
#define MP_GPIO_IRQ 12
40
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
42
#define MP_RTC_IRQ 28
41
index XXXXXXX..XXXXXXX 100644
43
#define MP_AUDIO_IRQ 30
42
--- a/include/hw/arm/smmu-common.h
44
@@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine)
43
+++ b/include/hw/arm/smmu-common.h
45
ARMCPU *cpu;
44
@@ -XXX,XX +XXX,XX @@ typedef struct SMMUPciBus {
46
qemu_irq pic[32];
45
typedef struct SMMUIOTLBKey {
47
DeviceState *dev;
46
uint64_t iova;
48
+ DeviceState *uart_orgate;
47
uint16_t asid;
49
DeviceState *i2c_dev;
48
+ uint16_t vmid;
50
DeviceState *lcd_dev;
49
uint8_t tg;
51
DeviceState *key_dev;
50
uint8_t level;
52
@@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine)
51
} SMMUIOTLBKey;
53
pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ],
52
@@ -XXX,XX +XXX,XX @@ IOMMUMemoryRegion *smmu_iommu_mr(SMMUState *s, uint32_t sid);
54
pic[MP_TIMER4_IRQ], NULL);
53
SMMUTLBEntry *smmu_iotlb_lookup(SMMUState *bs, SMMUTransCfg *cfg,
55
54
SMMUTransTableInfo *tt, hwaddr iova);
56
- serial_mm_init(address_space_mem, MP_UART1_BASE, 2, pic[MP_UART1_IRQ],
55
void smmu_iotlb_insert(SMMUState *bs, SMMUTransCfg *cfg, SMMUTLBEntry *entry);
57
+ /* Logically OR both UART IRQs together */
56
-SMMUIOTLBKey smmu_get_iotlb_key(uint16_t asid, uint64_t iova,
58
+ uart_orgate = DEVICE(object_new(TYPE_OR_IRQ));
57
+SMMUIOTLBKey smmu_get_iotlb_key(uint16_t asid, uint16_t vmid, uint64_t iova,
59
+ object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal);
58
uint8_t tg, uint8_t level);
60
+ qdev_realize_and_unref(uart_orgate, NULL, &error_fatal);
59
void smmu_iotlb_inv_all(SMMUState *s);
61
+ qdev_connect_gpio_out(DEVICE(uart_orgate), 0, pic[MP_UART_SHARED_IRQ]);
60
void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid);
61
-void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
62
+void smmu_iotlb_inv_iova(SMMUState *s, int asid, int vmid, dma_addr_t iova,
63
uint8_t tg, uint64_t num_pages, uint8_t ttl);
64
65
/* Unmap the range of all the notifiers registered to any IOMMU mr */
66
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/hw/arm/smmu-common.c
69
+++ b/hw/arm/smmu-common.c
70
@@ -XXX,XX +XXX,XX @@ static guint smmu_iotlb_key_hash(gconstpointer v)
71
72
/* Jenkins hash */
73
a = b = c = JHASH_INITVAL + sizeof(*key);
74
- a += key->asid + key->level + key->tg;
75
+ a += key->asid + key->vmid + key->level + key->tg;
76
b += extract64(key->iova, 0, 32);
77
c += extract64(key->iova, 32, 32);
78
79
@@ -XXX,XX +XXX,XX @@ static gboolean smmu_iotlb_key_equal(gconstpointer v1, gconstpointer v2)
80
SMMUIOTLBKey *k1 = (SMMUIOTLBKey *)v1, *k2 = (SMMUIOTLBKey *)v2;
81
82
return (k1->asid == k2->asid) && (k1->iova == k2->iova) &&
83
- (k1->level == k2->level) && (k1->tg == k2->tg);
84
+ (k1->level == k2->level) && (k1->tg == k2->tg) &&
85
+ (k1->vmid == k2->vmid);
86
}
87
88
-SMMUIOTLBKey smmu_get_iotlb_key(uint16_t asid, uint64_t iova,
89
+SMMUIOTLBKey smmu_get_iotlb_key(uint16_t asid, uint16_t vmid, uint64_t iova,
90
uint8_t tg, uint8_t level)
91
{
92
- SMMUIOTLBKey key = {.asid = asid, .iova = iova, .tg = tg, .level = level};
93
+ SMMUIOTLBKey key = {.asid = asid, .vmid = vmid, .iova = iova,
94
+ .tg = tg, .level = level};
95
96
return key;
97
}
98
@@ -XXX,XX +XXX,XX @@ SMMUTLBEntry *smmu_iotlb_lookup(SMMUState *bs, SMMUTransCfg *cfg,
99
uint64_t mask = subpage_size - 1;
100
SMMUIOTLBKey key;
101
102
- key = smmu_get_iotlb_key(cfg->asid, iova & ~mask, tg, level);
103
+ key = smmu_get_iotlb_key(cfg->asid, cfg->s2cfg.vmid,
104
+ iova & ~mask, tg, level);
105
entry = g_hash_table_lookup(bs->iotlb, &key);
106
if (entry) {
107
break;
108
@@ -XXX,XX +XXX,XX @@ SMMUTLBEntry *smmu_iotlb_lookup(SMMUState *bs, SMMUTransCfg *cfg,
109
110
if (entry) {
111
cfg->iotlb_hits++;
112
- trace_smmu_iotlb_lookup_hit(cfg->asid, iova,
113
+ trace_smmu_iotlb_lookup_hit(cfg->asid, cfg->s2cfg.vmid, iova,
114
cfg->iotlb_hits, cfg->iotlb_misses,
115
100 * cfg->iotlb_hits /
116
(cfg->iotlb_hits + cfg->iotlb_misses));
117
} else {
118
cfg->iotlb_misses++;
119
- trace_smmu_iotlb_lookup_miss(cfg->asid, iova,
120
+ trace_smmu_iotlb_lookup_miss(cfg->asid, cfg->s2cfg.vmid, iova,
121
cfg->iotlb_hits, cfg->iotlb_misses,
122
100 * cfg->iotlb_hits /
123
(cfg->iotlb_hits + cfg->iotlb_misses));
124
@@ -XXX,XX +XXX,XX @@ void smmu_iotlb_insert(SMMUState *bs, SMMUTransCfg *cfg, SMMUTLBEntry *new)
125
smmu_iotlb_inv_all(bs);
126
}
127
128
- *key = smmu_get_iotlb_key(cfg->asid, new->entry.iova, tg, new->level);
129
- trace_smmu_iotlb_insert(cfg->asid, new->entry.iova, tg, new->level);
130
+ *key = smmu_get_iotlb_key(cfg->asid, cfg->s2cfg.vmid, new->entry.iova,
131
+ tg, new->level);
132
+ trace_smmu_iotlb_insert(cfg->asid, cfg->s2cfg.vmid, new->entry.iova,
133
+ tg, new->level);
134
g_hash_table_insert(bs->iotlb, key, new);
135
}
136
137
@@ -XXX,XX +XXX,XX @@ static gboolean smmu_hash_remove_by_asid(gpointer key, gpointer value,
138
139
return SMMU_IOTLB_ASID(*iotlb_key) == asid;
140
}
141
-
142
-static gboolean smmu_hash_remove_by_asid_iova(gpointer key, gpointer value,
143
+static gboolean smmu_hash_remove_by_asid_vmid_iova(gpointer key, gpointer value,
144
gpointer user_data)
145
{
146
SMMUTLBEntry *iter = (SMMUTLBEntry *)value;
147
@@ -XXX,XX +XXX,XX @@ static gboolean smmu_hash_remove_by_asid_iova(gpointer key, gpointer value,
148
if (info->asid >= 0 && info->asid != SMMU_IOTLB_ASID(iotlb_key)) {
149
return false;
150
}
151
+ if (info->vmid >= 0 && info->vmid != SMMU_IOTLB_VMID(iotlb_key)) {
152
+ return false;
153
+ }
154
return ((info->iova & ~entry->addr_mask) == entry->iova) ||
155
((entry->iova & ~info->mask) == info->iova);
156
}
157
158
-void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
159
+void smmu_iotlb_inv_iova(SMMUState *s, int asid, int vmid, dma_addr_t iova,
160
uint8_t tg, uint64_t num_pages, uint8_t ttl)
161
{
162
/* if tg is not set we use 4KB range invalidation */
163
uint8_t granule = tg ? tg * 2 + 10 : 12;
164
165
if (ttl && (num_pages == 1) && (asid >= 0)) {
166
- SMMUIOTLBKey key = smmu_get_iotlb_key(asid, iova, tg, ttl);
167
+ SMMUIOTLBKey key = smmu_get_iotlb_key(asid, vmid, iova, tg, ttl);
168
169
if (g_hash_table_remove(s->iotlb, &key)) {
170
return;
171
@@ -XXX,XX +XXX,XX @@ void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
172
173
SMMUIOTLBPageInvInfo info = {
174
.asid = asid, .iova = iova,
175
+ .vmid = vmid,
176
.mask = (num_pages * 1 << granule) - 1};
177
178
g_hash_table_foreach_remove(s->iotlb,
179
- smmu_hash_remove_by_asid_iova,
180
+ smmu_hash_remove_by_asid_vmid_iova,
181
&info);
182
}
183
184
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
185
index XXXXXXX..XXXXXXX 100644
186
--- a/hw/arm/smmuv3.c
187
+++ b/hw/arm/smmuv3.c
188
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
189
{
190
dma_addr_t end, addr = CMD_ADDR(cmd);
191
uint8_t type = CMD_TYPE(cmd);
192
- uint16_t vmid = CMD_VMID(cmd);
193
+ int vmid = -1;
194
uint8_t scale = CMD_SCALE(cmd);
195
uint8_t num = CMD_NUM(cmd);
196
uint8_t ttl = CMD_TTL(cmd);
197
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
198
uint64_t num_pages;
199
uint8_t granule;
200
int asid = -1;
201
+ SMMUv3State *smmuv3 = ARM_SMMUV3(s);
62
+
202
+
63
+ serial_mm_init(address_space_mem, MP_UART1_BASE, 2,
203
+ /* Only consider VMID if stage-2 is supported. */
64
+ qdev_get_gpio_in(uart_orgate, 0),
204
+ if (STAGE2_SUPPORTED(smmuv3)) {
65
1825000, serial_hd(0), DEVICE_NATIVE_ENDIAN);
205
+ vmid = CMD_VMID(cmd);
66
- serial_mm_init(address_space_mem, MP_UART2_BASE, 2, pic[MP_UART2_IRQ],
206
+ }
67
+ serial_mm_init(address_space_mem, MP_UART2_BASE, 2,
207
68
+ qdev_get_gpio_in(uart_orgate, 1),
208
if (type == SMMU_CMD_TLBI_NH_VA) {
69
1825000, serial_hd(1), DEVICE_NATIVE_ENDIAN);
209
asid = CMD_ASID(cmd);
70
210
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
71
/* Register flash */
211
if (!tg) {
72
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
212
trace_smmuv3_s1_range_inval(vmid, asid, addr, tg, 1, ttl, leaf);
73
index XXXXXXX..XXXXXXX 100644
213
smmuv3_inv_notifiers_iova(s, asid, addr, tg, 1);
74
--- a/hw/arm/Kconfig
214
- smmu_iotlb_inv_iova(s, asid, addr, tg, 1, ttl);
75
+++ b/hw/arm/Kconfig
215
+ smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, 1, ttl);
76
@@ -XXX,XX +XXX,XX @@ config MUSCA
216
return;
77
217
}
78
config MUSICPAL
218
79
bool
219
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
80
+ select OR_IRQ
220
num_pages = (mask + 1) >> granule;
81
select BITBANG_I2C
221
trace_smmuv3_s1_range_inval(vmid, asid, addr, tg, num_pages, ttl, leaf);
82
select MARVELL_88W8618
222
smmuv3_inv_notifiers_iova(s, asid, addr, tg, num_pages);
83
select PTIMER
223
- smmu_iotlb_inv_iova(s, asid, addr, tg, num_pages, ttl);
224
+ smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, num_pages, ttl);
225
addr += mask + 1;
226
}
227
}
228
diff --git a/hw/arm/trace-events b/hw/arm/trace-events
229
index XXXXXXX..XXXXXXX 100644
230
--- a/hw/arm/trace-events
231
+++ b/hw/arm/trace-events
232
@@ -XXX,XX +XXX,XX @@ smmu_iotlb_inv_all(void) "IOTLB invalidate all"
233
smmu_iotlb_inv_asid(uint16_t asid) "IOTLB invalidate asid=%d"
234
smmu_iotlb_inv_iova(uint16_t asid, uint64_t addr) "IOTLB invalidate asid=%d addr=0x%"PRIx64
235
smmu_inv_notifiers_mr(const char *name) "iommu mr=%s"
236
-smmu_iotlb_lookup_hit(uint16_t asid, uint64_t addr, uint32_t hit, uint32_t miss, uint32_t p) "IOTLB cache HIT asid=%d addr=0x%"PRIx64" hit=%d miss=%d hit rate=%d"
237
-smmu_iotlb_lookup_miss(uint16_t asid, uint64_t addr, uint32_t hit, uint32_t miss, uint32_t p) "IOTLB cache MISS asid=%d addr=0x%"PRIx64" hit=%d miss=%d hit rate=%d"
238
-smmu_iotlb_insert(uint16_t asid, uint64_t addr, uint8_t tg, uint8_t level) "IOTLB ++ asid=%d addr=0x%"PRIx64" tg=%d level=%d"
239
+smmu_iotlb_lookup_hit(uint16_t asid, uint16_t vmid, uint64_t addr, uint32_t hit, uint32_t miss, uint32_t p) "IOTLB cache HIT asid=%d vmid=%d addr=0x%"PRIx64" hit=%d miss=%d hit rate=%d"
240
+smmu_iotlb_lookup_miss(uint16_t asid, uint16_t vmid, uint64_t addr, uint32_t hit, uint32_t miss, uint32_t p) "IOTLB cache MISS asid=%d vmid=%d addr=0x%"PRIx64" hit=%d miss=%d hit rate=%d"
241
+smmu_iotlb_insert(uint16_t asid, uint16_t vmid, uint64_t addr, uint8_t tg, uint8_t level) "IOTLB ++ asid=%d vmid=%d addr=0x%"PRIx64" tg=%d level=%d"
242
243
# smmuv3.c
244
smmuv3_read_mmio(uint64_t addr, uint64_t val, unsigned size, uint32_t r) "addr: 0x%"PRIx64" val:0x%"PRIx64" size: 0x%x(%d)"
84
--
245
--
85
2.20.1
246
2.34.1
86
87
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
When using a Cortex-A15, the Virt machine does not use any
3
CMD_TLBI_S2_IPA: As S1+S2 is not enabled, for now this can be the
4
MPCore peripherals. Remove the dependency.
4
same as CMD_TLBI_NH_VAA.
5
5
6
Fixes: 7951c7b7c05 ("hw/arm: Express dependencies of the virt machine with Kconfig")
6
CMD_TLBI_S12_VMALL: Added new function to invalidate TLB by VMID.
7
Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
7
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
For stage-1 only commands, add a check to throw CERROR_ILL if used
9
Message-id: 20201107114852.271922-1-philmd@redhat.com
9
when stage-1 is not supported.
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
11
Reviewed-by: Eric Auger <eric.auger@redhat.com>
12
Signed-off-by: Mostafa Saleh <smostafa@google.com>
13
Tested-by: Eric Auger <eric.auger@redhat.com>
14
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
15
Message-id: 20230516203327.2051088-9-smostafa@google.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
17
---
13
hw/arm/Kconfig | 1 -
18
include/hw/arm/smmu-common.h | 1 +
14
1 file changed, 1 deletion(-)
19
hw/arm/smmu-common.c | 16 +++++++++++
15
20
hw/arm/smmuv3.c | 55 ++++++++++++++++++++++++++++++------
16
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
21
hw/arm/trace-events | 4 ++-
17
index XXXXXXX..XXXXXXX 100644
22
4 files changed, 67 insertions(+), 9 deletions(-)
18
--- a/hw/arm/Kconfig
23
19
+++ b/hw/arm/Kconfig
24
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
20
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
25
index XXXXXXX..XXXXXXX 100644
21
imply VFIO_PLATFORM
26
--- a/include/hw/arm/smmu-common.h
22
imply VFIO_XGMAC
27
+++ b/include/hw/arm/smmu-common.h
23
imply TPM_TIS_SYSBUS
28
@@ -XXX,XX +XXX,XX @@ SMMUIOTLBKey smmu_get_iotlb_key(uint16_t asid, uint16_t vmid, uint64_t iova,
24
- select A15MPCORE
29
uint8_t tg, uint8_t level);
25
select ACPI
30
void smmu_iotlb_inv_all(SMMUState *s);
26
select ARM_SMMUV3
31
void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid);
27
select GPIO_KEY
32
+void smmu_iotlb_inv_vmid(SMMUState *s, uint16_t vmid);
33
void smmu_iotlb_inv_iova(SMMUState *s, int asid, int vmid, dma_addr_t iova,
34
uint8_t tg, uint64_t num_pages, uint8_t ttl);
35
36
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/arm/smmu-common.c
39
+++ b/hw/arm/smmu-common.c
40
@@ -XXX,XX +XXX,XX @@ static gboolean smmu_hash_remove_by_asid(gpointer key, gpointer value,
41
42
return SMMU_IOTLB_ASID(*iotlb_key) == asid;
43
}
44
+
45
+static gboolean smmu_hash_remove_by_vmid(gpointer key, gpointer value,
46
+ gpointer user_data)
47
+{
48
+ uint16_t vmid = *(uint16_t *)user_data;
49
+ SMMUIOTLBKey *iotlb_key = (SMMUIOTLBKey *)key;
50
+
51
+ return SMMU_IOTLB_VMID(*iotlb_key) == vmid;
52
+}
53
+
54
static gboolean smmu_hash_remove_by_asid_vmid_iova(gpointer key, gpointer value,
55
gpointer user_data)
56
{
57
@@ -XXX,XX +XXX,XX @@ void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid)
58
g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_asid, &asid);
59
}
60
61
+inline void smmu_iotlb_inv_vmid(SMMUState *s, uint16_t vmid)
62
+{
63
+ trace_smmu_iotlb_inv_vmid(vmid);
64
+ g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_vmid, &vmid);
65
+}
66
+
67
/* VMSAv8-64 Translation */
68
69
/**
70
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
71
index XXXXXXX..XXXXXXX 100644
72
--- a/hw/arm/smmuv3.c
73
+++ b/hw/arm/smmuv3.c
74
@@ -XXX,XX +XXX,XX @@ static void smmuv3_inv_notifiers_iova(SMMUState *s, int asid, dma_addr_t iova,
75
}
76
}
77
78
-static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
79
+static void smmuv3_range_inval(SMMUState *s, Cmd *cmd)
80
{
81
dma_addr_t end, addr = CMD_ADDR(cmd);
82
uint8_t type = CMD_TYPE(cmd);
83
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
84
}
85
86
if (!tg) {
87
- trace_smmuv3_s1_range_inval(vmid, asid, addr, tg, 1, ttl, leaf);
88
+ trace_smmuv3_range_inval(vmid, asid, addr, tg, 1, ttl, leaf);
89
smmuv3_inv_notifiers_iova(s, asid, addr, tg, 1);
90
smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, 1, ttl);
91
return;
92
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
93
uint64_t mask = dma_aligned_pow2_mask(addr, end, 64);
94
95
num_pages = (mask + 1) >> granule;
96
- trace_smmuv3_s1_range_inval(vmid, asid, addr, tg, num_pages, ttl, leaf);
97
+ trace_smmuv3_range_inval(vmid, asid, addr, tg, num_pages, ttl, leaf);
98
smmuv3_inv_notifiers_iova(s, asid, addr, tg, num_pages);
99
smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, num_pages, ttl);
100
addr += mask + 1;
101
@@ -XXX,XX +XXX,XX @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
102
{
103
uint16_t asid = CMD_ASID(&cmd);
104
105
+ if (!STAGE1_SUPPORTED(s)) {
106
+ cmd_error = SMMU_CERROR_ILL;
107
+ break;
108
+ }
109
+
110
trace_smmuv3_cmdq_tlbi_nh_asid(asid);
111
smmu_inv_notifiers_all(&s->smmu_state);
112
smmu_iotlb_inv_asid(bs, asid);
113
break;
114
}
115
case SMMU_CMD_TLBI_NH_ALL:
116
+ if (!STAGE1_SUPPORTED(s)) {
117
+ cmd_error = SMMU_CERROR_ILL;
118
+ break;
119
+ }
120
+ QEMU_FALLTHROUGH;
121
case SMMU_CMD_TLBI_NSNH_ALL:
122
trace_smmuv3_cmdq_tlbi_nh();
123
smmu_inv_notifiers_all(&s->smmu_state);
124
@@ -XXX,XX +XXX,XX @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
125
break;
126
case SMMU_CMD_TLBI_NH_VAA:
127
case SMMU_CMD_TLBI_NH_VA:
128
- smmuv3_s1_range_inval(bs, &cmd);
129
+ if (!STAGE1_SUPPORTED(s)) {
130
+ cmd_error = SMMU_CERROR_ILL;
131
+ break;
132
+ }
133
+ smmuv3_range_inval(bs, &cmd);
134
+ break;
135
+ case SMMU_CMD_TLBI_S12_VMALL:
136
+ {
137
+ uint16_t vmid = CMD_VMID(&cmd);
138
+
139
+ if (!STAGE2_SUPPORTED(s)) {
140
+ cmd_error = SMMU_CERROR_ILL;
141
+ break;
142
+ }
143
+
144
+ trace_smmuv3_cmdq_tlbi_s12_vmid(vmid);
145
+ smmu_inv_notifiers_all(&s->smmu_state);
146
+ smmu_iotlb_inv_vmid(bs, vmid);
147
+ break;
148
+ }
149
+ case SMMU_CMD_TLBI_S2_IPA:
150
+ if (!STAGE2_SUPPORTED(s)) {
151
+ cmd_error = SMMU_CERROR_ILL;
152
+ break;
153
+ }
154
+ /*
155
+ * As currently only either s1 or s2 are supported
156
+ * we can reuse same function for s2.
157
+ */
158
+ smmuv3_range_inval(bs, &cmd);
159
break;
160
case SMMU_CMD_TLBI_EL3_ALL:
161
case SMMU_CMD_TLBI_EL3_VA:
162
@@ -XXX,XX +XXX,XX @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
163
case SMMU_CMD_TLBI_EL2_ASID:
164
case SMMU_CMD_TLBI_EL2_VA:
165
case SMMU_CMD_TLBI_EL2_VAA:
166
- case SMMU_CMD_TLBI_S12_VMALL:
167
- case SMMU_CMD_TLBI_S2_IPA:
168
case SMMU_CMD_ATC_INV:
169
case SMMU_CMD_PRI_RESP:
170
case SMMU_CMD_RESUME:
171
@@ -XXX,XX +XXX,XX @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
172
break;
173
default:
174
cmd_error = SMMU_CERROR_ILL;
175
- qemu_log_mask(LOG_GUEST_ERROR,
176
- "Illegal command type: %d\n", CMD_TYPE(&cmd));
177
break;
178
}
179
qemu_mutex_unlock(&s->mutex);
180
if (cmd_error) {
181
+ if (cmd_error == SMMU_CERROR_ILL) {
182
+ qemu_log_mask(LOG_GUEST_ERROR,
183
+ "Illegal command type: %d\n", CMD_TYPE(&cmd));
184
+ }
185
break;
186
}
187
/*
188
diff --git a/hw/arm/trace-events b/hw/arm/trace-events
189
index XXXXXXX..XXXXXXX 100644
190
--- a/hw/arm/trace-events
191
+++ b/hw/arm/trace-events
192
@@ -XXX,XX +XXX,XX @@ smmu_ptw_block_pte(int stage, int level, uint64_t baseaddr, uint64_t pteaddr, ui
193
smmu_get_pte(uint64_t baseaddr, int index, uint64_t pteaddr, uint64_t pte) "baseaddr=0x%"PRIx64" index=0x%x, pteaddr=0x%"PRIx64", pte=0x%"PRIx64
194
smmu_iotlb_inv_all(void) "IOTLB invalidate all"
195
smmu_iotlb_inv_asid(uint16_t asid) "IOTLB invalidate asid=%d"
196
+smmu_iotlb_inv_vmid(uint16_t vmid) "IOTLB invalidate vmid=%d"
197
smmu_iotlb_inv_iova(uint16_t asid, uint64_t addr) "IOTLB invalidate asid=%d addr=0x%"PRIx64
198
smmu_inv_notifiers_mr(const char *name) "iommu mr=%s"
199
smmu_iotlb_lookup_hit(uint16_t asid, uint16_t vmid, uint64_t addr, uint32_t hit, uint32_t miss, uint32_t p) "IOTLB cache HIT asid=%d vmid=%d addr=0x%"PRIx64" hit=%d miss=%d hit rate=%d"
200
@@ -XXX,XX +XXX,XX @@ smmuv3_cmdq_cfgi_ste_range(int start, int end) "start=0x%x - end=0x%x"
201
smmuv3_cmdq_cfgi_cd(uint32_t sid) "sid=0x%x"
202
smmuv3_config_cache_hit(uint32_t sid, uint32_t hits, uint32_t misses, uint32_t perc) "Config cache HIT for sid=0x%x (hits=%d, misses=%d, hit rate=%d)"
203
smmuv3_config_cache_miss(uint32_t sid, uint32_t hits, uint32_t misses, uint32_t perc) "Config cache MISS for sid=0x%x (hits=%d, misses=%d, hit rate=%d)"
204
-smmuv3_s1_range_inval(int vmid, int asid, uint64_t addr, uint8_t tg, uint64_t num_pages, uint8_t ttl, bool leaf) "vmid=%d asid=%d addr=0x%"PRIx64" tg=%d num_pages=0x%"PRIx64" ttl=%d leaf=%d"
205
+smmuv3_range_inval(int vmid, int asid, uint64_t addr, uint8_t tg, uint64_t num_pages, uint8_t ttl, bool leaf) "vmid=%d asid=%d addr=0x%"PRIx64" tg=%d num_pages=0x%"PRIx64" ttl=%d leaf=%d"
206
smmuv3_cmdq_tlbi_nh(void) ""
207
smmuv3_cmdq_tlbi_nh_asid(uint16_t asid) "asid=%d"
208
+smmuv3_cmdq_tlbi_s12_vmid(uint16_t vmid) "vmid=%d"
209
smmuv3_config_cache_inv(uint32_t sid) "Config cache INV for sid=0x%x"
210
smmuv3_notify_flag_add(const char *iommu) "ADD SMMUNotifier node for iommu mr=%s"
211
smmuv3_notify_flag_del(const char *iommu) "DEL SMMUNotifier node for iommu mr=%s"
28
--
212
--
29
2.20.1
213
2.34.1
30
31
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
We can use one MPC per SRAM bank, but we currently only wire the
3
In smmuv3_notify_iova, read the granule based on translation stage
4
IRQ from the first expansion MPC to the IRQ splitter. Fix that.
4
and use VMID if valid value is sent.
5
5
6
Fixes: bb75e16d5e6 ("hw/arm/iotkit: Wire up MPC interrupt lines")
6
Signed-off-by: Mostafa Saleh <smostafa@google.com>
7
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Eric Auger <eric.auger@redhat.com>
8
Message-id: 20201107193403.436146-2-f4bug@amsat.org
8
Tested-by: Eric Auger <eric.auger@redhat.com>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
10
Message-id: 20230516203327.2051088-10-smostafa@google.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
---
12
hw/arm/armsse.c | 3 ++-
13
hw/arm/smmuv3.c | 39 ++++++++++++++++++++++++++-------------
13
1 file changed, 2 insertions(+), 1 deletion(-)
14
hw/arm/trace-events | 2 +-
15
2 files changed, 27 insertions(+), 14 deletions(-)
14
16
15
diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c
17
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
16
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/armsse.c
19
--- a/hw/arm/smmuv3.c
18
+++ b/hw/arm/armsse.c
20
+++ b/hw/arm/smmuv3.c
19
@@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp)
21
@@ -XXX,XX +XXX,XX @@ epilogue:
20
qdev_get_gpio_in(dev_splitter, 0));
22
* @mr: IOMMU mr region handle
21
qdev_connect_gpio_out(dev_splitter, 0,
23
* @n: notifier to be called
22
qdev_get_gpio_in_named(dev_secctl,
24
* @asid: address space ID or negative value if we don't care
23
- "mpc_status", 0));
25
+ * @vmid: virtual machine ID or negative value if we don't care
24
+ "mpc_status",
26
* @iova: iova
25
+ i - IOTS_NUM_EXP_MPC));
27
* @tg: translation granule (if communicated through range invalidation)
28
* @num_pages: number of @granule sized pages (if tg != 0), otherwise 1
29
*/
30
static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
31
IOMMUNotifier *n,
32
- int asid, dma_addr_t iova,
33
- uint8_t tg, uint64_t num_pages)
34
+ int asid, int vmid,
35
+ dma_addr_t iova, uint8_t tg,
36
+ uint64_t num_pages)
37
{
38
SMMUDevice *sdev = container_of(mr, SMMUDevice, iommu);
39
IOMMUTLBEvent event;
40
uint8_t granule;
41
+ SMMUv3State *s = sdev->smmu;
42
43
if (!tg) {
44
SMMUEventInfo event = {.inval_ste_allowed = true};
45
@@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
46
return;
26
}
47
}
27
48
28
qdev_connect_gpio_out(dev_splitter, 1,
49
- tt = select_tt(cfg, iova);
50
- if (!tt) {
51
+ if (vmid >= 0 && cfg->s2cfg.vmid != vmid) {
52
return;
53
}
54
- granule = tt->granule_sz;
55
+
56
+ if (STAGE1_SUPPORTED(s)) {
57
+ tt = select_tt(cfg, iova);
58
+ if (!tt) {
59
+ return;
60
+ }
61
+ granule = tt->granule_sz;
62
+ } else {
63
+ granule = cfg->s2cfg.granule_sz;
64
+ }
65
+
66
} else {
67
granule = tg * 2 + 10;
68
}
69
@@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
70
memory_region_notify_iommu_one(n, &event);
71
}
72
73
-/* invalidate an asid/iova range tuple in all mr's */
74
-static void smmuv3_inv_notifiers_iova(SMMUState *s, int asid, dma_addr_t iova,
75
- uint8_t tg, uint64_t num_pages)
76
+/* invalidate an asid/vmid/iova range tuple in all mr's */
77
+static void smmuv3_inv_notifiers_iova(SMMUState *s, int asid, int vmid,
78
+ dma_addr_t iova, uint8_t tg,
79
+ uint64_t num_pages)
80
{
81
SMMUDevice *sdev;
82
83
@@ -XXX,XX +XXX,XX @@ static void smmuv3_inv_notifiers_iova(SMMUState *s, int asid, dma_addr_t iova,
84
IOMMUMemoryRegion *mr = &sdev->iommu;
85
IOMMUNotifier *n;
86
87
- trace_smmuv3_inv_notifiers_iova(mr->parent_obj.name, asid, iova,
88
- tg, num_pages);
89
+ trace_smmuv3_inv_notifiers_iova(mr->parent_obj.name, asid, vmid,
90
+ iova, tg, num_pages);
91
92
IOMMU_NOTIFIER_FOREACH(n, mr) {
93
- smmuv3_notify_iova(mr, n, asid, iova, tg, num_pages);
94
+ smmuv3_notify_iova(mr, n, asid, vmid, iova, tg, num_pages);
95
}
96
}
97
}
98
@@ -XXX,XX +XXX,XX @@ static void smmuv3_range_inval(SMMUState *s, Cmd *cmd)
99
100
if (!tg) {
101
trace_smmuv3_range_inval(vmid, asid, addr, tg, 1, ttl, leaf);
102
- smmuv3_inv_notifiers_iova(s, asid, addr, tg, 1);
103
+ smmuv3_inv_notifiers_iova(s, asid, vmid, addr, tg, 1);
104
smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, 1, ttl);
105
return;
106
}
107
@@ -XXX,XX +XXX,XX @@ static void smmuv3_range_inval(SMMUState *s, Cmd *cmd)
108
109
num_pages = (mask + 1) >> granule;
110
trace_smmuv3_range_inval(vmid, asid, addr, tg, num_pages, ttl, leaf);
111
- smmuv3_inv_notifiers_iova(s, asid, addr, tg, num_pages);
112
+ smmuv3_inv_notifiers_iova(s, asid, vmid, addr, tg, num_pages);
113
smmu_iotlb_inv_iova(s, asid, vmid, addr, tg, num_pages, ttl);
114
addr += mask + 1;
115
}
116
diff --git a/hw/arm/trace-events b/hw/arm/trace-events
117
index XXXXXXX..XXXXXXX 100644
118
--- a/hw/arm/trace-events
119
+++ b/hw/arm/trace-events
120
@@ -XXX,XX +XXX,XX @@ smmuv3_cmdq_tlbi_s12_vmid(uint16_t vmid) "vmid=%d"
121
smmuv3_config_cache_inv(uint32_t sid) "Config cache INV for sid=0x%x"
122
smmuv3_notify_flag_add(const char *iommu) "ADD SMMUNotifier node for iommu mr=%s"
123
smmuv3_notify_flag_del(const char *iommu) "DEL SMMUNotifier node for iommu mr=%s"
124
-smmuv3_inv_notifiers_iova(const char *name, uint16_t asid, uint64_t iova, uint8_t tg, uint64_t num_pages) "iommu mr=%s asid=%d iova=0x%"PRIx64" tg=%d num_pages=0x%"PRIx64
125
+smmuv3_inv_notifiers_iova(const char *name, uint16_t asid, uint16_t vmid, uint64_t iova, uint8_t tg, uint64_t num_pages) "iommu mr=%s asid=%d vmid=%d iova=0x%"PRIx64" tg=%d num_pages=0x%"PRIx64
126
29
--
127
--
30
2.20.1
128
2.34.1
31
32
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
The system configuration controller (SYSCFG) doesn't have
3
As everything is in place, we can use a new system property to
4
any output IRQ (and the INTC input #71 belongs to the UART6).
4
advertise which stage is supported and remove bad_ste from STE
5
Remove the invalid code.
5
stage2 config.
6
6
7
Fixes: db635521a02 ("stm32f205: Add the stm32f205 SoC")
7
The property added arm-smmuv3.stage can have 3 values:
8
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
- "1": Stage-1 only is advertised.
9
Message-id: 20201107193403.436146-3-f4bug@amsat.org
9
- "2": Stage-2 only is advertised.
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
11
If not passed or an unsupported value is passed, it will default to
12
stage-1.
13
14
Advertise VMID16.
15
16
Don't try to decode CD, if stage-2 is configured.
17
18
Reviewed-by: Eric Auger <eric.auger@redhat.com>
19
Signed-off-by: Mostafa Saleh <smostafa@google.com>
20
Tested-by: Eric Auger <eric.auger@redhat.com>
21
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
22
Message-id: 20230516203327.2051088-11-smostafa@google.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
24
---
13
include/hw/misc/stm32f2xx_syscfg.h | 2 --
25
include/hw/arm/smmuv3.h | 1 +
14
hw/arm/stm32f205_soc.c | 1 -
26
hw/arm/smmuv3.c | 32 ++++++++++++++++++++++----------
15
hw/misc/stm32f2xx_syscfg.c | 2 --
27
2 files changed, 23 insertions(+), 10 deletions(-)
16
3 files changed, 5 deletions(-)
17
28
18
diff --git a/include/hw/misc/stm32f2xx_syscfg.h b/include/hw/misc/stm32f2xx_syscfg.h
29
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
19
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/misc/stm32f2xx_syscfg.h
31
--- a/include/hw/arm/smmuv3.h
21
+++ b/include/hw/misc/stm32f2xx_syscfg.h
32
+++ b/include/hw/arm/smmuv3.h
22
@@ -XXX,XX +XXX,XX @@ struct STM32F2XXSyscfgState {
33
@@ -XXX,XX +XXX,XX @@ struct SMMUv3State {
23
uint32_t syscfg_exticr3;
34
24
uint32_t syscfg_exticr4;
35
qemu_irq irq[4];
25
uint32_t syscfg_cmpcr;
36
QemuMutex mutex;
37
+ char *stage;
38
};
39
40
typedef enum {
41
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
42
index XXXXXXX..XXXXXXX 100644
43
--- a/hw/arm/smmuv3.c
44
+++ b/hw/arm/smmuv3.c
45
@@ -XXX,XX +XXX,XX @@
46
#include "hw/irq.h"
47
#include "hw/sysbus.h"
48
#include "migration/vmstate.h"
49
+#include "hw/qdev-properties.h"
50
#include "hw/qdev-core.h"
51
#include "hw/pci/pci.h"
52
#include "cpu.h"
53
@@ -XXX,XX +XXX,XX @@ void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *info)
54
55
static void smmuv3_init_regs(SMMUv3State *s)
56
{
57
- /**
58
- * IDR0: stage1 only, AArch64 only, coherent access, 16b ASID,
59
- * multi-level stream table
60
- */
61
- s->idr[0] = FIELD_DP32(s->idr[0], IDR0, S1P, 1); /* stage 1 supported */
62
+ /* Based on sys property, the stages supported in smmu will be advertised.*/
63
+ if (s->stage && !strcmp("2", s->stage)) {
64
+ s->idr[0] = FIELD_DP32(s->idr[0], IDR0, S2P, 1);
65
+ } else {
66
+ s->idr[0] = FIELD_DP32(s->idr[0], IDR0, S1P, 1);
67
+ }
68
+
69
s->idr[0] = FIELD_DP32(s->idr[0], IDR0, TTF, 2); /* AArch64 PTW only */
70
s->idr[0] = FIELD_DP32(s->idr[0], IDR0, COHACC, 1); /* IO coherent */
71
s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ASID16, 1); /* 16-bit ASID */
72
+ s->idr[0] = FIELD_DP32(s->idr[0], IDR0, VMID16, 1); /* 16-bit VMID */
73
s->idr[0] = FIELD_DP32(s->idr[0], IDR0, TTENDIAN, 2); /* little endian */
74
s->idr[0] = FIELD_DP32(s->idr[0], IDR0, STALL_MODEL, 1); /* No stall */
75
/* terminated transaction will always be aborted/error returned */
76
@@ -XXX,XX +XXX,XX @@ static int decode_ste_s2_cfg(SMMUTransCfg *cfg, STE *ste)
77
goto bad_ste;
78
}
79
80
- /* This is still here as stage 2 has not been fully enabled yet. */
81
- qemu_log_mask(LOG_UNIMP, "SMMUv3 does not support stage 2 yet\n");
82
- goto bad_ste;
26
-
83
-
27
- qemu_irq irq;
84
return 0;
85
86
bad_ste:
87
@@ -XXX,XX +XXX,XX @@ static int smmuv3_decode_config(IOMMUMemoryRegion *mr, SMMUTransCfg *cfg,
88
return ret;
89
}
90
91
- if (cfg->aborted || cfg->bypassed) {
92
+ if (cfg->aborted || cfg->bypassed || (cfg->stage == 2)) {
93
return 0;
94
}
95
96
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3 = {
97
}
28
};
98
};
29
99
30
#endif /* HW_STM32F2XX_SYSCFG_H */
100
+static Property smmuv3_properties[] = {
31
diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c
101
+ /*
32
index XXXXXXX..XXXXXXX 100644
102
+ * Stages of translation advertised.
33
--- a/hw/arm/stm32f205_soc.c
103
+ * "1": Stage 1
34
+++ b/hw/arm/stm32f205_soc.c
104
+ * "2": Stage 2
35
@@ -XXX,XX +XXX,XX @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
105
+ * Defaults to stage 1
36
}
106
+ */
37
busdev = SYS_BUS_DEVICE(dev);
107
+ DEFINE_PROP_STRING("stage", SMMUv3State, stage),
38
sysbus_mmio_map(busdev, 0, 0x40013800);
108
+ DEFINE_PROP_END_OF_LIST()
39
- sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, 71));
109
+};
40
110
+
41
/* Attach UART (uses USART registers) and USART controllers */
111
static void smmuv3_instance_init(Object *obj)
42
for (i = 0; i < STM_NUM_USARTS; i++) {
43
diff --git a/hw/misc/stm32f2xx_syscfg.c b/hw/misc/stm32f2xx_syscfg.c
44
index XXXXXXX..XXXXXXX 100644
45
--- a/hw/misc/stm32f2xx_syscfg.c
46
+++ b/hw/misc/stm32f2xx_syscfg.c
47
@@ -XXX,XX +XXX,XX @@ static void stm32f2xx_syscfg_init(Object *obj)
48
{
112
{
49
STM32F2XXSyscfgState *s = STM32F2XX_SYSCFG(obj);
113
/* Nothing much to do here as of now */
50
114
@@ -XXX,XX +XXX,XX @@ static void smmuv3_class_init(ObjectClass *klass, void *data)
51
- sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
115
&c->parent_phases);
52
-
116
c->parent_realize = dc->realize;
53
memory_region_init_io(&s->mmio, obj, &stm32f2xx_syscfg_ops, s,
117
dc->realize = smmu_realize;
54
TYPE_STM32F2XX_SYSCFG, 0x400);
118
+ device_class_set_props(dc, smmuv3_properties);
55
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
119
}
120
121
static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
56
--
122
--
57
2.20.1
123
2.34.1
58
59
diff view generated by jsdifflib
1
From: Xinhao Zhang <zhangxinhao1@huawei.com>
1
From: Tommy Wu <tommy.wu@sifive.com>
2
2
3
Fix code style. Operator needs spaces both sides.
3
When we receive a packet from the xilinx_axienet and then try to s2mem
4
through the xilinx_axidma, if the descriptor ring buffer is full in the
5
xilinx axidma driver, we’ll assert the DMASR.HALTED in the
6
function : stream_process_s2mem and return 0. In the end, we’ll be stuck in
7
an infinite loop in axienet_eth_rx_notify.
4
8
5
Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com>
9
This patch checks the DMASR.HALTED state when we try to push data
6
Signed-off-by: Kai Deng <dengkai1@huawei.com>
10
from xilinx axi-enet to xilinx axi-dma. When the DMASR.HALTED is asserted,
7
Message-id: 20201103114529.638233-1-zhangxinhao1@huawei.com
11
we will not keep pushing the data and then prevent the infinte loop.
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
13
Signed-off-by: Tommy Wu <tommy.wu@sifive.com>
14
Reviewed-by: Edgar E. Iglesias <edgar@zeroasic.com>
15
Reviewed-by: Frank Chang <frank.chang@sifive.com>
16
Message-id: 20230519062137.1251741-1-tommy.wu@sifive.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
18
---
11
target/arm/arch_dump.c | 8 ++++----
19
hw/dma/xilinx_axidma.c | 11 ++++++++---
12
target/arm/arm-semi.c | 8 ++++----
20
1 file changed, 8 insertions(+), 3 deletions(-)
13
target/arm/helper.c | 2 +-
14
3 files changed, 9 insertions(+), 9 deletions(-)
15
21
16
diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c
22
diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
17
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/arch_dump.c
24
--- a/hw/dma/xilinx_axidma.c
19
+++ b/target/arm/arch_dump.c
25
+++ b/hw/dma/xilinx_axidma.c
20
@@ -XXX,XX +XXX,XX @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f,
26
@@ -XXX,XX +XXX,XX @@ static inline int stream_idle(struct Stream *s)
21
27
return !!(s->regs[R_DMASR] & DMASR_IDLE);
22
for (i = 0; i < 32; ++i) {
28
}
23
uint64_t *q = aa64_vfp_qreg(env, i);
29
24
- note.vfp.vregs[2*i + 0] = cpu_to_dump64(s, q[0]);
30
+static inline int stream_halted(struct Stream *s)
25
- note.vfp.vregs[2*i + 1] = cpu_to_dump64(s, q[1]);
31
+{
26
+ note.vfp.vregs[2 * i + 0] = cpu_to_dump64(s, q[0]);
32
+ return !!(s->regs[R_DMASR] & DMASR_HALTED);
27
+ note.vfp.vregs[2 * i + 1] = cpu_to_dump64(s, q[1]);
33
+}
34
+
35
static void stream_reset(struct Stream *s)
36
{
37
s->regs[R_DMASR] = DMASR_HALTED; /* starts up halted. */
38
@@ -XXX,XX +XXX,XX @@ static void stream_process_mem2s(struct Stream *s, StreamSink *tx_data_dev,
39
uint64_t addr;
40
bool eop;
41
42
- if (!stream_running(s) || stream_idle(s)) {
43
+ if (!stream_running(s) || stream_idle(s) || stream_halted(s)) {
44
return;
28
}
45
}
29
46
30
if (s->dump_info.d_endian == ELFDATA2MSB) {
47
@@ -XXX,XX +XXX,XX @@ static size_t stream_process_s2mem(struct Stream *s, unsigned char *buf,
31
@@ -XXX,XX +XXX,XX @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f,
48
unsigned int rxlen;
32
*/
49
size_t pos = 0;
33
for (i = 0; i < 32; ++i) {
50
34
uint64_t tmp = note.vfp.vregs[2*i];
51
- if (!stream_running(s) || stream_idle(s)) {
35
- note.vfp.vregs[2*i] = note.vfp.vregs[2*i+1];
52
+ if (!stream_running(s) || stream_idle(s) || stream_halted(s)) {
36
- note.vfp.vregs[2*i+1] = tmp;
53
return 0;
37
+ note.vfp.vregs[2 * i] = note.vfp.vregs[2 * i + 1];
38
+ note.vfp.vregs[2 * i + 1] = tmp;
39
}
40
}
54
}
41
55
42
diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c
56
@@ -XXX,XX +XXX,XX @@ xilinx_axidma_data_stream_can_push(StreamSink *obj,
43
index XXXXXXX..XXXXXXX 100644
57
XilinxAXIDMAStreamSink *ds = XILINX_AXI_DMA_DATA_STREAM(obj);
44
--- a/target/arm/arm-semi.c
58
struct Stream *s = &ds->dma->streams[1];
45
+++ b/target/arm/arm-semi.c
59
46
@@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env)
60
- if (!stream_running(s) || stream_idle(s)) {
47
if (use_gdb_syscalls()) {
61
+ if (!stream_running(s) || stream_idle(s) || stream_halted(s)) {
48
arm_semi_open_guestfd = guestfd;
62
ds->dma->notify = notify;
49
ret = arm_gdb_syscall(cpu, arm_semi_open_cb, "open,%s,%x,1a4", arg0,
63
ds->dma->notify_opaque = notify_opaque;
50
- (int)arg2+1, gdb_open_modeflags[arg1]);
64
return false;
51
+ (int)arg2 + 1, gdb_open_modeflags[arg1]);
52
} else {
53
ret = set_swi_errno(env, open(s, open_modeflags[arg1], 0644));
54
if (ret == (uint32_t)-1) {
55
@@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env)
56
GET_ARG(1);
57
if (use_gdb_syscalls()) {
58
ret = arm_gdb_syscall(cpu, arm_semi_cb, "unlink,%s",
59
- arg0, (int)arg1+1);
60
+ arg0, (int)arg1 + 1);
61
} else {
62
s = lock_user_string(arg0);
63
if (!s) {
64
@@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env)
65
GET_ARG(3);
66
if (use_gdb_syscalls()) {
67
return arm_gdb_syscall(cpu, arm_semi_cb, "rename,%s,%s",
68
- arg0, (int)arg1+1, arg2, (int)arg3+1);
69
+ arg0, (int)arg1 + 1, arg2, (int)arg3 + 1);
70
} else {
71
char *s2;
72
s = lock_user_string(arg0);
73
@@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env)
74
GET_ARG(1);
75
if (use_gdb_syscalls()) {
76
return arm_gdb_syscall(cpu, arm_semi_cb, "system,%s",
77
- arg0, (int)arg1+1);
78
+ arg0, (int)arg1 + 1);
79
} else {
80
s = lock_user_string(arg0);
81
if (!s) {
82
diff --git a/target/arm/helper.c b/target/arm/helper.c
83
index XXXXXXX..XXXXXXX 100644
84
--- a/target/arm/helper.c
85
+++ b/target/arm/helper.c
86
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(usad8)(uint32_t a, uint32_t b)
87
uint32_t sum;
88
sum = do_usad(a, b);
89
sum += do_usad(a >> 8, b >> 8);
90
- sum += do_usad(a >> 16, b >>16);
91
+ sum += do_usad(a >> 16, b >> 16);
92
sum += do_usad(a >> 24, b >> 24);
93
return sum;
94
}
95
--
65
--
96
2.20.1
66
2.34.1
97
67
98
68
diff view generated by jsdifflib
1
From: Xinhao Zhang <zhangxinhao1@huawei.com>
1
From: Clément Chigot <chigot@adacore.com>
2
2
3
Fix code style. Space required before the open parenthesis '('.
3
When passing --smp with a number lower than XLNX_ZYNQMP_NUM_APU_CPUS,
4
the expression (ms->smp.cpus - XLNX_ZYNQMP_NUM_APU_CPUS) will result
5
in a positive number as ms->smp.cpus is a unsigned int.
6
This will raise the following error afterwards, as Qemu will try to
7
instantiate some additional RPUs.
8
| $ qemu-system-aarch64 --smp 1 -M xlnx-zcu102
9
| **
10
| ERROR:../src/tcg/tcg.c:777:tcg_register_thread:
11
| assertion failed: (n < tcg_max_ctxs)
4
12
5
Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com>
13
Signed-off-by: Clément Chigot <chigot@adacore.com>
6
Signed-off-by: Kai Deng <dengkai1@huawei.com>
14
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
7
Message-id: 20201103114529.638233-3-zhangxinhao1@huawei.com
15
Tested-by: Francisco Iglesias <frasse.iglesias@gmail.com>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
Message-id: 20230524143714.565792-1-chigot@adacore.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
18
---
11
target/arm/translate.c | 2 +-
19
hw/arm/xlnx-zynqmp.c | 2 +-
12
1 file changed, 1 insertion(+), 1 deletion(-)
20
1 file changed, 1 insertion(+), 1 deletion(-)
13
21
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
22
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
15
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate.c
24
--- a/hw/arm/xlnx-zynqmp.c
17
+++ b/target/arm/translate.c
25
+++ b/hw/arm/xlnx-zynqmp.c
18
@@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
26
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s,
19
- Hardware watchpoints.
27
const char *boot_cpu, Error **errp)
20
Hardware breakpoints have already been handled and skip this code.
28
{
21
*/
29
int i;
22
- switch(dc->base.is_jmp) {
30
- int num_rpus = MIN(ms->smp.cpus - XLNX_ZYNQMP_NUM_APU_CPUS,
23
+ switch (dc->base.is_jmp) {
31
+ int num_rpus = MIN((int)(ms->smp.cpus - XLNX_ZYNQMP_NUM_APU_CPUS),
24
case DISAS_NEXT:
32
XLNX_ZYNQMP_NUM_RPU_CPUS);
25
case DISAS_TOO_MANY:
33
26
gen_goto_tb(dc, 1, dc->base.pc_next);
34
if (num_rpus <= 0) {
27
--
35
--
28
2.20.1
36
2.34.1
29
37
30
38
diff view generated by jsdifflib
New patch
1
From: Thomas Huth <thuth@redhat.com>
1
2
3
pflash-cfi02-test.c always uses the "musicpal" machine for testing,
4
test-arm-mptimer.c always uses the "vexpress-a9" machine, and
5
microbit-test.c requires the "microbit" machine, so we should only
6
run these tests if the machines have been enabled in the configuration.
7
8
Signed-off-by: Thomas Huth <thuth@redhat.com>
9
Reviewed-by: Fabiano Rosas <farosas@suse.de>
10
Message-id: 20230524080600.1618137-1-thuth@redhat.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
tests/qtest/meson.build | 7 ++++---
14
1 file changed, 4 insertions(+), 3 deletions(-)
15
16
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
17
index XXXXXXX..XXXXXXX 100644
18
--- a/tests/qtest/meson.build
19
+++ b/tests/qtest/meson.build
20
@@ -XXX,XX +XXX,XX @@ qtests_arm = \
21
(config_all_devices.has_key('CONFIG_CMSDK_APB_DUALTIMER') ? ['cmsdk-apb-dualtimer-test'] : []) + \
22
(config_all_devices.has_key('CONFIG_CMSDK_APB_TIMER') ? ['cmsdk-apb-timer-test'] : []) + \
23
(config_all_devices.has_key('CONFIG_CMSDK_APB_WATCHDOG') ? ['cmsdk-apb-watchdog-test'] : []) + \
24
- (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \
25
+ (config_all_devices.has_key('CONFIG_PFLASH_CFI02') and
26
+ config_all_devices.has_key('CONFIG_MUSICPAL') ? ['pflash-cfi02-test'] : []) + \
27
(config_all_devices.has_key('CONFIG_ASPEED_SOC') ? qtests_aspeed : []) + \
28
(config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \
29
(config_all_devices.has_key('CONFIG_GENERIC_LOADER') ? ['hexloader-test'] : []) + \
30
(config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \
31
+ (config_all_devices.has_key('CONFIG_VEXPRESS') ? ['test-arm-mptimer'] : []) + \
32
+ (config_all_devices.has_key('CONFIG_MICROBIT') ? ['microbit-test'] : []) + \
33
['arm-cpu-features',
34
- 'microbit-test',
35
- 'test-arm-mptimer',
36
'boot-serial-test']
37
38
# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
39
--
40
2.34.1
diff view generated by jsdifflib
1
The nseries machines have a codepath that allows them to load a
1
For M-profile, there is no guest-facing A-profile format FSR, but we
2
secondary bootloader. This code wasn't checking that the
2
still use the env->exception.fsr field to pass fault information from
3
load_image_targphys() succeeded. Check the return value and report
3
the point where a fault is raised to the code in
4
the error to the user.
4
arm_v7m_cpu_do_interrupt() which interprets it and sets the M-profile
5
specific fault status registers. So it doesn't matter whether we
6
fill in env->exception.fsr in the short format or the LPAE format, as
7
long as both sides agree. As it happens arm_v7m_cpu_do_interrupt()
8
assumes short-form.
5
9
6
While we're in the vicinity, fix the comment style of the
10
In compute_fsr_fsc() we weren't explicitly choosing short-form for
7
comment documenting what this image load is doing.
11
M-profile, but instead relied on it falling out in the wash because
12
arm_s1_regime_using_lpae_format() would be false. This was broken in
13
commit 452c67a4 when we added v8R support, because we said "PMSAv8 is
14
always LPAE format" (as it is for v8R), forgetting that we were
15
implicitly using this code path on M-profile. At that point we would
16
hit a g_assert_not_reached():
17
ERROR:../../target/arm/internals.h:549:arm_fi_to_lfsc: code should not be reached
8
18
9
Fixes: Coverity CID 1192904
19
#7 0x0000555555e055f7 in arm_fi_to_lfsc (fi=0x7fffecff9a90) at ../../target/arm/internals.h:549
20
#8 0x0000555555e05a27 in compute_fsr_fsc (env=0x555557356670, fi=0x7fffecff9a90, target_el=1, mmu_idx=1, ret_fsc=0x7fffecff9a1c)
21
at ../../target/arm/tlb_helper.c:95
22
#9 0x0000555555e05b62 in arm_deliver_fault (cpu=0x555557354800, addr=268961344, access_type=MMU_INST_FETCH, mmu_idx=1, fi=0x7fffecff9a90)
23
at ../../target/arm/tlb_helper.c:132
24
#10 0x0000555555e06095 in arm_cpu_tlb_fill (cs=0x555557354800, address=268961344, size=1, access_type=MMU_INST_FETCH, mmu_idx=1, probe=false, retaddr=0)
25
at ../../target/arm/tlb_helper.c:260
26
27
The specific assertion changed when commit fcc7404eff24b4c added
28
"assert not M-profile" to arm_is_secure_below_el3(), because the
29
conditions being checked in compute_fsr_fsc() include
30
arm_el_is_aa64(), which will end up calling arm_is_secure_below_el3()
31
and asserting before we try to call arm_fi_to_lfsc():
32
33
#7 0x0000555555efaf43 in arm_is_secure_below_el3 (env=0x5555574665a0) at ../../target/arm/cpu.h:2396
34
#8 0x0000555555efb103 in arm_is_el2_enabled (env=0x5555574665a0) at ../../target/arm/cpu.h:2448
35
#9 0x0000555555efb204 in arm_el_is_aa64 (env=0x5555574665a0, el=1) at ../../target/arm/cpu.h:2509
36
#10 0x0000555555efbdfd in compute_fsr_fsc (env=0x5555574665a0, fi=0x7fffecff99e0, target_el=1, mmu_idx=1, ret_fsc=0x7fffecff996c)
37
38
Avoid the assertion and the incorrect FSR format selection by
39
explicitly making M-profile use the short-format in this function.
40
41
Fixes: 452c67a42704 ("target/arm: Enable TTBCR_EAE for ARMv8-R AArch32")a
42
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1658
43
Cc: qemu-stable@nongnu.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
44
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
45
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20201103114918.11807-1-peter.maydell@linaro.org
46
Message-id: 20230523131726.866635-1-peter.maydell@linaro.org
13
---
47
---
14
hw/arm/nseries.c | 15 +++++++++++----
48
target/arm/tcg/tlb_helper.c | 13 +++++++++++--
15
1 file changed, 11 insertions(+), 4 deletions(-)
49
1 file changed, 11 insertions(+), 2 deletions(-)
16
50
17
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
51
diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c
18
index XXXXXXX..XXXXXXX 100644
52
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/nseries.c
53
--- a/target/arm/tcg/tlb_helper.c
20
+++ b/hw/arm/nseries.c
54
+++ b/target/arm/tcg/tlb_helper.c
21
@@ -XXX,XX +XXX,XX @@ static void n8x0_init(MachineState *machine,
55
@@ -XXX,XX +XXX,XX @@ static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi,
22
/* No, wait, better start at the ROM. */
56
ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx);
23
s->mpu->cpu->env.regs[15] = OMAP2_Q2_BASE + 0x400000;
57
uint32_t fsr, fsc;
24
58
25
- /* This is intended for loading the `secondary.bin' program from
59
- if (target_el == 2 || arm_el_is_aa64(env, target_el) ||
26
+ /*
60
- arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) {
27
+ * This is intended for loading the `secondary.bin' program from
61
+ /*
28
* Nokia images (the NOLO bootloader). The entry point seems
62
+ * For M-profile there is no guest-facing FSR. We compute a
29
* to be at OMAP2_Q2_BASE + 0x400000.
63
+ * short-form value for env->exception.fsr which we will then
30
*
64
+ * examine in arm_v7m_cpu_do_interrupt(). In theory we could
31
@@ -XXX,XX +XXX,XX @@ static void n8x0_init(MachineState *machine,
65
+ * use the LPAE format instead as long as both bits of code agree
32
* for them the entry point needs to be set to OMAP2_SRAM_BASE.
66
+ * (and arm_fi_to_lfsc() handled the M-profile specific
33
*
67
+ * ARMFault_QEMU_NSCExec and ARMFault_QEMU_SFault cases).
34
* The code above is for loading the `zImage' file from Nokia
68
+ */
35
- * images. */
69
+ if (!arm_feature(env, ARM_FEATURE_M) &&
36
- load_image_targphys(option_rom[0].name, OMAP2_Q2_BASE + 0x400000,
70
+ (target_el == 2 || arm_el_is_aa64(env, target_el) ||
37
- machine->ram_size - 0x400000);
71
+ arm_s1_regime_using_lpae_format(env, arm_mmu_idx))) {
38
+ * images.
72
/*
39
+ */
73
* LPAE format fault status register : bottom 6 bits are
40
+ if (load_image_targphys(option_rom[0].name,
74
* status code in the same form as needed for syndrome
41
+ OMAP2_Q2_BASE + 0x400000,
42
+ machine->ram_size - 0x400000) < 0) {
43
+ error_report("Failed to load secondary bootloader %s",
44
+ option_rom[0].name);
45
+ exit(EXIT_FAILURE);
46
+ }
47
48
n800_setup_nolo_tags(nolo_tags);
49
cpu_physical_memory_write(OMAP2_SRAM_BASE, nolo_tags, 0x10000);
50
--
75
--
51
2.20.1
76
2.34.1
52
53
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
We should at least document what this machine is about.
3
We currently need to select ARM_V7M unconditionally when TCG is
4
present in the build because some translate.c helpers and the whole of
5
m_helpers.c are not yet under CONFIG_ARM_V7M.
4
6
5
Reviewed-by: Graeme Gregory <graeme@nuviainc.com>
7
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
8
Signed-off-by: Fabiano Rosas <farosas@suse.de>
7
Message-id: 20201104165254.24822-1-alex.bennee@linaro.org
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Cc: Leif Lindholm <leif@nuviainc.com>
10
Message-id: 20230523180525.29994-2-farosas@suse.de
9
Cc: Shashi Mallela <shashi.mallela@linaro.org>
10
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
11
[PMM: fixed filename mismatch]
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
12
---
14
docs/system/arm/sbsa.rst | 32 ++++++++++++++++++++++++++++++++
13
target/arm/Kconfig | 3 +++
15
docs/system/target-arm.rst | 1 +
14
1 file changed, 3 insertions(+)
16
2 files changed, 33 insertions(+)
17
create mode 100644 docs/system/arm/sbsa.rst
18
15
19
diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst
16
diff --git a/target/arm/Kconfig b/target/arm/Kconfig
20
new file mode 100644
17
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX
18
--- a/target/arm/Kconfig
22
--- /dev/null
19
+++ b/target/arm/Kconfig
23
+++ b/docs/system/arm/sbsa.rst
24
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@
25
+Arm Server Base System Architecture Reference board (``sbsa-ref``)
21
config ARM
26
+==================================================================
22
bool
23
select ARM_COMPATIBLE_SEMIHOSTING if TCG
27
+
24
+
28
+While the `virt` board is a generic board platform that doesn't match
25
+ # We need to select this until we move m_helper.c and the
29
+any real hardware the `sbsa-ref` board intends to look like real
26
+ # translate.c v7m helpers under ARM_V7M.
30
+hardware. The `Server Base System Architecture
27
select ARM_V7M if TCG
31
+<https://developer.arm.com/documentation/den0029/latest>` defines a
28
32
+minimum base line of hardware support and importantly how the firmware
29
config AARCH64
33
+reports that to any operating system. It is a static system that
34
+reports a very minimal DT to the firmware for non-discoverable
35
+information about components affected by the qemu command line (i.e.
36
+cpus and memory). As a result it must have a firmware specifically
37
+built to expect a certain hardware layout (as you would in a real
38
+machine).
39
+
40
+It is intended to be a machine for developing firmware and testing
41
+standards compliance with operating systems.
42
+
43
+Supported devices
44
+"""""""""""""""""
45
+
46
+The sbsa-ref board supports:
47
+
48
+ - A configurable number of AArch64 CPUs
49
+ - GIC version 3
50
+ - System bus AHCI controller
51
+ - System bus EHCI controller
52
+ - CDROM and hard disc on AHCI bus
53
+ - E1000E ethernet card on PCIe bus
54
+ - VGA display adaptor on PCIe bus
55
+ - A generic SBSA watchdog device
56
+
57
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
58
index XXXXXXX..XXXXXXX 100644
59
--- a/docs/system/target-arm.rst
60
+++ b/docs/system/target-arm.rst
61
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
62
arm/mps2
63
arm/musca
64
arm/realview
65
+ arm/sbsa
66
arm/versatile
67
arm/vexpress
68
arm/aspeed
69
--
30
--
70
2.20.1
31
2.34.1
71
32
72
33
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
3
When we moved the arm default CONFIGs into Kconfig and removed them
4
from default.mak, we made it harder to identify which CONFIGs are
5
selected by default in case users want to disable them.
6
7
Bring back the default entries into default.mak, but keep them
8
commented out. This way users can keep their workflows of editing
9
default.mak to remove build options without needing to search through
10
Kconfig.
11
12
Reported-by: Thomas Huth <thuth@redhat.com>
13
Signed-off-by: Fabiano Rosas <farosas@suse.de>
14
Reviewed-by: Thomas Huth <thuth@redhat.com>
15
Message-id: 20230523180525.29994-3-farosas@suse.de
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
18
configs/devices/aarch64-softmmu/default.mak | 6 ++++
19
configs/devices/arm-softmmu/default.mak | 40 +++++++++++++++++++++
20
2 files changed, 46 insertions(+)
21
22
diff --git a/configs/devices/aarch64-softmmu/default.mak b/configs/devices/aarch64-softmmu/default.mak
23
index XXXXXXX..XXXXXXX 100644
24
--- a/configs/devices/aarch64-softmmu/default.mak
25
+++ b/configs/devices/aarch64-softmmu/default.mak
26
@@ -XXX,XX +XXX,XX @@
27
28
# We support all the 32 bit boards so need all their config
29
include ../arm-softmmu/default.mak
30
+
31
+# These are selected by default when TCG is enabled, uncomment them to
32
+# keep out of the build.
33
+# CONFIG_XLNX_ZYNQMP_ARM=n
34
+# CONFIG_XLNX_VERSAL=n
35
+# CONFIG_SBSA_REF=n
36
diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak
37
index XXXXXXX..XXXXXXX 100644
38
--- a/configs/devices/arm-softmmu/default.mak
39
+++ b/configs/devices/arm-softmmu/default.mak
40
@@ -XXX,XX +XXX,XX @@
41
# CONFIG_TEST_DEVICES=n
42
43
CONFIG_ARM_VIRT=y
44
+
45
+# These are selected by default when TCG is enabled, uncomment them to
46
+# keep out of the build.
47
+# CONFIG_CUBIEBOARD=n
48
+# CONFIG_EXYNOS4=n
49
+# CONFIG_HIGHBANK=n
50
+# CONFIG_INTEGRATOR=n
51
+# CONFIG_FSL_IMX31=n
52
+# CONFIG_MUSICPAL=n
53
+# CONFIG_MUSCA=n
54
+# CONFIG_CHEETAH=n
55
+# CONFIG_SX1=n
56
+# CONFIG_NSERIES=n
57
+# CONFIG_STELLARIS=n
58
+# CONFIG_STM32VLDISCOVERY=n
59
+# CONFIG_REALVIEW=n
60
+# CONFIG_VERSATILE=n
61
+# CONFIG_VEXPRESS=n
62
+# CONFIG_ZYNQ=n
63
+# CONFIG_MAINSTONE=n
64
+# CONFIG_GUMSTIX=n
65
+# CONFIG_SPITZ=n
66
+# CONFIG_TOSA=n
67
+# CONFIG_Z2=n
68
+# CONFIG_NPCM7XX=n
69
+# CONFIG_COLLIE=n
70
+# CONFIG_ASPEED_SOC=n
71
+# CONFIG_NETDUINO2=n
72
+# CONFIG_NETDUINOPLUS2=n
73
+# CONFIG_OLIMEX_STM32_H405=n
74
+# CONFIG_MPS2=n
75
+# CONFIG_RASPI=n
76
+# CONFIG_DIGIC=n
77
+# CONFIG_SABRELITE=n
78
+# CONFIG_EMCRAFT_SF2=n
79
+# CONFIG_MICROBIT=n
80
+# CONFIG_FSL_IMX25=n
81
+# CONFIG_FSL_IMX7=n
82
+# CONFIG_FSL_IMX6UL=n
83
+# CONFIG_ALLWINNER_H3=n
84
--
85
2.34.1
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
commit 32bd322a0134 ("hw/timer/armv7m_systick: Rewrite to use ptimers")
3
Replace the 'default y if TCG' pattern with 'default y; depends on
4
changed armv7m_systick to build on ptimers. Make sure we have ptimers
4
TCG'.
5
in the build when building armv7m_systick.
5
6
6
That makes explict that there is a dependence on TCG and enabling
7
Signed-off-by: Andrew Jones <drjones@redhat.com>
7
these CONFIGs via .mak files without TCG present will fail earlier.
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
9
Message-id: 20201104103343.30392-1-drjones@redhat.com
9
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
10
Signed-off-by: Fabiano Rosas <farosas@suse.de>
11
Reviewed-by: Thomas Huth <thuth@redhat.com>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Message-id: 20230523180525.29994-4-farosas@suse.de
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
15
---
12
hw/arm/Kconfig | 1 +
16
hw/arm/Kconfig | 123 ++++++++++++++++++++++++++++++++-----------------
13
1 file changed, 1 insertion(+)
17
1 file changed, 82 insertions(+), 41 deletions(-)
14
18
15
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
19
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
16
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/Kconfig
21
--- a/hw/arm/Kconfig
18
+++ b/hw/arm/Kconfig
22
+++ b/hw/arm/Kconfig
23
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
24
25
config CHEETAH
26
bool
27
- default y if TCG && ARM
28
+ default y
29
+ depends on TCG && ARM
30
select OMAP
31
select TSC210X
32
33
config CUBIEBOARD
34
bool
35
- default y if TCG && ARM
36
+ default y
37
+ depends on TCG && ARM
38
select ALLWINNER_A10
39
40
config DIGIC
41
bool
42
- default y if TCG && ARM
43
+ default y
44
+ depends on TCG && ARM
45
select PTIMER
46
select PFLASH_CFI02
47
48
config EXYNOS4
49
bool
50
- default y if TCG && ARM
51
+ default y
52
+ depends on TCG && ARM
53
imply I2C_DEVICES
54
select A9MPCORE
55
select I2C
56
@@ -XXX,XX +XXX,XX @@ config EXYNOS4
57
58
config HIGHBANK
59
bool
60
- default y if TCG && ARM
61
+ default y
62
+ depends on TCG && ARM
63
select A9MPCORE
64
select A15MPCORE
65
select AHCI
66
@@ -XXX,XX +XXX,XX @@ config HIGHBANK
67
68
config INTEGRATOR
69
bool
70
- default y if TCG && ARM
71
+ default y
72
+ depends on TCG && ARM
73
select ARM_TIMER
74
select INTEGRATOR_DEBUG
75
select PL011 # UART
76
@@ -XXX,XX +XXX,XX @@ config INTEGRATOR
77
78
config MAINSTONE
79
bool
80
- default y if TCG && ARM
81
+ default y
82
+ depends on TCG && ARM
83
select PXA2XX
84
select PFLASH_CFI01
85
select SMC91C111
86
87
config MUSCA
88
bool
89
- default y if TCG && ARM
90
+ default y
91
+ depends on TCG && ARM
92
select ARMSSE
93
select PL011
94
select PL031
95
@@ -XXX,XX +XXX,XX @@ config MARVELL_88W8618
96
97
config MUSICPAL
98
bool
99
- default y if TCG && ARM
100
+ default y
101
+ depends on TCG && ARM
102
select OR_IRQ
103
select BITBANG_I2C
104
select MARVELL_88W8618
105
@@ -XXX,XX +XXX,XX @@ config MUSICPAL
106
107
config NETDUINO2
108
bool
109
- default y if TCG && ARM
110
+ default y
111
+ depends on TCG && ARM
112
select STM32F205_SOC
113
114
config NETDUINOPLUS2
115
bool
116
- default y if TCG && ARM
117
+ default y
118
+ depends on TCG && ARM
119
select STM32F405_SOC
120
121
config OLIMEX_STM32_H405
122
bool
123
- default y if TCG && ARM
124
+ default y
125
+ depends on TCG && ARM
126
select STM32F405_SOC
127
128
config NSERIES
129
bool
130
- default y if TCG && ARM
131
+ default y
132
+ depends on TCG && ARM
133
select OMAP
134
select TMP105 # temperature sensor
135
select BLIZZARD # LCD/TV controller
136
@@ -XXX,XX +XXX,XX @@ config PXA2XX
137
138
config GUMSTIX
139
bool
140
- default y if TCG && ARM
141
+ default y
142
+ depends on TCG && ARM
143
select PFLASH_CFI01
144
select SMC91C111
145
select PXA2XX
146
147
config TOSA
148
bool
149
- default y if TCG && ARM
150
+ default y
151
+ depends on TCG && ARM
152
select ZAURUS # scoop
153
select MICRODRIVE
154
select PXA2XX
155
@@ -XXX,XX +XXX,XX @@ config TOSA
156
157
config SPITZ
158
bool
159
- default y if TCG && ARM
160
+ default y
161
+ depends on TCG && ARM
162
select ADS7846 # touch-screen controller
163
select MAX111X # A/D converter
164
select WM8750 # audio codec
165
@@ -XXX,XX +XXX,XX @@ config SPITZ
166
167
config Z2
168
bool
169
- default y if TCG && ARM
170
+ default y
171
+ depends on TCG && ARM
172
select PFLASH_CFI01
173
select WM8750
174
select PL011 # UART
175
@@ -XXX,XX +XXX,XX @@ config Z2
176
177
config REALVIEW
178
bool
179
- default y if TCG && ARM
180
+ default y
181
+ depends on TCG && ARM
182
imply PCI_DEVICES
183
imply PCI_TESTDEV
184
imply I2C_DEVICES
185
@@ -XXX,XX +XXX,XX @@ config REALVIEW
186
187
config SBSA_REF
188
bool
189
- default y if TCG && AARCH64
190
+ default y
191
+ depends on TCG && AARCH64
192
imply PCI_DEVICES
193
select AHCI
194
select ARM_SMMUV3
195
@@ -XXX,XX +XXX,XX @@ config SBSA_REF
196
197
config SABRELITE
198
bool
199
- default y if TCG && ARM
200
+ default y
201
+ depends on TCG && ARM
202
select FSL_IMX6
203
select SSI_M25P80
204
205
config STELLARIS
206
bool
207
- default y if TCG && ARM
208
+ default y
209
+ depends on TCG && ARM
210
imply I2C_DEVICES
211
select ARM_V7M
212
select CMSDK_APB_WATCHDOG
213
@@ -XXX,XX +XXX,XX @@ config STELLARIS
214
215
config STM32VLDISCOVERY
216
bool
217
- default y if TCG && ARM
218
+ default y
219
+ depends on TCG && ARM
220
select STM32F100_SOC
221
222
config STRONGARM
223
@@ -XXX,XX +XXX,XX @@ config STRONGARM
224
225
config COLLIE
226
bool
227
- default y if TCG && ARM
228
+ default y
229
+ depends on TCG && ARM
230
select PFLASH_CFI01
231
select ZAURUS # scoop
232
select STRONGARM
233
234
config SX1
235
bool
236
- default y if TCG && ARM
237
+ default y
238
+ depends on TCG && ARM
239
select OMAP
240
241
config VERSATILE
242
bool
243
- default y if TCG && ARM
244
+ default y
245
+ depends on TCG && ARM
246
select ARM_TIMER # sp804
247
select PFLASH_CFI01
248
select LSI_SCSI_PCI
249
@@ -XXX,XX +XXX,XX @@ config VERSATILE
250
251
config VEXPRESS
252
bool
253
- default y if TCG && ARM
254
+ default y
255
+ depends on TCG && ARM
256
select A9MPCORE
257
select A15MPCORE
258
select ARM_MPTIMER
259
@@ -XXX,XX +XXX,XX @@ config VEXPRESS
260
261
config ZYNQ
262
bool
263
- default y if TCG && ARM
264
+ default y
265
+ depends on TCG && ARM
266
select A9MPCORE
267
select CADENCE # UART
268
select PFLASH_CFI02
19
@@ -XXX,XX +XXX,XX @@ config ZYNQ
269
@@ -XXX,XX +XXX,XX @@ config ZYNQ
20
21
config ARM_V7M
270
config ARM_V7M
22
bool
271
bool
23
+ select PTIMER
272
# currently v7M must be included in a TCG build due to translate.c
273
- default y if TCG && ARM
274
+ default y
275
+ depends on TCG && ARM
276
select PTIMER
24
277
25
config ALLWINNER_A10
278
config ALLWINNER_A10
26
bool
279
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_A10
280
281
config ALLWINNER_H3
282
bool
283
- default y if TCG && ARM
284
+ default y
285
+ depends on TCG && ARM
286
select ALLWINNER_A10_PIT
287
select ALLWINNER_SUN8I_EMAC
288
select ALLWINNER_I2C
289
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_H3
290
291
config RASPI
292
bool
293
- default y if TCG && ARM
294
+ default y
295
+ depends on TCG && ARM
296
select FRAMEBUFFER
297
select PL011 # UART
298
select SDHCI
299
@@ -XXX,XX +XXX,XX @@ config STM32F405_SOC
300
301
config XLNX_ZYNQMP_ARM
302
bool
303
- default y if TCG && AARCH64
304
+ default y
305
+ depends on TCG && AARCH64
306
select AHCI
307
select ARM_GIC
308
select CADENCE
309
@@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM
310
311
config XLNX_VERSAL
312
bool
313
- default y if TCG && AARCH64
314
+ default y
315
+ depends on TCG && AARCH64
316
select ARM_GIC
317
select PL011
318
select CADENCE
319
@@ -XXX,XX +XXX,XX @@ config XLNX_VERSAL
320
321
config NPCM7XX
322
bool
323
- default y if TCG && ARM
324
+ default y
325
+ depends on TCG && ARM
326
select A9MPCORE
327
select ADM1272
328
select ARM_GIC
329
@@ -XXX,XX +XXX,XX @@ config NPCM7XX
330
331
config FSL_IMX25
332
bool
333
- default y if TCG && ARM
334
+ default y
335
+ depends on TCG && ARM
336
imply I2C_DEVICES
337
select IMX
338
select IMX_FEC
339
@@ -XXX,XX +XXX,XX @@ config FSL_IMX25
340
341
config FSL_IMX31
342
bool
343
- default y if TCG && ARM
344
+ default y
345
+ depends on TCG && ARM
346
imply I2C_DEVICES
347
select SERIAL
348
select IMX
349
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6
350
351
config ASPEED_SOC
352
bool
353
- default y if TCG && ARM
354
+ default y
355
+ depends on TCG && ARM
356
select DS1338
357
select FTGMAC100
358
select I2C
359
@@ -XXX,XX +XXX,XX @@ config ASPEED_SOC
360
361
config MPS2
362
bool
363
- default y if TCG && ARM
364
+ default y
365
+ depends on TCG && ARM
366
imply I2C_DEVICES
367
select ARMSSE
368
select LAN9118
369
@@ -XXX,XX +XXX,XX @@ config MPS2
370
371
config FSL_IMX7
372
bool
373
- default y if TCG && ARM
374
+ default y
375
+ depends on TCG && ARM
376
imply PCI_DEVICES
377
imply TEST_DEVICES
378
imply I2C_DEVICES
379
@@ -XXX,XX +XXX,XX @@ config ARM_SMMUV3
380
381
config FSL_IMX6UL
382
bool
383
- default y if TCG && ARM
384
+ default y
385
+ depends on TCG && ARM
386
imply I2C_DEVICES
387
select A15MPCORE
388
select IMX
389
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6UL
390
391
config MICROBIT
392
bool
393
- default y if TCG && ARM
394
+ default y
395
+ depends on TCG && ARM
396
select NRF51_SOC
397
398
config NRF51_SOC
399
@@ -XXX,XX +XXX,XX @@ config NRF51_SOC
400
401
config EMCRAFT_SF2
402
bool
403
- default y if TCG && ARM
404
+ default y
405
+ depends on TCG && ARM
406
select MSF2
407
select SSI_M25P80
408
27
--
409
--
28
2.20.1
410
2.34.1
29
411
30
412
diff view generated by jsdifflib
1
From: AlexChen <alex.chen@huawei.com>
1
From: Enze Li <lienze@kylinos.cn>
2
2
3
We should use printf format specifier "%u" instead of "%d" for
3
I noticed that in the latest version, the copyright string is still
4
argument of type "unsigned int".
4
2022, even though 2023 is halfway through. This patch fixes that and
5
fixes the documentation along with it.
5
6
6
Reported-by: Euler Robot <euler.robot@huawei.com>
7
Signed-off-by: Enze Li <lienze@kylinos.cn>
7
Signed-off-by: Alex Chen <alex.chen@huawei.com>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-id: 20230525064345.1152801-1-lienze@kylinos.cn
9
Message-id: 5FA280F5.8060902@huawei.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
11
---
12
hw/ssi/imx_spi.c | 2 +-
12
docs/conf.py | 2 +-
13
hw/ssi/xilinx_spi.c | 2 +-
13
include/qemu/help-texts.h | 2 +-
14
2 files changed, 2 insertions(+), 2 deletions(-)
14
2 files changed, 2 insertions(+), 2 deletions(-)
15
15
16
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
16
diff --git a/docs/conf.py b/docs/conf.py
17
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/ssi/imx_spi.c
18
--- a/docs/conf.py
19
+++ b/hw/ssi/imx_spi.c
19
+++ b/docs/conf.py
20
@@ -XXX,XX +XXX,XX @@ static const char *imx_spi_reg_name(uint32_t reg)
20
@@ -XXX,XX +XXX,XX @@
21
case ECSPI_MSGDATA:
21
22
return "ECSPI_MSGDATA";
22
# General information about the project.
23
default:
23
project = u'QEMU'
24
- sprintf(unknown, "%d ?", reg);
24
-copyright = u'2022, The QEMU Project Developers'
25
+ sprintf(unknown, "%u ?", reg);
25
+copyright = u'2023, The QEMU Project Developers'
26
return unknown;
26
author = u'The QEMU Project Developers'
27
}
27
28
}
28
# The version info for the project you're documenting, acts as replacement for
29
diff --git a/hw/ssi/xilinx_spi.c b/hw/ssi/xilinx_spi.c
29
diff --git a/include/qemu/help-texts.h b/include/qemu/help-texts.h
30
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
31
--- a/hw/ssi/xilinx_spi.c
31
--- a/include/qemu/help-texts.h
32
+++ b/hw/ssi/xilinx_spi.c
32
+++ b/include/qemu/help-texts.h
33
@@ -XXX,XX +XXX,XX @@ static void xlx_spi_update_irq(XilinxSPI *s)
33
@@ -XXX,XX +XXX,XX @@
34
irq chain unless things really changed. */
34
#define QEMU_HELP_TEXTS_H
35
if (pending != s->irqline) {
35
36
s->irqline = pending;
36
/* Copyright string for -version arguments, About dialogs, etc */
37
- DB_PRINT("irq_change of state %d ISR:%x IER:%X\n",
37
-#define QEMU_COPYRIGHT "Copyright (c) 2003-2022 " \
38
+ DB_PRINT("irq_change of state %u ISR:%x IER:%X\n",
38
+#define QEMU_COPYRIGHT "Copyright (c) 2003-2023 " \
39
pending, s->regs[R_IPISR], s->regs[R_IPIER]);
39
"Fabrice Bellard and the QEMU Project developers"
40
qemu_set_irq(s->irq, pending);
40
41
}
41
/* Bug reporting information for --help arguments, About dialogs, etc */
42
--
42
--
43
2.20.1
43
2.34.1
44
45
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
2
2
3
omap2420_mpu_init() introduced in commit 827df9f3c5f ("Add basic
3
Let add GIC information into DeviceTree as part of SBSA-REF versioning.
4
OMAP2 chip support") takes care of creating the 3 UARTs.
5
4
6
Then commit 58a26b477e9 ("Emulate a serial bluetooth HCI with H4+
5
Trusted Firmware will read it and provide to next firmware level.
7
extensions and attach to n8x0's UART") added n8x0_uart_setup()
8
which create the UART and connects it to an IRQ output,
9
overwritting the existing peripheral and its IRQ connection.
10
This is incorrect.
11
6
12
Fortunately we don't need to fix this, because commit 6da68df7f9b
7
Bumps platform version to 0.1 one so we can check is node is present.
13
("hw/arm/nseries: Replace the bluetooth chardev with a "null"
14
chardev") removed the use of this peripheral. We can simply
15
remove the code.
16
8
17
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
18
Message-id: 20201107193403.436146-4-f4bug@amsat.org
19
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
---
12
---
22
hw/arm/nseries.c | 11 -----------
13
hw/arm/sbsa-ref.c | 19 ++++++++++++++++++-
23
1 file changed, 11 deletions(-)
14
1 file changed, 18 insertions(+), 1 deletion(-)
24
15
25
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
16
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
26
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
27
--- a/hw/arm/nseries.c
18
--- a/hw/arm/sbsa-ref.c
28
+++ b/hw/arm/nseries.c
19
+++ b/hw/arm/sbsa-ref.c
29
@@ -XXX,XX +XXX,XX @@ static void n8x0_cbus_setup(struct n800_s *s)
20
@@ -XXX,XX +XXX,XX @@
30
cbus_attach(cbus, s->tahvo = tahvo_init(tahvo_irq, 1));
21
#include "exec/hwaddr.h"
22
#include "kvm_arm.h"
23
#include "hw/arm/boot.h"
24
+#include "hw/arm/fdt.h"
25
#include "hw/arm/smmuv3.h"
26
#include "hw/block/flash.h"
27
#include "hw/boards.h"
28
@@ -XXX,XX +XXX,XX @@ static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx)
29
return arm_cpu_mp_affinity(idx, clustersz);
31
}
30
}
32
31
33
-static void n8x0_uart_setup(struct n800_s *s)
32
+static void sbsa_fdt_add_gic_node(SBSAMachineState *sms)
34
-{
33
+{
35
- Chardev *radio = qemu_chr_new("bt-dummy-uart", "null", NULL);
34
+ char *nodename;
36
- /*
35
+
37
- * Note: We used to connect N8X0_BT_RESET_GPIO and N8X0_BT_WKUP_GPIO
36
+ nodename = g_strdup_printf("/intc");
38
- * here, but this code has been removed with the bluetooth backend.
37
+ qemu_fdt_add_subnode(sms->fdt, nodename);
39
- */
38
+ qemu_fdt_setprop_sized_cells(sms->fdt, nodename, "reg",
40
- omap_uart_attach(s->mpu->uart[BT_UART], radio);
39
+ 2, sbsa_ref_memmap[SBSA_GIC_DIST].base,
41
-}
40
+ 2, sbsa_ref_memmap[SBSA_GIC_DIST].size,
42
-
41
+ 2, sbsa_ref_memmap[SBSA_GIC_REDIST].base,
43
static void n8x0_usb_setup(struct n800_s *s)
42
+ 2, sbsa_ref_memmap[SBSA_GIC_REDIST].size);
44
{
43
+
45
SysBusDevice *dev;
44
+ g_free(nodename);
46
@@ -XXX,XX +XXX,XX @@ static void n8x0_init(MachineState *machine,
45
+}
47
n8x0_spi_setup(s);
46
/*
48
n8x0_dss_setup(s);
47
* Firmware on this machine only uses ACPI table to load OS, these limited
49
n8x0_cbus_setup(s);
48
* device tree nodes are just to let firmware know the info which varies from
50
- n8x0_uart_setup(s);
49
@@ -XXX,XX +XXX,XX @@ static void create_fdt(SBSAMachineState *sms)
51
if (machine_usb(machine)) {
50
* fw compatibility.
52
n8x0_usb_setup(s);
51
*/
52
qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0);
53
- qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 0);
54
+ qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 1);
55
56
if (ms->numa_state->have_numa_distance) {
57
int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t);
58
@@ -XXX,XX +XXX,XX @@ static void create_fdt(SBSAMachineState *sms)
59
60
g_free(nodename);
53
}
61
}
62
+
63
+ sbsa_fdt_add_gic_node(sms);
64
}
65
66
#define SBSA_FLASH_SECTOR_SIZE (256 * KiB)
54
--
67
--
55
2.20.1
68
2.34.1
56
57
diff view generated by jsdifflib
1
From: Havard Skinnemoen <hskinnemoen@google.com>
1
From: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
2
2
3
The number of runs is equal to the number of 0-1 and 1-0 transitions,
3
We moved from VGA to Bochs to have PCIe card.
4
plus one. Currently, it's counting the number of times these transitions
5
do _not_ happen, plus one.
6
4
7
Source:
5
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
8
https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-22r1a.pdf
9
section 2.3.4 point (3).
10
11
Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
12
Message-id: 20201103011457.2959989-2-hskinnemoen@google.com
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
8
---
16
tests/qtest/npcm7xx_rng-test.c | 2 +-
9
docs/system/arm/sbsa.rst | 2 +-
17
1 file changed, 1 insertion(+), 1 deletion(-)
10
1 file changed, 1 insertion(+), 1 deletion(-)
18
11
19
diff --git a/tests/qtest/npcm7xx_rng-test.c b/tests/qtest/npcm7xx_rng-test.c
12
diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst
20
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
21
--- a/tests/qtest/npcm7xx_rng-test.c
14
--- a/docs/system/arm/sbsa.rst
22
+++ b/tests/qtest/npcm7xx_rng-test.c
15
+++ b/docs/system/arm/sbsa.rst
23
@@ -XXX,XX +XXX,XX @@ static double calc_runs_p(const unsigned long *buf, unsigned int nr_bits)
16
@@ -XXX,XX +XXX,XX @@ The sbsa-ref board supports:
24
pi = (double)nr_ones / nr_bits;
17
- System bus EHCI controller
25
18
- CDROM and hard disc on AHCI bus
26
for (k = 0; k < nr_bits - 1; k++) {
19
- E1000E ethernet card on PCIe bus
27
- vn_obs += !(test_bit(k, buf) ^ test_bit(k + 1, buf));
20
- - VGA display adaptor on PCIe bus
28
+ vn_obs += (test_bit(k, buf) ^ test_bit(k + 1, buf));
21
+ - Bochs display adapter on PCIe bus
29
}
22
- A generic SBSA watchdog device
30
vn_obs += 1;
31
23
32
--
24
--
33
2.20.1
25
2.34.1
34
35
diff view generated by jsdifflib