Re: [PATCH v2 16/40] arm64: mm: Pin down ASIDs for sharing mm with devices

2018-05-17 Thread Jean-Philippe Brucker
On 15/05/18 15:16, Catalin Marinas wrote: > Hi Jean-Philippe, > > On Fri, May 11, 2018 at 08:06:17PM +0100, Jean-Philippe Brucker wrote: >> +unsigned long mm_context_get(struct mm_struct *mm) >> +{ >> +unsigned long flags; >> +u64 asid; >> + >> +raw_spin_lock_irqsave(&cpu_asid_lock, fl

Re: [PATCH v2 16/40] arm64: mm: Pin down ASIDs for sharing mm with devices

2018-05-15 Thread Catalin Marinas
Hi Jean-Philippe, On Fri, May 11, 2018 at 08:06:17PM +0100, Jean-Philippe Brucker wrote: > +unsigned long mm_context_get(struct mm_struct *mm) > +{ > + unsigned long flags; > + u64 asid; > + > + raw_spin_lock_irqsave(&cpu_asid_lock, flags); > + > + asid = atomic64_read(&mm->context

[PATCH v2 16/40] arm64: mm: Pin down ASIDs for sharing mm with devices

2018-05-11 Thread Jean-Philippe Brucker
To enable address space sharing with the IOMMU, introduce mm_context_get() and mm_context_put(), that pin down a context and ensure that it will keep its ASID after a rollover. Pinning is necessary because a device constantly needs a valid ASID, unlike tasks that only require one when running. Wit