Thread (23 messages) 23 messages, 3 authors, 2021-08-05

Re: [PATCH V2 03/14] x86/set_memory: Add x86_set_memory_enc static call support

From: Dave Hansen <hidden>
Date: 2021-08-04 19:27:28
Also in: linux-arch, linux-hyperv, linux-iommu, lkml, netdev, xen-devel

On 8/4/21 11:44 AM, Tianyu Lan wrote:
quoted hunk ↗ jump to hunk
+static int default_set_memory_enc(unsigned long addr, int numpages, bool enc);
+DEFINE_STATIC_CALL(x86_set_memory_enc, default_set_memory_enc);
+
 #define CPA_FLUSHTLB 1
 #define CPA_ARRAY 2
 #define CPA_PAGES_ARRAY 4
@@ -1981,6 +1985,11 @@ int set_memory_global(unsigned long addr, int numpages)
 }
 
 static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc)
+{
+	return static_call(x86_set_memory_enc)(addr, numpages, enc);
+}
+
+static int default_set_memory_enc(unsigned long addr, int numpages, bool enc)
 {
 	struct cpa_data cpa;
 	int ret;
It doesn't make a lot of difference to add this infrastructure and then
ignore it for the existing in-tree user:
static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc)
{
        struct cpa_data cpa;
        int ret;

        /* Nothing to do if memory encryption is not active */
        if (!mem_encrypt_active())
                return 0;
Shouldn't the default be to just "return 0"?  Then on
mem_encrypt_active() systems, do the bulk of what is in
__set_memory_enc_dec() today.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help