From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c0b::22b; helo=mail-it0-x22b.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::22b]) (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 6B97E21F3C194 for ; Mon, 9 Oct 2017 11:19:26 -0700 (PDT) Received: by mail-it0-x22b.google.com with SMTP id g18so13939746itg.5 for ; Mon, 09 Oct 2017 11:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0Ren2zH3p7PYCul2Nw4dwjDrxID5jSoYyh067pS0C7Q=; b=ThdODAw76oYScCoNJEeu6e7kprWlymJW+VGuM7kABqwJ2PnhsTefqerwmgyrJz/O9a TQhQ+xZT5lqfCm57Ir2y4S7n2mHS6eQ2fbkAMc8EAk+LkIkR1upXcb8QKw11r/Uy3Qyt VOPTo3eyZQ/rN/CzCv55BI1q2o0jy1GbdxUKs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0Ren2zH3p7PYCul2Nw4dwjDrxID5jSoYyh067pS0C7Q=; b=cRGjO9/yxvfjfeQqkx+FXoC4Yiw8ycwCdou0I+35C4PYaabYwsZa5mgGoah7y7rcqF En6beXRph8K2++mMsxJB8/L/Bn7ZIMxM8Rx31/JqrOKkD/doaXlRzaI1RaMCToBLWo65 kreAyQNfZ3jfjnSk6U6Rkqt+y6I4qpESFfWNZHk+5pJMvKnlgnjRilS1NPd1H352Onc3 yyqM/4UH6Ls/10LB3AJ6nhz1okpqAtIAxG9Iz22lDVs7dCdr6clUJDBH9YfVi/cv4KF/ UJKoYNO99B9bYniwLPe16JPfoQcaMwtjUtYUxnfxjSsUvmy3OEgJS71NF9HDWJjfyk13 lBCA== X-Gm-Message-State: AMCzsaUp39dw5jr9z9j/IvWsg0W07BV4O6/noTg9+mv8IhdFu4geGkbJ VBUzlWUKr72L9GQwbb4rWTuhLwr46FMi+Xk3im+50bYo X-Google-Smtp-Source: AOwi7QBTLEjDwhx7VB2KKIMMiOleMGVanLcXtqIfxE7WLwkQUfdlFLZ5T/dgI3DIlG8WBF6yNzsj68UIn6R03+5LslQ= X-Received: by 10.36.4.212 with SMTP id 203mr15434020itb.10.1507573373065; Mon, 09 Oct 2017 11:22:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.131.167 with HTTP; Mon, 9 Oct 2017 11:22:52 -0700 (PDT) In-Reply-To: <20171009182201.qrihzucrxcgcgxxp@bivouac.eciton.net> References: <20171006204152.19376-1-ard.biesheuvel@linaro.org> <20171009182201.qrihzucrxcgcgxxp@bivouac.eciton.net> From: Ard Biesheuvel Date: Mon, 9 Oct 2017 19:22:52 +0100 Message-ID: To: Leif Lindholm Cc: "edk2-devel@lists.01.org" 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: Mon, 09 Oct 2017 18:19:26 -0000 Content-Type: text/plain; charset="UTF-8" On 9 October 2017 at 19:22, Leif Lindholm wrote: > 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 >> --- >> >> 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 > > If we're starting to add more of these, could we do some macro rather > than duplication? > > (see below) > >> -/* 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 > > #define ARM_SMC64_VALUE 0x40000000UL > #define ARM_SMC64(x) ((x) | ARM_SMC64_VALUE) > #define ARM_SMC32(x) ((x) & ~ARM_SMC64_VALUE) > > #if defined(MDE_CPU_AARCH64) > #define ARM_SMC(x) ARM_SMC64(x) > #else > #define ARM_SMC(x) ARM_SMC32(x) > #endif > > Want me to whip up a mini-set that does that and changes existing > definitiions/invokations? > Yes please