qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 56918a: memory: Add RAM_PROTECTED flag to ski


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 56918a: memory: Add RAM_PROTECTED flag to skip IOMMU mappings
Date: Thu, 30 Sep 2021 13:16:55 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 56918a126ae25383cb0c2c74a6f0f784a6d59ac1
      
https://github.com/qemu/qemu/commit/56918a126ae25383cb0c2c74a6f0f784a6d59ac1
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/vfio/common.c
    M include/exec/memory.h
    M softmmu/memory.c
    M softmmu/physmem.c

  Log Message:
  -----------
  memory: Add RAM_PROTECTED flag to skip IOMMU mappings

Add a new RAMBlock flag to denote "protected" memory, i.e. memory that
looks and acts like RAM but is inaccessible via normal mechanisms,
including DMA.  Use the flag to skip protected memory regions when
mapping RAM for DMA in VFIO.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 2f44bea907bb76adc511de5ba733c5164eedbce8
      
https://github.com/qemu/qemu/commit/2f44bea907bb76adc511de5ba733c5164eedbce8
  Author: Yang Zhong <yang.zhong@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M configs/devices/i386-softmmu/default.mak
    M hw/i386/Kconfig

  Log Message:
  -----------
  Kconfig: Add CONFIG_SGX support

Add new CONFIG_SGX for sgx support in the Qemu, and the Kconfig
default enable sgx in the i386 platform.

Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-32-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: c6c023200045fc9d61574cb157d368707e18efd5
      
https://github.com/qemu/qemu/commit/c6c023200045fc9d61574cb157d368707e18efd5
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    A backends/hostmem-epc.c
    M backends/meson.build
    A include/hw/i386/hostmem-epc.h

  Log Message:
  -----------
  hostmem: Add hostmem-epc as a backend for SGX EPC

EPC (Enclave Page Cahe) is a specialized type of memory used by Intel
SGX (Software Guard Extensions).  The SDM desribes EPC as:

    The Enclave Page Cache (EPC) is the secure storage used to store
    enclave pages when they are a part of an executing enclave. For an
    EPC page, hardware performs additional access control checks to
    restrict access to the page. After the current page access checks
    and translations are performed, the hardware checks that the EPC
    page is accessible to the program currently executing. Generally an
    EPC page is only accessed by the owner of the executing enclave or
    an instruction which is setting up an EPC page.

Because of its unique requirements, Linux manages EPC separately from
normal memory.  Similar to memfd, the device /dev/sgx_vepc can be
opened to obtain a file descriptor which can in turn be used to mmap()
EPC memory.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-3-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 46a1d21dbaafab2df25ac354095d90492cd3a98b
      
https://github.com/qemu/qemu/commit/46a1d21dbaafab2df25ac354095d90492cd3a98b
  Author: Yang Zhong <yang.zhong@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M qapi/qom.json

  Log Message:
  -----------
  qom: Add memory-backend-epc ObjectOptions support

Add the new 'memory-backend-epc' user creatable QOM object in
the ObjectOptions to support SGX since v6.1, or the sgx backend
object cannot bootup.

Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-4-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 80509c5557a152f876aec524e8136f309583b2cd
      
https://github.com/qemu/qemu/commit/80509c5557a152f876aec524e8136f309583b2cd
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/i386/meson.build
    A hw/i386/sgx-epc.c
    A include/hw/i386/sgx-epc.h

  Log Message:
  -----------
  i386: Add 'sgx-epc' device to expose EPC sections to guest

SGX EPC is enumerated through CPUID, i.e. EPC "devices" need to be
realized prior to realizing the vCPUs themselves, which occurs long
before generic devices are parsed and realized.  Because of this,
do not allow 'sgx-epc' devices to be instantiated after vCPUS have
been created.

The 'sgx-epc' device is essentially a placholder at this time, it will
be fully implemented in a future patch along with a dedicated command
to create 'sgx-epc' devices.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-5-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: dfce81f1b931352af0fcfe966c115a09646bd15a
      
https://github.com/qemu/qemu/commit/dfce81f1b931352af0fcfe966c115a09646bd15a
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/i386/sgx-epc.c
    M hw/i386/x86.c
    M include/hw/i386/pc.h
    M include/hw/i386/sgx-epc.h
    M include/hw/i386/x86.h
    M qapi/machine.json
    M qemu-options.hx

  Log Message:
  -----------
  vl: Add sgx compound properties to expose SGX EPC sections to guest

