@@ -8,7 +8,6 @@ use crate::address::{Address, PhysAddr, VirtAddr};
8
8
use crate :: cpu:: flush_tlb_global_sync;
9
9
use crate :: cpu:: msr:: { write_msr, SEV_GHCB } ;
10
10
use crate :: error:: SvsmError ;
11
- use crate :: io:: IOPort ;
12
11
use crate :: mm:: pagetable:: get_init_pgtable_locked;
13
12
use crate :: mm:: validate:: {
14
13
valid_bitmap_clear_valid_4k, valid_bitmap_set_valid_4k, valid_bitmap_valid_addr,
@@ -17,12 +16,9 @@ use crate::mm::virt_to_phys;
17
16
use crate :: sev:: sev_snp_enabled;
18
17
use crate :: sev:: utils:: raw_vmgexit;
19
18
use crate :: types:: { PageSize , PAGE_SIZE_2M } ;
20
- use core:: cell:: RefCell ;
21
19
use core:: { mem, ptr} ;
22
20
23
- use super :: msr_protocol:: {
24
- invalidate_page_msr, register_ghcb_gpa_msr, request_termination_msr, validate_page_msr,
25
- } ;
21
+ use super :: msr_protocol:: { invalidate_page_msr, register_ghcb_gpa_msr, validate_page_msr} ;
26
22
use super :: { pvalidate, PvalidateOp } ;
27
23
28
24
// TODO: Fix this when Rust gets decent compile time struct offset support
@@ -486,50 +482,3 @@ impl GHCB {
486
482
Ok ( ( ) )
487
483
}
488
484
}
489
-
490
- pub struct GHCBIOPort < ' a > {
491
- pub ghcb : RefCell < & ' a mut GHCB > ,
492
- }
493
-
494
- impl < ' a > GHCBIOPort < ' a > {
495
- pub fn new ( ghcb : RefCell < & ' a mut GHCB > ) -> Self {
496
- GHCBIOPort { ghcb }
497
- }
498
- }
499
- unsafe impl < ' a > Sync for GHCBIOPort < ' a > { }
500
-
501
- impl < ' a > IOPort for GHCBIOPort < ' a > {
502
- fn outb ( & self , port : u16 , value : u8 ) {
503
- let mut g = self . ghcb . borrow_mut ( ) ;
504
- let ret = g. ioio_out ( port, GHCBIOSize :: Size8 , value as u64 ) ;
505
- if ret. is_err ( ) {
506
- request_termination_msr ( ) ;
507
- }
508
- }
509
-
510
- fn inb ( & self , port : u16 ) -> u8 {
511
- let mut g = self . ghcb . borrow_mut ( ) ;
512
- let ret = g. ioio_in ( port, GHCBIOSize :: Size8 ) ;
513
- match ret {
514
- Ok ( v) => ( v & 0xff ) as u8 ,
515
- Err ( _e) => request_termination_msr ( ) ,
516
- }
517
- }
518
-
519
- fn outw ( & self , port : u16 , value : u16 ) {
520
- let mut g = self . ghcb . borrow_mut ( ) ;
521
- let ret = g. ioio_out ( port, GHCBIOSize :: Size16 , value as u64 ) ;
522
- if ret. is_err ( ) {
523
- request_termination_msr ( ) ;
524
- }
525
- }
526
-
527
- fn inw ( & self , port : u16 ) -> u16 {
528
- let mut g = self . ghcb . borrow_mut ( ) ;
529
- let ret = g. ioio_in ( port, GHCBIOSize :: Size16 ) ;
530
- match ret {
531
- Ok ( v) => ( v & 0xffff ) as u16 ,
532
- Err ( _e) => request_termination_msr ( ) ,
533
- }
534
- }
535
- }
0 commit comments