Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3014617pxb; Mon, 18 Oct 2021 06:38:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3WbVYR4WBqgG0v5gZeiD7hgWuTqjqd53pAqUjoXzhNe3ViHT37bKm8JZ9Caxtbo0Od60u X-Received: by 2002:a63:d30e:: with SMTP id b14mr23642688pgg.454.1634564288451; Mon, 18 Oct 2021 06:38:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564288; cv=none; d=google.com; s=arc-20160816; b=Knwiethh9Z0HoKbhrXEemCeC4y0+AeBlU6kmNjsnMsF04zz2nmnN8CvwJIGWRKqLoP 9pUmW/IvpgQP+WmRDw1gUzESXGiE/bKc1huQ/cEraURRmH//dLOdo4rI0jNJz0zMckae jg4PTJRPkwHtoUDG2aB3FaCsOYJIpDpBbxvk+qQjqgCXfuRFzmyjTrmLNE5obbTL1hI+ oqb96FCSnjrG6bF932XQyWGT8lNcJwplRjDW/yYuoXiIKMl9IszVVaMhTfXj7WiJSXOM tD1MihOHS5iQVL3cV2aCDXVHJcncXuFnqtbZHTF269I54DOjbxCxvFNYfOVogmtvPuko 46Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IlKnJMa0jkh1h1s/kJO2o4hr0c0RwNRMcUbyongZ64Q=; b=XfkctKnT2tiNYYRT2ptERpzlWOWPQLaYnczI7XXLmfrzwkOuUMsyEx/PjJ1jfuU2i0 t/edqmBb7yZPjklGiJSCxVlSAGH6ebE6BypQziIAx8MczTgaCtpVm9mEQqbYhn1NedSz N7xYbKG2jek/6U0PRMX8HM8egXr747ywNiE7O7FNpl1fofSDkP7+374uJSUeWCTDqJ1i 3aJsrjzsGgB8jcOfDSiHVdTOfQHXK8P+z2IfoDQjgZ3KSlgwCMBWV+ZYBHBWufUoMJLg nHpKS8XUyGJL05ZZdcJyDJ/jayPDjjnQOD0GlZAVWdpdB9evOxKyGOiCbSecM9nv+tbR eU3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eGc51J0m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l190si19206491pge.367.2021.10.18.06.37.55; Mon, 18 Oct 2021 06:38:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eGc51J0m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232735AbhJRNiF (ORCPT + 99 others); Mon, 18 Oct 2021 09:38:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:54246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232532AbhJRNfn (ORCPT ); Mon, 18 Oct 2021 09:35:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 19E83613AB; Mon, 18 Oct 2021 13:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563844; bh=+y+S4sr4LrFwxu2nSQ80feGpvSX2thEHPUinc2qElgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGc51J0mrlSItGCNQDAPv+JXPTXmtPCJaH9wBGGcLHjtTLZMZvbR+LrVY89zD//bu fj32z8VcruS0XWrg5BzUYeCFx7aL1IBKNGe4J6XtqONqErfjsWwad0nS3dd7TYzf+y l3zGDpuhQiHCllw0tCeDNNCATkIUQ7O9b61/+4uY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Menzel , Borislav Petkov , Alex Deucher , Tom Lendacky Subject: [PATCH 5.4 36/69] x86/Kconfig: Do not enable AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT automatically Date: Mon, 18 Oct 2021 15:24:34 +0200 Message-Id: <20211018132330.678200819@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132329.453964125@linuxfoundation.org> References: <20211018132329.453964125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov commit 711885906b5c2df90746a51f4cd674f1ab9fbb1d upstream. This Kconfig option was added initially so that memory encryption is enabled by default on machines which support it. However, devices which have DMA masks that are less than the bit position of the encryption bit, aka C-bit, require the use of an IOMMU or the use of SWIOTLB. If the IOMMU is disabled or in passthrough mode, the kernel would switch to SWIOTLB bounce-buffering for those transfers. In order to avoid that, 2cc13bb4f59f ("iommu: Disable passthrough mode when SME is active") disables the default IOMMU passthrough mode so that devices for which the default 256K DMA is insufficient, can use the IOMMU instead. However 2, there are cases where the IOMMU is disabled in the BIOS, etc. (think the usual hardware folk "oops, I dropped the ball there" cases) or a driver doesn't properly use the DMA APIs or a device has a firmware or hardware bug, e.g.: ea68573d408f ("drm/amdgpu: Fail to load on RAVEN if SME is active") However 3, in the above GPU use case, there are APIs like Vulkan and some OpenGL/OpenCL extensions which are under the assumption that user-allocated memory can be passed in to the kernel driver and both the GPU and CPU can do coherent and concurrent access to the same memory. That cannot work with SWIOTLB bounce buffers, of course. So, in order for those devices to function, drop the "default y" for the SME by default active option so that users who want to have SME enabled, will need to either enable it in their config or use "mem_encrypt=on" on the kernel command line. [ tlendacky: Generalize commit message. ] Fixes: 7744ccdbc16f ("x86/mm: Add Secure Memory Encryption (SME) support") Reported-by: Paul Menzel Signed-off-by: Borislav Petkov Acked-by: Alex Deucher Acked-by: Tom Lendacky Cc: Link: https://lkml.kernel.org/r/8bbacd0e-4580-3194-19d2-a0ecad7df09c@molgen.mpg.de Signed-off-by: Greg Kroah-Hartman --- arch/x86/Kconfig | 1 - 1 file changed, 1 deletion(-) --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1541,7 +1541,6 @@ config AMD_MEM_ENCRYPT config AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT bool "Activate AMD Secure Memory Encryption (SME) by default" - default y depends on AMD_MEM_ENCRYPT ---help--- Say yes to have system memory encrypted by default if running on