Because SGX EPC is enumerated through CPUID, EPC "devices" need to be
realized prior to realizing the vCPUs themselves, i.e. long before
generic devices are parsed and realized.  From a virtualization
perspective, the CPUID aspect also means that EPC sections cannot be
hotplugged without paravirtualizing the guest kernel (hardware does
not support hotplugging as EPC sections must be locked down during
pre-boot to provide EPC's security properties).

So even though EPC sections could be realized through the generic
-devices command, they need to be created much earlier for them to
actually be usable by the guest.  Place all EPC sections in a
contiguous block, somewhat arbitrarily starting after RAM above 4g.
Ensuring EPC is in a contiguous region simplifies calculations, e.g.
device memory base, PCI hole, etc..., allows dynamic calculation of the
total EPC size, e.g. exposing EPC to guests does not require -maxmem,
and last but not least allows all of EPC to be enumerated in a single
ACPI entry, which is expected by some kernels, e.g. Windows 7 and 8.

The new compound properties command for sgx like below:
 ......
 -object memory-backend-epc,id=mem1,size=28M,prealloc=on \
 -object memory-backend-epc,id=mem2,size=10M \
 -M sgx-epc.0.memdev=mem1,sgx-epc.1.memdev=mem2

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-6-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 5c76b651d0f6c420d31e51d22c380a0bdd04fb98
      
https://github.com/qemu/qemu/commit/5c76b651d0f6c420d31e51d22c380a0bdd04fb98
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M target/i386/cpu.c
    M target/i386/cpu.h

  Log Message:
  -----------
  i386: Add primary SGX CPUID and MSR defines

Add CPUID defines for SGX and SGX Launch Control (LC), as well as
defines for their associated FEATURE_CONTROL MSR bits.  Define the
Launch Enclave Public Key Hash MSRs (LE Hash MSRs), which exist
when SGX LC is present (in CPUID), and are writable when SGX LC is
enabled (in FEATURE_CONTROL).

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-7-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 4b841a793cd5c460b99312f80d306cec37a1b69d
      
https://github.com/qemu/qemu/commit/4b841a793cd5c460b99312f80d306cec37a1b69d
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M target/i386/cpu.c
    M target/i386/cpu.h

  Log Message:
  -----------
  i386: Add SGX CPUID leaf FEAT_SGX_12_0_EAX

CPUID leaf 12_0_EAX is an Intel-defined feature bits leaf enumerating
the CPU's SGX capabilities, e.g. supported SGX instruction sets.
Currently there are four enumerated capabilities:

    - SGX1 instruction set, i.e. "base" SGX
    - SGX2 instruction set for dynamic EPC management
    - ENCLV instruction set for VMM oversubscription of EPC
    - ENCLS-C instruction set for thread safe variants of ENCLS

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-8-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 120ca112ed0cb7c3c747f40d8380a5dc210e42ba
      
https://github.com/qemu/qemu/commit/120ca112ed0cb7c3c747f40d8380a5dc210e42ba
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M target/i386/cpu.c
    M target/i386/cpu.h

  Log Message:
  -----------
  i386: Add SGX CPUID leaf FEAT_SGX_12_0_EBX

CPUID leaf 12_0_EBX is an Intel-defined feature bits leaf enumerating
the platform's SGX extended capabilities.  Currently there is a single
capabilitiy:

   - EXINFO: record information about #PFs and #GPs in the enclave's SSA

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-9-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 165981a5e6baca05c99c1cdd5f7f6d89de77d5d7
      
https://github.com/qemu/qemu/commit/165981a5e6baca05c99c1cdd5f7f6d89de77d5d7
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M target/i386/cpu.c
    M target/i386/cpu.h

  Log Message:
  -----------
  i386: Add SGX CPUID leaf FEAT_SGX_12_1_EAX

CPUID leaf 12_1_EAX is an Intel-defined feature bits leaf enumerating
the platform's SGX capabilities that may be utilized by an enclave, e.g.
whether or not an enclave can gain access to the provision key.
Currently there are six capabilities:

   - INIT: set when the enclave has has been initialized by EINIT.  Cannot
           be set by software, i.e. forced to zero in CPUID.
   - DEBUG: permits a debugger to read/write into the enclave.
   - MODE64BIT: the enclave runs in 64-bit mode
   - PROVISIONKEY: grants has access to the provision key
   - EINITTOKENKEY: grants access to the EINIT token key, i.e. the
                    enclave can generate EINIT tokens
   - KSS: Key Separation and Sharing enabled for the enclave.

Note that the entirety of CPUID.0x12.0x1, i.e. all registers, enumerates
the allowed ATTRIBUTES (128 bits), but only bits 31:0 are directly
exposed to the user (via FEAT_12_1_EAX).  Bits 63:32 are currently all
reserved and bits 127:64 correspond to the allowed XSAVE Feature Request
Mask, which is calculated based on other CPU features, e.g. XSAVE, MPX,
AVX, etc... and is not exposed to the user.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-10-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: db888065233ab435a8ea9e589ce755668eef4f90
      
https://github.com/qemu/qemu/commit/db888065233ab435a8ea9e589ce755668eef4f90
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M target/i386/cpu.c
    M target/i386/cpu.h
    M target/i386/kvm/kvm.c
    M target/i386/machine.c

  Log Message:
  -----------
  i386: Add get/set/migrate support for SGX_LEPUBKEYHASH MSRs

On real hardware, on systems that supports SGX Launch Control, those
MSRs are initialized to digest of Intel's signing key; on systems that
don't support SGX Launch Control, those MSRs are not available but
hardware always uses digest of Intel's signing key in EINIT.

KVM advertises SGX LC via CPUID if and only if the MSRs are writable.
Unconditionally initialize those MSRs to digest of Intel's signing key
when CPU is realized and reset to reflect the fact. This avoids
potential bug in case kvm_arch_put_registers() is called before
kvm_arch_get_registers() is called, in which case guest's virtual
SGX_LEPUBKEYHASH MSRs will be set to 0, although KVM initializes those
to digest of Intel's signing key by default, since KVM allows those MSRs
to be updated by Qemu to support live migration.

Save/restore the SGX Launch Enclave Public Key Hash MSRs if SGX Launch
Control (LC) is exposed to the guest. Likewise, migrate the MSRs if they
are writable by the guest.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Kai Huang <kai.huang@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-11-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: a04835414b8d1ba1af980692d5cf20f8fe4156a0
      
https://github.com/qemu/qemu/commit/a04835414b8d1ba1af980692d5cf20f8fe4156a0
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M target/i386/kvm/kvm.c

  Log Message:
  -----------
  i386: Add feature control MSR dependency when SGX is enabled

SGX adds multiple flags to FEATURE_CONTROL to enable SGX and Flexible
Launch Control.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-12-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 1dec2e1f19fdb39a0340356ec2d77233837b3d68
      
https://github.com/qemu/qemu/commit/1dec2e1f19fdb39a0340356ec2d77233837b3d68
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/i386/meson.build
    A hw/i386/sgx-stub.c
    A hw/i386/sgx.c
    M include/hw/i386/pc.h
    M include/hw/i386/sgx-epc.h
    M target/i386/cpu.c

  Log Message:
  -----------
  i386: Update SGX CPUID info according to hardware/KVM/user input

Expose SGX to the guest if and only if KVM is enabled and supports
virtualization of SGX.  While the majority of ENCLS can be emulated to
some degree, because SGX uses a hardware-based root of trust, the
attestation aspects of SGX cannot be emulated in software, i.e.
ultimately emulation will fail as software cannot generate a valid
quote/report.  The complexity of partially emulating SGX in Qemu far
outweighs the value added, e.g. an SGX specific simulator for userspace
applications can emulate SGX for development and testing purposes.

Note, access to the PROVISIONKEY is not yet advertised to the guest as
KVM blocks access to the PROVISIONKEY by default and requires userspace
to provide additional credentials (via ioctl()) to expose PROVISIONKEY.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-13-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: c22f5467856d7e7fa5ee4a1f0ee9edc3bb80bf5c
      
https://github.com/qemu/qemu/commit/c22f5467856d7e7fa5ee4a1f0ee9edc3bb80bf5c
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M target/i386/cpu.c
    M target/i386/kvm/kvm.c
    M target/i386/kvm/kvm_i386.h

  Log Message:
  -----------
  i386: kvm: Add support for exposing PROVISIONKEY to guest

If the guest want to fully use SGX, the guest needs to be able to
access provisioning key. Add a new KVM_CAP_SGX_ATTRIBUTE to KVM to
support provisioning key to KVM guests.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-14-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: b9edbadefb9ecbb1b1754c86ba7d1d7ce3e876aa
      
https://github.com/qemu/qemu/commit/b9edbadefb9ecbb1b1754c86ba7d1d7ce3e876aa
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M target/i386/kvm/kvm.c

  Log Message:
  -----------
  i386: Propagate SGX CPUID sub-leafs to KVM

The SGX sub-leafs are enumerated at CPUID 0x12.  Indices 0 and 1 are
always present when SGX is supported, and enumerate SGX features and
capabilities.  Indices >=2 are directly correlated with the platform's
EPC sections.  Because the number of EPC sections is dynamic and user
defined, the number of SGX sub-leafs is "NULL" terminated.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-15-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: dca6cffc550a3243ba8d106dd02b411342e58782
      
https://github.com/qemu/qemu/commit/dca6cffc550a3243ba8d106dd02b411342e58782
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M target/i386/cpu.c

  Log Message:
  -----------
  Adjust min CPUID level to 0x12 when SGX is enabled

SGX capabilities are enumerated through CPUID_0x12.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-16-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: e2560114cdb127985b75ec2554cb2f0d91dd03f3
      
https://github.com/qemu/qemu/commit/e2560114cdb127985b75ec2554cb2f0d91dd03f3
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/i386/fw_cfg.c

  Log Message:
  -----------
  hw/i386/fw_cfg: Set SGX bits in feature control fw_cfg accordingly

Request SGX an SGX Launch Control to be enabled in FEATURE_CONTROL
when the features are exposed to the guest. Our design is the SGX
Launch Control bit will be unconditionally set in FEATURE_CONTROL,
which is unlike host bios.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-17-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 0cf4ce00d2255ef48d560d36559e7a4cda41748b
      
https://github.com/qemu/qemu/commit/0cf4ce00d2255ef48d560d36559e7a4cda41748b
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/i386/pc.c
    M include/hw/i386/sgx-epc.h

  Log Message:
  -----------
  hw/i386/pc: Account for SGX EPC sections when calculating device memory

Add helpers to detect if SGX EPC exists above 4g, and if so, where SGX
EPC above 4g ends.  Use the helpers to adjust the device memory range
if SGX EPC exists above 4g.

For multiple virtual EPC sections, we just put them together physically
contiguous for the simplicity because we don't support EPC NUMA affinity
now. Once the SGX EPC NUMA support in the kernel SGX driver, we will
support this in the future.

Note that SGX EPC is currently hardcoded to reside above 4g.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-18-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 1ed1ccc5a429b3fb35d9756f911eb652a6ab00c5
      
https://github.com/qemu/qemu/commit/1ed1ccc5a429b3fb35d9756f911eb652a6ab00c5
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/i386/pc.c

  Log Message:
  -----------
  i386/pc: Add e820 entry for SGX EPC section(s)

Note that SGX EPC is currently guaranteed to reside in a single
contiguous chunk of memory regardless of the number of EPC sections.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-19-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: c8a9899c1adc66a0dcf8f9658a1290a41bc70c2a
      
https://github.com/qemu/qemu/commit/c8a9899c1adc66a0dcf8f9658a1290a41bc70c2a
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/i386/acpi-build.c

  Log Message:
  -----------
  i386: acpi: Add SGX EPC entry to ACPI tables

The ACPI Device entry for SGX EPC is essentially a hack whose primary
purpose is to provide software with a way to autoprobe SGX support,
e.g. to allow software to implement SGX support as a driver.  Details
on the individual EPC sections are not enumerated through ACPI tables,
i.e. software must enumerate the EPC sections via CPUID.  Furthermore,
software expects to see only a single EPC Device in the ACPI tables
regardless of the number of EPC sections in the system.

However, several versions of Windows do rely on the ACPI tables to
enumerate the address and size of the EPC.  So, regardless of the number
of EPC sections exposed to the guest, create exactly *one* EPC device
with a _CRS entry that spans the entirety of all EPC sections (which are
guaranteed to be contiguous in Qemu).

Note, NUMA support for EPC memory is intentionally not considered as
enumerating EPC NUMA information is not yet defined for bare metal.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-20-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 97488c635e2785281baeeb31b1a3340efc848ad1
      
https://github.com/qemu/qemu/commit/97488c635e2785281baeeb31b1a3340efc848ad1
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/i386/pc_q35.c

  Log Message:
  -----------
  q35: Add support for SGX EPC

Enable SGX EPC virtualization, which is currently only support by KVM.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-21-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: fb6986a20eb0b6573bb90fabcd7cfbe69bc53b11
      
https://github.com/qemu/qemu/commit/fb6986a20eb0b6573bb90fabcd7cfbe69bc53b11
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/i386/pc_piix.c

  Log Message:
  -----------
  i440fx: Add support for SGX EPC

Enable SGX EPC virtualization, which is currently only support by KVM.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-22-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: a7c565a941b02a22f84509db797bd364c2b5716b
      
https://github.com/qemu/qemu/commit/a7c565a941b02a22f84509db797bd364c2b5716b
  Author: Yang Zhong <yang.zhong@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/i386/sgx-epc.c
    M monitor/hmp-cmds.c
    M qapi/machine.json

  Log Message:
  -----------
  sgx-epc: Add the fill_device_info() callback support

Since there is no fill_device_info() callback support, and when we
execute "info memory-devices" command in the monitor, the segfault
will be found.

This patch will add this callback support and "info memory-devices"
will show sgx epc memory exposed to guest. The result as below:

qemu) info memory-devices
Memory device [sgx-epc]: ""
  memaddr: 0x180000000
  size: 29360128
  memdev: /objects/mem1
