Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4504507imu; Tue, 29 Jan 2019 02:45:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN5neuLJDkUAglWkvm12jMlVAHmg9E6FGU1TzD3STdWHWTmQmCZHwMmgrwihCmF6QIoeD8nk X-Received: by 2002:a65:47ca:: with SMTP id f10mr16974955pgs.166.1548758704808; Tue, 29 Jan 2019 02:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548758704; cv=none; d=google.com; s=arc-20160816; b=W6DbpiregtxqxwXWVMK3ywv4DUq7tbLudSI09rYPePrcle2zO/EkfD9E/HSDGdC5no YvgGd6r7CADSlRoL4iirm4xlku/QL3YcGoIGzwsiPGDVe8Wv0Vd59fAW6hTXJfO2bIDu FTUNgwncZsiMdaTu0ZofoITOZgaqrJWtAaLXx9Yl/nW3GQ4wYYxUHkwCdFnv9Z/8EuO0 r3FsXrWBe6dGGPE7lDbwYLh4Zy21x6UrcrV28w5EdUqvfReeLm0l6ph66MqcUr+dCEvq o81HPPOF1K2tya91wTLWiLu5dg2aOSHDn+9e/2GB0ROEN+nP83poITid3rue/lq1q57E Dfgw== 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:dmarc-filter:dkim-signature :dkim-signature; bh=gdRmKTpwNsGTkkE+rQFmhHg2UWSaEG3xHFsxsxWRBJM=; b=QzENZK7YqrtW8+59e67FaZktfTzmbSeqyFHJoZLRfftDNSCaszs5LUjXOuyeD3nJ0f 0iIG9zFq4jDO1OvjIBuTMS+Il9y7LO/M0Ld9MiG9AL9rmDujeRybVTqDrweqVEtCAc9G k6aNTgpFDj+qVeBLw0py8auWznjHrYvdtSRWC2G5dpJI4PD5BUaSexa9vK/kITS4Hl/L n5uiP5hzGatLQwdqQU6aMTD3u8OilEQbXf+LjsYojfKc8NM/lHrop+teLvCTf6Y68SDd Wa9tgK48UDLskgnHC8nqf13nSQkTr6rRC8PagRHuPlEOjNwuoWASSoW6/Bt4LRVSVb2r kFQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="C+nCPt/l"; dkim=pass header.i=@codeaurora.org header.s=default header.b=KXjhPqYb; 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 i9si8890821plb.35.2019.01.29.02.44.48; Tue, 29 Jan 2019 02:45:04 -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=@codeaurora.org header.s=default header.b="C+nCPt/l"; dkim=pass header.i=@codeaurora.org header.s=default header.b=KXjhPqYb; 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 S1727047AbfA2Kn2 (ORCPT + 99 others); Tue, 29 Jan 2019 05:43:28 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:60736 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725764AbfA2Kn2 (ORCPT ); Tue, 29 Jan 2019 05:43:28 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 900B860907; Tue, 29 Jan 2019 10:43:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1548758606; bh=b8SkCNRhjNOfUi0XfdquRN5VpBwkG9P4jLXAjsvZQdQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=C+nCPt/lF+oxnenPcKCFA5OZAp4MhujiewCbiXiq45IAmoveM+T2Qfj6DJXywNIyc ks6DYG4wSrgRiADLjRbIZRElnLeN5jXRlSLLzjvYsnG4GLazNPRCvegzzSWx7tJA5c KlJXxU4lDUJuKl2WUyaxGsr+Mc0Z4H5JUyfUIv7E= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 79D3660850; Tue, 29 Jan 2019 10:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1548758605; bh=b8SkCNRhjNOfUi0XfdquRN5VpBwkG9P4jLXAjsvZQdQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KXjhPqYbcmmPih5E5qJpApgRkwMj/jHrkpaTUTqTgQsXD8mMWLDAMeZ5Li1WWXG2V NFebdVUSMVeSKcQglGyAOYpR3gkOI46YRGJHfGTP8KKjuxi9CVeeno15UA1SexdY98 g6lkef0tX/E/IkoSxbNvuHg94hKSPziV/QKzE4hQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 79D3660850 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org Received: by mail-ed1-f52.google.com with SMTP id g22so15559493edr.7; Tue, 29 Jan 2019 02:43:25 -0800 (PST) X-Gm-Message-State: AJcUukejNepEdKu004RJuZPxoArxNPpphMyx8HkL3G5zt+oOjthpWwx+ B9AJ1U7fpFU+LrBlsCerzOQ0BZa/WLhuQjNWKFs= X-Received: by 2002:a17:906:452:: with SMTP id e18mr11493850eja.142.1548758604052; Tue, 29 Jan 2019 02:43:24 -0800 (PST) MIME-Version: 1.0 References: <20190117092718.1396-1-vivek.gautam@codeaurora.org> <20190117092718.1396-3-vivek.gautam@codeaurora.org> <20190120000117.GH26876@brain-police> <20190122054326.GA6445@brain-police> In-Reply-To: <20190122054326.GA6445@brain-police> From: Vivek Gautam Date: Tue, 29 Jan 2019 16:13:12 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] iommu/arm-smmu: Add support for non-coherent page table mappings To: Will Deacon Cc: linux-arm-msm , open list , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , Robin Murphy , Linux ARM 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 Hi Will, On Tue, Jan 22, 2019 at 11:14 AM Will Deacon wrote: > > On Mon, Jan 21, 2019 at 11:35:30AM +0530, Vivek Gautam wrote: > > On Sun, Jan 20, 2019 at 5:31 AM Will Deacon wrote: > > > On Thu, Jan 17, 2019 at 02:57:18PM +0530, Vivek Gautam wrote: > > > > Adding a device tree option for arm smmu to enable non-cacheable > > > > memory for page tables. > > > > We already enable a smmu feature for coherent walk based on > > > > whether the smmu device is dma-coherent or not. Have an option > > > > to enable non-cacheable page table memory to force set it for > > > > particular smmu devices. > > > > > > Hmm, I must be missing something here. What is the difference between this > > > new property, and simply omitting dma-coherent on the SMMU? > > > > So, this is what I understood from the email thread for Last level > > cache support - > > Robin pointed to the fact that we may need to add support for setting > > non-cacheable > > mappings in the TCR. > > Currently, we don't do that for SMMUs that omit dma-coherent. > > We rely on the interconnect to handle the configuration set in TCR, > > and let interconnect > > ignore the cacheability if it can't support. > > I think that's a bug. With that fixed, can you get what you want by omitting > "dma-coherent"? Based on the discussion on the first patch in this series [1], I can update the series. First thing can be - if QUIRK_NO_DMA is set (i.e. the IOMMU _is_ coherent) then we use a cacheable TCR; So, we may need an additional check for this when setting the TCR. For the second case - IOMMUs that are *not* coherent, i.e ones that are omitting 'dma-coherent' property, anyways have to access the page table directly from memory. We take care of the CPU side of this by allocating non-coherent memory, and making sure that we sync the PTEs from map call. Shouldn't we mark TCR for these IOMMUs as non-cacheable for inner and outer cacheability attribute? [1] https://lore.kernel.org/patchwork/patch/1032939/ Regards Vivek > > Will -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation