Kernel 5.4

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

Re: Kernel 5.4

Post by xeno74 »

FYI
After DMA is complete, and the device and CPU caches are synchronized,
it's still required to mark the CPU pages as dirty, if the data was
coming from the device. However, this driver was just issuing a
bare put_page() call, without any set_page_dirty*() call.

Fix the problem, by calling set_page_dirty_lock() if the CPU pages
were potentially receiving data from the device.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>

Code: Select all

drivers/media/v4l2-core/videobuf-dma-sg.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c
index 66a6c6c236a7..28262190c3ab 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -349,8 +349,11 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma)
   BUG_ON(dma->sglen);

   if (dma->pages) {
-        for (i = 0; i < dma->nr_pages; i++)
+        for (i = 0; i < dma->nr_pages; i++) {
+            if (dma->direction == DMA_FROM_DEVICE)
+                set_page_dirty_lock(dma->pages[i]);
           put_page(dma->pages[i]);
+        }
       kfree(dma->pages);
       dma->pages = NULL;
   }
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

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

Re: Kernel 5.4

Post by xeno74 »

FYI
Christoph Hellwig wrote: Thanks. It looks like on your platform the swiotlb buffer isn't
actually addressable based on the bus dma mask limit, which is rather
interesting. swiotlb_init uses memblock_alloc_low to allocate the
buffer, and I'll need some help from Mike and the powerpc maintainers
to figure out how that select where to allocate the buffer from, and
how we can move it to a lower address. My gut feeling would be to try
to do what arm64 does and define a new ARCH_LOW_ADDRESS_LIMIT, preferably
without needing too much arch specific magic.

As a quick hack can you try this patch on top of the tree from Friday?

Code: Select all

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index f491690d54c6..e3f95c362922 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -344,7 +344,7 @@ static inline int memblock_get_region_node(const struct memblock_region *r)
 #define MEMBLOCK_LOW_LIMIT 0
 
 #ifndef ARCH_LOW_ADDRESS_LIMIT
-#define ARCH_LOW_ADDRESS_LIMIT  0xffffffffUL
+#define ARCH_LOW_ADDRESS_LIMIT  0x0fffffffUL
 #endif
 
 phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align,
Mike Rapoport wrote: Presuming the problem is relevant for all CoreNet boards something like
this could work:

Code: Select all

diff --git a/arch/powerpc/include/asm/dma.h b/arch/powerpc/include/asm/dma.h
index 1b4f0254868f..7c6cfeeaff52 100644
--- a/arch/powerpc/include/asm/dma.h
+++ b/arch/powerpc/include/asm/dma.h
@@ -347,5 +347,11 @@ extern int isa_dma_bridge_buggy;
 #define isa_dma_bridge_buggy	(0)
 #endif
 
+#ifdef CONFIG_CORENET_GENERIC
+extern phys_addr_t ppc_dma_phys_limit;
+#define ARCH_LOW_ADDRESS_LIMIT	(ppc_dma_phys_limit - 1)
+#endif
+
+
 #endif /* __KERNEL__ */
 #endif	/* _ASM_POWERPC_DMA_H */
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index fe0606439b5a..346b436b6d3f 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -126,3 +126,7 @@ void __init mpc85xx_qe_par_io_init(void)
 	}
 }
 #endif
+
+#ifdef CONFIG_CORENET_GENERIC
+phys_addr_t ppc_dma_phys_limit = 0xffffffffUL;
+#endif
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index 7ee2c6628f64..673bcbdc7c75 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -64,7 +64,7 @@ void __init corenet_gen_setup_arch(void)
 	mpc85xx_smp_init();
 
 	swiotlb_detect_4g();
-
+	ppc_dma_phys_limit = 0x0fffffffUL;
 	pr_info("%s board\n", ppc_md.name);
 
 	mpc85xx_qe_init();
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

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

Re: Kernel 5.4

Post by xeno74 »

Hi All,

The final kernel 5.4 has been released.

New:
Download: linux-image-5.4-X1000_X5000.tar.gz

Please note: There are problems with some PCI cards if you have more than 3.5G RAM in your X5000. If you have this problem please reduce the RAM with the boot argument "mem=3500M". The X1000 isn't affected. We created a bug report a month ago. Link to the bug report: Bug 205201 - Booting halts if Dawicontrol DC-2976 UW SCSI board installed, unless RAM size limited to 3500M

Image

Please test the kernels.

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

Running Linux on AmigaONEs can require some tinkering.
User avatar
Skateman
Posts: 863
Joined: Thu Aug 10, 2017 8:36 pm
Location: The Netherlands

Re: Kernel 5.4

Post by Skateman »

Final kernel 5.4 running fine on the AmigaOne X5000

Image

Big picture http://www.skateman.nl/wp-content/uploa ... 165805.png
AmigaOne X5000 -> 2GHz / 16GB RAM / Radeon RX 570 / Radeon X1950 / M-Audio 5.1 -> AmigaOS / Linux
Amiga 1200 -> Recapped / 68ec020 ACA 1221ec / CF HDD / RetroNET connected to the world
Vampire 4SA - RPi4 Running AmiKitXE Full
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.4

Post by xeno74 »

Skateman wrote:Final kernel 5.4 running fine on the AmigaOne X5000
You're fast! :o Thanks a lot for testing! :)
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
mechanic
Posts: 510
Joined: Sat Jun 25, 2011 9:22 pm

Re: Kernel 5.4

Post by mechanic »

Today I built the 5.4 kernel on my POWER9 workstation, Debian 10.2, using your config file. I do not know what is different but glxgears is showing a little better than 1000 frames/5 seconds for the same kernel. It is on a 4650 RV730 card.

The best advantage is how fast the build happens. Don't even get a chance to nap before it's done. :)


root@Fienix:/home/fienix# vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
9679 frames in 5.0 seconds = 1935.776 FPS
8295 frames in 5.0 seconds = 1658.931 FPS
8302 frames in 5.0 seconds = 1660.068 FPS
8290 frames in 5.0 seconds = 1657.962 FPS
8301 frames in 5.0 seconds = 1660.031 FPS
A-Eon A1X1000 ATI HD6850, Creative SB1570 PCIe, RTL8139 net PCI.
Roland
Posts: 825
Joined: Tue May 02, 2017 7:23 am

Re: Kernel 5.4

Post by Roland »

xeno74 wrote: Another kernel for testing.

Download: linux-image-5.4-rc9-X5000.tar.gz
Finally back to my X5000...! I tested now that rc9, and also the 5.4 final, but the DMA problem (booting halts after loading kernel) is still present with Dawicontrol SCSI board :-(.

BTW, could we get uInitrd also for 5.4...?
- Roland -
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.4

Post by xeno74 »

Roland,

Please also test the RC8.

New:

X5000/20 and X5000/40: Selected 0 (32 bit addressing for all chips) for CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE because of the issue with the Dawicontrol DC 2976 UW SCSI PCI board

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

Running Linux on AmigaONEs can require some tinkering.
Roland
Posts: 825
Joined: Tue May 02, 2017 7:23 am

Re: Kernel 5.4

Post by Roland »

xeno74 wrote:Roland,

Please also test the RC8.

New:

X5000/20 and X5000/40: Selected 0 (32 bit addressing for all chips) for CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE because of the issue with the Dawicontrol DC 2976 UW SCSI PCI board

Thanks,
Christian
Tested... Unfortunately the problem is present also with RC8.
- Roland -
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.4

Post by xeno74 »

Roland wrote:
Tested... Unfortunately the problem is present also with RC8.
@All
Great news! The problem is solved! Further information: Kernel 5.5 thread
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
Post Reply