Harald Hoyer 5f0dd7
From 7ef5ead6f4cf4834b84ea6d9546b77ddc0da394b Mon Sep 17 00:00:00 2001
Harald Hoyer 5f0dd7
From: Martin Wilck <mwilck@suse.de>
Harald Hoyer 5f0dd7
Date: Thu, 30 Jan 2020 13:48:11 +0100
Harald Hoyer 5f0dd7
Subject: [PATCH] Add module "90nvdimm" for NVDIMM support
Harald Hoyer 5f0dd7
Harald Hoyer 5f0dd7
Detection of persistent memory devices works mostly out of the box
Harald Hoyer 5f0dd7
already. Only the "provider" modules for ndbus devices, which are responsible
Harald Hoyer 5f0dd7
to extract information of available NVDIMM devices and their configuration
Harald Hoyer 5f0dd7
from system firmware, are only indirectly linked into the module stack.
Harald Hoyer 5f0dd7
Examples for such modules are nfit.ko, nd_e820.ko, and virtio-pmem.ko.
Harald Hoyer 5f0dd7
Harald Hoyer 5f0dd7
Add a module that resolves these dependencies.
Harald Hoyer 5f0dd7
---
Harald Hoyer 5f0dd7
 modules.d/90nvdimm/module-setup.sh | 31 +++++++++++++++++++++++++++++++
Harald Hoyer 5f0dd7
 1 file changed, 31 insertions(+)
Harald Hoyer 5f0dd7
Harald Hoyer 5f0dd7
diff --git a/modules.d/90nvdimm/module-setup.sh b/modules.d/90nvdimm/module-setup.sh
Harald Hoyer 5f0dd7
new file mode 100755
Harald Hoyer 5f0dd7
index 00000000..6d58efd7
Harald Hoyer 5f0dd7
--- /dev/null
Harald Hoyer 5f0dd7
+++ b/modules.d/90nvdimm/module-setup.sh
Harald Hoyer 5f0dd7
@@ -0,0 +1,31 @@
Harald Hoyer 5f0dd7
+#!/bin/bash
Harald Hoyer 5f0dd7
+
Harald Hoyer 5f0dd7
+# called by dracut
Harald Hoyer 5f0dd7
+check() {
Harald Hoyer 5f0dd7
+    if [[ ! $hostonly ]]; then
Harald Hoyer 5f0dd7
+        return 0
Harald Hoyer 5f0dd7
+    fi
Harald Hoyer 5f0dd7
+    [[ $DRACUT_KERNEL_MODALIASES && -f "$DRACUT_KERNEL_MODALIASES" ]] && \
Harald Hoyer 5f0dd7
+        grep -q libnvdimm "$DRACUT_KERNEL_MODALIASES" && return 0
Harald Hoyer 5f0dd7
+    return 255
Harald Hoyer 5f0dd7
+}
Harald Hoyer 5f0dd7
+
Harald Hoyer 5f0dd7
+# called by dracut
Harald Hoyer 5f0dd7
+depends() {
Harald Hoyer 5f0dd7
+    return 0
Harald Hoyer 5f0dd7
+}
Harald Hoyer 5f0dd7
+
Harald Hoyer 5f0dd7
+# called by dracut
Harald Hoyer 5f0dd7
+installkernel() {
Harald Hoyer 5f0dd7
+    # Directories to search for NVDIMM "providers" (firmware drivers)
Harald Hoyer 5f0dd7
+    # These modules call "nvdimm_bus_register()".
Harald Hoyer 5f0dd7
+    local _provider_dirs='=drivers/nvdimm =drivers/acpi =arch/powerpc'
Harald Hoyer 5f0dd7
+
Harald Hoyer 5f0dd7
+    #instmods() will take care of hostonly
Harald Hoyer 5f0dd7
+    dracut_instmods -o -s nvdimm_bus_register $_provider_dirs
Harald Hoyer 5f0dd7
+}
Harald Hoyer 5f0dd7
+
Harald Hoyer 5f0dd7
+# called by dracut
Harald Hoyer 5f0dd7
+install() {
Harald Hoyer 5f0dd7
+    inst_multiple -o ndctl
Harald Hoyer 5f0dd7
+}
Harald Hoyer 5f0dd7