vhost-user: support SET_MEM_TABLE waite the result of mmap
PATCH 1/2 vhost-user: support SET_MEM_TABLE waite the result of mmap
From: Linhaifeng <[email protected]>
Slave should reply to master and set u64 to 0 if
mmap all regions success otherwise set u64 to 1.
--- docs/specs/vhost-user.txt | 1 + 1 file changed, 1 insertion(+)
docs/specs/vhost-user.txt +1 -0
@@ -171,6 +171,7 @@ Message types Id: 5 Equivalent ioctl: VHOST_SET_MEM_TABLE Master payload: memory regions description + Slave payload: u64 (0:success >0:failed) Sets the memory map regions on the slave so it can translate the vring addresses. In the ancillary data there is an array of file descriptors
Signature · 1 line
1.7.12.4
PATCH 2/2 vhost-user: add reply for set_mem_table
From: Linhaifeng <[email protected]>
If u64 is not 0 we should return -1 to tell qemu not going on.
--- hw/virtio/vhost-user.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
hw/virtio/vhost-user.c +12 -1
@@ -243,7 +243,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, msg.size =sizeof (m.memory.nregions); msg.size +=sizeof (m.memory.padding); msg.size += fd_num *sizeof (VhostUserMemoryRegion); - + need_reply =1 ;break ;case VHOST_SET_LOG_FD :
@@ -315,6 +315,17 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, }memcpy (arg, &msg.state,sizeof (struct vhost_vring_state ));break ; +case VHOST_SET_MEM_TABLE : +if (msg.size !=sizeof (m.u64)) { +error_report ("Received bad msg size.\n" ); +return -1 ; + }else { +if (m.u64) { +error_report ("Failed to set memory table.\n" ); +return -1 ; + } + } +break ;default :error_report ("Received unexpected msg type.\n" );return -1 ;
Signature · 1 line
1.7.12.4
Re: [Qemu-devel] [PATCH 2/2] vhost-user: add reply for set_mem_table
Quoted 23 lines · linhaifeng
From: Linhaifeng <[email protected]>
If u64 is not 0 we should return -1 to tell qemu not going on.
Signed-off-by Linhaifeng <[email protected]>--- hw/virtio/vhost-user.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)hw/virtio/vhost-user.c +1
-1@@ -243,7 +243,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, msg.size =sizeof (m.memory.nregions); msg.size +=sizeof (m.memory.padding); msg.size += fd_num *sizeof (VhostUserMemoryRegion); - + need_reply =1 ;break ;case VHOST_SET_LOG_FD :
hw/virtio/vhost-user.c static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, · line 320
Quoted 6 lines
hw/virtio/vhost-user.c +3
-0@@ -315,6 +315,17 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, }memcpy (arg, &msg.state,sizeof (struct vhost_vring_state ));break ; +case VHOST_SET_MEM_TABLE : +if (msg.size !=sizeof (m.u64)) { +error_report ("Received bad msg size.\n" );
A superfluous "\n" character.
hw/virtio/vhost-user.c static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, · line 324
Quoted 4 lines
hw/virtio/vhost-user.c +4
-0+return -1 ; + }else { +if (m.u64) { +error_report ("Failed to set memory table.\n" );
A superfluous "\n" character.
Regards,
-Gonglei
Quoted 8 lines
hw/virtio/vhost-user.c +4
-0+return -1 ; + } + } +break ;default :error_report ("Received unexpected msg type.\n" );return -1 ;
Re: [Qemu-devel] [PATCH 2/2] vhost-user: add reply for set_mem_table
Quoted 22 lines · Gonglei
Quoted 21 lines · linhaifeng
From: Linhaifeng <[email protected]>
If u64 is not 0 we should return -1 to tell qemu not going on.
Signed-off-by Linhaifeng <[email protected]>--- hw/virtio/vhost-user.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)hw/virtio/vhost-user.c +1
-1@@ -243,7 +243,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, msg.size =sizeof (m.memory.nregions); msg.size +=sizeof (m.memory.padding); msg.size += fd_num *sizeof (VhostUserMemoryRegion); - + need_reply =1 ;break ;
Quoted 9 lines
hw/virtio/vhost-user.c static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, · line 320
Quoted 8 lines
hw/virtio/vhost-user.c +3
-0case VHOST_SET_LOG_FD :@@ -315,6 +315,17 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, }memcpy (arg, &msg.state,sizeof (struct vhost_vring_state ));break ; +case VHOST_SET_MEM_TABLE : +if (msg.size !=sizeof (m.u64)) { +error_report ("Received bad msg size.\n" );A superfluous "\n" character.
Hi Gonglei
Thank you for your review.
Yes, error_report has printed '\n'.
I will remove it.
Quoted 21 lines
hw/virtio/vhost-user.c static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, · line 324
Quoted 4 lines
hw/virtio/vhost-user.c +4
-0+return -1 ; + }else { +if (m.u64) { +error_report ("Failed to set memory table.\n" );A superfluous "\n" character.
Regards,
-Gongleihw/virtio/vhost-user.c static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, · line 331
Quoted 8 lines
hw/virtio/vhost-user.c +4
-0+return -1 ; + } + } +break ;default :error_report ("Received unexpected msg type.\n" );return -1 ;.
Signature · 2 lines
Regards, Haifeng