Memory device [sgx-epc]: ""
  memaddr: 0x181c00000
  size: 10485760
  memdev: /objects/mem2

Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-33-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: c5348c6a163f6956e7f640902b7401a1b4bad8c7
      
https://github.com/qemu/qemu/commit/c5348c6a163f6956e7f640902b7401a1b4bad8c7
  Author: Sean Christopherson <sean.j.christopherson@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    A docs/system/i386/sgx.rst
    M docs/system/target-i386.rst

  Log Message:
  -----------
  docs/system: Add SGX documentation to the system manual

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210719112136.57018-34-yang.zhong@intel.com>
[Convert to reStructuredText, and adopt the standard === --- ~~~ headings
 suggested for example by Linux. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 57d874c4c7a0acbaa076a166e3da093b6edbdb0f
      
https://github.com/qemu/qemu/commit/57d874c4c7a0acbaa076a166e3da093b6edbdb0f
  Author: Yang Zhong <yang.zhong@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hmp-commands-info.hx
    M hw/i386/sgx-stub.c
    M hw/i386/sgx.c
    A include/hw/i386/sgx.h
    M include/monitor/hmp-target.h
    M qapi/misc-target.json
    M target/i386/monitor.c
    M tests/qtest/qmp-cmd-test.c

  Log Message:
  -----------
  target/i386: Add HMP and QMP interfaces for SGX

The QMP and HMP interfaces can be used by monitor or QMP tools to retrieve
the SGX information from VM side when SGX is enabled on Intel platform.

Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210910102258.46648-2-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 0205c4fa1ea35d569b4c2f63adacef438c1e8f53
      
https://github.com/qemu/qemu/commit/0205c4fa1ea35d569b4c2f63adacef438c1e8f53
  Author: Yang Zhong <yang.zhong@intel.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M hw/i386/sgx-stub.c
    M hw/i386/sgx.c
    M include/hw/i386/sgx.h
    M qapi/misc-target.json
    M target/i386/monitor.c
    M tests/qtest/qmp-cmd-test.c

  Log Message:
  -----------
  target/i386: Add the query-sgx-capabilities QMP command

Libvirt can use query-sgx-capabilities to get the host
sgx capabilities to decide how to allocate SGX EPC size to VM.

Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20210910102258.46648-3-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: e49c0ef6f1cca3943f3d61da6e3da7e03ddf2a22
      
https://github.com/qemu/qemu/commit/e49c0ef6f1cca3943f3d61da6e3da7e03ddf2a22
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M meson.build
    M pc-bios/descriptors/meson.build
    M pc-bios/meson.build

  Log Message:
  -----------
  meson: unpack edk2 firmware even if --disable-blobs

The edk2 firmware blobs are needed to run bios-tables-test.  Unpack
them if any UEFI-enabled target is selected, so that the test can run.
This is a bit more than is actually necessary, since bios-tables-test
does not run for all UEFI-enabled targets, but it is the easiest
way to write this logic.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210923105529.3845741-1-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 809954efc279deff281ffad3d6a888760ea2b2d9
      
https://github.com/qemu/qemu/commit/809954efc279deff281ffad3d6a888760ea2b2d9
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M pc-bios/meson.build
    M tests/qtest/meson.build

  Log Message:
  -----------
  tests: qtest: bios-tables-test depends on the unpacked edk2 ROMs

Skip the test if bzip2 is not available, and run it after they are
uncompressed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210923105529.3845741-2-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 523a3d9524d5edd49dbec50c634b6e3872ad7d84
      
https://github.com/qemu/qemu/commit/523a3d9524d5edd49dbec50c634b6e3872ad7d84
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M target/i386/sev.c

  Log Message:
  -----------
  target/i386: Fix memory leak in sev_read_file_base64()

In sev_read_file_base64() we call g_file_get_contents(), which
allocates memory for the file contents.  We then base64-decode the
contents (which allocates another buffer for the decoded data), but
forgot to free the memory for the original file data.

Use g_autofree to ensure that the file data is freed.

Fixes: Coverity CID 1459997
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210820165650.2839-1-peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 142518bda515c132a46ce5826e73fbd2a5b154d9
      
https://github.com/qemu/qemu/commit/142518bda515c132a46ce5826e73fbd2a5b154d9
  Author: Peter Xu <peterx@redhat.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M accel/hvf/hvf-accel-ops.c
    M accel/kvm/kvm-all.c
    M hw/i386/xen/xen-hvm.c
    M hw/intc/openpic_kvm.c
    M hw/remote/proxy-memory-listener.c
    M hw/vfio/common.c
    M hw/vfio/spapr.c
    M hw/virtio/vhost-vdpa.c
    M hw/virtio/vhost.c
    M hw/virtio/virtio.c
    M hw/xen/xen_pt.c
    M include/exec/memory.h
    M include/sysemu/kvm_int.h
    M softmmu/physmem.c
    M target/arm/kvm.c
    M target/i386/hax/hax-mem.c
    M target/i386/kvm/kvm.c
    M target/i386/nvmm/nvmm-all.c
    M target/i386/whpx/whpx-all.c

  Log Message:
  -----------
  memory: Name all the memory listeners

Provide a name field for all the memory listeners.  It can be used to identify
which memory listener is which.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20210817013553.30584-2-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: fcb3ab341accb8ed897f148238cae0324ed89d2c
      
https://github.com/qemu/qemu/commit/fcb3ab341accb8ed897f148238cae0324ed89d2c
  Author: Peter Xu <peterx@redhat.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M softmmu/memory.c
    M softmmu/trace-events

  Log Message:
  -----------
  memory: Add tracepoint for dirty sync

Trace at memory_region_sync_dirty_bitmap() for log_sync() or global_log_sync()
on memory regions.  One trace line should suffice when it finishes, so as to
estimate the time used for each log sync process.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20210817013706.30986-1-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 653163fcbcab72499ff1c2011f3552811d957729
      
https://github.com/qemu/qemu/commit/653163fcbcab72499ff1c2011f3552811d957729
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M io/dns-resolver.c
    M meson.build
    M qapi/sockets.json
    M util/qemu-sockets.c

  Log Message:
  -----------
  build-sys: add HAVE_IPPROTO_MPTCP

The QAPI schema shouldn't rely on C system headers #define, but on
configure-time project #define, so we can express the build condition in
a C-independent way.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210907121943.3498701-3-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: c1de5858bd39b299d3d8baec38b0376bed7f19e8
      
https://github.com/qemu/qemu/commit/c1de5858bd39b299d3d8baec38b0376bed7f19e8
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M meson_options.txt

  Log Message:
  -----------
  meson_options.txt: Switch the default value for the vnc option to 'auto'

There is no reason why VNC should always be enabled and not be set to
the default value. We already switched the setting in the "configure"
script in commit 3a6a1256d4 ("configure: Allow vnc to get disabled with
--without-default-features"), so let's do that in meson_options.txt now,
too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210903081358.956267-3-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 0021c4765a6b83e5b09409b75d50c6caaa6971b9
      
https://github.com/qemu/qemu/commit/0021c4765a6b83e5b09409b75d50c6caaa6971b9
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-09-30 (Thu, 30 Sep 2021)

  Changed paths:
    M accel/hvf/hvf-accel-ops.c
    M accel/kvm/kvm-all.c
    A backends/hostmem-epc.c
    M backends/meson.build
    M configs/devices/i386-softmmu/default.mak
    A docs/system/i386/sgx.rst
    M docs/system/target-i386.rst
    M hmp-commands-info.hx
    M hw/i386/Kconfig
    M hw/i386/acpi-build.c
    M hw/i386/fw_cfg.c
    M hw/i386/meson.build
    M hw/i386/pc.c
    M hw/i386/pc_piix.c
    M hw/i386/pc_q35.c
    A hw/i386/sgx-epc.c
    A hw/i386/sgx-stub.c
    A hw/i386/sgx.c
    M hw/i386/x86.c
    M hw/i386/xen/xen-hvm.c
    M hw/intc/openpic_kvm.c
    M hw/remote/proxy-memory-listener.c
    M hw/vfio/common.c
    M hw/vfio/spapr.c
    M hw/virtio/vhost-vdpa.c
    M hw/virtio/vhost.c
    M hw/virtio/virtio.c
    M hw/xen/xen_pt.c
    M include/exec/memory.h
    A include/hw/i386/hostmem-epc.h
    M include/hw/i386/pc.h
    A include/hw/i386/sgx-epc.h
    A include/hw/i386/sgx.h
    M include/hw/i386/x86.h
    M include/monitor/hmp-target.h
    M include/sysemu/kvm_int.h
    M io/dns-resolver.c
    M meson.build
    M meson_options.txt
    M monitor/hmp-cmds.c
    M pc-bios/descriptors/meson.build
    M pc-bios/meson.build
    M qapi/machine.json
    M qapi/misc-target.json
    M qapi/qom.json
    M qapi/sockets.json
    M qemu-options.hx
    M softmmu/memory.c
    M softmmu/physmem.c
    M softmmu/trace-events
    M target/arm/kvm.c
    M target/i386/cpu.c
    M target/i386/cpu.h
    M target/i386/hax/hax-mem.c
    M target/i386/kvm/kvm.c
    M target/i386/kvm/kvm_i386.h
    M target/i386/machine.c
    M target/i386/monitor.c
    M target/i386/nvmm/nvmm-all.c
    M target/i386/sev.c
    M target/i386/whpx/whpx-all.c
    M tests/qtest/meson.build
    M tests/qtest/qmp-cmd-test.c
    M util/qemu-sockets.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into 
staging

* SGX implementation for x86
* Miscellaneous bugfixes
* Fix dependencies from ROMs to qtests

# gpg: Signature made Thu 30 Sep 2021 14:30:35 BST
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini-gitlab/tags/for-upstream: (33 commits)
  meson_options.txt: Switch the default value for the vnc option to 'auto'
  build-sys: add HAVE_IPPROTO_MPTCP
  memory: Add tracepoint for dirty sync
  memory: Name all the memory listeners
  target/i386: Fix memory leak in sev_read_file_base64()
  tests: qtest: bios-tables-test depends on the unpacked edk2 ROMs
  meson: unpack edk2 firmware even if --disable-blobs
  target/i386: Add the query-sgx-capabilities QMP command
  target/i386: Add HMP and QMP interfaces for SGX
  docs/system: Add SGX documentation to the system manual
  sgx-epc: Add the fill_device_info() callback support
  i440fx: Add support for SGX EPC
  q35: Add support for SGX EPC
  i386: acpi: Add SGX EPC entry to ACPI tables
  i386/pc: Add e820 entry for SGX EPC section(s)
  hw/i386/pc: Account for SGX EPC sections when calculating device memory
  hw/i386/fw_cfg: Set SGX bits in feature control fw_cfg accordingly
  Adjust min CPUID level to 0x12 when SGX is enabled
  i386: Propagate SGX CPUID sub-leafs to KVM
  i386: kvm: Add support for exposing PROVISIONKEY to guest
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/fce8f7735fce...0021c4765a6b



reply via email to

[Prev in Thread] Current Thread [Next in Thread]