Cavium OCTEON-III network driver.
Subsystems (5)
v3 cover Cavium OCTEON-III network driver.
We are adding the Cavium OCTEON-III network driver. But since interacting with the input and output queues is done via special CPU local memory, we also need to add support to the MIPS/Octeon architecture code. Aren't SoCs nice in this way?
The first six patches add the SoC support needed by the driver, the last two add the driver and an entry in MAINTAINERS.
Since these touch several subsystems (mips, staging, netdev), I would propose merging via netdev, but defer to the maintainers if they think something else would work better.
A separate pull request was recently done by Steven Hill for the firmware required by the driver.
Changes from v2:
o Fix PKI (RX path) initialization to work with little endian kernel.
Changes from v1:
o Cleanup and use of standard bindings in the device tree bindings document.
o Added (hopefully) clarifying comments about several OCTEON architectural peculiarities.
o Removed unused testing code from the driver.
o Removed some module parameters that already default to the proper values.
o KConfig cleanup, including testing on x86_64, arm64 and mips.
o Fixed breakage to the driver for previous generation of OCTEON SoCs (in the staging directory still).
o Verified bisectability of the patch set.
Carlos Munoz (5):
dt-bindings: Add Cavium Octeon Common Ethernet Interface.
MIPS: Octeon: Enable LMTDMA/LMTST operations.
MIPS: Octeon: Add a global resource manager.
MIPS: Octeon: Add Free Pointer Unit (FPA) support.
netdev: octeon-ethernet: Add Cavium Octeon III support.
David Daney (3):
MIPS: Octeon: Automatically provision CVMSEG space.
staging: octeon: Remove USE_ASYNC_IOBDMA macro.
MAINTAINERS: Add entry for
drivers/net/ethernet/cavium/octeon/octeon3-*
.../devicetree/bindings/net/cavium-bgx.txt | 61 + MAINTAINERS | 6 + arch/mips/cavium-octeon/Kconfig | 35 +- arch/mips/cavium-octeon/Makefile | 4 +- arch/mips/cavium-octeon/octeon-fpa3.c | 364 ++++ arch/mips/cavium-octeon/resource-mgr.c | 371 ++++ arch/mips/cavium-octeon/setup.c | 22 +- .../asm/mach-cavium-octeon/kernel-entry-init.h | 20 +- arch/mips/include/asm/mipsregs.h | 2 + arch/mips/include/asm/octeon/octeon.h | 47 +- arch/mips/include/asm/processor.h | 2 +- arch/mips/kernel/octeon_switch.S | 2 - arch/mips/mm/tlbex.c | 29 +- drivers/net/ethernet/cavium/Kconfig | 55 +- drivers/net/ethernet/cavium/octeon/Makefile | 6 + .../net/ethernet/cavium/octeon/octeon3-bgx-nexus.c | 698 +++++++ .../net/ethernet/cavium/octeon/octeon3-bgx-port.c | 2028 +++++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-core.c | 2068 ++++++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-pki.c | 832 ++++++++ drivers/net/ethernet/cavium/octeon/octeon3-pko.c | 1719 ++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-sso.c | 309 +++ drivers/net/ethernet/cavium/octeon/octeon3.h | 411 ++++ drivers/staging/octeon/ethernet-defines.h | 6 - drivers/staging/octeon/ethernet-rx.c | 25 +- drivers/staging/octeon/ethernet-tx.c | 85 +- 25 files changed, 9064 insertions(+), 143 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/cavium-bgx.txt create mode 100644 arch/mips/cavium-octeon/octeon-fpa3.c create mode 100644 arch/mips/cavium-octeon/resource-mgr.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-core.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-pki.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-pko.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-sso.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3.h
Signature · 6 lines
2.13.6 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 1/8 dt-bindings: Add Cavium Octeon Common Ethernet Interface.
From: Carlos Munoz <[email protected]>
Add bindings for Common Ethernet Interface (BGX) block.
--- .../devicetree/bindings/net/cavium-bgx.txt | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/cavium-bgx.txt
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +61 -0
@@ -0,0 +1,61 @@ +* Common Ethernet Interface (BGX) block + +Properties: + +- compatible: "cavium,octeon-7890-bgx": Compatibility with all cn7xxx SOCs. + +- reg: The base address of the BGX block. + +- #address-cells: Must be <1>. + +- #size-cells: Must be <0>. BGX addresses have no size component. + +A BGX block has several children, each representing an Ethernet +interface. + + +* Ethernet Interface (BGX port) connects to PKI/PKO + +Properties: + +- compatible: "cavium,octeon-7890-bgx-port": Compatibility with all + cn7xxx SOCs. + + "cavium,octeon-7360-xcv": Compatibility with cn73xx SOCs + for RGMII. + +- reg: The index of the interface within the BGX block. + +Optional properties: + +- local-mac-address: Mac address for the interface. + +- phy-handle: phandle to the phy node connected to the interface. + +- phy-mode: described in ethernet.txt. + +- fixed-link: described in fixed-link.txt. + +Example: + + ethernet-mac-nexus@11800e0000000 { + compatible = "cavium,octeon-7890-bgx"; + reg = <0x00011800 0xe0000000 0x00000000 0x01000000>; + #address-cells = <1>; + #size-cells = <0>; + + ethernet-mac@0 { + compatible = "cavium,octeon-7360-xcv"; + reg = <0>; + local-mac-address = [ 00 01 23 45 67 89 ]; + phy-handle = <&phy3>; + phy-mode = "rgmii-rxid" + }; + ethernet-mac@1 { + compatible = "cavium,octeon-7890-bgx-port"; + reg = <1>; + local-mac-address = [ 00 01 23 45 67 8a ]; + phy-handle = <&phy4>; + phy-mode = "sgmii" + }; + };
Signature · 1 line
2.13.6
Re: [PATCH v3 1/8] dt-bindings: Add Cavium Octeon Common Ethernet Interface.
Quoted 35 lines · David Daney
From: Carlos Munoz <cmunoz-YGCgFSpz5w/[email protected]>
Add bindings for Common Ethernet Interface (BGX) block.
Signed-off-by Carlos Munoz <cmunoz-YGCgFSpz5w/[email protected]>Signed-off-by David Daney <david.daney-YGCgFSpz5w/[email protected]>--- .../devicetree/bindings/net/cavium-bgx.txt | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/cavium-bgx.txtDocumentation/devicetree/bindings/net/cavium-bgx.txt new file +17
-0@@ -0,0 +1,61 @@ +* Common Ethernet Interface (BGX) block + +Properties: + +- compatible: "cavium,octeon-7890-bgx": Compatibility with all cn7xxx SOCs. + +- reg: The base address of the BGX block. + +- #address-cells: Must be <1>. + +- #size-cells: Must be <0>. BGX addresses have no size component. + +A BGX block has several children, each representing an Ethernet +interface. + + +* Ethernet Interface (BGX port) connects to PKI/PKO
Documentation/devicetree/bindings/net/cavium-bgx.txt line 27
Quoted 10 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +10
-0+ +Properties: + +- compatible: "cavium,octeon-7890-bgx-port": Compatibility with all + cn7xxx SOCs. + + "cavium,octeon-7360-xcv": Compatibility with cn73xx SOCs + for RGMII. + +- reg: The index of the interface within the BGX block.
There's no memory mapped region associated with the sub-blocks?
Quoted 10 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +10
-0+ +Optional properties: + +- local-mac-address: Mac address for the interface. + +- phy-handle: phandle to the phy node connected to the interface. + +- phy-mode: described in ethernet.txt. + +- fixed-link: described in fixed-link.txt.
Documentation/devicetree/bindings/net/cavium-bgx.txt line 47
Quoted 10 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +10
-0+ +Example: + + ethernet-mac-nexus@11800e0000000 { + compatible = "cavium,octeon-7890-bgx"; + reg = <0x00011800 0xe0000000 0x00000000 0x01000000>; + #address-cells = <1>; + #size-cells = <0>; + + ethernet-mac@0 {
ethernet@0
Documentation/devicetree/bindings/net/cavium-bgx.txt line 54
Quoted 7 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +7
-0+ compatible = "cavium,octeon-7360-xcv"; + reg = <0>; + local-mac-address = [ 00 01 23 45 67 89 ]; + phy-handle = <&phy3>; + phy-mode = "rgmii-rxid" + }; + ethernet-mac@1 {
ditto.
Otherwise,
Quoted 10 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +7
-0+ compatible = "cavium,octeon-7890-bgx-port"; + reg = <1>; + local-mac-address = [ 00 01 23 45 67 8a ]; + phy-handle = <&phy4>; + phy-mode = "sgmii" + }; + };Signature · 1 line
2.13.6
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/8] dt-bindings: Add Cavium Octeon Common Ethernet Interface.
Quoted 40 lines · Rob Herring
Quoted 39 lines · David Daney
From: Carlos Munoz <[email protected]>
Add bindings for Common Ethernet Interface (BGX) block.
Signed-off-by Carlos Munoz <[email protected]>Signed-off-by Steven J. Hill <[email protected]>Signed-off-by David Daney <[email protected]>--- .../devicetree/bindings/net/cavium-bgx.txt | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+)create mode 100644
Documentation/devicetree/bindings/net/cavium-bgx.txtDocumentation/devicetree/bindings/net/cavium-bgx.txt new file +21
-0@@ -0,0 +1,61 @@ +* Common Ethernet Interface (BGX) block + +Properties: + +- compatible: "cavium,octeon-7890-bgx": Compatibility with all cn7xxx SOCs. + +- reg: The base address of the BGX block. + +- #address-cells: Must be <1>. + +- #size-cells: Must be <0>. BGX addresses have no size component. + +A BGX block has several children, each representing an Ethernet +interface. + + +* Ethernet Interface (BGX port) connects to PKI/PKO + +Properties: + +- compatible: "cavium,octeon-7890-bgx-port": Compatibility with all
Quoted 8 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt line 27
Quoted 6 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +6
-0+ cn7xxx SOCs. + + "cavium,octeon-7360-xcv": Compatibility with cn73xx SOCs + for RGMII. + +- reg: The index of the interface within the BGX block.There's no memory mapped region associated with the sub-blocks?
No. Many of the sub block control bits are co-located in the same registers.
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +14
-0+ +Optional properties: + +- local-mac-address: Mac address for the interface. + +- phy-handle: phandle to the phy node connected to the interface. + +- phy-mode: described in ethernet.txt. + +- fixed-link: described in fixed-link.txt. + +Example: + + ethernet-mac-nexus@11800e0000000 {
Quoted 8 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt line 47
Quoted 6 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +6
-0+ compatible = "cavium,octeon-7890-bgx"; + reg = <0x00011800 0xe0000000 0x00000000 0x01000000>; + #address-cells = <1>; + #size-cells = <0>; + + ethernet-mac@0 {ethernet@0
Good point. I will fix that.
Quoted 11 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt line 54
Quoted 8 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +7
-0+ compatible = "cavium,octeon-7360-xcv"; + reg = <0>; + local-mac-address = [ 00 01 23 45 67 89 ]; + phy-handle = <&phy3>; + phy-mode = "rgmii-rxid" + }; + ethernet-mac@1 {ditto.
Quoted 3 lines
Otherwise,
Acked-by Rob Herring <[email protected]>
Thanks,
David Daney
Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +7
-0+ compatible = "cavium,octeon-7890-bgx-port"; + reg = <1>; + local-mac-address = [ 00 01 23 45 67 8a ]; + phy-handle = <&phy4>; + phy-mode = "sgmii" + }; + };Signature · 1 line
2.13.6
PATCH v3 2/8 MIPS: Octeon: Enable LMTDMA/LMTST operations.
In reply to David DaneyFrom: Carlos Munoz <[email protected]>
LMTDMA/LMTST operations move data between cores and I/O devices:
* LMTST operations can send an address and a variable length (up to 128 bytes) of data to an I/O device.
* LMTDMA operations can send an address and a variable length (up to 128) of data to the I/O device and then return a variable length (up to 128 bytes) response from the IOI device.
--- arch/mips/cavium-octeon/setup.c | 6 ++++++ arch/mips/include/asm/octeon/octeon.h | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)
arch/mips/cavium-octeon/setup.c +6 -0
@@ -609,6 +609,12 @@ void octeon_user_io_init(void)#else cvmmemctl.s.cvmsegenak =0 ;#endif +if (OCTEON_IS_OCTEON3 ()) { +/* Enable LMTDMA */ + cvmmemctl.s.lmtena =1 ; +/* Scratch line to use for LMT operation */ + cvmmemctl.s.lmtline =2 ; + }/* R/W If set, CVMSEG is available for loads/stores in * supervisor mode. */ cvmmemctl.s.cvmsegenas =0 ;
arch/mips/include/asm/octeon/octeon.h +10 -2
@@ -179,7 +179,15 @@ union octeon_cvmemctl { /* RO 1 = BIST fail, 0 = BIST pass */ __BITFIELD_FIELD(uint64_t wbfbist:1, /* Reserved */ - __BITFIELD_FIELD(uint64_t reserved:17, + __BITFIELD_FIELD(uint64_t reserved_52_57:6, + /* When set, LMTDMA/LMTST operations are permitted */ + __BITFIELD_FIELD(uint64_t lmtena:1, + /* Selects the CVMSEG LM cacheline used by LMTDMA + * LMTST and wide atomic store operations. + */ + __BITFIELD_FIELD(uint64_t lmtline:6, + /* Reserved */ + __BITFIELD_FIELD(uint64_t reserved_41_44:4, /* OCTEON II - TLB replacement policy: 0 = bitmask LRU; 1 = NLU. * This field selects between the TLB replacement policies: * bitmask LRU or NLU. Bitmask LRU maintains a mask of
@@ -275,7 +283,7 @@ union octeon_cvmemctl {/* R/W Size of local memory in cache blocks, 54 (6912 * bytes) is max legal value. */ __BITFIELD_FIELD(uint64_t lmemsz:6, - ;))))))))))))))))))))))))))))))))) + ;)))))))))))))))))))))))))))))))))))) } s; };
Signature · 1 line
2.13.6
PATCH v3 3/8 MIPS: Octeon: Add a global resource manager.
In reply to David DaneyFrom: Carlos Munoz <[email protected]>
Add a global resource manager to manage tagged pointers within bootmem allocated memory. This is used by various functional blocks in the Octeon core like the FPA, Ethernet nexus, etc.
--- arch/mips/cavium-octeon/Makefile | 3 +- arch/mips/cavium-octeon/resource-mgr.c | 371 +++++++++++++++++++++++++++++++++ arch/mips/include/asm/octeon/octeon.h | 18 ++ 3 files changed, 391 insertions(+), 1 deletion(-) create mode 100644 arch/mips/cavium-octeon/resource-mgr.c
arch/mips/cavium-octeon/Makefile +2 -1
@@ -9,7 +9,8 @@ # Copyright (C) 2005-2009 Cavium Networks # -obj-y := cpu.o setup.o octeon-platform.o octeon-irq.o csrc-octeon.o +obj-y := cpu.o setup.o octeon-platform.o octeon-irq.o csrc-octeon.o \ + resource-mgr.o obj-y += dma-octeon.o obj-y += octeon-memcpy.o obj-y += executive/
arch/mips/cavium-octeon/resource-mgr.c new file +371 -0
371 lines not on this page · raw message
arch/mips/include/asm/octeon/octeon.h +18 -0
@@ -346,6 +346,24 @@ void octeon_mult_restore3_end(void);void octeon_mult_restore2 (void );void octeon_mult_restore2_end (void ); +/* +* This definition must be kept in sync with the one in +* cvmx-global-resources.c +*/ +struct global_resource_tag { +uint64_t lo; +uint64_t hi; +}; + +void res_mgr_free (struct global_resource_tag tag,int inst); +void res_mgr_free_range (struct global_resource_tag tag,const int *inst, +int req_cnt); +int res_mgr_alloc (struct global_resource_tag tag,int req_inst, +bool use_last_avail); +int res_mgr_alloc_range (struct global_resource_tag tag,int req_inst, +int req_cnt,bool use_last_avail,int *inst); +int res_mgr_create_resource (struct global_resource_tag tag,int inst_cnt); +/** * Read a 32bit value from the Octeon NPI register space *
Signature · 1 line
2.13.6
PATCH v3 4/8 MIPS: Octeon: Add Free Pointer Unit (FPA) support.
In reply to David DaneyFrom: Carlos Munoz <[email protected]>
Quoted 1 line
From the hardware user manual: "The FPA is a unit that maintains
pools of pointers to free L2/DRAM memory. To provide QoS, the pools are referenced indirectly through 1024 auras. Both core software and hardware units allocate and free pointers."
--- arch/mips/cavium-octeon/Kconfig | 8 + arch/mips/cavium-octeon/Makefile | 1 + arch/mips/cavium-octeon/octeon-fpa3.c | 364 ++++++++++++++++++++++++++++++++++ arch/mips/include/asm/octeon/octeon.h | 15 ++ 4 files changed, 388 insertions(+) create mode 100644 arch/mips/cavium-octeon/octeon-fpa3.c
arch/mips/cavium-octeon/Kconfig +8 -0
@@ -86,4 +86,12 @@ config OCTEON_ILM To compile this driver as a module, choose M here. The module will be called octeon-ilm +config OCTEON_FPA3 + tristate "Octeon III fpa driver" + help + This option enables a Octeon III driver for the Free Pool Unit (FPA). + The FPA is a hardware unit that manages pools of pointers to free + L2/DRAM memory. This driver provides an interface to reserve, + initialize, and fill fpa pools. + endif # CAVIUM_OCTEON_SOC
arch/mips/cavium-octeon/Makefile +1 -0
@@ -20,3 +20,4 @@ obj-$(CONFIG_MTD) += flash_setup.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_OCTEON_ILM) += oct_ilm.o obj-$(CONFIG_USB) += octeon-usb.o +obj-$(CONFIG_OCTEON_FPA3) += octeon-fpa3.o
arch/mips/cavium-octeon/octeon-fpa3.c new file +364 -0
364 lines not on this page · raw message
arch/mips/include/asm/octeon/octeon.h +15 -0
@@ -10,6 +10,7 @@#include <asm/octeon/cvmx.h> #include <asm/bitfield.h> +#include <linux/slab.h> extern uint64_t octeon_bootmem_alloc_range_phys(uint64_t size, uint64_t alignment,
@@ -364,6 +365,20 @@ int res_mgr_alloc_range(struct global_resource_tag tag, int req_inst, int req_cnt, bool use_last_avail, int *inst);int res_mgr_create_resource (struct global_resource_tag tag,int inst_cnt); +#if IS_ENABLED (CONFIG_OCTEON_FPA3 ) +int octeon_fpa3_init (int node); +int octeon_fpa3_pool_init (int node,int pool_num,int *pool,void **pool_stack, +int num_ptrs); +int octeon_fpa3_aura_init (int node,int pool,int aura_num,int *aura, +int num_bufs,unsigned int limit); +int octeon_fpa3_mem_fill (int node,struct kmem_cache *cache,int aura, +int num_bufs); +void octeon_fpa3_free (u64 node,int aura,const void *buf); +void *octeon_fpa3_alloc (u64 node,int aura); +void octeon_fpa3_release_pool (int node,int pool); +void octeon_fpa3_release_aura (int node,int aura); +#endif +/** * Read a 32bit value from the Octeon NPI register space *
Signature · 1 line
2.13.6
PATCH v3 5/8 MIPS: Octeon: Automatically provision CVMSEG space.
In reply to David DaneyRemove CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE and automatically calculate the amount of CVMSEG space needed.
1st 128-bytes: Use by IOBDMA
2nd 128-bytes: Reserved by kernel for scratch/TLS emulation. 3rd 128-bytes: OCTEON-III LMTLINE
New config variable CONFIG_CAVIUM_OCTEON_EXTRA_CVMSEG provisions additional lines, defaults to zero.
--- arch/mips/cavium-octeon/Kconfig | 27 ++++++++++++-------- arch/mips/cavium-octeon/setup.c | 16 ++++++------ .../asm/mach-cavium-octeon/kernel-entry-init.h | 20 +++++++++------ arch/mips/include/asm/mipsregs.h | 2 ++ arch/mips/include/asm/octeon/octeon.h | 2 ++ arch/mips/include/asm/processor.h | 2 +- arch/mips/kernel/octeon_switch.S | 2 -- arch/mips/mm/tlbex.c | 29 ++++++---------------- drivers/staging/octeon/ethernet-defines.h | 2 +- 9 files changed, 50 insertions(+), 52 deletions(-)
arch/mips/cavium-octeon/Kconfig +16 -11
@@ -10,21 +10,26 @@ config CAVIUM_CN63XXP1 non-CN63XXP1 hardware, so it is recommended to select "n" unless it is known the workarounds are needed. -config CAVIUM_OCTEON_CVMSEG_SIZE - int "Number of L1 cache lines reserved for CVMSEG memory" - range 0 54 - default 1 - help - CVMSEG LM is a segment that accesses portions of the dcache as a - local memory; the larger CVMSEG is, the smaller the cache is. - This selects the size of CVMSEG LM, which is in cache blocks. The - legally range is from zero to 54 cache blocks (i.e. CVMSEG LM is - between zero and 6192 bytes). - endif # CPU_CAVIUM_OCTEON if CAVIUM_OCTEON_SOC +config CAVIUM_OCTEON_EXTRA_CVMSEG + int "Number of extra L1 cache lines reserved for CVMSEG memory" + range 0 50 + default 0 + help + CVMSEG LM is a segment that accesses portions of the dcache + as a local memory; the larger CVMSEG is, the smaller the + cache is. The kernel uses two or three blocks (one for TLB + exception handlers, one for driver IOBDMA operations, and on + models that need it, one for LMTDMA operations). This + selects an optional extra number of CVMSEG lines for use by + other software. + + Normally no extra lines are required, and this parameter + should be set to zero. + config CAVIUM_OCTEON_LOCK_L2 bool "Lock often used kernel code in the L2" default "y"
arch/mips/cavium-octeon/setup.c +9 -7
@@ -68,6 +68,12 @@ extern void pci_console_init(const char *arg);static unsigned long long max_memory =ULLONG_MAX ;static unsigned long long reserve_low_mem; +/* +* modified in hernel-entry-init.h, must have an initial value to keep +* it from being clobbered when bss is zeroed. +*/ +u32 octeon_cvmseg_lines =2 ; +DEFINE_SEMAPHORE (octeon_bootbus_sem);EXPORT_SYMBOL (octeon_bootbus_sem);
@@ -604,11 +610,7 @@ void octeon_user_io_init(void)/* R/W If set, CVMSEG is available for loads/stores in * kernel/debug mode. */ -#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE >0 cvmmemctl.s.cvmsegenak =1 ; -#else - cvmmemctl.s.cvmsegenak =0 ; -#endif if (OCTEON_IS_OCTEON3 ()) {/* Enable LMTDMA */ cvmmemctl.s.lmtena =1 ;
@@ -626,9 +628,9 @@ void octeon_user_io_init(void)/* Setup of CVMSEG is done in kernel-entry-init.h */ if (smp_processor_id () ==0 ) -pr_notice ("CVMSEG size: %d cache lines (%d bytes)\n" , -CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE , -CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE *128 ); +pr_notice ("CVMSEG size: %u cache lines (%u bytes)\n" , + octeon_cvmseg_lines, + octeon_cvmseg_lines *128 );if (octeon_has_feature (OCTEON_FEATURE_FAU )) {union cvmx_iob_fau_timeout fau_timeout;
arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h +12 -8
@@ -26,11 +26,18 @@# a3 = address of boot descriptor block .set push .set arch=octeon + mfc0 v1, CP0_PRID_REG + andi v1, 0xff00 + li v0, 0x9500 # cn78XX or later + subu v1, v1, v0 + li t2, 2 + CONFIG_CAVIUM_OCTEON_EXTRA_CVMSEG + bltz v1, 1f + addiu t2, 1 # t2 has cvmseg_size +1:# Read the cavium mem control register dmfc0 v0, CP0_CVMMEMCTL_REG# Clear the lower 6 bits, the CVMSEG size - dins v0, $0, 0, 6 - ori v0, CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE + dins v0, t2, 0, 6 dmtc0 v0, CP0_CVMMEMCTL_REG # Write the cavium mem control register dmfc0 v0, CP0_CVMCTL_REG # Read the cavium control register# Disable unaligned load/store support but leave HW fixup enabled
@@ -70,7 +77,7 @@# Flush dcache after config change cache 9, 0($0)# Zero all of CVMSEG to make sure parity is correct -dli v0,CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE +move v0, t2 dsll v0, 7 beqz v0, 2f 1: dsubu v0, 8
@@ -126,12 +133,7 @@ LONG_L sp, (t0)# Set the SP global variable to zero so the master knows we've started LONG_S zero, (t0) -#ifdef __OCTEON__ -syncw - syncw -#else sync -#endif # Jump to the normal Linux SMP entry pointj smp_bootstrap nop
@@ -148,6 +150,8 @@#endif /* CONFIG_SMP */ octeon_main_processor: +dla v0, octeon_cvmseg_lines + sw t2, 0(v0) .set pop .endm
arch/mips/include/asm/mipsregs.h +2 -0
@@ -1126,6 +1126,8 @@#define FPU_CSR_RD 0x3/* towards -Infinity */ +#define CAVIUM_OCTEON_SCRATCH_OFFSET (2 * 128 - 16 - 32768) +#ifndef __ASSEMBLY__/*
arch/mips/include/asm/octeon/octeon.h +2 -0
@@ -392,6 +392,8 @@ static inline uint32_t octeon_npi_read32(uint64_t address)extern struct cvmx_bootinfo *octeon_bootinfo; +extern u32 octeon_cvmseg_lines; +extern uint64_t octeon_bootloader_entry_addr;extern void (*octeon_irq_setup_secondary)(void );
arch/mips/include/asm/processor.h +1 -1
@@ -216,7 +216,7 @@ struct octeon_cop2_state { .cp2 = {0,},struct octeon_cvmseg_state { -unsigned long cvmseg[CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE ] +unsigned long cvmseg[CONFIG_CAVIUM_OCTEON_EXTRA_CVMSEG +3 ] [cpu_dcache_line_size () /sizeof (unsigned long )]; };
arch/mips/kernel/octeon_switch.S +0 -2
@@ -29,7 +29,6 @@ cpu_save_nonscratch a0 LONG_S ra, THREAD_REG31(a0) -#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 /* Check if we need to store CVMSEG state */ dmfc0 t0, $11,7 /* CvmMemCtl */ bbit0 t0, 6, 3f /* Is user access enabled? */
@@ -58,7 +57,6 @@ dmfc0 t0, $11,7 /* CvmMemCtl */ xori t0, t0, 0x40 /* Bit 6 is CVMSEG user enable */ dmtc0 t0, $11,7 /* CvmMemCtl */ -#endif 3: #if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
arch/mips/mm/tlbex.c +7 -22
@@ -115,33 +115,17 @@ static int use_lwx_insns(void)return 0 ; } } -#if defined(CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE ) && \ -CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE >0 -static bool scratchpad_available (void ) -{ -return true; -} -static int scratchpad_offset (int i) -{ -/* -* CVMSEG starts at address -32768 and extends for -* CAVIUM_OCTEON_CVMSEG_SIZE 128 byte cache lines. -*/ - i +=1 ;/* Kernel use starts at the top and works down. */ -return CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE *128 - (8 * i) -32768 ; -} -#else -static bool scratchpad_available (void ) -{ -return false; -} +static int scratchpad_offset (int i) { +if (IS_ENABLED (CONFIG_CPU_CAVIUM_OCTEON )) +return (CAVIUM_OCTEON_SCRATCH_OFFSET - (8 * i)); +BUG ();/* Really unreachable, but evidently some GCC want this. */ return 0 ; } -#endif +/* * Found by experiment: At least some revisions of the 4kc throw under * some circumstances a machine check exception, triggered by invalid
@@ -1302,7 +1286,8 @@ static void build_r4000_tlb_refill_handler(void)memset (relocs,0 ,sizeof (relocs));memset (final_handler,0 ,sizeof (final_handler)); -if (IS_ENABLED (CONFIG_64BIT ) && (scratch_reg >=0 ||scratchpad_available ()) &&use_bbit_insns ()) { +if (IS_ENABLED (CONFIG_64BIT ) &&use_bbit_insns () && + (scratch_reg >=0 ||IS_ENABLED (CONFIG_CPU_CAVIUM_OCTEON ))) { htlb_info =build_fast_tlb_refill_handler (&p, &l, &r,K0 ,K1 , scratch_reg); vmalloc_mode = refill_scratch;
drivers/staging/octeon/ethernet-defines.h +1 -1
@@ -32,7 +32,7 @@#define REUSE_SKBUFFS_WITHOUT_FREE 1#endif -#define USE_ASYNC_IOBDMA (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0) +#define USE_ASYNC_IOBDMA 1/* Maximum number of SKBs to try to free per xmit packet. */ #define MAX_OUT_QUEUE_DEPTH 1000
Signature · 1 line
2.13.6
PATCH v3 6/8 staging: octeon: Remove USE_ASYNC_IOBDMA macro.
In reply to David DaneyPrevious patch sets USE_ASYNC_IOBDMA to 1 unconditionally. Remove USE_ASYNC_IOBDMA from all if statements. Remove dead code caused by the change.
--- drivers/staging/octeon/ethernet-defines.h | 6 --- drivers/staging/octeon/ethernet-rx.c | 25 ++++----- drivers/staging/octeon/ethernet-tx.c | 85 ++++++++++--------------------- 3 files changed, 37 insertions(+), 79 deletions(-)
drivers/staging/octeon/ethernet-defines.h +0 -6
@@ -10,10 +10,6 @@/* * A few defines are used to control the operation of this driver: -* USE_ASYNC_IOBDMA -* Use asynchronous IO access to hardware. This uses Octeon's asynchronous -* IOBDMAs to issue IO accesses without stalling. Set this to zero -* to disable this. Note that IOBDMAs require CVMSEG. * REUSE_SKBUFFS_WITHOUT_FREE * Allows the TX path to free an skbuff into the FPA hardware pool. This * can significantly improve performance for forwarding and bridging, but
@@ -32,8 +28,6 @@#define REUSE_SKBUFFS_WITHOUT_FREE 1#endif -#define USE_ASYNC_IOBDMA 1 -/* Maximum number of SKBs to try to free per xmit packet. */ #define MAX_OUT_QUEUE_DEPTH 1000
drivers/staging/octeon/ethernet-rx.c +10 -15
@@ -201,11 +201,9 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)/* Prefetch cvm_oct_device since we know we need it soon */ prefetch (cvm_oct_device); -if (USE_ASYNC_IOBDMA ) { -/* Save scratch in case userspace is using it */ -CVMX_SYNCIOBDMA ; - old_scratch =cvmx_scratch_read64 (CVMX_SCR_SCRATCH ); - } +/* Save scratch in case userspace is using it */ +CVMX_SYNCIOBDMA ; + old_scratch =cvmx_scratch_read64 (CVMX_SCR_SCRATCH );/* Only allow work for our group (and preserve priorities) */ if (OCTEON_IS_MODEL (OCTEON_CN68XX )) {
@@ -220,10 +218,8 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget) BIT(rx_group->group)); } -if (USE_ASYNC_IOBDMA ) { -cvmx_pow_work_request_async (CVMX_SCR_SCRATCH ,CVMX_POW_NO_WAIT ); - did_work_request =1 ; - } +cvmx_pow_work_request_async (CVMX_SCR_SCRATCH ,CVMX_POW_NO_WAIT ); + did_work_request =1 ;while (rx_count < budget) {struct sk_buff *skb =NULL ;
@@ -232,7 +228,7 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)cvmx_wqe_t *work;int port; -if (USE_ASYNC_IOBDMA && did_work_request) +if (did_work_request) work =cvmx_pow_work_response_async (CVMX_SCR_SCRATCH );else work =cvmx_pow_work_request_sync (CVMX_POW_NO_WAIT );
@@ -260,7 +256,7 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget) sizeof(void *));prefetch (pskb); -if (USE_ASYNC_IOBDMA && rx_count < (budget -1 )) { +if (rx_count < (budget -1 )) {cvmx_pow_work_request_async_nocheck (CVMX_SCR_SCRATCH ,CVMX_POW_NO_WAIT ); did_work_request =1 ;
@@ -403,10 +399,9 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)cvmx_write_csr (CVMX_POW_PP_GRP_MSKX (coreid), old_group_mask); } -if (USE_ASYNC_IOBDMA ) { -/* Restore the scratch area */ -cvmx_scratch_write64 (CVMX_SCR_SCRATCH , old_scratch); - } +/* Restore the scratch area */ +cvmx_scratch_write64 (CVMX_SCR_SCRATCH , old_scratch); +cvm_oct_rx_refill_pool (0 );return rx_count;
drivers/staging/octeon/ethernet-tx.c +27 -58
115 lines not on this page · raw message
Signature · 1 line
2.13.6
PATCH v3 7/8 netdev: octeon-ethernet: Add Cavium Octeon III support.
In reply to David DaneyFrom: Carlos Munoz <cmunoz-YGCgFSpz5w/[email protected]>
The Cavium OCTEON cn78xx and cn73xx SoCs have network packet I/O hardware that is significantly different from previous generations of the family.
Add a new driver for this hardware. The Ethernet MAC is called BGX on these devices. Common code for the MAC is in octeon3-bgx-port.c. Four of these BGX MACs are grouped together and managed as a group by octeon3-bgx-nexus.c. Ingress packet classification is done by the PKI unit initialized in octeon3-pki.c. Queue management is done in the SSO, initialized by octeon3-sso.c. Egress is handled by the PKO, initialized in octeon3-pko.c.
--- drivers/net/ethernet/cavium/Kconfig | 55 +- drivers/net/ethernet/cavium/octeon/Makefile | 6 + .../net/ethernet/cavium/octeon/octeon3-bgx-nexus.c | 698 +++++++ .../net/ethernet/cavium/octeon/octeon3-bgx-port.c | 2028 +++++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-core.c | 2068 ++++++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-pki.c | 832 ++++++++ drivers/net/ethernet/cavium/octeon/octeon3-pko.c | 1719 ++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-sso.c | 309 +++ drivers/net/ethernet/cavium/octeon/octeon3.h | 411 ++++ 9 files changed, 8116 insertions(+), 10 deletions(-) create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-core.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-pki.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-pko.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-sso.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3.h
drivers/net/ethernet/cavium/Kconfig +45 -10
@@ -4,7 +4,7 @@ config NET_VENDOR_CAVIUM bool "Cavium ethernet drivers" - depends on PCI + depends on PCI || CAVIUM_OCTEON_SOC default y ---help--- Select this option if you want enable Cavium network support.
@@ -13,6 +13,12 @@ config NET_VENDOR_CAVIUM if NET_VENDOR_CAVIUM +# +# The Thunder* and LiquidIO drivers require PCI. +# + +if PCI + config THUNDER_NIC_PF tristate "Thunder Physical function driver" depends on 64BIT
@@ -64,6 +70,20 @@ config LIQUIDIO To compile this driver as a module, choose M here: the module will be called liquidio. This is recommended. +config LIQUIDIO_VF + tristate "Cavium LiquidIO VF support" + depends on 64BIT && PCI_MSI + imply PTP_1588_CLOCK + ---help--- + This driver supports Cavium LiquidIO Intelligent Server Adapter + based on CN23XX chips. + + To compile this driver as a module, choose M here: The module + will be called liquidio_vf. MSI-X interrupt support is required + for this driver to work correctly + +endif # PCI + config OCTEON_MGMT_ETHERNET tristate "Octeon Management port ethernet driver (CN5XXX, CN6XXX)" depends on CAVIUM_OCTEON_SOC
@@ -75,16 +95,31 @@ config OCTEON_MGMT_ETHERNET port on Cavium Networks' Octeon CN57XX, CN56XX, CN55XX, CN54XX, CN52XX, and CN6XXX chips. -config LIQUIDIO_VF - tristate "Cavium LiquidIO VF support" - depends on 64BIT && PCI_MSI - imply PTP_1588_CLOCK +config OCTEON3_BGX_NEXUS + tristate + depends on CAVIUM_OCTEON_SOC + +config OCTEON3_BGX_PORT + tristate "Cavium OCTEON-III BGX port support" + depends on CAVIUM_OCTEON_SOC + select OCTEON3_BGX_NEXUS ---help--- - This driver supports Cavium LiquidIO Intelligent Server Adapter - based on CN23XX chips. + Enable the driver for Cavium Octeon III BGX ports. BGX ports + support sgmii, rgmii, xaui, rxaui, xlaui, xfi, 10KR and 40KR modes. - To compile this driver as a module, choose M here: The module - will be called liquidio_vf. MSI-X interrupt support is required - for this driver to work correctly + Say Y for support of any Octeon III SoC Ethernet port. + +config OCTEON3_ETHERNET + tristate "Cavium OCTEON-III PKI/PKO Ethernet support" + depends on CAVIUM_OCTEON_SOC + select OCTEON_BGX_PORT + select OCTEON_FPA3 + select FW_LOADER + ---help--- + Enable the driver for Cavium Octeon III Ethernet via PKI/PKO + units. No support for cn70xx chips (use OCTEON_ETHERNET for + cn70xx). + + Say Y for support of any Octeon III SoC Ethernet port. endif # NET_VENDOR_CAVIUM
drivers/net/ethernet/cavium/octeon/Makefile +6 -0
@@ -3,3 +3,9 @@ # obj-$(CONFIG_OCTEON_MGMT_ETHERNET) += octeon_mgmt.o +obj-$(CONFIG_OCTEON3_BGX_PORT) += octeon3-bgx-port.o +obj-$(CONFIG_OCTEON3_BGX_NEXUS) += octeon3-bgx-nexus.o +obj-$(CONFIG_OCTEON3_ETHERNET) += octeon3-ethernet.o + +octeon3-ethernet-objs += octeon3-core.o octeon3-pki.o octeon3-sso.o \ + octeon3-pko.o
drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c new file +698 -0
698 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c new file +2028 -0
2,028 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3-core.c new file +2068 -0
185 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3-pki.c new file +832 -0
832 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3-pko.c new file +1719 -0
1,719 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3-sso.c new file +309 -0
309 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3.h new file +411 -0
411 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.13.6 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Part of the diff is not shown here. View the raw message.
Re: [PATCH v3 7/8] netdev: octeon-ethernet: Add Cavium Octeon III support.
Quoted 12 lines
drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c new file +12
-0+ priv->phy_np =of_parse_phandle (pdev->dev.of_node,"phy-handle" ,0 ); + priv->phy_mode =of_get_phy_mode (pdev->dev.of_node); +/* If phy-mode absent, default to SGMII. */ +if (priv->phy_mode <0 ) + priv->phy_mode =PHY_INTERFACE_MODE_SGMII ; + +if (priv->phy_mode ==PHY_INTERFACE_MODE_1000BASEX ) + priv->mode_1000basex = true; + +if (of_phy_is_fixed_link (pdev->dev.of_node)) + priv->bgx_as_phy = true; +
...
drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c line 1933
Quoted 2 lines
drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c new file +2
-0+ priv->mode =bgx_port_get_mode (priv->node, priv->bgx, priv->index); +
It might be a good idea to verify priv->phy_mode and priv->mode are compatible.
Quoted 5 lines
drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c new file +5
-0+switch (priv->mode) { +case PORT_MODE_SGMII : +case PORT_MODE_RGMII : + priv->get_link = bgx_port_get_sgmii_link; + priv->set_link = bgx_port_set_xgmii_link;
drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c line 1948
Quoted 10 lines
drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c new file +10
-0+break ; +case PORT_MODE_XAUI : +case PORT_MODE_RXAUI : +case PORT_MODE_XLAUI : +case PORT_MODE_XFI : +case PORT_MODE_10G_KR : +case PORT_MODE_40G_KR4 : + priv->get_link = bgx_port_get_xaui_link; + priv->set_link = bgx_port_set_xaui_link; +break ;
Andrew
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 7/8] netdev: octeon-ethernet: Add Cavium Octeon III support.
In reply to David Daneydrivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c line 1685
Quoted 11 lines
drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c new file +11
-0+if (link_changed !=0 ) { +struct port_status status; + +if (link_changed >0 ) { +netdev_info (netdev,"Link is up - %d/%s\n" , + priv->phydev->speed, + priv->phydev->duplex ==DUPLEX_FULL ? +"Full" :"Half" ); + }else { +netdev_info (netdev,"Link is down\n" ); + }
phy_print_status()
Andrew
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 8/8 MAINTAINERS: Add entry for drivers/net/ethernet/cavium/octeon/octeon3-*
In reply to David Daney--- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -3212,6 +3212,12 @@ W: http://www.cavium.com S: Supported F: drivers/mmc/host/cavium* +CAVIUM OCTEON-III NETWORK DRIVER +M: David Daney <[email protected]> +L: [email protected] +S: Supported +F: drivers/net/ethernet/cavium/octeon/octeon3-* + CAVIUM OCTEON-TX CRYPTO DRIVER M: George Cherian <[email protected]> L: [email protected]
Signature · 1 line
2.13.6