Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2317167pxb; Fri, 5 Feb 2021 14:55:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMKAykoVSAPg/dJWAaIQj8AMhcZxmg42UuIAtc1Hnpwv8/a6CpdtkyGXWtT2ZWSJT2iYlI X-Received: by 2002:aa7:ccd3:: with SMTP id y19mr5792292edt.145.1612565747209; Fri, 05 Feb 2021 14:55:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612565747; cv=none; d=google.com; s=arc-20160816; b=URc/cK4HGQag7V20MiihiSDOlzXtVZDJcFZ1wFsq1hRfmOxVETu3acz0XhjnXrEx00 XdCnV2IdG1kdYqOzrfpGjBBpo9ocEPDErFPqNyNOoTE7ivAsgYGUweHtVUblRTSXkc56 U6nN5mBRAeXib/qPPJ5VMxm+lKjjCIUx7x1OUbjnij0cwkr8ljqubaB1q0S82vbX9VzA DEHMJC88ud9zdT3YEJFLm9pRq8+/dju3ZMd3IvGCrzFEuBweD7cTnLG4/HlHtGvbUOQQ f7qJi/4DAlJCGY+K0o5NaUHy6/MaHZEvsFFQLPKcCwSsrdk4XrOEUo50INjLzSpRmkZ3 hrRg== 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=VarGPp1pgyR5HOZdLdaV5+/hctAsRcm45mjeVXyeSEk=; b=quUKecDjDUG17mfNMnOK1C7t1+fUtYtaXfrBwnKUfKlGrqpZzCEcmST0PsQTSVfJ5t zE4aNYwqfTzJEzzwih8y2lXw+u3sLl3k1vRAOSX+9M8UU2ynXbxg8fa51J9/5MFws7Eh dh92tNLtErgUrBiE6joseYXoRAYazb5ZeBRQ1nUoUCekHseqAkzXsUXd1plYHwDwrTal Vp86MCaOSLcy4KTkWUubgjGseF7IsdHbdOKtxhSGPwx9tJmPtVKt0W21vzJj5BcI2p8F qvNkm7YTiwUP8WfIqqwStc2hfjbn8HwPMDhg+2guV5HWJ2IKOeGfA7CSs2uy+MNnb2ED N6XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Jzl5Z04I; 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 i6si2838903ejb.565.2021.02.05.14.55.21; Fri, 05 Feb 2021 14:55:47 -0800 (PST) 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=Jzl5Z04I; 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 S229609AbhBEWyY (ORCPT + 99 others); Fri, 5 Feb 2021 17:54:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:43230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232727AbhBEOld (ORCPT ); Fri, 5 Feb 2021 09:41:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C3C4D64FCF; Fri, 5 Feb 2021 14:09:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612534157; bh=cra8A94u+hPofX3vU1u/3WtQJERS54ohnojJXvInYnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jzl5Z04IjxnZJC1r6FTWzeHL10thSZal9vIZk4oroUgNGU2WcN2cFibJU7vXVk37S G47hL1y7UMev5OriIExKXwxz7tWQRvTHKTUOB3Fbt5mFH2Lkle2z84mejLl6tuxTO4 2N6MDU5FCOwY84IC0FompTjgwQuLtnzfSZ4n6pyA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Murphy , Neil Armstrong , Steven Price , Will Deacon Subject: [PATCH 5.10 10/57] iommu/io-pgtable-arm: Support coherency for Mali LPAE Date: Fri, 5 Feb 2021 15:06:36 +0100 Message-Id: <20210205140656.420373829@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210205140655.982616732@linuxfoundation.org> References: <20210205140655.982616732@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: Robin Murphy commit 728da60da7c1ec1e21ae64648e376666de3c279c upstream. Midgard GPUs have ACE-Lite master interfaces which allows systems to integrate them in an I/O-coherent manner. It seems that from the GPU's viewpoint, the rest of the system is its outer shareable domain, and so even when snoop signals are wired up, they are only emitted for outer shareable accesses. As such, setting the TTBR_SHARE_OUTER bit does indeed get coherent pagetable walks working nicely for the coherent T620 in the Arm Juno SoC. Signed-off-by: Robin Murphy Tested-by: Neil Armstrong Reviewed-by: Steven Price Acked-by: Will Deacon Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/8df778355378127ea7eccc9521d6427e3e48d4f2.1600780574.git.robin.murphy@arm.com Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/io-pgtable-arm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -417,7 +417,13 @@ static arm_lpae_iopte arm_lpae_prot_to_p << ARM_LPAE_PTE_ATTRINDX_SHIFT); } - if (prot & IOMMU_CACHE) + /* + * Also Mali has its own notions of shareability wherein its Inner + * domain covers the cores within the GPU, and its Outer domain is + * "outside the GPU" (i.e. either the Inner or System domain in CPU + * terms, depending on coherency). + */ + if (prot & IOMMU_CACHE && data->iop.fmt != ARM_MALI_LPAE) pte |= ARM_LPAE_PTE_SH_IS; else pte |= ARM_LPAE_PTE_SH_OS; @@ -1021,6 +1027,9 @@ arm_mali_lpae_alloc_pgtable(struct io_pg cfg->arm_mali_lpae_cfg.transtab = virt_to_phys(data->pgd) | ARM_MALI_LPAE_TTBR_READ_INNER | ARM_MALI_LPAE_TTBR_ADRMODE_TABLE; + if (cfg->coherent_walk) + cfg->arm_mali_lpae_cfg.transtab |= ARM_MALI_LPAE_TTBR_SHARE_OUTER; + return &data->iop; out_free_data: