Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a QEMU architecture ID #1213

Merged
merged 1 commit into from
Feb 1, 2024
Merged

Conversation

palmer-dabbelt
Copy link
Member

For the cases where QEMU isn't pretending to be something else (for example, when targeting a virtual platform) it'd be nice to set the arch IDs to something other than 0. That way users can detect they're running on QEMU and act differently, in case they want to work around a QEMU issue of some sort.

Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/arch-riscv64/dynamic_function_dispatch.cpp#47
Link: https://lore.kernel.org/r/20240131182430.20174-1-palmer@rivosinc.com/

For the cases where QEMU isn't pretending to be something else (for
example, when targeting a virtual platform) it'd be nice to set the arch
IDs to something other than 0.  That way users can detect they're
running on QEMU and act differently, in case they want to work around a
QEMU issue of some sort.

Link: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/arch-riscv64/dynamic_function_dispatch.cpp#47
Link: https://lore.kernel.org/r/20240131182430.20174-1-palmer@rivosinc.com/
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
patchew-importer pushed a commit to patchew-project/qemu that referenced this pull request Jan 31, 2024
Right now we just report 0 for marchid/mvendorid in QEMU.  That's legal,
but it's tricky for users that want to check if they're running on QEMU
to do so.  This sets marchid to 42, which I've proposed as the QEMU
architecture ID (mvendorid remains 0, just explicitly set, as that's how
the ISA handles open source implementations).

Link: riscv/riscv-isa-manual#1213
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Message-Id: <20240131182430.20174-1-palmer@rivosinc.com>
Copy link
Member

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

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

Agreed.

@aswaterman aswaterman merged commit 704c6d3 into riscv:main Feb 1, 2024
2 checks passed
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.

None yet

2 participants