From nobody Mon Mar 20 06:22:08 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 4Pg4QY0PZYz40HBn; Mon, 20 Mar 2023 06:22:13 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pg4QX6ycnz3vvp; Mon, 20 Mar 2023 06:22:12 +0000 (UTC) (envelope-from rpokala@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679293333; 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: in-reply-to:in-reply-to:references:references; bh=adN/IFq1sTNLpK5SwNH2Kqf4XjJu0fxeyJUF4N2l/2I=; b=F0jdBtilHCF4CfV3Y+au45VNoouOL9B60zVdv4BGo8KTbtC+N1+yDgjs7eV+uURtwyfMz6 q2djUNED9RE4Vc09Hb39u/4of6sChJd/V/NWdr5b55Ywrwvm2sq+cJyiY/yQCSNWc9G5Lm Ky1R8x7POHdd9VwqLXQ9LAKRrp7/J0QHyD0pju90ALugZSkklw9P4wWyMsxcmBVtGKY6qQ g7nxsR6Kt8nQs7cj7Dt/dQuVfmeWGr04fq2V65JLQwmlN4GnktxNJ9mk9Vd8m5o5aJ1oxW H4XU6eGNJyfYR5gHC+nCm8ottQ0Gxcd/3sEGFZ9MTHQyZcMDM41w6B4dBOuLOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679293333; 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: in-reply-to:in-reply-to:references:references; bh=adN/IFq1sTNLpK5SwNH2Kqf4XjJu0fxeyJUF4N2l/2I=; b=DRo1rbHN4UYl8PnMzCXN5EodNYbJY1gwMzRLMaEYgRujKK+B8VldLH8BuA4RQzNcA/8qw7 nNFtJozsbaTyjioWYQoLWqwWuiKsbIz48kJ18v992kQk85bYWJ7kTrx6u2bcn/cExFlfGP ez64lrf3yLhD3o2GWPRV4Dq2T31SFt4YRRymd0/MOrW7U28eFJQXSHW3Dh+16SaoOf6jLz NOUdTUq5B2vQAExDCl2AIOd+XOpfY3/A64ILBKo3sU9ZKh89HMOfb0WIK5imhjJUW9B7S1 6CM1856wRXI3iFwFuBzBM/4DwqVfS1VQabewQkKjZMM2uy6BDPpvUEoMJacb/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679293333; a=rsa-sha256; cv=none; b=W9SpyRHah/PaUdKyD/U0XbHWAutDgSN7J+LxtjSWblHS+ePauAw1DfEQfbGFRjv2PzXIpn PM+rH9BfG5sKpTSUvX6+UbZnLVq2Rtz/XUHKauQf91cw8nJQXwC7j8nkHTXQ5BvnNy5V+c q0Gn/dzRFWBHk9DJOpeGGqdDdz5uPLdQoh5LhLoanozL7r6N3x1nI7Qdc2mcTT8P0KiArS dHLaeLEgv7cCdk6L8IJ3tJAxQVpV+9jo62xyCkX3rqt71R8Xg6AbbVSZRfd6U4CkPUTDAq VoQ97vPHZNZe8Lh/K4zQw9Cyyw9D64KJofjzWVnZXu9kLOXxxqdKRCIuvAx/mg== Received: from [192.168.1.10] (unknown [IPv6:2601:641:700:5284:5c12:3669:f9bf:d3a6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Pg4QX2JvTz1Gsn; Mon, 20 Mar 2023 06:22:12 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.71.23031200 Date: Sun, 19 Mar 2023 23:22:08 -0700 Subject: Re: f7acb7ed41f2 - main - Allow forcing non-posted memory on arm64 From: Ravi Pokala To: Andrew Turner , , , Message-ID: <511B5170-6DE9-4056-8AEC-43A2D60BE533@panasas.com> Thread-Topic: f7acb7ed41f2 - main - Allow forcing non-posted memory on arm64 References: <202303161646.32GGkArS022254@gitrepo.freebsd.org> In-Reply-To: <202303161646.32GGkArS022254@gitrepo.freebsd.org> 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: quoted-printable X-ThisMailContainsUnwantedMimeParts: N Hi Andrew, This breaks arm64.LINT-FDT: | >>> stage 3.1: building everything | -------------------------------------------------------------- | /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:61: e= rror: expected identifier | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, &force_np, 0, | ^ | /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:1: er= ror: type specifier missing, defaults to 'int'; ISO C99 and later do not sup= port implicit int [-Werror,-Wimplicit-int] | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, &force_np, 0, | ^ | int | /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:11: w= arning: a function declaration without a prototype is deprecated in all vers= ions of C [-Wstrict-prototypes] | SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, &force_np, 0, | ^ | 1 warning and 2 errors generated. | --- nexus.o --- | *** [nexus.o] Error code 1 |=20 | make[5]: stopped in /build/usr/home/rpokala/freebsd/src/clean-main/arm64.= aarch64/sys/LINT-FDT Thanks, Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: > on behalf of Andrew Turner > Date: Thursday, March 16, 2023 at 09:46 To: >, >, > Subject: git: f7acb7ed41f2 - main - Allow forcing non-posted memory on arm6= 4 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e0479= 1ba5ceaf13 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 ch= ild, int type, int rid, { struct resource_map_request args; struct resource_map map; - int err; + int err, use_np; if ((err =3D rman_activate_resource(r)) !=3D 0) return (err); @@ -386,7 +390,13 @@ nexus_activate_resource_flags(device_t bus, device_t c= hild, int type, int rid, case SYS_RES_MEMORY: if ((rman_get_flags(r) & RF_UNMAPPED) =3D=3D 0) { resource_init_map_request(&args); - if ((flags & BUS_SPACE_MAP_NONPOSTED) !=3D 0) + use_np =3D (flags & BUS_SPACE_MAP_NONPOSTED) !=3D 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 =3D VM_MEMATTR_DEVICE_NP; err =3D nexus_map_resource(bus, child, type, r, &args, &map);