From f74017cc36371c159e7e0633c14ba30d52bd23d7 Mon Sep 17 00:00:00 2001 From: Chirag Sharma Date: Sun, 29 May 2022 04:43:50 -0500 Subject: [PATCH] libipl: Checking write flag before applying guard Change: Adding checkWriteFlag, which will read the write flag in guard partition, this to see if the guard partition is not corrupt or not. If the write flag is set to 0x00 checkWriteFlag will return true and need to clear the guard records from the partition. Tested: Setting the write flag as 0x00, seeing that guard records are getting clear. Signed-off-by: Chirag Sharma --- libipl/p10/ipl0.C | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libipl/p10/ipl0.C b/libipl/p10/ipl0.C index fb51901..3f9e622 100644 --- a/libipl/p10/ipl0.C +++ b/libipl/p10/ipl0.C @@ -291,6 +291,12 @@ static void process_guard_records() openpower::guard::libguard_init(false); + if (openpower::guard::checkWriteFlag()) { + ipl_log(IPL_INFO, "Guard partition is corrupt"); + openpower::guard::clearAll(); + return; + } + auto records = openpower::guard::getAll(); if (records.size()) { ipl_log(IPL_INFO, "Number of Records = %d\n",records.size());