File s390-tools-sles15sp4-10-ap_tools-ap-check-use-new-mdevctl-install-location.patch of Package s390-tools.30980
Subject: [PATCH] [FEAT VS1822] ap_tools/ap-check: use new mdevctl install location
From: Matthew Rosato <mjrosato@linux.ibm.com>
Summary: ap_tools: add ap-check and the ap device type to zdev
Description: This feature adds multiple components in support of persistent
configuration of vfio-ap mediated devices.
The ap-check utility is added as a callout function for the
mdevctl utility. This allows for meaningful error messages to be
presented to end-users when vfio-ap configuration errors are
detected while using mdevctl to create/modify vfio-ap mediated
devices.
Additionally, the 'ap' device type is added to zdev, providing a
command-line interface for managing the apmask and aqmask, which
determine what AP resources are available for vfio-ap usage.
'chzdev' is updated to allow for modifying the active masks as
well as to specify persistent mask values via a udev rule.
'lszdev' is updated to allow for querying of the active and
persistent mask values.
Upstream-ID: 4b5937f142c7381e8cdad3ea3f55a4931a862488
Problem-ID: VS1822
Upstream-Description:
ap_tools/ap-check: use new mdevctl install location
mdevctl has been updated to use /usr/lib/mdevctl/scripts.d/callouts/
instead of /etc/mdevctl.d/scripts.d/callouts/. The /etc location
is considered deprecated, meaning mdevctl will also look at that
location for now but might eventually stop looking in /etc for
callout scripts.
Based on that, update the installation location for the ap-check
callout. However, because older versions of mdevctl will still
only look in /etc, let's also put a wrapper script in /etc for now
to provide backward compatibility, and plan to remove it at a
later time.
Link: https://github.com/mdevctl/mdevctl/commit/df6bb57429ba7425e8b7901b0580ed7e616b6c4f
Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/139
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
ap_tools/Makefile | 20 +++++++++++++++++---
ap_tools/ap-check.sh | 15 +++++++++++++++
2 files changed, 32 insertions(+), 3 deletions(-)
--- a/ap_tools/Makefile
+++ b/ap_tools/Makefile
@@ -1,8 +1,11 @@
include ../common.mak
-MDEVCTL_DIR = /etc/mdevctl.d/
-MDEVCTL_SCRIPTS = /etc/mdevctl.d/scripts.d/
-MDEVCTL_CALLOUTS = /etc/mdevctl.d/scripts.d/callouts/
+MDEVCTL_DIR = /usr/lib/mdevctl/
+MDEVCTL_SCRIPTS = /usr/lib/mdevctl/scripts.d/
+MDEVCTL_CALLOUTS = /usr/lib/mdevctl/scripts.d/callouts/
+MDEVCTL_DEP_DIR = /etc/mdevctl.d/
+MDEVCTL_DEP_SCRIPTS = /etc/mdevctl.d/scripts.d/
+MDEVCTL_DEP_CALLOUTS = /etc/mdevctl.d/scripts.d/callouts/
libs = $(rootdir)/libap/libap.a \
$(rootdir)/libutil/libutil.a
@@ -32,6 +35,17 @@ install: all
fi; \
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 ap-check \
$(DESTDIR)$(MDEVCTL_CALLOUTS)
+ @if [ ! -d $(DESTDIR)$(MDEVCTL_DEP_CALLOUTS) ]; then \
+ mkdir -p $(DESTDIR)$(MDEVCTL_DEP_CALLOUTS); \
+ chown $(OWNER).$(GROUP) $(DESTDIR)$(MDEVCTL_DEP_DIR); \
+ chown $(OWNER).$(GROUP) $(DESTDIR)$(MDEVCTL_DEP_SCRIPTS); \
+ chown $(OWNER).$(GROUP) $(DESTDIR)$(MDEVCTL_DEP_CALLOUTS); \
+ chmod 755 $(DESTDIR)$(MDEVCTL_DEP_DIR); \
+ chmod 755 $(DESTDIR)$(MDEVCTL_DEP_SCRIPTS); \
+ chmod 755 $(DESTDIR)$(MDEVCTL_DEP_CALLOUTS); \
+ fi; \
+ $(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 ap-check.sh \
+ $(DESTDIR)$(MDEVCTL_DEP_CALLOUTS)
endif
clean:
--- /dev/null
+++ b/ap_tools/ap-check.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# ap-check.sh - Wrapper script for 'ap-check' binary
+#
+# mdevctl has deprecated the /etc/mdevctl.d/scripts.d/callouts/ location in
+# newer releases. This wrapper ensures that mdevctl 1.2.0 and older can
+# still access 'ap-check' for now, and will be removed at a later time.
+#
+# Copyright 2022 IBM Corp.
+#
+# s390-tools is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+#
+
+[ -e /usr/lib/mdevctl/scripts.d/callouts/ap-check ] && /usr/lib/mdevctl/scripts.d/callouts/ap-check "$@"