From: Richard Henderson <richard.henderson@linaro.org>
To: Song Gao <gaosong@loongson.cn>, qemu-devel@nongnu.org
Cc: philmd@linaro.org, maobibo@loongson.cn, yangxiaojuan@loongson.cn,
c@jia.je
Subject: Re: [PATCH v2 3/8] target/loongarch: Add avail_64 to check la64-only instructions
Date: Fri, 11 Aug 2023 09:00:16 -0700 [thread overview]
Message-ID: <3d151e82-f431-37b3-dae2-e111ee3946eb@linaro.org> (raw)
In-Reply-To: <20230811100208.271649-4-gaosong@loongson.cn>
On 8/11/23 03:02, Song Gao wrote:
> The la32 manual from [1], and it is not the final version.
>
> [1]: https://www.loongson.cn/uploads/images/2023041918122813624.%E9%BE%99%E8%8A%AF%E6%9E%B6%E6%9E%8432%E4%BD%8D%E7%B2%BE%E7%AE%80%E7%89%88%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C_r1p03.pdf
I really hope this manual will be changed before final.
> -TRANS(pcaddi, ALL, gen_pc, gen_pcaddi)
> -TRANS(pcalau12i, ALL, gen_pc, gen_pcalau12i)
> +TRANS(pcaddi, 64, gen_pc, gen_pcaddi)
> +TRANS(pcalau12i, 64, gen_pc, gen_pcalau12i)
> TRANS(pcaddu12i, ALL, gen_pc, gen_pcaddu12i)
> -TRANS(pcaddu18i, ALL, gen_pc, gen_pcaddu18i)
> +TRANS(pcaddu18i, 64, gen_pc, gen_pcaddu18i)
For the compiler, PCALAU12I is much more useful than PCADDU12I.
Because PCALAU12I produces zeros in the lower 12 bits, the high-part pc-relative
relocation does not need to be paired with a corresponding low-part pc-relative relocation.
Whereas PCADDU12I produces a full 32-bit result, and the low-part pc-relative relocation
needs to know where the high-part was produced in order to compensate. This fundamental
error was made by the RISC-V ISA, and their toolchain is still paying the price.
> @@ -69,6 +77,10 @@ static bool trans_cpucfg(DisasContext *ctx, arg_cpucfg *a)
> TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE);
> TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE);
>
> + if (!avail_64(ctx)) {
> + return false;
> + }
For the operating system running on LA32, lack of CPUCFG means that you now have to
provide the cpu configuration in another way:
(1) Via compilation options, such that one operating system build will only run on a
single cpu.
(2) Via external data, like device tree.
Either option complicates the usage of LA32.
I would hope that a few words of rom for CPUCFG to read is not too expensive to
incorporate in even the smallest cpu implementation.
r~
next prev parent reply other threads:[~2023-08-11 16:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 10:02 [PATCH v2 0/8] Add some checks before translating instructions Song Gao
2023-08-11 10:02 ` [PATCH v2 1/8] target/loongarch: Fix loongarch_la464_initfn() misses setting LSPW Song Gao
2023-08-11 10:02 ` [PATCH v2 2/8] target/loongarch: Add a check parameter to the TRANS macro Song Gao
2023-08-11 15:23 ` Richard Henderson
2023-08-14 8:28 ` gaosong
2023-08-11 10:02 ` [PATCH v2 3/8] target/loongarch: Add avail_64 to check la64-only instructions Song Gao
2023-08-11 16:00 ` Richard Henderson [this message]
2023-08-14 8:28 ` gaosong
2023-08-11 10:02 ` [PATCH v2 4/8] target/loongarch: Add avail_FP/FP_SP/FP_DP to check fpu instructions Song Gao
2023-08-11 16:09 ` Richard Henderson
2023-08-14 8:28 ` gaosong
2023-08-11 10:02 ` [PATCH v2 5/8] target/loongarch: Add avail_LSPW to check LSPW instructions Song Gao
2023-08-11 16:10 ` Richard Henderson
2023-08-11 10:02 ` [PATCH v2 6/8] target/loongarch: Add avail_LAM to check atomic instructions Song Gao
2023-08-11 16:13 ` Richard Henderson
2023-08-14 8:28 ` gaosong
2023-08-11 10:02 ` [PATCH v2 7/8] target/loongarch: Add avail_LSX to check LSX instructions Song Gao
2023-08-11 16:15 ` Richard Henderson
2023-08-11 10:02 ` [PATCH v2 8/8] target/loongarch: Add avail_IOCSR to check iocsr instructions Song Gao
2023-08-11 16:17 ` Richard Henderson
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=3d151e82-f431-37b3-dae2-e111ee3946eb@linaro.org \
--to=richard.henderson@linaro.org \
--cc=c@jia.je \
--cc=gaosong@loongson.cn \
--cc=maobibo@loongson.cn \
--cc=philmd@linaro.org \
--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).