Skip to content

Commit 3e3b4c8

Browse files
committed
run: only use KVM if we are in a native arch
Signed-off-by: Kornilios Kourtis <[email protected]>
1 parent 0d690ee commit 3e3b4c8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pkg/arch/arch.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ func (a Arch) Target() string {
3030
}
3131

3232
func (a Arch) CrossCompiling() bool {
33-
return string(a) != runtime.GOARCH
33+
return !a.IsNative()
34+
}
35+
36+
func (a Arch) IsNative() bool {
37+
return string(a) == runtime.GOARCH
3438
}
3539

3640
func (a Arch) CrossCompileMakeArgs() []string {

pkg/runner/qemu.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func BuildQemuArgs(log *logrus.Logger, rcnf *RunConf) ([]string, error) {
4444

4545
// quick-and-dirty kvm detection
4646
kvmEnabled := false
47-
if !rcnf.DisableHardwareAccel {
47+
if !rcnf.DisableHardwareAccel && qArch.IsNative() {
4848
switch runtime.GOOS {
4949
case "linux":
5050
if f, err := os.OpenFile("/dev/kvm", os.O_RDWR, 0755); err == nil {

0 commit comments

Comments
 (0)