Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1143264ybf; Thu, 27 Feb 2020 05:51:12 -0800 (PST) X-Google-Smtp-Source: APXvYqwt+wO+BRt4UV49SiqweX5c3zi49I+GqNC8kGmC3mkrAdESSuV9wvcn0uIyRhljKUEpfca1 X-Received: by 2002:aca:90f:: with SMTP id 15mr3411790oij.18.1582811472702; Thu, 27 Feb 2020 05:51:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582811472; cv=none; d=google.com; s=arc-20160816; b=ZSlOesXaHSHaUXoz4iN80CniRBXfQAd/r6i/0q9CujXbhyiBqSUngHCinnWTmro59T xWZHglILtzXnpEio6oWRoqgf1q5mcY94hhK50KlKMSWsxQK9L/jP66f3jUhrjWllj7KQ MaesWMfFQhXNJkyUUGPm49jdrbBwsKw88fBIt8zXMaaysjUx8Wj9EdSBK+v02G3vZ1Yw 2HvWZcbWpbmWHhcle486k9jESmm8B4kCXaURMIzxrC4UgNyckiPsVifBf0lo3UZ4qlJ7 8ciH+NbmXC7eWyoU708vZSqA2oz5lvVy3H6R08i4kKZLiRVJXK8E+4tShiu9IE8PgqIR h+Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:references:cc:to:from:subject :dkim-signature; bh=fbhKlfeMT7R3G2qyZ8thtYEaJVLMbVZxR/p3KvT+OXM=; b=CufOmS30rw/GR4ITpNjuokzDfLzOSCUO8TDXa5Fm3JQPWfSQzCdIyOiJsf4dgGk2nq BNY2jaYicJX5nKglOvcLzY6Vo47WbUxBMLfsjjXBWc4pLLYmEA6bkq/eLOaRS65rzLcq zlC678Q0NZTWHlTa9m82peXaTK0OJpbHrM8hL1Uqq/rUu8fo9TSKyjGSLOOtakoBjzao LjQmh7lDZQl8jcIuLYGXa9FRib2V/HLzY85uNTpBEtivOEtIONBDDhCdv0vAOT9XKjbI mpwFKbKnL0X4NqQWBLNV8A4eiwbUFXucAHSiuIfie1eeHN3pjTmwMLmlJMsnhc3iMsYl 6BNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@shipmail.org header.s=mail header.b=EPN81Roz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69si1741946otv.190.2020.02.27.05.51.00; Thu, 27 Feb 2020 05:51:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@shipmail.org header.s=mail header.b=EPN81Roz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731071AbgB0Ntk (ORCPT + 99 others); Thu, 27 Feb 2020 08:49:40 -0500 Received: from ste-pvt-msa2.bahnhof.se ([213.80.101.71]:11735 "EHLO ste-pvt-msa2.bahnhof.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729837AbgB0Nta (ORCPT ); Thu, 27 Feb 2020 08:49:30 -0500 Received: from localhost (localhost [127.0.0.1]) by ste-pvt-msa2.bahnhof.se (Postfix) with ESMTP id 6B47C3FFFF; Thu, 27 Feb 2020 14:49:29 +0100 (CET) Authentication-Results: ste-pvt-msa2.bahnhof.se; dkim=pass (1024-bit key; unprotected) header.d=shipmail.org header.i=@shipmail.org header.b=EPN81Roz; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Flag: NO X-Spam-Score: -2.099 X-Spam-Level: X-Spam-Status: No, score=-2.099 tagged_above=-999 required=6.31 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no Authentication-Results: ste-ftg-msa2.bahnhof.se (amavisd-new); dkim=pass (1024-bit key) header.d=shipmail.org Received: from ste-pvt-msa2.bahnhof.se ([127.0.0.1]) by localhost (ste-ftg-msa2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zZpp5hhf_Jwg; Thu, 27 Feb 2020 14:49:28 +0100 (CET) Received: from mail1.shipmail.org (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) (Authenticated sender: mb878879) by ste-pvt-msa2.bahnhof.se (Postfix) with ESMTPA id F34FB3FFFE; Thu, 27 Feb 2020 14:49:26 +0100 (CET) Received: from localhost.localdomain (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) by mail1.shipmail.org (Postfix) with ESMTPSA id 27F77360058; Thu, 27 Feb 2020 14:49:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1582811366; bh=dmA9EfEpLrguT6/Rljc0wE4Ag8/EI49OnW2QETp6mtc=; h=Subject:From:To:Cc:References:Date:In-Reply-To:From; b=EPN81Roz7tXs9Cw/4be9SSLQmZWi4wtXZXK8p54udnai4pfbkoaZUMngr+TBklMRJ itDjoZliExsMqXjg1lPzPokhPUoX02CsCemuGE5kxLWAwYn5e9IHj3DWoTfO3uAA6o PytqXJA4og9dpjaDtHGYEMZOhE/OuUlVCv0WQhvE= Subject: Re: [PATCH v5 1/3] drm/shmem: add support for per object caching flags. From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28VMware=29?= To: Gerd Hoffmann Cc: dri-devel@lists.freedesktop.org, Guillaume.Gardet@arm.com, David Airlie , open list , gurchetansingh@chromium.org, tzimmermann@suse.de, yuq825@gmail.com, noralf@tronnes.org, robh@kernel.org References: <20200226154752.24328-1-kraxel@redhat.com> <20200226154752.24328-2-kraxel@redhat.com> <20200227075321.ki74hfjpnsqv2yx2@sirius.home.kraxel.org> <41ca197c-136a-75d8-b269-801db44d4cba@shipmail.org> <20200227105643.h4klc3ybhpwv2l3x@sirius.home.kraxel.org> <68a05ace-40bc-76d6-5464-2c96328874b9@shipmail.org> <20200227132137.irruicvlkxpdo3so@sirius.home.kraxel.org> <78eb099e-020f-91d1-672e-15176bf12cd4@shipmail.org> Organization: VMware Inc. Message-ID: Date: Thu, 27 Feb 2020 14:49:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <78eb099e-020f-91d1-672e-15176bf12cd4@shipmail.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/27/20 2:44 PM, Thomas Hellström (VMware) wrote: > Hi, > > On 2/27/20 2:21 PM, Gerd Hoffmann wrote: >>    Hi, >> >>>> So I'd like to push patches 1+2 to -fixes and sort everything else >>>> later >>>> in -next.  OK? >>> OK with me. >> Done. >> >>>> [ context: why shmem helpers use pgprot_writecombine + >>>> pgprot_decrypted? >>>>             we get conflicting mappings because of that, linear kernel >>>>             map vs. gem object vmap/mmap ] >>> Do we have any idea what drivers are actually using >>> write-combine and decrypted? >> drivers/gpu/drm# find -name Kconfig* -print | xargs grep -l >> DRM_GEM_SHMEM_HELPER >> ./lima/Kconfig >> ./tiny/Kconfig >> ./cirrus/Kconfig >> ./Kconfig >> ./panfrost/Kconfig >> ./udl/Kconfig >> ./v3d/Kconfig >> ./virtio/Kconfig >> >> virtio needs cached. >> cirrus+udl should be ok with cached too. >> >> Not clue about the others (lima, tiny, panfrost, v3d).  Maybe they use >> write-combine just because this is what they got by default from >> drm_gem_mmap_obj().  Maybe they actually need that.  Trying to Cc: >> maintainters (and drop stable@). >> >> On decrypted: I guess that is only relevant for virtual machines, i.e. >> virtio-gpu and cirrus? >> >> virtio-gpu needs it, otherwise the host can't show the virtual display. >> cirrus bounces everything via blits to vram, so it should be ok without >> decrypted.  I guess that implies we should make decrypted configurable. > > Decrypted here is clearly incorrect and violates the SEV spec, > regardless of a config option. > The only correct way is currently to use dma_alloc_coherent() and > mmap_coherent() to allocate decrypted memory and then use the > pgprot_decrypted flag. > > Since the same page is aliased with two physical addresses (one > encrypted and one decrypted) switching memory from one to the other > needs extensive handling even to flush stale vmaps... > > So if virtio-gpu needs it for some bos, it should move away from shmem > for those bos. (But this is of course up to the virtio-gpu and drm maintainers), but IMO, again, pgprot_decrypted() shouldn't be part of generic helpers. /Thomas