Skip to content

Conversation

zhugengyu
Copy link

@zhugengyu zhugengyu commented Jul 8, 2025

This PR is to fix cpu frequency scaling in some arm64 platform

1): the current acpi_pcc.c do not handle for reg->BitWidth = 32 case,therefore some arm64 platform failed with Data aligment abort when init cppc
2): the current acpi_pcc.c mis-use mask when write new cpu freq into pcc channel

static ACPI_STATUS
pcc_send_command(struct pcc_subspace *ss, ACPI_GENERIC_ADDRESS *reg,
    uint32_t command, int flags, ACPI_INTEGER val)
{
  ...
	if ((flags & PCC_WRITE) != 0) {
		mask = __BITS(reg->BitOffset + reg->BitWidth - 1,
			      reg->BitOffset);
		ACPI_MOVE_64_TO_64(&tmp, data + reg->Address);
		tmp &= mask; // shall be 'tmp &= ~mask;' here
		tmp |= __SHIFTIN(val, mask);
		ACPI_MOVE_64_TO_64(data + reg->Address, &tmp);
	}
}
  • I verify the code in my ARM64 pc with ubench before and after cpu-freq scale
  • My build is
./build.sh -U -u -j12 -O /usr/obj.aarch64 -m evbarm -a aarch64 release
  • My test platform is
arm64# uname -a
NetBSD arm64 10.1_STABLE NetBSD 10.1_STABLE (GENERIC64) #14: Tue Jul  8 06:26:17 CST 2025
  • cpu-freq scale

image

  • scale freq to 2500MHz
    image

  • scale freq to 625MHz
    image

  • before change the code, my ARM64 PC would failed to boot when acpi_cppc is enabled

163bb6486ca06e03fd1f30d1d89a768

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant