From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::244; helo=mail-wm0-x244.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C751022137D89 for ; Thu, 14 Dec 2017 07:44:37 -0800 (PST) Received: by mail-wm0-x244.google.com with SMTP id f9so12403221wmh.0 for ; Thu, 14 Dec 2017 07:49:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/sdr+gvsGeMhnujeBhkCNhLTu3inVfyKZWA20kdhT5o=; b=Shy8dmIp1wvZ3t2H+JgspHyZvXuivlQpzgpjG2x4AZvpE+72Z/vqWF6uopqg1iKUE3 KeToIHUKh5otSJdE9B+2LU1Vo7GQmGsP8fLG5avczq89ZIAowl5u+SeGy9nfIRMkb5J1 Hvs0UfLrckJU+vmWgNUo47H8HHvN2euCsVMO8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/sdr+gvsGeMhnujeBhkCNhLTu3inVfyKZWA20kdhT5o=; b=P+dR5yRVmVDB3dnzhGwxq5tGrX0msY4sKzb0Fx2f2EKfdz6yGAa5J8RZlxS9s+Zbec N3x1RpQ1ZNKlebUaLWqzRll2FqaMccS2aL3eb8Batv3N/t+lA2Uch8A/eCUnpmWQR7aF TM1q7uNkr2P/9kT3wGInukeEz14CtsJZZXYKs780h6rkcJMl7P1mX/Wk4HtipjVOmr3r WrnnAA4iNaQ2t2s2C0GXb84Svc+nSZBTQdfY6CJw9EVZ86xNqMEnGLb5vP935id+TwrG jer0VrhQRk4ut47Il+LJpwjtsnJRDuqYuV4n7vahxpJZs4ca912BYLEHfipUXgpXRs2h YHlw== X-Gm-Message-State: AKGB3mLAZ9tm0xJJyNCVB1T9A/htUu3QiwJQTUzyJO2RPfEXrkwZWvPe kGB9XtKLuUor/PSGLGY6XMY19g== X-Google-Smtp-Source: ACJfBovtfBJZwbgZ0min14Nq1nh0eMh+VSafFhmYzKZNV/qCoO1zfDZPRmTgibSzqfsIkaWK0bZaQA== X-Received: by 10.28.15.11 with SMTP id 11mr2550898wmp.0.1513266557413; Thu, 14 Dec 2017 07:49:17 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id 187sm7983388wmu.19.2017.12.14.07.49.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Dec 2017 07:49:16 -0800 (PST) Date: Thu, 14 Dec 2017 15:49:14 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org Message-ID: <20171214154913.2f2hydquivshhzc6@bivouac.eciton.net> References: <20171006204152.19376-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <20171006204152.19376-1-ard.biesheuvel@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH] ArmPkg/ArmSmcPsciResetSystemLib: add support for warm reboot X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Dec 2017 15:44:38 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Oct 06, 2017 at 09:41:52PM +0100, Ard Biesheuvel wrote: > PSCI SYSTEM_RESET is specified as a cold reboot, which does not > preserve the contents of DRAM. In version 1.1, a new reset method > was introduced that allows a warm reboot to be requested. > > This is especially relevant for capsule update, given that it will > invoke a warm reboot before processing the capsule, under the > assumption that the capsule will still be in memory when the PEI > phase is reentered. > > So wire up the [rather inaccurately named] EnterS3WithImmediateWake() > entry point that the capsule update runtime uses to the new PSCI 1.1 > warm reboot. Note that many PSCI implementations will not support this > yet, so fall back to a cold reboot if warm reboot fails. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel Well, I meant to refactor the SMC call macros as an improved foundation for this, but that is clearly not happening before I leave on sabbatical. So: Reviewed-by: Leif Lindholm And I'll look into refactoring this if and when I look into that once I get back. > --- > > I don't actually need this code for Synquacer, but given that I had > already wrote it, we may just as well merge it. > > ArmPkg/Include/IndustryStandard/ArmStdSmc.h | 10 +++++++--- > ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c | 14 ++++++++++++-- > 2 files changed, 19 insertions(+), 5 deletions(-) > > diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h > index 593a3ce729ce..41b086947eaa 100644 > --- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h > +++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h > @@ -57,10 +57,12 @@ > #define ARM_SMC_ID_PSCI_MIGRATE_AARCH32 0x84000005 > #define ARM_SMC_ID_PSCI_SYSTEM_OFF 0x84000008 > #define ARM_SMC_ID_PSCI_SYSTEM_RESET 0x84000009 > +#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64 0xc4000012 > +#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH32 0x84000012 > > -/* The current PSCI version is: 0.2 */ > -#define ARM_SMC_PSCI_VERSION_MAJOR 0 > -#define ARM_SMC_PSCI_VERSION_MINOR 2 > +/* The current PSCI version is: 1.1 */ > +#define ARM_SMC_PSCI_VERSION_MAJOR 1 > +#define ARM_SMC_PSCI_VERSION_MINOR 1 > #define ARM_SMC_PSCI_VERSION \ > ((ARM_SMC_PSCI_VERSION_MAJOR << 16) | ARM_SMC_PSCI_VERSION_MINOR) > > @@ -93,4 +95,6 @@ > #define ARM_SMC_ID_PSCI_AFFINITY_INFO_OFF 1 > #define ARM_SMC_ID_PSCI_AFFINITY_INFO_ON_PENDING 2 > > +#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_WARM 0 > + > #endif > diff --git a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c > index d6d26bce5009..ffd726554c0f 100644 > --- a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c > +++ b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c > @@ -55,7 +55,17 @@ ResetWarm ( > VOID > ) > { > - // Map a warm reset into a cold reset > + ARM_SMC_ARGS ArmSmcArgs; > + > +#if defined(MDE_CPU_AARCH64) > + ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64; > +#else > + ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH32; > +#endif > + ArmSmcArgs.Arg1 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_WARM; > + ArmCallSmc (&ArmSmcArgs); > + > + // Fall back to cold reset if unsupported > ResetCold (); > } > > @@ -89,7 +99,7 @@ EnterS3WithImmediateWake ( > VOID > ) > { > - // Not implemented > + ResetWarm (); > } > > /** > -- > 2.11.0 >