@@ -765,37 +765,41 @@ fn vmxnet_smoltcp() {
765765 shutdown ( ExitReason :: Ok ) ;
766766}
767767
768- /// Write and test the content on a shared-mem device.
769- pub ( crate ) const BUFFER_CONTENT : u8 = 0xb ;
770-
771768/// Test cxl device in the kernel.
772769#[ cfg( all( feature = "integration-test" , target_arch = "x86_64" ) ) ]
773770pub ( crate ) fn cxl_write ( ) {
774771 use crate :: memory:: KERNEL_BASE ;
775- use crate :: transport:: shmem:: SHMEM_DEVICE ;
772+ use crate :: transport:: shmem:: SHMEM ;
776773
777- lazy_static:: initialize ( & SHMEM_DEVICE ) ;
774+ lazy_static:: initialize ( & SHMEM ) ;
778775
779- for i in 0 ..SHMEM_DEVICE . region . size {
780- let region = ( SHMEM_DEVICE . region . base + KERNEL_BASE + i as u64 ) as * mut u8 ;
781- unsafe { core:: ptr:: write ( region, BUFFER_CONTENT ) } ;
776+ let mut buffer_content: u8 = 0x0 ;
777+ for device in SHMEM . devices . iter ( ) {
778+ buffer_content += 1 ;
779+ for i in 0 ..( device. region . size / 1024 ) {
780+ let region = ( device. region . base + KERNEL_BASE + ( i * 1024 ) as u64 ) as * mut u8 ;
781+ unsafe { core:: ptr:: write ( region, buffer_content) } ;
782+ }
782783 }
783-
784784 shutdown ( ExitReason :: Ok ) ;
785785}
786786
787787/// Test cxl device in the kernel.
788788#[ cfg( all( feature = "integration-test" , target_arch = "x86_64" ) ) ]
789789pub ( crate ) fn cxl_read ( ) {
790790 use crate :: memory:: KERNEL_BASE ;
791- use crate :: transport:: shmem:: SHMEM_DEVICE ;
791+ use crate :: transport:: shmem:: SHMEM ;
792792
793- lazy_static:: initialize ( & SHMEM_DEVICE ) ;
793+ lazy_static:: initialize ( & SHMEM ) ;
794794
795- for i in 0 ..SHMEM_DEVICE . region . size {
796- let region = ( SHMEM_DEVICE . region . base + KERNEL_BASE + i as u64 ) as * mut u8 ;
797- let read = unsafe { core:: ptr:: read ( region) } ;
798- assert_eq ! ( read, BUFFER_CONTENT ) ;
795+ let mut buffer_content: u8 = 0x0 ;
796+ for device in SHMEM . devices . iter ( ) {
797+ buffer_content += 1 ;
798+ for i in 0 ..( device. region . size / 1024 ) {
799+ let region = ( device. region . base + KERNEL_BASE + ( i * 1024 ) as u64 ) as * mut u8 ;
800+ let read = unsafe { core:: ptr:: read ( region) } ;
801+ assert_eq ! ( read, buffer_content) ;
802+ }
799803 }
800804
801805 shutdown ( ExitReason :: Ok ) ;
@@ -805,18 +809,21 @@ pub(crate) fn cxl_read() {
805809#[ cfg( all( feature = "integration-test" , target_arch = "x86_64" ) ) ]
806810pub ( crate ) fn shmem_interruptor ( ) {
807811 use crate :: arch:: irq:: REMOTE_TLB_WORK_PENDING_SHMEM_VECTOR ;
808- use crate :: transport:: shmem:: SHMEM_DEVICE ;
812+ use crate :: transport:: shmem:: SHMEM ;
809813
810- lazy_static:: initialize ( & SHMEM_DEVICE ) ;
814+ lazy_static:: initialize ( & SHMEM ) ;
811815 {
812816 // The ivshmem server allocates IDs consecutively, so we'll assume interruptee is
813817 // current_id - 1
814818 log:: info!(
815819 "Sending shmem interrupt to: {:?} on vector {:?}" ,
816- SHMEM_DEVICE . id - 1 ,
820+ SHMEM . devices [ 0 ] . id - 1 ,
817821 1
818822 ) ;
819- SHMEM_DEVICE . set_doorbell ( REMOTE_TLB_WORK_PENDING_SHMEM_VECTOR , SHMEM_DEVICE . id - 1 ) ;
823+ SHMEM . devices [ 0 ] . set_doorbell (
824+ REMOTE_TLB_WORK_PENDING_SHMEM_VECTOR ,
825+ SHMEM . devices [ 0 ] . id - 1 ,
826+ ) ;
820827 }
821828 shutdown ( ExitReason :: Ok ) ;
822829}
@@ -828,11 +835,11 @@ pub(crate) fn shmem_interruptee() {
828835 use core:: time:: Duration ;
829836
830837 use crate :: arch:: irq:: { REMOTE_TLB_WORK_PENDING_SHMEM_VECTOR , REMOTE_TLB_WORK_PENDING_VECTOR } ;
831- use crate :: transport:: shmem:: SHMEM_DEVICE ;
838+ use crate :: transport:: shmem:: SHMEM ;
832839
833- lazy_static:: initialize ( & SHMEM_DEVICE ) ;
840+ lazy_static:: initialize ( & SHMEM ) ;
834841
835- SHMEM_DEVICE . enable_msix_vector (
842+ SHMEM . get_interrupt_device ( ) . unwrap ( ) . enable_msix_vector (
836843 REMOTE_TLB_WORK_PENDING_SHMEM_VECTOR as usize ,
837844 0 ,
838845 REMOTE_TLB_WORK_PENDING_VECTOR ,
0 commit comments