Path: blob/master/arch/mn10300/mm/cache-smp-flush.c
10817 views
/* Functions for global dcache flush when writeback caching in SMP1*2* Copyright (C) 2010 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public Licence7* as published by the Free Software Foundation; either version8* 2 of the Licence, or (at your option) any later version.9*/10#include <linux/mm.h>11#include <asm/cacheflush.h>12#include "cache-smp.h"1314/**15* mn10300_dcache_flush - Globally flush data cache16*17* Flush the data cache on all CPUs.18*/19void mn10300_dcache_flush(void)20{21unsigned long flags;2223flags = smp_lock_cache();24mn10300_local_dcache_flush();25smp_cache_call(SMP_DCACHE_FLUSH, 0, 0);26smp_unlock_cache(flags);27}2829/**30* mn10300_dcache_flush_page - Globally flush a page of data cache31* @start: The address of the page of memory to be flushed.32*33* Flush a range of addresses in the data cache on all CPUs covering34* the page that includes the given address.35*/36void mn10300_dcache_flush_page(unsigned long start)37{38unsigned long flags;3940start &= ~(PAGE_SIZE-1);4142flags = smp_lock_cache();43mn10300_local_dcache_flush_page(start);44smp_cache_call(SMP_DCACHE_FLUSH_RANGE, start, start + PAGE_SIZE);45smp_unlock_cache(flags);46}4748/**49* mn10300_dcache_flush_range - Globally flush range of data cache50* @start: The start address of the region to be flushed.51* @end: The end address of the region to be flushed.52*53* Flush a range of addresses in the data cache on all CPUs, between start and54* end-1 inclusive.55*/56void mn10300_dcache_flush_range(unsigned long start, unsigned long end)57{58unsigned long flags;5960flags = smp_lock_cache();61mn10300_local_dcache_flush_range(start, end);62smp_cache_call(SMP_DCACHE_FLUSH_RANGE, start, end);63smp_unlock_cache(flags);64}6566/**67* mn10300_dcache_flush_range2 - Globally flush range of data cache68* @start: The start address of the region to be flushed.69* @size: The size of the region to be flushed.70*71* Flush a range of addresses in the data cache on all CPUs, between start and72* start+size-1 inclusive.73*/74void mn10300_dcache_flush_range2(unsigned long start, unsigned long size)75{76unsigned long flags;7778flags = smp_lock_cache();79mn10300_local_dcache_flush_range2(start, size);80smp_cache_call(SMP_DCACHE_FLUSH_RANGE, start, start + size);81smp_unlock_cache(flags);82}8384/**85* mn10300_dcache_flush_inv - Globally flush and invalidate data cache86*87* Flush and invalidate the data cache on all CPUs.88*/89void mn10300_dcache_flush_inv(void)90{91unsigned long flags;9293flags = smp_lock_cache();94mn10300_local_dcache_flush_inv();95smp_cache_call(SMP_DCACHE_FLUSH_INV, 0, 0);96smp_unlock_cache(flags);97}9899/**100* mn10300_dcache_flush_inv_page - Globally flush and invalidate a page of data101* cache102* @start: The address of the page of memory to be flushed and invalidated.103*104* Flush and invalidate a range of addresses in the data cache on all CPUs105* covering the page that includes the given address.106*/107void mn10300_dcache_flush_inv_page(unsigned long start)108{109unsigned long flags;110111start &= ~(PAGE_SIZE-1);112113flags = smp_lock_cache();114mn10300_local_dcache_flush_inv_page(start);115smp_cache_call(SMP_DCACHE_FLUSH_INV_RANGE, start, start + PAGE_SIZE);116smp_unlock_cache(flags);117}118119/**120* mn10300_dcache_flush_inv_range - Globally flush and invalidate range of data121* cache122* @start: The start address of the region to be flushed and invalidated.123* @end: The end address of the region to be flushed and invalidated.124*125* Flush and invalidate a range of addresses in the data cache on all CPUs,126* between start and end-1 inclusive.127*/128void mn10300_dcache_flush_inv_range(unsigned long start, unsigned long end)129{130unsigned long flags;131132flags = smp_lock_cache();133mn10300_local_dcache_flush_inv_range(start, end);134smp_cache_call(SMP_DCACHE_FLUSH_INV_RANGE, start, end);135smp_unlock_cache(flags);136}137138/**139* mn10300_dcache_flush_inv_range2 - Globally flush and invalidate range of data140* cache141* @start: The start address of the region to be flushed and invalidated.142* @size: The size of the region to be flushed and invalidated.143*144* Flush and invalidate a range of addresses in the data cache on all CPUs,145* between start and start+size-1 inclusive.146*/147void mn10300_dcache_flush_inv_range2(unsigned long start, unsigned long size)148{149unsigned long flags;150151flags = smp_lock_cache();152mn10300_local_dcache_flush_inv_range2(start, size);153smp_cache_call(SMP_DCACHE_FLUSH_INV_RANGE, start, start + size);154smp_unlock_cache(flags);155}156157158