Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9C2BC433FE for ; Sun, 10 Oct 2021 21:23:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ECC6A60F22 for ; Sun, 10 Oct 2021 21:23:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ECC6A60F22 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:37960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZgIJ-0000FU-3w for qemu-devel@archiver.kernel.org; Sun, 10 Oct 2021 17:23:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZgGu-0007l6-PF for qemu-devel@nongnu.org; Sun, 10 Oct 2021 17:22:16 -0400 Received: from mail-vs1-xe30.google.com ([2607:f8b0:4864:20::e30]:37864) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mZgGo-0003Qs-Lv for qemu-devel@nongnu.org; Sun, 10 Oct 2021 17:22:12 -0400 Received: by mail-vs1-xe30.google.com with SMTP id f2so16713663vsj.4 for ; Sun, 10 Oct 2021 14:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:content-transfer-encoding:mime-version:subject:from :in-reply-to:cc:date:message-id:references:to; bh=gRLn8y3mwKB8CdGfRG2YWK4+1KzHopjUd1iZtPBSEfc=; b=CdXHwNj/gOsxa8jszVc62p3sSnFIdw6beI51YooMXJK80wt4qCsDHHZfUs6TMCFw0S pKXF78f9DDjtViAi9bzt171vgWqmJ2QggjL9hyTCrXprQPVCmkloTVfKMf3Vul1IUi3U s2OgtYNrMx7eS/brf52sX3sJwlyvv4AirftpQwrGNjfsHcg9mqtG6pt+LQxJ2iT+QbU8 KK0motujV1GWQJcXaLyOYHTc4wOZlLKZu1ghnACGaD7EZSDwVphp2rV8FP0sJe0a9+9q aNaPVkOJowsaom7Lv5ZrLmxk6p7yS+ED18ED7L3lnfu68l6Ss5N3pHprg/02tSqJVllJ 72sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:content-transfer-encoding:mime-version :subject:from:in-reply-to:cc:date:message-id:references:to; bh=gRLn8y3mwKB8CdGfRG2YWK4+1KzHopjUd1iZtPBSEfc=; b=tYqeAhztz3YA+BeLB/q06Vd8NrcA7jdCwjTQwoolrFY4CdCE29VLkKrhrskGYViCaj YKqLIAMk6Nwxvvd1HuC9hAgnFJA8i+pg3Mjw/nluRhG4CBI+OYmQDb08BuSizbg/Y+St 8OqCnzVlSY/BnLcKy4ZusOUOCOHm5hjIqIyiED3FKy80C6OPJzW+1PpWo8h01O5I9iEa OUhe7q041B/wpqEl4XP3qfwe/TnPcZtFwxuj3MvWePE08uODC1NKMTTZ0loabvB7mpow 0F17VBPTXXbQZ4vBxoGN+LL5HDT9aTRqX3TGyBg9sjh2+t72484XE1eJVS7d27A5ZPR4 2l5w== X-Gm-Message-State: AOAM531aMUEN/A/RpmhUIfOOevE1eb3XCxrzBM4NrxPWrL7IMGH7la+b IchQpTi71Sugs2lXtyZqn5U= X-Google-Smtp-Source: ABdhPJweUrkKTa3gi+OJmht8Glr5r9lYiMRj6uQeVavn67U/3J59tGSVQmP1Bqh1kRXnV0zAIHvHoA== X-Received: by 2002:a05:6102:c13:: with SMTP id x19mr4625723vss.4.1633900928363; Sun, 10 Oct 2021 14:22:08 -0700 (PDT) Received: from smtpclient.apple ([191.187.160.179]) by smtp.gmail.com with ESMTPSA id o19sm1580534vsl.29.2021.10.10.14.22.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Oct 2021 14:22:07 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-ED8FE4B6-A642-46F3-ACF8-59B614E1ABB4 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] hw/misc: applesmc: use host osk as default on macs From: =?utf-8?Q?Pedro_T=C3=B4rres?= In-Reply-To: Date: Sun, 10 Oct 2021 18:22:04 -0300 Message-Id: <001C97D2-2710-415C-9ECD-F8C20AB52196@gmail.com> References: To: Paolo Bonzini X-Mailer: iPhone Mail (19A348) Received-SPF: pass client-ip=2607:f8b0:4864:20::e30; envelope-from=t0rr3sp3dr0@gmail.com; helo=mail-vs1-xe30.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Phil Dennis-Jordan , rene@exactcode.de, "Kiszka, Jan" , qemu-devel , "Graf, Alexander" , "Gabriel L. Somlo" , suse@csgraf.de, afaerber , =?utf-8?Q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --Apple-Mail-ED8FE4B6-A642-46F3-ACF8-59B614E1ABB4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable AFAIK there=E2=80=99s no public documentation from Apple on how to read valu= es from SMC. But Amit Singh wrote a book, Mac OS X Internals, and one of the processes de= scribed on it is how to read OSK directly from SMC: https://web.archive.org/= web/20190630050544/http://osxbook.com/book/bonus/chapter7/tpmdrmmyth/ This is actually referenced on VirtualBox=E2=80=99s source code as the base f= or their implementation: https://www.virtualbox.org/browser/vbox/trunk/src/V= Box/Devices/EFI/DevSmc.cpp#L520 Additionally, there is the smcFanControl project, licensed under GPLv2, that= performs reads and writes on SMC and have all information necessary to impl= ement this feature on QEMU: https://github.com/hholtmann/smcFanControl This project was used as base for the SMC in-tree driver for Linux and it=E2= =80=99s referenced there: https://github.com/torvalds/linux/blob/master/driv= ers/hwmon/applesmc.c#L14 I think we would be safe using these sources as the base for our implementat= ion, given that other huge GPL projects like Linux and VirtualBox have been u= sing them for years. Best regards, Pedro T=C3=B4rres > On Oct 10, 2021, at 4:25 PM, Paolo Bonzini wrote: > =EF=BB=BF > Can you instead provide documentation in English (pseudocode, tables of th= e structs, etc.)? That's the safest bet. >=20 > Paolo >=20 > El s=C3=A1b., 9 oct. 2021 7:32, Pedro T=C3=B4rres e= scribi=C3=B3: >> Hey Paolo and Phil, >>=20 >> I understand you concerns regarding the license that Apple open-source co= de is distributed. >>=20 >> If I restart from scratch and implement this feature based only on Virtua= lBox code, that is distributed under GPLv2, would it be fine? >>=20 >> Best regards, >> Pedro T=C3=B4rres >>=20 >>> On Oct 8, 2021, at 3:54 PM, Paolo Bonzini wrote: >>> =EF=BB=BFOn 08/10/21 14:03, Phil Dennis-Jordan wrote: >>>> 1. Licensing >>>> Given that the code it's heavily based on is copyright Apple Computer I= nc., licensed under APSL, is it safe including it in qemu as is? >>>> If the integrated code is going to be quite so "directly inspired" (dow= n to the inconsistent struct definition style and mixing unrelated constants= in the same anonymous enum), perhaps at minimum place it in its own isolate= d source file with appropriate notice? >>>=20 >>> Yeah, this should be reverted. >>>=20 >>> Pedro, I understand that you stated it was "based on code from Apple" bu= t you also said (by including Signed-off-by) that >>>=20 >>> --- >>> (a) The contribution was created in whole or in part by me and I >>> have the right to submit it under the open source license >>> indicated in the file; or >>>=20 >>> (b) The contribution is based upon previous work that, to the best >>> of my knowledge, is covered under an appropriate open source >>> license and I have the right under that license to submit that >>> work with modifications, whether created in whole or in part >>> by me, under the same open source license (unless I am >>> permitted to submit under a different license), as indicated >>> in the file; or >>> --- >>>=20 >>> and this is not true. >>>=20 >>> Thanks very much, >>>=20 >>> Paolo --Apple-Mail-ED8FE4B6-A642-46F3-ACF8-59B614E1ABB4 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
AFAIK there=E2=80=99s no publ= ic documentation from Apple on how to read values from SMC.

