Skip to content

Commit cb8278c

Browse files
committed
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200616' into staging
* hw: arm: Set vendor property for IMX SDHCI emulations * sd: sdhci: Implement basic vendor specific register support * hw/net/imx_fec: Convert debug fprintf() to trace events * target/arm/cpu: adjust virtual time for all KVM arm cpus * Implement configurable descriptor size in ftgmac100 * hw/misc/imx6ul_ccm: Implement non writable bits in CCM registers * target/arm: More Neon decodetree conversion work # gpg: Signature made Tue 16 Jun 2020 10:56:10 BST # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "[email protected]" # gpg: Good signature from "Peter Maydell <[email protected]>" [ultimate] # gpg: aka "Peter Maydell <[email protected]>" [ultimate] # gpg: aka "Peter Maydell <[email protected]>" [ultimate] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20200616: (23 commits) hw: arm: Set vendor property for IMX SDHCI emulations sd: sdhci: Implement basic vendor specific register support hw/net/imx_fec: Convert debug fprintf() to trace events target/arm/cpu: adjust virtual time for all KVM arm cpus Implement configurable descriptor size in ftgmac100 hw/misc/imx6ul_ccm: Implement non writable bits in CCM registers target/arm: Convert Neon VDUP (scalar) to decodetree target/arm: Convert Neon VTBL, VTBX to decodetree target/arm: Convert Neon VEXT to decodetree target/arm: Convert Neon 2-reg-scalar long multiplies to decodetree target/arm: Convert Neon 2-reg-scalar VQRDMLAH, VQRDMLSH to decodetree target/arm: Convert Neon 2-reg-scalar VQDMULH, VQRDMULH to decodetree target/arm: Convert Neon 2-reg-scalar float multiplies to decodetree target/arm: Convert Neon 2-reg-scalar integer multiplies to decodetree target/arm: Add missing TCG temp free in do_2shift_env_64() target/arm: Add 'static' and 'const' annotations to VSHLL function arrays target/arm: Convert Neon 3-reg-diff polynomial VMULL target/arm: Convert Neon 3-reg-diff saturating doubling multiplies target/arm: Convert Neon 3-reg-diff long multiplies target/arm: Convert Neon 3-reg-diff VABAL, VABDL to decodetree ... Signed-off-by: Peter Maydell <[email protected]> # Conflicts: # hw/arm/fsl-imx25.c # hw/arm/fsl-imx6.c # hw/arm/fsl-imx6ul.c # hw/arm/fsl-imx7.c
2 parents 6675a65 + 64b3974 commit cb8278c

File tree

18 files changed

+1495
-766
lines changed

18 files changed

+1495
-766
lines changed

hw/arm/fsl-imx25.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
263263
&err);
264264
object_property_set_uint(OBJECT(&s->esdhc[i]), IMX25_ESDHC_CAPABILITIES,
265265
"capareg", &err);
266+
object_property_set_uint(OBJECT(&s->esdhc[i]), SDHCI_VENDOR_IMX,
267+
"vendor", &err);
268+
if (err) {
269+
error_propagate(errp, err);
270+
return;
271+
}
266272
sysbus_realize(SYS_BUS_DEVICE(&s->esdhc[i]), &err);
267273
if (err) {
268274
error_propagate(errp, err);

hw/arm/fsl-imx6.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,12 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
339339
&err);
340340
object_property_set_uint(OBJECT(&s->esdhc[i]), IMX6_ESDHC_CAPABILITIES,
341341
"capareg", &err);
342+
object_property_set_uint(OBJECT(&s->esdhc[i]), SDHCI_VENDOR_IMX,
343+
"vendor", &err);
344+
if (err) {
345+
error_propagate(errp, err);
346+
return;
347+
}
342348
sysbus_realize(SYS_BUS_DEVICE(&s->esdhc[i]), &err);
343349
if (err) {
344350
error_propagate(errp, err);

hw/arm/fsl-imx6ul.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
479479
FSL_IMX6UL_USDHC2_IRQ,
480480
};
481481

482+
object_property_set_uint(OBJECT(&s->usdhc[i]), SDHCI_VENDOR_IMX,
483+
"vendor", &error_abort);
482484
sysbus_realize(SYS_BUS_DEVICE(&s->usdhc[i]), &error_abort);
483485

484486
sysbus_mmio_map(SYS_BUS_DEVICE(&s->usdhc[i]), 0,

hw/arm/fsl-imx7.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
393393
FSL_IMX7_USDHC3_IRQ,
394394
};
395395

396+
object_property_set_uint(OBJECT(&s->usdhc[i]), SDHCI_VENDOR_IMX,
397+
"vendor", &error_abort);
396398
sysbus_realize(SYS_BUS_DEVICE(&s->usdhc[i]), &error_abort);
397399

