From nobody Thu Mar 16 16:46:10 2023 X-Original-To: dev-commits-src-main@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 4PctSL6KGQz3yK7p; Thu, 16 Mar 2023 16:46:10 +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 4PctSL5XK9z3n6N; Thu, 16 Mar 2023 16:46:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678985170; 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=2eDpvQtpj62hLYuTonkgZBHTdsKl8c2cRWPcp2ItLqA=; b=J+urz2mSRFa2hEouuyhvOJ2YVqQ+CzQvljxzh+afDwXDRiWtpdoje/crZIykSI8dqHK/hP aTCzhOB60aQQBSPCvEtwddi1clgPCBHj2egGqAtH5l26T4Q7fKJt5cCCmN9PlPNWvFfIvI DSDzLeMpOvpEZ055z6/ALA5aLMCasAYjpVwKAoxW/oM4/6+P+rneIRZCs9g0IN6rxpSHVn 4hz/MIlCE6BRTYKLA1hRoBjcn265sN9lKv3pTL88O/7BjaFRgTy77lKTAWRymWvI0LAiwe 9TxV2gPnykss9zbUoH41Y1CROc1bBr6KZB2gWVQKzMdP6k32umtaNJcw26tCqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678985170; 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=2eDpvQtpj62hLYuTonkgZBHTdsKl8c2cRWPcp2ItLqA=; b=GoS1omgjeiAVZuGsa39DieQ00MIh92UQEZn+mnMTI+ppscrFN96zLZUa1QhKDhNQD4nn8G ZCtVIt4k5Aeep7H7Uoyv7er+DAUikOVuTXjaGUutBWBcl+1Ypa5L80kjEPdoD3Jb3xo0rk vs2u7CRsQTo7e/Z88J7Ypcg5inN7VcvcM2SeZh7JR32yBh1Rh5Nm0N1s4+s2dbR42zaqNs eQGA+HuGMSAQTXBTywcj0+WonziC33KVNWPLINRnoyghnx8Gl9zN0VabznJ5fAYODmxc3i MRKBJ6bvc2143jrb29xNf1yvnkpv5DQ6bqaWhsiAMIIwNxPDOmaGK9N6G6EYdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678985170; a=rsa-sha256; cv=none; b=WsTWXAIS1LZguukqVI0TsWnh9+yhF4yLmsEkSZ0w485c6r3+Bf2rUvPM53zZ1skUPr/LL9 Tdvv5kZl+D26amFEBV8wh9JHcsVI9Deq8bb0cNRp8M9hVwBMVpxKQ3ZkVWxXxhHhIgCl3X VyU2x6RJAX1rpZszmvjWqo8tbDsQ9hUoviKOQiVhZaGul1grsRjuUmIt3+3h4Pd8KlQyer 43vRYPYAlJOEskhyZ1oJrts1ZhU+5ZOK+JzDMBRncqodH83c9BoLcZwJC8mwjxHWrTgRID ph40SEmMl58mDNAEQBA0mObVxx1x50YFc0JESRzDQ7iSK5hWk8Yvo4VRY2GuIA== 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 4PctSL4V63zr6G; Thu, 16 Mar 2023 16:46:10 +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 32GGkAGo022255; Thu, 16 Mar 2023 16:46:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32GGkArS022254; Thu, 16 Mar 2023 16:46:10 GMT (envelope-from git) Date: Thu, 16 Mar 2023 16:46:10 GMT Message-Id: <202303161646.32GGkArS022254@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: f7acb7ed41f2 - main - Allow forcing non-posted memory on arm64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: f7acb7ed41f229a050b2d5e35e04791ba5ceaf13 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f7acb7ed41f229a050b2d5e35e04791ba5ceaf13 commit f7acb7ed41f229a050b2d5e35e04791ba5ceaf13 Author: Andrew Turner AuthorDate: 2023-03-16 15:35:59 +0000 Commit: Andrew Turner CommitDate: 2023-03-16 16:45:42 +0000 Allow forcing non-posted memory on arm64 To allow for debugging after changing the arm64 VM_MEMATTR_DEVICE memory type add a new set of tunables to tell the kernel to use non-posted memory. This adds the following tunables: - kern.force_nonposted: When set to non-zero the kernel will use non-posted memory for all device allocations. - hint...force_nonposted: As above, however only forces non-posted memory on the named device. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D38944 --- sys/arm64/arm64/nexus.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c index 3d6519f5fedd..0c06736f4e66 100644 --- a/sys/arm64/arm64/nexus.c +++ b/sys/arm64/arm64/nexus.c @@ -83,6 +83,10 @@ struct nexus_device { struct resource_list nx_resources; }; +static int force_np; +SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, &force_np, 0, + "Force all devices to use non-posted device memory"); + #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) static struct rman mem_rman; @@ -373,7 +377,7 @@ nexus_activate_resource_flags(device_t bus, device_t child, int type, int rid, { struct resource_map_request args; struct resource_map map; - int err; + int err, use_np; if ((err = rman_activate_resource(r)) != 0) return (err); @@ -386,7 +390,13 @@ nexus_activate_resource_flags(device_t bus, device_t child, int type, int rid, case SYS_RES_MEMORY: if ((rman_get_flags(r) & RF_UNMAPPED) == 0) { resource_init_map_request(&args); - if ((flags & BUS_SPACE_MAP_NONPOSTED) != 0) + use_np = (flags & BUS_SPACE_MAP_NONPOSTED) != 0 || + force_np; + if (!use_np) + resource_int_value(device_get_name(child), + device_get_unit(child), "force_nonposted", + &use_np); + if (use_np) args.memattr = VM_MEMATTR_DEVICE_NP; err = nexus_map_resource(bus, child, type, r, &args, &map);