1
From: Alistair Francis <alistair.francis@wdc.com>
1
The following changes since commit 8f6330a807f2642dc2a3cdf33347aa28a4c00a87:
2
2
3
The following changes since commit c5fbdd60cf1fb52f01bdfe342b6fa65d5343e1b1:
3
Merge tag 'pull-maintainer-updates-060324-1' of https://gitlab.com/stsquad/qemu into staging (2024-03-06 16:56:20 +0000)
4
5
Merge tag 'qemu-sparc-20211121' of git://github.com/mcayland/qemu into staging (2021-11-21 14:12:25 +0100)
6
4
7
are available in the Git repository at:
5
are available in the Git repository at:
8
6
9
git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20211122
7
https://github.com/alistair23/qemu.git tags/pull-riscv-to-apply-20240308-1
10
8
11
for you to fetch changes up to 526e7443027c71fe7b04c29df529e1f9f425f9e3:
9
for you to fetch changes up to 301876597112218c1e465ecc2b2fef6b27d5c27b:
12
10
13
hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset (2021-11-22 10:46:22 +1000)
11
target/riscv: fix ACPI MCFG table (2024-03-08 21:00:37 +1000)
14
12
15
----------------------------------------------------------------
13
----------------------------------------------------------------
16
Seventh RISC-V PR for QEMU 6.2
14
RISC-V PR for 9.0
17
15
18
- Deprecate IF_NONE for SiFive OTP
16
* Update $ra with current $pc in trans_cm_jalt
19
- Don't reset SiFive OTP content
17
* Enable SPCR for SCPI virt machine
18
* Allow large kernels to boot by moving the initrd further away in RAM
19
* Sync hwprobe keys with kernel
20
* Named features riscv,isa, 'svade' rework
21
* FIX xATP_MODE validation
22
* Add missing include guard in pmu.h
23
* Add SRAT and SLIT ACPI tables
24
* libqos fixes and add a riscv machine
25
* Add Ztso extension
26
* Use 'zfa' instead of 'Zfa'
27
* Update KVM exts to Linux 6.8
28
* move ratified/frozen exts to non-experimental
29
* Ensure mcountinhibit, mcounteren, scounteren, hcounteren are 32-bit
30
* mark_vs_dirty() before loads and stores
31
* Remove 'is_store' bool from load/store fns
32
* Fix shift count overflow
33
* Fix setipnum_le write emulation for APLIC MSI-mode
34
* Fix in_clrip[x] read emulation
35
* Fix privilege mode of G-stage translation for debugging
36
* Fix ACPI MCFG table for virt machine
20
37
21
----------------------------------------------------------------
38
----------------------------------------------------------------
22
Philippe Mathieu-Daudé (1):
39
Alexandre Ghiti (1):
23
hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset
40
hw: riscv: Allow large kernels to boot by moving the initrd further away in RAM
24
41
25
Thomas Huth (1):
42
Andrew Jones (3):
26
hw/misc/sifive_u_otp: Use IF_PFLASH for the OTP device instead of IF_NONE
43
target/riscv: Reset henvcfg to zero
44
target/riscv: Gate hardware A/D PTE bit updating
45
target/riscv: Promote svade to a normal extension
27
46
28
docs/about/deprecated.rst | 6 ++++++
47
Anup Patel (2):
29
hw/misc/sifive_u_otp.c | 22 +++++++++++++---------
48
hw/intc/riscv_aplic: Fix setipnum_le write emulation for APLIC MSI-mode
30
2 files changed, 19 insertions(+), 9 deletions(-)
49
hw/intc/riscv_aplic: Fix in_clrip[x] read emulation
31
50
51
Christoph Müllner (4):
52
linux-user/riscv: Add Zicboz extensions to hwprobe
53
linux-user/riscv: Sync hwprobe keys with Linux
54
linux-user/riscv: Add Ztso extension to hwprobe
55
tests: riscv64: Use 'zfa' instead of 'Zfa'
56
57
Daniel Henrique Barboza (12):
58
target/riscv/tcg: set 'mmu' with 'satp' in cpu_set_profile()
59
target/riscv: add riscv,isa to named features
60
target/riscv: add remaining named features
61
hw/riscv/virt.c: create '/soc/pci@...' fdt node earlier
62
hw/riscv/virt.c: add virtio-iommu-pci hotplug support
63
hw/riscv/virt.c: make aclint compatible with 'qtest' accel
64
tests/libqos: add riscv/virt machine nodes
65
linux-headers: Update to Linux v6.8-rc6
66
target/riscv/kvm: update KVM exts to Linux 6.8
67
target/riscv: move ratified/frozen exts to non-experimental
68
trans_rvv.c.inc: mark_vs_dirty() before loads and stores
69
trans_rvv.c.inc: remove 'is_store' bool from load/store fns
70
71
Frank Chang (1):
72
target/riscv: Add missing include guard in pmu.h
73
74
Haibo Xu (1):
75
hw/riscv/virt-acpi-build.c: Add SRAT and SLIT ACPI tables
76
77
Hiroaki Yamamoto (1):
78
target/riscv: Fix privilege mode of G-stage translation for debugging
79
80
Ilya Chugin (1):
81
target/riscv: fix ACPI MCFG table
82
83
Irina Ryapolova (2):
84
target/riscv: FIX xATP_MODE validation
85
target/riscv: UPDATE xATP write CSR
86
87
Jason Chien (1):
88
target/riscv: Update $ra with current $pc in trans_cm_jalt()
89
90
Palmer Dabbelt (1):
91
RISC-V: Add support for Ztso
92
93
Sia Jee Heng (2):
94
hw/arm/virt-acpi-build.c: Migrate SPCR creation to common location
95
hw/riscv/virt-acpi-build.c: Generate SPCR table
96
97
Vadim Shakirov (1):
98
target/riscv: mcountinhibit, mcounteren, scounteren, hcounteren is 32-bit
99
100
demin.han (1):
101
target/riscv: Fix shift count overflow
102
103
include/hw/acpi/acpi-defs.h | 33 ++++++
104
include/hw/acpi/aml-build.h | 4 +
105
include/standard-headers/drm/drm_fourcc.h | 10 +-
106
include/standard-headers/linux/ethtool.h | 41 +++++---
107
include/standard-headers/linux/virtio_config.h | 8 +-
108
include/standard-headers/linux/virtio_pci.h | 68 ++++++++++++
109
include/standard-headers/linux/virtio_pmem.h | 7 ++
110
linux-headers/asm-generic/unistd.h | 15 ++-
111
linux-headers/asm-mips/mman.h | 2 +-
112
linux-headers/asm-mips/unistd_n32.h | 5 +
113
linux-headers/asm-mips/unistd_n64.h | 5 +
114
linux-headers/asm-mips/unistd_o32.h | 5 +
115
linux-headers/asm-powerpc/unistd_32.h | 5 +
116
linux-headers/asm-powerpc/unistd_64.h | 5 +
117
linux-headers/asm-riscv/kvm.h | 40 +++++++
118
linux-headers/asm-s390/unistd_32.h | 5 +
119
linux-headers/asm-s390/unistd_64.h | 5 +
120
linux-headers/asm-x86/kvm.h | 3 +
121
linux-headers/asm-x86/unistd_32.h | 5 +
122
linux-headers/asm-x86/unistd_64.h | 5 +
123
linux-headers/asm-x86/unistd_x32.h | 5 +
124
linux-headers/linux/iommufd.h | 79 ++++++++++++++
125
linux-headers/linux/kvm.h | 140 +++++++++----------------
126
linux-headers/linux/userfaultfd.h | 29 ++++-
127
linux-headers/linux/vfio.h | 1 +
128
target/riscv/cpu.h | 8 +-
129
target/riscv/cpu_cfg.h | 13 ++-
130
target/riscv/pmu.h | 5 +
131
hw/acpi/aml-build.c | 53 ++++++++++
132
hw/arm/virt-acpi-build.c | 68 +++++-------
133
hw/intc/riscv_aplic.c | 37 +++++--
134
hw/riscv/boot.c | 12 +--
135
hw/riscv/virt-acpi-build.c | 103 +++++++++++++++++-
136
hw/riscv/virt.c | 97 ++++++++++++-----
137
linux-user/syscall.c | 104 ++++++++++++++++--
138
target/riscv/cpu.c | 94 +++++++++++------
139
target/riscv/cpu_helper.c | 21 +++-
140
target/riscv/csr.c | 58 +++++-----
141
target/riscv/kvm/kvm-cpu.c | 29 +++++
142
target/riscv/machine.c | 16 +--
143
target/riscv/tcg/tcg-cpu.c | 34 +++---
144
target/riscv/translate.c | 3 +
145
target/riscv/vector_helper.c | 5 +-
146
tests/qtest/libqos/riscv-virt-machine.c | 137 ++++++++++++++++++++++++
147
target/riscv/insn_trans/trans_rva.c.inc | 11 +-
148
target/riscv/insn_trans/trans_rvi.c.inc | 16 ++-
149
target/riscv/insn_trans/trans_rvv.c.inc | 97 +++++++++--------
150
target/riscv/insn_trans/trans_rvzce.c.inc | 6 +-
151
tests/qtest/libqos/meson.build | 1 +
152
tests/tcg/riscv64/Makefile.target | 2 +-
153
50 files changed, 1213 insertions(+), 347 deletions(-)
154
create mode 100644 tests/qtest/libqos/riscv-virt-machine.c
155
diff view generated by jsdifflib
New patch
1
From: Jason Chien <jason.chien@sifive.com>
1
2
3
The original implementation sets $pc to the address read from the jump
4
vector table first and links $ra with the address of the next instruction
5
after the updated $pc. After jumping to the updated $pc and executing the
6
next ret instruction, the program jumps to $ra, which is in the same
7
function currently executing, which results in an infinite loop.
8
This commit stores the jump address in a temporary, updates $ra with the
9
current $pc, and copies the temporary to $pc.
10
11
Signed-off-by: Jason Chien <jason.chien@sifive.com>
12
Reviewed-by: Frank Chang <frank.chang@sifive.com>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-ID: <20240207081820.28559-1-jason.chien@sifive.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
16
---
17
target/riscv/insn_trans/trans_rvzce.c.inc | 6 +++++-
18
1 file changed, 5 insertions(+), 1 deletion(-)
19
20
diff --git a/target/riscv/insn_trans/trans_rvzce.c.inc b/target/riscv/insn_trans/trans_rvzce.c.inc
21
index XXXXXXX..XXXXXXX 100644
22
--- a/target/riscv/insn_trans/trans_rvzce.c.inc
23
+++ b/target/riscv/insn_trans/trans_rvzce.c.inc
24
@@ -XXX,XX +XXX,XX @@ static bool trans_cm_jalt(DisasContext *ctx, arg_cm_jalt *a)
25
{
26
REQUIRE_ZCMT(ctx);
27
28
+ TCGv addr = tcg_temp_new();
29
+
30
/*
31
* Update pc to current for the non-unwinding exception
32
* that might come from cpu_ld*_code() in the helper.
33
*/
34
gen_update_pc(ctx, 0);
35
- gen_helper_cm_jalt(cpu_pc, tcg_env, tcg_constant_i32(a->index));
36
+ gen_helper_cm_jalt(addr, tcg_env, tcg_constant_i32(a->index));
37
38
/* c.jt vs c.jalt depends on the index. */
39
if (a->index >= 32) {
40
@@ -XXX,XX +XXX,XX @@ static bool trans_cm_jalt(DisasContext *ctx, arg_cm_jalt *a)
41
gen_set_gpr(ctx, xRA, succ_pc);
42
}
43
44
+ tcg_gen_mov_tl(cpu_pc, addr);
45
+
46
tcg_gen_lookup_and_goto_ptr();
47
ctx->base.is_jmp = DISAS_NORETURN;
48
return true;
49
--
50
2.44.0
diff view generated by jsdifflib
New patch
1
From: Sia Jee Heng <jeeheng.sia@starfivetech.com>
1
2
3
RISC-V should also generate the SPCR in a manner similar to ARM.
4
Therefore, instead of replicating the code, relocate this function
5
to the common AML build.
6
7
Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-ID: <20240129021440.17640-2-jeeheng.sia@starfivetech.com>
10
[ Changes by AF:
11
- Add missing Language SPCR entry
12
]
13
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
14
---
15
include/hw/acpi/acpi-defs.h | 33 ++++++++++++++++++
16
include/hw/acpi/aml-build.h | 4 +++
17
hw/acpi/aml-build.c | 53 +++++++++++++++++++++++++++++
18
hw/arm/virt-acpi-build.c | 68 +++++++++++++++----------------------
19
4 files changed, 117 insertions(+), 41 deletions(-)
20
21
diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
22
index XXXXXXX..XXXXXXX 100644
23
--- a/include/hw/acpi/acpi-defs.h
24
+++ b/include/hw/acpi/acpi-defs.h
25
@@ -XXX,XX +XXX,XX @@ typedef struct AcpiFadtData {
26
unsigned *xdsdt_tbl_offset;
27
} AcpiFadtData;
28
29
+typedef struct AcpiGas {
30
+ uint8_t id; /* Address space ID */
31
+ uint8_t width; /* Register bit width */
32
+ uint8_t offset; /* Register bit offset */
33
+ uint8_t size; /* Access size */
34
+ uint64_t addr; /* Address */
35
+} AcpiGas;
36
+
37
+/* SPCR (Serial Port Console Redirection table) */
38
+typedef struct AcpiSpcrData {
39
+ uint8_t interface_type;
40
+ uint8_t reserved[3];
41
+ struct AcpiGas base_addr;
42
+ uint8_t interrupt_type;
43
+ uint8_t pc_interrupt;
44
+ uint32_t interrupt; /* Global system interrupt */
45
+ uint8_t baud_rate;
46
+ uint8_t parity;
47
+ uint8_t stop_bits;
48
+ uint8_t flow_control;
49
+ uint8_t terminal_type;
50
+ uint8_t language;
51
+ uint8_t reserved1;
52
+ uint16_t pci_device_id; /* Must be 0xffff if not PCI device */
53
+ uint16_t pci_vendor_id; /* Must be 0xffff if not PCI device */
54
+ uint8_t pci_bus;
55
+ uint8_t pci_device;
56
+ uint8_t pci_function;
57
+ uint32_t pci_flags;
58
+ uint8_t pci_segment;
59
+ uint32_t reserved2;
60
+} AcpiSpcrData;
61
+
62
#define ACPI_FADT_ARM_PSCI_COMPLIANT (1 << 0)
63
#define ACPI_FADT_ARM_PSCI_USE_HVC (1 << 1)
64
65
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
66
index XXXXXXX..XXXXXXX 100644
67
--- a/include/hw/acpi/aml-build.h
68
+++ b/include/hw/acpi/aml-build.h
69
@@ -XXX,XX +XXX,XX @@ void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
70
71
void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog,
72
const char *oem_id, const char *oem_table_id);
73
+
74
+void build_spcr(GArray *table_data, BIOSLinker *linker,
75
+ const AcpiSpcrData *f, const uint8_t rev,
76
+ const char *oem_id, const char *oem_table_id);
77
#endif
78
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
79
index XXXXXXX..XXXXXXX 100644
80
--- a/hw/acpi/aml-build.c
81
+++ b/hw/acpi/aml-build.c
82
@@ -XXX,XX +XXX,XX @@ static void build_processor_hierarchy_node(GArray *tbl, uint32_t flags,
83
}
84
}
85
86
+void build_spcr(GArray *table_data, BIOSLinker *linker,
87
+ const AcpiSpcrData *f, const uint8_t rev,
88
+ const char *oem_id, const char *oem_table_id)
89
+{
90
+ AcpiTable table = { .sig = "SPCR", .rev = rev, .oem_id = oem_id,
91
+ .oem_table_id = oem_table_id };
92
+
93
+ acpi_table_begin(&table, table_data);
94
+ /* Interface type */
95
+ build_append_int_noprefix(table_data, f->interface_type, 1);
96
+ /* Reserved */
97
+ build_append_int_noprefix(table_data, 0, 3);
98
+ /* Base Address */
99
+ build_append_gas(table_data, f->base_addr.id, f->base_addr.width,
100
+ f->base_addr.offset, f->base_addr.size,
101
+ f->base_addr.addr);
102
+ /* Interrupt type */
103
+ build_append_int_noprefix(table_data, f->interrupt_type, 1);
104
+ /* IRQ */
105
+ build_append_int_noprefix(table_data, f->pc_interrupt, 1);
106
+ /* Global System Interrupt */
107
+ build_append_int_noprefix(table_data, f->interrupt, 4);
108
+ /* Baud Rate */
109
+ build_append_int_noprefix(table_data, f->baud_rate, 1);
110
+ /* Parity */
111
+ build_append_int_noprefix(table_data, f->parity, 1);
112
+ /* Stop Bits */
113
+ build_append_int_noprefix(table_data, f->stop_bits, 1);
114
+ /* Flow Control */
115
+ build_append_int_noprefix(table_data, f->flow_control, 1);
116
+ /* Language */
117
+ build_append_int_noprefix(table_data, f->language, 1);
118
+ /* Terminal Type */
119
+ build_append_int_noprefix(table_data, f->terminal_type, 1);
120
+ /* PCI Device ID */
121
+ build_append_int_noprefix(table_data, f->pci_device_id, 2);
122
+ /* PCI Vendor ID */
123
+ build_append_int_noprefix(table_data, f->pci_vendor_id, 2);
124
+ /* PCI Bus Number */
125
+ build_append_int_noprefix(table_data, f->pci_bus, 1);
126
+ /* PCI Device Number */
127
+ build_append_int_noprefix(table_data, f->pci_device, 1);
128
+ /* PCI Function Number */
129
+ build_append_int_noprefix(table_data, f->pci_function, 1);
130
+ /* PCI Flags */
131
+ build_append_int_noprefix(table_data, f->pci_flags, 4);
132
+ /* PCI Segment */
133
+ build_append_int_noprefix(table_data, f->pci_segment, 1);
134
+ /* Reserved */
135
+ build_append_int_noprefix(table_data, 0, 4);
136
+
137
+ acpi_table_end(linker, &table);
138
+}
139
/*
140
* ACPI spec, Revision 6.3
141
* 5.2.29 Processor Properties Topology Table (PPTT)
142
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
143
index XXXXXXX..XXXXXXX 100644
144
--- a/hw/arm/virt-acpi-build.c
145
+++ b/hw/arm/virt-acpi-build.c
146
@@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
147
* Rev: 1.07
148
*/
149
static void
150
-build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
151
+spcr_setup(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
152
{
153
- AcpiTable table = { .sig = "SPCR", .rev = 2, .oem_id = vms->oem_id,
154
- .oem_table_id = vms->oem_table_id };
155
-
156
- acpi_table_begin(&table, table_data);
157
-
158
- /* Interface Type */
159
- build_append_int_noprefix(table_data, 3, 1); /* ARM PL011 UART */
160
- build_append_int_noprefix(table_data, 0, 3); /* Reserved */
161
- /* Base Address */
162
- build_append_gas(table_data, AML_AS_SYSTEM_MEMORY, 32, 0, 3,
163
- vms->memmap[VIRT_UART].base);
164
- /* Interrupt Type */
165
- build_append_int_noprefix(table_data,
166
- (1 << 3) /* Bit[3] ARMH GIC interrupt */, 1);
167
- build_append_int_noprefix(table_data, 0, 1); /* IRQ */
168
- /* Global System Interrupt */
169
- build_append_int_noprefix(table_data,
170
- vms->irqmap[VIRT_UART] + ARM_SPI_BASE, 4);
171
- build_append_int_noprefix(table_data, 3 /* 9600 */, 1); /* Baud Rate */
172
- build_append_int_noprefix(table_data, 0 /* No Parity */, 1); /* Parity */
173
- /* Stop Bits */
174
- build_append_int_noprefix(table_data, 1 /* 1 Stop bit */, 1);
175
- /* Flow Control */
176
- build_append_int_noprefix(table_data,
177
- (1 << 1) /* RTS/CTS hardware flow control */, 1);
178
- /* Terminal Type */
179
- build_append_int_noprefix(table_data, 0 /* VT100 */, 1);
180
- build_append_int_noprefix(table_data, 0, 1); /* Language */
181
- /* PCI Device ID */
182
- build_append_int_noprefix(table_data, 0xffff /* not a PCI device*/, 2);
183
- /* PCI Vendor ID */
184
- build_append_int_noprefix(table_data, 0xffff /* not a PCI device*/, 2);
185
- build_append_int_noprefix(table_data, 0, 1); /* PCI Bus Number */
186
- build_append_int_noprefix(table_data, 0, 1); /* PCI Device Number */
187
- build_append_int_noprefix(table_data, 0, 1); /* PCI Function Number */
188
- build_append_int_noprefix(table_data, 0, 4); /* PCI Flags */
189
- build_append_int_noprefix(table_data, 0, 1); /* PCI Segment */
190
- build_append_int_noprefix(table_data, 0, 4); /* Reserved */
191
+ AcpiSpcrData serial = {
192
+ .interface_type = 3, /* ARM PL011 UART */
193
+ .base_addr.id = AML_AS_SYSTEM_MEMORY,
194
+ .base_addr.width = 32,
195
+ .base_addr.offset = 0,
196
+ .base_addr.size = 3,
197
+ .base_addr.addr = vms->memmap[VIRT_UART].base,
198
+ .interrupt_type = (1 << 3),/* Bit[3] ARMH GIC interrupt*/
199
+ .pc_interrupt = 0, /* IRQ */
200
+ .interrupt = (vms->irqmap[VIRT_UART] + ARM_SPI_BASE),
201
+ .baud_rate = 3, /* 9600 */
202
+ .parity = 0, /* No Parity */
203
+ .stop_bits = 1, /* 1 Stop bit */
204
+ .flow_control = 1 << 1, /* RTS/CTS hardware flow control */
205
+ .terminal_type = 0, /* VT100 */
206
+ .language = 0, /* Language */
207
+ .pci_device_id = 0xffff, /* not a PCI device*/
208
+ .pci_vendor_id = 0xffff, /* not a PCI device*/
209
+ .pci_bus = 0,
210
+ .pci_device = 0,
211
+ .pci_function = 0,
212
+ .pci_flags = 0,
213
+ .pci_segment = 0,
214
+ };
215
216
- acpi_table_end(linker, &table);
217
+ build_spcr(table_data, linker, &serial, 2, vms->oem_id, vms->oem_table_id);
218
}
219
220
/*
221
@@ -XXX,XX +XXX,XX @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
222
}
223
224
acpi_add_table(table_offsets, tables_blob);
225
- build_spcr(tables_blob, tables->linker, vms);
226
+ spcr_setup(tables_blob, tables->linker, vms);
227
228
acpi_add_table(table_offsets, tables_blob);
229
build_dbg2(tables_blob, tables->linker, vms);
230
--
231
2.44.0
diff view generated by jsdifflib
New patch
1
From: Sia Jee Heng <jeeheng.sia@starfivetech.com>
1
2
3
Generate Serial Port Console Redirection Table (SPCR) for RISC-V
4
virtual machine.
5
6
Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
7
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
8
Message-ID: <20240129021440.17640-3-jeeheng.sia@starfivetech.com>
9
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
10
---
11
hw/riscv/virt-acpi-build.c | 39 ++++++++++++++++++++++++++++++++++++++
12
1 file changed, 39 insertions(+)
13
14
diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/riscv/virt-acpi-build.c
17
+++ b/hw/riscv/virt-acpi-build.c
18
@@ -XXX,XX +XXX,XX @@ acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
19
aml_append(scope, dev);
20
}
21
22
+/*
23
+ * Serial Port Console Redirection Table (SPCR)
24
+ * Rev: 1.07
25
+ */
26
+
27
+static void
28
+spcr_setup(GArray *table_data, BIOSLinker *linker, RISCVVirtState *s)
29
+{
30
+ AcpiSpcrData serial = {
31
+ .interface_type = 0, /* 16550 compatible */
32
+ .base_addr.id = AML_AS_SYSTEM_MEMORY,
33
+ .base_addr.width = 32,
34
+ .base_addr.offset = 0,
35
+ .base_addr.size = 1,
36
+ .base_addr.addr = s->memmap[VIRT_UART0].base,
37
+ .interrupt_type = (1 << 4),/* Bit[4] RISC-V PLIC/APLIC */
38
+ .pc_interrupt = 0,
39
+ .interrupt = UART0_IRQ,
40
+ .baud_rate = 7, /* 15200 */
41
+ .parity = 0,
42
+ .stop_bits = 1,
43
+ .flow_control = 0,
44
+ .terminal_type = 3, /* ANSI */
45
+ .language = 0, /* Language */
46
+ .pci_device_id = 0xffff, /* not a PCI device*/
47
+ .pci_vendor_id = 0xffff, /* not a PCI device*/
48
+ .pci_bus = 0,
49
+ .pci_device = 0,
50
+ .pci_function = 0,
51
+ .pci_flags = 0,
52
+ .pci_segment = 0,
53
+ };
54
+
55
+ build_spcr(table_data, linker, &serial, 2, s->oem_id, s->oem_table_id);
56
+}
57
+
58
/* RHCT Node[N] starts at offset 56 */
59
#define RHCT_NODE_ARRAY_OFFSET 56
60
61
@@ -XXX,XX +XXX,XX @@ static void virt_acpi_build(RISCVVirtState *s, AcpiBuildTables *tables)
62
acpi_add_table(table_offsets, tables_blob);
63
build_rhct(tables_blob, tables->linker, s);
64
65
+ acpi_add_table(table_offsets, tables_blob);
66
+ spcr_setup(tables_blob, tables->linker, s);
67
+
68
acpi_add_table(table_offsets, tables_blob);
69
{
70
AcpiMcfgInfo mcfg = {
71
--
72
2.44.0
diff view generated by jsdifflib
New patch
1
From: Alexandre Ghiti <alexghiti@rivosinc.com>
1
2
3
Currently, the initrd is placed at 128MB, which overlaps with the kernel
4
when it is large (for example syzbot kernels are). From the kernel side,
5
there is no reason we could not push the initrd further away in memory
6
to accommodate large kernels, so move the initrd at 512MB when possible.
7
8
The ideal solution would have been to place the initrd based on the
9
kernel size but we actually can't since the bss size is not known when
10
the image is loaded by load_image_targphys_as() and the initrd would
11
then overlap with this section.
12
13
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
14
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
15
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
16
Message-ID: <20240206154042.514698-1-alexghiti@rivosinc.com>
17
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
18
---
19
hw/riscv/boot.c | 12 ++++++------
20
1 file changed, 6 insertions(+), 6 deletions(-)
21
22
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/riscv/boot.c
25
+++ b/hw/riscv/boot.c
26
@@ -XXX,XX +XXX,XX @@ static void riscv_load_initrd(MachineState *machine, uint64_t kernel_entry)
27
* kernel is uncompressed it will not clobber the initrd. However
28
* on boards without much RAM we must ensure that we still leave
29
* enough room for a decent sized initrd, and on boards with large
30
- * amounts of RAM we must avoid the initrd being so far up in RAM
31
- * that it is outside lowmem and inaccessible to the kernel.
32
- * So for boards with less than 256MB of RAM we put the initrd
33
- * halfway into RAM, and for boards with 256MB of RAM or more we put
34
- * the initrd at 128MB.
35
+ * amounts of RAM, we put the initrd at 512MB to allow large kernels
36
+ * to boot.
37
+ * So for boards with less than 1GB of RAM we put the initrd
38
+ * halfway into RAM, and for boards with 1GB of RAM or more we put
39
+ * the initrd at 512MB.
40
*/
41
- start = kernel_entry + MIN(mem_size / 2, 128 * MiB);
42
+ start = kernel_entry + MIN(mem_size / 2, 512 * MiB);
43
44
size = load_ramdisk(filename, start, mem_size - start);
45
if (size == -1) {
46
--
47
2.44.0
diff view generated by jsdifflib
New patch
1
From: Christoph Müllner <christoph.muellner@vrull.eu>
1
2
3
Upstream Linux recently added RISC-V Zicboz support to the hwprobe API.
4
This patch introduces this for QEMU's user space emulator.
5
6
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
7
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
8
Message-ID: <20240207115926.887816-2-christoph.muellner@vrull.eu>
9
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
10
---
11
linux-user/syscall.c | 3 +++
12
1 file changed, 3 insertions(+)
13
14
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/linux-user/syscall.c
17
+++ b/linux-user/syscall.c
18
@@ -XXX,XX +XXX,XX @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
19
#define RISCV_HWPROBE_EXT_ZBA (1 << 3)
20
#define RISCV_HWPROBE_EXT_ZBB (1 << 4)
21
#define RISCV_HWPROBE_EXT_ZBS (1 << 5)
22
+#define RISCV_HWPROBE_EXT_ZICBOZ (1 << 6)
23
24
#define RISCV_HWPROBE_KEY_CPUPERF_0 5
25
#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0)
26
@@ -XXX,XX +XXX,XX @@ static void risc_hwprobe_fill_pairs(CPURISCVState *env,
27
RISCV_HWPROBE_EXT_ZBB : 0;
28
value |= cfg->ext_zbs ?
29
RISCV_HWPROBE_EXT_ZBS : 0;
30
+ value |= cfg->ext_zicboz ?
31
+ RISCV_HWPROBE_EXT_ZICBOZ : 0;
32
__put_user(value, &pair->value);
33
break;
34
case RISCV_HWPROBE_KEY_CPUPERF_0:
35
--
36
2.44.0
37
38
diff view generated by jsdifflib
New patch
1
From: Christoph Müllner <christoph.muellner@vrull.eu>
1
2
3
Upstream Linux recently added many additional keys to the hwprobe API.
4
This patch adds support for all of them with the exception of Ztso,
5
which is currently not supported in QEMU.
6
7
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
8
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
9
Message-ID: <20240207115926.887816-3-christoph.muellner@vrull.eu>
10
[ Changes by AF:
11
- Fixup whitespace
12
]
13
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
14
---
15
linux-user/syscall.c | 100 +++++++++++++++++++++++++++++++++++++++----
16
1 file changed, 92 insertions(+), 8 deletions(-)
17
18
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/linux-user/syscall.c
21
+++ b/linux-user/syscall.c
22
@@ -XXX,XX +XXX,XX @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
23
#define RISCV_HWPROBE_KEY_BASE_BEHAVIOR 3
24
#define RISCV_HWPROBE_BASE_BEHAVIOR_IMA (1 << 0)
25
26
-#define RISCV_HWPROBE_KEY_IMA_EXT_0 4
27
-#define RISCV_HWPROBE_IMA_FD (1 << 0)
28
-#define RISCV_HWPROBE_IMA_C (1 << 1)
29
-#define RISCV_HWPROBE_IMA_V (1 << 2)
30
-#define RISCV_HWPROBE_EXT_ZBA (1 << 3)
31
-#define RISCV_HWPROBE_EXT_ZBB (1 << 4)
32
-#define RISCV_HWPROBE_EXT_ZBS (1 << 5)
33
-#define RISCV_HWPROBE_EXT_ZICBOZ (1 << 6)
34
+#define RISCV_HWPROBE_KEY_IMA_EXT_0 4
35
+#define RISCV_HWPROBE_IMA_FD (1 << 0)
36
+#define RISCV_HWPROBE_IMA_C (1 << 1)
37
+#define RISCV_HWPROBE_IMA_V (1 << 2)
38
+#define RISCV_HWPROBE_EXT_ZBA (1 << 3)
39
+#define RISCV_HWPROBE_EXT_ZBB (1 << 4)
40
+#define RISCV_HWPROBE_EXT_ZBS (1 << 5)
41
+#define RISCV_HWPROBE_EXT_ZICBOZ (1 << 6)
42
+#define RISCV_HWPROBE_EXT_ZBC (1 << 7)
43
+#define RISCV_HWPROBE_EXT_ZBKB (1 << 8)
44
+#define RISCV_HWPROBE_EXT_ZBKC (1 << 9)
45
+#define RISCV_HWPROBE_EXT_ZBKX (1 << 10)
46
+#define RISCV_HWPROBE_EXT_ZKND (1 << 11)
47
+#define RISCV_HWPROBE_EXT_ZKNE (1 << 12)
48
+#define RISCV_HWPROBE_EXT_ZKNH (1 << 13)
49
+#define RISCV_HWPROBE_EXT_ZKSED (1 << 14)
50
+#define RISCV_HWPROBE_EXT_ZKSH (1 << 15)
51
+#define RISCV_HWPROBE_EXT_ZKT (1 << 16)
52
+#define RISCV_HWPROBE_EXT_ZVBB (1 << 17)
53
+#define RISCV_HWPROBE_EXT_ZVBC (1 << 18)
54
+#define RISCV_HWPROBE_EXT_ZVKB (1 << 19)
55
+#define RISCV_HWPROBE_EXT_ZVKG (1 << 20)
56
+#define RISCV_HWPROBE_EXT_ZVKNED (1 << 21)
57
+#define RISCV_HWPROBE_EXT_ZVKNHA (1 << 22)
58
+#define RISCV_HWPROBE_EXT_ZVKNHB (1 << 23)
59
+#define RISCV_HWPROBE_EXT_ZVKSED (1 << 24)
60
+#define RISCV_HWPROBE_EXT_ZVKSH (1 << 25)
61
+#define RISCV_HWPROBE_EXT_ZVKT (1 << 26)
62
+#define RISCV_HWPROBE_EXT_ZFH (1 << 27)
63
+#define RISCV_HWPROBE_EXT_ZFHMIN (1 << 28)
64
+#define RISCV_HWPROBE_EXT_ZIHINTNTL (1 << 29)
65
+#define RISCV_HWPROBE_EXT_ZVFH (1 << 30)
66
+#define RISCV_HWPROBE_EXT_ZVFHMIN (1 << 31)
67
+#define RISCV_HWPROBE_EXT_ZFA (1ULL << 32)
68
+#define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34)
69
+#define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35)
70
71
#define RISCV_HWPROBE_KEY_CPUPERF_0 5
72
#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0)
73
@@ -XXX,XX +XXX,XX @@ static void risc_hwprobe_fill_pairs(CPURISCVState *env,
74
RISCV_HWPROBE_EXT_ZBS : 0;
75
value |= cfg->ext_zicboz ?
76
RISCV_HWPROBE_EXT_ZICBOZ : 0;
77
+ value |= cfg->ext_zbc ?
78
+ RISCV_HWPROBE_EXT_ZBC : 0;
79
+ value |= cfg->ext_zbkb ?
80
+ RISCV_HWPROBE_EXT_ZBKB : 0;
81
+ value |= cfg->ext_zbkc ?
82
+ RISCV_HWPROBE_EXT_ZBKC : 0;
83
+ value |= cfg->ext_zbkx ?
84
+ RISCV_HWPROBE_EXT_ZBKX : 0;
85
+ value |= cfg->ext_zknd ?
86
+ RISCV_HWPROBE_EXT_ZKND : 0;
87
+ value |= cfg->ext_zkne ?
88
+ RISCV_HWPROBE_EXT_ZKNE : 0;
89
+ value |= cfg->ext_zknh ?
90
+ RISCV_HWPROBE_EXT_ZKNH : 0;
91
+ value |= cfg->ext_zksed ?
92
+ RISCV_HWPROBE_EXT_ZKSED : 0;
93
+ value |= cfg->ext_zksh ?
94
+ RISCV_HWPROBE_EXT_ZKSH : 0;
95
+ value |= cfg->ext_zkt ?
96
+ RISCV_HWPROBE_EXT_ZKT : 0;
97
+ value |= cfg->ext_zvbb ?
98
+ RISCV_HWPROBE_EXT_ZVBB : 0;
99
+ value |= cfg->ext_zvbc ?
100
+ RISCV_HWPROBE_EXT_ZVBC : 0;
101
+ value |= cfg->ext_zvkb ?
102
+ RISCV_HWPROBE_EXT_ZVKB : 0;
103
+ value |= cfg->ext_zvkg ?
104
+ RISCV_HWPROBE_EXT_ZVKG : 0;
105
+ value |= cfg->ext_zvkned ?
106
+ RISCV_HWPROBE_EXT_ZVKNED : 0;
107
+ value |= cfg->ext_zvknha ?
108
+ RISCV_HWPROBE_EXT_ZVKNHA : 0;
109
+ value |= cfg->ext_zvknhb ?
110
+ RISCV_HWPROBE_EXT_ZVKNHB : 0;
111
+ value |= cfg->ext_zvksed ?
112
+ RISCV_HWPROBE_EXT_ZVKSED : 0;
113
+ value |= cfg->ext_zvksh ?
114
+ RISCV_HWPROBE_EXT_ZVKSH : 0;
115
+ value |= cfg->ext_zvkt ?
116
+ RISCV_HWPROBE_EXT_ZVKT : 0;
117
+ value |= cfg->ext_zfh ?
118
+ RISCV_HWPROBE_EXT_ZFH : 0;
119
+ value |= cfg->ext_zfhmin ?
120
+ RISCV_HWPROBE_EXT_ZFHMIN : 0;
121
+ value |= cfg->ext_zihintntl ?
122
+ RISCV_HWPROBE_EXT_ZIHINTNTL : 0;
123
+ value |= cfg->ext_zvfh ?
124
+ RISCV_HWPROBE_EXT_ZVFH : 0;
125
+ value |= cfg->ext_zvfhmin ?
126
+ RISCV_HWPROBE_EXT_ZVFHMIN : 0;
127
+ value |= cfg->ext_zfa ?
128
+ RISCV_HWPROBE_EXT_ZFA : 0;
129
+ value |= cfg->ext_zacas ?
130
+ RISCV_HWPROBE_EXT_ZACAS : 0;
131
+ value |= cfg->ext_zicond ?
132
+ RISCV_HWPROBE_EXT_ZICOND : 0;
133
__put_user(value, &pair->value);
134
break;
135
case RISCV_HWPROBE_KEY_CPUPERF_0:
136
--
137
2.44.0
138
139
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
Recent changes in options handling removed the 'mmu' default the bare
4
CPUs had, meaning that we must enable 'mmu' by hand when using the
5
rva22s64 profile CPU.
6
7
Given that this profile is setting a satp mode, it already implies that
8
we need a 'mmu'. Enable the 'mmu' in this case.
9
10
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
11
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
12
Message-ID: <20240215223955.969568-2-dbarboza@ventanamicro.com>
13
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
14
---
15
target/riscv/tcg/tcg-cpu.c | 1 +
16
1 file changed, 1 insertion(+)
17
18
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/riscv/tcg/tcg-cpu.c
21
+++ b/target/riscv/tcg/tcg-cpu.c
22
@@ -XXX,XX +XXX,XX @@ static void cpu_set_profile(Object *obj, Visitor *v, const char *name,
23
24
#ifndef CONFIG_USER_ONLY
25
if (profile->satp_mode != RISCV_PROFILE_ATTR_UNUSED) {
26
+ object_property_set_bool(obj, "mmu", true, NULL);
27
const char *satp_prop = satp_mode_str(profile->satp_mode,
28
riscv_cpu_is_32bit(cpu));
29
object_property_set_bool(obj, satp_prop, profile->enabled, NULL);
30
--
31
2.44.0
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
Further discussions after the introduction of rva22 support in QEMU
4
revealed that what we've been calling 'named features' are actually
5
regular extensions, with their respective riscv,isa DTs. This is
6
clarified in [1]. [2] is a bug tracker asking for the profile spec to be
7
less cryptic about it.
8
9
As far as QEMU goes we understand extensions as something that the user
10
can enable/disable in the command line. This isn't the case for named
11
features, so we'll have to reach a middle ground.
12
13
We'll keep our existing nomenclature 'named features' to refer to any
14
extension that the user can't control in the command line. We'll also do
15
the following:
16
17
- 'svade' and 'zic64b' flags are renamed to 'ext_svade' and
18
'ext_zic64b'. 'ext_svade' and 'ext_zic64b' now have riscv,isa strings and
19
priv_spec versions;
20
21
- skip name feature check in cpu_bump_multi_ext_priv_ver(). Now that
22
named features have a riscv,isa and an entry in isa_edata_arr[] we
23
don't need to gate the call to cpu_cfg_ext_get_min_version() anymore.
24
25
[1] https://github.com/riscv/riscv-profiles/issues/121
26
[2] https://github.com/riscv/riscv-profiles/issues/142
27
28
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
29
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
30
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
31
Message-ID: <20240215223955.969568-3-dbarboza@ventanamicro.com>
32
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
33
---
34
target/riscv/cpu_cfg.h | 6 ++++--
35
target/riscv/cpu.c | 17 +++++++++++++----
36
target/riscv/tcg/tcg-cpu.c | 16 ++++++----------
37
3 files changed, 23 insertions(+), 16 deletions(-)
38
39
diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h
40
index XXXXXXX..XXXXXXX 100644
41
--- a/target/riscv/cpu_cfg.h
42
+++ b/target/riscv/cpu_cfg.h
43
@@ -XXX,XX +XXX,XX @@ struct RISCVCPUConfig {
44
bool ext_smepmp;
45
bool rvv_ta_all_1s;
46
bool rvv_ma_all_1s;
47
- bool svade;
48
- bool zic64b;
49
50
uint32_t mvendorid;
51
uint64_t marchid;
52
uint64_t mimpid;
53
54
+ /* Named features */
55
+ bool ext_svade;
56
+ bool ext_zic64b;
57
+
58
/* Vendor-specific custom extensions */
59
bool ext_xtheadba;
60
bool ext_xtheadbb;
61
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
62
index XXXXXXX..XXXXXXX 100644
63
--- a/target/riscv/cpu.c
64
+++ b/target/riscv/cpu.c
65
@@ -XXX,XX +XXX,XX @@ bool riscv_cpu_option_set(const char *optname)
66
* instead.
67
*/
68
const RISCVIsaExtData isa_edata_arr[] = {
69
+ ISA_EXT_DATA_ENTRY(zic64b, PRIV_VERSION_1_12_0, ext_zic64b),
70
ISA_EXT_DATA_ENTRY(zicbom, PRIV_VERSION_1_12_0, ext_zicbom),
71
ISA_EXT_DATA_ENTRY(zicbop, PRIV_VERSION_1_12_0, ext_zicbop),
72
ISA_EXT_DATA_ENTRY(zicboz, PRIV_VERSION_1_12_0, ext_zicboz),
73
@@ -XXX,XX +XXX,XX @@ const RISCVIsaExtData isa_edata_arr[] = {
74
ISA_EXT_DATA_ENTRY(ssaia, PRIV_VERSION_1_12_0, ext_ssaia),
75
ISA_EXT_DATA_ENTRY(sscofpmf, PRIV_VERSION_1_12_0, ext_sscofpmf),
76
ISA_EXT_DATA_ENTRY(sstc, PRIV_VERSION_1_12_0, ext_sstc),
77
+ ISA_EXT_DATA_ENTRY(svade, PRIV_VERSION_1_11_0, ext_svade),
78
ISA_EXT_DATA_ENTRY(svadu, PRIV_VERSION_1_12_0, ext_svadu),
79
ISA_EXT_DATA_ENTRY(svinval, PRIV_VERSION_1_12_0, ext_svinval),
80
ISA_EXT_DATA_ENTRY(svnapot, PRIV_VERSION_1_12_0, ext_svnapot),
81
@@ -XXX,XX +XXX,XX @@ const RISCVCPUMultiExtConfig riscv_cpu_experimental_exts[] = {
82
DEFINE_PROP_END_OF_LIST(),
83
};
84
85
+/*
86
+ * 'Named features' is the name we give to extensions that we
87
+ * don't want to expose to users. They are either immutable
88
+ * (always enabled/disable) or they'll vary depending on
89
+ * the resulting CPU state. They have riscv,isa strings
90
+ * and priv_ver like regular extensions.
91
+ */
92
const RISCVCPUMultiExtConfig riscv_cpu_named_features[] = {
93
- MULTI_EXT_CFG_BOOL("svade", svade, true),
94
- MULTI_EXT_CFG_BOOL("zic64b", zic64b, true),
95
+ MULTI_EXT_CFG_BOOL("svade", ext_svade, true),
96
+ MULTI_EXT_CFG_BOOL("zic64b", ext_zic64b, true),
97
98
DEFINE_PROP_END_OF_LIST(),
99
};
100
@@ -XXX,XX +XXX,XX @@ static RISCVCPUProfile RVA22U64 = {
101
CPU_CFG_OFFSET(ext_zicbop), CPU_CFG_OFFSET(ext_zicboz),
102
103
/* mandatory named features for this profile */
104
- CPU_CFG_OFFSET(zic64b),
105
+ CPU_CFG_OFFSET(ext_zic64b),
106
107
RISCV_PROFILE_EXT_LIST_END
108
}
109
@@ -XXX,XX +XXX,XX @@ static RISCVCPUProfile RVA22S64 = {
110
CPU_CFG_OFFSET(ext_svinval),
111
112
/* rva22s64 named features */
113
- CPU_CFG_OFFSET(svade),
114
+ CPU_CFG_OFFSET(ext_svade),
115
116
RISCV_PROFILE_EXT_LIST_END
117
}
118
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
119
index XXXXXXX..XXXXXXX 100644
120
--- a/target/riscv/tcg/tcg-cpu.c
121
+++ b/target/riscv/tcg/tcg-cpu.c
122
@@ -XXX,XX +XXX,XX @@ static bool cpu_cfg_offset_is_named_feat(uint32_t ext_offset)
123
static void riscv_cpu_enable_named_feat(RISCVCPU *cpu, uint32_t feat_offset)
124
{
125
switch (feat_offset) {
126
- case CPU_CFG_OFFSET(zic64b):
127
+ case CPU_CFG_OFFSET(ext_zic64b):
128
cpu->cfg.cbom_blocksize = 64;
129
cpu->cfg.cbop_blocksize = 64;
130
cpu->cfg.cboz_blocksize = 64;
131
break;
132
- case CPU_CFG_OFFSET(svade):
133
+ case CPU_CFG_OFFSET(ext_svade):
134
cpu->cfg.ext_svadu = false;
135
break;
136
default:
137
@@ -XXX,XX +XXX,XX @@ static void cpu_bump_multi_ext_priv_ver(CPURISCVState *env,
138
return;
139
}
140
141
- if (cpu_cfg_offset_is_named_feat(ext_offset)) {
142
- return;
143
- }
144
-
145
ext_priv_ver = cpu_cfg_ext_get_min_version(ext_offset);
146
147
if (env->priv_ver < ext_priv_ver) {
148
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_disable_priv_spec_isa_exts(RISCVCPU *cpu)
149
150
static void riscv_cpu_update_named_features(RISCVCPU *cpu)
151
{
152
- cpu->cfg.zic64b = cpu->cfg.cbom_blocksize == 64 &&
153
- cpu->cfg.cbop_blocksize == 64 &&
154
- cpu->cfg.cboz_blocksize == 64;
155
+ cpu->cfg.ext_zic64b = cpu->cfg.cbom_blocksize == 64 &&
156
+ cpu->cfg.cbop_blocksize == 64 &&
157
+ cpu->cfg.cboz_blocksize == 64;
158
159
- cpu->cfg.svade = !cpu->cfg.ext_svadu;
160
+ cpu->cfg.ext_svade = !cpu->cfg.ext_svadu;
161
}
162
163
static void riscv_cpu_validate_g(RISCVCPU *cpu)
164
--
165
2.44.0
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
The RVA22U64 and RVA22S64 profiles mandates certain extensions that,
4
until now, we were implying that they were available.
5
6
We can't do this anymore since named features also has a riscv,isa
7
entry. Let's add them to riscv_cpu_named_features[].
8
9
Instead of adding one bool for each named feature that we'll always
10
implement, i.e. can't be turned off, add a 'ext_always_enabled' bool in
11
cpu->cfg. This bool will be set to 'true' in TCG accel init, and all
12
named features will point to it. This also means that KVM won't see
13
these features as always enable, which is our intention.
14
15
If any accelerator adds support to disable one of these features, we'll
16
have to promote them to regular extensions and allow users to disable it
17
via command line.
18
19
After this patch, here's the riscv,isa from a buildroot using the
20
'rva22s64' CPU:
21
22
# cat /proc/device-tree/cpus/cpu@0/riscv,isa
23
rv64imafdc_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_
24
zicntr_zicsr_zifencei_zihintpause_zihpm_za64rs_zfhmin_zca_zcd_zba_zbb_
25
zbs_zkt_ssccptr_sscounterenw_sstvala_sstvecd_svade_svinval_svpbmt#
26
27
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
28
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
29
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
30
Message-ID: <20240215223955.969568-4-dbarboza@ventanamicro.com>
31
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
32
---
33
target/riscv/cpu_cfg.h | 6 ++++++
34
target/riscv/cpu.c | 42 +++++++++++++++++++++++++++++++-------
35
target/riscv/tcg/tcg-cpu.c | 2 ++
36
3 files changed, 43 insertions(+), 7 deletions(-)
37
38
diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h
39
index XXXXXXX..XXXXXXX 100644
40
--- a/target/riscv/cpu_cfg.h
41
+++ b/target/riscv/cpu_cfg.h
42
@@ -XXX,XX +XXX,XX @@ struct RISCVCPUConfig {
43
bool ext_svade;
44
bool ext_zic64b;
45
46
+ /*
47
+ * Always 'true' boolean for named features
48
+ * TCG always implement/can't be disabled.
49
+ */
50
+ bool ext_always_enabled;
51
+
52
/* Vendor-specific custom extensions */
53
bool ext_xtheadba;
54
bool ext_xtheadbb;
55
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
56
index XXXXXXX..XXXXXXX 100644
57
--- a/target/riscv/cpu.c
58
+++ b/target/riscv/cpu.c
59
@@ -XXX,XX +XXX,XX @@ const RISCVIsaExtData isa_edata_arr[] = {
60
ISA_EXT_DATA_ENTRY(zicbom, PRIV_VERSION_1_12_0, ext_zicbom),
61
ISA_EXT_DATA_ENTRY(zicbop, PRIV_VERSION_1_12_0, ext_zicbop),
62
ISA_EXT_DATA_ENTRY(zicboz, PRIV_VERSION_1_12_0, ext_zicboz),
63
+ ISA_EXT_DATA_ENTRY(ziccamoa, PRIV_VERSION_1_11_0, ext_always_enabled),
64
+ ISA_EXT_DATA_ENTRY(ziccif, PRIV_VERSION_1_11_0, ext_always_enabled),
65
+ ISA_EXT_DATA_ENTRY(zicclsm, PRIV_VERSION_1_11_0, ext_always_enabled),
66
+ ISA_EXT_DATA_ENTRY(ziccrse, PRIV_VERSION_1_11_0, ext_always_enabled),
67
ISA_EXT_DATA_ENTRY(zicond, PRIV_VERSION_1_12_0, ext_zicond),
68
ISA_EXT_DATA_ENTRY(zicntr, PRIV_VERSION_1_12_0, ext_zicntr),
69
ISA_EXT_DATA_ENTRY(zicsr, PRIV_VERSION_1_10_0, ext_zicsr),
70
@@ -XXX,XX +XXX,XX @@ const RISCVIsaExtData isa_edata_arr[] = {
71
ISA_EXT_DATA_ENTRY(zihintpause, PRIV_VERSION_1_10_0, ext_zihintpause),
72
ISA_EXT_DATA_ENTRY(zihpm, PRIV_VERSION_1_12_0, ext_zihpm),
73
ISA_EXT_DATA_ENTRY(zmmul, PRIV_VERSION_1_12_0, ext_zmmul),
74
+ ISA_EXT_DATA_ENTRY(za64rs, PRIV_VERSION_1_12_0, ext_always_enabled),
75
ISA_EXT_DATA_ENTRY(zaamo, PRIV_VERSION_1_12_0, ext_zaamo),
76
ISA_EXT_DATA_ENTRY(zacas, PRIV_VERSION_1_12_0, ext_zacas),
77
ISA_EXT_DATA_ENTRY(zalrsc, PRIV_VERSION_1_12_0, ext_zalrsc),
78
@@ -XXX,XX +XXX,XX @@ const RISCVIsaExtData isa_edata_arr[] = {
79
ISA_EXT_DATA_ENTRY(smepmp, PRIV_VERSION_1_12_0, ext_smepmp),
80
ISA_EXT_DATA_ENTRY(smstateen, PRIV_VERSION_1_12_0, ext_smstateen),
81
ISA_EXT_DATA_ENTRY(ssaia, PRIV_VERSION_1_12_0, ext_ssaia),
82
+ ISA_EXT_DATA_ENTRY(ssccptr, PRIV_VERSION_1_11_0, ext_always_enabled),
83
ISA_EXT_DATA_ENTRY(sscofpmf, PRIV_VERSION_1_12_0, ext_sscofpmf),
84
+ ISA_EXT_DATA_ENTRY(sscounterenw, PRIV_VERSION_1_12_0, ext_always_enabled),
85
ISA_EXT_DATA_ENTRY(sstc, PRIV_VERSION_1_12_0, ext_sstc),
86
+ ISA_EXT_DATA_ENTRY(sstvala, PRIV_VERSION_1_12_0, ext_always_enabled),
87
+ ISA_EXT_DATA_ENTRY(sstvecd, PRIV_VERSION_1_12_0, ext_always_enabled),
88
ISA_EXT_DATA_ENTRY(svade, PRIV_VERSION_1_11_0, ext_svade),
89
ISA_EXT_DATA_ENTRY(svadu, PRIV_VERSION_1_12_0, ext_svadu),
90
ISA_EXT_DATA_ENTRY(svinval, PRIV_VERSION_1_12_0, ext_svinval),
91
@@ -XXX,XX +XXX,XX @@ const RISCVCPUMultiExtConfig riscv_cpu_experimental_exts[] = {
92
DEFINE_PROP_END_OF_LIST(),
93
};
94
95
+#define ALWAYS_ENABLED_FEATURE(_name) \
96
+ {.name = _name, \
97
+ .offset = CPU_CFG_OFFSET(ext_always_enabled), \
98
+ .enabled = true}
99
+
100
/*
101
* 'Named features' is the name we give to extensions that we
102
* don't want to expose to users. They are either immutable
103
@@ -XXX,XX +XXX,XX @@ const RISCVCPUMultiExtConfig riscv_cpu_named_features[] = {
104
MULTI_EXT_CFG_BOOL("svade", ext_svade, true),
105
MULTI_EXT_CFG_BOOL("zic64b", ext_zic64b, true),
106
107
+ /*
108
+ * cache-related extensions that are always enabled
109
+ * in TCG since QEMU RISC-V does not have a cache
110
+ * model.
111
+ */
112
+ ALWAYS_ENABLED_FEATURE("za64rs"),
113
+ ALWAYS_ENABLED_FEATURE("ziccif"),
114
+ ALWAYS_ENABLED_FEATURE("ziccrse"),
115
+ ALWAYS_ENABLED_FEATURE("ziccamoa"),
116
+ ALWAYS_ENABLED_FEATURE("zicclsm"),
117
+ ALWAYS_ENABLED_FEATURE("ssccptr"),
118
+
119
+ /* Other named features that TCG always implements */
120
+ ALWAYS_ENABLED_FEATURE("sstvecd"),
121
+ ALWAYS_ENABLED_FEATURE("sstvala"),
122
+ ALWAYS_ENABLED_FEATURE("sscounterenw"),
123
+
124
DEFINE_PROP_END_OF_LIST(),
125
};
126
127
@@ -XXX,XX +XXX,XX @@ static const PropertyInfo prop_marchid = {
128
};
129
130
/*
131
- * RVA22U64 defines some 'named features' or 'synthetic extensions'
132
- * that are cache related: Za64rs, Zic64b, Ziccif, Ziccrse, Ziccamoa
133
- * and Zicclsm. We do not implement caching in QEMU so we'll consider
134
- * all these named features as always enabled.
135
- *
136
- * There's no riscv,isa update for them (nor for zic64b, despite it
137
- * having a cfg offset) at this moment.
138
+ * RVA22U64 defines some 'named features' that are cache
139
+ * related: Za64rs, Zic64b, Ziccif, Ziccrse, Ziccamoa
140
+ * and Zicclsm. They are always implemented in TCG and
141
+ * doesn't need to be manually enabled by the profile.
142
*/
143
static RISCVCPUProfile RVA22U64 = {
144
.parent = NULL,
145
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
146
index XXXXXXX..XXXXXXX 100644
147
--- a/target/riscv/tcg/tcg-cpu.c
148
+++ b/target/riscv/tcg/tcg-cpu.c
149
@@ -XXX,XX +XXX,XX @@ static void riscv_tcg_cpu_instance_init(CPUState *cs)
150
RISCVCPU *cpu = RISCV_CPU(cs);
151
Object *obj = OBJECT(cpu);
152
153
+ cpu->cfg.ext_always_enabled = true;
154
+
155
misa_ext_user_opts = g_hash_table_new(NULL, g_direct_equal);
156
multi_ext_user_opts = g_hash_table_new(NULL, g_direct_equal);
157
riscv_cpu_add_user_properties(obj);
158
--
159
2.44.0
diff view generated by jsdifflib
New patch
1
From: Andrew Jones <ajones@ventanamicro.com>
1
2
3
The hypervisor should decide what it wants to enable. Zero all
4
configuration enable bits on reset.
5
6
Also, commit ed67d63798f2 ("target/riscv: Update CSR bits name for
7
svadu extension") missed one reference to 'hade'. Change it now.
8
9
Fixes: 0af3f115e68e ("target/riscv: Add *envcfg.HADE related check in address translation")
10
Fixes: ed67d63798f2 ("target/riscv: Update CSR bits name for svadu extension")
11
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
12
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
13
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
Message-ID: <20240215223955.969568-5-dbarboza@ventanamicro.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
16
---
17
target/riscv/cpu.c | 3 +--
18
target/riscv/csr.c | 2 +-
19
2 files changed, 2 insertions(+), 3 deletions(-)
20
21
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
22
index XXXXXXX..XXXXXXX 100644
23
--- a/target/riscv/cpu.c
24
+++ b/target/riscv/cpu.c
25
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_reset_hold(Object *obj)
26
27
env->menvcfg = (cpu->cfg.ext_svpbmt ? MENVCFG_PBMTE : 0) |
28
(cpu->cfg.ext_svadu ? MENVCFG_ADUE : 0);
29
- env->henvcfg = (cpu->cfg.ext_svpbmt ? HENVCFG_PBMTE : 0) |
30
- (cpu->cfg.ext_svadu ? HENVCFG_ADUE : 0);
31
+ env->henvcfg = 0;
32
33
/* Initialized default priorities of local interrupts. */
34
for (i = 0; i < ARRAY_SIZE(env->miprio); i++) {
35
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/target/riscv/csr.c
38
+++ b/target/riscv/csr.c
39
@@ -XXX,XX +XXX,XX @@ static RISCVException read_henvcfg(CPURISCVState *env, int csrno,
40
/*
41
* henvcfg.pbmte is read_only 0 when menvcfg.pbmte = 0
42
* henvcfg.stce is read_only 0 when menvcfg.stce = 0
43
- * henvcfg.hade is read_only 0 when menvcfg.hade = 0
44
+ * henvcfg.adue is read_only 0 when menvcfg.adue = 0
45
*/
46
*val = env->henvcfg & (~(HENVCFG_PBMTE | HENVCFG_STCE | HENVCFG_ADUE) |
47
env->menvcfg);
48
--
49
2.44.0
diff view generated by jsdifflib
New patch
1
From: Andrew Jones <ajones@ventanamicro.com>
1
2
3
Gate hardware A/D PTE bit updating on {m,h}envcfg.ADUE and only
4
enable menvcfg.ADUE on reset if svade has not been selected. Now
5
that we also consider svade, we have four possible configurations:
6
7
1) !svade && !svadu
8
use hardware updating and there's no way to disable it
9
(the default, which maintains past behavior. Maintaining
10
the default, even with !svadu is a change that fixes [1])
11
12
2) !svade && svadu
13
use hardware updating, but also provide {m,h}envcfg.ADUE,
14
allowing software to switch to exception mode
15
(being able to switch is a change which fixes [1])
16
17
3) svade && !svadu
18
use exception mode and there's no way to switch to hardware
19
updating
20
(this behavior change fixes [2])
21
22
4) svade && svadu
23
use exception mode, but also provide {m,h}envcfg.ADUE,
24
allowing software to switch to hardware updating
25
(this behavior change fixes [2])
26
27
Fixes: 0af3f115e68e ("target/riscv: Add *envcfg.HADE related check in address translation") [1]
28
Fixes: 48531f5adb2a ("target/riscv: implement svade") [2]
29
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
30
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
31
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
32
Message-ID: <20240215223955.969568-6-dbarboza@ventanamicro.com>
33
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
34
---
35
target/riscv/cpu.c | 3 ++-
36
target/riscv/cpu_helper.c | 19 +++++++++++++++----
37
target/riscv/tcg/tcg-cpu.c | 15 +++++----------
38
3 files changed, 22 insertions(+), 15 deletions(-)
39
40
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/target/riscv/cpu.c
43
+++ b/target/riscv/cpu.c
44
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_reset_hold(Object *obj)
45
env->two_stage_lookup = false;
46
47
env->menvcfg = (cpu->cfg.ext_svpbmt ? MENVCFG_PBMTE : 0) |
48
- (cpu->cfg.ext_svadu ? MENVCFG_ADUE : 0);
49
+ (!cpu->cfg.ext_svade && cpu->cfg.ext_svadu ?
50
+ MENVCFG_ADUE : 0);
51
env->henvcfg = 0;
52
53
/* Initialized default priorities of local interrupts. */
54
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
55
index XXXXXXX..XXXXXXX 100644
56
--- a/target/riscv/cpu_helper.c
57
+++ b/target/riscv/cpu_helper.c
58
@@ -XXX,XX +XXX,XX @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,
59
}
60
61
bool pbmte = env->menvcfg & MENVCFG_PBMTE;
62
- bool adue = env->menvcfg & MENVCFG_ADUE;
63
+ bool svade = riscv_cpu_cfg(env)->ext_svade;
64
+ bool svadu = riscv_cpu_cfg(env)->ext_svadu;
65
+ bool adue = svadu ? env->menvcfg & MENVCFG_ADUE : !svade;
66
67
if (first_stage && two_stage && env->virt_enabled) {
68
pbmte = pbmte && (env->henvcfg & HENVCFG_PBMTE);
69
@@ -XXX,XX +XXX,XX @@ restart:
70
return TRANSLATE_FAIL;
71
}
72
73
- /* If necessary, set accessed and dirty bits. */
74
- target_ulong updated_pte = pte | PTE_A |
75
- (access_type == MMU_DATA_STORE ? PTE_D : 0);
76
+ target_ulong updated_pte = pte;
77
+
78
+ /*
79
+ * If ADUE is enabled, set accessed and dirty bits.
80
+ * Otherwise raise an exception if necessary.
81
+ */
82
+ if (adue) {
83
+ updated_pte |= PTE_A | (access_type == MMU_DATA_STORE ? PTE_D : 0);
84
+ } else if (!(pte & PTE_A) ||
85
+ (access_type == MMU_DATA_STORE && !(pte & PTE_D))) {
86
+ return TRANSLATE_FAIL;
87
+ }
88
89
/* Page table updates need to be atomic with MTTCG enabled */
90
if (updated_pte != pte && !is_debug) {
91
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
92
index XXXXXXX..XXXXXXX 100644
93
--- a/target/riscv/tcg/tcg-cpu.c
94
+++ b/target/riscv/tcg/tcg-cpu.c
95
@@ -XXX,XX +XXX,XX @@ static bool cpu_cfg_offset_is_named_feat(uint32_t ext_offset)
96
97
static void riscv_cpu_enable_named_feat(RISCVCPU *cpu, uint32_t feat_offset)
98
{
99
- switch (feat_offset) {
100
- case CPU_CFG_OFFSET(ext_zic64b):
101
+ /*
102
+ * All other named features are already enabled
103
+ * in riscv_tcg_cpu_instance_init().
104
+ */
105
+ if (feat_offset == CPU_CFG_OFFSET(ext_zic64b)) {
106
cpu->cfg.cbom_blocksize = 64;
107
cpu->cfg.cbop_blocksize = 64;
108
cpu->cfg.cboz_blocksize = 64;
109
- break;
110
- case CPU_CFG_OFFSET(ext_svade):
111
- cpu->cfg.ext_svadu = false;
112
- break;
113
- default:
114
- g_assert_not_reached();
115
}
116
}
117
118
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_update_named_features(RISCVCPU *cpu)
119
cpu->cfg.ext_zic64b = cpu->cfg.cbom_blocksize == 64 &&
120
cpu->cfg.cbop_blocksize == 64 &&
121
cpu->cfg.cboz_blocksize == 64;
122
-
123
- cpu->cfg.ext_svade = !cpu->cfg.ext_svadu;
124
}
125
126
static void riscv_cpu_validate_g(RISCVCPU *cpu)
127
--
128
2.44.0
diff view generated by jsdifflib
New patch
1
From: Andrew Jones <ajones@ventanamicro.com>
1
2
3
Named features are extensions which don't make sense for users to
4
control and are therefore not exposed on the command line. However,
5
svade is an extension which makes sense for users to control, so treat
6
it like a "normal" extension. The default is false, even for the max
7
cpu type, since QEMU has always implemented hardware A/D PTE bit
8
updating, so users must opt into svade (or get it from a CPU type
9
which enables it by default).
10
11
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
12
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
13
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
Message-ID: <20240215223955.969568-7-dbarboza@ventanamicro.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
16
---
17
target/riscv/cpu.c | 9 ++-------
18
target/riscv/tcg/tcg-cpu.c | 6 ++++++
19
2 files changed, 8 insertions(+), 7 deletions(-)
20
21
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
22
index XXXXXXX..XXXXXXX 100644
23
--- a/target/riscv/cpu.c
24
+++ b/target/riscv/cpu.c
25
@@ -XXX,XX +XXX,XX @@ const RISCVCPUMultiExtConfig riscv_cpu_extensions[] = {
26
27
MULTI_EXT_CFG_BOOL("smepmp", ext_smepmp, false),
28
MULTI_EXT_CFG_BOOL("smstateen", ext_smstateen, false),
29
+ MULTI_EXT_CFG_BOOL("svade", ext_svade, false),
30
MULTI_EXT_CFG_BOOL("svadu", ext_svadu, true),
31
MULTI_EXT_CFG_BOOL("svinval", ext_svinval, false),
32
MULTI_EXT_CFG_BOOL("svnapot", ext_svnapot, false),
33
@@ -XXX,XX +XXX,XX @@ const RISCVCPUMultiExtConfig riscv_cpu_experimental_exts[] = {
34
* and priv_ver like regular extensions.
35
*/
36
const RISCVCPUMultiExtConfig riscv_cpu_named_features[] = {
37
- MULTI_EXT_CFG_BOOL("svade", ext_svade, true),
38
MULTI_EXT_CFG_BOOL("zic64b", ext_zic64b, true),
39
40
/*
41
@@ -XXX,XX +XXX,XX @@ static RISCVCPUProfile RVA22U64 = {
42
* Other named features that we already implement: Sstvecd, Sstvala,
43
* Sscounterenw
44
*
45
- * Named features that we need to enable: svade
46
- *
47
* The remaining features/extensions comes from RVA22U64.
48
*/
49
static RISCVCPUProfile RVA22S64 = {
50
@@ -XXX,XX +XXX,XX @@ static RISCVCPUProfile RVA22S64 = {
51
.ext_offsets = {
52
/* rva22s64 exts */
53
CPU_CFG_OFFSET(ext_zifencei), CPU_CFG_OFFSET(ext_svpbmt),
54
- CPU_CFG_OFFSET(ext_svinval),
55
-
56
- /* rva22s64 named features */
57
- CPU_CFG_OFFSET(ext_svade),
58
+ CPU_CFG_OFFSET(ext_svinval), CPU_CFG_OFFSET(ext_svade),
59
60
RISCV_PROFILE_EXT_LIST_END
61
}
62
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
63
index XXXXXXX..XXXXXXX 100644
64
--- a/target/riscv/tcg/tcg-cpu.c
65
+++ b/target/riscv/tcg/tcg-cpu.c
66
@@ -XXX,XX +XXX,XX @@ static void riscv_init_max_cpu_extensions(Object *obj)
67
isa_ext_update_enabled(cpu, prop->offset, true);
68
}
69
70
+ /*
71
+ * Some extensions can't be added without backward compatibilty concerns.
72
+ * Disable those, the user can still opt in to them on the command line.
73
+ */
74
+ cpu->cfg.ext_svade = false;
75
+
76
/* set vector version */
77
env->vext_ver = VEXT_VERSION_1_00_0;
78
79
--
80
2.44.0
diff view generated by jsdifflib
New patch
1
From: Irina Ryapolova <irina.ryapolova@syntacore.com>
1
2
3
The SATP register is an SXLEN-bit read/write WARL register. It means that CSR fields are only defined
4
for a subset of bit encodings, but allow any value to be written while guaranteeing to return a legal
5
value whenever read (See riscv-privileged-20211203, SATP CSR).
6
7
For example on rv64 we are trying to write to SATP CSR val = 0x1000000000000000 (SATP_MODE = 1 - Reserved for standard use)
8
and after that we are trying to read SATP_CSR. We read from the SATP CSR value = 0x1000000000000000, which is not a correct
9
operation (return illegal value).
10
11
Signed-off-by: Irina Ryapolova <irina.ryapolova@syntacore.com>
12
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
13
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
Message-ID: <20240109145923.37893-1-irina.ryapolova@syntacore.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
16
---
17
target/riscv/csr.c | 4 ++--
18
1 file changed, 2 insertions(+), 2 deletions(-)
19
20
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/target/riscv/csr.c
23
+++ b/target/riscv/csr.c
24
@@ -XXX,XX +XXX,XX @@ static RISCVException read_mstatus(CPURISCVState *env, int csrno,
25
26
static bool validate_vm(CPURISCVState *env, target_ulong vm)
27
{
28
- return (vm & 0xf) <=
29
- satp_mode_max_from_map(riscv_cpu_cfg(env)->satp_mode.map);
30
+ uint64_t mode_supported = riscv_cpu_cfg(env)->satp_mode.map;
31
+ return get_field(mode_supported, (1 << vm));
32
}
33
34
static target_ulong legalize_mpp(CPURISCVState *env, target_ulong old_mpp,
35
--
36
2.44.0
diff view generated by jsdifflib
New patch
1
From: Irina Ryapolova <irina.ryapolova@syntacore.com>
1
2
3
Added xATP_MODE validation for vsatp/hgatp CSRs.
4
The xATP register is an SXLEN-bit read/write WARL register, so
5
the legal value must be returned (See riscv-privileged-20211203, SATP/VSATP/HGATP CSRs).
6
7
Signed-off-by: Irina Ryapolova <irina.ryapolova@syntacore.com>
8
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-ID: <20240109145923.37893-2-irina.ryapolova@syntacore.com>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
---
13
target/riscv/csr.c | 52 ++++++++++++++++++++++++++--------------------
14
1 file changed, 29 insertions(+), 23 deletions(-)
15
16
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/riscv/csr.c
19
+++ b/target/riscv/csr.c
20
@@ -XXX,XX +XXX,XX @@ static bool validate_vm(CPURISCVState *env, target_ulong vm)
21
return get_field(mode_supported, (1 << vm));
22
}
23
24
+static target_ulong legalize_xatp(CPURISCVState *env, target_ulong old_xatp,
25
+ target_ulong val)
26
+{
27
+ target_ulong mask;
28
+ bool vm;
29
+ if (riscv_cpu_mxl(env) == MXL_RV32) {
30
+ vm = validate_vm(env, get_field(val, SATP32_MODE));
31
+ mask = (val ^ old_xatp) & (SATP32_MODE | SATP32_ASID | SATP32_PPN);
32
+ } else {
33
+ vm = validate_vm(env, get_field(val, SATP64_MODE));
34
+ mask = (val ^ old_xatp) & (SATP64_MODE | SATP64_ASID | SATP64_PPN);
35
+ }
36
+
37
+ if (vm && mask) {
38
+ /*
39
+ * The ISA defines SATP.MODE=Bare as "no translation", but we still
40
+ * pass these through QEMU's TLB emulation as it improves
41
+ * performance. Flushing the TLB on SATP writes with paging
42
+ * enabled avoids leaking those invalid cached mappings.
43
+ */
44
+ tlb_flush(env_cpu(env));
45
+ return val;
46
+ }
47
+ return old_xatp;
48
+}
49
+
50
static target_ulong legalize_mpp(CPURISCVState *env, target_ulong old_mpp,
51
target_ulong val)
52
{
53
@@ -XXX,XX +XXX,XX @@ static RISCVException read_satp(CPURISCVState *env, int csrno,
54
static RISCVException write_satp(CPURISCVState *env, int csrno,
55
target_ulong val)
56
{
57
- target_ulong mask;
58
- bool vm;
59
-
60
if (!riscv_cpu_cfg(env)->mmu) {
61
return RISCV_EXCP_NONE;
62
}
63
64
- if (riscv_cpu_mxl(env) == MXL_RV32) {
65
- vm = validate_vm(env, get_field(val, SATP32_MODE));
66
- mask = (val ^ env->satp) & (SATP32_MODE | SATP32_ASID | SATP32_PPN);
67
- } else {
68
- vm = validate_vm(env, get_field(val, SATP64_MODE));
69
- mask = (val ^ env->satp) & (SATP64_MODE | SATP64_ASID | SATP64_PPN);
70
- }
71
-
72
- if (vm && mask) {
73
- /*
74
- * The ISA defines SATP.MODE=Bare as "no translation", but we still
75
- * pass these through QEMU's TLB emulation as it improves
76
- * performance. Flushing the TLB on SATP writes with paging
77
- * enabled avoids leaking those invalid cached mappings.
78
- */
79
- tlb_flush(env_cpu(env));
80
- env->satp = val;
81
- }
82
+ env->satp = legalize_xatp(env, env->satp, val);
83
return RISCV_EXCP_NONE;
84
}
85
86
@@ -XXX,XX +XXX,XX @@ static RISCVException read_hgatp(CPURISCVState *env, int csrno,
87
static RISCVException write_hgatp(CPURISCVState *env, int csrno,
88
target_ulong val)
89
{
90
- env->hgatp = val;
91
+ env->hgatp = legalize_xatp(env, env->hgatp, val);
92
return RISCV_EXCP_NONE;
93
}
94
95
@@ -XXX,XX +XXX,XX @@ static RISCVException read_vsatp(CPURISCVState *env, int csrno,
96
static RISCVException write_vsatp(CPURISCVState *env, int csrno,
97
target_ulong val)
98
{
99
- env->vsatp = val;
100
+ env->vsatp = legalize_xatp(env, env->vsatp, val);
101
return RISCV_EXCP_NONE;
102
}
103
104
--
105
2.44.0
diff view generated by jsdifflib
New patch
1
From: Frank Chang <frank.chang@sifive.com>
1
2
3
Add missing include guard in pmu.h to avoid the problem of double
4
inclusion.
5
6
Signed-off-by: Frank Chang <frank.chang@sifive.com>
7
Reviewed-by: Atish Patra <atishp@rivosinc.com>
8
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-ID: <20240220110907.10479-1-frank.chang@sifive.com>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
---
14
target/riscv/pmu.h | 5 +++++
15
1 file changed, 5 insertions(+)
16
17
diff --git a/target/riscv/pmu.h b/target/riscv/pmu.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/riscv/pmu.h
20
+++ b/target/riscv/pmu.h
21
@@ -XXX,XX +XXX,XX @@
22
* this program. If not, see <http://www.gnu.org/licenses/>.
23
*/
24
25
+#ifndef RISCV_PMU_H
26
+#define RISCV_PMU_H
27
+
28
#include "cpu.h"
29
#include "qapi/error.h"
30
31
@@ -XXX,XX +XXX,XX @@ int riscv_pmu_incr_ctr(RISCVCPU *cpu, enum riscv_pmu_event_idx event_idx);
32
void riscv_pmu_generate_fdt_node(void *fdt, uint32_t cmask, char *pmu_name);
33
int riscv_pmu_setup_timer(CPURISCVState *env, uint64_t value,
34
uint32_t ctr_idx);
35
+
36
+#endif /* RISCV_PMU_H */
37
--
38
2.44.0
39
40
diff view generated by jsdifflib
New patch
1
From: Haibo Xu <haibo1.xu@intel.com>
1
2
3
Enable ACPI NUMA support by adding the following 2 ACPI tables:
4
SRAT: provides the association for memory/Harts and Proximity Domains
5
SLIT: provides the relative distance between Proximity Domains
6
7
The SRAT RINTC Affinity Structure definition[1] was based on the recently
8
approved ACPI CodeFirst ECR[2].
9
10
[1] https://github.com/riscv-non-isa/riscv-acpi/issues/25
11
[2] https://mantis.uefi.org/mantis/view.php?id=2433
12
13
Signed-off-by: Haibo Xu <haibo1.xu@intel.com>
14
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
15
Message-ID: <20240129094200.3581037-1-haibo1.xu@intel.com>
16
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
17
---
18
hw/riscv/virt-acpi-build.c | 60 ++++++++++++++++++++++++++++++++++++++
19
1 file changed, 60 insertions(+)
20
21
diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c
22
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/riscv/virt-acpi-build.c
24
+++ b/hw/riscv/virt-acpi-build.c
25
@@ -XXX,XX +XXX,XX @@ static void build_madt(GArray *table_data,
26
acpi_table_end(linker, &table);
27
}
28
29
+/*
30
+ * ACPI spec, Revision 6.5+
31
+ * 5.2.16 System Resource Affinity Table (SRAT)
32
+ * REF: https://github.com/riscv-non-isa/riscv-acpi/issues/25
33
+ * https://drive.google.com/file/d/1YTdDx2IPm5IeZjAW932EYU-tUtgS08tX/view
34
+ */
35
+static void
36
+build_srat(GArray *table_data, BIOSLinker *linker, RISCVVirtState *vms)
37
+{
38
+ int i;
39
+ uint64_t mem_base;
40
+ MachineClass *mc = MACHINE_GET_CLASS(vms);
41
+ MachineState *ms = MACHINE(vms);
42
+ const CPUArchIdList *cpu_list = mc->possible_cpu_arch_ids(ms);
43
+ AcpiTable table = { .sig = "SRAT", .rev = 3, .oem_id = vms->oem_id,
44
+ .oem_table_id = vms->oem_table_id };
45
+
46
+ acpi_table_begin(&table, table_data);
47
+ build_append_int_noprefix(table_data, 1, 4); /* Reserved */
48
+ build_append_int_noprefix(table_data, 0, 8); /* Reserved */
49
+
50
+ for (i = 0; i < cpu_list->len; ++i) {
51
+ uint32_t nodeid = cpu_list->cpus[i].props.node_id;
52
+ /*
53
+ * 5.2.16.8 RINTC Affinity Structure
54
+ */
55
+ build_append_int_noprefix(table_data, 7, 1); /* Type */
56
+ build_append_int_noprefix(table_data, 20, 1); /* Length */
57
+ build_append_int_noprefix(table_data, 0, 2); /* Reserved */
58
+ build_append_int_noprefix(table_data, nodeid, 4); /* Proximity Domain */
59
+ build_append_int_noprefix(table_data, i, 4); /* ACPI Processor UID */
60
+ /* Flags, Table 5-70 */
61
+ build_append_int_noprefix(table_data, 1 /* Flags: Enabled */, 4);
62
+ build_append_int_noprefix(table_data, 0, 4); /* Clock Domain */
63
+ }
64
+
65
+ mem_base = vms->memmap[VIRT_DRAM].base;
66
+ for (i = 0; i < ms->numa_state->num_nodes; ++i) {
67
+ if (ms->numa_state->nodes[i].node_mem > 0) {
68
+ build_srat_memory(table_data, mem_base,
69
+ ms->numa_state->nodes[i].node_mem, i,
70
+ MEM_AFFINITY_ENABLED);
71
+ mem_base += ms->numa_state->nodes[i].node_mem;
72
+ }
73
+ }
74
+
75
+ acpi_table_end(linker, &table);
76
+}
77
+
78
static void virt_acpi_build(RISCVVirtState *s, AcpiBuildTables *tables)
79
{
80
GArray *table_offsets;
81
unsigned dsdt, xsdt;
82
GArray *tables_blob = tables->table_data;
83
+ MachineState *ms = MACHINE(s);
84
85
table_offsets = g_array_new(false, true,
86
sizeof(uint32_t));
87
@@ -XXX,XX +XXX,XX @@ static void virt_acpi_build(RISCVVirtState *s, AcpiBuildTables *tables)
88
s->oem_table_id);
89
}
90
91
+ if (ms->numa_state->num_nodes > 0) {
92
+ acpi_add_table(table_offsets, tables_blob);
93
+ build_srat(tables_blob, tables->linker, s);
94
+ if (ms->numa_state->have_numa_distance) {
95
+ acpi_add_table(table_offsets, tables_blob);
96
+ build_slit(tables_blob, tables->linker, ms, s->oem_id,
97
+ s->oem_table_id);
98
+ }
99
+ }
100
+
101
/* XSDT is pointed to by RSDP */
102
xsdt = tables_blob->len;
103
build_xsdt(tables_blob, tables->linker, table_offsets, s->oem_id,
104
--
105
2.44.0
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
Hotplugged FDT nodes will attempt to write this node that, at this
4
moment, is being created only in create_fdt_pcie() during
5
finalize_fdt().
6
7
Create it earlier.
8
9
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-ID: <20240217192607.32565-4-dbarboza@ventanamicro.com>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
---
14
hw/riscv/virt.c | 9 ++++++++-
15
1 file changed, 8 insertions(+), 1 deletion(-)
16
17
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/riscv/virt.c
20
+++ b/hw/riscv/virt.c
21
@@ -XXX,XX +XXX,XX @@ static void create_fdt_pcie(RISCVVirtState *s, const MemMapEntry *memmap,
22
23
name = g_strdup_printf("/soc/pci@%lx",
24
(long) memmap[VIRT_PCIE_ECAM].base);
25
- qemu_fdt_add_subnode(ms->fdt, name);
26
qemu_fdt_setprop_cell(ms->fdt, name, "#address-cells",
27
FDT_PCI_ADDR_CELLS);
28
qemu_fdt_setprop_cell(ms->fdt, name, "#interrupt-cells",
29
@@ -XXX,XX +XXX,XX @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap)
30
{
31
MachineState *ms = MACHINE(s);
32
uint8_t rng_seed[32];
33
+ g_autofree char *name = NULL;
34
35
ms->fdt = create_device_tree(&s->fdt_size);
36
if (!ms->fdt) {
37
@@ -XXX,XX +XXX,XX @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap)
38
qemu_fdt_setprop_cell(ms->fdt, "/soc", "#size-cells", 0x2);
39
qemu_fdt_setprop_cell(ms->fdt, "/soc", "#address-cells", 0x2);
40
41
+ /*
42
+ * The "/soc/pci@..." node is needed for PCIE hotplugs
43
+ * that might happen before finalize_fdt().
44
+ */
45
+ name = g_strdup_printf("/soc/pci@%lx", (long) memmap[VIRT_PCIE_ECAM].base);
46
+ qemu_fdt_add_subnode(ms->fdt, name);
47
+
48
qemu_fdt_add_subnode(ms->fdt, "/chosen");
49
50
/* Pass seed to RNG */
51
--
52
2.44.0
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
We want to add a RISC-V 'virt' libqos machine to increase our test
4
coverage. Some of the tests will try to plug a virtio-iommu-pci
5
device into the board and do some tests with it.
6
7
Enable virtio-iommu-pci in the 'virt' machine.
8
9
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
10
Acked-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-ID: <20240217192607.32565-5-dbarboza@ventanamicro.com>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
---
14
hw/riscv/virt.c | 36 +++++++++++++++++++++++++++++++++++-
15
1 file changed, 35 insertions(+), 1 deletion(-)
16
17
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/riscv/virt.c
20
+++ b/hw/riscv/virt.c
21
@@ -XXX,XX +XXX,XX @@
22
#include "hw/display/ramfb.h"
23
#include "hw/acpi/aml-build.h"
24
#include "qapi/qapi-visit-common.h"
25
+#include "hw/virtio/virtio-iommu.h"
26
27
/* KVM AIA only supports APLIC MSI. APLIC Wired is always emulated by QEMU. */
28
static bool virt_use_kvm_aia(RISCVVirtState *s)
29
@@ -XXX,XX +XXX,XX @@ static void create_fdt_fw_cfg(RISCVVirtState *s, const MemMapEntry *memmap)
30
qemu_fdt_setprop(ms->fdt, nodename, "dma-coherent", NULL, 0);
31
}
32
33
+static void create_fdt_virtio_iommu(RISCVVirtState *s, uint16_t bdf)
34
+{
35
+ const char compat[] = "virtio,pci-iommu\0pci1af4,1057";
36
+ void *fdt = MACHINE(s)->fdt;
37
+ uint32_t iommu_phandle;
38
+ g_autofree char *iommu_node = NULL;
39
+ g_autofree char *pci_node = NULL;
40
+
41
+ pci_node = g_strdup_printf("/soc/pci@%lx",
42
+ (long) virt_memmap[VIRT_PCIE_ECAM].base);
43
+ iommu_node = g_strdup_printf("%s/virtio_iommu@%x,%x", pci_node,
44
+ PCI_SLOT(bdf), PCI_FUNC(bdf));
45
+ iommu_phandle = qemu_fdt_alloc_phandle(fdt);
46
+
47
+ qemu_fdt_add_subnode(fdt, iommu_node);
48
+
49
+ qemu_fdt_setprop(fdt, iommu_node, "compatible", compat, sizeof(compat));
50
+ qemu_fdt_setprop_sized_cells(fdt, iommu_node, "reg",
51
+ 1, bdf << 8, 1, 0, 1, 0,
52
+ 1, 0, 1, 0);
53
+ qemu_fdt_setprop_cell(fdt, iommu_node, "#iommu-cells", 1);
54
+ qemu_fdt_setprop_cell(fdt, iommu_node, "phandle", iommu_phandle);
55
+
56
+ qemu_fdt_setprop_cells(fdt, pci_node, "iommu-map",
57
+ 0, iommu_phandle, 0, bdf,
58
+ bdf + 1, iommu_phandle, bdf + 1, 0xffff - bdf);
59
+}
60
+
61
static void finalize_fdt(RISCVVirtState *s)
62
{
63
uint32_t phandle = 1, irq_mmio_phandle = 1, msi_pcie_phandle = 1;
64
@@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine,
65
{
66
MachineClass *mc = MACHINE_GET_CLASS(machine);
67
68
- if (device_is_dynamic_sysbus(mc, dev)) {
69
+ if (device_is_dynamic_sysbus(mc, dev) ||
70
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
71
return HOTPLUG_HANDLER(machine);
72
}
73
return NULL;
74
@@ -XXX,XX +XXX,XX @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,
75
SYS_BUS_DEVICE(dev));
76
}
77
}
78
+
79
+ if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
80
+ create_fdt_virtio_iommu(s, pci_get_bdf(PCI_DEVICE(dev)));
81
+ }
82
}
83
84
static void virt_machine_class_init(ObjectClass *oc, void *data)
85
--
86
2.44.0
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
The 'virt' machine makes assumptions on the Advanced Core-Local
4
Interruptor, or aclint, based on 'tcg_enabled()' conditionals. This
5
will impact MSI related tests support when adding a RISC-V 'virt' libqos
6
machine. The accelerator used in that case, 'qtest', isn't being
7
accounted for and we'll error out if we try to enable aclint.
8
9
Create a new virt_aclint_allowed() helper to gate the aclint code
10
considering both TCG and 'qtest' accelerators. The error message is
11
left untouched, mentioning TCG only, because we don't expect the
12
regular user to be aware of 'qtest'.
13
14
We want to add 'qtest' support for aclint only, leaving the TCG specific
15
bits out of it. This is done by changing the current format we use
16
today:
17
18
if (tcg_enabled()) {
19
if (s->have_aclint) { - aclint logic - }
20
else { - non-aclint, TCG logic - }
21
}
22
23
into:
24
25
if (virt_aclint_allowed() && s->have_aclint) {
26
- aclint logic -
27
} else if (tcg_enabled()) {
28
- non-aclint, TCG logic -
29
}
30
31
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
32
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
33
Message-ID: <20240217192607.32565-6-dbarboza@ventanamicro.com>
34
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
35
---
36
hw/riscv/virt.c | 52 +++++++++++++++++++++++++------------------------
37
1 file changed, 27 insertions(+), 25 deletions(-)
38
39
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/hw/riscv/virt.c
42
+++ b/hw/riscv/virt.c
43
@@ -XXX,XX +XXX,XX @@
44
#include "sysemu/tcg.h"
45
#include "sysemu/kvm.h"
46
#include "sysemu/tpm.h"
47
+#include "sysemu/qtest.h"
48
#include "hw/pci/pci.h"
49
#include "hw/pci-host/gpex.h"
50
#include "hw/display/ramfb.h"
51
@@ -XXX,XX +XXX,XX @@ static bool virt_use_kvm_aia(RISCVVirtState *s)
52
return kvm_irqchip_in_kernel() && s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC;
53
}
54
55
+static bool virt_aclint_allowed(void)
56
+{
57
+ return tcg_enabled() || qtest_enabled();
58
+}
59
+
60
static const MemMapEntry virt_memmap[] = {
61
[VIRT_DEBUG] = { 0x0, 0x100 },
62
[VIRT_MROM] = { 0x1000, 0xf000 },
63
@@ -XXX,XX +XXX,XX @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap,
64
65
create_fdt_socket_memory(s, memmap, socket);
66
67
- if (tcg_enabled()) {
68
- if (s->have_aclint) {
69
- create_fdt_socket_aclint(s, memmap, socket,
70
- &intc_phandles[phandle_pos]);
71
- } else {
72
- create_fdt_socket_clint(s, memmap, socket,
73
- &intc_phandles[phandle_pos]);
74
- }
75
+ if (virt_aclint_allowed() && s->have_aclint) {
76
+ create_fdt_socket_aclint(s, memmap, socket,
77
+ &intc_phandles[phandle_pos]);
78
+ } else if (tcg_enabled()) {
79
+ create_fdt_socket_clint(s, memmap, socket,
80
+ &intc_phandles[phandle_pos]);
81
}
82
}
83
84
@@ -XXX,XX +XXX,XX @@ static void virt_machine_init(MachineState *machine)
85
exit(1);
86
}
87
88
- if (!tcg_enabled() && s->have_aclint) {
89
+ if (!virt_aclint_allowed() && s->have_aclint) {
90
error_report("'aclint' is only available with TCG acceleration");
91
exit(1);
92
}
93
@@ -XXX,XX +XXX,XX @@ static void virt_machine_init(MachineState *machine)
94
hart_count, &error_abort);
95
sysbus_realize(SYS_BUS_DEVICE(&s->soc[i]), &error_fatal);
96
97
- if (tcg_enabled()) {
98
- if (s->have_aclint) {
99
- if (s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC) {
100
- /* Per-socket ACLINT MTIMER */
101
- riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
102
+ if (virt_aclint_allowed() && s->have_aclint) {
103
+ if (s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC) {
104
+ /* Per-socket ACLINT MTIMER */
105
+ riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
106
i * RISCV_ACLINT_DEFAULT_MTIMER_SIZE,
107
RISCV_ACLINT_DEFAULT_MTIMER_SIZE,
108
base_hartid, hart_count,
109
RISCV_ACLINT_DEFAULT_MTIMECMP,
110
RISCV_ACLINT_DEFAULT_MTIME,
111
RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, true);
112
- } else {
113
- /* Per-socket ACLINT MSWI, MTIMER, and SSWI */
114
- riscv_aclint_swi_create(memmap[VIRT_CLINT].base +
115
+ } else {
116
+ /* Per-socket ACLINT MSWI, MTIMER, and SSWI */
117
+ riscv_aclint_swi_create(memmap[VIRT_CLINT].base +
118
i * memmap[VIRT_CLINT].size,
119
base_hartid, hart_count, false);
120
- riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
121
+ riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
122
i * memmap[VIRT_CLINT].size +
123
RISCV_ACLINT_SWI_SIZE,
124
RISCV_ACLINT_DEFAULT_MTIMER_SIZE,
125
@@ -XXX,XX +XXX,XX @@ static void virt_machine_init(MachineState *machine)
126
RISCV_ACLINT_DEFAULT_MTIMECMP,
127
RISCV_ACLINT_DEFAULT_MTIME,
128
RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, true);
129
- riscv_aclint_swi_create(memmap[VIRT_ACLINT_SSWI].base +
130
+ riscv_aclint_swi_create(memmap[VIRT_ACLINT_SSWI].base +
131
i * memmap[VIRT_ACLINT_SSWI].size,
132
base_hartid, hart_count, true);
133
- }
134
- } else {
135
- /* Per-socket SiFive CLINT */
136
- riscv_aclint_swi_create(
137
+ }
138
+ } else if (tcg_enabled()) {
139
+ /* Per-socket SiFive CLINT */
140
+ riscv_aclint_swi_create(
141
memmap[VIRT_CLINT].base + i * memmap[VIRT_CLINT].size,
142
base_hartid, hart_count, false);
143
- riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
144
+ riscv_aclint_mtimer_create(memmap[VIRT_CLINT].base +
145
i * memmap[VIRT_CLINT].size + RISCV_ACLINT_SWI_SIZE,
146
RISCV_ACLINT_DEFAULT_MTIMER_SIZE, base_hartid, hart_count,
147
RISCV_ACLINT_DEFAULT_MTIMECMP, RISCV_ACLINT_DEFAULT_MTIME,
148
RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, true);
149
- }
150
}
151
152
/* Per-socket interrupt controller */
153
--
154
2.44.0
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
Add a RISC-V 'virt' machine to the graph. This implementation is a
4
modified copy of the existing arm machine in arm-virt-machine.c
5
6
It contains a virtio-mmio and a generic-pcihost controller. The
7
generic-pcihost controller hardcodes assumptions from the ARM 'virt'
8
machine, like ecam and pio_base addresses, so we'll add an extra step to
9
set its parameters after creating it.
10
11
Our command line is incremented with 'aclint' parameters to allow the
12
machine to run MSI tests.
13
14
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
15
Acked-by: Alistair Francis <alistair.francis@wdc.com>
16
Acked-by: Thomas Huth <thuth@redhat.com>
17
Message-ID: <20240217192607.32565-7-dbarboza@ventanamicro.com>
18
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
19
---
20
tests/qtest/libqos/riscv-virt-machine.c | 137 ++++++++++++++++++++++++
21
tests/qtest/libqos/meson.build | 1 +
22
2 files changed, 138 insertions(+)
23
create mode 100644 tests/qtest/libqos/riscv-virt-machine.c
24
25
diff --git a/tests/qtest/libqos/riscv-virt-machine.c b/tests/qtest/libqos/riscv-virt-machine.c
26
new file mode 100644
27
index XXXXXXX..XXXXXXX
28
--- /dev/null
29
+++ b/tests/qtest/libqos/riscv-virt-machine.c
30
@@ -XXX,XX +XXX,XX @@
31
+/*
32
+ * libqos driver framework for risc-v
33
+ *
34
+ * Initial version based on arm-virt-machine.c
35
+ *
36
+ * Copyright (c) 2024 Ventana Micro
37
+ *
38
+ * This library is free software; you can redistribute it and/or
39
+ * modify it under the terms of the GNU Lesser General Public
40
+ * License version 2.1 as published by the Free Software Foundation.
41
+ *
42
+ * This library is distributed in the hope that it will be useful,
43
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
44
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
45
+ * Lesser General Public License for more details.
46
+ *
47
+ * You should have received a copy of the GNU Lesser General Public
48
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>
49
+ */
50
+
51
+#include "qemu/osdep.h"
52
+#include "../libqtest.h"
53
+#include "qemu/module.h"
54
+#include "libqos-malloc.h"
55
+#include "qgraph.h"
56
+#include "virtio-mmio.h"
57
+#include "generic-pcihost.h"
58
+#include "hw/pci/pci_regs.h"
59
+
60
+#define RISCV_PAGE_SIZE 4096
61
+
62
+/* VIRT_DRAM */
63
+#define RISCV_VIRT_RAM_ADDR 0x80000000
64
+#define RISCV_VIRT_RAM_SIZE 0x20000000
65
+
66
+/*
67
+ * VIRT_VIRTIO. BASE_ADDR points to the last
68
+ * virtio_mmio device.
69
+ */
70
+#define VIRTIO_MMIO_BASE_ADDR 0x10008000
71
+#define VIRTIO_MMIO_SIZE 0x00001000
72
+
73
+/* VIRT_PCIE_PIO */
74
+#define RISCV_GPEX_PIO_BASE 0x3000000
75
+#define RISCV_BUS_PIO_LIMIT 0x10000
76
+
77
+/* VIRT_PCIE_MMIO */
78
+#define RISCV_BUS_MMIO_ALLOC_PTR 0x40000000
79
+#define RISCV_BUS_MMIO_LIMIT 0x80000000
80
+
81
+/* VIRT_PCIE_ECAM */
82
+#define RISCV_ECAM_ALLOC_PTR 0x30000000
83
+
84
+typedef struct QVirtMachine QVirtMachine;
85
+
86
+struct QVirtMachine {
87
+ QOSGraphObject obj;
88
+ QGuestAllocator alloc;
89
+ QVirtioMMIODevice virtio_mmio;
90
+ QGenericPCIHost bridge;
91
+};
92
+
93
+static void virt_destructor(QOSGraphObject *obj)
94
+{
95
+ QVirtMachine *machine = (QVirtMachine *) obj;
96
+ alloc_destroy(&machine->alloc);
97
+}
98
+
99
+static void *virt_get_driver(void *object, const char *interface)
100
+{
101
+ QVirtMachine *machine = object;
102
+ if (!g_strcmp0(interface, "memory")) {
103
+ return &machine->alloc;
104
+ }
105
+
106
+ fprintf(stderr, "%s not present in riscv/virtio\n", interface);
107
+ g_assert_not_reached();
108
+}
109
+
110
+static QOSGraphObject *virt_get_device(void *obj, const char *device)
111
+{
112
+ QVirtMachine *machine = obj;
113
+ if (!g_strcmp0(device, "generic-pcihost")) {
114
+ return &machine->bridge.obj;
115
+ } else if (!g_strcmp0(device, "virtio-mmio")) {
116
+ return &machine->virtio_mmio.obj;
117
+ }
118
+
119
+ fprintf(stderr, "%s not present in riscv/virt\n", device);
120
+ g_assert_not_reached();
121
+}
122
+
123
+static void riscv_config_qpci_bus(QGenericPCIBus *qpci)
124
+{
125
+ qpci->gpex_pio_base = RISCV_GPEX_PIO_BASE;
126
+ qpci->bus.pio_limit = RISCV_BUS_PIO_LIMIT;
127
+
128
+ qpci->bus.mmio_alloc_ptr = RISCV_BUS_MMIO_ALLOC_PTR;
129
+ qpci->bus.mmio_limit = RISCV_BUS_MMIO_LIMIT;
130
+
131
+ qpci->ecam_alloc_ptr = RISCV_ECAM_ALLOC_PTR;
132
+}
133
+
134
+static void *qos_create_machine_riscv_virt(QTestState *qts)
135
+{
136
+ QVirtMachine *machine = g_new0(QVirtMachine, 1);
137
+
138
+ alloc_init(&machine->alloc, 0,
139
+ RISCV_VIRT_RAM_ADDR,
140
+ RISCV_VIRT_RAM_ADDR + RISCV_VIRT_RAM_SIZE,
141
+ RISCV_PAGE_SIZE);
142
+ qvirtio_mmio_init_device(&machine->virtio_mmio, qts, VIRTIO_MMIO_BASE_ADDR,
143
+ VIRTIO_MMIO_SIZE);
144
+
145
+ qos_create_generic_pcihost(&machine->bridge, qts, &machine->alloc);
146
+ riscv_config_qpci_bus(&machine->bridge.pci);
147
+
148
+ machine->obj.get_device = virt_get_device;
149
+ machine->obj.get_driver = virt_get_driver;
150
+ machine->obj.destructor = virt_destructor;
151
+ return machine;
152
+}
153
+
154
+static void virt_machine_register_nodes(void)
155
+{
156
+ qos_node_create_machine_args("riscv32/virt", qos_create_machine_riscv_virt,
157
+ "aclint=on,aia=aplic-imsic");
158
+ qos_node_contains("riscv32/virt", "virtio-mmio", NULL);
159
+ qos_node_contains("riscv32/virt", "generic-pcihost", NULL);
160
+
161
+ qos_node_create_machine_args("riscv64/virt", qos_create_machine_riscv_virt,
162
+ "aclint=on,aia=aplic-imsic");
163
+ qos_node_contains("riscv64/virt", "virtio-mmio", NULL);
164
+ qos_node_contains("riscv64/virt", "generic-pcihost", NULL);
165
+}
166
+
167
+libqos_init(virt_machine_register_nodes);
168
diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
169
index XXXXXXX..XXXXXXX 100644
170
--- a/tests/qtest/libqos/meson.build
171
+++ b/tests/qtest/libqos/meson.build
172
@@ -XXX,XX +XXX,XX @@ libqos_srcs = files(
173
'arm-xilinx-zynq-a9-machine.c',
174
'ppc64_pseries-machine.c',
175
'x86_64_pc-machine.c',
176
+ 'riscv-virt-machine.c',
177
)
178
179
if have_virtfs
180
--
181
2.44.0
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Palmer Dabbelt <palmer@rivosinc.com>
2
2
3
Once a "One Time Programmable" is programmed, it shouldn't be reset.
3
The Ztso extension is already ratified, this adds it as a CPU property
4
and adds various fences throughout the port in order to allow TSO
5
targets to function on weaker hosts. We need no fences for AMOs as
6
they're already SC, the places we need barriers are described.
7
These fences are placed in the RISC-V backend rather than TCG as is
8
planned for x86-on-arm64 because RISC-V allows heterogeneous (and
9
likely soon dynamic) hart memory models.
4
10
5
Do not re-initialize the OTP content in the DeviceReset handler,
11
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
6
initialize it once in the DeviceRealize one.
12
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
7
13
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
8
Fixes: 9fb45c62ae8 ("riscv: sifive: Implement a model for SiFive FU540 OTP")
14
Message-ID: <20240207122256.902627-2-christoph.muellner@vrull.eu>
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-Id: <20211119104757.331579-1-f4bug@amsat.org>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
---
16
---
14
hw/misc/sifive_u_otp.c | 13 +++++--------
17
target/riscv/cpu_cfg.h | 1 +
15
1 file changed, 5 insertions(+), 8 deletions(-)
18
target/riscv/cpu.c | 2 ++
19
target/riscv/translate.c | 3 +++
20
target/riscv/insn_trans/trans_rva.c.inc | 11 ++++++++---
21
target/riscv/insn_trans/trans_rvi.c.inc | 16 ++++++++++++++--
22
target/riscv/insn_trans/trans_rvv.c.inc | 20 ++++++++++++++++++++
23
6 files changed, 48 insertions(+), 5 deletions(-)
16
24
17
diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
25
diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h
18
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/misc/sifive_u_otp.c
27
--- a/target/riscv/cpu_cfg.h
20
+++ b/hw/misc/sifive_u_otp.c
28
+++ b/target/riscv/cpu_cfg.h
21
@@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp)
29
@@ -XXX,XX +XXX,XX @@ struct RISCVCPUConfig {
22
30
bool ext_zihintntl;
23
if (blk_pread(s->blk, 0, s->fuse, filesize) != filesize) {
31
bool ext_zihintpause;
24
error_setg(errp, "failed to read the initial flash content");
32
bool ext_zihpm;
25
+ return;
33
+ bool ext_ztso;
26
}
34
bool ext_smstateen;
27
}
35
bool ext_sstc;
36
bool ext_svadu;
37
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/riscv/cpu.c
40
+++ b/target/riscv/cpu.c
41
@@ -XXX,XX +XXX,XX @@ const RISCVIsaExtData isa_edata_arr[] = {
42
ISA_EXT_DATA_ENTRY(zksed, PRIV_VERSION_1_12_0, ext_zksed),
43
ISA_EXT_DATA_ENTRY(zksh, PRIV_VERSION_1_12_0, ext_zksh),
44
ISA_EXT_DATA_ENTRY(zkt, PRIV_VERSION_1_12_0, ext_zkt),
45
+ ISA_EXT_DATA_ENTRY(ztso, PRIV_VERSION_1_12_0, ext_ztso),
46
ISA_EXT_DATA_ENTRY(zvbb, PRIV_VERSION_1_12_0, ext_zvbb),
47
ISA_EXT_DATA_ENTRY(zvbc, PRIV_VERSION_1_12_0, ext_zvbc),
48
ISA_EXT_DATA_ENTRY(zve32f, PRIV_VERSION_1_10_0, ext_zve32f),
49
@@ -XXX,XX +XXX,XX @@ const RISCVCPUMultiExtConfig riscv_cpu_extensions[] = {
50
MULTI_EXT_CFG_BOOL("zksed", ext_zksed, false),
51
MULTI_EXT_CFG_BOOL("zksh", ext_zksh, false),
52
MULTI_EXT_CFG_BOOL("zkt", ext_zkt, false),
53
+ MULTI_EXT_CFG_BOOL("ztso", ext_ztso, false),
54
55
MULTI_EXT_CFG_BOOL("zdinx", ext_zdinx, false),
56
MULTI_EXT_CFG_BOOL("zfinx", ext_zfinx, false),
57
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
58
index XXXXXXX..XXXXXXX 100644
59
--- a/target/riscv/translate.c
60
+++ b/target/riscv/translate.c
61
@@ -XXX,XX +XXX,XX @@ typedef struct DisasContext {
62
/* PointerMasking extension */
63
bool pm_mask_enabled;
64
bool pm_base_enabled;
65
+ /* Ztso */
66
+ bool ztso;
67
/* Use icount trigger for native debug */
68
bool itrigger;
69
/* FRM is known to contain a valid value. */
70
@@ -XXX,XX +XXX,XX @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
71
ctx->cs = cs;
72
ctx->pm_mask_enabled = FIELD_EX32(tb_flags, TB_FLAGS, PM_MASK_ENABLED);
73
ctx->pm_base_enabled = FIELD_EX32(tb_flags, TB_FLAGS, PM_BASE_ENABLED);
74
+ ctx->ztso = cpu->cfg.ext_ztso;
75
ctx->itrigger = FIELD_EX32(tb_flags, TB_FLAGS, ITRIGGER);
76
ctx->zero = tcg_constant_tl(0);
77
ctx->virt_inst_excp = false;
78
diff --git a/target/riscv/insn_trans/trans_rva.c.inc b/target/riscv/insn_trans/trans_rva.c.inc
79
index XXXXXXX..XXXXXXX 100644
80
--- a/target/riscv/insn_trans/trans_rva.c.inc
81
+++ b/target/riscv/insn_trans/trans_rva.c.inc
82
@@ -XXX,XX +XXX,XX @@ static bool gen_lr(DisasContext *ctx, arg_atomic *a, MemOp mop)
83
tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL);
28
}
84
}
29
-}
85
tcg_gen_qemu_ld_tl(load_val, src1, ctx->mem_idx, mop);
30
-
86
- if (a->aq) {
31
-static void sifive_u_otp_reset(DeviceState *dev)
87
+ /*
32
-{
88
+ * TSO defines AMOs as acquire+release-RCsc, but does not define LR/SC as
33
- SiFiveUOTPState *s = SIFIVE_U_OTP(dev);
89
+ * AMOs. Instead treat them like loads.
34
90
+ */
35
/* Initialize all fuses' initial value to 0xFFs */
91
+ if (a->aq || ctx->ztso) {
36
memset(s->fuse, 0xff, sizeof(s->fuse));
92
tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ);
37
@@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_reset(DeviceState *dev)
38
serial_data = s->serial;
39
if (blk_pwrite(s->blk, index * SIFIVE_U_OTP_FUSE_WORD,
40
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
41
- error_report("write error index<%d>", index);
42
+ error_setg(errp, "failed to write index<%d>", index);
43
+ return;
44
}
45
46
serial_data = ~(s->serial);
47
if (blk_pwrite(s->blk, (index + 1) * SIFIVE_U_OTP_FUSE_WORD,
48
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
49
- error_report("write error index<%d>", index + 1);
50
+ error_setg(errp, "failed to write index<%d>", index + 1);
51
+ return;
52
}
53
}
93
}
54
94
55
@@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_class_init(ObjectClass *klass, void *data)
95
@@ -XXX,XX +XXX,XX @@ static bool gen_sc(DisasContext *ctx, arg_atomic *a, MemOp mop)
56
96
gen_set_label(l1);
57
device_class_set_props(dc, sifive_u_otp_properties);
97
/*
58
dc->realize = sifive_u_otp_realize;
98
* Address comparison failure. However, we still need to
59
- dc->reset = sifive_u_otp_reset;
99
- * provide the memory barrier implied by AQ/RL.
100
+ * provide the memory barrier implied by AQ/RL/TSO.
101
*/
102
- tcg_gen_mb(TCG_MO_ALL + a->aq * TCG_BAR_LDAQ + a->rl * TCG_BAR_STRL);
103
+ TCGBar bar_strl = (ctx->ztso || a->rl) ? TCG_BAR_STRL : 0;
104
+ tcg_gen_mb(TCG_MO_ALL + a->aq * TCG_BAR_LDAQ + bar_strl);
105
gen_set_gpr(ctx, a->rd, tcg_constant_tl(1));
106
107
gen_set_label(l2);
108
diff --git a/target/riscv/insn_trans/trans_rvi.c.inc b/target/riscv/insn_trans/trans_rvi.c.inc
109
index XXXXXXX..XXXXXXX 100644
110
--- a/target/riscv/insn_trans/trans_rvi.c.inc
111
+++ b/target/riscv/insn_trans/trans_rvi.c.inc
112
@@ -XXX,XX +XXX,XX @@ static bool gen_load_i128(DisasContext *ctx, arg_lb *a, MemOp memop)
113
114
static bool gen_load(DisasContext *ctx, arg_lb *a, MemOp memop)
115
{
116
+ bool out;
117
+
118
decode_save_opc(ctx);
119
if (get_xl(ctx) == MXL_RV128) {
120
- return gen_load_i128(ctx, a, memop);
121
+ out = gen_load_i128(ctx, a, memop);
122
} else {
123
- return gen_load_tl(ctx, a, memop);
124
+ out = gen_load_tl(ctx, a, memop);
125
+ }
126
+
127
+ if (ctx->ztso) {
128
+ tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ);
129
}
130
+
131
+ return out;
60
}
132
}
61
133
62
static const TypeInfo sifive_u_otp_info = {
134
static bool trans_lb(DisasContext *ctx, arg_lb *a)
135
@@ -XXX,XX +XXX,XX @@ static bool gen_store_tl(DisasContext *ctx, arg_sb *a, MemOp memop)
136
TCGv addr = get_address(ctx, a->rs1, a->imm);
137
TCGv data = get_gpr(ctx, a->rs2, EXT_NONE);
138
139
+ if (ctx->ztso) {
140
+ tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL);
141
+ }
142
+
143
tcg_gen_qemu_st_tl(data, addr, ctx->mem_idx, memop);
144
return true;
145
}
146
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
147
index XXXXXXX..XXXXXXX 100644
148
--- a/target/riscv/insn_trans/trans_rvv.c.inc
149
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
150
@@ -XXX,XX +XXX,XX @@ static bool ldst_us_trans(uint32_t vd, uint32_t rs1, uint32_t data,
151
tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, vd));
152
tcg_gen_addi_ptr(mask, tcg_env, vreg_ofs(s, 0));
153
154
+ /*
155
+ * According to the specification
156
+ *
157
+ * Additionally, if the Ztso extension is implemented, then vector memory
158
+ * instructions in the V extension and Zve family of extensions follow
159
+ * RVTSO at the instruction level. The Ztso extension does not
160
+ * strengthen the ordering of intra-instruction element accesses.
161
+ *
162
+ * as a result neither ordered nor unordered accesses from the V
163
+ * instructions need ordering within the loop but we do still need barriers
164
+ * around the loop.
165
+ */
166
+ if (is_store && s->ztso) {
167
+ tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL);
168
+ }
169
+
170
fn(dest, mask, base, tcg_env, desc);
171
172
+ if (!is_store && s->ztso) {
173
+ tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ);
174
+ }
175
+
176
if (!is_store) {
177
mark_vs_dirty(s);
178
}
63
--
179
--
64
2.31.1
180
2.44.0
65
181
66
182
diff view generated by jsdifflib
New patch
1
From: Christoph Müllner <christoph.muellner@vrull.eu>
1
2
3
This patch exposes Ztso via hwprobe in QEMU's user space emulator.
4
5
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
6
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
7
Message-ID: <20240207122256.902627-3-christoph.muellner@vrull.eu>
8
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
9
---
10
linux-user/syscall.c | 3 +++
11
1 file changed, 3 insertions(+)
12
13
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/linux-user/syscall.c
16
+++ b/linux-user/syscall.c
17
@@ -XXX,XX +XXX,XX @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
18
#define RISCV_HWPROBE_EXT_ZVFH (1 << 30)
19
#define RISCV_HWPROBE_EXT_ZVFHMIN (1 << 31)
20
#define RISCV_HWPROBE_EXT_ZFA (1ULL << 32)
21
+#define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33)
22
#define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34)
23
#define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35)
24
25
@@ -XXX,XX +XXX,XX @@ static void risc_hwprobe_fill_pairs(CPURISCVState *env,
26
RISCV_HWPROBE_EXT_ZVFHMIN : 0;
27
value |= cfg->ext_zfa ?
28
RISCV_HWPROBE_EXT_ZFA : 0;
29
+ value |= cfg->ext_ztso ?
30
+ RISCV_HWPROBE_EXT_ZTSO : 0;
31
value |= cfg->ext_zacas ?
32
RISCV_HWPROBE_EXT_ZACAS : 0;
33
value |= cfg->ext_zicond ?
34
--
35
2.44.0
36
37
diff view generated by jsdifflib
New patch
1
From: Christoph Müllner <christoph.muellner@vrull.eu>
1
2
3
Running test-fcvtmod triggers the following deprecation warning:
4
warning: CPU property 'Zfa' is deprecated. Please use 'zfa' instead
5
Let's fix that.
6
7
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-ID: <20240229180656.1208881-1-christoph.muellner@vrull.eu>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
---
14
tests/tcg/riscv64/Makefile.target | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
16
17
diff --git a/tests/tcg/riscv64/Makefile.target b/tests/tcg/riscv64/Makefile.target
18
index XXXXXXX..XXXXXXX 100644
19
--- a/tests/tcg/riscv64/Makefile.target
20
+++ b/tests/tcg/riscv64/Makefile.target
21
@@ -XXX,XX +XXX,XX @@ run-test-aes: QEMU_OPTS += -cpu rv64,zk=on
22
TESTS += test-fcvtmod
23
test-fcvtmod: CFLAGS += -march=rv64imafdc
24
test-fcvtmod: LDFLAGS += -static
25
-run-test-fcvtmod: QEMU_OPTS += -cpu rv64,d=true,Zfa=true
26
+run-test-fcvtmod: QEMU_OPTS += -cpu rv64,d=true,zfa=true
27
--
28
2.44.0
29
30
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
The idea with this update is to get the latest KVM caps for RISC-V.
4
5
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
6
Acked-by: Alistair Francis <alistair.francis@wdc.com>
7
Message-ID: <20240304134732.386590-2-dbarboza@ventanamicro.com>
8
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
9
---
10
include/standard-headers/drm/drm_fourcc.h | 10 +-
11
include/standard-headers/linux/ethtool.h | 41 +++--
12
.../standard-headers/linux/virtio_config.h | 8 +-
13
include/standard-headers/linux/virtio_pci.h | 68 +++++++++
14
include/standard-headers/linux/virtio_pmem.h | 7 +
15
linux-headers/asm-generic/unistd.h | 15 +-
16
linux-headers/asm-mips/mman.h | 2 +-
17
linux-headers/asm-mips/unistd_n32.h | 5 +
18
linux-headers/asm-mips/unistd_n64.h | 5 +
19
linux-headers/asm-mips/unistd_o32.h | 5 +
20
linux-headers/asm-powerpc/unistd_32.h | 5 +
21
linux-headers/asm-powerpc/unistd_64.h | 5 +
22
linux-headers/asm-riscv/kvm.h | 40 +++++
23
linux-headers/asm-s390/unistd_32.h | 5 +
24
linux-headers/asm-s390/unistd_64.h | 5 +
25
linux-headers/asm-x86/kvm.h | 3 +
26
linux-headers/asm-x86/unistd_32.h | 5 +
27
linux-headers/asm-x86/unistd_64.h | 5 +
28
linux-headers/asm-x86/unistd_x32.h | 5 +
29
linux-headers/linux/iommufd.h | 79 ++++++++++
30
linux-headers/linux/kvm.h | 140 +++++++-----------
31
linux-headers/linux/userfaultfd.h | 29 +++-
32
linux-headers/linux/vfio.h | 1 +
33
23 files changed, 381 insertions(+), 112 deletions(-)
34
35
diff --git a/include/standard-headers/drm/drm_fourcc.h b/include/standard-headers/drm/drm_fourcc.h
36
index XXXXXXX..XXXXXXX 100644
37
--- a/include/standard-headers/drm/drm_fourcc.h
38
+++ b/include/standard-headers/drm/drm_fourcc.h
39
@@ -XXX,XX +XXX,XX @@ extern "C" {
40
* Format modifiers may change any property of the buffer, including the number
41
* of planes and/or the required allocation size. Format modifiers are
42
* vendor-namespaced, and as such the relationship between a fourcc code and a
43
- * modifier is specific to the modifer being used. For example, some modifiers
44
+ * modifier is specific to the modifier being used. For example, some modifiers
45
* may preserve meaning - such as number of planes - from the fourcc code,
46
* whereas others may not.
47
*
48
@@ -XXX,XX +XXX,XX @@ extern "C" {
49
* format.
50
* - Higher-level programs interfacing with KMS/GBM/EGL/Vulkan/etc: these users
51
* see modifiers as opaque tokens they can check for equality and intersect.
52
- * These users musn't need to know to reason about the modifier value
53
+ * These users mustn't need to know to reason about the modifier value
54
* (i.e. they are not expected to extract information out of the modifier).
55
*
56
* Vendors should document their modifier usage in as much detail as
57
@@ -XXX,XX +XXX,XX @@ extern "C" {
58
* This is a tiled layout using 4Kb tiles in row-major layout.
59
* Within the tile pixels are laid out in 16 256 byte units / sub-tiles which
60
* are arranged in four groups (two wide, two high) with column-major layout.
61
- * Each group therefore consits out of four 256 byte units, which are also laid
62
+ * Each group therefore consists out of four 256 byte units, which are also laid
63
* out as 2x2 column-major.
64
* 256 byte units are made out of four 64 byte blocks of pixels, producing
65
* either a square block or a 2:1 unit.
66
@@ -XXX,XX +XXX,XX @@ drm_fourcc_canonicalize_nvidia_format_mod(uint64_t modifier)
67
*/
68
69
/*
70
- * The top 4 bits (out of the 56 bits alloted for specifying vendor specific
71
+ * The top 4 bits (out of the 56 bits allotted for specifying vendor specific
72
* modifiers) denote the category for modifiers. Currently we have three
73
* categories of modifiers ie AFBC, MISC and AFRC. We can have a maximum of
74
* sixteen different categories.
75
@@ -XXX,XX +XXX,XX @@ drm_fourcc_canonicalize_nvidia_format_mod(uint64_t modifier)
76
* Amlogic FBC Memory Saving mode
77
*
78
* Indicates the storage is packed when pixel size is multiple of word
79
- * boudaries, i.e. 8bit should be stored in this mode to save allocation
80
+ * boundaries, i.e. 8bit should be stored in this mode to save allocation
81
* memory.
82
*
83
* This mode reduces body layout to 3072 bytes per 64x32 superblock with
84
diff --git a/include/standard-headers/linux/ethtool.h b/include/standard-headers/linux/ethtool.h
85
index XXXXXXX..XXXXXXX 100644
86
--- a/include/standard-headers/linux/ethtool.h
87
+++ b/include/standard-headers/linux/ethtool.h
88
@@ -XXX,XX +XXX,XX @@ struct ethtool_rxfh_indir {
89
*    hardware hash key.
90
* @hfunc: Defines the current RSS hash function used by HW (or to be set to).
91
*    Valid values are one of the %ETH_RSS_HASH_*.
92
+ * @input_xfrm: Defines how the input data is transformed. Valid values are one
93
+ *    of %RXH_XFRM_*.
94
* @rsvd8: Reserved for future use; see the note on reserved space.
95
* @rsvd32: Reserved for future use; see the note on reserved space.
96
* @rss_config: RX ring/queue index for each hash value i.e., indirection table
97
@@ -XXX,XX +XXX,XX @@ struct ethtool_rxfh {
98
    uint32_t indir_size;
99
    uint32_t key_size;
100
    uint8_t    hfunc;
101
-    uint8_t    rsvd8[3];
102
+    uint8_t    input_xfrm;
103
+    uint8_t    rsvd8[2];
104
    uint32_t    rsvd32;
105
    uint32_t rss_config[];
106
};
107
@@ -XXX,XX +XXX,XX @@ static inline int ethtool_validate_duplex(uint8_t duplex)
108
109
#define WOL_MODE_COUNT        8
110
111
+/* RSS hash function data
112
+ * XOR the corresponding source and destination fields of each specified
113
+ * protocol. Both copies of the XOR'ed fields are fed into the RSS and RXHASH
114
+ * calculation. Note that this XORing reduces the input set entropy and could
115
+ * be exploited to reduce the RSS queue spread.
116
+ */
117
+#define    RXH_XFRM_SYM_XOR    (1 << 0)
118
+#define    RXH_XFRM_NO_CHANGE    0xff
119
+
120
/* L2-L4 network traffic flow types */
121
#define    TCP_V4_FLOW    0x01    /* hash or spec (tcp_ip4_spec) */
122
#define    UDP_V4_FLOW    0x02    /* hash or spec (udp_ip4_spec) */
123
@@ -XXX,XX +XXX,XX @@ enum ethtool_reset_flags {
124
*    refused. For drivers: ignore this field (use kernel's
125
*    __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will
126
*    be overwritten by kernel.
127
- * @supported: Bitmap with each bit meaning given by
128
- *    %ethtool_link_mode_bit_indices for the link modes, physical
129
- *    connectors and other link features for which the interface
130
- *    supports autonegotiation or auto-detection. Read-only.
131
- * @advertising: Bitmap with each bit meaning given by
132
- *    %ethtool_link_mode_bit_indices for the link modes, physical
133
- *    connectors and other link features that are advertised through
134
- *    autonegotiation or enabled for auto-detection.
135
- * @lp_advertising: Bitmap with each bit meaning given by
136
- *    %ethtool_link_mode_bit_indices for the link modes, and other
137
- *    link features that the link partner advertised through
138
- *    autonegotiation; 0 if unknown or not applicable. Read-only.
139
* @transceiver: Used to distinguish different possible PHY types,
140
*    reported consistently by PHYLIB. Read-only.
141
* @master_slave_cfg: Master/slave port mode.
142
@@ -XXX,XX +XXX,XX @@ enum ethtool_reset_flags {
143
* %set_link_ksettings() should validate all fields other than @cmd
144
* and @link_mode_masks_nwords that are not described as read-only or
145
* deprecated, and must ignore all fields described as read-only.
146
+ *
147
+ * @link_mode_masks is divided into three bitfields, each of length
148
+ * @link_mode_masks_nwords:
149
+ * - supported: Bitmap with each bit meaning given by
150
+ *    %ethtool_link_mode_bit_indices for the link modes, physical
151
+ *    connectors and other link features for which the interface
152
+ *    supports autonegotiation or auto-detection. Read-only.
153
+ * - advertising: Bitmap with each bit meaning given by
154
+ *    %ethtool_link_mode_bit_indices for the link modes, physical
155
+ *    connectors and other link features that are advertised through
156
+ *    autonegotiation or enabled for auto-detection.
157
+ * - lp_advertising: Bitmap with each bit meaning given by
158
+ *    %ethtool_link_mode_bit_indices for the link modes, and other
159
+ *    link features that the link partner advertised through
160
+ *    autonegotiation; 0 if unknown or not applicable. Read-only.
161
*/
162
struct ethtool_link_settings {
163
    uint32_t    cmd;
164
diff --git a/include/standard-headers/linux/virtio_config.h b/include/standard-headers/linux/virtio_config.h
165
index XXXXXXX..XXXXXXX 100644
166
--- a/include/standard-headers/linux/virtio_config.h
167
+++ b/include/standard-headers/linux/virtio_config.h
168
@@ -XXX,XX +XXX,XX @@
169
* rest are per-device feature bits.
170
*/
171
#define VIRTIO_TRANSPORT_F_START    28
172
-#define VIRTIO_TRANSPORT_F_END        41
173
+#define VIRTIO_TRANSPORT_F_END        42
174
175
#ifndef VIRTIO_CONFIG_NO_LEGACY
176
/* Do we get callbacks when the ring is completely used, even if we've
177
@@ -XXX,XX +XXX,XX @@
178
* This feature indicates that the driver can reset a queue individually.
179
*/
180
#define VIRTIO_F_RING_RESET        40
181
+
182
+/*
183
+ * This feature indicates that the device support administration virtqueues.
184
+ */
185
+#define VIRTIO_F_ADMIN_VQ        41
186
+
187
#endif /* _LINUX_VIRTIO_CONFIG_H */
188
diff --git a/include/standard-headers/linux/virtio_pci.h b/include/standard-headers/linux/virtio_pci.h
189
index XXXXXXX..XXXXXXX 100644
190
--- a/include/standard-headers/linux/virtio_pci.h
191
+++ b/include/standard-headers/linux/virtio_pci.h
192
@@ -XXX,XX +XXX,XX @@ struct virtio_pci_modern_common_cfg {
193
194
    uint16_t queue_notify_data;    /* read-write */
195
    uint16_t queue_reset;        /* read-write */
196
+
197
+    uint16_t admin_queue_index;    /* read-only */
198
+    uint16_t admin_queue_num;        /* read-only */
199
};
200
201
/* Fields in VIRTIO_PCI_CAP_PCI_CFG: */
202
@@ -XXX,XX +XXX,XX @@ struct virtio_pci_cfg_cap {
203
#define VIRTIO_PCI_COMMON_Q_USEDHI    52
204
#define VIRTIO_PCI_COMMON_Q_NDATA    56
205
#define VIRTIO_PCI_COMMON_Q_RESET    58
206
+#define VIRTIO_PCI_COMMON_ADM_Q_IDX    60
207
+#define VIRTIO_PCI_COMMON_ADM_Q_NUM    62
208
209
#endif /* VIRTIO_PCI_NO_MODERN */
210
211
+/* Admin command status. */
212
+#define VIRTIO_ADMIN_STATUS_OK        0
213
+
214
+/* Admin command opcode. */
215
+#define VIRTIO_ADMIN_CMD_LIST_QUERY    0x0
216
+#define VIRTIO_ADMIN_CMD_LIST_USE    0x1
217
+
218
+/* Admin command group type. */
219
+#define VIRTIO_ADMIN_GROUP_TYPE_SRIOV    0x1
220
+
221
+/* Transitional device admin command. */
222
+#define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE    0x2
223
+#define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ        0x3
224
+#define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE        0x4
225
+#define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ        0x5
226
+#define VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO        0x6
227
+
228
+struct QEMU_PACKED virtio_admin_cmd_hdr {
229
+    uint16_t opcode;
230
+    /*
231
+     * 1 - SR-IOV
232
+     * 2-65535 - reserved
233
+     */
234
+    uint16_t group_type;
235
+    /* Unused, reserved for future extensions. */
236
+    uint8_t reserved1[12];
237
+    uint64_t group_member_id;
238
+};
239
+
240
+struct QEMU_PACKED virtio_admin_cmd_status {
241
+    uint16_t status;
242
+    uint16_t status_qualifier;
243
+    /* Unused, reserved for future extensions. */
244
+    uint8_t reserved2[4];
245
+};
246
+
247
+struct QEMU_PACKED virtio_admin_cmd_legacy_wr_data {
248
+    uint8_t offset; /* Starting offset of the register(s) to write. */
249
+    uint8_t reserved[7];
250
+    uint8_t registers[];
251
+};
252
+
253
+struct QEMU_PACKED virtio_admin_cmd_legacy_rd_data {
254
+    uint8_t offset; /* Starting offset of the register(s) to read. */
255
+};
256
+
257
+#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_END 0
258
+#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_DEV 0x1
259
+#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_MEM 0x2
260
+
261
+#define VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO 4
262
+
263
+struct QEMU_PACKED virtio_admin_cmd_notify_info_data {
264
+    uint8_t flags; /* 0 = end of list, 1 = owner device, 2 = member device */
265
+    uint8_t bar; /* BAR of the member or the owner device */
266
+    uint8_t padding[6];
267
+    uint64_t offset; /* Offset within bar. */
268
+};
269
+
270
+struct virtio_admin_cmd_notify_info_result {
271
+    struct virtio_admin_cmd_notify_info_data entries[VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO];
272
+};
273
+
274
#endif
275
diff --git a/include/standard-headers/linux/virtio_pmem.h b/include/standard-headers/linux/virtio_pmem.h
276
index XXXXXXX..XXXXXXX 100644
277
--- a/include/standard-headers/linux/virtio_pmem.h
278
+++ b/include/standard-headers/linux/virtio_pmem.h
279
@@ -XXX,XX +XXX,XX @@
280
#include "standard-headers/linux/virtio_ids.h"
281
#include "standard-headers/linux/virtio_config.h"
282
283
+/* Feature bits */
284
+/* guest physical address range will be indicated as shared memory region 0 */
285
+#define VIRTIO_PMEM_F_SHMEM_REGION 0
286
+
287
+/* shmid of the shared memory region corresponding to the pmem */
288
+#define VIRTIO_PMEM_SHMEM_REGION_ID 0
289
+
290
struct virtio_pmem_config {
291
    uint64_t start;
292
    uint64_t size;
293
diff --git a/linux-headers/asm-generic/unistd.h b/linux-headers/asm-generic/unistd.h
294
index XXXXXXX..XXXXXXX 100644
295
--- a/linux-headers/asm-generic/unistd.h
296
+++ b/linux-headers/asm-generic/unistd.h
297
@@ -XXX,XX +XXX,XX @@ __SYSCALL(__NR_futex_wait, sys_futex_wait)
298
#define __NR_futex_requeue 456
299
__SYSCALL(__NR_futex_requeue, sys_futex_requeue)
300
301
+#define __NR_statmount 457
302
+__SYSCALL(__NR_statmount, sys_statmount)
303
+
304
+#define __NR_listmount 458
305
+__SYSCALL(__NR_listmount, sys_listmount)
306
+
307
+#define __NR_lsm_get_self_attr 459
308
+__SYSCALL(__NR_lsm_get_self_attr, sys_lsm_get_self_attr)
309
+#define __NR_lsm_set_self_attr 460
310
+__SYSCALL(__NR_lsm_set_self_attr, sys_lsm_set_self_attr)
311
+#define __NR_lsm_list_modules 461
312
+__SYSCALL(__NR_lsm_list_modules, sys_lsm_list_modules)
313
+
314
#undef __NR_syscalls
315
-#define __NR_syscalls 457
316
+#define __NR_syscalls 462
317
318
/*
319
* 32 bit systems traditionally used different
320
diff --git a/linux-headers/asm-mips/mman.h b/linux-headers/asm-mips/mman.h
321
index XXXXXXX..XXXXXXX 100644
322
--- a/linux-headers/asm-mips/mman.h
323
+++ b/linux-headers/asm-mips/mman.h
324
@@ -XXX,XX +XXX,XX @@
325
#define MADV_HUGEPAGE    14        /* Worth backing with hugepages */
326
#define MADV_NOHUGEPAGE 15        /* Not worth backing with hugepages */
327
328
-#define MADV_DONTDUMP    16        /* Explicity exclude from the core dump,
329
+#define MADV_DONTDUMP    16        /* Explicitly exclude from core dump,
330
                     overrides the coredump filter bits */
331
#define MADV_DODUMP    17        /* Clear the MADV_NODUMP flag */
332
333
diff --git a/linux-headers/asm-mips/unistd_n32.h b/linux-headers/asm-mips/unistd_n32.h
334
index XXXXXXX..XXXXXXX 100644
335
--- a/linux-headers/asm-mips/unistd_n32.h
336
+++ b/linux-headers/asm-mips/unistd_n32.h
337
@@ -XXX,XX +XXX,XX @@
338
#define __NR_futex_wake (__NR_Linux + 454)
339
#define __NR_futex_wait (__NR_Linux + 455)
340
#define __NR_futex_requeue (__NR_Linux + 456)
341
+#define __NR_statmount (__NR_Linux + 457)
342
+#define __NR_listmount (__NR_Linux + 458)
343
+#define __NR_lsm_get_self_attr (__NR_Linux + 459)
344
+#define __NR_lsm_set_self_attr (__NR_Linux + 460)
345
+#define __NR_lsm_list_modules (__NR_Linux + 461)
346
347
#endif /* _ASM_UNISTD_N32_H */
348
diff --git a/linux-headers/asm-mips/unistd_n64.h b/linux-headers/asm-mips/unistd_n64.h
349
index XXXXXXX..XXXXXXX 100644
350
--- a/linux-headers/asm-mips/unistd_n64.h
351
+++ b/linux-headers/asm-mips/unistd_n64.h
352
@@ -XXX,XX +XXX,XX @@
353
#define __NR_futex_wake (__NR_Linux + 454)
354
#define __NR_futex_wait (__NR_Linux + 455)
355
#define __NR_futex_requeue (__NR_Linux + 456)
356
+#define __NR_statmount (__NR_Linux + 457)
357
+#define __NR_listmount (__NR_Linux + 458)
358
+#define __NR_lsm_get_self_attr (__NR_Linux + 459)
359
+#define __NR_lsm_set_self_attr (__NR_Linux + 460)
360
+#define __NR_lsm_list_modules (__NR_Linux + 461)
361
362
#endif /* _ASM_UNISTD_N64_H */
363
diff --git a/linux-headers/asm-mips/unistd_o32.h b/linux-headers/asm-mips/unistd_o32.h
364
index XXXXXXX..XXXXXXX 100644
365
--- a/linux-headers/asm-mips/unistd_o32.h
366
+++ b/linux-headers/asm-mips/unistd_o32.h
367
@@ -XXX,XX +XXX,XX @@
368
#define __NR_futex_wake (__NR_Linux + 454)
369
#define __NR_futex_wait (__NR_Linux + 455)
370
#define __NR_futex_requeue (__NR_Linux + 456)
371
+#define __NR_statmount (__NR_Linux + 457)
372
+#define __NR_listmount (__NR_Linux + 458)
373
+#define __NR_lsm_get_self_attr (__NR_Linux + 459)
374
+#define __NR_lsm_set_self_attr (__NR_Linux + 460)
375
+#define __NR_lsm_list_modules (__NR_Linux + 461)
376
377
#endif /* _ASM_UNISTD_O32_H */
378
diff --git a/linux-headers/asm-powerpc/unistd_32.h b/linux-headers/asm-powerpc/unistd_32.h
379
index XXXXXXX..XXXXXXX 100644
380
--- a/linux-headers/asm-powerpc/unistd_32.h
381
+++ b/linux-headers/asm-powerpc/unistd_32.h
382
@@ -XXX,XX +XXX,XX @@
383
#define __NR_futex_wake 454
384
#define __NR_futex_wait 455
385
#define __NR_futex_requeue 456
386
+#define __NR_statmount 457
387
+#define __NR_listmount 458
388
+#define __NR_lsm_get_self_attr 459
389
+#define __NR_lsm_set_self_attr 460
390
+#define __NR_lsm_list_modules 461
391
392
393
#endif /* _ASM_UNISTD_32_H */
394
diff --git a/linux-headers/asm-powerpc/unistd_64.h b/linux-headers/asm-powerpc/unistd_64.h
395
index XXXXXXX..XXXXXXX 100644
396
--- a/linux-headers/asm-powerpc/unistd_64.h
397
+++ b/linux-headers/asm-powerpc/unistd_64.h
398
@@ -XXX,XX +XXX,XX @@
399
#define __NR_futex_wake 454
400
#define __NR_futex_wait 455
401
#define __NR_futex_requeue 456
402
+#define __NR_statmount 457
403
+#define __NR_listmount 458
404
+#define __NR_lsm_get_self_attr 459
405
+#define __NR_lsm_set_self_attr 460
406
+#define __NR_lsm_list_modules 461
407
408
409
#endif /* _ASM_UNISTD_64_H */
410
diff --git a/linux-headers/asm-riscv/kvm.h b/linux-headers/asm-riscv/kvm.h
411
index XXXXXXX..XXXXXXX 100644
412
--- a/linux-headers/asm-riscv/kvm.h
413
+++ b/linux-headers/asm-riscv/kvm.h
414
@@ -XXX,XX +XXX,XX @@ enum KVM_RISCV_ISA_EXT_ID {
415
    KVM_RISCV_ISA_EXT_ZIHPM,
416
    KVM_RISCV_ISA_EXT_SMSTATEEN,
417
    KVM_RISCV_ISA_EXT_ZICOND,
418
+    KVM_RISCV_ISA_EXT_ZBC,
419
+    KVM_RISCV_ISA_EXT_ZBKB,
420
+    KVM_RISCV_ISA_EXT_ZBKC,
421
+    KVM_RISCV_ISA_EXT_ZBKX,
422
+    KVM_RISCV_ISA_EXT_ZKND,
423
+    KVM_RISCV_ISA_EXT_ZKNE,
424
+    KVM_RISCV_ISA_EXT_ZKNH,
425
+    KVM_RISCV_ISA_EXT_ZKR,
426
+    KVM_RISCV_ISA_EXT_ZKSED,
427
+    KVM_RISCV_ISA_EXT_ZKSH,
428
+    KVM_RISCV_ISA_EXT_ZKT,
429
+    KVM_RISCV_ISA_EXT_ZVBB,
430
+    KVM_RISCV_ISA_EXT_ZVBC,
431
+    KVM_RISCV_ISA_EXT_ZVKB,
432
+    KVM_RISCV_ISA_EXT_ZVKG,
433
+    KVM_RISCV_ISA_EXT_ZVKNED,
434
+    KVM_RISCV_ISA_EXT_ZVKNHA,
435
+    KVM_RISCV_ISA_EXT_ZVKNHB,
436
+    KVM_RISCV_ISA_EXT_ZVKSED,
437
+    KVM_RISCV_ISA_EXT_ZVKSH,
438
+    KVM_RISCV_ISA_EXT_ZVKT,
439
+    KVM_RISCV_ISA_EXT_ZFH,
440
+    KVM_RISCV_ISA_EXT_ZFHMIN,
441
+    KVM_RISCV_ISA_EXT_ZIHINTNTL,
442
+    KVM_RISCV_ISA_EXT_ZVFH,
443
+    KVM_RISCV_ISA_EXT_ZVFHMIN,
444
+    KVM_RISCV_ISA_EXT_ZFA,
445
    KVM_RISCV_ISA_EXT_MAX,
446
};
447
448
@@ -XXX,XX +XXX,XX @@ enum KVM_RISCV_SBI_EXT_ID {
449
    KVM_RISCV_SBI_EXT_EXPERIMENTAL,
450
    KVM_RISCV_SBI_EXT_VENDOR,
451
    KVM_RISCV_SBI_EXT_DBCN,
452
+    KVM_RISCV_SBI_EXT_STA,
453
    KVM_RISCV_SBI_EXT_MAX,
454
};
455
456
+/* SBI STA extension registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */
457
+struct kvm_riscv_sbi_sta {
458
+    unsigned long shmem_lo;
459
+    unsigned long shmem_hi;
460
+};
461
+
462
/* Possible states for kvm_riscv_timer */
463
#define KVM_RISCV_TIMER_STATE_OFF    0
464
#define KVM_RISCV_TIMER_STATE_ON    1
465
@@ -XXX,XX +XXX,XX @@ enum KVM_RISCV_SBI_EXT_ID {
466
#define KVM_REG_RISCV_VECTOR_REG(n)    \
467
        ((n) + sizeof(struct __riscv_v_ext_state) / sizeof(unsigned long))
468
469
+/* Registers for specific SBI extensions are mapped as type 10 */
470
+#define KVM_REG_RISCV_SBI_STATE        (0x0a << KVM_REG_RISCV_TYPE_SHIFT)
471
+#define KVM_REG_RISCV_SBI_STA        (0x0 << KVM_REG_RISCV_SUBTYPE_SHIFT)
472
+#define KVM_REG_RISCV_SBI_STA_REG(name)        \
473
+        (offsetof(struct kvm_riscv_sbi_sta, name) / sizeof(unsigned long))
474
+
475
/* Device Control API: RISC-V AIA */
476
#define KVM_DEV_RISCV_APLIC_ALIGN        0x1000
477
#define KVM_DEV_RISCV_APLIC_SIZE        0x4000
478
diff --git a/linux-headers/asm-s390/unistd_32.h b/linux-headers/asm-s390/unistd_32.h
479
index XXXXXXX..XXXXXXX 100644
480
--- a/linux-headers/asm-s390/unistd_32.h
481
+++ b/linux-headers/asm-s390/unistd_32.h
482
@@ -XXX,XX +XXX,XX @@
483
#define __NR_futex_wake 454
484
#define __NR_futex_wait 455
485
#define __NR_futex_requeue 456
486
+#define __NR_statmount 457
487
+#define __NR_listmount 458
488
+#define __NR_lsm_get_self_attr 459
489
+#define __NR_lsm_set_self_attr 460
490
+#define __NR_lsm_list_modules 461
491
492
#endif /* _ASM_S390_UNISTD_32_H */
493
diff --git a/linux-headers/asm-s390/unistd_64.h b/linux-headers/asm-s390/unistd_64.h
494
index XXXXXXX..XXXXXXX 100644
495
--- a/linux-headers/asm-s390/unistd_64.h
496
+++ b/linux-headers/asm-s390/unistd_64.h
497
@@ -XXX,XX +XXX,XX @@
498
#define __NR_futex_wake 454
499
#define __NR_futex_wait 455
500
#define __NR_futex_requeue 456
501
+#define __NR_statmount 457
502
+#define __NR_listmount 458
503
+#define __NR_lsm_get_self_attr 459
504
+#define __NR_lsm_set_self_attr 460
505
+#define __NR_lsm_list_modules 461
506
507
#endif /* _ASM_S390_UNISTD_64_H */
508
diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
509
index XXXXXXX..XXXXXXX 100644
510
--- a/linux-headers/asm-x86/kvm.h
511
+++ b/linux-headers/asm-x86/kvm.h
512
@@ -XXX,XX +XXX,XX @@ struct kvm_pmu_event_filter {
513
/* x86-specific KVM_EXIT_HYPERCALL flags. */
514
#define KVM_EXIT_HYPERCALL_LONG_MODE    BIT(0)
515
516
+#define KVM_X86_DEFAULT_VM    0
517
+#define KVM_X86_SW_PROTECTED_VM    1
518
+
519
#endif /* _ASM_X86_KVM_H */
520
diff --git a/linux-headers/asm-x86/unistd_32.h b/linux-headers/asm-x86/unistd_32.h
521
index XXXXXXX..XXXXXXX 100644
522
--- a/linux-headers/asm-x86/unistd_32.h
523
+++ b/linux-headers/asm-x86/unistd_32.h
524
@@ -XXX,XX +XXX,XX @@
525
#define __NR_futex_wake 454
526
#define __NR_futex_wait 455
527
#define __NR_futex_requeue 456
528
+#define __NR_statmount 457
529
+#define __NR_listmount 458
530
+#define __NR_lsm_get_self_attr 459
531
+#define __NR_lsm_set_self_attr 460
532
+#define __NR_lsm_list_modules 461
533
534
535
#endif /* _ASM_UNISTD_32_H */
536
diff --git a/linux-headers/asm-x86/unistd_64.h b/linux-headers/asm-x86/unistd_64.h
537
index XXXXXXX..XXXXXXX 100644
538
--- a/linux-headers/asm-x86/unistd_64.h
539
+++ b/linux-headers/asm-x86/unistd_64.h
540
@@ -XXX,XX +XXX,XX @@
541
#define __NR_futex_wake 454
542
#define __NR_futex_wait 455
543
#define __NR_futex_requeue 456
544
+#define __NR_statmount 457
545
+#define __NR_listmount 458
546
+#define __NR_lsm_get_self_attr 459
547
+#define __NR_lsm_set_self_attr 460
548
+#define __NR_lsm_list_modules 461
549
550
551
#endif /* _ASM_UNISTD_64_H */
552
diff --git a/linux-headers/asm-x86/unistd_x32.h b/linux-headers/asm-x86/unistd_x32.h
553
index XXXXXXX..XXXXXXX 100644
554
--- a/linux-headers/asm-x86/unistd_x32.h
555
+++ b/linux-headers/asm-x86/unistd_x32.h
556
@@ -XXX,XX +XXX,XX @@
557
#define __NR_futex_wake (__X32_SYSCALL_BIT + 454)
558
#define __NR_futex_wait (__X32_SYSCALL_BIT + 455)
559
#define __NR_futex_requeue (__X32_SYSCALL_BIT + 456)
560
+#define __NR_statmount (__X32_SYSCALL_BIT + 457)
561
+#define __NR_listmount (__X32_SYSCALL_BIT + 458)
562
+#define __NR_lsm_get_self_attr (__X32_SYSCALL_BIT + 459)
563
+#define __NR_lsm_set_self_attr (__X32_SYSCALL_BIT + 460)
564
+#define __NR_lsm_list_modules (__X32_SYSCALL_BIT + 461)
565
#define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
566
#define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
567
#define __NR_ioctl (__X32_SYSCALL_BIT + 514)
568
diff --git a/linux-headers/linux/iommufd.h b/linux-headers/linux/iommufd.h
569
index XXXXXXX..XXXXXXX 100644
570
--- a/linux-headers/linux/iommufd.h
571
+++ b/linux-headers/linux/iommufd.h
572
@@ -XXX,XX +XXX,XX @@ enum {
573
    IOMMUFD_CMD_GET_HW_INFO,
574
    IOMMUFD_CMD_HWPT_SET_DIRTY_TRACKING,
575
    IOMMUFD_CMD_HWPT_GET_DIRTY_BITMAP,
576
+    IOMMUFD_CMD_HWPT_INVALIDATE,
577
};
578
579
/**
580
@@ -XXX,XX +XXX,XX @@ struct iommu_hwpt_get_dirty_bitmap {
581
#define IOMMU_HWPT_GET_DIRTY_BITMAP _IO(IOMMUFD_TYPE, \
582
                    IOMMUFD_CMD_HWPT_GET_DIRTY_BITMAP)
583
584
+/**
585
+ * enum iommu_hwpt_invalidate_data_type - IOMMU HWPT Cache Invalidation
586
+ * Data Type
587
+ * @IOMMU_HWPT_INVALIDATE_DATA_VTD_S1: Invalidation data for VTD_S1
588
+ */
589
+enum iommu_hwpt_invalidate_data_type {
590
+    IOMMU_HWPT_INVALIDATE_DATA_VTD_S1,
591
+};
592
+
593
+/**
594
+ * enum iommu_hwpt_vtd_s1_invalidate_flags - Flags for Intel VT-d
595
+ * stage-1 cache invalidation
596
+ * @IOMMU_VTD_INV_FLAGS_LEAF: Indicates whether the invalidation applies
597
+ * to all-levels page structure cache or just
598
+ * the leaf PTE cache.
599
+ */
600
+enum iommu_hwpt_vtd_s1_invalidate_flags {
601
+    IOMMU_VTD_INV_FLAGS_LEAF = 1 << 0,
602
+};
603
+
604
+/**
605
+ * struct iommu_hwpt_vtd_s1_invalidate - Intel VT-d cache invalidation
606
+ * (IOMMU_HWPT_INVALIDATE_DATA_VTD_S1)
607
+ * @addr: The start address of the range to be invalidated. It needs to
608
+ * be 4KB aligned.
609
+ * @npages: Number of contiguous 4K pages to be invalidated.
610
+ * @flags: Combination of enum iommu_hwpt_vtd_s1_invalidate_flags
611
+ * @__reserved: Must be 0
612
+ *
613
+ * The Intel VT-d specific invalidation data for user-managed stage-1 cache
614
+ * invalidation in nested translation. Userspace uses this structure to
615
+ * tell the impacted cache scope after modifying the stage-1 page table.
616
+ *
617
+ * Invalidating all the caches related to the page table by setting @addr
618
+ * to be 0 and @npages to be U64_MAX.
619
+ *
620
+ * The device TLB will be invalidated automatically if ATS is enabled.
621
+ */
622
+struct iommu_hwpt_vtd_s1_invalidate {
623
+    __aligned_u64 addr;
624
+    __aligned_u64 npages;
625
+    __u32 flags;
626
+    __u32 __reserved;
627
+};
628
+
629
+/**
630
+ * struct iommu_hwpt_invalidate - ioctl(IOMMU_HWPT_INVALIDATE)
631
+ * @size: sizeof(struct iommu_hwpt_invalidate)
632
+ * @hwpt_id: ID of a nested HWPT for cache invalidation
633
+ * @data_uptr: User pointer to an array of driver-specific cache invalidation
634
+ * data.
635
+ * @data_type: One of enum iommu_hwpt_invalidate_data_type, defining the data
636
+ * type of all the entries in the invalidation request array. It
637
+ * should be a type supported by the hwpt pointed by @hwpt_id.
638
+ * @entry_len: Length (in bytes) of a request entry in the request array
639
+ * @entry_num: Input the number of cache invalidation requests in the array.
640
+ * Output the number of requests successfully handled by kernel.
641
+ * @__reserved: Must be 0.
642
+ *
643
+ * Invalidate the iommu cache for user-managed page table. Modifications on a
644
+ * user-managed page table should be followed by this operation to sync cache.
645
+ * Each ioctl can support one or more cache invalidation requests in the array
646
+ * that has a total size of @entry_len * @entry_num.
647
+ *
648
+ * An empty invalidation request array by setting @entry_num==0 is allowed, and
649
+ * @entry_len and @data_uptr would be ignored in this case. This can be used to
650
+ * check if the given @data_type is supported or not by kernel.
651
+ */
652
+struct iommu_hwpt_invalidate {
653
+    __u32 size;
654
+    __u32 hwpt_id;
655
+    __aligned_u64 data_uptr;
656
+    __u32 data_type;
657
+    __u32 entry_len;
658
+    __u32 entry_num;
659
+    __u32 __reserved;
660
+};
661
+#define IOMMU_HWPT_INVALIDATE _IO(IOMMUFD_TYPE, IOMMUFD_CMD_HWPT_INVALIDATE)
662
#endif
663
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
664
index XXXXXXX..XXXXXXX 100644
665
--- a/linux-headers/linux/kvm.h
666
+++ b/linux-headers/linux/kvm.h
667
@@ -XXX,XX +XXX,XX @@
668
669
#define KVM_API_VERSION 12
670
671
-/* *** Deprecated interfaces *** */
672
-
673
-#define KVM_TRC_SHIFT 16
674
-
675
-#define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT)
676
-#define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1))
677
-
678
-#define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01)
679
-#define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02)
680
-#define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01)
681
-
682
-#define KVM_TRC_HEAD_SIZE 12
683
-#define KVM_TRC_CYCLE_SIZE 8
684
-#define KVM_TRC_EXTRA_MAX 7
685
-
686
-#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
687
-#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
688
-#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04)
689
-#define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05)
690
-#define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06)
691
-#define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07)
692
-#define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08)
693
-#define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09)
694
-#define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A)
695
-#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B)
696
-#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C)
697
-#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D)
698
-#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E)
699
-#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F)
700
-#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10)
701
-#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11)
702
-#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12)
703
-#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13)
704
-#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14)
705
-#define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15)
706
-#define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16)
707
-#define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17)
708
-#define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18)
709
-#define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19)
710
-
711
-struct kvm_user_trace_setup {
712
-    __u32 buf_size;
713
-    __u32 buf_nr;
714
-};
715
-
716
-#define __KVM_DEPRECATED_MAIN_W_0x06 \
717
-    _IOW(KVMIO, 0x06, struct kvm_user_trace_setup)
718
-#define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07)
719
-#define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08)
720
-
721
-#define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq)
722
-
723
-struct kvm_breakpoint {
724
-    __u32 enabled;
725
-    __u32 padding;
726
-    __u64 address;
727
-};
728
-
729
-struct kvm_debug_guest {
730
-    __u32 enabled;
731
-    __u32 pad;
732
-    struct kvm_breakpoint breakpoints[4];
733
-    __u32 singlestep;
734
-};
735
-
736
-#define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest)
737
-
738
-/* *** End of deprecated interfaces *** */
739
-
740
-
741
/* for KVM_SET_USER_MEMORY_REGION */
742
struct kvm_userspace_memory_region {
743
    __u32 slot;
744
@@ -XXX,XX +XXX,XX @@ struct kvm_userspace_memory_region {
745
    __u64 userspace_addr; /* start of the userspace allocated memory */
746
};
747
748
+/* for KVM_SET_USER_MEMORY_REGION2 */
749
+struct kvm_userspace_memory_region2 {
750
+    __u32 slot;
751
+    __u32 flags;
752
+    __u64 guest_phys_addr;
753
+    __u64 memory_size;
754
+    __u64 userspace_addr;
755
+    __u64 guest_memfd_offset;
756
+    __u32 guest_memfd;
757
+    __u32 pad1;
758
+    __u64 pad2[14];
759
+};
760
+
761
/*
762
* The bit 0 ~ bit 15 of kvm_userspace_memory_region::flags are visible for
763
* userspace, other bits are reserved for kvm internal use which are defined
764
@@ -XXX,XX +XXX,XX @@ struct kvm_userspace_memory_region {
765
*/
766
#define KVM_MEM_LOG_DIRTY_PAGES    (1UL << 0)
767
#define KVM_MEM_READONLY    (1UL << 1)
768
+#define KVM_MEM_GUEST_MEMFD    (1UL << 2)
769
770
/* for KVM_IRQ_LINE */
771
struct kvm_irq_level {
772
@@ -XXX,XX +XXX,XX @@ struct kvm_xen_exit {
773
#define KVM_EXIT_RISCV_CSR 36
774
#define KVM_EXIT_NOTIFY 37
775
#define KVM_EXIT_LOONGARCH_IOCSR 38
776
+#define KVM_EXIT_MEMORY_FAULT 39
777
778
/* For KVM_EXIT_INTERNAL_ERROR */
779
/* Emulate instruction failed. */
780
@@ -XXX,XX +XXX,XX @@ struct kvm_run {
781
#define KVM_NOTIFY_CONTEXT_INVALID    (1 << 0)
782
            __u32 flags;
783
        } notify;
784
+        /* KVM_EXIT_MEMORY_FAULT */
785
+        struct {
786
+#define KVM_MEMORY_EXIT_FLAG_PRIVATE    (1ULL << 3)
787
+            __u64 flags;
788
+            __u64 gpa;
789
+            __u64 size;
790
+        } memory_fault;
791
        /* Fix the size of the union. */
792
        char padding[256];
793
    };
794
@@ -XXX,XX +XXX,XX @@ struct kvm_ppc_resize_hpt {
795
*/
796
#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */
797
#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2)
798
-#define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06
799
-#define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07
800
-#define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08
801
#define KVM_GET_EMULATED_CPUID     _IOWR(KVMIO, 0x09, struct kvm_cpuid2)
802
#define KVM_GET_MSR_FEATURE_INDEX_LIST _IOWR(KVMIO, 0x0a, struct kvm_msr_list)
803
804
@@ -XXX,XX +XXX,XX @@ struct kvm_ppc_resize_hpt {
805
#define KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE 228
806
#define KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES 229
807
#define KVM_CAP_ARM_SUPPORTED_REG_MASK_RANGES 230
808
+#define KVM_CAP_USER_MEMORY2 231
809
+#define KVM_CAP_MEMORY_FAULT_INFO 232
810
+#define KVM_CAP_MEMORY_ATTRIBUTES 233
811
+#define KVM_CAP_GUEST_MEMFD 234
812
+#define KVM_CAP_VM_TYPES 235
813
814
#ifdef KVM_CAP_IRQ_ROUTING
815
816
@@ -XXX,XX +XXX,XX @@ struct kvm_x86_mce {
817
#define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL    (1 << 4)
818
#define KVM_XEN_HVM_CONFIG_EVTCHN_SEND        (1 << 5)
819
#define KVM_XEN_HVM_CONFIG_RUNSTATE_UPDATE_FLAG    (1 << 6)
820
+#define KVM_XEN_HVM_CONFIG_PVCLOCK_TSC_UNSTABLE    (1 << 7)
821
822
struct kvm_xen_hvm_config {
823
    __u32 flags;
824
@@ -XXX,XX +XXX,XX @@ struct kvm_vfio_spapr_tce {
825
                    struct kvm_userspace_memory_region)
826
#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
827
#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
828
+#define KVM_SET_USER_MEMORY_REGION2 _IOW(KVMIO, 0x49, \
829
+                     struct kvm_userspace_memory_region2)
830
831
/* enable ucontrol for s390 */
832
struct kvm_s390_ucas_mapping {
833
@@ -XXX,XX +XXX,XX @@ struct kvm_s390_ucas_mapping {
834
            _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
835
#define KVM_UNREGISTER_COALESCED_MMIO \
836
            _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
837
-#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \
838
-                 struct kvm_assigned_pci_dev)
839
#define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing)
840
-/* deprecated, replaced by KVM_ASSIGN_DEV_IRQ */
841
-#define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70
842
-#define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq)
843
#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71)
844
-#define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \
845
-                 struct kvm_assigned_pci_dev)
846
-#define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, \
847
-                 struct kvm_assigned_msix_nr)
848
-#define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, \
849
-                 struct kvm_assigned_msix_entry)
850
-#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq)
851
#define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd)
852
#define KVM_CREATE_PIT2         _IOW(KVMIO, 0x77, struct kvm_pit_config)
853
#define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78)
854
@@ -XXX,XX +XXX,XX @@ struct kvm_s390_ucas_mapping {
855
* KVM_CAP_VM_TSC_CONTROL to set defaults for a VM */
856
#define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2)
857
#define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3)
858
-/* Available with KVM_CAP_PCI_2_3 */
859
-#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \
860
-                 struct kvm_assigned_pci_dev)
861
/* Available with KVM_CAP_SIGNAL_MSI */
862
#define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi)
863
/* Available with KVM_CAP_PPC_GET_SMMU_INFO */
864
@@ -XXX,XX +XXX,XX @@ struct kvm_s390_ucas_mapping {
865
#define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs)
866
#define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation)
867
#define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt)
868
-/* KVM_DEBUG_GUEST is no longer supported, use KVM_SET_GUEST_DEBUG instead */
869
-#define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87
870
#define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs)
871
#define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs)
872
#define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid)
873
@@ -XXX,XX +XXX,XX @@ struct kvm_s390_zpci_op {
874
/* flags for kvm_s390_zpci_op->u.reg_aen.flags */
875
#define KVM_S390_ZPCIOP_REGAEN_HOST (1 << 0)
876
877
+/* Available with KVM_CAP_MEMORY_ATTRIBUTES */
878
+#define KVM_SET_MEMORY_ATTRIBUTES _IOW(KVMIO, 0xd2, struct kvm_memory_attributes)
879
+
880
+struct kvm_memory_attributes {
881
+    __u64 address;
882
+    __u64 size;
883
+    __u64 attributes;
884
+    __u64 flags;
885
+};
886
+
887
+#define KVM_MEMORY_ATTRIBUTE_PRIVATE (1ULL << 3)
888
+
889
+#define KVM_CREATE_GUEST_MEMFD    _IOWR(KVMIO, 0xd4, struct kvm_create_guest_memfd)
890
+
891
+struct kvm_create_guest_memfd {
892
+    __u64 size;
893
+    __u64 flags;
894
+    __u64 reserved[6];
895
+};
896
+
897
#endif /* __LINUX_KVM_H */
898
diff --git a/linux-headers/linux/userfaultfd.h b/linux-headers/linux/userfaultfd.h
899
index XXXXXXX..XXXXXXX 100644
900
--- a/linux-headers/linux/userfaultfd.h
901
+++ b/linux-headers/linux/userfaultfd.h
902
@@ -XXX,XX +XXX,XX @@
903
             UFFD_FEATURE_WP_HUGETLBFS_SHMEM |    \
904
             UFFD_FEATURE_WP_UNPOPULATED |    \
905
             UFFD_FEATURE_POISON |        \
906
-             UFFD_FEATURE_WP_ASYNC)
907
+             UFFD_FEATURE_WP_ASYNC |        \
908
+             UFFD_FEATURE_MOVE)
909
#define UFFD_API_IOCTLS                \
910
    ((__u64)1 << _UFFDIO_REGISTER |        \
911
     (__u64)1 << _UFFDIO_UNREGISTER |    \
912
@@ -XXX,XX +XXX,XX @@
913
    ((__u64)1 << _UFFDIO_WAKE |        \
914
     (__u64)1 << _UFFDIO_COPY |        \
915
     (__u64)1 << _UFFDIO_ZEROPAGE |        \
916
+     (__u64)1 << _UFFDIO_MOVE |        \
917
     (__u64)1 << _UFFDIO_WRITEPROTECT |    \
918
     (__u64)1 << _UFFDIO_CONTINUE |        \
919
     (__u64)1 << _UFFDIO_POISON)
920
@@ -XXX,XX +XXX,XX @@
921
#define _UFFDIO_WAKE            (0x02)
922
#define _UFFDIO_COPY            (0x03)
923
#define _UFFDIO_ZEROPAGE        (0x04)
924
+#define _UFFDIO_MOVE            (0x05)
925
#define _UFFDIO_WRITEPROTECT        (0x06)
926
#define _UFFDIO_CONTINUE        (0x07)
927
#define _UFFDIO_POISON            (0x08)
928
@@ -XXX,XX +XXX,XX @@
929
                 struct uffdio_copy)
930
#define UFFDIO_ZEROPAGE        _IOWR(UFFDIO, _UFFDIO_ZEROPAGE,    \
931
                 struct uffdio_zeropage)
932
+#define UFFDIO_MOVE        _IOWR(UFFDIO, _UFFDIO_MOVE,    \
933
+                 struct uffdio_move)
934
#define UFFDIO_WRITEPROTECT    _IOWR(UFFDIO, _UFFDIO_WRITEPROTECT, \
935
                 struct uffdio_writeprotect)
936
#define UFFDIO_CONTINUE        _IOWR(UFFDIO, _UFFDIO_CONTINUE,    \
937
@@ -XXX,XX +XXX,XX @@ struct uffdio_api {
938
     * asynchronous mode is supported in which the write fault is
939
     * automatically resolved and write-protection is un-set.
940
     * It implies UFFD_FEATURE_WP_UNPOPULATED.
941
+     *
942
+     * UFFD_FEATURE_MOVE indicates that the kernel supports moving an
943
+     * existing page contents from userspace.
944
     */
945
#define UFFD_FEATURE_PAGEFAULT_FLAG_WP        (1<<0)
946
#define UFFD_FEATURE_EVENT_FORK            (1<<1)
947
@@ -XXX,XX +XXX,XX @@ struct uffdio_api {
948
#define UFFD_FEATURE_WP_UNPOPULATED        (1<<13)
949
#define UFFD_FEATURE_POISON            (1<<14)
950
#define UFFD_FEATURE_WP_ASYNC            (1<<15)
951
+#define UFFD_FEATURE_MOVE            (1<<16)
952
    __u64 features;
953
954
    __u64 ioctls;
955
@@ -XXX,XX +XXX,XX @@ struct uffdio_poison {
956
    __s64 updated;
957
};
958
959
+struct uffdio_move {
960
+    __u64 dst;
961
+    __u64 src;
962
+    __u64 len;
963
+    /*
964
+     * Especially if used to atomically remove memory from the
965
+     * address space the wake on the dst range is not needed.
966
+     */
967
+#define UFFDIO_MOVE_MODE_DONTWAKE        ((__u64)1<<0)
968
+#define UFFDIO_MOVE_MODE_ALLOW_SRC_HOLES    ((__u64)1<<1)
969
+    __u64 mode;
970
+    /*
971
+     * "move" is written by the ioctl and must be at the end: the
972
+     * copy_from_user will not read the last 8 bytes.
973
+     */
974
+    __s64 move;
975
+};
976
+
977
/*
978
* Flags for the userfaultfd(2) system call itself.
979
*/
980
diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
981
index XXXXXXX..XXXXXXX 100644
982
--- a/linux-headers/linux/vfio.h
983
+++ b/linux-headers/linux/vfio.h
984
@@ -XXX,XX +XXX,XX @@ enum vfio_device_mig_state {
985
    VFIO_DEVICE_STATE_RUNNING_P2P = 5,
986
    VFIO_DEVICE_STATE_PRE_COPY = 6,
987
    VFIO_DEVICE_STATE_PRE_COPY_P2P = 7,
988
+    VFIO_DEVICE_STATE_NR,
989
};
990
991
/**
992
--
993
2.44.0
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
The last KVM extensions added were back in 6.6. Sync them to Linux 6.8.
4
5
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
6
Acked-by: Alistair Francis <alistair.francis@wdc.com>
7
Message-ID: <20240304134732.386590-3-dbarboza@ventanamicro.com>
8
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
9
---
10
target/riscv/kvm/kvm-cpu.c | 29 +++++++++++++++++++++++++++++
11
1 file changed, 29 insertions(+)
12
13
diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/riscv/kvm/kvm-cpu.c
16
+++ b/target/riscv/kvm/kvm-cpu.c
17
@@ -XXX,XX +XXX,XX @@ static KVMCPUConfig kvm_multi_ext_cfgs[] = {
18
KVM_EXT_CFG("zicbom", ext_zicbom, KVM_RISCV_ISA_EXT_ZICBOM),
19
KVM_EXT_CFG("zicboz", ext_zicboz, KVM_RISCV_ISA_EXT_ZICBOZ),
20
KVM_EXT_CFG("zicntr", ext_zicntr, KVM_RISCV_ISA_EXT_ZICNTR),
21
+ KVM_EXT_CFG("zicond", ext_zicond, KVM_RISCV_ISA_EXT_ZICOND),
22
KVM_EXT_CFG("zicsr", ext_zicsr, KVM_RISCV_ISA_EXT_ZICSR),
23
KVM_EXT_CFG("zifencei", ext_zifencei, KVM_RISCV_ISA_EXT_ZIFENCEI),
24
+ KVM_EXT_CFG("zihintntl", ext_zihintntl, KVM_RISCV_ISA_EXT_ZIHINTNTL),
25
KVM_EXT_CFG("zihintpause", ext_zihintpause, KVM_RISCV_ISA_EXT_ZIHINTPAUSE),
26
KVM_EXT_CFG("zihpm", ext_zihpm, KVM_RISCV_ISA_EXT_ZIHPM),
27
+ KVM_EXT_CFG("zfa", ext_zfa, KVM_RISCV_ISA_EXT_ZFA),
28
+ KVM_EXT_CFG("zfh", ext_zfh, KVM_RISCV_ISA_EXT_ZFH),
29
+ KVM_EXT_CFG("zfhmin", ext_zfhmin, KVM_RISCV_ISA_EXT_ZFHMIN),
30
KVM_EXT_CFG("zba", ext_zba, KVM_RISCV_ISA_EXT_ZBA),
31
KVM_EXT_CFG("zbb", ext_zbb, KVM_RISCV_ISA_EXT_ZBB),
32
+ KVM_EXT_CFG("zbc", ext_zbc, KVM_RISCV_ISA_EXT_ZBC),
33
+ KVM_EXT_CFG("zbkb", ext_zbkb, KVM_RISCV_ISA_EXT_ZBKB),
34
+ KVM_EXT_CFG("zbkc", ext_zbkc, KVM_RISCV_ISA_EXT_ZBKC),
35
+ KVM_EXT_CFG("zbkx", ext_zbkx, KVM_RISCV_ISA_EXT_ZBKX),
36
KVM_EXT_CFG("zbs", ext_zbs, KVM_RISCV_ISA_EXT_ZBS),
37
+ KVM_EXT_CFG("zknd", ext_zknd, KVM_RISCV_ISA_EXT_ZKND),
38
+ KVM_EXT_CFG("zkne", ext_zkne, KVM_RISCV_ISA_EXT_ZKNE),
39
+ KVM_EXT_CFG("zknh", ext_zknh, KVM_RISCV_ISA_EXT_ZKNH),
40
+ KVM_EXT_CFG("zkr", ext_zkr, KVM_RISCV_ISA_EXT_ZKR),
41
+ KVM_EXT_CFG("zksed", ext_zksed, KVM_RISCV_ISA_EXT_ZKSED),
42
+ KVM_EXT_CFG("zksh", ext_zksh, KVM_RISCV_ISA_EXT_ZKSH),
43
+ KVM_EXT_CFG("zkt", ext_zkt, KVM_RISCV_ISA_EXT_ZKT),
44
+ KVM_EXT_CFG("zvbb", ext_zvbb, KVM_RISCV_ISA_EXT_ZVBB),
45
+ KVM_EXT_CFG("zvbc", ext_zvbc, KVM_RISCV_ISA_EXT_ZVBC),
46
+ KVM_EXT_CFG("zvfh", ext_zvfh, KVM_RISCV_ISA_EXT_ZVFH),
47
+ KVM_EXT_CFG("zvfhmin", ext_zvfhmin, KVM_RISCV_ISA_EXT_ZVFHMIN),
48
+ KVM_EXT_CFG("zvkb", ext_zvkb, KVM_RISCV_ISA_EXT_ZVKB),
49
+ KVM_EXT_CFG("zvkg", ext_zvkg, KVM_RISCV_ISA_EXT_ZVKG),
50
+ KVM_EXT_CFG("zvkned", ext_zvkned, KVM_RISCV_ISA_EXT_ZVKNED),
51
+ KVM_EXT_CFG("zvknha", ext_zvknha, KVM_RISCV_ISA_EXT_ZVKNHA),
52
+ KVM_EXT_CFG("zvknhb", ext_zvknhb, KVM_RISCV_ISA_EXT_ZVKNHB),
53
+ KVM_EXT_CFG("zvksed", ext_zvksed, KVM_RISCV_ISA_EXT_ZVKSED),
54
+ KVM_EXT_CFG("zvksh", ext_zvksh, KVM_RISCV_ISA_EXT_ZVKSH),
55
+ KVM_EXT_CFG("zvkt", ext_zvkt, KVM_RISCV_ISA_EXT_ZVKT),
56
+ KVM_EXT_CFG("smstateen", ext_smstateen, KVM_RISCV_ISA_EXT_SMSTATEEN),
57
KVM_EXT_CFG("ssaia", ext_ssaia, KVM_RISCV_ISA_EXT_SSAIA),
58
KVM_EXT_CFG("sstc", ext_sstc, KVM_RISCV_ISA_EXT_SSTC),
59
KVM_EXT_CFG("svinval", ext_svinval, KVM_RISCV_ISA_EXT_SVINVAL),
60
--
61
2.44.0
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
smaia and ssaia were ratified in August 25th 2023 [1].
4
5
zvfh and zvfhmin were ratified in August 2nd 2023 [2].
6
7
zfbfmin and zvfbf(min|wma) are frozen and moved to public review since
8
Dec 16th 2023 [3].
9
10
zaamo and zalrsc are both marked as "Frozen" since January 24th 2024
11
[4].
12
13
[1] https://jira.riscv.org/browse/RVS-438
14
[2] https://jira.riscv.org/browse/RVS-871
15
[3] https://jira.riscv.org/browse/RVS-704
16
[4] https://jira.riscv.org/browse/RVS-1995
17
18
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
19
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
20
Message-ID: <20240301144053.265964-1-dbarboza@ventanamicro.com>
21
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
22
---
23
target/riscv/cpu.c | 22 +++++++++-------------
24
1 file changed, 9 insertions(+), 13 deletions(-)
25
26
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
27
index XXXXXXX..XXXXXXX 100644
28
--- a/target/riscv/cpu.c
29
+++ b/target/riscv/cpu.c
30
@@ -XXX,XX +XXX,XX @@ const RISCVCPUMultiExtConfig riscv_cpu_extensions[] = {
31
MULTI_EXT_CFG_BOOL("zihintntl", ext_zihintntl, true),
32
MULTI_EXT_CFG_BOOL("zihintpause", ext_zihintpause, true),
33
MULTI_EXT_CFG_BOOL("zacas", ext_zacas, false),
34
+ MULTI_EXT_CFG_BOOL("zaamo", ext_zaamo, false),
35
+ MULTI_EXT_CFG_BOOL("zalrsc", ext_zalrsc, false),
36
MULTI_EXT_CFG_BOOL("zawrs", ext_zawrs, true),
37
MULTI_EXT_CFG_BOOL("zfa", ext_zfa, true),
38
+ MULTI_EXT_CFG_BOOL("zfbfmin", ext_zfbfmin, false),
39
MULTI_EXT_CFG_BOOL("zfh", ext_zfh, false),
40
MULTI_EXT_CFG_BOOL("zfhmin", ext_zfhmin, false),
41
MULTI_EXT_CFG_BOOL("zve32f", ext_zve32f, false),
42
MULTI_EXT_CFG_BOOL("zve64f", ext_zve64f, false),
43
MULTI_EXT_CFG_BOOL("zve64d", ext_zve64d, false),
44
+ MULTI_EXT_CFG_BOOL("zvfbfmin", ext_zvfbfmin, false),
45
+ MULTI_EXT_CFG_BOOL("zvfbfwma", ext_zvfbfwma, false),
46
+ MULTI_EXT_CFG_BOOL("zvfh", ext_zvfh, false),
47
+ MULTI_EXT_CFG_BOOL("zvfhmin", ext_zvfhmin, false),
48
MULTI_EXT_CFG_BOOL("sstc", ext_sstc, true),
49
50
+ MULTI_EXT_CFG_BOOL("smaia", ext_smaia, false),
51
MULTI_EXT_CFG_BOOL("smepmp", ext_smepmp, false),
52
MULTI_EXT_CFG_BOOL("smstateen", ext_smstateen, false),
53
+ MULTI_EXT_CFG_BOOL("ssaia", ext_ssaia, false),
54
MULTI_EXT_CFG_BOOL("svade", ext_svade, false),
55
MULTI_EXT_CFG_BOOL("svadu", ext_svadu, true),
56
MULTI_EXT_CFG_BOOL("svinval", ext_svinval, false),
57
@@ -XXX,XX +XXX,XX @@ const RISCVCPUMultiExtConfig riscv_cpu_vendor_exts[] = {
58
59
/* These are experimental so mark with 'x-' */
60
const RISCVCPUMultiExtConfig riscv_cpu_experimental_exts[] = {
61
- MULTI_EXT_CFG_BOOL("x-smaia", ext_smaia, false),
62
- MULTI_EXT_CFG_BOOL("x-ssaia", ext_ssaia, false),
63
-
64
- MULTI_EXT_CFG_BOOL("x-zaamo", ext_zaamo, false),
65
- MULTI_EXT_CFG_BOOL("x-zalrsc", ext_zalrsc, false),
66
-
67
- MULTI_EXT_CFG_BOOL("x-zvfh", ext_zvfh, false),
68
- MULTI_EXT_CFG_BOOL("x-zvfhmin", ext_zvfhmin, false),
69
-
70
- MULTI_EXT_CFG_BOOL("x-zfbfmin", ext_zfbfmin, false),
71
- MULTI_EXT_CFG_BOOL("x-zvfbfmin", ext_zvfbfmin, false),
72
- MULTI_EXT_CFG_BOOL("x-zvfbfwma", ext_zvfbfwma, false),
73
-
74
DEFINE_PROP_END_OF_LIST(),
75
};
76
77
--
78
2.44.0
diff view generated by jsdifflib
New patch
1
From: Vadim Shakirov <vadim.shakirov@syntacore.com>
1
2
3
mcountinhibit, mcounteren, scounteren and hcounteren must always be 32-bit
4
by privileged spec
5
6
Signed-off-by: Vadim Shakirov <vadim.shakirov@syntacore.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
9
Message-ID: <20240202113919.18236-1-vadim.shakirov@syntacore.com>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
12
target/riscv/cpu.h | 8 ++++----
13
target/riscv/machine.c | 16 ++++++++--------
14
2 files changed, 12 insertions(+), 12 deletions(-)
15
16
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/riscv/cpu.h
19
+++ b/target/riscv/cpu.h
20
@@ -XXX,XX +XXX,XX @@ struct CPUArchState {
21
target_ulong hstatus;
22
target_ulong hedeleg;
23
uint64_t hideleg;
24
- target_ulong hcounteren;
25
+ uint32_t hcounteren;
26
target_ulong htval;
27
target_ulong htinst;
28
target_ulong hgatp;
29
@@ -XXX,XX +XXX,XX @@ struct CPUArchState {
30
*/
31
bool two_stage_indirect_lookup;
32
33
- target_ulong scounteren;
34
- target_ulong mcounteren;
35
+ uint32_t scounteren;
36
+ uint32_t mcounteren;
37
38
- target_ulong mcountinhibit;
39
+ uint32_t mcountinhibit;
40
41
/* PMU counter state */
42
PMUCTRState pmu_ctrs[RV_MAX_MHPMCOUNTERS];
43
diff --git a/target/riscv/machine.c b/target/riscv/machine.c
44
index XXXXXXX..XXXXXXX 100644
45
--- a/target/riscv/machine.c
46
+++ b/target/riscv/machine.c
47
@@ -XXX,XX +XXX,XX @@ static bool hyper_needed(void *opaque)
48
49
static const VMStateDescription vmstate_hyper = {
50
.name = "cpu/hyper",
51
- .version_id = 3,
52
- .minimum_version_id = 3,
53
+ .version_id = 4,
54
+ .minimum_version_id = 4,
55
.needed = hyper_needed,
56
.fields = (const VMStateField[]) {
57
VMSTATE_UINTTL(env.hstatus, RISCVCPU),
58
VMSTATE_UINTTL(env.hedeleg, RISCVCPU),
59
VMSTATE_UINT64(env.hideleg, RISCVCPU),
60
- VMSTATE_UINTTL(env.hcounteren, RISCVCPU),
61
+ VMSTATE_UINT32(env.hcounteren, RISCVCPU),
62
VMSTATE_UINTTL(env.htval, RISCVCPU),
63
VMSTATE_UINTTL(env.htinst, RISCVCPU),
64
VMSTATE_UINTTL(env.hgatp, RISCVCPU),
65
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_jvt = {
66
67
const VMStateDescription vmstate_riscv_cpu = {
68
.name = "cpu",
69
- .version_id = 9,
70
- .minimum_version_id = 9,
71
+ .version_id = 10,
72
+ .minimum_version_id = 10,
73
.post_load = riscv_cpu_post_load,
74
.fields = (const VMStateField[]) {
75
VMSTATE_UINTTL_ARRAY(env.gpr, RISCVCPU, 32),
76
@@ -XXX,XX +XXX,XX @@ const VMStateDescription vmstate_riscv_cpu = {
77
VMSTATE_UINTTL(env.mtval, RISCVCPU),
78
VMSTATE_UINTTL(env.miselect, RISCVCPU),
79
VMSTATE_UINTTL(env.siselect, RISCVCPU),
80
- VMSTATE_UINTTL(env.scounteren, RISCVCPU),
81
- VMSTATE_UINTTL(env.mcounteren, RISCVCPU),
82
- VMSTATE_UINTTL(env.mcountinhibit, RISCVCPU),
83
+ VMSTATE_UINT32(env.scounteren, RISCVCPU),
84
+ VMSTATE_UINT32(env.mcounteren, RISCVCPU),
85
+ VMSTATE_UINT32(env.mcountinhibit, RISCVCPU),
86
VMSTATE_STRUCT_ARRAY(env.pmu_ctrs, RISCVCPU, RV_MAX_MHPMCOUNTERS, 0,
87
vmstate_pmu_ctr_state, PMUCTRState),
88
VMSTATE_UINTTL_ARRAY(env.mhpmevent_val, RISCVCPU, RV_MAX_MHPMEVENTS),
89
--
90
2.44.0
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
While discussing a problem with how we're (not) setting vstart_eq_zero
4
Richard had the following to say w.r.t the conditional mark_vs_dirty()
5
calls on load/store functions [1]:
6
7
"I think it's required to have stores set dirty unconditionally, before
8
the operation.
9
10
Consider a store that traps on the 2nd element, leaving vstart = 2, and
11
exiting to the main loop via exception. The exception enters the kernel
12
page fault handler. The kernel may need to fault in the page for the
13
process, and in the meantime task switch.
14
15
If vs dirty is not already set, the kernel won't know to save vector
16
state on task switch."
17
18
Do a mark_vs_dirty() before both loads and stores.
19
20
[1] https://lore.kernel.org/qemu-riscv/72c7503b-0f43-44b8-aa82-fbafed2aac0c@linaro.org/
21
22
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
23
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
24
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
25
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
26
Message-ID: <20240306171932.549549-2-dbarboza@ventanamicro.com>
27
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
28
---
29
target/riscv/insn_trans/trans_rvv.c.inc | 23 ++++++++---------------
30
1 file changed, 8 insertions(+), 15 deletions(-)
31
32
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/riscv/insn_trans/trans_rvv.c.inc
35
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
36
@@ -XXX,XX +XXX,XX @@ static bool ldst_us_trans(uint32_t vd, uint32_t rs1, uint32_t data,
37
tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL);
38
}
39
40
+ mark_vs_dirty(s);
41
+
42
fn(dest, mask, base, tcg_env, desc);
43
44
if (!is_store && s->ztso) {
45
tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ);
46
}
47
48
- if (!is_store) {
49
- mark_vs_dirty(s);
50
- }
51
-
52
gen_set_label(over);
53
return true;
54
}
55
@@ -XXX,XX +XXX,XX @@ static bool ldst_stride_trans(uint32_t vd, uint32_t rs1, uint32_t rs2,
56
tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, vd));
57
tcg_gen_addi_ptr(mask, tcg_env, vreg_ofs(s, 0));
58
59
- fn(dest, mask, base, stride, tcg_env, desc);
60
+ mark_vs_dirty(s);
61
62
- if (!is_store) {
63
- mark_vs_dirty(s);
64
- }
65
+ fn(dest, mask, base, stride, tcg_env, desc);
66
67
gen_set_label(over);
68
return true;
69
@@ -XXX,XX +XXX,XX @@ static bool ldst_index_trans(uint32_t vd, uint32_t rs1, uint32_t vs2,
70
tcg_gen_addi_ptr(index, tcg_env, vreg_ofs(s, vs2));
71
tcg_gen_addi_ptr(mask, tcg_env, vreg_ofs(s, 0));
72
73
- fn(dest, mask, base, index, tcg_env, desc);
74
+ mark_vs_dirty(s);
75
76
- if (!is_store) {
77
- mark_vs_dirty(s);
78
- }
79
+ fn(dest, mask, base, index, tcg_env, desc);
80
81
gen_set_label(over);
82
return true;
83
@@ -XXX,XX +XXX,XX @@ static bool ldst_whole_trans(uint32_t vd, uint32_t rs1, uint32_t nf,
84
base = get_gpr(s, rs1, EXT_NONE);
85
tcg_gen_addi_ptr(dest, tcg_env, vreg_ofs(s, vd));
86
87
+ mark_vs_dirty(s);
88
+
89
fn(dest, base, tcg_env, desc);
90
91
- if (!is_store) {
92
- mark_vs_dirty(s);
93
- }
94
gen_set_label(over);
95
96
return true;
97
--
98
2.44.0
diff view generated by jsdifflib
New patch
1
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
1
2
3
After the 'mark_vs_dirty' changes from the previous patch the 'is_store'
4
bool is unused in some load/store functions that were changed. Remove it.
5
6
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-ID: <20240306171932.549549-3-dbarboza@ventanamicro.com>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
---
13
target/riscv/insn_trans/trans_rvv.c.inc | 58 ++++++++++++-------------
14
1 file changed, 29 insertions(+), 29 deletions(-)
15
16
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/riscv/insn_trans/trans_rvv.c.inc
19
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
20
@@ -XXX,XX +XXX,XX @@ typedef void gen_helper_ldst_stride(TCGv_ptr, TCGv_ptr, TCGv,
21
22
static bool ldst_stride_trans(uint32_t vd, uint32_t rs1, uint32_t rs2,
23
uint32_t data, gen_helper_ldst_stride *fn,
24
- DisasContext *s, bool is_store)
25
+ DisasContext *s)
26
{
27
TCGv_ptr dest, mask;
28
TCGv base, stride;
29
@@ -XXX,XX +XXX,XX @@ static bool ld_stride_op(DisasContext *s, arg_rnfvm *a, uint8_t eew)
30
data = FIELD_DP32(data, VDATA, NF, a->nf);
31
data = FIELD_DP32(data, VDATA, VTA, s->vta);
32
data = FIELD_DP32(data, VDATA, VMA, s->vma);
33
- return ldst_stride_trans(a->rd, a->rs1, a->rs2, data, fn, s, false);
34
+ return ldst_stride_trans(a->rd, a->rs1, a->rs2, data, fn, s);
35
}
36
37
static bool ld_stride_check(DisasContext *s, arg_rnfvm* a, uint8_t eew)
38
@@ -XXX,XX +XXX,XX @@ static bool st_stride_op(DisasContext *s, arg_rnfvm *a, uint8_t eew)
39
return false;
40
}
41
42
- return ldst_stride_trans(a->rd, a->rs1, a->rs2, data, fn, s, true);
43
+ return ldst_stride_trans(a->rd, a->rs1, a->rs2, data, fn, s);
44
}
45
46
static bool st_stride_check(DisasContext *s, arg_rnfvm* a, uint8_t eew)
47
@@ -XXX,XX +XXX,XX @@ typedef void gen_helper_ldst_index(TCGv_ptr, TCGv_ptr, TCGv,
48
49
static bool ldst_index_trans(uint32_t vd, uint32_t rs1, uint32_t vs2,
50
uint32_t data, gen_helper_ldst_index *fn,
51
- DisasContext *s, bool is_store)
52
+ DisasContext *s)
53
{
54
TCGv_ptr dest, mask, index;
55
TCGv base;
56
@@ -XXX,XX +XXX,XX @@ static bool ld_index_op(DisasContext *s, arg_rnfvm *a, uint8_t eew)
57
data = FIELD_DP32(data, VDATA, NF, a->nf);
58
data = FIELD_DP32(data, VDATA, VTA, s->vta);
59
data = FIELD_DP32(data, VDATA, VMA, s->vma);
60
- return ldst_index_trans(a->rd, a->rs1, a->rs2, data, fn, s, false);
61
+ return ldst_index_trans(a->rd, a->rs1, a->rs2, data, fn, s);
62
}
63
64
static bool ld_index_check(DisasContext *s, arg_rnfvm* a, uint8_t eew)
65
@@ -XXX,XX +XXX,XX @@ static bool st_index_op(DisasContext *s, arg_rnfvm *a, uint8_t eew)
66
data = FIELD_DP32(data, VDATA, VM, a->vm);
67
data = FIELD_DP32(data, VDATA, LMUL, emul);
68
data = FIELD_DP32(data, VDATA, NF, a->nf);
69
- return ldst_index_trans(a->rd, a->rs1, a->rs2, data, fn, s, true);
70
+ return ldst_index_trans(a->rd, a->rs1, a->rs2, data, fn, s);
71
}
72
73
static bool st_index_check(DisasContext *s, arg_rnfvm* a, uint8_t eew)
74
@@ -XXX,XX +XXX,XX @@ typedef void gen_helper_ldst_whole(TCGv_ptr, TCGv, TCGv_env, TCGv_i32);
75
76
static bool ldst_whole_trans(uint32_t vd, uint32_t rs1, uint32_t nf,
77
uint32_t width, gen_helper_ldst_whole *fn,
78
- DisasContext *s, bool is_store)
79
+ DisasContext *s)
80
{
81
uint32_t evl = s->cfg_ptr->vlenb * nf / width;
82
TCGLabel *over = gen_new_label();
83
@@ -XXX,XX +XXX,XX @@ static bool ldst_whole_trans(uint32_t vd, uint32_t rs1, uint32_t nf,
84
* load and store whole register instructions ignore vtype and vl setting.
85
* Thus, we don't need to check vill bit. (Section 7.9)
86
*/
87
-#define GEN_LDST_WHOLE_TRANS(NAME, ARG_NF, WIDTH, IS_STORE) \
88
+#define GEN_LDST_WHOLE_TRANS(NAME, ARG_NF, WIDTH) \
89
static bool trans_##NAME(DisasContext *s, arg_##NAME * a) \
90
{ \
91
if (require_rvv(s) && \
92
QEMU_IS_ALIGNED(a->rd, ARG_NF)) { \
93
return ldst_whole_trans(a->rd, a->rs1, ARG_NF, WIDTH, \
94
- gen_helper_##NAME, s, IS_STORE); \
95
+ gen_helper_##NAME, s); \
96
} \
97
return false; \
98
}
99
100
-GEN_LDST_WHOLE_TRANS(vl1re8_v, 1, 1, false)
101
-GEN_LDST_WHOLE_TRANS(vl1re16_v, 1, 2, false)
102
-GEN_LDST_WHOLE_TRANS(vl1re32_v, 1, 4, false)
103
-GEN_LDST_WHOLE_TRANS(vl1re64_v, 1, 8, false)
104
-GEN_LDST_WHOLE_TRANS(vl2re8_v, 2, 1, false)
105
-GEN_LDST_WHOLE_TRANS(vl2re16_v, 2, 2, false)
106
-GEN_LDST_WHOLE_TRANS(vl2re32_v, 2, 4, false)
107
-GEN_LDST_WHOLE_TRANS(vl2re64_v, 2, 8, false)
108
-GEN_LDST_WHOLE_TRANS(vl4re8_v, 4, 1, false)
109
-GEN_LDST_WHOLE_TRANS(vl4re16_v, 4, 2, false)
110
-GEN_LDST_WHOLE_TRANS(vl4re32_v, 4, 4, false)
111
-GEN_LDST_WHOLE_TRANS(vl4re64_v, 4, 8, false)
112
-GEN_LDST_WHOLE_TRANS(vl8re8_v, 8, 1, false)
113
-GEN_LDST_WHOLE_TRANS(vl8re16_v, 8, 2, false)
114
-GEN_LDST_WHOLE_TRANS(vl8re32_v, 8, 4, false)
115
-GEN_LDST_WHOLE_TRANS(vl8re64_v, 8, 8, false)
116
+GEN_LDST_WHOLE_TRANS(vl1re8_v, 1, 1)
117
+GEN_LDST_WHOLE_TRANS(vl1re16_v, 1, 2)
118
+GEN_LDST_WHOLE_TRANS(vl1re32_v, 1, 4)
119
+GEN_LDST_WHOLE_TRANS(vl1re64_v, 1, 8)
120
+GEN_LDST_WHOLE_TRANS(vl2re8_v, 2, 1)
121
+GEN_LDST_WHOLE_TRANS(vl2re16_v, 2, 2)
122
+GEN_LDST_WHOLE_TRANS(vl2re32_v, 2, 4)
123
+GEN_LDST_WHOLE_TRANS(vl2re64_v, 2, 8)
124
+GEN_LDST_WHOLE_TRANS(vl4re8_v, 4, 1)
125
+GEN_LDST_WHOLE_TRANS(vl4re16_v, 4, 2)
126
+GEN_LDST_WHOLE_TRANS(vl4re32_v, 4, 4)
127
+GEN_LDST_WHOLE_TRANS(vl4re64_v, 4, 8)
128
+GEN_LDST_WHOLE_TRANS(vl8re8_v, 8, 1)
129
+GEN_LDST_WHOLE_TRANS(vl8re16_v, 8, 2)
130
+GEN_LDST_WHOLE_TRANS(vl8re32_v, 8, 4)
131
+GEN_LDST_WHOLE_TRANS(vl8re64_v, 8, 8)
132
133
/*
134
* The vector whole register store instructions are encoded similar to
135
* unmasked unit-stride store of elements with EEW=8.
136
*/
137
-GEN_LDST_WHOLE_TRANS(vs1r_v, 1, 1, true)
138
-GEN_LDST_WHOLE_TRANS(vs2r_v, 2, 1, true)
139
-GEN_LDST_WHOLE_TRANS(vs4r_v, 4, 1, true)
140
-GEN_LDST_WHOLE_TRANS(vs8r_v, 8, 1, true)
141
+GEN_LDST_WHOLE_TRANS(vs1r_v, 1, 1)
142
+GEN_LDST_WHOLE_TRANS(vs2r_v, 2, 1)
143
+GEN_LDST_WHOLE_TRANS(vs4r_v, 4, 1)
144
+GEN_LDST_WHOLE_TRANS(vs8r_v, 8, 1)
145
146
/*
147
*** Vector Integer Arithmetic Instructions
148
--
149
2.44.0
150
151
diff view generated by jsdifflib
New patch
1
From: "demin.han" <demin.han@starfivetech.com>
1
2
3
The result of (8 - 3 - vlmul) is negative when vlmul >= 6,
4
and results in wrong vill.
5
6
Signed-off-by: demin.han <demin.han@starfivetech.com>
7
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
8
Message-ID: <20240225174114.5298-1-demin.han@starfivetech.com>
9
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
10
---
11
target/riscv/vector_helper.c | 5 ++---
12
1 file changed, 2 insertions(+), 3 deletions(-)
13
14
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/riscv/vector_helper.c
17
+++ b/target/riscv/vector_helper.c
18
@@ -XXX,XX +XXX,XX @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ulong s1,
19
target_ulong reserved = s2 &
20
MAKE_64BIT_MASK(R_VTYPE_RESERVED_SHIFT,
21
xlen - 1 - R_VTYPE_RESERVED_SHIFT);
22
+ uint16_t vlen = cpu->cfg.vlenb << 3;
23
int8_t lmul;
24
25
if (vlmul & 4) {
26
@@ -XXX,XX +XXX,XX @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ulong s1,
27
* VLEN * LMUL >= SEW
28
* VLEN >> (8 - lmul) >= sew
29
* (vlenb << 3) >> (8 - lmul) >= sew
30
- * vlenb >> (8 - 3 - lmul) >= sew
31
*/
32
- if (vlmul == 4 ||
33
- cpu->cfg.vlenb >> (8 - 3 - vlmul) < sew) {
34
+ if (vlmul == 4 || (vlen >> (8 - vlmul)) < sew) {
35
vill = true;
36
}
37
}
38
--
39
2.44.0
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
From: Anup Patel <apatel@ventanamicro.com>
2
2
3
Configuring a drive with "if=none" is meant for creation of a backend
3
The writes to setipnum_le register in APLIC MSI-mode have special
4
only, it should not get automatically assigned to a device frontend.
4
consideration for level-triggered interrupts as-per section "4.9.2
5
Use "if=pflash" for the One-Time-Programmable device instead (like
5
Special consideration for level-sensitive interrupt sources" of the
6
it is e.g. also done for the efuse device in hw/arm/xlnx-zcu102.c).
6
RISC-V AIA specification.
7
7
8
Since the old way of configuring the device has already been published
8
Particularly, the below text from the RISC-V specification defines
9
with the previous QEMU versions, we cannot remove this immediately, but
9
the behaviour of writes to setipnum_le for level-triggered interrupts:
10
have to deprecate it and support it for at least two more releases.
11
10
12
Signed-off-by: Thomas Huth <thuth@redhat.com>
11
"A second option is for the interrupt service routine to write the
13
Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
12
APLIC’s source identity number for the interrupt to the domain’s
14
Reviewed-by: Markus Armbruster <armbru@redhat.com>
13
setipnum register just before exiting. This will cause the interrupt’s
15
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
pending bit to be set to one again if the source is still asserting
16
Message-id: 20211119102549.217755-1-thuth@redhat.com
15
an interrupt, but not if the source is not asserting an interrupt."
16
17
Fix setipnum_le write emulation for APLIC MSI-mode by implementing
18
the above behaviour in riscv_aplic_set_pending() function.
19
20
Fixes: e8f79343cfc8 ("hw/intc: Add RISC-V AIA APLIC device emulation")
21
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
22
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
23
Message-ID: <20240306095722.463296-2-apatel@ventanamicro.com>
17
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
24
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
18
---
25
---
19
docs/about/deprecated.rst | 6 ++++++
26
hw/intc/riscv_aplic.c | 20 ++++++++++++++++----
20
hw/misc/sifive_u_otp.c | 9 ++++++++-
27
1 file changed, 16 insertions(+), 4 deletions(-)
21
2 files changed, 14 insertions(+), 1 deletion(-)
22
28
23
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
29
diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
24
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
25
--- a/docs/about/deprecated.rst
31
--- a/hw/intc/riscv_aplic.c
26
+++ b/docs/about/deprecated.rst
32
+++ b/hw/intc/riscv_aplic.c
27
@@ -XXX,XX +XXX,XX @@ as short-form boolean values, and passed to plugins as ``arg_name=on``.
33
@@ -XXX,XX +XXX,XX @@ static void riscv_aplic_set_pending(RISCVAPLICState *aplic,
28
However, short-form booleans are deprecated and full explicit ``arg_name=on``
34
}
29
form is preferred.
35
30
36
sm = sourcecfg & APLIC_SOURCECFG_SM_MASK;
31
+``-drive if=none`` for the sifive_u OTP device (since 6.2)
37
- if ((sm == APLIC_SOURCECFG_SM_INACTIVE) ||
32
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
38
- ((!aplic->msimode || (aplic->msimode && !pending)) &&
33
+
39
- ((sm == APLIC_SOURCECFG_SM_LEVEL_HIGH) ||
34
+Using ``-drive if=none`` to configure the OTP device of the sifive_u
40
- (sm == APLIC_SOURCECFG_SM_LEVEL_LOW)))) {
35
+RISC-V machine is deprecated. Use ``-drive if=pflash`` instead.
41
+ if (sm == APLIC_SOURCECFG_SM_INACTIVE) {
36
+
42
return;
37
43
}
38
QEMU Machine Protocol (QMP) commands
44
39
------------------------------------
45
+ if ((sm == APLIC_SOURCECFG_SM_LEVEL_HIGH) ||
40
diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
46
+ (sm == APLIC_SOURCECFG_SM_LEVEL_LOW)) {
41
index XXXXXXX..XXXXXXX 100644
47
+ if (!aplic->msimode || (aplic->msimode && !pending)) {
42
--- a/hw/misc/sifive_u_otp.c
48
+ return;
43
+++ b/hw/misc/sifive_u_otp.c
49
+ }
44
@@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp)
50
+ if ((aplic->state[irq] & APLIC_ISTATE_INPUT) &&
45
TYPE_SIFIVE_U_OTP, SIFIVE_U_OTP_REG_SIZE);
51
+ (sm == APLIC_SOURCECFG_SM_LEVEL_LOW)) {
46
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio);
52
+ return;
47
53
+ }
48
- dinfo = drive_get_next(IF_NONE);
54
+ if (!(aplic->state[irq] & APLIC_ISTATE_INPUT) &&
49
+ dinfo = drive_get_next(IF_PFLASH);
55
+ (sm == APLIC_SOURCECFG_SM_LEVEL_HIGH)) {
50
+ if (!dinfo) {
56
+ return;
51
+ dinfo = drive_get_next(IF_NONE);
52
+ if (dinfo) {
53
+ warn_report("using \"-drive if=none\" for the OTP is deprecated, "
54
+ "use \"-drive if=pflash\" instead.");
55
+ }
57
+ }
56
+ }
58
+ }
57
if (dinfo) {
59
+
58
int ret;
60
riscv_aplic_set_pending_raw(aplic, irq, pending);
59
uint64_t perm;
61
}
62
60
--
63
--
61
2.31.1
64
2.44.0
62
65
63
66
diff view generated by jsdifflib
New patch
1
From: Anup Patel <apatel@ventanamicro.com>
1
2
3
The reads to in_clrip[x] registers return rectified input values of the
4
interrupt sources.
5
6
A rectified input value of an interrupt source is defined by the section
7
"4.5.2 Source configurations (sourcecfg[1]–sourcecfg[1023])" of the RISC-V
8
AIA specification as:
9
"rectified input value = (incoming wire value) XOR (source is inverted)"
10
11
Update the riscv_aplic_read_input_word() implementation to match the above.
12
13
Fixes: e8f79343cfc8 ("hw/intc: Add RISC-V AIA APLIC device emulation")
14
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
15
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
16
Message-ID: <20240306095722.463296-3-apatel@ventanamicro.com>
17
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
18
---
19
hw/intc/riscv_aplic.c | 17 +++++++++++++++--
20
1 file changed, 15 insertions(+), 2 deletions(-)
21
22
diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/intc/riscv_aplic.c
25
+++ b/hw/intc/riscv_aplic.c
26
@@ -XXX,XX +XXX,XX @@ static bool is_kvm_aia(bool msimode)
27
static uint32_t riscv_aplic_read_input_word(RISCVAPLICState *aplic,
28
uint32_t word)
29
{
30
- uint32_t i, irq, ret = 0;
31
+ uint32_t i, irq, sourcecfg, sm, raw_input, irq_inverted, ret = 0;
32
33
for (i = 0; i < 32; i++) {
34
irq = word * 32 + i;
35
@@ -XXX,XX +XXX,XX @@ static uint32_t riscv_aplic_read_input_word(RISCVAPLICState *aplic,
36
continue;
37
}
38
39
- ret |= ((aplic->state[irq] & APLIC_ISTATE_INPUT) ? 1 : 0) << i;
40
+ sourcecfg = aplic->sourcecfg[irq];
41
+ if (sourcecfg & APLIC_SOURCECFG_D) {
42
+ continue;
43
+ }
44
+
45
+ sm = sourcecfg & APLIC_SOURCECFG_SM_MASK;
46
+ if (sm == APLIC_SOURCECFG_SM_INACTIVE) {
47
+ continue;
48
+ }
49
+
50
+ raw_input = (aplic->state[irq] & APLIC_ISTATE_INPUT) ? 1 : 0;
51
+ irq_inverted = (sm == APLIC_SOURCECFG_SM_LEVEL_LOW ||
52
+ sm == APLIC_SOURCECFG_SM_EDGE_FALL) ? 1 : 0;
53
+ ret |= (raw_input ^ irq_inverted) << i;
54
}
55
56
return ret;
57
--
58
2.44.0
59
60
diff view generated by jsdifflib
New patch
1
From: Hiroaki Yamamoto <hrak1529@gmail.com>
1
2
3
G-stage translation should be considered to be user-level access in
4
riscv_cpu_get_phys_page_debug(), as already done in riscv_cpu_tlb_fill().
5
6
This fixes a bug that prevents gdb from reading memory while the VM is
7
running in VS-mode.
8
9
Signed-off-by: Hiroaki Yamamoto <hrak1529@gmail.com>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-ID: <20240228081028.35081-1-hrak1529@gmail.com>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
---
14
target/riscv/cpu_helper.c | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
16
17
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/riscv/cpu_helper.c
20
+++ b/target/riscv/cpu_helper.c
21
@@ -XXX,XX +XXX,XX @@ hwaddr riscv_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
22
23
if (env->virt_enabled) {
24
if (get_physical_address(env, &phys_addr, &prot, phys_addr, NULL,
25
- 0, mmu_idx, false, true, true)) {
26
+ 0, MMUIdx_U, false, true, true)) {
27
return -1;
28
}
29
}
30
--
31
2.44.0
diff view generated by jsdifflib
New patch
1
From: Ilya Chugin <danger_mail@list.ru>
1
2
3
MCFG segments should point to PCI configuration range, not BAR MMIO.
4
5
Signed-off-by: Ilya Chugin <danger_mail@list.ru>
6
Fixes: 55ecd83b36 ("hw/riscv/virt-acpi-build.c: Add IO controllers and devices")
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
9
Message-ID: <180d236d-c8e4-411a-b4d2-632eb82092fa@list.ru>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
12
hw/riscv/virt-acpi-build.c | 4 ++--
13
1 file changed, 2 insertions(+), 2 deletions(-)
14
15
diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/riscv/virt-acpi-build.c
18
+++ b/hw/riscv/virt-acpi-build.c
19
@@ -XXX,XX +XXX,XX @@ static void virt_acpi_build(RISCVVirtState *s, AcpiBuildTables *tables)
20
acpi_add_table(table_offsets, tables_blob);
21
{
22
AcpiMcfgInfo mcfg = {
23
- .base = s->memmap[VIRT_PCIE_MMIO].base,
24
- .size = s->memmap[VIRT_PCIE_MMIO].size,
25
+ .base = s->memmap[VIRT_PCIE_ECAM].base,
26
+ .size = s->memmap[VIRT_PCIE_ECAM].size,
27
};
28
build_mcfg(tables_blob, tables->linker, &mcfg, s->oem_id,
29
s->oem_table_id);
30
--
31
2.44.0
32
33
diff view generated by jsdifflib