target-arm queue
Subsystems (2)
ARM queue: nothing particularly exciting here, but no reason to sit on them for another week.
thanks
-- PMM
The following changes since commit 61eedf7aec0e2395aabd628cc055096909a3ea15:
tests/prom-env: Ease time-out problems on slow hosts (2017-02-10 15:44:53 +0000)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170210
for you to fetch changes up to b4cc583f0285a2e1e78621dfba142f00ca47414a:
aspeed/smc: use a modulo to check segment limits (2017-02-10 17:40:30 +0000)
----------------------------------------------------------------
target-arm queue:
* aspeed: minor fixes
* virt: declare fwcfg and virtio-mmio as DMA coherent in DT & ACPI
* arm: enable basic TCG emulation of PMU for AArch64
----------------------------------------------------------------
Alexander Graf (4):
target-arm: Declare virtio-mmio as dma-coherent in dt hw/arm/virt: Declare virtio-mmio as dma cache coherent in ACPI hw/arm/virt: Declare fwcfg as dma cache coherent in ACPI hw/arm/virt: Declare fwcfg as dma cache coherent in dt
Cédric Le Goater (4):
aspeed: check for negative values returned by blk_getlength()
aspeed: remove useless comment on controller segment size aspeed/smc: handle dummies only in fast read mode aspeed/smc: use a modulo to check segment limits
Wei Huang (4):
target-arm: Add support for PMU register PMSELR_EL0
target-arm: Add support for AArch64 PMU register PMXEVTYPER_EL0
target-arm: Add support for PMU register PMINTENSET_EL1
target-arm: Enable vPMU support under TCG mode
target/arm/cpu.h | 4 +-- hw/arm/aspeed.c | 22 +++++++++----- hw/arm/vexpress.c | 1 + hw/arm/virt-acpi-build.c | 2 ++ hw/arm/virt.c | 4 ++- hw/ssi/aspeed_smc.c | 13 +++++---- target/arm/cpu.c | 2 +- target/arm/helper.c | 74 ++++++++++++++++++++++++++++++++++++------------ 8 files changed, 88 insertions(+), 34 deletions(-)
[Qemu-devel] [PULL 03/12] target-arm: Add support for PMU register PMINTENSET_EL1
From: Wei Huang <[email protected]>
This patch adds access support for PMINTENSET_EL1.
Message-id: [email protected]
--- target/arm/cpu.h | 2 +- target/arm/helper.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-)
target/arm/cpu.h +1 -1
@@ -309,7 +309,7 @@ typedef struct CPUARMState {uint32_t c9_pmovsr;/* perf monitor overflow status */ uint32_t c9_pmuserenr;/* perf monitor user enable */ uint64_t c9_pmselr;/* perf monitor counter selection register */ -uint32_t c9_pminten;/* perf monitor interrupt enables */ +uint64_t c9_pminten;/* perf monitor interrupt enables */ union { /* Memory attribute redirection */ struct { #ifdef HOST_WORDS_BIGENDIAN
target/arm/helper.c +9 -1
@@ -1275,9 +1275,17 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .writefn = pmuserenr_write, .raw_writefn = raw_write }, { .name = "PMINTENSET", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 1, .access = PL1_RW, .accessfn = access_tpm, - .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), + .type = ARM_CP_ALIAS, + .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pminten), .resetvalue = 0, .writefn = pmintenset_write, .raw_writefn = raw_write }, + { .name = "PMINTENSET_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 1, + .access = PL1_RW, .accessfn = access_tpm, + .type = ARM_CP_IO, + .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), + .writefn = pmintenset_write, .raw_writefn = raw_write, + .resetvalue = 0x0 }, { .name = "PMINTENCLR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 2, .access = PL1_RW, .accessfn = access_tpm, .type = ARM_CP_ALIAS, .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten),
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PULL 03/12] target-arm: Add support for PMU register PMINTENSET_EL1
Wei, Peter,
Quoted 18 lines · Peter Maydell
From: Wei Huang <[email protected]>
This patch adds access support for
PMINTENSET_EL1.Signed-off-by Wei Huang <[email protected]>Reviewed-by Peter Maydell <[email protected]>Message-id: [email protected]
Signed-off-by Peter Maydell <[email protected]>--- target/arm/cpu.h | 2 +- target/arm/helper.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-)target/arm/cpu.h +0
-0
target/arm/cpu.h typedef struct CPUARMState { · line 312
Quoted 5 lines
target/arm/cpu.h +1
-1@@ -309,7 +309,7 @@ typedef struct CPUARMState {uint32_t c9_pmovsr;/* perf monitor overflow status */ uint32_t c9_pmuserenr;/* perf monitor user enable */ uint64_t c9_pmselr;/* perf monitor counter selection register */ -uint32_t c9_pminten;/* perf monitor interrupt enables */ +uint64_t c9_pminten;/* perf monitor interrupt enables */
PMINTENSET_EL1 and PMINTENCLR_EL1 are both 32-bit registers, just like their AArch32 counterparts. Is there a reason I'm missing for why this has been changed to a uint64_t? There are a number of other 32-bit PMU registers also currently being represented by uint64_t.
-Aaron
Quoted 30 lines
target/arm/cpu.h +0
-0union { /* Memory attribute redirection */ struct { #ifdef HOST_WORDS_BIGENDIANtarget/arm/helper.c +9
-1@@ -1275,9 +1275,17 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .writefn = pmuserenr_write, .raw_writefn = raw_write }, { .name = "PMINTENSET", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 1, .access = PL1_RW, .accessfn = access_tpm, - .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), + .type = ARM_CP_ALIAS, + .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pminten), .resetvalue = 0, .writefn = pmintenset_write, .raw_writefn = raw_write }, + { .name = "PMINTENSET_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 1, + .access = PL1_RW, .accessfn = access_tpm, + .type = ARM_CP_IO, + .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), + .writefn = pmintenset_write, .raw_writefn = raw_write, + .resetvalue = 0x0 }, { .name = "PMINTENCLR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 2, .access = PL1_RW, .accessfn = access_tpm, .type = ARM_CP_ALIAS, .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten),Signature · 1 line
2.7.4
Signature · 3 lines
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: [Qemu-devel] [PULL 03/12] target-arm: Add support for PMU register PMINTENSET_EL1
Quoted 16 lines · Aaron Lindsay
Wei, Peter,
Quoted 13 lines · Peter Maydell
From: Wei Huang <[email protected]>
This patch adds access support for
PMINTENSET_EL1.Signed-off-by Wei Huang <[email protected]>Reviewed-by Peter Maydell <[email protected]>Message-id: [email protected]
Signed-off-by Peter Maydell <[email protected]>--- target/arm/cpu.h | 2 +- target/arm/helper.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-)
Quoted 15 lines
target/arm/cpu.h typedef struct CPUARMState { · line 312
Quoted 10 lines
target/arm/cpu.h +1
-1@@ -309,7 +309,7 @@ typedef struct CPUARMState {uint32_t c9_pmovsr;/* perf monitor overflow status */ uint32_t c9_pmuserenr;/* perf monitor user enable */ uint64_t c9_pmselr;/* perf monitor counter selection register */ -uint32_t c9_pminten;/* perf monitor interrupt enables */ +uint64_t c9_pminten;/* perf monitor interrupt enables */
PMINTENSET_EL1andPMINTENCLR_EL1are both 32-bit registers, just like their AArch32 counterparts. Is there a reason I'm missing for why this has been changed to auint64_t? There are a number of other 32-bit PMU registers also currently being represented byuint64_t.
Two reasons:
(1) The conceptual reason. In AArch64 "32-bit system register" is just
a convenient shorthand for "64-bit system register where the upper 32 bits are RAZ/WI". The register itself is still 64 bits and in a future architecture revision it might end up with defined bits in the upper half (this has happened already for a few registers).
(2) The QEMU implementation reason. The way we implement system register
access instructions typically ends up in generating a simple "load/store 64 bit value from address" instruction. Rather than having the generic "handle a system register access" code have two codepaths to cope with "64-bit sysreg that's stored in a 32-bit field" and "64-bit sysreg that's stored in a 64-bit field", we choose to require that the fields are always 64-bits wide, so that the code that accesses them doesn't have to care.
(The implementation reason derives from the conceptual reason:
architecturally there is no real different "32-bit system register" concept, so we don't need to implement handling differently. For AArch32 we do distinguish between 32-bit and 64-bit coprocessor registers, because they're really different things and need different handling.)
thanks
-- PMM
[Qemu-devel] [PULL 05/12] target-arm: Declare virtio-mmio as dma-coherent in dt
In reply to Peter MaydellFrom: Alexander Graf <[email protected]>
QEMU emulated hardware is always dma coherent with its guest. We do annotate that correctly on the PCI host controller, but left out virtio-mmio.
Recent kernels have started to interpret that flag rather than take dma coherency as granted with virtio-mmio. While that is considered a kernel bug, as it breaks previously working systems, it showed that our dt description is incomplete.
This patch adds the respective marker that allows guest OSs to evaluate that our virtio-mmio devices are indeed cache coherent.
Message-id: [email protected]
--- hw/arm/vexpress.c | 1 + hw/arm/virt.c | 1 + 2 files changed, 2 insertions(+)
hw/arm/vexpress.c +1 -0
@@ -452,6 +452,7 @@ static int add_virtio_mmio_node(void *fdt, uint32_t acells, uint32_t scells, acells, addr, scells, size);qemu_fdt_setprop_cells (fdt, nodename,"interrupt-parent" , intc);qemu_fdt_setprop_cells (fdt, nodename,"interrupts" ,0 , irq,1 ); +qemu_fdt_setprop (fdt, nodename,"dma-coherent" ,NULL ,0 );g_free (nodename);if (rc) {return -1 ;
hw/arm/virt.c +1 -0
@@ -797,6 +797,7 @@ static void create_virtio_devices(const VirtMachineState *vms, qemu_irq *pic)qemu_fdt_setprop_cells (vms->fdt, nodename,"interrupts" ,GIC_FDT_IRQ_TYPE_SPI , irq,GIC_FDT_IRQ_FLAGS_EDGE_LO_HI ); +qemu_fdt_setprop (vms->fdt, nodename,"dma-coherent" ,NULL ,0 );g_free (nodename); } }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 04/12] target-arm: Enable vPMU support under TCG mode
In reply to Peter MaydellFrom: Wei Huang <[email protected]>
This patch contains several fixes to enable vPMU under TCG mode. It first removes the checking of kvm_enabled() while unsetting ARM_FEATURE_PMU. With it, the .pmu option can be used to turn on/off vPMU under TCG mode. Secondly the PMU node of DT table is now created under TCG. The last fix is to disable the masking of PMUver field of ID_AA64DFR0_EL1.
Message-id: [email protected]
--- hw/arm/virt.c | 2 +- target/arm/cpu.c | 2 +- target/arm/helper.c | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-)
hw/arm/virt.c +1 -1
@@ -471,7 +471,7 @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)CPU_FOREACH (cpu) { armcpu =ARM_CPU (cpu);if (!arm_feature (&armcpu->env,ARM_FEATURE_PMU ) || - !kvm_arm_pmu_create (cpu,PPI (VIRTUAL_PMU_IRQ ))) { + (kvm_enabled () && !kvm_arm_pmu_create (cpu,PPI (VIRTUAL_PMU_IRQ )))) {return ; } }
target/arm/cpu.c +1 -1
@@ -781,7 +781,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)unset_feature (env,ARM_FEATURE_EL2 ); } -if (!cpu->has_pmu || !kvm_enabled ()) { +if (!cpu->has_pmu) { cpu->has_pmu = false;unset_feature (env,ARM_FEATURE_PMU ); }
target/arm/helper.c +1 -6
@@ -4633,12 +4633,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "ID_AA64DFR0_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 0, .access = PL1_R, .type = ARM_CP_CONST, -/* We mask out the PMUVer field, because we don't currently -* implement the PMU. Not advertising it prevents the guest -* from trying to use it and getting UNDEFs on registers we -* don't implement. -*/ - .resetvalue = cpu->id_aa64dfr0 & ~0xf00 }, + .resetvalue = cpu->id_aa64dfr0 }, { .name = "ID_AA64DFR1_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 5, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST,
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 06/12] hw/arm/virt: Declare virtio-mmio as dma cache coherent in ACPI
In reply to Peter MaydellFrom: Alexander Graf <[email protected]>
Virtio-mmio devices can directly access guest memory and do so in cache coherent fashion. Tell the guest about that fact when it's using ACPI.
Message-id: [email protected]
--- hw/arm/virt-acpi-build.c | 1 + 1 file changed, 1 insertion(+)
hw/arm/virt-acpi-build.c +1 -0
@@ -135,6 +135,7 @@ static void acpi_dsdt_add_virtio(Aml *scope,Aml *dev =aml_device ("VR%02u" , i);aml_append (dev,aml_name_decl ("_HID" ,aml_string ("LNRO0005" )));aml_append (dev,aml_name_decl ("_UID" ,aml_int (i))); +aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 )));Aml *crs =aml_resource_template ();aml_append (crs,aml_memory32_fixed (base, size,AML_READ_WRITE ));
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 07/12] hw/arm/virt: Declare fwcfg as dma cache coherent in ACPI
In reply to Peter MaydellFrom: Alexander Graf <[email protected]>
Fw-cfg recently learned how to directly access guest memory and does so in cache coherent fashion. Tell the guest about that fact when it's using ACPI.
Message-id: [email protected]
--- hw/arm/virt-acpi-build.c | 1 + 1 file changed, 1 insertion(+)
hw/arm/virt-acpi-build.c +1 -0
@@ -90,6 +90,7 @@ static void acpi_dsdt_add_fw_cfg(Aml *scope, const MemMapEntry *fw_cfg_memmap)aml_append (dev,aml_name_decl ("_HID" ,aml_string ("QEMU0002" )));/* device present, functioning, decoding, not shown in UI */ aml_append (dev,aml_name_decl ("_STA" ,aml_int (0xB ))); +aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 )));Aml *crs =aml_resource_template (); aml_append(crs, aml_memory32_fixed(fw_cfg_memmap->base,
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 09/12] aspeed: check for negative values returned by blk_getlength()
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
write_boot_rom() does not check for negative values. This is more a problem for coverity than the actual code as the size of the flash device is checked when the m25p80 object is created. If there is anything wrong with the backing file, we should not even reach that path.
Message-id: [email protected]
--- hw/arm/aspeed.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
hw/arm/aspeed.c +12 -2
@@ -113,9 +113,19 @@ static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size, {BlockBackend *blk =blk_by_legacy_dinfo (dinfo);uint8_t *storage; +int64_t size; -if (rom_size >blk_getlength (blk)) { - rom_size =blk_getlength (blk); +/* The block backend size should have already been 'validated' by +* the creation of the m25p80 object. +*/ + size =blk_getlength (blk); +if (size <=0 ) { +error_setg (errp,"failed to get flash size" ); +return ; + } + +if (rom_size > size) { + rom_size = size; } storage =g_new0 (uint8_t, rom_size);
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 10/12] aspeed: remove useless comment on controller segment size
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
The flash devices used for the FMC controller (BMC firmware) are well defined for each Aspeed machine and are all smaller than the default mapping window size, at least for CE0 which is the chip the SoC boots from.
Message-id: [email protected]
--- hw/arm/aspeed.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
hw/arm/aspeed.c +3 -5
@@ -148,10 +148,6 @@ static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,DriveInfo *dinfo =drive_get_next (IF_MTD );qemu_irq cs_line; -/* -* FIXME: check that we are not using a flash module exceeding -* the controller segment size -*/ fl->flash =ssi_create_slave_no_init (s->spi, flashtype);if (dinfo) { qdev_prop_set_drive(fl->flash, "drive", blk_by_legacy_dinfo(dinfo),
@@ -210,7 +206,9 @@ static void aspeed_board_init(MachineState *machine,/* * create a ROM region using the default mapping window size of -* the flash module. +* the flash module. The window size is 64MB for the AST2400 +* SoC and 128MB for the AST2500 SoC, which is twice as big as +* needed by the flash modules of the Aspeed machines. */ memory_region_init_rom (boot_rom,OBJECT (bmc),"aspeed.boot_rom" , fl->size, &error_abort);
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 02/12] target-arm: Add support for AArch64 PMU register PMXEVTYPER_EL0
In reply to Peter MaydellFrom: Wei Huang <[email protected]>
In order to support Linux perf, which uses PMXEVTYPER register, this patch adds read/write access support for PMXEVTYPER. The access is CONSTRAINED UNPREDICTABLE when PMSELR is not 0x1f. Additionally this patch adds support for PMXEVTYPER_EL0.
Message-id: [email protected]
--- target/arm/cpu.h | 1 - target/arm/helper.c | 30 +++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-)
target/arm/cpu.h +0 -1
@@ -307,7 +307,6 @@ typedef struct CPUARMState {uint64_t c9_pmcr;/* performance monitor control register */ uint64_t c9_pmcnten;/* perf monitor counter enables */ uint32_t c9_pmovsr;/* perf monitor overflow status */ -uint32_t c9_pmxevtyper;/* perf monitor event type */ uint32_t c9_pmuserenr;/* perf monitor user enable */ uint64_t c9_pmselr;/* perf monitor counter selection register */ uint32_t c9_pminten;/* perf monitor interrupt enables */
target/arm/helper.c +25 -5
@@ -1054,7 +1054,25 @@ static void pmovsr_write(CPUARMState *env, const ARMCPRegInfo *ri,static void pmxevtyper_write (CPUARMState *env,const ARMCPRegInfo *ri,uint64_t value) { - env->cp15.c9_pmxevtyper = value &0xff ; +/* Attempts to access PMXEVTYPER are CONSTRAINED UNPREDICTABLE when +* PMSELR value is equal to or greater than the number of implemented +* counters, but not equal to 0x1f. We opt to behave as a RAZ/WI. +*/ +if (env->cp15.c9_pmselr ==0x1f ) { +pmccfiltr_write (env, ri, value); + } +} + +static uint64_t pmxevtyper_read (CPUARMState *env,const ARMCPRegInfo *ri) +{ +/* We opt to behave as a RAZ/WI when attempts to access PMXEVTYPER +* are CONSTRAINED UNPREDICTABLE. See comments in pmxevtyper_write(). +*/ +if (env->cp15.c9_pmselr ==0x1f ) { +return env->cp15.pmccfiltr_el0; + }else { +return 0 ; + } } static void pmuserenr_write(CPUARMState *env, const ARMCPRegInfo *ri,
@@ -1234,10 +1252,12 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .fieldoffset = offsetof(CPUARMState, cp15.pmccfiltr_el0), .resetvalue = 0, }, { .name = "PMXEVTYPER", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 1, - .access = PL0_RW, - .fieldoffset = offsetof(CPUARMState, cp15.c9_pmxevtyper), - .accessfn = pmreg_access, .writefn = pmxevtyper_write, - .raw_writefn = raw_write }, + .access = PL0_RW, .type = ARM_CP_NO_RAW, .accessfn = pmreg_access, + .writefn = pmxevtyper_write, .readfn = pmxevtyper_read }, + { .name = "PMXEVTYPER_EL0", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 13, .opc2 = 1, + .access = PL0_RW, .type = ARM_CP_NO_RAW, .accessfn = pmreg_access, + .writefn = pmxevtyper_write, .readfn = pmxevtyper_read }, /* Unimplemented, RAZ/WI. */ { .name = "PMXEVCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 2, .access = PL0_RW, .type = ARM_CP_CONST, .resetvalue = 0,
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 08/12] hw/arm/virt: Declare fwcfg as dma cache coherent in dt
In reply to Peter MaydellFrom: Alexander Graf <[email protected]>
Fw-cfg recently learned how to directly access guest memory and does so in cache coherent fashion. Tell the guest about that fact when it's using DT.
Message-id: [email protected]
--- hw/arm/virt.c | 1 + 1 file changed, 1 insertion(+)
hw/arm/virt.c +1 -0
@@ -929,6 +929,7 @@ static FWCfgState *create_fw_cfg(const VirtMachineState *vms, AddressSpace *as) "compatible", "qemu,fw-cfg-mmio");qemu_fdt_setprop_sized_cells (vms->fdt, nodename,"reg" ,2 , base,2 , size); +qemu_fdt_setprop (vms->fdt, nodename,"dma-coherent" ,NULL ,0 );g_free (nodename);return fw_cfg; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 11/12] aspeed/smc: handle dummies only in fast read mode
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
HW works fine in normal read mode with dummy bytes being set. So let's check this case to not transfer bytes.
Message-id: [email protected]
--- hw/ssi/aspeed_smc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
hw/ssi/aspeed_smc.c +6 -3
@@ -536,10 +536,13 @@ static uint64_t aspeed_smc_flash_read(void *opaque, hwaddr addr, unsigned size)/* * Use fake transfers to model dummy bytes. The value should * be configured to some non-zero value in fast read mode and -* zero in read mode. +* zero in read mode. But, as the HW allows inconsistent +* settings, let's check for fast read mode. */ -for (i =0 ; i <aspeed_smc_flash_dummies (fl); i++) { -ssi_transfer (fl->controller->spi,0xFF ); +if (aspeed_smc_flash_mode (fl) ==CTRL_FREADMODE ) { +for (i =0 ; i <aspeed_smc_flash_dummies (fl); i++) { +ssi_transfer (fl->controller->spi,0xFF ); + } }for (i =0 ; i < size; i++) {
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 12/12] aspeed/smc: use a modulo to check segment limits
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
The size of a segment is not necessarily a power of 2.
Message-id: [email protected]
--- hw/ssi/aspeed_smc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ssi/aspeed_smc.c +2 -2
@@ -475,15 +475,15 @@ static uint32_t aspeed_smc_check_segment_addr(const AspeedSMCFlash *fl,AspeedSegments seg;aspeed_smc_reg_to_segment (s->regs[R_SEG_ADDR0 + fl->id], &seg); -if ((addr & (seg.size -1 )) != addr) { +if ((addr % seg.size) != addr) {qemu_log_mask (LOG_GUEST_ERROR ,"%s: invalid address 0x%08x for CS%d segment : " "[ 0x%" HWADDR_PRIx" - 0x%" HWADDR_PRIx" ]\n" , s->ctrl->name, addr, fl->id, seg.addr, seg.addr + seg.size); + addr %= seg.size; } - addr &= seg.size -1 ;return addr; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 01/12] target-arm: Add support for PMU register PMSELR_EL0
In reply to Peter MaydellFrom: Wei Huang <[email protected]>
This patch adds support for AArch64 register PMSELR_EL0. The existing PMSELR definition is revised accordingly.
Message-id: [email protected]
--- target/arm/cpu.h | 1 + target/arm/helper.c | 27 +++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-)
target/arm/cpu.h +1 -0
@@ -309,6 +309,7 @@ typedef struct CPUARMState {uint32_t c9_pmovsr;/* perf monitor overflow status */ uint32_t c9_pmxevtyper;/* perf monitor event type */ uint32_t c9_pmuserenr;/* perf monitor user enable */ +uint64_t c9_pmselr;/* perf monitor counter selection register */ uint32_t c9_pminten;/* perf monitor interrupt enables */ union { /* Memory attribute redirection */ struct {
target/arm/helper.c +21 -6
@@ -975,6 +975,17 @@ static uint64_t pmccntr_read(CPUARMState *env, const ARMCPRegInfo *ri)return total_ticks - env->cp15.c15_ccnt; } +static void pmselr_write (CPUARMState *env,const ARMCPRegInfo *ri, +uint64_t value) +{ +/* The value of PMSELR.SEL affects the behavior of PMXEVTYPER and +* PMXEVCNTR. We allow [0..31] to be written to PMSELR here; in the +* meanwhile, we check PMSELR.SEL when PMXEVTYPER and PMXEVCNTR are +* accessed. +*/ + env->cp15.c9_pmselr = value &0x1f ; +} +static void pmccntr_write (CPUARMState *env,const ARMCPRegInfo *ri,uint64_t value) {
@@ -1194,13 +1205,17 @@ static const ARMCPRegInfo v7_cp_reginfo[] = {/* Unimplemented so WI. */ { .name = "PMSWINC", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 4, .access = PL0_W, .accessfn = pmreg_access, .type = ARM_CP_NOP }, - /* Since we don't implement any events, writing to PMSELR is UNPREDICTABLE. - * We choose to RAZ/WI. - */ - { .name = "PMSELR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 5, - .access = PL0_RW, .type = ARM_CP_CONST, .resetvalue = 0, - .accessfn = pmreg_access },#ifndef CONFIG_USER_ONLY + { .name = "PMSELR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 5, + .access = PL0_RW, .type = ARM_CP_ALIAS, + .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmselr), + .accessfn = pmreg_access, .writefn = pmselr_write, + .raw_writefn = raw_write}, + { .name = "PMSELR_EL0", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 5, + .access = PL0_RW, .accessfn = pmreg_access, + .fieldoffset = offsetof(CPUARMState, cp15.c9_pmselr), + .writefn = pmselr_write, .raw_writefn = raw_write, }, { .name = "PMCCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 0, .access = PL0_RW, .resetvalue = 0, .type = ARM_CP_IO, .readfn = pmccntr_read, .writefn = pmccntr_write32,
Signature · 1 line
2.7.4
Peter Maydell
AppliedQuoted 16 lines · Peter Maydell
ARM queue: nothing particularly exciting here, but no reason to sit on them for another week.
thanks
-- PMMThe following changes since commit
61eedf7aec0e2395aabd628cc055096909a3ea15:tests/prom-env: Ease time-out problems on slow hosts (2017-02-10 15:44:53 +0000)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.gittags/pull-target-arm-20170210for you to fetch changes up to
b4cc583f0285a2e1e78621dfba142f00ca47414a:
Quoted 8 lines
aspeed/smc: use a modulo to check segment limits (2017-02-10 17:40:30 +0000)
----------------------------------------------------------------
target-arm queue:
* aspeed: minor fixes
* virt: declare fwcfg and virtio-mmio as DMA coherent in DT & ACPI
* arm: enable basic TCG emulation of PMU for AArch64
Applied, thanks.
-- PMM