target-arm queue
Subsystems (4)
target-arm queue: this clears out a bunch of patches I'd sent over the last coupled of weeks that have now got reviewed. Mostly this is MPS2 device support improvements, put there is also more of the incremental work towards supporting AArch32 Hyp mode, a floating point bugfix, and the raspi framebuffer viewport support.
thanks
-- PMM
The following changes since commit 5ccac548faf041ff5229a8e8342e3be14a34c8af:
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging (2018-08-23 17:35:48 +0100)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180824
for you to fetch changes up to 30a719e3cb5c5367f3651eba8fa935634bfee286:
hw/arm/mps2: Fix ID register errors on AN511 and AN385 (2018-08-24 10:22:44 +0100)
----------------------------------------------------------------
target-arm queue:
* Fix rounding errors in scaling float-to-int and int-to-float operations
* Connect virtualization-related IRQs and memory regions of GICv2 in boards that use Cortex-A7 or Cortex-A15
* Support taking exceptions to AArch32 Hyp mode
* Clear CPSR.IL and CPSR.J on 32-bit exception entry
(a minor bug fix that won't affect non-buggy guest code)
* mps2-an505: Implement various missing devices:
dual timer, watchdogs, counters in the FPGAIO registers, some missing ID/control registers, TrustZone Master Security Controllers, PL081 DMA controllers, PL022 SPI controllers
* correct ID register values for mps2-an385, -an511, -an505
* fix some hardcoded tabs in untouched backwaters of the target/arm codebase
* raspi: Refactor framebuffer property handling code and implement support for the virtual framebuffer/viewport
----------------------------------------------------------------
Peter Maydell (48):
hw/intc/arm_gic: Make per-cpu GICH memory regions 0x200 bytes large hw/arm/vexpress: Connect VIRQ and VFIQ
hw/arm/highbank: Connect VIRQ and VFIQ
hw/arm/fsl-imx6ul: Connect VIRQ and VFIQ
hw/arm/fsl-imx6ul: Connect VIRQ and VFIQ
hw/cpu/a15mpcore: If CPU has EL2, enable it on the GIC and wire it up hw/arm/vexpress: Don't set info->secure_boot if CPU doesn't have EL3 hw/arm/vexpress: Add "virtualization" property controlling presence of EL2 target/arm: Implement RAZ/WI HACTLR2
target/arm: Implement AArch32 HCR and HCR2
target/arm: Factor out code for taking an AArch32 exception target/arm: Implement support for taking exceptions to Hyp mode target/arm: Clear CPSR.IL and CPSR.J on 32-bit exception entry hw/arm/boot: AArch32 kernels should be started in Hyp mode if available hw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module hw/arm/iotkit: Wire up the dualtimer
hw/arm/mps2: Wire up dual-timer in mps2-an385 and mps2-an511 hw/arm/iotkit: Wire up the watchdogs
hw/arm/iotkit: Wire up the S32KTIMER
hw/misc/iotkit-sysctl: Implement IoTKit system control element hw/misc/iotkit-sysinfo: Implement IoTKit system information block hw/misc/iotkit: Wire up the sysctl and sysinfo register blocks hw/misc/tz-msc: Model TrustZone Master Security Controller hw/misc/iotkit-secctl: Wire up registers for controlling MSCs hw/arm/iotkit: Wire up the lines for MSCs
hw/arm/mps2-tz: Create PL081s and MSCs
hw/ssi/pl022: Allow use as embedded-struct device hw/ssi/pl022: Set up reset function in class init hw/ssi/pl022: Don't directly call vmstate_register() hw/ssi/pl022: Use DeviceState::realize rather than SysBusDevice::init hw/ssi/pl022: Correct wrong value for PL022_INT_RT hw/ssi/pl022: Correct wrong DMACR and ICR handling hw/arm/mps2-tz: Instantiate SPI controllers
hw/arm/mps2-tz: Fix MPS2 SCC config register values target/arm: Untabify translate.c
target/arm: Untabify iwmmxt_helper.c
target/arm: Remove a handful of stray tabs hw/misc/bcm2835_fb: Move config fields to their own struct hw/misc/bcm2835_property: Track fb settings using BCM2835FBConfig hw/display/bcm2835_fb: Drop unused size and pitch fields hw/display/bcm2835_fb: Reset resolution, etc correctly hw/display/bcm2835_fb: Abstract out calculation of pitch, size hw/display/bcm2835_fb: Fix handling of virtual framebuffer hw/display/bcm2835_fb: Validate config settings hw/display/bcm2835_fb: Validate bcm2835_fb_mbox_push() config hw/arm/mps2: Fix ID register errors on AN511 and AN385
Richard Henderson (4):
softfloat: Add scaling int-to-float routines
softfloat: Add scaling float-to-int routines target/arm: Use the int-to-float-scale softfloat routines target/arm: Use the float-to-int-scale softfloat routines
hw/misc/Makefile.objs | 3 + hw/timer/Makefile.objs | 1 + include/fpu/softfloat.h | 169 +++++++--- include/hw/arm/iotkit.h | 25 +- include/hw/display/bcm2835_fb.h | 59 +++- include/hw/misc/iotkit-secctl.h | 14 + include/hw/misc/iotkit-sysctl.h | 49 +++ include/hw/misc/iotkit-sysinfo.h | 37 +++ include/hw/misc/mps2-fpgaio.h | 10 + include/hw/misc/tz-msc.h | 79 +++++ include/hw/ssi/pl022.h | 51 +++ include/hw/timer/cmsdk-apb-dualtimer.h | 72 ++++ target/arm/cpu.h | 16 +- fpu/softfloat.c | 579 ++++++++++++++++++++++++++------- hw/arm/boot.c | 11 + hw/arm/fsl-imx6ul.c | 4 + hw/arm/fsl-imx7.c | 4 + hw/arm/highbank.c | 6 + hw/arm/iotkit.c | 114 ++++++- hw/arm/mps2-tz.c | 142 +++++++- hw/arm/mps2.c | 17 +- hw/arm/vexpress.c | 64 +++- hw/cpu/a15mpcore.c | 31 +- hw/display/bcm2835_fb.c | 218 ++++++++----- hw/intc/arm_gic.c | 2 +- hw/misc/bcm2835_property.c | 123 ++++--- hw/misc/iotkit-secctl.c | 73 ++++- hw/misc/iotkit-sysctl.c | 261 +++++++++++++++ hw/misc/iotkit-sysinfo.c | 128 ++++++++ hw/misc/mps2-fpgaio.c | 146 ++++++++- hw/misc/tz-msc.c | 308 ++++++++++++++++++ hw/ssi/pl022.c | 57 ++-- hw/timer/cmsdk-apb-dualtimer.c | 515 +++++++++++++++++++++++++++++ target/arm/arm-semi.c | 2 +- target/arm/helper.c | 342 +++++++++++++------ target/arm/iwmmxt_helper.c | 234 ++++++------- target/arm/translate.c | 122 +++---- MAINTAINERS | 10 + default-configs/arm-softmmu.mak | 4 + hw/misc/trace-events | 16 + hw/timer/trace-events | 5 + 41 files changed, 3405 insertions(+), 718 deletions(-) create mode 100644 include/hw/misc/iotkit-sysctl.h create mode 100644 include/hw/misc/iotkit-sysinfo.h create mode 100644 include/hw/misc/tz-msc.h create mode 100644 include/hw/ssi/pl022.h create mode 100644 include/hw/timer/cmsdk-apb-dualtimer.h create mode 100644 hw/misc/iotkit-sysctl.c create mode 100644 hw/misc/iotkit-sysinfo.c create mode 100644 hw/misc/tz-msc.c create mode 100644 hw/timer/cmsdk-apb-dualtimer.c
[Qemu-devel] [PULL 03/52] target/arm: Use the int-to-float-scale softfloat routines
From: Richard Henderson <[email protected]>
Message-id: [email protected]
--- target/arm/helper.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-)
target/arm/helper.c +5 -24
@@ -11564,12 +11564,7 @@ float32 VFP_HELPER(fcvts, d)(float64 x, CPUARMState *env)#define VFP_CONV_FIX_FLOAT (name, p, fsz, isz, itype) \ float##fsz HELPER(vfp_##name##to##p)(uint##isz##_t x, uint32_t shift, \ void *fpstp) \ -{ \ - float_status *fpst = fpstp; \ - float##fsz tmp; \ - tmp = itype##_to_##float##fsz(x, fpst); \ - return float##fsz##_scalbn(tmp, -(int)shift, fpst); \ -} +{ return itype##_to_##float##fsz##_scalbn(x, -shift, fpstp); }/* Notice that we want only input-denormal exception flags from the * scalbn operation: the other possible flags (overflow+inexact if
@@ -11622,38 +11617,24 @@ VFP_CONV_FIX_A64(uq, s, 32, 64, uint64)#undef VFP_CONV_FLOAT_FIX_ROUND#undef VFP_CONV_FIX_A64 -/* Conversion to/from f16 can overflow to infinity before/after scaling. -* Therefore we convert to f64, scale, and then convert f64 to f16; or -* vice versa for conversion to integer. -* -* For 16- and 32-bit integers, the conversion to f64 never rounds. -* For 64-bit integers, any integer that would cause rounding will also -* overflow to f16 infinity, so there is no double rounding problem. -*/ - -static float16 do_postscale_fp16 (float64 f,int shift,float_status *fpst) -{ -return float64_to_float16 (float64_scalbn (f, -shift, fpst), true, fpst); -} -uint32_t HELPER (vfp_sltoh )(uint32_t x,uint32_t shift,void *fpst) { -return do_postscale_fp16 (int32_to_float64 (x, fpst), shift, fpst); +return int32_to_float16_scalbn (x, -shift, fpst); }uint32_t HELPER (vfp_ultoh )(uint32_t x,uint32_t shift,void *fpst) { -return do_postscale_fp16 (uint32_to_float64 (x, fpst), shift, fpst); +return uint32_to_float16_scalbn (x, -shift, fpst); }uint32_t HELPER (vfp_sqtoh )(uint64_t x,uint32_t shift,void *fpst) { -return do_postscale_fp16 (int64_to_float64 (x, fpst), shift, fpst); +return int64_to_float16_scalbn (x, -shift, fpst); }uint32_t HELPER (vfp_uqtoh )(uint64_t x,uint32_t shift,void *fpst) { -return do_postscale_fp16 (uint64_to_float64 (x, fpst), shift, fpst); +return uint64_to_float16_scalbn (x, -shift, fpst); }static float64 do_prescale_fp16 (float16 f,int shift,float_status *fpst)
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 04/52] target/arm: Use the float-to-int-scale softfloat routines
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- target/arm/helper.c | 101 ++++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 50 deletions(-)
target/arm/helper.c +51 -50
@@ -11566,38 +11566,28 @@ float##fsz HELPER(vfp_##name##to##p)(uint##isz##_t x, uint32_t shift, \ void *fpstp) \ { return itype##_to_##float##fsz##_scalbn(x, -shift, fpstp); } -/* Notice that we want only input-denormal exception flags from the -* scalbn operation: the other possible flags (overflow+inexact if -* we overflow to infinity, output-denormal) aren't correct for the -* complete scale-and-convert operation. -*/ -#define VFP_CONV_FLOAT_FIX_ROUND (name, p, fsz, isz, itype, round) \ -uint##isz##_t HELPER(vfp_to##name##p##round)(float##fsz x, \ - uint32_t shift, \ - void *fpstp) \ -{ \ - float_status *fpst = fpstp; \ - int old_exc_flags = get_float_exception_flags(fpst); \ - float##fsz tmp; \ - if (float##fsz##_is_any_nan(x)) { \ - float_raise(float_flag_invalid, fpst); \ - return 0; \ - } \ - tmp = float##fsz##_scalbn(x, shift, fpst); \ - old_exc_flags |= get_float_exception_flags(fpst) \ - & float_flag_input_denormal; \ - set_float_exception_flags(old_exc_flags, fpst); \ - return float##fsz##_to_##itype##round(tmp, fpst); \ +#define VFP_CONV_FLOAT_FIX_ROUND (name, p, fsz, isz, itype,ROUND , suff) \ +uint##isz##_t HELPER(vfp_to##name##p##suff)(float##fsz x, uint32_t shift, \ + void *fpst) \ +{ \ + if (unlikely(float##fsz##_is_any_nan(x))) { \ + float_raise(float_flag_invalid, fpst); \ + return 0; \ + } \ + return float##fsz##_to_##itype##_scalbn(x, ROUND, shift, fpst); \ }#define VFP_CONV_FIX (name, p, fsz, isz, itype) \ VFP_CONV_FIX_FLOAT(name, p, fsz, isz, itype) \ -VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, isz, itype, _round_to_zero) \ -VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, isz, itype, ) +VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, isz, itype, \ + float_round_to_zero, _round_to_zero) \ +VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, isz, itype, \ + get_float_rounding_mode(fpst), )#define VFP_CONV_FIX_A64 (name, p, fsz, isz, itype) \ VFP_CONV_FIX_FLOAT(name, p, fsz, isz, itype) \ -VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, isz, itype, ) +VFP_CONV_FLOAT_FIX_ROUND(name, p, fsz, isz, itype, \ + get_float_rounding_mode(fpst), ) VFP_CONV_FIX(sh, d, 64, 64, int16)VFP_CONV_FIX (sl, d,64 ,64 , int32)
@@ -11637,53 +11627,64 @@ uint32_t HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst)return uint64_to_float16_scalbn (x, -shift, fpst); } -static float64 do_prescale_fp16 (float16 f,int shift,float_status *fpst) -{ -if (unlikely (float16_is_any_nan (f))) { -float_raise (float_flag_invalid, fpst); -return 0 ; - }else { -int old_exc_flags =get_float_exception_flags (fpst); -float64 ret; - - ret =float16_to_float64 (f, true, fpst); - ret =float64_scalbn (ret, shift, fpst); - old_exc_flags |=get_float_exception_flags (fpst) - & float_flag_input_denormal; -set_float_exception_flags (old_exc_flags, fpst); - -return ret; - } -} -uint32_t HELPER (vfp_toshh )(uint32_t x,uint32_t shift,void *fpst) { -return float64_to_int16 (do_prescale_fp16 (x, shift, fpst), fpst); +if (unlikely (float16_is_any_nan (x))) { +float_raise (float_flag_invalid, fpst); +return 0 ; + } +return float16_to_int16_scalbn (x,get_float_rounding_mode (fpst), + shift, fpst); }uint32_t HELPER (vfp_touhh )(uint32_t x,uint32_t shift,void *fpst) { -return float64_to_uint16 (do_prescale_fp16 (x, shift, fpst), fpst); +if (unlikely (float16_is_any_nan (x))) { +float_raise (float_flag_invalid, fpst); +return 0 ; + } +return float16_to_uint16_scalbn (x,get_float_rounding_mode (fpst), + shift, fpst); }uint32_t HELPER (vfp_toslh )(uint32_t x,uint32_t shift,void *fpst) { -return float64_to_int32 (do_prescale_fp16 (x, shift, fpst), fpst); +if (unlikely (float16_is_any_nan (x))) { +float_raise (float_flag_invalid, fpst); +return 0 ; + } +return float16_to_int32_scalbn (x,get_float_rounding_mode (fpst), + shift, fpst); }uint32_t HELPER (vfp_toulh )(uint32_t x,uint32_t shift,void *fpst) { -return float64_to_uint32 (do_prescale_fp16 (x, shift, fpst), fpst); +if (unlikely (float16_is_any_nan (x))) { +float_raise (float_flag_invalid, fpst); +return 0 ; + } +return float16_to_uint32_scalbn (x,get_float_rounding_mode (fpst), + shift, fpst); }uint64_t HELPER (vfp_tosqh )(uint32_t x,uint32_t shift,void *fpst) { -return float64_to_int64 (do_prescale_fp16 (x, shift, fpst), fpst); +if (unlikely (float16_is_any_nan (x))) { +float_raise (float_flag_invalid, fpst); +return 0 ; + } +return float16_to_int64_scalbn (x,get_float_rounding_mode (fpst), + shift, fpst); }uint64_t HELPER (vfp_touqh )(uint32_t x,uint32_t shift,void *fpst) { -return float64_to_uint64 (do_prescale_fp16 (x, shift, fpst), fpst); +if (unlikely (float16_is_any_nan (x))) { +float_raise (float_flag_invalid, fpst); +return 0 ; + } +return float16_to_uint64_scalbn (x,get_float_rounding_mode (fpst), + shift, fpst); }/* Set the current fp rounding mode and return the old one.
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 05/52] hw/intc/arm_gic: Make per-cpu GICH memory regions 0x200 bytes large
In reply to Peter MaydellReduce the size of the per-cpu GICH memory regions from 0x1000 to 0x200. The registers only cover 0x200 bytes, and the Cortex-A15 wants to map them at a spacing of 0x200 bytes apart. Having the region be too large interferes with mapping them like that, so reduce it.
Message-id: [email protected]
--- hw/intc/arm_gic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/arm_gic.c +1 -1
@@ -2084,7 +2084,7 @@ static void arm_gic_realize(DeviceState *dev, Error **errp)for (i =0 ; i < s->num_cpu; i++) {memory_region_init_io (&s->vifaceiomem[i +1 ],OBJECT (s), &gic_viface_ops, &s->backref[i], -"gic_viface" ,0x1000 ); +"gic_viface" ,0x200 );sysbus_init_mmio (sbd, &s->vifaceiomem[i +1 ]); } }
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 06/52] hw/arm/vexpress: Connect VIRQ and VFIQ
In reply to Peter MaydellConnect the VIRQ and VFIQ lines from the GIC to the CPU; these exist always for both CPU and GIC whether the virtualization extensions are enabled or not, so we can just unconditionally connect them.
Message-id: [email protected]
--- hw/arm/vexpress.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/arm/vexpress.c +4 -0
@@ -251,6 +251,10 @@ static void init_cpus(const char *cpu_type, const char *privdev,sysbus_connect_irq (busdev, n,qdev_get_gpio_in (cpudev,ARM_CPU_IRQ ));sysbus_connect_irq (busdev, n + smp_cpus,qdev_get_gpio_in (cpudev,ARM_CPU_FIQ )); +sysbus_connect_irq (busdev, n +2 * smp_cpus, +qdev_get_gpio_in (cpudev,ARM_CPU_VIRQ )); +sysbus_connect_irq (busdev, n +3 * smp_cpus, +qdev_get_gpio_in (cpudev,ARM_CPU_VFIQ )); } }
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 01/52] softfloat: Add scaling int-to-float routines
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- include/fpu/softfloat.h | 56 ++++++++---- fpu/softfloat.c | 188 +++++++++++++++++++++++++++++----------- 2 files changed, 179 insertions(+), 65 deletions(-)
include/fpu/softfloat.h +41 -15
@@ -190,22 +190,54 @@ enum {/*---------------------------------------------------------------------------- | Software IEC/IEEE integer-to-floating-point conversion routines. *----------------------------------------------------------------------------*/ + +float16 int16_to_float16_scalbn (int16_t a,int ,float_status *status); +float16 int32_to_float16_scalbn (int32_t a,int ,float_status *status); +float16 int64_to_float16_scalbn (int64_t a,int ,float_status *status); +float16 uint16_to_float16_scalbn (uint16_t a,int ,float_status *status); +float16 uint32_to_float16_scalbn (uint32_t a,int ,float_status *status); +float16 uint64_to_float16_scalbn (uint64_t a,int ,float_status *status); + +float16 int16_to_float16 (int16_t a,float_status *status); +float16 int32_to_float16 (int32_t a,float_status *status); +float16 int64_to_float16 (int64_t a,float_status *status); +float16 uint16_to_float16 (uint16_t a,float_status *status); +float16 uint32_to_float16 (uint32_t a,float_status *status); +float16 uint64_to_float16 (uint64_t a,float_status *status); + +float32 int16_to_float32_scalbn (int16_t ,int ,float_status *status); +float32 int32_to_float32_scalbn (int32_t ,int ,float_status *status); +float32 int64_to_float32_scalbn (int64_t ,int ,float_status *status); +float32 uint16_to_float32_scalbn (uint16_t ,int ,float_status *status); +float32 uint32_to_float32_scalbn (uint32_t ,int ,float_status *status); +float32 uint64_to_float32_scalbn (uint64_t ,int ,float_status *status); +float32 int16_to_float32 (int16_t ,float_status *status);float32 int32_to_float32 (int32_t ,float_status *status); -float64 int16_to_float64 (int16_t ,float_status *status); -float64 int32_to_float64 (int32_t ,float_status *status); +float32 int64_to_float32 (int64_t ,float_status *status);float32 uint16_to_float32 (uint16_t ,float_status *status);float32 uint32_to_float32 (uint32_t ,float_status *status); +float32 uint64_to_float32 (uint64_t ,float_status *status); + +float64 int16_to_float64_scalbn (int16_t ,int ,float_status *status); +float64 int32_to_float64_scalbn (int32_t ,int ,float_status *status); +float64 int64_to_float64_scalbn (int64_t ,int ,float_status *status); +float64 uint16_to_float64_scalbn (uint16_t ,int ,float_status *status); +float64 uint32_to_float64_scalbn (uint32_t ,int ,float_status *status); +float64 uint64_to_float64_scalbn (uint64_t ,int ,float_status *status); + +float64 int16_to_float64 (int16_t ,float_status *status); +float64 int32_to_float64 (int32_t ,float_status *status); +float64 int64_to_float64 (int64_t ,float_status *status);float64 uint16_to_float64 (uint16_t ,float_status *status);float64 uint32_to_float64 (uint32_t ,float_status *status); -floatx80 int32_to_floatx80 (int32_t ,float_status *status); -float128 int32_to_float128 (int32_t ,float_status *status); -float32 int64_to_float32 (int64_t ,float_status *status); -float64 int64_to_float64 (int64_t ,float_status *status); -floatx80 int64_to_floatx80 (int64_t ,float_status *status); -float128 int64_to_float128 (int64_t ,float_status *status); -float32 uint64_to_float32 (uint64_t ,float_status *status);float64 uint64_to_float64 (uint64_t ,float_status *status); + +floatx80 int32_to_floatx80 (int32_t ,float_status *status); +floatx80 int64_to_floatx80 (int64_t ,float_status *status); + +float128 int32_to_float128 (int32_t ,float_status *status); +float128 int64_to_float128 (int64_t ,float_status *status);float128 uint64_to_float128 (uint64_t ,float_status *status);/*----------------------------------------------------------------------------
@@ -227,12 +259,6 @@ int64_t float16_to_int64(float16, float_status *status);uint64_t float16_to_uint64 (float16 a,float_status *status);int64_t float16_to_int64_round_to_zero (float16 ,float_status *status);uint64_t float16_to_uint64_round_to_zero (float16 a,float_status *status); -float16 int16_to_float16 (int16_t a,float_status *status); -float16 int32_to_float16 (int32_t a,float_status *status); -float16 int64_to_float16 (int64_t a,float_status *status); -float16 uint16_to_float16 (uint16_t a,float_status *status); -float16 uint32_to_float16 (uint32_t a,float_status *status); -float16 uint64_to_float16 (uint64_t a,float_status *status);/*---------------------------------------------------------------------------- | Software half-precision operations.
fpu/softfloat.c +138 -50
292 lines not on this page · raw message
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 07/52] hw/arm/highbank: Connect VIRQ and VFIQ
In reply to Peter MaydellConnect the VIRQ and VFIQ lines from the GIC to the CPU; these exist always for both CPU and GIC whether the virtualization extensions are enabled or not, so we can just unconditionally connect them.
Message-id: [email protected]
--- hw/arm/highbank.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/arm/highbank.c +6 -0
@@ -243,6 +243,8 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)int n;qemu_irq cpu_irq[4 ];qemu_irq cpu_fiq[4 ]; +qemu_irq cpu_virq[4 ]; +qemu_irq cpu_vfiq[4 ];MemoryRegion *sysram;MemoryRegion *dram;MemoryRegion *sysmem;
@@ -282,6 +284,8 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)object_property_set_bool (cpuobj, true,"realized" , &error_fatal); cpu_irq[n] =qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_IRQ ); cpu_fiq[n] =qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_FIQ ); + cpu_virq[n] =qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_VIRQ ); + cpu_vfiq[n] =qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_VFIQ ); } sysmem =get_system_memory ();
@@ -329,6 +333,8 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)for (n =0 ; n < smp_cpus; n++) {sysbus_connect_irq (busdev, n, cpu_irq[n]);sysbus_connect_irq (busdev, n + smp_cpus, cpu_fiq[n]); +sysbus_connect_irq (busdev, n +2 * smp_cpus, cpu_virq[n]); +sysbus_connect_irq (busdev, n +3 * smp_cpus, cpu_vfiq[n]); }for (n =0 ; n <128 ; n++) {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 09/52] hw/arm/fsl-imx6ul: Connect VIRQ and VFIQ
In reply to Peter MaydellConnect the VIRQ and VFIQ lines from the GIC to the CPU; these exist always for both CPU and GIC whether the virtualization extensions are enabled or not, so we can just unconditionally connect them.
Message-id: [email protected]
--- hw/arm/fsl-imx7.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/arm/fsl-imx7.c +4 -0
@@ -209,6 +209,10 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)sysbus_connect_irq (sbd, i, irq); irq =qdev_get_gpio_in (d,ARM_CPU_FIQ );sysbus_connect_irq (sbd, i + smp_cpus, irq); + irq =qdev_get_gpio_in (d,ARM_CPU_VIRQ ); +sysbus_connect_irq (sbd, i +2 * smp_cpus, irq); + irq =qdev_get_gpio_in (d,ARM_CPU_VFIQ ); +sysbus_connect_irq (sbd, i +3 * smp_cpus, irq); }/*
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 02/52] softfloat: Add scaling float-to-int routines
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- include/fpu/softfloat.h | 85 ++++++--- fpu/softfloat.c | 391 ++++++++++++++++++++++++++++++++-------- 2 files changed, 379 insertions(+), 97 deletions(-)
include/fpu/softfloat.h +62 -23
@@ -243,21 +243,34 @@ float128 uint64_to_float128(uint64_t, float_status *status);/*---------------------------------------------------------------------------- | Software half-precision conversion routines. *----------------------------------------------------------------------------*/ +float16 float32_to_float16 (float32 ,bool ieee,float_status *status);float32 float16_to_float32 (float16 ,bool ieee,float_status *status);float16 float64_to_float16 (float64 a,bool ieee,float_status *status);float64 float16_to_float64 (float16 a,bool ieee,float_status *status); + +int16_t float16_to_int16_scalbn (float16 ,int ,int ,float_status *status); +int32_t float16_to_int32_scalbn (float16 ,int ,int ,float_status *status); +int64_t float16_to_int64_scalbn (float16 ,int ,int ,float_status *status); +int16_t float16_to_int16 (float16 ,float_status *status); -uint16_t float16_to_uint16 (float16 a,float_status *status); -int16_t float16_to_int16_round_to_zero (float16 ,float_status *status); -uint16_t float16_to_uint16_round_to_zero (float16 a,float_status *status);int32_t float16_to_int32 (float16 ,float_status *status); -uint32_t float16_to_uint32 (float16 a,float_status *status); -int32_t float16_to_int32_round_to_zero (float16 ,float_status *status); -uint32_t float16_to_uint32_round_to_zero (float16 a,float_status *status);int64_t float16_to_int64 (float16 ,float_status *status); -uint64_t float16_to_uint64 (float16 a,float_status *status); + +int16_t float16_to_int16_round_to_zero (float16 ,float_status *status); +int32_t float16_to_int32_round_to_zero (float16 ,float_status *status);int64_t float16_to_int64_round_to_zero (float16 ,float_status *status); + +uint16_t float16_to_uint16_scalbn (float16 a,int ,int ,float_status *status); +uint32_t float16_to_uint32_scalbn (float16 a,int ,int ,float_status *status); +uint64_t float16_to_uint64_scalbn (float16 a,int ,int ,float_status *status); + +uint16_t float16_to_uint16 (float16 a,float_status *status); +uint32_t float16_to_uint32 (float16 a,float_status *status); +uint64_t float16_to_uint64 (float16 a,float_status *status); + +uint16_t float16_to_uint16_round_to_zero (float16 a,float_status *status); +uint32_t float16_to_uint32_round_to_zero (float16 a,float_status *status);uint64_t float16_to_uint64_round_to_zero (float16 a,float_status *status);/*----------------------------------------------------------------------------
@@ -347,18 +360,31 @@ float16 float16_default_nan(float_status *status);/*---------------------------------------------------------------------------- | Software IEC/IEEE single-precision conversion routines. *----------------------------------------------------------------------------*/ + +int16_t float32_to_int16_scalbn (float32 ,int ,int ,float_status *status); +int32_t float32_to_int32_scalbn (float32 ,int ,int ,float_status *status); +int64_t float32_to_int64_scalbn (float32 ,int ,int ,float_status *status); +int16_t float32_to_int16 (float32 ,float_status *status); -uint16_t float32_to_uint16 (float32 ,float_status *status); -int16_t float32_to_int16_round_to_zero (float32 ,float_status *status); -uint16_t float32_to_uint16_round_to_zero (float32 ,float_status *status);int32_t float32_to_int32 (float32 ,float_status *status); -int32_t float32_to_int32_round_to_zero (float32 ,float_status *status); -uint32_t float32_to_uint32 (float32 ,float_status *status); -uint32_t float32_to_uint32_round_to_zero (float32 ,float_status *status);int64_t float32_to_int64 (float32 ,float_status *status); -uint64_t float32_to_uint64 (float32 ,float_status *status); -uint64_t float32_to_uint64_round_to_zero (float32 ,float_status *status); + +int16_t float32_to_int16_round_to_zero (float32 ,float_status *status); +int32_t float32_to_int32_round_to_zero (float32 ,float_status *status);int64_t float32_to_int64_round_to_zero (float32 ,float_status *status); + +uint16_t float32_to_uint16_scalbn (float32 ,int ,int ,float_status *status); +uint32_t float32_to_uint32_scalbn (float32 ,int ,int ,float_status *status); +uint64_t float32_to_uint64_scalbn (float32 ,int ,int ,float_status *status); + +uint16_t float32_to_uint16 (float32 ,float_status *status); +uint32_t float32_to_uint32 (float32 ,float_status *status); +uint64_t float32_to_uint64 (float32 ,float_status *status); + +uint16_t float32_to_uint16_round_to_zero (float32 ,float_status *status); +uint32_t float32_to_uint32_round_to_zero (float32 ,float_status *status); +uint64_t float32_to_uint64_round_to_zero (float32 ,float_status *status); +float64 float32_to_float64 (float32 ,float_status *status);floatx80 float32_to_floatx80 (float32 ,float_status *status);float128 float32_to_float128 (float32 ,float_status *status);
@@ -476,18 +502,31 @@ float32 float32_default_nan(float_status *status);/*---------------------------------------------------------------------------- | Software IEC/IEEE double-precision conversion routines. *----------------------------------------------------------------------------*/ + +int16_t float64_to_int16_scalbn (float64 ,int ,int ,float_status *status); +int32_t float64_to_int32_scalbn (float64 ,int ,int ,float_status *status); +int64_t float64_to_int64_scalbn (float64 ,int ,int ,float_status *status); +int16_t float64_to_int16 (float64 ,float_status *status); -uint16_t float64_to_uint16 (float64 ,float_status *status); -int16_t float64_to_int16_round_to_zero (float64 ,float_status *status); -uint16_t float64_to_uint16_round_to_zero (float64 ,float_status *status);int32_t float64_to_int32 (float64 ,float_status *status); -int32_t float64_to_int32_round_to_zero (float64 ,float_status *status); -uint32_t float64_to_uint32 (float64 ,float_status *status); -uint32_t float64_to_uint32_round_to_zero (float64 ,float_status *status);int64_t float64_to_int64 (float64 ,float_status *status); + +int16_t float64_to_int16_round_to_zero (float64 ,float_status *status); +int32_t float64_to_int32_round_to_zero (float64 ,float_status *status);int64_t float64_to_int64_round_to_zero (float64 ,float_status *status); -uint64_t float64_to_uint64 (float64 a,float_status *status); -uint64_t float64_to_uint64_round_to_zero (float64 a,float_status *status); + +uint16_t float64_to_uint16_scalbn (float64 ,int ,int ,float_status *status); +uint32_t float64_to_uint32_scalbn (float64 ,int ,int ,float_status *status); +uint64_t float64_to_uint64_scalbn (float64 ,int ,int ,float_status *status); + +uint16_t float64_to_uint16 (float64 ,float_status *status); +uint32_t float64_to_uint32 (float64 ,float_status *status); +uint64_t float64_to_uint64 (float64 ,float_status *status); + +uint16_t float64_to_uint16_round_to_zero (float64 ,float_status *status); +uint32_t float64_to_uint32_round_to_zero (float64 ,float_status *status); +uint64_t float64_to_uint64_round_to_zero (float64 ,float_status *status); +float32 float64_to_float32 (float64 ,float_status *status);floatx80 float64_to_floatx80 (float64 ,float_status *status);float128 float64_to_float128 (float64 ,float_status *status);
fpu/softfloat.c +317 -74
493 lines not on this page · raw message
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 08/52] hw/arm/fsl-imx6ul: Connect VIRQ and VFIQ
In reply to Peter MaydellConnect the VIRQ and VFIQ lines from the GIC to the CPU; these exist always for both CPU and GIC whether the virtualization extensions are enabled or not, so we can just unconditionally connect them.
Message-id: [email protected]
--- hw/arm/fsl-imx6ul.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/arm/fsl-imx6ul.c +4 -0
@@ -207,6 +207,10 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) irq =qdev_get_gpio_in (d,ARM_CPU_IRQ );sysbus_connect_irq (sbd, i, irq);sysbus_connect_irq (sbd, i + smp_cpus,qdev_get_gpio_in (d,ARM_CPU_FIQ )); +sysbus_connect_irq (sbd, i +2 * smp_cpus, +qdev_get_gpio_in (d,ARM_CPU_VIRQ )); +sysbus_connect_irq (sbd, i +3 * smp_cpus, +qdev_get_gpio_in (d,ARM_CPU_VFIQ )); }/*
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 10/52] hw/cpu/a15mpcore: If CPU has EL2, enable it on the GIC and wire it up
In reply to Peter MaydellFor the A15MPCore internal peripheral object, we handle GIC security extensions support by checking whether the CPUs have EL3 enabled; if so then we enable it also on the GIC. Handle the virtualization extensions in the same way: if the CPU has EL2 then enable it on the GIC and wire up the virtualization-specific memory regions and the maintenance interrupt.
Message-id: [email protected]
--- hw/cpu/a15mpcore.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
hw/cpu/a15mpcore.c +28 -3
@@ -53,6 +53,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)int i;Error *err =NULL ;bool has_el3; +bool has_el2;Object *cpuobj; gicdev =DEVICE (&s->gic);
@@ -67,6 +68,10 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp) has_el3 =object_property_find (cpuobj,"has_el3" ,NULL ) &&object_property_get_bool (cpuobj,"has_el3" , &error_abort);qdev_prop_set_bit (gicdev,"has-security-extensions" , has_el3); +/* Similarly for virtualization support */ + has_el2 =object_property_find (cpuobj,"has_el2" ,NULL ) && +object_property_get_bool (cpuobj,"has_el2" , &error_abort); +qdev_prop_set_bit (gicdev,"has-virtualization-extensions" , has_el2); }object_property_set_bool (OBJECT (&s->gic), true,"realized" , &err);
@@ -103,20 +108,40 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)qdev_get_gpio_in (gicdev, ppibase + timer_irq[irq])); } +if (has_el2) { +/* Connect the GIC maintenance interrupt to PPI ID 25 */ +sysbus_connect_irq (SYS_BUS_DEVICE (gicdev), i +4 * s->num_cpu, +qdev_get_gpio_in (gicdev, ppibase +25 )); + } }/* Memory map (addresses are offsets from PERIPHBASE): * 0x0000-0x0fff -- reserved * 0x1000-0x1fff -- GIC Distributor * 0x2000-0x3fff -- GIC CPU interface -* 0x4000-0x4fff -- GIC virtual interface control (not modelled) -* 0x5000-0x5fff -- GIC virtual interface control (not modelled) -* 0x6000-0x7fff -- GIC virtual CPU interface (not modelled) +* 0x4000-0x4fff -- GIC virtual interface control for this CPU +* 0x5000-0x51ff -- GIC virtual interface control for CPU 0 +* 0x5200-0x53ff -- GIC virtual interface control for CPU 1 +* 0x5400-0x55ff -- GIC virtual interface control for CPU 2 +* 0x5600-0x57ff -- GIC virtual interface control for CPU 3 +* 0x6000-0x7fff -- GIC virtual CPU interface */ memory_region_add_subregion (&s->container,0x1000 ,sysbus_mmio_get_region (busdev,0 ));memory_region_add_subregion (&s->container,0x2000 ,sysbus_mmio_get_region (busdev,1 )); +if (has_el2) { +memory_region_add_subregion (&s->container,0x4000 , +sysbus_mmio_get_region (busdev,2 )); +memory_region_add_subregion (&s->container,0x6000 , +sysbus_mmio_get_region (busdev,3 )); +for (i =0 ; i < s->num_cpu; i++) { +hwaddr base =0x5000 + i *0x200 ; +MemoryRegion *mr =sysbus_mmio_get_region (busdev, +4 + s->num_cpu + i); +memory_region_add_subregion (&s->container, base, mr); + } + } }static Property a15mp_priv_properties[] = {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 11/52] hw/arm/vexpress: Don't set info->secure_boot if CPU doesn't have EL3
In reply to Peter MaydellDon't request that the arm_load_kernel() code should boot in secure state if the CPU doesn't have a secure state. Currently this doesn't make a difference because the boot.c code only examines the secure_boot flag in code guarded by an ARM_FEATURE_EL3 check, but upcoming changes for supporting booting into Hyp mode will change that.
Message-id: [email protected]
--- hw/arm/vexpress.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/vexpress.c +2 -2
@@ -705,8 +705,8 @@ static void vexpress_common_init(MachineState *machine) daughterboard->bootinfo.smp_bootreg_addr = map[VE_SYSREGS ] +0x30 ; daughterboard->bootinfo.gic_cpu_if_addr = daughterboard->gic_cpu_if_addr; daughterboard->bootinfo.modify_dtb = vexpress_modify_dtb; -/* Indicate that when booting Linux we should be in secure state */ - daughterboard->bootinfo.secure_boot = true; +/* When booting Linux we should be in secure state if the CPU has one. */ + daughterboard->bootinfo.secure_boot = vms->secure;arm_load_kernel (ARM_CPU (first_cpu), &daughterboard->bootinfo); }
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 12/52] hw/arm/vexpress: Add "virtualization" property controlling presence of EL2
In reply to Peter MaydellAdd a "virtualization" property to the vexpress-a15 board, controlling presence of EL2. As with EL3, we default to enabling it, but the user can disable it if they have an older guest which can't cope with it being present.
Message-id: [email protected]
--- hw/arm/vexpress.c | 56 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-)
hw/arm/vexpress.c +53 -3
@@ -172,6 +172,7 @@ typedef struct {typedef struct {MachineState parent;bool secure; +bool virt; }VexpressMachineState ;#define TYPE_VEXPRESS_MACHINE "vexpress"
@@ -203,7 +204,7 @@ struct VEDBoardInfo { };static void init_cpus (const char *cpu_type,const char *privdev, -hwaddr periphbase,qemu_irq *pic,bool secure) +hwaddr periphbase,qemu_irq *pic,bool secure,bool virt) {DeviceState *dev;SysBusDevice *busdev;
@@ -216,6 +217,11 @@ static void init_cpus(const char *cpu_type, const char *privdev,if (!secure) {object_property_set_bool (cpuobj, false,"has_el3" ,NULL ); } +if (!virt) { +if (object_property_find (cpuobj,"has_el2" ,NULL )) { +object_property_set_bool (cpuobj, false,"has_el2" ,NULL ); + } + }if (object_property_find (cpuobj,"reset-cbar" ,NULL )) { object_property_set_int(cpuobj, periphbase,
@@ -289,7 +295,8 @@ static void a9_daughterboard_init(const VexpressMachineState *vms,memory_region_add_subregion (sysmem,0x60000000 , ram);/* 0x1e000000 A9MPCore (SCU) private memory region */ -init_cpus (cpu_type,TYPE_A9MPCORE_PRIV ,0x1e000000 , pic, vms->secure); +init_cpus (cpu_type,TYPE_A9MPCORE_PRIV ,0x1e000000 , pic, + vms->secure, vms->virt);/* Daughterboard peripherals : 0x10020000 .. 0x20000000 */
@@ -370,7 +377,8 @@ static void a15_daughterboard_init(const VexpressMachineState *vms,memory_region_add_subregion (sysmem,0x80000000 , ram);/* 0x2c000000 A15MPCore private memory region (GIC) */ -init_cpus (cpu_type,TYPE_A15MPCORE_PRIV ,0x2c000000 , pic, vms->secure); +init_cpus (cpu_type,TYPE_A15MPCORE_PRIV ,0x2c000000 , pic, vms->secure, + vms->virt);/* A15 daughterboard peripherals: */
@@ -724,6 +732,20 @@ static void vexpress_set_secure(Object *obj, bool value, Error **errp) vms->secure = value; } +static bool vexpress_get_virt (Object *obj,Error **errp) +{ +VexpressMachineState *vms =VEXPRESS_MACHINE (obj); + +return vms->virt; +} + +static void vexpress_set_virt (Object *obj,bool value,Error **errp) +{ +VexpressMachineState *vms =VEXPRESS_MACHINE (obj); + + vms->virt = value; +} +static void vexpress_instance_init (Object *obj) {VexpressMachineState *vms =VEXPRESS_MACHINE (obj);
@@ -738,6 +760,32 @@ static void vexpress_instance_init(Object *obj) NULL); } +static void vexpress_a15_instance_init (Object *obj) +{ +VexpressMachineState *vms =VEXPRESS_MACHINE (obj); + +/* +* For the vexpress-a15, EL2 is by default enabled if EL3 is, +* but can also be specifically set to on or off. +*/ + vms->virt = true; +object_property_add_bool (obj,"virtualization" , vexpress_get_virt, + vexpress_set_virt,NULL ); +object_property_set_description (obj,"virtualization" , +"Set on/off to enable/disable the ARM " +"Virtualization Extensions " +"(defaults to same as 'secure')" , +NULL ); +} + +static void vexpress_a9_instance_init (Object *obj) +{ +VexpressMachineState *vms =VEXPRESS_MACHINE (obj); + +/* The A9 doesn't have the virt extensions */ + vms->virt = false; +} +static void vexpress_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc);
@@ -784,12 +832,14 @@ static const TypeInfo vexpress_a9_info = { .name = TYPE_VEXPRESS_A9_MACHINE, .parent = TYPE_VEXPRESS_MACHINE, .class_init = vexpress_a9_class_init, + .instance_init = vexpress_a9_instance_init, };static const TypeInfo vexpress_a15_info = { .name =TYPE_VEXPRESS_A15_MACHINE , .parent =TYPE_VEXPRESS_MACHINE , .class_init = vexpress_a15_class_init, + .instance_init = vexpress_a15_instance_init, };static void vexpress_machine_init (void )
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 13/52] target/arm: Implement RAZ/WI HACTLR2
In reply to Peter MaydellThe v8 AArch32 HACTLR2 register maps to bits [63:32] of ACTLR_EL2. We implement ACTLR_EL2 as RAZ/WI, so make HACTLR2 also RAZ/WI. (We put the regdef next to ACTLR_EL2 as a reminder in case we ever make ACTLR_EL2 something other than RAZ/WI).
Message-id: [email protected]
--- target/arm/helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
target/arm/helper.c +10 -0
@@ -5459,6 +5459,16 @@ void register_cp_regs_for_features(ARMCPU *cpu) REGINFO_SENTINEL };define_arm_cp_regs (cpu, auxcr_reginfo); +if (arm_feature (env,ARM_FEATURE_V8 )) { +/* HACTLR2 maps to ACTLR_EL2[63:32] and is not in ARMv7 */ +ARMCPRegInfo hactlr2_reginfo = { + .name ="HACTLR2" , .state =ARM_CP_STATE_AA32 , + .cp =15 , .opc1 =4 , .crn =1 , .crm =0 , .opc2 =3 , + .access =PL2_RW , .type =ARM_CP_CONST , + .resetvalue =0 + }; +define_one_arm_cp_reg (cpu, &hactlr2_reginfo); + } }if (arm_feature (env,ARM_FEATURE_CBAR )) {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 14/52] target/arm: Implement AArch32 HCR and HCR2
In reply to Peter MaydellThe AArch32 HCR and HCR2 registers alias HCR_EL2
bits [31:0] and [63:32]; implement them.
Since HCR2 exists in ARMv8 but not ARMv7, we need new regdef arrays for "we have EL3, not EL2, we're ARMv8" and "we have EL2, we're ARMv8" to hold the definitions.
Message-id: [email protected]
--- target/arm/helper.c | 54 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-)
target/arm/helper.c +50 -4
@@ -3754,11 +3754,11 @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 0, .access = PL2_RW, .readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore }, - { .name = "HCR_EL2", .state = ARM_CP_STATE_AA64, + { .name = "HCR_EL2", .state = ARM_CP_STATE_BOTH, .type = ARM_CP_NO_RAW, .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0, .access = PL2_RW, - .readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore }, + .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "ESR_EL2", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 0, .access = PL2_RW,
@@ -3857,6 +3857,15 @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { REGINFO_SENTINEL }; +/* Ditto, but for registers which exist in ARMv8 but not v7 */ +static const ARMCPRegInfo el3_no_el2_v8_cp_reginfo[] = { + { .name ="HCR2" , .state =ARM_CP_STATE_AA32 , + .cp =15 , .opc1 =4 , .crn =1 , .crm =1 , .opc2 =4 , + .access =PL2_RW , + .type =ARM_CP_CONST , .resetvalue =0 }, +REGINFO_SENTINEL +}; +static void hcr_write (CPUARMState *env,const ARMCPRegInfo *ri,uint64_t value) {ARMCPU *cpu =arm_env_get_cpu (env);
@@ -3883,10 +3892,26 @@ static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)* HCR_PTW forbids certain page-table setups * HCR_DC Disables stage1 and enables stage2 translation */ -if ((raw_read (env, ri) ^ value) & (HCR_VM |HCR_PTW |HCR_DC )) { +if ((env->cp15.hcr_el2 ^ value) & (HCR_VM |HCR_PTW |HCR_DC )) {tlb_flush (CPU (cpu)); } -raw_write (env, ri, value); + env->cp15.hcr_el2 = value; +} + +static void hcr_writehigh (CPUARMState *env,const ARMCPRegInfo *ri, +uint64_t value) +{ +/* Handle HCR2 write, i.e. write to high half of HCR_EL2 */ + value =deposit64 (env->cp15.hcr_el2,32 ,32 , value); +hcr_write (env,NULL , value); +} + +static void hcr_writelow (CPUARMState *env,const ARMCPRegInfo *ri, +uint64_t value) +{ +/* Handle HCR write, i.e. write to low half of HCR_EL2 */ + value =deposit64 (env->cp15.hcr_el2,0 ,32 , value); +hcr_write (env,NULL , value); }static const ARMCPRegInfo el2_cp_reginfo[] = {
@@ -3894,6 +3919,11 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0, .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.hcr_el2), .writefn = hcr_write }, + { .name = "HCR", .state = ARM_CP_STATE_AA32, + .type = ARM_CP_ALIAS, + .cp = 15, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0, + .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.hcr_el2), + .writefn = hcr_writelow }, { .name = "ELR_EL2", .state = ARM_CP_STATE_AA64, .type = ARM_CP_ALIAS, .opc0 = 3, .opc1 = 4, .crn = 4, .crm = 0, .opc2 = 1,
@@ -4128,6 +4158,16 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { REGINFO_SENTINEL }; +static const ARMCPRegInfo el2_v8_cp_reginfo[] = { + { .name ="HCR2" , .state =ARM_CP_STATE_AA32 , + .type =ARM_CP_ALIAS , + .cp =15 , .opc1 =4 , .crn =1 , .crm =1 , .opc2 =4 , + .access =PL2_RW , + .fieldoffset =offsetofhigh32 (CPUARMState, cp15.hcr_el2), + .writefn = hcr_writehigh }, +REGINFO_SENTINEL +}; +static CPAccessResult nsacr_access (CPUARMState *env,const ARMCPRegInfo *ri,bool isread) {
@@ -5179,6 +5219,9 @@ void register_cp_regs_for_features(ARMCPU *cpu) };define_arm_cp_regs (cpu, vpidr_regs);define_arm_cp_regs (cpu, el2_cp_reginfo); +if (arm_feature (env,ARM_FEATURE_V8 )) { +define_arm_cp_regs (cpu, el2_v8_cp_reginfo); + }/* RVBAR_EL2 is only implemented if EL2 is the highest EL */ if (!arm_feature (env,ARM_FEATURE_EL3 )) {ARMCPRegInfo rvbar = {
@@ -5211,6 +5254,9 @@ void register_cp_regs_for_features(ARMCPU *cpu) };define_arm_cp_regs (cpu, vpidr_regs);define_arm_cp_regs (cpu, el3_no_el2_cp_reginfo); +if (arm_feature (env,ARM_FEATURE_V8 )) { +define_arm_cp_regs (cpu, el3_no_el2_v8_cp_reginfo); + } } }if (arm_feature (env,ARM_FEATURE_EL3 )) {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 15/52] target/arm: Factor out code for taking an AArch32 exception
In reply to Peter MaydellFactor out the code which changes the CPU state so as to actually take an exception to AArch32. We're going to want to use this for handling exception entry to Hyp mode.
Message-id: [email protected]
--- target/arm/helper.c | 64 +++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 23 deletions(-)
target/arm/helper.c +41 -23
@@ -8033,6 +8033,46 @@ void aarch64_sync_64_to_32(CPUARMState *env) env->regs[15 ] = env->pc; } +static void take_aarch32_exception (CPUARMState *env,int new_mode, +uint32_t mask,uint32_t offset, +uint32_t newpc) +{ +/* Change the CPU state so as to actually take the exception. */ +switch_mode (env, new_mode); +/* +* For exceptions taken to AArch32 we must clear the SS bit in both +* PSTATE and in the old-state value we save to SPSR_<mode>, so zero it now. +*/ + env->uncached_cpsr &= ~PSTATE_SS ; + env->spsr =cpsr_read (env); +/* Clear IT bits. */ + env->condexec_bits =0 ; +/* Switch to the new mode, and to the correct instruction set. */ + env->uncached_cpsr = (env->uncached_cpsr & ~CPSR_M ) | new_mode; +/* Set new mode endianness */ + env->uncached_cpsr &= ~CPSR_E ; +if (env->cp15.sctlr_el[arm_current_el (env)] &SCTLR_EE ) { + env->uncached_cpsr |=CPSR_E ; + } + env->daif |= mask; + +if (new_mode ==ARM_CPU_MODE_HYP ) { + env->thumb = (env->cp15.sctlr_el[2 ] &SCTLR_TE ) !=0 ; + env->elr_el[2 ] = env->regs[15 ]; + }else { +/* +* this is a lie, as there was no c1_sys on V4T/V5, but who cares +* and we should just guard the thumb mode on V4 +*/ +if (arm_feature (env,ARM_FEATURE_V4T )) { + env->thumb = + (A32_BANKED_CURRENT_REG_GET (env, sctlr) &SCTLR_TE ) !=0 ; + } + env->regs[14 ] = env->regs[15 ] + offset; + } + env->regs[15 ] = newpc; +} +static void arm_cpu_do_interrupt_aarch32 (CPUState *cs) {ARMCPU *cpu =ARM_CPU (cs);
@@ -8175,29 +8215,7 @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs) env->cp15.scr_el3 &= ~SCR_NS ; } -switch_mode (env, new_mode); -/* For exceptions taken to AArch32 we must clear the SS bit in both -* PSTATE and in the old-state value we save to SPSR_<mode>, so zero it now. -*/ - env->uncached_cpsr &= ~PSTATE_SS ; - env->spsr =cpsr_read (env); -/* Clear IT bits. */ - env->condexec_bits =0 ; -/* Switch to the new mode, and to the correct instruction set. */ - env->uncached_cpsr = (env->uncached_cpsr & ~CPSR_M ) | new_mode; -/* Set new mode endianness */ - env->uncached_cpsr &= ~CPSR_E ; -if (env->cp15.sctlr_el[arm_current_el (env)] &SCTLR_EE ) { - env->uncached_cpsr |=CPSR_E ; - } - env->daif |= mask; -/* this is a lie, as the was no c1_sys on V4T/V5, but who cares -* and we should just guard the thumb mode on V4 */ -if (arm_feature (env,ARM_FEATURE_V4T )) { - env->thumb = (A32_BANKED_CURRENT_REG_GET (env, sctlr) &SCTLR_TE ) !=0 ; - } - env->regs[14 ] = env->regs[15 ] + offset; - env->regs[15 ] = addr; +take_aarch32_exception (env, new_mode, mask, offset, addr); }/* Handle exception entry to a target EL which is using AArch64 */
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 16/52] target/arm: Implement support for taking exceptions to Hyp mode
In reply to Peter MaydellImplement the necessary support code for taking exceptions to Hyp mode in AArch32.
Message-id: [email protected]
--- target/arm/helper.c | 82 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+)
target/arm/helper.c +82 -0
@@ -8073,6 +8073,83 @@ static void take_aarch32_exception(CPUARMState *env, int new_mode, env->regs[15 ] = newpc; } +static void arm_cpu_do_interrupt_aarch32_hyp (CPUState *cs) +{ +/* +* Handle exception entry to Hyp mode; this is sufficiently +* different to entry to other AArch32 modes that we handle it +* separately here. +* +* The vector table entry used is always the 0x14 Hyp mode entry point, +* unless this is an UNDEF/HVC/abort taken from Hyp to Hyp. +* The offset applied to the preferred return address is always zero +* (see DDI0487C.a section G1.12.3). +* PSTATE A/I/F masks are set based only on the SCR.EA/IRQ/FIQ values. +*/ +uint32_t addr, mask; +ARMCPU *cpu =ARM_CPU (cs); +CPUARMState *env = &cpu->env; + +switch (cs->exception_index) { +case EXCP_UDEF : + addr =0x04 ; +break ; +case EXCP_SWI : + addr =0x14 ; +break ; +case EXCP_BKPT : +/* Fall through to prefetch abort. */ +case EXCP_PREFETCH_ABORT : + env->cp15.ifar_s = env->exception.vaddress; +qemu_log_mask (CPU_LOG_INT ,"...with HIFAR 0x%x\n" , + (uint32_t )env->exception.vaddress); + addr =0x0c ; +break ; +case EXCP_DATA_ABORT : + env->cp15.dfar_s = env->exception.vaddress; +qemu_log_mask (CPU_LOG_INT ,"...with HDFAR 0x%x\n" , + (uint32_t )env->exception.vaddress); + addr =0x10 ; +break ; +case EXCP_IRQ : + addr =0x18 ; +break ; +case EXCP_FIQ : + addr =0x1c ; +break ; +case EXCP_HVC : + addr =0x08 ; +break ; +case EXCP_HYP_TRAP : + addr =0x14 ; +default : +cpu_abort (cs,"Unhandled exception 0x%x\n" , cs->exception_index); + } + +if (cs->exception_index !=EXCP_IRQ && cs->exception_index !=EXCP_FIQ ) { + env->cp15.esr_el[2 ] = env->exception.syndrome; + } + +if (arm_current_el (env) !=2 && addr <0x14 ) { + addr =0x14 ; + } + + mask =0 ; +if (!(env->cp15.scr_el3 &SCR_EA )) { + mask |=CPSR_A ; + } +if (!(env->cp15.scr_el3 &SCR_IRQ )) { + mask |=CPSR_I ; + } +if (!(env->cp15.scr_el3 &SCR_FIQ )) { + mask |=CPSR_F ; + } + + addr += env->cp15.hvbar; + +take_aarch32_exception (env,ARM_CPU_MODE_HYP , mask,0 , addr); +} +static void arm_cpu_do_interrupt_aarch32 (CPUState *cs) {ARMCPU *cpu =ARM_CPU (cs);
@@ -8108,6 +8185,11 @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs) env->cp15.mdscr_el1 =deposit64 (env->cp15.mdscr_el1,2 ,4 , moe); } +if (env->exception.target_el ==2 ) { +arm_cpu_do_interrupt_aarch32_hyp (cs); +return ; + } +/* TODO: Vectored interrupt controller. */ switch (cs->exception_index) {case EXCP_UDEF :
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 17/52] target/arm: Clear CPSR.IL and CPSR.J on 32-bit exception entry
In reply to Peter MaydellOn 32-bit exception entry, CPSR.J must always be set to 0 (see v7A Arm ARM DDI0406C.c B1.8.5). CPSR.IL must also be cleared on 32-bit exception entry (see v8A Arm ARM DDI0487C.a G1.10).
Clear these bits. (This fixes a bug which will never be noticed by non-buggy guests.)
Message-id: [email protected]
--- target/arm/helper.c | 2 ++ 1 file changed, 2 insertions(+)
target/arm/helper.c +2 -0
@@ -8054,6 +8054,8 @@ static void take_aarch32_exception(CPUARMState *env, int new_mode,if (env->cp15.sctlr_el[arm_current_el (env)] &SCTLR_EE ) { env->uncached_cpsr |=CPSR_E ; } +/* J and IL must always be cleared for exception entry */ + env->uncached_cpsr &= ~(CPSR_IL |CPSR_J ); env->daif |= mask;if (new_mode ==ARM_CPU_MODE_HYP ) {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 18/52] hw/arm/boot: AArch32 kernels should be started in Hyp mode if available
In reply to Peter MaydellThe kernel booting specification for an AArch32 kernel requires that it is booted in Hyp mode if available; otherwise the kernel can't enable KVM. We were incorrectly leaving the kernel in SVC mode. If we're booting an AArch32 kernel in the Nonsecure state and Hyp mode is available, start in it.
Message-id: [email protected]
--- hw/arm/boot.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
hw/arm/boot.c +11 -0
@@ -736,6 +736,17 @@ static void do_cpu_reset(void *opaque) } } +if (!env->aarch64 && !info->secure_boot && +arm_feature (env,ARM_FEATURE_EL2 )) { +/* +* This is an AArch32 boot not to Secure state, and +* we have Hyp mode available, so boot the kernel into +* Hyp mode. This is not how the CPU comes out of reset, +* so we need to manually put it there. +*/ +cpsr_write (env,ARM_CPU_MODE_HYP ,CPSR_M , CPSRWriteRaw); + } +if (cs == first_cpu) {AddressSpace *as =arm_boot_address_space (cpu, info);
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 19/52] hw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters
In reply to Peter MaydellThe MPS2 FPGAIO block includes some simple free-running counters. Implement these.
Message-id: [email protected]
--- include/hw/misc/mps2-fpgaio.h | 4 +++ hw/misc/mps2-fpgaio.c | 53 ++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-)
include/hw/misc/mps2-fpgaio.h +4 -0
@@ -38,6 +38,10 @@ typedef struct {uint32_t misc;uint32_t prescale_clk; + +/* These hold the CLOCK_VIRTUAL ns tick when the CLK1HZ/CLK100HZ was zero */ +int64_t clk1hz_tick_offset; + int64_t clk100hz_tick_offset; }MPS2FPGAIO ;#endif
hw/misc/mps2-fpgaio.c +52 -1
113 lines not on this page · raw message
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 20/52] hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER
In reply to Peter MaydellIn the MPS2 FPGAIO, PSCNTR is a free-running downcounter with a reload value configured via the PRESCALE register, and COUNTER counts up by 1 every time PSCNTR reaches zero. Implement these counters.
We can just increment the counters migration subsection's version ID because we only added it in the previous commit, so no released QEMU versions will be using it.
Message-id: [email protected]
--- include/hw/misc/mps2-fpgaio.h | 6 +++ hw/misc/mps2-fpgaio.c | 97 +++++++++++++++++++++++++++++++++-- 2 files changed, 99 insertions(+), 4 deletions(-)
include/hw/misc/mps2-fpgaio.h +6 -0
@@ -37,6 +37,12 @@ typedef struct {uint32_t prescale;uint32_t misc; +/* QEMU_CLOCK_VIRTUAL time at which counter and pscntr were last synced */ +int64_t pscntr_sync_ticks; +/* Values of COUNTER and PSCNTR at time pscntr_sync_ticks */ +uint32_t counter; +uint32_t pscntr; +uint32_t prescale_clk;/* These hold the CLOCK_VIRTUAL ns tick when the CLK1HZ/CLK100HZ was zero */
hw/misc/mps2-fpgaio.c +93 -4
138 lines not on this page · raw message
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 22/52] hw/arm/iotkit: Wire up the dualtimer
In reply to Peter MaydellNow we have a model of the CMSDK dual timer, we can wire it up in the IoTKit.
Message-id: [email protected]
--- include/hw/arm/iotkit.h | 3 ++- hw/arm/iotkit.c | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-)
include/hw/arm/iotkit.h +2 -1
@@ -56,6 +56,7 @@#include "hw/misc/tz-ppc.h" #include "hw/misc/tz-mpc.h" #include "hw/timer/cmsdk-apb-timer.h" +#include "hw/timer/cmsdk-apb-dualtimer.h" #include "hw/misc/unimp.h" #include "hw/or-irq.h" #include "hw/core/split-irq.h"
@@ -87,7 +88,7 @@ typedef struct IoTKit {SplitIRQ mpc_irq_splitter[IOTS_NUM_EXP_MPC +IOTS_NUM_MPC ];qemu_or_irq mpc_irq_orgate; -UnimplementedDeviceState dualtimer; +CMSDKAPBDualTimer dualtimer;UnimplementedDeviceState s32ktimer;MemoryRegion container;
hw/arm/iotkit.c +5 -3
@@ -139,7 +139,7 @@ static void iotkit_init(Object *obj)sysbus_init_child_obj (obj,"timer1" , &s->timer1,sizeof (s->timer1),TYPE_CMSDK_APB_TIMER );sysbus_init_child_obj (obj,"dualtimer" , &s->dualtimer,sizeof (s->dualtimer), -TYPE_UNIMPLEMENTED_DEVICE ); +TYPE_CMSDK_APB_DUALTIMER );object_initialize_child (obj,"ppc-irq-orgate" , &s->ppc_irq_orgate,sizeof (s->ppc_irq_orgate),TYPE_OR_IRQ , &error_abort,NULL );
@@ -390,13 +390,15 @@ static void iotkit_realize(DeviceState *dev, Error **errp)return ; } -qdev_prop_set_string (DEVICE (&s->dualtimer),"name" ,"Dual timer" ); -qdev_prop_set_uint64 (DEVICE (&s->dualtimer),"size" ,0x1000 ); + +qdev_prop_set_uint32 (DEVICE (&s->dualtimer),"pclk-frq" , s->mainclk_frq);object_property_set_bool (OBJECT (&s->dualtimer), true,"realized" , &err);if (err) {error_propagate (errp, err);return ; } +sysbus_connect_irq (SYS_BUS_DEVICE (&s->dualtimer),0 , +qdev_get_gpio_in (DEVICE (&s->armv7m),5 )); mr =sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->dualtimer),0 );object_property_set_link (OBJECT (&s->apb_ppc0),OBJECT (mr),"port[2]" , &err);if (err) {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 21/52] hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module
In reply to Peter MaydellThe Arm Cortex-M System Design Kit includes a "dual-input timer module" which combines two programmable down-counters. Implement a model of this device.
Message-id: [email protected]
--- hw/timer/Makefile.objs | 1 + include/hw/timer/cmsdk-apb-dualtimer.h | 72 ++++ hw/timer/cmsdk-apb-dualtimer.c | 515 +++++++++++++++++++++++++ MAINTAINERS | 2 + default-configs/arm-softmmu.mak | 1 + hw/timer/trace-events | 5 + 6 files changed, 596 insertions(+) create mode 100644 include/hw/timer/cmsdk-apb-dualtimer.h create mode 100644 hw/timer/cmsdk-apb-dualtimer.c
hw/timer/Makefile.objs +1 -0
@@ -44,4 +44,5 @@ common-obj-$(CONFIG_ASPEED_SOC) += aspeed_timer.o common-obj-$(CONFIG_SUN4V_RTC) += sun4v-rtc.o common-obj-$(CONFIG_CMSDK_APB_TIMER) += cmsdk-apb-timer.o +common-obj-$(CONFIG_CMSDK_APB_DUALTIMER) += cmsdk-apb-dualtimer.o common-obj-$(CONFIG_MSF2) += mss-timer.o
include/hw/timer/cmsdk-apb-dualtimer.h new file +72 -0
72 lines not on this page · raw message
hw/timer/cmsdk-apb-dualtimer.c new file +515 -0
515 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -455,6 +455,8 @@ F: hw/timer/pl031.c F: include/hw/arm/primecell.h F: hw/timer/cmsdk-apb-timer.c F: include/hw/timer/cmsdk-apb-timer.h +F: hw/timer/cmsdk-apb-dualtimer.c +F: include/hw/timer/cmsdk-apb-dualtimer.h F: hw/char/cmsdk-apb-uart.c F: include/hw/char/cmsdk-apb-uart.h F: hw/watchdog/cmsdk-apb-watchdog.c
default-configs/arm-softmmu.mak +1 -0
@@ -103,6 +103,7 @@ CONFIG_STM32F2XX_SPI=y CONFIG_STM32F205_SOC=y CONFIG_CMSDK_APB_TIMER=y +CONFIG_CMSDK_APB_DUALTIMER=y CONFIG_CMSDK_APB_UART=y CONFIG_CMSDK_APB_WATCHDOG=y
hw/timer/trace-events +5 -0
@@ -61,5 +61,10 @@ cmsdk_apb_timer_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB t cmsdk_apb_timer_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB timer write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" cmsdk_apb_timer_reset(void) "CMSDK APB timer: reset" +# hw/timer/cmsdk_apb_dualtimer.c +cmsdk_apb_dualtimer_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB dualtimer read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" +cmsdk_apb_dualtimer_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB dualtimer write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" +cmsdk_apb_dualtimer_reset(void) "CMSDK APB dualtimer: reset" + # hw/timer/xlnx-zynqmp-rtc.c xlnx_zynqmp_rtc_gettime(int year, int month, int day, int hour, int min, int sec) "Get time from host: %d-%d-%d %2d:%02d:%02d"
Signature · 1 line
2.18.0
Re: [Qemu-devel] [PULL 21/52] hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module
Quoted 11 lines · Peter Maydell
ze);
+
+ if (offset >=A_TIMERITCR) {
+ switch (offset) {
+ caseA_TIMERITCR:
+s->timeritcr= value &R_TIMERITCR_VALID_MASK;
+cmsdk_apb_dualtimer_update(s);
+ caseA_TIMERITOP:
+s->timeritop= value &R_TIMERITOP_VALID_MASK;
+cmsdk_apb_dualtimer_update(s);
+ default:
Two missing "break"s here (Coverity CID 1395626 and 1395633).
Paolo
[Qemu-devel] [PULL 23/52] hw/arm/mps2: Wire up dual-timer in mps2-an385 and mps2-an511
In reply to Peter MaydellThe MPS2 FPGA images for the Cortex-M3 (mps2-an385 and mps2-511) both include a CMSDK dual-timer module. Wire this up.
Message-id: [email protected]
--- hw/arm/mps2.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
hw/arm/mps2.c +11 -0
@@ -34,6 +34,7 @@#include "hw/misc/unimp.h" #include "hw/char/cmsdk-apb-uart.h" #include "hw/timer/cmsdk-apb-timer.h" +#include "hw/timer/cmsdk-apb-dualtimer.h" #include "hw/misc/mps2-scc.h" #include "hw/devices.h" #include "net/net.h"
@@ -64,6 +65,7 @@ typedef struct {MemoryRegion blockram_m3;MemoryRegion sram;MPS2SCC scc; +CMSDKAPBDualTimer dualtimer; } MPS2MachineState;#define TYPE_MPS2_MACHINE "mps2"
@@ -297,6 +299,15 @@ static void mps2_common_init(MachineState *machine)cmsdk_apb_timer_create (0x40000000 ,qdev_get_gpio_in (armv7m,8 ),SYSCLK_FRQ );cmsdk_apb_timer_create (0x40001000 ,qdev_get_gpio_in (armv7m,9 ),SYSCLK_FRQ ); +sysbus_init_child_obj (OBJECT (mms),"dualtimer" , &mms->dualtimer, +sizeof (mms->dualtimer),TYPE_CMSDK_APB_DUALTIMER ); +qdev_prop_set_uint32 (DEVICE (&mms->dualtimer),"pclk-frq" ,SYSCLK_FRQ ); +object_property_set_bool (OBJECT (&mms->dualtimer), true,"realized" , + &error_fatal); +sysbus_connect_irq (SYS_BUS_DEVICE (&mms->dualtimer),0 , +qdev_get_gpio_in (armv7m,10 )); +sysbus_mmio_map (SYS_BUS_DEVICE (&mms->dualtimer),0 ,0x40002000 ); +object_initialize (&mms->scc,sizeof (mms->scc),TYPE_MPS2_SCC ); sccdev =DEVICE (&mms->scc);qdev_set_parent_bus (sccdev,sysbus_get_default ());
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 24/52] hw/arm/iotkit: Wire up the watchdogs
In reply to Peter MaydellThe IoTKit includes three different instances of the CMSDK APB watchdog; create and wire them up.
Message-id: [email protected]
--- include/hw/arm/iotkit.h | 6 +++++ hw/arm/iotkit.c | 58 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 61 insertions(+), 3 deletions(-)
include/hw/arm/iotkit.h +6 -0
@@ -57,6 +57,7 @@#include "hw/misc/tz-mpc.h" #include "hw/timer/cmsdk-apb-timer.h" #include "hw/timer/cmsdk-apb-dualtimer.h" +#include "hw/watchdog/cmsdk-apb-watchdog.h" #include "hw/misc/unimp.h" #include "hw/or-irq.h" #include "hw/core/split-irq.h"
@@ -87,10 +88,15 @@ typedef struct IoTKit {SplitIRQ ppc_irq_splitter[NUM_PPCS ];SplitIRQ mpc_irq_splitter[IOTS_NUM_EXP_MPC +IOTS_NUM_MPC ];qemu_or_irq mpc_irq_orgate; +qemu_or_irq nmi_orgate;CMSDKAPBDualTimer dualtimer;UnimplementedDeviceState s32ktimer; +CMSDKAPBWatchdog s32kwatchdog; +CMSDKAPBWatchdog nswatchdog; +CMSDKAPBWatchdog swatchdog; +MemoryRegion container;MemoryRegion alias1;MemoryRegion alias2;
hw/arm/iotkit.c +55 -3
79 lines not on this page · raw message
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 25/52] hw/arm/iotkit: Wire up the S32KTIMER
In reply to Peter MaydellThe IoTKit has a CMSDK timer device that runs on the S32KCLK. Create this and wire it up.
Message-id: [email protected]
--- include/hw/arm/iotkit.h | 2 +- hw/arm/iotkit.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
include/hw/arm/iotkit.h +1 -1
@@ -83,6 +83,7 @@ typedef struct IoTKit {TZMPC mpc;CMSDKAPBTIMER timer0;CMSDKAPBTIMER timer1; +CMSDKAPBTIMER s32ktimer;qemu_or_irq ppc_irq_orgate;SplitIRQ sec_resp_splitter;SplitIRQ ppc_irq_splitter[NUM_PPCS ];
@@ -91,7 +92,6 @@ typedef struct IoTKit {qemu_or_irq nmi_orgate;CMSDKAPBDualTimer dualtimer; -UnimplementedDeviceState s32ktimer;CMSDKAPBWatchdog s32kwatchdog;CMSDKAPBWatchdog nswatchdog;
hw/arm/iotkit.c +5 -4
@@ -141,6 +141,8 @@ static void iotkit_init(Object *obj) TYPE_CMSDK_APB_TIMER);sysbus_init_child_obj (obj,"timer1" , &s->timer1,sizeof (s->timer1),TYPE_CMSDK_APB_TIMER ); +sysbus_init_child_obj (obj,"s32ktimer" , &s->s32ktimer,sizeof (s->s32ktimer), +TYPE_CMSDK_APB_TIMER );sysbus_init_child_obj (obj,"dualtimer" , &s->dualtimer,sizeof (s->dualtimer),TYPE_CMSDK_APB_DUALTIMER ); sysbus_init_child_obj(obj, "s32kwatchdog", &s->s32kwatchdog,
@@ -166,8 +168,6 @@ static void iotkit_init(Object *obj) TYPE_SPLIT_IRQ, &error_abort, NULL);g_free (name); } -sysbus_init_child_obj (obj,"s32ktimer" , &s->s32ktimer,sizeof (s->s32ktimer), -TYPE_UNIMPLEMENTED_DEVICE ); }static void iotkit_exp_irq (void *opaque,int n,int level)
@@ -476,13 +476,14 @@ static void iotkit_realize(DeviceState *dev, Error **errp)/* Devices behind APB PPC1: * 0x4002f000: S32K timer */ -qdev_prop_set_string (DEVICE (&s->s32ktimer),"name" ,"S32KTIMER" ); -qdev_prop_set_uint64 (DEVICE (&s->s32ktimer),"size" ,0x1000 ); +qdev_prop_set_uint32 (DEVICE (&s->s32ktimer),"pclk-frq" ,S32KCLK );object_property_set_bool (OBJECT (&s->s32ktimer), true,"realized" , &err);if (err) {error_propagate (errp, err);return ; } +sysbus_connect_irq (SYS_BUS_DEVICE (&s->s32ktimer),0 , +qdev_get_gpio_in (DEVICE (&s->armv7m),2 )); mr =sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->s32ktimer),0 );object_property_set_link (OBJECT (&s->apb_ppc1),OBJECT (mr),"port[0]" , &err);if (err) {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 26/52] hw/misc/iotkit-sysctl: Implement IoTKit system control element
In reply to Peter MaydellThe Arm IoTKit includes a system control element which provides a block of read-only ID registers and a block of read-write control registers. Implement a minimal version of this.
Message-id: [email protected]
--- hw/misc/Makefile.objs | 1 + include/hw/misc/iotkit-sysctl.h | 49 ++++++ hw/misc/iotkit-sysctl.c | 261 ++++++++++++++++++++++++++++++++ MAINTAINERS | 2 + default-configs/arm-softmmu.mak | 1 + hw/misc/trace-events | 7 + 6 files changed, 321 insertions(+) create mode 100644 include/hw/misc/iotkit-sysctl.h create mode 100644 hw/misc/iotkit-sysctl.c
hw/misc/Makefile.objs +1 -0
@@ -66,6 +66,7 @@ obj-$(CONFIG_MPS2_SCC) += mps2-scc.o obj-$(CONFIG_TZ_MPC) += tz-mpc.o obj-$(CONFIG_TZ_PPC) += tz-ppc.o obj-$(CONFIG_IOTKIT_SECCTL) += iotkit-secctl.o +obj-$(CONFIG_IOTKIT_SYSCTL) += iotkit-sysctl.o obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
include/hw/misc/iotkit-sysctl.h new file +49 -0
49 lines not on this page · raw message
hw/misc/iotkit-sysctl.c new file +261 -0
261 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -539,6 +539,8 @@ F: hw/misc/mps2-*.c F: include/hw/misc/mps2-*.h F: hw/arm/iotkit.c F: include/hw/arm/iotkit.h +F: hw/misc/iotkit-sysctl.c +F: include/hw/misc/iotkit-sysctl.h Musicpal M: Jan Kiszka <[email protected]>
default-configs/arm-softmmu.mak +1 -0
@@ -114,6 +114,7 @@ CONFIG_TZ_MPC=y CONFIG_TZ_PPC=y CONFIG_IOTKIT=y CONFIG_IOTKIT_SECCTL=y +CONFIG_IOTKIT_SYSCTL=y CONFIG_VERSATILE=y CONFIG_VERSATILE_PCI=y
hw/misc/trace-events +7 -0
@@ -116,3 +116,10 @@ ccm_freq(uint32_t freq) "freq = %d\n" ccm_clock_freq(uint32_t clock, uint32_t freq) "(Clock = %d) = %d\n" ccm_read_reg(const char *reg_name, uint32_t value) "reg[%s] <= 0x%" PRIx32 "\n" ccm_write_reg(const char *reg_name, uint32_t value) "reg[%s] => 0x%" PRIx32 "\n" + +# hw/misc/iotkit-sysctl.c +iotkit_sysinfo_read(uint64_t offset, uint64_t data, unsigned size) "IoTKit SysInfo read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" +iotkit_sysinfo_write(uint64_t offset, uint64_t data, unsigned size) "IoTKit SysInfo write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" +iotkit_sysctl_read(uint64_t offset, uint64_t data, unsigned size) "IoTKit SysCtl read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" +iotkit_sysctl_write(uint64_t offset, uint64_t data, unsigned size) "IoTKit SysCtl write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" +iotkit_sysctl_reset(void) "IoTKit SysCtl: reset"
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 27/52] hw/misc/iotkit-sysinfo: Implement IoTKit system information block
In reply to Peter MaydellImplement the IoTKit system control element's system information block; this is just a pair of read-only version/config registers, plus the usual PID/CID ID registers.
Message-id: [email protected]
--- hw/misc/Makefile.objs | 1 + include/hw/misc/iotkit-sysinfo.h | 37 +++++++++ hw/misc/iotkit-sysinfo.c | 128 +++++++++++++++++++++++++++++++ MAINTAINERS | 2 + default-configs/arm-softmmu.mak | 1 + 5 files changed, 169 insertions(+) create mode 100644 include/hw/misc/iotkit-sysinfo.h create mode 100644 hw/misc/iotkit-sysinfo.c
hw/misc/Makefile.objs +1 -0
@@ -67,6 +67,7 @@ obj-$(CONFIG_TZ_MPC) += tz-mpc.o obj-$(CONFIG_TZ_PPC) += tz-ppc.o obj-$(CONFIG_IOTKIT_SECCTL) += iotkit-secctl.o obj-$(CONFIG_IOTKIT_SYSCTL) += iotkit-sysctl.o +obj-$(CONFIG_IOTKIT_SYSINFO) += iotkit-sysinfo.o obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
include/hw/misc/iotkit-sysinfo.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* ARM IoTKit system information block +* +* Copyright (c) 2018 Linaro Limited +* Written by Peter Maydell +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 or +* (at your option) any later version. +*/ + +/* +* This is a model of the "system information block" which is part of the +* Arm IoTKit and documented in +* http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ecm0601256/index.html +* QEMU interface: +* + sysbus MMIO region 0: the system information register bank +*/ + +#ifndef HW_MISC_IOTKIT_SYSINFO_H +#define HW_MISC_IOTKIT_SYSINFO_H + +#include "hw/sysbus.h" + +#define TYPE_IOTKIT_SYSINFO "iotkit-sysinfo" +#define IOTKIT_SYSINFO (obj) OBJECT_CHECK(IoTKitSysInfo, (obj), \ + TYPE_IOTKIT_SYSINFO) + +typedef struct IoTKitSysInfo { +/*< private >*/ +SysBusDevice parent_obj; + +/*< public >*/ +MemoryRegion iomem; +}IoTKitSysInfo ; + +#endif
hw/misc/iotkit-sysinfo.c new file +128 -0
128 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -541,6 +541,8 @@ F: hw/arm/iotkit.c F: include/hw/arm/iotkit.h F: hw/misc/iotkit-sysctl.c F: include/hw/misc/iotkit-sysctl.h +F: hw/misc/iotkit-sysinfo.c +F: include/hw/misc/iotkit-sysinfo.h Musicpal M: Jan Kiszka <[email protected]>
default-configs/arm-softmmu.mak +1 -0
@@ -115,6 +115,7 @@ CONFIG_TZ_PPC=y CONFIG_IOTKIT=y CONFIG_IOTKIT_SECCTL=y CONFIG_IOTKIT_SYSCTL=y +CONFIG_IOTKIT_SYSINFO=y CONFIG_VERSATILE=y CONFIG_VERSATILE_PCI=y
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 28/52] hw/misc/iotkit: Wire up the sysctl and sysinfo register blocks
In reply to Peter MaydellWire up the system control element's register banks (sysctl and sysinfo).
This is the last of the previously completely unimplemented components in the IoTKit.
Message-id: [email protected]
--- include/hw/arm/iotkit.h | 6 +++++- hw/arm/iotkit.c | 26 ++++++++++++++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-)
include/hw/arm/iotkit.h +5 -1
@@ -58,7 +58,8 @@#include "hw/timer/cmsdk-apb-timer.h" #include "hw/timer/cmsdk-apb-dualtimer.h" #include "hw/watchdog/cmsdk-apb-watchdog.h" -#include "hw/misc/unimp.h" +#include "hw/misc/iotkit-sysctl.h" +#include "hw/misc/iotkit-sysinfo.h" #include "hw/or-irq.h" #include "hw/core/split-irq.h"
@@ -97,6 +98,9 @@ typedef struct IoTKit {CMSDKAPBWatchdog nswatchdog;CMSDKAPBWatchdog swatchdog; +IoTKitSysCtl sysctl; +IoTKitSysCtl sysinfo; +MemoryRegion container;MemoryRegion alias1;MemoryRegion alias2;
hw/arm/iotkit.c +18 -8
@@ -16,7 +16,6 @@#include "hw/sysbus.h" #include "hw/registerfields.h" #include "hw/arm/iotkit.h" -#include "hw/misc/unimp.h" #include "hw/arm/arm.h" /* Clock frequency in HZ of the 32KHz "slow clock" */
@@ -151,6 +150,10 @@ static void iotkit_init(Object *obj) sizeof(s->nswatchdog), TYPE_CMSDK_APB_WATCHDOG);sysbus_init_child_obj (obj,"swatchdog" , &s->swatchdog,sizeof (s->swatchdog),TYPE_CMSDK_APB_WATCHDOG ); +sysbus_init_child_obj (obj,"iotkit-sysctl" , &s->sysctl, +sizeof (s->sysctl),TYPE_IOTKIT_SYSCTL ); +sysbus_init_child_obj (obj,"iotkit-sysinfo" , &s->sysinfo, +sizeof (s->sysinfo),TYPE_IOTKIT_SYSINFO );object_initialize_child (obj,"nmi-orgate" , &s->nmi_orgate,sizeof (s->nmi_orgate),TYPE_OR_IRQ , &error_abort,NULL );
@@ -516,13 +519,20 @@ static void iotkit_realize(DeviceState *dev, Error **errp)qdev_get_gpio_in_named (dev_apb_ppc1, "cfg_sec_resp", 0)); -/* Using create_unimplemented_device() maps the stub into the -* system address space rather than into our container, but the -* overall effect to the guest is the same. -*/ -create_unimplemented_device ("SYSINFO" ,0x40020000 ,0x1000 ); - -create_unimplemented_device ("SYSCONTROL" ,0x50021000 ,0x1000 ); +object_property_set_bool (OBJECT (&s->sysinfo), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + } +/* System information registers */ +sysbus_mmio_map (SYS_BUS_DEVICE (&s->sysinfo),0 ,0x40020000 ); +/* System control registers */ +object_property_set_bool (OBJECT (&s->sysctl), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + } +sysbus_mmio_map (SYS_BUS_DEVICE (&s->sysctl),0 ,0x50021000 );/* This OR gate wires together outputs from the secure watchdogs to NMI */ object_property_set_int (OBJECT (&s->nmi_orgate),2 ,"num-lines" , &err);
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 29/52] hw/misc/tz-msc: Model TrustZone Master Security Controller
In reply to Peter MaydellImplement a model of the TrustZone Master Securtiy Controller, as documented in the Arm CoreLink SIE-200 System IP for Embedded TRM (DDI0571G):
https://developer.arm.com/products/architecture/m-profile/docs/ddi0571/g
The MSC is intended to sit in front of a device which can be a bus master (eg a DMA controller) and programmably gate its transactions. This allows a bus-mastering device to be controlled by non-secure code but still restricted from making accesses to addresses which are secure-only.
Message-id: [email protected]
--- hw/misc/Makefile.objs | 1 + include/hw/misc/tz-msc.h | 79 ++++++++ hw/misc/tz-msc.c | 308 ++++++++++++++++++++++++++++++++ MAINTAINERS | 2 + default-configs/arm-softmmu.mak | 1 + hw/misc/trace-events | 9 + 6 files changed, 400 insertions(+) create mode 100644 include/hw/misc/tz-msc.h create mode 100644 hw/misc/tz-msc.c
hw/misc/Makefile.objs +1 -0
@@ -64,6 +64,7 @@ obj-$(CONFIG_MPS2_FPGAIO) += mps2-fpgaio.o obj-$(CONFIG_MPS2_SCC) += mps2-scc.o obj-$(CONFIG_TZ_MPC) += tz-mpc.o +obj-$(CONFIG_TZ_MSC) += tz-msc.o obj-$(CONFIG_TZ_PPC) += tz-ppc.o obj-$(CONFIG_IOTKIT_SECCTL) += iotkit-secctl.o obj-$(CONFIG_IOTKIT_SYSCTL) += iotkit-sysctl.o
include/hw/misc/tz-msc.h new file +79 -0
79 lines not on this page · raw message
hw/misc/tz-msc.c new file +308 -0
308 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -465,6 +465,8 @@ F: hw/misc/tz-ppc.c F: include/hw/misc/tz-ppc.h F: hw/misc/tz-mpc.c F: include/hw/misc/tz-mpc.h +F: hw/misc/tz-msc.c +F: include/hw/misc/tz-msc.h ARM cores M: Peter Maydell <[email protected]>
default-configs/arm-softmmu.mak +1 -0
@@ -111,6 +111,7 @@ CONFIG_MPS2_FPGAIO=y CONFIG_MPS2_SCC=y CONFIG_TZ_MPC=y +CONFIG_TZ_MSC=y CONFIG_TZ_PPC=y CONFIG_IOTKIT=y CONFIG_IOTKIT_SECCTL=y
hw/misc/trace-events +9 -0
@@ -92,6 +92,15 @@ tz_mpc_mem_blocked_write(uint64_t addr, uint64_t data, unsigned size, bool secur tz_mpc_translate(uint64_t addr, int flags, const char *idx, const char *res) "TZ MPC translate: addr 0x%" PRIx64 " flags 0x%x iommu_idx %s: %s" tz_mpc_iommu_notify(uint64_t addr) "TZ MPC iommu: notifying UNMAP/MAP for 0x%" PRIx64 +# hw/misc/tz-msc.c +tz_msc_reset(void) "TZ MSC: reset" +tz_msc_cfg_nonsec(int level) "TZ MSC: cfg_nonsec = %d" +tz_msc_cfg_sec_resp(int level) "TZ MSC: cfg_sec_resp = %d" +tz_msc_irq_enable(int level) "TZ MSC: int_enable = %d" +tz_msc_irq_clear(int level) "TZ MSC: int_clear = %d" +tz_msc_update_irq(int level) "TZ MSC: setting irq line to %d" +tz_msc_access_blocked(uint64_t offset) "TZ MSC: offset 0x%" PRIx64 " access blocked" + # hw/misc/tz-ppc.c tz_ppc_reset(void) "TZ PPC: reset" tz_ppc_cfg_nonsec(int n, int level) "TZ PPC: cfg_nonsec[%d] = %d"
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 30/52] hw/misc/iotkit-secctl: Wire up registers for controlling MSCs
In reply to Peter MaydellThe IoTKit does not have any Master Security Contollers itself, but it does provide registers in the secure privilege control block which allow control of MSCs in the external system. Add support for these registers.
Message-id: [email protected]
--- include/hw/misc/iotkit-secctl.h | 14 +++++++ hw/misc/iotkit-secctl.c | 73 +++++++++++++++++++++++++++++---- 2 files changed, 79 insertions(+), 8 deletions(-)
include/hw/misc/iotkit-secctl.h +14 -0
@@ -19,6 +19,7 @@* + named GPIO output "sec_resp_cfg" indicating whether blocked accesses * should RAZ/WI or bus error * + named GPIO output "nsc_cfg" whose value tracks the NSCCFG register value +* + named GPIO output "msc_irq" for the combined IRQ line from the MSCs * Controlling the 2 APB PPCs in the IoTKit: * + named GPIO outputs apb_ppc0_nonsec[0..2] and apb_ppc1_nonsec * + named GPIO outputs apb_ppc0_ap[0..2] and apb_ppc1_ap
@@ -44,6 +45,11 @@* Controlling each of the 16 expansion MPCs which a system using the IoTKit * might provide: * + named GPIO inputs mpcexp_status[0..15] +* Controlling each of the 16 expansion MSCs which a system using the IoTKit +* might provide: +* + named GPIO inputs mscexp_status[0..15] +* + named GPIO outputs mscexp_clear[0..15] +* + named GPIO outputs mscexp_ns[0..15] */ #ifndef IOTKIT_SECCTL_H
@@ -62,6 +68,7 @@#define IOTS_NUM_AHB_EXP_PPC 4#define IOTS_NUM_EXP_MPC 16#define IOTS_NUM_MPC 1 +#define IOTS_NUM_EXP_MSC 16typedef struct IoTKitSecCtl IoTKitSecCtl ;
@@ -103,6 +110,13 @@ struct IoTKitSecCtl {uint32_t brginten;uint32_t mpcintstatus; +uint32_t secmscintstat; +uint32_t secmscinten; +uint32_t nsmscexp; +qemu_irq mscexp_clear[IOTS_NUM_EXP_MSC ]; +qemu_irq mscexp_ns[IOTS_NUM_EXP_MSC ]; +qemu_irq msc_irq; +IoTKitSecCtlPPC apb[IOTS_NUM_APB_PPC ];IoTKitSecCtlPPC apbexp[IOTS_NUM_APB_EXP_PPC ];IoTKitSecCtlPPC ahbexp[IOTS_NUM_APB_EXP_PPC ];
hw/misc/iotkit-secctl.c +65 -8
124 lines not on this page · raw message
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 31/52] hw/arm/iotkit: Wire up the lines for MSCs
In reply to Peter MaydellThe IoTKit doesn't have any MSCs itself but it does need some wiring to connect the external signals from MSCs in the outer board model up to the registers and the NVIC IRQ line.
We also need to expose a MemoryRegion corresponding to the AHB bus, so that MSCs in the outer board model can use that as their downstream port. (In the FPGA this is the "AHB Slave Expansion" ports shown in the block diagram in the AN505 documentation.)
Message-id: [email protected]
--- include/hw/arm/iotkit.h | 8 ++++++++ hw/arm/iotkit.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+)
include/hw/arm/iotkit.h +8 -0
@@ -28,6 +28,9 @@* + QOM property "EXP_NUMIRQ" sets the number of expansion interrupts * + Named GPIO inputs "EXP_IRQ" 0..n are the expansion interrupts, which * are wired to the NVIC lines 32 .. n+32 +* + sysbus MMIO region 0 is the "AHB Slave Expansion" which allows +* bus master devices in the board model to make transactions into +* all the devices and memory areas in the IoTKit * Controlling up to 4 AHB expansion PPBs which a system using the IoTKit * might provide: * + named GPIO outputs apb_ppcexp{0,1,2,3}_nonsec[0..15]
@@ -45,6 +48,11 @@* Controlling each of the 16 expansion MPCs which a system using the IoTKit * might provide: * + named GPIO inputs mpcexp_status[0..15] +* Controlling each of the 16 expansion MSCs which a system using the IoTKit +* might provide: +* + named GPIO inputs mscexp_status[0..15] +* + named GPIO outputs mscexp_clear[0..15] +* + named GPIO outputs mscexp_ns[0..15] */ #ifndef IOTKIT_H
hw/arm/iotkit.c +15 -0
@@ -667,6 +667,21 @@ static void iotkit_realize(DeviceState *dev, Error **errp)iotkit_forward_sec_resp_cfg (s); +/* Forward the MSC related signals */ +qdev_pass_gpios (dev_secctl, dev,"mscexp_status" ); +qdev_pass_gpios (dev_secctl, dev,"mscexp_clear" ); +qdev_pass_gpios (dev_secctl, dev,"mscexp_ns" ); +qdev_connect_gpio_out_named (dev_secctl,"msc_irq" ,0 , +qdev_get_gpio_in (DEVICE (&s->armv7m),11 )); + +/* +* Expose our container region to the board model; this corresponds +* to the AHB Slave Expansion ports which allow bus master devices +* (eg DMA controllers) in the board model to make transactions into +* devices in the IoTKit. +*/ +sysbus_init_mmio (SYS_BUS_DEVICE (s), &s->container); + system_clock_scale =NANOSECONDS_PER_SECOND / s->mainclk_frq; }
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 32/52] hw/arm/mps2-tz: Create PL081s and MSCs
In reply to Peter MaydellThe AN505 FPGA image includes four PL081 DMA controllers, each of which is gated by a Master Security Controller that allows the guest to prevent a non-secure DMA controller from accessing memory that is used by secure guest code. Create and wire up these devices.
Message-id: [email protected]
--- hw/arm/mps2-tz.c | 100 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 93 insertions(+), 7 deletions(-)
hw/arm/mps2-tz.c +93 -7
@@ -45,7 +45,9 @@#include "hw/misc/mps2-scc.h" #include "hw/misc/mps2-fpgaio.h" #include "hw/misc/tz-mpc.h" +#include "hw/misc/tz-msc.h" #include "hw/arm/iotkit.h" +#include "hw/dma/pl080.h" #include "hw/devices.h" #include "net/net.h" #include "hw/core/split-irq.h"
@@ -75,8 +77,9 @@ typedef struct {UnimplementedDeviceState i2c[4 ];UnimplementedDeviceState i2s_audio;UnimplementedDeviceState gpio[4 ]; -UnimplementedDeviceState dma[4 ];UnimplementedDeviceState gfx; +PL080State dma[4 ]; +TZMSC msc[4 ];CMSDKAPBUART uart[5 ];SplitIRQ sec_resp_splitter;qemu_or_irq uart_irq_orgate;
@@ -263,6 +266,64 @@ static MemoryRegion *make_mpc(MPS2TZMachineState *mms, void *opaque,return sysbus_mmio_get_region (SYS_BUS_DEVICE (mpc),0 ); } +static MemoryRegion *make_dma (MPS2TZMachineState *mms,void *opaque, +const char *name,hwaddr size) +{ +PL080State *dma = opaque; +int i = dma - &mms->dma[0 ]; +SysBusDevice *s; +char *mscname =g_strdup_printf ("%s-msc" , name); +TZMSC *msc = &mms->msc[i]; +DeviceState *iotkitdev =DEVICE (&mms->iotkit); +MemoryRegion *msc_upstream; +MemoryRegion *msc_downstream; + +/* +* Each DMA device is a PL081 whose transaction master interface +* is guarded by a Master Security Controller. The downstream end of +* the MSC connects to the IoTKit AHB Slave Expansion port, so the +* DMA devices can see all devices and memory that the CPU does. +*/ +sysbus_init_child_obj (OBJECT (mms), mscname, msc,sizeof (*msc),TYPE_TZ_MSC ); + msc_downstream =sysbus_mmio_get_region (SYS_BUS_DEVICE (&mms->iotkit),0 ); +object_property_set_link (OBJECT (msc),OBJECT (msc_downstream), +"downstream" , &error_fatal); +object_property_set_link (OBJECT (msc),OBJECT (mms), +"idau" , &error_fatal); +object_property_set_bool (OBJECT (msc), true,"realized" , &error_fatal); + +qdev_connect_gpio_out_named (DEVICE (msc),"irq" ,0 , +qdev_get_gpio_in_named (iotkitdev, +"mscexp_status" , i)); +qdev_connect_gpio_out_named (iotkitdev,"mscexp_clear" , i, +qdev_get_gpio_in_named (DEVICE (msc), +"irq_clear" ,0 )); +qdev_connect_gpio_out_named (iotkitdev,"mscexp_ns" , i, +qdev_get_gpio_in_named (DEVICE (msc), +"cfg_nonsec" ,0 )); +qdev_connect_gpio_out (DEVICE (&mms->sec_resp_splitter), +ARRAY_SIZE (mms->ppc) + i, +qdev_get_gpio_in_named (DEVICE (msc), +"cfg_sec_resp" ,0 )); + msc_upstream =sysbus_mmio_get_region (SYS_BUS_DEVICE (msc),0 ); + +sysbus_init_child_obj (OBJECT (mms), name, dma,sizeof (*dma),TYPE_PL081 ); +object_property_set_link (OBJECT (dma),OBJECT (msc_upstream), +"downstream" , &error_fatal); +object_property_set_bool (OBJECT (dma), true,"realized" , &error_fatal); + + s =SYS_BUS_DEVICE (dma); +/* Wire up DMACINTR, DMACINTERR, DMACINTTC */ +sysbus_connect_irq (s,0 ,qdev_get_gpio_in_named (iotkitdev, +"EXP_IRQ" ,58 + i *3 )); +sysbus_connect_irq (s,1 ,qdev_get_gpio_in_named (iotkitdev, +"EXP_IRQ" ,56 + i *3 )); +sysbus_connect_irq (s,2 ,qdev_get_gpio_in_named (iotkitdev, +"EXP_IRQ" ,57 + i *3 )); + +return sysbus_mmio_get_region (s,0 ); +} +static void mps2tz_common_init (MachineState *machine) {MPS2TZMachineState *mms =MPS2TZ_MACHINE (machine);
@@ -289,13 +350,14 @@ static void mps2tz_common_init(MachineState *machine) &error_fatal);/* The sec_resp_cfg output from the IoTKit must be split into multiple -* lines, one for each of the PPCs we create here. +* lines, one for each of the PPCs we create here, plus one per MSC. */ object_initialize (&mms->sec_resp_splitter,sizeof (mms->sec_resp_splitter),TYPE_SPLIT_IRQ );object_property_add_child (OBJECT (machine),"sec-resp-splitter" ,OBJECT (&mms->sec_resp_splitter), &error_abort); -object_property_set_int (OBJECT (&mms->sec_resp_splitter),5 , +object_property_set_int (OBJECT (&mms->sec_resp_splitter), +ARRAY_SIZE (mms->ppc) +ARRAY_SIZE (mms->msc),"num-lines" , &error_fatal);object_property_set_bool (OBJECT (&mms->sec_resp_splitter), true,"realized" , &error_fatal);
@@ -396,10 +458,10 @@ static void mps2tz_common_init(MachineState *machine) }, { .name = "ahb_ppcexp1", .ports = { - { "dma0", make_unimp_dev, &mms->dma[0], 0x40110000, 0x1000 }, - { "dma1", make_unimp_dev, &mms->dma[1], 0x40111000, 0x1000 }, - { "dma2", make_unimp_dev, &mms->dma[2], 0x40112000, 0x1000 }, - { "dma3", make_unimp_dev, &mms->dma[3], 0x40113000, 0x1000 }, + { "dma0", make_dma, &mms->dma[0], 0x40110000, 0x1000 }, + { "dma1", make_dma, &mms->dma[1], 0x40111000, 0x1000 }, + { "dma2", make_dma, &mms->dma[2], 0x40112000, 0x1000 }, + { "dma3", make_dma, &mms->dma[3], 0x40113000, 0x1000 }, }, }, };
@@ -480,12 +542,32 @@ static void mps2tz_common_init(MachineState *machine)armv7m_load_kernel (ARM_CPU (first_cpu), machine->kernel_filename,0x400000 ); } +static void mps2_tz_idau_check (IDAUInterface *ii,uint32_t address, +int *iregion,bool *exempt,bool *ns,bool *nsc) +{ +/* +* The MPS2 TZ FPGA images have IDAUs in them which are connected to +* the Master Security Controllers. Thes have the same logic as +* is used by the IoTKit for the IDAU connected to the CPU, except +* that MSCs don't care about the NSC attribute. +*/ +int region =extract32 (address,28 ,4 ); + + *ns = !(region &1 ); + *nsc = false; +/* 0xe0000000..0xe00fffff and 0xf0000000..0xf00fffff are exempt */ + *exempt = (address &0xeff00000 ) ==0xe0000000 ; + *iregion = region; +} +static void mps2tz_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc); +IDAUInterfaceClass *iic =IDAU_INTERFACE_CLASS (oc); mc->init = mps2tz_common_init; mc->max_cpus =1 ; + iic->check = mps2_tz_idau_check; }static void mps2tz_an505_class_init (ObjectClass *oc,void *data)
@@ -506,6 +588,10 @@ static const TypeInfo mps2tz_info = { .instance_size = sizeof(MPS2TZMachineState), .class_size = sizeof(MPS2TZMachineClass), .class_init = mps2tz_class_init, + .interfaces = (InterfaceInfo []) { + {TYPE_IDAU_INTERFACE }, + { } + }, };static const TypeInfo mps2tz_an505_info = {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 33/52] hw/ssi/pl022: Allow use as embedded-struct device
In reply to Peter MaydellCreate a new include file for the pl022's device struct, type macros, etc, so that it can be instantiated using the "embedded struct" coding style.
While we're adding the new file to MAINTAINERS, add also the .c file, which was missing an entry.
Message-id: [email protected]
--- include/hw/ssi/pl022.h | 51 ++++++++++++++++++++++++++++++++++++++++++ hw/ssi/pl022.c | 26 +-------------------- MAINTAINERS | 2 ++ 3 files changed, 54 insertions(+), 25 deletions(-) create mode 100644 include/hw/ssi/pl022.h
include/hw/ssi/pl022.h new file +51 -0
@@ -0,0 +1,51 @@ +/* +* ARM PrimeCell PL022 Synchronous Serial Port +* +* Copyright (c) 2007 CodeSourcery. +* Written by Paul Brook +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 or +* (at your option) any later version. +*/ + +/* This is a model of the Arm PrimeCell PL022 synchronous serial port. +* The PL022 TRM is: +* http://infocenter.arm.com/help/topic/com.arm.doc.ddi0194h/DDI0194H_ssp_pl022_trm.pdf +* +* QEMU interface: +* + sysbus IRQ: SSPINTR combined interrupt line +* + sysbus MMIO region 0: MemoryRegion for the device's registers +*/ + +#ifndef HW_SSI_PL022_H +#define HW_SSI_PL022_H + +#include "hw/sysbus.h" + +#define TYPE_PL022 "pl022" +#define PL022 (obj) OBJECT_CHECK(PL022State, (obj), TYPE_PL022) + +typedef struct PL022State { +SysBusDevice parent_obj; + +MemoryRegion iomem; +uint32_t cr0; +uint32_t cr1; +uint32_t bitmask; +uint32_t sr; +uint32_t cpsr; +uint32_t is; +uint32_t im; +/* The FIFO head points to the next empty entry. */ +int tx_fifo_head; +int rx_fifo_head; +int tx_fifo_len; +int rx_fifo_len; +uint16_t tx_fifo[8 ]; +uint16_t rx_fifo[8 ]; +qemu_irq irq; +SSIBus *ssi; +}PL022State ; + +#endif
hw/ssi/pl022.c +1 -25
@@ -9,6 +9,7 @@#include "qemu/osdep.h" #include "hw/sysbus.h" +#include "hw/ssi/pl022.h" #include "hw/ssi/ssi.h" #include "qemu/log.h"
@@ -41,31 +42,6 @@ do { fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__);} while (0)#define PL022_INT_RX 0x04#define PL022_INT_TX 0x08 -#define TYPE_PL022 "pl022" -#define PL022 (obj) OBJECT_CHECK(PL022State, (obj), TYPE_PL022) - -typedef struct PL022State { -SysBusDevice parent_obj; - -MemoryRegion iomem; -uint32_t cr0; -uint32_t cr1; -uint32_t bitmask; -uint32_t sr; -uint32_t cpsr; -uint32_t is; -uint32_t im; -/* The FIFO head points to the next empty entry. */ -int tx_fifo_head; -int rx_fifo_head; -int tx_fifo_len; -int rx_fifo_len; -uint16_t tx_fifo[8 ]; -uint16_t rx_fifo[8 ]; -qemu_irq irq; -SSIBus *ssi; -}PL022State ; -static const unsigned char pl022_id[8 ] = {0x22 ,0x10 ,0x04 ,0x00 ,0x0d ,0xf0 ,0x05 ,0xb1 };
MAINTAINERS +2 -0
@@ -451,6 +451,8 @@ F: hw/gpio/pl061.c F: hw/input/pl050.c F: hw/intc/pl190.c F: hw/sd/pl181.c +F: hw/ssi/pl022.c +F: include/hw/ssi/pl022.h F: hw/timer/pl031.c F: include/hw/arm/primecell.h F: hw/timer/cmsdk-apb-timer.c
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 37/52] hw/ssi/pl022: Correct wrong value for PL022_INT_RT
In reply to Peter MaydellThe PL022 interrupt registers have bits allocated as:
0: ROR (receive overrun)
1: RT (receive timeout)
2: RX (receive FIFO half full or less)
3: TX (transmit FIFO half full or less)
A cut and paste error meant we had the wrong value for the PL022_INT_RT constant. This bug doesn't affect device behaviour, because we don't implement the receive timeout feature and so never set that interrupt bit.
Message-id: [email protected]
--- hw/ssi/pl022.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ssi/pl022.c +1 -1
@@ -38,7 +38,7 @@ do { fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__);} while (0)#define PL022_SR_BSY 0x10#define PL022_INT_ROR 0x01 -#define PL022_INT_RT 0x04 +#define PL022_INT_RT 0x02#define PL022_INT_RX 0x04#define PL022_INT_TX 0x08
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 38/52] hw/ssi/pl022: Correct wrong DMACR and ICR handling
In reply to Peter MaydellIn the PL022, register offset 0x20 is the ICR, a write-only interrupt-clear register. Register offset 0x24 is DMACR, the DMA control register. We were incorrectly implementing (a stub version of) DMACR at 0x20, and not implementing anything at 0x24. Fix this bug.
Message-id: [email protected]
--- hw/ssi/pl022.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
hw/ssi/pl022.c +10 -2
@@ -146,7 +146,7 @@ static uint64_t pl022_read(void *opaque, hwaddr offset,return s->is;case 0x1c :/* MIS */ return s->im & s->is; -case 0x20 :/* DMACR */ +case 0x24 :/* DMACR */ /* Not implemented. */ return 0 ;default :
@@ -192,7 +192,15 @@ static void pl022_write(void *opaque, hwaddr offset, s->im = value;pl022_update (s);break ; -case 0x20 :/* DMACR */ +case 0x20 :/* ICR */ +/* +* write-1-to-clear: bit 0 clears ROR, bit 1 clears RT; +* RX and TX interrupts cannot be cleared this way. +*/ + value &=PL022_INT_ROR |PL022_INT_RT ; + s->is &= ~value; +break ; +case 0x24 :/* DMACR */ if (value) {qemu_log_mask (LOG_UNIMP ,"pl022: DMA not implemented\n" ); }
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 39/52] hw/arm/mps2-tz: Instantiate SPI controllers
In reply to Peter MaydellThe SPI controllers in the MPS2 AN505 board are PL022s. We have a model of the PL022, so create these devices.
We don't currently model the LCD controller that sits behind one of the PL022s; the others are intended to control devices that sit on the FPGA's general purpose SPI connector or "shield" expansion connectors.
Message-id: [email protected]
--- hw/arm/mps2-tz.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-)
hw/arm/mps2-tz.c +32 -6
@@ -48,6 +48,7 @@#include "hw/misc/tz-msc.h" #include "hw/arm/iotkit.h" #include "hw/dma/pl080.h" +#include "hw/ssi/pl022.h" #include "hw/devices.h" #include "net/net.h" #include "hw/core/split-irq.h"
@@ -73,7 +74,7 @@ typedef struct {MPS2FPGAIO fpgaio;TZPPC ppc[5 ];TZMPC ssram_mpc[3 ]; -UnimplementedDeviceState spi[5 ]; +PL022State spi[5 ];UnimplementedDeviceState i2c[4 ];UnimplementedDeviceState i2s_audio;UnimplementedDeviceState gpio[4 ];
@@ -324,6 +325,31 @@ static MemoryRegion *make_dma(MPS2TZMachineState *mms, void *opaque,return sysbus_mmio_get_region (s,0 ); } +static MemoryRegion *make_spi (MPS2TZMachineState *mms,void *opaque, +const char *name,hwaddr size) +{ +/* +* The AN505 has five PL022 SPI controllers. +* One of these should have the LCD controller behind it; the others +* are connected only to the FPGA's "general purpose SPI connector" +* or "shield" expansion connectors. +* Note that if we do implement devices behind SPI, the chip select +* lines are set via the "MISC" register in the MPS2 FPGAIO device. +*/ +PL022State *spi = opaque; +int i = spi - &mms->spi[0 ]; +DeviceState *iotkitdev =DEVICE (&mms->iotkit); +SysBusDevice *s; + +sysbus_init_child_obj (OBJECT (mms), name, spi,sizeof (mms->spi[0 ]), +TYPE_PL022 ); +object_property_set_bool (OBJECT (spi), true,"realized" , &error_fatal); + s =SYS_BUS_DEVICE (spi); +sysbus_connect_irq (s,0 , +qdev_get_gpio_in_named (iotkitdev,"EXP_IRQ" ,51 + i)); +return sysbus_mmio_get_region (s,0 ); +} +static void mps2tz_common_init (MachineState *machine) {MPS2TZMachineState *mms =MPS2TZ_MACHINE (machine);
@@ -422,11 +448,11 @@ static void mps2tz_common_init(MachineState *machine) }, { .name = "apb_ppcexp1", .ports = { - { "spi0", make_unimp_dev, &mms->spi[0], 0x40205000, 0x1000 }, - { "spi1", make_unimp_dev, &mms->spi[1], 0x40206000, 0x1000 }, - { "spi2", make_unimp_dev, &mms->spi[2], 0x40209000, 0x1000 }, - { "spi3", make_unimp_dev, &mms->spi[3], 0x4020a000, 0x1000 }, - { "spi4", make_unimp_dev, &mms->spi[4], 0x4020b000, 0x1000 }, + { "spi0", make_spi, &mms->spi[0], 0x40205000, 0x1000 }, + { "spi1", make_spi, &mms->spi[1], 0x40206000, 0x1000 }, + { "spi2", make_spi, &mms->spi[2], 0x40209000, 0x1000 }, + { "spi3", make_spi, &mms->spi[3], 0x4020a000, 0x1000 }, + { "spi4", make_spi, &mms->spi[4], 0x4020b000, 0x1000 }, { "uart0", make_uart, &mms->uart[0], 0x40200000, 0x1000 }, { "uart1", make_uart, &mms->uart[1], 0x40201000, 0x1000 }, { "uart2", make_uart, &mms->uart[2], 0x40202000, 0x1000 },
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 43/52] target/arm: Remove a handful of stray tabs
In reply to Peter MaydellFollowing the bulk conversion of the iwMMXt code, there are just a handful of hard coded tabs in target/arm; fix them. This is a whitespace-only patch.
Message-id: [email protected]
--- target/arm/cpu.h | 16 ++++++++-------- target/arm/arm-semi.c | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-)
target/arm/cpu.h +8 -8
@@ -1320,14 +1320,14 @@ enum arm_cpu_mode {#define ARM_VFP_FPINST2 10/* iwMMXt coprocessor control registers. */ -#define ARM_IWMMXT_wCID 0 -#define ARM_IWMMXT_wCon 1 -#define ARM_IWMMXT_wCSSF 2 -#define ARM_IWMMXT_wCASF 3 -#define ARM_IWMMXT_wCGR0 8 -#define ARM_IWMMXT_wCGR1 9 -#define ARM_IWMMXT_wCGR2 10 -#define ARM_IWMMXT_wCGR3 11 +#define ARM_IWMMXT_wCID 0 +#define ARM_IWMMXT_wCon 1 +#define ARM_IWMMXT_wCSSF 2 +#define ARM_IWMMXT_wCASF 3 +#define ARM_IWMMXT_wCGR0 8 +#define ARM_IWMMXT_wCGR1 9 +#define ARM_IWMMXT_wCGR2 10 +#define ARM_IWMMXT_wCGR3 11/* V7M CCR bits */ FIELD (V7M_CCR ,NONBASETHRDENA ,0 ,1 )
target/arm/arm-semi.c +1 -1
@@ -136,7 +136,7 @@ static void arm_semi_cb(CPUState *cs, target_ulong ret, target_ulong err)#ifdef CONFIG_USER_ONLY ts->swi_errno = err;#else - syscall_err = err; + syscall_err = err;#endif reg0 = ret; }else {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 42/52] target/arm: Untabify iwmmxt_helper.c
In reply to Peter MaydellUntabify the arm iwmmxt_helper.c. This affects only the iwMMXt code. We've never touched that code in years, so it's not going to get fixed up by our "change when touched" process, and a bulk change is not going to be too disruptive.
This commit was produced using Emacs "untabify" (plus one by-hand removal of a space to fix a checkpatch nit); it is a whitespace-only change.
Message-id: [email protected]
--- target/arm/iwmmxt_helper.c | 234 ++++++++++++++++++------------------- 1 file changed, 117 insertions(+), 117 deletions(-)
target/arm/iwmmxt_helper.c +117 -117
@@ -27,30 +27,30 @@/* iwMMXt macros extracted from GNU gdb. */ /* Set the SIMD wCASF flags for 8, 16, 32 or 64-bit operations. */ -#define SIMD8_SET ( v, n, b) ((v != 0) << ((((b) + 1) * 4) + (n))) -#define SIMD16_SET (v, n, h) ((v != 0) << ((((h) + 1) * 8) + (n))) -#define SIMD32_SET (v, n, w) ((v != 0) << ((((w) + 1) * 16) + (n))) -#define SIMD64_SET (v, n) ((v != 0) << (32 + (n))) +#define SIMD8_SET (v, n, b) ((v != 0) << ((((b) + 1) * 4) + (n))) +#define SIMD16_SET (v, n, h) ((v != 0) << ((((h) + 1) * 8) + (n))) +#define SIMD32_SET (v, n, w) ((v != 0) << ((((w) + 1) * 16) + (n))) +#define SIMD64_SET (v, n) ((v != 0) << (32 + (n)))/* Flags to pass as "n" above. */ -#define SIMD_NBIT -1 -#define SIMD_ZBIT -2 -#define SIMD_CBIT -3 -#define SIMD_VBIT -4 +#define SIMD_NBIT -1 +#define SIMD_ZBIT -2 +#define SIMD_CBIT -3 +#define SIMD_VBIT -4/* Various status bit macros. */ -#define NBIT8 (x) ((x) & 0x80) -#define NBIT16 (x) ((x) & 0x8000) -#define NBIT32 (x) ((x) & 0x80000000) -#define NBIT64 (x) ((x) & 0x8000000000000000ULL) -#define ZBIT8 (x) (((x) & 0xff) == 0) -#define ZBIT16 (x) (((x) & 0xffff) == 0) -#define ZBIT32 (x) (((x) & 0xffffffff) == 0) -#define ZBIT64 (x) (x == 0) +#define NBIT8 (x) ((x) & 0x80) +#define NBIT16 (x) ((x) & 0x8000) +#define NBIT32 (x) ((x) & 0x80000000) +#define NBIT64 (x) ((x) & 0x8000000000000000ULL) +#define ZBIT8 (x) (((x) & 0xff) == 0) +#define ZBIT16 (x) (((x) & 0xffff) == 0) +#define ZBIT32 (x) (((x) & 0xffffffff) == 0) +#define ZBIT64 (x) (x == 0)/* Sign extension macros. */ -#define EXTEND8H (a) ((uint16_t) (int8_t) (a)) -#define EXTEND8 (a) ((uint32_t) (int8_t) (a)) -#define EXTEND16 (a) ((uint32_t) (int16_t) (a)) -#define EXTEND16S (a) ((int32_t) (int16_t) (a)) -#define EXTEND32 (a) ((uint64_t) (int32_t) (a)) +#define EXTEND8H (a) ((uint16_t) (int8_t) (a)) +#define EXTEND8 (a) ((uint32_t) (int8_t) (a)) +#define EXTEND16 (a) ((uint32_t) (int16_t) (a)) +#define EXTEND16S (a) ((int32_t) (int16_t) (a)) +#define EXTEND32 (a) ((uint64_t) (int32_t) (a))uint64_t HELPER (iwmmxt_maddsq )(uint64_t a,uint64_t b) {
@@ -159,141 +159,141 @@ uint64_t HELPER(iwmmxt_macuw)(uint64_t a, uint64_t b)#define NZBIT64 (x) \ SIMD64_SET(NBIT64(x), SIMD_NBIT) | \ SIMD64_SET(ZBIT64(x), SIMD_ZBIT) -#define IWMMXT_OP_UNPACK (S ,SH0 ,SH1 ,SH2 ,SH3 ) \ +#define IWMMXT_OP_UNPACK (S ,SH0 ,SH1 ,SH2 ,SH3 ) \ uint64_t HELPER(glue(iwmmxt_unpack, glue(S, b)))(CPUARMState *env, \ uint64_t a, uint64_t b) \ -{ \ - a = \ - (((a >> SH0) & 0xff) << 0) | (((b >> SH0) & 0xff) << 8) | \ - (((a >> SH1) & 0xff) << 16) | (((b >> SH1) & 0xff) << 24) | \ - (((a >> SH2) & 0xff) << 32) | (((b >> SH2) & 0xff) << 40) | \ - (((a >> SH3) & 0xff) << 48) | (((b >> SH3) & 0xff) << 56); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ - NZBIT8(a >> 0, 0) | NZBIT8(a >> 8, 1) | \ - NZBIT8(a >> 16, 2) | NZBIT8(a >> 24, 3) | \ - NZBIT8(a >> 32, 4) | NZBIT8(a >> 40, 5) | \ - NZBIT8(a >> 48, 6) | NZBIT8(a >> 56, 7); \ +{ \ + a = \ + (((a >> SH0) & 0xff) << 0) | (((b >> SH0) & 0xff) << 8) | \ + (((a >> SH1) & 0xff) << 16) | (((b >> SH1) & 0xff) << 24) | \ + (((a >> SH2) & 0xff) << 32) | (((b >> SH2) & 0xff) << 40) | \ + (((a >> SH3) & 0xff) << 48) | (((b >> SH3) & 0xff) << 56); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ + NZBIT8(a >> 0, 0) | NZBIT8(a >> 8, 1) | \ + NZBIT8(a >> 16, 2) | NZBIT8(a >> 24, 3) | \ + NZBIT8(a >> 32, 4) | NZBIT8(a >> 40, 5) | \ + NZBIT8(a >> 48, 6) | NZBIT8(a >> 56, 7); \ return a; \ -} \ +} \ uint64_t HELPER(glue(iwmmxt_unpack, glue(S, w)))(CPUARMState *env, \ uint64_t a, uint64_t b) \ -{ \ - a = \ - (((a >> SH0) & 0xffff) << 0) | \ - (((b >> SH0) & 0xffff) << 16) | \ - (((a >> SH2) & 0xffff) << 32) | \ - (((b >> SH2) & 0xffff) << 48); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ - NZBIT8(a >> 0, 0) | NZBIT8(a >> 16, 1) | \ - NZBIT8(a >> 32, 2) | NZBIT8(a >> 48, 3); \ +{ \ + a = \ + (((a >> SH0) & 0xffff) << 0) | \ + (((b >> SH0) & 0xffff) << 16) | \ + (((a >> SH2) & 0xffff) << 32) | \ + (((b >> SH2) & 0xffff) << 48); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ + NZBIT8(a >> 0, 0) | NZBIT8(a >> 16, 1) | \ + NZBIT8(a >> 32, 2) | NZBIT8(a >> 48, 3); \ return a; \ -} \ +} \ uint64_t HELPER(glue(iwmmxt_unpack, glue(S, l)))(CPUARMState *env, \ uint64_t a, uint64_t b) \ -{ \ - a = \ - (((a >> SH0) & 0xffffffff) << 0) | \ - (((b >> SH0) & 0xffffffff) << 32); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ - NZBIT32(a >> 0, 0) | NZBIT32(a >> 32, 1); \ +{ \ + a = \ + (((a >> SH0) & 0xffffffff) << 0) | \ + (((b >> SH0) & 0xffffffff) << 32); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ + NZBIT32(a >> 0, 0) | NZBIT32(a >> 32, 1); \ return a; \ -} \ +} \ uint64_t HELPER(glue(iwmmxt_unpack, glue(S, ub)))(CPUARMState *env, \ uint64_t x) \ -{ \ - x = \ - (((x >> SH0) & 0xff) << 0) | \ - (((x >> SH1) & 0xff) << 16) | \ - (((x >> SH2) & 0xff) << 32) | \ - (((x >> SH3) & 0xff) << 48); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ - NZBIT16(x >> 0, 0) | NZBIT16(x >> 16, 1) | \ - NZBIT16(x >> 32, 2) | NZBIT16(x >> 48, 3); \ +{ \ + x = \ + (((x >> SH0) & 0xff) << 0) | \ + (((x >> SH1) & 0xff) << 16) | \ + (((x >> SH2) & 0xff) << 32) | \ + (((x >> SH3) & 0xff) << 48); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ + NZBIT16(x >> 0, 0) | NZBIT16(x >> 16, 1) | \ + NZBIT16(x >> 32, 2) | NZBIT16(x >> 48, 3); \ return x; \ -} \ +} \ uint64_t HELPER(glue(iwmmxt_unpack, glue(S, uw)))(CPUARMState *env, \ uint64_t x) \ -{ \ - x = \ - (((x >> SH0) & 0xffff) << 0) | \ - (((x >> SH2) & 0xffff) << 32); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ - NZBIT32(x >> 0, 0) | NZBIT32(x >> 32, 1); \ +{ \ + x = \ + (((x >> SH0) & 0xffff) << 0) | \ + (((x >> SH2) & 0xffff) << 32); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ + NZBIT32(x >> 0, 0) | NZBIT32(x >> 32, 1); \ return x; \ -} \ +} \ uint64_t HELPER(glue(iwmmxt_unpack, glue(S, ul)))(CPUARMState *env, \ uint64_t x) \ -{ \ - x = (((x >> SH0) & 0xffffffff) << 0); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = NZBIT64(x >> 0); \ +{ \ + x = (((x >> SH0) & 0xffffffff) << 0); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = NZBIT64(x >> 0); \ return x; \ -} \ +} \ uint64_t HELPER(glue(iwmmxt_unpack, glue(S, sb)))(CPUARMState *env, \ uint64_t x) \ -{ \ - x = \ - ((uint64_t) EXTEND8H((x >> SH0) & 0xff) << 0) | \ - ((uint64_t) EXTEND8H((x >> SH1) & 0xff) << 16) | \ - ((uint64_t) EXTEND8H((x >> SH2) & 0xff) << 32) | \ - ((uint64_t) EXTEND8H((x >> SH3) & 0xff) << 48); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ - NZBIT16(x >> 0, 0) | NZBIT16(x >> 16, 1) | \ - NZBIT16(x >> 32, 2) | NZBIT16(x >> 48, 3); \ +{ \ + x = \ + ((uint64_t) EXTEND8H((x >> SH0) & 0xff) << 0) | \ + ((uint64_t) EXTEND8H((x >> SH1) & 0xff) << 16) | \ + ((uint64_t) EXTEND8H((x >> SH2) & 0xff) << 32) | \ + ((uint64_t) EXTEND8H((x >> SH3) & 0xff) << 48); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ + NZBIT16(x >> 0, 0) | NZBIT16(x >> 16, 1) | \ + NZBIT16(x >> 32, 2) | NZBIT16(x >> 48, 3); \ return x; \ -} \ +} \ uint64_t HELPER(glue(iwmmxt_unpack, glue(S, sw)))(CPUARMState *env, \ uint64_t x) \ -{ \ - x = \ - ((uint64_t) EXTEND16((x >> SH0) & 0xffff) << 0) | \ - ((uint64_t) EXTEND16((x >> SH2) & 0xffff) << 32); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ - NZBIT32(x >> 0, 0) | NZBIT32(x >> 32, 1); \ +{ \ + x = \ + ((uint64_t) EXTEND16((x >> SH0) & 0xffff) << 0) | \ + ((uint64_t) EXTEND16((x >> SH2) & 0xffff) << 32); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ + NZBIT32(x >> 0, 0) | NZBIT32(x >> 32, 1); \ return x; \ -} \ +} \ uint64_t HELPER(glue(iwmmxt_unpack, glue(S, sl)))(CPUARMState *env, \ uint64_t x) \ -{ \ - x = EXTEND32((x >> SH0) & 0xffffffff); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = NZBIT64(x >> 0); \ +{ \ + x = EXTEND32((x >> SH0) & 0xffffffff); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = NZBIT64(x >> 0); \ return x; \ } IWMMXT_OP_UNPACK(l, 0, 8, 16, 24) IWMMXT_OP_UNPACK(h, 32, 40, 48, 56) -#define IWMMXT_OP_CMP (SUFF , Tb, Tw, Tl,O ) \ +#define IWMMXT_OP_CMP (SUFF , Tb, Tw, Tl,O ) \ uint64_t HELPER(glue(iwmmxt_, glue(SUFF, b)))(CPUARMState *env, \ uint64_t a, uint64_t b) \ -{ \ - a = \ - CMP(0, Tb, O, 0xff) | CMP(8, Tb, O, 0xff) | \ - CMP(16, Tb, O, 0xff) | CMP(24, Tb, O, 0xff) | \ - CMP(32, Tb, O, 0xff) | CMP(40, Tb, O, 0xff) | \ - CMP(48, Tb, O, 0xff) | CMP(56, Tb, O, 0xff); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ - NZBIT8(a >> 0, 0) | NZBIT8(a >> 8, 1) | \ - NZBIT8(a >> 16, 2) | NZBIT8(a >> 24, 3) | \ - NZBIT8(a >> 32, 4) | NZBIT8(a >> 40, 5) | \ - NZBIT8(a >> 48, 6) | NZBIT8(a >> 56, 7); \ +{ \ + a = \ + CMP(0, Tb, O, 0xff) | CMP(8, Tb, O, 0xff) | \ + CMP(16, Tb, O, 0xff) | CMP(24, Tb, O, 0xff) | \ + CMP(32, Tb, O, 0xff) | CMP(40, Tb, O, 0xff) | \ + CMP(48, Tb, O, 0xff) | CMP(56, Tb, O, 0xff); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ + NZBIT8(a >> 0, 0) | NZBIT8(a >> 8, 1) | \ + NZBIT8(a >> 16, 2) | NZBIT8(a >> 24, 3) | \ + NZBIT8(a >> 32, 4) | NZBIT8(a >> 40, 5) | \ + NZBIT8(a >> 48, 6) | NZBIT8(a >> 56, 7); \ return a; \ -} \ +} \ uint64_t HELPER(glue(iwmmxt_, glue(SUFF, w)))(CPUARMState *env, \ uint64_t a, uint64_t b) \ -{ \ - a = CMP(0, Tw, O, 0xffff) | CMP(16, Tw, O, 0xffff) | \ - CMP(32, Tw, O, 0xffff) | CMP(48, Tw, O, 0xffff); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ - NZBIT16(a >> 0, 0) | NZBIT16(a >> 16, 1) | \ - NZBIT16(a >> 32, 2) | NZBIT16(a >> 48, 3); \ +{ \ + a = CMP(0, Tw, O, 0xffff) | CMP(16, Tw, O, 0xffff) | \ + CMP(32, Tw, O, 0xffff) | CMP(48, Tw, O, 0xffff); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ + NZBIT16(a >> 0, 0) | NZBIT16(a >> 16, 1) | \ + NZBIT16(a >> 32, 2) | NZBIT16(a >> 48, 3); \ return a; \ -} \ +} \ uint64_t HELPER(glue(iwmmxt_, glue(SUFF, l)))(CPUARMState *env, \ uint64_t a, uint64_t b) \ -{ \ - a = CMP(0, Tl, O, 0xffffffff) | \ - CMP(32, Tl, O, 0xffffffff); \ - env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ - NZBIT32(a >> 0, 0) | NZBIT32(a >> 32, 1); \ +{ \ + a = CMP(0, Tl, O, 0xffffffff) | \ + CMP(32, Tl, O, 0xffffffff); \ + env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = \ + NZBIT32(a >> 0, 0) | NZBIT32(a >> 32, 1); \ return a; \ }#define CMP (SHR ,TYPE ,OPER ,MASK ) ((((TYPE) ((a >> SHR) & MASK) OPER \
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 34/52] hw/ssi/pl022: Set up reset function in class init
In reply to Peter MaydellCurrently the PL022 calls pl022_reset() from its class init function. Make it register a DeviceState reset method instead, so that we reset the device on system reset.
Message-id: [email protected]
--- hw/ssi/pl022.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
hw/ssi/pl022.c +5 -2
@@ -203,8 +203,10 @@ static void pl022_write(void *opaque, hwaddr offset, } } -static void pl022_reset (PL022State *s) +static void pl022_reset (DeviceState *dev) { +PL022State *s =PL022 (dev); + s->rx_fifo_len =0 ; s->tx_fifo_len =0 ; s->im =0 ;
@@ -277,7 +279,6 @@ static int pl022_init(SysBusDevice *sbd)sysbus_init_mmio (sbd, &s->iomem);sysbus_init_irq (sbd, &s->irq); s->ssi =ssi_create_bus (dev,"ssi" ); -pl022_reset (s);vmstate_register (dev,-1 , &vmstate_pl022, s);return 0 ; }
@@ -285,8 +286,10 @@ static int pl022_init(SysBusDevice *sbd)static void pl022_class_init (ObjectClass *klass,void *data) {SysBusDeviceClass *sdc =SYS_BUS_DEVICE_CLASS (klass); +DeviceClass *dc =DEVICE_CLASS (klass); sdc->init = pl022_init; + dc->reset = pl022_reset; }static const TypeInfo pl022_info = {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 35/52] hw/ssi/pl022: Don't directly call vmstate_register()
In reply to Peter MaydellUse the DeviceState vmsd pointer rather than calling vmstate_register() directly.
Message-id: [email protected]
--- hw/ssi/pl022.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ssi/pl022.c +1 -1
@@ -279,7 +279,6 @@ static int pl022_init(SysBusDevice *sbd)sysbus_init_mmio (sbd, &s->iomem);sysbus_init_irq (sbd, &s->irq); s->ssi =ssi_create_bus (dev,"ssi" ); -vmstate_register (dev,-1 , &vmstate_pl022, s);return 0 ; }
@@ -290,6 +289,7 @@ static void pl022_class_init(ObjectClass *klass, void *data) sdc->init = pl022_init; dc->reset = pl022_reset; + dc->vmsd = &vmstate_pl022; }static const TypeInfo pl022_info = {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 36/52] hw/ssi/pl022: Use DeviceState::realize rather than SysBusDevice::init
In reply to Peter MaydellMove from the legacy SysBusDevice::init method to using DeviceState::realize.
Message-id: [email protected]
--- hw/ssi/pl022.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
hw/ssi/pl022.c +3 -5
@@ -270,26 +270,24 @@ static const VMStateDescription vmstate_pl022 = { } }; -static int pl022_init (SysBusDevice *sbd) +static void pl022_realize (DeviceState *dev,Error **errp) { -DeviceState *dev =DEVICE (sbd); +SysBusDevice *sbd =SYS_BUS_DEVICE (dev);PL022State *s =PL022 (dev);memory_region_init_io (&s->iomem,OBJECT (s), &pl022_ops, s,"pl022" ,0x1000 );sysbus_init_mmio (sbd, &s->iomem);sysbus_init_irq (sbd, &s->irq); s->ssi =ssi_create_bus (dev,"ssi" ); -return 0 ; }static void pl022_class_init (ObjectClass *klass,void *data) { -SysBusDeviceClass *sdc =SYS_BUS_DEVICE_CLASS (klass);DeviceClass *dc =DEVICE_CLASS (klass); - sdc->init = pl022_init; dc->reset = pl022_reset; dc->vmsd = &vmstate_pl022; + dc->realize = pl022_realize; }static const TypeInfo pl022_info = {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 40/52] hw/arm/mps2-tz: Fix MPS2 SCC config register values
In reply to Peter MaydellSome of the config register values we were setting for the MPS2 SCC weren't correct:
* the SCC_AID bits [23:20] specify the FPGA build target board revision, and the SCC_CFG4 register specifies the actual board revision, so these should have matching values. Claim to be board revision C, consistently -- we had the revision in the wrong part of SCC_AID.
* SCC_ID bits [15:4] should be 0x505, not decimal 505
Message-id: [email protected]
--- hw/arm/mps2-tz.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/mps2-tz.c +2 -2
@@ -192,7 +192,7 @@ static MemoryRegion *make_scc(MPS2TZMachineState *mms, void *opaque, sccdev =DEVICE (scc);qdev_set_parent_bus (sccdev,sysbus_get_default ());qdev_prop_set_uint32 (sccdev,"scc-cfg4" ,0x2 ); -qdev_prop_set_uint32 (sccdev,"scc-aid" ,0x02000008 ); +qdev_prop_set_uint32 (sccdev,"scc-aid" ,0x00200008 );qdev_prop_set_uint32 (sccdev,"scc-id" , mmc->scc_id);object_property_set_bool (OBJECT (scc), true,"realized" , &error_fatal);return sysbus_mmio_get_region (SYS_BUS_DEVICE (sccdev),0 );
@@ -604,7 +604,7 @@ static void mps2tz_an505_class_init(ObjectClass *oc, void *data) mc->desc ="ARM MPS2 with AN505 FPGA image for Cortex-M33" ; mmc->fpga_type =FPGA_AN505 ; mc->default_cpu_type =ARM_CPU_TYPE_NAME ("cortex-m33" ); - mmc->scc_id =0x41040000 | (505 <<4 ); + mmc->scc_id =0x41045050 ; }static const TypeInfo mps2tz_info = {
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 41/52] target/arm: Untabify translate.c
In reply to Peter MaydellUntabify the arm translate.c. This affects only some lines, mostly comments, in the iwMMXt code. We've never touched that code in years, so it's not going to get fixed up by our "change when touched" process, and a bulk change is not going to be too disruptive.
This commit was produced using Emacs "untabify"; it is a whitespace-only change.
Message-id: [email protected]
--- target/arm/translate.c | 122 ++++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 61 deletions(-)
target/arm/translate.c +61 -61
@@ -1627,7 +1627,7 @@ static inline void gen_mov_vreg_F0(int dp, int reg)tcg_gen_st_f32 (cpu_F0s, cpu_env,vfp_reg_offset (dp, reg)); } -#define ARM_CP_RW_BIT (1 << 20) +#define ARM_CP_RW_BIT (1 << 20)static inline void iwmmxt_load_reg (TCGv_i64 var,int reg) {
@@ -1861,12 +1861,12 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) wrd = insn &0xf ; rdlo = (insn >>12 ) &0xf ; rdhi = (insn >>16 ) &0xf ; -if (insn &ARM_CP_RW_BIT ) {/* TMRRC */ +if (insn &ARM_CP_RW_BIT ) {/* TMRRC */ iwmmxt_load_reg (cpu_V0, wrd);tcg_gen_extrl_i64_i32 (cpu_R[rdlo], cpu_V0);tcg_gen_shri_i64 (cpu_V0, cpu_V0,32 );tcg_gen_extrl_i64_i32 (cpu_R[rdhi], cpu_V0); - }else {/* TMCRR */ + }else {/* TMCRR */ tcg_gen_concat_i32_i64 (cpu_V0, cpu_R[rdlo], cpu_R[rdhi]);iwmmxt_store_reg (cpu_V0, wrd);gen_op_iwmmxt_set_mup ();
@@ -1881,25 +1881,25 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)return 1 ; }if (insn &ARM_CP_RW_BIT ) { -if ((insn >>28 ) ==0xf ) {/* WLDRW wCx */ +if ((insn >>28 ) ==0xf ) {/* WLDRW wCx */ tmp =tcg_temp_new_i32 ();gen_aa32_ld32u (s, tmp, addr,get_mem_index (s));iwmmxt_store_creg (wrd, tmp); }else { i =1 ;if (insn & (1 <<8 )) { -if (insn & (1 <<22 )) {/* WLDRD */ +if (insn & (1 <<22 )) {/* WLDRD */ gen_aa32_ld64 (s, cpu_M0, addr,get_mem_index (s)); i =0 ; - }else {/* WLDRW wRd */ + }else {/* WLDRW wRd */ tmp =tcg_temp_new_i32 ();gen_aa32_ld32u (s, tmp, addr,get_mem_index (s)); } }else { tmp =tcg_temp_new_i32 (); -if (insn & (1 <<22 )) {/* WLDRH */ +if (insn & (1 <<22 )) {/* WLDRH */ gen_aa32_ld16u (s, tmp, addr,get_mem_index (s)); - }else {/* WLDRB */ + }else {/* WLDRB */ gen_aa32_ld8u (s, tmp, addr,get_mem_index (s)); } }
@@ -1910,24 +1910,24 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd); } }else { -if ((insn >>28 ) ==0xf ) {/* WSTRW wCx */ +if ((insn >>28 ) ==0xf ) {/* WSTRW wCx */ tmp =iwmmxt_load_creg (wrd);gen_aa32_st32 (s, tmp, addr,get_mem_index (s)); }else {gen_op_iwmmxt_movq_M0_wRn (wrd); tmp =tcg_temp_new_i32 ();if (insn & (1 <<8 )) { -if (insn & (1 <<22 )) {/* WSTRD */ +if (insn & (1 <<22 )) {/* WSTRD */ gen_aa32_st64 (s, cpu_M0, addr,get_mem_index (s)); - }else {/* WSTRW wRd */ + }else {/* WSTRW wRd */ tcg_gen_extrl_i64_i32 (tmp, cpu_M0);gen_aa32_st32 (s, tmp, addr,get_mem_index (s)); } }else { -if (insn & (1 <<22 )) {/* WSTRH */ +if (insn & (1 <<22 )) {/* WSTRH */ tcg_gen_extrl_i64_i32 (tmp, cpu_M0);gen_aa32_st16 (s, tmp, addr,get_mem_index (s)); - }else {/* WSTRB */ + }else {/* WSTRB */ tcg_gen_extrl_i64_i32 (tmp, cpu_M0);gen_aa32_st8 (s, tmp, addr,get_mem_index (s)); }
@@ -1943,7 +1943,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)return 1 ;switch (((insn >>12 ) &0xf00 ) | ((insn >>4 ) &0xff )) { -case 0x000 :/* WOR */ +case 0x000 :/* WOR */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>0 ) &0xf ; rd1 = (insn >>16 ) &0xf ;
@@ -1954,7 +1954,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x011 :/* TMCR */ +case 0x011 :/* TMCR */ if (insn &0xf )return 1 ; rd = (insn >>12 ) &0xf ;
@@ -1985,7 +1985,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)return 1 ; }break ; -case 0x100 :/* WXOR */ +case 0x100 :/* WXOR */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>0 ) &0xf ; rd1 = (insn >>16 ) &0xf ;
@@ -1996,7 +1996,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x111 :/* TMRC */ +case 0x111 :/* TMRC */ if (insn &0xf )return 1 ; rd = (insn >>12 ) &0xf ;
@@ -2004,7 +2004,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) tmp =iwmmxt_load_creg (wrd);store_reg (s, rd, tmp);break ; -case 0x300 :/* WANDN */ +case 0x300 :/* WANDN */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>0 ) &0xf ; rd1 = (insn >>16 ) &0xf ;
@@ -2016,7 +2016,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x200 :/* WAND */ +case 0x200 :/* WAND */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>0 ) &0xf ; rd1 = (insn >>16 ) &0xf ;
@@ -2027,7 +2027,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x810 :case 0xa10 :/* WMADD */ +case 0x810 :case 0xa10 :/* WMADD */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>0 ) &0xf ; rd1 = (insn >>16 ) &0xf ;
@@ -2039,7 +2039,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ; -case 0x10e :case 0x50e :case 0x90e :case 0xd0e :/* WUNPCKIL */ +case 0x10e :case 0x50e :case 0x90e :case 0xd0e :/* WUNPCKIL */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ; rd1 = (insn >>0 ) &0xf ;
@@ -2061,7 +2061,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x10c :case 0x50c :case 0x90c :case 0xd0c :/* WUNPCKIH */ +case 0x10c :case 0x50c :case 0x90c :case 0xd0c :/* WUNPCKIH */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ; rd1 = (insn >>0 ) &0xf ;
@@ -2083,7 +2083,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x012 :case 0x112 :case 0x412 :case 0x512 :/* WSAD */ +case 0x012 :case 0x112 :case 0x412 :case 0x512 :/* WSAD */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ; rd1 = (insn >>0 ) &0xf ;
@@ -2097,7 +2097,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ; -case 0x010 :case 0x110 :case 0x210 :case 0x310 :/* WMUL */ +case 0x010 :case 0x110 :case 0x210 :case 0x310 :/* WMUL */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ; rd1 = (insn >>0 ) &0xf ;
@@ -2116,7 +2116,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ; -case 0x410 :case 0x510 :case 0x610 :case 0x710 :/* WMAC */ +case 0x410 :case 0x510 :case 0x610 :case 0x710 :/* WMAC */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ; rd1 = (insn >>0 ) &0xf ;
@@ -2132,7 +2132,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ; -case 0x006 :case 0x406 :case 0x806 :case 0xc06 :/* WCMPEQ */ +case 0x006 :case 0x406 :case 0x806 :case 0xc06 :/* WCMPEQ */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ; rd1 = (insn >>0 ) &0xf ;
@@ -2154,7 +2154,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x800 :case 0x900 :case 0xc00 :case 0xd00 :/* WAVG2 */ +case 0x800 :case 0x900 :case 0xc00 :case 0xd00 :/* WAVG2 */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ; rd1 = (insn >>0 ) &0xf ;
@@ -2174,7 +2174,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x802 :case 0x902 :case 0xa02 :case 0xb02 :/* WALIGNR */ +case 0x802 :case 0x902 :case 0xa02 :case 0xb02 :/* WALIGNR */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ; rd1 = (insn >>0 ) &0xf ;
@@ -2187,7 +2187,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ; -case 0x601 :case 0x605 :case 0x609 :case 0x60d :/* TINSR */ +case 0x601 :case 0x605 :case 0x609 :case 0x60d :/* TINSR */ if (((insn >>6 ) &3 ) ==3 )return 1 ; rd = (insn >>12 ) &0xf ;
@@ -2218,7 +2218,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ; -case 0x107 :case 0x507 :case 0x907 :case 0xd07 :/* TEXTRM */ +case 0x107 :case 0x507 :case 0x907 :case 0xd07 :/* TEXTRM */ rd = (insn >>12 ) &0xf ; wrd = (insn >>16 ) &0xf ;if (rd ==15 || ((insn >>22 ) &3 ) ==3 )
@@ -2251,7 +2251,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) }store_reg (s, rd, tmp);break ; -case 0x117 :case 0x517 :case 0x917 :case 0xd17 :/* TEXTRC */ +case 0x117 :case 0x517 :case 0x917 :case 0xd17 :/* TEXTRC */ if ((insn &0x000ff008 ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 )return 1 ; tmp =iwmmxt_load_creg (ARM_IWMMXT_wCASF);
@@ -2270,7 +2270,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_set_nzcv (tmp);tcg_temp_free_i32 (tmp);break ; -case 0x401 :case 0x405 :case 0x409 :case 0x40d :/* TBCST */ +case 0x401 :case 0x405 :case 0x409 :case 0x40d :/* TBCST */ if (((insn >>6 ) &3 ) ==3 )return 1 ; rd = (insn >>12 ) &0xf ;
@@ -2291,7 +2291,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ; -case 0x113 :case 0x513 :case 0x913 :case 0xd13 :/* TANDC */ +case 0x113 :case 0x513 :case 0x913 :case 0xd13 :/* TANDC */ if ((insn &0x000ff00f ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 )return 1 ; tmp =iwmmxt_load_creg (ARM_IWMMXT_wCASF);
@@ -2319,7 +2319,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)tcg_temp_free_i32 (tmp2);tcg_temp_free_i32 (tmp);break ; -case 0x01c :case 0x41c :case 0x81c :case 0xc1c :/* WACC */ +case 0x01c :case 0x41c :case 0x81c :case 0xc1c :/* WACC */ wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;gen_op_iwmmxt_movq_M0_wRn (rd0);
@@ -2339,7 +2339,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ; -case 0x115 :case 0x515 :case 0x915 :case 0xd15 :/* TORC */ +case 0x115 :case 0x515 :case 0x915 :case 0xd15 :/* TORC */ if ((insn &0x000ff00f ) !=0x0003f000 || ((insn >>22 ) &3 ) ==3 )return 1 ; tmp =iwmmxt_load_creg (ARM_IWMMXT_wCASF);
@@ -2367,7 +2367,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)tcg_temp_free_i32 (tmp2);tcg_temp_free_i32 (tmp);break ; -case 0x103 :case 0x503 :case 0x903 :case 0xd03 :/* TMOVMSK */ +case 0x103 :case 0x503 :case 0x903 :case 0xd03 :/* TMOVMSK */ rd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;if ((insn &0xf ) !=0 || ((insn >>22 ) &3 ) ==3 )
@@ -2387,7 +2387,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) }store_reg (s, rd, tmp);break ; -case 0x106 :case 0x306 :case 0x506 :case 0x706 :/* WCMPGT */ +case 0x106 :case 0x306 :case 0x506 :case 0x706 :/* WCMPGT */ case 0x906 :case 0xb06 :case 0xd06 :case 0xf06 : wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;
@@ -2419,7 +2419,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x00e :case 0x20e :case 0x40e :case 0x60e :/* WUNPCKEL */ +case 0x00e :case 0x20e :case 0x40e :case 0x60e :/* WUNPCKEL */ case 0x80e :case 0xa0e :case 0xc0e :case 0xe0e : wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;
@@ -2450,7 +2450,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x00c :case 0x20c :case 0x40c :case 0x60c :/* WUNPCKEH */ +case 0x00c :case 0x20c :case 0x40c :case 0x60c :/* WUNPCKEH */ case 0x80c :case 0xa0c :case 0xc0c :case 0xe0c : wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;
@@ -2481,7 +2481,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x204 :case 0x604 :case 0xa04 :case 0xe04 :/* WSRL */ +case 0x204 :case 0x604 :case 0xa04 :case 0xe04 :/* WSRL */ case 0x214 :case 0x614 :case 0xa14 :case 0xe14 :if (((insn >>22 ) &3 ) ==0 )return 1 ;
@@ -2509,7 +2509,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x004 :case 0x404 :case 0x804 :case 0xc04 :/* WSRA */ +case 0x004 :case 0x404 :case 0x804 :case 0xc04 :/* WSRA */ case 0x014 :case 0x414 :case 0x814 :case 0xc14 :if (((insn >>22 ) &3 ) ==0 )return 1 ;
@@ -2537,7 +2537,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x104 :case 0x504 :case 0x904 :case 0xd04 :/* WSLL */ +case 0x104 :case 0x504 :case 0x904 :case 0xd04 :/* WSLL */ case 0x114 :case 0x514 :case 0x914 :case 0xd14 :if (((insn >>22 ) &3 ) ==0 )return 1 ;
@@ -2565,7 +2565,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x304 :case 0x704 :case 0xb04 :case 0xf04 :/* WROR */ +case 0x304 :case 0x704 :case 0xb04 :case 0xf04 :/* WROR */ case 0x314 :case 0x714 :case 0xb14 :case 0xf14 :if (((insn >>22 ) &3 ) ==0 )return 1 ;
@@ -2601,7 +2601,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x116 :case 0x316 :case 0x516 :case 0x716 :/* WMIN */ +case 0x116 :case 0x316 :case 0x516 :case 0x716 :/* WMIN */ case 0x916 :case 0xb16 :case 0xd16 :case 0xf16 : wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;
@@ -2632,7 +2632,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ; -case 0x016 :case 0x216 :case 0x416 :case 0x616 :/* WMAX */ +case 0x016 :case 0x216 :case 0x416 :case 0x616 :/* WMAX */ case 0x816 :case 0xa16 :case 0xc16 :case 0xe16 : wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;
@@ -2663,7 +2663,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ; -case 0x002 :case 0x102 :case 0x202 :case 0x302 :/* WALIGNI */ +case 0x002 :case 0x102 :case 0x202 :case 0x302 :/* WALIGNI */ case 0x402 :case 0x502 :case 0x602 :case 0x702 : wrd = (insn >>12 ) &0xf ; rd0 = (insn >>16 ) &0xf ;
@@ -2676,7 +2676,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_movq_wRn_M0 (wrd);gen_op_iwmmxt_set_mup ();break ; -case 0x01a :case 0x11a :case 0x21a :case 0x31a :/* WSUB */ +case 0x01a :case 0x11a :case 0x21a :case 0x31a :/* WSUB */ case 0x41a :case 0x51a :case 0x61a :case 0x71a :case 0x81a :case 0x91a :case 0xa1a :case 0xb1a :case 0xc1a :case 0xd1a :case 0xe1a :case 0xf1a :
@@ -2719,7 +2719,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x01e :case 0x11e :case 0x21e :case 0x31e :/* WSHUFH */ +case 0x01e :case 0x11e :case 0x21e :case 0x31e :/* WSHUFH */ case 0x41e :case 0x51e :case 0x61e :case 0x71e :case 0x81e :case 0x91e :case 0xa1e :case 0xb1e :case 0xc1e :case 0xd1e :case 0xe1e :case 0xf1e :
@@ -2733,7 +2733,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x018 :case 0x118 :case 0x218 :case 0x318 :/* WADD */ +case 0x018 :case 0x118 :case 0x218 :case 0x318 :/* WADD */ case 0x418 :case 0x518 :case 0x618 :case 0x718 :case 0x818 :case 0x918 :case 0xa18 :case 0xb18 :case 0xc18 :case 0xd18 :case 0xe18 :case 0xf18 :
@@ -2776,7 +2776,7 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn)gen_op_iwmmxt_set_mup ();gen_op_iwmmxt_set_cup ();break ; -case 0x008 :case 0x108 :case 0x208 :case 0x308 :/* WPACK */ +case 0x008 :case 0x108 :case 0x208 :case 0x308 :/* WPACK */ case 0x408 :case 0x508 :case 0x608 :case 0x708 :case 0x808 :case 0x908 :case 0xa08 :case 0xb08 :case 0xc08 :case 0xd08 :case 0xe08 :case 0xf08 :
@@ -2823,13 +2823,13 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) tmp =load_reg (s, rd0); tmp2 =load_reg (s, rd1);switch ((insn >>16 ) &0xf ) { -case 0x0 :/* TMIA */ +case 0x0 :/* TMIA */ gen_helper_iwmmxt_muladdsl (cpu_M0, cpu_M0, tmp, tmp2);break ; -case 0x8 :/* TMIAPH */ +case 0x8 :/* TMIAPH */ gen_helper_iwmmxt_muladdsw (cpu_M0, cpu_M0, tmp, tmp2);break ; -case 0xc :case 0xd :case 0xe :case 0xf :/* TMIAxy */ +case 0xc :case 0xd :case 0xe :case 0xf :/* TMIAxy */ if (insn & (1 <<16 ))tcg_gen_shri_i32 (tmp, tmp,16 );if (insn & (1 <<17 ))
@@ -2872,16 +2872,16 @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn) tmp =load_reg (s, rd0); tmp2 =load_reg (s, rd1);switch ((insn >>16 ) &0xf ) { -case 0x0 :/* MIA */ +case 0x0 :/* MIA */ gen_helper_iwmmxt_muladdsl (cpu_M0, cpu_M0, tmp, tmp2);break ; -case 0x8 :/* MIAPH */ +case 0x8 :/* MIAPH */ gen_helper_iwmmxt_muladdsw (cpu_M0, cpu_M0, tmp, tmp2);break ; -case 0xc :/* MIABB */ -case 0xd :/* MIABT */ -case 0xe :/* MIATB */ -case 0xf :/* MIATT */ +case 0xc :/* MIABB */ +case 0xd :/* MIABT */ +case 0xe :/* MIATB */ +case 0xf :/* MIATT */ if (insn & (1 <<16 ))tcg_gen_shri_i32 (tmp, tmp,16 );if (insn & (1 <<17 ))
@@ -2907,13 +2907,13 @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn)if (acc !=0 )return 1 ; -if (insn &ARM_CP_RW_BIT ) {/* MRA */ +if (insn &ARM_CP_RW_BIT ) {/* MRA */ iwmmxt_load_reg (cpu_V0, acc);tcg_gen_extrl_i64_i32 (cpu_R[rdlo], cpu_V0);tcg_gen_shri_i64 (cpu_V0, cpu_V0,32 );tcg_gen_extrl_i64_i32 (cpu_R[rdhi], cpu_V0);tcg_gen_andi_i32 (cpu_R[rdhi], cpu_R[rdhi], (1 << (40 -32 )) -1 ); - }else {/* MAR */ + }else {/* MAR */ tcg_gen_concat_i32_i64 (cpu_V0, cpu_R[rdlo], cpu_R[rdhi]);iwmmxt_store_reg (cpu_V0, acc); }
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 44/52] hw/misc/bcm2835_fb: Move config fields to their own struct
In reply to Peter MaydellThe handling of framebuffer properties in the bcm2835_property code is a bit clumsy, because for each of the many fb related properties we try to track the value we're about to set and whether we're going to be setting a value, and then we hand all the new values off to the framebuffer via a function which takes them all as separate arguments. It would be simpler if the property code could easily copy all the framebuffer's current settings, update them with the new specified values and then ask the framebuffer to switch to the new set.
As the first part of this refactoring, pull all the fb config settings fields in BCM2835FBState out into their own struct.
Message-id: [email protected]
--- include/hw/display/bcm2835_fb.h | 26 ++++++-- hw/display/bcm2835_fb.c | 114 +++++++++++++++++--------------- hw/misc/bcm2835_property.c | 28 ++++---- 3 files changed, 94 insertions(+), 74 deletions(-)
include/hw/display/bcm2835_fb.h +20 -6
@@ -17,6 +17,20 @@#define TYPE_BCM2835_FB "bcm2835-fb"#define BCM2835_FB (obj) OBJECT_CHECK(BCM2835FBState, (obj), TYPE_BCM2835_FB) +/* +* Configuration information about the fb which the guest can program +* via the mailbox property interface. +*/ +typedef struct { +uint32_t xres, yres; +uint32_t xres_virtual, yres_virtual; +uint32_t xoffset, yoffset; +uint32_t bpp; +uint32_t base; +uint32_t pixo; +uint32_t alpha; +}BCM2835FBConfig ; + typedef struct { /*< private >*/ SysBusDevice busdev;
@@ -31,12 +45,12 @@ typedef struct {qemu_irq mbox_irq;bool lock, invalidate, pending; -uint32_t xres, yres; -uint32_t xres_virtual, yres_virtual; -uint32_t xoffset, yoffset; -uint32_t bpp; -uint32_t base, pitch, size; -uint32_t pixo, alpha; + +BCM2835FBConfig config; + +/* These are just cached values calculated from the config settings */ +uint32_t size; +uint32_t pitch; } BCM2835FBState; void bcm2835_fb_reconfigure(BCM2835FBState *s, uint32_t *xres, uint32_t *yres,
hw/display/bcm2835_fb.c +59 -55
212 lines not on this page · raw message
hw/misc/bcm2835_property.c +15 -13
@@ -141,10 +141,10 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)/* Frame buffer */ case 0x00040001 :/* Allocate buffer */ -stl_le_phys (&s->dma_as, value +12 , s->fbdev->base); - tmp_xres = newxres !=NULL ? *newxres : s->fbdev->xres; - tmp_yres = newyres !=NULL ? *newyres : s->fbdev->yres; - tmp_bpp = newbpp !=NULL ? *newbpp : s->fbdev->bpp; +stl_le_phys (&s->dma_as, value +12 , s->fbdev->config.base); + tmp_xres = newxres !=NULL ? *newxres : s->fbdev->config.xres; + tmp_yres = newyres !=NULL ? *newyres : s->fbdev->config.yres; + tmp_bpp = newbpp !=NULL ? *newbpp : s->fbdev->config.bpp;stl_le_phys (&s->dma_as, value +16 , tmp_xres * tmp_yres * tmp_bpp /8 ); resplen =8 ;
@@ -157,8 +157,8 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)break ;case 0x00040003 :/* Get display width/height */ case 0x00040004 : - tmp_xres = newxres !=NULL ? *newxres : s->fbdev->xres; - tmp_yres = newyres !=NULL ? *newyres : s->fbdev->yres; + tmp_xres = newxres !=NULL ? *newxres : s->fbdev->config.xres; + tmp_yres = newyres !=NULL ? *newyres : s->fbdev->config.yres;stl_le_phys (&s->dma_as, value +12 , tmp_xres);stl_le_phys (&s->dma_as, value +16 , tmp_yres); resplen =8 ;
@@ -176,7 +176,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) resplen =8 ;break ;case 0x00040005 :/* Get depth */ - tmp_bpp = newbpp !=NULL ? *newbpp : s->fbdev->bpp; + tmp_bpp = newbpp !=NULL ? *newbpp : s->fbdev->config.bpp;stl_le_phys (&s->dma_as, value +12 , tmp_bpp); resplen =4 ;break ;
@@ -189,7 +189,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) resplen =4 ;break ;case 0x00040006 :/* Get pixel order */ - tmp_pixo = newpixo !=NULL ? *newpixo : s->fbdev->pixo; + tmp_pixo = newpixo !=NULL ? *newpixo : s->fbdev->config.pixo;stl_le_phys (&s->dma_as, value +12 , tmp_pixo); resplen =4 ;break ;
@@ -202,7 +202,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) resplen =4 ;break ;case 0x00040007 :/* Get alpha */ - tmp_alpha = newalpha !=NULL ? *newalpha : s->fbdev->alpha; + tmp_alpha = newalpha !=NULL ? *newalpha : s->fbdev->config.alpha;stl_le_phys (&s->dma_as, value +12 , tmp_alpha); resplen =4 ;break ;
@@ -215,14 +215,16 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) resplen =4 ;break ;case 0x00040008 :/* Get pitch */ - tmp_xres = newxres !=NULL ? *newxres : s->fbdev->xres; - tmp_bpp = newbpp !=NULL ? *newbpp : s->fbdev->bpp; + tmp_xres = newxres !=NULL ? *newxres : s->fbdev->config.xres; + tmp_bpp = newbpp !=NULL ? *newbpp : s->fbdev->config.bpp;stl_le_phys (&s->dma_as, value +12 , tmp_xres * tmp_bpp /8 ); resplen =4 ;break ;case 0x00040009 :/* Get virtual offset */ - tmp_xoffset = newxoffset !=NULL ? *newxoffset : s->fbdev->xoffset; - tmp_yoffset = newyoffset !=NULL ? *newyoffset : s->fbdev->yoffset; + tmp_xoffset = newxoffset !=NULL ? + *newxoffset : s->fbdev->config.xoffset; + tmp_yoffset = newyoffset !=NULL ? + *newyoffset : s->fbdev->config.yoffset;stl_le_phys (&s->dma_as, value +12 , tmp_xoffset);stl_le_phys (&s->dma_as, value +16 , tmp_yoffset); resplen =8 ;
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 45/52] hw/misc/bcm2835_property: Track fb settings using BCM2835FBConfig
In reply to Peter MaydellRefactor the fb property setting code so that rather than using a set of pointers to local variables to track whether a config value has been updated in the current mbox and if so what its new value is, we just copy all the current settings of the fb at the start, and then update that copy as we go along, before asking the fb to switch to it at the end.
Message-id: [email protected]
--- include/hw/display/bcm2835_fb.h | 4 +- hw/display/bcm2835_fb.c | 27 ++--------- hw/misc/bcm2835_property.c | 80 ++++++++++++++------------------- 3 files changed, 37 insertions(+), 74 deletions(-)
include/hw/display/bcm2835_fb.h +1 -3
@@ -53,8 +53,6 @@ typedef struct { uint32_t pitch; } BCM2835FBState; -void bcm2835_fb_reconfigure (BCM2835FBState *s,uint32_t *xres,uint32_t *yres, -uint32_t *xoffset,uint32_t *yoffset,uint32_t *bpp, -uint32_t *pixo,uint32_t *alpha); +void bcm2835_fb_reconfigure (BCM2835FBState *s,BCM2835FBConfig *newconfig);#endif
hw/display/bcm2835_fb.c +3 -24
@@ -213,34 +213,13 @@ static void bcm2835_fb_mbox_push(BCM2835FBState *s, uint32_t value) s->lock = false; } -void bcm2835_fb_reconfigure (BCM2835FBState *s,uint32_t *xres,uint32_t *yres, -uint32_t *xoffset,uint32_t *yoffset,uint32_t *bpp, -uint32_t *pixo,uint32_t *alpha) +void bcm2835_fb_reconfigure (BCM2835FBState *s,BCM2835FBConfig *newconfig) { s->lock = true;/* TODO: input validation! */ -if (xres) { - s->config.xres = *xres; - } -if (yres) { - s->config.yres = *yres; - } -if (xoffset) { - s->config.xoffset = *xoffset; - } -if (yoffset) { - s->config.yoffset = *yoffset; - } -if (bpp) { - s->config.bpp = *bpp; - } -if (pixo) { - s->config.pixo = *pixo; - } -if (alpha) { - s->config.alpha = *alpha; - } + + s->config = *newconfig;/* TODO - Manage properly virtual resolution */
hw/misc/bcm2835_property.c +33 -47
150 lines not on this page · raw message
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 46/52] hw/display/bcm2835_fb: Drop unused size and pitch fields
In reply to Peter MaydellThe BCM2835FBState struct has a 'pitch' field which is a cached copy of xres * (bpp >> 3), and a 'size' field which is a cached copy of pitch * yres. However we don't actually do anything with these fields; delete them. We retain the now-unused slots in the VMState struct for migration compatibility.
Message-id: [email protected]
--- include/hw/display/bcm2835_fb.h | 4 ---- hw/display/bcm2835_fb.c | 19 ++++++++----------- 2 files changed, 8 insertions(+), 15 deletions(-)
include/hw/display/bcm2835_fb.h +0 -4
@@ -47,10 +47,6 @@ typedef struct {bool lock, invalidate, pending;BCM2835FBConfig config; - -/* These are just cached values calculated from the config settings */ -uint32_t size; -uint32_t pitch; } BCM2835FBState;void bcm2835_fb_reconfigure (BCM2835FBState *s,BCM2835FBConfig *newconfig);
hw/display/bcm2835_fb.c +8 -11
@@ -184,6 +184,9 @@ static void fb_update_display(void *opaque)static void bcm2835_fb_mbox_push (BCM2835FBState *s,uint32_t value) { +uint32_t pitch; +uint32_t size; + value &= ~0xf ; s->lock = true;
@@ -201,12 +204,12 @@ static void bcm2835_fb_mbox_push(BCM2835FBState *s, uint32_t value)/* TODO - Manage properly virtual resolution */ - s->pitch = s->config.xres * (s->config.bpp >>3 ); - s->size = s->config.yres * s->pitch; + pitch = s->config.xres * (s->config.bpp >>3 ); + size = s->config.yres * pitch; -stl_le_phys (&s->dma_as, value +16 , s->pitch); +stl_le_phys (&s->dma_as, value +16 , pitch);stl_le_phys (&s->dma_as, value +32 , s->config.base); -stl_le_phys (&s->dma_as, value +36 , s->size); +stl_le_phys (&s->dma_as, value +36 , size); s->invalidate = true;qemu_console_resize (s->con, s->config.xres, s->config.yres);
@@ -223,9 +226,6 @@ void bcm2835_fb_reconfigure(BCM2835FBState *s, BCM2835FBConfig *newconfig)/* TODO - Manage properly virtual resolution */ - s->pitch = s->config.xres * (s->config.bpp >>3 ); - s->size = s->config.yres * s->pitch; - s->invalidate = true;qemu_console_resize (s->con, s->config.xres, s->config.yres); s->lock = false;
@@ -301,8 +301,7 @@ static const VMStateDescription vmstate_bcm2835_fb = {VMSTATE_UINT32 (config.yoffset, BCM2835FBState),VMSTATE_UINT32 (config.bpp, BCM2835FBState),VMSTATE_UINT32 (config.base, BCM2835FBState), -VMSTATE_UINT32 (pitch, BCM2835FBState), -VMSTATE_UINT32 (size, BCM2835FBState), +VMSTATE_UNUSED (8 ),/* Was pitch and size */ VMSTATE_UINT32 (config.pixo, BCM2835FBState),VMSTATE_UINT32 (config.alpha, BCM2835FBState),VMSTATE_END_OF_LIST ()
@@ -335,8 +334,6 @@ static void bcm2835_fb_reset(DeviceState *dev) s->config.xoffset =0 ; s->config.yoffset =0 ; s->config.base = s->vcram_base +BCM2835_FB_OFFSET ; - s->pitch = s->config.xres * (s->config.bpp >>3 ); - s->size = s->config.yres * s->pitch; s->invalidate = true; s->lock = false;
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 47/52] hw/display/bcm2835_fb: Reset resolution, etc correctly
In reply to Peter MaydellThe bcm2835_fb's initial resolution and other parameters are set via QOM properties. We should reset to those initial values on device reset, which means we need to save the QOM property values somewhere that they are not overwritten by guest changes to the framebuffer configuration.
Message-id: [email protected]
--- include/hw/display/bcm2835_fb.h | 1 + hw/display/bcm2835_fb.c | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-)
include/hw/display/bcm2835_fb.h +1 -0
@@ -47,6 +47,7 @@ typedef struct {bool lock, invalidate, pending;BCM2835FBConfig config; +BCM2835FBConfig initial_config; } BCM2835FBState;void bcm2835_fb_reconfigure (BCM2835FBState *s,BCM2835FBConfig *newconfig);
hw/display/bcm2835_fb.c +15 -12
@@ -329,11 +329,7 @@ static void bcm2835_fb_reset(DeviceState *dev) s->pending = false; - s->config.xres_virtual = s->config.xres; - s->config.yres_virtual = s->config.yres; - s->config.xoffset =0 ; - s->config.yoffset =0 ; - s->config.base = s->vcram_base +BCM2835_FB_OFFSET ; + s->config = s->initial_config; s->invalidate = true; s->lock = false;
@@ -357,6 +353,13 @@ static void bcm2835_fb_realize(DeviceState *dev, Error **errp)return ; } +/* Fill in the parts of initial_config that are not set by QOM properties */ + s->initial_config.xres_virtual = s->initial_config.xres; + s->initial_config.yres_virtual = s->initial_config.yres; + s->initial_config.xoffset =0 ; + s->initial_config.yoffset =0 ; + s->initial_config.base = s->vcram_base +BCM2835_FB_OFFSET ; + s->dma_mr =MEMORY_REGION (obj);address_space_init (&s->dma_as, s->dma_mr,NULL );
@@ -370,13 +373,13 @@ static Property bcm2835_fb_props[] = {DEFINE_PROP_UINT32 ("vcram-base" , BCM2835FBState, vcram_base,0 ),/*required*/ DEFINE_PROP_UINT32 ("vcram-size" , BCM2835FBState, vcram_size,DEFAULT_VCRAM_SIZE ), -DEFINE_PROP_UINT32 ("xres" , BCM2835FBState, config.xres,640 ), -DEFINE_PROP_UINT32 ("yres" , BCM2835FBState, config.yres,480 ), -DEFINE_PROP_UINT32 ("bpp" , BCM2835FBState, config.bpp,16 ), -DEFINE_PROP_UINT32 ("pixo" , - BCM2835FBState, config.pixo,1 ),/* 1=RGB, 0=BGR */ -DEFINE_PROP_UINT32 ("alpha" , - BCM2835FBState, config.alpha,2 ),/* alpha ignored */ +DEFINE_PROP_UINT32 ("xres" , BCM2835FBState, initial_config.xres,640 ), +DEFINE_PROP_UINT32 ("yres" , BCM2835FBState, initial_config.yres,480 ), +DEFINE_PROP_UINT32 ("bpp" , BCM2835FBState, initial_config.bpp,16 ), +DEFINE_PROP_UINT32 ("pixo" , BCM2835FBState, + initial_config.pixo,1 ),/* 1=RGB, 0=BGR */ +DEFINE_PROP_UINT32 ("alpha" , BCM2835FBState, + initial_config.alpha,2 ),/* alpha ignored */ DEFINE_PROP_END_OF_LIST() };
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 48/52] hw/display/bcm2835_fb: Abstract out calculation of pitch, size
In reply to Peter MaydellAbstract out the calculation of the pitch and size of the framebuffer into functions that operate on the BCM2835FBConfig struct -- these are about to get a little more complicated when we add support for virtual and physical sizes differing.
Message-id: [email protected]
--- include/hw/display/bcm2835_fb.h | 22 ++++++++++++++++++++++ hw/display/bcm2835_fb.c | 6 +++--- hw/misc/bcm2835_property.c | 4 ++-- 3 files changed, 27 insertions(+), 5 deletions(-)
include/hw/display/bcm2835_fb.h +22 -0
@@ -52,4 +52,26 @@ typedef struct {void bcm2835_fb_reconfigure (BCM2835FBState *s,BCM2835FBConfig *newconfig); +/** +* bcm2835_fb_get_pitch: return number of bytes per line of the framebuffer +* @config: configuration info for the framebuffer +* +* Return the number of bytes per line of the framebuffer, ie the number +* that must be added to a pixel address to get the address of the pixel +* directly below it on screen. +*/ +static inline uint32_t bcm2835_fb_get_pitch (BCM2835FBConfig *config) +{ +return config->xres * (config->bpp >>3 ); +} + +/** +* bcm2835_fb_get_size: return total size of framebuffer in bytes +* @config: configuration info for the framebuffer +*/ +static inline uint32_t bcm2835_fb_get_size (BCM2835FBConfig *config) +{ +return config->yres *bcm2835_fb_get_pitch (config); +} +#endif
hw/display/bcm2835_fb.c +3 -3
@@ -139,7 +139,7 @@ static void fb_update_display(void *opaque)return ; } - src_width = s->config.xres * (s->config.bpp >>3 ); + src_width =bcm2835_fb_get_pitch (&s->config); dest_width = s->config.xres;switch (surface_bits_per_pixel (surface)) {
@@ -204,8 +204,8 @@ static void bcm2835_fb_mbox_push(BCM2835FBState *s, uint32_t value)/* TODO - Manage properly virtual resolution */ - pitch = s->config.xres * (s->config.bpp >>3 ); - size = s->config.yres * pitch; + pitch =bcm2835_fb_get_pitch (&s->config); + size =bcm2835_fb_get_size (&s->config);stl_le_phys (&s->dma_as, value +16 , pitch);stl_le_phys (&s->dma_as, value +32 , s->config.base);
hw/misc/bcm2835_property.c +2 -2
@@ -146,7 +146,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)case 0x00040001 :/* Allocate buffer */ stl_le_phys (&s->dma_as, value +12 , fbconfig.base);stl_le_phys (&s->dma_as, value +16 , - fbconfig.xres * fbconfig.yres * fbconfig.bpp /8 ); +bcm2835_fb_get_size (&fbconfig)); resplen =8 ;break ;case 0x00048001 :/* Release buffer */
@@ -210,7 +210,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)break ;case 0x00040008 :/* Get pitch */ stl_le_phys (&s->dma_as, value +12 , - fbconfig.xres * fbconfig.bpp /8 ); +bcm2835_fb_get_pitch (&fbconfig)); resplen =4 ;break ;case 0x00040009 :/* Get virtual offset */
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 49/52] hw/display/bcm2835_fb: Fix handling of virtual framebuffer
In reply to Peter MaydellThe raspi framebuffir in bcm2835_fb supports the definition of a virtual "viewport", which is smaller than the full physical framebuffer size and at an adjustable offset within it. Only the viewport area is sent to the screen. This allows the guest to do things like double buffering, or scrolling by adjusting the viewport origin. Currently QEMU doesn't implement this at all.
Add support for this feature:
* the property mailbox code needs to distinguish the virtual width/height from the physical width/height
* the framebuffer code needs to do something with the virtual width/height/origin information
Note that the wiki documentation on the semantics of the virtual and physical height and width has it the wrong way around -- the virtual size is the size of the allocated buffer, and the physical size is the size of the display, so the virtual size is always the same as or larger than the physical.
If the viewport size is set smaller than the physical screen size, we ignore the viewport settings completely and just display the physical screen area.
Message-id: [email protected]
--- include/hw/display/bcm2835_fb.h | 6 ++++-- hw/display/bcm2835_fb.c | 28 ++++++++++++++++++++++------ hw/misc/bcm2835_property.c | 21 +++++++++++++++------ 3 files changed, 41 insertions(+), 14 deletions(-)
include/hw/display/bcm2835_fb.h +4 -2
@@ -62,7 +62,8 @@ void bcm2835_fb_reconfigure(BCM2835FBState *s, BCM2835FBConfig *newconfig);*/ static inline uint32_t bcm2835_fb_get_pitch (BCM2835FBConfig *config) { -return config->xres * (config->bpp >>3 ); +uint32_t xres =MAX (config->xres, config->xres_virtual); +return xres * (config->bpp >>3 ); }/**
@@ -71,7 +72,8 @@ static inline uint32_t bcm2835_fb_get_pitch(BCM2835FBConfig *config)*/ static inline uint32_t bcm2835_fb_get_size (BCM2835FBConfig *config) { -return config->yres *bcm2835_fb_get_pitch (config); +uint32_t yres =MAX (config->yres, config->yres_virtual); +return yres *bcm2835_fb_get_pitch (config); }#endif
hw/display/bcm2835_fb.c +22 -6
@@ -126,6 +126,18 @@ static void draw_line_src16(void *opaque, uint8_t *dst, const uint8_t *src, } } +static bool fb_use_offsets (BCM2835FBConfig *config) +{ +/* +* Return true if we should use the viewport offsets. +* Experimentally, the hardware seems to do this only if the +* viewport size is larger than the physical screen. (It doesn't +* prevent the guest setting this silly viewport setting, though...) +*/ +return config->xres_virtual > config->xres && + config->yres_virtual > config->yres; +} +static void fb_update_display (void *opaque) {BCM2835FBState *s = opaque;
@@ -134,12 +146,18 @@ static void fb_update_display(void *opaque)int last =0 ;int src_width =0 ;int dest_width =0 ; +uint32_t xoff =0 , yoff =0 ;if (s->lock || !s->config.xres) {return ; } src_width =bcm2835_fb_get_pitch (&s->config); +if (fb_use_offsets (&s->config)) { + xoff = s->config.xoffset; + yoff = s->config.yoffset; + } + dest_width = s->config.xres;switch (surface_bits_per_pixel (surface)) {
@@ -165,8 +183,9 @@ static void fb_update_display(void *opaque) }if (s->invalidate) { +hwaddr base = s->config.base + xoff + yoff * src_width;framebuffer_update_memory_section (&s->fbsection, s->dma_mr, - s->config.base, + base, s->config.yres, src_width); }
@@ -176,7 +195,8 @@ static void fb_update_display(void *opaque) draw_line_src16, s, &first, &last);if (first >=0 ) { -dpy_gfx_update (s->con,0 , first, s->config.xres, last - first +1 ); +dpy_gfx_update (s->con,0 , first, s->config.xres, + last - first +1 ); } s->invalidate = false;
@@ -202,8 +222,6 @@ static void bcm2835_fb_mbox_push(BCM2835FBState *s, uint32_t value) s->config.base = s->vcram_base | (value &0xc0000000 ); s->config.base +=BCM2835_FB_OFFSET ; -/* TODO - Manage properly virtual resolution */ - pitch =bcm2835_fb_get_pitch (&s->config); size =bcm2835_fb_get_size (&s->config);
@@ -224,8 +242,6 @@ void bcm2835_fb_reconfigure(BCM2835FBState *s, BCM2835FBConfig *newconfig) s->config = *newconfig; -/* TODO - Manage properly virtual resolution */ - s->invalidate = true;qemu_console_resize (s->con, s->config.xres, s->config.yres); s->lock = false;
hw/misc/bcm2835_property.c +15 -6
@@ -155,23 +155,32 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)case 0x00040002 :/* Blank screen */ resplen =4 ;break ; -case 0x00040003 :/* Get display width/height */ -case 0x00040004 : +case 0x00040003 :/* Get physical display width/height */ stl_le_phys (&s->dma_as, value +12 , fbconfig.xres);stl_le_phys (&s->dma_as, value +16 , fbconfig.yres); resplen =8 ;break ; -case 0x00044003 :/* Test display width/height */ -case 0x00044004 : +case 0x00040004 :/* Get virtual display width/height */ +stl_le_phys (&s->dma_as, value +12 , fbconfig.xres_virtual); +stl_le_phys (&s->dma_as, value +16 , fbconfig.yres_virtual); resplen =8 ;break ; -case 0x00048003 :/* Set display width/height */ -case 0x00048004 : +case 0x00044003 :/* Test physical display width/height */ +case 0x00044004 :/* Test virtual display width/height */ + resplen =8 ; +break ; +case 0x00048003 :/* Set physical display width/height */ fbconfig.xres =ldl_le_phys (&s->dma_as, value +12 ); fbconfig.yres =ldl_le_phys (&s->dma_as, value +16 ); fbconfig_updated = true; resplen =8 ;break ; +case 0x00048004 :/* Set virtual display width/height */ + fbconfig.xres_virtual =ldl_le_phys (&s->dma_as, value +12 ); + fbconfig.yres_virtual =ldl_le_phys (&s->dma_as, value +16 ); + fbconfig_updated = true; + resplen =8 ; +break ;case 0x00040005 :/* Get depth */ stl_le_phys (&s->dma_as, value +12 , fbconfig.bpp); resplen =4 ;
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 50/52] hw/display/bcm2835_fb: Validate config settings
In reply to Peter MaydellValidate the config settings that the guest tries to set.
The wiki page documentation is not really accurate here:
generally rather than failing requests to set bad parameters, the hardware will just clip them to something sensible.
Validate the most important parameters: sizes and the viewport offsets. This prevents the framebuffer code from trying to read out-of-range memory.
In the property handling code, we validate the new parameters every time we encounter a tag that sets them. This means we validate the config multiple times if the request includes multiple config-setting tags, but the code would require significant restructuring to do a validation only once but still return the clipped settings for get-parameter tags and the buffer allocation tag.
Validation of settings made via the older bcm2835_fb_mbox_push() function will be done in the next commit.
Message-id: [email protected]
--- include/hw/display/bcm2835_fb.h | 8 +++++ hw/display/bcm2835_fb.c | 48 +++++++++++++++++++++++++++-- hw/misc/bcm2835_property.c | 54 ++++++++++++++++----------------- 3 files changed, 81 insertions(+), 29 deletions(-)
include/hw/display/bcm2835_fb.h +8 -0
@@ -76,4 +76,12 @@ static inline uint32_t bcm2835_fb_get_size(BCM2835FBConfig *config) return yres * bcm2835_fb_get_pitch(config); } +/** +* bcm2835_fb_validate_config: check provided config +* +* Validates the configuration information provided by the guest and +* adjusts it if necessary. +*/ +void bcm2835_fb_validate_config (BCM2835FBConfig *config); +#endif
hw/display/bcm2835_fb.c +46 -2
66 lines not on this page · raw message
hw/misc/bcm2835_property.c +27 -27
108 lines not on this page · raw message
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 51/52] hw/display/bcm2835_fb: Validate bcm2835_fb_mbox_push() config
In reply to Peter MaydellRefactor bcm2835_fb_mbox_push() to work by calling bcm2835_fb_validate_config() and bcm2835_fb_reconfigure(), so that config set this way is also validated.
Message-id: [email protected]
--- hw/display/bcm2835_fb.c | 63 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 32 deletions(-)
hw/display/bcm2835_fb.c +31 -32
@@ -248,38 +248,6 @@ void bcm2835_fb_validate_config(BCM2835FBConfig *config) } } -static void bcm2835_fb_mbox_push (BCM2835FBState *s,uint32_t value) -{ -uint32_t pitch; -uint32_t size; - - value &= ~0xf ; - - s->lock = true; - - s->config.xres =ldl_le_phys (&s->dma_as, value); - s->config.yres =ldl_le_phys (&s->dma_as, value +4 ); - s->config.xres_virtual =ldl_le_phys (&s->dma_as, value +8 ); - s->config.yres_virtual =ldl_le_phys (&s->dma_as, value +12 ); - s->config.bpp =ldl_le_phys (&s->dma_as, value +20 ); - s->config.xoffset =ldl_le_phys (&s->dma_as, value +24 ); - s->config.yoffset =ldl_le_phys (&s->dma_as, value +28 ); - - s->config.base = s->vcram_base | (value &0xc0000000 ); - s->config.base +=BCM2835_FB_OFFSET ; - - pitch =bcm2835_fb_get_pitch (&s->config); - size =bcm2835_fb_get_size (&s->config); - -stl_le_phys (&s->dma_as, value +16 , pitch); -stl_le_phys (&s->dma_as, value +32 , s->config.base); -stl_le_phys (&s->dma_as, value +36 , size); - - s->invalidate = true; -qemu_console_resize (s->con, s->config.xres, s->config.yres); - s->lock = false; -} -void bcm2835_fb_reconfigure (BCM2835FBState *s,BCM2835FBConfig *newconfig) { s->lock = true;
@@ -291,6 +259,37 @@ void bcm2835_fb_reconfigure(BCM2835FBState *s, BCM2835FBConfig *newconfig) s->lock = false; } +static void bcm2835_fb_mbox_push (BCM2835FBState *s,uint32_t value) +{ +uint32_t pitch; +uint32_t size; +BCM2835FBConfig newconf; + + value &= ~0xf ; + + newconf.xres =ldl_le_phys (&s->dma_as, value); + newconf.yres =ldl_le_phys (&s->dma_as, value +4 ); + newconf.xres_virtual =ldl_le_phys (&s->dma_as, value +8 ); + newconf.yres_virtual =ldl_le_phys (&s->dma_as, value +12 ); + newconf.bpp =ldl_le_phys (&s->dma_as, value +20 ); + newconf.xoffset =ldl_le_phys (&s->dma_as, value +24 ); + newconf.yoffset =ldl_le_phys (&s->dma_as, value +28 ); + + newconf.base = s->vcram_base | (value &0xc0000000 ); + newconf.base +=BCM2835_FB_OFFSET ; + +bcm2835_fb_validate_config (&newconf); + + pitch =bcm2835_fb_get_pitch (&newconf); + size =bcm2835_fb_get_size (&newconf); + +stl_le_phys (&s->dma_as, value +16 , pitch); +stl_le_phys (&s->dma_as, value +32 , newconf.base); +stl_le_phys (&s->dma_as, value +36 , size); + +bcm2835_fb_reconfigure (s, &newconf); +} +static uint64_t bcm2835_fb_read (void *opaque,hwaddr offset,unsigned size) {BCM2835FBState *s = opaque;
Signature · 1 line
2.18.0
[Qemu-devel] [PULL 52/52] hw/arm/mps2: Fix ID register errors on AN511 and AN385
In reply to Peter MaydellFix MPS2 SCC config register values for the mps2-an511
and mps2-an385 boards:
* the SCC_AID bits [23:20] specify the FPGA build target board revision, and the SCC_CFG4 register specifies the actual board revision, so these should have matching values. Claim to be board revision C, consistently -- we had the revision in the wrong part of SCC_AID.
* SCC_ID bits [15:4] should be the board number in hex, not decimal
Message-id: [email protected]
--- hw/arm/mps2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/arm/mps2.c +3 -3
@@ -312,7 +312,7 @@ static void mps2_common_init(MachineState *machine) sccdev =DEVICE (&mms->scc);qdev_set_parent_bus (sccdev,sysbus_get_default ());qdev_prop_set_uint32 (sccdev,"scc-cfg4" ,0x2 ); -qdev_prop_set_uint32 (sccdev,"scc-aid" ,0x02000008 ); +qdev_prop_set_uint32 (sccdev,"scc-aid" ,0x00200008 );qdev_prop_set_uint32 (sccdev,"scc-id" , mmc->scc_id);object_property_set_bool (OBJECT (&mms->scc), true,"realized" , &error_fatal);
@@ -347,7 +347,7 @@ static void mps2_an385_class_init(ObjectClass *oc, void *data) mc->desc ="ARM MPS2 with AN385 FPGA image for Cortex-M3" ; mmc->fpga_type =FPGA_AN385 ; mc->default_cpu_type =ARM_CPU_TYPE_NAME ("cortex-m3" ); - mmc->scc_id =0x41040000 | (385 <<4 ); + mmc->scc_id =0x41043850 ; }static void mps2_an511_class_init (ObjectClass *oc,void *data)
@@ -358,7 +358,7 @@ static void mps2_an511_class_init(ObjectClass *oc, void *data) mc->desc ="ARM MPS2 with AN511 DesignStart FPGA image for Cortex-M3" ; mmc->fpga_type =FPGA_AN511 ; mc->default_cpu_type =ARM_CPU_TYPE_NAME ("cortex-m3" ); - mmc->scc_id =0x4104000 | (511 <<4 ); + mmc->scc_id =0x41045110 ; }static const TypeInfo mps2_info = {
Signature · 1 line
2.18.0