From b47e18a6599a08619455e8b602af492589a6fb5b Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 23 Aug 2024 00:10:58 +0000 Subject: [PATCH] Standardize page property. ro.boot.hardware.cpu.pagesize is used on some devices to report the page size. However, we also know what value this should be from the CPU. Rather than create a separate property for this, standardize around this property. This also allows us to test the value of this property on all devices. Bug: 358696947 Test: Vts16KPageSizeTest Change-Id: I7f6260c68e17e7df8a789e9066a7171f3a56f4b0 --- init/property_service.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init/property_service.cpp b/init/property_service.cpp index 0d6eb1533..208d76f94 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -1255,6 +1255,16 @@ void PropertyLoadBootDefaults() { update_sys_usb_config(); } +void PropertyLoadDerivedDefaults() { + const char* PAGE_PROP = "ro.boot.hardware.cpu.pagesize"; + if (GetProperty(PAGE_PROP, "").empty()) { + std::string error; + if (PropertySetNoSocket(PAGE_PROP, std::to_string(getpagesize()), &error) != PROP_SUCCESS) { + LOG(ERROR) << "Could not set '" << PAGE_PROP << "' because: " << error; + } + } +} + bool LoadPropertyInfoFromFile(const std::string& filename, std::vector* property_infos) { auto file_contents = std::string(); @@ -1425,6 +1435,7 @@ void PropertyInit() { ExportKernelBootProps(); PropertyLoadBootDefaults(); + PropertyLoadDerivedDefaults(); } static void HandleInitSocket() {