Commit 51c1c135 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging



pci, pc, virtio: fixes, features

tpm physical presence interface
rsc support in virtio net
ivshmem is removed
misc cleanups and fixes all over the place

Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>

# gpg: Signature made Fri 18 Jan 2019 02:11:11 GMT
# gpg:                using RSA key 281F0DB8D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream: (49 commits)
  migration: Use strnlen() for fixed-size string
  migration: Fix stringop-truncation warning
  hw/acpi: Use QEMU_NONSTRING for non NUL-terminated arrays
  block/sheepdog: Use QEMU_NONSTRING for non NUL-terminated arrays
  qemu/compiler: Define QEMU_NONSTRING
  acpi: update expected files
  hw: acpi: Fix memory hotplug AML generation error
  tpm: clear RAM when "memory overwrite" requested
  acpi: add ACPI memory clear interface
  acpi: build TPM Physical Presence interface
  acpi: expose TPM/PPI configuration parameters to firmware via fw_cfg
  tpm: allocate/map buffer for TPM Physical Presence interface
  tpm: add a "ppi" boolean property
  hw/misc/edu: add msi_uninit() for pci_edu_uninit()
  virtio: Make disable-legacy/disable-modern compat properties optional
  globals: Allow global properties to be optional
  virtio: virtio 9p really requires CONFIG_VIRTFS to work
  virtio: split virtio crypto bits from virtio-pci.h
  virtio: split virtio gpu bits from virtio-pci.h
  virtio: split virtio serial bits from virtio-pci
  ...

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 681d6136 a346af9c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1224,7 +1224,7 @@ static int find_vdi_name(BDRVSheepdogState *s, const char *filename,
    SheepdogVdiReq hdr;
    SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr;
    unsigned int wlen, rlen = 0;
    char buf[SD_MAX_VDI_LEN + SD_MAX_VDI_TAG_LEN];
    char buf[SD_MAX_VDI_LEN + SD_MAX_VDI_TAG_LEN] QEMU_NONSTRING;

    fd = connect_to_sdog(s, errp);
    if (fd < 0) {
+2 −1
Original line number Diff line number Diff line
CONFIG_VHOST_USER_SCSI=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX))
CONFIG_VHOST_USER_BLK=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX))
CONFIG_VIRTIO=y
CONFIG_VIRTIO_9P=y
CONFIG_VIRTIO_9P=$(CONFIG_VIRTFS)
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_CRYPTO=y
@@ -12,3 +12,4 @@ CONFIG_VIRTIO_RNG=y
CONFIG_SCSI=y
CONFIG_VIRTIO_SCSI=y
CONFIG_VIRTIO_SERIAL=y
CONFIG_VIRTIO_INPUT_HOST=$(CONFIG_LINUX)
+6 −2
Original line number Diff line number Diff line
@@ -17,12 +17,16 @@ get interrupted by its peers.

There are two basic configurations:

- Just shared memory: -device ivshmem-plain,memdev=HMB,...
- Just shared memory:

      -device ivshmem-plain,memdev=HMB,...

  This uses host memory backend HMB.  It should have option "share"
  set.

- Shared memory plus interrupts: -device ivshmem,chardev=CHR,vectors=N,...
- Shared memory plus interrupts:

      -device ivshmem-doorbell,chardev=CHR,vectors=N,...

  An ivshmem server must already be running on the host.  The device
  connects to the server's UNIX domain socket via character device
+104 −0
Original line number Diff line number Diff line
@@ -34,6 +34,25 @@ The CRB interface makes a memory mapped IO region in the area 0xfed40000 -
QEMU files related to TPM CRB interface:
 - hw/tpm/tpm_crb.c

= fw_cfg interface =

The bios/firmware may read the "etc/tpm/config" fw_cfg entry for
configuring the guest appropriately.

The entry of 6 bytes has the following content, in little-endian:

    #define TPM_VERSION_UNSPEC          0
    #define TPM_VERSION_1_2             1
    #define TPM_VERSION_2_0             2

    #define TPM_PPI_VERSION_NONE        0
    #define TPM_PPI_VERSION_1_30        1

    struct FwCfgTPMConfig {
        uint32_t tpmppi_address;         /* PPI memory location */
        uint8_t tpm_version;             /* TPM version */
        uint8_t tpmppi_version;          /* PPI version */
    };

= ACPI Interface =

@@ -57,6 +76,91 @@ 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 supported.                            |
 +----------+--------+--------+-------------------------------------------+
 | res1     |  0x40  |  0x119 | Reserved for future use                   |
 +----------+--------+--------+-------------------------------------------+
 | next_step|   0x1  |  0x159 | Operation to execute after reboot by      |
 |          |        |        | firmware. Used by firmware.               |
 +----------+--------+--------+-------------------------------------------+
 | movv     |   0x1  |  0x15a | Memory overwrite variable                 |
 +----------+--------+--------+-------------------------------------------+

   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.                                                   |
 +----------+-------------------------------------------------------------+

The location of the table is given by the fw_cfg tpmppi_address field.
The PPI memory region size is 0x400 (TPM_PPI_ADDR_SIZE) to leave
enough room for future updates.


QEMU files related to TPM ACPI tables:
 - hw/i386/acpi-build.c
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ common-obj-$(call lnot,$(CONFIG_ACPI_X86)) += acpi-stub.o
common-obj-y += acpi_interface.o
common-obj-y += bios-linker-loader.o
common-obj-y += aml-build.o
common-obj-$(CONFIG_TPM) += tpm.o

common-obj-$(CONFIG_IPMI) += ipmi.o
common-obj-$(call lnot,$(CONFIG_IPMI)) += ipmi-stub.o
Loading