Skip to content

Commit 5d91b2a

Browse files
committed
NVIDIA Bluefield ignition provider
1 parent c43db71 commit 5d91b2a

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed

docs/release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ nav_order: 9
1111
### Features
1212

1313
- The name for custom clevis pins is not validated by Ignition anymore, enabling the use of arbitrary custom pins _(3.6.0-exp)_
14+
- Add NVIDIA BlueField provider
1415

1516
### Changes
1617

docs/supported-platforms.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Ignition is currently supported for the following platforms:
2323
* [KubeVirt] (`kubevirt`) - Ignition will read its configuration from the instance userdata via `cloudInitConfigDrive` or `cloudInitNoCloud`. Cloud SSH keys are handled separately.
2424
* Bare Metal (`metal`) - Use the `ignition.config.url` kernel parameter to provide a URL to the configuration. The URL can use the `http://`, `https://`, `tftp://`, `s3://`, `arn:`, or `gs://` schemes to specify a remote config.
2525
* [Nutanix] (`nutanix`) - Ignition will read its configuration from the instance userdata via config drive. Cloud SSH keys are handled separately.
26+
* [NVIDIA BlueField] (`nvidiabluefield`) - Ignition will read its configuration from the bootfifo sysfs interface from the mlxbf-bootctl platform driver.
2627
* [OpenStack] (`openstack`) - Ignition will read its configuration from the instance userdata via either metadata service or config drive. Cloud SSH keys are handled separately.
2728
* [Oracle Cloud Infrastucture] (`oraclecloud`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
2829
* [Proxmox VE] (`proxmoxve`) - Ignition will read its configuration from the instance userdata via config drive. If there isn't any valid Ignition configuration in userdata it will check the vendordata next. Cloud SSH keys are handled separately.

dracut/30ignition/module-setup.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,10 @@ installkernel() {
123123
instmods -c zcrypt_cex4
124124
instmods -c pkey_cca
125125
fi
126+
127+
# required by nvidiabluefield platform to read ignition file through bootfifo sysfs interface
128+
if [[ ${DRACUT_ARCH:-$(uname -m)} == aarch64 ]]; then
129+
instmods -c mlxbf_bootctl
130+
fi
126131
}
127132

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Copyright 2025 CoreOS, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
// The NVIDIA BlueField [1] provider fetches configurations from the bootfifo interface.
16+
// [1] https://www.nvidia.com/en-eu/networking/products/data-processing-unit
17+
18+
package nvidiabluefield
19+
20+
import (
21+
"bytes"
22+
"os"
23+
"os/exec"
24+
25+
"github.com/coreos/ignition/v2/config/v3_6_experimental/types"
26+
"github.com/coreos/ignition/v2/internal/distro"
27+
"github.com/coreos/ignition/v2/internal/platform"
28+
"github.com/coreos/ignition/v2/internal/providers/util"
29+
"github.com/coreos/ignition/v2/internal/resource"
30+
31+
"github.com/coreos/vcontext/report"
32+
)
33+
34+
// bootfifo paths are exposed in sysfs by the mlxbf-bootctl platform driver.
35+
// https://github.com/torvalds/linux/blob/2fbe820/drivers/platform/mellanox/mlxbf-bootctl.c#L954
36+
var bootfifoPaths = []string{
37+
"/sys/bus/platform/devices/MLNXBF04:00/bootfifo",
38+
}
39+
40+
func init() {
41+
platform.Register(platform.Provider{
42+
Name: "nvidiabluefield",
43+
Fetch: fetchConfig,
44+
})
45+
}
46+
47+
func fetchConfig(f *resource.Fetcher) (cfg types.Config, rpt report.Report, err error) {
48+
// load mlxbf-bootctl module
49+
if _, err = f.Logger.LogCmd(exec.Command(distro.ModprobeCmd(), "mlxbf_bootctl"), "loading mlxbf-booctl kernel module"); err != nil {
50+
return
51+
}
52+
53+
for _, bootfifoPath := range bootfifoPaths {
54+
f.Logger.Debug("Attempting to read bootfifo at %s", bootfifoPath)
55+
raw, err := os.ReadFile(bootfifoPath)
56+
57+
if os.IsNotExist(err) {
58+
continue
59+
} else if err != nil {
60+
f.Logger.Err("Could not read bootfifo at %s: %v", bootfifoPath, err)
61+
continue
62+
}
63+
64+
if len(raw) == 0 {
65+
continue
66+
}
67+
68+
data := bytes.Trim(raw, "\x00")
69+
return util.ParseConfig(f.Logger, data)
70+
}
71+
72+
f.Logger.Info("No config found in any of the NVIDIA BlueField bootfifo interfaces")
73+
return types.Config{}, report.Report{}, err
74+
}

internal/register/providers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
_ "github.com/coreos/ignition/v2/internal/providers/kubevirt"
3333
_ "github.com/coreos/ignition/v2/internal/providers/metal"
3434
_ "github.com/coreos/ignition/v2/internal/providers/nutanix"
35+
_ "github.com/coreos/ignition/v2/internal/providers/nvidiabluefield"
3536
_ "github.com/coreos/ignition/v2/internal/providers/openstack"
3637
_ "github.com/coreos/ignition/v2/internal/providers/oraclecloud"
3738
_ "github.com/coreos/ignition/v2/internal/providers/packet"

0 commit comments

Comments
 (0)