@@ -32,8 +32,8 @@ def change_domain_check(dom, pci_addr, def_dom):
3232 Check if the domain changed successfully to "dom" for "pci_addr"
3333
3434 :param dom: domain type
35- :param def_dom: default domain of pci device (pci_addr)
36- :param pci_addr: pci device
35+ :param def_dom: default domain of pci address (pci_addr)
36+ :param pci_addr: full pci address including domain (0000:03:00.0)
3737 return: bool
3838 """
3939 output = genio .read_one_line (
@@ -49,7 +49,7 @@ def reset_check(pci_addr):
4949 """
5050 Check if reset for "pci_addr" is successful
5151
52- :param pci_addr: pci device
52+ :param pci_addr: full pci address including domain (0000:03:00.0)
5353 return: bool
5454 """
5555 cmd = f"lspci -vvs { pci_addr } "
@@ -64,7 +64,7 @@ def rescan_check(pci_addr):
6464 """
6565 Check if rescan for pci_addr is successful
6666
67- :param pci_addr: pci device
67+ :param pci_addr: full pci address including domain (0000:03:00.0)
6868 return: bool
6969 """
7070 cmd = f"lspci -vvs { pci_addr } "
@@ -81,7 +81,7 @@ class IommuTest(Test):
8181 reset and rescan is used to form sub-tests that test and exercise iommu
8282 code.
8383
84- :param device: Name of the pci device
84+ :param device: full pci address including domain (0000:03:00.0)
8585 """
8686
8787 def setUp (self ):
@@ -96,8 +96,16 @@ def setUp(self):
9696 smm = SoftwareManager ()
9797 if not smm .check_installed ("pciutils" ) and not smm .install ("pciutils" ):
9898 self .cancel ("pciutils package not found and installing failed" )
99+
99100 # Check the number of devices in iommu-group for pci device passed.
100101 for pci_addr in self .pci_devices .split (" " ):
102+
103+ # Check if device input is valid
104+ cmd = f"lspci -s { pci_addr } "
105+ out = process .run (cmd , ignore_status = True , shell = True ).stdout_text
106+ if not out :
107+ self .cancel (f"{ pci_addr } not found on the system" )
108+
101109 driver = pci .get_driver (pci_addr )
102110 if driver is None :
103111 self .cancel ("Device passed is not bound to any driver" )
@@ -120,8 +128,8 @@ def unbind(self, driver, pci_addr):
120128 """
121129 Unbind the device
122130
123- :param driver: driver of the pci device (pci_addr)
124- :param pci_addr: pci device to be unbind from driver
131+ :param driver: driver of the pci address (pci_addr)
132+ :param pci_addr: full pci address including domain (0000:03:00.0)
125133 return: None
126134 """
127135 genio .write_file (f'/sys/bus/pci/drivers/{ driver } /unbind' , pci_addr )
@@ -137,8 +145,8 @@ def change_domain(self, dom, def_dom, pci_addr):
137145 Change the domain of device to dom
138146
139147 :param dom: domain type
140- :param def_dom: default domain of pci device (pci_addr)
141- :param pci_addr: pci device
148+ :param def_dom: default domain of pci address (pci_addr)
149+ :param pci_addr: full pci address including domain (0000:03:00.0)
142150 return: None
143151 """
144152 genio .write_file (f'/sys/bus/pci/devices/{ pci_addr } /iommu_group/type' ,
@@ -154,8 +162,8 @@ def bind(self, driver, pci_addr):
154162 """
155163 Bind the device to driver
156164
157- :param driver: driver of the pci device (pci_addr)
158- :param pci_addr: pci device
165+ :param driver: driver of the pci address (pci_addr)
166+ :param pci_addr: full pci address including domain (0000:03:00.0)
159167 return: None
160168 """
161169 genio .write_file (f"/sys/bus/pci/drivers/{ driver } /bind" , pci_addr )
@@ -171,7 +179,7 @@ def reset(self, pci_addr):
171179 """
172180 Remove the device
173181
174- :param pci_addr: pci device
182+ :param pci_addr: full pci address including domain (0000:03:00.0)
175183 return: None
176184 """
177185 genio .write_file (f'/sys/bus/pci/devices/{ pci_addr } /remove' , '1' )
@@ -185,7 +193,7 @@ def rescan(self, pci_addr):
185193 """
186194 Rescan the system
187195
188- :param pci_addr: pci device
196+ :param pci_addr: full pci address including domain (0000:03:00.0)
189197 return: None
190198 """
191199 genio .write_file ('/sys/bus/pci/rescan' , '1' )
@@ -198,9 +206,9 @@ def get_params(self, pci_addr):
198206 """
199207 Get device parameter-driver, group, default domain(def_dom)
200208
201- :param pci_addr: pci device
202- return: driver (driver of pci device ),
203- def_dom (default domain of pci device )
209+ :param pci_addr: full pci address including domain (0000:03:00.0)
210+ return: driver (driver of pci address (pci_addr) ),
211+ def_dom (default domain of pci address (pci_addr) )
204212 """
205213 driver = pci .get_driver (pci_addr )
206214
@@ -217,9 +225,9 @@ def check(self, def_dom, pci_addr, driver):
217225 """
218226 Check if the PCI device is in default domain
219227
220- :param def_dom: default domain of pci device (pci_addr)
221- :param pci_addr: pci device
222- :param driver: driver of the pci device (pci_addr)
228+ :param def_dom: default domain of pci address (pci_addr)
229+ :param pci_addr: full pci address including domain (0000:03:00.0)
230+ :param driver: driver of the pci address (pci_addr)
223231 return: None
224232 """
225233 output = genio .read_one_line (
0 commit comments