Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6238502imu; Mon, 21 Jan 2019 05:37:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN6aixc7ZyWmJJqRa5s7IFRieq9GjHZj6wx89Iy9kJbGVGyJsnnQI7U1bgLUdw53HSF/fgUJ X-Received: by 2002:a63:6ecf:: with SMTP id j198mr28697597pgc.3.1548077878006; Mon, 21 Jan 2019 05:37:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548077877; cv=none; d=google.com; s=arc-20160816; b=Ah/AcgatSzd4wlxaw8cjLGP6SZ3MsjoLsoyoD+GAjadH4JcUSkxH4AhhOGL4Ff2xZv 1KgX+mR7SC1gPr1yZqbk3YPbRyjTFPy3DVgMsHaqovEbMyj7o90A2LBkdWBh+CqOCMdZ 7CA959cP4q9tVNEdNaNo/5DY63eGJJjAQHF1PygB8GkCUg+JDlOw+DTBuWTKQxtIpS/N CrLSZrNS1WcGoUqYidM9niOljkN2H/Zl75tTcq56zh9HFrlufQEHqUn3jlw/VoYRBHmf BH+D6htuBqxwpmZV556Ep7QEATBLtG0CP/uHY8U+jJ80bGXyeTEts7Xy2am/SWExhEVz F/gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ouVfrYoE4tBo/aI/S/8fegEEIgNFev38fWx5MQf/VJM=; b=gezZKUOXvh58Jmkts5xtksni0D1qgPjboxYvyfTUmMQBeoKY4+hmHzid1iADLttc5v l4KUiN2dJor7xjqSeSzXBdvysYM6/QkGGOWNzhZ93nPOCp0DbQEcxcJQt/ns4ccZXccQ WgwEhjow5zFF9b0e91x7F3YjJkUbn6nGHIh3J4OnVWz2QPn4hw31s+lDSNIyEQ93fA+K C5TKJVJkCgUtl93NuselwPFpE3Z5mlOnbfRHc5n1zECb52ldFFEvB3+BBaUeSdifcS0E qYe4LF7UC1nyHGMtXB74QAKdlhZAStviJ7pMHrhwY8/PkpxhFqculXKOPdIJ9C5XfwWM mEww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ArwJ8Lr5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p10si9944876pgi.549.2019.01.21.05.37.31; Mon, 21 Jan 2019 05:37:57 -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=pass header.i=@linaro.org header.s=google header.b=ArwJ8Lr5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728966AbfAUNgU (ORCPT + 99 others); Mon, 21 Jan 2019 08:36:20 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:53088 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728693AbfAUNgU (ORCPT ); Mon, 21 Jan 2019 08:36:20 -0500 Received: by mail-it1-f195.google.com with SMTP id g76so16389123itg.2 for ; Mon, 21 Jan 2019 05:36:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ouVfrYoE4tBo/aI/S/8fegEEIgNFev38fWx5MQf/VJM=; b=ArwJ8Lr5+Hg4clYMFji1qY6Vo2rofrnjVP0RHCXnIPk+vN/lZ1h84Xu3WmeVnunuTg bQpqIwVqgYFTWo4Yb1ZWpKYyN2Ifm4/cFTkOcm5qT4aL30RDYLeLAqp6+7sB9ucFvD2q XpZFUGGZ2BVDn8RjrRtpA4VoRdh3P1L/TQVC4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ouVfrYoE4tBo/aI/S/8fegEEIgNFev38fWx5MQf/VJM=; b=QSyvDbOBzo9MhJClAuIxgECG/lwC84S/EOg8jGy2CbKSsQA5XnS+kWMUi/9k4sOhZk ql9mVtQDvOphdi1EOfi9az7VltLEOWgHiixHo0/Cqw+Au1HtZU1Jmzj6amaNGAZkMLGE PM2gCgiRry1LSUJ9o4DDRT0fWcXKWpwI520+Biijc+HCSfi0L4wAeNdKmAaF4iHgDRcm smbV8SWYOgtMjaUv9j51kDS3FgWYwZLJW+ocUi+XniEabSZuhNJDnfP2OGTDR8N/OpOj zLgHo23jpAQCjD+S7msZCo3Phbgv2viVA1KdfNgl/j7jgyjtiCsklA8gZLQcRZiKI+cu 4t1g== X-Gm-Message-State: AJcUukePbBgeNx+KNfa5LhtBmvT7WIIzhWtJIhF1uZlGOpwlfZXSWkhP wnDGD7NRuJ3fMHXKggyCzPu+XikWpnD963G6RxrHAA== X-Received: by 2002:a05:660c:4b:: with SMTP id p11mr17398985itk.71.1548077778941; Mon, 21 Jan 2019 05:36:18 -0800 (PST) MIME-Version: 1.0 References: <20190121055335.15430-1-vivek.gautam@codeaurora.org> In-Reply-To: From: Ard Biesheuvel Date: Mon, 21 Jan 2019 14:36:07 +0100 Message-ID: Subject: Re: [PATCH 0/3] iommu/arm-smmu: Add support to use Last level cache To: Robin Murphy Cc: Vivek Gautam , Will Deacon , Joerg Roedel , "list@263.net:IOMMU DRIVERS" , pdaly@codeaurora.org, linux-arm-msm , Linux Kernel Mailing List , Tomasz Figa , Jordan Crouse , pratikp@codeaurora.org, linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 21 Jan 2019 at 14:25, Robin Murphy wrote: > > On 21/01/2019 10:50, Ard Biesheuvel wrote: > > On Mon, 21 Jan 2019 at 11:17, Vivek Gautam wrote: > >> > >> Hi, > >> > >> > >> On Mon, Jan 21, 2019 at 12:56 PM Ard Biesheuvel > >> wrote: > >>> > >>> On Mon, 21 Jan 2019 at 06:54, Vivek Gautam wrote: > >>>> > >>>> Qualcomm SoCs have an additional level of cache called as > >>>> System cache, aka. Last level cache (LLC). This cache sits right > >>>> before the DDR, and is tightly coupled with the memory controller. > >>>> The clients using this cache request their slices from this > >>>> system cache, make it active, and can then start using it. > >>>> For these clients with smmu, to start using the system cache for > >>>> buffers and, related page tables [1], memory attributes need to be > >>>> set accordingly. This series add the required support. > >>>> > >>> > >>> Does this actually improve performance on reads from a device? The > >>> non-cache coherent DMA routines perform an unconditional D-cache > >>> invalidate by VA to the PoC before reading from the buffers filled by > >>> the device, and I would expect the PoC to be defined as lying beyond > >>> the LLC to still guarantee the architected behavior. > >> > >> We have seen performance improvements when running Manhattan > >> GFXBench benchmarks. > >> > > > > Ah ok, that makes sense, since in that case, the data flow is mostly > > to the device, not from the device. > > > >> As for the PoC, from my knowledge on sdm845 the system cache, aka > >> Last level cache (LLC) lies beyond the point of coherency. > >> Non-cache coherent buffers will not be cached to system cache also, and > >> no additional software cache maintenance ops are required for system cache. > >> Pratik can add more if I am missing something. > >> > >> To take care of the memory attributes from DMA APIs side, we can add a > >> DMA_ATTR definition to take care of any dma non-coherent APIs calls. > >> > > > > So does the device use the correct inner non-cacheable, outer > > writeback cacheable attributes if the SMMU is in pass-through? > > > > We have been looking into another use case where the fact that the > > SMMU overrides memory attributes is causing issues (WC mappings used > > by the radeon and amdgpu driver). So if the SMMU would honour the > > existing attributes, would you still need the SMMU changes? > > Even if we could force a stage 2 mapping with the weakest pagetable > attributes (such that combining would work), there would still need to > be a way to set the TCR attributes appropriately if this behaviour is > wanted for the SMMU's own table walks as well. > Isn't that just a matter of implementing support for SMMUs that lack the 'dma-coherent' attribute?