qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: WANG Xuerui <i.qemu@xen0n.name>
To: gaosong <gaosong@loongson.cn>
Cc: "Xiaojuan Yang" <yangxiaojuan@loongson.cn>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [PATCH v14 02/26] target/loongarch: Add core definition
Date: Wed, 12 Jan 2022 18:26:17 +0800	[thread overview]
Message-ID: <d13f1bff-191a-d3e9-d313-de7a44ce0f4a@xen0n.name> (raw)
In-Reply-To: <7e5eac9c-a6d6-82eb-3209-dc5e07479cfa@loongson.cn>

[-- Attachment #1: Type: text/plain, Size: 2833 bytes --]

Hi,

On 2022/1/12 18:17, gaosong wrote:
>
> Hi,
>
> On 2022/1/12 下午5:28, gaosong wrote:
>>>> +    data = FIELD_DP32(data, CPUCFG16, L3_IUUNIFY, 1);
>>>> +    data = FIELD_DP32(data, CPUCFG16, L3_IUINCL, 1);
>>>> +    env->cpucfg[16] = data;
>>>> +
>>>> +    data = 0;
>>>> +    data = FIELD_DP32(data, CPUCFG17, L1IU_WAYS, 0x8003);
>>>
>>> This seems out-of-place, according to the manual this field is Way-1
>>> for the L1I cache, so you have 0x8004=32772 ways in this cache?
>>>
>>> Same for all similar constructions below.
>>>
>> I have time to reply to your comment now.
>> As in the previous comments, I don't remember which one,these values should be the same as the values of the physical environment. I dumped 'CPUCFG17' value again,
>> the value is no problem. Maybe you didn't think about dumping these values when you commented. The value of  'L11U_SIZE' is dumped to be 0. and cpucfg[i] has been 
>> initialized to 0 before. There is no need to set it again.
> Not quite right,  cpucfg[17] is '0x60800003', I missed a '0',  I don't know from which version it's wrong
> Thank you very much,  if I hadn't dumped the value today, I wouldn't have realized the wrong.  

Still not quite right; maybe you made a typo there as the value is
`0x06080003` (the fields are all whole bytes/shorts, so very easy to
recognize).

I used the following snippet to get real values from the 3A5000 system:

    #include <stdio.h>

    int cpucfg(const int sel)
    {
            int ret;
            __asm__ __volatile__("cpucfg %0, %1" : "=r"(ret) : "r"(sel));
            return ret;
    }

    int main(void)
    {
            int i;
            int c;
            for (i = 0; i < 64; i++) {
                    c = cpucfg(i);
                    if (!c) {
                            continue;
                    }
                    printf("CPUCFG.0x%-2x = 0x%08x\n", i, c);
            }

            return 0;
    }

And I got the following output so we can cross-check:

    CPUCFG.0x0  = 0x0014c010
    CPUCFG.0x1  = 0x03f2f2fe
    CPUCFG.0x2  = 0x007ccfc7
    CPUCFG.0x3  = 0x0000fcff
    CPUCFG.0x4  = 0x05f5e100
    CPUCFG.0x5  = 0x00010001
    CPUCFG.0x6  = 0x00007f33
    CPUCFG.0x10 = 0x00002c3d
    CPUCFG.0x11 = 0x06080003
    CPUCFG.0x12 = 0x06080003
    CPUCFG.0x13 = 0x0608000f
    CPUCFG.0x14 = 0x060e000f
    CPUCFG.0x30 = 0x0000000e

Obviously the 0x30 leaf is undocumented, but not implementing it
shouldn't matter either, as userspace has no way to make use of that
when people aren't even aware of its existence. The other fields are of
course to be checked to only leave the implemented bits set in the QEMU
implementation.

Hope that helps!

[-- Attachment #2: Type: text/html, Size: 4426 bytes --]

  reply	other threads:[~2022-01-12 10:28 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06  9:41 [PATCH v14 00/26] Add LoongArch linux-user emulation support Song Gao
2022-01-06  9:41 ` [PATCH v14 01/26] target/loongarch: Add README Song Gao
2022-01-09  9:24   ` WANG Xuerui
2022-01-06  9:41 ` [PATCH v14 02/26] target/loongarch: Add core definition Song Gao
2022-01-09  9:25   ` WANG Xuerui
2022-01-09 18:49     ` Richard Henderson
2022-01-10 12:34       ` gaosong
2022-01-10 15:20         ` WANG Xuerui
2022-01-10 13:00     ` gaosong
2022-01-10 15:11       ` WANG Xuerui
2022-01-12  9:28     ` gaosong
2022-01-12 10:17       ` gaosong
2022-01-12 10:26         ` WANG Xuerui [this message]
2022-01-06  9:41 ` [PATCH v14 03/26] target/loongarch: Add main translation routines Song Gao
2022-01-09  9:25   ` WANG Xuerui
2022-01-06  9:41 ` [PATCH v14 04/26] target/loongarch: Add fixed point arithmetic instruction translation Song Gao
2022-01-06  9:41 ` [PATCH v14 05/26] target/loongarch: Add fixed point shift " Song Gao
2022-01-06  9:41 ` [PATCH v14 06/26] target/loongarch: Add fixed point bit " Song Gao
2022-01-06  9:41 ` [PATCH v14 07/26] target/loongarch: Add fixed point load/store " Song Gao
2022-01-06  9:41 ` [PATCH v14 08/26] target/loongarch: Add fixed point atomic " Song Gao
2022-01-06  9:41 ` [PATCH v14 09/26] target/loongarch: Add fixed point extra " Song Gao
2022-01-06  9:41 ` [PATCH v14 10/26] target/loongarch: Add floating point arithmetic " Song Gao
2022-01-06  9:41 ` [PATCH v14 11/26] target/loongarch: Add floating point comparison " Song Gao
2022-01-06  9:41 ` [PATCH v14 12/26] target/loongarch: Add floating point conversion " Song Gao
2022-01-06  9:41 ` [PATCH v14 13/26] target/loongarch: Add floating point move " Song Gao
2022-01-06  9:41 ` [PATCH v14 14/26] target/loongarch: Add floating point load/store " Song Gao
2022-01-06  9:41 ` [PATCH v14 15/26] target/loongarch: Add branch " Song Gao
2022-01-06  9:41 ` [PATCH v14 16/26] target/loongarch: Add disassembler Song Gao
2022-01-09  9:25   ` WANG Xuerui
2022-01-09 18:51     ` Richard Henderson
2022-01-06  9:41 ` [PATCH v14 17/26] linux-user: Add LoongArch generic header files Song Gao
2022-01-06  9:41 ` [PATCH v14 18/26] linux-user: Add LoongArch specific structures Song Gao
2022-01-07  4:29   ` Richard Henderson
2022-01-06  9:41 ` [PATCH v14 19/26] linux-user: Add LoongArch signal support Song Gao
2022-01-07  4:58   ` Richard Henderson
2022-01-09  9:25   ` WANG Xuerui
2022-01-06  9:41 ` [PATCH v14 20/26] linux-user: Add LoongArch elf support Song Gao
2022-01-09  9:25   ` WANG Xuerui
2022-01-06  9:41 ` [PATCH v14 21/26] linux-user: Add LoongArch syscall support Song Gao
2022-01-09  9:25   ` WANG Xuerui
2022-01-06  9:41 ` [PATCH v14 22/26] linux-user: Add LoongArch cpu_loop support Song Gao
2022-01-09  9:25   ` WANG Xuerui
2022-01-06  9:41 ` [PATCH v14 23/26] default-configs: Add loongarch linux-user support Song Gao
2022-01-09  9:25   ` WANG Xuerui
2022-01-06  9:41 ` [PATCH v14 24/26] target/loongarch: Add target build suport Song Gao
2022-01-09  9:25   ` WANG Xuerui
2022-01-06  9:41 ` [PATCH v14 25/26] target/loongarch: 'make check-tcg' support Song Gao
2022-01-09  9:25   ` WANG Xuerui
2022-01-06  9:42 ` [PATCH v14 26/26] scripts: add loongarch64 binfmt config Song Gao
2022-01-09  9:25   ` WANG Xuerui
2022-01-07  5:01 ` [PATCH v14 00/26] Add LoongArch linux-user emulation support Richard Henderson
2022-01-07  7:59   ` gaosong
2022-01-09  5:09     ` WANG Xuerui

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=d13f1bff-191a-d3e9-d313-de7a44ce0f4a@xen0n.name \
    --to=i.qemu@xen0n.name \
    --cc=f4bug@amsat.org \
    --cc=gaosong@loongson.cn \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).