Kernel 4.7

AmigaOne X1000 platform specific issues related to Linux only.
User avatar
xeno74
Posts: 9348
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 4.7

Post by xeno74 »

Benjamin Herrenschmidt wrote: On Mon, 2016-05-23 at 06:38 +0200, Christian Zigotzky wrote:

>
>
> Hi All,
>
> You removed PAGE_GUARDED in the commit
>
> https://git.kernel.org/cgit/linux/kerne ... 9cdffd44a6
>
> We use
>
> range.size, _PAGE_NO_CACHE|_PAGE_GUARDED);
>
> This doesn't work anymore. What can we use instead?
>
>

You should just use pgprot_noncached()

Cheers,
Ben.
Hi All,

Unfortunately it doesn't compile. It needs an argument. I tried

range.size, pgprot_val(pgprot_noncached(__pgprot(0))));

a few days ago. It compiled but the kernel doesn't boot.

Cheers,

Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9348
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 4.7

Post by xeno74 »

I was able to remove the powerpc-4.7-1 commit with:

Code: Select all

git revert 	c04a5880299eab3da8c10547db96ea9cdffd44a6 -m 1
Output:

Code: Select all

199 files changed, 3405 insertions(+), 7173 deletions(-)
After that I was able to patch it with our Nemo patch 4.7-1.
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9348
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 4.7

Post by xeno74 »

xeno74 wrote:I was able to remove the powerpc-4.7-1 commit with:

Code: Select all

git revert 	c04a5880299eab3da8c10547db96ea9cdffd44a6 -m 1
Output:

Code: Select all

199 files changed, 3405 insertions(+), 7173 deletions(-)
After that I was able to patch it with our Nemo patch 4.7-1.
With the removed powerpc-4.7-1 commit, the kernel boots without any problems.
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9348
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 4.7

Post by xeno74 »

Code: Select all

    +
    +
    +#ifdef CONFIG_PPC_PASEMI_SB600
    +                       /* Workaround for lack of device tree. New for kernel 3.17: range.cpu_addr instead of cpu_addr and range.size instead of size Ch. Zigotzky */
    +                       if (primary) {
    +                               __ioremap_at(range.cpu_addr, (void *)ISA_IO_BASE,
    +                               range.size, _PAGE_NO_CACHE|_PAGE_GUARDED);
    +                       hose->io_base_virt = (void *)_IO_BASE;
    +               /* _IO_BASE needs unsigned long long for the kernel 3.17 Ch. Zigotzky */
    +                       printk("Initialised io_base_virt 0x%lx _IO_BASE 0x%llx\n", (unsigned long)hose->io_base_virt, (unsigned long long)_IO_BASE);
    +                    }
    +#endif
    +
I deleted _PAGE_GUARDED from the patch and I compiled the old alpha3 again. It boots. That means, the kernel doesn't need _PAGE_GUARDED.

New alpha3 code:

Code: Select all

#ifdef CONFIG_PPC_PASEMI_SB600
                       /* Workaround for lack of device tree. New for kernel 3.17: range.cpu_addr instead of cpu_addr and range.size instead of size Ch. Zigotzky */
                       if (primary) {
                               __ioremap_at(range.cpu_addr, (void *)ISA_IO_BASE,
                               range.size, _PAGE_NO_CACHE);
                       hose->io_base_virt = (void *)_IO_BASE;
		       /* _IO_BASE needs unsigned long long for the kernel 3.17 Ch. Zigotzky */
                       printk("Initialised io_base_virt 0x%lx _IO_BASE 0x%llx\n", (unsigned long)hose->io_base_virt, (unsigned long long)_IO_BASE);
                    }
#endif
I deleted _PAGE_GUARDED in the alpha4 with the powerpc-4.7-1 commit as well but it doesn't boot. That means something is wrong with _PAGE_NO_CACHE. In the new source code it still exists but it's not the same. Our focus is therefore on _PAGE_NO_CACHE.
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9348
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 4.7

Post by xeno74 »

I've found this new code in the powerpc-4.7-1 commit which is very similar to our SB600 code:

Code: Select all

diff --git a/arch/powerpc/kernel/isa-bridge.c b/arch/powerpc/kernel/isa-bridge.c
index 0f19970..ae13161 100644
--- a/arch/powerpc/kernel/isa-bridge.c
+++ b/arch/powerpc/kernel/isa-bridge.c
@@ -109,14 +109,14 @@ static void pci_process_ISA_OF_ranges(struct device_node *isa_node,
 		size = 0x10000;
 
 	__ioremap_at(phb_io_base_phys, (void *)ISA_IO_BASE,
-		     size, _PAGE_NO_CACHE|_PAGE_GUARDED);
+		     size, pgprot_val(pgprot_noncached(__pgprot(0))));
 	return;
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9348
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 4.7

Post by xeno74 »

I tried

Code: Select all

range.size, pgprot_val(pgprot_noncached_wc(__pgprot(0))));
but without success.
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9348
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 4.7

Post by xeno74 »

FYI:
Benjamin Herrenschmidt wrote: On 24 May 2016 at 1:16 PM, Benjamin Herrenschmidt wrote:
> On Tue, 2016-05-24 at 12:48 +0200, Christian Zigotzky wrote:
>> Ben,
>>
>> Thanks for the hint. I'm sorry I don't know how pgprot_noncached()
>> works.
>>
>> I tried:
>>
>> 1) range.size, pgprot_noncached()
>>
>> 2) range.size, pgprot_val(pgprot_noncached(__pgprot(0))));
> Hrm... The above is what is used elsewhere, I'm not sure what's wrong.
>
> Aneesh, any idea ?
>
> Michael, does it work on our PA-Semi board ? (DO we have that
> southbridge on it ?)
>
> Actually, can you try pgprot_noncached(PAGE_KERNEL) ? If that works,
> then I wonder what that's going on in pci_64.c ...
>
> Cheers,
> Ben.
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9348
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 4.7

Post by xeno74 »

FYI:

I wasn't able to compile the kernel with:

Code: Select all

pgprot_noncached(PAGE_KERNEL)
Aneesh Kumar K.V wrote: 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
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9348
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 4.7

Post by xeno74 »

I tried

Code: Select all

/* Workaround for lack of device tree */
                       if (primary) {
                               __ioremap_at(range.cpu_addr, (void *)ISA_IO_BASE,
                               range.size, HPTE_R_C | HPTE_R_M);
                       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 the kernel doesn't boot.
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9348
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 4.7

Post by xeno74 »

FYI:
Aneesh Kumar K.V wrote: Use helper instead of opencoding with constants. Later patch will
drop the WIMG bits and use PowerISA 3.0 defines
[08/14] powerpc/mm: Use helper for finding pte bits mapping I/O area -- Patchwork Linux PPC development
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
Post Reply