History log of /freebsd/sys/kern/subr_physmem.c (Results 1 – 21 of 21)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 6a7a01ec 04-Feb-2025 Andrew Turner <andrew@FreeBSD.org>

physmem: Move the ram0 device earlier in the boot

If the ram driver is unable to reserve a memory range it will panic
with no real information why. Move this driver earlier in the boot so
any device

physmem: Move the ram0 device earlier in the boot

If the ram driver is unable to reserve a memory range it will panic
with no real information why. Move this driver earlier in the boot so
any devices that cause the conflict will fail to attach.

This should make it easier to debug why the conflict exists.

Reviewed by: mhorne, kevans, imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D48766

show more ...


Revision tags: release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0
# f45213c7 20-Jun-2024 Mark Johnston <markj@FreeBSD.org>

physmem: Correct a comment

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.


# 191e6a60 05-Jun-2024 Mitchell Horne <mhorne@FreeBSD.org>

physmem: zero entire array

As a convenience to callers, who might allocate the array on the stack.
An empty/zero-valued range indicates the end of the physmap entries.

Remove the now-redundant call

physmem: zero entire array

As a convenience to callers, who might allocate the array on the stack.
An empty/zero-valued range indicates the end of the physmap entries.

Remove the now-redundant calls to bzero() at the call site.

Reviewed by: andrew
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45318

show more ...


Revision tags: release/14.1.0, release/13.3.0
# add99c9c 14-Feb-2024 John Baldwin <jhb@FreeBSD.org>

physmem ram: Don't reserve excluded regions

These regions can conflict with I/O resources and prevent allocation
of those regions by other drivers. It may make sense to reserve them
after the boot-

physmem ram: Don't reserve excluded regions

These regions can conflict with I/O resources and prevent allocation
of those regions by other drivers. It may make sense to reserve them
after the boot-time probe of devices has concluded (or after an
initial pass to reserve firmware-assigned resources before "wildcard"
resources are allocated), but that would require additional changes.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43893

show more ...


Revision tags: release/14.0.0
# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

show more ...


Revision tags: release/13.2.0
# cc0fe048 10-Mar-2023 Kyle Evans <kevans@FreeBSD.org>

kern: physmem: don't create a new exregion for different flags...

... if the region we're adding is an exact match to one that we already
have. Simply extend the flags of the existing entry as need

kern: physmem: don't create a new exregion for different flags...

... if the region we're adding is an exact match to one that we already
have. Simply extend the flags of the existing entry as needed so that
we don't end up with duplicate regions.

It could be that we got the exclusion through two different means, e.g.,
FDT memreserve and the EFI memory map, and we may derive different
characteristics from each. Apply the most restrictive set to the
region.

Reported by: Mark Millard <marklmi yahoo com>
Reviewed by: mhorne

show more ...


# c32946d8 21-Feb-2023 Kyle Evans <kevans@FreeBSD.org>

kern: physmem: fix the format string again, i is a size_t

Fixes the riscv LINT build.

Fixes: 7b5cb32fca26 ("kern: physmem: properly cast %jx [...]")


# 7b5cb32f 20-Feb-2023 Kyle Evans <kevans@FreeBSD.org>

kern: physmem: properly cast %jx arguments to uintmax_t

While we're here, slap prfunc with a __printflike to get compiler
checking on args to catch silly mistakes like this.

Reported by: jrtc27


# cd73914b 20-Feb-2023 Kyle Evans <kevans@FreeBSD.org>

kern: physmem: don't truncate addresses in DEBUG output

Make it consistent with the above region printing, otherwise it appears
to be somewhat confusing.


Revision tags: release/12.4.0, release/13.1.0, release/12.3.0
# e6cf1a08 27-May-2021 Mitchell Horne <mhorne@FreeBSD.org>

physmem: add ram0 pseudo-driver

Its purpose is to reserve all I/O space belonging to physical memory
from nexus, preventing it from being handed out by bus_alloc_resource()
to callers such as xenpv_

physmem: add ram0 pseudo-driver

Its purpose is to reserve all I/O space belonging to physical memory
from nexus, preventing it from being handed out by bus_alloc_resource()
to callers such as xenpv_alloc_physmem(), which looks for the first
available free range it can get. This mimics the existing pseudo-driver
on x86.

If needed, the device can be disabled with hint.ram.0.disabled="1" in
/boot/device.hints.

Reviewed by: imp
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D32343

show more ...


# deb1e3b7 06-Oct-2022 Warner Losh <imp@FreeBSD.org>

physmem: Add physmem_excluded to query if a region is excluded

In order to safely reuse excluded memory when it's reserved for special
purpose, we need to test whether or not the memory has been res

physmem: Add physmem_excluded to query if a region is excluded

In order to safely reuse excluded memory when it's reserved for special
purpose, we need to test whether or not the memory has been reserved
early in boot. physmem_excluded will return true when the entire range
is excluded, false otherwise.

Sponsored by: Netflix

show more ...


# c84c5e00 18-Jul-2022 Mitchell Horne <mhorne@FreeBSD.org>

ddb: annotate some commands with DB_CMD_MEMSAFE

This is not completely exhaustive, but covers a large majority of
commands in the tree.

Reviewed by: markj
Sponsored by: Juniper Networks, Inc.
Spons

ddb: annotate some commands with DB_CMD_MEMSAFE

