Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp543645lqs; Thu, 13 Jun 2024 19:45:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXAuKJ3TamV8MXQGGeS864OKIp2lrc3DHx3Q2sQjaxRfMUePU+Z31nDdXkrNGB6dfeCVNJs8I+zM8T7lEgUmgfEvrvGDYceSr6RpjjfRQ== X-Google-Smtp-Source: AGHT+IEie3lBGCfqvtYeaGDMBnNehnhvm+pgBMG8fRXBL6VEeW+9i+T5qwK6kkFWIw/2oD7lt/UN X-Received: by 2002:a05:6830:1e6b:b0:6f9:b4fa:2215 with SMTP id 46e09a7af769-6fb93506d75mr1617510a34.10.1718333108296; Thu, 13 Jun 2024 19:45:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718333108; cv=pass; d=google.com; s=arc-20160816; b=Y3AmHJ64Ve38yFDIQQQZSLfcDSRHkosn+vfn+oDYQmNp30HOys5S6w/ZiXvh9SQINH qrXPvm8ul/t1cfWdAug/DozR7oOTRT8uANfHNrWZAggqk+RO4FqptWUs2oG7NaRz87Zk pefZftnB/ZJK5tTsDuVYviSF3aIe9PzK1GrD6AlEDlqZj5tVY+LzjwOFOKYOObqswlVN lUSLxIUvVvM6yYED3bJcbzWb6uVf8X3lT4LjPWXb4AsfoUi4z6eFRWR+gWv8+VvQ8vWD Sb9sa4Jhi5ZN8tQJp6NziWpoNk2vpDDxnX2TPfHTpAsoVBB37R8Z1CThOmmcMWaY/9pq Jmog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:subject:cc:to:from:date:references :in-reply-to:message-id:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:user-agent:feedback-id:dkim-signature :dkim-signature; bh=DGZI5mG40FnyaDB0BC1fbYrQ9V/VYVQVkIVUveeQsQI=; fh=TcXuPGGxGy974GrqlE/28bEut3PgUMyzwWSOXP+VxM0=; b=0q1V2gRIdXNADnEE+gXXdYszTwOEWRJjtZx+2Mw0cz4REUxyjIQirs4i36XPrtvnqb 99yDRaXIt5EZ0Ky9OW4OE9yIQW3QRRdnU8gS9NCWbBZaJkVhhPrCjndDvbg255/Zfx4A 1Njiph+ZoBvMGvgURLA2EAtQ6T3Kq5nqb/CdFKQcDjI//iwZI7zk60uLNCifW8efXp1W vIBqy39Fs1rN/TNgLRyOFVokAL0yMVb/KVwgGZQYP0FC33nTowZr82iPEW14AD5BFvcQ NSwvg9DRxrzRGKMuTemnB2KgJ9DHs0AePB938QWeGPVvDGNUcFfFwR4uxc2iHssXY5Sk cgqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=JvoDMu8G; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=qtefudHW; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-214245-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214245-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fede8239c1si2420643a12.236.2024.06.13.19.45.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 19:45:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214245-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=JvoDMu8G; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=qtefudHW; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-214245-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214245-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D71E22840E9 for ; Fri, 14 Jun 2024 02:45:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F16BF1836C7; Fri, 14 Jun 2024 02:44:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="JvoDMu8G"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="qtefudHW" Received: from fout7-smtp.messagingengine.com (fout7-smtp.messagingengine.com [103.168.172.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78FE118308F; Fri, 14 Jun 2024 02:44:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.150 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718333098; cv=none; b=jfoc+DUEC3KVENrVGLlJuHn7vryPoI8uSQ7xC7gxA806PFlumuHvAUARIllWl6DbvsvmDfXEcDw84qoqgOtFChBSDjW6Y4p8nF2gkbLdjbO4zDEW63+ykesSVXzjnXcMI+u4o/mr7Ab23j3dloq5dnMwLaKSY3fdFNzoDefXLLo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718333098; c=relaxed/simple; bh=DGZI5mG40FnyaDB0BC1fbYrQ9V/VYVQVkIVUveeQsQI=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=lLb0AIiguhoM7oHMLrfFymY6YyFFM++TRdGoDmI5OHhwAJnMXHgN0AZ0DxK2thhJKUpyGEuUchIsGg8osC1p15xVEM/8PJfLH04FDlz4JRhdAMcpvm+bq7EEOimkmw4XJdGTQna8vzWFIoo4gXxB1KFMwgfZJGhtiMAQ/76yJyc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=JvoDMu8G; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=qtefudHW; arc=none smtp.client-ip=103.168.172.150 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.nyi.internal (Postfix) with ESMTP id 8CE1013801A4; Thu, 13 Jun 2024 22:44:56 -0400 (EDT) Received: from imap44 ([10.202.2.94]) by compute3.internal (MEProxy); Thu, 13 Jun 2024 22:44:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1718333096; x=1718419496; bh=DGZI5mG40FnyaDB0BC1fbYrQ9V/VYVQVkIVUveeQsQI=; b= JvoDMu8GtVyp/R7dzBMEhsJaWn3rMv3yGKSDsQgoC6JYmqsVf92GxAs9qnrgt5h9 VW9YbiNmkCV2aX8alm6YUmmMoueg/A7epiVr1dX64dwYU9cF8fNJTMcoxmpX+YeQ 8QghXkxTGa79NXx73/4+Ch5n2PDhy/LkyZKwDX/J37sYxBqBTmnV33ZaqjhBgUYN W4UBysPQTeyYqc0OZ517U20coAKhUBztawapEs3gJEBAj+MTFagqov5f0cWdGxu0 Aag6RjR4aDvJCxdYsr9bDw08Mb6cVAO+ESCbT2Z/IGkSQi6pUnaMtT+++QGQb9NR IKRlj4lhI+mWf8D3CDcqnw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1718333096; x= 1718419496; bh=DGZI5mG40FnyaDB0BC1fbYrQ9V/VYVQVkIVUveeQsQI=; b=q tefudHW7BEfc2lKY1jot8DKvoh/aWDHpoooOZ6nLjPh5Kp9dOPkAXIT7yl2BNqj8 r9cf5XMeFyPYGjtzDtKmb6EfA6piN4wyKWIXLezFOUxVgZ6RhPYN4lCIJsoukR+y rsLUbIUrmtMVT4enAJmKBwBqR36XKWewROK7r1GusvAghyrOpQ45tXYT7Um1KyGg 6SFqW2GvkjY9o7Lci2mxne9/49EpndNNsu5xdb1DI4dhBwXJL5wMylz8EArUBcNZ dHB0b67YxHzEtivCh2W93ezpFj9PyPF9SwvL4Ud1Eb26fBe5WDpPI5LIp13f8t7O kKMrD63HeIOifT5wAlmzA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedukedgiedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtgfesthhqredtreerjeenucfhrhhomhepfdfl ihgrgihunhcujggrnhhgfdcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtoh hmqeenucggtffrrghtthgvrhhnpeeivdefffdvgfegfeehjeelteevheehkeefvdffhfej tdejvdeuhedtgfekudelleenucffohhmrghinhepuhgvfhhirdhorhhgnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghn ghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 676B736A0074; Thu, 13 Jun 2024 22:44:55 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-515-g87b2bad5a-fm-20240604.001-g87b2bad5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: In-Reply-To: References: <20240613-loongarch64-sleep-v1-0-a245232af5e4@flygoat.com> <20240613-loongarch64-sleep-v1-2-a245232af5e4@flygoat.com> Date: Fri, 14 Jun 2024 03:44:36 +0100 From: "Jiaxun Yang" To: "Huacai Chen" Cc: "Jianmin Lv" , "Xuerui Wang" , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, "stable@vger.kernel.org" Subject: Re: [PATCH 2/2] LoongArch: Fix ACPI standard register based S3 support Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable =E5=9C=A82024=E5=B9=B46=E6=9C=8814=E6=97=A5=E5=85=AD=E6=9C=88 =E4=B8=8A=E5= =8D=883:32=EF=BC=8CHuacai Chen=E5=86=99=E9=81=93=EF=BC=9A > On Fri, Jun 14, 2024 at 10:25=E2=80=AFAM Jiaxun Yang wrote: >> >> >> >> =E5=9C=A82024=E5=B9=B46=E6=9C=8814=E6=97=A5=E5=85=AD=E6=9C=88 =E4=B8=8A= =E5=8D=883:11=EF=BC=8CHuacai Chen=E5=86=99=E9=81=93=EF=BC=9A >> > Hi, Jiaxun, >> > >> > On Fri, Jun 14, 2024 at 12:41=E2=80=AFAM Jiaxun Yang 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 m= ay >> > break real hardware. What's your opinion, Jianmin? >> >> I understand why your hardware need SADR. Most systems DDR self-refre= sh >> mode needs to be setup by firmware. > _S3 is also a firmware method, why we can't use it to setup self-refre= sh? 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 pe= rform 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 memo= ry to access DDR controller's configuration registers. Which means self-ref= resh code must run from BIOS ROM. [1]: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/16_Waking_and_Sleepin= g/sleeping-states.html Thanks - Jiaxun > > Huacai > >> >> There is no chance that it may break real hardware. When firmware sup= plied >> SADR it will always use SADR. The fallback only happens when _S3 meth= od 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 >> --=20 - Jiaxun