qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

net/ftgmac100: add a 'aspeed' property

The Aspeed SoCs have a different definition of the end of the ring
buffer bit. Add a property to specify which set of bits should be used
by the NIC.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>

authored by

Cédric Le Goater and committed by
Jason Wang
1335fe3e bd44300d

+19 -2
+15 -2
hw/net/ftgmac100.c
··· 126 126 #define FTGMAC100_TXDES0_CRC_ERR (1 << 19) 127 127 #define FTGMAC100_TXDES0_LTS (1 << 28) 128 128 #define FTGMAC100_TXDES0_FTS (1 << 29) 129 + #define FTGMAC100_TXDES0_EDOTR_ASPEED (1 << 30) 129 130 #define FTGMAC100_TXDES0_TXDMA_OWN (1 << 31) 130 131 131 132 #define FTGMAC100_TXDES1_VLANTAG_CI(x) ((x) & 0xffff) ··· 154 155 #define FTGMAC100_RXDES0_PAUSE_FRAME (1 << 25) 155 156 #define FTGMAC100_RXDES0_LRS (1 << 28) 156 157 #define FTGMAC100_RXDES0_FRS (1 << 29) 158 + #define FTGMAC100_RXDES0_EDORR_ASPEED (1 << 30) 157 159 #define FTGMAC100_RXDES0_RXPKT_RDY (1 << 31) 158 160 159 161 #define FTGMAC100_RXDES1_VLANTAG_CI 0xffff ··· 462 464 /* Write back the modified descriptor. */ 463 465 ftgmac100_write_bd(&bd, addr); 464 466 /* Advance to the next descriptor. */ 465 - if (bd.des0 & FTGMAC100_TXDES0_EDOTR) { 467 + if (bd.des0 & s->txdes0_edotr) { 466 468 addr = tx_ring; 467 469 } else { 468 470 addr += sizeof(FTGMAC100Desc); ··· 880 882 s->isr |= FTGMAC100_INT_RPKT_FIFO; 881 883 } 882 884 ftgmac100_write_bd(&bd, addr); 883 - if (bd.des0 & FTGMAC100_RXDES0_EDORR) { 885 + if (bd.des0 & s->rxdes0_edorr) { 884 886 addr = s->rx_ring; 885 887 } else { 886 888 addr += sizeof(FTGMAC100Desc); ··· 921 923 FTGMAC100State *s = FTGMAC100(dev); 922 924 SysBusDevice *sbd = SYS_BUS_DEVICE(dev); 923 925 926 + if (s->aspeed) { 927 + s->txdes0_edotr = FTGMAC100_TXDES0_EDOTR_ASPEED; 928 + s->rxdes0_edorr = FTGMAC100_RXDES0_EDORR_ASPEED; 929 + } else { 930 + s->txdes0_edotr = FTGMAC100_TXDES0_EDOTR; 931 + s->rxdes0_edorr = FTGMAC100_RXDES0_EDORR; 932 + } 933 + 924 934 memory_region_init_io(&s->iomem, OBJECT(dev), &ftgmac100_ops, s, 925 935 TYPE_FTGMAC100, 0x2000); 926 936 sysbus_init_mmio(sbd, &s->iomem); ··· 967 977 VMSTATE_UINT32(phy_advertise, FTGMAC100State), 968 978 VMSTATE_UINT32(phy_int, FTGMAC100State), 969 979 VMSTATE_UINT32(phy_int_mask, FTGMAC100State), 980 + VMSTATE_UINT32(txdes0_edotr, FTGMAC100State), 981 + VMSTATE_UINT32(rxdes0_edorr, FTGMAC100State), 970 982 VMSTATE_END_OF_LIST() 971 983 } 972 984 }; 973 985 974 986 static Property ftgmac100_properties[] = { 987 + DEFINE_PROP_BOOL("aspeed", FTGMAC100State, aspeed, false), 975 988 DEFINE_NIC_PROPERTIES(FTGMAC100State, conf), 976 989 DEFINE_PROP_END_OF_LIST(), 977 990 };
+4
include/hw/net/ftgmac100.h
··· 55 55 uint32_t phy_advertise; 56 56 uint32_t phy_int; 57 57 uint32_t phy_int_mask; 58 + 59 + bool aspeed; 60 + uint32_t txdes0_edotr; 61 + uint32_t rxdes0_edorr; 58 62 } FTGMAC100State; 59 63 60 64 #endif