hw/riscv/riscv-iommu: set cmd_ill IOFENCE.C rsvp bits are set
PATCH 1/1 hw/riscv/riscv-iommu: set cmd_ill IOFENCE.C rsvp bits are set
We're not setting RISCV_IOMMU_CQCSR_CMD_ILL if a reserved bit happens to be set in an IOFENCE.C command.
Fixes 0c54acb8243d ("hw/riscv: add RISC-V IOMMU base emulation")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3575
Signed-off-by Daniel Henrique Barboza <[email protected]>
--- hw/riscv/riscv-iommu-bits.h | 1 + hw/riscv/riscv-iommu.c | 4 ++++ 2 files changed, 5 insertions(+)
hw/riscv/riscv-iommu-bits.h +1 -0
@@ -344,6 +344,7 @@ struct riscv_iommu_command {#define RISCV_IOMMU_CMD_IOFENCE_OPCODE 2#define RISCV_IOMMU_CMD_IOFENCE_FUNC_C 0#define RISCV_IOMMU_CMD_IOFENCE_AV BIT_ULL(10) +#define RISCV_IOMMU_CMD_IOFENCE_RESERVED GENMASK_ULL(31, 14)#define RISCV_IOMMU_CMD_IOFENCE_DATA GENMASK_ULL(63, 32)#define RISCV_IOMMU_CMD_IODIR_OPCODE 3
hw/riscv/riscv-iommu.c +4 -0
@@ -1876,6 +1876,10 @@ static void riscv_iommu_process_cq_tail(RISCVIOMMUState *s)switch (cmd_opcode) {case RISCV_IOMMU_CMD (RISCV_IOMMU_CMD_IOFENCE_FUNC_C ,RISCV_IOMMU_CMD_IOFENCE_OPCODE ): +if (cmd.dword0 &RISCV_IOMMU_CMD_IOFENCE_RESERVED ) { + goto cmd_ill; + } + res =riscv_iommu_iofence (s, cmd.dword0 &RISCV_IOMMU_CMD_IOFENCE_AV , cmd.dword1 <<2 ,get_field (cmd.dword0,RISCV_IOMMU_CMD_IOFENCE_DATA ));
Signature · 1 line
2.43.0
Quoted 7 lines · Daniel Henrique Barboza
We're not setting
RISCV_IOMMU_CQCSR_CMD_ILLif a reserved bit happens to be set in an IOFENCE.C command.Fixes 0c54acb8243d ("hw/riscv: add RISC-V IOMMU base emulation")Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3575
Signed-off-by Daniel Henrique Barboza <[email protected]>
Acked-by Alistair Francis <[email protected]>
Alistair
Quoted 36 lines
--- hw/riscv/riscv-iommu-bits.h | 1 + hw/riscv/riscv-iommu.c | 4 ++++ 2 files changed, 5 insertions(+)hw/riscv/riscv-iommu-bits.h +1
-0@@ -344,6 +344,7 @@ struct riscv_iommu_command {#define RISCV_IOMMU_CMD_IOFENCE_OPCODE 2#define RISCV_IOMMU_CMD_IOFENCE_FUNC_C 0#define RISCV_IOMMU_CMD_IOFENCE_AV BIT_ULL(10) +#define RISCV_IOMMU_CMD_IOFENCE_RESERVED GENMASK_ULL(31, 14)#define RISCV_IOMMU_CMD_IOFENCE_DATA GENMASK_ULL(63, 32)#define RISCV_IOMMU_CMD_IODIR_OPCODE 3hw/riscv/riscv-iommu.c +4
-1@@ -1876,6 +1876,10 @@ static void riscv_iommu_process_cq_tail(RISCVIOMMUState *s)switch (cmd_opcode) {case RISCV_IOMMU_CMD (RISCV_IOMMU_CMD_IOFENCE_FUNC_C ,RISCV_IOMMU_CMD_IOFENCE_OPCODE ): +if (cmd.dword0 &RISCV_IOMMU_CMD_IOFENCE_RESERVED ) { + goto cmd_ill; + } + res =riscv_iommu_iofence (s, cmd.dword0 &RISCV_IOMMU_CMD_IOFENCE_AV , cmd.dword1 <<2 ,get_field (cmd.dword0,RISCV_IOMMU_CMD_IOFENCE_DATA )); --2.43.0
Alistair Francis
AppliedQuoted 7 lines · Daniel Henrique Barboza
We're not setting
RISCV_IOMMU_CQCSR_CMD_ILLif a reserved bit happens to be set in an IOFENCE.C command.Fixes 0c54acb8243d ("hw/riscv: add RISC-V IOMMU base emulation")Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3575
Signed-off-by Daniel Henrique Barboza <[email protected]>
Thanks!
Applied to riscv-to-apply.next
Alistair
Quoted 36 lines
--- hw/riscv/riscv-iommu-bits.h | 1 + hw/riscv/riscv-iommu.c | 4 ++++ 2 files changed, 5 insertions(+)hw/riscv/riscv-iommu-bits.h +1
-0@@ -344,6 +344,7 @@ struct riscv_iommu_command {#define RISCV_IOMMU_CMD_IOFENCE_OPCODE 2#define RISCV_IOMMU_CMD_IOFENCE_FUNC_C 0#define RISCV_IOMMU_CMD_IOFENCE_AV BIT_ULL(10) +#define RISCV_IOMMU_CMD_IOFENCE_RESERVED GENMASK_ULL(31, 14)#define RISCV_IOMMU_CMD_IOFENCE_DATA GENMASK_ULL(63, 32)#define RISCV_IOMMU_CMD_IODIR_OPCODE 3hw/riscv/riscv-iommu.c +4
-1@@ -1876,6 +1876,10 @@ static void riscv_iommu_process_cq_tail(RISCVIOMMUState *s)switch (cmd_opcode) {case RISCV_IOMMU_CMD (RISCV_IOMMU_CMD_IOFENCE_FUNC_C ,RISCV_IOMMU_CMD_IOFENCE_OPCODE ): +if (cmd.dword0 &RISCV_IOMMU_CMD_IOFENCE_RESERVED ) { + goto cmd_ill; + } + res =riscv_iommu_iofence (s, cmd.dword0 &RISCV_IOMMU_CMD_IOFENCE_AV , cmd.dword1 <<2 ,get_field (cmd.dword0,RISCV_IOMMU_CMD_IOFENCE_DATA )); --2.43.0