Sean Christopherson wrote:
On Thu, Aug 07, 2025, Sagi Shahar wrote:
From: Erdem Aktas erdemaktas@google.com
[snip]
+static void load_td_memory_region(struct kvm_vm *vm,
struct userspace_mem_region *region)
+{
- const struct sparsebit *pages = region->protected_phy_pages;
- const vm_paddr_t gpa_base = region->region.guest_phys_addr;
- const uint64_t hva_base = region->region.userspace_addr;
- const sparsebit_idx_t lowest_page_in_region = gpa_base >> vm->page_shift;
- sparsebit_idx_t i;
- sparsebit_idx_t j;
- if (!sparsebit_any_set(pages))
return;
- sparsebit_for_each_set_range(pages, i, j) {
const uint64_t size_to_load = (j - i + 1) * vm->page_size;
const uint64_t offset =
(i - lowest_page_in_region) * vm->page_size;
const uint64_t hva = hva_base + offset;
const uint64_t gpa = gpa_base + offset;
void *source_addr;
/*
* KVM_TDX_INIT_MEM_REGION ioctl cannot encrypt memory in place.
We should really fix that.
I'm working on it.
This code will change with those changes. But I'd like this to land, or be close to landing, first.
Ira
[snip]