[PATCH 00/14] hexagon: add semihosting support

Matheus Tavares Bernardino posted 14 patches 1 week, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/cover.1783973054.git.matheus.bernardino@oss.qualcomm.com
Maintainers: Brian Cain <brian.cain@oss.qualcomm.com>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Paolo Bonzini <pbonzini@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Chao Liu <chao.liu@processmission.com>, Thomas Huth <th.huth+qemu@posteo.eu>, "Philippe Mathieu-Daudé" <philmd@mailo.com>, "Daniel P. Berrangé" <berrange@redhat.com>
There is a newer version of this series
configs/targets/hexagon-softmmu.mak       |   2 +
include/semihosting/common-semi.h         |   2 +
include/semihosting/console.h             |   9 +
include/semihosting/guestfd.h             |   9 +
include/semihosting/syscalls.h            |   2 +
target/hexagon/cpu.h                      |   1 +
target/hexagon/cpu_helper.h               |  24 +
target/hexagon/internal.h                 |   1 +
hw/hexagon/hexagon_dsp.c                  |   7 +
hw/hexagon/virt.c                         |   5 +
semihosting/arm-compat-semi.c             |   3 +-
semihosting/console.c                     |   5 +
semihosting/guestfd.c                     |   8 +
semihosting/syscalls.c                    |  29 +
target/arm/common-semi-target.c           |   4 +
target/hexagon/common-semi-target.c       |  51 ++
target/hexagon/cpu.c                      |   4 +-
target/hexagon/cpu_helper.c               | 173 +++++
target/hexagon/hexswi.c                   | 728 +++++++++++++++++++++-
target/hexagon/op_helper.c                |  18 +-
target/hexagon/translate.c                |  13 +-
target/riscv/common-semi-target.c         |   4 +
hw/hexagon/Kconfig                        |   1 +
python/qemu/machine/machine.py            |  10 +-
qemu-options.hx                           |   8 +-
target/hexagon/meson.build                |   3 +
tests/functional/hexagon/meson.build      |   9 +
tests/functional/hexagon/test_systests.py | 133 ++++
tests/functional/meson.build              |   1 +
29 files changed, 1236 insertions(+), 31 deletions(-)
create mode 100644 target/hexagon/common-semi-target.c
create mode 100644 tests/functional/hexagon/meson.build
create mode 100644 tests/functional/hexagon/test_systests.py
[PATCH 00/14] hexagon: add semihosting support
Posted by Matheus Tavares Bernardino 1 week, 5 days ago
This series adds semihosting support to hexagon system emulation,
together with functional tests for the added operations.

The Hexagon semihosting spec can be found at:
https://docs.qualcomm.com/doc/80-N2040-101_102648/topic/semihosting-specification.html

Brian Cain (4):
  semihosting: add APIs for chardev-aware guest fd routing
  target/hexagon: Add an errno mapping
  python/machine: support routing semihosting output to the test console
  tests/functional: Add hexagon semihosting systests

Matheus Tavares Bernardino (10):
  target/hexagon: fix get_phys_addr_debug with in-page offset
  target/hexagon: fix PC advancement for non-COF TB terminators
  target/hexagon: add aux functions for guest mem load/store
  hexagon: cpu_helper: add reg reading/writing helpers
  semihosting: add callback to set error
  target/hexagon: add semihosting support
  semihosting: add ftruncate helper (to be used for hexagon)
  target/hexagon: add main arch-specific semihosting operations
  target/hexagon: add COREDUMP semihosting operation
  target/hexagon: add OPEN/READ/CLOSE_DIR semihosting operations

 configs/targets/hexagon-softmmu.mak       |   2 +
 include/semihosting/common-semi.h         |   2 +
 include/semihosting/console.h             |   9 +
 include/semihosting/guestfd.h             |   9 +
 include/semihosting/syscalls.h            |   2 +
 target/hexagon/cpu.h                      |   1 +
 target/hexagon/cpu_helper.h               |  24 +
 target/hexagon/internal.h                 |   1 +
 hw/hexagon/hexagon_dsp.c                  |   7 +
 hw/hexagon/virt.c                         |   5 +
 semihosting/arm-compat-semi.c             |   3 +-
 semihosting/console.c                     |   5 +
 semihosting/guestfd.c                     |   8 +
 semihosting/syscalls.c                    |  29 +
 target/arm/common-semi-target.c           |   4 +
 target/hexagon/common-semi-target.c       |  51 ++
 target/hexagon/cpu.c                      |   4 +-
 target/hexagon/cpu_helper.c               | 173 +++++
 target/hexagon/hexswi.c                   | 728 +++++++++++++++++++++-
 target/hexagon/op_helper.c                |  18 +-
 target/hexagon/translate.c                |  13 +-
 target/riscv/common-semi-target.c         |   4 +
 hw/hexagon/Kconfig                        |   1 +
 python/qemu/machine/machine.py            |  10 +-
 qemu-options.hx                           |   8 +-
 target/hexagon/meson.build                |   3 +
 tests/functional/hexagon/meson.build      |   9 +
 tests/functional/hexagon/test_systests.py | 133 ++++
 tests/functional/meson.build              |   1 +
 29 files changed, 1236 insertions(+), 31 deletions(-)
 create mode 100644 target/hexagon/common-semi-target.c
 create mode 100644 tests/functional/hexagon/meson.build
 create mode 100644 tests/functional/hexagon/test_systests.py

-- 
2.37.2
Re: [PATCH 00/14] hexagon: add semihosting support
Posted by Pierrick Bouvier 1 week, 4 days ago
Hi Matheus,

On 7/13/2026 1:07 PM, Matheus Tavares Bernardino wrote:
> This series adds semihosting support to hexagon system emulation,
> together with functional tests for the added operations.
> 
> The Hexagon semihosting spec can be found at:
> https://docs.qualcomm.com/doc/80-N2040-101_102648/topic/semihosting-specification.html
> 
> Brian Cain (4):
>   semihosting: add APIs for chardev-aware guest fd routing
>   target/hexagon: Add an errno mapping
>   python/machine: support routing semihosting output to the test console
>   tests/functional: Add hexagon semihosting systests
> 
> Matheus Tavares Bernardino (10):
>   target/hexagon: fix get_phys_addr_debug with in-page offset
>   target/hexagon: fix PC advancement for non-COF TB terminators
>   target/hexagon: add aux functions for guest mem load/store
>   hexagon: cpu_helper: add reg reading/writing helpers
>   semihosting: add callback to set error
>   target/hexagon: add semihosting support
>   semihosting: add ftruncate helper (to be used for hexagon)
>   target/hexagon: add main arch-specific semihosting operations
>   target/hexagon: add COREDUMP semihosting operation
>   target/hexagon: add OPEN/READ/CLOSE_DIR semihosting operations
> 
>  configs/targets/hexagon-softmmu.mak       |   2 +
>  include/semihosting/common-semi.h         |   2 +
>  include/semihosting/console.h             |   9 +
>  include/semihosting/guestfd.h             |   9 +
>  include/semihosting/syscalls.h            |   2 +
>  target/hexagon/cpu.h                      |   1 +
>  target/hexagon/cpu_helper.h               |  24 +
>  target/hexagon/internal.h                 |   1 +
>  hw/hexagon/hexagon_dsp.c                  |   7 +
>  hw/hexagon/virt.c                         |   5 +
>  semihosting/arm-compat-semi.c             |   3 +-
>  semihosting/console.c                     |   5 +
>  semihosting/guestfd.c                     |   8 +
>  semihosting/syscalls.c                    |  29 +
>  target/arm/common-semi-target.c           |   4 +
>  target/hexagon/common-semi-target.c       |  51 ++
>  target/hexagon/cpu.c                      |   4 +-
>  target/hexagon/cpu_helper.c               | 173 +++++
>  target/hexagon/hexswi.c                   | 728 +++++++++++++++++++++-
>  target/hexagon/op_helper.c                |  18 +-
>  target/hexagon/translate.c                |  13 +-
>  target/riscv/common-semi-target.c         |   4 +
>  hw/hexagon/Kconfig                        |   1 +
>  python/qemu/machine/machine.py            |  10 +-
>  qemu-options.hx                           |   8 +-
>  target/hexagon/meson.build                |   3 +
>  tests/functional/hexagon/meson.build      |   9 +
>  tests/functional/hexagon/test_systests.py | 133 ++++
>  tests/functional/meson.build              |   1 +
>  29 files changed, 1236 insertions(+), 31 deletions(-)
>  create mode 100644 target/hexagon/common-semi-target.c
>  create mode 100644 tests/functional/hexagon/meson.build
>  create mode 100644 tests/functional/hexagon/test_systests.py
> 

