Skip to content

Conversation

@stephanosio
Copy link
Member

Zephyr-specific patches for QEMU 7.0.0

galak and others added 6 commits June 21, 2022 19:16
Exisitng 10m50_devboard is not supporting qemu-niso2 on Zephyr OS
and the reason might be that the softcpu build may be different
for Linux and Zephyr OS.

So added support for Zephyr qemu-nios2 board.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This commit add LEON2 support.  It is taken from AdaCore Qemu
repository at https://github.com/adacore/qemu.

AdaCore/qemu@9d94f4803

The following is the original commit message.

> Part of K104-004.
>
> --- merged with ---
>
> Add plug-ins and GNATbus to leon
>
> --- merged with ---
>
> Add HostFs device to leon
>
> 2019-03-24  KONRAD Frederic  <konrad@adacore.com>
>     * hw/sparc/leon.c: fix load_elf parameters.
> 2019-02-01  KONRAD Frederic  <konrad@adacore.com>
>     * hw/sparc/leon.c: drop plugin.
> 2018-06-08  KONRAD Frederic  <konrad@adacore.com>
>     * hw/sparc/leon.c: fixed against serial_hds disparition
> 2018-04-06  KONRAD Frederic  <konrad@adacore.com>
>     * hw/sparc/leon.c: Use cpu_type instead of cpu_model which has been
>                        dropped.
> 2018-02-12  KONRAD Frederic  <konrad@adacore.com>
>     * hw/sparc/leon.c: Update to new Chardev API.
>     * hw/sparc/leon.c: Update to hostfs, gnatbus, plugin source
>                        reorganization.
>     * hw/sparc/leon.c: Update leon2_intctl_ack prototype.
>
> Change-Id: I594757ad137370479b152e5de8de7be7caf9a911

Signed-off-by: Yasushi SHOJI <y-shoji@ispace-inc.com>
The previous commit, taken from AdaCore repository as is for future
reference, depends on other commit in the AdaCore repository and fails
to build.  This commit is to port it to the vanilla QEmu.

What it does is 4 folds:

- Remove AdaCore specific headers and function calls.
- Add necessarily headers to build.
- Use env_cpu instead of CPU() as per
  29a0af6.
- Update for intctl_ack API change introduced by
  7922703.

Signed-off-by: Yasushi SHOJI <y-shoji@ispace-inc.com>
…EGISTER

Accessing timer1 counter register (offset 0x40) always returned 0
because the address range check for leon_timer_io_read() was
insufficient.  Add TIMER_1_COUNTER_REGISTER at the case statement.

We don't need to add TIMER_1_COUNTER_REGISTER for
leon_timer_io_write() because timer1 counter register isn't
writable. But, this commit also changes the range check for
leon_timer_io_write() as well for consistency.  The given address is
checked in leon_timer_io_write() again, thus the change is effectively
no-op for non-writable registers.

Signed-off-by: Yasushi SHOJI <y-shoji@ispace-inc.com>
Switch the leon code away from old ptimers to the new
transaction-based ptimer API.  This requires adding begin/commit calls
around the various places that modify the ptimer state, and not
calling leon_timer_enable() from leon_timer_hit() since
leon_timer_hit() is called within a transcation enabled ptimer_tick().

Signed-off-by: Yasushi SHOJI <y-shoji@ispace-inc.com>
Make updates to build due to upstream changes in qemu 6.0.0

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Copy link
Member Author

@stephanosio stephanosio left a comment

Choose a reason for hiding this comment

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

@stephanosio stephanosio deleted the zephyr-qemu-v7.0.0_patches branch June 22, 2022 07:16
nashif pushed a commit that referenced this pull request May 16, 2025
ASAN detected a leak when running the ahci-test
/ahci/io/dma/lba28/retry:

Direct leak of 35 byte(s) in 1 object(s) allocated from:
    #0 in malloc
    #1 in __vasprintf_internal
    #2 in vasprintf
    #3 in g_vasprintf
    #4 in g_strdup_vprintf
    #5 in g_strdup_printf
    #6 in object_get_canonical_path ../qom/object.c:2096:19
    #7 in blk_get_attached_dev_id_or_path ../block/block-backend.c:1033:12
    #8 in blk_get_attached_dev_path ../block/block-backend.c:1047:12
    #9 in send_qmp_error_event ../block/block-backend.c:2140:36
    #10 in blk_error_action ../block/block-backend.c:2172:9
    #11 in ide_handle_rw_error ../hw/ide/core.c:875:5
    #12 in ide_dma_cb ../hw/ide/core.c:894:13
    qemu#13 in dma_complete ../system/dma-helpers.c:107:9
    qemu#14 in dma_blk_cb ../system/dma-helpers.c:129:9
    qemu#15 in blk_aio_complete ../block/block-backend.c:1552:9
    qemu#16 in blk_aio_write_entry ../block/block-backend.c:1619:5
    qemu#17 in coroutine_trampoline ../util/coroutine-ucontext.c:175:9

Plug the leak by freeing the device path string.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20241111145214.8261-1-farosas@suse.de>
[PMD: Use g_autofree]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20241111170333.43833-3-philmd@linaro.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 23ea425)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
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.

4 participants