mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
Merge tag 'drm-misc-next-fixes-2026-06-11' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next
drm-misc-next-fixes for v7.2: - Fix agp_amd64_probe error propagation. - Require carveout when PASID is not enabled amdxdna. - Clear variable to prevent second unbind in amdxdna. - Add separate Kconfig option for DMABUF_HEAPS_SYSTEM_CC_SHARED. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patch.msgid.link/c7a9dbb0-a5c8-4e67-904e-1a52b3de9bb4@linux.intel.com
This commit is contained in:
@@ -87,6 +87,7 @@ static int amdxdna_sva_init(struct amdxdna_client *client)
|
||||
client->pasid = iommu_sva_get_pasid(client->sva);
|
||||
if (client->pasid == IOMMU_PASID_INVALID) {
|
||||
iommu_sva_unbind_device(client->sva);
|
||||
client->sva = NULL;
|
||||
XDNA_ERR(xdna, "SVA get pasid failed");
|
||||
return -ENODEV;
|
||||
}
|
||||
@@ -120,8 +121,14 @@ static int amdxdna_drm_open(struct drm_device *ddev, struct drm_file *filp)
|
||||
|
||||
if (!amdxdna_iova_on(xdna)) {
|
||||
/* No need to fail open since user may use pa + carveout later. */
|
||||
if (amdxdna_sva_init(client))
|
||||
if (amdxdna_sva_init(client)) {
|
||||
XDNA_WARN(xdna, "PASID not available for pid %d", client->pid);
|
||||
if (!amdxdna_use_carveout(xdna)) {
|
||||
XDNA_ERR(xdna, "PASID unavailable and carveout not configured");
|
||||
kfree(client);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
mmgrab(client->mm);
|
||||
init_srcu_struct(&client->hwctx_srcu);
|
||||
|
||||
@@ -546,7 +546,7 @@ static int agp_amd64_probe(struct pci_dev *pdev,
|
||||
/* Fill in the mode register */
|
||||
pci_read_config_dword(pdev, bridge->capndx+PCI_AGP_STATUS, &bridge->mode);
|
||||
|
||||
if (cache_nbs(pdev, cap_ptr) == -1) {
|
||||
if (cache_nbs(pdev, cap_ptr) < 0) {
|
||||
agp_put_bridge(bridge);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,14 @@ config DMABUF_HEAPS_SYSTEM
|
||||
Choose this option to enable the system dmabuf heap. The system heap
|
||||
is backed by pages from the buddy allocator. If in doubt, say Y.
|
||||
|
||||
config DMABUF_HEAPS_SYSTEM_CC_SHARED
|
||||
bool "DMA-BUF System Heap for decrypted CoCo VMs"
|
||||
depends on DMABUF_HEAPS && ARCH_HAS_MEM_ENCRYPT && DMABUF_HEAPS_SYSTEM=y
|
||||
help
|
||||
Choose this option to enable the system_cc_shared dmabuf heap. This
|
||||
allows allocating shared (decrypted) memory for confidential computing
|
||||
(CoCo) VMs.
|
||||
|
||||
config DMABUF_HEAPS_CMA
|
||||
tristate "DMA-BUF CMA Heap"
|
||||
depends on DMABUF_HEAPS && DMA_CMA
|
||||
|
||||
@@ -48,6 +48,9 @@ struct dma_heap_attachment {
|
||||
bool cc_shared;
|
||||
};
|
||||
|
||||
#define cc_shared_buffer(b) (IS_ENABLED(CONFIG_DMABUF_HEAPS_SYSTEM_CC_SHARED) && \
|
||||
(b)->cc_shared)
|
||||
|
||||
#define LOW_ORDER_GFP (GFP_HIGHUSER | __GFP_ZERO)
|
||||
#define HIGH_ORDER_GFP (((GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN \
|
||||
| __GFP_NORETRY) & ~__GFP_RECLAIM) \
|
||||
@@ -161,7 +164,7 @@ static struct sg_table *system_heap_map_dma_buf(struct dma_buf_attachment *attac
|
||||
unsigned long attrs;
|
||||
int ret;
|
||||
|
||||
attrs = a->cc_shared ? DMA_ATTR_CC_SHARED : 0;
|
||||
attrs = cc_shared_buffer(a) ? DMA_ATTR_CC_SHARED : 0;
|
||||
ret = dma_map_sgtable(attachment->dev, table, direction, attrs);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
@@ -233,7 +236,7 @@ static int system_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
|
||||
int i, ret;
|
||||
|
||||
prot = vma->vm_page_prot;
|
||||
if (buffer->cc_shared)
|
||||
if (cc_shared_buffer(buffer))
|
||||
prot = pgprot_decrypted(prot);
|
||||
|
||||
for_each_sgtable_sg(table, sg, i) {
|
||||
@@ -282,7 +285,7 @@ static void *system_heap_do_vmap(struct system_heap_buffer *buffer)
|
||||
}
|
||||
|
||||
prot = PAGE_KERNEL;
|
||||
if (buffer->cc_shared)
|
||||
if (cc_shared_buffer(buffer))
|
||||
prot = pgprot_decrypted(prot);
|
||||
vaddr = vmap(pages, npages, VM_MAP, prot);
|
||||
vfree(pages);
|
||||
@@ -349,7 +352,7 @@ static void system_heap_dma_buf_release(struct dma_buf *dmabuf)
|
||||
* Intentionally leak pages that cannot be re-encrypted
|
||||
* to prevent shared memory from being reused.
|
||||
*/
|
||||
if (buffer->cc_shared &&
|
||||
if (cc_shared_buffer(buffer) &&
|
||||
system_heap_set_page_encrypted(page))
|
||||
continue;
|
||||
|
||||
@@ -456,7 +459,7 @@ static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
|
||||
list_del(&page->lru);
|
||||
}
|
||||
|
||||
if (cc_shared) {
|
||||
if (cc_shared_buffer(buffer)) {
|
||||
for_each_sgtable_sg(table, sg, i) {
|
||||
ret = system_heap_set_page_decrypted(sg_page(sg));
|
||||
if (ret)
|
||||
@@ -485,7 +488,7 @@ static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
|
||||
* Intentionally leak pages that cannot be re-encrypted
|
||||
* to prevent shared memory from being reused.
|
||||
*/
|
||||
if (buffer->cc_shared &&
|
||||
if (cc_shared_buffer(buffer) &&
|
||||
system_heap_set_page_encrypted(p))
|
||||
continue;
|
||||
__free_pages(p, compound_order(p));
|
||||
@@ -525,6 +528,7 @@ static int __init system_heap_create(void)
|
||||
return PTR_ERR(sys_heap);
|
||||
|
||||
if (IS_ENABLED(CONFIG_HIGHMEM) ||
|
||||
!IS_ENABLED(CONFIG_DMABUF_HEAPS_SYSTEM_CC_SHARED) ||
|
||||
!cc_platform_has(CC_ATTR_MEM_ENCRYPT))
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user