So I want to have a buffer in my kernel module that I created like that:
static char buf[BUF_LEN];
My problem is that the start address of this buffer is not necessarily page aligned. To give a bit of context: I want to extract the physical address (I currently do so using virt_to_phys, although I have read somewhere that it is not appliccable to variable addresses in kernel modules; is there a better way?). Then I change execution environment with a hypervisor call to execute svsm; the specifics don't really matter here. This new execution environment has the same (emulated) physical address space and the process there will read the physical address of buf. The problem is: it expects it to be page aligned!
Is there a good way to create a page aligned buffer and its physical address within a kernel module?
alloc_pages(0)? Is there a particular reason you need it statically defined in you rmodule?static char buf[BUF_LEN] __aligned(PAGE_SIZE);.