mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jiaxun Yang" <jiaxun.yang@flygoat.com>
To: "Huacai Chen" <chenhuacai@kernel.org>
Cc: "Jianmin Lv" <lvjianmin@loongson.cn>,
	"Xuerui Wang" <kernel@xen0n.name>,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH 2/2] LoongArch: Fix ACPI standard register based S3 support
Date: Fri, 14 Jun 2024 03:44:36 +0100	[thread overview]
Message-ID: <b291e5fb-bf3a-4129-96a0-99182e11f506@app.fastmail.com> (raw)
In-Reply-To: <CAAhV-H5C0rn-bY11FxoGANX+hEFrrbpj095ZAEbjC0ksQGuWpA@mail.gmail.com>



在2024年6月14日六月 上午3:32,Huacai Chen写道:
> On Fri, Jun 14, 2024 at 10:25 AM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>>
>>
>>
>> 在2024年6月14日六月 上午3:11,Huacai Chen写道:
>> > Hi, Jiaxun,
>> >
>> > On Fri, Jun 14, 2024 at 12:41 AM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>> >>
>> >> Most LoongArch 64 machines are using custom "SADR" ACPI extension
>> >> to perform ACPI S3 sleep. However the standard ACPI way to perform
>> >> sleep is to write a value to ACPI PM1/SLEEP_CTL register, and this
>> >> is never supported properly in kernel.
>> > Maybe our hardware is insane so we need "SADR", if so, this patch may
>> > break real hardware. What's your opinion, Jianmin?
>>
>> I understand why your hardware need SADR. Most systems DDR self-refresh
>> mode needs to be setup by firmware.
> _S3 is also a firmware method, why we can't use it to setup self-refresh?

That's the problem from ACPI spec. As per ACPI spec _S3 method only tells
you what should you write into PM1 or SLEEP_CTL register, it will NOT perform
actual task to enter sleeping. (See 16.1.3.1 [1])

On existing LoongArch hardware _S3 method is only used to mark presence of S3
state. This is violating ACPI spec, but I guess we must live with it.

Furthermore, on Loongson hardware you have to disable access to DDR memory
to access DDR controller's configuration registers. Which means self-refresh
code must run from BIOS ROM.

[1]: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/16_Waking_and_Sleeping/sleeping-states.html

Thanks
- Jiaxun

>
> Huacai
>
>>
>> There is no chance that it may break real hardware. When firmware supplied
>> SADR it will always use SADR. The fallback only happens when _S3 method exist
>> but no SADR supplied, which won't happen on real hardware.
>>
>> For QEMU we don't have stub firmware but standard compliant SEEP_CTL is
>> sufficient for entering sleep mode, thus we need this fallback path.
>>
>> Thanks
>>
>> >
>> > Huacai
>> >
>> >>
>>
>> --
>> - Jiaxun
>>

-- 
- Jiaxun

  reply	other threads:[~2024-06-14  2:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 16:41 [PATCH 0/2] LoongArch: Fix S3 sleep on U-Boot + QEMU virt machine Jiaxun Yang
2024-06-13 16:41 ` [PATCH 1/2] LoongArch: Initialise unused Direct Map Windows Jiaxun Yang
2024-06-14  2:13   ` Huacai Chen
2024-06-14  2:17     ` Jiaxun Yang
2024-06-17 13:49       ` Huacai Chen
2024-06-13 16:41 ` [PATCH 2/2] LoongArch: Fix ACPI standard register based S3 support Jiaxun Yang
2024-06-14  2:11   ` Huacai Chen
2024-06-14  2:24     ` Jiaxun Yang
2024-06-14  2:32       ` Huacai Chen
2024-06-14  2:44         ` Jiaxun Yang [this message]
2024-06-17 13:49           ` Huacai Chen

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=b291e5fb-bf3a-4129-96a0-99182e11f506@app.fastmail.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=chenhuacai@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=lvjianmin@loongson.cn \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®