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

Minimal collection for running on Xen/ARM64 #1358

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d545832
intrng: split intr_describe_irq()
ehem Mar 24, 2023
f215ff3
intrng: expose lower-level device interface for INTRNG
ehem Mar 24, 2023
66c5fde
intrng: add calling pic_init_secondary on all registered PICs
ehem Jun 9, 2023
de61dc9
intrng: allocate event during isrc setup
ehem Aug 21, 2023
18d2567
intrng: destroy event when deregistering source
ehem Nov 12, 2022
adbf624
xen/arm64: implement aarch64 Xen hypercall header
ehem Mar 8, 2022
8f88dd6
xen: move Xen hypercall wrapper functions to sys/xen
ehem Mar 7, 2022
65741e1
xen/console: add hook for early Xen probing
ehem Apr 24, 2021
663d753
xen/intrng: add Xen INTRNG files and copyright notice
ehem Apr 10, 2021
79d08d3
xen/arm64: add aarch64 main Xen configuration header
jgrall Jan 14, 2014
9a1733a
xen/intrng: add handling of Xen device-tree
jgrall Jan 14, 2014
9864580
xen/intrng: implement kernel event Xen interrupts
jgrall Oct 21, 2015
550b4a5
xen/intrng: small description adjustment
ehem May 9, 2023
c50562d
xen/intrng: retrieved from history
jgrall Jan 14, 2014
d57b109
xen/intrng: updates for FreeBSD-CURRENT
ehem Feb 16, 2021
992ac28
xen/intrng: report error when failing to map shared info page
ehem Sep 7, 2023
9d1f970
xen/intrng: rename xen_init() to match better with purpose
ehem Feb 16, 2021
229d617
xen/intrng: arm64: implement Xen event balancing
ehem Jun 26, 2021
170da82
xen/intrng: move isrc allocation to architecture (INTRNG version)
ehem Jun 5, 2021
8fd5470
xen/intrng: update PAGE_MASK_4K
ehem Sep 9, 2022
4c2d660
xen/intrng: switch to DEVMETHOD_END from inline
ehem Aug 15, 2023
aab9d04
xen/intrng: add checking for Domain 0
ehem Jun 15, 2022
02dffc3
xen/intrng: use xen_setup_vcpu_info() for vcpu_info setup
ehem Jun 9, 2023
c497d46
xen/intrng: remove vcpu_info from INTRNG implementation
ehem Jun 8, 2023
e6ef9a7
xen/intrng: switch to ofwbus-only
ehem Jun 9, 2023
04dadff
xen/intrng: add INTRNG PIC interface
ehem Nov 11, 2022
42fe093
xen/intrng: add INTRNG PIC registration
ehem Nov 11, 2022
e22c57e
xen/intrng: call xen_setup_vcpu_info() as pic_init_secondary
ehem Jun 9, 2023
ff051b8
xen: add atomic #defines to accomodate differing xen_ulong_t sizes
ehem Dec 2, 2023
316a2b1
xen/arm64: enable arm64 Xen configuration
jgrall Jan 14, 2014
f367503
xen/arm64: add Xen support to NOTES, avoid ACPI-only
ehem Nov 5, 2022
06f24df
xen/intrng: add INTRNG PIC interface
ehem Nov 11, 2022
cdb7611
xen/intrng: add pic_bind_intr, arch-intr.h
ehem Nov 15, 2022
adf8eb3
xen/intrng: progress on INTRNG, allocation/release implemented
ehem Nov 11, 2022
e32c503
xen/intrng: small description adjustment
ehem May 9, 2023
0d064f5
xen/intrng: handle binding
ehem Nov 11, 2022
5d2a185
xen/intrng: assert non-NULL event during bind
ehem May 8, 2023
efe1a11
xen/intrng: declarations of everything believed to be done
ehem Nov 11, 2022
5009b57
xen/intrng: increment/decrement ->isrc_handlers on handler add/remove
ehem Jun 9, 2023
fb185ff
xen/intrng: purge unused functions
ehem May 9, 2023
253ef08
xen/intrng: implement new grant-table allocation interface
ehem May 7, 2024
5ffa406
xen/intrng: explicitly initialize rid for interrupts
ehem May 8, 2024
586b422
xen/intrng: switch to newly exposed interface
ehem May 7, 2023
fd45ce6
xen/intrng: fix Xen event balancing
ehem May 9, 2023
7156bdc
RELNOTES: add entry for Xen/ARM64
ehem Jul 2, 2021
f514ba9
manpages: update xen.4 for additional authors
ehem Apr 15, 2022
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
15 changes: 15 additions & 0 deletions RELNOTES
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ newline. Entries should be separated by a newline.