But Amit Singh wrote a book, Mac OS X Internals, and one of the processes= described on it is how to read OSK directly from SMC: https://web.archive.org/web/20190630050544/http://osxbook.com/= book/bonus/chapter7/tpmdrmmyth/

This is actually referenced= on VirtualBox=E2=80=99s source code as the base for their implementation:&n= bsp;https://www.virtualbox.org/browser/vbox/trunk/= src/VBox/Devices/EFI/DevSmc.cpp#L520

Additional= ly, there is the smcFanControl project, licensed under GPLv2, that performs r= eads and writes on SMC and have all information necessary to implement this f= eature on QEMU: = https://github.com/hholtmann/smcFanControl

This= project was used as base for the SMC in-tree driver for Linux and it=E2=80=99= s referenced there: https://github.com/torvalds/linux/blob/m= aster/drivers/hwmon/applesmc.c#L14

I think we w= ould be safe using these sources as the base for our implementation, given t= hat other huge GPL projects like Linux and VirtualBox have been using them f= or years.

Best regards,
Pedro T=C3=B4rres

= On Oct 10, 2021, at 4:25 PM, Paolo Bonzini <pbonzini@redhat.com> wrote= :

=EF=BB= =BF
Can you instead provide documentation in English (pseud= ocode, tables of the structs, etc.)? That's the safest bet.

Paolo

El s=C3=A1b., 9 oct. 2021 7:32, Pedro= T=C3=B4rres <t0rr3sp3dr0@gmail.= com> escribi=C3=B3:
Hey Paolo and Phil,

I understand you concerns regarding the lic= ense that Apple open-source code is distributed.

<= /div>
If I restart from scratch and implement this feature b= ased only on VirtualBox code, that is distributed under GPLv2, would it be f= ine?

Best regards,
Pedro T=C3=B4rres

On Oct 8, 2021, at 3:54 PM, Paolo Bonzini <= ;pbonzini@redhat.com> wrote:

=EF=BB=BFOn 08/10/21 14:03, Phil Dennis-J= ordan wrote:
1. Licensing
Given that the code it's heav= ily based on is copyright Apple Computer Inc., licensed under APSL, is it sa= fe including it in qemu as is?
If the integrated code is going to be quite so "directly inspired"= (down to the inconsistent struct definition style and mixing unrelated cons= tants in the same anonymous enum), perhaps at minimum place it in its own is= olated source file with appropriate notice?

Yeah, this should be reverted.

Pedro, I understand that you stated it was "based on code from Apple" but y= ou also said (by including Signed-off-by) that


---
(a) The contribution was created in whole or in part= by me and I
   have the right to submit it u= nder the open source license
   indicated in= the file; or

(b) The contribution is based= upon previous work that, to the best
   of m= y knowledge, is covered under an appropriate open source
&n= bsp;  license and I have the right under that license to submit th= at
   work with modifications, whether creat= ed in whole or in part
   by me, under the s= ame open source license (unless I am
   perm= itted to submit under a different license), as indicated
&n= bsp;  in the file; or
---
<= br>and this is not true.

Thanks very m= uch,

Paolo

= --Apple-Mail-ED8FE4B6-A642-46F3-ACF8-59B614E1ABB4--