From patchwork Wed Mar 13 09:20:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10850833 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A0C81669 for ; Wed, 13 Mar 2019 09:21:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66D1C29A71 for ; Wed, 13 Mar 2019 09:21:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5ADD929AD6; Wed, 13 Mar 2019 09:21:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E9BB829A71 for ; Wed, 13 Mar 2019 09:20:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A1F246E07A; Wed, 13 Mar 2019 09:20:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0D9E16E07A for ; Wed, 13 Mar 2019 09:20:57 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id f3so1103596wmj.4 for ; Wed, 13 Mar 2019 02:20:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kVZSUIYAjOnTq1zxsTHdphIWQJ+lUK71PdU7yVQ1Muo=; b=ZtwyeA6i640UcCzj4gFeSge6ornnp2sXORAmjObNFW8/+12n30/jYFxKyPKCOTi44n lHBAPvPKvR4xp0jNbBzGPTpPxwXcVgCWO6wD/URiWOd9zG6BT7Z41xCUqTmR4YQAk7pk n4f6Ylisq7P+UICckQGuTzXyVf0GIWyUqP9EG08x9oME9uLdj6DUigrScwZQZsTy/dmg C4MtFI7QOt0eOod3sFbbgDhjtDVu/5c4FdXc5XnzL+sVAw9VMfnyawwTneUFb5u7v0mM kX8jGxzWIzc+mxR7yDnT1t/8A3jQNr1a+uLasKQbZNhO4GxAGolm5Jb/gYjndpvxhCQW 0ZAA== X-Gm-Message-State: APjAAAX5Aql0W4KFWolS2ciUQ87IwLqZdEuPaVD+n4GPCnHL+Dyhi40k N4BguM3VhYREsvaR1WDgsJLYdulo X-Google-Smtp-Source: APXvYqyhEreXlIhkazbeypL0F3tV98wOuyoRQHWQTDU09lX1YHOLoPFQMhSAOYrdUrOF8GmeV3+14Q== X-Received: by 2002:a1c:2e85:: with SMTP id u127mr1589413wmu.45.1552468855479; Wed, 13 Mar 2019 02:20:55 -0700 (PDT) Received: from laptop.amd.com ([2a02:908:1252:fb60:be8a:bd56:1f94:86e7]) by smtp.gmail.com with ESMTPSA id f6sm12349631wrt.87.2019.03.13.02.20.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 02:20:53 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: fallback to dma_alloc_coherent when memory encryption is active Date: Wed, 13 Mar 2019 10:20:52 +0100 Message-Id: <20190313092052.16347-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kVZSUIYAjOnTq1zxsTHdphIWQJ+lUK71PdU7yVQ1Muo=; b=TAb8HQXL10UshFC16EDbQafe63CAZHrV4gWoB6fzmBX/Z3IE9enhFWxQ6NUdxQ5TUE DoiSl1kp5nNgswaLz5UD4n+c9FGl8uT2NQg7ggQ4GGk8SJLLHt0nmINiRrBIN7b/8u9g uRhERDcdahQBWJ7MSWjVeadGnLhz1iFeePH16zFlLbKRzlWEARpaq5r8hgdf0rqIjpSh RZB6E/VuDW6s4uHm7UmbS2wx1G/4xsR9v+PKOut/aSvqz9OQC3PKLtG739R9JEIReKNu jPw/Q4ewitbWeDWAoolX+V3F8UwSP5euA42/dhlEbIVNW7CLTcVvASsE+1jjCjrgCOKT ZuRw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas.Lendacky@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP We can't just map any randome page we get when memory encryption is active. Signed-off-by: Christian König Acked-by: Alex Deucher --- drivers/gpu/drm/drm_memory.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c index 8dbcdc77f6bf..132fef8ff1b6 100644 --- a/drivers/gpu/drm/drm_memory.c +++ b/drivers/gpu/drm/drm_memory.c @@ -168,6 +168,13 @@ bool drm_need_swiotlb(int dma_bits) if (xen_pv_domain()) return true; + /* + * Enforce dma_alloc_coherent when memory encryption is active as well + * for the same reasons as for Xen paravirtual hosts. + */ + if (mem_encrypt_active()) + return true; + for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) { max_iomem = max(max_iomem, tmp->end); }