跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

0021-whpx-interrupt-controller-compatibility.patch

64 行 · 2.2 KB历史下载
1Subject: [PATCH] WHPX: use QEMU interrupt controller emulation for the Cage Linux guest
2
3---
4diff --git a/pkg/driver/qemu/qemu.go b/pkg/driver/qemu/qemu.go
5--- a/pkg/driver/qemu/qemu.go
6+++ b/pkg/driver/qemu/qemu.go
7@@ -587,7 +587,7 @@
8 args = append(args, "-global", "ICH9-LPC.disable_s3=1")
9 args = append(args, "-global", "ICH9-LPC.disable_s4=1")
10 default:
11- args = appendArgsIfNoConflict(args, "-machine", "q35,accel="+accel)
12+ args = appendQ35Machine(args, accel)
13 }
14 case limatype.AARCH64:
15 machine := "virt,accel=" + accel
16diff --git a/pkg/driver/qemu/machine.go b/pkg/driver/qemu/machine.go
17new file mode 100644
18--- /dev/null
19+++ b/pkg/driver/qemu/machine.go
20@@ -0,0 +1,15 @@
21+// SPDX-FileCopyrightText: Copyright The Lima Authors
22+// SPDX-License-Identifier: Apache-2.0
23+
24+package qemu
25+
26+func appendQ35Machine(args []string, accel string) []string {
27+ machine := "q35,accel=" + accel
28+ if accel == "whpx" {
29+ // QEMU 11 can fail to enable nested virtualization on WHPX even
30+ // when Windows reports it as supported (HRESULT 80370302). Use
31+ // QEMU's interrupt controller emulation for the Cage Linux guest.
32+ machine += ",kernel-irqchip=off"
33+ }
34+ return appendArgsIfNoConflict(args, "-machine", machine)
35+}
36diff --git a/pkg/driver/qemu/machine_test.go b/pkg/driver/qemu/machine_test.go
37new file mode 100644
38--- /dev/null
39+++ b/pkg/driver/qemu/machine_test.go
40@@ -0,0 +1,24 @@
41+// SPDX-FileCopyrightText: Copyright The Lima Authors
42+// SPDX-License-Identifier: Apache-2.0
43+
44+package qemu
45+
46+import "testing"
47+
48+func TestWHPXMachineCompatibility(t *testing.T) {
49+ for _, accel := range []string{"whpx", "kvm", "hvf", "nvmm"} {
50+ want := "q35,accel=" + accel
51+ if accel == "whpx" {
52+ want += ",kernel-irqchip=off"
53+ }
54+ args := appendQ35Machine(nil, accel)
55+ if got, _ := argValue(args, "-machine"); got != want {
56+ t.Fatalf("%s: got %q, want %q", accel, got, want)
57+ }
58+ }
59+ // Retain Lima's explicit override contract for custom QEMU arguments.
60+ args := appendQ35Machine([]string{"-machine", "q35,accel=whpx,kernel-irqchip=on"}, "whpx")
61+ if len(args) != 2 || args[1] != "q35,accel=whpx,kernel-irqchip=on" {
62+ t.Fatalf("overrode explicit machine: %v", args)
63+ }
64+}