From nobody Wed Apr 10 15:19:27 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VF61r1dC6z5HHbc; Wed, 10 Apr 2024 15:19:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VF61r0nHQz4ncN; Wed, 10 Apr 2024 15:19:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712762368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zLQhic69hcj0fwDiTVW9nDIT7Jj3E5KW5NOmWTHDAk8=; b=RA0Wd7qTauOnxW42YcFhKR0pXjBJga9vNdDC/8DURsvylKmpjg0W9nt0YBtdf2lMNt4bxB BaD0AoE3h/KhZcG5kt4XUbDbNsxO0etL5yf8SZ8k2yXrmKjkOurg2e8M0Y5FqecHFcoqZB 7YUbWHjR+Ri1KInXcvuXVVYVw4c47EQhL0BMsvSWIrfUju09hCdjhmjlkqsyHE0KN/830G AQRJy1fRloOZFRmyQl1aAedmDOjGxDRzcUqywiPDQ2PjP7TYqaoPUBRR5PFONu63ktsMrh ZyvPwpRRXD4XUDXSBZrEcPeFyUcz8LoRurDfRxcJdKWCVW2vCyWqykIJravDOA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712762368; a=rsa-sha256; cv=none; b=SySe1qywArzfmc6L410XyZ4p3VOwmXVRgV55g63Cyv/5BB30Qk63rjgc+Qsv7Zrnq/Gtxr v2wtCPHYx9PObS/xPGhfLy4bjEdITjPlfl7vUOPqD2f1exMTichJOM/FfulH3DtQs1Hm/o wN/5EU0OYIzyGwXKMPMQi49a850XYC/dxGm6zMIk1yVw4mgsqc3Lr7oBzLF0slrfIBP1W9 /7KsvyJ5QkoW9d5qoXMzB3JweNFCfSxH3TYBruF2D+tr19ADVvR/157zUIG4SmjG4pJop+ ZkjyVDFzlkd4EMsrAHbjnYQwhuBq1TQ/+IeJfe8jlmXm1FTu+rdoUk0+tQoMhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712762368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zLQhic69hcj0fwDiTVW9nDIT7Jj3E5KW5NOmWTHDAk8=; b=ChfOxuH8i8iC09bE+wTjiXb3VNFUagYuj2ZVINzmAcvr1eIMQdGWwPd3CDp37890tekdmk draBtmDk+PjoikkU5+45r1f8OR144d8TutlMBHqI8HbgWC9LtE1IVtYB9Cut28JWCyfJYb qci2SHW4MtMiK03TL+VVsE/c5mGJhOQXYah1sDP/rpghQ6xj6V61cacNhztu0UKXfROvjl U0n843dLFdDzn9ZX3H5o0kJ3vzKMNtVRvY7ZDR2g+kg4oksqTk33vouhmfGOJwGLrNotEr YkDYwHdPX6nW9YdNY8rfO+yw5e1FcXRZat94s5f5l2Ij9jvFQi4hkaJJ+OZ9zg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VF61r0PV0zjsN; Wed, 10 Apr 2024 15:19:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43AFJRDa093828; Wed, 10 Apr 2024 15:19:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43AFJRPb093825; Wed, 10 Apr 2024 15:19:27 GMT (envelope-from git) Date: Wed, 10 Apr 2024 15:19:27 GMT Message-Id: <202404101519.43AFJRPb093825@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e3bd5730ca92 - main - bhyve: Extract uart-clock from fdt_add_uart as an apb-pclk List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: dev-commits-src-all+owner@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3bd5730ca925cd74dece9c52bcc10237b058546 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e3bd5730ca925cd74dece9c52bcc10237b058546 commit e3bd5730ca925cd74dece9c52bcc10237b058546 Author: Jessica Clarke AuthorDate: 2024-02-21 22:44:57 +0000 Commit: Mark Johnston CommitDate: 2024-04-10 15:17:56 +0000 bhyve: Extract uart-clock from fdt_add_uart as an apb-pclk This clock will also be used by the PL031 RTC (rather than defining redundant per-device clocks). Reviewed by: jhb MFC after: 2 weeks Obtained from: CheriBSD --- usr.sbin/bhyve/aarch64/fdt.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/usr.sbin/bhyve/aarch64/fdt.c b/usr.sbin/bhyve/aarch64/fdt.c index 65876f0f90e8..e8c959a65f3b 100644 --- a/usr.sbin/bhyve/aarch64/fdt.c +++ b/usr.sbin/bhyve/aarch64/fdt.c @@ -57,6 +57,7 @@ static void *fdtroot; static uint32_t gic_phandle = 0; +static uint32_t apb_pclk_phandle; static uint32_t assign_phandle(void *fdt) @@ -155,6 +156,14 @@ fdt_init(struct vmctx *ctx, int ncpu, vm_paddr_t fdtaddr, vm_size_t fdtsize) fdt_property_string(fdt, "method", "hvc"); fdt_end_node(fdt); + fdt_begin_node(fdt, "apb-pclk"); + fdt_property_string(fdt, "compatible", "fixed-clock"); + fdt_property_string(fdt, "clock-output-names", "clk24mhz"); + fdt_property_u32(fdt, "#clock-cells", 0); + fdt_property_u32(fdt, "clock-frequency", 24000000); + apb_pclk_phandle = assign_phandle(fdt); + fdt_end_node(fdt); + /* Finalized by fdt_finalized(). */ fdtroot = fdt; @@ -204,21 +213,13 @@ fdt_add_uart(uint64_t uart_base, uint64_t uart_size, int intr) { void *fdt, *interrupts, *prop; char node_name[32]; - uint32_t clk_phandle; assert(gic_phandle != 0); + assert(apb_pclk_phandle != 0); assert(intr >= GIC_FIRST_SPI); fdt = fdtroot; - fdt_begin_node(fdt, "uart-clock"); - fdt_property_string(fdt, "compatible", "fixed-clock"); - fdt_property_string(fdt, "clock-output-names", "clk24mhz"); - fdt_property_u32(fdt, "#clock-cells", 0); - fdt_property_u32(fdt, "clock-frequency", 24000000); - clk_phandle = assign_phandle(fdt); - fdt_end_node(fdt); - snprintf(node_name, sizeof(node_name), "serial@%lx", uart_base); fdt_begin_node(fdt, node_name); #define UART_COMPAT "arm,pl011\0arm,primecell" @@ -232,8 +233,8 @@ fdt_add_uart(uint64_t uart_base, uint64_t uart_size, int intr) SET_PROP_U32(interrupts, 1, intr - GIC_FIRST_SPI); SET_PROP_U32(interrupts, 2, IRQ_TYPE_LEVEL_HIGH); fdt_property_placeholder(fdt, "clocks", 2 * sizeof(uint32_t), &prop); - SET_PROP_U32(prop, 0, clk_phandle); - SET_PROP_U32(prop, 1, clk_phandle); + SET_PROP_U32(prop, 0, apb_pclk_phandle); + SET_PROP_U32(prop, 1, apb_pclk_phandle); #define UART_CLK_NAMES "uartclk\0apb_pclk" fdt_property(fdt, "clock-names", UART_CLK_NAMES, sizeof(UART_CLK_NAMES));