git: 1855002ddf0b - main - libvmmapi: Make vm_raise_msi() a common function
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 10 Apr 2024 15:19:12 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1855002ddf0b226d92ce5d698bae06305d9a3a4e commit 1855002ddf0b226d92ce5d698bae06305d9a3a4e Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-04-03 17:09:32 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-04-10 15:17:56 +0000 libvmmapi: Make vm_raise_msi() a common function Currently, bhyve PCI emulation uses vm_lapic_msi() to raise an MSI in the guest. The arm64 port has a similar function, vm_raise_msi(). Add vm_raise_msi() on amd64 as well and have it simply call vm_lapic_msi() so that bhyve can use a common, generically named function. Reviewed by: corvink, andrew, jhb MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D41752 --- lib/libvmmapi/aarch64/vmmapi_machdep.c | 4 ++-- lib/libvmmapi/amd64/vmmapi_machdep.c | 7 +++++++ lib/libvmmapi/vmmapi.h | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/libvmmapi/aarch64/vmmapi_machdep.c b/lib/libvmmapi/aarch64/vmmapi_machdep.c index 5440adaaf3ef..fb2556af3be2 100644 --- a/lib/libvmmapi/aarch64/vmmapi_machdep.c +++ b/lib/libvmmapi/aarch64/vmmapi_machdep.c @@ -99,8 +99,8 @@ vm_deassert_irq(struct vmctx *ctx, uint32_t irq) } int -vm_raise_msi(struct vmctx *ctx, uint64_t addr, uint64_t msg, int bus, int slot, - int func) +vm_raise_msi(struct vmctx *ctx, uint64_t addr, uint64_t msg, + int bus, int slot, int func) { struct vm_msi vmsi; diff --git a/lib/libvmmapi/amd64/vmmapi_machdep.c b/lib/libvmmapi/amd64/vmmapi_machdep.c index 49844be8a574..8990b28b4432 100644 --- a/lib/libvmmapi/amd64/vmmapi_machdep.c +++ b/lib/libvmmapi/amd64/vmmapi_machdep.c @@ -166,6 +166,13 @@ vm_lapic_msi(struct vmctx *ctx, uint64_t addr, uint64_t msg) return (ioctl(ctx->fd, VM_LAPIC_MSI, &vmmsi)); } +int +vm_raise_msi(struct vmctx *ctx, uint64_t addr, uint64_t msg, + int bus __unused, int slot __unused, int func __unused) +{ + return (vm_lapic_msi(ctx, addr, msg)); +} + int vm_apicid2vcpu(struct vmctx *ctx __unused, int apicid) { diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h index 751cfa6ca330..ea869a0c1749 100644 --- a/lib/libvmmapi/vmmapi.h +++ b/lib/libvmmapi/vmmapi.h @@ -157,17 +157,17 @@ int vm_get_register_set(struct vcpu *vcpu, unsigned int count, int vm_run(struct vcpu *vcpu, struct vm_run *vmrun); int vm_suspend(struct vmctx *ctx, enum vm_suspend_how how); int vm_reinit(struct vmctx *ctx); -int vm_apicid2vcpu(struct vmctx *ctx, int apicid); +int vm_raise_msi(struct vmctx *ctx, uint64_t addr, uint64_t msg, + int bus, int slot, int func); #ifdef __aarch64__ 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_assert_irq(struct vmctx *ctx, uint32_t irq); int vm_deassert_irq(struct vmctx *ctx, uint32_t irq); -int vm_raise_msi(struct vmctx *ctx, uint64_t addr, uint64_t msg, int bus, - int slot, int func); int vm_inject_exception(struct vcpu *vcpu, uint64_t esr, uint64_t far); #endif #ifdef __amd64__ +int vm_apicid2vcpu(struct vmctx *ctx, int apicid); int vm_inject_exception(struct vcpu *vcpu, int vector, int errcode_valid, uint32_t errcode, int restart_instruction); int vm_lapic_irq(struct vcpu *vcpu, int vector);