diff mbox

[05/31] mips/kvm: Use generic cache flushing functions.

Message ID 1370646215-6543-6-git-send-email-ddaney.cavm@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Daney June 7, 2013, 11:03 p.m. UTC
From: David Daney <david.daney@cavium.com>

We don't know if we have the r4k specific functions available, so use
universally available __flush_cache_all() instead.  This takes longer
as it flushes both i-cache and d-cache, but is available for all CPUs.

Signed-off-by: David Daney <david.daney@cavium.com>
---
 arch/mips/kvm/kvm_mips_emul.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Ralf Baechle June 14, 2013, 1:17 p.m. UTC | #1
On Fri, Jun 07, 2013 at 04:03:09PM -0700, David Daney wrote:

> From: David Daney <david.daney@cavium.com>
> 
> We don't know if we have the r4k specific functions available, so use
> universally available __flush_cache_all() instead.  This takes longer
> as it flushes both i-cache and d-cache, but is available for all CPUs.
> 
> Signed-off-by: David Daney <david.daney@cavium.com>
> ---
>  arch/mips/kvm/kvm_mips_emul.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c
> index af9a661..a2c6687 100644
> --- a/arch/mips/kvm/kvm_mips_emul.c
> +++ b/arch/mips/kvm/kvm_mips_emul.c
> @@ -916,8 +916,6 @@ kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, uint32_t cause,
>  		       struct kvm_run *run, struct kvm_vcpu *vcpu)
>  {
>  	struct mips_coproc *cop0 = vcpu->arch.cop0;
> -	extern void (*r4k_blast_dcache) (void);
> -	extern void (*r4k_blast_icache) (void);
>  	enum emulation_result er = EMULATE_DONE;
>  	int32_t offset, cache, op_inst, op, base;
>  	struct kvm_vcpu_arch *arch = &vcpu->arch;
> @@ -954,9 +952,9 @@ kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, uint32_t cause,
>  		     arch->gprs[base], offset);
>  
>  		if (cache == MIPS_CACHE_DCACHE)
> -			r4k_blast_dcache();

Only nukes the D-cache.

> +			__flush_cache_all();

This is also going to blow away the I-cache, so will be slower.

>  		else if (cache == MIPS_CACHE_ICACHE)
> -			r4k_blast_icache();

Only nukes the I-cache.

> +			__flush_cache_all();

This is also going to blow away the D-cache, so will be slower.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c
index af9a661..a2c6687 100644
--- a/arch/mips/kvm/kvm_mips_emul.c
+++ b/arch/mips/kvm/kvm_mips_emul.c
@@ -916,8 +916,6 @@  kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, uint32_t cause,
 		       struct kvm_run *run, struct kvm_vcpu *vcpu)
 {
 	struct mips_coproc *cop0 = vcpu->arch.cop0;
-	extern void (*r4k_blast_dcache) (void);
-	extern void (*r4k_blast_icache) (void);
 	enum emulation_result er = EMULATE_DONE;
 	int32_t offset, cache, op_inst, op, base;
 	struct kvm_vcpu_arch *arch = &vcpu->arch;
@@ -954,9 +952,9 @@  kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, uint32_t cause,
 		     arch->gprs[base], offset);
 
 		if (cache == MIPS_CACHE_DCACHE)
-			r4k_blast_dcache();
+			__flush_cache_all();
 		else if (cache == MIPS_CACHE_ICACHE)
-			r4k_blast_icache();
+			__flush_cache_all();
 		else {
 			printk("%s: unsupported CACHE INDEX operation\n",
 			       __func__);