Re: semantics of dma_map_single()

2017-07-17 Thread Vineet Gupta

Hi Christoph,

On 07/16/2017 11:42 PM, Christoph Hellwig wrote:

I would expect that it would support any contiguous range in
the kernel mapping (e.g. no vmalloc and friends).  But it's not
documented anywhere, and if no in kernel users makes use of that
fact at the moment it might be better to document a page size
limitation and add asserts to enforce it.


My first thought was indeed to add a BUG_ON for @size > PAGE_SIZE (also accounting 
for offset etc), but I have a feeling this will cause too many breakages. So 
perhaps it would be better to add the fact to Documentation that it can handle any 
physically contiguous range.


-Vineet

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: semantics of dma_map_single()

2017-07-17 Thread James Bottomley
On Mon, 2017-07-17 at 09:06 -0700, Vineet Gupta wrote:
> Hi Christoph,
> 
> On 07/16/2017 11:42 PM, Christoph Hellwig wrote:
> > 
> > I would expect that it would support any contiguous range in
> > the kernel mapping (e.g. no vmalloc and friends).  But it's not
> > documented anywhere, and if no in kernel users makes use of that
> > fact at the moment it might be better to document a page size
> > limitation and add asserts to enforce it.
> 
> My first thought was indeed to add a BUG_ON for @size > PAGE_SIZE
> (also accounting for offset etc), but I have a feeling this will
> cause too many breakages. So perhaps it would be better to add the
> fact to Documentation that it can handle any physically contiguous
> range.

Actually, that's not historically right.  dma_map_single() was
originally designed to be called on any region that was kmalloc'd
meaning it was capable of mapping physically contiguous > PAGE_SIZE
regions.

For years (decades?) we've been eliminating the specialised
dma_map_single() calls in favour of dma_map_sg, so it's possible there
may not be any large region consumers anymore, so it *may* be safe to
enforce a PAGE_SIZE limit, but not without auditing the remaining
callers.

James


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH 3/3 v8] ARC: hsdk: initial port for HSDK board

2017-07-17 Thread Rob Herring
On Wed, Jul 12, 2017 at 12:40:23PM +0300, Eugeniy Paltsev wrote:
> From: Alexey Brodkin 
> 
> This initial port adds support of ARC HS Development Kit board with some
> basic features such serial port, USB, SD/MMC and Ethernet.
> 
> Essentially we run Linux kernel on all 4 cores (i.e. utilize SMP) and
> heavily use IO Coherency for speeding-up DMA-aware peripherals.
> 
> Note as opposed to other ARC boards we link Linux kernel to
> 0x9000_ intentionally because cores 1 and 3 configured with DCCM
> situated at our more usual link base 0x8000_. We still can use
> memory region starting at 0x8000_ as we reallocate DCCM in our
> platform code.
> 
> Note that PAE remapping for DMA clients does not work due to an RTL bug,
> so CREG_PAE register must be programmed to all zeroes, otherwise it will
> cause problems with DMA to/from peripherals even if PAE40 is not used.
> 
> Signed-off-by: Alexey Brodkin 
> Signed-off-by: Eugeniy Paltsev 
> ---
> Changes v7 -> v8:
>  * DTS: move cpu_intc, idu_intc, arcpct, timer, gfrc nodes to root
>level and out of the cpus node.
>  * DTS: add vendor-specific compatible for ohci and ehci nodes.
>  * DTS: style fixes

Acked-by: Rob Herring 

> + ohci@6 {
> + compatible = "snps,hsdk-v1.0-ohci", "generic-ohci";
> + reg = <0x6 0x100>;
> + interrupts = <15>;
> + };
> +
> + ehci@4 {
> + compatible = "snps,hsdk-v1.0-ehci", "generic-ehci";
> + reg = <0x4 0x100>;
> + interrupts = <15>;
> + };

Of course, now these compatibles need to be documented. You can do that 
in a separate follow-up patch.

Rob

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC PATCH 1/5] serial: arc: Remove __init marking from early write

2017-07-17 Thread Jeffy Chen
The earlycon would be alive outside the init code in these cases:
1/ we have keep_bootcon in cmdline.
2/ we don't have a real console to switch to.

So remove the __init marking to avoid invalid memory access.

Signed-off-by: Jeffy Chen 
---

 drivers/tty/serial/arc_uart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 5ac06fc..77fe306 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -549,8 +549,8 @@ static struct console arc_console = {
.data   = &arc_uart_driver
 };
 
-static __init void arc_early_serial_write(struct console *con, const char *s,
- unsigned int n)
+static void arc_early_serial_write(struct console *con, const char *s,
+  unsigned int n)
 {
struct earlycon_device *dev = con->data;
 
-- 
2.1.4



___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC PATCH 0/5] earlycon hang under some conditions

2017-07-17 Thread Jeffy Chen
I was testing earlycon with 8250 dw serial console. And it hangs in
these cases:
1/ kernel hang when calling early write function after free_initmem:
a) the earlycon not disabled after the init code(due to keep_bootcon or
   not specify a real console to switch to)
b) the early write func is marked as __init, for example 8250_early.

2/ kernel hang when calling early write function after disable unused
clks/pm domain:
a) the earlycon not disabled after the init code
b) the disable unused clks/pm domain kill the requiered clks/pm
   domain, since they are not referenced by the earlycon.

3/ kernel hang when calling early write function after the serial
   console driver runtime suspended:
a) the earlycon not disabled after the init code
b) the serial console driver's runtime suspend kills the requiered
   clks/pm domain, since they are not referenced by the earlycon.

This serial fix 1/ case only.



Jeffy Chen (5):
  serial: arc: Remove __init marking from early write
  serial: omap: Remove __init marking from early write
  serial: xuartps: Remove __init marking from early write
  serial: 8250_ingenic: Remove __init marking from early write
  serial: 8250_early: Remove __init marking from early write

 drivers/tty/serial/8250/8250_early.c   |  8 
 drivers/tty/serial/8250/8250_ingenic.c |  8 
 drivers/tty/serial/arc_uart.c  |  4 ++--
 drivers/tty/serial/omap-serial.c   | 13 ++---
 drivers/tty/serial/xilinx_uartps.c |  2 +-
 5 files changed, 17 insertions(+), 18 deletions(-)

-- 
2.1.4



___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [RFC PATCH 1/5] serial: arc: Remove __init marking from early write

2017-07-17 Thread Greg KH
On Tue, Jul 18, 2017 at 12:29:59PM +0800, Jeffy Chen wrote:
> The earlycon would be alive outside the init code in these cases:
> 1/ we have keep_bootcon in cmdline.
> 2/ we don't have a real console to switch to.
> 
> So remove the __init marking to avoid invalid memory access.
> 
> Signed-off-by: Jeffy Chen 
> ---
> 

I can't apply "RFC" patches.  If you have tested and found this series
to be correct, can you resend it without that on the patch?

thanks,

greg k-h

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/5] serial: arc: Remove __init marking from early write

2017-07-17 Thread Jeffy Chen
The earlycon would be alive outside the init code in these cases:
1/ we have keep_bootcon in cmdline.
2/ we don't have a real console to switch to.

So remove the __init marking to avoid invalid memory access.

Signed-off-by: Jeffy Chen 
---

 drivers/tty/serial/arc_uart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 5ac06fc..77fe306 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -549,8 +549,8 @@ static struct console arc_console = {
.data   = &arc_uart_driver
 };
 
-static __init void arc_early_serial_write(struct console *con, const char *s,
- unsigned int n)
+static void arc_early_serial_write(struct console *con, const char *s,
+  unsigned int n)
 {
struct earlycon_device *dev = con->data;
 
-- 
2.1.4



___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [RFC PATCH 1/5] serial: arc: Remove __init marking from early write

2017-07-17 Thread jeffy

Hi Greg,

On 07/18/2017 01:08 PM, Greg KH wrote:

On Tue, Jul 18, 2017 at 12:29:59PM +0800, Jeffy Chen wrote:

The earlycon would be alive outside the init code in these cases:
1/ we have keep_bootcon in cmdline.
2/ we don't have a real console to switch to.

So remove the __init marking to avoid invalid memory access.

Signed-off-by: Jeffy Chen 
---



I can't apply "RFC" patches.  If you have tested and found this series
to be correct, can you resend it without that on the patch?

oh, sorry, i'll resend it :)

but i'm still not sure how to fix other hang cases(mentioned in the 
cover-letter, earlycon's required clks/pm domain been disabled by ignore 
unused initcalls or serial console driver's runtime suspend).


thanks,

greg k-h







___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/5] earlycon hang under some conditions

2017-07-17 Thread Jeffy Chen
I was testing earlycon with 8250 dw serial console. And it hangs in
these cases:
1/ kernel hang when calling early write function after free_initmem:
a) the earlycon not disabled after the init code(due to keep_bootcon or
   not specify a real console to switch to)
b) the early write func is marked as __init, for example 8250_early.

2/ kernel hang when calling early write function after disable unused
clks/pm domain:
a) the earlycon not disabled after the init code
b) the disable unused clks/pm domain kill the requiered clks/pm
   domain, since they are not referenced by the earlycon.

3/ kernel hang when calling early write function after the serial
   console driver runtime suspended:
a) the earlycon not disabled after the init code
b) the serial console driver's runtime suspend kills the requiered
   clks/pm domain, since they are not referenced by the earlycon.

This serial fix 1/ case only.



Jeffy Chen (5):
  serial: arc: Remove __init marking from early write
  serial: omap: Remove __init marking from early write
  serial: xuartps: Remove __init marking from early write
  serial: 8250_ingenic: Remove __init marking from early write
  serial: 8250_early: Remove __init marking from early write

 drivers/tty/serial/8250/8250_early.c   |  8 
 drivers/tty/serial/8250/8250_ingenic.c |  8 
 drivers/tty/serial/arc_uart.c  |  4 ++--
 drivers/tty/serial/omap-serial.c   | 13 ++---
 drivers/tty/serial/xilinx_uartps.c |  2 +-
 5 files changed, 17 insertions(+), 18 deletions(-)

-- 
2.1.4



___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc