On 10/10/2023 10.49, Janosch Frank wrote:
Add functions and definitions needed to test the Adjunct
Processor (AP) crypto interface.
Signed-off-by: Janosch Frank <frankja@xxxxxxxxxxxxx>
---
lib/s390x/ap.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++
lib/s390x/ap.h | 88 +++++++++++++++++++++++++++++++++++++++++++++++
s390x/Makefile | 1 +
3 files changed, 181 insertions(+)
create mode 100644 lib/s390x/ap.c
create mode 100644 lib/s390x/ap.h
diff --git a/lib/s390x/ap.c b/lib/s390x/ap.c
new file mode 100644
index 00000000..4af3cdee
--- /dev/null
+++ b/lib/s390x/ap.c
...
+bool ap_check(void)
+{
+ /*
+ * Base AP support has no STFLE or SCLP feature bit but the
+ * PQAP QCI support is indicated via stfle bit 12. As this
+ * library relies on QCI we bail out if it's not available.
+ */
+ if (!test_facility(12))
+ return false;
+
+ return true;
+}
Easier:
return test_facility(12);
... but with that in mind, I wonder why you need a wrapper function for this
at all - why not simply checking test_facility(12) at the calling side instead?
Thomas