public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nelson Chu <nelson.chu@sifive.com>
To: jiawei <jiawei@iscas.ac.cn>
Cc: Binutils <binutils@sourceware.org>,
	"Kito Cheng" <kito.cheng@sifive.com>,
	"Jim Wilson" <jimw@sifive.com>,
	"Philipp Tomsich" <philipp.tomsich@vrull.eu>,
	mjos@pqshield.com, ben.marshall@pqshield.com,
	cmuellner@ventanamicro.com, "Palmer Dabbelt" <palmer@dabbelt.com>,
	"Andrew Waterman" <andrew@sifive.com>,
	"Wei Wu (吴伟)" <lazyparser@gmail.com>,
	siyu@isrc.iscas.ac.cn, "Andreas Schwab" <schwab@linux-m68k.org>,
	"Jan Beulich" <jbeulich@suse.com>
Subject: Re: [PATCH v3 1/3] RISC-V: Minimal support of scalar crypto extension
Date: Wed, 10 Nov 2021 10:38:48 +0800	[thread overview]
Message-ID: <CAJYME4FOB9Mq92kv7VoXqFAPTkYectAGEviV5jsu15ALy369HA@mail.gmail.com> (raw)
In-Reply-To: <20211104055615.629732-2-jiawei@iscas.ac.cn>

On Thu, Nov 4, 2021 at 1:56 PM jiawei <jiawei@iscas.ac.cn> wrote:
>
> Minimal support of scalar crypto extension, add "k" in riscv_supported_std_ext[] to make the   order check right with "zk" behind "zb". "zbk*" is sub-extension for k-ext, so it added behind "zbs" in riscv_supported_std_z_ext[].
> ---
>  bfd/elfxx-riscv.c      | 28 ++++++++++++++++++++++++++++
>  gas/config/tc-riscv.c  | 25 +++++++++++++++++++++++++
>  include/opcode/riscv.h | 11 +++++++++++
>  3 files changed, 64 insertions(+)
>
> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
> index cdb4fa0996a..045b5a68a10 100644
> --- a/bfd/elfxx-riscv.c
> +++ b/bfd/elfxx-riscv.c
> @@ -1075,6 +1075,20 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
>    {"q", "d",           check_implicit_always},
>    {"d", "f",           check_implicit_always},
>    {"f", "zicsr",       check_implicit_always},
> +  {"zk", "zkn",        check_implicit_always},
> +  {"zk", "zkr",        check_implicit_always},
> +  {"zk", "zkt",        check_implicit_always},
> +  {"zkn", "zbkb",      check_implicit_always},
> +  {"zkn", "zbkc",      check_implicit_always},
> +  {"zkn", "zbkx",      check_implicit_always},
> +  {"zkn", "zkne",      check_implicit_always},
> +  {"zkn", "zknd",      check_implicit_always},
> +  {"zkn", "zknh",      check_implicit_always},
> +  {"zks", "zbkb",      check_implicit_always},
> +  {"zks", "zbkc",      check_implicit_always},
> +  {"zks", "zbkx",      check_implicit_always},
> +  {"zks", "zksed",     check_implicit_always},
> +  {"zks", "zksh",      check_implicit_always},
>    {NULL, NULL, NULL}
>  };
>
> @@ -1128,6 +1142,7 @@ static struct riscv_supported_ext riscv_supported_std_ext[] =
>    {"c",                ISA_SPEC_CLASS_2P2,             2, 0, 0 },
>    {"b",                ISA_SPEC_CLASS_NONE, RISCV_UNKNOWN_VERSION, RISCV_UNKNOWN_VERSION, 0 },
>    {"j",                ISA_SPEC_CLASS_NONE, RISCV_UNKNOWN_VERSION, RISCV_UNKNOWN_VERSION, 0 },
> +  {"k",                ISA_SPEC_CLASS_NONE, RISCV_UNKNOWN_VERSION, RISCV_UNKNOWN_VERSION, 0 },
>    {"t",                ISA_SPEC_CLASS_NONE, RISCV_UNKNOWN_VERSION, RISCV_UNKNOWN_VERSION, 0 },
>    {"p",                ISA_SPEC_CLASS_NONE, RISCV_UNKNOWN_VERSION, RISCV_UNKNOWN_VERSION, 0 },
>    {"v",                ISA_SPEC_CLASS_NONE, RISCV_UNKNOWN_VERSION, RISCV_UNKNOWN_VERSION, 0 },

After checking the table 27.1 (Standard ISA extension names...) in the
riscv ISA spec, I think the k extension should be placed after b, and
before j extension.

