Received: by 10.223.185.116 with SMTP id b49csp4162996wrg; Tue, 6 Mar 2018 10:50:12 -0800 (PST) X-Google-Smtp-Source: AG47ELu2lc5YcMuek2S5RDej6oCJAg9xb0hOupY2F77YoZr92ivjZuKSJ6xpAbD1nMdty5EiGJdw X-Received: by 2002:a17:902:501:: with SMTP id 1-v6mr17583163plf.283.1520362212796; Tue, 06 Mar 2018 10:50:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520362212; cv=none; d=google.com; s=arc-20160816; b=tYo04F0yUm21ESmwvU4nGoN8SVsVhy84IBQRra+TM9mTZp1oNJr15BD6eLTOHGTqFc LhqpIfcIyHJ14YcUIiX7KGrYl2fhlaEcTzeBFuXpByfbkrkHVsGpEBfwJ7K10mzIZRT8 62fgfygPkil9ZZ8JpZemohWBVAjeXuaBOJYy500cVzl1BMAyJQkM8DpYWxoDDraj4EZI sxkxTPJeObhbn7lPj5qquzzp7Y9n/prhX1rph+8FbjoKT4tL8I/eodMRvYwPJ7ZOG/tJ UdKJ7tkVrE1ChYtPf+xr7vqB7duPF7XDwlsl9QarboIuUAF5XPsc40aDMR2e+O3g/EAL 38iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=SmVLPpAr4zJiVx5ok9OP05K0j/+zQYXuw088+uFvJGw=; b=GCeTNehQ7WII3+7Qgxi4e0BVp83iKI0Fas/w2YVJ3C3So90yaYJkzN7nYXEpc5Ul8C 8fF76i54GSDnhBUaw5KLKrIc9MpwF96Mr8Ai/fvqquu7r1TRkXQSIur92KYIVAt5R7jB E/4Ur5VKkUidt9w5u5nFNr/bMxOhqDLQTZYVZBcU6XNQzgGnKPzgls7YTyN3dEsjFFll c3mw/5Jhb0Za748hcJVrJMpectgjQQmh1QmJ5bxDESd2MWOsvExunaxBp5IPIMkDBgzP VGeakG2olIQbrb46p6RmFKJ1Z7otaVff5b8deuraCEFYJJqaunmw2v16Z1/QLtedYCty UnFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=DHJZH5Qs; dkim=pass header.i=@codeaurora.org header.s=default header.b=bMM93bVr; 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 f26si10162033pgn.650.2018.03.06.10.49.57; Tue, 06 Mar 2018 10:50: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=pass header.i=@codeaurora.org header.s=default header.b=DHJZH5Qs; dkim=pass header.i=@codeaurora.org header.s=default header.b=bMM93bVr; 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 S1753942AbeCFSs4 (ORCPT + 99 others); Tue, 6 Mar 2018 13:48:56 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:32810 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753902AbeCFSsy (ORCPT ); Tue, 6 Mar 2018 13:48:54 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B63576053D; Tue, 6 Mar 2018 18:48:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520362133; bh=+2O/Kh/5YWkPRg3Ky4F1eTPfyk/+Bh1iXpIeV9EJRWI=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=DHJZH5Qs9jTjAtU9ys+8b7RdyYUjZhnoZKAGFYwLLaDUOqQQBp8qoBtHI0K74sNuY lum1P9K0iDcII3QLMOuLWTAGzJOX6imXxGtu3+orUBkWnyjuYrCCLiKO9Xb0+sLSN0 VYVTeTUvU6UbTes2+mzBCvM8sVQEMcvuFMx6GGsg= 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.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.0.2.15] (unknown [70.123.43.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: shankerd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id AFABD601CF; Tue, 6 Mar 2018 18:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520362132; bh=+2O/Kh/5YWkPRg3Ky4F1eTPfyk/+Bh1iXpIeV9EJRWI=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=bMM93bVrJJ8hW79SmxWFseehmKxu2+8AKBVvZ4pRcX0o3k0ll8pKqkVROk02iFPDQ QZMmqZ2rpPxHhWDXqZmSS/TPROXavKCy8VMFMVthvKa+WNPRP2uswa8E9O2OTmtZz5 5aYkznbPcZLxQgXMebIrdfc9cC4F2PltO3tYHhzI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AFABD601CF 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=shankerd@codeaurora.org Reply-To: shankerd@codeaurora.org Subject: Re: [PATCH v6] arm64: Add support for new control bits CTR_EL0.DIC and CTR_EL0.IDC To: Will Deacon Cc: Mark Rutland , Philip Elcan , Vikram Sethi , Marc Zyngier , Catalin Marinas , linux-kernel , Robin Murphy , kvmarm , linux-arm-kernel References: <1519877640-11944-1-git-send-email-shankerd@codeaurora.org> <20180306134405.GB18080@arm.com> <20180306152318.GE17454@arm.com> From: Shanker Donthineni Message-ID: Date: Tue, 6 Mar 2018 12:48:49 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180306152318.GE17454@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Will, On 03/06/2018 09:23 AM, Will Deacon wrote: > Hi Shanker, > > On Tue, Mar 06, 2018 at 08:47:27AM -0600, Shanker Donthineni wrote: >> On 03/06/2018 07:44 AM, Will Deacon wrote: >>> I think this is a slight asymmetry with the code for the I-side. On the >>> I-side, you hook into invalidate_icache_by_line, whereas on the D-side you >>> hook into the callers of dcache_by_line_op. Why is that? >>> >> >> There is no particular reason other than complexity of the macro with another >> alternative. I tried to avoid this change by updating __clean_dcache_area_pou(). >> I can change if you're interested to see both I-Side and D-Side changes are >> symmetric some thing like this... >> >> .macro dcache_by_line_op op, domain, kaddr, size, tmp1, tmp2 >> >> .if (\op == cvau) >> alternative_if ARM64_HAS_CACHE_IDC >> dsb ishst >> b 9997f >> alternative_else_nop_endif >> .endif >> >> dcache_line_size \tmp1, \tmp2 >> add \size, \kaddr, \size >> sub \tmp2, \tmp1, #1 >> bic \kaddr, \kaddr, \tmp2 >> 9998: >> .if (\op == cvau || \op == cvac) >> alternative_if_not ARM64_WORKAROUND_CLEAN_CACHE >> dc \op, \kaddr >> alternative_else >> dc civac, \kaddr >> alternative_endif >> .elseif (\op == cvap) >> alternative_if ARM64_HAS_DCPOP >> sys 3, c7, c12, 1, \kaddr // dc cvap >> alternative_else >> dc cvac, \kaddr >> alternative_endif >> .else >> dc \op, \kaddr >> .endif >> add \kaddr, \kaddr, \tmp1 >> cmp \kaddr, \size >> b.lo 9998b >> dsb \domain >> 9997: >> .endm > > I think it would be cleaner the other way round, actually -- move the check > out of invalidate_icache_by_line and into its two callers. > Sure, I'll send out the next patch with your suggestions. >>> I notice that the only user other than >>> flush_icache_range/__flush_cache_user_range or invalidate_icache_by_line >>> is in KVM, via invalidate_icache_range. If you want to hook in there, why >>> aren't you also patching __flush_icache_all? If so, I'd rather have the >>> I-side code consistent with the D-side code and do this in the handful of >>> callers. We might even be able to elide a branch or two that way. >>> >> >> Agree with you, it saves function calls overhead. I'll do this change... >> >> static void invalidate_icache_guest_page(kvm_pfn_t pfn, unsigned long size) >> { >> if (cpus_have_const_cap(ARM64_HAS_CACHE_DIC) >> __invalidate_icache_guest_page(pfn, size); >> } >> >> >>> I'm going to assume that I-cache aliases are all coherent if DIC=1, so it's >>> safe to elide our alias sync code. >>> >> >> I'm not sure about I-cache whether aliases are all coherent if DIC=1 ot not. >> Unfortunately I don't have any hardware to test DIC=1. I've verified IDC=1. > > I checked with our architects and aliases don't pose a problem here, so you > can ignore me :) > I also confirmed with Thomas Speier, we can skip __flush_icache_all() if DIC=1. > Will > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > -- Shanker Donthineni Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.