Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict pessimization of M4 arch to macOS 15.2 #3197

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions pkg/limayaml/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -1194,14 +1194,16 @@ func HasHostCPU() bool {
switch runtime.GOOS {
case "darwin":
if hasSMEDarwin() {
// SME is available since Apple M4 running macOS 15.2.
//
// However, QEMU is not ready to handle SME yet.
//
// https://github.com/lima-vm/lima/issues/3032
// https://gitlab.com/qemu-project/qemu/-/issues/2665
// https://gitlab.com/qemu-project/qemu/-/issues/2721
return false
macOSProductVersion, err := osutil.ProductVersion()
if err != nil || macOSProductVersion.Equal(*semver.New("15.2")) {
// SME is available since Apple M4 running macOS 15.2, but it was broken on macOS 15.2.
// It has been fixed in 15.3.
//
// https://github.com/lima-vm/lima/issues/3032
// https://gitlab.com/qemu-project/qemu/-/issues/2665
// https://gitlab.com/qemu-project/qemu/-/issues/2721
return false
}
}
return true
case "linux":
Expand Down
5 changes: 3 additions & 2 deletions pkg/osutil/osversion_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"fmt"
"os/exec"
"strings"
"sync"

"github.com/coreos/go-semver/semver"
)

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