From nobody Mon Mar 20 12:10:00 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 4PgD8830G0z40dZ0 for ; Mon, 20 Mar 2023 12:10:16 +0000 (UTC) (envelope-from bT.8gkgh6xd30=jpyage3vnu2d=2sl1wfofor@return.smtpservice.net) Received: from e2i580.smtp2go.com (e2i580.smtp2go.com [103.2.142.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PgD880T1lz3Fn5 for ; Mon, 20 Mar 2023 12:10:15 +0000 (UTC) (envelope-from bT.8gkgh6xd30=jpyage3vnu2d=2sl1wfofor@return.smtpservice.net) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpservice.net; s=mgy720.a1-4.dyn; x=1679315115; h=Feedback-ID: X-Smtpcorp-Track:To:Date:Subject:Message-Id:From:Reply-To:Sender: List-Unsubscribe; bh=m9jN/RjJBbWfIoQdE4lsVXgVLzFPr4LYfNGAjIsdoxk=; b=ECL/U6l9 6zU5M0k5liiqS6ZnM0phoLX0weI72EVMdcTGcekRh+hzx+WlH60VF62zfd/ynnyb34oMINFkGG3f2 ojbhfWNkJYFTqnKXYN2l3DqdtcWR5tG6+9e1/YVTQ6IKgnfsTt5ZWTt50qtvsSMUl8HQLcgwoCsBF qmWHnRjIDFNsJuS26tazWgSMqEYQ1s45yNybaHEg+YKB2rLwU7hn0wu4T0cE4lhFdiuim18Ay9IJ7 V8BgwywmiNC71VoL4YbFZTZoGleMVA4EmyYos/ilO7CqdXlues0JOon7ZWiVOdr0jovNakNpfr5xp BmMteMj5Fxg7EZORHCZPxn2A3Q==; Received: from [10.176.58.103] (helo=SmtpCorp) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2-S2G) (envelope-from ) id 1peEL6-qt4KyX-RP; Mon, 20 Mar 2023 12:10:12 +0000 Received: from [10.162.55.164] (helo=morbo.fubar.geek.nz) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96-S2G) (envelope-from ) id 1peEL6-9EU24T-1Z; Mon, 20 Mar 2023 12:10:12 +0000 Received: from smtpclient.apple (cpc91210-cmbg18-2-0-cust37.5-4.cable.virginm.net [81.102.44.38]) by morbo.fubar.geek.nz (Postfix) with ESMTPSA id 993E1294F3; Mon, 20 Mar 2023 12:10:11 +0000 (UTC) From: Andrew Turner Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE" 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 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: f7acb7ed41f2 - main - Allow forcing non-posted memory on arm64 Date: Mon, 20 Mar 2023 12:10:00 +0000 In-Reply-To: <511B5170-6DE9-4056-8AEC-43A2D60BE533@panasas.com> Cc: "" , "" , "" To: Ravi Pokala References: <202303161646.32GGkArS022254@gitrepo.freebsd.org> <511B5170-6DE9-4056-8AEC-43A2D60BE533@panasas.com> X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Smtpcorp-Track: 1p-EL69El24T1Z.GJ0_FFw6H3Pg8 Feedback-ID: 790814m:790814amQcrys:790814s_u8mx-IzT X-Report-Abuse: Please forward a copy of this message, including all headers, to X-Rspamd-Queue-Id: 4PgD880T1lz3Fn5 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:23352, ipnet:103.2.140.0/22, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 That should now be fixed. Andrew > On 20 Mar 2023, at 06:22, Ravi Pokala wrote: >=20 > Hi Andrew, >=20 > This breaks arm64.LINT-FDT: >=20 > | >>> stage 3.1: building everything > | -------------------------------------------------------------- > | = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:61: = error: 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: = error: type specifier missing, defaults to 'int'; ISO C99 and later do = not support 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: = warning: a function declaration without a prototype is deprecated in all = versions 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 >=20 > Thanks, >=20 > Ravi (rpokala@) >=20 > =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 = arm64 >=20 >=20 > The branch main has been updated by andrew: >=20 >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e04791b= a5ceaf13 = > >=20 >=20 > commit f7acb7ed41f229a050b2d5e35e04791ba5ceaf13 > Author: Andrew Turner = > > AuthorDate: 2023-03-16 15:35:59 +0000 > Commit: Andrew Turner = > > CommitDate: 2023-03-16 16:45:42 +0000 >=20 >=20 > Allow forcing non-posted memory on arm64 >=20 >=20 > 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. >=20 >=20 > 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. >=20 >=20 > Sponsored by: Arm Ltd > Differential Revision: https://reviews.freebsd.org/D38944 = > --- > sys/arm64/arm64/nexus.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) >=20 >=20 > 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; > }; >=20 >=20 > +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)) >=20 >=20 > 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; >=20 >=20 > if ((err =3D rman_activate_resource(r)) !=3D 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) =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); --Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 That should = now be fixed.

Andrew

On 20 Mar 2023, at 06:22, Ravi Pokala = <rpokala@freebsd.org> wrote:

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: = error: expected identifier
| = SYSCTL_INT(_kern, OID_AUTO, force_nonposted, CTLFLAG_RDTUN, = &force_np, 0,
| =             &n= bsp;           &nbs= p;            =             &n= bsp;          ^| = /usr/home/rpokala/freebsd/src/clean-main/sys/arm64/arm64/nexus.c:87:1: = error: type specifier missing, defaults to 'int'; ISO C99 and later do = not support 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: = warning: a function declaration without a prototype is deprecated in all = versions 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
| 
| make[5]: stopped in = /build/usr/home/rpokala/freebsd/src/clean-main/arm64.aarch64/sys/LINT-FDT<= /span>

Thanks,

Ravi (rpokala@)

=EF=BB=BF-----Original = Message-----
From: <owner-src-committers@freebsd.org <mailto:owner-src-committers@freebsd.org>> on behalf of Andrew Turner = <andrew@FreeBSD.org <mailto:andrew@FreeBSD.org>>
Date: = Thursday, March 16, 2023 at 09:46
To: = <src-committers@FreeBSD.org <mailto:src-committers@FreeBSD.org>>, <dev-commits-src-all@FreeBSD.org<mailto:dev-commits-src-all@FreeBSD.org>>, <dev-commits-src-main@FreeBSD.org <mailto:dev-commits-src-main@FreeBSD.org>>
Subject: git: f7acb7ed41f2 - main - Allow forcing = non-posted memory on arm64


The = branch main has been updated by andrew:


URL: https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e= 04791ba5ceaf13<https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e= 04791ba5ceaf13>


commit = f7acb7ed41f229a050b2d5e35e04791ba5ceaf13
Author: = Andrew Turner <andrew@FreeBSD.org <mailto:andrew@FreeBSD.org>>
AuthorDate: 2023-03-16 15:35:59 +0000
Commit: Andrew Turner <andrew@FreeBSD.org <mailto:andrew@FreeBSD.org>>
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.<dev>.<unit>.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 <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 =3D = rman_activate_resource(r)) !=3D 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) =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);

= --Apple-Mail=_CD2D9A16-7577-40B4-96C5-5BCF6EA8D8EE--