Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Mar 2023 23:22:08 -0700
From:      Ravi Pokala <rpokala@freebsd.org>
To:        Andrew Turner <andrew@FreeBSD.org>, <src-committers@FreeBSD.org>, <dev-commits-src-all@FreeBSD.org>, <dev-commits-src-main@FreeBSD.org>
Subject:   Re: f7acb7ed41f2 - main - Allow forcing non-posted memory on arm64
Message-ID:  <511B5170-6DE9-4056-8AEC-43A2D60BE533@panasas.com>
In-Reply-To: <202303161646.32GGkArS022254@gitrepo.freebsd.org>
References:  <202303161646.32GGkArS022254@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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: <owner-src-committers@freebsd.org <mailto:owner-src-committers@freebs=
d.org>> on behalf of Andrew Turner <andrew@FreeBSD.org <mailto:andrew@FreeBS=
D.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 arm6=
4


The branch main has been updated by andrew:


URL: https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e35e0479=
1ba5ceaf13 <https://cgit.FreeBSD.org/src/commit/?id=3Df7acb7ed41f229a050b2d5e3=
5e04791ba5ceaf13>


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 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);







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?511B5170-6DE9-4056-8AEC-43A2D60BE533>