Changes to this file should not be MFCed.

????????????:
Support for operation in Xen/ARM64 VMs was introduced. FreeBSD
has worked in x86 Xen VMs for more than a decade, but now FreeBSD
works in Xen's ARM64 VMs. Effort was made to keep the patches
architecture-independent, so support for Xen/RISC-V should appear
once Xen/RISC-V becomes viable.

Tianocore/EDK2 for Xen/ARM is the presently known to work initial boot
stage. Build the ArmVirtXen.dsc configuration and configure XEN_EFI.fd
as the kernel to boot.

Presently DomU operation has been implemented. Dom0 operation could
be implemented in the future. A sponsor could aid this, or CheriBSD
may get there first.

f57efe95cc25:
New mididump(1) utility which dumps MIDI 1.0 events in real time.

Expand Down
8 changes: 7 additions & 1 deletion share/man/man4/xen.4
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd January 8, 2024
.Dd January 23, 2024
.Dt XEN 4
.Os
.Sh NAME
Expand Down Expand Up @@ -136,3 +136,9 @@ This manual page was written by
.An Robert Watson Aq Mt [email protected] ,
and
.An Roger Pau Monné Aq Mt [email protected] .
A great deal of work since 2015 has been done by
.An Roger Pau Monné Aq Mt [email protected] .
Initial work on adding support for DomU support on ARM64 was done by
.An Julien Grall Aq Mt [email protected] .
ARM64 DomU support was completed in 2022 by
.An Elliott Mitchell .
225 changes: 2 additions & 223 deletions sys/amd64/include/xen/hypercall.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
#ifndef __MACHINE_XEN_HYPERCALL_H__
#define __MACHINE_XEN_HYPERCALL_H__

#include <sys/systm.h>

#ifndef __XEN_HYPERVISOR_H__
# error "please don't include this file directly"
#endif
Expand Down Expand Up @@ -164,227 +162,8 @@ HYPERVISOR_set_trap_table(
return _hypercall1(int, set_trap_table, table);
}

static inline int __must_check
HYPERVISOR_mmu_update(
mmu_update_t *req, unsigned int count, unsigned int *success_count,
domid_t domid)
{
return _hypercall4(int, mmu_update, req, count, success_count, domid);
}

static inline int __must_check
HYPERVISOR_mmuext_op(
struct mmuext_op *op, unsigned int count, unsigned int *success_count,
domid_t domid)
{
return _hypercall4(int, mmuext_op, op, count, success_count, domid);
}

static inline int __must_check
HYPERVISOR_set_gdt(
unsigned long *frame_list, unsigned int entries)
{
return _hypercall2(int, set_gdt, frame_list, entries);
}

static inline int __must_check
HYPERVISOR_stack_switch(
unsigned long ss, unsigned long esp)
{
return _hypercall2(int, stack_switch, ss, esp);
}

static inline int __must_check
HYPERVISOR_set_callbacks(
unsigned long event_address, unsigned long failsafe_address,
unsigned long syscall_address)
{
return _hypercall3(int, set_callbacks,
event_address, failsafe_address, syscall_address);
}

