Re: [PATCH v4 14/36] m68k: Implement the new page table range API

From: Geert Uytterhoeven
Date: Thu Mar 16 2023 - 12:32:53 EST


On Wed, Mar 15, 2023 at 8:43 AM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
> On Wed, Mar 15, 2023 at 6:14 AM Matthew Wilcox (Oracle)
> <willy@xxxxxxxxxxxxx> wrote:
> > Add PFN_PTE_SHIFT, update_mmu_cache_range(), flush_icache_pages() and
> > flush_dcache_folio().
> >
> > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
>
> Thanks for your patch!
>
> > --- a/arch/m68k/include/asm/cacheflush_mm.h
> > +++ b/arch/m68k/include/asm/cacheflush_mm.h
> > @@ -220,24 +220,29 @@ static inline void flush_cache_page(struct vm_area_struct *vma, unsigned long vm
> >
> > /* Push the page at kernel virtual address and clear the icache */
> > /* RZ: use cpush %bc instead of cpush %dc, cinv %ic */
> > -static inline void __flush_page_to_ram(void *vaddr)
> > +static inline void __flush_pages_to_ram(void *vaddr, unsigned int nr)
> > {
> > if (CPU_IS_COLDFIRE) {
> > unsigned long addr, start, end;
> > addr = ((unsigned long) vaddr) & ~(PAGE_SIZE - 1);
> > start = addr & ICACHE_SET_MASK;
> > - end = (addr + PAGE_SIZE - 1) & ICACHE_SET_MASK;
> > + end = (addr + nr * PAGE_SIZE - 1) & ICACHE_SET_MASK;
> > if (start > end) {
> > flush_cf_bcache(0, end);
> > end = ICACHE_MAX_ADDR;
> > }
> > flush_cf_bcache(start, end);
> > } else if (CPU_IS_040_OR_060) {
> > - __asm__ __volatile__("nop\n\t"
> > - ".chip 68040\n\t"
> > - "cpushp %%bc,(%0)\n\t"
> > - ".chip 68k"
> > - : : "a" (__pa(vaddr)));
> > + unsigned long paddr = __pa(vaddr);
> > +
> > + do {
> > + __asm__ __volatile__("nop\n\t"
> > + ".chip 68040\n\t"
> > + "cpushp %%bc,(%0)\n\t"
> > + ".chip 68k"
> > + : : "a" (paddr));
> > + paddr += PAGE_SIZE;
> > + } while (--nr);
>
> Please use "while (nr--) { ... }", to protect against anyone ever
> calling this with nr == 0.
>
> The rest LGTM, I'll give it a try shortly...

Still working fine on ARAnyM, so
Tested-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds