blob: 540cef3c64b962a2dca34f173232ff7d9d787488 [file] [log] [blame]
Leon Verdinc867de32017-12-06 15:51:25 -06001*** Settings ***
2Documentation Verify EEH recovery on the integrated storage controller.
3Library SSHLibrary
4Library String
5Library ../lib/bmc_ssh_utils.py
6Resource ../lib/resource.txt
7Resource ../syslib/utils_os.robot
8
9# Test Parameters:
10# TYPE EEH error function to use, default is 4.
11# OPENBMC_HOST The BMC host name or IP address.
12# OS_HOST The OS host name or IP Address.
13# OS_USERNAME The OS login userid (usually root).
14# OS_PASSWORD The password for the OS login.
15# HTX_DURATION Duration of HTX run, for example, 8 hours, or
16# 30 minutes.
17# HTX_INTERVAL The time delay between consecutive checks of HTX
18# status, for example, 30s.
19# In summary: Run HTX for $HTX_DURATION, checking
20# every $HTX_INTERVAL.
21# This test case verifies the correct operation of EEH on the integrated
22# storage controller. It should be verified with all supported distros.
23# The injection command:
24# echo <pe_num>:<mode>:<type>:<address>:<mask> > /sys/kernel/debug/powerpc/PCIxxxx/err_injct
25# Input arguments to injection command:
26# pe_num: determined from the output of
27# 'cat /sys/bus/pci/devices/xxxx:xx:xx.x/eeh_pe_config_addr'
28# where the xxxx.xx.xx.x is the PCI location of the device you want.
29# mode: 0 for 32-bit BARs and 64-bit non-prefetchable BARs
30# 1 for 64-bit prefetchable BARs
31# type: error function to use:
32# 0 to inject on an MMIO load
33# 4 to inject on a config load--Not recommended for standard
34# injection trials.
35# 6 to inject on an MMIO writes
36# 10 to inject on a CFG write
37# address, mask: if you do not care to specify which endpoint under the
38# slot is to be frozen, use a value of '0' for both the address and mask.
39# xxxx: the PCI domain location of the device.
40# Example:
41# echo 5:0:6:3fe280810000:fffffffffffff800 > /sys/kernel/debug/powerpc/PCI0005/err_injct
42# Expected output:
43# HTX Runs mdt.hdbuster and doesn't log errors after error injections.
44# Glossary:
45# EEH:
46# Enhanced I/O Error Handling is an error-recovery mechanism for errors that
47# occur during load and store operations on the PCI bus.
48# MDT:
49# Master device table is a collection of hardware devices on the system for
50# which HTX exercisers can be run.
51# mdt.hdbuster:
52# MDT for disk storage device testing. Uses 0s and FFs for data patterns.
53# HTX error log file /tmp/htxerr
54# Records all the errors that occur. If there's no error during the test, it
55# should be empty.
56# TODO: Check if monitoring dmesg entries adds value.
57
58Suite Setup Suite Setup Execution
59Suite Teardown Collect HTX Log Files
60Test Teardown FFDC On Test Case Fail
61
62*** Variables ***
63${HTX_DURATION} 4 hours
64${HTX_INTERVAL} 15 minutes
65${TYPE} 4
66${lspci_cmd} lspci -D | grep Marvell
67
68*** Test Cases ***
69Test EEH Operation
70 [Documentation] Inject EEH Errors and check if errors are logged in htx.
71 [Tags] Test_EEH_Operation
72
73 Run MDT Profile
74 Repeat Keyword ${HTX_DURATION} Run Keywords
75 ... Inject EEH Error AND Check HTX Run Status AND Sleep ${HTX_INTERVAL}
76 Shutdown HTX Exerciser
77
78*** Keywords ***
79Inject EEH Error
80 [Documentation] Inject EEH error to a PE (Partitionable Endpoint).
81
82 Log Building the injection command.
83 ${pci}= Get PCI
84 ${sub_cmd}= Make Injection Command ${pci}
85 ${pci}= Fetch From Left ${pci} :
86 ${cmd}= Convert To String
87 ... echo ${sub_cmd} > /sys/kernel/debug/powerpc/PCI${pci}/err_injct
88 Log Proceeding with injection:\n${cmd}\n
89 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
90 Log ${output}
91
92Get PCI
93 [Documentation] Get the PCI ID for the Marvell adapter.
94
95 ${output} ${stderr} ${rc}= OS Execute Command
96 ... ${lspci_cmd} | cut -d " " -f1 | head -n 1
97 [Return] ${output}
98
99Get Pe Num
100 [Documentation] Get the PE (partitionable endpoint) configuration
101 ... address for the specified PCI.
102 [Arguments] ${pci}=${EMPTY}
103 # Description of argument(s):
104 # pci PCI address as domain number (0 to ffff), bus (0 to ff),
105 # slot (0 to 1f) and function (0 to 7).
106 # (e.g. "0000:00:1f.2").
107
108 ${output} ${stderr} ${rc}= OS Execute Command
109 ... cut -d "x" -f2 /sys/bus/pci/devices/${pci}/eeh_pe_config_addr
110 [Return] ${output}
111
112Get Mode
113 [Documentation] Determine the 'mode' field value, by checking the device's
114 ... memory information.
115 [Arguments] ${pci}=${EMPTY}
116 # Description of argument(s):
117 # pci PCI address as domain number (0 to ffff), bus (0 to ff),
118 # slot (0 to 1f) and function (0 to 7).
119 # (e.g. "0000:00:1f.2").
120
121 ${cmd_buf}= Catenate lspci -bvs ${pci} | grep "Memory at " |
122 ... grep "64-bit, prefetchable" | wc -l
123 ${output} ${stderr} ${rc}= OS Execute Command ${cmd_buf}
124 ${mode}= Set Variable If '${output}' == '0' 0 1
125 [Return] ${mode}
126
127Get Address
128 [Documentation] Determine the PE address field.
129 [Arguments] ${pci}=${EMPTY}
130 # Description of argument(s):
131 # pci PCI address as domain number (0 to ffff), bus (0 to ff),
132 # slot (0 to 1f) and function (0 to 7).
133 # (e.g. "0000:00:1f.2").
134
135 ${output} ${stderr} ${rc}= OS Execute Command
136 ... lspci -vv -s ${pci} | grep "Memory at " | cut -d " " -f5 | head -n 1
137 [Return] ${output}
138
139Get Mask
140 [Documentation] Determine the adress' mask field.
141 [Arguments] ${pci}=${EMPTY}
142 # Description of argument(s):
143 # pci PCI address as domain number (0 to ffff), bus (0 to ff),
144 # slot (0 to 1f) and function (0 to 7).
145 # (e.g. "0000:00:1f.2").
146
147 ${output} ${stderr} ${rc}= OS Execute Command
148 ... lspci -vv -s ${pci} | grep "Memory at" | head -n 1
149 ${size_left}= Fetch From Right ${output} size=
150 ${size_right}= Fetch From Left ${size_left} K
151 ${size1}= Convert To Integer ${size_right}
152 ${size}= Evaluate ${size1}*1024
153 ${size_hex}= Convert To Hex ${size}
154 ${mask}= Evaluate "{:f>16}".format(${size_hex})
155 [Return] ${mask}
156
157Make Injection Command
158 [Documentation] Concatenate the fields to form a valid injection command.
159 [Arguments] ${pci}=${EMPTY}
160 # Description of argument(s):
161 # pci PCI address as domain number (0 to ffff), bus (0 to ff),
162 # slot (0 to 1f) and function (0 to 7).
163 # (e.g. "0000:00:1f.2").
164
165 ${pe_num}= Get Pe Num ${pci}
166 ${mode}= Get Mode ${pci}
167 ${addr}= Get Address ${pci}
168 ${mask}= Get Mask ${pci}
169 ${res}= Catenate SEPARATOR=:
170 ... ${pe_num} ${mode} ${TYPE} ${addr} ${mask}
171 [Return] ${res}
172
173Suite Setup Execution
174 [Documentation] Do suite setup tasks.
175
176 Boot To OS
177 Tool Exist lspci
178 Tool Exist htxcmdline
179 # HTX_MDT_PROFILE: MDT to use in the 'Run MDT Profile' external keyword.
180 # It's set to mdt.hdbuster in the Suite Setup, so it's not a -v argument.
181 Set Suite Variable ${HTX_MDT_PROFILE} mdt.hdbuster children=true
182 Create Default MDT Profile