public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: jiawei@iscas.ac.cn
To: "Tsukasa OI" <research_trasio@irq.a4lg.com>
Cc: "Nelson Chu" <nelson.chu@sifive.com>,
	 "Kito Cheng" <kito.cheng@sifive.com>,
	 "Palmer Dabbelt" <palmer@dabbelt.com>,
	binutils@sourceware.org
Subject: Re: [REVIEW ONLY 2/2] NEAR-RATIFICATION RISC-V: Add platform property/capability extensions
Date: Tue, 29 Nov 2022 14:35:30 +0800 (GMT+08:00)	[thread overview]
Message-ID: <47b60bda.af2d.184c2190405.Coremail.jiawei@iscas.ac.cn> (raw)
In-Reply-To: <20220627020348.11920-6-research_trasio@irq.a4lg.com>

&gt; [DO NOT MERGE]
&gt; RISC-V Profiles are frozen but -- from my view -- this document will still
&gt; change in some way.  Meanwhile, this patch should not be merged upstream.
&gt; This commit uses tentative version 1.0 (as there are no versions).
&gt; 
&gt; RISC-V Profiles document defines number of "extensions" that indicate
&gt; certain platform properties/capabilities just like 'Zkt' extension from the
&gt; RISC-V cryptography extensions.
&gt; 
&gt; This commit defines 19 platform property/capability extensions as defined
&gt; in the RISC-V Profiles documentation.
&gt; The version number is tentatively set to 1.0.
&gt; 
&gt; The only exception: 'Ssstateen' extension is defined separately because it
&gt; defines a subset (supervisor/hypervisor view) of the 'Smstateen' extension.
&gt; 
&gt; This is based on the latest version of RISC-V Profiles (version 0.9-draft):
&gt; <https: github.com="" riscv="" riscv-profiles="" commit="" 226b7f643067b29abc6723fac60d5f6d3f9eb901="">
&gt; 
&gt; [Definition]
&gt; 
&gt; "Main memory regions": memory regions with both the cacheability
&gt;                        and coherence PMAs.
&gt; 
&gt; [New Unprivileged Extensions]
&gt; 
&gt; 1.  'Ziccif'
&gt;     "Main memory regions" support instruction fetch and any instruction
&gt;     fetches of naturally aligned power-of-2 sizes up to min(ILEN, XLEN)
&gt;     are atomic.
&gt; 2.  'Ziccrse'
&gt;     "Main memory regions" provide the eventual success guarantee for
&gt;     LR/SC sequence.
&gt; 3.  'Ziccamoa'
&gt;     "Main memory regions" support all AMO operations including atomic swap,
&gt;     logical and arithmetic operations.
&gt; 4.  'Za64rs'
&gt;     For LR/SC instructions, reservation sets are contiguous, naturally
&gt;     aligned and at most 64-bytes in size.
&gt; 5.  'Za128rs'
&gt;     Likewise, but reservation sets are at most 128-bytes in size.
&gt; 6.  'Zicclsm'
&gt;     Misaligned loads / stores to "main memory regions" are supported.
&gt;     Those include both regular scalar and vector access but does not include
&gt;     AMOs and other specialized forms of memory access.
&gt; 7.  'Zic64b'
&gt;     Cache blocks are (exactly) 64-bytes in size and naturally aligned.
&gt; 
&gt; [New Privileged Extensions]
&gt; 
&gt; 1.  'Svbare'
&gt;     "satp" mode Bare is supported.
&gt; 2.  'Ssptead'
&gt;     Page-fault exceptions are raised when a page is accessed when A bit is
&gt;     clear, or written when D bit is clear.
&gt; 3.  'Ssccptr'
&gt;     "Main memory regions" support hardware page-table reads.
&gt; 4.  'Sstvecd'
&gt;     "stvec" mode Direct is supported.  When "stvec" mode is Direct,
&gt;     "stvec.BASE" is capable of holding any valid 4-byte aligned address.
&gt; 5.  'Sstvala'
&gt;     "stval" is always written with a nonzero value whenever possible as
&gt;     specified in the Privileged Architecture documentation
&gt;     (version 20211203: see section 4.1.9).
&gt; 6.  'Ssu64xl'
&gt;     "sstatus.UXL"=64 [sic].
&gt; 7.  'Shcounterenw'
&gt;     For any "hpmcounter" that is not read-only zero, the corresponding bit
&gt;     in "hcounteren" is writable.
&gt; 8.  'Shvstvala'
&gt;     Similar to 'Sstvala' but the same rule applies to "vstval".
&gt; 9.  'Shtvala'
&gt;     "htval" is written with the faulting guest physical address as long as
&gt;     permitted by the ISA (a bit similar to 'Sstvala' and 'Shvstvala').
&gt; 10. 'Shvstvecd'
&gt;     Similar to 'Sstvecd' but the same rule applies to "vstvec".
&gt; 11. 'Shvsatpa'
&gt;     All translation modes supported in "satp" are also supported in "vsatp".
&gt; 12. 'Shgatpa'
&gt;     For each supported virtual memory scheme SvNN supported in "satp", the
&gt;     corresponding "hgatp" SvNNx4 mode is supported.  The "hgatp" mode Bare
&gt;     is also supported.
&gt; 
&gt; [Implications]
&gt; 
&gt; (Due to reservation set size constraints)
&gt; -   'Za64rs' -&gt; 'Za128rs'
&gt; 
&gt; (Due to the fact that a privileged "extension" directly refers a CSR)
&gt; -   'Svbare'       -&gt; 'Zicsr'
&gt; -   'Sstvecd'      -&gt; 'Zicsr'
&gt; -   'Sstvala'      -&gt; 'Zicsr'
&gt; -   'Ssu64xl'      -&gt; 'Zicsr'
&gt; 
&gt; (Due to the fact that a privileged "extension" indirectly depends on CSRs)
&gt; -   'Ssptead' -&gt; 'Zicsr'
&gt; -   'Ssccptr' -&gt; 'Zicsr'
&gt; 
&gt; (Due to the fact that a privileged "extension" is a hypervisor property)
&gt; -   'Shcounterenw' -&gt; 'H'
&gt; -   'Shvstvala'    -&gt; 'H'
&gt; -   'Shtvala'      -&gt; 'H'
&gt; -   'Shvstvecd'    -&gt; 'H'
&gt; -   'Shvsatpa'     -&gt; 'H'
&gt; -   'Shgatpa'      -&gt; 'H'
&gt; 
&gt; bfd/ChangeLog:
&gt; 
&gt; 	* elfxx-riscv.c
&gt; 	(riscv_implicit_subsets): Add 13 implication rules.
&gt; 	(riscv_supported_std_z_ext) Add 7 property/capability extensions.
&gt; 	(riscv_supported_std_s_ext) Add 12 property/capability extensions.
&gt; ---
&gt;  bfd/elfxx-riscv.c | 34 +++++++++++++++++++++++++++++++++-
&gt;  1 file changed, 33 insertions(+), 1 deletion(-)
&gt; 
&gt; diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
&gt; index 781b57cbd98..64811a138a3 100644
&gt; --- a/bfd/elfxx-riscv.c
&gt; +++ b/bfd/elfxx-riscv.c
&gt; @@ -1047,7 +1047,6 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
&gt;    {"g", "zicsr",	check_implicit_always},
&gt;    {"g", "zifencei",	check_implicit_always},
&gt;    {"m", "zmmul",	check_implicit_always},
&gt; -  {"h", "zicsr",	check_implicit_always},
&gt;    {"q", "d",		check_implicit_always},
&gt;    {"v", "d",		check_implicit_always},
&gt;    {"v", "zve64d",	check_implicit_always},
&gt; @@ -1083,6 +1082,7 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
&gt;    {"zhinx", "zhinxmin",	check_implicit_always},
&gt;    {"zhinxmin", "zfinx",	check_implicit_always},
&gt;    {"zfinx", "zicsr",	check_implicit_always},
&gt; +  {"za64rs", "za128rs",	check_implicit_always},
&gt;    {"zk", "zkn",		check_implicit_always},
&gt;    {"zk", "zkr",		check_implicit_always},
&gt;    {"zk", "zkt",		check_implicit_always},
&gt; @@ -1099,9 +1099,22 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
&gt;    {"zks", "zksh",	check_implicit_always},
&gt;    {"smstateen", "ssstateen",	check_implicit_always},
&gt;    {"smepmp", "zicsr",		check_implicit_always},
&gt; +  {"shcounterenw", "h",		check_implicit_always},
&gt; +  {"shgatpa", "h",		check_implicit_always},
&gt; +  {"shtvala", "h",		check_implicit_always},
&gt; +  {"shvsatpa", "h",		check_implicit_always},
&gt; +  {"shvstvala", "h",		check_implicit_always},
&gt; +  {"shvstvecd", "h",		check_implicit_always},
&gt; +  {"h", "zicsr",		check_implicit_always},
&gt; +  {"ssccptr", "zicsr",		check_implicit_always},
&gt;    {"sscofpmf", "zicsr",		check_implicit_always},
&gt; +  {"ssptead", "zicsr",		check_implicit_always},
&gt;    {"ssstateen", "zicsr",	check_implicit_always},
&gt;    {"sstc", "zicsr",		check_implicit_always},
&gt; +  {"sstvala", "zicsr",		check_implicit_always},
&gt; +  {"sstvecd", "zicsr",		check_implicit_always},
&gt; +  {"ssu64xl", "zicsr",		check_implicit_always},
&gt; +  {"svbare", "zicsr",		check_implicit_always},
&gt;    {NULL, NULL, NULL}
&gt;  };
&gt;  
&gt; @@ -1159,6 +1172,11 @@ static struct riscv_supported_ext riscv_supported_std_ext[] =
&gt;  
&gt;  static struct riscv_supported_ext riscv_supported_std_z_ext[] =
&gt;  {
&gt; +  {"zic64b",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt; +  {"ziccamoa",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt; +  {"ziccif",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt; +  {"zicclsm",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt; +  {"ziccrse",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt;    {"zicbom",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt;    {"zicbop",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt;    {"zicboz",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt; @@ -1168,6 +1186,8 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
&gt;    {"zifencei",		ISA_SPEC_CLASS_20190608,	2, 0,  0 },
&gt;    {"zihintpause",	ISA_SPEC_CLASS_DRAFT,		2, 0,  0 },
&gt;    {"zmmul",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt; +  {"za64rs",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt; +  {"za128rs",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt;    {"zawrs",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt;    {"zfh",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt;    {"zfhmin",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
&gt; @@ -1217,11 +1237,23 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
&gt;  
&gt;  static struct riscv_supported_ext riscv_supported_std_s_ext[] =
&gt;  {
&gt; +  {"shcounterenw",	ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; +  {"shgatpa",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; +  {"shtvala",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; +  {"shvsatpa",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; +  {"shvstvala",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; +  {"shvstvecd",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt;    {"smepmp",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt;    {"smstateen",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; +  {"ssccptr",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt;    {"sscofpmf",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; +  {"ssptead",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt;    {"ssstateen",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt;    {"sstc",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; +  {"sstvala",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; +  {"sstvecd",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; +  {"ssu64xl",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; +  {"svbare",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt;    {"svinval",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt;    {"svnapot",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt;    {"svpbmt",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
&gt; -- 
&gt; 2.37.2

LGTM, since some extensions are optional in profile and not documented yet, 
I'm not sure if we need to add all of them  here, anyway thanks for your works.

</https:>

  parent reply	other threads:[~2022-11-29  6:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27  2:03 [PATCH v2 0/8] RISC-V: Combined floating point enhancements Tsukasa OI
2022-06-27  2:03 ` [PATCH v2 1/8] RISC-V: Refactor Zfh/Zhinx-related constants Tsukasa OI
2022-06-27  2:03 ` [PATCH v2 2/8] RISC-V: Add instruction declaration for Zfh/Zhinx Tsukasa OI
2022-06-27  2:03 ` [PATCH v2 3/8] RISC-V: Add Zfhmin/Zhinxmin (with refactoring) Tsukasa OI
2022-07-05 14:21   ` Kito Cheng
2022-07-05 23:19     ` Andrew Waterman
2022-07-07  2:57       ` Kito Cheng
2022-07-07  4:43         ` Nelson Chu
2022-07-08  5:37           ` Tsukasa OI
2022-07-07  6:10         ` Andrew Waterman
2022-07-07  8:59           ` Nelson Chu
2022-06-27  2:03 ` [PATCH v2 4/8] RISC-V: Fix disassembling Zfinx with -M numeric Tsukasa OI
2022-07-07  2:58   ` Kito Cheng
2022-07-07  4:25     ` Nelson Chu
2022-06-27  2:03 ` [PATCH v2 5/8] RISC-V: Reorganize and enhance Zfinx tests Tsukasa OI
2022-06-27  2:29   ` jiawei
2022-11-29  6:35   ` jiawei [this message]
2022-06-27  2:03 ` [PATCH v2 6/8] RISC-V: Relax `fmv.[sdq]' requirements Tsukasa OI
2022-06-27  2:03 ` [PATCH v2 7/8] RISC-V: Validate Zdinx/Zqinx register pairs Tsukasa OI
2022-06-27  2:03 ` [PATCH v2 8/8] RISC-V: Add testcases for Z[dq]inx " Tsukasa OI
2022-11-03 12:26 [REVIEW ONLY 0/2] NEAR RATIFICATION RISC-V: Extensions from the RISC-V Profiles Tsukasa OI
2022-11-03 12:26 ` [REVIEW ONLY 2/2] NEAR-RATIFICATION RISC-V: Add platform property/capability extensions Tsukasa OI

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=47b60bda.af2d.184c2190405.Coremail.jiawei@iscas.ac.cn \
    --to=jiawei@iscas.ac.cn \
    --cc=binutils@sourceware.org \
    --cc=kito.cheng@sifive.com \
    --cc=nelson.chu@sifive.com \
    --cc=palmer@dabbelt.com \
    --cc=research_trasio@irq.a4lg.com \
    /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).