File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -111,12 +111,23 @@ pub struct GpuConfig {
111111 pub listing : Vec < String > ,
112112 /// The PCI addresses to exclude from passthrough
113113 pub exclude : Vec < String > ,
114+ /// The PCI addresses to include in passthrough
115+ pub include : Vec < String > ,
114116}
115117
116118impl GpuConfig {
117119 pub ( crate ) fn list_devices ( & self ) -> Result < Vec < Device > > {
118120 let devices = lspci_filtered ( |dev| {
119- self . listing . contains ( & dev. full_product_id ( ) ) && !self . exclude . contains ( & dev. slot )
121+ if !self . listing . contains ( & dev. full_product_id ( ) ) {
122+ return false ;
123+ }
124+ if self . exclude . contains ( & dev. slot ) {
125+ return false ;
126+ }
127+ if !self . include . is_empty ( ) && !self . include . contains ( & dev. slot ) {
128+ return false ;
129+ }
130+ true
120131 } )
121132 . context ( "Failed to list GPU devices" ) ?;
122133
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ enabled = false
4545listing = [" 10de:2335" ]
4646# The PCI addresses of the cards to exclude
4747exclude = []
48+ # The PCI addresses of the cards to include
49+ include = []
4850
4951[gateway ]
5052base_domain = " localhost"
You can’t perform that action at this time.
0 commit comments