x86 queue, 2021-06-18
There's still a lot to review/queue on the list, but I'm flush my current queue so it doesn't get stale.
The following changes since commit 18e53dff939898c6dd00d206a3c2f5cd3d6669db:
Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-c11-20210615' into staging (2021-06-17 10:42:57 +0100)
are available in the Git repository at:
https://gitlab.com/ehabkost/qemu.git tags/x86-next-pull-request
for you to fetch changes up to 4e2f5f3a9db06e87a73eb60a7cc9754fc13596ee:
scripts: helper to generate x86_64 CPU ABI compat info (2021-06-17 14:11:06 -0400)
----------------------------------------------------------------
x86 queue, 2021-06-18
Features:
* Add ratelimit for bus locks acquired in guest (Chenyi Qiang)
Documentation:
* SEV documentation updates (Tom Lendacky)
* Add a table showing x86-64 ABI compatibility levels (Daniel P. Berrangé)
Automated changes:
* Update Linux headers to 5.13-rc4 (Eduardo Habkost)
----------------------------------------------------------------
Chenyi Qiang (1):
i386: Add ratelimit for bus locks acquired in guest
Daniel P. Berrangé (2):
docs: add a table showing x86-64 ABI compatibility levels
scripts: helper to generate x86_64 CPU ABI compat info
Eduardo Habkost (1):
Update Linux headers to 5.13-rc4
Tom Lendacky (3):
doc: Fix some mistakes in the SEV documentation
docs: Add SEV-ES documentation to amd-memory-encryption.txt docs/interop/firmware.json: Add SEV-ES support
include/hw/i386/x86.h | 8 + .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h | 35 - include/standard-headers/drm/drm_fourcc.h | 23 +- include/standard-headers/linux/ethtool.h | 109 ++- include/standard-headers/linux/fuse.h | 17 +- include/standard-headers/linux/input.h | 2 +- include/standard-headers/linux/virtio_bt.h | 31 + include/standard-headers/linux/virtio_ids.h | 2 + include/standard-headers/linux/virtio_snd.h | 334 +++++++ .../standard-headers/rdma/vmw_pvrdma-abi.h | 7 + linux-headers/asm-generic/unistd.h | 13 +- linux-headers/asm-mips/unistd_n32.h | 751 +++++++-------- linux-headers/asm-mips/unistd_n64.h | 703 +++++++------- linux-headers/asm-mips/unistd_o32.h | 843 ++++++++--------- linux-headers/asm-powerpc/kvm.h | 2 + linux-headers/asm-powerpc/unistd_32.h | 856 +++++++++--------- linux-headers/asm-powerpc/unistd_64.h | 800 ++++++++-------- linux-headers/asm-s390/unistd_32.h | 4 + linux-headers/asm-s390/unistd_64.h | 4 + linux-headers/asm-x86/kvm.h | 3 + linux-headers/asm-x86/unistd_32.h | 4 + linux-headers/asm-x86/unistd_64.h | 4 + linux-headers/asm-x86/unistd_x32.h | 4 + linux-headers/linux/kvm.h | 131 ++- linux-headers/linux/userfaultfd.h | 36 +- linux-headers/linux/vfio.h | 35 + MAINTAINERS | 2 +- docs/amd-memory-encryption.txt | 89 +- docs/interop/firmware.json | 47 +- docs/system/cpu-models-x86-abi.csv | 67 ++ docs/system/cpu-models-x86.rst.inc | 22 + hw/i386/x86.c | 24 + scripts/cpu-x86-uarch-abi.py | 194 ++++ target/i386/kvm/kvm.c | 41 + 34 files changed, 3174 insertions(+), 2073 deletions(-) create mode 100644 include/standard-headers/linux/virtio_bt.h create mode 100644 include/standard-headers/linux/virtio_snd.h create mode 100644 docs/system/cpu-models-x86-abi.csv create mode 100644 scripts/cpu-x86-uarch-abi.py
Signature · 1 line
2.31.1
[PULL 5/7] docs/interop/firmware.json: Add SEV-ES support
From: Tom Lendacky <[email protected]>
Create an enum definition, '@amd-sev-es', for SEV-ES and add documention for the new enum. Add an example that shows some of the requirements for SEV-ES, including not having SMM support and the requirement for an X64-only build.
Message-Id: <b941a7ee105dfeb67607cf2d24dafcb82658b212.1619208498.git.thomas.lendacky@amd.com>
--- docs/interop/firmware.json | 47 +++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)
docs/interop/firmware.json +46 -1
@@ -115,6 +115,12 @@ # this feature are documented in # "docs/amd-memory-encryption.txt". # +# @amd-sev-es: The firmware supports running under AMD Secure Encrypted +# Virtualization - Encrypted State, as specified in the AMD64 +# Architecture Programmer's Manual. QEMU command line options +# related to this feature are documented in +# "docs/amd-memory-encryption.txt". +# # @enrolled-keys: The variable store (NVRAM) template associated with # the firmware binary has the UEFI Secure Boot # operational mode turned on, with certificates
@@ -179,7 +185,7 @@ # Since: 3.0 ## { 'enum' : 'FirmwareFeature', - 'data' : [ 'acpi-s3', 'acpi-s4', 'amd-sev', 'enrolled-keys', + 'data' : [ 'acpi-s3', 'acpi-s4', 'amd-sev', 'amd-sev-es', 'enrolled-keys', 'requires-smm', 'secure-boot', 'verbose-dynamic', 'verbose-static' ] }
@@ -504,6 +510,45 @@ # } # # { +# "description": "OVMF with SEV-ES support", +# "interface-types": [ +# "uefi" +# ], +# "mapping": { +# "device": "flash", +# "executable": { +# "filename": "/usr/share/OVMF/OVMF_CODE.fd", +# "format": "raw" +# }, +# "nvram-template": { +# "filename": "/usr/share/OVMF/OVMF_VARS.fd", +# "format": "raw" +# } +# }, +# "targets": [ +# { +# "architecture": "x86_64", +# "machines": [ +# "pc-q35-*" +# ] +# } +# ], +# "features": [ +# "acpi-s3", +# "amd-sev", +# "amd-sev-es", +# "verbose-dynamic" +# ], +# "tags": [ +# "-a X64", +# "-p OvmfPkg/OvmfPkgX64.dsc", +# "-t GCC48", +# "-b DEBUG", +# "-D FD_SIZE_4MB" +# ] +# } +# +# { # "description": "UEFI firmware for ARM64 virtual machines", # "interface-types": [ # "uefi"
Signature · 1 line
2.31.1
[PULL 3/7] doc: Fix some mistakes in the SEV documentation
In reply to Eduardo HabkostFrom: Tom Lendacky <[email protected]>
Fix some spelling and grammar mistakes in the amd-memory-encryption.txt file. No new information added.
Message-Id: <a7c5ee6c056d840f46028f4a817c16a9862bdd9e.1619208498.git.thomas.lendacky@amd.com>
--- docs/amd-memory-encryption.txt | 59 +++++++++++++++++----------------- 1 file changed, 29 insertions(+), 30 deletions(-)
docs/amd-memory-encryption.txt +29 -30
@@ -1,38 +1,38 @@ Secure Encrypted Virtualization (SEV) is a feature found on AMD processors. SEV is an extension to the AMD-V architecture which supports running encrypted -virtual machine (VMs) under the control of KVM. Encrypted VMs have their pages +virtual machines (VMs) under the control of KVM. Encrypted VMs have their pages (code and data) secured such that only the guest itself has access to the unencrypted version. Each encrypted VM is associated with a unique encryption -key; if its data is accessed to a different entity using a different key the +key; if its data is accessed by a different entity using a different key the encrypted guests data will be incorrectly decrypted, leading to unintelligible data. -The key management of this feature is handled by separate processor known as -AMD secure processor (AMD-SP) which is present in AMD SOCs. Firmware running -inside the AMD-SP provide commands to support common VM lifecycle. This +Key management for this feature is handled by a separate processor known as the +AMD secure processor (AMD-SP), which is present in AMD SOCs. Firmware running +inside the AMD-SP provides commands to support a common VM lifecycle. This includes commands for launching, snapshotting, migrating and debugging the -encrypted guest. Those SEV command can be issued via KVM_MEMORY_ENCRYPT_OP +encrypted guest. These SEV commands can be issued via KVM_MEMORY_ENCRYPT_OP ioctls. Launching --------- -Boot images (such as bios) must be encrypted before guest can be booted. -MEMORY_ENCRYPT_OP ioctl provides commands to encrypt the images :LAUNCH_START, +Boot images (such as bios) must be encrypted before a guest can be booted. The +MEMORY_ENCRYPT_OP ioctl provides commands to encrypt the images: LAUNCH_START, LAUNCH_UPDATE_DATA, LAUNCH_MEASURE and LAUNCH_FINISH. These four commands together generate a fresh memory encryption key for the VM, encrypt the boot -images and provide a measurement than can be used as an attestation of the +images and provide a measurement than can be used as an attestation of a successful launch. LAUNCH_START is called first to create a cryptographic launch context within -the firmware. To create this context, guest owner must provides guest policy, +the firmware. To create this context, guest owner must provide a guest policy, its public Diffie-Hellman key (PDH) and session parameters. These inputs -should be treated as binary blob and must be passed as-is to the SEV firmware. +should be treated as a binary blob and must be passed as-is to the SEV firmware. -The guest policy is passed as plaintext and hypervisor may able to read it +The guest policy is passed as plaintext. A hypervisor may choose to read it, but should not modify it (any modification of the policy bits will result in bad measurement). The guest policy is a 4-byte data structure containing -several flags that restricts what can be done on running SEV guest. +several flags that restricts what can be done on a running SEV guest. See KM Spec section 3 and 6.2 for more details. The guest policy can be provided via the 'policy' property (see below)
@@ -40,31 +40,30 @@ The guest policy can be provided via the 'policy' property (see below) # ${QEMU} \ sev-guest,id=sev0,policy=0x1...\ -Guest owners provided DH certificate and session parameters will be used to +The guest owner provided DH certificate and session parameters will be used to establish a cryptographic session with the guest owner to negotiate keys used for the attestation. -The DH certificate and session blob can be provided via 'dh-cert-file' and -'session-file' property (see below +The DH certificate and session blob can be provided via the 'dh-cert-file' and +'session-file' properties (see below) # ${QEMU} \ sev-guest,id=sev0,dh-cert-file=<file1>,session-file=<file2> LAUNCH_UPDATE_DATA encrypts the memory region using the cryptographic context -created via LAUNCH_START command. If required, this command can be called +created via the LAUNCH_START command. If required, this command can be called multiple times to encrypt different memory regions. The command also calculates the measurement of the memory contents as it encrypts. -LAUNCH_MEASURE command can be used to retrieve the measurement of encrypted -memory. This measurement is a signature of the memory contents that can be -sent to the guest owner as an attestation that the memory was encrypted -correctly by the firmware. The guest owner may wait to provide the guest -confidential information until it can verify the attestation measurement. -Since the guest owner knows the initial contents of the guest at boot, the -attestation measurement can be verified by comparing it to what the guest owner -expects. +LAUNCH_MEASURE can be used to retrieve the measurement of encrypted memory. +This measurement is a signature of the memory contents that can be sent to the +guest owner as an attestation that the memory was encrypted correctly by the +firmware. The guest owner may wait to provide the guest confidential information +until it can verify the attestation measurement. Since the guest owner knows the +initial contents of the guest at boot, the attestation measurement can be +verified by comparing it to what the guest owner expects. -LAUNCH_FINISH command finalizes the guest launch and destroy's the cryptographic +LAUNCH_FINISH finalizes the guest launch and destroys the cryptographic context. See SEV KM API Spec [1] 'Launching a guest' usage flow (Appendix A) for the
@@ -78,10 +77,10 @@ To launch a SEV guest Debugging ----------- -Since memory contents of SEV guest is encrypted hence hypervisor access to the -guest memory will get a cipher text. If guest policy allows debugging, then -hypervisor can use DEBUG_DECRYPT and DEBUG_ENCRYPT commands access the guest -memory region for debug purposes. This is not supported in QEMU yet. +Since the memory contents of a SEV guest are encrypted, hypervisor access to +the guest memory will return cipher text. If the guest policy allows debugging, +then a hypervisor can use the DEBUG_DECRYPT and DEBUG_ENCRYPT commands to access +the guest memory region for debug purposes. This is not supported in QEMU yet. Snapshot/Restore -----------------
Signature · 1 line
2.31.1
[PULL 7/7] scripts: helper to generate x86_64 CPU ABI compat info
In reply to Eduardo HabkostFrom: Daniel P. Berrangé <[email protected]>
This script is what is used to generate the docs data table in:
docs/system/cpu-models-x86-abi.csv
It can be useful to run if adding new CPU models / versions and the csv needs updating.
Message-Id: <[email protected]>
--- scripts/cpu-x86-uarch-abi.py | 194 +++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 scripts/cpu-x86-uarch-abi.py
scripts/cpu-x86-uarch-abi.py new file +194 -0
@@ -0,0 +1,194 @@ +#!/usr/bin/python3 +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# A script to generate a CSV file showing the x86_64 ABI +# compatibility levels for each CPU model. +# + +from qemu import qmp +import sys + +if len(sys.argv) != 1: + print("syntax: %s QMP-SOCK\n\n" % __file__ + + "Where QMP-SOCK points to a QEMU process such as\n\n" + + " # qemu-system-x86_64 -qmp unix:/tmp/qmp,server,nowait " + + "-display none -accel kvm", file=sys.stderr) + sys.exit(1) + +# Mandatory CPUID features for each microarch ABI level +levels = [ + [ # x86-64 baseline + "cmov", + "cx8", + "fpu", + "fxsr", + "mmx", + "syscall", + "sse", + "sse2", + ], + [ # x86-64-v2 + "cx16", + "lahf-lm", + "popcnt", + "pni", + "sse4.1", + "sse4.2", + "ssse3", + ], + [ # x86-64-v3 + "avx", + "avx2", + "bmi1", + "bmi2", + "f16c", + "fma", + "abm", + "movbe", + ], + [ # x86-64-v4 + "avx512f", + "avx512bw", + "avx512cd", + "avx512dq", + "avx512vl", + ], +] + +# Assumes externally launched process such as +# +# qemu-system-x86_64 -qmp unix:/tmp/qmp,server,nowait -display none -accel kvm +# +# Note different results will be obtained with TCG, as +# TCG masks out certain features otherwise present in +# the CPU model definitions, as does KVM. + + +sock = sys.argv[1] +cmd = sys.argv[2] +shell = qmp.QEMUMonitorProtocol(sock) +shell.connect() + +models = shell.cmd("query-cpu-definitions") + +# These QMP props don't correspond to CPUID fatures +# so ignore them +skip = [ + "family", + "min-level", + "min-xlevel", + "vendor", + "model", + "model-id", + "stepping", +] + +names = [] + +for model in models["return"]: + if "alias-of" in model: + continue + names.append(model["name"]) + +models = {} + +for name in sorted(names): + cpu = shell.cmd("query-cpu-model-expansion", + { "type": "static", + "model": { "name": name }}) + + got = {} + for (feature, present) in cpu["return"]["model"]["props"].items(): + if present and feature not in skip: + got[feature] = True + + if name in ["host", "max", "base"]: + continue + + models[name] = { + # Dict of all present features in this CPU model + "features": got, + + # Whether each x86-64 ABI level is satisfied + "levels": [False, False, False, False], + + # Number of extra CPUID features compared to the x86-64 ABI level + "distance":[-1, -1, -1, -1], + + # CPUID features present in model, but not in ABI level + "delta":[[], [], [], []], + + # CPUID features in ABI level but not present in model + "missing": [[], [], [], []], + } + + +# Calculate whether the CPU models satisfy each ABI level +for name in models.keys(): + for level in range(len(levels)): + got = set(models[name]["features"]) + want = set(levels[level]) + missing = want - got + match = True + if len(missing) > 0: + match = False + models[name]["levels"][level] = match + models[name]["missing"][level] = missing + +# Cache list of CPU models satisfying each ABI level +abi_models = [ + [], + [], + [], + [], +] + +for name in models.keys(): + for level in range(len(levels)): + if models[name]["levels"][level]: + abi_models[level].append(name) + + +for level in range(len(abi_models)): + # Find the union of features in all CPU models satisfying this ABI + allfeatures = {} + for name in abi_models[level]: + for feat in models[name]["features"]: + allfeatures[feat] = True + + # Find the intersection of features in all CPU models satisfying this ABI + commonfeatures = [] + for feat in allfeatures: + present = True + for name in models.keys(): + if not models[name]["levels"][level]: + continue + if feat not in models[name]["features"]: + present = False + if present: + commonfeatures.append(feat) + + # Determine how many extra features are present compared to the lowest + # common denominator + for name in models.keys(): + if not models[name]["levels"][level]: + continue + + delta = set(models[name]["features"].keys()) - set(commonfeatures) + models[name]["distance"][level] = len(delta) + models[name]["delta"][level] = delta + +def print_uarch_abi_csv(): + print("# Automatically generated from '%s'" % __file__) + print("Model,baseline,v2,v3,v4") + for name in models.keys(): + print(name, end="") + for level in range(len(levels)): + if models[name]["levels"][level]: + print(",✅", end="") + else: + print(",", end="") + print() + +print_uarch_abi_csv()
Signature · 1 line
2.31.1
[PULL 1/7] Update Linux headers to 5.13-rc4
In reply to Eduardo HabkostMessage-Id: <[email protected]>
--- .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h | 35 - include/standard-headers/drm/drm_fourcc.h | 23 +- include/standard-headers/linux/ethtool.h | 109 ++- include/standard-headers/linux/fuse.h | 17 +- include/standard-headers/linux/input.h | 2 +- include/standard-headers/linux/virtio_bt.h | 31 + include/standard-headers/linux/virtio_ids.h | 2 + include/standard-headers/linux/virtio_snd.h | 334 +++++++ .../standard-headers/rdma/vmw_pvrdma-abi.h | 7 + linux-headers/asm-generic/unistd.h | 13 +- linux-headers/asm-mips/unistd_n32.h | 751 +++++++-------- linux-headers/asm-mips/unistd_n64.h | 703 +++++++------- linux-headers/asm-mips/unistd_o32.h | 843 ++++++++--------- linux-headers/asm-powerpc/kvm.h | 2 + linux-headers/asm-powerpc/unistd_32.h | 856 +++++++++--------- linux-headers/asm-powerpc/unistd_64.h | 800 ++++++++-------- linux-headers/asm-s390/unistd_32.h | 4 + linux-headers/asm-s390/unistd_64.h | 4 + linux-headers/asm-x86/kvm.h | 3 + linux-headers/asm-x86/unistd_32.h | 4 + linux-headers/asm-x86/unistd_64.h | 4 + linux-headers/asm-x86/unistd_x32.h | 4 + linux-headers/linux/kvm.h | 131 ++- linux-headers/linux/userfaultfd.h | 36 +- linux-headers/linux/vfio.h | 35 + 25 files changed, 2707 insertions(+), 2046 deletions(-) create mode 100644 include/standard-headers/linux/virtio_bt.h create mode 100644 include/standard-headers/linux/virtio_snd.h
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h +0 -35
@@ -70,30 +70,6 @@ enum pvrdma_mtu { PVRDMA_MTU_4096 = 5, }; -static inline int pvrdma_mtu_enum_to_int (enum pvrdma_mtu mtu) -{ -switch (mtu) { -case PVRDMA_MTU_256 :return 256 ; -case PVRDMA_MTU_512 :return 512 ; -case PVRDMA_MTU_1024 :return 1024 ; -case PVRDMA_MTU_2048 :return 2048 ; -case PVRDMA_MTU_4096 :return 4096 ; -default :return -1 ; - } -} - -static inline enum pvrdma_mtu pvrdma_mtu_int_to_enum (int mtu) -{ -switch (mtu) { -case 256 :return PVRDMA_MTU_256 ; -case 512 :return PVRDMA_MTU_512 ; -case 1024 :return PVRDMA_MTU_1024 ; -case 2048 :return PVRDMA_MTU_2048 ; -case 4096 : -default :return PVRDMA_MTU_4096 ; - } -} -enum pvrdma_port_state {PVRDMA_PORT_NOP =0 ,PVRDMA_PORT_DOWN =1 ,
@@ -138,17 +114,6 @@ enum pvrdma_port_width { PVRDMA_WIDTH_12X = 8, }; -static inline int pvrdma_width_enum_to_int (enum pvrdma_port_width width) -{ -switch (width) { -case PVRDMA_WIDTH_1X :return 1 ; -case PVRDMA_WIDTH_4X :return 4 ; -case PVRDMA_WIDTH_8X :return 8 ; -case PVRDMA_WIDTH_12X :return 12 ; -default :return -1 ; - } -} -enum pvrdma_port_speed {PVRDMA_SPEED_SDR =1 ,PVRDMA_SPEED_DDR =2 ,
include/standard-headers/drm/drm_fourcc.h +21 -2
@@ -526,6 +526,25 @@ extern "C" {*/ #define I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS fourcc_mod_code(INTEL, 7) +/* +* Intel Color Control Surface with Clear Color (CCS) for Gen-12 render +* compression. +* +* The main surface is Y-tiled and is at plane index 0 whereas CCS is linear +* and at index 1. The clear color is stored at index 2, and the pitch should +* be ignored. The clear color structure is 256 bits. The first 128 bits +* represents Raw Clear Color Red, Green, Blue and Alpha color each represented +* by 32 bits. The raw clear color is consumed by the 3d engine and generates +* the converted clear color of size 64 bits. The first 32 bits store the Lower +* Converted Clear Color value and the next 32 bits store the Higher Converted +* Clear Color value when applicable. The Converted Clear Color values are +* consumed by the DE. The last 64 bits are used to store Color Discard Enable +* and Depth Clear Value Valid which are ignored by the DE. A CCS cache line +* corresponds to an area of 4x1 tiles in the main surface. The main surface +* pitch is required to be a multiple of 4 tile widths. +*/ +#define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC fourcc_mod_code(INTEL, 8) +/* * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks *
@@ -1035,9 +1054,9 @@ drm_fourcc_canonicalize_nvidia_format_mod(uint64_t modifier)* Not all combinations are valid, and different SoCs may support different * combinations of layout and options. */ -#define __fourcc_mod_amlogic_layout_mask 0xf +#define __fourcc_mod_amlogic_layout_mask 0xff#define __fourcc_mod_amlogic_options_shift 8 -#define __fourcc_mod_amlogic_options_mask 0xf +#define __fourcc_mod_amlogic_options_mask 0xff#define DRM_FORMAT_MOD_AMLOGIC_FBC (__layout, __options) \ fourcc_mod_code(AMLOGIC, \
include/standard-headers/linux/ethtool.h +77 -32
245 lines not on this page · raw message
include/standard-headers/linux/fuse.h +16 -1
@@ -179,6 +179,8 @@* 7.33 * - add FUSE_HANDLE_KILLPRIV_V2, FUSE_WRITE_KILL_SUIDGID, FATTR_KILL_SUIDGID * - add FUSE_OPEN_KILL_SUIDGID +* - extend fuse_setxattr_in, add FUSE_SETXATTR_EXT +* - add FUSE_SETXATTR_ACL_KILL_SGID */ #ifndef _LINUX_FUSE_H
@@ -326,6 +328,7 @@ struct fuse_file_lock {* does not have CAP_FSETID. Additionally upon * write/truncate sgid is killed only if file has group * execute permission. (Same as Linux VFS behavior). +* FUSE_SETXATTR_EXT: Server supports extended struct fuse_setxattr_in */ #define FUSE_ASYNC_READ (1 << 0)#define FUSE_POSIX_LOCKS (1 << 1)
@@ -356,6 +359,7 @@ struct fuse_file_lock {#define FUSE_MAP_ALIGNMENT (1 << 26)#define FUSE_SUBMOUNTS (1 << 27)#define FUSE_HANDLE_KILLPRIV_V2 (1 << 28) +#define FUSE_SETXATTR_EXT (1 << 29)/** * CUSE INIT request/reply flags
@@ -447,6 +451,12 @@ struct fuse_file_lock {*/ #define FUSE_OPEN_KILL_SUIDGID (1 << 0) +/** +* setxattr flags +* FUSE_SETXATTR_ACL_KILL_SGID: Clear SGID when system.posix_acl_access is set +*/ +#define FUSE_SETXATTR_ACL_KILL_SGID (1 << 0) +enum fuse_opcode {FUSE_LOOKUP =1 ,FUSE_FORGET =2 ,/* no reply */
@@ -677,9 +687,13 @@ struct fuse_fsync_in {uint32_t padding; }; +#define FUSE_COMPAT_SETXATTR_IN_SIZE 8 +struct fuse_setxattr_in {uint32_t size;uint32_t flags; +uint32_t setxattr_flags; +uint32_t padding; };struct fuse_getxattr_in {
@@ -899,7 +913,8 @@ struct fuse_notify_retrieve_in { };/* Device ioctls: */ -#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) +#define FUSE_DEV_IOC_MAGIC 229 +#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t)struct fuse_lseek_in {uint64_t fh;
include/standard-headers/linux/input.h +1 -1
@@ -81,7 +81,7 @@ struct input_id {* in units per radian. * When INPUT_PROP_ACCELEROMETER is set the resolution changes. * The main axes (ABS_X, ABS_Y, ABS_Z) are then reported in -* in units per g (units/g) and in units per degree per second +* units per g (units/g) and in units per degree per second * (units/deg/s) for rotational axes (ABS_RX, ABS_RY, ABS_RZ). */ struct input_absinfo {
include/standard-headers/linux/virtio_bt.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +#ifndef _LINUX_VIRTIO_BT_H +#define _LINUX_VIRTIO_BT_H + +#include "standard-headers/linux/virtio_types.h" + +/* Feature bits */ +#define VIRTIO_BT_F_VND_HCI 0/* Indicates vendor command support */ +#define VIRTIO_BT_F_MSFT_EXT 1/* Indicates MSFT vendor support */ +#define VIRTIO_BT_F_AOSP_EXT 2/* Indicates AOSP vendor support */ + +enum virtio_bt_config_type { +VIRTIO_BT_CONFIG_TYPE_PRIMARY =0 , +VIRTIO_BT_CONFIG_TYPE_AMP =1 , +}; + +enum virtio_bt_config_vendor { +VIRTIO_BT_CONFIG_VENDOR_NONE =0 , +VIRTIO_BT_CONFIG_VENDOR_ZEPHYR =1 , +VIRTIO_BT_CONFIG_VENDOR_INTEL =2 , +VIRTIO_BT_CONFIG_VENDOR_REALTEK =3 , +}; + +struct virtio_bt_config { +uint8_t type; +uint16_t vendor; +uint16_t msft_opcode; +}QEMU_PACKED ; + +#endif /* _LINUX_VIRTIO_BT_H */
include/standard-headers/linux/virtio_ids.h +2 -0
@@ -51,8 +51,10 @@#define VIRTIO_ID_PSTORE 22/* virtio pstore device */ #define VIRTIO_ID_IOMMU 23/* virtio IOMMU */ #define VIRTIO_ID_MEM 24/* virtio mem */ +#define VIRTIO_ID_SOUND 25/* virtio sound */ #define VIRTIO_ID_FS 26/* virtio filesystem */ #define VIRTIO_ID_PMEM 27/* virtio pmem */ +#define VIRTIO_ID_BT 28/* virtio bluetooth */ #define VIRTIO_ID_MAC80211_HWSIM 29/* virtio mac80211-hwsim */ #endif /* _LINUX_VIRTIO_IDS_H */
include/standard-headers/linux/virtio_snd.h new file +334 -0
334 lines not on this page · raw message
include/standard-headers/rdma/vmw_pvrdma-abi.h +7 -0
@@ -133,6 +133,13 @@ enum pvrdma_wc_flags { PVRDMA_WC_FLAGS_MAX = PVRDMA_WC_WITH_NETWORK_HDR_TYPE, }; +enum pvrdma_network_type { +PVRDMA_NETWORK_IB , +PVRDMA_NETWORK_ROCE_V1 =PVRDMA_NETWORK_IB , +PVRDMA_NETWORK_IPV4 , +PVRDMA_NETWORK_IPV6 +}; +struct pvrdma_alloc_ucontext_resp {uint32_t qp_tab_size;uint32_t reserved;
linux-headers/asm-generic/unistd.h +12 -1
@@ -861,9 +861,20 @@ __SYSCALL(__NR_faccessat2, sys_faccessat2) __SYSCALL(__NR_process_madvise, sys_process_madvise)#define __NR_epoll_pwait2 441 __SC_COMP(__NR_epoll_pwait2, sys_epoll_pwait2, compat_sys_epoll_pwait2) +#define __NR_mount_setattr 442 +__SYSCALL(__NR_mount_setattr, sys_mount_setattr) +#define __NR_quotactl_path 443 +__SYSCALL(__NR_quotactl_path, sys_quotactl_path) + +#define __NR_landlock_create_ruleset 444 +__SYSCALL(__NR_landlock_create_ruleset, sys_landlock_create_ruleset) +#define __NR_landlock_add_rule 445 +__SYSCALL(__NR_landlock_add_rule, sys_landlock_add_rule) +#define __NR_landlock_restrict_self 446 +__SYSCALL(__NR_landlock_restrict_self, sys_landlock_restrict_self)#undef __NR_syscalls -#define __NR_syscalls 442 +#define __NR_syscalls 447/* * 32 bit systems traditionally used different
linux-headers/asm-mips/unistd_n32.h +377 -374
753 lines not on this page · raw message
linux-headers/asm-mips/unistd_n64.h +353 -350
705 lines not on this page · raw message
linux-headers/asm-mips/unistd_o32.h +423 -420
741 lines not on this page · raw message
linux-headers/asm-powerpc/unistd_32.h +430 -426
856 lines not on this page · raw message
linux-headers/asm-powerpc/unistd_64.h +402 -398
800 lines not on this page · raw message
linux-headers/linux/kvm.h +129 -2
131 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.31.1
Part of the diff is not shown here. View the raw message.
[PULL 6/7] docs: add a table showing x86-64 ABI compatibility levels
In reply to Eduardo HabkostFrom: Daniel P. Berrangé <[email protected]>
It is useful to know which CPUs satisfy each x86-64 ABI compatibility level, when dealing with guest OS that require something newer than the baseline ABI.
These ABI levels are defined in:
https://gitlab.com/x86-psABIs/x86-64-ABI/
and supported by GCC, Clang, glibc and more.
Message-Id: <[email protected]>
--- MAINTAINERS | 2 +- docs/system/cpu-models-x86-abi.csv | 67 ++++++++++++++++++++++++++++++ docs/system/cpu-models-x86.rst.inc | 22 ++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 docs/system/cpu-models-x86-abi.csv
MAINTAINERS +1 -1
@@ -328,7 +328,7 @@ F: tests/tcg/i386/ F: tests/tcg/x86_64/ F: hw/i386/ F: disas/i386.c -F: docs/system/cpu-models-x86.rst.inc +F: docs/system/cpu-models-x86* T: git https://gitlab.com/ehabkost/qemu.git x86-next Xtensa TCG CPUs
docs/system/cpu-models-x86-abi.csv new file +67 -0
67 lines not on this page · raw message
docs/system/cpu-models-x86.rst.inc +22 -0
@@ -39,6 +39,28 @@ CPU, as they would with "Host passthrough", but gives much of the benefit of passthrough, while making live migration safe. +ABI compatibility levels for CPU models +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The x86_64 architecture has a number of `ABI compatibility levels`_ +defined. Traditionally most operating systems and toolchains would +only target the original baseline ABI. It is expected that in +future OS and toolchains are likely to target newer ABIs. The +table that follows illustrates which ABI compatibility levels +can be satisfied by the QEMU CPU models. Note that the table only +lists the long term stable CPU model versions (eg Haswell-v4). +In addition to whats listed, there are also many CPU model +aliases which resolve to a different CPU model version, +depending on the machine type is in use. + +.. _ABI compatibility levels: https://gitlab.com/x86-psABIs/x86-64-ABI/ + +.. csv-table:: x86-64 ABI compatibility levels + :file: cpu-models-x86-abi.csv + :widths: 40,15,15,15,15 + :header-rows: 2 + + Preferred CPU models for Intel x86 hosts ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Signature · 1 line
2.31.1
[PULL 2/7] i386: Add ratelimit for bus locks acquired in guest
In reply to Eduardo HabkostFrom: Chenyi Qiang <[email protected]>
A bus lock is acquired through either split locked access to writeback (WB) memory or any locked access to non-WB memory. It is typically >1000 cycles slower than an atomic operation within a cache and can also disrupts performance on other cores.
Virtual Machines can exploit bus locks to degrade the performance of system. To address this kind of performance DOS attack coming from the VMs, bus lock VM exit is introduced in KVM and it can report the bus locks detected in guest. If enabled in KVM, it would exit to the userspace to let the user enforce throttling policies once bus locks acquired in VMs.
The availability of bus lock VM exit can be detected through the KVM_CAP_X86_BUS_LOCK_EXIT. The returned bitmap contains the potential policies supported by KVM. The field KVM_BUS_LOCK_DETECTION_EXIT in bitmap is the only supported strategy at present. It indicates that KVM will exit to userspace to handle the bus locks.
This patch adds a ratelimit on the bus locks acquired in guest as a mitigation policy.
Introduce a new field "bus_lock_ratelimit" to record the limited speed of bus locks in the target VM. The user can specify it through the "bus-lock-ratelimit" as a machine property. In current implementation, the default value of the speed is 0 per second, which means no restrictions on the bus locks.
As for ratelimit on detected bus locks, simply set the ratelimit interval to 1s and restrict the quota of bus lock occurence to the value of "bus_lock_ratelimit". A potential alternative is to introduce the time slice as a property which can help the user achieve more precise control.
The detail of bus lock VM exit can be found in spec:
https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html
Message-Id: <[email protected]>
--- include/hw/i386/x86.h | 8 ++++++++ hw/i386/x86.c | 24 ++++++++++++++++++++++++ target/i386/kvm/kvm.c | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+)
include/hw/i386/x86.h +8 -0
@@ -74,12 +74,20 @@ struct X86MachineState {* will be translated to MSI messages in the address space. */ AddressSpace *ioapic_as; + +/* +* Ratelimit enforced on detected bus locks in guest. +* The default value of the bus_lock_ratelimit is 0 per second, +* which means no limitation on the guest's bus locks. +*/ +uint64_t bus_lock_ratelimit; };#define X86_MACHINE_SMM "smm"#define X86_MACHINE_ACPI "acpi"#define X86_MACHINE_OEM_ID "x-oem-id"#define X86_MACHINE_OEM_TABLE_ID "x-oem-table-id" +#define X86_MACHINE_BUS_LOCK_RATELIMIT "bus-lock-ratelimit"#define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86")OBJECT_DECLARE_TYPE (X86MachineState, X86MachineClass,X86_MACHINE )
hw/i386/x86.c +24 -0
@@ -1246,6 +1246,23 @@ static void x86_machine_set_oem_table_id(Object *obj, const char *value,strncpy (x86ms->oem_table_id, value,8 ); } +static void x86_machine_get_bus_lock_ratelimit (Object *obj,Visitor *v, +const char *name,void *opaque,Error **errp) +{ +X86MachineState *x86ms =X86_MACHINE (obj); +uint64_t bus_lock_ratelimit = x86ms->bus_lock_ratelimit; + +visit_type_uint64 (v, name, &bus_lock_ratelimit, errp); +} + +static void x86_machine_set_bus_lock_ratelimit (Object *obj,Visitor *v, +const char *name,void *opaque,Error **errp) +{ +X86MachineState *x86ms =X86_MACHINE (obj); + +visit_type_uint64 (v, name, &x86ms->bus_lock_ratelimit, errp); +} +static void x86_machine_initfn (Object *obj) {X86MachineState *x86ms =X86_MACHINE (obj);
@@ -1256,6 +1273,7 @@ static void x86_machine_initfn(Object *obj) x86ms->pci_irq_mask =ACPI_BUILD_PCI_IRQS ; x86ms->oem_id =g_strndup (ACPI_BUILD_APPNAME6 ,6 ); x86ms->oem_table_id =g_strndup (ACPI_BUILD_APPNAME8 ,8 ); + x86ms->bus_lock_ratelimit =0 ; }static void x86_machine_class_init (ObjectClass *oc,void *data)
@@ -1299,6 +1317,12 @@ static void x86_machine_class_init(ObjectClass *oc, void *data)"Override the default value of field OEM Table ID " "in ACPI table header." "The string may be up to 8 bytes in size"); + +object_class_property_add (oc,X86_MACHINE_BUS_LOCK_RATELIMIT ,"uint64_t" , + x86_machine_get_bus_lock_ratelimit, + x86_machine_set_bus_lock_ratelimit,NULL ,NULL ); +object_class_property_set_description (oc,X86_MACHINE_BUS_LOCK_RATELIMIT , +"Set the ratelimit for the bus locks acquired in VMs" ); }static const TypeInfo x86_machine_info = {
target/i386/kvm/kvm.c +41 -0
71 lines not on this page · raw message
Signature · 1 line
2.31.1
[PULL 4/7] docs: Add SEV-ES documentation to amd-memory-encryption.txt
In reply to Eduardo HabkostFrom: Tom Lendacky <[email protected]>
Update the amd-memory-encryption.txt file with information about SEV-ES, including how to launch an SEV-ES guest and some of the differences between SEV and SEV-ES guests in regards to launching and measuring the guest.
Message-Id: <fa1825a5eb0290eac4712cde75ba4c6829946eac.1619208498.git.thomas.lendacky@amd.com>
--- docs/amd-memory-encryption.txt | 54 +++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 7 deletions(-)
docs/amd-memory-encryption.txt +47 -7
@@ -15,6 +15,13 @@ includes commands for launching, snapshotting, migrating and debugging the encrypted guest. These SEV commands can be issued via KVM_MEMORY_ENCRYPT_OP ioctls. +Secure Encrypted Virtualization - Encrypted State (SEV-ES) builds on the SEV +support to additionally protect the guest register state. In order to allow a +hypervisor to perform functions on behalf of a guest, there is architectural +support for notifying a guest's operating system when certain types of VMEXITs +are about to occur. This allows the guest to selectively share information with +the hypervisor to satisfy the requested function. + Launching --------- Boot images (such as bios) must be encrypted before a guest can be booted. The
@@ -24,6 +31,9 @@ together generate a fresh memory encryption key for the VM, encrypt the boot images and provide a measurement than can be used as an attestation of a successful launch. +For a SEV-ES guest, the LAUNCH_UPDATE_VMSA command is also used to encrypt the +guest register state, or VM save area (VMSA), for all of the guest vCPUs. + LAUNCH_START is called first to create a cryptographic launch context within the firmware. To create this context, guest owner must provide a guest policy, its public Diffie-Hellman key (PDH) and session parameters. These inputs
@@ -40,6 +50,12 @@ The guest policy can be provided via the 'policy' property (see below) # ${QEMU} \ sev-guest,id=sev0,policy=0x1...\ +Setting the "SEV-ES required" policy bit (bit 2) will launch the guest as a +SEV-ES guest (see below) + +# ${QEMU} \ + sev-guest,id=sev0,policy=0x5...\ + The guest owner provided DH certificate and session parameters will be used to establish a cryptographic session with the guest owner to negotiate keys used for the attestation.
@@ -55,13 +71,19 @@ created via the LAUNCH_START command. If required, this command can be called multiple times to encrypt different memory regions. The command also calculates the measurement of the memory contents as it encrypts. -LAUNCH_MEASURE can be used to retrieve the measurement of encrypted memory. -This measurement is a signature of the memory contents that can be sent to the -guest owner as an attestation that the memory was encrypted correctly by the -firmware. The guest owner may wait to provide the guest confidential information -until it can verify the attestation measurement. Since the guest owner knows the -initial contents of the guest at boot, the attestation measurement can be -verified by comparing it to what the guest owner expects. +LAUNCH_UPDATE_VMSA encrypts all the vCPU VMSAs for a SEV-ES guest using the +cryptographic context created via the LAUNCH_START command. The command also +calculates the measurement of the VMSAs as it encrypts them. + +LAUNCH_MEASURE can be used to retrieve the measurement of encrypted memory and, +for a SEV-ES guest, encrypted VMSAs. This measurement is a signature of the +memory contents and, for a SEV-ES guest, the VMSA contents, that can be sent +to the guest owner as an attestation that the memory and VMSAs were encrypted +correctly by the firmware. The guest owner may wait to provide the guest +confidential information until it can verify the attestation measurement. +Since the guest owner knows the initial contents of the guest at boot, the +attestation measurement can be verified by comparing it to what the guest owner +expects. LAUNCH_FINISH finalizes the guest launch and destroys the cryptographic context.
@@ -75,6 +97,22 @@ To launch a SEV guest -machine ...,confidential-guest-support=sev0 \ -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1 +To launch a SEV-ES guest + +# ${QEMU} \ + -machine ...,confidential-guest-support=sev0 \ + -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1,policy=0x5 + +An SEV-ES guest has some restrictions as compared to a SEV guest. Because the +guest register state is encrypted and cannot be updated by the VMM/hypervisor, +a SEV-ES guest: + - Does not support SMM - SMM support requires updating the guest register + state. + - Does not support reboot - a system reset requires updating the guest register + state. + - Requires in-kernel irqchip - the burden is placed on the hypervisor to + manage booting APs. + Debugging ----------- Since the memory contents of a SEV guest are encrypted, hypervisor access to
@@ -101,8 +139,10 @@ Secure Encrypted Virtualization Key Management: KVM Forum slides: http://www.linux-kvm.org/images/7/74/02x08A-Thomas_Lendacky-AMDs_Virtualizatoin_Memory_Encryption_Technology.pdf +https://www.linux-kvm.org/images/9/94/Extending-Secure-Encrypted-Virtualization-with-SEV-ES-Thomas-Lendacky-AMD.pdf AMD64 Architecture Programmer's Manual: http://support.amd.com/TechDocs/24593.pdf SME is section 7.10 SEV is section 15.34 + SEV-ES is section 15.35
Signature · 1 line
2.31.1
Peter Maydell
AppliedQuoted 22 lines · Eduardo Habkost
There's still a lot to review/queue on the list, but I'm flush my current queue so it doesn't get stale.
The following changes since commit
18e53dff939898c6dd00d206a3c2f5cd3d6669db:Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-c11-20210615' into staging (2021-06-17 10:42:57 +0100)
are available in the Git repository at:
https://gitlab.com/ehabkost/qemu.git tags/x86-next-pull-request
for you to fetch changes up to
4e2f5f3a9db06e87a73eb60a7cc9754fc13596ee:scripts: helper to generate
x86_64CPU ABI compat info (2021-06-17 14:11:06 -0400)----------------------------------------------------------------
x86 queue, 2021-06-18Features:
* Add ratelimit for bus locks acquired in guest (Chenyi Qiang)
Quoted 8 lines
Documentation:
* SEV documentation updates (Tom Lendacky)
* Add a table showing x86-64 ABI compatibility levels (Daniel P. Berrangé)Automated changes:
* Update Linux headers to 5.13-rc4 (Eduardo Habkost)----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.
-- PMM