static inline int
HYPERVISOR_fpu_taskswitch(
int set)
{
return _hypercall1(int, fpu_taskswitch, set);
}

static inline int __must_check
HYPERVISOR_sched_op(
int cmd, void *arg)
{
return _hypercall2(int, sched_op, cmd, arg);
}

static inline long __must_check
HYPERVISOR_set_timer_op(
uint64_t timeout)
{
return _hypercall1(long, set_timer_op, timeout);
}

static inline int __must_check
HYPERVISOR_platform_op(
struct xen_platform_op *platform_op)
{
platform_op->interface_version = XENPF_INTERFACE_VERSION;
return _hypercall1(int, platform_op, platform_op);
}

static inline int __must_check
HYPERVISOR_set_debugreg(
unsigned int reg, unsigned long value)
{
return _hypercall2(int, set_debugreg, reg, value);
}

static inline unsigned long __must_check
HYPERVISOR_get_debugreg(
unsigned int reg)
{
return _hypercall1(unsigned long, get_debugreg, reg);
}

static inline int __must_check
HYPERVISOR_update_descriptor(
unsigned long ma, unsigned long word)
{
return _hypercall2(int, update_descriptor, ma, word);
}

static inline int __must_check
HYPERVISOR_memory_op(
unsigned int cmd, void *arg)
{
return _hypercall2(int, memory_op, cmd, arg);
}

static inline int __must_check
HYPERVISOR_multicall(
multicall_entry_t *call_list, unsigned int nr_calls)
{
return _hypercall2(int, multicall, call_list, nr_calls);
}

static inline int __must_check
HYPERVISOR_update_va_mapping(
unsigned long va, uint64_t new_val, unsigned long flags)
{
return _hypercall3(int, update_va_mapping, va, new_val, flags);
}

static inline int __must_check
HYPERVISOR_event_channel_op(
int cmd, void *arg)
{
return _hypercall2(int, event_channel_op, cmd, arg);
}

static inline int __must_check
HYPERVISOR_xen_version(
int cmd, void *arg)
{
return _hypercall2(int, xen_version, cmd, arg);
}

static inline int __must_check
HYPERVISOR_console_io(
int cmd, unsigned int count, const char *str)
{
return _hypercall3(int, console_io, cmd, count, str);
}

static inline int __must_check
HYPERVISOR_physdev_op(
int cmd, void *arg)
{
return _hypercall2(int, physdev_op, cmd, arg);
}

static inline int __must_check
HYPERVISOR_grant_table_op(
unsigned int cmd, void *uop, unsigned int count)
{
return _hypercall3(int, grant_table_op, cmd, uop, count);
}

static inline int __must_check
HYPERVISOR_update_va_mapping_otherdomain(
unsigned long va, uint64_t new_val, unsigned long flags, domid_t domid)
{
return _hypercall4(int, update_va_mapping_otherdomain, va,
new_val, flags, domid);
}

static inline int __must_check
HYPERVISOR_vm_assist(
unsigned int cmd, unsigned int type)
{
return _hypercall2(int, vm_assist, cmd, type);
}

static inline int __must_check
HYPERVISOR_vcpu_op(
int cmd, unsigned int vcpuid, void *extra_args)
{
return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
}

static inline int __must_check
HYPERVISOR_set_segment_base(
int reg, unsigned long value)
{
return _hypercall2(int, set_segment_base, reg, value);
}

static inline int __must_check
HYPERVISOR_suspend(
unsigned long srec)
{
struct sched_shutdown sched_shutdown = {
.reason = SHUTDOWN_suspend
};

return _hypercall3(int, sched_op, SCHEDOP_shutdown,
&sched_shutdown, srec);
}

static inline unsigned long __must_check
HYPERVISOR_hvm_op(
int op, void *arg)
{
return _hypercall2(unsigned long, hvm_op, op, arg);
}

