@@ -126,20 +126,37 @@ static uint32_t rproc_virtio_negotiate_features(struct virtio_device *vdev,
126126static void rproc_virtio_read_config (struct virtio_device * vdev ,
127127 uint32_t offset , void * dst , int length )
128128{
129- (void )vdev ;
130- (void )offset ;
131- (void )dst ;
132- (void )length ;
129+ struct remoteproc_virtio * rpvdev ;
130+ struct fw_rsc_vdev * vdev_rsc ;
131+ struct metal_io_region * io ;
132+ char * config ;
133+
134+ rpvdev = metal_container_of (vdev , struct remoteproc_virtio , vdev );
135+ vdev_rsc = rpvdev -> vdev_rsc ;
136+ config = (char * )(& vdev_rsc -> vring [vdev -> vrings_num ]);
137+ io = rpvdev -> vdev_rsc_io ;
138+ metal_io_block_read (io ,
139+ metal_io_virt_to_offset (io , config + offset ),
140+ dst , length );
133141}
134142
135143#ifndef VIRTIO_SLAVE_ONLY
136144static void rproc_virtio_write_config (struct virtio_device * vdev ,
137145 uint32_t offset , void * src , int length )
138146{
139- (void )vdev ;
140- (void )offset ;
141- (void )src ;
142- (void )length ;
147+ struct remoteproc_virtio * rpvdev ;
148+ struct fw_rsc_vdev * vdev_rsc ;
149+ struct metal_io_region * io ;
150+ char * config ;
151+
152+ rpvdev = metal_container_of (vdev , struct remoteproc_virtio , vdev );
153+ vdev_rsc = rpvdev -> vdev_rsc ;
154+ config = (char * )(& vdev_rsc -> vring [vdev -> vrings_num ]);
155+ io = rpvdev -> vdev_rsc_io ;
156+ metal_io_block_write (io ,
157+ metal_io_virt_to_offset (io , config + offset ),
158+ src , length );
159+ rpvdev -> notify (rpvdev -> priv , vdev -> notifyid );
143160}
144161
145162static void rproc_virtio_reset_device (struct virtio_device * vdev )
@@ -220,6 +237,7 @@ rproc_virtio_create_vdev(unsigned int role, unsigned int notifyid,
220237 vdev -> notifyid = notifyid ;
221238 vdev -> role = role ;
222239 vdev -> reset_cb = rst_cb ;
240+ vdev -> config_len = vdev_rsc -> config_len ;
223241 vdev -> vrings_num = num_vrings ;
224242 vdev -> func = & remoteproc_virtio_dispatch_funcs ;
225243
0 commit comments