This is not completely exhaustive, but covers a large majority of
commands in the tree.

Reviewed by: markj
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35583

show more ...


# 41e6d209 07-Apr-2022 Andrew Turner <andrew@FreeBSD.org>

Enable subr_physmem_test on supported architectures

Only build where it's supported.

While here add support for amd64 to help with testing.

Sponsored by: The FreeBSD Foundation


# d8bff5b6 28-Mar-2022 Andrew Turner <andrew@FreeBSD.org>

Handle non-page aligned/sized memory in physmem

In some configurations the firmware may pass memory regions that are
not page sized or aligned, e.g. when using 16k pages on arm64. If this
is the cas

Handle non-page aligned/sized memory in physmem

In some configurations the firmware may pass memory regions that are
not page sized or aligned, e.g. when using 16k pages on arm64. If this
is the case we will calculate many small regions because the alignment
is applied before being inserted. As we round the start up and end down
this will leave a 1 page hole between what should have been a single
region.

Fix by keeping the original alignment until we are just about to insert
the region into the avail array.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34694

show more ...


# 8c99dfed 28-Mar-2022 Andrew Turner <andrew@FreeBSD.org>

Port subr_physmem to userspace and add tests

These give us some confidience we haven't broken anything in early
boot code that may be running before the console.

Reviewed by: emaste
Sponsored by: T

Port subr_physmem to userspace and add tests

These give us some confidience we haven't broken anything in early
boot code that may be running before the console.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34691

show more ...


# f461b955 28-Mar-2022 Andrew Turner <andrew@FreeBSD.org>

Fix a sign mismatch warning in the physmem code

Make sure both sides of a comparison are unsigned. As the values being
compared are size_t make the the value in the for loop size_t too.

Sponsored b

Fix a sign mismatch warning in the physmem code

Make sure both sides of a comparison are unsigned. As the values being
compared are size_t make the the value in the for loop size_t too.

Sponsored by: The FreeBSD Foundation

show more ...


# 7771f2a0 28-Oct-2021 Kyle Evans <kevans@FreeBSD.org>

kern: physmem: improve region coalescing logic

The existing logic didn't take into account newly inserted mappings
wholly contained by an existing region (or vice versa), nor did it
account for weir

kern: physmem: improve region coalescing logic

The existing logic didn't take into account newly inserted mappings
wholly contained by an existing region (or vice versa), nor did it
account for weird overlap scenarios. The latter is probably unlikely
to happen, but the former may happen in UEFI: BootServicesData allocated
within a large chunk of ConventionalMemory. This situation blows up vm
initialization.

While we're here, remove the "exact match" logic as it's likely wrong;
if an exact match exists with conflicting flags, for instance, then we
should probably be doing something else. The new logic takes into
account exact matches as part of the overlapping efforts.

Reviewed by: kib, mhorne (both earlier version)
Differential Revision: https://reviews.freebsd.org/D32701

show more ...


Revision tags: release/13.0.0
# 18ce865a 03-Dec-2020 Oleksandr Tymoshenko <gonzo@FreeBSD.org>

Add support for hw.physmem tunable for ARM/ARM64/RISC-V platforms

hw.physmem tunable allows to limit number of physical memory available to the
system. It's handled in machdep files for x86 and Powe

Add support for hw.physmem tunable for ARM/ARM64/RISC-V platforms

hw.physmem tunable allows to limit number of physical memory available to the
system. It's handled in machdep files for x86 and PowerPC. This patch adds
required logic to the consolidated physmem management interface that is used by
ARM, ARM64, and RISC-V.

Submitted by: Klara, Inc.
Reviewed by: mhorne
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D27152

show more ...


Revision tags: release/12.2.0
# 6f3b523c 15-Oct-2020 Konstantin Belousov <kib@FreeBSD.org>

Avoid dump_avail[] redefinition.

Move dump_avail[] extern declaration and inlines into a new header
vm/vm_dumpset.h. This fixes default gcc build for mips.

Reviewed by: alc, scottph
Tested by: kev

Avoid dump_avail[] redefinition.

Move dump_avail[] extern declaration and inlines into a new header
vm/vm_dumpset.h. This fixes default gcc build for mips.

Reviewed by: alc, scottph
Tested by: kevans (previous version)
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D26741

show more ...


Revision tags: release/11.4.0
# 49439183 19-Apr-2020 Mitchell Horne <mhorne@FreeBSD.org>

Convert arm's physmem interface to MI code

The arm_physmem interface found in arm's MD code provides a convenient
set of routines for adding/excluding physical memory regions and
initializing import

Convert arm's physmem interface to MI code

The arm_physmem interface found in arm's MD code provides a convenient
set of routines for adding/excluding physical memory regions and
initializing important kernel globals such as Maxmem, realmem,
phys_avail[], and dump_avail[]. It is especially convenient for FDT
systems, since we can use FDT parsing functions and pass the result
directly to one of these physmem routines. This interface is already in
use on arm and arm64, and can be used to simplify this early
initialization on RISC-V as well.

This requires only a couple trivial changes:
- Move arm_physmem_kernel_addr to arm/machdep.c. It is unused on arm64,
and manipulated entirely in arm MD code.
- Convert arm32_btop/arm64_btop to atop. This is equivalently defined
on all architectures.
- Drop the "arm" prefix.

Reviewed by: manu, emaste ("looks reasonable")
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24153

show more ...