Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp16950pxb; Wed, 30 Mar 2022 21:35:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/KKNcopa/FyATwGJzOzMUzFMtyh7ZtsRcbioRWMrg13NM2BGoNXAJtN3Wjc2+RdUVoZna X-Received: by 2002:a17:902:a585:b0:14d:58ef:65 with SMTP id az5-20020a170902a58500b0014d58ef0065mr3142329plb.139.1648701317422; Wed, 30 Mar 2022 21:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648701317; cv=none; d=google.com; s=arc-20160816; b=CLypoHNOvsYuxZXownQS7BHZRJphLE98Iq/+W2na7nMaS8/Agp9HZdZJ4nL76YJEox ZFHPsUqmjmo2aVlvE3Ba/3Uyhl+m7QYkrib/i4e9DOE7eKJpRwMk7KG48GOSJ1Aik+HT iQzsyXlmIlHlWQWAeotKHDjnJgqNkAJhndgcohjelDm/Q6SexQlAktN0snP9k9yqLQoP lvIpza5hDq7VvAWhtiNG6mnzc1Wea8H7KsMWZEUItIqpXZab6t0v8eUJMoyHLvEpkIHR n8Z+CLtaKunmV1SY+erInwB3/IY+3MXFSgChLnmoBoU+RZZOp6iVjNBykDoH22+zFxnb PhZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8sQ6SQCM7+eekKWwRavWR33/gb8wY09eRtrYpsnuNfQ=; b=teARX1HIN9Y6XXWPFI91xNHh4UF80mkkAPa5FyzgteUZFfEq5ml/HYZB+npglu8IL4 Ng3MKQYfkF5jhasuFOIZ9XWcpPdDakuKFEXCBgb7I77+ncOrPYOqDrM5+YV3m7fb3WI5 quG2qT5A3R8PCtMtitnJ0qUIPBSHbcqMNGvqmyj/9zmJR2pRiSoLuolvcKhCXgQGFKR4 AVQu2ooY8DHH/1NZ6VYMw0vv4F6oA8HUMW0WksLwYand9TWSQyS6qarEkE9LL1D49pEO xUyl9eIBMaeufJqXns9IsMlMJFgXtPX4PvOxT7ics5BfhtZJpl4cJLjlj2XVQcY8rBdB pZbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=yUXTtYD7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d8-20020a631d08000000b003986e01e40dsi10740604pgd.95.2022.03.30.21.35.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 21:35:17 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=yUXTtYD7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7FB961F1631; Wed, 30 Mar 2022 20:28:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349621AbiC3SDQ (ORCPT + 99 others); Wed, 30 Mar 2022 14:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349592AbiC3SDO (ORCPT ); Wed, 30 Mar 2022 14:03:14 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74C772195 for ; Wed, 30 Mar 2022 11:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=8sQ6SQCM7+eekKWwRavWR33/gb8wY09eRtrYpsnuNfQ=; b=yUXTtYD7LDJ8eYXzNSyyQftYQp S3O3C63uKLospuC5Mh4AL7JUStHkfwaRMljYo1yNjIR4OiIFD0WCK6jyi4GeT6zDxpQJ1+vdcHAMr Q9GQ8fNuoqDTs+qyoLgpt5fZSxYSIBkGtonuYlUG6ikqvFlpI2GChXbsKYHjI4IF/xYbqm+ndyIMd ZT3PM5Bm0h4mo51aGi0q6qMUxCjahNmfVAewOXBnIkSgPBXAUY3oAv4hW8yl+qZwlGs/YmUtbLjqG wX+ok7SDr/YclbDU4s+KHcUp+FpF2CmEH5tEZs9x1mHwaVvFaNUhDxmbduA7BR2uyfpRiyCw7IYfk eQNcXaFA==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nZcdJ-00H3zL-To; Wed, 30 Mar 2022 18:01:25 +0000 Date: Wed, 30 Mar 2022 11:01:25 -0700 From: Christoph Hellwig To: "Alex Xu (Hello71)" Cc: Christoph Hellwig , regressions@lists.linux.dev, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org Subject: Re: "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail Message-ID: References: <1648659326.eabkokyuym.none.ref@localhost> <1648659326.eabkokyuym.none@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1648659326.eabkokyuym.none@localhost> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Can you try this patch, which is a bit of a hack? diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index 50d209939c66c..61997c2ee0a17 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -28,7 +28,8 @@ bool force_dma_unencrypted(struct device *dev) * device does not support DMA to addresses that include the * encryption mask. */ - if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) { + if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) && + !get_dma_ops(dev)) { u64 dma_enc_mask = DMA_BIT_MASK(__ffs64(sme_me_mask)); u64 dma_dev_mask = min_not_zero(dev->coherent_dma_mask, dev->bus_dma_limit);