@@ -16,7 +16,7 @@ use vm_memory::GuestAddress;
16
16
17
17
use crate :: devices:: virtio:: device:: VirtioDevice ;
18
18
use crate :: devices:: virtio:: queue:: Queue ;
19
- use crate :: logger:: { debug , error , info , trace , warn} ;
19
+ use crate :: logger:: warn;
20
20
pub const VIRTIO_PCI_COMMON_CONFIG_ID : & str = "virtio_pci_common_config" ;
21
21
22
22
#[ derive( Debug , Clone , Serialize , Deserialize ) ]
@@ -176,7 +176,10 @@ impl VirtioPciCommonConfig {
176
176
let v = self . read_common_config_qword ( offset) ;
177
177
LittleEndian :: write_u64 ( data, v) ;
178
178
}
179
- _ => error ! ( "invalid data length for virtio read: len {}" , data. len( ) ) ,
179
+ _ => warn ! (
180
+ "pci: invalid data length for virtio read: len {}" ,
181
+ data. len( )
182
+ ) ,
180
183
}
181
184
}
182
185
@@ -196,35 +199,35 @@ impl VirtioPciCommonConfig {
196
199
LittleEndian :: read_u64 ( data) ,
197
200
device. lock ( ) . unwrap ( ) . queues_mut ( ) ,
198
201
) ,
199
- _ => error ! ( "invalid data length for virtio write: len {}" , data. len( ) ) ,
202
+ _ => warn ! (
203
+ "pci: invalid data length for virtio write: len {}" ,
204
+ data. len( )
205
+ ) ,
200
206
}
201
207
}
202
208
203
209
fn read_common_config_byte ( & self , offset : u64 ) -> u8 {
204
- debug ! ( "read_common_config_byte: offset 0x{:x}" , offset) ;
205
210
// The driver is only allowed to do aligned, properly sized access.
206
211
match offset {
207
212
0x14 => self . driver_status ,
208
213
0x15 => self . config_generation ,
209
214
_ => {
210
- warn ! ( "invalid virtio config byte read: 0x{:x}" , offset) ;
215
+ warn ! ( "pci: invalid virtio config byte read: 0x{:x}" , offset) ;
211
216
0
212
217
}
213
218
}
214
219
}
215
220
216
221
fn write_common_config_byte ( & mut self , offset : u64 , value : u8 ) {
217
- debug ! ( "write_common_config_byte: offset 0x{offset:x}: {value:x}" ) ;
218
222
match offset {
219
223
0x14 => self . driver_status = value,
220
224
_ => {
221
- warn ! ( "invalid virtio config byte write: 0x{:x}" , offset) ;
225
+ warn ! ( "pci: invalid virtio config byte write: 0x{:x}" , offset) ;
222
226
}
223
227
}
224
228
}
225
229
226
230
fn read_common_config_word ( & self , offset : u64 , queues : & [ Queue ] ) -> u16 {
227
- debug ! ( "read_common_config_word: offset 0x{:x}" , offset) ;
228
231
match offset {
229
232
0x10 => self . msix_config . load ( Ordering :: Acquire ) ,
230
233
0x12 => queues. len ( ) . try_into ( ) . unwrap ( ) , // num_queues
@@ -246,14 +249,13 @@ impl VirtioPciCommonConfig {
246
249
0x1c => u16:: from ( self . with_queue ( queues, |q| q. ready ) . unwrap_or ( false ) ) ,
247
250
0x1e => self . queue_select , // notify_off
248
251
_ => {
249
- warn ! ( "invalid virtio register word read: 0x{:x}" , offset) ;
252
+ warn ! ( "pci: invalid virtio register word read: 0x{:x}" , offset) ;
250
253
0
251
254
}
252
255
}
253
256
}
254
257
255
258
fn write_common_config_word ( & mut self , offset : u64 , value : u16 , queues : & mut [ Queue ] ) {
256
- debug ! ( "write_common_config_word: offset 0x{:x}" , offset) ;
257
259
match offset {
258
260
0x10 => self . msix_config . store ( value, Ordering :: Release ) ,
259
261
0x16 => self . queue_select = value,
@@ -274,13 +276,12 @@ impl VirtioPciCommonConfig {
274
276
q. ready = value == 1 ;
275
277
} ) ,
276
278
_ => {
277
- warn ! ( "invalid virtio register word write: 0x{:x}" , offset) ;
279
+ warn ! ( "pci: invalid virtio register word write: 0x{:x}" , offset) ;
278
280
}
279
281
}
280
282
}
281
283
282
284
fn read_common_config_dword ( & self , offset : u64 , device : Arc < Mutex < dyn VirtioDevice > > ) -> u32 {
283
- debug ! ( "read_common_config_dword: offset 0x{:x}" , offset) ;
284
285
match offset {
285
286
0x00 => self . device_feature_select ,
286
287
0x04 => {
@@ -296,7 +297,7 @@ impl VirtioPciCommonConfig {
296
297
}
297
298
0x08 => self . driver_feature_select ,
298
299
_ => {
299
- warn ! ( "invalid virtio register dword read: 0x{:x}" , offset) ;
300
+ warn ! ( "pci: invalid virtio register dword read: 0x{:x}" , offset) ;
300
301
0
301
302
}
302
303
}
@@ -308,7 +309,6 @@ impl VirtioPciCommonConfig {
308
309
value : u32 ,
309
310
device : Arc < Mutex < dyn VirtioDevice > > ,
310
311
) {
311
- debug ! ( "write_common_config_dword: offset 0x{:x}" , offset) ;
312
312
fn hi ( v : & mut GuestAddress , x : u32 ) {
313
313
* v = ( * v & 0xffff_ffff ) | ( u64:: from ( x) << 32 )
314
314
}
@@ -342,19 +342,16 @@ impl VirtioPciCommonConfig {
342
342
hi ( & mut q. used_ring_address , value)
343
343
} ) ,
344
344
_ => {
345
- warn ! ( "invalid virtio register dword write: 0x{:x}" , offset) ;
345
+ warn ! ( "pci: invalid virtio register dword write: 0x{:x}" , offset) ;
346
346
}
347
347
}
348
348
}
349
349
350
350
fn read_common_config_qword ( & self , _offset : u64 ) -> u64 {
351
- debug ! ( "read_common_config_qword: offset 0x{:x}" , _offset) ;
352
351
0 // Assume the guest has no reason to read write-only registers.
353
352
}
354
353
355
354
fn write_common_config_qword ( & mut self , offset : u64 , value : u64 , queues : & mut [ Queue ] ) {
356
- debug ! ( "write_common_config_qword: offset 0x{:x}" , offset) ;
357
-
358
355
let low = Some ( ( value & 0xffff_ffff ) as u32 ) ;
359
356
let high = Some ( ( value >> 32 ) as u32 ) ;
360
357
@@ -363,7 +360,7 @@ impl VirtioPciCommonConfig {
363
360
0x28 => self . with_queue_mut ( queues, |q| q. avail_ring_address . 0 = value) ,
364
361
0x30 => self . with_queue_mut ( queues, |q| q. used_ring_address . 0 = value) ,
365
362
_ => {
366
- warn ! ( "invalid virtio register qword write: 0x{:x}" , offset) ;
363
+ warn ! ( "pci: invalid virtio register qword write: 0x{:x}" , offset) ;
367
364
}
368
365
}
369
366
}
0 commit comments