Lines Matching full:section
31 * Return one past the end of the end of section. Be careful with uint64_t
34 static Int128 vhost_vdpa_section_end(const MemoryRegionSection *section, in vhost_vdpa_section_end() argument
37 Int128 llend = int128_make64(section->offset_within_address_space); in vhost_vdpa_section_end()
38 llend = int128_add(llend, section->size); in vhost_vdpa_section_end()
44 static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section, in vhost_vdpa_listener_skipped_section() argument
50 bool is_ram = memory_region_is_ram(section->mr); in vhost_vdpa_listener_skipped_section()
51 bool is_iommu = memory_region_is_iommu(section->mr); in vhost_vdpa_listener_skipped_section()
52 bool is_protected = memory_region_is_protected(section->mr); in vhost_vdpa_listener_skipped_section()
55 bool is_ram_device = memory_region_is_ram_device(section->mr); in vhost_vdpa_listener_skipped_section()
64 if (section->offset_within_address_space < iova_min) { in vhost_vdpa_listener_skipped_section()
65 error_report("RAM section out of device range (min=0x%" PRIx64 in vhost_vdpa_listener_skipped_section()
67 iova_min, section->offset_within_address_space); in vhost_vdpa_listener_skipped_section()
71 * While using vIOMMU, sometimes the section will be larger than iova_max, in vhost_vdpa_listener_skipped_section()
78 llend = vhost_vdpa_section_end(section, page_mask); in vhost_vdpa_listener_skipped_section()
80 error_report("RAM section out of device range (max=0x%" PRIx64 in vhost_vdpa_listener_skipped_section()
221 /* check if RAM section out of device range */ in vhost_vdpa_iommu_map_notify()
224 error_report("RAM section out of device range (max=0x%" PRIx64 in vhost_vdpa_iommu_map_notify()
260 MemoryRegionSection *section) in vhost_vdpa_iommu_region_add() argument
270 iommu_mr = IOMMU_MEMORY_REGION(section->mr); in vhost_vdpa_iommu_region_add()
273 end = int128_add(int128_make64(section->offset_within_region), in vhost_vdpa_iommu_region_add()
274 section->size); in vhost_vdpa_iommu_region_add()
281 section->offset_within_region, in vhost_vdpa_iommu_region_add()
284 iommu->iommu_offset = section->offset_within_address_space - in vhost_vdpa_iommu_region_add()
285 section->offset_within_region; in vhost_vdpa_iommu_region_add()
288 ret = memory_region_register_iommu_notifier(section->mr, &iommu->n, NULL); in vhost_vdpa_iommu_region_add()
299 MemoryRegionSection *section) in vhost_vdpa_iommu_region_del() argument
307 if (MEMORY_REGION(iommu->iommu_mr) == section->mr && in vhost_vdpa_iommu_region_del()
308 iommu->n.start == section->offset_within_region) { in vhost_vdpa_iommu_region_del()
309 memory_region_unregister_iommu_notifier(section->mr, &iommu->n); in vhost_vdpa_iommu_region_del()
318 MemoryRegionSection *section) in vhost_vdpa_listener_region_add() argument
329 if (vhost_vdpa_listener_skipped_section(section, s->iova_range.first, in vhost_vdpa_listener_region_add()
333 if (memory_region_is_iommu(section->mr)) { in vhost_vdpa_listener_region_add()
334 vhost_vdpa_iommu_region_add(listener, section); in vhost_vdpa_listener_region_add()
338 if (unlikely((section->offset_within_address_space & ~page_mask) != in vhost_vdpa_listener_region_add()
339 (section->offset_within_region & ~page_mask))) { in vhost_vdpa_listener_region_add()
340 trace_vhost_vdpa_listener_region_add_unaligned(s, section->mr->name, in vhost_vdpa_listener_region_add()
341 section->offset_within_address_space & ~page_mask, in vhost_vdpa_listener_region_add()
342 section->offset_within_region & ~page_mask); in vhost_vdpa_listener_region_add()
346 iova = ROUND_UP(section->offset_within_address_space, page_size); in vhost_vdpa_listener_region_add()
347 llend = vhost_vdpa_section_end(section, page_mask); in vhost_vdpa_listener_region_add()
352 memory_region_ref(section->mr); in vhost_vdpa_listener_region_add()
354 /* Here we assume that memory_region_is_ram(section->mr)==true */ in vhost_vdpa_listener_region_add()
356 vaddr = memory_region_get_ram_ptr(section->mr) + in vhost_vdpa_listener_region_add()
357 section->offset_within_region + in vhost_vdpa_listener_region_add()
358 (iova - section->offset_within_address_space); in vhost_vdpa_listener_region_add()
361 vaddr, section->readonly); in vhost_vdpa_listener_region_add()
366 hwaddr gpa = section->offset_within_address_space; in vhost_vdpa_listener_region_add()
369 mem_region.perm = IOMMU_ACCESS_FLAG(true, section->readonly), in vhost_vdpa_listener_region_add()
388 int128_get64(llsize), vaddr, section->readonly); in vhost_vdpa_listener_region_add()
413 MemoryRegionSection *section) in vhost_vdpa_listener_region_del() argument
422 if (vhost_vdpa_listener_skipped_section(section, s->iova_range.first, in vhost_vdpa_listener_region_del()
426 if (memory_region_is_iommu(section->mr)) { in vhost_vdpa_listener_region_del()
427 vhost_vdpa_iommu_region_del(listener, section); in vhost_vdpa_listener_region_del()
430 if (unlikely((section->offset_within_address_space & ~page_mask) != in vhost_vdpa_listener_region_del()
431 (section->offset_within_region & ~page_mask))) { in vhost_vdpa_listener_region_del()
432 trace_vhost_vdpa_listener_region_del_unaligned(s, section->mr->name, in vhost_vdpa_listener_region_del()
433 section->offset_within_address_space & ~page_mask, in vhost_vdpa_listener_region_del()
434 section->offset_within_region & ~page_mask); in vhost_vdpa_listener_region_del()
438 iova = ROUND_UP(section->offset_within_address_space, page_size); in vhost_vdpa_listener_region_del()
439 llend = vhost_vdpa_section_end(section, page_mask); in vhost_vdpa_listener_region_del()
453 .translated_addr = section->offset_within_address_space, in vhost_vdpa_listener_region_del()
490 memory_region_unref(section->mr); in vhost_vdpa_listener_region_del()