Page MenuHomeFreeBSD

powerpc: Remove flag CTLFLAG_TUN from sysctl knob hw.platform
ClosedPublic

Authored by zlei on Feb 8 2025, 8:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 12, 8:57 AM
Unknown Object (File)
Sun, Mar 9, 9:03 AM
Unknown Object (File)
Wed, Mar 5, 3:06 PM
Unknown Object (File)
Tue, Mar 4, 3:32 PM
Unknown Object (File)
Tue, Feb 25, 1:22 PM
Unknown Object (File)
Fri, Feb 21, 1:02 PM
Unknown Object (File)
Fri, Feb 21, 12:34 PM
Unknown Object (File)
Tue, Feb 18, 3:11 PM
Subscribers

Details

Summary

Prior to change [1] this flag is useless but harmless. After the change
plat_name[] will be fetched from kernel environment after invoking the
platform probe function platform_probe_and_attach(). The probe function
runs at early boot stage prior to mi_startup() thus it is too late and
pointless to set plat_name[].

Nathan mentioned that the logic to specify the platform pre-dates the
powerpc64 work, and is from the original pre-FDT Book-E bringup from
like 2008. So it's irrelevant these days. Let's clean it up now.

[1] 3da1cf1e88f8 Extend the meaning of the CTLFLAG_TUN flag to ...

MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

zlei requested review of this revision.Feb 8 2025, 8:37 AM
sys/powerpc/powerpc/platform.c
369

Any real usage to requested the platform via loader tunable ?

Seems fine to me, but I'm not a PowerPC specialist.

This revision is now accepted and ready to land.Feb 8 2025, 10:26 AM
jhibbits added inline comments.
sys/powerpc/powerpc/platform.c
369

I highly doubt it. It might be more useful on, say, the Book-E side, where qemu may not pass a 'correct' device tree, but other than that I don't see a need for this anymore. My guess is it was added while Nathan was working on the powerpc64 bringup, so he could coerce things. It's very likely unused by this point.

I think it actually pre-dates the powerpc64 work, and is from the original pre-FDT Book-E bringup from like 2008. It's for sure irrelevant these days.

sys/powerpc/powerpc/platform.c
348

I think it actually pre-dates the powerpc64 work, and is from the original pre-FDT Book-E bringup from like 2008. It's for sure irrelevant these days.

Then this is actually not needed now, right ? And the following logic

		/*
		 * Check if this module was specifically requested through
		 * the loader tunable we provide.
		 */
		if (strcmp(platp->name,plat_name) == 0) {
			plat_def_impl = platp;
			break;
		}

becomes dead ( well actually has been dead for quite a long time ).

I see ps3 is fetching from kenv,

sys/powerpc/ps3/ps3_syscons.c:	TUNABLE_STR_FETCH("hw.platform", compatible, sizeof(compatible));

to determin the VT driver ( as a fallback IIUC ). If that is field for debugging / developing, I'd suggest to remove the CTLFLAG_TUN from the sysctl knob hw.platfrom , so we do not attempt user to hack it. Well the dead code can also be removed, but I'll let it up to you @nwhitehorn to decide.

@jhibbits @nwhitehorn How do you think ?

I think removing everything is fine. The PS3 code is from the very misty past where the PS3 didn't have FDTs (as all of of this is), but that circumstance has been gone for a decade. The set of people who use FreeBSD on PS3 is probably at most one or two at this point, also.

zlei retitled this revision from powerpc: Fix setting hw.platform tunable to powerpc: Remove flag CTLFLAG_TUN from sysctl knob hw.platform.
zlei edited the summary of this revision. (Show Details)
zlei edited the test plan for this revision. (Show Details)

Removed sysctl flag CTLFLAG_TUN. Removed now irrelevant code.

This revision now requires review to proceed.Feb 11 2025, 7:02 AM
zlei marked an inline comment as done.Feb 11 2025, 7:03 AM
This revision is now accepted and ready to land.Feb 12 2025, 8:10 PM