Swiotlb: Add CONFIG_HAS_IOMEM check around memremap() in the swiotlb_mem_remap()
PATCH 1/1 Swiotlb: Add CONFIG_HAS_IOMEM check around memremap() in the swiotlb_mem_remap()
From: Tianyu Lan <[email protected]>
HAS_IOMEM option may not be selected on some platforms(e.g, s390) and this will cause compile error due to miss memremap() implementation. Fix it via adding HAS_IOMEM check around memremap() in the swiotlb.c.
--- kernel/dma/swiotlb.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/dma/swiotlb.c +2 -0
@@ -167,6 +167,7 @@ static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes) {void *vaddr =NULL ; +#ifdef CONFIG_HAS_IOMEM if (swiotlb_unencrypted_base) {phys_addr_t paddr = mem->start + swiotlb_unencrypted_base;
@@ -175,6 +176,7 @@ static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes)pr_err ("Failed to map the unencrypted memory %pa size %lx.\n" , &paddr, bytes); } +#endif return vaddr; }
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 4 lines · Tianyu Lan
From: Tianyu Lan <[email protected]>
HAS_IOMEMoption may not be selected on someplatforms(e.g, s390)and this will cause compile error due to missmemremap()implementation. Fix it via
miss -> missingk
Quoted 4 lines
adding
HAS_IOMEMcheck aroundmemremap()in theswiotlb.c.Reported-by kernel test robot <[email protected]>Signed-off-by Tianyu Lan <[email protected]>
Hi Christoph
Are you happy with this fix?
Thanks,
Wei.
Quoted 27 lines
--- kernel/dma/swiotlb.c | 2 ++ 1 file changed, 2 insertions(+)kernel/dma/swiotlb.c +2
-0@@ -167,6 +167,7 @@ static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes) {void *vaddr =NULL ; +#ifdef CONFIG_HAS_IOMEM if (swiotlb_unencrypted_base) {phys_addr_t paddr = mem->start + swiotlb_unencrypted_base;@@ -175,6 +176,7 @@ static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes)pr_err ("Failed to map the unencrypted memory %pa size %lx.\n" , &paddr, bytes); } +#endif return vaddr; }Signature · 1 line
2.25.1
Quoted 17 lines · Tianyu Lan
From: Tianyu Lan <[email protected]>
HAS_IOMEMoption may not be selected on someplatforms(e.g, s390)and this will cause compile error due to missmemremap()implementation. Fix it via addingHAS_IOMEMcheck aroundmemremap()in theswiotlb.c.Reported-by kernel test robot <[email protected]>Signed-off-by Tianyu Lan <[email protected]>--- kernel/dma/swiotlb.c | 2 ++ 1 file changed, 2 insertions(+)kernel/dma/swiotlb.c +0
-0
kernel/dma/swiotlb.c static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes) · line 170
Quoted 4 lines
kernel/dma/swiotlb.c +1
-0@@ -167,6 +167,7 @@ static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes) {void *vaddr =NULL ; +#ifdef CONFIG_HAS_IOMEM
Please stub out all of swiotlb_mem_remap instead of the ifdef inside the function.
Quoted 21 lines · Christoph Hellwig
Quoted 20 lines · Tianyu Lan
From: Tianyu Lan <[email protected]>
HAS_IOMEMoption may not be selected on someplatforms(e.g, s390)and this will cause compile error due to missmemremap()implementation. Fix it via addingHAS_IOMEMcheck aroundmemremap()in theswiotlb.c.Reported-by kernel test robot <[email protected]>Signed-off-by Tianyu Lan <[email protected]>--- kernel/dma/swiotlb.c | 2 ++ 1 file changed, 2 insertions(+)kernel/dma/swiotlb.c +0
-0@@ -167,6 +167,7 @@ static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes) {void *vaddr =NULL ;
Quoted 4 lines
kernel/dma/swiotlb.c static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes) · line 170
Quoted 1 line
kernel/dma/swiotlb.c +1
-0+#ifdef CONFIG_HAS_IOMEM Please stub out all of
swiotlb_mem_remapinstead of the ifdef inside the function.
Does this look okay to you?
---8<---
kernel/dma/swiotlb.c +7 -0
@@ -163,6 +163,7 @@ static inline unsigned long nr_slots(u64 val)* when swiotlb_unencrypted_base is set. (e.g. for Hyper-V AMD SEV-SNP * Isolation VMs). */ +#ifdef CONFIG_HAS_IOMEM static void *swiotlb_mem_remap (struct io_tlb_mem *mem,unsigned long bytes) {void *vaddr =NULL ;
@@ -178,6 +179,12 @@ static void *swiotlb_mem_remap(struct io_tlb_mem *mem, unsigned long bytes) return vaddr; } +#else +static void *swiotlb_mem_remap (struct io_tlb_mem *mem,unsigned long bytes) +{ +return NULL ; +} +#endif /* * Early SWIOTLB allocation may be too early to allow an architecture to
Quoted 4 lines · Wei Liu
Quoted 2 lines
Please stub out all of
swiotlb_mem_remapinstead of the ifdef inside the function.Does this look okay to you?
Yes, thanks!
Quoted 7 lines · Christoph Hellwig
Quoted 4 lines · Wei Liu
Quoted 2 lines
Please stub out all of
swiotlb_mem_remapinstead of the ifdef inside the function.Does this look okay to you?
Yes, thanks!
Thanks for confirming!
I will turn this into an ack and apply the diff to hyperv-next.
Wei.