515.43.04
This commit is contained in:
commit
1739a20efc
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**NVIDIA Driver Version**
|
||||
Please write the version of the NVIDIA driver you are using.
|
||||
|
||||
**GPU**
|
||||
Please write the particular model of NVIDIA GPU you are using.
|
||||
|
||||
**Describe the bug**
|
||||
Please write a clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Please write the steps to reproduce the behavior.
|
||||
|
||||
**Expected behavior**
|
||||
Please write a clear and concise description of what you expected to happen.
|
||||
|
||||
**Please reproduce the problem, run nvidia-bug-report.sh, and attach the resulting nvidia-bug-report.log.gz.**
|
||||
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
*.o
|
||||
*.o_binary
|
||||
*.o.cmd
|
||||
*.o.d
|
||||
_out/
|
141
CODE_OF_CONDUCT.md
Normal file
141
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,141 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contribute to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances of
|
||||
any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address,
|
||||
without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, or to ban temporarily or permanently any
|
||||
contributor for other behaviors that they deem inappropriate, threatening,
|
||||
offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when
|
||||
an individual is representing the project or its community. Examples of representing
|
||||
our community include using an official e-mail address, posting via an official
|
||||
social media account, or acting as an appointed representative at an online or
|
||||
offline event. Representation of a project may be further defined and clarified
|
||||
by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders and moderators responsible for enforcement at
|
||||
GitHub_Conduct@nvidia.com.
|
||||
All complaints will be reviewed and investigated and will result in a response
|
||||
that is deemed necessary and appropriate to the circumstances. Leaders and moderators
|
||||
are obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Moderators who do not follow or enforce the Code of Conduct in good faith
|
||||
may face temporary or permanent repercussions as determined by other members of the
|
||||
community’s leadership.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders and moderators will follow these Community Impact Guidelines
|
||||
in determining the consequences for any action they deem in violation of this
|
||||
Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community moderators, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating an egregious single violation, or a pattern of
|
||||
violation of community standards, including sustained inappropriate behavior,
|
||||
harassment of an individual, or aggression toward or disparagement of classes of
|
||||
individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
369
COPYING
Normal file
369
COPYING
Normal file
@ -0,0 +1,369 @@
|
||||
|
||||
Except where noted otherwise, the individual files within this package are
|
||||
licensed as MIT:
|
||||
|
||||
Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
However, when linked together to form a Linux kernel module, the resulting Linux
|
||||
kernel module is dual licensed as MIT/GPLv2.
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
|
76
Makefile
Normal file
76
Makefile
Normal file
@ -0,0 +1,76 @@
|
||||
###########################################################################
|
||||
# This is the top level makefile for the NVIDIA Linux kernel module source
|
||||
# package.
|
||||
#
|
||||
# To build: run `make modules`
|
||||
# To install the build kernel modules: run (as root) `make modules_install`
|
||||
###########################################################################
|
||||
|
||||
include utils.mk
|
||||
|
||||
all: modules
|
||||
|
||||
nv_kernel_o = src/nvidia/$(OUTPUTDIR)/nv-kernel.o
|
||||
nv_kernel_o_binary = kernel-open/nvidia/nv-kernel.o_binary
|
||||
|
||||
nv_modeset_kernel_o = src/nvidia-modeset/$(OUTPUTDIR)/nv-modeset-kernel.o
|
||||
nv_modeset_kernel_o_binary = kernel-open/nvidia-modeset/nv-modeset-kernel.o_binary
|
||||
|
||||
.PHONY: $(nv_kernel_o) $(nv_modeset_kernel_o) modules modules_install
|
||||
|
||||
|
||||
###########################################################################
|
||||
# nv-kernel.o is the OS agnostic portion of nvidia.ko
|
||||
###########################################################################
|
||||
|
||||
$(nv_kernel_o):
|
||||
$(MAKE) -C src/nvidia
|
||||
|
||||
$(nv_kernel_o_binary): $(nv_kernel_o)
|
||||
cd $(dir $@) && ln -sf ../../$^ $(notdir $@)
|
||||
|
||||
|
||||
###########################################################################
|
||||
# nv-modeset-kernel.o is the OS agnostic portion of nvidia-modeset.ko
|
||||
###########################################################################
|
||||
|
||||
$(nv_modeset_kernel_o):
|
||||
$(MAKE) -C src/nvidia-modeset
|
||||
|
||||
$(nv_modeset_kernel_o_binary): $(nv_modeset_kernel_o)
|
||||
cd $(dir $@) && ln -sf ../../$^ $(notdir $@)
|
||||
|
||||
|
||||
###########################################################################
|
||||
# After the OS agnostic portions are built, descend into kernel-open/ and build
|
||||
# the kernel modules with kbuild.
|
||||
###########################################################################
|
||||
|
||||
modules: $(nv_kernel_o_binary) $(nv_modeset_kernel_o_binary)
|
||||
$(MAKE) -C kernel-open modules
|
||||
|
||||
|
||||
###########################################################################
|
||||
# Install the built kernel modules using kbuild.
|
||||
###########################################################################
|
||||
|
||||
modules_install:
|
||||
$(MAKE) -C kernel-open modules_install
|
||||
|
||||
|
||||
###########################################################################
|
||||
# clean
|
||||
###########################################################################
|
||||
|
||||
.PHONY: clean nvidia.clean nvidia-modeset.clean kernel-open.clean
|
||||
|
||||
clean: nvidia.clean nvidia-modeset.clean kernel-open.clean
|
||||
|
||||
nvidia.clean:
|
||||
$(MAKE) -C src/nvidia clean
|
||||
|
||||
nvidia-modeset.clean:
|
||||
$(MAKE) -C src/nvidia-modeset clean
|
||||
|
||||
kernel-open.clean:
|
||||
$(MAKE) -C kernel-open clean
|
164
README.md
Normal file
164
README.md
Normal file
@ -0,0 +1,164 @@
|
||||
# NVIDIA Linux Open GPU Kernel Module Source
|
||||
|
||||
This is the source release of the NVIDIA Linux open GPU kernel modules,
|
||||
version 515.43.04.
|
||||
|
||||
|
||||
## How to Build
|
||||
|
||||
To build:
|
||||
|
||||
make modules -j`nproc`
|
||||
|
||||
To install, first uninstall any existing NVIDIA kernel modules. Then,
|
||||
as root:
|
||||
|
||||
make modules_install -j`nproc`
|
||||
|
||||
Note that the kernel modules built here must be used with gsp.bin
|
||||
firmware and user-space NVIDIA GPU driver components from a corresponding
|
||||
515.43.04 driver release. This can be achieved by installing
|
||||
the NVIDIA GPU driver from the .run file using the `--no-kernel-modules`
|
||||
option. E.g.,
|
||||
|
||||
sh ./NVIDIA-Linux-[...].run --no-kernel-modules
|
||||
|
||||
|
||||
## Supported Target CPU Architectures
|
||||
|
||||
Currently, the kernel modules can be built for x86_64 or aarch64.
|
||||
If cross-compiling, set these variables on the make command line:
|
||||
|
||||
TARGET_ARCH=aarch64|x86_64
|
||||
CC
|
||||
LD
|
||||
AR
|
||||
CXX
|
||||
OBJCOPY
|
||||
|
||||
E.g.,
|
||||
|
||||
# compile on x86_64 for aarch64
|
||||
make modules -j`nproc` \
|
||||
TARGET_ARCH=aarch64 \
|
||||
CC=aarch64-linux-gnu-gcc \
|
||||
LD=aarch64-linux-gnu-ld \
|
||||
AR=aarch64-linux-gnu-ar \
|
||||
CXX=aarch64-linux-gnu-g++ \
|
||||
OBJCOPY=aarch64-linux-gnu-objcopy
|
||||
|
||||
|
||||
## Other Build Knobs
|
||||
|
||||
NV_VERBOSE - Set this to "1" to print each complete command executed;
|
||||
otherwise, a succinct "CC" line is printed.
|
||||
|
||||
DEBUG - Set this to "1" to build the kernel modules as debug. By default, the
|
||||
build compiles without debugging information. This also enables
|
||||
various debug log messages in the kernel modules.
|
||||
|
||||
These variables can be set on the make command line. E.g.,
|
||||
|
||||
make modules -j`nproc` NV_VERBOSE=1
|
||||
|
||||
|
||||
## Supported Toolchains
|
||||
|
||||
Any reasonably modern version of gcc or clang can be used to build the
|
||||
kernel modules. Note that the kernel interface layers of the kernel
|
||||
modules must be built with the toolchain that was used to build the
|
||||
kernel.
|
||||
|
||||
|
||||
## Supported Linux Kernel Versions
|
||||
|
||||
The NVIDIA open kernel modules support the same range of Linux kernel
|
||||
versions that are supported with the proprietary NVIDIA kernel modules.
|
||||
This is currently Linux kernel 3.10 or newer.
|
||||
|
||||
|
||||
## How to Contribute
|
||||
|
||||
Contributions can be made by creating a pull request on
|
||||
https://github.com/NVIDIA/open-gpu-kernel-modules
|
||||
We'll respond via github.
|
||||
|
||||
Note that when submitting a pull request, you will be prompted to accept
|
||||
a Contributor License Agreement.
|
||||
|
||||
This code base is shared with NVIDIA's proprietary drivers, and various
|
||||
processing is performed on the shared code to produce the source code that is
|
||||
published here. This has several implications for the foreseeable future:
|
||||
|
||||
* The github repository will function mostly as a snapshot of each driver
|
||||
release.
|
||||
|
||||
* We do not expect to be able to provide revision history for individual
|
||||
changes that were made to NVIDIA's shared code base. There will likely
|
||||
only be one git commit per driver release.
|
||||
|
||||
* We may not be able to reflect individual contributions as separate
|
||||
git commits in the github repository.
|
||||
|
||||
* Because the code undergoes various processing prior to publishing here,
|
||||
contributions made here require manual merging to be applied to the shared
|
||||
code base. Therefore, large refactoring changes made here may be difficult to
|
||||
merge and accept back into the shared code base. If you have large
|
||||
refactoring to suggest, please contact us in advance, so we can coordinate.
|
||||
|
||||
|
||||
## How to Report Issues
|
||||
|
||||
Problems specific to the Open GPU Kernel Modules can be reported in the
|
||||
Issues section of the https://github.com/NVIDIA/open-gpu-kernel-modules
|
||||
repository.
|
||||
|
||||
Further, any of the existing bug reporting venues can be used to communicate
|
||||
problems to NVIDIA, such as our forum:
|
||||
|
||||
https://forums.developer.nvidia.com/c/gpu-graphics/linux/148
|
||||
|
||||
or linux-bugs@nvidia.com.
|
||||
|
||||
Please see the 'NVIDIA Contact Info and Additional Resources' section
|
||||
of the NVIDIA GPU Driver README for details.
|
||||
|
||||
Please see the separate [SECURITY.md](SECURITY.md) document if you
|
||||
believe you have discovered a security vulnerability in this software.
|
||||
|
||||
|
||||
## Kernel Interface and OS-Agnostic Components of Kernel Modules
|
||||
|
||||
Most of NVIDIA's kernel modules are split into two components:
|
||||
|
||||
* An "OS-agnostic" component: this is the component of each kernel module
|
||||
that is independent of operating system.
|
||||
|
||||
* A "kernel interface layer": this is the component of each kernel module
|
||||
that is specific to the Linux kernel version and configuration.
|
||||
|
||||
When packaged in the NVIDIA .run installation package, the OS-agnostic
|
||||
component is provided as a binary: it is large and time-consuming to
|
||||
compile, so pre-built versions are provided so that the user does
|
||||
not have to compile it during every driver installation. For the
|
||||
nvidia.ko kernel module, this component is named "nv-kernel.o_binary".
|
||||
For the nvidia-modeset.ko kernel module, this component is named
|
||||
"nv-modeset-kernel.o_binary". Neither nvidia-drm.ko nor nvidia-uvm.ko
|
||||
have OS-agnostic components.
|
||||
|
||||
The kernel interface layer component for each kernel module must be built
|
||||
for the target kernel.
|
||||
|
||||
|
||||
## Directory Structure Layout
|
||||
|
||||
- `kernel-open/` The kernel interface layer
|
||||
- `kernel-open/nvidia/` The kernel interface layer for nvidia.ko
|
||||
- `kernel-open/nvidia-drm/` The kernel interface layer for nvidia-drm.ko
|
||||
- `kernel-open/nvidia-modeset/` The kernel interface layer for nvidia-modeset.ko
|
||||
- `kernel-open/nvidia-uvm/` The kernel interface layer for nvidia-uvm.ko
|
||||
|
||||
- `src/` The OS-agnostic code
|
||||
- `src/nvidia/` The OS-agnostic code for nvidia.ko
|
||||
- `src/nvidia-modeset/` The OS-agnostic code for nvidia-modeset.ko
|
||||
- `src/common/` Utility code used by one or more of nvidia.ko and nvidia-modeset.ko
|
16
SECURITY.md
Normal file
16
SECURITY.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Report a Security Vulnerability
|
||||
|
||||
To report a potential security vulnerability in any NVIDIA product, please use either:
|
||||
* this web form: [Security Vulnerability Submission Form](https://www.nvidia.com/object/submit-security-vulnerability.html), or
|
||||
* send email to: [NVIDIA PSIRT](mailto:psirt@nvidia.com)
|
||||
|
||||
**OEM Partners should contact their NVIDIA Customer Program Manager**
|
||||
|
||||
If reporting a potential vulnerability via email, please encrypt it using NVIDIA’s public PGP key ([see PGP Key page](https://www.nvidia.com/en-us/security/pgp-key/)) and include the following information:
|
||||
* Product/Driver name and version/branch that contains the vulnerability
|
||||
* Type of vulnerability (code execution, denial of service, buffer overflow, etc.)
|
||||
* Instructions to reproduce the vulnerability
|
||||
* Proof-of-concept or exploit code
|
||||
* Potential impact of the vulnerability, including how an attacker could exploit the vulnerability
|
||||
|
||||
See https://www.nvidia.com/en-us/security/ for past NVIDIA Security Bulletins and Notices.
|
9
kernel-open/.gitignore
vendored
Normal file
9
kernel-open/.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
.*.cmd
|
||||
*.ko
|
||||
*.mod
|
||||
*.mod.c
|
||||
conftest/
|
||||
conftest[0-9]*.c
|
||||
modules.order
|
||||
Module.symvers
|
||||
nv_compiler.h
|
245
kernel-open/Kbuild
Normal file
245
kernel-open/Kbuild
Normal file
@ -0,0 +1,245 @@
|
||||
###########################################################################
|
||||
# Kbuild file for NVIDIA Linux GPU driver kernel modules
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# The parent makefile is expected to define:
|
||||
#
|
||||
# NV_KERNEL_SOURCES : The root of the kernel source tree.
|
||||
# NV_KERNEL_OUTPUT : The kernel's output tree.
|
||||
# NV_KERNEL_MODULES : A whitespace-separated list of modules to build.
|
||||
# ARCH : The target CPU architecture: x86_64|arm64|powerpc
|
||||
#
|
||||
# Kbuild provides the variables:
|
||||
#
|
||||
# $(src) : The directory containing this Kbuild file.
|
||||
# $(obj) : The directory where the output from this build is written.
|
||||
#
|
||||
|
||||
NV_BUILD_TYPE ?= release
|
||||
|
||||
#
|
||||
# Utility macro ASSIGN_PER_OBJ_CFLAGS: to control CFLAGS on a
|
||||
# per-object basis, Kbuild honors the 'CFLAGS_$(object)' variable.
|
||||
# E.g., "CFLAGS_nv.o" for CFLAGS that are specific to nv.o. Use this
|
||||
# macro to assign 'CFLAGS_$(object)' variables for multiple object
|
||||
# files.
|
||||
#
|
||||
# $(1): The object files.
|
||||
# $(2): The CFLAGS to add for those object files.
|
||||
#
|
||||
# With kernel git commit 54b8ae66ae1a3454a7645d159a482c31cd89ab33, the
|
||||
# handling of object-specific CFLAGs, CFLAGS_$(object) has changed. Prior to
|
||||
# this commit, the CFLAGS_$(object) variable was required to be defined with
|
||||
# only the the object name (<CFLAGS_somefile.o>). With the aforementioned git
|
||||
# commit, it is now required to give Kbuild relative paths along-with the
|
||||
# object name (CFLAGS_<somepath>/somefile.o>). As a result, CFLAGS_$(object)
|
||||
# is set twice, once with a relative path to the object files and once with
|
||||
# just the object files.
|
||||
#
|
||||
ASSIGN_PER_OBJ_CFLAGS = \
|
||||
$(foreach _cflags_variable, \
|
||||
$(notdir $(1)) $(1), \
|
||||
$(eval $(addprefix CFLAGS_,$(_cflags_variable)) += $(2)))
|
||||
|
||||
|
||||
#
|
||||
# Include the specifics of the individual NVIDIA kernel modules.
|
||||
#
|
||||
# Each of these should:
|
||||
# - Append to 'obj-m', to indicate the kernel module that should be built.
|
||||
# - Define the object files that should get built to produce the kernel module.
|
||||
# - Tie into conftest (see the description below).
|
||||
#
|
||||
|
||||
NV_UNDEF_BEHAVIOR_SANITIZER ?=
|
||||
ifeq ($(NV_UNDEF_BEHAVIOR_SANITIZER),1)
|
||||
UBSAN_SANITIZE := y
|
||||
endif
|
||||
|
||||
$(foreach _module, $(NV_KERNEL_MODULES), \
|
||||
$(eval include $(src)/$(_module)/$(_module).Kbuild))
|
||||
|
||||
|
||||
#
|
||||
# Define CFLAGS that apply to all the NVIDIA kernel modules. EXTRA_CFLAGS
|
||||
# is deprecated since 2.6.24 in favor of ccflags-y, but we need to support
|
||||
# older kernels which do not have ccflags-y. Newer kernels append
|
||||
# $(EXTRA_CFLAGS) to ccflags-y for compatibility.
|
||||
#
|
||||
|
||||
EXTRA_CFLAGS += -I$(src)/common/inc
|
||||
EXTRA_CFLAGS += -I$(src)
|
||||
EXTRA_CFLAGS += -Wall -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error -Wno-format-extra-args
|
||||
EXTRA_CFLAGS += -D__KERNEL__ -DMODULE -DNVRM
|
||||
EXTRA_CFLAGS += -DNV_VERSION_STRING=\"515.43.04\"
|
||||
|
||||
EXTRA_CFLAGS += -Wno-unused-function
|
||||
|
||||
ifneq ($(NV_BUILD_TYPE),debug)
|
||||
EXTRA_CFLAGS += -Wuninitialized
|
||||
endif
|
||||
|
||||
EXTRA_CFLAGS += -fno-strict-aliasing
|
||||
|
||||
ifeq ($(ARCH),arm64)
|
||||
EXTRA_CFLAGS += -mstrict-align
|
||||
endif
|
||||
|
||||
ifeq ($(NV_BUILD_TYPE),debug)
|
||||
EXTRA_CFLAGS += -g -gsplit-dwarf
|
||||
endif
|
||||
|
||||
EXTRA_CFLAGS += -ffreestanding
|
||||
|
||||
ifeq ($(ARCH),arm64)
|
||||
EXTRA_CFLAGS += -mgeneral-regs-only -march=armv8-a
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
EXTRA_CFLAGS += -mno-red-zone -mcmodel=kernel
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),powerpc)
|
||||
EXTRA_CFLAGS += -mlittle-endian -mno-strict-align -mno-altivec
|
||||
endif
|
||||
|
||||
EXTRA_CFLAGS += -DNV_UVM_ENABLE
|
||||
EXTRA_CFLAGS += $(call cc-option,-Werror=undef,)
|
||||
EXTRA_CFLAGS += -DNV_SPECTRE_V2=$(NV_SPECTRE_V2)
|
||||
EXTRA_CFLAGS += -DNV_KERNEL_INTERFACE_LAYER
|
||||
|
||||
#
|
||||
# Detect SGI UV systems and apply system-specific optimizations.
|
||||
#
|
||||
|
||||
ifneq ($(wildcard /proc/sgi_uv),)
|
||||
EXTRA_CFLAGS += -DNV_CONFIG_X86_UV
|
||||
endif
|
||||
|
||||
|
||||
#
|
||||
# The conftest.sh script tests various aspects of the target kernel.
|
||||
# The per-module Kbuild files included above should:
|
||||
#
|
||||
# - Append to the NV_CONFTEST_*_COMPILE_TESTS variables to indicate
|
||||
# which conftests they require.
|
||||
# - Append to the NV_OBJECTS_DEPEND_ON_CONFTEST variable any object files
|
||||
# that depend on conftest.
|
||||
#
|
||||
# The conftest machinery below will run the requested tests and
|
||||
# generate the appropriate header files.
|
||||
#
|
||||
|
||||
CC ?= cc
|
||||
LD ?= ld
|
||||
|
||||
NV_CONFTEST_SCRIPT := $(src)/conftest.sh
|
||||
NV_CONFTEST_HEADER := $(obj)/conftest/headers.h
|
||||
|
||||
NV_CONFTEST_CMD := /bin/sh $(NV_CONFTEST_SCRIPT) \
|
||||
"$(CC)" $(ARCH) $(NV_KERNEL_SOURCES) $(NV_KERNEL_OUTPUT)
|
||||
|
||||
NV_CFLAGS_FROM_CONFTEST := $(shell $(NV_CONFTEST_CMD) build_cflags)
|
||||
|
||||
NV_CONFTEST_CFLAGS = $(NV_CFLAGS_FROM_CONFTEST) $(EXTRA_CFLAGS) -fno-pie
|
||||
|
||||
NV_CONFTEST_COMPILE_TEST_HEADERS := $(obj)/conftest/macros.h
|
||||
NV_CONFTEST_COMPILE_TEST_HEADERS += $(obj)/conftest/functions.h
|
||||
NV_CONFTEST_COMPILE_TEST_HEADERS += $(obj)/conftest/symbols.h
|
||||
NV_CONFTEST_COMPILE_TEST_HEADERS += $(obj)/conftest/types.h
|
||||
NV_CONFTEST_COMPILE_TEST_HEADERS += $(obj)/conftest/generic.h
|
||||
|
||||
NV_CONFTEST_HEADERS := $(obj)/conftest/patches.h
|
||||
NV_CONFTEST_HEADERS += $(obj)/conftest/headers.h
|
||||
NV_CONFTEST_HEADERS += $(NV_CONFTEST_COMPILE_TEST_HEADERS)
|
||||
|
||||
|
||||
#
|
||||
# Generate a header file for a single conftest compile test. Each compile test
|
||||
# header depends on conftest.sh, as well as the generated conftest/headers.h
|
||||
# file, which is included in the compile test preamble.
|
||||
#
|
||||
|
||||
$(obj)/conftest/compile-tests/%.h: $(NV_CONFTEST_SCRIPT) $(NV_CONFTEST_HEADER)
|
||||
@mkdir -p $(obj)/conftest/compile-tests
|
||||
@echo " CONFTEST: $(notdir $*)"
|
||||
@$(NV_CONFTEST_CMD) compile_tests '$(NV_CONFTEST_CFLAGS)' \
|
||||
$(notdir $*) > $@
|
||||
|
||||
#
|
||||
# Concatenate a conftest/*.h header from its constituent compile test headers
|
||||
#
|
||||
# $(1): The name of the concatenated header
|
||||
# $(2): The list of compile tests that make up the header
|
||||
#
|
||||
|
||||
define NV_GENERATE_COMPILE_TEST_HEADER
|
||||
$(obj)/conftest/$(1).h: $(addprefix $(obj)/conftest/compile-tests/,$(addsuffix .h,$(2)))
|
||||
@mkdir -p $(obj)/conftest
|
||||
@# concatenate /dev/null to prevent cat from hanging when $$^ is empty
|
||||
@cat $$^ /dev/null > $$@
|
||||
endef
|
||||
|
||||
#
|
||||
# Generate the conftest compile test headers from the lists of compile tests
|
||||
# provided by the module-specific Kbuild files.
|
||||
#
|
||||
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS ?=
|
||||
NV_CONFTEST_GENERIC_COMPILE_TESTS ?=
|
||||
NV_CONFTEST_MACRO_COMPILE_TESTS ?=
|
||||
NV_CONFTEST_SYMBOL_COMPILE_TESTS ?=
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS ?=
|
||||
|
||||
$(eval $(call NV_GENERATE_COMPILE_TEST_HEADER,functions,$(NV_CONFTEST_FUNCTION_COMPILE_TESTS)))
|
||||
$(eval $(call NV_GENERATE_COMPILE_TEST_HEADER,generic,$(NV_CONFTEST_GENERIC_COMPILE_TESTS)))
|
||||
$(eval $(call NV_GENERATE_COMPILE_TEST_HEADER,macros,$(NV_CONFTEST_MACRO_COMPILE_TESTS)))
|
||||
$(eval $(call NV_GENERATE_COMPILE_TEST_HEADER,symbols,$(NV_CONFTEST_SYMBOL_COMPILE_TESTS)))
|
||||
$(eval $(call NV_GENERATE_COMPILE_TEST_HEADER,types,$(NV_CONFTEST_TYPE_COMPILE_TESTS)))
|
||||
|
||||
$(obj)/conftest/patches.h: $(NV_CONFTEST_SCRIPT)
|
||||
@mkdir -p $(obj)/conftest
|
||||
@$(NV_CONFTEST_CMD) patch_check > $@
|
||||
|
||||
$(obj)/conftest/headers.h: $(NV_CONFTEST_SCRIPT)
|
||||
@mkdir -p $(obj)/conftest
|
||||
@$(NV_CONFTEST_CMD) test_kernel_headers '$(NV_CONFTEST_CFLAGS)' > $@
|
||||
|
||||
clean-dirs := $(obj)/conftest
|
||||
|
||||
|
||||
# For any object files that depend on conftest, declare the dependency here.
|
||||
$(addprefix $(obj)/,$(NV_OBJECTS_DEPEND_ON_CONFTEST)): | $(NV_CONFTEST_HEADERS)
|
||||
|
||||
# Sanity checks of the build environment and target system/kernel
|
||||
|
||||
BUILD_SANITY_CHECKS = \
|
||||
cc_sanity_check \
|
||||
cc_version_check \
|
||||
dom0_sanity_check \
|
||||
xen_sanity_check \
|
||||
preempt_rt_sanity_check \
|
||||
vgpu_kvm_sanity_check \
|
||||
module_symvers_sanity_check
|
||||
|
||||
.PHONY: $(BUILD_SANITY_CHECKS)
|
||||
|
||||
$(BUILD_SANITY_CHECKS):
|
||||
@$(NV_CONFTEST_CMD) $@ full_output
|
||||
|
||||
# Perform all sanity checks before generating the conftest headers
|
||||
|
||||
$(NV_CONFTEST_HEADERS): | $(BUILD_SANITY_CHECKS)
|
||||
|
||||
# Make the conftest headers depend on the kernel version string
|
||||
|
||||
$(obj)/conftest/uts_release: NV_GENERATE_UTS_RELEASE
|
||||
@mkdir -p $(dir $@)
|
||||
@NV_UTS_RELEASE="// Kernel version: `$(NV_CONFTEST_CMD) compile_tests '$(NV_CONFTEST_CFLAGS)' uts_release`"; \
|
||||
if ! [ -f "$@" ] || [ "$$NV_UTS_RELEASE" != "`cat $@`" ]; \
|
||||
then echo "$$NV_UTS_RELEASE" > $@; fi
|
||||
|
||||
.PHONY: NV_GENERATE_UTS_RELEASE
|
||||
|
||||
$(NV_CONFTEST_HEADERS): $(obj)/conftest/uts_release
|
126
kernel-open/Makefile
Normal file
126
kernel-open/Makefile
Normal file
@ -0,0 +1,126 @@
|
||||
#
|
||||
# This Makefile was automatically generated; do not edit.
|
||||
#
|
||||
|
||||
###########################################################################
|
||||
# Makefile for NVIDIA Linux GPU driver kernel modules
|
||||
###########################################################################
|
||||
|
||||
# This makefile is read twice: when a user or nvidia-installer invokes
|
||||
# 'make', this file is read. It then invokes the Linux kernel's
|
||||
# Kbuild. Modern versions of Kbuild will then read the Kbuild file in
|
||||
# this directory. However, old versions of Kbuild will instead read
|
||||
# this Makefile. For backwards compatibility, when read by Kbuild
|
||||
# (recognized by KERNELRELEASE not being empty), do nothing but
|
||||
# include the Kbuild file in this directory.
|
||||
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
include $(src)/Kbuild
|
||||
else
|
||||
|
||||
# Determine the location of the Linux kernel source tree, and of the
|
||||
# kernel's output tree. Use this to invoke Kbuild, and pass the paths
|
||||
# to the source and output trees to NVIDIA's Kbuild file via
|
||||
# NV_KERNEL_{SOURCES,OUTPUT}.
|
||||
|
||||
ifdef SYSSRC
|
||||
KERNEL_SOURCES := $(SYSSRC)
|
||||
else
|
||||
KERNEL_UNAME ?= $(shell uname -r)
|
||||
KERNEL_MODLIB := /lib/modules/$(KERNEL_UNAME)
|
||||
KERNEL_SOURCES := $(shell test -d $(KERNEL_MODLIB)/source && echo $(KERNEL_MODLIB)/source || echo $(KERNEL_MODLIB)/build)
|
||||
endif
|
||||
|
||||
KERNEL_OUTPUT := $(KERNEL_SOURCES)
|
||||
KBUILD_PARAMS :=
|
||||
|
||||
ifdef SYSOUT
|
||||
ifneq ($(SYSOUT), $(KERNEL_SOURCES))
|
||||
KERNEL_OUTPUT := $(SYSOUT)
|
||||
KBUILD_PARAMS := KBUILD_OUTPUT=$(KERNEL_OUTPUT)
|
||||
endif
|
||||
else
|
||||
KERNEL_UNAME ?= $(shell uname -r)
|
||||
KERNEL_MODLIB := /lib/modules/$(KERNEL_UNAME)
|
||||
ifeq ($(KERNEL_SOURCES), $(KERNEL_MODLIB)/source)
|
||||
KERNEL_OUTPUT := $(KERNEL_MODLIB)/build
|
||||
KBUILD_PARAMS := KBUILD_OUTPUT=$(KERNEL_OUTPUT)
|
||||
endif
|
||||
endif
|
||||
|
||||
CC ?= cc
|
||||
LD ?= ld
|
||||
OBJDUMP ?= objdump
|
||||
|
||||
ifndef ARCH
|
||||
ARCH := $(shell uname -m | sed -e 's/i.86/i386/' \
|
||||
-e 's/armv[0-7]\w\+/arm/' \
|
||||
-e 's/aarch64/arm64/' \
|
||||
-e 's/ppc64le/powerpc/' \
|
||||
)
|
||||
endif
|
||||
|
||||
NV_KERNEL_MODULES ?= $(wildcard nvidia nvidia-uvm nvidia-vgpu-vfio nvidia-modeset nvidia-drm nvidia-peermem)
|
||||
NV_KERNEL_MODULES := $(filter-out $(NV_EXCLUDE_KERNEL_MODULES), \
|
||||
$(NV_KERNEL_MODULES))
|
||||
NV_VERBOSE ?=
|
||||
SPECTRE_V2_RETPOLINE ?= 0
|
||||
|
||||
ifeq ($(NV_VERBOSE),1)
|
||||
KBUILD_PARAMS += V=1
|
||||
endif
|
||||
KBUILD_PARAMS += -C $(KERNEL_SOURCES) M=$(CURDIR)
|
||||
KBUILD_PARAMS += ARCH=$(ARCH)
|
||||
KBUILD_PARAMS += NV_KERNEL_SOURCES=$(KERNEL_SOURCES)
|
||||
KBUILD_PARAMS += NV_KERNEL_OUTPUT=$(KERNEL_OUTPUT)
|
||||
KBUILD_PARAMS += NV_KERNEL_MODULES="$(NV_KERNEL_MODULES)"
|
||||
KBUILD_PARAMS += INSTALL_MOD_DIR=kernel/drivers/video
|
||||
KBUILD_PARAMS += NV_SPECTRE_V2=$(SPECTRE_V2_RETPOLINE)
|
||||
|
||||
.PHONY: modules module clean clean_conftest modules_install
|
||||
modules clean modules_install:
|
||||
@$(MAKE) "LD=$(LD)" "CC=$(CC)" "OBJDUMP=$(OBJDUMP)" $(KBUILD_PARAMS) $@
|
||||
@if [ "$@" = "modules" ]; then \
|
||||
for module in $(NV_KERNEL_MODULES); do \
|
||||
if [ -x split-object-file.sh ]; then \
|
||||
./split-object-file.sh $$module.ko; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
# Compatibility target for scripts that may be directly calling the
|
||||
# "module" target from the old build system.
|
||||
|
||||
module: modules
|
||||
|
||||
# Check if the any of kernel module linker scripts exist. If they do, pass
|
||||
# them as linker options (via variable NV_MODULE_LD_SCRIPTS) while building
|
||||
# the kernel interface object files. These scripts do some processing on the
|
||||
# module symbols on which the Linux kernel's module resolution is dependent
|
||||
# and hence must be used whenever present.
|
||||
|
||||
LD_SCRIPT ?= $(KERNEL_SOURCES)/scripts/module-common.lds \
|
||||
$(KERNEL_SOURCES)/arch/$(ARCH)/kernel/module.lds \
|
||||
$(KERNEL_OUTPUT)/scripts/module.lds
|
||||
NV_MODULE_COMMON_SCRIPTS := $(foreach s, $(wildcard $(LD_SCRIPT)), -T $(s))
|
||||
|
||||
# Use $* to match the stem % in the kernel interface file %-linux.o. Replace
|
||||
# "nv" with "nvidia" in $* as appropriate: e.g. nv-modeset-linux.o links
|
||||
# nvidia-modeset.mod.o and nvidia-modeset/nv-modeset-interface.o. The kernel
|
||||
# interface file must have the .mod.o object linked into it: otherwise, the
|
||||
# kernel module produced by linking the interface against its corresponding
|
||||
# core object file will not be loadable. The .mod.o file is built as part of
|
||||
# the MODPOST process (stage 2), so the rule to build the kernel interface
|
||||
# cannot be defined in the *Kbuild files, which are only used during stage 1.
|
||||
|
||||
%-linux.o: modules
|
||||
$(LD) $(NV_MODULE_COMMON_SCRIPTS) -r -o $@ \
|
||||
$(subst nv,nvidia,$*).mod.o $(subst nv,nvidia,$*)/$*-interface.o
|
||||
|
||||
# Kbuild's "clean" rule won't clean up the conftest headers on its own, and
|
||||
# clean-dirs doesn't appear to work as advertised.
|
||||
clean_conftest:
|
||||
$(RM) -r conftest
|
||||
clean: clean_conftest
|
||||
|
||||
endif # KERNELRELEASE
|
34
kernel-open/common/inc/conftest.h
Normal file
34
kernel-open/common/inc/conftest.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2014 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _CONFTEST_H
|
||||
#define _CONFTEST_H
|
||||
|
||||
#include "conftest/headers.h"
|
||||
#include "conftest/functions.h"
|
||||
#include "conftest/generic.h"
|
||||
#include "conftest/macros.h"
|
||||
#include "conftest/symbols.h"
|
||||
#include "conftest/types.h"
|
||||
|
||||
#endif
|
459
kernel-open/common/inc/cpuopsys.h
Normal file
459
kernel-open/common/inc/cpuopsys.h
Normal file
@ -0,0 +1,459 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2018-2018 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*! \brief
|
||||
* Define compile time symbols for CPU type and operating system type.
|
||||
* This file should only contain preprocessor commands so that
|
||||
* there are no dependencies on other files.
|
||||
*
|
||||
* cpuopsys.h
|
||||
*
|
||||
* Copyright (c) 2001, Nvidia Corporation. All rights reserved.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Uniform names are defined for compile time options to distinguish
|
||||
* CPU types and Operating systems.
|
||||
* Distinctions between CPU and OpSys should be orthogonal.
|
||||
*
|
||||
* These uniform names have initially been defined by keying off the
|
||||
* makefile/build names defined for builds in the OpenGL group.
|
||||
* Getting the uniform names defined for other builds may require
|
||||
* different qualifications.
|
||||
*
|
||||
* The file is placed here to allow for the possibility of all driver
|
||||
* components using the same naming convention for conditional compilation.
|
||||
*/
|
||||
|
||||
#ifndef CPUOPSYS_H
|
||||
#define CPUOPSYS_H
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Define all OS/CPU-Chip related symbols */
|
||||
|
||||
/* ***** WINDOWS variations */
|
||||
#if defined(_WIN32) || defined(_WIN16)
|
||||
# define NV_WINDOWS
|
||||
|
||||
# if defined(_WIN32_WINNT)
|
||||
# define NV_WINDOWS_NT
|
||||
# elif defined(_WIN32_WCE)
|
||||
# define NV_WINDOWS_CE
|
||||
# elif !defined(NV_MODS)
|
||||
# define NV_WINDOWS_9X
|
||||
# endif
|
||||
#endif /* _WIN32 || defined(_WIN16) */
|
||||
|
||||
/* ***** Unix variations */
|
||||
#if defined(__linux__) && !defined(NV_LINUX) && !defined(NV_VMWARE)
|
||||
# define NV_LINUX
|
||||
#endif /* defined(__linux__) */
|
||||
|
||||
#if defined(__VMWARE__) && !defined(NV_VMWARE)
|
||||
# define NV_VMWARE
|
||||
#endif /* defined(__VMWARE__) */
|
||||
|
||||
/* SunOS + gcc */
|
||||
#if defined(__sun__) && defined(__svr4__) && !defined(NV_SUNOS)
|
||||
# define NV_SUNOS
|
||||
#endif /* defined(__sun__) && defined(__svr4__) */
|
||||
|
||||
/* SunOS + Sun Compiler (named SunPro, Studio or Forte) */
|
||||
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
# define NV_SUNPRO_C
|
||||
# define NV_SUNOS
|
||||
#endif /* defined(_SUNPRO_C) || defined(__SUNPRO_CC) */
|
||||
|
||||
#if defined(__FreeBSD__) && !defined(NV_BSD)
|
||||
# define NV_BSD
|
||||
#endif /* defined(__FreeBSD__) */
|
||||
|
||||
/* XXXar don't define NV_UNIX on MacOSX or vxworks or QNX */
|
||||
#if (defined(__unix__) || defined(__unix) || defined(__INTEGRITY) ) && !defined(nvmacosx) && !defined(vxworks) && !defined(NV_UNIX) && !defined(__QNX__) && !defined(__QNXNTO__)/* XXX until removed from Makefiles */
|
||||
# define NV_UNIX
|
||||
#endif /* defined(__unix__) */
|
||||
|
||||
#if (defined(__QNX__) || defined(__QNXNTO__)) && !defined(NV_QNX)
|
||||
# define NV_QNX
|
||||
#endif
|
||||
|
||||
#if (defined(__ANDROID__) || defined(ANDROID)) && !defined(NV_ANDROID)
|
||||
# define NV_ANDROID
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(DceCore) && !defined(NV_DCECORE)
|
||||
# define NV_DCECORE
|
||||
#endif
|
||||
|
||||
/* ***** Apple variations */
|
||||
#if defined(macintosh) || defined(__APPLE__)
|
||||
# define NV_MACINTOSH
|
||||
# if defined(__MACH__)
|
||||
# define NV_MACINTOSH_OSX
|
||||
# else
|
||||
# define NV_MACINTOSH_OS9
|
||||
# endif
|
||||
# if defined(__LP64__)
|
||||
# define NV_MACINTOSH_64
|
||||
# endif
|
||||
#endif /* defined(macintosh) */
|
||||
|
||||
/* ***** VxWorks */
|
||||
/* Tornado 2.21 is gcc 2.96 and #defines __vxworks. */
|
||||
/* Tornado 2.02 is gcc 2.7.2 and doesn't define any OS symbol, so we rely on */
|
||||
/* the build system #defining vxworks. */
|
||||
#if defined(__vxworks) || defined(vxworks)
|
||||
# define NV_VXWORKS
|
||||
#endif
|
||||
|
||||
/* ***** Integrity OS */
|
||||
#if defined(__INTEGRITY)
|
||||
# if !defined(NV_INTEGRITY)
|
||||
# define NV_INTEGRITY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* ***** Processor type variations */
|
||||
/* Note: The prefix NV_CPU_* is taken by Nvcm.h */
|
||||
|
||||
#if ((defined(_M_IX86) || defined(__i386__) || defined(__i386)) && !defined(NVCPU_X86)) /* XXX until removed from Makefiles */
|
||||
/* _M_IX86 for windows, __i386__ for Linux (or any x86 using gcc) */
|
||||
/* __i386 for Studio compiler on Solaris x86 */
|
||||
# define NVCPU_X86 /* any IA32 machine (not x86-64) */
|
||||
# define NVCPU_MIN_PAGE_SHIFT 12
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(_M_IA64)
|
||||
# define NVCPU_IA64_WINDOWS /* any IA64 for Windows opsys */
|
||||
#endif
|
||||
#if defined(NV_LINUX) && defined(__ia64__)
|
||||
# define NVCPU_IA64_LINUX /* any IA64 for Linux opsys */
|
||||
#endif
|
||||
#if defined(NVCPU_IA64_WINDOWS) || defined(NVCPU_IA64_LINUX) || defined(IA64)
|
||||
# define NVCPU_IA64 /* any IA64 for any opsys */
|
||||
#endif
|
||||
|
||||
#if (defined(NV_MACINTOSH) && !(defined(__i386__) || defined(__x86_64__))) || defined(__PPC__) || defined(__ppc)
|
||||
# if defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
|
||||
# ifndef NVCPU_PPC64LE
|
||||
# define NVCPU_PPC64LE /* PPC 64-bit little endian */
|
||||
# endif
|
||||
# else
|
||||
# ifndef NVCPU_PPC
|
||||
# define NVCPU_PPC /* any non-PPC64LE PowerPC architecture */
|
||||
# endif
|
||||
# ifndef NV_BIG_ENDIAN
|
||||
# define NV_BIG_ENDIAN
|
||||
# endif
|
||||
# endif
|
||||
# define NVCPU_FAMILY_PPC
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
|
||||
# define NVCPU_X86_64 /* any x86-64 for any opsys */
|
||||
#endif
|
||||
|
||||
#if defined(NVCPU_X86) || defined(NVCPU_X86_64)
|
||||
# define NVCPU_FAMILY_X86
|
||||
#endif
|
||||
|
||||
#if defined(__riscv) && (__riscv_xlen==64)
|
||||
# define NVCPU_RISCV64
|
||||
# if defined(__nvriscv)
|
||||
# define NVCPU_NVRISCV64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__arm__) || defined(_M_ARM)
|
||||
/*
|
||||
* 32-bit instruction set on, e.g., ARMv7 or AArch32 execution state
|
||||
* on ARMv8
|
||||
*/
|
||||
# define NVCPU_ARM
|
||||
# define NVCPU_MIN_PAGE_SHIFT 12
|
||||
#endif
|
||||
|
||||
#if defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
|
||||
# define NVCPU_AARCH64 /* 64-bit A64 instruction set on ARMv8 */
|
||||
# define NVCPU_MIN_PAGE_SHIFT 12
|
||||
#endif
|
||||
|
||||
#if defined(NVCPU_ARM) || defined(NVCPU_AARCH64)
|
||||
# define NVCPU_FAMILY_ARM
|
||||
#endif
|
||||
|
||||
#if defined(__SH4__)
|
||||
# ifndef NVCPU_SH4
|
||||
# define NVCPU_SH4 /* Renesas (formerly Hitachi) SH4 */
|
||||
# endif
|
||||
# if defined NV_WINDOWS_CE
|
||||
# define NVCPU_MIN_PAGE_SHIFT 12
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* For Xtensa processors */
|
||||
#if defined(__XTENSA__)
|
||||
# define NVCPU_XTENSA
|
||||
# if defined(__XTENSA_EB__)
|
||||
# define NV_BIG_ENDIAN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Other flavors of CPU type should be determined at run-time.
|
||||
* For example, an x86 architecture with/without SSE.
|
||||
* If it can compile, then there's no need for a compile time option.
|
||||
* For some current GCC limitations, these may be fixed by using the Intel
|
||||
* compiler for certain files in a Linux build.
|
||||
*/
|
||||
|
||||
/* The minimum page size can be determined from the minimum page shift */
|
||||
#if defined(NVCPU_MIN_PAGE_SHIFT)
|
||||
#define NVCPU_MIN_PAGE_SIZE (1 << NVCPU_MIN_PAGE_SHIFT)
|
||||
#endif
|
||||
|
||||
#if defined(NVCPU_IA64) || defined(NVCPU_X86_64) || \
|
||||
defined(NV_MACINTOSH_64) || defined(NVCPU_AARCH64) || \
|
||||
defined(NVCPU_PPC64LE) || defined(NVCPU_RISCV64)
|
||||
# define NV_64_BITS /* all architectures where pointers are 64 bits */
|
||||
#else
|
||||
/* we assume 32 bits. I don't see a need for NV_16_BITS. */
|
||||
#endif
|
||||
|
||||
/* For verification-only features not intended to be included in normal drivers */
|
||||
#if (defined(NV_MODS) || defined(NV_GSP_MODS)) && defined(DEBUG) && !defined(DISABLE_VERIF_FEATURES)
|
||||
#define NV_VERIF_FEATURES
|
||||
#endif
|
||||
|
||||
/*
|
||||
* New, safer family of #define's -- these ones use 0 vs. 1 rather than
|
||||
* defined/!defined. This is advantageous because if you make a typo,
|
||||
* say misspelled ENDIAN:
|
||||
*
|
||||
* #if NVCPU_IS_BIG_ENDAIN
|
||||
*
|
||||
* ...some compilers can give you a warning telling you that you screwed up.
|
||||
* The compiler can also give you a warning if you forget to #include
|
||||
* "cpuopsys.h" in your code before the point where you try to use these
|
||||
* conditionals.
|
||||
*
|
||||
* Also, the names have been prefixed in more cases with "CPU" or "OS" for
|
||||
* increased clarity. You can tell the names apart from the old ones because
|
||||
* they all use "_IS_" in the name.
|
||||
*
|
||||
* Finally, these can be used in "if" statements and not just in #if's. For
|
||||
* example:
|
||||
*
|
||||
* if (NVCPU_IS_BIG_ENDIAN) x = Swap32(x);
|
||||
*
|
||||
* Maybe some day in the far-off future these can replace the old #define's.
|
||||
*/
|
||||
|
||||
#if defined(NV_MODS)
|
||||
#define NV_IS_MODS 1
|
||||
#else
|
||||
#define NV_IS_MODS 0
|
||||
#endif
|
||||
|
||||
#if defined(NV_GSP_MODS)
|
||||
#define NV_IS_GSP_MODS 1
|
||||
#else
|
||||
#define NV_IS_GSP_MODS 0
|
||||
#endif
|
||||
|
||||
#if defined(NV_WINDOWS)
|
||||
#define NVOS_IS_WINDOWS 1
|
||||
#else
|
||||
#define NVOS_IS_WINDOWS 0
|
||||
#endif
|
||||
#if defined(NV_WINDOWS_CE)
|
||||
#define NVOS_IS_WINDOWS_CE 1
|
||||
#else
|
||||
#define NVOS_IS_WINDOWS_CE 0
|
||||
#endif
|
||||
#if defined(NV_LINUX)
|
||||
#define NVOS_IS_LINUX 1
|
||||
#else
|
||||
#define NVOS_IS_LINUX 0
|
||||
#endif
|
||||
#if defined(NV_UNIX)
|
||||
#define NVOS_IS_UNIX 1
|
||||
#else
|
||||
#define NVOS_IS_UNIX 0
|
||||
#endif
|
||||
#if defined(NV_BSD)
|
||||
#define NVOS_IS_FREEBSD 1
|
||||
#else
|
||||
#define NVOS_IS_FREEBSD 0
|
||||
#endif
|
||||
#if defined(NV_SUNOS)
|
||||
#define NVOS_IS_SOLARIS 1
|
||||
#else
|
||||
#define NVOS_IS_SOLARIS 0
|
||||
#endif
|
||||
#if defined(NV_VMWARE)
|
||||
#define NVOS_IS_VMWARE 1
|
||||
#else
|
||||
#define NVOS_IS_VMWARE 0
|
||||
#endif
|
||||
#if defined(NV_QNX)
|
||||
#define NVOS_IS_QNX 1
|
||||
#else
|
||||
#define NVOS_IS_QNX 0
|
||||
#endif
|
||||
#if defined(NV_ANDROID)
|
||||
#define NVOS_IS_ANDROID 1
|
||||
#else
|
||||
#define NVOS_IS_ANDROID 0
|
||||
#endif
|
||||
#if defined(NV_MACINTOSH)
|
||||
#define NVOS_IS_MACINTOSH 1
|
||||
#else
|
||||
#define NVOS_IS_MACINTOSH 0
|
||||
#endif
|
||||
#if defined(NV_VXWORKS)
|
||||
#define NVOS_IS_VXWORKS 1
|
||||
#else
|
||||
#define NVOS_IS_VXWORKS 0
|
||||
#endif
|
||||
#if defined(NV_LIBOS)
|
||||
#define NVOS_IS_LIBOS 1
|
||||
#else
|
||||
#define NVOS_IS_LIBOS 0
|
||||
#endif
|
||||
#if defined(NV_INTEGRITY)
|
||||
#define NVOS_IS_INTEGRITY 1
|
||||
#else
|
||||
#define NVOS_IS_INTEGRITY 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(NVCPU_X86)
|
||||
#define NVCPU_IS_X86 1
|
||||
#else
|
||||
#define NVCPU_IS_X86 0
|
||||
#endif
|
||||
#if defined(NVCPU_RISCV64)
|
||||
#define NVCPU_IS_RISCV64 1
|
||||
#else
|
||||
#define NVCPU_IS_RISCV64 0
|
||||
#endif
|
||||
#if defined(NVCPU_NVRISCV64)
|
||||
#define NVCPU_IS_NVRISCV64 1
|
||||
#else
|
||||
#define NVCPU_IS_NVRISCV64 0
|
||||
#endif
|
||||
#if defined(NVCPU_IA64)
|
||||
#define NVCPU_IS_IA64 1
|
||||
#else
|
||||
#define NVCPU_IS_IA64 0
|
||||
#endif
|
||||
#if defined(NVCPU_X86_64)
|
||||
#define NVCPU_IS_X86_64 1
|
||||
#else
|
||||
#define NVCPU_IS_X86_64 0
|
||||
#endif
|
||||
#if defined(NVCPU_FAMILY_X86)
|
||||
#define NVCPU_IS_FAMILY_X86 1
|
||||
#else
|
||||
#define NVCPU_IS_FAMILY_X86 0
|
||||
#endif
|
||||
#if defined(NVCPU_PPC)
|
||||
#define NVCPU_IS_PPC 1
|
||||
#else
|
||||
#define NVCPU_IS_PPC 0
|
||||
#endif
|
||||
#if defined(NVCPU_PPC64LE)
|
||||
#define NVCPU_IS_PPC64LE 1
|
||||
#else
|
||||
#define NVCPU_IS_PPC64LE 0
|
||||
#endif
|
||||
#if defined(NVCPU_FAMILY_PPC)
|
||||
#define NVCPU_IS_FAMILY_PPC 1
|
||||
#else
|
||||
#define NVCPU_IS_FAMILY_PPC 0
|
||||
#endif
|
||||
#if defined(NVCPU_ARM)
|
||||
#define NVCPU_IS_ARM 1
|
||||
#else
|
||||
#define NVCPU_IS_ARM 0
|
||||
#endif
|
||||
#if defined(NVCPU_AARCH64)
|
||||
#define NVCPU_IS_AARCH64 1
|
||||
#else
|
||||
#define NVCPU_IS_AARCH64 0
|
||||
#endif
|
||||
#if defined(NVCPU_FAMILY_ARM)
|
||||
#define NVCPU_IS_FAMILY_ARM 1
|
||||
#else
|
||||
#define NVCPU_IS_FAMILY_ARM 0
|
||||
#endif
|
||||
#if defined(NVCPU_SH4)
|
||||
#define NVCPU_IS_SH4 1
|
||||
#else
|
||||
#define NVCPU_IS_SH4 0
|
||||
#endif
|
||||
#if defined(NVCPU_XTENSA)
|
||||
#define NVCPU_IS_XTENSA 1
|
||||
#else
|
||||
#define NVCPU_IS_XTENSA 0
|
||||
#endif
|
||||
#if defined(NV_BIG_ENDIAN)
|
||||
#define NVCPU_IS_BIG_ENDIAN 1
|
||||
#else
|
||||
#define NVCPU_IS_BIG_ENDIAN 0
|
||||
#endif
|
||||
#if defined(NV_64_BITS)
|
||||
#define NVCPU_IS_64_BITS 1
|
||||
#else
|
||||
#define NVCPU_IS_64_BITS 0
|
||||