Blame SOURCES/0043-Documentation-cxl-add-library-API-documentation.patch

26ccd9
From 62fe17528d362110e258d56d8a2f44f2798f3f45 Mon Sep 17 00:00:00 2001
26ccd9
From: Vishal Verma <vishal.l.verma@intel.com>
26ccd9
Date: Thu, 7 Oct 2021 02:21:36 -0600
26ccd9
Subject: [PATCH 043/217] Documentation/cxl: add library API documentation
26ccd9
26ccd9
Add library API documentation for libcxl(3) using the existing
26ccd9
asciidoc(tor) build system. Add a section 3 man page for 'libcxl' that
26ccd9
provides an overview of the library and its usage, and a man page for
26ccd9
the 'cxl_new()' API.
26ccd9
26ccd9
Cc: Ben Widawsky <ben.widawsky@intel.com>
26ccd9
Cc: Dan Williams <dan.j.williams@intel.com>
26ccd9
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
26ccd9
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
26ccd9
---
26ccd9
 .gitignore                        |  3 ++
26ccd9
 Documentation/cxl/lib/Makefile.am | 58 +++++++++++++++++++++++++++++++
26ccd9
 Documentation/cxl/lib/cxl_new.txt | 43 +++++++++++++++++++++++
26ccd9
 Documentation/cxl/lib/libcxl.txt  | 56 +++++++++++++++++++++++++++++
26ccd9
 Makefile.am                       |  1 +
26ccd9
 configure.ac                      |  1 +
26ccd9
 6 files changed, 162 insertions(+)
26ccd9
 create mode 100644 Documentation/cxl/lib/Makefile.am
26ccd9
 create mode 100644 Documentation/cxl/lib/cxl_new.txt
26ccd9
 create mode 100644 Documentation/cxl/lib/libcxl.txt
26ccd9
26ccd9
diff --git a/.gitignore b/.gitignore
26ccd9
index 6a97b92..6468c7a 100644
26ccd9
--- a/.gitignore
26ccd9
+++ b/.gitignore
26ccd9
@@ -14,12 +14,15 @@ Makefile.in
26ccd9
 /libtool
26ccd9
 /stamp-h1
26ccd9
 *.1
26ccd9
+*.3
26ccd9
 Documentation/daxctl/asciidoc.conf
26ccd9
 Documentation/ndctl/asciidoc.conf
26ccd9
 Documentation/cxl/asciidoc.conf
26ccd9
+Documentation/cxl/lib/asciidoc.conf
26ccd9
 Documentation/daxctl/asciidoctor-extensions.rb
26ccd9
 Documentation/ndctl/asciidoctor-extensions.rb
26ccd9
 Documentation/cxl/asciidoctor-extensions.rb
26ccd9
+Documentation/cxl/lib/asciidoctor-extensions.rb
26ccd9
 Documentation/ndctl/attrs.adoc
26ccd9
 .dirstamp
26ccd9
 daxctl/config.h
