diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..22009a6 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing to the Software Development and Build Convention for LoongArch™ Architectures + +## Thank you for taking the time to contribute! + +We accept bug fixes and feature proposals through two means: by filing an issue, +or by submitting a pull request (PR). + +## Create an issue + +You can create an issue at https://github.com/loongson/la-softdev-convention/issues +to submit bug reports or make proposals. + +## Pull request + +To contribute fixes or improvements, you are welcome to submit a pull request +on https://github.com/loongson/la-softdev-convention/pull. The workflow for submitting +a pull request is as follows: + +### Sign Contributor License Agreement (CLA) + +Contributors must sign CLA before their pull requests can be merged. Please +contact wuqingling@loongson.cn regarding how to sign the CLA. + +### Make the actual pull request + +Follow [Github pull requests documentation](https://docs.github.com/en/pull-requests) +to submit the PR. + +### Review of pull request + +Pull requests need to be reviewed before they can be merged. Anyone can review +the requests, but approval from at least one Loongson reviewer is required. + +### Merging the change + +Pull request can be merged once the change has been reviewed properly, which +can only be done by one of the administrators. If your change hasn't been merged +for more than a week after it has been accepted, leave a comment on the pull +request. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8849b73 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +SRC = la-softdev-convention.adoc +PDF = la-softdev-convention.pdf + +PDF_THEME = themes/la-softdev-pdf.yml + +.PHONY: all clean + +$(PDF): $(PDF:.pdf=.adoc) $(SRC) $(PDF_THEME) + asciidoctor-pdf \ + -a compress \ + -a pdf-style="$(PDF_THEME)" \ + -a pdf-fontsdir=fonts \ + -v \ + --trace \ + $< -o $@ + +html: $(patsubst %.adoc, %.html, $(SRC)) + +%.html: %.adoc + asciidoctor $^ -o $@ + +clean: + -rm -rf $(patsubst %.adoc, %.html, $(SRC)) diff --git a/README.md b/README.md new file mode 100644 index 0000000..9fa64ca --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# Software Development and Build Convention for LoongArch™ Architectures + +This document is a official comprehensive guide to software development +and building convention for LoongArch Architecture Chips. + +## Releases + +The latest Software Development and Build Convention releases are available at +https://github.com/loongson/la-softdev-convention and are licensed under the Creative +Commons Attribution-NonCommercial-NoDerivatives 4.0 International +(CC BY-NC-ND 4.0) License. + +## Defect reports + +Please report defects in or enhancements to the specifications in this folder to +the [issue tracker page on GitHub](https://github.com/loongson/la-softdev-convention/issues). + +## Contributing + +Please refer to the contribution guidelines in [CONTRIBUTING](CONTRIBUTING.md). + +## License + +The documents and source files are currently licensed under the +Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International +(CC BY-NC-ND 4.0) License. Contributions to these files are accepted under +the same license. + +To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ +or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. + +## Revision History + +- **v0.1** + + * Initial version diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..1357079 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +Software Development and Build Convention for LoongArch™ Architectures, version 0.10 diff --git a/fonts/CM_Unicode/OFL.txt b/fonts/CM_Unicode/OFL.txt new file mode 100644 index 0000000..a55bb6b --- /dev/null +++ b/fonts/CM_Unicode/OFL.txt @@ -0,0 +1,103 @@ +Copyright (C) Authors of original metafont fonts: +Donald Ervin Knuth (cm, concrete fonts) +1995, 1996, 1997 J"org Knappen, 1990, 1992 Norbert Schwarz (ec fonts) +1992-2006 A.Khodulev, O.Lapko, A.Berdnikov, V.Volovich (lh fonts) +1997-2005 Claudio Beccari (cb greek fonts) +2002 FUKUI Rei (tipa fonts) +2003-2005 Han The Thanh (Vietnamese fonts) +1996-2005 Walter Schmidt (cmbright fonts) + +Copyright (C) 2003-2009, Andrey V. Panov (panov@canopus.iacp.dvo.ru), +with Reserved Font Family Name "Computer Modern Unicode fonts". + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/fonts/CM_Unicode/cmunbi.ttf b/fonts/CM_Unicode/cmunbi.ttf new file mode 100644 index 0000000..3b529ed Binary files /dev/null and b/fonts/CM_Unicode/cmunbi.ttf differ diff --git a/fonts/CM_Unicode/cmunbx.ttf b/fonts/CM_Unicode/cmunbx.ttf new file mode 100644 index 0000000..2c7198e Binary files /dev/null and b/fonts/CM_Unicode/cmunbx.ttf differ diff --git a/fonts/CM_Unicode/cmunrm.ttf b/fonts/CM_Unicode/cmunrm.ttf new file mode 100644 index 0000000..1c3fff0 Binary files /dev/null and b/fonts/CM_Unicode/cmunrm.ttf differ diff --git a/fonts/CM_Unicode/cmuntb.ttf b/fonts/CM_Unicode/cmuntb.ttf new file mode 100644 index 0000000..f940901 Binary files /dev/null and b/fonts/CM_Unicode/cmuntb.ttf differ diff --git a/fonts/CM_Unicode/cmunti.ttf b/fonts/CM_Unicode/cmunti.ttf new file mode 100644 index 0000000..993d5c0 Binary files /dev/null and b/fonts/CM_Unicode/cmunti.ttf differ diff --git a/fonts/CM_Unicode/cmuntt.ttf b/fonts/CM_Unicode/cmuntt.ttf new file mode 100644 index 0000000..1651877 Binary files /dev/null and b/fonts/CM_Unicode/cmuntt.ttf differ diff --git a/fonts/Merriweather/Merriweather-Bold.ttf b/fonts/Merriweather/Merriweather-Bold.ttf new file mode 100644 index 0000000..b668e8c Binary files /dev/null and b/fonts/Merriweather/Merriweather-Bold.ttf differ diff --git a/fonts/Merriweather/Merriweather-BoldItalic.ttf b/fonts/Merriweather/Merriweather-BoldItalic.ttf new file mode 100644 index 0000000..df062a3 Binary files /dev/null and b/fonts/Merriweather/Merriweather-BoldItalic.ttf differ diff --git a/fonts/Merriweather/Merriweather-Italic.ttf b/fonts/Merriweather/Merriweather-Italic.ttf new file mode 100644 index 0000000..90f3273 Binary files /dev/null and b/fonts/Merriweather/Merriweather-Italic.ttf differ diff --git a/fonts/Merriweather/Merriweather-Regular.ttf b/fonts/Merriweather/Merriweather-Regular.ttf new file mode 100644 index 0000000..666a322 Binary files /dev/null and b/fonts/Merriweather/Merriweather-Regular.ttf differ diff --git a/fonts/Merriweather/OFL.txt b/fonts/Merriweather/OFL.txt new file mode 100644 index 0000000..042a4c4 --- /dev/null +++ b/fonts/Merriweather/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2016 The Merriweather Project Authors (https://github.com/EbenSorkin/Merriweather), with Reserved Font Name "Merriweather". + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/fonts/Noto_Serif/NotoSerif-Bold.ttf b/fonts/Noto_Serif/NotoSerif-Bold.ttf new file mode 100644 index 0000000..219b8cf Binary files /dev/null and b/fonts/Noto_Serif/NotoSerif-Bold.ttf differ diff --git a/fonts/Noto_Serif/NotoSerif-BoldItalic.ttf b/fonts/Noto_Serif/NotoSerif-BoldItalic.ttf new file mode 100644 index 0000000..2dfc953 Binary files /dev/null and b/fonts/Noto_Serif/NotoSerif-BoldItalic.ttf differ diff --git a/fonts/Noto_Serif/NotoSerif-Italic.ttf b/fonts/Noto_Serif/NotoSerif-Italic.ttf new file mode 100644 index 0000000..50ad343 Binary files /dev/null and b/fonts/Noto_Serif/NotoSerif-Italic.ttf differ diff --git a/fonts/Noto_Serif/NotoSerif-Regular.ttf b/fonts/Noto_Serif/NotoSerif-Regular.ttf new file mode 100644 index 0000000..521539c Binary files /dev/null and b/fonts/Noto_Serif/NotoSerif-Regular.ttf differ diff --git a/fonts/Noto_Serif/OFL.txt b/fonts/Noto_Serif/OFL.txt new file mode 100644 index 0000000..c985727 --- /dev/null +++ b/fonts/Noto_Serif/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2012 Google Inc. All Rights Reserved. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/la-softdev-convention.adoc b/la-softdev-convention.adoc new file mode 100644 index 0000000..9f674a0 --- /dev/null +++ b/la-softdev-convention.adoc @@ -0,0 +1,226 @@ += Software Development and Build Convention for LoongArch Architectures +Version 0.1 +Copyright © Loongson Technology 2023. All rights reserved. +:doctype: article +:toc: left +:sectnums: + +== Abstract + +This document is a comprehensive guide to software development and building convention for LoongArch Architecture Chips. + +== Keywords + +LoongArch chip features, Software development, Compiler constraints, Kernel constraints + +== Version History + +- **0.1** + * initial version. + +== Introduction + +This document provides an overview of the software development construction convention for LoongArch Architecture Chips. It defines the specific requirements and constraints related to meeting convention, ensuring compatibility, handling compilers and kernels, and building operating system software packages. + +That includes constraints on: + +[loweralpha] +. Compatibility requirements: It outlines the specific requirements and constraints related to ensuring compatibility with LoongArch Architecture Chips. +. Compiler constraints: It defines the limitations and considerations for software development in terms of compilers used for LoongArch Architecture Chips. +. Kernel limitations: It specifies the restrictions and guidelines for developing software that interacts with the kernel of LoongArch Architecture Chips. +. Operating system software package building: It provides guidelines and convention for building software packages for operating systems compatible with LoongArch Architecture Chips. + +== Terms and abbreviations + +**GPR** + +General-purpose registers. + +**FPR** + +Floating-point registers. + +== Convention Target + +The Software Development and Build Convention for LoongArch Architectures is primarily targeted at Linux desktop operating systems, Linux server operating systems and Linux embedded operating systems. + +== Chip Feature Compatibility Requirements + +=== CPUCFG instruction +The CPU needs to support the CPUCFG instruction and follow the convention of the CPUCFG instruction described in https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_cpucfg[__LoongArch Architecture Reference Manual Volume 1__]. CPUCFG.1.bit25 equals 1 is used to determine whether the CRC instruction is supported.The CPU reads the lower 8 bits of the 0-offset address through the IOCSR method, and the return value is not 0 indicating that it supports the chip configuration version register, feature register, manufacturer name register and chip name register. The definitions of each register are as follows. + +[options="header"] +|=============================================================================================== +| Registers | Offset Address | Bit Width +| Chip Configuration Version Register | IOCSR Space Offset Address: 0x0 | Register Width: 8bits +| Chip Feature Register | IOCSR Space Offset Address: 0x8 | Register Width: 32bit +| Manufacturer Name Register | IOCSR Space Offset Address: 0x10 | Register Width: 64bit +| Chip Name Register | IOCSR Space Offset Address: 0x20 | Register Width: 64bit +|=============================================================================================== + +[options="header"] +|================================================================================================================================ +| Bit Field | Field Name | Access | Description +| 0 | Centigrade | R | When set to 1, indicates CSR[0x428] is valid +| 1 | Node counter | R | When set to 1, indicates CSR[0x408] is valid +| 2 | MSI | R | When set to 1, indicates MSI is available +| 3 | EXT_IOI | R | When set to 1, indicates EXT_IOI is available +| 4 | IPI_percore | R | When set to 1, indicates IPI sending is done via CSR private address +| 5 | Freq_percore | R | When set to 1, indicates frequency adjustment is done via CSR private address +| 6 | Freq_scale | R | When set to 1, indicates dynamic frequency scaling is available +| 7 | DVFS_v1 | R | When set to 1, indicates dynamic voltage and frequency scaling (DVFS) v1 is available +| 8 | Tsensor | R | When set to 1, indicates temperature sensor is available +| 9 | Interrupt Decoding | R | Interrupt pin decoding mode is available +| 10 | Flat mode | R | Traditional compatibility mode +| 11 | Guest Mode | WR | KVM virtual machine mode +| 12 | Freq_scale_16 | R | When set to 1, indicates support for 16-level frequency scaling mode +| 13 | Int Remap | R | When set to 1, indicates support for interrupt remapping mechanism +| 14 | SE enabled | WR | SE function is enabled +|================================================================================================================================ + +=== Device Driver Compatibility +The internal functional module register interface of the CPU needs to ensure compatibility between chips. + +- For non-PCI devices of the CPU or bridge chip, their register definitions need to ensure forward compatibility to ensure the normal use of their basic functions by the kernel. For example, non-PCI devices currently used by the kernel include: interrupt controllers (traditional interrupts, extended interrupts), UART, PWM, ACPI, RTC, GPIO. +- For PCI devices, identification is done through Vendor ID, Device ID, and Revision ID, and software compatibility under the same ID needs to be ensured. + +=== Vector instruction support +Desktop and server chips default to supporting 128-bit vector instructions. + +=== Unaligned memory access support +Desktop and server chips default to supporting unaligned memory access. + + +== Compiler constraints + +=== Compiler constraints for desktop and server operating systems + +When building desktop and server operating systems, developers should enable the -mno-strict-align compilation option of the compiler by default. + +=== Compiler constraints for embedded operating systems + +When building an embedded operating system, developers should enable the -mstrict-align compilation option of the compiler by default. + +=== Architecture-related C/C++ pre-defined macros. + +link:https://github.com/loongson/LoongArch-Documentation/blob/main/docs/LoongArch-toolchain-conventions-EN.adoc#cc-preprocessor-built-in-macro-definitions[upstream documentation] +[options="header"] +|======================================================================================================================================================================================================================================================================== +| Name | Expanded Value | Description +| `\\__loongarch__` | `1` | Target architecture is LoongArch +| `__loongarch_grlen` | `64` `32` | Bit-width of GPR +| `__loongarch_frlen` | `0` `32` `64` | Bit-width of FPR (`0` if no FPU) +| `__loongarch_arch` | `"loongarch64"` `"la464"` | Target CPU name specified by `-march`. If not specified, defaults to the compiler-defined default. If `-march=native` is specified, then it is automatically detected by the compiler +| `__loongarch_tune` | `"loongarch64"` `"la464"` | Target CPU name specified by `-mtune`. If not specified, it defaults to the same as `__loongarch_arch`. If `-mtune=native` is specified, then it is automatically detected by the compiler +| `__loongarch_lp64` | Undefined or `1` | ABI uses 64-bit GPR for parameter passing and follows LP64 data model +| `__loongarch_hard_float` | Undefined or `1` | ABI uses FPR for parameter passing +| `__loongarch_soft_float` | Undefined or `1` | ABI does not use FPR for parameter passing +| `__loongarch_single_float` | Undefined or `1` | ABI only uses 32-bit FPR for parameter passing +| `__loongarch_double_float` | Undefined or `1` | ABI uses 64-bit FPR for parameter passing +|======================================================================================================================================================================================================================================================================== + +=== Debian Multiarch Identifiers (Convention Target Triplet) + +[options="header"] +|====================================================================== +| ABI Type | C Library | Kernel | Multiarch Identifier +| lp64d / base | glibc | Linux | loongarch64-linux-gnu +| lp64f / base | glibc | Linux | loongarch64-linux-gnuf32 +| lp64s / base | glibc | Linux | loongarch64-linux-gnusf +|====================================================================== + +== Kernel Constraints + +=== Kernel Development + +The kernel needs to obtain CPU features through CPUCFG instruction, and the application obtains CPU features through the getauxval system call provided by the kernel. + +(1)The kernel needs to support the corresponding functions based on the CPUCFG instruction and CPU feature registers, to achieve compatible operation on different model CPUs using the same kernel binary; + +(2)The kernel exports the CPU features supported by the system through HWCAP (a 32-bit unsigned data), and application software identifies the CPU features supported by the system based on HWCAP. HWCAP is defined as follows: + +[.text-center] +Table 1 HWCAP Definitions + +[options="header"] +|========================================================== +| Bit Field | Meaning +| 0 | Supports cpucfg instruction +| 1 | Supports atomic instructions +| 2 | Supports unaligned access +| 3 | Supports single/double precision FP +| 4 | Supports 128-bit vector extension +| 5 | Supports 256-bit vector extension +| 6 | Supports 32-bit CRC instruction +| 7 | Supports complex vector operation instruction +| 8 | Supports cryptographic vector instruction +| 9 | Supports virtualization extension +| 10 | Supports x86 binary translation extension +| 11 | Supports ARM binary translation extension +| 12 | Supports MIPS binary translation extension +|========================================================== + +Applications can use HWCAP as follows: + +The CPU characteristic data can be obtained through getauxval(AT_HWCAP), and the corresponding CPU characteristic can be detected according to the HWCAP definition. + +(3)The kernel exports CPU information through /proc/cpuinfo, which is only used for display and not for application software's CPU feature detection. The format of cpuinfo is as follows: + +[.text-center] +Table 2 cpuinfo format + +[options="header"] +|========================================================================================================================================== +| Field Name | Meaning +| system type | system type +| processor | system-wide processor core ID +| package | package ID +| core | internal core ID of the package (if a package includes n processor cores, the valid range of core is from 0 to n-1) +| CPU Family | CPU family +| Model Name | CPU model name +| CPU Revision | CPU revision number +| FPU Revision | FPU revision number +| CPU MHz | maximum frequency supported by the CPU +| BogoMIPS | BogoMIPS +| TLB Entries | number of TLBs per processor core +| Address Sizes | physical and virtual address bit sizes +| ISA | instruction set architecture +| Features | CPU features +| Hardware Watchpoint | hardware watchpoint information +|========================================================================================================================================== + +=== Kernel Build + +For desktop and server operating systems, the kernel defaults to supporting non-aligned access builds. + +For embedded operating systems, the kernel needs to be built with the -mstrict-align compilation option for aligned access. + +== Operating System Package Build Requirements + +=== Desktop and Server Operating System Build Requirements + +Desktop operating systems need to support CPU platforms with at least 128-bit vector units. + +The desktop operating system compilation toolchain should enable the -mno-strict-align compilation option by default and disable auto-vectorization. + +=== Embedded Operating System Requirements + +Embedded operating systems need to support CPU platforms without vector units. + +The embedded operating system compilation toolchain should enable the -mstrict-align compilation option by default and disable auto-vectorization. + + +== Compatibility Requirements for Software Development + +=== Extended Instruction Recognition +New extended instructions should be identified using getauxval.For the specific usage method of getauxval and the meaning of parameters, please refer to xref:_kernel_development[_Kernel Development_]. + +=== Compiler Vector Instruction Support Detection +To ensure compatibility, vectorization should at least consider checking the characteristics of the compiler and runtime platform. During compilation, check that the compiler supports the vector instruction set before compiling the binary with vectorization enabled. During runtime, check that the runtime platform supports the vector instruction set before initializing/registering the corresponding optimization interface. + +=== Compile-time and Runtime Checks +Compatibility should also be considered for microstructure or differences between different instruction set versions, and both compile-time and runtime checks should be implemented. + +=== Compatibility of LA32R and LA64 +LA32R and LA64 are compatible. Since there are differences in the underlying integer instruction sets between the two, developers are advised to abstract the required basic integer instructions as macros and point them to specific instructions on different platforms. + diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e69de29 diff --git a/themes/la-softdev-pdf.yml b/themes/la-softdev-pdf.yml new file mode 100644 index 0000000..e95ee95 --- /dev/null +++ b/themes/la-softdev-pdf.yml @@ -0,0 +1,158 @@ +# ----------------------------------------------------------------------------- +# Asciidoctor PDF Theme for LoongArch documentations. +# ----------------------------------------------------------------------------- +page: + layout: portrait + margin: [10mm, 15mm, 18mm, 15mm] + size: a4 + +base: + font_color: #333333 + font_family: Noto Serif + font_style: normal + font_size: 10 + line_height: 1.1 + vertical_spacing: $base_line_height_length + +heading: + font_color: #d71520 + font_family: Merriweather + h1_font_family: CMU Serif + h1_font_size: floor($base_font_size * 1.7) + h2_font_size: floor($base_font_size * 1.3) + h3_font_size: round($base_font_size * 1.1) + h4_font_size: round($base_font_size * 1.0) + font_style: bold + line_height: 1 + margin_bottom: $vertical_spacing / 1.5 + margin_top: $vertical_spacing / 1.5 + +code: + font_color: #333333 +# font_family: Courier Prime Sans + font_family: CMU Typewriter + font_style: normal + font_size: 10 + background_color: #f6f6f6 +# border_color: #0f80aa + border_color: #333333 + border_radius: 2 + line_height: 1.1 + +#caption: +# font_family: CMU Serif +# font_style: normal +# font_size: 10 + +literal: + font_family: CMU Typewriter + font_color: $heading_font_color + font_style: normal + +link: + font_color: #002FA7 + +description_list: + description_indent: $base_font_size * 2.5 + +outline_list: + indent: $base_font_size * 2.5 + +title_page: + font_family: Noto Serif + font_color: #000000 +# background_color: #1d4e89 + background_color: #ffffff + align: right + #logo: + # top: 10% + # image: image:images/puzzle_stamp_white.svg[width=30%, align=center] + title: + top: 33% + font_color: $heading_font_color + font_size: $base_font_size * 4.0 + font_family: CMU Serif + font_style: bold + line_height: 0.9 + subtitle: + font_size: $base_font_size * 2.00 + font_family: Noto Serif + font_style: normal + line_height: 1 + authors: + margin_top: $base_font_size * 28.25 + font_size: $base_font_size * 1.5 + font_family: Noto Serif + font_style: normal + revision: + margin_top: $base_font_size * 0.5 + font_family: Noto Serif + font_style: normal + +toc: + line_height: 1.25 + h1: + font_style: bold + dot_leader: + content: ". " + font_color: A9A9A9 + levels: 1 2 3 + + +table: + border_width: 1 + cell: + padding: 3 + head: + font_size: 10 + body: + font_size: 9 + foot: + font_size: 9 + +footer: + font_size: 8 + border_color: dddddd + border_width: 0.25 + height: $base_line_height_length * 3.5 + line_height: 1 + padding: [$base_line_height_length / 2, 1, 0, 1] + vertical_align: top + recto: + right: + content: '{document-title} | © Loongson' + left: + content: '{page-number}' + verso: + left: + content: $footer_recto_right_content + right: + content: '{page-number}' + + +## ---------------------------------------------------------------------------- +## Fonts +## ---------------------------------------------------------------------------- +font: + catalog: + Noto Serif: + normal: Noto_Serif/NotoSerif-Regular.ttf + bold: Noto_Serif/NotoSerif-Bold.ttf + italic: Noto_Serif/NotoSerif-Italic.ttf + bold_italic: Noto_Serif/NotoSerif-BoldItalic.ttf + + Merriweather: + normal: Merriweather/Merriweather-Regular.ttf + bold: Merriweather/Merriweather-Bold.ttf + italic: Merriweather/Merriweather-Italic.ttf + bold_italic: Merriweather/Merriweather-BoldItalic.ttf + + CMU Serif: + normal: CM_Unicode/cmunrm.ttf + bold: CM_Unicode/cmunbx.ttf + italic: CM_Unicode/cmunti.ttf + bold_italic: CM_Unicode/cmunbi.ttf + + CMU Typewriter: + normal: CM_Unicode/cmuntt.ttf + bold: CM_Unicode/cmuntb.ttf