Skip to content

linux, rvy: add default QEMU -cpu flags - #502

Open
heshamelmatary wants to merge 1 commit into
mainfrom
linux_run
Open

linux, rvy: add default QEMU -cpu flags#502
heshamelmatary wants to merge 1 commit into
mainfrom
linux_run

Conversation

@heshamelmatary

@heshamelmatary heshamelmatary commented Jun 16, 2026

Copy link
Copy Markdown
Member

Currently the launch target will add -cpu codasip-a730 only if --riscv-cheri-isa experimental_std093 is passed, and will discard -cpu if not. Discarding -cpu will result in a CHERI-enabled RVY QEMU, but with extended CHERI flags/features disabled such as cheri_pte, cheri_levels, etc, in the QEMU 7.1 branch.

This PR fixes this by:
1- Always pass -cpu rv64,cheri_pte,cheri_levels for CHERI-Linux by default, without having to check for the --riscv-cheri-isa flag.
2- Use a more generic -cpu rv64 and not codasip-a730.

@arichardson arichardson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do this globally instead of just for Linux?

@heshamelmatary

Copy link
Copy Markdown
Member Author

Can you do this globally instead of just for Linux?

@arichardson I have now moved this to run_qemu's init. We can also probably remove this check in favour of the change in this PR

@heshamelmatary
heshamelmatary force-pushed the linux_run branch 2 times, most recently from e9d6832 to b782a30 Compare June 17, 2026 11:04
@paul-metzger

paul-metzger commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Can you do this globally instead of just for Linux?

@arichardson I have now moved this to run_qemu's init. We can also probably remove this check in favour of the change in this PR

It looks like we can't remove the check and the corresponding if and else branches entirely because self._qemu_arch_suffix wouldn't be set. If we want to remove the code that sets -cpu and drop l730 support, then we could refactor the if branch to

if riscv_cheri_isa is RiscvCheriISA.EXPERIMENTAL_STD093:
                self._qemu_arch_suffix = f"riscv{xlen}cheristd"
else:
                self._qemu_arch_suffix = f"riscv{xlen}cheri"

so that _qemu_arch_suffix is still set.

@arichardson arichardson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you place this in the qemu options init instead?

It just needs to be updated to use
xtarget.is_experimental_cheri093_std(self.config) instead of just checking the command line flag.

And yes we can use the generic CPU instead of a730

@arichardson

Copy link
Copy Markdown
Member

Can you place this in the qemu options init instead?

It just needs to be updated to use xtarget.is_experimental_cheri093_std(self.config) instead of just checking the command line flag.

And yes we can use the generic CPU instead of a730

If the problem is that the config argument is not available there we could probably just add it.

@heshamelmatary

Copy link
Copy Markdown
Member Author

this check

Can you do this globally instead of just for Linux?

@arichardson I have now moved this to run_qemu's init. We can also probably remove this check in favour of the change in this PR

It looks like we can't remove the check and the corresponding if and else branches entirely because self._qemu_arch_suffix wouldn't be set. If we want to remove the code that sets -cpu and drop l730 support, then we could refactor the if branch to

if riscv_cheri_isa is RiscvCheriISA.EXPERIMENTAL_STD093:
                self._qemu_arch_suffix = f"riscv{xlen}cheristd"
else:
                self._qemu_arch_suffix = f"riscv{xlen}cheri"

so that _qemu_arch_suffix is still set.

I think that's not even needed here. I've been running CHERI-Linux without that flag and it picks the correct QEMU's suffix

@heshamelmatary

Copy link
Copy Markdown
Member Author

Can you place this in the qemu options init instead?

It just needs to be updated to use xtarget.is_experimental_cheri093_std(self.config) instead of just checking the command line flag.

That's what I tried first thing, but QemuOptions doesn't have config eg:

AttributeError: 'QemuOptions' object has no attribute 'config'

@heshamelmatary

Copy link
Copy Markdown
Member Author

Can you place this in the qemu options init instead?
It just needs to be updated to use xtarget.is_experimental_cheri093_std(self.config) instead of just checking the command line flag.
And yes we can use the generic CPU instead of a730

If the problem is that the config argument is not available there we could probably just add it.

Yeah that was the issue. I just added it now (in the last push) as an argument if that's what you meant?

@heshamelmatary
heshamelmatary force-pushed the linux_run branch 3 times, most recently from f3053fe to 674f859 Compare June 18, 2026 14:02
Currently the launch target will add -cpu codasip-a730 only if
--riscv-cheri-isa experimental_std093 is passed, and will discard -cpu if not.
Discarding -cpu will result in a CHERI-enabled RVY QEMU, but with extended CHERI
flags/features disabled such as cheri_pte, cheri_levels, etc, in the QEMU 7.1
branch.

This PR fixes this by:
1- Always pass -cpu rv64,cheri_pte,cheri_levels for RVY by default,
without having to check for the --riscv-cheri-isa flag, by also relying on the
cross compilation target.
2- Use a more generic -cpu rv64 and not codasip-a730.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants