ITADN
NetBSD/src/Issues

Fix arm64 32bit pcc for cpu-freq scaling

#55Pull Requestzhugengyu 创建于 2025-07-08
Z
zhugengyucommented
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 ```c 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](https://github.com/user-attachments/assets/c12d0e69-178d-46c8-8e41-bf20a92403ed) - scale freq to 2500MHz ![image](https://github.com/user-attachments/assets/c041d3db-b114-4881-b464-699aceb91b28) - scale freq to 625MHz ![image](https://github.com/user-attachments/assets/543b190b-07ea-42e8-b79a-efcadec71c93)
合并状态:未合并 0 条评论