zdev: Introduce the ap device type

The AP device type initially allows only the setting of type
attributes 'apmask' and 'aqmask'.

Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Matthew Rosato
2021-09-15 11:52:08 -04:00
committed by Jan Höppner
parent 2da206f5a6
commit 773d01e674
8 changed files with 1194 additions and 2 deletions

40
zdev/include/ap.h Normal file
View File

@@ -0,0 +1,40 @@
/*
* zdev - Modify and display the persistent configuration of devices
*
* Copyright IBM Corp. 2022
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#ifndef AP_H
#define AP_H
#include "lib/util_list.h"
#define AP_MOD_NAME "ap"
#define AP_NAME "ap"
#define VFIO_AP_MOD_NAME "vfio_ap"
struct devtype;
struct subtype;
struct namespace;
extern struct devtype ap_devtype;
extern struct subtype ap_subtype;
extern struct namespace ap_namespace;
struct ap_node {
struct util_list_node node;
unsigned int id;
};
struct mdev_cb_data {
struct util_list *adapters;
struct util_list *domains;
bool typeap;
bool autoconf;
bool found_conflict;
};
#endif /* AP_H */

View File

@@ -36,7 +36,7 @@ struct namespace;
struct subtype;
/* NULL-terminated list of namespaces. */
#define NUM_NAMESPACES 5
#define NUM_NAMESPACES 6
extern struct namespace *namespaces[NUM_NAMESPACES + 1];
/* struct namespace - Definition of a device ID namespace

View File

@@ -64,6 +64,7 @@ char *path_get_sys_bus_drv(const char *, const char *);
char *path_get_zfcp_lun_dev(struct zfcp_lun_devid *);
char *path_get_zfcp_port_dev(struct zfcp_lun_devid *);
char *path_get_scsi_hctl_dev(const char *);
char *path_get_bus_attr(const char *, const char *);
exit_code_t path_for_each(const char *,
exit_code_t (*callback)(const char *, const char *,

View File

@@ -40,6 +40,9 @@ chzdev_objects += ctc.o ctc_auto.o
# LCS devtype
chzdev_objects += lcs.o lcs_auto.o
# AP devtype
chzdev_objects += ap.o
# Generic CCW devtype
chzdev_objects += generic_ccw.o
@@ -70,11 +73,21 @@ lszdev_objects += ctc.o ctc_auto.o
# LCS devtype
lszdev_objects += lcs.o lcs_auto.o
# AP devtype
lszdev_objects += ap.o
# Generic CCW devtype
lszdev_objects += generic_ccw.o
all: chzdev lszdev zdev_id
ifneq (${HAVE_LOCKFILE}, 0)
LDLIBS += -llockfile
endif
ifneq (${HAVE_JSONC}, 0)
LDLIBS += -ljson-c
endif
chzdev_usage.c: chzdev_usage.txt
$(SED) $< >$@ -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/g' \
-e 's/$$/\\n"/g'
@@ -90,7 +103,8 @@ lszdev_usage.c: lszdev_usage.txt
chzdev.o: chzdev_usage.c
lszdev.o: lszdev_usage.c
libs = $(rootdir)/libutil/libutil.a
libs = $(rootdir)/libap/libap.a \
$(rootdir)/libutil/libutil.a
chzdev: $(chzdev_objects) $(libs)
lszdev: $(lszdev_objects) $(libs)

1127
zdev/src/ap.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -27,6 +27,7 @@
#include "setting.h"
#include "subtype.h"
#include "zfcp.h"
#include "ap.h"
/* Array of pointers to known device types. */
struct devtype *devtypes[] = {
@@ -35,6 +36,7 @@ struct devtype *devtypes[] = {
&qeth_devtype,
&ctc_devtype,
&lcs_devtype,
&ap_devtype,
&generic_ccw_devtype, /* Generic types should come last. */
NULL
};

View File

@@ -17,6 +17,7 @@
#include "namespace.h"
#include "qeth.h"
#include "zfcp_lun.h"
#include "ap.h"
struct namespace *namespaces[] = {
&ccw_namespace,
@@ -24,6 +25,7 @@ struct namespace *namespaces[] = {
&qeth_namespace,
&ctc_namespace,
&lcs_namespace,
&ap_namespace,
NULL,
};

View File

@@ -398,3 +398,9 @@ char *path_get_scsi_hctl_dev(const char *hctl)
{
return path_get("/sys/bus/scsi/devices/%s", hctl);
}
/* Return sysfs path to a bus attribute */
char *path_get_bus_attr(const char *bus, const char *attr)
{
return path_get("/sys/bus/%s/%s", bus, attr);
}