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

fixup! target/hexagon: Add guest, system reg number defs #113

Open
wants to merge 126 commits into
base: hex-next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
bdb47b4
docs: Add hexagon sysemu docs
androm3da Apr 30, 2024
04c7ff3
docs/system: Add hexagon CPU emulation
androm3da Oct 26, 2024
5665b0e
target/hexagon: Fix badva reference, delete CAUSE
androm3da Aug 8, 2024
c943a9b
target/hexagon: Add missing A_CALL attr, hintjumpr to multi_cof
androm3da May 18, 2024
afb3b58
target/hexagon: Add System/Guest register definitions
androm3da May 18, 2024
3e4cb9b
target/hexagon: Make gen_exception_end_tb non-static
androm3da May 20, 2024
669bdb4
target/hexagon: Switch to tag_ignore(), generate via get_{user,sys}_t…
androm3da May 18, 2024
5aed2a2
target/hexagon: Add privilege check, use tag_ignore()
androm3da May 18, 2024
00f9aaf
target/hexagon: Add memory order definition
androm3da May 20, 2024
762ed4e
target/hexagon: Add a placeholder fp exception
androm3da May 20, 2024
f25012d
target/hexagon: Add guest, system reg number defs
androm3da May 20, 2024
4bab16a
target/hexagon: Add guest, system reg number state
androm3da May 29, 2024
e19dc3c
target/hexagon: Add TCG values for sreg, greg
androm3da May 20, 2024
a33f529
target/hexagon: Add guest/sys reg writes to DisasContext
androm3da May 20, 2024
203d40c
target/hexagon: Add imported macro, attr defs for sysemu
androm3da May 20, 2024
bd00c0d
target/hexagon: Define DCache states
androm3da Sep 9, 2024
55580c0
target/hexagon: Add new macro definitions for sysemu
androm3da May 20, 2024
eeed2ee
target/hexagon: Add handlers for guest/sysreg r/w
androm3da May 20, 2024
19899f6
target/hexagon: Add placeholder greg/sreg r/w helpers
androm3da May 20, 2024
0a9f735
target/hexagon: Add vmstate representation
androm3da Sep 8, 2024
01ce2ee
target/hexagon: Make A_PRIV, "J2_trap*" insts need_env()
androm3da May 27, 2024
269ac16
target/hexagon: Define register fields for system regs
androm3da May 24, 2024
0a39a72
target/hexagon: Implement do_raise_exception()
androm3da Sep 5, 2024
0ef74b8
target/hexagon: Add system reg insns
androm3da May 29, 2024
6498d06
target/hexagon: Add sysemu TCG overrides
androm3da Jul 8, 2024
cd07070
target/hexagon: Add implicit attributes to sysemu macros
androm3da Sep 12, 2024
7dba853
target/hexagon: Add TCG overrides for int handler insts
androm3da Jul 25, 2024
eac6352
target/hexagon: Add TCG overrides for thread ctl
androm3da Jul 25, 2024
cd8e910
target/hexagon: Add TCG overrides for rte, nmi
androm3da Jul 25, 2024
b306cbc
target/hexagon: Add sreg_{read,write} helpers
androm3da Jul 26, 2024
7d3e819
target/hexagon: Initialize htid, modectl regs
androm3da Aug 9, 2024
a521168
target/hexagon: Add locks, id, next_PC to state
androm3da Aug 10, 2024
3441dfb
target/hexagon: Add a TLB count property
androm3da Aug 10, 2024
53ef961
target/hexagon: Add {TLB,k0}lock, cause code, wait_next_pc
androm3da Aug 16, 2024
26931a4
target/hexagon: Add stubs for modify_ssr/get_exe_mode
androm3da Aug 16, 2024
d72a949
target/hexagon: Add gdb support for sys regs
androm3da Aug 27, 2024
ed96f45
target/hexagon: Add initial MMU model
androm3da Aug 26, 2024
1c2076a
target/hexagon: Add IRQ events
androm3da Aug 27, 2024
0423a95
target/hexagon: Add clear_wait_mode() definition
androm3da Aug 27, 2024
113b9e2
target/hexagon: Define f{S,G}ET_FIELD macros
androm3da Aug 27, 2024
f19a928
target/hexagon: Add hex_interrupts support
androm3da Aug 27, 2024
240f057
target/hexagon: Implement ciad helper
androm3da Aug 28, 2024
5395f01
target/hexagon: Implement {c,}swi helpers
androm3da Aug 28, 2024
aa88ca1
target/hexagon: Implement iassign{r,w} helpers
androm3da Aug 28, 2024
8416270
target/hexagon: Implement start/stop helpers
androm3da Aug 28, 2024
6043e66
target/hexagon: Implement modify SSR
androm3da Aug 28, 2024
28ba712
target/hexagon: Implement {g,s}etimask helpers
androm3da Aug 28, 2024
adc98cc
target/hexagon: Implement wait helper
androm3da Aug 28, 2024
5e21c6a
target/hexagon: Implement get_exe_mode()
androm3da Aug 28, 2024
8760976
target/hexagon: Implement arch_get_system_reg()
androm3da Aug 28, 2024
e46ac8a
target/hexagon: Implement arch_{s,g}et_{thread,system}_reg()
androm3da Aug 28, 2024
a7c7934
target/hexagon: Add representation to count cycles
androm3da Aug 29, 2024
de0bcfb
target/hexagon: Add implementation of cycle counters
androm3da Aug 29, 2024
546882a
target/hexagon: Implement modify_syscfg()
androm3da Aug 29, 2024
d6d14b9
target/hexagon: Add system event, cause codes
androm3da Sep 4, 2024
5c114b4
target/hexagon: Implement hex_tlb_entry_get_perm()
androm3da Sep 4, 2024
fb8f1cf
target/hexagon: Implement hex_tlb_lookup_by_asid()
androm3da Sep 4, 2024
af4d767
target/hexagon: Implement software interrupt
androm3da Sep 4, 2024
f36fecf
target/hexagon: Implement exec_interrupt, set_irq
androm3da Sep 5, 2024
0dc8c11
target/hexagon: Implement hexagon_tlb_fill()
androm3da Sep 5, 2024
6d0dbf5
target/hexagon: Implement siad inst
androm3da Sep 5, 2024
b8068a1
target/hexagon: Implement hexagon_resume_threads()
androm3da Sep 5, 2024
c299d68
target/hexagon: Implement setprio, resched
androm3da Sep 5, 2024
0340554
target/hexagon: Add sysemu_ops, cpu_get_phys_page_debug()
androm3da Sep 5, 2024
fc9159e
target/hexagon: Add exec-start-addr prop
androm3da Sep 5, 2024
db48cf2
target/hexagon: Add hexagon_cpu_mmu_index()
androm3da Sep 5, 2024
310f658
target/hexagon: Decode trap1, rte as COF
androm3da Sep 6, 2024
3ba3730
target/hexagon: Implement hexagon_find_last_irq()
androm3da Sep 8, 2024
fef696c
target/hexagon: Implement modify_ssr, resched, pending_interrupt
androm3da Sep 9, 2024
1c32cfb
target/hexagon: Add pkt_ends_tb to translation
androm3da Sep 9, 2024
45df6e9
target/hexagon: Add next_PC, {s,g}reg writes
androm3da Sep 9, 2024
64c21be
target/hexagon: Add implicit sysreg writes
androm3da Sep 9, 2024
9e5aa94
target/hexagon: Define system, guest reg names
androm3da Sep 11, 2024
59b249f
target/hexagon: initialize sys/guest reg TCGvs
androm3da Sep 11, 2024
bca9000
target/hexagon: Add TLB, k0 {un,}lock
androm3da Sep 12, 2024
d6574eb
target/hexagon: Define gen_precise_exception()
androm3da Sep 12, 2024
78b5d54
target/hexagon: Add TCG overrides for transfer insts
androm3da Sep 18, 2024
2796488
target/hexagon: Add support for loadw_phys
androm3da Sep 18, 2024
546bd23
target/hexagon: Add guest reg reading functionality
quic-mathbern Dec 6, 2024
b231c25
target/hexagon: Add pcycle setting functionality
androm3da Dec 11, 2024
5b5d143
hw/intc: Add l2vic interrupt controller
SidManning Nov 8, 2023
10c6ab9
hw/hexagon: Add machine configs for sysemu
androm3da Dec 2, 2023
8891ea7
hw/hexagon: Add v68, sa8775-cdsp0 defs
androm3da Oct 16, 2024
230947a
hw/hexagon: Add support for cfgbase
SidManning Dec 18, 2024
55849d3
hw/hexagon: Modify "Standalone" symbols
androm3da Oct 22, 2024
c93d9c0
target/hexagon: add build config for softmmu
androm3da Dec 2, 2023
479e2fd
hw/hexagon: Define hexagon "virt" machine
androm3da Jul 29, 2024
e47cd0a
tests/functional: Add a hexagon minivm test
androm3da Oct 26, 2024
4b4a614
target/hexagon: s/pkt_has_store/pkt_has_scalar_store
androm3da Sep 9, 2024
a839fa3
target/hexagon: Add a QTimer address prop
androm3da Jan 3, 2025
0f571a1
hw/timer: Add QTimer device
SidManning Nov 8, 2023
44dd5ac
docs: Add hexagon VM info
androm3da Jul 9, 2024
7c37ce5
target/hexagon: Implement hexagon_read_timer()
androm3da Jan 3, 2025
21174cf
semihosting: add the "usefs" feature
quic-mathbern Jan 28, 2025
ad40781
semihosting: add option for extended open() modes
quic-mathbern Jan 29, 2025
4e7a90b
semihosting: extract GET_ARG() to its own function
quic-mathbern Jan 29, 2025
1a60139
semihosting: add optional callbacks
quic-mathbern Jan 29, 2025
45429b9
semihosting: add config opt to use stdio
quic-mathbern Jan 29, 2025
6df47fd
Hexagon: add aux functions for guest mem load/store
quic-mathbern Jan 29, 2025
58b87fb
Hexagon: add semihosting support
quic-mathbern Jan 29, 2025
bcbccd1
Hexagon: add main arch-specific semihosting operations
quic-mathbern Jan 29, 2025
febff91
Hexagon: add COREDUMP semihosting operation
quic-mathbern Jan 29, 2025
81f98b4
Hexagon: add {OPEN|READ|CLOSE}_DIR semihosting operations
quic-mathbern Jan 29, 2025
f80033b
Hexagon: add semihosting check-tcg test
quic-mathbern Jan 29, 2025
6200a46
target/hexagon: fill in the 'rev' system register
quic-mathbern Feb 5, 2025
cef8e4c
target/hexagon: print full name of control regs
quic-mathbern Feb 5, 2025
0e57d99
target/hexagon: fix system register names with -d in_asm
quic-mathbern Feb 5, 2025
0f1e32b
target/hexagon: reset registers on cpu_reset
quic-mathbern Feb 5, 2025
17a3555
tests/tcg/hexagon: add MMU tests
quic-mathbern Feb 5, 2025
c349f4c
tests/tcg/hexagon: add interrupt and priority tests
quic-mathbern Feb 5, 2025
a94f0f2
tests/tcg/hexagon: add tests for system registers
quic-mathbern Feb 5, 2025
6befeee
tests/tcg/hexagon: add HVX tests
quic-mathbern Feb 5, 2025
e68daef
tests/tcg/hexagon: add l2vic tests
quic-mathbern Feb 5, 2025
4314811
target/hexagon: add utimer reg impl
androm3da Sep 24, 2024
69b6587
Hexagon (target/hexagon) Make "info tlb" work in qemu monitor
taylorsimpson Oct 29, 2024
bd558c8
Fix parameter order of call to load_elf_ram_sym fixup c13443215acf21a…
SidManning Mar 5, 2025
ebf5dee
target/hexagon: Add instruction definitions
quic-mliebel Feb 27, 2025
12a283f
FIXME: target/hexagon: Add qfloat files
quic-mliebel Feb 27, 2025
60e059d
target/hexagon: Add macro imports
quic-mliebel Feb 27, 2025
5768008
target/hexagon: Update encoding of vunpackob
quic-mliebel Mar 5, 2025
b1ae06a
target/hexagon: Add encodings
quic-mliebel Mar 5, 2025
2a8242a
target/hexagon: Add simple qfloat test
quic-mliebel Mar 5, 2025
3f0034c
Merge qtmr_rg0/rg1 into just qtmr_region
SidManning Mar 7, 2025
e6d5f63
FIXME: Add unimplemented DMA instructions
androm3da Mar 9, 2025
78f3f55
fixup! hw/intc: Add l2vic interrupt controller
SidManning Mar 10, 2025
d324787
fixup! target/hexagon: Add guest, system reg number defs
SidManning Mar 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,25 @@ Hexagon TCG CPUs
M: Brian Cain <[email protected]>
S: Supported
F: target/hexagon/
F: hw/intc/l2vic.[ch]
F: hw/hexagon/
F: hw/timer/qct-qtimer.c
F: include/hw/hexagon/
F: include/hw/timer/qct-qtimer.h
X: target/hexagon/idef-parser/
X: target/hexagon/gen_idef_parser_funcs.py
F: linux-user/hexagon/
F: tests/tcg/hexagon/
F: disas/hexagon.c
F: configs/targets/hexagon-linux-user/default.mak
F: configs/devices/hexagon-softmmu/default.mak
F: docker/dockerfiles/debian-hexagon-cross.docker
F: gdb-xml/hexagon*.xml
F: docs/system/target-hexagon.rst
F: docs/devel/hexagon-sys.rst
F: docs/devel/hexagon-l2vic.rst
F: tests/functional/test_hexagon_minivm.py
F: docs/devel/hexagon-vm.rst
T: git https://github.com/quic/qemu.git hex-next

