From nobody Wed Mar 15 15:49:17 2023 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 4PcFF95lqMz3ygK0; Wed, 15 Mar 2023 15:49:17 +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 4PcFF94y3Vz4ZJx; Wed, 15 Mar 2023 15:49:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678895357; 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=AR6IXrR52HKn5owNLXworZT4Ve0r9ken78E3mNMGMgk=; b=tjvoY3W+VBugKL23pydi4cn8xx2+7PmwseQpYguqhkAAUxk1hU6BZfzIKu0Y2LgDhdTXcv tnc5BQcrliB1tkSOcfGacsIlofCo8fGngPgMlz1JMg4smvbMmeLtVm8T9FBOxj7uDg3HXk W/WWTLFJ/VoBLSq8LGLwje809hvzCTc5o21uA2fr6xhWhprYXgxXXgiNRa0RI3Bivd2UI7 aIVGwGqXmegr9C4TS00HO0fLRNVr+/JHbs2C7peibI7lqqLCzCaFhl2b7Rr4kf2QLGrh2W GDXwfCOaNAuSrLR8e5yeiwWGKVMaiS/azDE2G4w1qfcInO+Ehexitg5qW3UDMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678895357; 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=AR6IXrR52HKn5owNLXworZT4Ve0r9ken78E3mNMGMgk=; b=C91gNW3ySEU11H3WuOhNO0RUC6cu1jhA62hbX56XbyCBYdMLFxt5SKbWKJC17GexhzksTs /SKApINK9CaTT2M0HZ7ZYkzBDz5Jggvr9HqMx4Fw7MSJn8I+xmJPaGV3NELP1ntKmB5V5h tYFPt5+gQ2/R35uWxBi3hD6548+G8b0fmU4x2E2p/AN/XATB293+iWXnDEXWfN+80SooTo L2rTbhWkA2EgFoOfDTKg/6VUg9B0fA/EsH82d2sOwL4xsCYBwILgB+YQHI2gqlJfPnNEiL WJUQgqe6g1AFVlu+a+/fO4OyKWPXUTdiobQ1HEG9M/QvVC3kgBhT3CpmWA3aeQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678895357; a=rsa-sha256; cv=none; b=MNrzF7l7Ncq9xok/CykxFkt+/OpB3SROP9vs2DCz8DfmnCAFZLuenvfyGM11+lF++PgmFD 0pBbsKyHvQnhKJoTrKZpj8w8zWAjla2KIvAIHlacmXXU786bs1tjTqAmW27qKMT4wlEBr1 Khyk9UOAYKEScYrpBHxFdjhYpWOOaw/VyJv9olwiSjs/1AXoAGEEbYI3LLxEgiP+1DA1RZ r+/lC2/iPT7KpuM4Q9HctiXD3xM4O/XIxgMlJZCRnVEa0BtAer9GXCgn7p09nwYUZxee20 a6aDuM3UooadcCANznOFrU1mY9o/YycAQgfpoE1IcxXNMW6dSopqNs/OZBpVig== 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 4PcFF93tVGz1MGm; Wed, 15 Mar 2023 15:49:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32FFnHjX058793; Wed, 15 Mar 2023 15:49:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32FFnHGh058792; Wed, 15 Mar 2023 15:49:17 GMT (envelope-from git) Date: Wed, 15 Mar 2023 15:49:17 GMT Message-Id: <202303151549.32FFnHGh058792@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 02f3d094aead - main - Use the arm physical timer when able 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: owner-dev-commits-src-all@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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02f3d094aead055d0ebc709c251c124e6f652fb6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=02f3d094aead055d0ebc709c251c124e6f652fb6 commit 02f3d094aead055d0ebc709c251c124e6f652fb6 Author: Andrew Turner AuthorDate: 2023-03-15 13:33:02 +0000 Commit: Andrew Turner CommitDate: 2023-03-15 15:49:00 +0000 Use the arm physical timer when able To allow bhyve manage the virtual timer while in a guest have FreeBSD use the virtual timer only when bhyve will be unavailable due to not starting at EL2 where the hypervisor switcher will run. Reviewed by: imp, kevans Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D39093 --- sys/arm/arm/generic_timer.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c index 36747441ec88..b36fbdf8dcbe 100644 --- a/sys/arm/arm/generic_timer.c +++ b/sys/arm/arm/generic_timer.c @@ -655,8 +655,13 @@ arm_tmr_attach(device_t dev) } #ifdef __aarch64__ - /* Use the virtual timer if we have one. */ - if (sc->irqs[GT_VIRT].res != NULL) { + /* + * Use the virtual timer when we can't use the hypervisor. + * A hypervisor guest may change the virtual timer registers while + * executing so any use of the virtual timer interrupt needs to be + * coordinated with the virtual machine manager. + */ + if (!HAS_PHYS) { sc->physical = false; first_timer = GT_VIRT; last_timer = GT_VIRT; @@ -687,12 +692,9 @@ arm_tmr_attach(device_t dev) } } - /* Disable the virtual timer until we are ready */ - if (sc->irqs[GT_VIRT].res != NULL) - arm_tmr_disable(false); - /* And the physical */ - if ((sc->irqs[GT_PHYS_SECURE].res != NULL || - sc->irqs[GT_PHYS_NONSECURE].res != NULL) && HAS_PHYS) + /* Disable the timers until we are ready */ + arm_tmr_disable(false); + if (HAS_PHYS) arm_tmr_disable(true); arm_tmr_timecount.tc_frequency = sc->clkfreq;