[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 27/68] vdpa: stash memory region properties in vars
From: |
Michael S. Tsirkin |
Subject: |
[PULL 27/68] vdpa: stash memory region properties in vars |
Date: |
Tue, 12 Mar 2024 18:26:54 -0400 |
From: Eugenio Pérez <eperezma@redhat.com>
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>
---
hw/virtio/vhost-vdpa.c | 14 ++++++++------
1 file 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
--
MST
- [PULL 14/68] libvhost-user: Factor out removing all mem regions, (continued)
- [PULL 14/68] libvhost-user: Factor out removing all mem regions, Michael S. Tsirkin, 2024/03/12
- [PULL 15/68] libvhost-user: Merge vu_set_mem_table_exec_postcopy() into vu_set_mem_table_exec(), Michael S. Tsirkin, 2024/03/12
- [PULL 16/68] libvhost-user: Factor out adding a memory region, Michael S. Tsirkin, 2024/03/12
- [PULL 17/68] libvhost-user: No need to check for NULL when unmapping, Michael S. Tsirkin, 2024/03/12
- [PULL 18/68] libvhost-user: Don't zero out memory for memory regions, Michael S. Tsirkin, 2024/03/12
- [PULL 19/68] libvhost-user: Don't search for duplicates when removing memory regions, Michael S. Tsirkin, 2024/03/12
- [PULL 23/68] libvhost-user: Factor out vq usability check, Michael S. Tsirkin, 2024/03/12
- [PULL 26/68] pcie: Support PCIe Gen5/Gen6 link speeds, Michael S. Tsirkin, 2024/03/12
- [PULL 21/68] libvhost-user: Speedup gpa_to_mem_region() and vu_gpa_to_va(), Michael S. Tsirkin, 2024/03/12
- [PULL 22/68] libvhost-user: Use most of mmap_offset as fd_offset, Michael S. Tsirkin, 2024/03/12
- [PULL 27/68] vdpa: stash memory region properties in vars,
Michael S. Tsirkin <=
- [PULL 20/68] libvhost-user: Factor out search for memory region by GPA and simplify, Michael S. Tsirkin, 2024/03/12
- [PULL 24/68] libvhost-user: Dynamically remap rings after (temporarily?) removing memory regions, Michael S. Tsirkin, 2024/03/12
- [PULL 28/68] vdpa: trace skipped memory sections, Michael S. Tsirkin, 2024/03/12
- [PULL 29/68] hw/pci-bridge/pxb-cxl: Drop RAS capability from host bridge., Michael S. Tsirkin, 2024/03/12
- [PULL 30/68] hw/audio/virtio-sound: return correct command response size, Michael S. Tsirkin, 2024/03/12
- [PULL 31/68] hw/virtio: check owner for removing objects, Michael S. Tsirkin, 2024/03/12
- [PULL 33/68] hw/cxl/cxl-host: Fix missing ERRP_GUARD() in cxl_fixed_memory_window_config(), Michael S. Tsirkin, 2024/03/12
- [PULL 25/68] libvhost-user: Mark mmap'ed region memory as MADV_DONTDUMP, Michael S. Tsirkin, 2024/03/12
- [PULL 32/68] hw/virtio: Add support for VDPA network simulation devices, Michael S. Tsirkin, 2024/03/12