Skip to contentSkip to conversation

serial: Support OXPCIe952 aka Oxford Semiconductor Ltd Device c138 (1415:c138)

RFC PATCH Konrad Rzeszutek Wilk 2 participants 4 messages Mar 4, 2014

lore
Share & tools
lore
#0 lore raw
Quoted 12 lines · Jan Beulich
Quoted 10 lines
Quoted 2 lines
Quoted 2 lines · Konrad Rzeszutek Wilk
(quoted diff) +0 -0
@@ -325,11 +342,12 @@ static void __init ns16550_init_preirq(struct serial_port *port) 
   #ifdef CONFIG_X86 
           enum fixed_addresses idx = FIX_COM_BEGIN + (uart - ns16550_com); 


-        set_fixmap_nocache(idx, uart->io_base);
+        set_fixmap_nocache(idx, uart->io_base + uart->offset); uart->remapped_io_base = (void __iomem *)fix_to_virt(idx); uart->remapped_io_base += uart->io_base & ~PAGE_MASK;

Don't you need to add in uart->offset here too?

The virtual address at that point already covers then BAR + offset.

Quoted 6 lines
Quoted 4 lines

  #else
-        uart->remapped_io_base = (char *)ioremap(uart->io_base, uart->io_size); +        uart->remapped_io_base = (char *)ioremap(uart->io_base+ uart->offset,

Missing space.

Fixed.

Quoted 9 lines
Quoted 5 lines

+                                                 uart->io_size); #endif
      }

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 10 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
Quoted 3 lines · Jan Beulich

Review static void __init ns16550_init_preirq(struct

Quoted 3 lines
Quoted 2 lines
Quoted 2 lines · Konrad Rzeszutek Wilk
(quoted diff) +0 -0
@@ -325,11 +342,12 @@ static void __init ns16550_init_preirq(struct 

serial_port *port)

Quoted 3 lines
Quoted 3 lines
(quoted diff) +0 -0
 #ifdef CONFIG_X86 
         enum fixed_addresses idx = FIX_COM_BEGIN + (uart - ns16550_com); 
 
Quoted 8 lines
Quoted 6 lines

Review static void __init ns16550_init_preirq(struct · line 347

Quoted 4 lines
(quoted diff) +1 -1
-        set_fixmap_nocache(idx, uart->io_base); 
+        set_fixmap_nocache(idx, uart->io_base + uart->offset); 
         uart->remapped_io_base = (void __iomem *)fix_to_virt(idx); 
         uart->remapped_io_base += uart->io_base & ~PAGE_MASK; 

Don't you need to add in uart->offset here too?

The virtual address at that point already covers then BAR + offset.

Hardly: fix_to_virt() returns a page-aligned address, and anything that may affect the offset-in-page value needs to be taken into consideration in the right side expression of the +=.

Jan

#2 lore raw
Quoted 15 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
Quoted 3 lines · Jan Beulich

Review static void __init ns16550_init_preirq(struct

Quoted 3 lines
Quoted 2 lines
Quoted 2 lines · Konrad Rzeszutek Wilk
(quoted diff) +0 -0
@@ -325,11 +342,12 @@ static void __init ns16550_init_preirq(struct 

serial_port *port)

Quoted 8 lines
Quoted 7 lines
(quoted diff) +1 -1
 #ifdef CONFIG_X86 
         enum fixed_addresses idx = FIX_COM_BEGIN + (uart - ns16550_com); 
 
-        set_fixmap_nocache(idx, uart->io_base); 
+        set_fixmap_nocache(idx, uart->io_base + uart->offset); 
         uart->remapped_io_base = (void __iomem *)fix_to_virt(idx); 
         uart->remapped_io_base += uart->io_base & ~PAGE_MASK; 
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Don't you need to add in uart->offset here too?

The virtual address at that point already covers then BAR + offset.

Hardly: fix_to_virt() returns a page-aligned address, and anything that may affect the offset-in-page value needs to be taken into consideration in the right side expression of the +=.

Oh, this is not a offset-in-page (well, it is, but also past the first page). In this case the offset ends up being BAR + 0x1000 + 0x200 * idx. It is well past the first page.

Perhaps splitting it up in two offsets would be better?

	set_fixmap_nocache(idx, uart_io_base + uart->pfn_offset * PAGE_SIZE);
	uart->remapped_io_base = (void __iomem)*fix_to_virt(idx);
	uart->remapped_io_base += uart->io_base + uart->offset & ~PAGE_MASK;

And of course we make sure that offset is within 0->4096.

Quoted 3 lines

Jan

#3 lore raw
Quoted 29 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
Quoted 15 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
Quoted 3 lines · Jan Beulich

Review static void __init ns16550_init_preirq(struct

Quoted 3 lines
Quoted 2 lines
Quoted 2 lines · Konrad Rzeszutek Wilk
(quoted diff) +0 -0
@@ -325,11 +342,12 @@ static void __init ns16550_init_preirq(struct 

serial_port *port)

Quoted 8 lines
Quoted 7 lines
(quoted diff) +1 -1
 #ifdef CONFIG_X86 
         enum fixed_addresses idx = FIX_COM_BEGIN + (uart - ns16550_com); 
 
-        set_fixmap_nocache(idx, uart->io_base); 
+        set_fixmap_nocache(idx, uart->io_base + uart->offset); 
         uart->remapped_io_base = (void __iomem *)fix_to_virt(idx); 
         uart->remapped_io_base += uart->io_base & ~PAGE_MASK; 
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Don't you need to add in uart->offset here too?

The virtual address at that point already covers then BAR + offset.

Hardly: fix_to_virt() returns a page-aligned address, and anything that may affect the offset-in-page value needs to be taken into consideration in the right side expression of the +=.

Oh, this is not a offset-in-page (well, it is, but also past the first page). In this case the offset ends up being BAR + 0x1000 + 0x200 * idx. It is well past the first page.

Quoted 7 lines

Perhaps splitting it up in two offsets would be better?

	set_fixmap_nocache(idx, uart_io_base + uart->pfn_offset * PAGE_SIZE);
	uart->remapped_io_base = (void __iomem)*fix_to_virt(idx);
	uart->remapped_io_base += uart->io_base + uart->offset & ~PAGE_MASK;

And of course we make sure that offset is within 0->4096.

I don't think that makes sense. Just properly add uart->offset as indicated.

Jan