From 660d86e5f058d613eedcb833317b49ea63079525 Mon Sep 17 00:00:00 2001
From: Joerg Roedel <jroedel@suse.de>
Date: Tue, 12 Feb 2019 10:18:46 +0100
Subject: [PATCH] kABI: Preserve kABI for dma_max_mapping_size()
Patch-mainline: Never (kABI fixup)
References: bsc#1120008
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
arch/x86/kernel/pci-swiotlb.c | 1 -
include/linux/dma-mapping.h | 7 +++----
2 files changed, 3 insertions(+), 5 deletions(-)
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -60,7 +60,6 @@ static const struct dma_map_ops swiotlb_
.map_page = swiotlb_map_page,
.unmap_page = swiotlb_unmap_page,
.dma_supported = NULL,
- .max_mapping_size = swiotlb_max_mapping_size,
};
/*
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -11,6 +11,7 @@
#include <linux/kmemcheck.h>
#include <linux/bug.h>
#include <linux/mem_encrypt.h>
+#include <linux/swiotlb.h>
/**
* List of possible attributes associated with a DMA mapping. The semantics
@@ -129,7 +130,6 @@ struct dma_map_ops {
int (*mapping_error)(struct device *dev, dma_addr_t dma_addr);
int (*dma_supported)(struct device *dev, u64 mask);
int (*set_dma_mask)(struct device *dev, u64 mask);
- size_t (*max_mapping_size)(struct device *dev);
#ifdef ARCH_HAS_DMA_GET_REQUIRED_MASK
u64 (*get_required_mask)(struct device *dev);
#endif
@@ -604,11 +604,10 @@ static inline u64 dma_get_mask(struct de
static inline size_t dma_max_mapping_size(struct device *dev)
{
- const struct dma_map_ops *ops = get_dma_ops(dev);
size_t size = SIZE_MAX;
- if (ops->max_mapping_size)
- size = ops->max_mapping_size(dev);
+ if (is_swiotlb_active())
+ size = swiotlb_max_mapping_size(dev);
return size;
}
--- a/arch/x86/mm/mem_encrypt.c
+++ b/arch/x86/mm/mem_encrypt.c
@@ -424,7 +424,6 @@ static const struct dma_map_ops sev_dma_
.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
.sync_sg_for_device = swiotlb_sync_sg_for_device,
.mapping_error = swiotlb_dma_mapping_error,
- .max_mapping_size = swiotlb_max_mapping_size,
};
/* Architecture __weak replacement functions */