static inline int __must_check
HYPERVISOR_callback_op(
int cmd, const void *arg)
{
return _hypercall2(int, callback_op, cmd, arg);
}

static inline int __must_check
HYPERVISOR_xenoprof_op(
int op, void *arg)
{
return _hypercall2(int, xenoprof_op, op, arg);
}

static inline int __must_check
HYPERVISOR_kexec_op(
unsigned long op, void *args)
{
return _hypercall2(int, kexec_op, op, args);
}

static inline int __must_check
HYPERVISOR_dm_op(
domid_t domid, unsigned int nr_bufs, const void *bufs)
{
return _hypercall3(int, dm_op, domid, nr_bufs, bufs);
}

#undef __must_check

#include <xen/hypercall.h>

#endif /* __MACHINE_XEN_HYPERCALL_H__ */
7 changes: 7 additions & 0 deletions sys/arm/arm/gic.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ arm_gic_init_secondary(device_t dev, uint32_t rootnum)
struct arm_gic_softc *sc = device_get_softc(dev);
u_int irq, cpu;

if (root_type >= INTR_ROOT_COUNT) {
/*
* Per-processor setup for devices with PPI interrupts?
*/
return;
}

/* Set the mask so we can find this CPU to send it IPIs */
cpu = PCPU_GET(cpuid);
MPASS(cpu < GIC_MAXCPU);
Expand Down
7 changes: 7 additions & 0 deletions sys/arm/broadcom/bcm2835/bcm2836.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,13 @@ bcm_lintc_init_secondary(device_t dev, uint32_t rootnum)
u_int cpu;
struct bcm_lintc_softc *sc;

if (root_type >= INTR_ROOT_COUNT) {
/*
* Per-processor setup for devices with PPI interrupts?
*/
return;
}

cpu = PCPU_GET(cpuid);
sc = device_get_softc(dev);

Expand Down
7 changes: 7 additions & 0 deletions sys/arm64/arm64/gic_v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,13 @@ gic_v3_init_secondary(device_t dev, uint32_t rootnum)
u_int cpu, irq;
int err, i;

if (root_type >= INTR_ROOT_COUNT) {
/*
* Per-processor setup for devices with PPI interrupts?
*/
return;
}

sc = device_get_softc(dev);
cpu = PCPU_GET(cpuid);

Expand Down
7 changes: 7 additions & 0 deletions sys/arm64/arm64/gicv3_its.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,13 @@ gicv3_its_init_secondary(device_t dev, uint32_t rootnum)
{
struct gicv3_its_softc *sc;

if (root_type >= INTR_ROOT_COUNT) {
/*
* Per-processor setup for devices with PPI interrupts?
*/
return;
}

sc = device_get_softc(dev);

/*
Expand Down
6 changes: 6 additions & 0 deletions sys/arm64/conf/LINT-ACPI
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
include "../../conf/NOTES"
include NOTES
nooptions FDT

#####################################################################
# Items broken without FDT that are generally available elsewhere

# Only presently available probe method uses device-trees
nooptions XENHVM
3 changes: 3 additions & 0 deletions sys/arm64/conf/LINT-FDT
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
include "../../conf/NOTES"
include NOTES
nodevice acpi

#####################################################################
# Items broken without ACPI that are generally available elsewhere
3 changes: 3 additions & 0 deletions sys/arm64/conf/NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ device gve # Google Virtual NIC (gVNIC) driver
# Microsoft Hyper-V
device hyperv

# Xen HVM Guest support
options XENHVM # Xen HVM kernel infrastructure

# CPU frequency control
device cpufreq

Expand Down
3 changes: 3 additions & 0 deletions sys/arm64/conf/std.virt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Virt SoC support
#

# Xen HVM Guest support
options XENHVM # Xen HVM kernel infrastructure

# Block devices
device pvscsi # VMware PVSCSI

Expand Down
1 change: 1 addition & 0 deletions sys/arm64/include/xen/arch-intr.h
Loading
Loading