pkgdep/git: Bump vanilla qemu to v6.0.0

Older version wasn't providing full support for PMR setup, this one
does.

Rewrite get-pmr such that it supports CMB/PMR sizes greater than 4GB.
Also, since CMB and PMR can coexist in newer versions of qemu try to
detect both under single device.

E.g.:

nvme0:0000:00:04.0:64-bit:prefetchable:0x700000000:0x707ffffff:0x08000000:cmb
nvme0:0000:00:04.0:64-bit:prefetchable:0x400000000:0x5ffffffff:0x200000000:pmr
nvme1:0000:00:05.0:64-bit:prefetchable:0x708000000:0x70fffffff:0x08000000:cmb
nvme2:0000:00:06.0:64-bit:prefetchable:0x600000000:0x6ffffffff:0x100000000:cmb

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ic159f5c12d3ef39db77617f7d64f825356c255a4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7539
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Michal Berger 2021-04-21 20:20:31 +02:00 committed by Tomasz Zawadzki
parent f99d46d5f7
commit eb4b79919a
2 changed files with 49 additions and 14 deletions

View File

@ -1,13 +1,14 @@
#!/usr/bin/env bash
# We simply check if BAR2 is present as that's where PMR or CMB is
# meant to be located under qemu. If found, print some stats then exit.
shopt -s nullglob
[[ $(uname -s) == Linux ]] || exit 0
# Use MSR instead?
[[ $(< /sys/class/dmi/id/chassis_vendor) == QEMU ]] || exit 0
get_bar2() {
echo "0x$(setpci -s "$1" 0x18.L)"
get_bar() {
echo "0x$(setpci -s "$1" "$2.L")"
}
get_size() {
@ -22,29 +23,57 @@ get_size() {
return 0
fi
done < /proc/iomem
echo "unknown"
echo "unknown/unassigned"
}
info() {
local bar=$1
local dev=$1
local pref loc
local base_addr2
local base_addr4
local bar local bar2 bar3 bar4 bar5
local bar_type2
pref[0]=non-prefetchable
pref[1]=prefetchable
loc[0]=32-bit
loc[1]="<1MiB"
loc[2]=64-bit
print_info() {
local bar=$1 base_addr=$2 bar_type=$3
echo "${loc[(bar >> 1) & 0x3]}:${pref[bar & 1 << 3 ? 1 : 0]}:$(get_size $((bar & ~0xf)))"
printf '%s:%s:%s:%s:%s:%s\n' \
"${nvme##*/}" \
"$dev" \
"64-bit" \
"${pref[bar & 1 << 3 ? 1 : 0]}" \
"$(get_size "$base_addr")" \
"$bar_type"
}
bar2=$(get_bar "$dev" 0x18)
bar3=$(get_bar "$dev" 0x1c)
bar4=$(get_bar "$dev" 0x20)
bar5=$(get_bar "$dev" 0x24)
# QEMU uses 64-bit BARs
if ((bar2 & 1 << 2)); then
bar_type2=pmr
if [[ -e $nvme/cmb ]]; then
bar_type2=cmb
fi
base_addr2=$(((bar2 & ~0xf) + (bar3 << 32)))
print_info "$bar2" "$base_addr2" "$bar_type2"
fi
# QEMU uses 64-bit BARs
if ((bar4 & 1 << 2)); then
base_addr4=$(((bar4 & ~0xf) + (bar5 << 32)))
print_info "$bar4" "$base_addr4" pmr
fi
}
for nvme in /sys/class/nvme/nvme*; do
pci=$(readlink -f "$nvme/device") pci=${pci##*/}
bar2=$(get_bar2 "$pci") || continue
((bar2 != 0x0)) || continue
bar=pmr
[[ -e $nvme/cmb ]] && bar=cmb
echo "${nvme##*/}:$pci:$(info "$bar2"):$bar"
info "$pci"
done

View File

@ -295,6 +295,12 @@ function _install_qemu() {
fi
opt_params+=("--extra-cflags=${extra_cflags[*]}")
if [[ $prefix == vanilla ]]; then
# Latest qemu seems to take sysconfdir from the prefix and instead of checking /etc
# it looks under /usr/local/qemu/vanilla*/bin/../etc which is a bit peculiar. Fix it.
opt_params+=("--sysconfdir=/etc/")
fi
# The qemu configure script places several output files in the CWD.
(cd "$repo_dir" && ./configure "${opt_params[@]}" --target-list="x86_64-softmmu" --enable-kvm --enable-linux-aio --enable-numa)
@ -316,7 +322,7 @@ function install_qemu() {
# Forked QEMUs
SPDK_QEMU_BRANCH=spdk-5.0.0
VFIO_QEMU_BRANCH=vfio-user-v0.6
VANILLA_QEMU_BRANCH=v5.1.0
VANILLA_QEMU_BRANCH=v6.0.0
_install_qemu $GIT_REPO_QEMU_SPDK $SPDK_QEMU_BRANCH
_install_qemu $GIT_REPO_QEMU_VFIO $VFIO_QEMU_BRANCH