Skip to contentSkip to conversation

Support RISC-V IOPMP

PATCH Superseded Ethan Chen via 3 participants 15 messages Nov 2, 2023 – Nov 8, 2023

Subsystems (2)

v2 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v2 cover Support RISC-V IOPMP

This series implements IOPMP specification v1.0.0-draft4 rapid-k model.

When IOPMP is enabled, a DMA device ATCDMAC300 is added to RISC-V virt platform. This DMA devce is connected to the IOPMP and has the functionalities required by IOPMP, including:
- Support specify source-id (SID)
- Support asynchronous I/O to handle stall transcations

IOPMP takes a transaction which partially match an entry as a partially hit error. The transaction size is depending on source device, destination device and bus.

As v1 disccussion, new iommu translate_size() function is not suitable because the size may be modified in previos stage.

In addtion to SID, start address and end address are also added to MemTxAttrs in v2. IOPMP matches transaction to an entry with those attributes.

Changes for v2:

- Add iopmp_start_addr and iopmp_end_addr to MemTxAttrs.
- Remove translate_size().
- IOPMP: Get transaction info in attrs_to_index instead of using translate_size().
- IOPMP: Fix some partially hit transactions are not detected.
- ATCDMAC300: Fix write stall is not resumed correctly.
- ATCDMAC300: Fix some partially hit errors are not detected.

Ethan Chen (4):
exec/memattrs: Add iopmp source id, start address, end address to
MemTxAttrs
Add RISC-V IOPMP support
hw/dma: Add Andes ATCDMAC300 support
hw/riscv/virt: Add IOPMP support

 hw/dma/Kconfig                |   3 +
 hw/dma/atcdmac300.c           | 460 +++++++++++++++++
 hw/dma/meson.build            |   1 +
 hw/misc/Kconfig               |   3 +
 hw/misc/meson.build           |   1 +
 hw/misc/riscv_iopmp.c         | 902 ++++++++++++++++++++++++++++++++++
 hw/riscv/Kconfig              |   2 +
 hw/riscv/virt.c               |  68 +++
 include/exec/memattrs.h       |   6 +
 include/hw/dma/atcdmac300.h   | 171 +++++++
 include/hw/misc/riscv_iopmp.h | 330 +++++++++++++
 include/hw/riscv/virt.h       |  10 +-
 12 files changed, 1956 insertions(+), 1 deletion(-)
 create mode 100644 hw/dma/atcdmac300.c
 create mode 100644 hw/misc/riscv_iopmp.c
 create mode 100644 include/hw/dma/atcdmac300.h
 create mode 100644 include/hw/misc/riscv_iopmp.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/4 exec/memattrs: Add iopmp source id, start address, end address to MemTxAttrs

---
 include/exec/memattrs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/exec/memattrs.h +6 -0
index d04170aa27..fc15e5d7d3 100644
@@ -64,6 +64,12 @@ typedef struct MemTxAttrs {
     unsigned int target_tlb_bit0 : 1;
     unsigned int target_tlb_bit1 : 1;
     unsigned int target_tlb_bit2 : 1;
+
+    /* IOPMP support up to 65535 sources */
+    unsigned int iopmp_sid:16;
+    /* Transaction infomation for IOPMP */
+    unsigned long long iopmp_start_addr;
+    unsigned long long iopmp_end_addr;
 } MemTxAttrs;
 
 /* Bus masters which don't specify any attributes will get this,
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/4] exec/memattrs: Add iopmp source id, start address, end address to MemTxAttrs

Quoted 10 lines · Ethan Chen
---
 include/exec/memattrs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/exec/memattrs.h +0 -0
index d04170aa27..fc15e5d7d3 100644

include/exec/memattrs.h typedef struct MemTxAttrs { · line 69

Quoted 6 lines
include/exec/memattrs.h +3 -0
@@ -64,6 +64,12 @@ typedef struct MemTxAttrs {
     unsigned int target_tlb_bit0 : 1;
     unsigned int target_tlb_bit1 : 1;
     unsigned int target_tlb_bit2 : 1;
+
+    /* IOPMP support up to 65535 sources */
+    unsigned int iopmp_sid:16;

There's MemTxAttrs.requester_id, SID for pci, same length. Reuse it?

include/exec/memattrs.h typedef struct MemTxAttrs { · line 72

Quoted 3 lines
include/exec/memattrs.h +3 -0
+    /* Transaction infomation for IOPMP */
+    unsigned long long iopmp_start_addr;
+    unsigned long long iopmp_end_addr;

PS: encoding addresses into memattrs is.. strange, but since I know nothing about iopmp, I'll leave that for other reviewers.

Currently MemTxAttrs are passed as a whole int on the stack, if it keeps growing we may start to consider a pointer, but need to check the side effects of unexpected fields modified within a call.

Thanks,

Signature · 1 line
Peter Xu
#3 lore raw

Re: [PATCH v2 1/4] exec/memattrs: Add iopmp source id, start address, end address to MemTxAttrs

Quoted 25 lines · Peter Xu
Quoted 10 lines · Ethan Chen
---
 include/exec/memattrs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/exec/memattrs.h +0 -0
index d04170aa27..fc15e5d7d3 100644

include/exec/memattrs.h typedef struct MemTxAttrs { · line 69

Quoted 6 lines
include/exec/memattrs.h +3 -0
@@ -64,6 +64,12 @@ typedef struct MemTxAttrs {
     unsigned int target_tlb_bit0 : 1;
     unsigned int target_tlb_bit1 : 1;
     unsigned int target_tlb_bit2 : 1;
+
+    /* IOPMP support up to 65535 sources */
+    unsigned int iopmp_sid:16;

There's MemTxAttrs.requester_id, SID for pci, same length. Reuse it?

include/exec/memattrs.h typedef struct MemTxAttrs { · line 72

Quoted 3 lines
include/exec/memattrs.h +3 -0
+    /* Transaction infomation for IOPMP */
+    unsigned long long iopmp_start_addr;
+    unsigned long long iopmp_end_addr;
Quoted 6 lines

PS: encoding addresses into memattrs is.. strange, but since I know nothing about iopmp, I'll leave that for other reviewers.

Currently MemTxAttrs are passed as a whole int on the stack, if it keeps growing we may start to consider a pointer, but need to check the side effects of unexpected fields modified within a call.

Yeah, this struct is intended to model the various attributes that get passed around on the bus alongside data in real hardware. I'm pretty sure no real hardware is passing around start and end transaction addresses on its bus with every read and write, which suggests that we should be doing this some other way than adding these fields to the MemTxAttrs struct.

thanks
-- PMM

#4 lore raw

Re: [PATCH v2 1/4] exec/memattrs: Add iopmp source id, start address, end address to MemTxAttrs

Quoted 33 lines · Peter Maydell
Quoted 25 lines · Peter Xu
Quoted 10 lines · Ethan Chen
---
 include/exec/memattrs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/exec/memattrs.h +0 -0
index d04170aa27..fc15e5d7d3 100644

include/exec/memattrs.h typedef struct MemTxAttrs { · line 69

Quoted 6 lines
include/exec/memattrs.h +3 -0
@@ -64,6 +64,12 @@ typedef struct MemTxAttrs {
     unsigned int target_tlb_bit0 : 1;
     unsigned int target_tlb_bit1 : 1;
     unsigned int target_tlb_bit2 : 1;
+
+    /* IOPMP support up to 65535 sources */
+    unsigned int iopmp_sid:16;

There's MemTxAttrs.requester_id, SID for pci, same length. Reuse it?

include/exec/memattrs.h typedef struct MemTxAttrs { · line 72

Quoted 3 lines
include/exec/memattrs.h +3 -0
+    /* Transaction infomation for IOPMP */
+    unsigned long long iopmp_start_addr;
+    unsigned long long iopmp_end_addr;
Quoted 6 lines

PS: encoding addresses into memattrs is.. strange, but since I know nothing about iopmp, I'll leave that for other reviewers.

Currently MemTxAttrs are passed as a whole int on the stack, if it keeps growing we may start to consider a pointer, but need to check the side effects of unexpected fields modified within a call.

Quoted 6 lines

Yeah, this struct is intended to model the various attributes that get passed around on the bus alongside data in real hardware. I'm pretty sure no real hardware is passing around start and end transaction addresses on its bus with every read and write, which suggests that we should be doing this some other way than adding these fields to the MemTxAttrs struct.

For AXI bus ADDR, LEN, SIZE are signals in read/write address channel. IOPMP will check that start address = ADDR,
and end address = ADDR + LEN * SIZE.

Thanks,
Ethan Chen

#5 lore raw

Re: [PATCH v2 1/4] exec/memattrs: Add iopmp source id, start address, end address to MemTxAttrs

Quoted 42 lines · Ethan Chen
Quoted 33 lines · Peter Maydell
Quoted 25 lines · Peter Xu
Quoted 10 lines · Ethan Chen
---
 include/exec/memattrs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/exec/memattrs.h +0 -0
index d04170aa27..fc15e5d7d3 100644

include/exec/memattrs.h typedef struct MemTxAttrs { · line 69

Quoted 6 lines
include/exec/memattrs.h +3 -0
@@ -64,6 +64,12 @@ typedef struct MemTxAttrs {
     unsigned int target_tlb_bit0 : 1;
     unsigned int target_tlb_bit1 : 1;
     unsigned int target_tlb_bit2 : 1;
+
+    /* IOPMP support up to 65535 sources */
+    unsigned int iopmp_sid:16;

There's MemTxAttrs.requester_id, SID for pci, same length. Reuse it?

include/exec/memattrs.h typedef struct MemTxAttrs { · line 72

Quoted 3 lines
include/exec/memattrs.h +3 -0
+    /* Transaction infomation for IOPMP */
+    unsigned long long iopmp_start_addr;
+    unsigned long long iopmp_end_addr;
Quoted 6 lines

PS: encoding addresses into memattrs is.. strange, but since I know nothing about iopmp, I'll leave that for other reviewers.

Currently MemTxAttrs are passed as a whole int on the stack, if it keeps growing we may start to consider a pointer, but need to check the side effects of unexpected fields modified within a call.

Quoted 6 lines

Yeah, this struct is intended to model the various attributes that get passed around on the bus alongside data in real hardware. I'm pretty sure no real hardware is passing around start and end transaction addresses on its bus with every read and write, which suggests that we should be doing this some other way than adding these fields to the MemTxAttrs struct.

Quoted 3 lines

For AXI bus ADDR, LEN, SIZE are signals in read/write address channel. IOPMP will check that start address = ADDR,
and end address = ADDR + LEN * SIZE.

Yes, but you don't pass the start and end address on the AXI bus, so they don't go in QEMU's MemTxAttrs either.

thanks
-- PMM

#6 lore raw

Re: [PATCH v2 1/4] exec/memattrs: Add iopmp source id, start address, end address to MemTxAttrs

Quoted 43 lines · Peter Maydell
Quoted 42 lines · Ethan Chen
Quoted 39 lines · Peter Maydell
Quoted 25 lines · Peter Xu
Quoted 10 lines · Ethan Chen
---
 include/exec/memattrs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/exec/memattrs.h +0 -0
index d04170aa27..fc15e5d7d3 100644

include/exec/memattrs.h typedef struct MemTxAttrs { · line 69

Quoted 6 lines
include/exec/memattrs.h +3 -0
@@ -64,6 +64,12 @@ typedef struct MemTxAttrs {
     unsigned int target_tlb_bit0 : 1;
     unsigned int target_tlb_bit1 : 1;
     unsigned int target_tlb_bit2 : 1;
+
+    /* IOPMP support up to 65535 sources */
+    unsigned int iopmp_sid:16;

There's MemTxAttrs.requester_id, SID for pci, same length. Reuse it?

include/exec/memattrs.h typedef struct MemTxAttrs { · line 72

Quoted 3 lines
include/exec/memattrs.h +3 -0
+    /* Transaction infomation for IOPMP */
+    unsigned long long iopmp_start_addr;
+    unsigned long long iopmp_end_addr;
Quoted 6 lines

PS: encoding addresses into memattrs is.. strange, but since I know nothing about iopmp, I'll leave that for other reviewers.

Currently MemTxAttrs are passed as a whole int on the stack, if it keeps growing we may start to consider a pointer, but need to check the side effects of unexpected fields modified within a call.

Yeah, this struct is intended to model the various attributes that get passed around on the bus alongside data in real hardware. I'm pretty sure no real hardware is passing around start and end transaction addresses on its bus with every read and write, which suggests that we should be doing this some other way than adding these fields to the MemTxAttrs struct.

Quoted 6 lines
Quoted 3 lines

For AXI bus ADDR, LEN, SIZE are signals in read/write address channel. IOPMP will check that start address = ADDR,
and end address = ADDR + LEN * SIZE.

Yes, but you don't pass the start and end address on the AXI bus, so they don't go in QEMU's MemTxAttrs either.

I will add those AXI bus signals to MemTxAttrs instead of using start and end address in next revision.

Thanks,
Ethan Chen

#7 lore raw

Re: [PATCH v2 1/4] exec/memattrs: Add iopmp source id, start address, end address to MemTxAttrs

Quoted 49 lines · Ethan Chen
Quoted 47 lines · Peter Maydell
Quoted 45 lines · Ethan Chen
Quoted 33 lines · Peter Maydell
Quoted 25 lines · Peter Xu
Quoted 10 lines · Ethan Chen
---
 include/exec/memattrs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/exec/memattrs.h +0 -0
index d04170aa27..fc15e5d7d3 100644

include/exec/memattrs.h typedef struct MemTxAttrs { · line 69

Quoted 6 lines
include/exec/memattrs.h +3 -0
@@ -64,6 +64,12 @@ typedef struct MemTxAttrs {
     unsigned int target_tlb_bit0 : 1;
     unsigned int target_tlb_bit1 : 1;
     unsigned int target_tlb_bit2 : 1;
+
+    /* IOPMP support up to 65535 sources */
+    unsigned int iopmp_sid:16;

There's MemTxAttrs.requester_id, SID for pci, same length. Reuse it?

include/exec/memattrs.h typedef struct MemTxAttrs { · line 72

Quoted 3 lines
include/exec/memattrs.h +3 -0
+    /* Transaction infomation for IOPMP */
+    unsigned long long iopmp_start_addr;
+    unsigned long long iopmp_end_addr;
Quoted 6 lines

PS: encoding addresses into memattrs is.. strange, but since I know nothing about iopmp, I'll leave that for other reviewers.

Currently MemTxAttrs are passed as a whole int on the stack, if it keeps growing we may start to consider a pointer, but need to check the side effects of unexpected fields modified within a call.

Quoted 6 lines

Yeah, this struct is intended to model the various attributes that get passed around on the bus alongside data in real hardware. I'm pretty sure no real hardware is passing around start and end transaction addresses on its bus with every read and write, which suggests that we should be doing this some other way than adding these fields to the MemTxAttrs struct.

For AXI bus ADDR, LEN, SIZE are signals in read/write address channel. IOPMP will check that start address = ADDR,
and end address = ADDR + LEN * SIZE.

Quoted 5 lines
Quoted 2 lines

Yes, but you don't pass the start and end address on the AXI bus, so they don't go in QEMU's MemTxAttrs either.

I will add those AXI bus signals to MemTxAttrs instead of using start and end address in next revision.

What AXI bus signals? You already get address and size in the actual memory transaction, they don't need to go in the MemTxAttrs.

thanks
-- PMM

#8 lore raw

Re: [PATCH v2 1/4] exec/memattrs: Add iopmp source id, start address, end address to MemTxAttrs

Quoted 50 lines · Peter Maydell
Quoted 49 lines · Ethan Chen
Quoted 47 lines · Peter Maydell
Quoted 45 lines · Ethan Chen
Quoted 33 lines · Peter Maydell
Quoted 25 lines · Peter Xu
Quoted 10 lines · Ethan Chen
---
 include/exec/memattrs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/exec/memattrs.h +0 -0
index d04170aa27..fc15e5d7d3 100644

include/exec/memattrs.h typedef struct MemTxAttrs { · line 69

Quoted 6 lines
include/exec/memattrs.h +3 -0
@@ -64,6 +64,12 @@ typedef struct MemTxAttrs {
     unsigned int target_tlb_bit0 : 1;
     unsigned int target_tlb_bit1 : 1;
     unsigned int target_tlb_bit2 : 1;
+
+    /* IOPMP support up to 65535 sources */
+    unsigned int iopmp_sid:16;

There's MemTxAttrs.requester_id, SID for pci, same length. Reuse it?

include/exec/memattrs.h typedef struct MemTxAttrs { · line 72

Quoted 3 lines
include/exec/memattrs.h +3 -0
+    /* Transaction infomation for IOPMP */
+    unsigned long long iopmp_start_addr;
+    unsigned long long iopmp_end_addr;
Quoted 6 lines

PS: encoding addresses into memattrs is.. strange, but since I know nothing about iopmp, I'll leave that for other reviewers.

Currently MemTxAttrs are passed as a whole int on the stack, if it keeps growing we may start to consider a pointer, but need to check the side effects of unexpected fields modified within a call.

Quoted 6 lines

Yeah, this struct is intended to model the various attributes that get passed around on the bus alongside data in real hardware. I'm pretty sure no real hardware is passing around start and end transaction addresses on its bus with every read and write, which suggests that we should be doing this some other way than adding these fields to the MemTxAttrs struct.

For AXI bus ADDR, LEN, SIZE are signals in read/write address channel. IOPMP will check that start address = ADDR,
and end address = ADDR + LEN * SIZE.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Yes, but you don't pass the start and end address on the AXI bus, so they don't go in QEMU's MemTxAttrs either.

I will add those AXI bus signals to MemTxAttrs instead of using start and end address in next revision.

What AXI bus signals? You already get address and size in the actual memory transaction, they don't need to go in the MemTxAttrs.

A burst contains multiple continuous read or write operations. In current transaction, I can only get the size and address of a single operation. IOPMP checks not only a single operation but also the burst information. I propose to add those signals to MemTxAttrs.

Following AXI signals are needed for IOPMP. (AW/AR)ADDR: Address of the first beat(operation) of the burst (AW/AR)LEN: Number of beats inside the burst (AW/AR)SIZE: Size of each beat
(AW/AR)BURST: Type of the burst

Thanks,
Ethan Chen

#9 lore raw

Re: [PATCH v2 1/4] exec/memattrs: Add iopmp source id, start address, end address to MemTxAttrs

Quoted 10 lines · Ethan Chen
Quoted 3 lines · Peter Maydell

What AXI bus signals? You already get address and size in the actual memory transaction, they don't need to go in the MemTxAttrs.

A burst contains multiple continuous read or write operations. In current transaction, I can only get the size and address of a single operation. IOPMP checks not only a single operation but also the burst information. I propose to add those signals to MemTxAttrs.

QEMU doesn't emulate bus transactions at that level -- we have no concept of burst transactions. You should have the IOMMU do whatever it would do for a series of simple transactions.

thanks
-- PMM

#10 lore raw

Re: [PATCH v2 1/4] exec/memattrs: Add iopmp source id, start address, end address to MemTxAttrs

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Ethan Chen
Quoted 3 lines · Peter Maydell

What AXI bus signals? You already get address and size in the actual memory transaction, they don't need to go in the MemTxAttrs.

Quoted 9 lines
Quoted 4 lines

A burst contains multiple continuous read or write operations. In current transaction, I can only get the size and address of a single operation. IOPMP checks not only a single operation but also the burst information. I propose to add those signals to MemTxAttrs.

QEMU doesn't emulate bus transactions at that level -- we have no concept of burst transactions. You should have the IOMMU do whatever it would do for a series of simple transactions.

I propose to use another method like StreamSink in hw/dma/xilinx_axidma.c to let DMA send the signals to IOPMP instead of modifying IOMMU.

Thanks,
Ethan Chen

#11 lore raw

Re: [PATCH v2 1/4] exec/memattrs: Add iopmp source id, start address, end address to MemTxAttrs

In reply to Peter Xu
Quoted 6 lines · Peter Xu
Quoted 5 lines · Ethan Chen
---
 include/exec/memattrs.h | 6 ++++++
 1 file changed, 6 insertions(+)
Quoted 13 lines

include/exec/memattrs.h typedef struct MemTxAttrs { · line 69

Quoted 11 lines
include/exec/memattrs.h +3 -0
index d04170aa27..fc15e5d7d3 100644
@@ -64,6 +64,12 @@ typedef struct MemTxAttrs {
     unsigned int target_tlb_bit0 : 1;
     unsigned int target_tlb_bit1 : 1;
     unsigned int target_tlb_bit2 : 1;
+
+    /* IOPMP support up to 65535 sources */
+    unsigned int iopmp_sid:16;

There's MemTxAttrs.requester_id, SID for pci, same length. Reuse it?

OK, I will reuse it.

Quoted 7 lines

include/exec/memattrs.h typedef struct MemTxAttrs { · line 72

Quoted 4 lines
include/exec/memattrs.h +3 -0
+    /* Transaction infomation for IOPMP */
+    unsigned long long iopmp_start_addr;
+    unsigned long long iopmp_end_addr;

PS: encoding addresses into memattrs is.. strange, but since I know nothing about iopmp, I'll leave that for other reviewers.

Current IOMMU translate function only have address need to be translate. In IOPMP, It needs the transfer start and end address to check this transfer is valid or not.

Quoted 4 lines

Currently MemTxAttrs are passed as a whole int on the stack, if it keeps growing we may start to consider a pointer, but need to check the side effects of unexpected fields modified within a call.

It's good for me to use a pointer.

Thanks,
Ethan Chen

#12 lore raw

PATCH v2 2/4 Add RISC-V IOPMP support

In reply to Ethan Chen via

Support specification Version 1.0.0-draft4 rapid-k model.

---
 hw/misc/Kconfig               |   3 +
 hw/misc/meson.build           |   1 +
 hw/misc/riscv_iopmp.c         | 902 ++++++++++++++++++++++++++++++++++
 include/hw/misc/riscv_iopmp.h | 330 +++++++++++++
 4 files changed, 1236 insertions(+)
 create mode 100644 hw/misc/riscv_iopmp.c
 create mode 100644 include/hw/misc/riscv_iopmp.h
hw/misc/Kconfig +3 -0
index dba41afe67..8c63eb4cef 100644
@@ -197,4 +197,7 @@ config DJMEMC
 config IOSB
     bool
 
+config RISCV_IOPMP
+    bool
+
 source macio/Kconfig
hw/misc/meson.build +1 -0
index f60de33f9a..7826ed9b7b 100644
@@ -35,6 +35,7 @@ system_ss.add(when: 'CONFIG_SIFIVE_E_PRCI', if_true: files('sifive_e_prci.c'))
 system_ss.add(when: 'CONFIG_SIFIVE_E_AON', if_true: files('sifive_e_aon.c'))
 system_ss.add(when: 'CONFIG_SIFIVE_U_OTP', if_true: files('sifive_u_otp.c'))
 system_ss.add(when: 'CONFIG_SIFIVE_U_PRCI', if_true: files('sifive_u_prci.c'))
+specific_ss.add(when: 'CONFIG_RISCV_IOPMP', if_true: files('riscv_iopmp.c'))
 
 subdir('macio')
 
hw/misc/riscv_iopmp.c new file +902 -0

902 lines not on this page · raw message

include/hw/misc/riscv_iopmp.h new file +330 -0

330 lines not on this page · raw message

Signature · 1 line
2.34.1
#13 lore raw

PATCH v2 3/4 hw/dma: Add Andes ATCDMAC300 support

In reply to Ethan Chen via
---
 hw/dma/Kconfig              |   3 +
 hw/dma/atcdmac300.c         | 460 ++++++++++++++++++++++++++++++++++++
 hw/dma/meson.build          |   1 +
 include/hw/dma/atcdmac300.h | 171 ++++++++++++++
 4 files changed, 635 insertions(+)
 create mode 100644 hw/dma/atcdmac300.c
 create mode 100644 include/hw/dma/atcdmac300.h
hw/dma/Kconfig +3 -0
index 98fbb1bb04..b3f4edc873 100644
@@ -30,3 +30,6 @@ config SIFIVE_PDMA
 config XLNX_CSU_DMA
     bool
     select REGISTER
+
+config ATCDMAC300
+    bool
hw/dma/atcdmac300.c new file +460 -0

460 lines not on this page · raw message

hw/dma/meson.build +1 -0
index a96c1be2c8..dfe37de32d 100644
@@ -14,3 +14,4 @@ system_ss.add(when: 'CONFIG_PXA2XX', if_true: files('pxa2xx_dma.c'))
 system_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_dma.c'))
 system_ss.add(when: 'CONFIG_SIFIVE_PDMA', if_true: files('sifive_pdma.c'))
 system_ss.add(when: 'CONFIG_XLNX_CSU_DMA', if_true: files('xlnx_csu_dma.c'))
+system_ss.add(when: 'CONFIG_ATCDMAC300', if_true: files('atcdmac300.c'))
\ No newline at end of file
include/hw/dma/atcdmac300.h new file +171 -0

171 lines not on this page · raw message

Signature · 1 line
2.34.1
#14 lore raw

PATCH v2 4/4 hw/riscv/virt: Add IOPMP support

In reply to Ethan Chen via

- Add 'iopmp=on' option to enable a iopmp device and a dma device connect to the iopmp device
- Add 'iopmp_cascade=on' option to enable iopmp cascading.

---
 hw/riscv/Kconfig        |  2 ++
 hw/riscv/virt.c         | 68 +++++++++++++++++++++++++++++++++++++++++
 include/hw/riscv/virt.h | 10 +++++-
 3 files changed, 79 insertions(+), 1 deletion(-)
hw/riscv/Kconfig +2 -0
index b6a5eb4452..c30a104aa4 100644
@@ -45,6 +45,8 @@ config RISCV_VIRT
     select FW_CFG_DMA
     select PLATFORM_BUS
     select ACPI
+    select ATCDMAC300
+    select RISCV_IOPMP
 
 config SHAKTI_C
     bool
hw/riscv/virt.c +68 -0

98 lines not on this page · raw message

include/hw/riscv/virt.h +9 -1
index e5c474b26e..5fa2944d29 100644
@@ -54,6 +54,8 @@ struct RISCVVirtState {
 
     int fdt_size;
     bool have_aclint;
+    bool have_iopmp;
+    bool have_iopmp_cascade;
     RISCVVirtAIAType aia_type;
     int aia_guests;
     char *oem_id;
@@ -82,12 +84,18 @@ enum {
     VIRT_PCIE_MMIO,
     VIRT_PCIE_PIO,
     VIRT_PLATFORM_BUS,
-    VIRT_PCIE_ECAM
+    VIRT_PCIE_ECAM,
+    VIRT_IOPMP,
+    VIRT_IOPMP2,
+    VIRT_DMAC,
 };
 
 enum {
     UART0_IRQ = 10,
     RTC_IRQ = 11,
+    DMAC_IRQ = 12,
+    IOPMP_IRQ = 13,
+    IOPMP2_IRQ = 14,
     VIRTIO_IRQ = 1, /* 1 to 8 */
     VIRTIO_COUNT = 8,
     PCIE_IRQ = 0x20, /* 32 to 35 */
Signature · 1 line
2.34.1