qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC 3/5] softmmu: add a tlb_vaddr_to_host_fill f


From: Aurelien Jarno
Subject: Re: [Qemu-devel] [PATCH RFC 3/5] softmmu: add a tlb_vaddr_to_host_fill function
Date: Wed, 3 Jun 2015 17:11:13 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On 2015-06-02 13:54, Richard Henderson wrote:
> On 06/02/2015 04:26 AM, Aurelien Jarno wrote:
> >      int index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
> > -    CPUTLBEntry *tlbentry = &env->tlb_table[mmu_idx][index];
> > +    CPUTLBEntry *tlbentry;
> >      target_ulong tlb_addr;
> >      uintptr_t haddr;
> >  
> > +again:
> > +    tlbentry = &env->tlb_table[mmu_idx][index];
> > +
> >      switch (access_type) {
> > -    case 0:
> > +    case MMU_DATA_LOAD:
> >          tlb_addr = tlbentry->addr_read;
> >          break;
> > -    case 1:
> > +    case MMU_DATA_STORE:
> >          tlb_addr = tlbentry->addr_write;
> >          break;
> > -    case 2:
> > +    case MMU_INST_FETCH:
> >          tlb_addr = tlbentry->addr_code;
> >          break;
> >      default:
> > @@ -347,10 +350,14 @@ static inline void *tlb_vaddr_to_host(CPUArchState 
> > *env, target_ulong addr,
> >      if ((addr & TARGET_PAGE_MASK)
> >          != (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
> >          /* TLB entry is for a different page */
> > +        if (fill) {
> > +            tlb_fill(ENV_GET_CPU(env), addr, access_type, mmu_idx, 
> > retaddr);
> > +            goto again;
> > +        }
> >          return NULL;
> >      }
> 
> To properly perform a fill, you also ought to check the victim cache.
> There's a macro to do that in softmmu_template.h, which is why I
> placed probe_write there.  It's not so convenient to use with a
> variable type though.
> 

Unfortunately that means we can't cleanly provide a probe_write function
doing nothing for the user-mode case. That would allow to avoid to many
#ifdef in the helper code. For me the softmmu_template.h is supposed to
only contain the code called by the helpers or by the glue in
cpu_ldst*.h

That also means the current tlb_vaddr_to_host code doesn't look in the
victim cache and that there is no easy way to fix that, though that's
less problematic.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
address@hidden                 http://www.aurel32.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]