Skip to contentSkip to conversation

MIPS: Octeon: size the swiotlb for a modular OHCI platform driver

PATCH Applied Orgad Shaneh 2 participants 4 messages Sep 15 – Sep 26 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 MIPS: Octeon: size the swiotlb for a modular OHCI platform driver

plat_swiotlb_setup() raises the swiotlb to 64 MB on OCTEON II with memory above 4 GB, because that OHCI can only DMA to 32 bits. The test is "#ifdef CONFIG_USB_OHCI_HCD_PLATFORM", which is false when the driver is a module - the usual way to build it - so the bump is silently skipped.

What is left depends on the rest of the function: with PCI enabled the "memory past the BAR1 hole" branch happens to ask for the same 64 MB, but with CONFIG_PCI off - which is normal on these SoCs when no PCI devices are wired - swiotlbsize stays at the PAGE_SIZE it was initialised to. A full- or low-speed device on an OCTEON II board with more than 4 GB of RAM then has no bounce buffer to speak of.

Use IS_ENABLED() so a modular OHCI gets the same sizing as a built-in one. Seen on a CN6635 board with 8 GB of RAM and CONFIG_USB_OHCI_HCD_PLATFORM=m.

Fixes a8667d706dfa ("MIPS: OCTEON: dma-octeon: fix OHCI USB config check")
Assisted-by Claude:claude-opus-5

---

arch/mips/cavium-octeon/dma-octeon.c +1 -1
@@ -228,7 +228,7 @@ void __init plat_swiotlb_setup(void)
 		swiotlbsize = 64 * (1<<20);
 	}
 #endif
-#ifdef CONFIG_USB_OHCI_HCD_PLATFORM
+#if IS_ENABLED(CONFIG_USB_OHCI_HCD_PLATFORM)
 	/* OCTEON II ohci is only 32-bit. */
 	if (OCTEON_IS_OCTEON2() && max_addr >= 0x100000000ul)
 		swiotlbsize = 64 * (1<<20);
Signature · 1 line
2.47.0
#1 lore raw

PATCH 2/2 MIPS: Octeon: offer the RedBoot parser when it is modular

The bootbus flash driver lists "RedBoot" among the partition parsers to try under "#ifdef CONFIG_MTD_REDBOOT_PARTS", so building that parser as a module drops it from the list and the partitions on such a chip are never found.

Use IS_ENABLED(), like the USB device-tree fixups in octeon-platform.c.

Untested - I have no board with RedBoot partitions; the change is by inspection, in the same family as the two above.

Assisted-by Claude:claude-opus-5

---

arch/mips/cavium-octeon/flash_setup.c +1 -1
@@ -22,7 +22,7 @@ static struct map_info flash_map;
 static struct mtd_info *mymtd;
 static const char *part_probe_types[] = {
 	"cmdlinepart",
-#ifdef CONFIG_MTD_REDBOOT_PARTS
+#if IS_ENABLED(CONFIG_MTD_REDBOOT_PARTS)
 	"RedBoot",
 #endif
 	NULL
Signature · 1 line
2.47.0
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] MIPS: Octeon: offer the RedBoot parser when it is modular

Quoted 27 lines · Orgad Shaneh

The bootbus flash driver lists "RedBoot" among the partition parsers to try under "#ifdef CONFIG_MTD_REDBOOT_PARTS", so building that parser as a module drops it from the list and the partitions on such a chip are never found.

Use IS_ENABLED(), like the USB device-tree fixups in octeon-platform.c.

Untested - I have no board with RedBoot partitions; the change is by inspection, in the same family as the two above.

Assisted-by Claude:claude-opus-5

---

arch/mips/cavium-octeon/flash_setup.c +1 -1
@@ -22,7 +22,7 @@ static struct map_info flash_map;
 static struct mtd_info *mymtd;
 static const char *part_probe_types[] = {
 	"cmdlinepart",
-#ifdef CONFIG_MTD_REDBOOT_PARTS
+#if IS_ENABLED(CONFIG_MTD_REDBOOT_PARTS)
 	"RedBoot",
 #endif
 	NULL
Signature · 1 line
2.47.0

applied to mips-next

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
maintainer Applied
#3 lore raw
In reply to Orgad Shaneh
Quoted 35 lines · Orgad Shaneh

plat_swiotlb_setup() raises the swiotlb to 64 MB on OCTEON II with memory above 4 GB, because that OHCI can only DMA to 32 bits. The test is "#ifdef CONFIG_USB_OHCI_HCD_PLATFORM", which is false when the driver is a module - the usual way to build it - so the bump is silently skipped.

What is left depends on the rest of the function: with PCI enabled the "memory past the BAR1 hole" branch happens to ask for the same 64 MB, but with CONFIG_PCI off - which is normal on these SoCs when no PCI devices are wired - swiotlbsize stays at the PAGE_SIZE it was initialised to. A full- or low-speed device on an OCTEON II board with more than 4 GB of RAM then has no bounce buffer to speak of.

Use IS_ENABLED() so a modular OHCI gets the same sizing as a built-in one. Seen on a CN6635 board with 8 GB of RAM and CONFIG_USB_OHCI_HCD_PLATFORM=m.

Fixes a8667d706dfa ("MIPS: OCTEON: dma-octeon: fix OHCI USB config check")
Assisted-by Claude:claude-opus-5

---

arch/mips/cavium-octeon/dma-octeon.c +1 -1
@@ -228,7 +228,7 @@ void __init plat_swiotlb_setup(void)
 		swiotlbsize = 64 * (1<<20);
 	}
 #endif
-#ifdef CONFIG_USB_OHCI_HCD_PLATFORM
+#if IS_ENABLED(CONFIG_USB_OHCI_HCD_PLATFORM)
 	/* OCTEON II ohci is only 32-bit. */
 	if (OCTEON_IS_OCTEON2() && max_addr >= 0x100000000ul)
 		swiotlbsize = 64 * (1<<20);
Signature · 1 line
2.47.0

applied to mips-next

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]