Hexagon idef-parser
Expand Down
8 changes: 8 additions & 0 deletions configs/devices/hexagon-softmmu/default.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Default configuration for hexagon-softmmu

# Uncomment the following lines to disable these optional devices:

# Boards are selected by default, uncomment to keep out of the build.
# CONFIG_HEX_VIRT=y
# CONFIG_HEX_DSP=y
# CONFIG_L2VIC=y
10 changes: 10 additions & 0 deletions configs/targets/hexagon-softmmu.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Default configuration for hexagon-softmmu

TARGET_ARCH=hexagon
TARGET_SUPPORTS_MTTCG=y
TARGET_XML_FILES=gdb-xml/hexagon-core.xml gdb-xml/hexagon-hvx.xml gdb-xml/hexagon-sys.xml
TARGET_LONG_BITS=32
TARGET_NEED_FDT=y
CONFIG_SEMIHOSTING=y
CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
CONFIG_SEMIHOSTING_USE_STDIO=y
59 changes: 59 additions & 0 deletions docs/devel/hexagon-l2vic.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Hexagon L2 Vectored Interrupt Controller
========================================


.. code-block:: none

+-------+
| | +----------------+
| l2vic | | hexagon core |
| | | |
| +-----| | |
------> |VID0 >------------->irq2 -\ |
------> | | | | |
... > | | | | |
------> | | | <int steering> |
| +-----| | / | | \ |
| ... | | | | | | |
| +-----| | t0 t1 t2 t3 ...|
------> |VIDN | | |
------> | | | |
------> | | | |
------> | | | |
| +-----| | |
| | |Global SREG File|
| State | | |
| [ ]|<============|=>[VID ] |
| [ ]|<============|=>[VID1] |
| [ ]| | |
| [ ]| | |
| | | |
+-------+ +----------------+

