https://github.com/torvalds/linux
Revision 0afe64bebb13509ef9a4be9deb18286b4c052c93 authored by Linus Torvalds on 20 October 2021, 15:52:10 UTC, committed by Linus Torvalds on 20 October 2021, 15:52:10 UTC
Pull kvm fixes from Paolo Bonzini:
 "Tools:
   - kvm_stat: do not show halt_wait_ns since it is not a cumulative statistic

  x86:
   - clean ups and fixes for bus lock vmexit and lazy allocation of rmaps
   - two fixes for SEV-ES (one more coming as soon as I get reviews)
   - fix for static_key underflow

  ARM:
   - Properly refcount pages used as a concatenated stage-2 PGD
   - Fix missing unlock when detecting the use of MTE+VM_SHARED"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: SEV-ES: reduce ghcb_sa_len to 32 bits
  KVM: VMX: Remove redundant handling of bus lock vmexit
  KVM: kvm_stat: do not show halt_wait_ns
  KVM: x86: WARN if APIC HW/SW disable static keys are non-zero on unload
  Revert "KVM: x86: Open code necessary bits of kvm_lapic_set_base() at vCPU RESET"
  KVM: SEV-ES: Set guest_state_protected after VMSA update
  KVM: X86: fix lazy allocation of rmaps
  KVM: SEV-ES: fix length of string I/O
  KVM: arm64: Release mmap_lock when using VM_SHARED with MTE
  KVM: arm64: Report corrupted refcount at EL2
  KVM: arm64: Fix host stage-2 PGD refcount
  KVM: s390: Function documentation fixes
2 parent s d9abdee + 9f1ee7b
Raw File
Tip revision: 0afe64bebb13509ef9a4be9deb18286b4c052c93 authored by Linus Torvalds on 20 October 2021, 15:52:10 UTC
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Tip revision: 0afe64b
syscallhdr.sh
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
#
# Generate a syscall number header.
#
# Each line of the syscall table should have the following format:
#
# NR ABI NAME [NATIVE] [COMPAT]
#
# NR       syscall number
# ABI      ABI name
# NAME     syscall name
# NATIVE   native entry point (optional)
# COMPAT   compat entry point (optional)

set -e

usage() {
	echo >&2 "usage: $0 [--abis ABIS] [--emit-nr] [--offset OFFSET] [--prefix PREFIX] INFILE OUTFILE" >&2
	echo >&2
	echo >&2 "  INFILE    input syscall table"
	echo >&2 "  OUTFILE   output header file"
	echo >&2
	echo >&2 "options:"
	echo >&2 "  --abis ABIS        ABI(s) to handle (By default, all lines are handled)"
	echo >&2 "  --emit-nr          Emit the macro of the number of syscalls (__NR_syscalls)"
	echo >&2 "  --offset OFFSET    The offset of syscall numbers"
	echo >&2 "  --prefix PREFIX    The prefix to the macro like __NR_<PREFIX><NAME>"
	exit 1
}

# default unless specified by options
abis=
emit_nr=
offset=
prefix=

while [ $# -gt 0 ]
do
	case $1 in
	--abis)
		abis=$(echo "($2)" | tr ',' '|')
		shift 2;;
	--emit-nr)
		emit_nr=1
		shift 1;;
	--offset)
		offset=$2
		shift 2;;
	--prefix)
		prefix=$2
		shift 2;;
	-*)
		echo "$1: unknown option" >&2
		usage;;
	*)
		break;;
	esac
done

if [ $# -ne 2 ]; then
	usage
fi

infile="$1"
outfile="$2"

guard=_UAPI_ASM_$(basename "$outfile" |
	sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
	-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g')

grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$infile" | {
	echo "#ifndef $guard"
	echo "#define $guard"
	echo

	max=0
	while read nr abi name native compat ; do

		max=$nr

		if [ -n "$offset" ]; then
			nr="($offset + $nr)"
		fi

		echo "#define __NR_$prefix$name $nr"
	done

	if [ -n "$emit_nr" ]; then
		echo
		echo "#ifdef __KERNEL__"
		echo "#define __NR_${prefix}syscalls $(($max + 1))"
		echo "#endif"
	fi

	echo
	echo "#endif /* $guard */"
} > "$outfile"
back to top