> @@ -1146,6 +1161,19 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
>    {"zba",              ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
>    {"zbc",              ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
>    {"zbs",               ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zbkb",             ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zbkc",             ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zbkx",             ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zk",               ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zkn",              ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zknd",             ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zkne",             ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zknh",             ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zkr",              ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zks",              ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zksed",    ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zksh",             ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
> +  {"zkt",              ISA_SPEC_CLASS_DRAFT,           1, 0,  0 },
>    {NULL, 0, 0, 0, 0}
>  };
>
> diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
> index eb626f8e1d5..5e7009b5696 100644
> --- a/gas/config/tc-riscv.c
> +++ b/gas/config/tc-riscv.c
> @@ -301,6 +301,31 @@ riscv_multi_subset_supports (enum riscv_insn_class insn_class)
>        return riscv_subset_supports ("zbc");
>      case INSN_CLASS_ZBS:
>        return riscv_subset_supports ("zbs");
> +    case INSN_CLASS_ZBKB:
> +      return riscv_subset_supports ("zbkb");
> +    case INSN_CLASS_ZBKC:
> +      return riscv_subset_supports ("zbkc");
> +    case INSN_CLASS_ZBKX:
> +      return riscv_subset_supports ("zbkx");
> +    case INSN_CLASS_ZBB_OR_ZBKB:
> +      return (riscv_subset_supports ("zbb")
> +        || riscv_subset_supports ("zbkb"));
> +    case INSN_CLASS_ZBC_OR_ZBKC:
> +      return (riscv_subset_supports ("zbc")
> +        || riscv_subset_supports ("zbkc"));
> +    case INSN_CLASS_ZKND:
> +      return riscv_subset_supports ("zknd");
> +    case INSN_CLASS_ZKNE:
> +      return riscv_subset_supports ("zkne");
> +    case INSN_CLASS_ZKNH:
> +      return riscv_subset_supports ("zknh");
> +    case INSN_CLASS_ZKND_OR_ZKNE:
> +      return (riscv_subset_supports ("zknd")
> +        || riscv_subset_supports ("zkne"));
> +    case INSN_CLASS_ZKSED:
> +      return riscv_subset_supports ("zksed");
> +    case INSN_CLASS_ZKSH:
> +      return riscv_subset_supports ("zksh");
>      default:
>        as_fatal ("internal: unreachable");
>        return false;
> diff --git a/include/opcode/riscv.h b/include/opcode/riscv.h
> index afcd41ff1dd..f61004bdf95 100644
> --- a/include/opcode/riscv.h
> +++ b/include/opcode/riscv.h
> @@ -320,6 +320,17 @@ enum riscv_insn_class
>    INSN_CLASS_ZBB,
>    INSN_CLASS_ZBC,
>    INSN_CLASS_ZBS,
> +  INSN_CLASS_ZBKB,
> +  INSN_CLASS_ZBKC,
> +  INSN_CLASS_ZBKX,
> +  INSN_CLASS_ZKND,
> +  INSN_CLASS_ZKNE,
> +  INSN_CLASS_ZKNH,
> +  INSN_CLASS_ZKSED,
> +  INSN_CLASS_ZKSH,
> +  INSN_CLASS_ZBB_OR_ZBKB,
> +  INSN_CLASS_ZBC_OR_ZBKC,
> +  INSN_CLASS_ZKND_OR_ZKNE,
>  };
>
>  /* This structure holds information for a particular instruction.  */
> --

Likewise, the INSN_CLASS* classes can be moved to the later patches,
so this patch can focus on the architecture string parser support.
Except for the above comments, this patch looks good to me.

Thanks
Nelson

  reply	other threads:[~2021-11-10  2:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04  5:56 [PATCH v3 0/3] RISC-V: Support Scalar Cryptography extension jiawei
2021-11-04  5:56 ` [PATCH v3 1/3] RISC-V: Minimal support of scalar crypto extension jiawei
2021-11-10  2:38   ` Nelson Chu [this message]
2021-11-04  5:56 ` [PATCH v3 2/3] RISC-V: Scalar crypto instructions and operand set jiawei
2021-11-10  9:26   ` Nelson Chu
2021-11-11  3:30     ` 陈嘉炜
2021-11-04  5:56 ` [PATCH v3 3/3] RISC-V: Scalar crypto instruction and Entropy Source CSR testcases jiawei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJYME4FOB9Mq92kv7VoXqFAPTkYectAGEviV5jsu15ALy369HA@mail.gmail.com \
    --to=nelson.chu@sifive.com \
    --cc=andrew@sifive.com \
    --cc=ben.marshall@pqshield.com \
    --cc=binutils@sourceware.org \
    --cc=cmuellner@ventanamicro.com \
    --cc=jbeulich@suse.com \
    --cc=jiawei@iscas.ac.cn \
    --cc=jimw@sifive.com \
    --cc=kito.cheng@sifive.com \
    --cc=lazyparser@gmail.com \
    --cc=mjos@pqshield.com \
    --cc=palmer@dabbelt.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=schwab@linux-m68k.org \
    --cc=siyu@isrc.iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).