Introduce new host-startmin action target
Requirements have arisen for OpenBMC firmware to run
certain services only during fresh power on operations.
To achieve that, break the obmc-host-start action target into
two targets. The existing obmc-host-start target will now
call the new obmc-host-startmin target. The startmin target
will be the minimum services required to start the host.
The obmc-host-start target is where services that should
only be called during a fresh power on can be placed.
The initial use case for this is the obmc-host-reboot target.
It will call this new obmc-host-startmin target to do the bare
minimum on a reboot operation.
This then allows the use case for OpenBMC to only reset the host
reboot count on a fresh power on operation. A new service will
be added to the obmc-host-start target to do this. If a reboot
operation is issued, or a host watchdog is triggered to cause a
reboot, this service would not be started, ensuring the reboot
count is properly decremented.
Tested: Verified on/off/reboot and ran CT regression suite.
https://gerrit.openbmc-project.xyz/#/c/9821/ is required
for reboots to work properly.
Change-Id: I86df03e6d671178c1525f852e196c4102bb73cb6
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/meta-phosphor/common/recipes-core/systemd/obmc-targets.bb b/meta-phosphor/common/recipes-core/systemd/obmc-targets.bb
index 26fbcd1..ac7835e 100644
--- a/meta-phosphor/common/recipes-core/systemd/obmc-targets.bb
+++ b/meta-phosphor/common/recipes-core/systemd/obmc-targets.bb
@@ -32,7 +32,12 @@
HOST_SYNCH_TARGETS = "start-pre starting started stop-pre stopping stopped reset-running"
# Track all host action targets
-# - start: Service to run to start the host
+# - start: Will run startmin target, this target used for any additional
+# services that user needs for an initial power on of host.
+# For example, resetting the host reboot count could be put in
+# this target so on any fresh power on, this count is reset.
+# - startmin: Minimum services required to start the host. This target will
+# be called by reboot and start target.
# - stop: Services to run to shutdown the host
# - quiesce: Target to enter on host boot failure
# - shutdown: Tell host to shutdown, then stop system
@@ -42,7 +47,7 @@
# multiple services and one of them is the quiesce target.
# - timeout: Target to run when host watchdog times out
# - reboot: Reboot the host
-HOST_ACTION_TARGETS = "start stop quiesce reset shutdown crash timeout reboot"
+HOST_ACTION_TARGETS = "start startmin stop quiesce reset shutdown crash timeout reboot"
CHASSIS_SYNCH_FMT = "obmc-power-{0}@.target"
CHASSIS_ACTION_FMT = "obmc-chassis-{0}@.target"
diff --git a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-reboot@.target b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-reboot@.target
index 5ee53ae..dc280ea 100644
--- a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-reboot@.target
+++ b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-reboot@.target
@@ -4,7 +4,7 @@
After={SYSTEMD_DEFAULT_TARGET}
Wants=mapper-wait@-org-openbmc-control-chassis%i.service
After=mapper-wait@-org-openbmc-control-chassis%i.service
-Conflicts=obmc-host-start@%i.target
+Conflicts=obmc-host-startmin@%i.target
RefuseManualStop=yes
OnFailure=obmc-chassis-poweroff@%i.target
OnFailureJobMode=flush
diff --git a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-startmin@.target b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-startmin@.target
new file mode 100644
index 0000000..6e924ad
--- /dev/null
+++ b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-startmin@.target
@@ -0,0 +1,10 @@
+[Unit]
+Description=Start Host%i Minimum
+Wants={SYSTEMD_DEFAULT_TARGET}
+After={SYSTEMD_DEFAULT_TARGET}
+Wants=mapper-wait@-org-openbmc-control-chassis%i.service
+After=mapper-wait@-org-openbmc-control-chassis%i.service
+Conflicts=obmc-host-stop@%i.target
+RefuseManualStop=yes
+OnFailure=obmc-host-quiesce@%i.target
+OnFailureJobMode=flush
diff --git a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stop-pre@.target b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stop-pre@.target
index 75afd43..e88d3ea 100644
--- a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stop-pre@.target
+++ b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stop-pre@.target
@@ -3,6 +3,6 @@
Wants={SYSTEMD_DEFAULT_TARGET}
After={SYSTEMD_DEFAULT_TARGET}
Before=obmc-host-stopping@%i.target
-Conflicts=obmc-host-start@%i.target
+Conflicts=obmc-host-startmin@%i.target
RefuseManualStart=yes
RefuseManualStop=yes
diff --git a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stop@.target b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stop@.target
index 6353e74..8e99bcc 100644
--- a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stop@.target
+++ b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stop@.target
@@ -5,7 +5,7 @@
Wants=mapper-wait@-org-openbmc-control-chassis%i.service
After=mapper-wait@-org-openbmc-control-chassis%i.service
After=obmc-chassis-poweroff@%i.target
-Conflicts=obmc-host-start@%i.target
+Conflicts=obmc-host-startmin@%i.target
RefuseManualStop=yes
OnFailure=obmc-chassis-poweroff@%i.target
OnFailureJobMode=flush
diff --git a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stopped@.target b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stopped@.target
index d3efca5..74039fc 100644
--- a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stopped@.target
+++ b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stopped@.target
@@ -4,6 +4,6 @@
Wants=obmc-host-stopping@%i.target
After=obmc-host-stopping@%i.target
Before=obmc-power-stop-pre@%i.target
-Conflicts=obmc-host-start@%i.target
+Conflicts=obmc-host-startmin@%i.target
RefuseManualStart=yes
RefuseManualStop=yes
diff --git a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stopping@.target b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stopping@.target
index 6209c52..f087dea 100644
--- a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stopping@.target
+++ b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-host-stopping@.target
@@ -4,7 +4,7 @@
Wants=obmc-host-stop-pre@%i.target
After=obmc-host-stop-pre@%i.target
Before=obmc-host-stopped@%i.target
-Conflicts=obmc-host-start@%i.target
+Conflicts=obmc-host-startmin@%i.target
Conflicts=obmc-host-starting@%i.target
RefuseManualStart=yes
RefuseManualStop=yes
diff --git a/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb b/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb
index e341463..fabddf3 100644
--- a/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb
+++ b/meta-phosphor/common/recipes-phosphor/chassis/obmc-op-control-power.bb
@@ -68,7 +68,7 @@
# Now show that the main control target requires these power targets
START_TMPL_CTRL = "obmc-chassis-poweron@.target"
-START_TGTFMT_CTRL = "obmc-host-start@{1}.target"
+START_TGTFMT_CTRL = "obmc-host-startmin@{1}.target"
START_INSTFMT_CTRL = "obmc-chassis-poweron@{0}.target"
START_FMT_CTRL = "../${START_TMPL_CTRL}:${START_TGTFMT_CTRL}.requires/${START_INSTFMT_CTRL}"
SYSTEMD_LINK_${PN} += "${@compose_list_zip(d, 'START_FMT_CTRL', 'OBMC_POWER_INSTANCES', 'OBMC_CHASSIS_INSTANCES')}"
diff --git a/meta-phosphor/common/recipes-phosphor/chassis/obmc-pcie-detect.bb b/meta-phosphor/common/recipes-phosphor/chassis/obmc-pcie-detect.bb
index 6b5761b..6e0ad97 100644
--- a/meta-phosphor/common/recipes-phosphor/chassis/obmc-pcie-detect.bb
+++ b/meta-phosphor/common/recipes-phosphor/chassis/obmc-pcie-detect.bb
@@ -9,7 +9,7 @@
SKELETON_DIR = "pciedetect"
TMPL = "pcie-slot-detect@.service"
-TGTFMT = "obmc-host-start@{0}.target"
+TGTFMT = "obmc-host-startmin@{0}.target"
INSTFMT = "pcie-slot-detect@{0}.service"
FMT = "../${TMPL}:${TGTFMT}.wants/${INSTFMT}"
diff --git a/meta-phosphor/common/recipes-phosphor/chassis/obmc-pcie-detect/pcie-slot-detect@.service b/meta-phosphor/common/recipes-phosphor/chassis/obmc-pcie-detect/pcie-slot-detect@.service
index 91adb76..4545524 100644
--- a/meta-phosphor/common/recipes-phosphor/chassis/obmc-pcie-detect/pcie-slot-detect@.service
+++ b/meta-phosphor/common/recipes-phosphor/chassis/obmc-pcie-detect/pcie-slot-detect@.service
@@ -11,4 +11,4 @@
SyslogIdentifier=pcie_slot_present.exe
[Install]
-WantedBy=obmc-host-start@%i.target
+WantedBy=obmc-host-startmin@%i.target
diff --git a/meta-phosphor/common/recipes-phosphor/state/files/phosphor-reboot-host@.service b/meta-phosphor/common/recipes-phosphor/state/files/phosphor-reboot-host@.service
index f8f0171..6158086 100644
--- a/meta-phosphor/common/recipes-phosphor/state/files/phosphor-reboot-host@.service
+++ b/meta-phosphor/common/recipes-phosphor/state/files/phosphor-reboot-host@.service
@@ -9,7 +9,9 @@
# target this service is running in. OpenBMC needs a refactor of
# how it does its host reset path. Until then, this short term
# solution does the job.
-ExecStart=/bin/sh -c "sleep 5 && systemctl start obmc-host-start@%i.target"
+# Since this is a part of the reboot target, call the startmin
+# target which does the minimum required to start the host.
+ExecStart=/bin/sh -c "sleep 5 && systemctl start obmc-host-startmin@%i.target"
[Install]
diff --git a/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb b/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
index 67988f5..9936156 100644
--- a/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
+++ b/meta-phosphor/common/recipes-phosphor/state/phosphor-state-manager.bb
@@ -116,13 +116,20 @@
HOST_REBOOT_FMT = "../${HOST_SHUTDOWN_TMPL}:${HOST_REBOOT_TGTFMT}.requires/${HOST_SHUTDOWN_INSTFMT}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_REBOOT_FMT', 'OBMC_HOST_INSTANCES')}"
-# And also force the reboot target to call the host start service
+# And also force the reboot target to call the host startmin service
HOST_REBOOT_SVC = "phosphor-reboot-host@.service"
HOST_REBOOT_SVC_INST = "phosphor-reboot-host@{0}.service"
HOST_REBOOT_SVC_FMT = "../${HOST_REBOOT_SVC}:${HOST_REBOOT_TGTFMT}.requires/${HOST_REBOOT_SVC_INST}"
SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_REBOOT_SVC_FMT', 'OBMC_HOST_INSTANCES', 'OBMC_HOST_INSTANCES')}"
+# Force the host-start target to call the host-startmin target
+HOST_STARTMIN_TMPL = "obmc-host-startmin@.target"
+HOST_START_TGTFMT = "obmc-host-start@{0}.target"
+HOST_STARTMIN_INSTFMT = "obmc-host-startmin@{0}.target"
+HOST_START_FMT = "../${HOST_STARTMIN_TMPL}:${HOST_START_TGTFMT}.requires/${HOST_STARTMIN_INSTFMT}"
+SYSTEMD_LINK_${PN}-host += "${@compose_list_zip(d, 'HOST_START_FMT', 'OBMC_HOST_INSTANCES')}"
+
SRC_URI += "git://github.com/openbmc/phosphor-state-manager"
-SRCREV = "90e5ae705afa8b63e41815a57cf5858b4ca7e710"
+SRCREV = "969b2613fed44f5b504411b21a9c65d89ed28bf5"
S = "${WORKDIR}/git"
diff --git a/meta-phosphor/common/recipes-phosphor/watchdog/phosphor-watchdog.bb b/meta-phosphor/common/recipes-phosphor/watchdog/phosphor-watchdog.bb
index 7ccb152..d0b04cc 100644
--- a/meta-phosphor/common/recipes-phosphor/watchdog/phosphor-watchdog.bb
+++ b/meta-phosphor/common/recipes-phosphor/watchdog/phosphor-watchdog.bb
@@ -43,8 +43,8 @@
WATCHDOG_TGTFMT = "phosphor-watchdog@{0}.service"
ENABLE_WATCHDOG_TGTFMT = "obmc-enable-host-watchdog@{0}.service"
-WATCHDOG_FMT = "../${WATCHDOG_TMPL}:obmc-host-start@{1}.target.wants/${WATCHDOG_TGTFMT}"
-ENABLE_WATCHDOG_FMT = "../${ENABLE_WATCHDOG_TMPL}:obmc-host-start@{0}.target.wants/${ENABLE_WATCHDOG_TGTFMT}"
+WATCHDOG_FMT = "../${WATCHDOG_TMPL}:obmc-host-startmin@{1}.target.wants/${WATCHDOG_TGTFMT}"
+ENABLE_WATCHDOG_FMT = "../${ENABLE_WATCHDOG_TMPL}:obmc-host-startmin@{0}.target.wants/${ENABLE_WATCHDOG_TGTFMT}"
SYSTEMD_LINK_${PN} += "${@compose_list(d, 'WATCHDOG_FMT', 'OBMC_HOST_WATCHDOG_INSTANCES', 'OBMC_HOST_INSTANCES')}"
SYSTEMD_LINK_${PN} += "${@compose_list(d, 'ENABLE_WATCHDOG_FMT', 'OBMC_HOST_INSTANCES')}"