Re: [PATCH V6 3/8] x86/hyperv: Add new hvcall guest address host visibility support

From: Tianyu Lan
Date: Fri Oct 01 2021 - 09:18:33 EST


Hi Boris:
Thanks for your review.

On 10/1/2021 2:02 AM, Borislav Petkov wrote:
On Thu, Sep 30, 2021 at 09:05:39AM -0400, Tianyu Lan wrote:
@@ -1980,15 +1982,11 @@ int set_memory_global(unsigned long addr, int numpages)
__pgprot(_PAGE_GLOBAL), 0);
}
-static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc)
+static int __set_memory_enc_pgtable(unsigned long addr, int numpages, bool enc)

What exactly is that "pgtable" at the end of the name supposed to mean?


This was suggested by Dave Hansen. It gets used for the hypervisors
that get informed about "encryption" status via page tables: SEV and TDX.

https://lore.kernel.org/linux-iommu/c00e269c-da4c-c703-0182-0221c73a76cc@xxxxxxxxx/

So if you want to have different indirections here, I'd suggest you do
this:

set_memory_encrypted/decrypted() is the external API. It calls

_set_memory_enc_dec() which does your hv_* checks. Note the single
underscore "_" prefix.

Then, the workhorse remains __set_memory_enc_dec().

Ok?

Also, we're reworking the mem_encrypt_active() accessors:

https://lkml.kernel.org/r/20210928191009.32551-1-bp@xxxxxxxxx

so some synchronization when juggling patchsets will be needed. JFYI
anyway.

Thanks for reminder. I know that patchset and suggested to decouple dependency among SEV, TDX and Hyper=v patchset.


Also 2, building your set triggers this, dunno if I'm missing some
patches on my local branch for that.

Thanks for your test. Missing hv_set_register() when CONFIG_HYPERV is not selected. I will fix it in the next version.


In file included from ./arch/x86/include/asm/mshyperv.h:240,
from ./include/clocksource/hyperv_timer.h:18,
from ./arch/x86/include/asm/vdso/gettimeofday.h:21,
from ./include/vdso/datapage.h:137,
from ./arch/x86/include/asm/vgtod.h:12,
from arch/x86/entry/vdso/vma.c:20:
./include/asm-generic/mshyperv.h: In function ‘vmbus_signal_eom’:
./include/asm-generic/mshyperv.h:153:3: error: implicit declaration of function ‘hv_set_register’; did you mean ‘kset_register’? [-Werror=implicit-function-declaration]
153 | hv_set_register(HV_REGISTER_EOM, 0);
| ^~~~~~~~~~~~~~~
| kset_register
In file included from ./arch/x86/include/asm/mshyperv.h:240,
from arch/x86/mm/pat/set_memory.c:34:
./include/asm-generic/mshyperv.h: In function ‘vmbus_signal_eom’:
...