[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH V3 01/11] x86/HV: Initialize GHCB page in Isolation VM



Hi Christoph:
        Thanks for your review.

On 6/7/2021 2:41 PM, Christoph Hellwig wrote:
On Sun, May 30, 2021 at 11:06:18AM -0400, Tianyu Lan wrote:
+       if (ms_hyperv.ghcb_base) {
+               rdmsrl(MSR_AMD64_SEV_ES_GHCB, ghcb_gpa);
+
+               ghcb_va = ioremap_cache(ghcb_gpa, HV_HYP_PAGE_SIZE);
+               if (!ghcb_va)
+                       return -ENOMEM;

Can you explain this a bit more?  We've very much deprecated
ioremap_cache in favor of memremap.  Why yo you need a __iomem address
here?  Why do we need the remap here at all? >

GHCB physical address is an address in extra address space which is above shared gpa boundary reported by Hyper-V CPUID. The addresses below shared gpa boundary treated as encrypted and the one above is treated as decrypted. System memory is remapped in the extra address space and it starts from the boundary. The shared memory with host needs to use address in the extra address(pa + shared_gpa_boundary) in Linux guest.

Here is to map ghcb page for the communication operations with Hypervisor(e.g, hypercall and read/write MSR) via GHCB page.

memremap() will go through iomem_resource list and the address in extra address space will not be in the list. So I used ioremap_cache(). I will
memremap() instead of ioremap() here.

Does the data structure at this address not have any types that we
could use a struct for?

The struct will be added in the following patch. I will refresh the following patch and use the struct hv_ghcb for the mapped point.

+
+               rdmsrl(MSR_AMD64_SEV_ES_GHCB, ghcb_gpa);
+               ghcb_va = ioremap_cache(ghcb_gpa, HV_HYP_PAGE_SIZE);
+               if (!ghcb_va) {

This seems to duplicate the above code.

The above is to map ghcb for BSP and here does the same thing for APs
Will add a new function to avoid the duplication.


+bool hv_isolation_type_snp(void)
+{
+       return static_branch_unlikely(&isolation_type_snp);
+}
+EXPORT_SYMBOL_GPL(hv_isolation_type_snp);

This probably wants a kerneldoc explaining when it should be used. >

OK. I will add.




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.