target-arm queue
Here's the target-arm queue; first pullreq since 1.7 went out. Please pull. (I expect I'll do another pullreq in a week or two which will have AArch64 KVM control and most of the A64 decoder changes in it...)
thanks
--PMM
The following changes since commit 8f84271da83c0e9f92aa7c1c2d0d3875bf0a5cb8:
target-mips: Use macro ARRAY_SIZE where possible (2013-12-09 16:44:04 +0100)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20131210
for you to fetch changes up to 74f1c6ddec8dc7566d9b75574bb006214cc7d3b4:
target-arm: fix TTBCR write masking (2013-12-10 13:28:50 +0000)
----------------------------------------------------------------
target-arm queue:
* support REFCNT register on integrator/cp board
* implement the A9MP's global timer
* add the 'virt' platform
* support '-cpu host' on KVM/ARM
* Cadence GEM ethernet device bugfixes
* Implement 32-bit ARMv8 VSEL, VMAXNM, VMINNM
* fix TTBCR write masking
* update 32 bit decoder to use new qemu_ld/st TCG opcodes
----------------------------------------------------------------
Edgar E. Iglesias (1):
net/cadence_gem: Update DMA rx descriptors as we process them
François LEGAL (1):
cpu/a9mpcore: Add Global Timer
Jan Petrous (1):
integrator/cp: add support for REFCNT register
John Rigby (1):
hw/arm/boot: Allow boards to provide an fdt blob
Peter Crosthwaite (16):
cpu/a9mpcore: rename timerbusdev variable cpu/a9mpcore: reorder operations/declarations hw/timer: Introduce ARM A9 Global Timer. net/cadence_gem: Implement mac level loopback mode net/cadence_gem: Don't assert against 0 buffer address net/cadence_gem: simplify rx buf descriptor walking net/cadence_gem: Prefetch rx descriptors ASAP net/cadence_gem: Implement RX descriptor match mode flags net/cadence_gem: Implement SAR match bit in rx desc net/cadence_gem: Implement SAR (de)activation net/cadence_gem: Add missing VMSTATE_END_OF_LIST net/cadence_gem: Fix rx multi-fragment packets net/cadence_gem: Fix small packet FCS stripping net/cadence_gem: Fix register w1c logic net/cadence_gem: Improve can_receive debug printfery net/cadence_gem: Don't rx packets when no rx buffer available
Peter Maydell (9):
target-arm: Provide mechanism for getting KVM constants even if not CONFIG_KVM device_tree.c: Terminate the empty reservemap in create_device_tree()
target-arm: Provide PSCI constants to generic QEMU code
target-arm: Add ARMCPU field for Linux device-tree 'compatible' string
target-arm: Allow secondary KVM CPUs to be booted via PSCI hw/arm: Add 'virt' platform
target-arm: Don't hardcode KVM target CPU to be A15
target-arm: Provide '-cpu host' when running KVM
hw/arm/virt: Support -cpu host
Richard Henderson (1):
target-arm: Use new qemu_ld/st opcodes
Sergey Fedorov (1):
target-arm: fix TTBCR write masking
Will Newton (6):
target-arm: Move call to disas_vfp_insn out of disas_coproc_insn.
target-arm: Implement ARMv8 VSEL instruction.
softfloat: Remove unused argument from MINMAX macro.
softfloat: Add minNum() and maxNum() functions to softfloat.
target-arm: Implement ARMv8 FP VMAXNM and VMINNM instructions.
target-arm: Implement ARMv8 SIMD VMAXNM and VMINNM instructions.
default-configs/arm-softmmu.mak | 1 + device_tree.c | 4 + fpu/softfloat.c | 38 +++- hw/arm/Makefile.objs | 2 +- hw/arm/boot.c | 32 +-- hw/arm/integratorcp.c | 13 +- hw/arm/virt.c | 452 ++++++++++++++++++++++++++++++++++++++++ hw/cpu/a9mpcore.c | 44 ++-- hw/net/cadence_gem.c | 278 +++++++++++++++--------- hw/timer/Makefile.objs | 1 + hw/timer/a9gtimer.c | 369 ++++++++++++++++++++++++++++++++ include/fpu/softfloat.h | 4 + include/hw/arm/arm.h | 7 + include/hw/cpu/a9mpcore.h | 4 +- include/hw/timer/a9gtimer.h | 97 +++++++++ target-arm/cpu-qom.h | 11 + target-arm/cpu.c | 59 ++++++ target-arm/cpu.h | 13 +- target-arm/helper.c | 33 ++- target-arm/helper.h | 5 + target-arm/kvm-consts.h | 64 ++++++ target-arm/kvm.c | 243 ++++++++++++++++++++- target-arm/kvm_arm.h | 55 +++++ target-arm/translate.c | 302 +++++++++++++++++++++++---- 24 files changed, 1926 insertions(+), 205 deletions(-) create mode 100644 hw/arm/virt.c create mode 100644 hw/timer/a9gtimer.c create mode 100644 include/hw/timer/a9gtimer.h create mode 100644 target-arm/kvm-consts.h
[Qemu-devel] [PULL 02/37] cpu/a9mpcore: rename timerbusdev variable
From: Peter Crosthwaite <[email protected]>
Rename this variable for consistency with the above defined mptimerdev variable.
Message-id: 28939ef95589a62414634e86c47cef76b21b15f7.1385969450.git.peter.crosthwaite@xilinx.com
--- hw/cpu/a9mpcore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/cpu/a9mpcore.c +4 -4
@@ -42,7 +42,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)SysBusDevice *sbd =SYS_BUS_DEVICE (dev);A9MPPrivState *s =A9MPCORE_PRIV (dev);DeviceState *gicdev, *scudev, *mptimerdev, *wdtdev; -SysBusDevice *timerbusdev, *wdtbusdev, *gicbusdev, *scubusdev; +SysBusDevice *mptimerbusdev, *wdtbusdev, *gicbusdev, *scubusdev;Error *err =NULL ;int i;
@@ -78,7 +78,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)error_propagate (errp, err);return ; } - timerbusdev =SYS_BUS_DEVICE (&s->mptimer); + mptimerbusdev =SYS_BUS_DEVICE (&s->mptimer); wdtdev =DEVICE (&s->wdt);qdev_prop_set_uint32 (wdtdev,"num-cpu" , s->num_cpu);
@@ -109,7 +109,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)* memory region, not the "timer/watchdog for core X" ones 11MPcore has. */ memory_region_add_subregion (&s->container,0x600 , -sysbus_mmio_get_region (timerbusdev,0 )); +sysbus_mmio_get_region (mptimerbusdev,0 ));memory_region_add_subregion (&s->container,0x620 ,sysbus_mmio_get_region (wdtbusdev,0 )); memory_region_add_subregion(&s->container, 0x1000,
@@ -120,7 +120,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)*/ for (i =0 ; i < s->num_cpu; i++) {int ppibase = (s->num_irq -32 ) + i *32 ; -sysbus_connect_irq (timerbusdev, i, +sysbus_connect_irq (mptimerbusdev, i,qdev_get_gpio_in (gicdev, ppibase +29 ));sysbus_connect_irq (wdtbusdev, i,qdev_get_gpio_in (gicdev, ppibase +30 ));
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 16/37] net/cadence_gem: Implement mac level loopback mode
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
Cadence GEM has a MAC level loopback mode. Implement. Use the same basic operation as the already implemented PHY loopback.
Message-id: 3a0baf1b6b2fc1be638bdf1a37408ec38988e970.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/cadence_gem.c +1 -1
@@ -893,7 +893,7 @@ static void gem_transmit(GemState *s)gem_transmit_updatestats (s, tx_packet, total_bytes);/* Send the packet somewhere */ -if (s->phy_loop) { +if (s->phy_loop || (s->regs[GEM_NWCTRL ] &GEM_NWCTRL_LOCALLOOP )) {gem_receive (qemu_get_queue (s->nic), tx_packet, total_bytes); }else { qemu_send_packet(qemu_get_queue(s->nic), tx_packet,
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 17/37] net/cadence_gem: Update DMA rx descriptors as we process them
In reply to Peter MaydellFrom: "Edgar E. Iglesias" <[email protected]>
We were updating the ownership bit of all descriptors if packets get split and written through several descriptors.
Message-id: d61b7847b51487118783c93765a485bc5c66d272.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
hw/net/cadence_gem.c +16 -17
@@ -592,6 +592,7 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)unsigned rxbuf_offset;uint8_t rxbuf[2048 ];uint8_t *rxbuf_ptr; +bool first_desc = true; s =qemu_get_nic_opaque (nc);
@@ -701,6 +702,21 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) rxbuf_ptr, MIN(bytes_to_copy, rxbufsize)); bytes_to_copy -=MIN (bytes_to_copy, rxbufsize); rxbuf_ptr +=MIN (bytes_to_copy, rxbufsize); + +/* Update the descriptor. */ +if (first_desc) { +rx_desc_set_sof (desc); + first_desc = false; + } +if (bytes_to_copy ==0 ) { +rx_desc_set_eof (desc); +rx_desc_set_length (desc, size); + } +rx_desc_set_ownership (desc); +/* Descriptor write-back. */ +cpu_physical_memory_write (packet_desc_addr, + (uint8_t *)&desc[0 ],sizeof (desc)); +if (bytes_to_copy ==0 ) {break ; }
@@ -716,12 +732,6 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)DB_PRINT ("set length: %ld, EOF on descriptor 0x%x\n" , size, (unsigned )packet_desc_addr); -/* Update last descriptor with EOF and total length */ -rx_desc_set_eof (desc); -rx_desc_set_length (desc, size); -cpu_physical_memory_write (packet_desc_addr, - (uint8_t *)&desc[0 ],sizeof (desc)); -/* Advance RX packet descriptor Q */ last_desc_addr = packet_desc_addr; packet_desc_addr = s->rx_desc_addr;
@@ -734,20 +744,9 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) s->rx_desc_addr +=8 ; } -DB_PRINT ("set SOF, OWN on descriptor 0x%08x\n" , (unsigned )packet_desc_addr); -/* Count it */ gem_receive_updatestats (s, buf, size); -/* Update first descriptor (which could also be the last) */ -/* read descriptor */ -cpu_physical_memory_read (packet_desc_addr, - (uint8_t *)&desc[0 ],sizeof (desc)); -rx_desc_set_sof (desc); -rx_desc_set_ownership (desc); -cpu_physical_memory_write (packet_desc_addr, - (uint8_t *)&desc[0 ],sizeof (desc)); - s->regs[GEM_RXSTATUS ] |=GEM_RXSTATUS_FRMRCVD ; s->regs[GEM_ISR ] |=GEM_INT_RXCMPL & ~(s->regs[GEM_IMR ]);
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 36/37] target-arm: Use new qemu_ld/st opcodes
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Retain the existing gen_aa32_* inlines, to aid compilation for A64.
Message-id: [email protected]
--- target-arm/translate.c | 56 ++++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 31 deletions(-)
target-arm/translate.c +25 -31
@@ -825,63 +825,57 @@ static inline void store_reg_from_load(CPUARMState *env, DisasContext *s,* extended if we're a 64 bit core) and data is also * 32 bits unless specifically doing a 64 bit access. * These functions work like tcg_gen_qemu_{ld,st}* except -* that their arguments are TCGv_i32 rather than TCGv. +* that the address argument is TCGv_i32 rather than TCGv. */ #if TARGET_LONG_BITS ==32 -#define DO_GEN_LD (OP ) \ -static inline void gen_aa32_##OP(TCGv_i32 val, TCGv_i32 addr, int index) \ +#define DO_GEN_LD (SUFF ,OPC ) \ +static inline void gen_aa32_ld##SUFF(TCGv_i32 val, TCGv_i32 addr, int index) \ { \ - tcg_gen_qemu_##OP(val, addr, index); \ + tcg_gen_qemu_ld_i32(val, addr, index, OPC); \ } -#define DO_GEN_ST (OP ) \ -static inline void gen_aa32_##OP(TCGv_i32 val, TCGv_i32 addr, int index) \ +#define DO_GEN_ST (SUFF ,OPC ) \ +static inline void gen_aa32_st##SUFF(TCGv_i32 val, TCGv_i32 addr, int index) \ { \ - tcg_gen_qemu_##OP(val, addr, index); \ + tcg_gen_qemu_st_i32(val, addr, index, OPC); \ }static inline void gen_aa32_ld64 (TCGv_i64 val,TCGv_i32 addr,int index) { -tcg_gen_qemu_ld64 (val, addr, index); +tcg_gen_qemu_ld_i64 (val, addr, index,MO_TEQ ); }static inline void gen_aa32_st64 (TCGv_i64 val,TCGv_i32 addr,int index) { -tcg_gen_qemu_st64 (val, addr, index); +tcg_gen_qemu_st_i64 (val, addr, index,MO_TEQ ); }#else -#define DO_GEN_LD (OP ) \ -static inline void gen_aa32_##OP(TCGv_i32 val, TCGv_i32 addr, int index) \ +#define DO_GEN_LD (SUFF ,OPC ) \ +static inline void gen_aa32_ld##SUFF(TCGv_i32 val, TCGv_i32 addr, int index) \ { \ TCGv addr64 = tcg_temp_new(); \ - TCGv val64 = tcg_temp_new(); \ tcg_gen_extu_i32_i64(addr64, addr); \ - tcg_gen_qemu_##OP(val64, addr64, index); \ + tcg_gen_qemu_ld_i32(val, addr64, index, OPC); \ tcg_temp_free(addr64); \ - tcg_gen_trunc_i64_i32(val, val64); \ - tcg_temp_free(val64); \ } -#define DO_GEN_ST (OP ) \ -static inline void gen_aa32_##OP(TCGv_i32 val, TCGv_i32 addr, int index) \ +#define DO_GEN_ST (SUFF ,OPC ) \ +static inline void gen_aa32_st##SUFF(TCGv_i32 val, TCGv_i32 addr, int index) \ { \ TCGv addr64 = tcg_temp_new(); \ - TCGv val64 = tcg_temp_new(); \ tcg_gen_extu_i32_i64(addr64, addr); \ - tcg_gen_extu_i32_i64(val64, val); \ - tcg_gen_qemu_##OP(val64, addr64, index); \ + tcg_gen_qemu_st_i32(val, addr64, index, OPC); \ tcg_temp_free(addr64); \ - tcg_temp_free(val64); \ }static inline void gen_aa32_ld64 (TCGv_i64 val,TCGv_i32 addr,int index) {TCGv addr64 =tcg_temp_new ();tcg_gen_extu_i32_i64 (addr64, addr); -tcg_gen_qemu_ld64 (val, addr64, index); +tcg_gen_qemu_ld_i64 (val, addr64, index,MO_TEQ );tcg_temp_free (addr64); }
@@ -889,20 +883,20 @@ static inline void gen_aa32_st64(TCGv_i64 val, TCGv_i32 addr, int index) {TCGv addr64 =tcg_temp_new ();tcg_gen_extu_i32_i64 (addr64, addr); -tcg_gen_qemu_st64 (val, addr64, index); +tcg_gen_qemu_st_i64 (val, addr64, index,MO_TEQ );tcg_temp_free (addr64); }#endif -DO_GEN_LD (ld8s) -DO_GEN_LD (ld8u ) -DO_GEN_LD (ld16s) -DO_GEN_LD (ld16u) -DO_GEN_LD (ld32u) -DO_GEN_ST (st8) -DO_GEN_ST (st16) -DO_GEN_ST (st32) +DO_GEN_LD(8s, MO_SB) +DO_GEN_LD(8u, MO_UB) +DO_GEN_LD(16s, MO_TESW) +DO_GEN_LD(16u, MO_TEUW) +DO_GEN_LD(32u, MO_TEUL) +DO_GEN_ST(8, MO_UB) +DO_GEN_ST(16, MO_TEUW) +DO_GEN_ST(32, MO_TEUL)static inline void gen_set_pc_im (DisasContext *s,target_ulong val) {
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 32/37] softfloat: Remove unused argument from MINMAX macro.
In reply to Peter MaydellFrom: Will Newton <[email protected]>
The nan_exp argument is not used, so remove it.
Message-id: [email protected]
--- fpu/softfloat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fpu/softfloat.c +3 -3
@@ -6706,7 +6706,7 @@ int float128_compare_quiet( float128 a, float128 b STATUS_PARAM )* 'compare and pick one input' because that would mishandle * NaNs and +0 vs -0. */ -#define MINMAX (s, nan_exp) \ +#define MINMAX (s) \ INLINE float ## s float ## s ## _minmax(float ## s a, float ## s b, \ int ismin STATUS_PARAM ) \ { \
@@ -6747,8 +6747,8 @@ float ## s float ## s ## _max(float ## s a, float ## s b STATUS_PARAM) \ return float ## s ## _minmax(a, b, 0 STATUS_VAR); \ } -MINMAX(32, 0xff) -MINMAX (64 ,0x7ff ) +MINMAX(32) +MINMAX (64 )/* Multiply A by 2 raised to the power N. */
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 33/37] softfloat: Add minNum() and maxNum() functions to softfloat.
In reply to Peter MaydellFrom: Will Newton <[email protected]>
Add floatnn_minnum() and floatnn_maxnum() functions which are equivalent to the minNum() and maxNum() functions from IEEE 754-2008. They are similar to min() and max() but differ in the handling of QNaN arguments.
Message-id: [email protected]
--- fpu/softfloat.c | 32 +++++++++++++++++++++++++++++--- include/fpu/softfloat.h | 4 ++++ 2 files changed, 33 insertions(+), 3 deletions(-)
fpu/softfloat.c +29 -3
@@ -6705,10 +6705,17 @@ int float128_compare_quiet( float128 a, float128 b STATUS_PARAM )/* min() and max() functions. These can't be implemented as * 'compare and pick one input' because that would mishandle * NaNs and +0 vs -0. +* +* minnum() and maxnum() functions. These are similar to the min() +* and max() functions but if one of the arguments is a QNaN and +* the other is numerical then the numerical argument is returned. +* minnum() and maxnum correspond to the IEEE 754-2008 minNum() +* and maxNum() operations. min() and max() are the typical min/max +* semantics provided by many CPUs which predate that specification. */ #define MINMAX (s) \ INLINE float ## s float ## s ## _minmax(float ## s a, float ## s b, \ - int ismin STATUS_PARAM ) \ + int ismin, int isieee STATUS_PARAM) \ { \ flag aSign, bSign; \ uint ## s ## _t av, bv; \
@@ -6716,6 +6723,15 @@ INLINE float ## s float ## s ## _minmax(float ## s a, float ## s b, \ b = float ## s ## _squash_input_denormal(b STATUS_VAR); \ if (float ## s ## _is_any_nan(a) || \ float ## s ## _is_any_nan(b)) { \ + if (isieee) { \ + if (float ## s ## _is_quiet_nan(a) && \ + !float ## s ##_is_any_nan(b)) { \ + return b; \ + } else if (float ## s ## _is_quiet_nan(b) && \ + !float ## s ## _is_any_nan(a)) { \ + return a; \ + } \ + } \ return propagateFloat ## s ## NaN(a, b STATUS_VAR); \ } \ aSign = extractFloat ## s ## Sign(a); \
@@ -6739,12 +6755,22 @@ INLINE float ## s float ## s ## _minmax(float ## s a, float ## s b, \ \ float ## s float ## s ## _min(float ## s a, float ## s b STATUS_PARAM) \ { \ - return float ## s ## _minmax(a, b, 1 STATUS_VAR); \ + return float ## s ## _minmax(a, b, 1, 0 STATUS_VAR); \ } \ \ float ## s float ## s ## _max(float ## s a, float ## s b STATUS_PARAM) \ { \ - return float ## s ## _minmax(a, b, 0 STATUS_VAR); \ + return float ## s ## _minmax(a, b, 0, 0 STATUS_VAR); \ +} \ + \ +float ## s float ## s ## _minnum(float ## s a, float ## s b STATUS_PARAM) \ +{ \ + return float ## s ## _minmax(a, b, 1, 1 STATUS_VAR); \ +} \ + \ +float ## s float ## s ## _maxnum(float ## s a, float ## s b STATUS_PARAM) \ +{ \ + return float ## s ## _minmax(a, b, 0, 1 STATUS_VAR); \ }MINMAX (32 )
include/fpu/softfloat.h +4 -0
@@ -302,6 +302,8 @@ int float32_compare( float32, float32 STATUS_PARAM );int float32_compare_quiet (float32 ,float32 STATUS_PARAM );float32 float32_min (float32 ,float32 STATUS_PARAM );float32 float32_max (float32 ,float32 STATUS_PARAM ); +float32 float32_minnum (float32 ,float32 STATUS_PARAM ); +float32 float32_maxnum (float32 ,float32 STATUS_PARAM );int float32_is_quiet_nan (float32 );int float32_is_signaling_nan (float32 );float32 float32_maybe_silence_nan (float32 );
@@ -408,6 +410,8 @@ int float64_compare( float64, float64 STATUS_PARAM );int float64_compare_quiet (float64 ,float64 STATUS_PARAM );float64 float64_min (float64 ,float64 STATUS_PARAM );float64 float64_max (float64 ,float64 STATUS_PARAM ); +float64 float64_minnum (float64 ,float64 STATUS_PARAM ); +float64 float64_maxnum (float64 ,float64 STATUS_PARAM );int float64_is_quiet_nan (float64 a );int float64_is_signaling_nan (float64 );float64 float64_maybe_silence_nan (float64 );
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 34/37] target-arm: Implement ARMv8 FP VMAXNM and VMINNM instructions.
In reply to Peter MaydellFrom: Will Newton <[email protected]>
This adds support for the ARMv8 floating point VMAXNM and VMINNM instructions.
Message-id: [email protected]
--- target-arm/helper.c | 25 +++++++++++++++++++++++++ target-arm/helper.h | 5 +++++ target-arm/translate.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+)
target-arm/helper.c +25 -0
@@ -4085,3 +4085,28 @@ float64 VFP_HELPER(muladd, d)(float64 a, float64 b, float64 c, void *fpstp)float_status *fpst = fpstp;return float64_muladd (a, b, c,0 , fpst); } + +/* ARMv8 VMAXNM/VMINNM */ +float32 VFP_HELPER (maxnm ,s )(float32 a,float32 b,void *fpstp) +{ +float_status *fpst = fpstp; +return float32_maxnum (a, b, fpst); +} + +float64 VFP_HELPER (maxnm ,d )(float64 a,float64 b,void *fpstp) +{ +float_status *fpst = fpstp; +return float64_maxnum (a, b, fpst); +} + +float32 VFP_HELPER (minnm ,s )(float32 a,float32 b,void *fpstp) +{ +float_status *fpst = fpstp; +return float32_minnum (a, b, fpst); +} + +float64 VFP_HELPER (minnm ,d )(float64 a,float64 b,void *fpstp) +{ +float_status *fpst = fpstp; +return float64_minnum (a, b, fpst); +}
target-arm/helper.h +5 -0
@@ -132,6 +132,11 @@ DEF_HELPER_2(neon_fcvt_f32_to_f16, i32, f32, env) DEF_HELPER_4(vfp_muladdd, f64, f64, f64, f64, ptr) DEF_HELPER_4(vfp_muladds, f32, f32, f32, f32, ptr) +DEF_HELPER_3(vfp_maxnmd, f64, f64, f64, ptr) +DEF_HELPER_3(vfp_maxnms, f32, f32, f32, ptr) +DEF_HELPER_3(vfp_minnmd, f64, f64, f64, ptr) +DEF_HELPER_3(vfp_minnms, f32, f32, f32, ptr) + DEF_HELPER_3(recps_f32, f32, f32, f32, env) DEF_HELPER_3(rsqrts_f32, f32, f32, f32, env)DEF_HELPER_2 (recpe_f32, f32, f32, env)
target-arm/translate.c +50 -0
62 lines not on this page · raw message
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 24/37] net/cadence_gem: Add missing VMSTATE_END_OF_LIST
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
Message-id: 8f8c2bfb15f40fb5f0d5766aa4cd3d54c596de6a.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 1 + 1 file changed, 1 insertion(+)
hw/net/cadence_gem.c +1 -0
@@ -1246,6 +1246,7 @@ static const VMStateDescription vmstate_cadence_gem = { VMSTATE_UINT32(rx_desc_addr, GemState), VMSTATE_UINT32(tx_desc_addr, GemState), VMSTATE_BOOL_ARRAY(sar_active, GemState, 4), + VMSTATE_END_OF_LIST(), } };
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 31/37] target-arm: Implement ARMv8 VSEL instruction.
In reply to Peter MaydellFrom: Will Newton <[email protected]>
This adds support for the VSEL floating point selection instruction which was added in ARMv8.
Message-id: [email protected]
--- target-arm/translate.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 1 deletion(-)
target-arm/translate.c +134 -1
@@ -2614,6 +2614,139 @@ static TCGv_i32 gen_load_and_replicate(DisasContext *s, TCGv_i32 addr, int size)return tmp; } +static int handle_vsel (uint32_t insn,uint32_t rd,uint32_t rn,uint32_t rm, +uint32_t dp) +{ +uint32_t cc =extract32 (insn,20 ,2 ); + +if (dp) { +TCGv_i64 frn, frm, dest; +TCGv_i64 tmp, zero, zf, nf, vf; + + zero =tcg_const_i64 (0 ); + + frn =tcg_temp_new_i64 (); + frm =tcg_temp_new_i64 (); + dest =tcg_temp_new_i64 (); + + zf =tcg_temp_new_i64 (); + nf =tcg_temp_new_i64 (); + vf =tcg_temp_new_i64 (); + +tcg_gen_extu_i32_i64 (zf, cpu_ZF); +tcg_gen_ext_i32_i64 (nf, cpu_NF); +tcg_gen_ext_i32_i64 (vf, cpu_VF); + +tcg_gen_ld_f64 (frn, cpu_env,vfp_reg_offset (dp, rn)); +tcg_gen_ld_f64 (frm, cpu_env,vfp_reg_offset (dp, rm)); +switch (cc) { +case 0 :/* eq: Z */ +tcg_gen_movcond_i64 (TCG_COND_EQ , dest, zf, zero, + frn, frm); +break ; +case 1 :/* vs: V */ +tcg_gen_movcond_i64 (TCG_COND_LT , dest, vf, zero, + frn, frm); +break ; +case 2 :/* ge: N == V -> N ^ V == 0 */ + tmp =tcg_temp_new_i64 (); +tcg_gen_xor_i64 (tmp, vf, nf); +tcg_gen_movcond_i64 (TCG_COND_GE , dest, tmp, zero, + frn, frm); +tcg_temp_free_i64 (tmp); +break ; +case 3 :/* gt: !Z && N == V */ +tcg_gen_movcond_i64 (TCG_COND_NE , dest, zf, zero, + frn, frm); + tmp =tcg_temp_new_i64 (); +tcg_gen_xor_i64 (tmp, vf, nf); +tcg_gen_movcond_i64 (TCG_COND_GE , dest, tmp, zero, + dest, frm); +tcg_temp_free_i64 (tmp); +break ; + } +tcg_gen_st_f64 (dest, cpu_env,vfp_reg_offset (dp, rd)); +tcg_temp_free_i64 (frn); +tcg_temp_free_i64 (frm); +tcg_temp_free_i64 (dest); + +tcg_temp_free_i64 (zf); +tcg_temp_free_i64 (nf); +tcg_temp_free_i64 (vf); + +tcg_temp_free_i64 (zero); + }else { +TCGv_i32 frn, frm, dest; +TCGv_i32 tmp, zero; + + zero =tcg_const_i32 (0 ); + + frn =tcg_temp_new_i32 (); + frm =tcg_temp_new_i32 (); + dest =tcg_temp_new_i32 (); +tcg_gen_ld_f32 (frn, cpu_env,vfp_reg_offset (dp, rn)); +tcg_gen_ld_f32 (frm, cpu_env,vfp_reg_offset (dp, rm)); +switch (cc) { +case 0 :/* eq: Z */ +tcg_gen_movcond_i32 (TCG_COND_EQ , dest, cpu_ZF, zero, + frn, frm); +break ; +case 1 :/* vs: V */ +tcg_gen_movcond_i32 (TCG_COND_LT , dest, cpu_VF, zero, + frn, frm); +break ; +case 2 :/* ge: N == V -> N ^ V == 0 */ + tmp =tcg_temp_new_i32 (); +tcg_gen_xor_i32 (tmp, cpu_VF, cpu_NF); +tcg_gen_movcond_i32 (TCG_COND_GE , dest, tmp, zero, + frn, frm); +tcg_temp_free_i32 (tmp); +break ; +case 3 :/* gt: !Z && N == V */ +tcg_gen_movcond_i32 (TCG_COND_NE , dest, cpu_ZF, zero, + frn, frm); + tmp =tcg_temp_new_i32 (); +tcg_gen_xor_i32 (tmp, cpu_VF, cpu_NF); +tcg_gen_movcond_i32 (TCG_COND_GE , dest, tmp, zero, + dest, frm); +tcg_temp_free_i32 (tmp); +break ; + } +tcg_gen_st_f32 (dest, cpu_env,vfp_reg_offset (dp, rd)); +tcg_temp_free_i32 (frn); +tcg_temp_free_i32 (frm); +tcg_temp_free_i32 (dest); + +tcg_temp_free_i32 (zero); + } + +return 0 ; +} + +static int disas_vfp_v8_insn (CPUARMState *env,DisasContext *s,uint32_t insn) +{ +uint32_t rd, rn, rm, dp =extract32 (insn,8 ,1 ); + +if (!arm_feature (env,ARM_FEATURE_V8 )) { +return 1 ; + } + +if (dp) { +VFP_DREG_D (rd, insn); +VFP_DREG_N (rn, insn); +VFP_DREG_M (rm, insn); + }else { + rd =VFP_SREG_D (insn); + rn =VFP_SREG_N (insn); + rm =VFP_SREG_M (insn); + } + +if ((insn &0x0f800e50 ) ==0x0e000a00 ) { +return handle_vsel (insn, rd, rn, rm, dp); + } +return 1 ; +} +/* Disassemble a VFP instruction. Returns nonzero if an error occurred (ie. an undefined instruction). */ static int disas_vfp_insn (CPUARMState * env,DisasContext *s,uint32_t insn)
@@ -2641,7 +2774,7 @@ static int disas_vfp_insn(CPUARMState * env, DisasContext *s, uint32_t insn)/* Encodings with T=1 (Thumb) or unconditional (ARM): * only used in v8 and above. */ -return 1 ; +return disas_vfp_v8_insn (env, s, insn); } dp = ((insn &0xf00 ) ==0xb00 );
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 10/37] target-arm: Add ARMCPU field for Linux device-tree 'compatible' string
In reply to Peter MaydellLinux requires device tree CPU nodes to include a 'compatible' string describing the CPU. Add a field in the ARMCPU struct for this so that boards which construct a device tree can insert the correct CPU nodes.
Note that there is currently no officially specified 'compatible' string for the TI925T, Cortex-M3 or SA1110 CPUs.
Message-id: [email protected]
--- target-arm/cpu-qom.h | 3 +++ target-arm/cpu.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+)
target-arm/cpu-qom.h +3 -0
@@ -91,6 +91,9 @@ typedef struct ARMCPU {/* GPIO outputs for generic timer */ qemu_irq gt_timer_outputs[NUM_GTIMERS ]; +/* 'compatible' string for this CPU for Linux device trees */ +const char *dtb_compatible; +/* The instance init functions for implementation-specific subclasses * set these fields to specify the implementation-dependent values of * various constant registers and reset values of non-constant
target-arm/cpu.c +50 -0
188 lines not on this page · raw message
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 26/37] net/cadence_gem: Fix small packet FCS stripping
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
The minimum packet size is 64, however this is before FCS stripping occurs. So when FCS stripping the minimum packet size is 60. Fix.
Message-id: 8aac5bd737f9cf48b87f32943d7eb5939061e546.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
hw/net/cadence_gem.c +8 -5
@@ -687,6 +687,14 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) GEM_DMACFG_RBUFSZ_S) * GEM_DMACFG_RBUFSZ_MUL; bytes_to_copy = size; +/* Pad to minimum length. Assume FCS field is stripped, logic +* below will increment it to the real minimum of 64 when +* not FCS stripping +*/ +if (size <60 ) { + size =60 ; + } +/* Strip of FCS field ? (usually yes) */ if (s->regs[GEM_NWCFG ] &GEM_NWCFG_STRIP_FCS ) { rxbuf_ptr = (void *)buf;
@@ -713,11 +721,6 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) size +=4 ; } -/* Pad to minimum length */ -if (size <64 ) { - size =64 ; - } -DB_PRINT ("config bufsize: %d packet size: %ld\n" , rxbufsize, size);while (bytes_to_copy) {
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 28/37] net/cadence_gem: Improve can_receive debug printfery
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
Currently this just floods indicating that can_receive has been called by the net framework. Instead, save the result of the most recent can_receive callback as state and only print a message if the result changes (indicating some sort of actual state change in GEM). Make said debug message more meaningful as well.
Message-id: 2eb74ca6a5756aea242d9f525961db95d6cfcf2c.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
hw/net/cadence_gem.c +10 -2
@@ -380,6 +380,8 @@ typedef struct GemState {uint32_t rx_desc_addr;uint32_t tx_desc_addr; +uint8_t can_rx_state;/* Debug only */ +unsigned rx_desc[2 ];bool sar_active[4 ];
@@ -452,13 +454,19 @@ static int gem_can_receive(NetClientState *nc) s =qemu_get_nic_opaque (nc); -DB_PRINT ("\n" ); -/* Do nothing if receive is not enabled. */ if (!(s->regs[GEM_NWCTRL ] &GEM_NWCTRL_RXENA )) { +if (s->can_rx_state !=1 ) { + s->can_rx_state =1 ; +DB_PRINT ("can't receive - no enable\n" ); + }return 0 ; } +if (s->can_rx_state !=0 ) { + s->can_rx_state =0 ; +DB_PRINT ("can receive 0x%x\n" , s->rx_desc_addr); + }return 1 ; }
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 29/37] net/cadence_gem: Don't rx packets when no rx buffer available
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
Return false from can_receive() when no valid buffer descriptor is available. Ensures against mass packet droppage in some applications.
Message-id: cde00ef774e84e2586bf10fd37b542f75bf36cfb.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
hw/net/cadence_gem.c +10 -1
@@ -463,6 +463,15 @@ static int gem_can_receive(NetClientState *nc)return 0 ; } +if (rx_desc_get_ownership (s->rx_desc) ==1 ) { +if (s->can_rx_state !=2 ) { + s->can_rx_state =2 ; +DB_PRINT ("can't receive - busy buffer descriptor 0x%x\n" , + s->rx_desc_addr); + } +return 0 ; + } +if (s->can_rx_state !=0 ) { s->can_rx_state =0 ;DB_PRINT ("can receive 0x%x\n" , s->rx_desc_addr);
@@ -1142,7 +1151,7 @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val,/* Reset to start of Q when transmit disabled. */ s->tx_desc_addr = s->regs[GEM_TXQBASE ]; } -if (val &GEM_NWCTRL_RXENA ) { +if (gem_can_receive (qemu_get_queue (s->nic))) {qemu_flush_queued_packets (qemu_get_queue (s->nic)); }break ;
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 09/37] target-arm: Provide PSCI constants to generic QEMU code
In reply to Peter MaydellProvide versions of the KVM PSCI constants to non-KVM code; this will allow us to avoid an ifdef in boards which set up a PSCI node in the device tree.
Message-id: [email protected]
--- target-arm/kvm-consts.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
target-arm/kvm-consts.h +12 -0
@@ -36,6 +36,18 @@ MISMATCH_CHECK(CP_REG_SIZE_U32, KVM_REG_SIZE_U32) MISMATCH_CHECK(CP_REG_SIZE_U64, KVM_REG_SIZE_U64) MISMATCH_CHECK(CP_REG_ARM, KVM_REG_ARM) +#define PSCI_FN_BASE 0x95c1ba5e +#define PSCI_FN (n) (PSCI_FN_BASE + (n)) +#define PSCI_FN_CPU_SUSPEND PSCI_FN(0) +#define PSCI_FN_CPU_OFF PSCI_FN(1) +#define PSCI_FN_CPU_ON PSCI_FN(2) +#define PSCI_FN_MIGRATE PSCI_FN(3) + +MISMATCH_CHECK(PSCI_FN_CPU_SUSPEND, KVM_PSCI_FN_CPU_SUSPEND) +MISMATCH_CHECK(PSCI_FN_CPU_OFF, KVM_PSCI_FN_CPU_OFF) +MISMATCH_CHECK(PSCI_FN_CPU_ON, KVM_PSCI_FN_CPU_ON) +MISMATCH_CHECK(PSCI_FN_MIGRATE, KVM_PSCI_FN_MIGRATE) +#undef MISMATCH_CHECK#endif
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 27/37] net/cadence_gem: Fix register w1c logic
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
This write-1-clear logic was incorrect. It was always clearing w1c bits regardless of whether the written value was 1 or not. i.e. it was implementing a write-anything-to-clear strategy.
Message-id: ed905b04d3343966ded425f06aa2224bc7a35b59.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
hw/net/cadence_gem.c +6 -7
@@ -1112,15 +1112,14 @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val,/* Squash bits which are read only in write value */ val &= ~(s->regs_ro[offset]); -/* Preserve (only) bits which are read only in register */ - readonly = s->regs[offset]; - readonly &= s->regs_ro[offset]; - -/* Squash bits which are write 1 to clear */ - val &= ~(s->regs_w1c[offset] & val); +/* Preserve (only) bits which are read only and wtc in register */ + readonly = s->regs[offset] & (s->regs_ro[offset] | s->regs_w1c[offset]);/* Copy register write to backing store */ - s->regs[offset] = val | readonly; + s->regs[offset] = (val & ~s->regs_w1c[offset]) | readonly; + +/* do w1c */ + s->regs[offset] &= ~(s->regs_w1c[offset] & val);/* Handle register write side effects */ switch (offset) {
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 11/37] target-arm: Allow secondary KVM CPUs to be booted via PSCI
In reply to Peter MaydellNew ARM boards are generally expected to boot their secondary CPUs via the PSCI interface, rather than ad-hoc "loop around in holding pen code" as hw/arm/boot.c implements. In particular this is necessary for mach-virt kernels. For KVM we achieve this by creating the VCPUs with a feature flag marking them as starting in PSCI powered-down state; the guest kernel will then make a PSCI call (implemented in the host kernel) to start the secondaries at an address of its choosing once it has got the primary CPU up.
Implement this setting of the feature flag, controlled by a qdev property for ARMCPU, which board code can set if it is a PSCI system.
Message-id: [email protected]
--- target-arm/cpu-qom.h | 3 +++ target-arm/cpu.c | 7 +++++++ target-arm/kvm.c | 3 +++ 3 files changed, 13 insertions(+)
target-arm/cpu-qom.h +3 -0
@@ -94,6 +94,9 @@ typedef struct ARMCPU {/* 'compatible' string for this CPU for Linux device trees */ const char *dtb_compatible; +/* Should CPU start in PSCI powered-off state? */ +bool start_powered_off; +/* The instance init functions for implementation-specific subclasses * set these fields to specify the implementation-dependent values of * various constant registers and reset values of non-constant
target-arm/cpu.c +7 -0
@@ -20,6 +20,7 @@#include "cpu.h" #include "qemu-common.h" +#include "hw/qdev-properties.h" #if !defined(CONFIG_USER_ONLY )#include "hw/loader.h" #endif
@@ -944,6 +945,11 @@ static const ARMCPUInfo arm_cpus[] = {#endif }; +static Property arm_cpu_properties[] = { +DEFINE_PROP_BOOL ("start-powered-off" ,ARMCPU , start_powered_off, false), +DEFINE_PROP_END_OF_LIST () +}; +static void arm_cpu_class_init (ObjectClass *oc,void *data) {ARMCPUClass *acc =ARM_CPU_CLASS (oc);
@@ -952,6 +958,7 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) acc->parent_realize = dc->realize; dc->realize = arm_cpu_realizefn; + dc->props = arm_cpu_properties; acc->parent_reset = cc->reset; cc->reset = arm_cpu_reset;
target-arm/kvm.c +3 -0
@@ -79,6 +79,9 @@ int kvm_arch_init_vcpu(CPUState *cs) init.target =KVM_ARM_TARGET_CORTEX_A15 ;memset (init.features,0 ,sizeof (init.features)); +if (cpu->start_powered_off) { + init.features[0 ] =1 <<KVM_ARM_VCPU_POWER_OFF ; + } ret =kvm_vcpu_ioctl (cs,KVM_ARM_VCPU_INIT , &init);if (ret) {return ret;
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 03/37] cpu/a9mpcore: reorder operations/declarations
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
To make it consistent for easier code reading. The order in which variables are defined and functions are called is set to match the address map ordering.
The new consistent order of doing stuff is:
SCU -> GIC -> MPTimer -> WDT.
0 functional change.
Message-id: 8f31398e6d9a93f57291399f269039da1a77a2b5.1385969450.git.peter.crosthwaite@xilinx.com
--- hw/cpu/a9mpcore.c | 28 ++++++++++++++-------------- include/hw/cpu/a9mpcore.h | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-)
hw/cpu/a9mpcore.c +14 -14
@@ -24,12 +24,12 @@ static void a9mp_priv_initfn(Object *obj)memory_region_init (&s->container, obj,"a9mp-priv-container" ,0x2000 );sysbus_init_mmio (SYS_BUS_DEVICE (obj), &s->container); -object_initialize (&s->gic,sizeof (s->gic),TYPE_ARM_GIC ); -qdev_set_parent_bus (DEVICE (&s->gic),sysbus_get_default ()); -object_initialize (&s->scu,sizeof (s->scu),TYPE_A9_SCU );qdev_set_parent_bus (DEVICE (&s->scu),sysbus_get_default ()); +object_initialize (&s->gic,sizeof (s->gic),TYPE_ARM_GIC ); +qdev_set_parent_bus (DEVICE (&s->gic),sysbus_get_default ()); +object_initialize (&s->mptimer,sizeof (s->mptimer),TYPE_ARM_MPTIMER );qdev_set_parent_bus (DEVICE (&s->mptimer),sysbus_get_default ());
@@ -41,11 +41,20 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp) {SysBusDevice *sbd =SYS_BUS_DEVICE (dev);A9MPPrivState *s =A9MPCORE_PRIV (dev); -DeviceState *gicdev, *scudev, *mptimerdev, *wdtdev; -SysBusDevice *mptimerbusdev, *wdtbusdev, *gicbusdev, *scubusdev; +DeviceState *scudev, *gicdev, *mptimerdev, *wdtdev; +SysBusDevice *scubusdev, *gicbusdev, *mptimerbusdev, *wdtbusdev;Error *err =NULL ;int i; + scudev =DEVICE (&s->scu); +qdev_prop_set_uint32 (scudev,"num-cpu" , s->num_cpu); +object_property_set_bool (OBJECT (&s->scu), true,"realized" , &err); +if (err !=NULL ) { +error_propagate (errp, err); +return ; + } + scubusdev =SYS_BUS_DEVICE (&s->scu); + gicdev =DEVICE (&s->gic);qdev_prop_set_uint32 (gicdev,"num-cpu" , s->num_cpu);qdev_prop_set_uint32 (gicdev,"num-irq" , s->num_irq);
@@ -62,15 +71,6 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)/* Pass through inbound GPIO lines to the GIC */ qdev_init_gpio_in (dev, a9mp_priv_set_irq, s->num_irq -32 ); - scudev =DEVICE (&s->scu); -qdev_prop_set_uint32 (scudev,"num-cpu" , s->num_cpu); -object_property_set_bool (OBJECT (&s->scu), true,"realized" , &err); -if (err !=NULL ) { -error_propagate (errp, err); -return ; - } - scubusdev =SYS_BUS_DEVICE (&s->scu); - mptimerdev =DEVICE (&s->mptimer);qdev_prop_set_uint32 (mptimerdev,"num-cpu" , s->num_cpu);object_property_set_bool (OBJECT (&s->mptimer), true,"realized" , &err);
include/hw/cpu/a9mpcore.h +1 -1
@@ -28,8 +28,8 @@ typedef struct A9MPPrivState {MemoryRegion container;uint32_t num_irq; -GICState gic;A9SCUState scu; +GICState gic;ARMMPTimerState mptimer;ARMMPTimerState wdt; } A9MPPrivState;
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 22/37] net/cadence_gem: Implement SAR match bit in rx desc
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
Bit 27 of the RX buffer desc word 1 should be set when the packet was accepted due to specific address register match. Implement.
This feature is absent from the Xilinx documentation (UG585) but the behaviour is tested as accurate on real hardware.
Message-id: 7e3f26fc4ab244e8123efc12723e7164730abdcb.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 2 ++ 1 file changed, 2 insertions(+)
hw/net/cadence_gem.c +2 -0
@@ -243,6 +243,7 @@#define R_DESC_1_RX_SAR_SHIFT 25#define R_DESC_1_RX_SAR_LENGTH 2 +#define R_DESC_1_RX_SAR_MATCH (1 << 27)#define R_DESC_1_RX_UNICAST_HASH (1 << 29)#define R_DESC_1_RX_MULTICAST_HASH (1 << 30)#define R_DESC_1_RX_BROADCAST (1 << 31)
@@ -345,6 +346,7 @@ static inline void rx_desc_set_sar(unsigned *desc, int sar_idx) { desc[1 ] =deposit32 (desc[1 ],R_DESC_1_RX_SAR_SHIFT ,R_DESC_1_RX_SAR_LENGTH , sar_idx); + desc[1 ] |=R_DESC_1_RX_SAR_MATCH ; }#define TYPE_CADENCE_GEM "cadence_gem"
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 35/37] target-arm: Implement ARMv8 SIMD VMAXNM and VMINNM instructions.
In reply to Peter MaydellFrom: Will Newton <[email protected]>
This adds support for the ARMv8 Advanced SIMD VMAXNM and VMINNM instructions.
Message-id: [email protected]
--- target-arm/translate.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-)
target-arm/translate.c +22 -9
@@ -4553,7 +4553,7 @@ static void gen_neon_narrow_op(int op, int u, int size,#define NEON_3R_FLOAT_CMP 28/* float VCEQ, VCGE, VCGT */ #define NEON_3R_FLOAT_ACMP 29/* float VACGE, VACGT, VACLE, VACLT */ #define NEON_3R_FLOAT_MINMAX 30/* float VMIN, VMAX */ -#define NEON_3R_VRECPS_VRSQRTS 31/* float VRECPS, VRSQRTS */ +#define NEON_3R_FLOAT_MISC 31/* float VRECPS, VRSQRTS, VMAXNM/MINNM */ static const uint8_t neon_3r_sizes[] = { [NEON_3R_VHADD ] =0x7 ,
@@ -4586,7 +4586,7 @@ static const uint8_t neon_3r_sizes[] = { [NEON_3R_FLOAT_CMP] = 0x5, /* size bit 1 encodes op */ [NEON_3R_FLOAT_ACMP] = 0x5, /* size bit 1 encodes op */ [NEON_3R_FLOAT_MINMAX] = 0x5, /* size bit 1 encodes op */ - [NEON_3R_VRECPS_VRSQRTS] = 0x5, /* size bit 1 encodes op */ + [NEON_3R_FLOAT_MISC] = 0x5, /* size bit 1 encodes op */ };/* Symbolic constants for op fields for Neon 2-register miscellaneous.
@@ -4847,8 +4847,9 @@ static int disas_neon_data_insn(CPUARMState * env, DisasContext *s, uint32_t insreturn 1 ; }break ; -case NEON_3R_VRECPS_VRSQRTS : -if (u) { +case NEON_3R_FLOAT_MISC : +/* VMAXNM/VMINNM in ARMv8 */ +if (u && !arm_feature (env,ARM_FEATURE_V8 )) {return 1 ; }break ;
@@ -5137,11 +5138,23 @@ static int disas_neon_data_insn(CPUARMState * env, DisasContext *s, uint32_t instcg_temp_free_ptr (fpstatus);break ; } -case NEON_3R_VRECPS_VRSQRTS : -if (size ==0 ) -gen_helper_recps_f32 (tmp, tmp, tmp2, cpu_env); -else -gen_helper_rsqrts_f32 (tmp, tmp, tmp2, cpu_env); +case NEON_3R_FLOAT_MISC : +if (u) { +/* VMAXNM/VMINNM */ +TCGv_ptr fpstatus =get_fpstatus_ptr (1 ); +if (size ==0 ) { +gen_helper_vfp_maxnms (tmp, tmp, tmp2, fpstatus); + }else { +gen_helper_vfp_minnms (tmp, tmp, tmp2, fpstatus); + } +tcg_temp_free_ptr (fpstatus); + }else { +if (size ==0 ) { +gen_helper_recps_f32 (tmp, tmp, tmp2, cpu_env); + }else { +gen_helper_rsqrts_f32 (tmp, tmp, tmp2, cpu_env); + } + }break ;case NEON_3R_VFM : {
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 15/37] hw/arm/virt: Support -cpu host
In reply to Peter MaydellSupport -cpu host in virt machine (treating it like an A15, ie with a GIC v2 and the A15's private peripherals.)
Message-id: [email protected]
--- hw/arm/virt.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/arm/virt.c +8 -0
@@ -122,6 +122,14 @@ static VirtBoardInfo machines[] = { .memmap = a15memmap, .irqmap = a15irqmap, }, + { + .cpu_model = "host", + /* We use the A15 private peripheral model to get a V2 GIC */ + .qdevname = "a15mpcore_priv", + .gic_compatible = "arm,cortex-a15-gic", + .memmap = a15memmap, + .irqmap = a15irqmap, + }, };static VirtBoardInfo *find_machine_info (const char *cpu)
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 19/37] net/cadence_gem: simplify rx buf descriptor walking
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
There was a replication of the rx descriptor address walking logic. Reorder the flow control to remove. This refactoring also obsoletes the local variables packet_desc_addr and last_desc_addr.
Message-id: 2a425b457ff0b57274bf206ad2236690cd7f5909.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-)
hw/net/cadence_gem.c +9 -28
@@ -586,7 +586,6 @@ static int gem_mac_address_filter(GemState *s, const uint8_t *packet)static ssize_t gem_receive (NetClientState *nc,const uint8_t *buf,size_t size) {unsigned desc[2 ]; -hwaddr packet_desc_addr, last_desc_addr;GemState *s;unsigned rxbufsize, bytes_to_copy;unsigned rxbuf_offset;
@@ -667,17 +666,16 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)DB_PRINT ("config bufsize: %d packet size: %ld\n" , rxbufsize, size); - packet_desc_addr = s->rx_desc_addr; -while (1 ) { -DB_PRINT ("read descriptor 0x%x\n" , (unsigned )packet_desc_addr); +while (bytes_to_copy) { +DB_PRINT ("read descriptor 0x%x\n" , (unsigned )s->rx_desc_addr);/* read current descriptor */ -cpu_physical_memory_read (packet_desc_addr, +cpu_physical_memory_read (s->rx_desc_addr, (uint8_t *)&desc[0 ],sizeof (desc));/* Descriptor owned by software ? */ if (rx_desc_get_ownership (desc) ==1 ) {DB_PRINT ("descriptor 0x%x owned by sw.\n" , - (unsigned )packet_desc_addr); + (unsigned )s->rx_desc_addr); s->regs[GEM_RXSTATUS ] |=GEM_RXSTATUS_NOBUF ; s->regs[GEM_ISR ] |=GEM_INT_RXUSED & ~(s->regs[GEM_IMR ]);/* Handle interrupt consequences */
@@ -705,36 +703,19 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) }rx_desc_set_ownership (desc);/* Descriptor write-back. */ -cpu_physical_memory_write (packet_desc_addr, +cpu_physical_memory_write (s->rx_desc_addr, (uint8_t *)&desc[0 ],sizeof (desc)); -if (bytes_to_copy ==0 ) { -break ; - } -/* Next descriptor */ if (rx_desc_get_wrap (desc)) { - packet_desc_addr = s->regs[GEM_RXQBASE ]; +DB_PRINT ("wrapping RX descriptor list\n" ); + s->rx_desc_addr = s->regs[GEM_RXQBASE ]; }else { - packet_desc_addr +=8 ; +DB_PRINT ("incrementing RX descriptor list\n" ); + s->rx_desc_addr +=8 ; } } -DB_PRINT ("set length: %ld, EOF on descriptor 0x%x\n" , size, - (unsigned )packet_desc_addr); - -/* Advance RX packet descriptor Q */ - last_desc_addr = packet_desc_addr; - packet_desc_addr = s->rx_desc_addr; - s->rx_desc_addr = last_desc_addr; -if (rx_desc_get_wrap (desc)) { - s->rx_desc_addr = s->regs[GEM_RXQBASE ]; -DB_PRINT ("wrapping RX descriptor list\n" ); - }else { -DB_PRINT ("incrementing RX descriptor list\n" ); - s->rx_desc_addr +=8 ; - } -/* Count it */ gem_receive_updatestats (s, buf, size);
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 25/37] net/cadence_gem: Fix rx multi-fragment packets
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
Bytes_to_copy was being updated before its final use where it advances the rx buffer pointer. This was causing total mayhem, where packet data for any subsequent fragments was being fetched from the wrong place.
Message-id: c2a1c65c1fd06eb274442a0fa4a6839d940e145e.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/cadence_gem.c +1 -1
@@ -733,8 +733,8 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)/* Copy packet data to emulated DMA buffer */ cpu_physical_memory_write (rx_desc_get_buffer (s->rx_desc) + rxbuf_offset, rxbuf_ptr,MIN (bytes_to_copy, rxbufsize)); - bytes_to_copy -=MIN (bytes_to_copy, rxbufsize); rxbuf_ptr +=MIN (bytes_to_copy, rxbufsize); + bytes_to_copy -=MIN (bytes_to_copy, rxbufsize);/* Update the descriptor. */ if (first_desc) {
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 12/37] hw/arm: Add 'virt' platform
In reply to Peter MaydellAdd 'virt' platform support corresponding to arch/arm/mach-virt in the Linux kernel tree. This has no platform-specific code but can use any device whose kernel driver is is able to work purely from a device tree node. We use this to instantiate a minimal set of devices: a GIC and some virtio-mmio transports.
Message-id: [email protected] [PMM:
Significantly overhauled:
* renamed user-facing machine to just "virt"
* removed the A9 support (it can't work since the A9 has no generic timers)
* added virtio-mmio transports instead of random set of 'soc' devices (though we retain a pl011 UART)
* instead of updating io_base as we step through adding devices, define a memory map with an array (similar to vexpress)
* similarly, define irqmap with an array
* folded in some minor fixes from John's aarch64-support patch
* rather than explicitly doing endian-swapping on FDT cells, use fdt APIs that let us just pass in host-endian values and let the fdt layer take care of the swapping
* miscellaneous minor code cleanups and style fixes
]
--- hw/arm/Makefile.objs | 2 +- hw/arm/virt.c | 444 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 445 insertions(+), 1 deletion(-) create mode 100644 hw/arm/virt.c
hw/arm/Makefile.objs +1 -1
@@ -1,7 +1,7 @@ obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o obj-y += integratorcp.o kzm.o mainstone.o musicpal.o nseries.o obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o -obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o +obj-y += tosa.o versatilepb.o vexpress.o virt.o xilinx_zynq.o z2.o obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o obj-y += omap1.o omap2.o strongarm.o
hw/arm/virt.c new file +444 -0
444 lines not on this page · raw message
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 06/37] target-arm: Provide mechanism for getting KVM constants even if not CONFIG_KVM
In reply to Peter MaydellThere are a number of places where it would be convenient for ARM code to have working definitions of KVM constants even in code which is compiled with CONFIG_KVM not set. In this situation we can't simply include the kernel KVM headers (which might conflict with host header definitions or not even compile on the compiler we're using) so we have to redefine equivalent constants. Provide a mechanism for doing this and checking that the values match, and use it for the constants we're currently exposing via an ad-hoc mechanism.
Message-id: [email protected]
--- target-arm/cpu.h | 13 ++----------- target-arm/kvm-consts.h | 41 +++++++++++++++++++++++++++++++++++++++++ target-arm/kvm.c | 9 --------- 3 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 target-arm/kvm-consts.h
target-arm/cpu.h +2 -11
@@ -21,6 +21,8 @@#include "config.h" +#include "kvm-consts.h" +#if defined(TARGET_AARCH64 )/* AArch64 definitions */ # define TARGET_LONG_BITS 64
@@ -497,17 +499,6 @@ void armv7m_nvic_complete_irq(void *opaque, int irq); (((cp) <<16 ) | ((is64) <<15 ) | ((crn) <<11 ) | \ ((crm) <<7 ) | ((opc1) <<3 ) | (opc2)) -/* Note that these must line up with the KVM/ARM register -* ID field definitions (kvm.c will check this, but we -* can't just use the KVM defines here as the kvm headers -* are unavailable to non-KVM-specific files) - */ -#define CP_REG_SIZE_SHIFT 52 -#define CP_REG_SIZE_MASK 0x00f0000000000000ULL -#define CP_REG_SIZE_U32 0x0020000000000000ULL -#define CP_REG_SIZE_U64 0x0030000000000000ULL -#define CP_REG_ARM 0x4000000000000000ULL -/* Convert a full 64 bit KVM register ID to the truncated 32 bit * version used as a key for the coprocessor register hashtable */
target-arm/kvm-consts.h new file +41 -0
41 lines not on this page · raw message
target-arm/kvm.c +0 -9
@@ -23,15 +23,6 @@#include "cpu.h" #include "hw/arm/arm.h" -/* Check that cpu.h's idea of coprocessor fields matches KVM's */ -#if (CP_REG_SIZE_SHIFT !=KVM_REG_SIZE_SHIFT ) || \ - (CP_REG_SIZE_MASK !=KVM_REG_SIZE_MASK ) || \ - (CP_REG_SIZE_U32 !=KVM_REG_SIZE_U32 ) || \ - (CP_REG_SIZE_U64 !=KVM_REG_SIZE_U64 ) || \ - (CP_REG_ARM !=KVM_REG_ARM ) -#error mismatch between cpu.h and KVM header definitions -#endif -const KVMCapabilityInfo kvm_arch_required_capabilities[] = {KVM_CAP_LAST_INFO };
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 30/37] target-arm: Move call to disas_vfp_insn out of disas_coproc_insn.
In reply to Peter MaydellFrom: Will Newton <[email protected]>
Floating point is an extension to the instruction set rather than a coprocessor, so call it directly from the ARM and Thumb decode functions.
Message-id: [email protected]
--- target-arm/translate.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-)
target-arm/translate.c +27 -5
@@ -2636,6 +2636,14 @@ static int disas_vfp_insn(CPUARMState * env, DisasContext *s, uint32_t insn) && rn != ARM_VFP_MVFR1 && rn != ARM_VFP_MVFR0)return 1 ; } + +if (extract32 (insn,28 ,4 ) ==0xf ) { +/* Encodings with T=1 (Thumb) or unconditional (ARM): +* only used in v8 and above. +*/ +return 1 ; + } + dp = ((insn &0xf00 ) ==0xb00 );switch ((insn >>24 ) &0xf ) {case 0xe :
@@ -6296,9 +6304,6 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn)return disas_dsp_insn (env, s, insn); }return 1 ; -case 10 : -case 11 : -return disas_vfp_insn (env, s, insn);default :break ; }
@@ -6753,6 +6758,13 @@ static void disas_arm_insn(CPUARMState * env, DisasContext *s) goto illegal_op;return ; } +if ((insn &0x0f000e10 ) ==0x0e000a00 ) { +/* VFP. */ +if (disas_vfp_insn (env, s, insn)) { + goto illegal_op; + } +return ; + }if (((insn &0x0f30f000 ) ==0x0510f000 ) || ((insn &0x0f30f010 ) ==0x0710f000 )) {if ((insn & (1 <<22 )) ==0 ) {
@@ -8033,9 +8045,15 @@ static void disas_arm_insn(CPUARMState * env, DisasContext *s)case 0xc :case 0xd :case 0xe : -/* Coprocessor. */ -if (disas_coproc_insn (env, s, insn)) +if (((insn >>8 ) &0xe ) ==10 ) { +/* VFP. */ +if (disas_vfp_insn (env, s, insn)) { + goto illegal_op; + } + }else if (disas_coproc_insn (env, s, insn)) { +/* Coprocessor. */ goto illegal_op; + }break ;case 0xf :/* swi */
@@ -8765,6 +8783,10 @@ static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hw insn = (insn &0xe2ffffff ) | ((insn & (1 <<28 )) >>4 ) | (1 <<28 );if (disas_neon_data_insn (env, s, insn)) goto illegal_op; + }else if (((insn >>8 ) &0xe ) ==10 ) { +if (disas_vfp_insn (env, s, insn)) { + goto illegal_op; + } }else {if (insn & (1 <<28 )) goto illegal_op;
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 04/37] hw/timer: Introduce ARM A9 Global Timer.
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
The ARM A9 MPCore has a timer that is global to all cores in the cluster. The timer is shared but each core has a private independent comparator and interrupt.
Based on version contributed by Francois LEGAL.
Message-id: 4918e89476b8da916be2964ec41578b50d569a37.1385969450.git.peter.crosthwaite@xilinx.com [PC changes:
* New commit message
* Re-implemented as single timer model
* Fixed backwards counting issue in polled mode
* completed VMSD fields
* macroified magic numbers (and headerified reg definitions)
* split of as device-model-only patch
* use bitops for 64 bit register access
* Fixed auto increment mode to check condition properly
* general cleanup (names/style etc).
]
[PMM:
* minor typo fixes
* added missing return after error_setg()
* dropped setting dc->no_user = 1
]
--- default-configs/arm-softmmu.mak | 1 + hw/timer/Makefile.objs | 1 + hw/timer/a9gtimer.c | 369 ++++++++++++++++++++++++++++++++++++++++ include/hw/timer/a9gtimer.h | 97 +++++++++++ 4 files changed, 468 insertions(+) create mode 100644 hw/timer/a9gtimer.c create mode 100644 include/hw/timer/a9gtimer.h
default-configs/arm-softmmu.mak +1 -0
@@ -41,6 +41,7 @@ CONFIG_ARM_GIC=y CONFIG_ARM_GIC_KVM=$(CONFIG_KVM) CONFIG_ARM_TIMER=y CONFIG_ARM_MPTIMER=y +CONFIG_A9_GTIMER=y CONFIG_PL011=y CONFIG_PL022=y CONFIG_PL031=y
hw/timer/Makefile.objs +1 -0
@@ -1,5 +1,6 @@ common-obj-$(CONFIG_ARM_TIMER) += arm_timer.o common-obj-$(CONFIG_ARM_MPTIMER) += arm_mptimer.o +common-obj-$(CONFIG_A9_GTIMER) += a9gtimer.o common-obj-$(CONFIG_CADENCE) += cadence_ttc.o common-obj-$(CONFIG_DS1338) += ds1338.o common-obj-$(CONFIG_HPET) += hpet.o
hw/timer/a9gtimer.c new file +369 -0
369 lines not on this page · raw message
include/hw/timer/a9gtimer.h new file +97 -0
97 lines not on this page · raw message
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 07/37] device_tree.c: Terminate the empty reservemap in create_device_tree()
In reply to Peter MaydellDevice trees created with create_device_tree() may not have any entries in their reservemap, because the FDT API requires that the reservemap is completed before any FDT nodes are added, and create_device_tree() itself creates a node. However we were not calling fdt_finish_reservemap(), which meant that there was no terminator in the reservemap list and whatever happened to be at the start of the FDT data section would end up being interpreted as reservemap entries. Avoid this by calling fdt_finish_reservemap() to add the terminator.
Message-id: [email protected]
--- device_tree.c | 4 ++++ 1 file changed, 4 insertions(+)
device_tree.c +4 -0
@@ -41,6 +41,10 @@ void *create_device_tree(int *sizep)if (ret <0 ) { goto fail; } + ret =fdt_finish_reservemap (fdt); +if (ret <0 ) { + goto fail; + } ret =fdt_begin_node (fdt,"" );if (ret <0 ) { goto fail;
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 20/37] net/cadence_gem: Prefetch rx descriptors ASAP
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
The real hardware prefetches rx buffer descriptors ASAP and potentially throws relevant interrupts following the fetch even in the absence of a received packet.
Message-id: 41629e35edfdb1f02f1e401f2c3d0e2e4c9e44b3.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 62 +++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 27 deletions(-)
hw/net/cadence_gem.c +35 -27
@@ -346,6 +346,8 @@ typedef struct GemState {uint32_t rx_desc_addr;uint32_t tx_desc_addr; +unsigned rx_desc[2 ]; + } GemState;/* The broadcast MAC address: 0xFFFFFFFFFFFF */
@@ -579,13 +581,30 @@ static int gem_mac_address_filter(GemState *s, const uint8_t *packet)return GEM_RX_REJECT ; } +static void gem_get_rx_desc (GemState *s) +{ +DB_PRINT ("read descriptor 0x%x\n" , (unsigned )s->rx_desc_addr); +/* read current descriptor */ +cpu_physical_memory_read (s->rx_desc_addr, + (uint8_t *)s->rx_desc,sizeof (s->rx_desc)); + +/* Descriptor owned by software ? */ +if (rx_desc_get_ownership (s->rx_desc) ==1 ) { +DB_PRINT ("descriptor 0x%x owned by sw.\n" , + (unsigned )s->rx_desc_addr); + s->regs[GEM_RXSTATUS ] |=GEM_RXSTATUS_NOBUF ; + s->regs[GEM_ISR ] |=GEM_INT_RXUSED & ~(s->regs[GEM_IMR ]); +/* Handle interrupt consequences */ +gem_update_int_status (s); + } +} +/* * gem_receive: * Fit a packet handed to us by QEMU into the receive descriptor ring. */ static ssize_t gem_receive (NetClientState *nc,const uint8_t *buf,size_t size) { -unsigned desc[2 ];GemState *s;unsigned rxbufsize, bytes_to_copy;unsigned rxbuf_offset;
@@ -595,11 +614,6 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) s =qemu_get_nic_opaque (nc); -/* Do nothing if receive is not enabled. */ -if (!gem_can_receive (nc)) { -return -1 ; - } -/* Is this destination MAC address "for us" ? */ if (gem_mac_address_filter (s, buf) ==GEM_RX_REJECT ) {return -1 ;
@@ -667,53 +681,44 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)DB_PRINT ("config bufsize: %d packet size: %ld\n" , rxbufsize, size);while (bytes_to_copy) { -DB_PRINT ("read descriptor 0x%x\n" , (unsigned )s->rx_desc_addr); -/* read current descriptor */ -cpu_physical_memory_read (s->rx_desc_addr, - (uint8_t *)&desc[0 ],sizeof (desc)); - -/* Descriptor owned by software ? */ -if (rx_desc_get_ownership (desc) ==1 ) { -DB_PRINT ("descriptor 0x%x owned by sw.\n" , - (unsigned )s->rx_desc_addr); - s->regs[GEM_RXSTATUS ] |=GEM_RXSTATUS_NOBUF ; - s->regs[GEM_ISR ] |=GEM_INT_RXUSED & ~(s->regs[GEM_IMR ]); -/* Handle interrupt consequences */ -gem_update_int_status (s); +/* Do nothing if receive is not enabled. */ +if (!gem_can_receive (nc)) { +assert (!first_desc);return -1 ; }DB_PRINT ("copy %d bytes to 0x%x\n" ,MIN (bytes_to_copy, rxbufsize), -rx_desc_get_buffer (desc)); +rx_desc_get_buffer (s->rx_desc));/* Copy packet data to emulated DMA buffer */ -cpu_physical_memory_write (rx_desc_get_buffer (desc) + rxbuf_offset, +cpu_physical_memory_write (rx_desc_get_buffer (s->rx_desc) + rxbuf_offset, rxbuf_ptr,MIN (bytes_to_copy, rxbufsize)); bytes_to_copy -=MIN (bytes_to_copy, rxbufsize); rxbuf_ptr +=MIN (bytes_to_copy, rxbufsize);/* Update the descriptor. */ if (first_desc) { -rx_desc_set_sof (desc); +rx_desc_set_sof (s->rx_desc); first_desc = false; }if (bytes_to_copy ==0 ) { -rx_desc_set_eof (desc); -rx_desc_set_length (desc, size); +rx_desc_set_eof (s->rx_desc); +rx_desc_set_length (s->rx_desc, size); } -rx_desc_set_ownership (desc); +rx_desc_set_ownership (s->rx_desc);/* Descriptor write-back. */ cpu_physical_memory_write (s->rx_desc_addr, - (uint8_t *)&desc[0 ],sizeof (desc)); + (uint8_t *)s->rx_desc,sizeof (s->rx_desc));/* Next descriptor */ -if (rx_desc_get_wrap (desc)) { +if (rx_desc_get_wrap (s->rx_desc)) {DB_PRINT ("wrapping RX descriptor list\n" ); s->rx_desc_addr = s->regs[GEM_RXQBASE ]; }else {DB_PRINT ("incrementing RX descriptor list\n" ); s->rx_desc_addr +=8 ; } +gem_get_rx_desc (s); }/* Count it */
@@ -1053,6 +1058,9 @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val,/* Handle register write side effects */ switch (offset) {case GEM_NWCTRL : +if (val &GEM_NWCTRL_RXENA ) { +gem_get_rx_desc (s); + }if (val &GEM_NWCTRL_TXSTART ) {gem_transmit (s); }
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 01/37] integrator/cp: add support for REFCNT register
In reply to Peter MaydellFrom: Jan Petrous <[email protected]>
Linux kernel from version 3.4 requires CM_REFCNT register for sched timer for Integrator/CP board (integrator_defconfig).
See http://infocenter.arm.com/help/topic/com.arm.doc.dui0138e/ch04s06s11.html
--- hw/arm/integratorcp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
hw/arm/integratorcp.c +10 -3
@@ -36,6 +36,7 @@ typedef struct IntegratorCMState {uint32_t cm_init;uint32_t cm_flags;uint32_t cm_nvflags; +uint32_t cm_refcnt_offset;uint32_t int_level;uint32_t irq_enabled;uint32_t fiq_enabled;
@@ -82,9 +83,13 @@ static uint64_t integratorcm_read(void *opaque, hwaddr offset,return s->cm_sdram;case 9 :/* CM_INIT */ return s->cm_init; -case 10 :/* CM_REFCT */ -/* ??? High frequency timer. */ -hw_error ("integratorcm_read: CM_REFCT" ); +case 10 :/* CM_REFCNT */ +/* This register, CM_REFCNT, provides a 32-bit count value. +* The count increments at the fixed reference clock frequency of 24MHz +* and can be used as a real-time counter. +*/ +return (uint32_t )muldiv64 (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ),24 , +1000 ) - s->cm_refcnt_offset;case 12 :/* CM_FLAGS */ return s->cm_flags;case 14 :/* CM_NVFLAGS */
@@ -257,6 +262,8 @@ static int integratorcm_init(SysBusDevice *dev) }memcpy (integrator_spd +73 ,"QEMU-MEMORY" ,11 ); s->cm_init =0x00000112 ; + s->cm_refcnt_offset =muldiv64 (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ),24 , +1000 );memory_region_init_ram (&s->flash,OBJECT (s),"integrator.flash" ,0x100000 );vmstate_register_ram_global (&s->flash);
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 05/37] cpu/a9mpcore: Add Global Timer
In reply to Peter MaydellFrom: François LEGAL <[email protected]>
Add the global timer to A9 MPCore.
Message-id: ff92f35f438ac671b57d99d823723dd3e62d2c49.1385969450.git.peter.crosthwaite@xilinx.com [PC Changes:
* new commit message
* split off original version as a separate patch
* Rebased against new mpcore implementation (with struct embedding)
]
--- hw/cpu/a9mpcore.c | 26 +++++++++++++++++++++----- include/hw/cpu/a9mpcore.h | 2 ++ 2 files changed, 23 insertions(+), 5 deletions(-)
hw/cpu/a9mpcore.c +21 -5
@@ -30,6 +30,9 @@ static void a9mp_priv_initfn(Object *obj)object_initialize (&s->gic,sizeof (s->gic),TYPE_ARM_GIC );qdev_set_parent_bus (DEVICE (&s->gic),sysbus_get_default ()); +object_initialize (&s->gtimer,sizeof (s->gtimer),TYPE_A9_GTIMER ); +qdev_set_parent_bus (DEVICE (&s->gtimer),sysbus_get_default ()); +object_initialize (&s->mptimer,sizeof (s->mptimer),TYPE_ARM_MPTIMER );qdev_set_parent_bus (DEVICE (&s->mptimer),sysbus_get_default ());
@@ -41,8 +44,9 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp) {SysBusDevice *sbd =SYS_BUS_DEVICE (dev);A9MPPrivState *s =A9MPCORE_PRIV (dev); -DeviceState *scudev, *gicdev, *mptimerdev, *wdtdev; -SysBusDevice *scubusdev, *gicbusdev, *mptimerbusdev, *wdtbusdev; +DeviceState *scudev, *gicdev, *gtimerdev, *mptimerdev, *wdtdev; +SysBusDevice *scubusdev, *gicbusdev, *gtimerbusdev, *mptimerbusdev, + *wdtbusdev;Error *err =NULL ;int i;
@@ -71,6 +75,15 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)/* Pass through inbound GPIO lines to the GIC */ qdev_init_gpio_in (dev, a9mp_priv_set_irq, s->num_irq -32 ); + gtimerdev =DEVICE (&s->gtimer); +qdev_prop_set_uint32 (gtimerdev,"num-cpu" , s->num_cpu); +object_property_set_bool (OBJECT (&s->gtimer), true,"realized" , &err); +if (err !=NULL ) { +error_propagate (errp, err); +return ; + } + gtimerbusdev =SYS_BUS_DEVICE (&s->gtimer); + mptimerdev =DEVICE (&s->mptimer);qdev_prop_set_uint32 (mptimerdev,"num-cpu" , s->num_cpu);object_property_set_bool (OBJECT (&s->mptimer), true,"realized" , &err);
@@ -97,14 +110,14 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)* 0x0600-0x06ff -- private timers and watchdogs * 0x0700-0x0fff -- nothing * 0x1000-0x1fff -- GIC Distributor -* -* We should implement the global timer but don't currently do so. */ memory_region_add_subregion (&s->container,0 ,sysbus_mmio_get_region (scubusdev,0 ));/* GIC CPU interface */ memory_region_add_subregion (&s->container,0x100 ,sysbus_mmio_get_region (gicbusdev,1 )); +memory_region_add_subregion (&s->container,0x200 , +sysbus_mmio_get_region (gtimerbusdev,0 ));/* Note that the A9 exposes only the "timer/watchdog for this core" * memory region, not the "timer/watchdog for core X" ones 11MPcore has. */
@@ -116,10 +129,13 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp) sysbus_mmio_get_region(gicbusdev, 0));/* Wire up the interrupt from each watchdog and timer. -* For each core the timer is PPI 29 and the watchdog PPI 30. +* For each core the global timer is PPI 27, the private +* timer is PPI 29 and the watchdog PPI 30. */ for (i =0 ; i < s->num_cpu; i++) {int ppibase = (s->num_irq -32 ) + i *32 ; +sysbus_connect_irq (gtimerbusdev, i, +qdev_get_gpio_in (gicdev, ppibase +27 ));sysbus_connect_irq (mptimerbusdev, i,qdev_get_gpio_in (gicdev, ppibase +29 )); sysbus_connect_irq(wdtbusdev, i,
include/hw/cpu/a9mpcore.h +2 -0
@@ -14,6 +14,7 @@#include "hw/intc/arm_gic.h" #include "hw/misc/a9scu.h" #include "hw/timer/arm_mptimer.h" +#include "hw/timer/a9gtimer.h" #define TYPE_A9MPCORE_PRIV "a9mpcore_priv"#define A9MPCORE_PRIV (obj) \
@@ -30,6 +31,7 @@ typedef struct A9MPPrivState {A9SCUState scu;GICState gic; +A9GTimerState gtimer;ARMMPTimerState mptimer;ARMMPTimerState wdt; } A9MPPrivState;
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 23/37] net/cadence_gem: Implement SAR (de)activation
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
The Specific address registers can be enabled or disabled by software. QEMU was assuming they were always enabled. Implement the disable/enable feature. SARs are disabled by writing to the lower half register. They are re-enabled by then writing the upper half.
Message-id: 49efd1f7450af8f980b967d3054245bae137866c.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
hw/net/cadence_gem.c +23 -4
@@ -382,6 +382,7 @@ typedef struct GemState {unsigned rx_desc[2 ]; +bool sar_active[4 ]; } GemState;/* The broadcast MAC address: 0xFFFFFFFFFFFF */
@@ -609,7 +610,7 @@ static int gem_mac_address_filter(GemState *s, const uint8_t *packet)/* Check all 4 specific addresses */ gem_spaddr = (uint8_t *)&(s->regs[GEM_SPADDR1LO ]);for (i =3 ; i >=0 ; i--) { -if (!memcmp (packet, gem_spaddr +8 * i,6 )) { +if (s->sar_active[i] && !memcmp (packet, gem_spaddr +8 * i,6 )) {return GEM_RX_SAR_ACCEPT + i; } }
@@ -983,6 +984,7 @@ static void gem_phy_reset(GemState *s)static void gem_reset (DeviceState *d) { +int i;GemState *s =GEM (d);DB_PRINT ("\n" );
@@ -1002,6 +1004,10 @@ static void gem_reset(DeviceState *d) s->regs[GEM_DESCONF5 ] =0x002f2145 ; s->regs[GEM_DESCONF6 ] =0x00000200 ; +for (i =0 ; i <4 ; i++) { + s->sar_active[i] = false; + } +gem_phy_reset (s);gem_update_int_status (s);
@@ -1151,6 +1157,18 @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, s->regs[GEM_IMR ] |= val;gem_update_int_status (s);break ; +case GEM_SPADDR1LO : +case GEM_SPADDR2LO : +case GEM_SPADDR3LO : +case GEM_SPADDR4LO : + s->sar_active[(offset -GEM_SPADDR1LO ) /2 ] = false; +break ; +case GEM_SPADDR1HI : +case GEM_SPADDR2HI : +case GEM_SPADDR3HI : +case GEM_SPADDR4HI : + s->sar_active[(offset -GEM_SPADDR1HI ) /2 ] = true; +break ;case GEM_PHYMNTNC :if (val &GEM_PHYMNTNC_OP_W ) {uint32_t phy_addr, reg_num;
@@ -1218,15 +1236,16 @@ static int gem_init(SysBusDevice *sbd)static const VMStateDescription vmstate_cadence_gem = { .name ="cadence_gem" , - .version_id =1 , - .minimum_version_id =1 , - .minimum_version_id_old =1 , + .version_id =2 , + .minimum_version_id =2 , + .minimum_version_id_old =2 , .fields = (VMStateField []) {VMSTATE_UINT32_ARRAY (regs, GemState,GEM_MAXREG ),VMSTATE_UINT16_ARRAY (phy_regs, GemState,32 ),VMSTATE_UINT8 (phy_loop, GemState),VMSTATE_UINT32 (rx_desc_addr, GemState),VMSTATE_UINT32 (tx_desc_addr, GemState), +VMSTATE_BOOL_ARRAY (sar_active, GemState,4 ), } };
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 08/37] hw/arm/boot: Allow boards to provide an fdt blob
In reply to Peter MaydellFrom: John Rigby <[email protected]>
If no fdt is provided on command line and the new field get_dtb in struct arm_boot_info is set then call it to get a device tree blob.
Message-id: [email protected]
--- hw/arm/boot.c | 32 ++++++++++++++++++++------------ include/hw/arm/arm.h | 7 +++++++ 2 files changed, 27 insertions(+), 12 deletions(-)
hw/arm/boot.c +20 -12
@@ -228,23 +228,31 @@ static void set_kernel_args_old(const struct arm_boot_info *info)static int load_dtb (hwaddr addr,const struct arm_boot_info *binfo) {void *fdt =NULL ; -char *filename;int size, rc;uint32_t acells, scells; - filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , binfo->dtb_filename); -if (!filename) { -fprintf (stderr,"Couldn't open dtb file %s\n" , binfo->dtb_filename); - goto fail; - } +if (binfo->dtb_filename) { +char *filename; + filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , binfo->dtb_filename); +if (!filename) { +fprintf (stderr,"Couldn't open dtb file %s\n" , binfo->dtb_filename); + goto fail; + } - fdt =load_device_tree (filename, &size); -if (!fdt) { -fprintf (stderr,"Couldn't open dtb file %s\n" , filename); + fdt =load_device_tree (filename, &size); +if (!fdt) { +fprintf (stderr,"Couldn't open dtb file %s\n" , filename); +g_free (filename); + goto fail; + }g_free (filename); - goto fail; + }else if (binfo->get_dtb) { + fdt = binfo->get_dtb (binfo, &size); +if (!fdt) { +fprintf (stderr,"Board was unable to create a dtb blob\n" ); + goto fail; + } } -g_free (filename); acells =qemu_devtree_getprop_cell (fdt,"/" ,"#address-cells" ); scells =qemu_devtree_getprop_cell (fdt,"/" ,"#size-cells" );
@@ -438,7 +446,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)/* for device tree boot, we pass the DTB directly in r2. Otherwise * we point to the kernel args. */ -if (info->dtb_filename) { +if (info->dtb_filename || info->get_dtb) {/* Place the DTB after the initrd in memory. Note that some * kernels will trash anything in the 4K page the initrd * ends in, so make sure the DTB isn't caught up in that.
include/hw/arm/arm.h +7 -0
@@ -50,6 +50,13 @@ struct arm_boot_info { const struct arm_boot_info *info);void (*secondary_cpu_reset_hook)(ARMCPU *cpu,const struct arm_boot_info *info); +/* if a board is able to create a dtb without a dtb file then it +* sets get_dtb. This will only be used if no dtb file is provided +* by the user. On success, sets *size to the length of the created +* dtb, and returns a pointer to it. (The caller must free this memory +* with g_free() when it has finished with it.) On failure, returns NULL. +*/ +void *(*get_dtb)(const struct arm_boot_info *info,int *size);/* if a board needs to be able to modify a device tree provided by * the user it should implement this hook. */
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 13/37] target-arm: Don't hardcode KVM target CPU to be A15
In reply to Peter MaydellInstead of assuming that a KVM target CPU must always be a Cortex-A15 and hardcoding this in kvm_arch_init_vcpu(), store the KVM_ARM_TARGET_* value in the ARMCPU class, and use that.
Message-id: [email protected]
--- target-arm/cpu-qom.h | 5 +++++ target-arm/cpu.c | 2 ++ target-arm/kvm-consts.h | 11 +++++++++++ target-arm/kvm.c | 7 ++++++- 4 files changed, 24 insertions(+), 1 deletion(-)
target-arm/cpu-qom.h +5 -0
@@ -97,6 +97,11 @@ typedef struct ARMCPU {/* Should CPU start in PSCI powered-off state? */ bool start_powered_off; +/* [QEMU_]KVM_ARM_TARGET_* constant for this CPU, or +* QEMU_KVM_ARM_TARGET_NONE if the kernel doesn't support this CPU type. +*/ +uint32_t kvm_target; +/* The instance init functions for implementation-specific subclasses * set these fields to specify the implementation-dependent values of * various constant registers and reset values of non-constant
target-arm/cpu.c +2 -0
@@ -223,6 +223,7 @@ static void arm_cpu_initfn(Object *obj)* picky DTB consumer will also provide a helpful error message. */ cpu->dtb_compatible ="qemu,unknown" ; + cpu->kvm_target =QEMU_KVM_ARM_TARGET_NONE ;if (tcg_enabled () && !inited) { inited = true;
@@ -685,6 +686,7 @@ static void cortex_a15_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_GENERIC_TIMER );set_feature (&cpu->env,ARM_FEATURE_DUMMY_C15_REGS );set_feature (&cpu->env,ARM_FEATURE_LPAE ); + cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A15 ; cpu->midr =0x412fc0f1 ; cpu->reset_fpsid =0x410430f0 ; cpu->mvfr0 =0x10110222 ;
target-arm/kvm-consts.h +11 -0
@@ -48,6 +48,17 @@ MISMATCH_CHECK(PSCI_FN_CPU_OFF, KVM_PSCI_FN_CPU_OFF) MISMATCH_CHECK(PSCI_FN_CPU_ON, KVM_PSCI_FN_CPU_ON) MISMATCH_CHECK(PSCI_FN_MIGRATE, KVM_PSCI_FN_MIGRATE) +#define QEMU_KVM_ARM_TARGET_CORTEX_A15 0 + +/* There's no kernel define for this: sentinel value which +* matches no KVM target value for either 64 or 32 bit +*/ +#define QEMU_KVM_ARM_TARGET_NONE UINT_MAX + +#ifndef TARGET_AARCH64 +MISMATCH_CHECK(QEMU_KVM_ARM_TARGET_CORTEX_A15, KVM_ARM_TARGET_CORTEX_A15) +#endif +#undef MISMATCH_CHECK#endif
target-arm/kvm.c +6 -1
@@ -77,7 +77,12 @@ int kvm_arch_init_vcpu(CPUState *cs)struct kvm_reg_list *rlp;ARMCPU *cpu =ARM_CPU (cs); - init.target =KVM_ARM_TARGET_CORTEX_A15 ; +if (cpu->kvm_target ==QEMU_KVM_ARM_TARGET_NONE ) { +fprintf (stderr,"KVM is not supported for this guest CPU type\n" ); +return -EINVAL ; + } + + init.target = cpu->kvm_target;memset (init.features,0 ,sizeof (init.features));if (cpu->start_powered_off) { init.features[0 ] =1 <<KVM_ARM_VCPU_POWER_OFF ;
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 14/37] target-arm: Provide '-cpu host' when running KVM
In reply to Peter MaydellImplement '-cpu host' for ARM when we're using KVM, broadly in line with other KVM-supporting architectures.
Message-id: [email protected]
--- target-arm/helper.c | 6 ++ target-arm/kvm.c | 224 +++++++++++++++++++++++++++++++++++++++++++++++++++ target-arm/kvm_arm.h | 55 +++++++++++++ 3 files changed, 285 insertions(+)
target-arm/helper.c +6 -0
@@ -1842,6 +1842,12 @@ void arm_cpu_list(FILE *f, fprintf_function cpu_fprintf) (*cpu_fprintf)(f,"Available CPUs:\n" );g_slist_foreach (list, arm_cpu_list_entry, &s);g_slist_free (list); +#ifdef CONFIG_KVM +/* The 'host' CPU type is dynamically registered only if KVM is +* enabled, so we have to special-case it here: +*/ + (*cpu_fprintf)(f," host (only available in KVM mode)\n" ); +#endif }static void arm_cpu_add_definition (gpointer data,gpointer user_data)
target-arm/kvm.c +224 -0
236 lines not on this page · raw message
target-arm/kvm_arm.h +55 -0
59 lines not on this page · raw message
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 21/37] net/cadence_gem: Implement RX descriptor match mode flags
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
The various Rx packet address matching mode flags were not being set in the rx descriptor. Implement.
Message-id: 6002a24a6a8ceaa11d3009ab5392840d1c084b28.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 82 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 13 deletions(-)
hw/net/cadence_gem.c +69 -13
@@ -222,8 +222,13 @@#define PHY_REG_INT_ST_ENERGY 0x0010/***********************************************************************/ -#define GEM_RX_REJECT 1 -#define GEM_RX_ACCEPT 0 +#define GEM_RX_REJECT (-1) +#define GEM_RX_PROMISCUOUS_ACCEPT (-2) +#define GEM_RX_BROADCAST_ACCEPT (-3) +#define GEM_RX_MULTICAST_HASH_ACCEPT (-4) +#define GEM_RX_UNICAST_HASH_ACCEPT (-5) + +#define GEM_RX_SAR_ACCEPT 0/***********************************************************************/
@@ -236,6 +241,12 @@#define DESC_0_RX_WRAP 0x00000002#define DESC_0_RX_OWNERSHIP 0x00000001 +#define R_DESC_1_RX_SAR_SHIFT 25 +#define R_DESC_1_RX_SAR_LENGTH 2 +#define R_DESC_1_RX_UNICAST_HASH (1 << 29) +#define R_DESC_1_RX_MULTICAST_HASH (1 << 30) +#define R_DESC_1_RX_BROADCAST (1 << 31) +#define DESC_1_RX_SOF 0x00004000#define DESC_1_RX_EOF 0x00008000
@@ -315,6 +326,27 @@ static inline void rx_desc_set_length(unsigned *desc, unsigned len) desc[1 ] |= len; } +static inline void rx_desc_set_broadcast (unsigned *desc) +{ + desc[1 ] |=R_DESC_1_RX_BROADCAST ; +} + +static inline void rx_desc_set_unicast_hash (unsigned *desc) +{ + desc[1 ] |=R_DESC_1_RX_UNICAST_HASH ; +} + +static inline void rx_desc_set_multicast_hash (unsigned *desc) +{ + desc[1 ] |=R_DESC_1_RX_MULTICAST_HASH ; +} + +static inline void rx_desc_set_sar (unsigned *desc,int sar_idx) +{ + desc[1 ] =deposit32 (desc[1 ],R_DESC_1_RX_SAR_SHIFT ,R_DESC_1_RX_SAR_LENGTH , + sar_idx); +} +#define TYPE_CADENCE_GEM "cadence_gem"#define GEM (obj) OBJECT_CHECK(GemState, (obj), TYPE_CADENCE_GEM)
@@ -529,7 +561,10 @@ static unsigned calc_mac_hash(const uint8_t *mac)* Accept or reject this destination address? * Returns: * GEM_RX_REJECT: reject -* GEM_RX_ACCEPT: accept +* >= 0: Specific address accept (which matched SAR is returned) +* others for various other modes of accept: +* GEM_RM_PROMISCUOUS_ACCEPT, GEM_RX_BROADCAST_ACCEPT, +* GEM_RX_MULTICAST_HASH_ACCEPT or GEM_RX_UNICAST_HASH_ACCEPT */ static int gem_mac_address_filter (GemState *s,const uint8_t *packet) {
@@ -538,7 +573,7 @@ static int gem_mac_address_filter(GemState *s, const uint8_t *packet)/* Promiscuous mode? */ if (s->regs[GEM_NWCFG ] &GEM_NWCFG_PROMISC ) { -return GEM_RX_ACCEPT ; +return GEM_RX_PROMISCUOUS_ACCEPT ; }if (!memcmp (packet, broadcast_addr,6 )) {
@@ -546,7 +581,7 @@ static int gem_mac_address_filter(GemState *s, const uint8_t *packet)if (s->regs[GEM_NWCFG ] &GEM_NWCFG_BCAST_REJ ) {return GEM_RX_REJECT ; } -return GEM_RX_ACCEPT ; +return GEM_RX_BROADCAST_ACCEPT ; }/* Accept packets -w- hash match? */
@@ -557,24 +592,24 @@ static int gem_mac_address_filter(GemState *s, const uint8_t *packet) hash_index =calc_mac_hash (packet);if (hash_index <32 ) {if (s->regs[GEM_HASHLO ] & (1 <<hash_index)) { -return GEM_RX_ACCEPT ; +return packet[0 ] ==0x01 ?GEM_RX_MULTICAST_HASH_ACCEPT : +GEM_RX_UNICAST_HASH_ACCEPT ; } }else { hash_index -=32 ;if (s->regs[GEM_HASHHI ] & (1 <<hash_index)) { -return GEM_RX_ACCEPT ; +return packet[0 ] ==0x01 ?GEM_RX_MULTICAST_HASH_ACCEPT : +GEM_RX_UNICAST_HASH_ACCEPT ; } } }/* Check all 4 specific addresses */ gem_spaddr = (uint8_t *)&(s->regs[GEM_SPADDR1LO ]); -for (i =0 ; i <4 ; i++) { -if (!memcmp (packet, gem_spaddr,6 )) { -return GEM_RX_ACCEPT ; +for (i =3 ; i >=0 ; i--) { +if (!memcmp (packet, gem_spaddr +8 * i,6 )) { +return GEM_RX_SAR_ACCEPT + i; } - - gem_spaddr +=8 ; }/* No address match; reject the packet */
@@ -611,11 +646,13 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)uint8_t rxbuf[2048 ];uint8_t *rxbuf_ptr;bool first_desc = true; +int maf; s =qemu_get_nic_opaque (nc);/* Is this destination MAC address "for us" ? */ -if (gem_mac_address_filter (s, buf) ==GEM_RX_REJECT ) { + maf =gem_mac_address_filter (s, buf); +if (maf ==GEM_RX_REJECT ) {return -1 ; }
@@ -706,6 +743,25 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)rx_desc_set_length (s->rx_desc, size); }rx_desc_set_ownership (s->rx_desc); + +switch (maf) { +case GEM_RX_PROMISCUOUS_ACCEPT : +break ; +case GEM_RX_BROADCAST_ACCEPT : +rx_desc_set_broadcast (s->rx_desc); +break ; +case GEM_RX_UNICAST_HASH_ACCEPT : +rx_desc_set_unicast_hash (s->rx_desc); +break ; +case GEM_RX_MULTICAST_HASH_ACCEPT : +rx_desc_set_multicast_hash (s->rx_desc); +break ; +case GEM_RX_REJECT : +abort (); +default :/* SAR */ +rx_desc_set_sar (s->rx_desc, maf); + } +/* Descriptor write-back. */ cpu_physical_memory_write (s->rx_desc_addr, (uint8_t *)s->rx_desc,sizeof (s->rx_desc));
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 37/37] target-arm: fix TTBCR write masking
In reply to Peter MaydellFrom: Sergey Fedorov <[email protected]>
Current implementation is not accurate according to ARMv7-AR reference manual. See "B4.1.153 TTBCR, Translation Table Base Control Register, VMSA | TTBCR format when using the Long-descriptor translation table format". When LPAE feature is supported, EAE, bit[31] selects translation descriptor format and, therefore, TTBCR format.
Message-id: [email protected]
--- target-arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-arm/helper.c +1 -1
@@ -1173,7 +1173,7 @@ static int vmsa_ttbcr_raw_write(CPUARMState *env, const ARMCPRegInfo *ri, {int maskshift =extract32 (value,0 ,3 ); -if (arm_feature (env,ARM_FEATURE_LPAE )) { +if (arm_feature (env,ARM_FEATURE_LPAE ) && (value & (1 <<31 ))) { value &= ~((7 <<19 ) | (3 <<14 ) | (0xf <<3 )); }else { value &=7 ;
Signature · 1 line
1.8.5
[Qemu-devel] [PULL 18/37] net/cadence_gem: Don't assert against 0 buffer address
In reply to Peter MaydellFrom: Peter Crosthwaite <[email protected]>
This has no real hardware analog and asserting correctness of DMA addresses is not a perhiperal level problem. Delete.
Message-id: fc02417eb1874cb05e4f20531c6203c5a00110f1.1386136219.git.peter.crosthwaite@xilinx.com
--- hw/net/cadence_gem.c | 9 --------- 1 file changed, 9 deletions(-)
hw/net/cadence_gem.c +0 -9
@@ -688,15 +688,6 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)DB_PRINT ("copy %d bytes to 0x%x\n" ,MIN (bytes_to_copy, rxbufsize),rx_desc_get_buffer (desc)); -/* -* Let's have QEMU lend a helping hand. -*/ -if (rx_desc_get_buffer (desc) ==0 ) { -DB_PRINT ("Invalid RX buffer (NULL) for descriptor 0x%x\n" , - (unsigned )packet_desc_addr); -break ; - } -/* Copy packet data to emulated DMA buffer */ cpu_physical_memory_write (rx_desc_get_buffer (desc) + rxbuf_offset, rxbuf_ptr,MIN (bytes_to_copy, rxbufsize));
Signature · 1 line
1.8.5