From patchwork Thu Nov 15 05:52:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 10683549 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CBC081747 for ; Thu, 15 Nov 2018 05:55:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B76372C140 for ; Thu, 15 Nov 2018 05:55:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAE4E2C15A; Thu, 15 Nov 2018 05:55:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 29FB12C140 for ; Thu, 15 Nov 2018 05:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=90eRkzDBjUxR9v80XKn6ERTLo6vaifKGEa2r3REfrbU=; b=q/USzYkjUOZVp5 ZKY9YdFkaROlIZSin3M34GHGyFGUjljId/yMUvLplt5qBDFN4LgHDh4i8EkEtpoMQhOsZBrcSmun/ EkCR8iTQBK8DsMedbwSYtkx3VOnM1U+BO7HhcaF9loiRdQD6ZHUFh9vJ4nKTRSIXTFm/m9qkqzh16 rVAIYfMqPu3q0e2Lsunu6yImAKW1AKoiwwsiQEfEZWs+CpjCAx/7/MV9YxDxGQzTvEabgTkltguxc hyJXVFl0kLpiVBZM9kSr6yUbPJcgFNSJbH9KsMQNfHaBGE/+Gaye5h7xURoQnXKkhHQqqBzxwRWvv 5uJ8fPx5vR1gcwuC6t3Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNAcg-0000x3-Hz; Thu, 15 Nov 2018 05:55:26 +0000 Received: from mail-yw1-xc43.google.com ([2607:f8b0:4864:20::c43]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNAai-0006CO-D8 for linux-arm-kernel@lists.infradead.org; Thu, 15 Nov 2018 05:53:30 +0000 Received: by mail-yw1-xc43.google.com with SMTP id p18-v6so8222570ywg.12 for ; Wed, 14 Nov 2018 21:53:14 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=o5y8l0NsFtoWbp90IzL9nHnwXBQanitGUE7PDY2nFw0=; b=EtBHn+kvNnc+4EN2r0hbJOtGY9b+zYbzmZmiED+K8NRA7cYk1XfWnhksshiqQhgAEN ix8GpkWl+fDniCZKDfw1vzsSg0b78KRVJcHl2pWwVi1/5LbchSUTp73Er1LUijszQhf5 102zObBAKbKK1ewHXbJJ6C5kj4FiqqC/04haw= 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:mime-version:content-transfer-encoding; bh=o5y8l0NsFtoWbp90IzL9nHnwXBQanitGUE7PDY2nFw0=; b=h/OhR7PFNdD5qZhzFLrPi3i8NeQX9iplgLif2imJru4idH2+HGrrD8VtwkPoGwPYYe wJzW4kwiwm1nVvta3IECHIdNIolPUeQHzKasr1u9N68ONG12LTjt3DWrGDW2L2Sax37b 2SZNIr77OM9ACuRIqzLfIwF6qarIDUv2YCCzkjU16XMneCqufNr3KJ5L7UKw6Y+bNaWL Adw8WitubFePaQc/EMCZSPeH541OEgFuiZGU/yAfNXtKp8NIzPi7s/Bo72oI11ZwS0RJ uGORjaY7YwyhNaFvj/BwAXXFdRZrLEsXM5rQ5OoFUnKJKLgaVG5BR9KNc9HLzdbRpQAy sa2Q== X-Gm-Message-State: AGRZ1gJocZ5/HTf9u8kM6iZ7Jl5kZDV5U8ab58Ucg6ZFtBZ1xI0VpUHC eWsOGooFylAugFOEWNTbX2cgkg== X-Google-Smtp-Source: AJdET5cLVSe3DdE5jgpOWdPQDybq6OD5ogbCr+lRGJR4mlAHIRvUQ84xBa3h/jl5HLpW8gIQeHTEbQ== X-Received: by 2002:a81:5089:: with SMTP id e131mr1242482ywb.392.1542261193064; Wed, 14 Nov 2018 21:53:13 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id 207-v6sm7417310ywo.87.2018.11.14.21.53.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 21:53:12 -0800 (PST) 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 Subject: [PATCH v16 08/16] arm64: cpufeature: add MMFR0 helper functions Date: Thu, 15 Nov 2018 14:52:47 +0900 Message-Id: <20181115055254.2812-9-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181115055254.2812-1-takahiro.akashi@linaro.org> References: <20181115055254.2812-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181114_215324_475918_F92C8134 X-CRM114-Status: GOOD ( 10.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ard.biesheuvel@linaro.org, bhsharma@redhat.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, prudo@linux.ibm.com, AKASHI Takahiro , james.morse@arm.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 7e2ec64aa414..ef118d819fe8 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);