398400
sysbus_mmio_map(SYS_BUS_DEVICE(&s->usdhc[i]), 0,

hw/misc/imx6ul_ccm.c

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,62 @@
1919

2020
#include "trace.h"
2121

22+
static const uint32_t ccm_mask[CCM_MAX] = {
23+
[CCM_CCR] = 0xf01fef80,
24+
[CCM_CCDR] = 0xfffeffff,
25+
[CCM_CSR] = 0xffffffff,
26+
[CCM_CCSR] = 0xfffffef2,
27+
[CCM_CACRR] = 0xfffffff8,
28+
[CCM_CBCDR] = 0xc1f8e000,
29+
[CCM_CBCMR] = 0xfc03cfff,
30+
[CCM_CSCMR1] = 0x80700000,
31+
[CCM_CSCMR2] = 0xe01ff003,
32+
[CCM_CSCDR1] = 0xfe00c780,
33+
[CCM_CS1CDR] = 0xfe00fe00,
34+
[CCM_CS2CDR] = 0xf8007000,
35+
[CCM_CDCDR] = 0xf00fffff,
36+
[CCM_CHSCCDR] = 0xfffc01ff,
37+
[CCM_CSCDR2] = 0xfe0001ff,
38+
[CCM_CSCDR3] = 0xffffc1ff,
39+
[CCM_CDHIPR] = 0xffffffff,
40+
[CCM_CTOR] = 0x00000000,
41+
[CCM_CLPCR] = 0xf39ff01c,
42+
[CCM_CISR] = 0xfb85ffbe,
43+
[CCM_CIMR] = 0xfb85ffbf,
44+
[CCM_CCOSR] = 0xfe00fe00,
45+
[CCM_CGPR] = 0xfffc3fea,
46+
[CCM_CCGR0] = 0x00000000,
47+
[CCM_CCGR1] = 0x00000000,
48+
[CCM_CCGR2] = 0x00000000,
49+
[CCM_CCGR3] = 0x00000000,
50+
[CCM_CCGR4] = 0x00000000,
51+
[CCM_CCGR5] = 0x00000000,
52+
[CCM_CCGR6] = 0x00000000,
53+
[CCM_CMEOR] = 0xafffff1f,
54+
};
55+
56+
static const uint32_t analog_mask[CCM_ANALOG_MAX] = {
57+
[CCM_ANALOG_PLL_ARM] = 0xfff60f80,
58+
[CCM_ANALOG_PLL_USB1] = 0xfffe0fbc,
59+
[CCM_ANALOG_PLL_USB2] = 0xfffe0fbc,
60+
[CCM_ANALOG_PLL_SYS] = 0xfffa0ffe,
61+
[CCM_ANALOG_PLL_SYS_SS] = 0x00000000,
62+
[CCM_ANALOG_PLL_SYS_NUM] = 0xc0000000,
63+
[CCM_ANALOG_PLL_SYS_DENOM] = 0xc0000000,
64+
[CCM_ANALOG_PLL_AUDIO] = 0xffe20f80,
65+
[CCM_ANALOG_PLL_AUDIO_NUM] = 0xc0000000,
66+
[CCM_ANALOG_PLL_AUDIO_DENOM] = 0xc0000000,
67+
[CCM_ANALOG_PLL_VIDEO] = 0xffe20f80,
68+
[CCM_ANALOG_PLL_VIDEO_NUM] = 0xc0000000,
69+
[CCM_ANALOG_PLL_VIDEO_DENOM] = 0xc0000000,
70+
[CCM_ANALOG_PLL_ENET] = 0xffc20ff0,
71+
[CCM_ANALOG_PFD_480] = 0x40404040,
72+
[CCM_ANALOG_PFD_528] = 0x40404040,
73+
[PMU_MISC0] = 0x01fe8306,
74+
[PMU_MISC1] = 0x07fcede0,
75+
[PMU_MISC2] = 0x005f5f5f,
76+
};
77+
2278
static const char *imx6ul_ccm_reg_name(uint32_t reg)
2379
{
2480
static char unknown[20];
@@ -596,11 +652,8 @@ static void imx6ul_ccm_write(void *opaque, hwaddr offset, uint64_t value,
596652

597653
trace_ccm_write_reg(imx6ul_ccm_reg_name(index), (uint32_t)value);
598654

599-
/*
600-
* We will do a better implementation later. In particular some bits
601-
* cannot be written to.
602-
*/
603-
s->ccm[index] = (uint32_t)value;
655+
s->ccm[index] = (s->ccm[index] & ccm_mask[index]) |
656+
((uint32_t)value & ~ccm_mask[index]);
604657
}
605658

606659
static uint64_t imx6ul_analog_read(void *opaque, hwaddr offset, unsigned size)
@@ -737,7 +790,7 @@ static void imx6ul_analog_write(void *opaque, hwaddr offset, uint64_t value,
737790
* the REG_NAME register. So we change the value of the
738791
* REG_NAME register, setting bits passed in the value.
739792
*/
740-
s->analog[index - 1] |= value;
793+
s->analog[index - 1] |= (value & ~analog_mask[index - 1]);
741794
break;
742795
case CCM_ANALOG_PLL_ARM_CLR:
743796
case CCM_ANALOG_PLL_USB1_CLR:
@@ -762,7 +815,7 @@ static void imx6ul_analog_write(void *opaque, hwaddr offset, uint64_t value,
762815
* the REG_NAME register. So we change the value of the
763816
* REG_NAME register, unsetting bits passed in the value.
764817
*/
765-
s->analog[index - 2] &= ~value;
818+
s->analog[index - 2] &= ~(value & ~analog_mask[index - 2]);
766819
break;
767820
case CCM_ANALOG_PLL_ARM_TOG:
768821
case CCM_ANALOG_PLL_USB1_TOG:
@@ -787,14 +840,11 @@ static void imx6ul_analog_write(void *opaque, hwaddr offset, uint64_t value,
787840
* the REG_NAME register. So we change the value of the
788841
* REG_NAME register, toggling bits passed in the value.
789842
*/
790-
s->analog[index - 3] ^= value;
843+
s->analog[index - 3] ^= (value & ~analog_mask[index - 3]);
791844
break;
792845
default:
793-
/*
794-
* We will do a better implementation later. In particular some bits
795-
* cannot be written to.
796-
*/
797-
s->analog[index] = value;
846+
s->analog[index] = (s->analog[index] & analog_mask[index]) |
847+
(value & ~analog_mask[index]);
798848
break;
799849
}
800850
}

hw/net/ftgmac100.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@
7979
#define FTGMAC100_APTC_TXPOLL_CNT(x) (((x) >> 8) & 0xf)
8080
#define FTGMAC100_APTC_TXPOLL_TIME_SEL (1 << 12)
8181

82+
/*
83+
* DMA burst length and arbitration control register
84+
*/
85+
#define FTGMAC100_DBLAC_RXBURST_SIZE(x) (((x) >> 8) & 0x3)
86+
#define FTGMAC100_DBLAC_TXBURST_SIZE(x) (((x) >> 10) & 0x3)
87+
#define FTGMAC100_DBLAC_RXDES_SIZE(x) ((((x) >> 12) & 0xf) * 8)
88+
#define FTGMAC100_DBLAC_TXDES_SIZE(x) ((((x) >> 16) & 0xf) * 8)
89+
#define FTGMAC100_DBLAC_IFG_CNT(x) (((x) >> 20) & 0x7)
90+
#define FTGMAC100_DBLAC_IFG_INC (1 << 23)
91+
8292
/*
8393
* PHY control register
8494
*/
@@ -553,7 +563,7 @@ static void ftgmac100_do_tx(FTGMAC100State *s, uint32_t tx_ring,
553563
if (bd.des0 & s->txdes0_edotr) {
554564
addr = tx_ring;
555565
} else {
556-
addr += sizeof(FTGMAC100Desc);
566+
addr += FTGMAC100_DBLAC_TXDES_SIZE(s->dblac);
557567
}
558568
}
559569

@@ -800,6 +810,18 @@ static void ftgmac100_write(void *opaque, hwaddr addr,
800810
s->phydata = value & 0xffff;
801811
break;
802812
case FTGMAC100_DBLAC: /* DMA Burst Length and Arbitration Control */
813+
if (FTGMAC100_DBLAC_TXDES_SIZE(s->dblac) < sizeof(FTGMAC100Desc)) {
814+
qemu_log_mask(LOG_GUEST_ERROR,
815+
"%s: transmit descriptor too small : %d bytes\n",
816+
__func__, FTGMAC100_DBLAC_TXDES_SIZE(s->dblac));
817+
break;
818+
}
819+
if (FTGMAC100_DBLAC_RXDES_SIZE(s->dblac) < sizeof(FTGMAC100Desc)) {
820+
qemu_log_mask(LOG_GUEST_ERROR,
821+
"%s: receive descriptor too small : %d bytes\n",
822+
__func__, FTGMAC100_DBLAC_RXDES_SIZE(s->dblac));
823+
break;
824+
}
803825
s->dblac = value;
804826
break;
805827
case FTGMAC100_REVR: /* Feature Register */
@@ -982,7 +1004,7 @@ static ssize_t ftgmac100_receive(NetClientState *nc, const uint8_t *buf,
9821004
if (bd.des0 & s->rxdes0_edorr) {
9831005
addr = s->rx_ring;
9841006
} else {
985-
addr += sizeof(FTGMAC100Desc);
1007+
addr += FTGMAC100_DBLAC_RXDES_SIZE(s->dblac);
9861008
}
9871009
}
9881010
s->rx_descriptor = addr;

0 commit comments

Comments
 (0)