Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174193115
D60117.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D60117.diff
View Options
diff --git a/lib/libvmmapi/aarch64/vmmapi_machdep.c b/lib/libvmmapi/aarch64/vmmapi_machdep.c
--- a/lib/libvmmapi/aarch64/vmmapi_machdep.c
+++ b/lib/libvmmapi/aarch64/vmmapi_machdep.c
@@ -34,6 +34,7 @@
#include <machine/vmm_snapshot.h>
#include <assert.h>
+#include <errno.h>
#include <string.h>
#include "vmmapi.h"
@@ -56,6 +57,20 @@
};
size_t vm_ioctl_ncmds = nitems(vm_ioctl_cmds);
+int
+vm_get_vgic_version(struct vmctx *ctx)
+{
+ struct vm_vgic_descr vgic;
+ int error;
+
+ bzero(&vgic, sizeof(vgic));
+ error = ioctl(ctx->fd, VM_GET_VGIC_VERSION, &vgic.ver);
+ if (error != 0)
+ return (-error);
+
+ return (vgic.ver.version);
+}
+
int
vm_attach_vgic(struct vmctx *ctx, uint64_t dist_start, size_t dist_size,
uint64_t redist_start, size_t redist_size)
@@ -67,7 +82,10 @@
error = ioctl(ctx->fd, VM_GET_VGIC_VERSION, &vgic.ver);
if (error != 0)
return (error);
- assert(vgic.ver.version == 3);
+ if (vgic.ver.version != 3)
+ return (EINVAL);
+
+ vgic.ver.version = 3;
vgic.v3_regs.dist_start = dist_start;
vgic.v3_regs.dist_size = dist_size;
vgic.v3_regs.redist_start = redist_start;
@@ -76,6 +94,38 @@
return (ioctl(ctx->fd, VM_ATTACH_VGIC, &vgic));
}
+int
+vm_attach_vgic_ex(struct vmctx *ctx, uint64_t dist_start, size_t dist_size,
+ uint64_t redist_start, size_t redist_size, int req_version)
+{
+ struct vm_vgic_descr vgic;
+ int error;
+
+ bzero(&vgic, sizeof(vgic));
+ error = ioctl(ctx->fd, VM_GET_VGIC_VERSION, &vgic.ver);
+ if (error != 0)
+ return (error);
+ if (vgic.ver.version != 3 && vgic.ver.version != 5)
+ return (EINVAL);
+
+ if (req_version == 5 && vgic.ver.version != 5)
+ return (EINVAL);
+
+ vgic.ver.version = req_version;
+ vgic.v3_regs.dist_start = dist_start;
+ vgic.v3_regs.dist_size = dist_size;
+ vgic.v3_regs.redist_start = redist_start;
+ vgic.v3_regs.redist_size = redist_size;
+
+ return (ioctl(ctx->fd, VM_ATTACH_VGIC, &vgic));
+}
+
+int
+vm_attach_vgic_new(struct vmctx *ctx, struct vm_vgic_descr *vgic)
+{
+ return (ioctl(ctx->fd, VM_ATTACH_VGIC, vgic));
+}
+
int
vm_assert_irq(struct vmctx *ctx, uint32_t irq)
{
diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h
--- a/lib/libvmmapi/vmmapi.h
+++ b/lib/libvmmapi/vmmapi.h
@@ -164,8 +164,13 @@
int vm_raise_msi(struct vmctx *ctx, uint64_t addr, uint64_t msg,
int bus, int slot, int func);
#if defined(__aarch64__)
+int vm_get_vgic_version(struct vmctx *ctx);
int vm_attach_vgic(struct vmctx *ctx, uint64_t dist_start, size_t dist_size,
uint64_t redist_start, size_t redist_size);
+int vm_attach_vgic_ex(struct vmctx *ctx, uint64_t dist_start,
+ size_t dist_size, uint64_t redist_start, size_t redist_size,
+ int req_version);
+int vm_attach_vgic_new(struct vmctx *ctx, struct vm_vgic_descr *vgic);
int vm_inject_exception(struct vcpu *vcpu, uint64_t esr, uint64_t far);
#elif defined(__riscv)
int vm_attach_aplic(struct vmctx *ctx, uint64_t mem_start, size_t mem_size);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 2, 6:51 AM (9 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40054392
Default Alt Text
D60117.diff (2 KB)
Attached To
Mode
D60117: libvmmapi: Add Arm GICv5 support
Attached
Detach File
Event Timeline
Log In to Comment