Skip to content

Commit ea38508

Browse files
authored
Merge pull request #3197 from jandubois/qemu-on-m4
Restrict pessimization of M4 arch to macOS 15.2
2 parents 216d3d6 + f3f3b73 commit ea38508

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

pkg/limayaml/defaults.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,14 +1194,16 @@ func HasHostCPU() bool {
11941194
switch runtime.GOOS {
11951195
case "darwin":
11961196
if hasSMEDarwin() {
1197-
// SME is available since Apple M4 running macOS 15.2.
1198-
//
1199-
// However, QEMU is not ready to handle SME yet.
1200-
//
1201-
// https://github.com/lima-vm/lima/issues/3032
1202-
// https://gitlab.com/qemu-project/qemu/-/issues/2665
1203-
// https://gitlab.com/qemu-project/qemu/-/issues/2721
1204-
return false
1197+
macOSProductVersion, err := osutil.ProductVersion()
1198+
if err != nil || macOSProductVersion.Equal(*semver.New("15.2")) {
1199+
// SME is available since Apple M4 running macOS 15.2, but it was broken on macOS 15.2.
1200+
// It has been fixed in 15.3.
1201+
//
1202+
// https://github.com/lima-vm/lima/issues/3032
1203+
// https://gitlab.com/qemu-project/qemu/-/issues/2665
1204+
// https://gitlab.com/qemu-project/qemu/-/issues/2721
1205+
return false
1206+
}
12051207
}
12061208
return true
12071209
case "linux":

pkg/osutil/osversion_darwin.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import (
44
"fmt"
55
"os/exec"
66
"strings"
7+
"sync"
78

89
"github.com/coreos/go-semver/semver"
910
)
1011

1112
// ProductVersion returns the macOS product version like "12.3.1".
12-
func ProductVersion() (*semver.Version, error) {
13+
var ProductVersion = sync.OnceValues(func() (*semver.Version, error) {
1314
cmd := exec.Command("sw_vers", "-productVersion")
1415
// output is like "12.3.1\n"
1516
b, err := cmd.Output()
@@ -26,4 +27,4 @@ func ProductVersion() (*semver.Version, error) {
2627
return nil, fmt.Errorf("failed to parse macOS version %q: %w", verTrimmed, err)
2728
}
2829
return verSem, nil
29-
}
30+
})

0 commit comments

Comments
 (0)