From patchwork Mon Jun 25 14:23:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Berger X-Patchwork-Id: 10486385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 521EB6038C for ; Mon, 25 Jun 2018 14:28:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31BF728174 for ; Mon, 25 Jun 2018 14:28:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 264B62842E; Mon, 25 Jun 2018 14:28:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 727E328174 for ; Mon, 25 Jun 2018 14:28:33 +0000 (UTC) Received: from localhost ([::1]:47467 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXSTo-0002Pr-F5 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 25 Jun 2018 10:28:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXSQN-00008Z-Cc for qemu-devel@nongnu.org; Mon, 25 Jun 2018 10:25:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXSQI-000171-EY for qemu-devel@nongnu.org; Mon, 25 Jun 2018 10:24:59 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57200 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fXSQI-00016p-8T for qemu-devel@nongnu.org; Mon, 25 Jun 2018 10:24:54 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5PEOkDj129312 for ; Mon, 25 Jun 2018 10:24:53 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ju0ruc07s-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 25 Jun 2018 10:24:49 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 25 Jun 2018 10:23:42 -0400 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 25 Jun 2018 10:23:38 -0400 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5PENblX6423010 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Jun 2018 14:23:37 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E5C6E28058; Mon, 25 Jun 2018 10:23:19 -0400 (EDT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CD5112805A; Mon, 25 Jun 2018 10:23:19 -0400 (EDT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 25 Jun 2018 10:23:19 -0400 (EDT) To: Igor Mammedov References: <20180621115530.11069-1-marcandre.lureau@redhat.com> <20180621115530.11069-5-marcandre.lureau@redhat.com> <9d02acd4-8a60-1ac3-00d9-8c99940254a2@linux.vnet.ibm.com> <20180622110312.275b5d59@redhat.com> <20180622155642.3f05423b@redhat.com> <20180625113128.3a8a546b@redhat.com> From: Stefan Berger Date: Mon, 25 Jun 2018 10:23:36 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180625113128.3a8a546b@redhat.com> Content-Language: en-MW X-TM-AS-GCONF: 00 x-cbid: 18062514-0064-0000-0000-0000031FFDCD X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009252; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01052133; UDB=6.00539347; IPR=6.00830058; MB=3.00021848; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-25 14:23:40 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18062514-0065-0000-0000-000039B61467 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-25_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1806250168 X-MIME-Autoconverted: from 8bit to base64 by mx0b-001b2d01.pphosted.com id w5PEOkDj129312 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: Re: [Qemu-devel] [PATCH v4 4/5] acpi: build TPM Physical Presence interface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , qemu-devel@nongnu.org, =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP supported.                            | + +----------+--------+--------+-------------------------------------------+ +   | res1     |  0x40  |  0x119 | Reserved for future use                   | + +----------+--------+--------+-------------------------------------------+ +   | next_step|   0x1  |  0x159 | Operation to execute after reboot by      | +   |          |        |        | firmware. Used by firmware.               | + +----------+--------+--------+-------------------------------------------+ + +   The following values are supported for the 'func' field. They correspond +   to the values used by ACPI function index 8. + + +----------+-------------------------------------------------------------+ +   | value    | Description                                                 | + +----------+-------------------------------------------------------------+ +   | 0        | Operation is not implemented.                               | + +----------+-------------------------------------------------------------+ +   | 1        | Operation is only accessible through firmware.              | + +----------+-------------------------------------------------------------+ +   | 2        | Operation is blocked for OS by firmware configuration.      | + +----------+-------------------------------------------------------------+ +   | 3        | Operation is allowed and physically present user required.  | + +----------+-------------------------------------------------------------+ +   | 4        | Operation is allowed and physically present user is not     | +   |          | required.                                                   | + +----------+-------------------------------------------------------------+ +  QEMU files related to TPM ACPI tables:   - hw/i386/acpi-build.c diff --git a/docs/specs/tpm.txt b/docs/specs/tpm.txt index c230c4c93e..90f96c53cb 100644 --- a/docs/specs/tpm.txt +++ b/docs/specs/tpm.txt @@ -42,6 +42,85 @@ URL:  https://trustedcomputinggroup.org/tcg-acpi-specification/ +== ACPI PPI Interface == + +QEMU supports the Physical Presence Interface (PPI) for TPM 1.2 and TPM 2. This +interface requires ACPI and firmware support. The specification can be found at +the following URL: + +https://trustedcomputinggroup.org/resource/tcg-physical-presence-interface-specification/ + +PPI enables a system administrator (root) to request a modification to the +TPM upon reboot. The PPI specification defines the operation requests and the +actions the firmware has to take. The system administrator passes the operation +request number to the firmware through an ACPI interface which writes this +number to a memory location that the firmware knows. Upon reboot, the firmware +finds the number and sends commands to the the TPM. The firmware writes the TPM +result code and the operation request number to a memory location that ACPI can +read from and pass the result on to the administrator. + +The PPI specification defines a set of mandatory and optional operations for +the firmware to implement. The ACPI interface also allows an administrator to +list the supported operations. In QEMU the ACPI code is generated by QEMU, yet +the firmware needs to implement support on a per-operations basis, and +different firmwares may support a different subset. Therefore, QEMU introduces +the virtual memory device for PPI where the firmware can indicate which +operations it supports and ACPI can enable the ones that are supported and +disable all others. This interface lies in main memory and has the following +layout: + + +----------+--------+--------+-------------------------------------------+ +   |  Field   | Length | Offset | Description               | + +----------+--------+--------+-------------------------------------------+ +   | func     |  0x100 |  0x000 | Firmware sets values for each supported   | +   |          |        |        | operation. See defined values below.      | + +----------+--------+--------+-------------------------------------------+ +   | ppin     |   0x1  |  0x100 | SMI interrupt to use. Set by firmware.    | +   |          |        |        | Not supported.                            | + +----------+--------+--------+-------------------------------------------+ +   | ppip     |   0x4  |  0x101 | ACPI function index to pass to SMM code.  | +   |          |        |        | Set by ACPI. Not supported.               | + +----------+--------+--------+-------------------------------------------+ +   | pprp     |   0x4  |  0x105 | Result of last executed operation. Set by | +   |          |        |        | firmware. See function index 5 for values.| + +----------+--------+--------+-------------------------------------------+ +   | pprq     |   0x4  |  0x109 | Operation request number to execute. See  | +   |          |        |        | 'Physical Presence Interface Operation    | +   |          |        |        | Summary' tables in specs. Set by ACPI.    | + +----------+--------+--------+-------------------------------------------+ +   | pprm     |   0x4  |  0x10d | Operation request optional parameter.     | +   |          |        |        | Values depend on operation. Set by ACPI.  | + +----------+--------+--------+-------------------------------------------+ +   | lppr     |   0x4  |  0x111 | Last executed operation request number.   | +   |          |        |        | Copied from pprq field by firmware.       | + +----------+--------+--------+-------------------------------------------+ +   | fret     |   0x4  |  0x115 | Result code from SMM function.            | +   |          |        |        | Not