Re: [RFC V1 5/5] x86: CVMs: Ensure that memory conversions happen at 2M alignment
From: Dave Hansen
Date: Wed Jan 31 2024 - 11:33:32 EST
On 1/11/24 21:52, Vishal Annapurve wrote:
> @@ -2133,8 +2133,10 @@ static int __set_memory_enc_pgtable(unsigned long addr, int numpages, bool enc)
> int ret;
>
> /* Should not be working on unaligned addresses */
> - if (WARN_ONCE(addr & ~PAGE_MASK, "misaligned address: %#lx\n", addr))
> - addr &= PAGE_MASK;
> + if (WARN_ONCE(addr & ~HPAGE_MASK, "misaligned address: %#lx\n", addr)
> + || WARN_ONCE((numpages << PAGE_SHIFT) & ~HPAGE_MASK,
> + "misaligned numpages: %#lx\n", numpages))
> + return -EINVAL;
This series is talking about swiotlb and DMA, then this applies a
restriction to what I *thought* was a much more generic function:
__set_memory_enc_pgtable(). What prevents this function from getting
used on 4k mappings?