Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 25078dc1 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Michael Ellerman
Browse files

powerpc: use mm zones more sensibly



Powerpc has somewhat odd usage where ZONE_DMA is used for all memory on
common 64-bit configfs, and ZONE_DMA32 is used for 31-bit schemes.

Move to a scheme closer to what other architectures use (and I dare to
say the intent of the system):

 - ZONE_DMA: optionally for memory < 31-bit (64-bit embedded only)
 - ZONE_NORMAL: everything addressable by the kernel
 - ZONE_HIGHMEM: memory > 32-bit for 32-bit kernels

Also provide information on how ZONE_DMA is used by defining
ARCH_ZONE_DMA_BITS.

Contains various fixes from Benjamin Herrenschmidt.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent f3e5a857
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -375,9 +375,9 @@ config PPC_ADV_DEBUG_DAC_RANGE
	depends on PPC_ADV_DEBUG_REGS && 44x
	default y

config ZONE_DMA32
config ZONE_DMA
	bool
	default y if PPC64
	default y if PPC_BOOK3E_64

config PGTABLE_LEVELS
	int
@@ -870,10 +870,6 @@ config ISA
	  have an IBM RS/6000 or pSeries machine, say Y.  If you have an
	  embedded board, consult your board documentation.

config ZONE_DMA
	bool
	default y

config GENERIC_ISA_DMA
	bool
	depends on ISA_DMA_API
+2 −0
Original line number Diff line number Diff line
@@ -340,4 +340,6 @@ struct vm_area_struct;
#endif /* __ASSEMBLY__ */
#include <asm/slice.h>

#define ARCH_ZONE_DMA_BITS 31

#endif /* _ASM_POWERPC_PAGE_H */
+0 −1
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ extern unsigned long empty_zero_page[];

extern pgd_t swapper_pg_dir[];

void limit_zone_pfn(enum zone_type zone, unsigned long max_pfn);
int dma_pfn_limit_to_zone(u64 pfn_limit);
extern void paging_init(void);

+1 −5
Original line number Diff line number Diff line
@@ -108,12 +108,8 @@ int __init swiotlb_setup_bus_notifier(void)

void __init swiotlb_detect_4g(void)
{
	if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
	if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
		ppc_swiotlb_enable = 1;
#ifdef CONFIG_ZONE_DMA32
		limit_zone_pfn(ZONE_DMA32, (1ULL << 32) >> PAGE_SHIFT);
#endif
	}
}

static int __init check_swiotlb_enabled(void)
+3 −5
Original line number Diff line number Diff line
@@ -50,7 +50,8 @@ static int dma_nommu_dma_supported(struct device *dev, u64 mask)
		return 1;

#ifdef CONFIG_FSL_SOC
	/* Freescale gets another chance via ZONE_DMA/ZONE_DMA32, however
	/*
	 * Freescale gets another chance via ZONE_DMA, however
	 * that will have to be refined if/when they support iommus
	 */
	return 1;
@@ -88,13 +89,10 @@ void *__dma_nommu_alloc_coherent(struct device *dev, size_t size,
	}

	switch (zone) {
#ifdef CONFIG_ZONE_DMA
	case ZONE_DMA:
		flag |= GFP_DMA;
		break;
#ifdef CONFIG_ZONE_DMA32
	case ZONE_DMA32:
		flag |= GFP_DMA32;
		break;
#endif
	};
#endif /* CONFIG_FSL_SOC */
Loading