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 {
1174
1174
return false
1175
1175
}
1176
1176
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 {
1189
1178
if runtime .GOOS != "darwin" || runtime .GOARCH != "arm64" {
1190
1179
return false
1191
1180
}
@@ -1195,12 +1184,12 @@ func hasSMEDarwinFn() bool {
1195
1184
logrus .WithError (err ).Debug ("failed to check hw.optional.arm.FEAT_SME" )
1196
1185
}
1197
1186
return s == "1"
1198
- }
1187
+ })
1199
1188
1200
1189
func HasHostCPU () bool {
1201
1190
switch runtime .GOOS {
1202
1191
case "darwin" :
1203
- if hasSMEDarwin {
1192
+ if hasSMEDarwin () {
1204
1193
// SME is available since Apple M4 running macOS 15.2.
1205
1194
//
1206
1195
// However, QEMU is not ready to handle SME yet.
You can’t perform that action at this time.
0 commit comments