soc/amd: Implement common reset API
[coreboot.git] / Documentation / getting_started / gerrit_guidelines.md
blob9210c8448e1fad129cf1c266d71fb93dea2acdb2
1 coreboot Gerrit Etiquette and Guidelines
2 ========================================
4 The following rules are the requirements for behavior in the coreboot
5 codebase in gerrit. These have mainly been unwritten rules up to this
6 point, and should be familiar to most users who have been active in
7 coreboot for a period of time. Following these rules will help reduce
8 friction in the community.
10 Note that as with many rules, there are exceptions. Some have been noted
11 in the 'More Detail' section. If you feel there is an exception not listed
12 here, please discuss it in the mailing list to get this document  updated.
13 Don't just assume that it's okay, even if someone on IRC says it is.
16 Summary
17 -------
18 These are the expectations for committing, reviewing, and submitting code
19 into coreboot git and gerrit. While breaking individual rules may not have
20 immediate consequences, the coreboot leadership may act on repeated or
21 flagrant violations with or without notice.
23 * Don't violate the licenses.
24 * Let non-trivial patches sit in a review state for at least 24 hours
25 before submission.
26 * Try to coordinate with platform maintainers when making changes to
27 platforms.
28 * If you give a patch a -2, you are responsible for giving concrete
29 recommendations for what could be changed to resolve the issue the patch
30 addresses.
31 * Don't modify other people's patches without their consent.
32 * Be respectful to others when commenting.
33 * Don’t submit patches that you know will break other platforms.
36 More detail
37 -----------
38 * Don't violate the licenses. If you're submitting code that you didn't
39 write yourself, make sure the license is compatible with the license of the
40 project you're submitting the changes to. If you’re submitting code that
41 you wrote that might be owned by your employer, make sure that your
42 employer is aware and you are authorized to submit the code. For
43 clarification, see the Developer's Certificate of Origin in the coreboot
44 [Signed-off-by policy](https://www.coreboot.org/Development_Guidelines#Sign-off_Procedure).
46 * Let non-trivial patches sit in a review state for at least 24 hours
47 before submission. Remember that there are coreboot developers in timezones
48 all over the world, and everyone should have a chance to contribute.
49 Trivial patches would be things like whitespace changes or spelling fixes.
50 In general, small changes that don’t impact the final binary output. The
51 24-hour period would start at submission, and would be restarted at any
52 update which significantly changes any part of the patch. Patches can be
53 'Fast-tracked' and submitted in under this 24 hour with the agreement of at
54 least 3 +2 votes.
56 * Do not +2 patches that you authored or own, even for something as trivial
57 as whitespace fixes. When working on your own patches, it’s easy to
58 overlook something like accidentally updating file permissions or git
59 submodule commit IDs. Let someone else review the patch. An exception to
60 this would be if two people worked in the patch together. If both +2 the
61 patch, that is acceptable, as each is giving a +2 to the other's work.
63 * Try to coordinate with platform maintainers and other significant
64 contributors to the code when making changes to platforms. The platform
65 maintainers are the users who initially pushed the code for that platform,
66 as well as users who have made significant changes to a platform. To find
67 out who maintains a piece of code, please use util/scripts/maintainers.go
68 or refer to the original author of the code in git log.
70 * If you give a patch a -2, you are responsible for giving concrete
71 recommendations for what could be changed to resolve the issue the patch
72 addresses. If you feel strongly that a patch should NEVER be merged, you
73 are responsible for defending your position and listening to other points
74 of view. Giving a -2 and walking away is not acceptable, and may cause your
75  -2 to be removed by the coreboot leadership after no less than a week. A
76  notification that the -2 will be removed unless there is a response will
77  be sent out at least 2 days before it is removed.
79 * Don't modify other people's patches unless you have coordinated this with
80 the owner of that patch. Not only is this considered rude, but your changes
81 could be unintentionally lost. An exception to this would be for patches
82 that have not been updated for more than 90 days. In that case, the patch
83 can be taken over if the original author does not respond to requests for
84 updates. Alternatively, a new patch can be pushed with the original
85 content, and both patches should be updated to reference the other.
87 * Be respectful to others when commenting on patches. Comments should
88 be kept to the code, and should be kept in a polite tone. We are a
89 worldwide community and English is a difficult language. Assume your
90 colleagues are intelligent and do not intend disrespect. Resist the urge to
91 retaliate against perceived verbal misconduct, such behavior is not
92 conducive to getting patches merged.
94 * Don’t submit code that you know will break other platforms. If your patch
95 affects code that is used by other platforms, it should be compatible with
96 those platforms. While it would be nice to update any other platforms, you
97 must at least provide a path that will allow other platforms to continue
98 working.
101 Recommendations for gerrit activity
102 -----------------------------------
103 These guidelines are less strict than the ones listed above. These are more
104 of the “good idea” variety. You are requested to follow the below
105 guidelines, but there will probably be no actual consequences if they’re
106 not followed. That said, following the recommendations below will speed up
107 review of your patches, and make the members of the community do less work.
109 * Each patch should be kept to one logical change, which should be
110 described in the title of the patch. Unrelated changes should be split out
111 into separate patches. Fixing whitespace on a line you’re editing is
112 reasonable. Fixing whitespace around the code you’re working on should be a
113 separate ‘cleanup’ patch. Larger patches that touch several areas are fine,
114 so long as they are one logical change. Adding new chips and doing code
115 cleanup over wide areas are two examples of this.
117 * Test your patches before submitting them to gerrit. It's also appreciated
118 if you add a line to the commit message describing how the patch was
119 tested. This prevents people from having to ask whether and how the patch
120 was tested. Examples of this sort of comment would be ‘TEST=Built
121 platform’ or ‘Tested by building and booting platform’.  Stating that the
122 patch was not tested is also fine, although you might be asked to do some
123 testing in cases where that would be reasonable.
125 * Take advantage of the lint tools to make sure your patches don’t contain
126 trivial mistakes. By running ‘make gitconfig’, the lint-stable tools are
127 automatically put in place and will test your patches before they are
128 committed. As a violation of these tools will cause the jenkins build test
129 to fail, it’s to your advantage to test this before pushing to gerrit.
131 * Don't submit patch trains longer than around 20 patches unless you
132 understand how to manage long patch trains. Long patch trains can become
133 difficult to handle and tie up the build servers for long periods of time
134 if not managed well. Rebasing a patch train over and over as you fix
135 earlier patches in the train can hide comments, and make people review the
136 code multiple times to see if anything has changed between revisions. When
137 pushing long patch trains, it is recommended to only push the full patch
138 train once - the initial time, and only to rebase three or four patches at
139 a time.
141 * Run 'make what-jenkins-does' locally on patch trains before submitting.
142 This helps verify that the patch train won’t tie up the jenkins builders
143 for no reason if there are failing patches in the train. For running
144 parallel builds, you can specify the number of cores to use by setting the
145 the CPUS environment variable. Example:
146         make what-jenkins-does CPUS=8
148 * Use a topic when pushing a train of patches. This groups the commits
149 together so people can easily see the connection at the top level of
150 gerrit. Topics can be set for individual patches in gerrit by going into
151 the patch and clicking on the icon next to the topic line. Topics can also
152 be set when you push the patches into gerrit. For example, to push a set of
153 commits with the the i915-kernel-x60 set, use the command:
154         git push origin HEAD:refs/for/master/i915-kernel-x60
156 * If one of your patches isn't ready to be merged, make sure it's obvious
157 that you don't feel it's ready for merge yet. The preferred way to show
158 this is by marking in the commit message that it’s not ready until X. The
159 commit message can be updated easily when it’s ready to be pushed.
160 Examples of this are "WIP: title" or "[NEEDS_TEST]: title".  Another way to
161 mark the patch as not ready would be to give it a -1 or -2 review, but
162 isn't as obvious as the commit message. These patches can also be pushed as
163 drafts as shown in the next guideline.
165 * When pushing patches that are not for submission, these should be marked
166 as such. This can be done in the title ‘[DONOTSUBMIT]’, or can be pushed as
167 draft commits, so that only explicitly added reviewers will see them. These
168 sorts of patches are frequently posted as ideas or RFCs for the community
169 to look at. To push a draft, use the command:
170         git push origin HEAD:refs/for/master%private,wip
172 * Respond to anyone who has taken the time to review your patches, even if
173 it's just to say that you disagree. While it may seem annoying to address a
174 request to fix spelling or 'trivial' issues, it’s generally easy to handle
175 in gerrit’s built-in editor. If you do use the built-in editor, remember to
176 get that change to your local copy before re-pushing. It's also acceptable
177 to add fixes for these sorts of comments to another patch, but it's
178 recommended that that patch be pushed to gerrit before the initial patch
179 gets submitted.
181 * Consider breaking up large individual patches into smaller patches
182 grouped by areas. This makes the patches easier to review, but increases
183 the number of patches. The way you want to handle this is a personal
184 decision, as long as each patch is still one logical change.
186 * If you have an interest in a particular area or mainboard, set yourself
187 up as a ‘maintainer’ of that area by adding yourself to the MAINTAINERS
188 file in the coreboot root directory. Eventually, this should automatically
189 add you as a reviewer when an area that you’re listed as a maintainer is
190 changed.
192 * Submit mainboards that you’re working on to the board-status repo. This
193 helps others and shows that these mainboards are currently being
194 maintained. At some point, boards that are not up to date in the
195 board-status repo will probably end up getting removed from the coreboot
196 master branch.
198 * Abandon patches that are no longer useful, or that you don’t intend to
199 keep working on to get submitted.
201 * Bring attention to patches that you would like reviewed. Add reviewers,
202 ask for reviewers on IRC or even just rebase it against the current
203 codebase to bring it to the top of the gerrit list. If you’re not sure who
204 would be a good reviewer, look in the MAINTAINERS file or git history of
205 the files that you’ve changed, and add those people.
207 * Familiarize yourself with the coreboot [commit message
208 guidelines](https://www.coreboot.org/Git#Commit_messages), before pushing
209 patches. This will help to keep annoying requests to fix your commit
210 message to a minimum.
212 * If there have been comments or discussion on a patch, verify that the
213 comments have been addressed before giving a +2. If you feel that a comment
214 is invalid, please respond to that comment instead of just ignoring it.
216 * Be conscientious when reviewing patches. As a reviewer who approves (+2)
217 a patch, you are responsible for the patch and the effect it has on the
218 codebase. In the event that the patch breaks things, you are expected to
219 be actively involved in the cleanup effort. This means you shouldn’t +2 a
220 patch just because you trust the author of a patch - Make sure you
221 understand what the implications of a patch might be, or leave the review
222 to others. Partial reviews, reviewing code style, for example, can be given
223 a +1 instead of a +2. This also applies if you think the patch looks good,
224 but may not have the experience to know if there may be unintended
225 consequences.
227 * If there is still ongoing discussion to a patch, try to wait for a
228 conclusion to the discussion before submitting it to the tree. If you feel
229 that someone is just bikeshedding, maybe just state that and give a time
230 that the patch will be submitted if no new objections are raised.
232 * When working with patch trains, for minor requests it’s acceptable to
233 create a fix addressing a comment in another patch at the end of the patch
234 train. This minimizes rebases of the patch train while still addressing the
235 request. For major problems where the change doesn’t work as intended or
236 breaks other platforms, the change really needs to go into the original
237 patch.
239 * When bringing in a patch from another git repo, update the original
240 git/gerrit tags by prepending the lines with 'Original-'.  Marking
241 the original text this way makes it much easier to tell what changes
242 happened in which repository. This applies to these lines, not the actual
243 commit message itself:
244         Commit-Id:
245         Change-Id:
246         Signed-off-by:
247         Reviewed-on:
248         Tested-by:
249         Reviewed-by:
250 The script 'util/gitconfig/rebase.sh' can be used to help automate this.
251 Other tags such as 'Commit-Queue' can simply be removed.
254 Expectations contributors should have
255 -------------------------------------
256 * Don't expect that people will review your patch unless you ask them to.
257 Adding other people as reviewers is the easiest way. Asking for reviews for
258 individual patches in the IRC channel, or by sending a direct request to an
259 individual through your favorite messenger is usually the best way to get a
260 patch reviewed quickly.
262 * Don't expect that your patch will be submitted immediately after getting
263 a +2. As stated previously, non-trivial patches should wait at least 24
264 hours before being submitted. That said, if you feel that your patch or
265 series of patches has been sitting longer than needed, you can ask for it
266 to be submitted on IRC, or comment that it's ready for submission in the
267 patch. This will move it to the top of the list where it's more likely to
268 be noticed and acted upon.
270 * Reviews are about the code. It's easy to take it personally when someone
271 is criticising your code, but the whole idea is to get better code into our
272 codebase. Again, this also applies in the other direction: review code,
273 criticize code, but don’t make it personal.
276 Requests for clarification and suggestions for updates to these guidelines
277 should be sent to the coreboot mailing list at <coreboot@coreboot.org>.