Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp552315imm; Wed, 1 Aug 2018 01:02:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdLzZ0gJHyYFqv2wQubz7T88ihpe9lRWznsdHQ3BDudDHK3F3O6vSn3U5bCr0o3s5L7qTRG X-Received: by 2002:a63:dd09:: with SMTP id t9-v6mr23824699pgg.370.1533110528102; Wed, 01 Aug 2018 01:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533110528; cv=none; d=google.com; s=arc-20160816; b=aHwFvTO5juxbieAbNINmEzGFaWww3mCw7rvp9gNeskzlzVk1oix3xWZtU1zpxNbHNI KEkxikB9UCc+2wWSOmVbrL35yHYvSmApqliY+Sv8Ax/LLJrV53zznob0ZPFYVZ3J4K6m aINBFATBwS5lXfbjWKI+mBRR5Qg4dRRG8cjNbyTZYjB71PFdJFCn6LT++1qM8b8NsGqR Zm2JqvDNplZdcWmxz4QLjqoz17THnX255ZFBSgmf6qIakREfdHWf3DJUeCeez0zTbWzO 1fOe9ihrLbyScNAlPkeDFVI1RKaPX7K7T68BcK8A2Yx4Hm4DhxkRqMz3P81FNnPxvU4e x2VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=4lNt0s5QqmaPUumDTmDh9tuGftffvBV/eRp5isuKW8Y=; b=gxCW0Bv2TBdDle1DNHbnORIbDNrWZQSGwLjDlvZYRDOP6DjvVl/QFwgaIl46SWCIRr H9HRsmjLb4s2Wc+ssFY6ICVwP6XBJ9ePIbPXkXV1OWNTzonbeakHDlkCFboJ2L5SUK5b HsMhR16C25iyN9W+qm0vzg7XCfYhjpCwn11Q3SVEVZY73KKQLUw0uALQ/DmIfdjXDYUw 9xt6zffi/+oYrbAoB4Jw8hcYcQoRIjsyaUfklRH+gk9e3G8VXUy9GJWSQYSrxYtvPV14 HupcrKwEftUo4b2B0q1ueJaUve7GKstfApY5Olhi/OljlazxDvBsUPvZLBFsYtRI/OVt nf0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MqqpJpBU; 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 75-v6si15984254pgh.110.2018.08.01.01.01.54; Wed, 01 Aug 2018 01:02:08 -0700 (PDT) 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=MqqpJpBU; 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 S2388375AbeHAJpB (ORCPT + 99 others); Wed, 1 Aug 2018 05:45:01 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:42514 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387647AbeHAJpA (ORCPT ); Wed, 1 Aug 2018 05:45:00 -0400 Received: by mail-pg1-f196.google.com with SMTP id y4-v6so10409315pgp.9 for ; Wed, 01 Aug 2018 01:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4lNt0s5QqmaPUumDTmDh9tuGftffvBV/eRp5isuKW8Y=; b=MqqpJpBUvFp2lEvNJTwx9ZZ7YAwCgM8bOhVaSNxP2WpsLkQiPuslusADBhd+NT8pJh wY6LGOwsYr4Fmy4T8WtfjNNeb3rm4Z1Da/6snVjEoqCIyXPFkGz7syVHEB/P4EyEbfxX H40shOwKe4+WeIkwl0OBU1Mpl96yg9YBBBp58= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4lNt0s5QqmaPUumDTmDh9tuGftffvBV/eRp5isuKW8Y=; b=n1KxbU5+TN3C8p1sChiw/CVCtdHM9U78RvO3h/HReEIjJcvMCWdGJk/ztHOcP2Wcnd Ci6o3YQ+Z0kDYitmgimDhuDoBTGWljMdcSnxZ4NO6UaYBqxDAPkG6GXxkSWbNAHwkZYv FMa7WODrGF2bHq3LqhAvq5h98LkSFtltZ6i5UJ2XmjpJHMHaPIdla17wGVoywRRYUJ7H xk9OQumt0aFxV3HX+lZ07I82GWulUxK9jxdEMi/sT1zO6psduMSFrwiDM/AOB4grevhl 6lav2OcsSp4cJHa6rPMFAz2pqgnHl10xCXg6QWLsew9375zYtHDk6KX9pddRU9U9LY10 cXKQ== X-Gm-Message-State: AOUpUlHAPcNC9gnPbSyF1B+DZLWBgXce1NePgxOMICSkJTPCNkPiRGVC ZQ0Q26298CC011RHtgvItGa2Pg== X-Received: by 2002:a62:f610:: with SMTP id x16-v6mr25875846pfh.169.1533110434107; Wed, 01 Aug 2018 01:00:34 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id v8-v6sm9357075pff.120.2018.08.01.01.00.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 01:00:33 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, dyoung@redhat.com, bhe@redhat.com, arnd@arndb.de, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Cc: prudo@linux.ibm.com, ard.biesheuvel@linaro.org, james.morse@arm.com, bhsharma@redhat.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro Subject: [PATCH v13 08/16] arm64: cpufeature: add MMFR0 helper functions Date: Wed, 1 Aug 2018 16:58:12 +0900 Message-Id: <20180801075820.3753-9-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801075820.3753-1-takahiro.akashi@linaro.org> References: <20180801075820.3753-1-takahiro.akashi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Those helper functions for MMFR0 register will be used later by kexec_file loader. Signed-off-by: AKASHI Takahiro Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: James Morse --- arch/arm64/include/asm/cpufeature.h | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index 1717ba1db35d..cd90b5252d6d 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -486,11 +486,59 @@ static inline bool system_supports_32bit_el0(void) return cpus_have_const_cap(ARM64_HAS_32BIT_EL0); } +static inline bool system_supports_4kb_granule(void) +{ + u64 mmfr0; + u32 val; + + mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); + val = cpuid_feature_extract_unsigned_field(mmfr0, + ID_AA64MMFR0_TGRAN4_SHIFT); + + return val == ID_AA64MMFR0_TGRAN4_SUPPORTED; +} + +static inline bool system_supports_64kb_granule(void) +{ + u64 mmfr0; + u32 val; + + mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); + val = cpuid_feature_extract_unsigned_field(mmfr0, + ID_AA64MMFR0_TGRAN64_SHIFT); + + return val == ID_AA64MMFR0_TGRAN64_SUPPORTED; +} + +static inline bool system_supports_16kb_granule(void) +{ + u64 mmfr0; + u32 val; + + mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); + val = cpuid_feature_extract_unsigned_field(mmfr0, + ID_AA64MMFR0_TGRAN16_SHIFT); + + return val == ID_AA64MMFR0_TGRAN16_SUPPORTED; +} + static inline bool system_supports_mixed_endian_el0(void) { return id_aa64mmfr0_mixed_endian_el0(read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1)); } +static inline bool system_supports_mixed_endian(void) +{ + u64 mmfr0; + u32 val; + + mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); + val = cpuid_feature_extract_unsigned_field(mmfr0, + ID_AA64MMFR0_BIGENDEL_SHIFT); + + return val == 0x1; +} + static inline bool system_supports_fpsimd(void) { return !cpus_have_const_cap(ARM64_HAS_NO_FPSIMD); -- 2.18.0