From patchwork Wed Aug 1 07:58:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 143254 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp549559ljj; Wed, 1 Aug 2018 01:00:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcIsOvkE1sJAghT2i1rzewTHjsUlUxOHlUymR3W/CcnhQR8g5I/4AdLKy2pIdNLLHDO+LwV X-Received: by 2002:a17:902:280b:: with SMTP id e11-v6mr23574229plb.298.1533110437791; Wed, 01 Aug 2018 01:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533110437; cv=none; d=google.com; s=arc-20160816; b=XfkXuAqm1FxsEKQhpbMXJdXQpRZRmkpA1s0APO1Ti7G7gy1GiGLNGMZ+nxLAV9HMpj wWcEKyOX/4gFaKnCrq8RRfPSXXiMrjkJVgBr9Vg2hzqX0WwD8vuy9PEQlwiSsxJOpH+V dzNA/NqNv9kkpT+aScLw+a/r3UrK8EWxNiBmrJnLN4ansnWMygtvh/LPb6GZrJqXVVen lUeEdtqfAuy7HHEeI6j78qHZfWe7Y9F6KYZWzkIYyuvj+r7NdiE/jUnX339D46D9kQmI Qb8tu2QGc+dN1sG6Zhaoi3s9FDwNaEo0PxdOlGpaWb8rt0UtpRLmwhNPts5yLnGgzq0Q AvEA== 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 s2-v6si17624531pfs.2.2018.08.01.01.00.37; Wed, 01 Aug 2018 01:00:37 -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 S2388396AbeHAJpB (ORCPT + 31 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(+) -- 2.18.0 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);