PAGE_GUARDED

Aneesh Kumar K.V aneesh.kumar at linux.vnet.ibm.com
Wed May 25 01:37:10 AEST 2016


Christian Zigotzky <chzigotzky at xenosoft.de> writes:

> Ben,
>
> I tried:
>
> /* Workaround for lack of device tree */
>                         if (primary) {
>                                 __ioremap_at(range.cpu_addr, (void 
> *)ISA_IO_BASE,
>                                 range.size, pgprot_noncached(PAGE_KERNEL));
>                         hose->io_base_virt = (void *)_IO_BASE;
>                         printk("Initialised io_base_virt 0x%lx _IO_BASE 
> 0x%llx\n", (unsigned long)hose->io_base_virt, (unsigned long long)_IO_BASE);
>                      }
>
> Unfortunately I got some error messages:
>
> arch/powerpc/kernel/pci-common.c: In function 
> ‘pci_process_bridge_OF_ranges’:
> arch/powerpc/kernel/pci-common.c:731:32: error: incompatible type for 
> argument 4 of ‘__ioremap_at’
>                                  __ioremap_at(range.cpu_addr, (void 
> *)ISA_IO_BASE,
>                                  ^
> In file included from include/linux/io.h:25:0,
>                   from include/linux/pci.h:31,
>                   from arch/powerpc/kernel/pci-common.c:20:
> ./arch/powerpc/include/asm/io.h:746:23: note: expected ‘long unsigned 
> int’ but argument is of type ‘pgprot_t’
>   extern void __iomem * __ioremap_at(phys_addr_t pa, void *ea,
>

You can look at commit 72176dd0ad36c ("powerpc/mm: Use a helper for
finding pte bits mapping I/O area") to find similar conversion we did.

For ex:
 	__ioremap_at(phb_io_base_phys, (void *)ISA_IO_BASE,
		     size, _PAGE_NO_CACHE|_PAGE_GUARDED);

gets replaced by

 	__ioremap_at(phb_io_base_phys, (void *)ISA_IO_BASE,
		     size, pgprot_val(pgprot_noncached(__pgprot(0))));

Now that gets mapped to the below hpte bits

pte bit -> _PAGE_NON_IDEMPOTENT

Which get converted in htab_convert_pte_flags(unsigned long pteflags)
to

	if ((pteflags & _PAGE_CACHE_CTL ) == _PAGE_NON_IDEMPOTENT)
		rflags |= (HPTE_R_I | HPTE_R_G);

BTW we default add (HPTE_R_C | HPTE_R_M ).

Hence the final pte WIMG bits will be MIG. I guess that is what you
wanted ?


If that doesn't work, can you point me the current code so that I can
look at it and suggest correct alternative.

-aneesh



More information about the Linuxppc-dev mailing list