From: kernel test robot <lkp@intel.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Breno Leitao <leitao@debian.org>
Subject: [ardb:x86-efi-memattr-kexec-v3 4/5] drivers/firmware/efi/memattr.c:104:8: error: call to undeclared function 'PAGE_ALIGNED'; ISO C99 and later do not support implicit function declarations
Date: Thu, 02 Apr 2026 01:47:53 +0200 [thread overview]
Message-ID: <202604020129.gK0ZFl02-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git x86-efi-memattr-kexec-v3
head: 9dee7ecd271959a84a9d7bd622e017f6eb7ff5b9
commit: 3f66665e01597a2b05c8d87edf66f3227a97c994 [4/5] efi: Use efi_mem_reserve() to reserve the memory attribute table
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260402/202604020129.gK0ZFl02-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260402/202604020129.gK0ZFl02-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604020129.gK0ZFl02-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/firmware/efi/memattr.c:104:8: error: call to undeclared function 'PAGE_ALIGNED'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
104 | (!PAGE_ALIGNED(in->phys_addr) ||
| ^
1 error generated.
vim +/PAGE_ALIGNED +104 drivers/firmware/efi/memattr.c
10f0d2f5770535 Ard Biesheuvel 2016-04-25 83
10f0d2f5770535 Ard Biesheuvel 2016-04-25 84 /*
10f0d2f5770535 Ard Biesheuvel 2016-04-25 85 * Returns a copy @out of the UEFI memory descriptor @in if it is covered
10f0d2f5770535 Ard Biesheuvel 2016-04-25 86 * entirely by a UEFI memory map entry with matching attributes. The virtual
10f0d2f5770535 Ard Biesheuvel 2016-04-25 87 * address of @out is set according to the matching entry that was found.
10f0d2f5770535 Ard Biesheuvel 2016-04-25 88 */
10f0d2f5770535 Ard Biesheuvel 2016-04-25 89 static bool entry_is_valid(const efi_memory_desc_t *in, efi_memory_desc_t *out)
10f0d2f5770535 Ard Biesheuvel 2016-04-25 90 {
10f0d2f5770535 Ard Biesheuvel 2016-04-25 91 u64 in_paddr = in->phys_addr;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 92 u64 in_size = in->num_pages << EFI_PAGE_SHIFT;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 93 efi_memory_desc_t *md;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 94
10f0d2f5770535 Ard Biesheuvel 2016-04-25 95 *out = *in;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 96
10f0d2f5770535 Ard Biesheuvel 2016-04-25 97 if (in->type != EFI_RUNTIME_SERVICES_CODE &&
10f0d2f5770535 Ard Biesheuvel 2016-04-25 98 in->type != EFI_RUNTIME_SERVICES_DATA) {
10f0d2f5770535 Ard Biesheuvel 2016-04-25 99 pr_warn("Entry type should be RuntimeServiceCode/Data\n");
10f0d2f5770535 Ard Biesheuvel 2016-04-25 100 return false;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 101 }
10f0d2f5770535 Ard Biesheuvel 2016-04-25 102
10f0d2f5770535 Ard Biesheuvel 2016-04-25 103 if (PAGE_SIZE > EFI_PAGE_SIZE &&
10f0d2f5770535 Ard Biesheuvel 2016-04-25 @104 (!PAGE_ALIGNED(in->phys_addr) ||
10f0d2f5770535 Ard Biesheuvel 2016-04-25 105 !PAGE_ALIGNED(in->num_pages << EFI_PAGE_SHIFT))) {
10f0d2f5770535 Ard Biesheuvel 2016-04-25 106 /*
10f0d2f5770535 Ard Biesheuvel 2016-04-25 107 * Since arm64 may execute with page sizes of up to 64 KB, the
10f0d2f5770535 Ard Biesheuvel 2016-04-25 108 * UEFI spec mandates that RuntimeServices memory regions must
10f0d2f5770535 Ard Biesheuvel 2016-04-25 109 * be 64 KB aligned. We need to validate this here since we will
10f0d2f5770535 Ard Biesheuvel 2016-04-25 110 * not be able to tighten permissions on such regions without
10f0d2f5770535 Ard Biesheuvel 2016-04-25 111 * affecting adjacent regions.
10f0d2f5770535 Ard Biesheuvel 2016-04-25 112 */
10f0d2f5770535 Ard Biesheuvel 2016-04-25 113 pr_warn("Entry address region misaligned\n");
10f0d2f5770535 Ard Biesheuvel 2016-04-25 114 return false;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 115 }
10f0d2f5770535 Ard Biesheuvel 2016-04-25 116
10f0d2f5770535 Ard Biesheuvel 2016-04-25 117 for_each_efi_memory_desc(md) {
10f0d2f5770535 Ard Biesheuvel 2016-04-25 118 u64 md_paddr = md->phys_addr;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 119 u64 md_size = md->num_pages << EFI_PAGE_SHIFT;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 120
10f0d2f5770535 Ard Biesheuvel 2016-04-25 121 if (!(md->attribute & EFI_MEMORY_RUNTIME))
10f0d2f5770535 Ard Biesheuvel 2016-04-25 122 continue;
5de0fef0230f3c Ard Biesheuvel 2019-02-02 123 if (md->virt_addr == 0 && md->phys_addr != 0) {
10f0d2f5770535 Ard Biesheuvel 2016-04-25 124 /* no virtual mapping has been installed by the stub */
10f0d2f5770535 Ard Biesheuvel 2016-04-25 125 break;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 126 }
10f0d2f5770535 Ard Biesheuvel 2016-04-25 127
10f0d2f5770535 Ard Biesheuvel 2016-04-25 128 if (md_paddr > in_paddr || (in_paddr - md_paddr) >= md_size)
10f0d2f5770535 Ard Biesheuvel 2016-04-25 129 continue;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 130
10f0d2f5770535 Ard Biesheuvel 2016-04-25 131 /*
10f0d2f5770535 Ard Biesheuvel 2016-04-25 132 * This entry covers the start of @in, check whether
10f0d2f5770535 Ard Biesheuvel 2016-04-25 133 * it covers the end as well.
10f0d2f5770535 Ard Biesheuvel 2016-04-25 134 */
10f0d2f5770535 Ard Biesheuvel 2016-04-25 135 if (md_paddr + md_size < in_paddr + in_size) {
10f0d2f5770535 Ard Biesheuvel 2016-04-25 136 pr_warn("Entry covers multiple EFI memory map regions\n");
10f0d2f5770535 Ard Biesheuvel 2016-04-25 137 return false;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 138 }
10f0d2f5770535 Ard Biesheuvel 2016-04-25 139
10f0d2f5770535 Ard Biesheuvel 2016-04-25 140 if (md->type != in->type) {
10f0d2f5770535 Ard Biesheuvel 2016-04-25 141 pr_warn("Entry type deviates from EFI memory map region type\n");
10f0d2f5770535 Ard Biesheuvel 2016-04-25 142 return false;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 143 }
10f0d2f5770535 Ard Biesheuvel 2016-04-25 144
10f0d2f5770535 Ard Biesheuvel 2016-04-25 145 out->virt_addr = in_paddr + (md->virt_addr - md_paddr);
10f0d2f5770535 Ard Biesheuvel 2016-04-25 146
10f0d2f5770535 Ard Biesheuvel 2016-04-25 147 return true;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 148 }
10f0d2f5770535 Ard Biesheuvel 2016-04-25 149
10f0d2f5770535 Ard Biesheuvel 2016-04-25 150 pr_warn("No matching entry found in the EFI memory map\n");
10f0d2f5770535 Ard Biesheuvel 2016-04-25 151 return false;
10f0d2f5770535 Ard Biesheuvel 2016-04-25 152 }
10f0d2f5770535 Ard Biesheuvel 2016-04-25 153
:::::: The code at line 104 was first introduced by commit
:::::: 10f0d2f57705350bbbe5f28e9292ae3905823c3c efi: Implement generic support for the Memory Attributes table
:::::: TO: Ard Biesheuvel <ard.biesheuvel@linaro.org>
:::::: CC: Ingo Molnar <mingo@kernel.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-04-01 23:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202604020129.gK0ZFl02-lkp@intel.com \
--to=lkp@intel.com \
--cc=ardb@kernel.org \
--cc=leitao@debian.org \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox