vdpa: disable RAM block discard only for the first device
commita230c4712b9d4af202883b789e80780265b00de7
authorEugenio Pérez <eperezma@redhat.com>
Fri, 3 Mar 2023 17:24:40 +0000 (3 18:24 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 7 Mar 2023 17:38:59 +0000 (7 12:38 -0500)
tree1df98a94d13cfdde9fef55f729ab8c58388b0f7c
parent6949843046b6f9c4c6cd28922d5427a17414dfc9
vdpa: disable RAM block discard only for the first device

Although it does not make a big difference, its more correct and
simplifies the cleanup path in subsequent patches.

Move ram_block_discard_disable(false) call to the top of
vhost_vdpa_cleanup because:
* We cannot use vhost_vdpa_first_dev after dev->opaque = NULL
  assignment.
* Improve the stack order in cleanup: since it is the last action taken
  in init, it should be the first at cleanup.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230303172445.1089785-10-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/vhost-vdpa.c