[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL715W+-H7ZSQZeZmAbbJNGKaZCNqf4VdLismivxux=gerFuDw@mail.gmail.com>
Date: Mon, 18 Oct 2021 08:00:00 -0700
From: Mingwei Zhang <mizhang@...gle.com>
To: Michael Roth <michael.roth@....com>
Cc: linux-kselftest@...r.kernel.org, kvm <kvm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
Nathan Tempelman <natet@...gle.com>,
Marc Orr <marcorr@...gle.com>,
Steve Rutherford <srutherford@...gle.com>,
Sean Christopherson <seanjc@...gle.com>,
Brijesh Singh <brijesh.singh@....com>,
Tom Lendacky <thomas.lendacky@....com>,
Varad Gautam <varad.gautam@...e.com>,
Shuah Khan <shuah@...nel.org>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
David Woodhouse <dwmw@...zon.co.uk>,
Ricardo Koller <ricarkol@...gle.com>,
Jim Mattson <jmattson@...gle.com>,
Wanpeng Li <wanpengli@...cent.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>
Subject: Re: [RFC 02/16] KVM: selftests: add hooks for managing encrypted
guest memory
> +void vm_set_memory_encryption(struct kvm_vm *vm, bool enc_by_default, bool has_enc_bit,
> + uint8_t enc_bit)
> +{
> + vm->memcrypt.enabled = true;
> + vm->memcrypt.enc_by_default = enc_by_default;
> + vm->memcrypt.has_enc_bit = has_enc_bit;
> + vm->memcrypt.enc_bit = enc_bit;
> +}
> +
> +struct sparsebit *
> +vm_get_encrypted_phy_pages(struct kvm_vm *vm, int slot, vm_paddr_t *gpa_start,
> + uint64_t *size)
> +{
> + struct userspace_mem_region *region;
> + struct sparsebit *encrypted_phy_pages;
> +
> + if (!vm->memcrypt.enabled)
> + return NULL;
> +
> + region = memslot2region(vm, slot);
> + if (!region)
> + return NULL;
> +
> + encrypted_phy_pages = sparsebit_alloc();
> + sparsebit_copy(encrypted_phy_pages, region->encrypted_phy_pages);
Do we have to make a copy for the sparsebit? Why not just return the
pointer? By looking at your subsequent patches, I find that this data
structure seems to be just read-only?
-Mingwei
Powered by blists - more mailing lists