mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
dma-mapping fixes for Linux 7.3
A few fixes for the DMA-mapping code:
- resolved regression in accessing encrypted memory by IOMMU-backed
devices (Aneesh Kumar K.V),
- improved failure handling and removed rare bug in swiotlb/highmem
(Donggeun Yoo).
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQSrngzkoBtlA8uaaJ+Jp1EFxbsSRAUCaquwMwAKCRCJp1EFxbsS
RMT6AP0elpdaZXNY0KwUBTwU95H604J+donqriepHABIBhIDEQD9GWZqNf/m1gEI
tR5lHQ3+NGs0Q7Vd2ed1vSe82HQSsgU=
=QxUC
-----END PGP SIGNATURE-----
Merge tag 'dma-mapping-7.3-2026-09-17' of git://git.kernel.org/pub/scm/linux/kernel/git/mszyprowski/linux
Pull dma-mapping fixes from Marek Szyprowski:
"A few fixes for the DMA-mapping code:
- resolved regression in accessing encrypted memory by IOMMU-backed
devices (Aneesh Kumar K.V)
- improved failure handling and removed rare bug in swiotlb/highmem
(Donggeun Yoo)"
* tag 'dma-mapping-7.3-2026-09-17' of git://git.kernel.org/pub/scm/linux/kernel/git/mszyprowski/linux:
x86/mm: Don't force unencrypted DMA for IOMMU-backed devices
dma-mapping: don't trace the DMA address when the allocation fails
swiotlb: use the adjusted address for the highmem page lookup
dma-coherent: report a failed reserved memory assignment
This commit is contained in:
commit
4aec9ad1c6
|
|
@ -13,6 +13,7 @@
|
|||
#include <linux/cc_platform.h>
|
||||
#include <linux/mem_encrypt.h>
|
||||
#include <linux/virtio_anchor.h>
|
||||
#include <linux/iommu-dma.h>
|
||||
|
||||
#include <asm/sev.h>
|
||||
|
||||
|
|
@ -30,7 +31,7 @@ bool force_dma_unencrypted(struct device *dev)
|
|||
* device does not support DMA to addresses that include the
|
||||
* encryption mask.
|
||||
*/
|
||||
if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
|
||||
if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) && !use_dma_iommu(dev)) {
|
||||
u64 dma_enc_mask = DMA_BIT_MASK(__ffs64(sme_me_mask));
|
||||
u64 dma_dev_mask = min_not_zero(dev->coherent_dma_mask,
|
||||
dev->bus_dma_limit);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ DECLARE_EVENT_CLASS(dma_alloc_class,
|
|||
TP_fast_assign(
|
||||
__assign_str(device);
|
||||
__entry->virt_addr = virt_addr;
|
||||
__entry->dma_addr = dma_addr;
|
||||
__entry->dma_addr = virt_addr ? dma_addr : 0;
|
||||
__entry->size = size;
|
||||
__entry->flags = flags;
|
||||
__entry->dir = dir;
|
||||
|
|
|
|||
|
|
@ -352,8 +352,7 @@ static int rmem_dma_device_init(struct reserved_mem *rmem, struct device *dev)
|
|||
min_not_zero(dev->coherent_dma_mask, dev->bus_dma_limit))
|
||||
dev_warn(dev, "reserved memory is beyond device's set DMA address range\n");
|
||||
|
||||
dma_assign_coherent_memory(dev, mem);
|
||||
return 0;
|
||||
return dma_assign_coherent_memory(dev, mem);
|
||||
}
|
||||
|
||||
static void rmem_dma_device_release(struct reserved_mem *rmem,
|
||||
|
|
|
|||
|
|
@ -1019,7 +1019,6 @@ static void swiotlb_bounce(struct device *dev, phys_addr_t tlb_addr, size_t size
|
|||
int index = (tlb_addr - mem->start) >> IO_TLB_SHIFT;
|
||||
phys_addr_t orig_addr = mem->slots[index].orig_addr;
|
||||
size_t alloc_size = mem->slots[index].alloc_size;
|
||||
unsigned long pfn = PFN_DOWN(orig_addr);
|
||||
unsigned char *vaddr = mem->vaddr + tlb_addr - mem->start;
|
||||
int tlb_offset;
|
||||
|
||||
|
|
@ -1052,7 +1051,8 @@ static void swiotlb_bounce(struct device *dev, phys_addr_t tlb_addr, size_t size
|
|||
size = alloc_size;
|
||||
}
|
||||
|
||||
if (PageHighMem(pfn_to_page(pfn))) {
|
||||
if (PhysHighMem(orig_addr)) {
|
||||
unsigned long pfn = PFN_DOWN(orig_addr);
|
||||
unsigned int offset = orig_addr & ~PAGE_MASK;
|
||||
struct page *page;
|
||||
unsigned int sz = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user