On 8/4/21 11:44 AM, Tianyu Lan wrote: > +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.