The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=83b003fbe965869124706b4a80b212734152356d
commit 83b003fbe965869124706b4a80b212734152356d Author: Mark Johnston <ma...@freebsd.org> AuthorDate: 2023-10-04 16:28:28 +0000 Commit: Mark Johnston <ma...@freebsd.org> CommitDate: 2023-10-04 16:53:17 +0000 bhyve: Build the HPET ACPI table on amd64 only There is no HPET on arm64 and vm_get_hpet_capabilities() is not implemented there. Move the vm_get_hpet_capabilities() call into build_hpet(): I cannot see a downside, and doing so eliminates a global variable and reduces the amount of code that needs to be conditionally compiled. No functional change intended. Reviewed by: corvink, jhb MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40990 --- usr.sbin/bhyve/acpi.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c index 4a3233291b7a..050e1a0ab75f 100644 --- a/usr.sbin/bhyve/acpi.c +++ b/usr.sbin/bhyve/acpi.c @@ -71,7 +71,6 @@ static int basl_keep_temps; static int basl_verbose_iasl; static int basl_ncpu; -static uint32_t hpet_capabilities; /* * Contains the full pathname of the template to be passed @@ -218,6 +217,7 @@ basl_fwrite_dsdt(FILE *fp) pci_write_dsdt(); +#ifdef __amd64__ dsdt_line(""); dsdt_line(" Scope (_SB.PC00)"); dsdt_line(" {"); @@ -233,6 +233,7 @@ basl_fwrite_dsdt(FILE *fp) dsdt_line(" })"); dsdt_line(" }"); dsdt_line(" }"); +#endif vmgenc_write_dsdt(); @@ -530,11 +531,18 @@ build_fadt(struct vmctx *const ctx) return (0); } +#ifdef __amd64__ static int build_hpet(struct vmctx *const ctx) { ACPI_TABLE_HPET hpet; struct basl_table *table; + uint32_t hpet_capabilities; + int err; + + err = vm_get_hpet_capabilities(ctx, &hpet_capabilities); + if (err != 0) + return (err); BASL_EXEC(basl_table_create(&table, ctx, ACPI_SIG_HPET, BASL_TABLE_ALIGNMENT)); @@ -551,6 +559,7 @@ build_hpet(struct vmctx *const ctx) return (0); } +#endif static int build_madt(struct vmctx *const ctx) @@ -720,14 +729,8 @@ build_spcr(struct vmctx *const ctx) int acpi_build(struct vmctx *ctx, int ncpu) { - int err; - basl_ncpu = ncpu; - err = vm_get_hpet_capabilities(ctx, &hpet_capabilities); - if (err != 0) - return (err); - /* * For debug, allow the user to have iasl compiler output sent * to stdout rather than /dev/null @@ -756,7 +759,9 @@ acpi_build(struct vmctx *ctx, int ncpu) BASL_EXEC(build_rsdp(ctx)); BASL_EXEC(build_fadt(ctx)); BASL_EXEC(build_madt(ctx)); +#ifdef __amd64__ BASL_EXEC(build_hpet(ctx)); +#endif BASL_EXEC(build_mcfg(ctx)); BASL_EXEC(build_facs(ctx)); BASL_EXEC(build_spcr(ctx));