x86, swiotlb: Add memory encryption support
[linux-2.6-block.git] / init / main.c
index df58a416dd1da54df4c3f2be807adb5366ec35b2..9789ab7fe85e14f7434be3b0298a9ebf920242e0 100644 (file)
@@ -488,6 +488,8 @@ void __init __weak thread_stack_cache_init(void)
 }
 #endif
 
+void __init __weak mem_encrypt_init(void) { }
+
 /*
  * Set up kernel memory allocators
  */
@@ -518,6 +520,7 @@ asmlinkage __visible void __init start_kernel(void)
        /*
         * Set up the initial canary ASAP:
         */
+       add_latent_entropy();
        boot_init_stack_canary();
 
        cgroup_init_early();
@@ -640,6 +643,14 @@ asmlinkage __visible void __init start_kernel(void)
         */
        locking_selftest();
 
+       /*
+        * This needs to be called before any devices perform DMA
+        * operations that might use the SWIOTLB bounce buffers. It will
+        * mark the bounce buffers as decrypted so that their usage will
+        * not cause "plain-text" data to be decrypted when accessed.
+        */
+       mem_encrypt_init();
+
 #ifdef CONFIG_BLK_DEV_INITRD
        if (initrd_start && !initrd_below_start_ok &&
            page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) {