xref: /qemu/docs/devel/code-provenance.rst (revision 3d40db0efc22520fa6c399cf73960dced423b048)
12b0e4ecdSDaniel P. Berrangé.. _code-provenance:
22b0e4ecdSDaniel P. Berrangé
32b0e4ecdSDaniel P. BerrangéCode provenance
42b0e4ecdSDaniel P. Berrangé===============
52b0e4ecdSDaniel P. Berrangé
62b0e4ecdSDaniel P. BerrangéCertifying patch submissions
72b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~~~~~~~~~~
82b0e4ecdSDaniel P. Berrangé
92b0e4ecdSDaniel P. BerrangéThe QEMU community **mandates** all contributors to certify provenance of
102b0e4ecdSDaniel P. Berrangépatch submissions they make to the project. To put it another way,
112b0e4ecdSDaniel P. Berrangécontributors must indicate that they are legally permitted to contribute to
122b0e4ecdSDaniel P. Berrangéthe project.
132b0e4ecdSDaniel P. Berrangé
142b0e4ecdSDaniel P. BerrangéCertification is achieved with a low overhead by adding a single line to the
152b0e4ecdSDaniel P. Berrangébottom of every git commit::
162b0e4ecdSDaniel P. Berrangé
172b0e4ecdSDaniel P. Berrangé   Signed-off-by: YOUR NAME <YOUR@EMAIL>
182b0e4ecdSDaniel P. Berrangé
192b0e4ecdSDaniel P. BerrangéThe addition of this line asserts that the author of the patch is contributing
202b0e4ecdSDaniel P. Berrangéin accordance with the clauses specified in the
212b0e4ecdSDaniel P. Berrangé`Developer's Certificate of Origin <https://developercertificate.org>`__:
222b0e4ecdSDaniel P. Berrangé
232b0e4ecdSDaniel P. Berrangé.. _dco:
242b0e4ecdSDaniel P. Berrangé
252b0e4ecdSDaniel P. Berrangé  Developer's Certificate of Origin 1.1
262b0e4ecdSDaniel P. Berrangé
272b0e4ecdSDaniel P. Berrangé  By making a contribution to this project, I certify that:
282b0e4ecdSDaniel P. Berrangé
292b0e4ecdSDaniel P. Berrangé  (a) The contribution was created in whole or in part by me and I
302b0e4ecdSDaniel P. Berrangé      have the right to submit it under the open source license
312b0e4ecdSDaniel P. Berrangé      indicated in the file; or
322b0e4ecdSDaniel P. Berrangé
332b0e4ecdSDaniel P. Berrangé  (b) The contribution is based upon previous work that, to the best
342b0e4ecdSDaniel P. Berrangé      of my knowledge, is covered under an appropriate open source
352b0e4ecdSDaniel P. Berrangé      license and I have the right under that license to submit that
362b0e4ecdSDaniel P. Berrangé      work with modifications, whether created in whole or in part
372b0e4ecdSDaniel P. Berrangé      by me, under the same open source license (unless I am
382b0e4ecdSDaniel P. Berrangé      permitted to submit under a different license), as indicated
392b0e4ecdSDaniel P. Berrangé      in the file; or
402b0e4ecdSDaniel P. Berrangé
412b0e4ecdSDaniel P. Berrangé  (c) The contribution was provided directly to me by some other
422b0e4ecdSDaniel P. Berrangé      person who certified (a), (b) or (c) and I have not modified
432b0e4ecdSDaniel P. Berrangé      it.
442b0e4ecdSDaniel P. Berrangé
452b0e4ecdSDaniel P. Berrangé  (d) I understand and agree that this project and the contribution
462b0e4ecdSDaniel P. Berrangé      are public and that a record of the contribution (including all
472b0e4ecdSDaniel P. Berrangé      personal information I submit with it, including my sign-off) is
482b0e4ecdSDaniel P. Berrangé      maintained indefinitely and may be redistributed consistent with
492b0e4ecdSDaniel P. Berrangé      this project or the open source license(s) involved.
502b0e4ecdSDaniel P. Berrangé
512b0e4ecdSDaniel P. BerrangéThe name used with "Signed-off-by" does not need to be your legal name, nor
522b0e4ecdSDaniel P. Berrangébirth name, nor appear on any government ID. It is the identity you choose to
532b0e4ecdSDaniel P. Berrangébe known by in the community, but should not be anonymous, nor misrepresent
542b0e4ecdSDaniel P. Berrangéwhom you are.
552b0e4ecdSDaniel P. Berrangé
562b0e4ecdSDaniel P. BerrangéIt is generally expected that the name and email addresses used in one of the
572b0e4ecdSDaniel P. Berrangé``Signed-off-by`` lines, matches that of the git commit ``Author`` field.
582b0e4ecdSDaniel P. BerrangéIt's okay if you subscribe or contribute to the list via more than one
592b0e4ecdSDaniel P. Berrangéaddress, but using multiple addresses in one commit just confuses
602b0e4ecdSDaniel P. Berrangéthings.
612b0e4ecdSDaniel P. Berrangé
622b0e4ecdSDaniel P. BerrangéIf the person sending the mail is not one of the patch authors, they are
632b0e4ecdSDaniel P. Berrangénonetheless expected to add their own ``Signed-off-by`` to comply with the
642b0e4ecdSDaniel P. BerrangéDCO clause (c).
652b0e4ecdSDaniel P. Berrangé
662b0e4ecdSDaniel P. BerrangéMultiple authorship
672b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~
682b0e4ecdSDaniel P. Berrangé
692b0e4ecdSDaniel P. BerrangéIt is not uncommon for a patch to have contributions from multiple authors. In
702b0e4ecdSDaniel P. Berrangéthis scenario, git commits will usually be expected to have a ``Signed-off-by``
712b0e4ecdSDaniel P. Berrangéline for each contributor involved in creation of the patch. Some edge cases:
722b0e4ecdSDaniel P. Berrangé
732b0e4ecdSDaniel P. Berrangé  * The non-primary author's contributions were so trivial that they can be
742b0e4ecdSDaniel P. Berrangé    considered not subject to copyright. In this case the secondary authors
752b0e4ecdSDaniel P. Berrangé    need not include a ``Signed-off-by``.
762b0e4ecdSDaniel P. Berrangé
772b0e4ecdSDaniel P. Berrangé    This case most commonly applies where QEMU reviewers give short snippets
782b0e4ecdSDaniel P. Berrangé    of code as suggested fixes to a patch. The reviewers don't need to have
792b0e4ecdSDaniel P. Berrangé    their own ``Signed-off-by`` added unless their code suggestion was
802b0e4ecdSDaniel P. Berrangé    unusually large, but it is common to add ``Suggested-by`` as a credit
812b0e4ecdSDaniel P. Berrangé    for non-trivial code.
822b0e4ecdSDaniel P. Berrangé
832b0e4ecdSDaniel P. Berrangé  * Both contributors work for the same employer and the employer requires
842b0e4ecdSDaniel P. Berrangé    copyright assignment.
852b0e4ecdSDaniel P. Berrangé
862b0e4ecdSDaniel P. Berrangé    It can be said that in this case a ``Signed-off-by`` is indicating that
872b0e4ecdSDaniel P. Berrangé    the person has permission to contribute from their employer who is the
882b0e4ecdSDaniel P. Berrangé    copyright holder. It is nonetheless still preferable to include a
892b0e4ecdSDaniel P. Berrangé    ``Signed-off-by`` for each contributor, as in some countries employees are
902b0e4ecdSDaniel P. Berrangé    not able to assign copyright to their employer, and it also covers any
912b0e4ecdSDaniel P. Berrangé    time invested outside working hours.
922b0e4ecdSDaniel P. Berrangé
932b0e4ecdSDaniel P. BerrangéWhen multiple ``Signed-off-by`` tags are present, they should be strictly kept
942b0e4ecdSDaniel P. Berrangéin order of authorship, from oldest to newest.
952b0e4ecdSDaniel P. Berrangé
962b0e4ecdSDaniel P. BerrangéOther commit tags
972b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~
982b0e4ecdSDaniel P. Berrangé
992b0e4ecdSDaniel P. BerrangéWhile the ``Signed-off-by`` tag is mandatory, there are a number of other tags
1002b0e4ecdSDaniel P. Berrangéthat are commonly used during QEMU development:
1012b0e4ecdSDaniel P. Berrangé
1022b0e4ecdSDaniel P. Berrangé * **``Reviewed-by``**: when a QEMU community member reviews a patch on the
1032b0e4ecdSDaniel P. Berrangé   mailing list, if they consider the patch acceptable, they should send an
1042b0e4ecdSDaniel P. Berrangé   email reply containing a ``Reviewed-by`` tag. Subsystem maintainers who
1052b0e4ecdSDaniel P. Berrangé   review a patch should add this even if they are also adding their
1062b0e4ecdSDaniel P. Berrangé   ``Signed-off-by`` to the same commit.
1072b0e4ecdSDaniel P. Berrangé
1082b0e4ecdSDaniel P. Berrangé * **``Acked-by``**: when a QEMU subsystem maintainer approves a patch that
1092b0e4ecdSDaniel P. Berrangé   touches their subsystem, but intends to allow a different maintainer to
1102b0e4ecdSDaniel P. Berrangé   queue it and send a pull request, they would send a mail containing a
1112b0e4ecdSDaniel P. Berrangé   ``Acked-by`` tag. Where a patch touches multiple subsystems, ``Acked-by``
1122b0e4ecdSDaniel P. Berrangé   only implies review of the maintainers' own areas of responsibility. If a
1132b0e4ecdSDaniel P. Berrangé   maintainer wants to indicate they have done a full review they should use
1142b0e4ecdSDaniel P. Berrangé   a ``Reviewed-by`` tag.
1152b0e4ecdSDaniel P. Berrangé
1162b0e4ecdSDaniel P. Berrangé * **``Tested-by``**: when a QEMU community member has functionally tested the
1172b0e4ecdSDaniel P. Berrangé   behaviour of the patch in some manner, they should send an email reply
1182b0e4ecdSDaniel P. Berrangé   containing a ``Tested-by`` tag.
1192b0e4ecdSDaniel P. Berrangé
1202b0e4ecdSDaniel P. Berrangé * **``Reported-by``**: when a QEMU community member reports a problem via the
1212b0e4ecdSDaniel P. Berrangé   mailing list, or some other informal channel that is not the issue tracker,
1222b0e4ecdSDaniel P. Berrangé   it is good practice to credit them by including a ``Reported-by`` tag on
1232b0e4ecdSDaniel P. Berrangé   any patch fixing the issue. When the problem is reported via the GitLab
1242b0e4ecdSDaniel P. Berrangé   issue tracker, however, it is sufficient to just include a link to the
1252b0e4ecdSDaniel P. Berrangé   issue.
1262b0e4ecdSDaniel P. Berrangé
1272b0e4ecdSDaniel P. Berrangé * **``Suggested-by``**: when a reviewer or other 3rd party makes non-trivial
1282b0e4ecdSDaniel P. Berrangé   suggestions for how to change a patch, it is good practice to credit them
1292b0e4ecdSDaniel P. Berrangé   by including a ``Suggested-by`` tag.
1302b0e4ecdSDaniel P. Berrangé
1312b0e4ecdSDaniel P. BerrangéSubsystem maintainer requirements
1322b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1332b0e4ecdSDaniel P. Berrangé
1342b0e4ecdSDaniel P. BerrangéWhen a subsystem maintainer accepts a patch from a contributor, in addition to
1352b0e4ecdSDaniel P. Berrangéthe normal code review points, they are expected to validate the presence of
1362b0e4ecdSDaniel P. Berrangésuitable ``Signed-off-by`` tags.
1372b0e4ecdSDaniel P. Berrangé
1382b0e4ecdSDaniel P. BerrangéAt the time they queue the patch in their subsystem tree, the maintainer
1392b0e4ecdSDaniel P. Berrangé**must** also then add their own ``Signed-off-by`` to indicate that they have
1402b0e4ecdSDaniel P. Berrangédone the aforementioned validation. This is in addition to any of their own
1412b0e4ecdSDaniel P. Berrangé``Reviewed-by`` tags the subsystem maintainer may wish to include.
1422b0e4ecdSDaniel P. Berrangé
1432b0e4ecdSDaniel P. BerrangéWhen the maintainer modifies the patch after pulling into their tree, they
1442b0e4ecdSDaniel P. Berrangéshould record their contribution.  This is typically done via a note in the
1452b0e4ecdSDaniel P. Berrangécommit message, just prior to the maintainer's ``Signed-off-by``::
1462b0e4ecdSDaniel P. Berrangé
1472b0e4ecdSDaniel P. Berrangé    Signed-off-by: Cory Contributor <cory.contributor@example.com>
1482b0e4ecdSDaniel P. Berrangé    [Comment rephrased for clarity]
1492b0e4ecdSDaniel P. Berrangé    Signed-off-by: Mary Maintainer <mary.maintainer@mycorp.test>
1502b0e4ecdSDaniel P. Berrangé
1512b0e4ecdSDaniel P. Berrangé
1522b0e4ecdSDaniel P. BerrangéTools for adding ``Signed-off-by``
1532b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1542b0e4ecdSDaniel P. Berrangé
1552b0e4ecdSDaniel P. BerrangéThere are a variety of ways tools can support adding ``Signed-off-by`` tags
1562b0e4ecdSDaniel P. Berrangéfor patches, avoiding the need for contributors to manually type in this
1572b0e4ecdSDaniel P. Berrangérepetitive text each time.
1582b0e4ecdSDaniel P. Berrangé
1592b0e4ecdSDaniel P. Berrangégit commands
1602b0e4ecdSDaniel P. Berrangé^^^^^^^^^^^^
1612b0e4ecdSDaniel P. Berrangé
1622b0e4ecdSDaniel P. BerrangéWhen creating, or amending, a commit the ``-s`` flag to ``git commit`` will
1632b0e4ecdSDaniel P. Berrangéappend a suitable line matching the configured git author details.
1642b0e4ecdSDaniel P. Berrangé
1652b0e4ecdSDaniel P. BerrangéIf preparing patches using the ``git format-patch`` tool, the ``-s`` flag can
1662b0e4ecdSDaniel P. Berrangébe used to append a suitable line in the emails it creates, without modifying
1672b0e4ecdSDaniel P. Berrangéthe local commits. Alternatively to modify all the local commits on a branch::
1682b0e4ecdSDaniel P. Berrangé
1692b0e4ecdSDaniel P. Berrangé  git rebase master -x 'git commit --amend --no-edit -s'
1702b0e4ecdSDaniel P. Berrangé
1712b0e4ecdSDaniel P. Berrangéemacs
1722b0e4ecdSDaniel P. Berrangé^^^^^
1732b0e4ecdSDaniel P. Berrangé
1742b0e4ecdSDaniel P. BerrangéIn the file ``$HOME/.emacs.d/abbrev_defs`` add:
1752b0e4ecdSDaniel P. Berrangé
1762b0e4ecdSDaniel P. Berrangé.. code:: elisp
1772b0e4ecdSDaniel P. Berrangé
1782b0e4ecdSDaniel P. Berrangé  (define-abbrev-table 'global-abbrev-table
1792b0e4ecdSDaniel P. Berrangé    '(
1802b0e4ecdSDaniel P. Berrangé      ("8rev" "Reviewed-by: YOUR NAME <your@email.addr>" nil 1)
1812b0e4ecdSDaniel P. Berrangé      ("8ack" "Acked-by: YOUR NAME <your@email.addr>" nil 1)
1822b0e4ecdSDaniel P. Berrangé      ("8test" "Tested-by: YOUR NAME <your@email.addr>" nil 1)
1832b0e4ecdSDaniel P. Berrangé      ("8sob" "Signed-off-by: YOUR NAME <your@email.addr>" nil 1)
1842b0e4ecdSDaniel P. Berrangé     ))
1852b0e4ecdSDaniel P. Berrangé
1862b0e4ecdSDaniel P. Berrangéwith this change, if you type (for example) ``8rev`` followed by ``<space>``
1872b0e4ecdSDaniel P. Berrangéor ``<enter>`` it will expand to the whole phrase.
1882b0e4ecdSDaniel P. Berrangé
1892b0e4ecdSDaniel P. Berrangévim
1902b0e4ecdSDaniel P. Berrangé^^^
1912b0e4ecdSDaniel P. Berrangé
1922b0e4ecdSDaniel P. BerrangéIn the file ``$HOME/.vimrc`` add::
1932b0e4ecdSDaniel P. Berrangé
1942b0e4ecdSDaniel P. Berrangé  iabbrev 8rev Reviewed-by: YOUR NAME <your@email.addr>
1952b0e4ecdSDaniel P. Berrangé  iabbrev 8ack Acked-by: YOUR NAME <your@email.addr>
1962b0e4ecdSDaniel P. Berrangé  iabbrev 8test Tested-by: YOUR NAME <your@email.addr>
1972b0e4ecdSDaniel P. Berrangé  iabbrev 8sob Signed-off-by: YOUR NAME <your@email.addr>
1982b0e4ecdSDaniel P. Berrangé
1992b0e4ecdSDaniel P. Berrangéwith this change, if you type (for example) ``8rev`` followed by ``<space>``
2002b0e4ecdSDaniel P. Berrangéor ``<enter>`` it will expand to the whole phrase.
2012b0e4ecdSDaniel P. Berrangé
2022b0e4ecdSDaniel P. BerrangéRe-starting abandoned work
2032b0e4ecdSDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~~~~~~~~
2042b0e4ecdSDaniel P. Berrangé
2052b0e4ecdSDaniel P. BerrangéFor a variety of reasons there are some patches that get submitted to QEMU but
2062b0e4ecdSDaniel P. Berrangénever merged. An unrelated contributor may decide (months or years later) to
2072b0e4ecdSDaniel P. Berrangécontinue working from the abandoned patch and re-submit it with extra changes.
2082b0e4ecdSDaniel P. Berrangé
2092b0e4ecdSDaniel P. BerrangéThe general principles when picking up abandoned work are:
2102b0e4ecdSDaniel P. Berrangé
2112b0e4ecdSDaniel P. Berrangé * Continue to credit the original author for their work, by maintaining their
2122b0e4ecdSDaniel P. Berrangé   original ``Signed-off-by``
2132b0e4ecdSDaniel P. Berrangé * Indicate where the original patch was obtained from (mailing list, bug
2142b0e4ecdSDaniel P. Berrangé   tracker, author's git repo, etc) when sending it for review
2152b0e4ecdSDaniel P. Berrangé * Acknowledge the extra work of the new contributor by including their
2162b0e4ecdSDaniel P. Berrangé   ``Signed-off-by`` in the patch in addition to the orignal author's
2172b0e4ecdSDaniel P. Berrangé * Indicate who is responsible for what parts of the patch. This is typically
2182b0e4ecdSDaniel P. Berrangé   done via a note in the commit message, just prior to the new contributor's
2192b0e4ecdSDaniel P. Berrangé   ``Signed-off-by``::
2202b0e4ecdSDaniel P. Berrangé
2212b0e4ecdSDaniel P. Berrangé    Signed-off-by: Some Person <some.person@example.com>
2222b0e4ecdSDaniel P. Berrangé    [Rebased and added support for 'foo']
2232b0e4ecdSDaniel P. Berrangé    Signed-off-by: New Person <new.person@mycorp.test>
2242b0e4ecdSDaniel P. Berrangé
2252b0e4ecdSDaniel P. BerrangéIn complicated cases, or if otherwise unsure, ask for advice on the project
2262b0e4ecdSDaniel P. Berrangémailing list.
2272b0e4ecdSDaniel P. Berrangé
2282b0e4ecdSDaniel P. BerrangéIt is also recommended to attempt to contact the original author to let them
2292b0e4ecdSDaniel P. Berrangéknow you are interested in taking over their work, in case they still intended
2302b0e4ecdSDaniel P. Berrangéto return to the work, or had any suggestions about the best way to continue.
231b5d00557SDaniel P. Berrangé
232b5d00557SDaniel P. BerrangéInclusion of generated files
233b5d00557SDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~~~~~~~~~~
234b5d00557SDaniel P. Berrangé
235b5d00557SDaniel P. BerrangéFiles in patches contributed to QEMU are generally expected to be provided
236b5d00557SDaniel P. Berrangéonly in the preferred format for making modifications. The implication of
237b5d00557SDaniel P. Berrangéthis is that the output of code generators or compilers is usually not
238b5d00557SDaniel P. Berrangéappropriate to contribute to QEMU.
239b5d00557SDaniel P. Berrangé
240b5d00557SDaniel P. BerrangéFor reasons of practicality there are some exceptions to this rule, where
241b5d00557SDaniel P. Berrangégenerated code is permitted, provided it is also accompanied by the
242b5d00557SDaniel P. Berrangécorresponding preferred source format. This is done where it is impractical
243b5d00557SDaniel P. Berrangéto expect those building QEMU to run the code generation or compilation
244b5d00557SDaniel P. Berrangéprocess. A non-exhaustive list of examples is:
245b5d00557SDaniel P. Berrangé
246b5d00557SDaniel P. Berrangé * Images: where an bitmap image is created from a vector file it is common
247b5d00557SDaniel P. Berrangé   to include the rendered bitmaps at desired resolution(s), since subtle
248b5d00557SDaniel P. Berrangé   changes in the rasterization process / tools may affect quality. The
249b5d00557SDaniel P. Berrangé   original vector file is expected to accompany any generated bitmaps.
250b5d00557SDaniel P. Berrangé
251b5d00557SDaniel P. Berrangé * Firmware: QEMU includes pre-compiled binary ROMs for a variety of guest
252b5d00557SDaniel P. Berrangé   firmwares. When such binary ROMs are contributed, the corresponding source
253b5d00557SDaniel P. Berrangé   must also be provided, either directly, or through a git submodule link.
254b5d00557SDaniel P. Berrangé
255b5d00557SDaniel P. Berrangé * Dockerfiles: the majority of the dockerfiles are automatically generated
256b5d00557SDaniel P. Berrangé   from a canonical list of build dependencies maintained in tree, together
257b5d00557SDaniel P. Berrangé   with the libvirt-ci git submodule link. The generated dockerfiles are
258b5d00557SDaniel P. Berrangé   included in tree because it is desirable to be able to directly build
259b5d00557SDaniel P. Berrangé   container images from a clean git checkout.
260b5d00557SDaniel P. Berrangé
261b5d00557SDaniel P. Berrangé * eBPF: QEMU includes some generated eBPF machine code, since the required
262b5d00557SDaniel P. Berrangé   eBPF compilation tools are not broadly available on all targetted OS
263b5d00557SDaniel P. Berrangé   distributions. The corresponding eBPF C code for the binary is also
264b5d00557SDaniel P. Berrangé   provided. This is a time-limited exception until the eBPF toolchain is
265b5d00557SDaniel P. Berrangé   sufficiently broadly available in distros.
266b5d00557SDaniel P. Berrangé
267b5d00557SDaniel P. BerrangéIn all cases above, the existence of generated files must be acknowledged
268b5d00557SDaniel P. Berrangéand justified in the commit that introduces them.
269b5d00557SDaniel P. Berrangé
270b5d00557SDaniel P. BerrangéTools which perform changes to existing code with deterministic algorithmic
271b5d00557SDaniel P. Berrangémanipulation, driven by user specified inputs, are not generally considered
272b5d00557SDaniel P. Berrangéto be "generators".
273b5d00557SDaniel P. Berrangé
274b5d00557SDaniel P. BerrangéFor instance, using Coccinelle to convert code from one pattern to another
275b5d00557SDaniel P. Berrangépattern, or fixing documentation typos with a spell checker, or transforming
276b5d00557SDaniel P. Berrangécode using sed / awk / etc, are not considered to be acts of code
277b5d00557SDaniel P. Berrangégeneration. Where an automated manipulation is performed on code, however,
278b5d00557SDaniel P. Berrangéthis should be declared in the commit message.
279b5d00557SDaniel P. Berrangé
280b5d00557SDaniel P. BerrangéAt times contributors may use or create scripts/tools to generate an initial
281b5d00557SDaniel P. Berrangéboilerplate code template which is then filled in to produce the final patch.
282b5d00557SDaniel P. BerrangéThe output of such a tool would still be considered the "preferred format",
283b5d00557SDaniel P. Berrangésince it is intended to be a foundation for further human authored changes.
284b5d00557SDaniel P. BerrangéSuch tools are acceptable to use, provided there is clearly defined copyright
285*3d40db0eSDaniel P. Berrangéand licensing for their output. Note in particular the caveats applying to AI
286*3d40db0eSDaniel P. Berrangécontent generators below.
287*3d40db0eSDaniel P. Berrangé
288*3d40db0eSDaniel P. BerrangéUse of AI content generators
289*3d40db0eSDaniel P. Berrangé~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290*3d40db0eSDaniel P. Berrangé
291*3d40db0eSDaniel P. BerrangéTL;DR:
292*3d40db0eSDaniel P. Berrangé
293*3d40db0eSDaniel P. Berrangé  **Current QEMU project policy is to DECLINE any contributions which are
294*3d40db0eSDaniel P. Berrangé  believed to include or derive from AI generated content. This includes
295*3d40db0eSDaniel P. Berrangé  ChatGPT, Claude, Copilot, Llama and similar tools.**
296*3d40db0eSDaniel P. Berrangé
297*3d40db0eSDaniel P. BerrangéThe increasing prevalence of AI-assisted software development results in a
298*3d40db0eSDaniel P. Berrangénumber of difficult legal questions and risks for software projects, including
299*3d40db0eSDaniel P. BerrangéQEMU.  Of particular concern is content generated by `Large Language Models
300*3d40db0eSDaniel P. Berrangé<https://en.wikipedia.org/wiki/Large_language_model>`__ (LLMs).
301*3d40db0eSDaniel P. Berrangé
302*3d40db0eSDaniel P. BerrangéThe QEMU community requires that contributors certify their patch submissions
303*3d40db0eSDaniel P. Berrangéare made in accordance with the rules of the `Developer's Certificate of
304*3d40db0eSDaniel P. BerrangéOrigin (DCO) <dco>`.
305*3d40db0eSDaniel P. Berrangé
306*3d40db0eSDaniel P. BerrangéTo satisfy the DCO, the patch contributor has to fully understand the
307*3d40db0eSDaniel P. Berrangécopyright and license status of content they are contributing to QEMU. With AI
308*3d40db0eSDaniel P. Berrangécontent generators, the copyright and license status of the output is
309*3d40db0eSDaniel P. Berrangéill-defined with no generally accepted, settled legal foundation.
310*3d40db0eSDaniel P. Berrangé
311*3d40db0eSDaniel P. BerrangéWhere the training material is known, it is common for it to include large
312*3d40db0eSDaniel P. Berrangévolumes of material under restrictive licensing/copyright terms. Even where
313*3d40db0eSDaniel P. Berrangéthe training material is all known to be under open source licenses, it is
314*3d40db0eSDaniel P. Berrangélikely to be under a variety of terms, not all of which will be compatible
315*3d40db0eSDaniel P. Berrangéwith QEMU's licensing requirements.
316*3d40db0eSDaniel P. Berrangé
317*3d40db0eSDaniel P. BerrangéHow contributors could comply with DCO terms (b) or (c) for the output of AI
318*3d40db0eSDaniel P. Berrangécontent generators commonly available today is unclear.  The QEMU project is
319*3d40db0eSDaniel P. Berrangénot willing or able to accept the legal risks of non-compliance.
320*3d40db0eSDaniel P. Berrangé
321*3d40db0eSDaniel P. BerrangéThe QEMU project thus requires that contributors refrain from using AI content
322*3d40db0eSDaniel P. Berrangégenerators on patches intended to be submitted to the project, and will
323*3d40db0eSDaniel P. Berrangédecline any contribution if use of AI is either known or suspected.
324*3d40db0eSDaniel P. Berrangé
325*3d40db0eSDaniel P. BerrangéThis policy does not apply to other uses of AI, such as researching APIs or
326*3d40db0eSDaniel P. Berrangéalgorithms, static analysis, or debugging, provided their output is not to be
327*3d40db0eSDaniel P. Berrangéincluded in contributions.
328*3d40db0eSDaniel P. Berrangé
329*3d40db0eSDaniel P. BerrangéExamples of tools impacted by this policy includes GitHub's CoPilot, OpenAI's
330*3d40db0eSDaniel P. BerrangéChatGPT, Anthropic's Claude, and Meta's Code Llama, and code/content
331*3d40db0eSDaniel P. Berrangégeneration agents which are built on top of such tools.
332*3d40db0eSDaniel P. Berrangé
333*3d40db0eSDaniel P. BerrangéThis policy may evolve as AI tools mature and the legal situation is
334*3d40db0eSDaniel P. Berrangéclarifed. In the meanwhile, requests for exceptions to this policy will be
335*3d40db0eSDaniel P. Berrangéevaluated by the QEMU project on a case by case basis. To be granted an
336*3d40db0eSDaniel P. Berrangéexception, a contributor will need to demonstrate clarity of the license and
337*3d40db0eSDaniel P. Berrangécopyright status for the tool's output in relation to its training model and
338*3d40db0eSDaniel P. Berrangécode, to the satisfaction of the project maintainers.
339