File tree Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -1174,18 +1174,7 @@ func IsAccelOS() bool {
11741174 return false
11751175}
11761176
1177- var (
1178- hasSMEDarwin bool
1179- hasSMEDarwinOnce sync.Once
1180- )
1181-
1182- func init () {
1183- hasSMEDarwinOnce .Do (func () {
1184- hasSMEDarwin = hasSMEDarwinFn ()
1185- })
1186- }
1187-
1188- func hasSMEDarwinFn () bool {
1177+ var hasSMEDarwin = sync .OnceValue (func () bool {
11891178 if runtime .GOOS != "darwin" || runtime .GOARCH != "arm64" {
11901179 return false
11911180 }
@@ -1195,12 +1184,12 @@ func hasSMEDarwinFn() bool {
11951184 logrus .WithError (err ).Debug ("failed to check hw.optional.arm.FEAT_SME" )
11961185 }
11971186 return s == "1"
1198- }
1187+ })
11991188
12001189func HasHostCPU () bool {
12011190 switch runtime .GOOS {
12021191 case "darwin" :
1203- if hasSMEDarwin {
1192+ if hasSMEDarwin () {
12041193 // SME is available since Apple M4 running macOS 15.2.
12051194 //
12061195 // However, QEMU is not ready to handle SME yet.
You can’t perform that action at this time.
0 commit comments