From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933343AbcIEKYH (ORCPT ); Mon, 5 Sep 2016 06:24:07 -0400 Received: from foss.arm.com ([217.140.101.70]:51826 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932444AbcIEKYG (ORCPT ); Mon, 5 Sep 2016 06:24:06 -0400 Subject: Re: [PATCH v3 9/9] arm64: Work around systems with mismatched cache line sizes To: Ard Biesheuvel References: <1473069509-2317-1-git-send-email-suzuki.poulose@arm.com> <1473069509-2317-10-git-send-email-suzuki.poulose@arm.com> Cc: "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Will Deacon , Catalin Marinas , Marc Zyngier , Mark Rutland , James Morse , Andre Przywara From: Suzuki K Poulose Message-ID: Date: Mon, 5 Sep 2016 11:24:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/09/16 11:10, Ard Biesheuvel wrote: > On 5 September 2016 at 10:58, Suzuki K Poulose wrote: >> +/* >> + * read_ctr - read CTR_EL0. If the system has mismatched >> + * cache line sizes, provide the system wide safe value. >> + */ >> + .macro read_ctr, reg >> +alternative_if_not ARM64_MISMATCHED_CACHE_LINE_SIZE >> + mrs \reg, ctr_el0 // read CTR >> + nop >> + nop >> +alternative_else >> + adr_l \reg, arm64_ftr_reg_ctrel0 // Read system wide safe CTR value >> + ldr \reg, [\reg, #ARM64_FTR_SYSVAL] // from arm64_ftr_reg_ctrel0.sys_val > > You should be able to use > > ldr_l \reg, arm64_ftr_reg_ctrel0 + ARM64_FTR_SYSVAL > > here, and save one instruction. I had given a thought about that and chose the above to account for a rare chance of arm64_ftr_reg_ctrel0 spanning across a 4K boundary. But, you are right, ldr_l could treat (arm64_ftr_reg_ctrel0 + ARM64_FTR_SYSVAL) as the symbol address and still get the right offset. Suzuki