Caleb Palmer | 1a4f0e7 | 2022-11-07 15:08:01 -0600 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | |
| 3 | #include <analyzer/analyzer_main.hpp> |
| 4 | #include <analyzer/plugins/plugin.hpp> |
| 5 | #include <analyzer/ras-data/ras-data-parser.hpp> |
| 6 | #include <hei_util.hpp> |
| 7 | #include <util/pdbg.hpp> |
| 8 | #include <util/trace.hpp> |
| 9 | |
| 10 | #include "gtest/gtest.h" |
| 11 | |
| 12 | namespace analyzer |
| 13 | { |
| 14 | // Forward reference of filterRootCause |
| 15 | bool filterRootCause(AnalysisType i_type, |
| 16 | const libhei::IsolationData& i_isoData, |
| 17 | libhei::Signature& o_rootCause, |
| 18 | const RasDataParser& i_rasData); |
| 19 | } // namespace analyzer |
| 20 | |
| 21 | using namespace analyzer; |
| 22 | |
| 23 | static const auto eqCoreFir = static_cast<libhei::NodeId_t>( |
| 24 | libhei::hash<libhei::NodeId_t>("EQ_CORE_FIR")); |
| 25 | |
| 26 | static const auto rdfFir = |
| 27 | static_cast<libhei::NodeId_t>(libhei::hash<libhei::NodeId_t>("RDFFIR")); |
| 28 | |
Caleb Palmer | 51f8202 | 2023-02-22 16:09:09 -0600 | [diff] [blame] | 29 | static const auto mc_dstl_fir = static_cast<libhei::NodeId_t>( |
| 30 | libhei::hash<libhei::NodeId_t>("MC_DSTL_FIR")); |
| 31 | |
Caleb Palmer | 1a4f0e7 | 2022-11-07 15:08:01 -0600 | [diff] [blame] | 32 | TEST(RootCauseFilter, Filter1) |
| 33 | { |
| 34 | pdbg_targets_init(nullptr); |
| 35 | |
Caleb Palmer | 51f8202 | 2023-02-22 16:09:09 -0600 | [diff] [blame] | 36 | RasDataParser rasData{}; |
| 37 | |
| 38 | // Test 1: Test a checkstop with a UE root cause on an OCMB |
| 39 | |
Caleb Palmer | 1a4f0e7 | 2022-11-07 15:08:01 -0600 | [diff] [blame] | 40 | // Checkstop signature on the proc |
| 41 | auto proc0 = util::pdbg::getTrgt("/proc0"); |
| 42 | libhei::Chip procChip0{proc0, P10_20}; |
| 43 | |
| 44 | // EQ_CORE_FIR[14]: ME = 0 checkstop |
| 45 | libhei::Signature checkstopSig{procChip0, eqCoreFir, 0, 14, |
Zane Shelley | adda054 | 2023-04-06 16:38:02 -0500 | [diff] [blame] | 46 | libhei::ATTN_TYPE_CHIP_CS}; |
Caleb Palmer | 1a4f0e7 | 2022-11-07 15:08:01 -0600 | [diff] [blame] | 47 | |
Caleb Palmer | 51f8202 | 2023-02-22 16:09:09 -0600 | [diff] [blame] | 48 | // MC_DSTL_FIR[1]: AFU initiated Recoverable Attn on Subchannel A |
| 49 | libhei::Signature reAttnSig{procChip0, mc_dstl_fir, 0, 1, |
| 50 | libhei::ATTN_TYPE_RECOVERABLE}; |
| 51 | |
Caleb Palmer | 1a4f0e7 | 2022-11-07 15:08:01 -0600 | [diff] [blame] | 52 | // Root cause signature on the ocmb |
| 53 | auto ocmb0 = |
| 54 | util::pdbg::getTrgt("proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"); |
| 55 | libhei::Chip ocmbChip0{ocmb0, EXPLORER_20}; |
| 56 | |
| 57 | // RDFFIR[14]: Mainline read UE |
| 58 | libhei::Signature ueSig{ocmbChip0, rdfFir, 0, 14, |
| 59 | libhei::ATTN_TYPE_RECOVERABLE}; |
| 60 | |
| 61 | // Add the signatures to the isolation data |
| 62 | libhei::IsolationData isoData{}; |
| 63 | isoData.addSignature(checkstopSig); |
Caleb Palmer | 51f8202 | 2023-02-22 16:09:09 -0600 | [diff] [blame] | 64 | isoData.addSignature(reAttnSig); |
Caleb Palmer | 1a4f0e7 | 2022-11-07 15:08:01 -0600 | [diff] [blame] | 65 | isoData.addSignature(ueSig); |
| 66 | |
Caleb Palmer | 1a4f0e7 | 2022-11-07 15:08:01 -0600 | [diff] [blame] | 67 | libhei::Signature rootCause; |
| 68 | bool attnFound = filterRootCause(AnalysisType::SYSTEM_CHECKSTOP, isoData, |
| 69 | rootCause, rasData); |
| 70 | EXPECT_TRUE(attnFound); |
| 71 | EXPECT_EQ(ueSig.toUint32(), rootCause.toUint32()); |
Caleb Palmer | 51f8202 | 2023-02-22 16:09:09 -0600 | [diff] [blame] | 72 | |
| 73 | // Test 2: Test a checkstop with an unknown RE attn on an OCMB |
| 74 | |
| 75 | // Add the signatures to the isolation data |
| 76 | isoData.flush(); |
| 77 | isoData.addSignature(checkstopSig); |
| 78 | isoData.addSignature(reAttnSig); |
| 79 | |
| 80 | attnFound = filterRootCause(AnalysisType::SYSTEM_CHECKSTOP, isoData, |
| 81 | rootCause, rasData); |
| 82 | EXPECT_TRUE(attnFound); |
| 83 | EXPECT_EQ(reAttnSig.toUint32(), rootCause.toUint32()); |
| 84 | |
| 85 | // Test 3: Test a checkstop with an unknown UCS attn on an OCMB |
| 86 | |
| 87 | // MC_DSTL_FIR[0]: AFU initiated Checkstop on Subchannel A |
| 88 | libhei::Signature ucsAttnSig{procChip0, mc_dstl_fir, 0, 0, |
| 89 | libhei::ATTN_TYPE_UNIT_CS}; |
| 90 | |
| 91 | isoData.flush(); |
| 92 | isoData.addSignature(checkstopSig); |
| 93 | isoData.addSignature(ucsAttnSig); |
| 94 | |
| 95 | attnFound = filterRootCause(AnalysisType::SYSTEM_CHECKSTOP, isoData, |
| 96 | rootCause, rasData); |
| 97 | EXPECT_TRUE(attnFound); |
| 98 | EXPECT_EQ(ucsAttnSig.toUint32(), rootCause.toUint32()); |
| 99 | |
| 100 | // Test 4: Test a checkstop with a non-root cause recoverable from an OCMB |
| 101 | |
| 102 | // RDFFIR[42]: SCOM recoverable register parity error |
| 103 | libhei::Signature reSig{ocmbChip0, rdfFir, 0, 42, |
| 104 | libhei::ATTN_TYPE_RECOVERABLE}; |
| 105 | |
| 106 | isoData.flush(); |
| 107 | isoData.addSignature(checkstopSig); |
| 108 | isoData.addSignature(reAttnSig); |
| 109 | isoData.addSignature(reSig); |
| 110 | |
| 111 | attnFound = filterRootCause(AnalysisType::SYSTEM_CHECKSTOP, isoData, |
| 112 | rootCause, rasData); |
| 113 | EXPECT_TRUE(attnFound); |
| 114 | EXPECT_EQ(checkstopSig.toUint32(), rootCause.toUint32()); |
Caleb Palmer | 1a4f0e7 | 2022-11-07 15:08:01 -0600 | [diff] [blame] | 115 | } |