qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: lixianglai <lixianglai@loongson.cn>, qemu-devel@nongnu.org
Cc: maobibo@loongson.cn, Song Gao <gaosong@loongson.cn>,
	Xiaojuan Yang <yangxiaojuan@loongson.cn>,
	zhaotianrui@loongson.cn
Subject: Re: [PATCH V2 1/1] target/loongarch: Fixed tlb huge page loading issue
Date: Tue, 5 Mar 2024 05:37:39 -1000	[thread overview]
Message-ID: <dd5d998d-2c2e-4757-8e18-ae424df4f6a2@linaro.org> (raw)
In-Reply-To: <aa2670bd-b01d-6cc5-d6ad-9e807ed0abe4@loongson.cn>

On 3/4/24 20:21, lixianglai wrote:
> Hi Richard:
>> On 3/4/24 17:51, Xianglai Li wrote:
>>> When we use qemu tcg simulation, the page size of bios is 4KB.
>>> When using the level 2 super large page (page size is 1G) to create the page table,
>>> it is found that the content of the corresponding address space is abnormal,
>>> resulting in the bios can not start the operating system and graphical interface normally.
>>>
>>> The lddir and ldpte instruction emulation has
>>> a problem with the use of super large page processing above level 2.
>>> The page size is not correctly calculated,
>>> resulting in the wrong page size of the table entry found by tlb.
>>>
>>> Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
>>> Cc: maobibo@loongson.cn
>>> Cc: Song Gao <gaosong@loongson.cn>
>>> Cc: Xiaojuan Yang <yangxiaojuan@loongson.cn>
>>> Cc: zhaotianrui@loongson.cn
>>> ---
>>>   target/loongarch/cpu.h            |  1 +
>>>   target/loongarch/tcg/tlb_helper.c | 21 ++++++++++++---------
>>>   2 files changed, 13 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
>>> index ec37579fd6..eab3e41c71 100644
>>> --- a/target/loongarch/cpu.h
>>> +++ b/target/loongarch/cpu.h
>>> @@ -292,6 +292,7 @@ typedef struct CPUArchState {
>>>       uint32_t fcsr0_mask;
>>>         uint32_t cpucfg[21];
>>> +    uint32_t lddir_ps;
>>
>> This magical cpu state does not appear in the manual.
> 
> The hardware instruction manual is hosted on github at
> 
> https://github.com/loongson/LoongArch-Documentation
> 
>> Are you sure that large pages above level 2 are really supported by LDDIR?
> 
> 
> Yes,We have done tests on the physical cpu of loongarch64 and
> 
> it works fine with a level 2 large page on the physical cpu.
> 
> 
>>
>> Some explanation from the hardware engineering side is required.
> 
> The description of lddir hardware manual is as follows:
> 
> 
> Instruction formats:
> 
> |lddir rd, rj, level|
> 
> The|LDDIR|instruction is used for accessing directory entries during software page table 
> walking.
> 
> If bit|[6]|of the general register|rj|is|0|, it means that the content of|rj|is the 
> physical address of the
> 
> base address of the level page table at this time. In this case, the|LDDIR|instruction 
> will access the level
> 
> page table according to the current TLB refill address, retrieve the base address of the 
> corresponding
> 
> |level+1|page table, and write it to the general register|rd|.
> 
> 
> reference:
> 
> https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html
> 
> 
>           4.2.5.1.|LDDIR|

Yes, I have this manual.  Please highlight the portion of this description that 
corresponds to the LDDIR_PS variable that you add.


r~


  reply	other threads:[~2024-03-05 15:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05  3:51 [PATCH V2 0/1] target/loongarch: Fixed tlb huge page loading issue Xianglai Li
2024-03-05  3:51 ` [PATCH V2 1/1] " Xianglai Li
2024-03-05  4:34   ` Richard Henderson
2024-03-05  6:21     ` lixianglai
2024-03-05 15:37       ` Richard Henderson [this message]
2024-03-06  3:52         ` lixianglai
2024-03-06  4:10           ` Richard Henderson
2024-03-06  7:38             ` maobibo
2024-03-06 17:46               ` 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=dd5d998d-2c2e-4757-8e18-ae424df4f6a2@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=gaosong@loongson.cn \
    --cc=lixianglai@loongson.cn \
    --cc=maobibo@loongson.cn \
    --cc=qemu-devel@nongnu.org \
    --cc=yangxiaojuan@loongson.cn \
    --cc=zhaotianrui@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).