blob: c89e630d4d400872687019554acc5c3eb587173d [file] [log] [blame]
johpow0150ccb552020-11-10 19:22:13 -06001/*
Jayanth Dodderi Chidanand95d5d272023-01-16 17:58:47 +00002 * Copyright (c) 2021-2023, Arm Limited. All rights reserved.
johpow0150ccb552020-11-10 19:22:13 -06003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Olivier Deprez19202382022-08-17 14:18:51 +02007#ifndef SME_H
8#define SME_H
johpow0150ccb552020-11-10 19:22:13 -06009
Jayanth Dodderi Chidanandb3ffd3c2023-02-13 12:15:11 +000010#define MAX_VL (512)
11#define MAX_VL_B (MAX_VL / 8)
12#define SME_SMCR_LEN_MAX U(0x1FF)
johpow0150ccb552020-11-10 19:22:13 -060013
Jayanth Dodderi Chidanandb3ffd3c2023-02-13 12:15:11 +000014typedef enum {
15 SMSTART, /* enters streaming sve mode and enables SME ZA array */
16 SMSTART_SM, /* enters streaming sve mode only */
17 SMSTART_ZA, /* enables SME ZA array storage only */
18} smestart_instruction_type_t;
johpow0150ccb552020-11-10 19:22:13 -060019
Jayanth Dodderi Chidanandb3ffd3c2023-02-13 12:15:11 +000020typedef enum {
21 SMSTOP, /* exits streaming sve mode, & disables SME ZA array */
22 SMSTOP_SM, /* exits streaming sve mode only */
23 SMSTOP_ZA, /* disables SME ZA array storage only */
24} smestop_instruction_type_t;
25
26/* SME feature related prototypes. */
27void sme_enable(void);
28void sme_smstart(smestart_instruction_type_t smstart_type);
29void sme_smstop(smestop_instruction_type_t smstop_type);
30
Jayanth Dodderi Chidanand95d5d272023-01-16 17:58:47 +000031/* SME2 feature related prototypes. */
32void sme2_enable(void);
33
Jayanth Dodderi Chidanandb3ffd3c2023-02-13 12:15:11 +000034/* Assembly function prototypes. */
johpow0150ccb552020-11-10 19:22:13 -060035uint64_t sme_rdvl_1(void);
36void sme_try_illegal_instruction(void);
Jayanth Dodderi Chidanandb3ffd3c2023-02-13 12:15:11 +000037void sme_vector_to_ZA(const uint64_t *input_vector);
38void sme_ZA_to_vector(const uint64_t *output_vector);
Jayanth Dodderi Chidanand95d5d272023-01-16 17:58:47 +000039void sme2_load_zt0_instruction(const uint64_t *inputbuf);
40void sme2_store_zt0_instruction(const uint64_t *outputbuf);
johpow0150ccb552020-11-10 19:22:13 -060041
Olivier Deprez19202382022-08-17 14:18:51 +020042#endif /* SME_H */