L2VIC/Core Integration
----------------------

* hexagon core supports 8 external interrupt sources
* l2vic supports 1024 input interrupts mapped among 4 output interrupts
* l2vic has four output signals: { VID0, VID1, VID2, VID3 }
* l2vic device has a bank of registers per-VID that can be used to query
the status or assert new interrupts.
* Interrupts are 'steered' to threads based on { thread priority, 'EX' state,
thread interrupt mask, thread interrupt enable, global interrupt enable,
etc. }.
* Any hardware thread could conceivably handle any input interrupt, dependent
on state.
* The system register transfer instruction can read the VID0-VID3 values from
the l2vic when reading from hexagon core system registers "VID" and "VID1".
* When l2vic VID0 has multiple active interrupts, it pulses the VID0 output
IRQ and stores the IRQ number for the VID0 register field. Only after this
interrupt is cleared can the l2vic pulse the VID0 output IRQ again and provide
the next interrupt number on the VID0 register.
* The ``ciad`` instruction clears the l2vic input interrupt and un-disables the
core interrupt. If some/an l2vic VID0 interrupt is pending when this occurs,
the next interrupt should fire and any subseqeunt reads of the VID register
should reflect the newly raised interrupt.
* In QEMU, on an external interrupt or an unmasked-pending interrupt,
all vCPUs are triggered (has_work==true) and each will grab the IO lock
while considering the steering logic to determine whether they're the thread
that must handle the interrupt.
106 changes: 106 additions & 0 deletions docs/devel/hexagon-sys.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
.. _Hexagon-System-arch:

Hexagon System Architecture
===========================

The hexagon architecture has some unique elements which are described here.

Interrupts
----------
When interrupts arrive at a Hexagon DSP core, they are priority-steered to
be handled by an eligible hardware thread with the lowest priority.

Memory
------
Each hardware thread has an ``SSR.ASID`` field that contains its Address
Space Identifier. This value is catenated with a 32-bit virtual address -
the MMU can then resolve this extended virtual address to a physical address.

TLBs
----
The format of a TLB entry is shown below.

.. note::
The Small Core DSPs have a different TLB format which is not yet
supported.

.. admonition:: Diagram

.. code:: text

6 5 4 3
3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|v|g|x|A|A| | |
|a|l|P|1|0| ASID | Virtual Page |
|l|b| | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3 2 1 0
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | |
|x|w|r|u|Cacheab| Physical Page |S|
| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


* ASID: the address-space identifier
* A1, A0: the behavior of these cache line attributes are not modeled by QEMU.
* xP: the extra-physical bit is the most significant physical address bit.
* S: the S bit and the LSBs of the physical page indicate the page size
* val: this is the 'valid' bit, when set it indicates that page matching
should consider this entry.

.. list-table:: Page sizes
:widths: 25 25 50
:header-rows: 1

* - S-bit
- Phys page LSBs
- Page size
* - 1
- N/A
- 4kb
* - 0
- 0b1
- 16kb
* - 0
- 0b10
- 64kb
* - 0
- 0b100
- 256kb
* - 0
- 0b1000
- 1MB
* - 0
- 0b10000
- 4MB
* - 0
- 0b100000
- 16MB

* glb: if the global bit is set, the ASID is not considered when matching
TLBs.
* Cacheab: the cacheability attributes of TLBs are not modeled, these bits
are ignored.
* RWX: read-, write-, execute-, enable bits. Indicates if user programs
are permitted to read/write/execute the given page.
* U: indicates if user programs can access this page.

Scheduler
---------
The Hexagon system architecture has a feature to assist the guest OS
task scheduler. The guest OS can enable this feature by setting
``SCHEDCFG.EN``. The ``BESTWAIT`` register is programmed by the guest OS
to indicate the priority of the highest priority task waiting to run on a
hardware thread. The reschedule interrupt is triggered when any hardware
thread's priority in ``STID.PRIO`` is worse than the ``BESTWAIT``. When
it is triggered, the ``BESTWAIT.PRIO`` value is reset to 0x1ff.

HVX Coprocessor
---------------
The Supervisor Status Register field ``SSR.XA`` binds a DSP hardware thread
to one of the eight possible HVX contexts. The guest OS is responsible for
managing this resource.
Loading