see some build failures on windows and macos.
(feel free to ignore other one, seems to be a network outage issue).
Also, a few checkpatch style issues.
https://github.com/p-b-o/qemu-ci/actions/runs/29283651823

Regards,
Pierrick
Re: [PATCH 00/14] hexagon: add semihosting support
Posted by Brian Cain 1 week, 4 days ago
On 7/13/2026 3:07 PM, Matheus Tavares Bernardino wrote:
> This series adds semihosting support to hexagon system emulation,
> together with functional tests for the added operations.
>
> The Hexagon semihosting spec can be found at:
> https://docs.qualcomm.com/doc/80-N2040-101_102648/topic/semihosting-specification.html

Please also update docs/system/target-hexagon.rst to remove 
"Semihosting is not yet implemented in QEMU hexagon" and add a link to 
the spec.

> Brian Cain (4):
>    semihosting: add APIs for chardev-aware guest fd routing
>    target/hexagon: Add an errno mapping
>    python/machine: support routing semihosting output to the test console
>    tests/functional: Add hexagon semihosting systests
>
> Matheus Tavares Bernardino (10):
>    target/hexagon: fix get_phys_addr_debug with in-page offset
>    target/hexagon: fix PC advancement for non-COF TB terminators
>    target/hexagon: add aux functions for guest mem load/store
>    hexagon: cpu_helper: add reg reading/writing helpers
>    semihosting: add callback to set error
>    target/hexagon: add semihosting support
>    semihosting: add ftruncate helper (to be used for hexagon)
>    target/hexagon: add main arch-specific semihosting operations
>    target/hexagon: add COREDUMP semihosting operation
>    target/hexagon: add OPEN/READ/CLOSE_DIR semihosting operations
>
>   configs/targets/hexagon-softmmu.mak       |   2 +
>   include/semihosting/common-semi.h         |   2 +
>   include/semihosting/console.h             |   9 +
>   include/semihosting/guestfd.h             |   9 +
>   include/semihosting/syscalls.h            |   2 +
>   target/hexagon/cpu.h                      |   1 +
>   target/hexagon/cpu_helper.h               |  24 +
>   target/hexagon/internal.h                 |   1 +
>   hw/hexagon/hexagon_dsp.c                  |   7 +
>   hw/hexagon/virt.c                         |   5 +
>   semihosting/arm-compat-semi.c             |   3 +-
>   semihosting/console.c                     |   5 +
>   semihosting/guestfd.c                     |   8 +
>   semihosting/syscalls.c                    |  29 +
>   target/arm/common-semi-target.c           |   4 +
>   target/hexagon/common-semi-target.c       |  51 ++
>   target/hexagon/cpu.c                      |   4 +-
>   target/hexagon/cpu_helper.c               | 173 +++++
>   target/hexagon/hexswi.c                   | 728 +++++++++++++++++++++-
>   target/hexagon/op_helper.c                |  18 +-
>   target/hexagon/translate.c                |  13 +-
>   target/riscv/common-semi-target.c         |   4 +
>   hw/hexagon/Kconfig                        |   1 +
>   python/qemu/machine/machine.py            |  10 +-
>   qemu-options.hx                           |   8 +-
>   target/hexagon/meson.build                |   3 +
>   tests/functional/hexagon/meson.build      |   9 +
>   tests/functional/hexagon/test_systests.py | 133 ++++
>   tests/functional/meson.build              |   1 +
>   29 files changed, 1236 insertions(+), 31 deletions(-)
>   create mode 100644 target/hexagon/common-semi-target.c
>   create mode 100644 tests/functional/hexagon/meson.build
>   create mode 100644 tests/functional/hexagon/test_systests.py
>