From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
To: Jay Chang <jay.chang@sifive.com>,
qemu-devel@nongnu.org, qemu-riscv@nongnu.org
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
Weiwei Li <liwei1518@gmail.com>,
Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
Frank Chang <frank.chang@sifive.com>
Subject: Re: [PATCH 2/2] hw/riscv: Refactor riscv_iommu_ctx_put() for Bare mode handling
Date: Sat, 27 Dec 2025 09:24:41 -0300 [thread overview]
Message-ID: <032d9816-fac2-4e3f-a4e5-a1ad609deb57@ventanamicro.com> (raw)
In-Reply-To: <20251211025611.99038-3-jay.chang@sifive.com>
On 12/10/25 11:56 PM, Jay Chang wrote:
> Align SPEC: Bare mode contexts are not cached, so they require
> direct memory deallocation via g_free instead of hash table cleanup.
>
> Signed-off-by: Jay Chang <jay.chang@sifive.com>
> Reviewed-by: Frank Chang <frank.chang@sifive.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> hw/riscv/riscv-iommu.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c
> index 79eee2e85e..fca5763858 100644
> --- a/hw/riscv/riscv-iommu.c
> +++ b/hw/riscv/riscv-iommu.c
> @@ -1344,7 +1344,16 @@ static RISCVIOMMUContext *riscv_iommu_ctx(RISCVIOMMUState *s,
>
> static void riscv_iommu_ctx_put(RISCVIOMMUState *s, void *ref)
> {
> - if (ref) {
> + unsigned mode = get_field(s->ddtp, RISCV_IOMMU_DDTP_MODE);
> +
> + if (!ref) {
> + return;
> + }
> +
> + /* ref is pointing to ctx in Bare mode. Bare mode ctx is not cached */
> + if (mode == RISCV_IOMMU_DDTP_MODE_BARE) {
> + g_free(ref);
> + } else {
> g_hash_table_unref((GHashTable *)ref);
> }
> }
next prev parent reply other threads:[~2025-12-27 12:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-11 2:56 [PATCH 0/2] Don't insert DDT cache in Bare mode Jay Chang
2025-12-11 2:56 ` [PATCH 1/2] hw/riscv: " Jay Chang
2025-12-27 12:24 ` Daniel Henrique Barboza
2025-12-31 10:20 ` Nutty.Liu
2025-12-11 2:56 ` [PATCH 2/2] hw/riscv: Refactor riscv_iommu_ctx_put() for Bare mode handling Jay Chang
2025-12-27 12:24 ` Daniel Henrique Barboza [this message]
2025-12-31 10:21 ` Nutty.Liu
2026-05-18 2:36 ` [PATCH 0/2] Don't insert DDT cache in Bare mode Jay Chang
2026-05-18 5:05 ` Alistair Francis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=032d9816-fac2-4e3f-a4e5-a1ad609deb57@ventanamicro.com \
--to=dbarboza@ventanamicro.com \
--cc=alistair.francis@wdc.com \
--cc=frank.chang@sifive.com \
--cc=jay.chang@sifive.com \
--cc=liwei1518@gmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.