qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>, qemu-devel@nongnu.org
Cc: yangxiaojuan@loongson.cn, gaosong@loongson.cn, chenhuacai@kernel.org
Subject: Re: [PATCH 1/2] target/mips: Implement Loongson CSR instructions
Date: Mon, 10 Jul 2023 22:11:26 +0200	[thread overview]
Message-ID: <d7fc3f2d-d3ff-a59e-7683-80eccbace371@linaro.org> (raw)
In-Reply-To: <20230521214832.20145-2-jiaxun.yang@flygoat.com>

On 21/5/23 23:48, Jiaxun Yang wrote:
> Loongson introduced CSR instructions since 3A4000, which looks
> similar to IOCSR and CPUCFG instructions we seen in LoongArch.
> 
> Unfortunately we don't have much document about those instructions,
> bit fields of CPUCFG instructions and IOCSR registers can be found
> at 3A4000's user manual, while instruction encodings can be found
> at arch/mips/include/asm/mach-loongson64/loongson_regs.h from
> Linux Kernel.
> 
> Our predefined CPUCFG bits are differ from actual 3A4000, since
> we can't emulate all CPUCFG features present in 3A4000 for now,
> we just enable bits for what we have in TCG.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>   target/mips/cpu-defs.c.inc           |  9 ++++
>   target/mips/cpu.c                    |  8 ++++
>   target/mips/cpu.h                    | 40 ++++++++++++++++
>   target/mips/helper.h                 |  4 ++
>   target/mips/internal.h               |  2 +
>   target/mips/tcg/lcsr.decode          | 17 +++++++
>   target/mips/tcg/lcsr_translate.c     | 69 ++++++++++++++++++++++++++++
>   target/mips/tcg/meson.build          |  2 +
>   target/mips/tcg/op_helper.c          | 16 +++++++
>   target/mips/tcg/sysemu/lcsr_helper.c | 45 ++++++++++++++++++
>   target/mips/tcg/sysemu/meson.build   |  4 ++
>   target/mips/tcg/sysemu_helper.h.inc  |  8 ++++
>   target/mips/tcg/translate.c          |  3 ++
>   target/mips/tcg/translate.h          |  7 +++
>   14 files changed, 234 insertions(+)
>   create mode 100644 target/mips/tcg/lcsr.decode
>   create mode 100644 target/mips/tcg/lcsr_translate.c
>   create mode 100644 target/mips/tcg/sysemu/lcsr_helper.c


> @@ -1162,6 +1192,10 @@ typedef struct CPUArchState {
>       QEMUTimer *timer; /* Internal timer */
>       Clock *count_clock; /* CP0_Count clock */
>       target_ulong exception_base; /* ExceptionBase input to the core */
> +
> +    /* Loongson IOCSR memory */
> +    AddressSpace address_space_iocsr;
> +    MemoryRegion system_iocsr;
>   } CPUMIPSState;

Guarding to avoid on user emulation:

../target/mips/cpu.h:1198:22: error: field ‘as’ has incomplete type
  1198 |         AddressSpace as;
       |                      ^~
../target/mips/cpu.h:1199:22: error: field ‘mr’ has incomplete type
  1199 |         MemoryRegion mr;
       |                      ^~



  parent reply	other threads:[~2023-07-10 20:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-21 21:48 [PATCH 0/2] MIPS: Enable Loongson-3A4000 TCG for system emulation Jiaxun Yang
2023-05-21 21:48 ` [PATCH 1/2] target/mips: Implement Loongson CSR instructions Jiaxun Yang
2023-05-22  6:00   ` Philippe Mathieu-Daudé
2023-07-10 11:03     ` Philippe Mathieu-Daudé
2023-07-10 20:00   ` Philippe Mathieu-Daudé
2023-07-10 20:11   ` Philippe Mathieu-Daudé [this message]
2023-07-10 21:34     ` Philippe Mathieu-Daudé
2023-05-21 21:48 ` [PATCH 2/2] hw/mips/loongson3_virt: Remove CPU restrictions for TCG Jiaxun Yang
2023-05-22  6:03   ` Philippe Mathieu-Daudé
2023-05-22 12:08   ` Philippe Mathieu-Daudé
2023-05-22 12:43     ` Jiaxun Yang
2023-07-10 19:54 ` [PATCH 0/2] MIPS: Enable Loongson-3A4000 TCG for system emulation Philippe Mathieu-Daudé

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=d7fc3f2d-d3ff-a59e-7683-80eccbace371@linaro.org \
    --to=philmd@linaro.org \
    --cc=chenhuacai@kernel.org \
    --cc=gaosong@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yangxiaojuan@loongson.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).