26ccd9
diff --git a/Documentation/cxl/lib/Makefile.am b/Documentation/cxl/lib/Makefile.am
26ccd9
new file mode 100644
26ccd9
index 0000000..41e3a5f
26ccd9
--- /dev/null
26ccd9
+++ b/Documentation/cxl/lib/Makefile.am
26ccd9
@@ -0,0 +1,58 @@
26ccd9
+# SPDX-License-Identifier: GPL-2.0
26ccd9
+# Copyright (C) 2020-2021 Intel Corporation. All rights reserved.
26ccd9
+
26ccd9
+if USE_ASCIIDOCTOR
26ccd9
+
26ccd9
+do_subst = sed -e 's,@Utility@,Libcxl,g' -e's,@utility@,libcxl,g'
26ccd9
+CONFFILE = asciidoctor-extensions.rb
26ccd9
+asciidoctor-extensions.rb: ../../asciidoctor-extensions.rb.in
26ccd9
+	$(AM_V_GEN) $(do_subst) < $< > $@
26ccd9
+
26ccd9
+else
26ccd9
+
26ccd9
+do_subst = sed -e 's,UTILITY,libcxl,g'
26ccd9
+CONFFILE = asciidoc.conf
26ccd9
+asciidoc.conf: ../../asciidoc.conf.in
26ccd9
+	$(AM_V_GEN) $(do_subst) < $< > $@
26ccd9
+
26ccd9
+endif
26ccd9
+
26ccd9
+man3_MANS = \
26ccd9
+	libcxl.3 \
26ccd9
+	cxl_new.3
26ccd9
+
26ccd9
+EXTRA_DIST = $(man3_MANS)
26ccd9
+
26ccd9
+CLEANFILES = $(man3_MANS)
26ccd9
+
26ccd9
+XML_DEPS = \
26ccd9
+	../../../version.m4 \
26ccd9
+	../../copyright.txt \
26ccd9
+	Makefile \
26ccd9
+	$(CONFFILE)
26ccd9
+
26ccd9
+RM ?= rm -f
26ccd9
+
26ccd9
+if USE_ASCIIDOCTOR
26ccd9
+
26ccd9
+%.3: %.txt $(XML_DEPS)
26ccd9
+	$(AM_V_GEN)$(RM) $@+ $@ && \
26ccd9
+		$(ASCIIDOC) -b manpage -d manpage -acompat-mode \
26ccd9
+		-I. -rasciidoctor-extensions \
26ccd9
+		-amansource=libcxl -amanmanual="libcxl Manual" \
26ccd9
+		-andctl_version=$(VERSION) -o $@+ $< && \
26ccd9
+		mv $@+ $@
26ccd9
+
26ccd9
+else
26ccd9
+
26ccd9
+%.xml: %.txt $(XML_DEPS)
26ccd9
+	$(AM_V_GEN)$(RM) $@+ $@ && \
26ccd9
+		$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
26ccd9
+		--unsafe -alibcxl_version=$(VERSION) -o $@+ $< && \
26ccd9
+		mv $@+ $@
26ccd9
+
26ccd9
+%.3: %.xml $(XML_DEPS)
26ccd9
+	$(AM_V_GEN)$(RM) $@ && \
26ccd9
+		$(XMLTO) -o . -m ../../manpage-normal.xsl man $<
26ccd9
+
26ccd9
+endif
26ccd9
diff --git a/Documentation/cxl/lib/cxl_new.txt b/Documentation/cxl/lib/cxl_new.txt
26ccd9
new file mode 100644
26ccd9
index 0000000..147d4e0
26ccd9
--- /dev/null
26ccd9
+++ b/Documentation/cxl/lib/cxl_new.txt
26ccd9
@@ -0,0 +1,43 @@
26ccd9
+// SPDX-License-Identifier: LGPL-2.0
26ccd9
+
26ccd9
+cxl_new(3)
26ccd9
+==========
26ccd9
+
26ccd9
+NAME
26ccd9
+----
26ccd9
+cxl_new - Create a new library context object that acts as a handle for all
26ccd9
+library operations
26ccd9
+
26ccd9
+SYNOPSIS
26ccd9
+--------
26ccd9
+[verse]
26ccd9
+----
26ccd9
+#include <cxl/libcxl.h>
26ccd9
+
26ccd9
+int cxl_new(struct cxl_ctx **ctx);
26ccd9
+----
26ccd9
+
26ccd9
+DESCRIPTION
26ccd9
+-----------
26ccd9
+Instantiates a new library context, and stores an opaque pointer in ctx. The
26ccd9
+context is freed by linklibcxl:cxl_unref[3], i.e. cxl_new(3) implies an
26ccd9
+internal linklibcxl:cxl_ref[3].
26ccd9
+
26ccd9
+
26ccd9
+RETURN VALUE
26ccd9
+------------
26ccd9
+Returns 0 on success, and a negative errno on failure.
26ccd9
+Possible error codes are:
26ccd9
+
26ccd9
+ * -ENOMEM
26ccd9
+ * -ENXIO
26ccd9
+
26ccd9
+EXAMPLE
26ccd9
+-------
26ccd9
+See example usage in test/libcxl.c
26ccd9
+
26ccd9
+include::../../copyright.txt[]
26ccd9
+
26ccd9
+SEE ALSO
26ccd9
+--------
26ccd9
+linklibcxl:cxl_ref[3], linklibcxl:cxl_unref[3]
26ccd9
diff --git a/Documentation/cxl/lib/libcxl.txt b/Documentation/cxl/lib/libcxl.txt
26ccd9
new file mode 100644
26ccd9
index 0000000..2539369
26ccd9
--- /dev/null
26ccd9
+++ b/Documentation/cxl/lib/libcxl.txt
26ccd9
@@ -0,0 +1,56 @@
26ccd9
+// SPDX-License-Identifier: LGPL-2.0
26ccd9
+
26ccd9
+libcxl(3)
26ccd9
+=========
26ccd9
+
26ccd9
+NAME
26ccd9
+----
26ccd9
+libcxl - A library to interact with CXL devices through sysfs(5)
26ccd9
+and ioctl(2) interfaces
26ccd9
+
26ccd9
+SYNOPSIS
26ccd9
+--------
26ccd9
+[verse]
26ccd9
+#include <cxl/libcxl.h>
26ccd9
+cc ... -lcxl
26ccd9
+
26ccd9
+DESCRIPTION
26ccd9
+-----------
26ccd9
+libcxl provides interfaces to interact with CXL devices in Linux, using sysfs
26ccd9
+interfaces for most kernel interactions, and the ioctl() interface for command
26ccd9
+submission.
26ccd9
+
26ccd9
+The starting point for all library interfaces is a 'cxl_ctx' object, returned
26ccd9
+by linklibcxl:cxl_new[3]. CXL 'Type 3' memory devices are children of the
26ccd9
+cxl_ctx object, and can be iterated through using an iterator API.
26ccd9
+
26ccd9
+Library level interfaces that are agnostic to any device, or a specific
26ccd9
+subclass of operations have the prefix 'cxl_'
26ccd9
+
26ccd9
+The object representing a CXL Type 3 device is 'cxl_memdev'. Library interfaces
26ccd9
+related to these devices have the prefix 'cxl_memdev_'. These interfaces are
26ccd9
+mostly associated with sysfs interactions (unless otherwise noted in their
26ccd9
+respective documentation pages). They are typically used to retrieve data
26ccd9
+published by the kernel, or to send data or trigger kernel operations for a
26ccd9
+given device.
26ccd9
+
26ccd9
+A 'cxl_cmd' is a reference counted object which is used to perform 'Mailbox'
26ccd9
+commands as described in the CXL Specification. A 'cxl_cmd' object is tied to a
26ccd9
+'cxl_memdev'. Associated library interfaces have the prefix 'cxl_cmd_'. Within
26ccd9
+this sub-class of interfaces, there are:
26ccd9
+
26ccd9
+ * 'cxl_cmd_new_*' interfaces that allocate a new cxl_cmd object for a given
26ccd9
+   command type.
26ccd9
+
26ccd9
+ * 'cxl_cmd_submit' which submits the command via ioctl()
26ccd9
+
26ccd9
+ * 'cxl_cmd_<name>_get_<field>' interfaces that get specific fields out of the
26ccd9
+   command response
26ccd9
+
26ccd9
+ * 'cxl_cmd_get_*' interfaces to get general command related information.
26ccd9
+
26ccd9
+include::../../copyright.txt[]
26ccd9
+
26ccd9
+SEE ALSO
26ccd9
+--------
26ccd9
+linklibcxl:cxl[1]
26ccd9
diff --git a/Makefile.am b/Makefile.am
26ccd9
index 4904ee7..e2f6bef 100644
26ccd9
--- a/Makefile.am
26ccd9
+++ b/Makefile.am
26ccd9
@@ -4,6 +4,7 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
26ccd9
 SUBDIRS = . cxl/lib daxctl/lib ndctl/lib cxl ndctl daxctl
26ccd9
 if ENABLE_DOCS
26ccd9
 SUBDIRS += Documentation/ndctl Documentation/daxctl Documentation/cxl
26ccd9
+SUBDIRS += Documentation/cxl/lib
26ccd9
 endif
26ccd9
 SUBDIRS += test
26ccd9
 
26ccd9
diff --git a/configure.ac b/configure.ac
26ccd9
index dadae0a..00497ae 100644
26ccd9
--- a/configure.ac
26ccd9
+++ b/configure.ac
26ccd9
@@ -231,6 +231,7 @@ AC_CONFIG_FILES([
26ccd9
         Documentation/ndctl/Makefile
26ccd9
         Documentation/daxctl/Makefile
26ccd9
         Documentation/cxl/Makefile
26ccd9
+        Documentation/cxl/lib/Makefile
26ccd9
 ])
26ccd9
 
26ccd9
 AC_OUTPUT
26ccd9
-- 
26ccd9
2.27.0
26ccd9