v8 2026-09-24

共享粒度主机共享内存分配器 · v8

新增 CoCo 共享内存分配器 alloc_cc_shared_pages,按共享粒度对齐连续页并转共享状态,转换后再清零。

原始补丁链接

子 Patch(14)

1/14
mm: Add an allocator for CoCo shared memory
新增 alloc_cc_shared_pages()/free_cc_shared_pages():按共享粒度取整对齐连续页,经 cc_make_shared() 转换整段;释放前恢复私有,失败保留页避免共享页归还 buddy。
2/14
mm: Zero memory during shared memory transitions
把清零设为 set_memory_decrypted() 隐含语义,由架构在转换安全点执行:pKVM 前清、Arm CCA 后清、x86 prepare 回调清;移除冗余 memset,无加密平台仍保留 __GFP_ZERO。
3/14
irqchip/gic-v3-its: Resolve the default NUMA node explicitly
为切到 CoCo 共享内存分配器,its_alloc_pages() 先把 NUMA_NO_NODE 显式解析为 numa_mem_id(),因新分配器会将其解释为遵循任务内存策略,保持原就近节点。
4/14
irqchip/gic-v3-its: Allocate shared tables using CoCo shared memory allocator
ITS 命令队列/表改走 alloc_cc_shared_pages_node(),不再假设 PAGE_SIZE 够共享粒度;释放时按原 order 与 granule 重建元数据,恢复私有并正确释放 buddy。
5/14
dma-contiguous: Derive shared alignment from DMA attributes
DMA-contiguous 入口改收 allocation attrs,按 __DMA_ATTR_ALLOC_CC_SHARED 推导共享 granule 强制对齐;普通分配保持 clamping,granule 超 CONFIG_CMA_ALIGNMENT 则拒绝以回退页分配器。
6/14
dma-pool: Allocate CoCo atomic pools using CoCo shared memory allocator
CoCo atomic DMA pool 底层申请按共享 granule 取整,禁止 fallback 低于该 order,并用 __DMA_ATTR_ALLOC_CC_SHARED 让 CMA 强制对齐;cc_make_shared()/private() 转换整段。
7/14
dma-direct: Align CoCo shared DMA allocations to the shared granule size
dma-direct 的 CoCo 共享分配按 granule 取整并传属性强制 CMA 对齐;释放前重算布局,使恢复私有与 dma_free_contiguous() 覆盖原范围;失败则泄漏页面避免共享页回分配器。
8/14
swiotlb: Align shared IO TLB pools to the shared granule size
Align and size the early memblock pool to the common CoCo shared granule. Use the same rounded extent when the pool is transitioned and when it is released. This deliberately leaves the slot count unc
9/14
swiotlb: Reject misaligned restricted DMA pools for CoCo guests
A restricted DMA pool is a firmware-described ownership boundary. Unlike a pool allocated by SWIOTLB itself, its base cannot be moved and its size cannot be rounded without claiming memory outside the
10/14
dma-buf: system_heap: Limit scatterlist entries to the buffer size
The system heap currently allocates each backing page no larger than the remaining dma-buf length. It can therefore use the complete compound-page size for every scatterlist entry while keeping the to
11/14
dma-buf: system_heap: Allocate shared buffers using CoCo shared memory allocator
The system_cc_shared heap currently allocates its backing pages using the normal system-heap order policy and changes each resulting compound page to shared state. That is unsafe when an architecture
12/14
swiotlb: Make rounded shared pool capacity allocatable
CoCo shared memory may need to be allocated and transitioned in units larger than the requested object. Before this change, users handled the resulting capacity as follows: User
13/14
mm: Assert CoCo shared allocations may sleep
On platforms with memory encryption, alloc_cc_shared_pages_node() transitions the allocated memory to the shared state. set_memory_decrypted() may sleep, so the transition must run from a sleepable co
14/14
irqchip/gic-v3-its: Preallocate VPE L1 tables
VPE L1 tables are allocated from the CPU-starting callback, where sleeping is not allowed. Remove the page allocation from this atomic path. Use a blocking allocation for the boot CPU and record the