hw/net: Add Axiado HCP network model for SOC
Subsystems (2)
v2 cover hw/net: Add Axiado HCP network model for SOC
This patchset introduces Axiado HCP network model for SoC AX3000
hw/net: Add Axiado HCP network device model
The HCP (Header and Crypto Processing) block is the substantial part of the series. It is the SoC's network complex, built around an Inside Secure SafeXcel EIP-197 packet engine that acts as bus master for all packet I/O over four command/result descriptor ring pairs. Five MACs are demultiplexed by an "application ID" tag carried in the EIP-96 input and output tokens. Only the packet datapath is modelled; the EIP-197 cryptographic transforms are treated as pass-through, which is what the guest asks for when the block is used as a network interface.
Refer Axiado website for more product information
https://axiado.com/products/
Testing
-------
The user-mode network backend is required, so configure with libslirp enabled (it is auto-detected, and silently absent otherwise):
./configure --target-list=aarch64-softmmu -Dslirp=enabled
qemu-system-aarch64 \
-m 4G \
-machine axiado-scm3003 \
-device loader,file=u-boot.bin,addr=0x3C000000,cpu-num=0 \
-nographic \
-serial null \
-serial null \
-serial null \
-serial mon:stdio \
-drive if=sd,file=obmc-phosphor-image-evk-axiado-qemu.wic,format=raw \
-netdev user,id=net4,hostfwd=tcp::2222-:22 \
-global axiado-hcp.netdev4=net4 \In the guest, bring the interface up with DHCP:
udhcpc -i eth0
Then from the host:
ssh -p 2222 [email protected]
With the unmodified vendor Linux driver, the guest:
- probes the HCP and brings eth0 up
- obtains an address over DHCP from the SLIRP backend
- resolves ARP and answers ping
- sustains an SSH session and completes an SCP transfer
Not modelled
------------
- EIP-197 cryptographic transforms. Descriptors are pass-through.
- PCS/SerDes behaviour. The guest configures these registers and never reads them back, so writes are accepted and discarded; the link is always reported up.
Changes since v1:
- Rebased onto current master to resolve merge conflicts in ax3000-soc.h.
- Removed an extra blank line in ax3000-soc.c.
- Replaced AX3000_HCP_IRQ_BASE with individual AX3000_HCP_*_IRQ definitions in ax3000-soc.h.
Ratan Lal Dondi (2):
hw/net: Add Axiado HCP network device model hw/arm: Wire up the HCP network complex in the AX3000 SoC
hw/arm/Kconfig | 1 + hw/arm/ax3000-soc.c | 31 + hw/net/Kconfig | 3 + hw/net/axiado_hcp.c | 1372 +++++++++++++++++++++++++++++++++++ hw/net/meson.build | 1 + hw/net/trace-events | 7 + include/hw/arm/ax3000-soc.h | 17 + include/hw/net/axiado_hcp.h | 172 +++++ 8 files changed, 1604 insertions(+) create mode 100644 hw/net/axiado_hcp.c create mode 100644 include/hw/net/axiado_hcp.h
Signature · 1 line
2.34.1
PATCH v2 1/2 hw/net: Add Axiado HCP network device model
The HCP is the network complex of the Axiado AX3000 SoC. It exposes three MMIO regions:
- EIP-197: an Inside Secure SafeXcel packet engine. It is the bus master for all packet I/O, driven by four command/result descriptor ring pairs (CDR/RDR). Packets are routed to and from one of five MACs by an "application ID" tag carried in the EIP-96 input and output tokens.
- SHIM: MAC configuration, per-MAC MDIO and statistics. Configuration only; no packet data flows through it.
- PHY CSR: PCS/SerDes configuration.
The EIP-197 cryptographic transforms are not modelled; descriptors are treated as pass-through, which is what the guest asks for when the block is used purely as a network interface.
The MACs are exposed as "netdev0" to "netdev4" and "mac0" to "mac4" properties, each with its own virtual PHY on that MAC's MDIO bus.
--- hw/net/Kconfig | 3 + hw/net/axiado_hcp.c | 1372 +++++++++++++++++++++++++++++++++++ hw/net/meson.build | 1 + hw/net/trace-events | 7 + include/hw/net/axiado_hcp.h | 172 +++++ 5 files changed, 1555 insertions(+) create mode 100644 hw/net/axiado_hcp.c create mode 100644 include/hw/net/axiado_hcp.h
hw/net/Kconfig +3 -0
@@ -162,3 +162,6 @@ config CAN_FLEXCAN bool depends on IMX_CCM select CAN_BUS + +config AXIADO_HCP + bool
hw/net/axiado_hcp.c new file +1372 -0
1,372 lines not on this page · raw message
hw/net/meson.build +1 -0
@@ -71,5 +71,6 @@ if have_hmp endif system_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2838_genet.c')) +system_ss.add(when: 'CONFIG_AXIADO_HCP', if_true: files('axiado_hcp.c')) subdir('can')
hw/net/trace-events +7 -0
@@ -529,6 +529,7 @@ xen_netdev_rx(int dev, int idx, int status, int flags) "vif%u idx %d status %d f ethlite_pkt_lost(uint32_t rx_ctrl) "rx_ctrl:0x%" PRIx32 ethlite_pkt_size_too_big(uint64_t size) "size:0x%" PRIx64 ethlite_pkt_tx_size_too_big(uint64_t size) "size:0x%" PRIx64 + # bcm2838_genet.c bcm2838_genet_read(unsigned int size, uint64_t offset, uint64_t value) "%u bytes @ 0x%04" PRIx64 ": 0x%016" PRIx64 bcm2838_genet_write(unsigned int size, uint64_t offset, uint64_t value) "%u bytes @ 0x%04" PRIx64 ": 0x%016" PRIx64
@@ -545,3 +546,9 @@ bcm2838_genet_tx_dma_ring_active(unsigned int ring, const char *ring_state) "rin bcm2838_genet_tx_request(unsigned int ring_idx, uint32_t prod_idx, uint32_t cons_idx) "ring %u, PROD_INDEX %u, CONS_INDEX %u" bcm2838_genet_tx(unsigned int ring_idx, uint64_t desc_idx, uint32_t desc_status, uint64_t data_addr) "ring %u, descriptor %" PRIu64 ": 0x%08x, data @ 0x%08" PRIx64 bcm2838_genet_rx_dma_ring_active(unsigned int ring, const char *ring_state) "ring %u is %s" + +# axiado_hcp.c +axiado_hcp_tx_packet(int ring, unsigned app_id, int mac, unsigned len) "ring %d app_id %u mac %d len %u" +axiado_hcp_tx_unroutable(int ring, unsigned app_id, unsigned len, uint64_t addr) "ring %d app_id %u len %u data 0x%" PRIx64 +axiado_hcp_rx_packet(int ring, int mac, size_t len) "ring %d mac %d len %zu" +axiado_hcp_rx_backpressure(int ring, unsigned slot) "ring %d slot %u"
include/hw/net/axiado_hcp.h new file +172 -0
172 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 2/2 hw/arm: Wire up the HCP network complex in the AX3000 SoC
In reply to Ratan Lal DondiInstantiate the Axiado HCP and map its three MMIO regions - the EIP-197 packet engine, the SHIM MAC configuration block and the PCS/SerDes CSR region - at the addresses the SoC uses.
Its ten interrupt lines are connected to the GIC in the order the guest
expects: one for the EIP-197 itself, four for the descriptor ring interfaces and five for the MACs.
--- hw/arm/Kconfig | 1 + hw/arm/ax3000-soc.c | 31 +++++++++++++++++++++++++++++++ include/hw/arm/ax3000-soc.h | 17 +++++++++++++++++ 3 files changed, 49 insertions(+)
hw/arm/Kconfig +1 -0
@@ -767,6 +767,7 @@ config AXIADO_SOC select AXIADO_CLK select CADENCE_GPIO select AXIADO_SDHCI + select AXIADO_HCP select UNIMP config AXIADO_EVK
hw/arm/ax3000-soc.c +31 -0
@@ -41,6 +41,9 @@ static void ax3000_init(Object *obj) g_autofree char *name = g_strdup_printf("gpio%d", i);object_initialize_child (obj, name, &s->gpio[i],TYPE_CADENCE_GPIO ); } + +object_initialize_child (obj,"hcp" , &s->hcp,TYPE_AXIADO_HCP ); + }static void ax3000_realize (DeviceState *dev,Error **errp)
@@ -49,6 +52,7 @@ static void ax3000_realize(DeviceState *dev, Error **errp)Ax3000SoCClass *sc =AX3000_SOC_GET_CLASS (s);SysBusDevice *gic_sbd =SYS_BUS_DEVICE (&s->gic);DeviceState *gic_dev =DEVICE (&s->gic); +SysBusDevice *hcp_sbd =SYS_BUS_DEVICE (&s->hcp);QList *redist_region_count;SysBusDevice *sdhci0_sbd;DeviceState *card;
@@ -217,6 +221,33 @@ static void ax3000_realize(DeviceState *dev, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpio[i]),0 ,qdev_get_gpio_in (gic_dev, gpio_table[i].irq)); } + +/* HCP */ +static const unsigned int hcp_irq_table[] = { +AX3000_HCP_EIP197_IRQ , +AX3000_HCP_RING0_IRQ , +AX3000_HCP_RING1_IRQ , +AX3000_HCP_RING2_IRQ , +AX3000_HCP_RING3_IRQ , +AX3000_HCP_MAC0_IRQ , +AX3000_HCP_MAC1_IRQ , +AX3000_HCP_MAC2_IRQ , +AX3000_HCP_MAC3_IRQ , +AX3000_HCP_MAC4_IRQ , + }; + +if (!sysbus_realize (SYS_BUS_DEVICE (&s->hcp), errp)) { +return ; + } + +sysbus_mmio_map (hcp_sbd,0 ,AX3000_HCP_EIP197_BASE ); +sysbus_mmio_map (hcp_sbd,1 ,AX3000_HCP_SHIM_BASE ); +sysbus_mmio_map (hcp_sbd,2 ,AX3000_HCP_PHY_CSR_BASE ); + +for (int i =0 ; i <HCP_NUM_IRQS ; i++) { +sysbus_connect_irq (hcp_sbd, i, +qdev_get_gpio_in (gic_dev, hcp_irq_table[i])); + } }static void ax3000_class_init (ObjectClass *oc,const void *data)
include/hw/arm/ax3000-soc.h +17 -0
@@ -15,6 +15,7 @@#include "hw/misc/axiado_clk.h" #include "hw/gpio/cadence_gpio.h" #include "hw/sd/axiado_sdhci.h" +#include "hw/net/axiado_hcp.h" #include "hw/core/sysbus.h" #include "qemu/units.h"
@@ -48,6 +49,10 @@ OBJECT_DECLARE_TYPE(Ax3000SoCState, Ax3000SoCClass, AX3000_SOC)#define AX3000_GPIO6_BASE 0x80800000#define AX3000_GPIO7_BASE 0x80880000 +#define AX3000_HCP_EIP197_BASE 0x83000000 +#define AX3000_HCP_SHIM_BASE 0x83100000 +#define AX3000_HCP_PHY_CSR_BASE 0x87000000 +#define AX3000_TIMER_CTRL 0x8A020000#define AX3000_PLL_BASE 0x80000000
@@ -69,6 +74,7 @@ typedef struct Ax3000SoCState {CadenceUARTState uart[AX3000_NUM_UARTS ];CadenceGPIOState gpio[AX3000_NUM_GPIOS ];AxiadoSDHCIState sdhci0; +AXIADOHCPState hcp; } Ax3000SoCState; typedef struct Ax3000SoCClass {
@@ -93,6 +99,17 @@ enum Ax3000Irqs {AX3000_GPIO5_IRQ =188 ,AX3000_GPIO6_IRQ =189 ,AX3000_GPIO7_IRQ =190 , + +AX3000_HCP_EIP197_IRQ =0 , +AX3000_HCP_RING0_IRQ =1 , +AX3000_HCP_RING1_IRQ =2 , +AX3000_HCP_RING2_IRQ =3 , +AX3000_HCP_RING3_IRQ =4 , +AX3000_HCP_MAC0_IRQ =5 , +AX3000_HCP_MAC1_IRQ =6 , +AX3000_HCP_MAC2_IRQ =7 , +AX3000_HCP_MAC3_IRQ =8 , + AX3000_HCP_MAC4_IRQ = 9, };#endif /* AXIADO_AX3000_H */
Signature · 1 line
2.34.1