[PATCH v11 5/8] hw/misc/riscv_iopmp_txn_info: Add struct for transaction infomation

Ethan Chen via posted 8 patches 11 months ago
[PATCH v11 5/8] hw/misc/riscv_iopmp_txn_info: Add struct for transaction infomation
Posted by Ethan Chen via 11 months ago
The entire valid transaction must fit within a single IOPMP entry.
However, during IOMMU translation, the transaction size is not
available. This structure defines the transaction information required
by the IOPMP.

Signed-off-by: Ethan Chen <ethan84@andestech.com>
---
 include/hw/misc/riscv_iopmp_txn_info.h | 38 ++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 include/hw/misc/riscv_iopmp_txn_info.h

diff --git a/include/hw/misc/riscv_iopmp_txn_info.h b/include/hw/misc/riscv_iopmp_txn_info.h
new file mode 100644
index 0000000000..d1d8213867
--- /dev/null
+++ b/include/hw/misc/riscv_iopmp_txn_info.h
@@ -0,0 +1,38 @@
+/*
+ * QEMU RISC-V IOPMP transaction information
+ *
+ * The transaction information structure provides the complete transaction
+ * length to the IOPMP device
+ *
+ * Copyright (c) 2023-2025 Andes Tech. Corp.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2 or later, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef RISCV_IOPMP_TXN_INFO_H
+#define RISCV_IOPMP_TXN_INFO_H
+
+typedef struct {
+    /* The id of requestor */
+    uint32_t rrid:16;
+    /* The start address of transaction */
+    uint64_t start_addr;
+    /* The end address of transaction */
+    uint64_t end_addr;
+    /* The stage of cascading IOPMP */
+    uint32_t stage;
+} RISCVIOPMPTxnInfo;
+
+#endif
-- 
2.34.1
Re: [PATCH v11 5/8] hw/misc/riscv_iopmp_txn_info: Add struct for transaction infomation
Posted by Alistair Francis 8 months, 3 weeks ago
On Wed, Mar 12, 2025 at 7:43 PM Ethan Chen via <qemu-devel@nongnu.org> wrote:
>
> The entire valid transaction must fit within a single IOPMP entry.
> However, during IOMMU translation, the transaction size is not
> available. This structure defines the transaction information required
> by the IOPMP.
>
> Signed-off-by: Ethan Chen <ethan84@andestech.com>

Acked-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  include/hw/misc/riscv_iopmp_txn_info.h | 38 ++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
>  create mode 100644 include/hw/misc/riscv_iopmp_txn_info.h
>
> diff --git a/include/hw/misc/riscv_iopmp_txn_info.h b/include/hw/misc/riscv_iopmp_txn_info.h
> new file mode 100644
> index 0000000000..d1d8213867
> --- /dev/null
> +++ b/include/hw/misc/riscv_iopmp_txn_info.h
> @@ -0,0 +1,38 @@
> +/*
> + * QEMU RISC-V IOPMP transaction information
> + *
> + * The transaction information structure provides the complete transaction
> + * length to the IOPMP device
> + *
> + * Copyright (c) 2023-2025 Andes Tech. Corp.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2 or later, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#ifndef RISCV_IOPMP_TXN_INFO_H
> +#define RISCV_IOPMP_TXN_INFO_H
> +
> +typedef struct {
> +    /* The id of requestor */
> +    uint32_t rrid:16;
> +    /* The start address of transaction */
> +    uint64_t start_addr;
> +    /* The end address of transaction */
> +    uint64_t end_addr;
> +    /* The stage of cascading IOPMP */
> +    uint32_t stage;
> +} RISCVIOPMPTxnInfo;
> +
> +#endif
> --
> 2.34.1
>
>