aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorEugenio Pérez <eperezma@redhat.com>2024-02-15 11:36:15 +0100
committerMichael S. Tsirkin <mst@redhat.com>2024-03-12 17:56:55 -0400
commita55834579aa65f27519f948275d5efd9e2173bef (patch)
tree17d04b06f291d1b40eb12840e9f30685a10b5134 /hw/virtio
parentc08da86dc412cd44039bc78df02227578bc06268 (diff)
vdpa: stash memory region properties in vars
Next changes uses this variables, so avoid call repeatedly to memory region functions. No functional change intended. Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Message-Id: <20240215103616.330518-2-eperezma@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/vhost-vdpa.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index c968278e70..5559d4f89c 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -47,12 +47,14 @@ static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section,
int page_mask)
{
Int128 llend;
+ bool is_ram = memory_region_is_ram(section->mr);
+ bool is_iommu = memory_region_is_iommu(section->mr);
+ bool is_protected = memory_region_is_protected(section->mr);
- if ((!memory_region_is_ram(section->mr) &&
- !memory_region_is_iommu(section->mr)) ||
- memory_region_is_protected(section->mr) ||
- /* vhost-vDPA doesn't allow MMIO to be mapped */
- memory_region_is_ram_device(section->mr)) {
+ /* vhost-vDPA doesn't allow MMIO to be mapped */
+ bool is_ram_device = memory_region_is_ram_device(section->mr);
+
+ if ((!is_ram && !is_iommu) || is_protected || is_ram_device) {
return true;
}
@@ -69,7 +71,7 @@ static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section,
* size that maps to the kernel
*/
- if (!memory_region_is_iommu(section->mr)) {
+ if (!is_iommu) {
llend = vhost_vdpa_section_end(section, page_mask);
if (int128_gt(llend, int128_make64(iova_max))) {
error_report("RAM section out of device range (max=0x%" PRIx64