target-arm queue
Subsystems (3)
Arm queue. I'll probably end up doing another later this week.
thanks
-- PMM
The following changes since commit 5f39a91dbd9a186edb999afd4d17524f4b1da14f:
Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2019-01-28 12:54:06 +0000)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190128
for you to fetch changes up to dc192cb2d851c51ebd8d8e1a3b6b14ce9d16efc7:
gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index (2019-01-28 18:03:16 +0000)
----------------------------------------------------------------
target-arm queue:
* Fix validation of 32-bit address spaces for aa32 (fixes an assert introduced in ba97be9f4a4)
* v8m: Ensure IDAU is respected if SAU is disabled
* gdbstub: fix gdb_get_cpu(s, pid, tid) when pid and/or tid are 0
* exec.c: Use correct attrs in cpu_memory_rw_debug()
* accel/tcg/user-exec: Don't parse aarch64 insns to test for read vs write
* target/arm: Don't clear supported PMU events when initializing PMCEID1
* memory: add memory_region_flush_rom_device()
* microbit: Add nRF51 non-volatile memories
* microbit: Add stub NRF51 TWI magnetometer/accelerometer detection
* tests/microbit-test: extend testing of microbit devices
* checkpatch: Don't emit spurious warnings about block comments
* aspeed/smc: misc bug fixes
* xlnx-zynqmp: Don't create rpu-cluster if there are no RPUs
* xlnx-zynqmp: Realize cluster after putting RPUs in it
* accel/tcg: Add cluster number to TCG TB hash so differently configured
CPUs don't pick up cached TBs for the wrong kind of CPU
----------------------------------------------------------------
Aaron Lindsay OS (1):
target/arm: Don't clear supported PMU events when initializing PMCEID1
Cédric Le Goater (4):
aspeed/smc: fix default read value aspeed/smc: define registers for all possible CS aspeed/smc: Add dummy data register aspeed/smc: snoop SPI transfers to fake dummy cycles
Julia Suvorova (3):
tests/libqtest: Introduce qtest_init_with_serial() tests/microbit-test: Make test independent of global_qtest tests/microbit-test: Check nRF51 UART functionality
Luc Michel (1):
gdbstub: fix gdb_get_cpu(s, pid, tid) when pid and/or tid are 0
Peter Maydell (8):
exec.c: Use correct attrs in cpu_memory_rw_debug() accel/tcg/user-exec: Don't parse aarch64 insns to test for read vs write
checkpatch: Don't emit spurious warnings about block comments
xlnx-zynqmp: Don't create rpu-cluster if there are no RPUs hw/arm/xlnx-zynqmp: Realize cluster after putting RPUs in it qom/cpu: Add cluster_index to CPUState
accel/tcg: Add cluster number to TCG TB hash
gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index
Richard Henderson (1):
target/arm: Fix validation of 32-bit address spaces for aa32
Stefan Hajnoczi (3):
tests/microbit-test: add TWI stub device test
MAINTAINERS: update microbit ARM board files
memory: add memory_region_flush_rom_device()
Steffen Görtz (4):
arm: Stub out NRF51 TWI magnetometer/accelerometer detection hw/nvram/nrf51_nvm: Add nRF51 non-volatile memories
arm: Instantiate NRF51 special NVM's and NVMC tests/microbit-test: Add tests for nRF51 NVMC
Thomas Roth (1):
target/arm: v8m: Ensure IDAU is respected if SAU is disabled
hw/i2c/Makefile.objs | 1 + hw/nvram/Makefile.objs | 1 + include/exec/exec-all.h | 4 +- include/exec/memory.h | 18 ++ include/hw/arm/nrf51.h | 2 + include/hw/arm/nrf51_soc.h | 3 + include/hw/cpu/cluster.h | 24 +++ include/hw/i2c/microbit_i2c.h | 42 ++++ include/hw/nvram/nrf51_nvm.h | 64 ++++++ include/hw/ssi/aspeed_smc.h | 3 + include/qom/cpu.h | 7 + target/arm/cpu.h | 11 +- tests/libqtest.h | 11 + accel/tcg/cpu-exec.c | 3 + accel/tcg/translate-all.c | 3 + accel/tcg/user-exec.c | 66 ++++-- exec.c | 19 +- gdbstub.c | 120 +++++------ hw/arm/microbit.c | 16 ++ hw/arm/nrf51_soc.c | 41 ++-- hw/arm/xlnx-zynqmp.c | 9 +- hw/cpu/cluster.c | 46 +++++ hw/i2c/microbit_i2c.c | 127 ++++++++++++ hw/nvram/nrf51_nvm.c | 381 +++++++++++++++++++++++++++++++++++ hw/ssi/aspeed_smc.c | 128 +++++++++++- qom/cpu.c | 1 + target/arm/cpu.c | 3 +- target/arm/helper.c | 67 +++--- tests/libqtest.c | 25 +++ tests/microbit-test.c | 458 ++++++++++++++++++++++++++++++++---------- MAINTAINERS | 8 +- scripts/checkpatch.pl | 2 +- 32 files changed, 1459 insertions(+), 255 deletions(-) create mode 100644 include/hw/i2c/microbit_i2c.h create mode 100644 include/hw/nvram/nrf51_nvm.h create mode 100644 hw/i2c/microbit_i2c.c create mode 100644 hw/nvram/nrf51_nvm.c
[Qemu-devel] [PULL 01/26] target/arm: Fix validation of 32-bit address spaces for aa32
From: Richard Henderson <[email protected]>
When tsz == 0, aarch32 selects the address space via exclusion, and there are no "top_bits" remaining that require validation.
Message-id: [email protected]
--- target/arm/helper.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
target/arm/helper.c +13 -6
@@ -10447,7 +10447,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,uint64_t ttbr;hwaddr descaddr, indexmask, indexmask_grainsize;uint32_t tableattrs; -target_ulong page_size, top_bits; +target_ulong page_size;uint32_t attrs;int32_t stride;int addrsize, inputsize;
@@ -10487,12 +10487,19 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,* We determined the region when collecting the parameters, but we * have not yet validated that the address is valid for the region. * Extract the top bits and verify that they all match select. +* +* For aa32, if inputsize == addrsize, then we have selected the +* region by exclusion in aa32_va_parameters and there is no more +* validation to do here. */ - top_bits =sextract64 (address, inputsize, addrsize - inputsize); -if (-top_bits != param.select || (param.select && !ttbr1_valid)) { -/* In the gap between the two regions, this is a Translation fault */ - fault_type = ARMFault_Translation; - goto do_fault; +if (inputsize < addrsize) { +target_ulong top_bits =sextract64 (address, inputsize, + addrsize - inputsize); +if (-top_bits != param.select || (param.select && !ttbr1_valid)) { +/* The gap between the two regions is a Translation fault */ + fault_type = ARMFault_Translation; + goto do_fault; + } }if (param.using64k) {
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 03/26] gdbstub: fix gdb_get_cpu(s, pid, tid) when pid and/or tid are 0
In reply to Peter MaydellFrom: Luc Michel <[email protected]>
a TID or PID value means "any thread" (resp. "any process"). This commit fixes the different combinations when at least one value is 0.
When both are 0, the function now returns the first attached CPU, instead of the CPU with TID 1, which is not necessarily attached or even existent.
When PID is specified but TID is 0, the function returns the first CPU in the process, or NULL if the process does not exist or is not attached.
In other cases, it returns the corresponding CPU, while ignoring the PID check when PID is 0.
Message-id: [email protected]
--- gdbstub.c | 72 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 29 deletions(-)
gdbstub.c +43 -29
@@ -756,35 +756,6 @@ static CPUState *gdb_next_cpu_in_process(const GDBState *s, CPUState *cpu)return cpu; } -static CPUState *gdb_get_cpu (const GDBState *s,uint32_t pid,uint32_t tid) -{ -GDBProcess *process; -CPUState *cpu; - -if (!tid) { -/* 0 means any thread, we take the first one */ - tid =1 ; - } - - cpu =find_cpu (tid); - -if (cpu ==NULL ) { -return NULL ; - } - - process =gdb_get_cpu_process (s, cpu); - -if (process->pid != pid) { -return NULL ; - } - -if (!process->attached) { -return NULL ; - } - -return cpu; -} -/* Return the cpu following @cpu, while ignoring unattached processes. */ static CPUState *gdb_next_attached_cpu (const GDBState *s,CPUState *cpu) {
@@ -814,6 +785,49 @@ static CPUState *gdb_first_attached_cpu(const GDBState *s)return cpu; } +static CPUState *gdb_get_cpu (const GDBState *s,uint32_t pid,uint32_t tid) +{ +GDBProcess *process; +CPUState *cpu; + +if (!pid && !tid) { +/* 0 means any process/thread, we take the first attached one */ +return gdb_first_attached_cpu (s); + }else if (pid && !tid) { +/* any thread in a specific process */ + process =gdb_get_process (s, pid); + +if (process ==NULL ) { +return NULL ; + } + +if (!process->attached) { +return NULL ; + } + +return get_first_cpu_in_process (s, process); + }else { +/* a specific thread */ + cpu =find_cpu (tid); + +if (cpu ==NULL ) { +return NULL ; + } + + process =gdb_get_cpu_process (s, cpu); + +if (pid && process->pid != pid) { +return NULL ; + } + +if (!process->attached) { +return NULL ; + } + +return cpu; + } +} +static const char *get_feature_xml (const GDBState *s,const char *p,const char **newp,GDBProcess *process) {
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 02/26] target/arm: v8m: Ensure IDAU is respected if SAU is disabled
In reply to Peter MaydellFrom: Thomas Roth <[email protected]>
The current behavior of v8m_security_lookup in helper.c only checks whether the IDAU specifies a higher security if the SAU is enabled. If SAU.ALLNS is set to 1, this will lead to addresses being treated as non-secure, even though the IDAU indicates that they must be secure.
This patch changes the behavior to also check the IDAU if the SAU is currently disabled.
(This brings the behaviour here into line with the v8M Arm ARM SecurityCheck() pseudocode.)
Message-id: CAGGekkuc+-tvp5RJP7CM+Jy_hJF7eiRHZ96132sb=hPPCappKg@mail.gmail.com
--- target/arm/helper.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
target/arm/helper.c +11 -10
@@ -11078,18 +11078,19 @@ static void v8m_security_lookup(CPUARMState *env, uint32_t address, } } } - -/* The IDAU will override the SAU lookup results if it specifies -* higher security than the SAU does. -*/ -if (!idau_ns) { -if (sattrs->ns || (!idau_nsc && sattrs->nsc)) { - sattrs->ns = false; - sattrs->nsc = idau_nsc; - } - }break ; } + +/* +* The IDAU will override the SAU lookup results if it specifies +* higher security than the SAU does. +*/ +if (!idau_ns) { +if (sattrs->ns || (!idau_nsc && sattrs->nsc)) { + sattrs->ns = false; + sattrs->nsc = idau_nsc; + } + } } static bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 06/26] exec.c: Use correct attrs in cpu_memory_rw_debug()
In reply to Peter MaydellIn the softmmu version of cpu_memory_rw_debug(), we ask the CPU for the attributes to use for the virtual memory access, and we correctly use those to identify the address space index. However, we were not passing them in to the address_space_write_rom() and address_space_rw() functions.
The effect of this was that a memory access from the gdbstub to a device which had behaviour that was sensitive to the memory attributes (such as some ARMv8M NVIC registers) was incorrectly always performed as if non-secure, rather than using the right security state for the CPU's current state.
Message-id: [email protected]
--- exec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
exec.c +2 -4
@@ -3882,12 +3882,10 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr, phys_addr += (addr & ~TARGET_PAGE_MASK );if (is_write) {address_space_write_rom (cpu->cpu_ases[asidx].as, phys_addr, -MEMTXATTRS_UNSPECIFIED , - buf, l); + attrs, buf, l); }else {address_space_rw (cpu->cpu_ases[asidx].as, phys_addr, -MEMTXATTRS_UNSPECIFIED , - buf, l,0 ); + attrs, buf, l,0 ); } len -= l; buf += l;
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 05/26] tests/microbit-test: add TWI stub device test
In reply to Peter MaydellFrom: Stefan Hajnoczi <[email protected]>
This test verifies that we read back the expected I2C WHO_AM_I register values for the accelerometer/magnetometer.
Message-id: [email protected]
--- tests/microbit-test.c | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
tests/microbit-test.c +44 -0
@@ -21,6 +21,49 @@#include "hw/arm/nrf51.h" #include "hw/gpio/nrf51_gpio.h" #include "hw/timer/nrf51_timer.h" +#include "hw/i2c/microbit_i2c.h" + +/* Read a byte from I2C device at @addr from register @reg */ +static uint32_t i2c_read_byte (uint32_t addr,uint32_t reg) +{ +uint32_t val; + +writel (NRF51_TWI_BASE +NRF51_TWI_REG_ADDRESS , addr); +writel (NRF51_TWI_BASE +NRF51_TWI_TASK_STARTTX ,1 ); +writel (NRF51_TWI_BASE +NRF51_TWI_REG_TXD , reg); + val =readl (NRF51_TWI_BASE +NRF51_TWI_EVENT_TXDSENT ); + g_assert_cmpuint(val, ==, 1); +writel (NRF51_TWI_BASE +NRF51_TWI_TASK_STOP ,1 ); + +writel (NRF51_TWI_BASE +NRF51_TWI_TASK_STARTRX ,1 ); + val =readl (NRF51_TWI_BASE +NRF51_TWI_EVENT_RXDREADY ); + g_assert_cmpuint(val, ==, 1); + val =readl (NRF51_TWI_BASE +NRF51_TWI_REG_RXD ); +writel (NRF51_TWI_BASE +NRF51_TWI_TASK_STOP ,1 ); + +return val; +} + +static void test_microbit_i2c (void ) +{ +uint32_t val; + +/* We don't program pins/irqs but at least enable the device */ +writel (NRF51_TWI_BASE +NRF51_TWI_REG_ENABLE ,5 ); + +/* MMA8653 magnetometer detection */ + val =i2c_read_byte (0x3A ,0x0D ); + g_assert_cmpuint(val, ==, 0x5A); + + val =i2c_read_byte (0x3A ,0x0D ); + g_assert_cmpuint(val, ==, 0x5A); + +/* LSM303 accelerometer detection */ + val =i2c_read_byte (0x3C ,0x4F ); + g_assert_cmpuint(val, ==, 0x40); + +writel (NRF51_TWI_BASE +NRF51_TWI_REG_ENABLE ,0 ); +}static void test_nrf51_gpio (void ) {
@@ -247,6 +290,7 @@ int main(int argc, char **argv)qtest_add_func ("/microbit/nrf51/gpio" , test_nrf51_gpio);qtest_add_func ("/microbit/nrf51/timer" , test_nrf51_timer); +qtest_add_func ("/microbit/microbit/i2c" , test_microbit_i2c); ret =g_test_run ();
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 07/26] accel/tcg/user-exec: Don't parse aarch64 insns to test for read vs write
In reply to Peter MaydellIn cpu_signal_handler() for aarch64 hosts, currently we parse the faulting instruction to see if it is a load or a store. Since the 3.16 kernel (~2014), the kernel has provided us with the syndrome register for a fault, which includes the WnR bit. Use this instead if it is present, only falling back to instruction parsing if not.
Message-id: [email protected]
--- accel/tcg/user-exec.c | 66 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 14 deletions(-)
accel/tcg/user-exec.c +52 -14
@@ -479,28 +479,66 @@ int cpu_signal_handler(int host_signum, void *pinfo,#elif defined(__aarch64__) +#ifndef ESR_MAGIC +/* Pre-3.16 kernel headers don't have these, so provide fallback definitions */ +#define ESR_MAGIC 0x45535201 +struct esr_context { +struct _aarch64_ctx head; +uint64_t esr; +}; +#endif + +static inline struct _aarch64_ctx *first_ctx (ucontext_t *uc) +{ +return (struct _aarch64_ctx *)&uc->uc_mcontext.__reserved; +} + +static inline struct _aarch64_ctx *next_ctx (struct _aarch64_ctx *hdr) +{ +return (struct _aarch64_ctx *)((char *)hdr + hdr->size); +} +int cpu_signal_handler (int host_signum,void *pinfo,void *puc) {siginfo_t *info = pinfo;ucontext_t *uc = puc;uintptr_t pc = uc->uc_mcontext.pc; -uint32_t insn = *(uint32_t *)pc;bool is_write; +struct _aarch64_ctx *hdr; +struct esr_context const *esrctx =NULL ; -/* XXX: need kernel patch to get write flag faster. */ - is_write = ( (insn &0xbfff0000 ) ==0x0c000000 /* C3.3.1 */ - || (insn &0xbfe00000 ) ==0x0c800000 /* C3.3.2 */ - || (insn &0xbfdf0000 ) ==0x0d000000 /* C3.3.3 */ - || (insn &0xbfc00000 ) ==0x0d800000 /* C3.3.4 */ - || (insn &0x3f400000 ) ==0x08000000 /* C3.3.6 */ - || (insn &0x3bc00000 ) ==0x39000000 /* C3.3.13 */ - || (insn &0x3fc00000 ) ==0x3d800000 /* ... 128bit */ -/* Ingore bits 10, 11 & 21, controlling indexing. */ - || (insn &0x3bc00000 ) ==0x38000000 /* C3.3.8-12 */ - || (insn &0x3fe00000 ) ==0x3c800000 /* ... 128bit */ -/* Ignore bits 23 & 24, controlling indexing. */ - || (insn &0x3a400000 ) ==0x28000000 );/* C3.3.7,14-16 */ +/* Find the esr_context, which has the WnR bit in it */ +for (hdr =first_ctx (uc); hdr->magic; hdr =next_ctx (hdr)) { +if (hdr->magic ==ESR_MAGIC ) { + esrctx = (struct esr_context const *)hdr; +break ; + } + } +if (esrctx) { +/* For data aborts ESR.EC is 0b10010x: then bit 6 is the WnR bit */ +uint64_t esr = esrctx->esr; + is_write =extract32 (esr,27 ,5 ) ==0x12 &&extract32 (esr,6 ,1 ) ==1 ; + }else { +/* +* Fall back to parsing instructions; will only be needed +* for really ancient (pre-3.16) kernels. +*/ +uint32_t insn = *(uint32_t *)pc; + + is_write = ((insn &0xbfff0000 ) ==0x0c000000 /* C3.3.1 */ + || (insn &0xbfe00000 ) ==0x0c800000 /* C3.3.2 */ + || (insn &0xbfdf0000 ) ==0x0d000000 /* C3.3.3 */ + || (insn &0xbfc00000 ) ==0x0d800000 /* C3.3.4 */ + || (insn &0x3f400000 ) ==0x08000000 /* C3.3.6 */ + || (insn &0x3bc00000 ) ==0x39000000 /* C3.3.13 */ + || (insn &0x3fc00000 ) ==0x3d800000 /* ... 128bit */ +/* Ignore bits 10, 11 & 21, controlling indexing. */ + || (insn &0x3bc00000 ) ==0x38000000 /* C3.3.8-12 */ + || (insn &0x3fe00000 ) ==0x3c800000 /* ... 128bit */ +/* Ignore bits 23 & 24, controlling indexing. */ + || (insn &0x3a400000 ) ==0x28000000 );/* C3.3.7,14-16 */ + }return handle_cpu_signal (pc, info, is_write, &uc->uc_sigmask); }
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 08/26] MAINTAINERS: update microbit ARM board files
In reply to Peter MaydellFrom: Stefan Hajnoczi <[email protected]>
New source files were added without corresponding ./MAINTAINERS file entries. Let's get things up to date.
Message-id: [email protected]
--- MAINTAINERS | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
MAINTAINERS +5 -3
@@ -829,9 +829,11 @@ M: Joel Stanley <[email protected]> M: Peter Maydell <[email protected]> L: [email protected] S: Maintained -F: hw/arm/nrf51_soc.c -F: hw/arm/microbit.c -F: include/hw/arm/nrf51_soc.h +F: hw/*/nrf51*.c +F: hw/*/microbit*.c +F: include/hw/*/nrf51*.h +F: include/hw/*/microbit*.h +F: tests/microbit-test.c CRIS Machines -------------
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 09/26] target/arm: Don't clear supported PMU events when initializing PMCEID1
In reply to Peter MaydellFrom: Aaron Lindsay OS <[email protected]>
A bug was introduced during a respin of:
commit 57a4a11b2b281bb548b419ca81bfafb214e4c77a target/arm: Add array for supported PMU events, generate PMCEID[01]_EL0
This patch introduced two calls to get_pmceid() during CPU initialization - one each for PMCEID0 and PMCEID1. In addition to building the register values, get_pmceid() clears an internal array mapping event numbers to their implementations (supported_event_map) before rebuilding it. This is an optimization since much of the logic is shared. However, since it was called twice, the contents of supported_event_map reflect only the events in PMCEID1 (the second call to get_pmceid()).
Fix this bug by moving the initialization of PMCEID0 and PMCEID1 back into a single function call, and name it more appropriately since it is doing more than simply generating the contents of the PMCEID[01] registers.
Message-id: [email protected]
--- target/arm/cpu.h | 11 +++++------ target/arm/cpu.c | 3 +-- target/arm/helper.c | 27 ++++++++++++++++----------- 3 files changed, 22 insertions(+), 19 deletions(-)
target/arm/cpu.h +5 -6
@@ -1012,14 +1012,13 @@ void pmu_pre_el_change(ARMCPU *cpu, void *ignored);void pmu_post_el_change (ARMCPU *cpu,void *ignored);/* -* get_pmceid -* @env: CPUARMState -* @which: which PMCEID register to return (0 or 1) +* pmu_init +* @cpu: ARMCPU * -* Return the PMCEID[01]_EL0 register values corresponding to the counters -* which are supported given the current configuration +* Initialize the CPU's PMCEID[01]_EL0 registers and associated internal state +* for the current configuration */ -uint64_t get_pmceid (CPUARMState *env,unsigned which); +void pmu_init (ARMCPU *cpu);/* SCTLR bit meanings. Several bits have been reused in newer * versions of the architecture; in that case we define constants
target/arm/cpu.c +1 -2
@@ -1039,8 +1039,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)unset_feature (env,ARM_FEATURE_PMU ); }if (arm_feature (env,ARM_FEATURE_PMU )) { - cpu->pmceid0 =get_pmceid (&cpu->env,0 ); - cpu->pmceid1 =get_pmceid (&cpu->env,1 ); +pmu_init (cpu);if (!kvm_enabled ()) {arm_register_pre_el_change_hook (cpu, &pmu_pre_el_change,0 );
target/arm/helper.c +16 -11
@@ -1090,22 +1090,24 @@ static const pm_event pm_events[] = {static uint16_t supported_event_map[MAX_EVENT_ID +1 ];/* -* Called upon initialization to build PMCEID0_EL0 or PMCEID1_EL0 (indicated by -* 'which'). We also use it to build a map of ARM event numbers to indices in -* our pm_events array. +* Called upon CPU initialization to initialize PMCEID[01]_EL0 and build a map +* of ARM event numbers to indices in our pm_events array. * * Note: Events in the 0x40XX range are not currently supported. */ -uint64_t get_pmceid (CPUARMState *env,unsigned which) +void pmu_init (ARMCPU *cpu) { -uint64_t pmceid =0 ;unsigned int i; -assert (which <=1 ); - +/* +* Empty supported_event_map and cpu->pmceid[01] before adding supported +* events to them +*/ for (i =0 ; i <ARRAY_SIZE (supported_event_map); i++) { supported_event_map[i] =UNSUPPORTED_EVENT ; } + cpu->pmceid0 =0 ; + cpu->pmceid1 =0 ;for (i =0 ; i <ARRAY_SIZE (pm_events); i++) {const pm_event *cnt = &pm_events[i];
@@ -1113,13 +1115,16 @@ uint64_t get_pmceid(CPUARMState *env, unsigned which)/* We do not currently support events in the 0x40xx range */ assert (cnt->number <=0x3f ); -if ((cnt->number &0x20 ) == (which <<6 ) && - cnt->supported (env)) { - pmceid |= (1 << (cnt->number &0x1f )); +if (cnt->supported (&cpu->env)) { supported_event_map[cnt->number] = i; +uint64_t event_mask =1 << (cnt->number &0x1f ); +if (cnt->number &0x20 ) { + cpu->pmceid1 |= event_mask; + }else { + cpu->pmceid0 |= event_mask; + } } } -return pmceid; }/*
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PULL 09/26] target/arm: Don't clear supported PMU events when initializing PMCEID1
Quoted 11 lines · Peter Maydell
From: Aaron Lindsay OS <[email protected]>
A bug was introduced during a respin of:
commit
57a4a11b2b281bb548b419ca81bfafb214e4c77atarget/arm: Add array for supported PMU events, generate PMCEID[01]_EL0
target/arm/helper.c uint64_t get_pmceid(CPUARMState *env, unsigned which) · line 1120
Quoted 9 lines
target/arm/helper.c +2
-3@@ -1113,13 +1115,16 @@ uint64_t get_pmceid(CPUARMState *env, unsigned which)/* We do not currently support events in the 0x40xx range */ assert (cnt->number <=0x3f ); -if ((cnt->number &0x20 ) == (which <<6 ) && - cnt->supported (env)) { - pmceid |= (1 << (cnt->number &0x1f )); +if (cnt->supported (&cpu->env)) { supported_event_map[cnt->number] = i; +uint64_t event_mask =1 << (cnt->number &0x1f );
Coverity complains about this line (CID 1398645). The RHS is evaluated using 32-bit signed arithmetic (because cnt->number is uint16_t and so integer promotion means it ends up working with the 'int' type. If cnt->number is 31 then this means that the assignment will do an unintended sign-extension that sets the top 32 bits of event_mask.
Fix is probably just to use "1ULL" instead of "1" on the LHS of <<.
target/arm/helper.c uint64_t get_pmceid(CPUARMState *env, unsigned which) · line 1128
Quoted 9 lines
target/arm/helper.c +5
-1+if (cnt->number &0x20 ) { + cpu->pmceid1 |= event_mask; + }else { + cpu->pmceid0 |= event_mask; + } } } -return pmceid; }
thanks
-- PMM
Re: [Qemu-devel] [PULL 09/26] target/arm: Don't clear supported PMU events when initializing PMCEID1
Quoted 30 lines · Peter Maydell
Quoted 11 lines · Peter Maydell
From: Aaron Lindsay OS <[email protected]>
A bug was introduced during a respin of:
commit
57a4a11b2b281bb548b419ca81bfafb214e4c77atarget/arm: Add array for supported PMU events, generate PMCEID[01]_EL0target/arm/helper.c uint64_t get_pmceid(CPUARMState *env, unsigned which) · line 1120
Quoted 9 lines
target/arm/helper.c +2
-3@@ -1113,13 +1115,16 @@ uint64_t get_pmceid(CPUARMState *env, unsigned which)/* We do not currently support events in the 0x40xx range */ assert (cnt->number <=0x3f ); -if ((cnt->number &0x20 ) == (which <<6 ) && - cnt->supported (env)) { - pmceid |= (1 << (cnt->number &0x1f )); +if (cnt->supported (&cpu->env)) { supported_event_map[cnt->number] = i; +uint64_t event_mask =1 << (cnt->number &0x1f );Coverity complains about this line (CID 1398645). The RHS is evaluated using 32-bit signed arithmetic (because
cnt->numberisuint16_tand so integer promotion means it ends up working with the 'int' type. Ifcnt->numberis 31 then this means that the assignment will do an unintended sign-extension that sets the top 32 bits ofevent_mask.
Quoted 1 line
Fix is probably just to use "1ULL" instead of "1" on the LHS of <<.
I registered for a Coverity account and am awaiting approval for adding me to the QEMU project so I can test this myself (let me know if this isn't the right way to go about this).
Would you prefer I wait until I'm able to test that this is resolved myself, or just submit a patch and have you test it?
-Aaron
Re: [Qemu-devel] [PULL 09/26] target/arm: Don't clear supported PMU events when initializing PMCEID1
Quoted 6 lines · Aaron Lindsay OS
I registered for a Coverity account and am awaiting approval for adding me to the QEMU project so I can test this myself (let me know if this isn't the right way to go about this).
Would you prefer I wait until I'm able to test that this is resolved myself, or just submit a patch and have you test it?
You should just submit a patch. Coverity runs only on the git master, so until your patch is in master it won't get retested. Having an account with the coverity scan website is useful mostly for looking at reports in more detail, or for those enthusiastic to actively go triaging and fixing things.
thanks
-- PMM
Re: [Qemu-devel] [PULL 09/26] target/arm: Don't clear supported PMU events when initializing PMCEID1
Quoted 9 lines · Peter Maydell
Quoted 6 lines · Aaron Lindsay OS
I registered for a Coverity account and am awaiting approval for adding me to the QEMU project so I can test this myself (let me know if this isn't the right way to go about this).
Would you prefer I wait until I'm able to test that this is resolved myself, or just submit a patch and have you test it?
Quoted 6 lines
You should just submit a patch. Coverity runs only on the git master, so until your patch is in master it won't get retested. Having an account with the coverity scan website is useful mostly for looking at reports in more detail, or for those enthusiastic to actively go triaging and fixing things.
Ah, okay. I'll send a patch out shortly.
-Aaron
[Qemu-devel] [PULL 10/26] memory: add memory_region_flush_rom_device()
In reply to Peter MaydellFrom: Stefan Hajnoczi <[email protected]>
ROM devices go via MemoryRegionOps->write() callbacks for write operations and do not dirty/invalidate that memory. Device emulation must be able to mark memory ranges that have been modified internally (e.g. using memory_region_get_ram_ptr()).
Introduce the memory_region_flush_rom_device() API for this purpose.
Message-id: [email protected]
--- include/exec/memory.h | 18 ++++++++++++++++++ exec.c | 13 +++++++++++++ 2 files changed, 31 insertions(+)
include/exec/memory.h +18 -0
@@ -1344,6 +1344,24 @@ bool memory_region_snapshot_get_dirty(MemoryRegion *mr,void memory_region_reset_dirty (MemoryRegion *mr,hwaddr addr,hwaddr size,unsigned client); +/** +* memory_region_flush_rom_device: Mark a range of pages dirty and invalidate +* TBs (for self-modifying code). +* +* The MemoryRegionOps->write() callback of a ROM device must use this function +* to mark byte ranges that have been modified internally, such as by directly +* accessing the memory returned by memory_region_get_ram_ptr(). +* +* This function marks the range dirty and invalidates TBs so that TCG can +* detect self-modifying code. +* +* @mr: the region being flushed. +* @addr: the start, relative to the start of the region, of the range being +* flushed. +* @size: the size, in bytes, of the range being flushed. +*/ +void memory_region_flush_rom_device (MemoryRegion *mr,hwaddr addr,hwaddr size); +/** * memory_region_set_readonly: Turn a memory region read-only (or read-write) *
exec.c +13 -0
@@ -3162,6 +3162,19 @@ static void invalidate_and_set_dirty(MemoryRegion *mr, hwaddr addr,cpu_physical_memory_set_dirty_range (addr, length, dirty_log_mask); } +void memory_region_flush_rom_device (MemoryRegion *mr,hwaddr addr,hwaddr size) +{ +/* +* In principle this function would work on other memory region types too, +* but the ROM device use case is the only one where this operation is +* necessary. Other memory regions should use the +* address_space_read/write() APIs. +*/ +assert (memory_region_is_romd (mr)); + +invalidate_and_set_dirty (mr, addr, size); +} +static int memory_access_size (MemoryRegion *mr,unsigned l,hwaddr addr) {unsigned access_size_max = mr->ops->valid.max_access_size;
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 04/26] arm: Stub out NRF51 TWI magnetometer/accelerometer detection
In reply to Peter MaydellFrom: Steffen Görtz <[email protected]>
Recent microbit firmwares panic if the TWI magnetometer/accelerometer devices are not detected during startup. We don't implement TWI (I2C) so let's stub out these devices just to let the firmware boot.
Signed-off by: Steffen Görtz <[email protected]>
Message-id: [email protected]
--- hw/i2c/Makefile.objs | 1 + include/hw/arm/nrf51.h | 2 + include/hw/arm/nrf51_soc.h | 1 + include/hw/i2c/microbit_i2c.h | 42 +++++++++++ hw/arm/microbit.c | 16 +++++ hw/i2c/microbit_i2c.c | 127 ++++++++++++++++++++++++++++++++++ 6 files changed, 189 insertions(+) create mode 100644 include/hw/i2c/microbit_i2c.h create mode 100644 hw/i2c/microbit_i2c.c
hw/i2c/Makefile.objs +1 -0
@@ -7,5 +7,6 @@ common-obj-$(CONFIG_BITBANG_I2C) += bitbang_i2c.o common-obj-$(CONFIG_EXYNOS4) += exynos4210_i2c.o common-obj-$(CONFIG_IMX_I2C) += imx_i2c.o common-obj-$(CONFIG_ASPEED_SOC) += aspeed_i2c.o +common-obj-$(CONFIG_NRF51_SOC) += microbit_i2c.o obj-$(CONFIG_OMAP) += omap_i2c.o obj-$(CONFIG_PPC4XX) += ppc4xx_i2c.o
include/hw/arm/nrf51.h +2 -0
@@ -25,6 +25,8 @@#define NRF51_IOMEM_SIZE 0x20000000#define NRF51_UART_BASE 0x40002000 +#define NRF51_TWI_BASE 0x40003000 +#define NRF51_TWI_SIZE 0x00001000#define NRF51_TIMER_BASE 0x40008000#define NRF51_TIMER_SIZE 0x00001000#define NRF51_RNG_BASE 0x4000D000
include/hw/arm/nrf51_soc.h +1 -0
@@ -39,6 +39,7 @@ typedef struct NRF51State {MemoryRegion sram;MemoryRegion flash;MemoryRegion clock; +MemoryRegion twi;uint32_t sram_size;uint32_t flash_size;
include/hw/i2c/microbit_i2c.h new file +42 -0
42 lines not on this page · raw message
hw/arm/microbit.c +16 -0
@@ -16,11 +16,13 @@#include "exec/address-spaces.h" #include "hw/arm/nrf51_soc.h" +#include "hw/i2c/microbit_i2c.h" typedef struct {MachineState parent;NRF51State nrf51; +MicrobitI2CState i2c; }MicrobitMachineState ;#define TYPE_MICROBIT_MACHINE MACHINE_TYPE_NAME("microbit")
@@ -32,7 +34,9 @@ static void microbit_init(MachineState *machine) {MicrobitMachineState *s =MICROBIT_MACHINE (machine);MemoryRegion *system_memory =get_system_memory (); +MemoryRegion *mr;Object *soc =OBJECT (&s->nrf51); +Object *i2c =OBJECT (&s->i2c);sysbus_init_child_obj (OBJECT (machine),"nrf51" , soc,sizeof (s->nrf51),TYPE_NRF51_SOC );
@@ -41,6 +45,18 @@ static void microbit_init(MachineState *machine) &error_fatal);object_property_set_bool (soc, true,"realized" , &error_fatal); +/* +* Overlap the TWI stub device into the SoC. This is a microbit-specific +* hack until we implement the nRF51 TWI controller properly and the +* magnetometer/accelerometer devices. +*/ +sysbus_init_child_obj (OBJECT (machine),"microbit.twi" , i2c, +sizeof (s->i2c),TYPE_MICROBIT_I2C ); +object_property_set_bool (i2c, true,"realized" , &error_fatal); + mr =sysbus_mmio_get_region (SYS_BUS_DEVICE (i2c),0 ); +memory_region_add_subregion_overlap (&s->nrf51.container,NRF51_TWI_BASE , + mr,-1 ); +armv7m_load_kernel (ARM_CPU (first_cpu), machine->kernel_filename,NRF51_SOC (soc)->flash_size); }
hw/i2c/microbit_i2c.c new file +127 -0
127 lines not on this page · raw message
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 12/26] arm: Instantiate NRF51 special NVM's and NVMC
In reply to Peter MaydellFrom: Steffen Görtz <[email protected]>
Instantiates UICR, FICR, FLASH and NVMC in nRF51 SOC.
Message-id: [email protected]
--- include/hw/arm/nrf51_soc.h | 2 ++ hw/arm/nrf51_soc.c | 41 +++++++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 12 deletions(-)
include/hw/arm/nrf51_soc.h +2 -0
@@ -15,6 +15,7 @@#include "hw/char/nrf51_uart.h" #include "hw/misc/nrf51_rng.h" #include "hw/gpio/nrf51_gpio.h" +#include "hw/nvram/nrf51_nvm.h" #include "hw/timer/nrf51_timer.h" #define TYPE_NRF51_SOC "nrf51-soc"
@@ -32,6 +33,7 @@ typedef struct NRF51State {NRF51UARTState uart;NRF51RNGState rng; +NRF51NVMState nvm;NRF51GPIOState gpio;NRF51TimerState timer[NRF51_NUM_TIMERS ];
hw/arm/nrf51_soc.c +29 -12
71 lines not on this page · raw message
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 11/26] hw/nvram/nrf51_nvm: Add nRF51 non-volatile memories
In reply to Peter MaydellFrom: Steffen Görtz <[email protected]>
The nRF51 contains three regions of non-volatile memory (NVM):
- CODE (R/W): contains code
- FICR (R): Factory information like code size, chip id etc.
- UICR (R/W): Changeable configuration data. Lock bits, Code protection configuration, Bootloader address, Nordic SoftRadio configuration, Firmware configuration.
Read and write access to the memories is managed by the Non-volatile memory controller.
Memory schema:
[ CPU ] -+- [ NVM, either FICR, UICR or CODE ]
| |
\- [ NVMC ]Message-id: [email protected]
--- hw/nvram/Makefile.objs | 1 + include/hw/nvram/nrf51_nvm.h | 64 ++++++ hw/nvram/nrf51_nvm.c | 381 +++++++++++++++++++++++++++++++++++ 3 files changed, 446 insertions(+) create mode 100644 include/hw/nvram/nrf51_nvm.h create mode 100644 hw/nvram/nrf51_nvm.c
hw/nvram/Makefile.objs +1 -0
@@ -5,3 +5,4 @@ common-obj-y += fw_cfg.o common-obj-y += chrp_nvram.o common-obj-$(CONFIG_MAC_NVRAM) += mac_nvram.o obj-$(CONFIG_PSERIES) += spapr_nvram.o +obj-$(CONFIG_NRF51_SOC) += nrf51_nvm.o
include/hw/nvram/nrf51_nvm.h new file +64 -0
64 lines not on this page · raw message
hw/nvram/nrf51_nvm.c new file +381 -0
381 lines not on this page · raw message
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 13/26] tests/libqtest: Introduce qtest_init_with_serial()
In reply to Peter MaydellFrom: Julia Suvorova <[email protected]>
Run qtest with a socket that connects QEMU chardev and test code.
Message-id: [email protected]
--- tests/libqtest.h | 11 +++++++++++ tests/libqtest.c | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+)
tests/libqtest.h +11 -0
@@ -62,6 +62,17 @@ QTestState *qtest_init(const char *extra_args);*/ QTestState *qtest_init_without_qmp_handshake (const char *extra_args); +/** +* qtest_init_with_serial: +* @extra_args: other arguments to pass to QEMU. CAUTION: these +* arguments are subject to word splitting and shell evaluation. +* @sock_fd: pointer to store the socket file descriptor for +* connection with serial. +* +* Returns: #QTestState instance. +*/ +QTestState *qtest_init_with_serial (const char *extra_args,int *sock_fd); +/** * qtest_quit: * @s: #QTestState instance to operate on.
tests/libqtest.c +25 -0
@@ -315,6 +315,31 @@ QTestState *qtest_initf(const char *fmt, ...)return s; } +QTestState *qtest_init_with_serial (const char *extra_args,int *sock_fd) +{ +int sock_fd_init; +char *sock_path, sock_dir[] ="/tmp/qtest-serial-XXXXXX" ; +QTestState *qts; + +g_assert_true (mkdtemp (sock_dir) !=NULL ); + sock_path =g_strdup_printf ("%s/sock" , sock_dir); + + sock_fd_init =init_socket (sock_path); + + qts =qtest_initf ("-chardev socket,id=s0,path=%s -serial chardev:s0 %s" , + sock_path, extra_args); + + *sock_fd =socket_accept (sock_fd_init); + +unlink (sock_path); +g_free (sock_path); +rmdir (sock_dir); + +g_assert_true (*sock_fd >=0 ); + +return qts; +} +void qtest_quit (QTestState *s) {g_hook_destroy_link (&abrt_hooks,g_hook_find_data (&abrt_hooks, TRUE, s));
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 15/26] tests/microbit-test: Check nRF51 UART functionality
In reply to Peter MaydellFrom: Julia Suvorova <[email protected]>
Some functional tests for:
Basic reception/transmittion
Suspending
INTEN* registers
Message-id: [email protected]
--- tests/microbit-test.c | 89 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+)
tests/microbit-test.c +89 -0
@@ -19,10 +19,98 @@#include "libqtest.h" #include "hw/arm/nrf51.h" +#include "hw/char/nrf51_uart.h" #include "hw/gpio/nrf51_gpio.h" #include "hw/timer/nrf51_timer.h" #include "hw/i2c/microbit_i2c.h" +static bool uart_wait_for_event (QTestState *qts,uint32_t event_addr) +{ +time_t now, start =time (NULL ); + +while (true) { +if (qtest_readl (qts, event_addr) ==1 ) { +qtest_writel (qts, event_addr,0x00 ); +return true; + } + +/* Wait at most 10 minutes */ + now =time (NULL ); +if (now - start >600 ) { +break ; + } +g_usleep (10000 ); + } + +return false; +} + +static void uart_rw_to_rxd (QTestState *qts,int sock_fd,const char *in, +char *out) +{ +int i, in_len =strlen (in); + +g_assert_true (write (sock_fd, in, in_len) == in_len); +for (i =0 ; i < in_len; i++) { +g_assert_true (uart_wait_for_event (qts,NRF51_UART_BASE + +A_UART_RXDRDY )); + out[i] =qtest_readl (qts,NRF51_UART_BASE +A_UART_RXD ); + } + out[i] ='\0' ; +} + +static void uart_w_to_txd (QTestState *qts,const char *in) +{ +int i, in_len =strlen (in); + +for (i =0 ; i < in_len; i++) { +qtest_writel (qts,NRF51_UART_BASE +A_UART_TXD , in[i]); +g_assert_true (uart_wait_for_event (qts,NRF51_UART_BASE + +A_UART_TXDRDY )); + } +} + +static void test_nrf51_uart (void ) +{ +int sock_fd; +char s[10 ]; +QTestState *qts =qtest_init_with_serial ("-M microbit" , &sock_fd); + +g_assert_true (write (sock_fd,"c" ,1 ) ==1 ); + g_assert_cmphex(qtest_readl(qts, NRF51_UART_BASE + A_UART_RXD), ==, 0x00); + +qtest_writel (qts,NRF51_UART_BASE +A_UART_ENABLE ,0x04 ); +qtest_writel (qts,NRF51_UART_BASE +A_UART_STARTRX ,0x01 ); + +g_assert_true (uart_wait_for_event (qts,NRF51_UART_BASE +A_UART_RXDRDY )); +qtest_writel (qts,NRF51_UART_BASE +A_UART_RXDRDY ,0x00 ); + g_assert_cmphex(qtest_readl(qts, NRF51_UART_BASE + A_UART_RXD), ==, 'c'); + +qtest_writel (qts,NRF51_UART_BASE +A_UART_INTENSET ,0x04 ); + g_assert_cmphex(qtest_readl(qts, NRF51_UART_BASE + A_UART_INTEN), ==, 0x04); +qtest_writel (qts,NRF51_UART_BASE +A_UART_INTENCLR ,0x04 ); + g_assert_cmphex(qtest_readl(qts, NRF51_UART_BASE + A_UART_INTEN), ==, 0x00); + +uart_rw_to_rxd (qts, sock_fd,"hello" , s); +g_assert_true (memcmp (s,"hello" ,5 ) ==0 ); + +qtest_writel (qts,NRF51_UART_BASE +A_UART_STARTTX ,0x01 ); +uart_w_to_txd (qts,"d" ); +g_assert_true (read (sock_fd, s,10 ) ==1 ); + g_assert_cmphex(s[0], ==, 'd'); + +qtest_writel (qts,NRF51_UART_BASE +A_UART_SUSPEND ,0x01 ); +qtest_writel (qts,NRF51_UART_BASE +A_UART_TXD ,'h' ); +qtest_writel (qts,NRF51_UART_BASE +A_UART_STARTTX ,0x01 ); +uart_w_to_txd (qts,"world" ); +g_assert_true (read (sock_fd, s,10 ) ==5 ); +g_assert_true (memcmp (s,"world" ,5 ) ==0 ); + +close (sock_fd); + +qtest_quit (qts); +} +/* Read a byte from I2C device at @addr from register @reg */ static uint32_t i2c_read_byte (QTestState *qts,uint32_t addr,uint32_t reg) {
@@ -302,6 +390,7 @@ int main(int argc, char **argv) {g_test_init (&argc, &argv,NULL ); +qtest_add_func ("/microbit/nrf51/uart" , test_nrf51_uart);qtest_add_func ("/microbit/nrf51/gpio" , test_nrf51_gpio);qtest_add_func ("/microbit/nrf51/timer" , test_nrf51_timer);qtest_add_func ("/microbit/microbit/i2c" , test_microbit_i2c);
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 17/26] xlnx-zynqmp: Don't create rpu-cluster if there are no RPUs
In reply to Peter MaydellIf we aren't going to create any RPUs, then don't create the rpu-cluster unit. This allows us to add an assertion to the cluster object that it contains at least one CPU, which helps to avoid bugs in creating clusters and putting CPUs in them.
Message-id: [email protected]
--- hw/arm/xlnx-zynqmp.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/arm/xlnx-zynqmp.c +5 -0
@@ -178,6 +178,11 @@ static void xlnx_zynqmp_create_rpu(XlnxZynqMPState *s, const char *boot_cpu,int i;int num_rpus =MIN (smp_cpus -XLNX_ZYNQMP_NUM_APU_CPUS ,XLNX_ZYNQMP_NUM_RPU_CPUS ); +if (num_rpus <=0 ) { +/* Don't create rpu-cluster object if there's nothing to put in it */ +return ; + } +object_initialize_child (OBJECT (s),"rpu-cluster" , &s->rpu_cluster,sizeof (s->rpu_cluster),TYPE_CPU_CLUSTER , &error_abort,NULL );
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 16/26] checkpatch: Don't emit spurious warnings about block comments
In reply to Peter MaydellIn checkpatch we attempt to check for and warn about block comments which start with /* or /** followed by a non-blank. Unfortunately a bug in the regex meant that we would incorrectly warn about comments starting with "/**" with no following text:
git show 9813dc6ac3954d58ba16b3920556f106f97e1c67|./scripts/checkpatch.pl -
WARNING: Block comments use a leading /* on a separate line #34: FILE: tests/libqtest.h:233:
+/**
The sequence "/\*\*?" was intended to match either "/*" or "/**", but Perl's semantics for '?' allow it to backtrack and try the "matches 0 chars" option if the "matches 1 char" choice leads to a failure of the rest of the regex to match. Switch to "/\*\*?+" which uses what perlre(1) calls the "possessive" quantifier form:
this means that if it matches the "/**" string it will not later backtrack to matching just the "/*" prefix.
The other end of the regex is also wrong: it is attempting to check for "/* or /** followed by something that isn't just whitespace", but [ \t]*.+[ \t]* will match on pure whitespace. This is less significant but means that a line with just a comment-starter followed by trailing whitespace will generate an incorrect warning about block comment style as well as the correct error about trailing whitespace which a different checkpatch test emits.
Message-id: [email protected]
--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
@@ -1624,7 +1624,7 @@ sub process { # Block comments use /* on a line of its own if ($rawline !~ m@^\+.*/\*.*\*/[ \t]*$@ && #inline /*...*/ - $rawline =~ m@^\+.*/\*\*?[ \t]*.+[ \t]*$@) { # /* or /** non-blank + $rawline =~ m@^\+.*/\*\*?+[ \t]*[^ \t]@) { # /* or /** non-blank WARN("Block comments use a leading /* on a separate line\n" . $herecurr); }
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 18/26] aspeed/smc: fix default read value
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
0xFFFFFFFF should be returned for non implemented registers.
Message-id: [email protected]
--- hw/ssi/aspeed_smc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ssi/aspeed_smc.c +1 -1
@@ -670,7 +670,7 @@ static uint64_t aspeed_smc_read(void *opaque, hwaddr addr, unsigned int size) }else {qemu_log_mask (LOG_UNIMP ,"%s: not implemented: 0x%" HWADDR_PRIx"\n" , __func__, addr); -return 0 ; +return -1 ; } }
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 19/26] aspeed/smc: define registers for all possible CS
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
The model should expose one control register per possible CS. When testing the validity of the register number in the read operation, replace 's->num_cs' by 'ctrl->max_slaves' which represents the maximum number of flash devices a controller can handle.
Message-id: [email protected]
--- hw/ssi/aspeed_smc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ssi/aspeed_smc.c +1 -1
@@ -665,7 +665,7 @@ static uint64_t aspeed_smc_read(void *opaque, hwaddr addr, unsigned int size) addr == s->r_ce_ctrl || addr ==R_INTR_CTRL || (addr >=R_SEG_ADDR0 && addr <R_SEG_ADDR0 + s->ctrl->max_slaves) || - (addr >= s->r_ctrl0 && addr < s->r_ctrl0 + s->num_cs)) { + (addr >= s->r_ctrl0 && addr < s->r_ctrl0 + s->ctrl->max_slaves)) { return s->regs[addr]; } else { qemu_log_mask(LOG_UNIMP, "%s: not implemented: 0x%" HWADDR_PRIx "\n",
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 20/26] aspeed/smc: Add dummy data register
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
The SMC controllers have a register containing the byte that will be used as dummy output. It can be modified by software.
Message-id: [email protected]
--- hw/ssi/aspeed_smc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
hw/ssi/aspeed_smc.c +6 -3
@@ -98,8 +98,8 @@/* Misc Control Register #1 */ #define R_MISC_CTRL1 (0x50 / 4) -/* Misc Control Register #2 */ -#define R_MISC_CTRL2 (0x54 / 4) +/* SPI dummy cycle data */ +#define R_DUMMY_DATA (0x54 / 4)/* DMA Control/Status Register */ #define R_DMA_CTRL (0x80 / 4)
@@ -529,7 +529,7 @@ static void aspeed_smc_flash_setup(AspeedSMCFlash *fl, uint32_t addr)*/ if (aspeed_smc_flash_mode (fl) ==CTRL_FREADMODE ) {for (i =0 ; i <aspeed_smc_flash_dummies (fl); i++) { -ssi_transfer (fl->controller->spi,0xFF ); +ssi_transfer (fl->controller->spi, s->regs[R_DUMMY_DATA ] &0xff ); } } }
@@ -664,6 +664,7 @@ static uint64_t aspeed_smc_read(void *opaque, hwaddr addr, unsigned int size) addr == s->r_timings || addr == s->r_ce_ctrl || addr ==R_INTR_CTRL || + addr ==R_DUMMY_DATA || (addr >=R_SEG_ADDR0 && addr <R_SEG_ADDR0 + s->ctrl->max_slaves) || (addr >= s->r_ctrl0 && addr < s->r_ctrl0 + s->ctrl->max_slaves)) { return s->regs[addr];
@@ -697,6 +698,8 @@ static void aspeed_smc_write(void *opaque, hwaddr addr, uint64_t data,if (value != s->regs[R_SEG_ADDR0 + cs]) {aspeed_smc_flash_set_segment (s, cs, value); } + }else if (addr ==R_DUMMY_DATA ) { + s->regs[addr] = value &0xff ; }else {qemu_log_mask (LOG_UNIMP ,"%s: not implemented: 0x%" HWADDR_PRIx"\n" , __func__, addr);
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 14/26] tests/microbit-test: Make test independent of global_qtest
In reply to Peter MaydellFrom: Julia Suvorova <[email protected]>
Using of global_qtest is not required here. Let's replace functions like readl() with the corresponding qtest_* counterparts.
Message-id: [email protected]
--- tests/microbit-test.c | 247 ++++++++++++++++++++++-------------------- 1 file changed, 129 insertions(+), 118 deletions(-)
tests/microbit-test.c +129 -118
@@ -24,22 +24,22 @@#include "hw/i2c/microbit_i2c.h" /* Read a byte from I2C device at @addr from register @reg */ -static uint32_t i2c_read_byte (uint32_t addr,uint32_t reg) +static uint32_t i2c_read_byte (QTestState *qts,uint32_t addr,uint32_t reg) {uint32_t val; -writel (NRF51_TWI_BASE +NRF51_TWI_REG_ADDRESS , addr); -writel (NRF51_TWI_BASE +NRF51_TWI_TASK_STARTTX ,1 ); -writel (NRF51_TWI_BASE +NRF51_TWI_REG_TXD , reg); - val =readl (NRF51_TWI_BASE +NRF51_TWI_EVENT_TXDSENT ); +qtest_writel (qts,NRF51_TWI_BASE +NRF51_TWI_REG_ADDRESS , addr); +qtest_writel (qts,NRF51_TWI_BASE +NRF51_TWI_TASK_STARTTX ,1 ); +qtest_writel (qts,NRF51_TWI_BASE +NRF51_TWI_REG_TXD , reg); + val =qtest_readl (qts,NRF51_TWI_BASE +NRF51_TWI_EVENT_TXDSENT ); g_assert_cmpuint(val, ==, 1); -writel (NRF51_TWI_BASE +NRF51_TWI_TASK_STOP ,1 ); +qtest_writel (qts,NRF51_TWI_BASE +NRF51_TWI_TASK_STOP ,1 ); -writel (NRF51_TWI_BASE +NRF51_TWI_TASK_STARTRX ,1 ); - val =readl (NRF51_TWI_BASE +NRF51_TWI_EVENT_RXDREADY ); +qtest_writel (qts,NRF51_TWI_BASE +NRF51_TWI_TASK_STARTRX ,1 ); + val =qtest_readl (qts,NRF51_TWI_BASE +NRF51_TWI_EVENT_RXDREADY ); g_assert_cmpuint(val, ==, 1); - val =readl (NRF51_TWI_BASE +NRF51_TWI_REG_RXD ); -writel (NRF51_TWI_BASE +NRF51_TWI_TASK_STOP ,1 ); + val =qtest_readl (qts,NRF51_TWI_BASE +NRF51_TWI_REG_RXD ); +qtest_writel (qts,NRF51_TWI_BASE +NRF51_TWI_TASK_STOP ,1 );return val; }
@@ -47,22 +47,25 @@ static uint32_t i2c_read_byte(uint32_t addr, uint32_t reg)static void test_microbit_i2c (void ) {uint32_t val; +QTestState *qts =qtest_init ("-M microbit" );/* We don't program pins/irqs but at least enable the device */ -writel (NRF51_TWI_BASE +NRF51_TWI_REG_ENABLE ,5 ); +qtest_writel (qts,NRF51_TWI_BASE +NRF51_TWI_REG_ENABLE ,5 );/* MMA8653 magnetometer detection */ - val =i2c_read_byte (0x3A ,0x0D ); + val =i2c_read_byte (qts,0x3A ,0x0D ); g_assert_cmpuint(val, ==, 0x5A); - val =i2c_read_byte (0x3A ,0x0D ); + val =i2c_read_byte (qts,0x3A ,0x0D ); g_assert_cmpuint(val, ==, 0x5A);/* LSM303 accelerometer detection */ - val =i2c_read_byte (0x3C ,0x4F ); + val =i2c_read_byte (qts,0x3C ,0x4F ); g_assert_cmpuint(val, ==, 0x40); -writel (NRF51_TWI_BASE +NRF51_TWI_REG_ENABLE ,0 ); +qtest_writel (qts,NRF51_TWI_BASE +NRF51_TWI_REG_ENABLE ,0 ); + +qtest_quit (qts); }static void test_nrf51_gpio (void )
@@ -80,220 +83,228 @@ static void test_nrf51_gpio(void) {NRF51_GPIO_REG_DIRCLR, 0x00000000} }; +QTestState *qts =qtest_init ("-M microbit" ); +/* Check reset state */ for (i =0 ; i <ARRAY_SIZE (reset_state); i++) { expected = reset_state[i].expected; - actual =readl (NRF51_GPIO_BASE + reset_state[i].addr); + actual =qtest_readl (qts,NRF51_GPIO_BASE + reset_state[i].addr); g_assert_cmpuint(actual, ==, expected); }for (i =0 ; i <NRF51_GPIO_PINS ; i++) { expected =0x00000002 ; - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START + i *4 ); + actual =qtest_readl (qts,NRF51_GPIO_BASE + +NRF51_GPIO_REG_CNF_START + i *4 ); g_assert_cmpuint(actual, ==, expected); }/* Check dir bit consistency between dir and cnf */ /* Check set via DIRSET */ expected =0x80000001 ; -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_DIRSET , expected); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_DIR ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_DIRSET , expected); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_DIR ); g_assert_cmpuint(actual, ==, expected); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ) &0x01 ; + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ) + &0x01 ; g_assert_cmpuint(actual, ==, 0x01); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_END ) &0x01 ; + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_END ) &0x01 ; g_assert_cmpuint(actual, ==, 0x01);/* Check clear via DIRCLR */ -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_DIRCLR ,0x80000001 ); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_DIR ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_DIRCLR ,0x80000001 ); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_DIR ); g_assert_cmpuint(actual, ==, 0x00000000); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ) &0x01 ; + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ) + &0x01 ; g_assert_cmpuint(actual, ==, 0x00); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_END ) &0x01 ; + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_END ) &0x01 ; g_assert_cmpuint(actual, ==, 0x00);/* Check set via DIR */ expected =0x80000001 ; -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_DIR , expected); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_DIR ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_DIR , expected); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_DIR ); g_assert_cmpuint(actual, ==, expected); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ) &0x01 ; + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ) + &0x01 ; g_assert_cmpuint(actual, ==, 0x01); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_END ) &0x01 ; + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_END ) &0x01 ; g_assert_cmpuint(actual, ==, 0x01);/* Reset DIR */ -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_DIR ,0x00000000 ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_DIR ,0x00000000 );/* Check Input propagates */ -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0x00 ); -qtest_set_irq_in (global_qtest,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,0 ); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0x00 ); +qtest_set_irq_in (qts,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,0 ); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; g_assert_cmpuint(actual, ==, 0x00); -qtest_set_irq_in (global_qtest,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,1 ); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; +qtest_set_irq_in (qts,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,1 ); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; g_assert_cmpuint(actual, ==, 0x01); -qtest_set_irq_in (global_qtest,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,-1 ); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; +qtest_set_irq_in (qts,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,-1 ); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; g_assert_cmpuint(actual, ==, 0x01); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0x02 ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0x02 );/* Check pull-up working */ -qtest_set_irq_in (global_qtest,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,0 ); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b0000 ); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; +qtest_set_irq_in (qts,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,0 ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b0000 ); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; g_assert_cmpuint(actual, ==, 0x00); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b1110 ); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b1110 ); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; g_assert_cmpuint(actual, ==, 0x01); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0x02 ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0x02 );/* Check pull-down working */ -qtest_set_irq_in (global_qtest,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,1 ); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b0000 ); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; +qtest_set_irq_in (qts,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,1 ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b0000 ); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; g_assert_cmpuint(actual, ==, 0x01); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b0110 ); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b0110 ); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; g_assert_cmpuint(actual, ==, 0x00); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0x02 ); -qtest_set_irq_in (global_qtest,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,-1 ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0x02 ); +qtest_set_irq_in (qts,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,-1 );/* Check Output propagates */ -irq_intercept_out ("/machine/nrf51" ); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b0011 ); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_OUTSET ,0x01 ); -g_assert_true (get_irq (0 )); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_OUTCLR ,0x01 ); -g_assert_false (get_irq (0 )); +qtest_irq_intercept_out (qts,"/machine/nrf51" ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b0011 ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_OUTSET ,0x01 ); +g_assert_true (qtest_get_irq (qts,0 )); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_OUTCLR ,0x01 ); +g_assert_false (qtest_get_irq (qts,0 ));/* Check self-stimulation */ -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b01 ); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_OUTSET ,0x01 ); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b01 ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_OUTSET ,0x01 ); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; g_assert_cmpuint(actual, ==, 0x01); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_OUTCLR ,0x01 ); - actual =readl (NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_OUTCLR ,0x01 ); + actual =qtest_readl (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_IN ) &0x01 ; g_assert_cmpuint(actual, ==, 0x00);/* * Check short-circuit - generates an guest_error which must be checked * manually as long as qtest can not scan qemu_log messages */ -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b01 ); -writel (NRF51_GPIO_BASE +NRF51_GPIO_REG_OUTSET ,0x01 ); -qtest_set_irq_in (global_qtest,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,0 ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_CNF_START ,0b01 ); +qtest_writel (qts,NRF51_GPIO_BASE +NRF51_GPIO_REG_OUTSET ,0x01 ); +qtest_set_irq_in (qts,"/machine/nrf51" ,"unnamed-gpio-in" ,0 ,0 ); + +qtest_quit (qts); } -static void timer_task (hwaddr task) +static void timer_task (QTestState *qts,hwaddr task) { -writel (NRF51_TIMER_BASE + task,NRF51_TRIGGER_TASK ); +qtest_writel (qts,NRF51_TIMER_BASE + task,NRF51_TRIGGER_TASK ); } -static void timer_clear_event (hwaddr event) +static void timer_clear_event (QTestState *qts,hwaddr event) { -writel (NRF51_TIMER_BASE + event,NRF51_EVENT_CLEAR ); +qtest_writel (qts,NRF51_TIMER_BASE + event,NRF51_EVENT_CLEAR ); } -static void timer_set_bitmode (uint8_t mode) +static void timer_set_bitmode (QTestState *qts,uint8_t mode) { -writel (NRF51_TIMER_BASE +NRF51_TIMER_REG_BITMODE , mode); +qtest_writel (qts,NRF51_TIMER_BASE +NRF51_TIMER_REG_BITMODE , mode); } -static void timer_set_prescaler (uint8_t prescaler) +static void timer_set_prescaler (QTestState *qts,uint8_t prescaler) { -writel (NRF51_TIMER_BASE +NRF51_TIMER_REG_PRESCALER , prescaler); +qtest_writel (qts,NRF51_TIMER_BASE +NRF51_TIMER_REG_PRESCALER , prescaler); } -static void timer_set_cc (size_t idx,uint32_t value) +static void timer_set_cc (QTestState *qts,size_t idx,uint32_t value) { -writel (NRF51_TIMER_BASE +NRF51_TIMER_REG_CC0 + idx *4 , value); +qtest_writel (qts,NRF51_TIMER_BASE +NRF51_TIMER_REG_CC0 + idx *4 , value); } -static void timer_assert_events (uint32_t ev0,uint32_t ev1,uint32_t ev2, -uint32_t ev3) +static void timer_assert_events (QTestState *qts,uint32_t ev0,uint32_t ev1, +uint32_t ev2,uint32_t ev3) { -g_assert (readl (NRF51_TIMER_BASE +NRF51_TIMER_EVENT_COMPARE_0 ) == ev0); -g_assert (readl (NRF51_TIMER_BASE +NRF51_TIMER_EVENT_COMPARE_1 ) == ev1); -g_assert (readl (NRF51_TIMER_BASE +NRF51_TIMER_EVENT_COMPARE_2 ) == ev2); -g_assert (readl (NRF51_TIMER_BASE +NRF51_TIMER_EVENT_COMPARE_3 ) == ev3); +g_assert (qtest_readl (qts,NRF51_TIMER_BASE +NRF51_TIMER_EVENT_COMPARE_0 ) + == ev0); +g_assert (qtest_readl (qts,NRF51_TIMER_BASE +NRF51_TIMER_EVENT_COMPARE_1 ) + == ev1); +g_assert (qtest_readl (qts,NRF51_TIMER_BASE +NRF51_TIMER_EVENT_COMPARE_2 ) + == ev2); +g_assert (qtest_readl (qts,NRF51_TIMER_BASE +NRF51_TIMER_EVENT_COMPARE_3 ) + == ev3); }static void test_nrf51_timer (void ) {uint32_t steps_to_overflow =408 ; +QTestState *qts =qtest_init ("-M microbit" );/* Compare Match */ -timer_task (NRF51_TIMER_TASK_STOP ); -timer_task (NRF51_TIMER_TASK_CLEAR ); +timer_task (qts,NRF51_TIMER_TASK_STOP ); +timer_task (qts,NRF51_TIMER_TASK_CLEAR ); -timer_clear_event (NRF51_TIMER_EVENT_COMPARE_0 ); -timer_clear_event (NRF51_TIMER_EVENT_COMPARE_1 ); -timer_clear_event (NRF51_TIMER_EVENT_COMPARE_2 ); -timer_clear_event (NRF51_TIMER_EVENT_COMPARE_3 ); +timer_clear_event (qts,NRF51_TIMER_EVENT_COMPARE_0 ); +timer_clear_event (qts,NRF51_TIMER_EVENT_COMPARE_1 ); +timer_clear_event (qts,NRF51_TIMER_EVENT_COMPARE_2 ); +timer_clear_event (qts,NRF51_TIMER_EVENT_COMPARE_3 ); -timer_set_bitmode (NRF51_TIMER_WIDTH_16 );/* 16 MHz Timer */ -timer_set_prescaler (0 ); +timer_set_bitmode (qts,NRF51_TIMER_WIDTH_16 );/* 16 MHz Timer */ +timer_set_prescaler (qts,0 );/* Swept over in first step */ -timer_set_cc (0 ,2 ); +timer_set_cc (qts,0 ,2 );/* Barely miss on first step */ -timer_set_cc (1 ,162 ); +timer_set_cc (qts,1 ,162 );/* Spot on on third step */ -timer_set_cc (2 ,480 ); +timer_set_cc (qts,2 ,480 ); -timer_assert_events (0 ,0 ,0 ,0 ); +timer_assert_events (qts,0 ,0 ,0 ,0 ); -timer_task (NRF51_TIMER_TASK_START ); -clock_step (10000 ); -timer_assert_events (1 ,0 ,0 ,0 ); +timer_task (qts,NRF51_TIMER_TASK_START ); +qtest_clock_step (qts,10000 ); +timer_assert_events (qts,1 ,0 ,0 ,0 );/* Swept over on first overflow */ -timer_set_cc (3 ,114 ); +timer_set_cc (qts,3 ,114 ); -clock_step (10000 ); -timer_assert_events (1 ,1 ,0 ,0 ); +qtest_clock_step (qts,10000 ); +timer_assert_events (qts,1 ,1 ,0 ,0 ); -clock_step (10000 ); -timer_assert_events (1 ,1 ,1 ,0 ); +qtest_clock_step (qts,10000 ); +timer_assert_events (qts,1 ,1 ,1 ,0 );/* Wrap time until internal counter overflows */ while (steps_to_overflow--) { -timer_assert_events (1 ,1 ,1 ,0 ); -clock_step (10000 ); +timer_assert_events (qts,1 ,1 ,1 ,0 ); +qtest_clock_step (qts,10000 ); } -timer_assert_events (1 ,1 ,1 ,1 ); +timer_assert_events (qts,1 ,1 ,1 ,1 ); -timer_clear_event (NRF51_TIMER_EVENT_COMPARE_0 ); -timer_clear_event (NRF51_TIMER_EVENT_COMPARE_1 ); -timer_clear_event (NRF51_TIMER_EVENT_COMPARE_2 ); -timer_clear_event (NRF51_TIMER_EVENT_COMPARE_3 ); -timer_assert_events (0 ,0 ,0 ,0 ); +timer_clear_event (qts,NRF51_TIMER_EVENT_COMPARE_0 ); +timer_clear_event (qts,NRF51_TIMER_EVENT_COMPARE_1 ); +timer_clear_event (qts,NRF51_TIMER_EVENT_COMPARE_2 ); +timer_clear_event (qts,NRF51_TIMER_EVENT_COMPARE_3 ); +timer_assert_events (qts,0 ,0 ,0 ,0 ); -timer_task (NRF51_TIMER_TASK_STOP ); +timer_task (qts,NRF51_TIMER_TASK_STOP );/* Test Proposal: Stop/Shutdown */ /* Test Proposal: Shortcut Compare -> Clear */ /* Test Proposal: Shortcut Compare -> Stop */ /* Test Proposal: Counter Mode */ + +qtest_quit (qts); }int main (int argc,char **argv) { -int ret; -g_test_init (&argc, &argv,NULL ); - global_qtest =qtest_initf ("-machine microbit" ); -qtest_add_func ("/microbit/nrf51/gpio" , test_nrf51_gpio);qtest_add_func ("/microbit/nrf51/timer" , test_nrf51_timer);qtest_add_func ("/microbit/microbit/i2c" , test_microbit_i2c); - ret =g_test_run (); - -qtest_quit (global_qtest); -return ret; +return g_test_run (); }
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 23/26] hw/arm/xlnx-zynqmp: Realize cluster after putting RPUs in it
In reply to Peter MaydellCurrently the cluster implementation doesn't have any constraints on the ordering of realizing the TYPE_CPU_CLUSTER and populating it with child objects. We want to impose a constraint that realize must happen only after all the child objects are added, so move the realize of rpu_cluster. (The apu_cluster is already realized after child population.)
Message-id: [email protected]
--- hw/arm/xlnx-zynqmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/xlnx-zynqmp.c +2 -2
@@ -188,8 +188,6 @@ static void xlnx_zynqmp_create_rpu(XlnxZynqMPState *s, const char *boot_cpu, &error_abort, NULL);qdev_prop_set_uint32 (DEVICE (&s->rpu_cluster),"cluster-id" ,1 ); -qdev_init_nofail (DEVICE (&s->rpu_cluster)); -for (i =0 ; i < num_rpus; i++) {char *name;
@@ -217,6 +215,8 @@ static void xlnx_zynqmp_create_rpu(XlnxZynqMPState *s, const char *boot_cpu,return ; } } + +qdev_init_nofail (DEVICE (&s->rpu_cluster)); }static void xlnx_zynqmp_init (Object *obj)
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 26/26] gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index
In reply to Peter MaydellNow we're keeping the cluster index in the CPUState, we don't need to jump through hoops in gdb_get_cpu_pid() to find the associated cluster object.
Message-id: [email protected]
--- gdbstub.c | 48 +++++------------------------------------------- 1 file changed, 5 insertions(+), 43 deletions(-)
gdbstub.c +5 -43
@@ -644,50 +644,12 @@ static int memtox(char *buf, const char *mem, int len)static uint32_t gdb_get_cpu_pid (const GDBState *s,CPUState *cpu) { -#ifndef CONFIG_USER_ONLY -gchar *path, *name =NULL ; -Object *obj; -CPUClusterState *cluster; -uint32_t ret; - - path =object_get_canonical_path (OBJECT (cpu)); - -if (path ==NULL ) { -/* Return the default process' PID */ - ret = s->processes[s->process_num -1 ].pid; - goto out; - } - - name =object_get_canonical_path_component (OBJECT (cpu)); -assert (name !=NULL ); - -/* -* Retrieve the CPU parent path by removing the last '/' and the CPU name -* from the CPU canonical path. -*/ - path[strlen (path) -strlen (name) -1 ] ='\0' ; - - obj =object_resolve_path_type (path,TYPE_CPU_CLUSTER ,NULL ); - -if (obj ==NULL ) { -/* Return the default process' PID */ - ret = s->processes[s->process_num -1 ].pid; - goto out; - } - - cluster =CPU_CLUSTER (obj); - ret = cluster->cluster_id +1 ; - -out: -g_free (name); -g_free (path); - -return ret; - -#else /* TODO: In user mode, we should use the task state PID */ -return s->processes[s->process_num -1 ].pid; -#endif +if (cpu->cluster_index ==UNASSIGNED_CLUSTER_INDEX ) { +/* Return the default process' PID */ +return s->processes[s->process_num -1 ].pid; + } +return cpu->cluster_index +1 ; }static GDBProcess *gdb_get_process (const GDBState *s,uint32_t pid)
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 21/26] aspeed/smc: snoop SPI transfers to fake dummy cycles
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
The m25p80 models dummy cycles using byte transfers. This works well when the transfers are initiated by the QEMU model of a SPI controller but when these are initiated by the OS, it breaks emulation.
Snoop the SPI transfer to catch commands requiring dummy cycles and replace them with byte transfers compatible with the m25p80 model.
Message-id: [email protected]
--- include/hw/ssi/aspeed_smc.h | 3 + hw/ssi/aspeed_smc.c | 115 +++++++++++++++++++++++++++++++++++- 2 files changed, 115 insertions(+), 3 deletions(-)
include/hw/ssi/aspeed_smc.h +3 -0
@@ -98,6 +98,9 @@ typedef struct AspeedSMCState {uint8_t conf_enable_w0;AspeedSMCFlash *flashes; + +uint8_t snoop_index; + uint8_t snoop_dummies; } AspeedSMCState;#endif /* ASPEED_SMC_H */
hw/ssi/aspeed_smc.c +112 -3
153 lines not on this page · raw message
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 22/26] tests/microbit-test: Add tests for nRF51 NVMC
In reply to Peter MaydellFrom: Steffen Görtz <[email protected]>
Message-id: [email protected]
--- tests/microbit-test.c | 108 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+)
tests/microbit-test.c +108 -0
@@ -21,6 +21,7 @@#include "hw/arm/nrf51.h" #include "hw/char/nrf51_uart.h" #include "hw/gpio/nrf51_gpio.h" +#include "hw/nvram/nrf51_nvm.h" #include "hw/timer/nrf51_timer.h" #include "hw/i2c/microbit_i2c.h"
@@ -156,6 +157,112 @@ static void test_microbit_i2c(void)qtest_quit (qts); } +#define FLASH_SIZE (256 * NRF51_PAGE_SIZE) + +static void fill_and_erase (QTestState *qts,hwaddr base,hwaddr size, +uint32_t address_reg) +{ +hwaddr i; + +/* Erase Page */ +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x02 ); +qtest_writel (qts,NRF51_NVMC_BASE + address_reg, base); +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x00 ); + +/* Check memory */ +for (i =0 ; i < size /4 ; i++) { + g_assert_cmpuint(qtest_readl(qts, base + i * 4), ==, 0xFFFFFFFF); + } + +/* Fill memory */ +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x01 ); +for (i =0 ; i < size /4 ; i++) { +qtest_writel (qts, base + i *4 , i); + g_assert_cmpuint(qtest_readl(qts, base + i * 4), ==, i); + } +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x00 ); +} + +static void test_nrf51_nvmc (void ) +{ +uint32_t value; +hwaddr i; +QTestState *qts =qtest_init ("-M microbit" ); + +/* Test always ready */ + value =qtest_readl (qts,NRF51_NVMC_BASE +NRF51_NVMC_READY ); + g_assert_cmpuint(value & 0x01, ==, 0x01); + +/* Test write-read config register */ +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x03 ); +g_assert_cmpuint (qtest_readl (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ), + ==, 0x03); +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x00 ); +g_assert_cmpuint (qtest_readl (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ), + ==, 0x00); + +/* Test PCR0 */ +fill_and_erase (qts,NRF51_FLASH_BASE ,NRF51_PAGE_SIZE , +NRF51_NVMC_ERASEPCR0 ); +fill_and_erase (qts,NRF51_FLASH_BASE +NRF51_PAGE_SIZE , +NRF51_PAGE_SIZE ,NRF51_NVMC_ERASEPCR0 ); + +/* Test PCR1 */ +fill_and_erase (qts,NRF51_FLASH_BASE ,NRF51_PAGE_SIZE , +NRF51_NVMC_ERASEPCR1 ); +fill_and_erase (qts,NRF51_FLASH_BASE +NRF51_PAGE_SIZE , +NRF51_PAGE_SIZE ,NRF51_NVMC_ERASEPCR1 ); + +/* Erase all */ +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x02 ); +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_ERASEALL ,0x01 ); +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x00 ); + +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x01 ); +for (i =0 ; i <FLASH_SIZE /4 ; i++) { +qtest_writel (qts,NRF51_FLASH_BASE + i *4 , i); + g_assert_cmpuint(qtest_readl(qts, NRF51_FLASH_BASE + i * 4), ==, i); + } +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x00 ); + +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x02 ); +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_ERASEALL ,0x01 ); +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x00 ); + +for (i =0 ; i <FLASH_SIZE /4 ; i++) { +g_assert_cmpuint (qtest_readl (qts,NRF51_FLASH_BASE + i *4 ), + ==, 0xFFFFFFFF); + } + +/* Erase UICR */ +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x02 ); +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_ERASEUICR ,0x01 ); +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x00 ); + +for (i =0 ; i <NRF51_UICR_SIZE /4 ; i++) { +g_assert_cmpuint (qtest_readl (qts,NRF51_UICR_BASE + i *4 ), + ==, 0xFFFFFFFF); + } + +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x01 ); +for (i =0 ; i <NRF51_UICR_SIZE /4 ; i++) { +qtest_writel (qts,NRF51_UICR_BASE + i *4 , i); + g_assert_cmpuint(qtest_readl(qts, NRF51_UICR_BASE + i * 4), ==, i); + } +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x00 ); + +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x02 ); +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_ERASEUICR ,0x01 ); +qtest_writel (qts,NRF51_NVMC_BASE +NRF51_NVMC_CONFIG ,0x00 ); + +for (i =0 ; i <NRF51_UICR_SIZE /4 ; i++) { +g_assert_cmpuint (qtest_readl (qts,NRF51_UICR_BASE + i *4 ), + ==, 0xFFFFFFFF); + } + +qtest_quit (qts); +} +static void test_nrf51_gpio (void ) {size_t i;
@@ -392,6 +499,7 @@ int main(int argc, char **argv)qtest_add_func ("/microbit/nrf51/uart" , test_nrf51_uart);qtest_add_func ("/microbit/nrf51/gpio" , test_nrf51_gpio); +qtest_add_func ("/microbit/nrf51/nvmc" , test_nrf51_nvmc);qtest_add_func ("/microbit/nrf51/timer" , test_nrf51_timer);qtest_add_func ("/microbit/microbit/i2c" , test_microbit_i2c);
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 24/26] qom/cpu: Add cluster_index to CPUState
In reply to Peter MaydellFor TCG we want to distinguish which cluster a CPU is in, and we need to do it quickly. Cache the cluster index in the CPUState struct, by having the cluster object set cpu->cluster_index for each CPU child when it is realized.
This means that board/SoC code must add all CPUs to the cluster before realizing the cluster object. Regrettably QOM provides no way to prevent adding children to a realized object and no way for the parent to be notified when a new child is added to it, so we don't have any way to enforce/assert this constraint; all we can do is document it in a comment. We can at least put in a check that the cluster contains at least one CPU, which should catch the typical cases of "realized cluster too early" or "forgot to parent the CPUs into it".
The restriction on how many clusters can exist in the system is imposed by TCG code which will be added in a subsequent commit, but the check to enforce it in cluster.c fits better in this one.
Message-id: [email protected]
--- include/hw/cpu/cluster.h | 24 +++++++++++++++++++++ include/qom/cpu.h | 7 ++++++ hw/cpu/cluster.c | 46 ++++++++++++++++++++++++++++++++++++++++ qom/cpu.c | 1 + 4 files changed, 78 insertions(+)
include/hw/cpu/cluster.h +24 -0
@@ -34,12 +34,36 @@* Arm big.LITTLE system) they should be in different clusters. If the CPUs do * not have the same view of memory (for example the main CPU and a management * controller processor) they should be in different clusters. +* +* A cluster is created by creating an object of TYPE_CPU_CLUSTER, and then +* adding the CPUs to it as QOM child objects (e.g. using the +* object_initialize_child() or object_property_add_child() functions). +* The CPUs may be either direct children of the cluster object, or indirect +* children (e.g. children of children of the cluster object). +* +* All CPUs must be added as children before the cluster is realized. +* (Regrettably QOM provides no way to prevent adding children to a realized +* object and no way for the parent to be notified when a new child is added +* to it, so this restriction is not checked for, but the system will not +* behave correctly if it is not adhered to. The cluster will assert that +* it contains at least one CPU, which should catch most inadvertent +* violations of this constraint.) +* +* A CPU which is not put into any cluster will be considered implicitly +* to be in a cluster with all the other "loose" CPUs, so all CPUs that are +* not assigned to clusters must be identical. */ #define TYPE_CPU_CLUSTER "cpu-cluster"#define CPU_CLUSTER (obj) \ OBJECT_CHECK(CPUClusterState, (obj), TYPE_CPU_CLUSTER) +/* +* This limit is imposed by TCG, which puts the cluster ID into an +* 8 bit field (and uses all-1s for the default "not in any cluster"). +*/ +#define MAX_CLUSTERS 255 +/** * CPUClusterState: * @cluster_id: The cluster ID. This value is for internal use only and should
include/qom/cpu.h +7 -0
@@ -280,6 +280,11 @@ struct qemu_work_item;/** * CPUState: * @cpu_index: CPU index (informative). +* @cluster_index: Identifies which cluster this CPU is in. +* For boards which don't define clusters or for "loose" CPUs not assigned +* to a cluster this will be UNASSIGNED_CLUSTER_INDEX; otherwise it will +* be the same as the cluster-id property of the CPU object's TYPE_CPU_CLUSTER +* QOM parent. * @nr_cores: Number of cores within this CPU package. * @nr_threads: Number of threads within this CPU. * @running: #true if CPU is currently running (lockless).
@@ -405,6 +410,7 @@ struct CPUState {/* TODO Move common fields from CPUArchState here. */ int cpu_index; +int cluster_index;uint32_t halted;uint32_t can_do_io;int32_t exception_index;
@@ -1111,5 +1117,6 @@ extern const struct VMStateDescription vmstate_cpu_common;#endif /* NEED_CPU_H */ #define UNASSIGNED_CPU_INDEX -1 +#define UNASSIGNED_CLUSTER_INDEX -1#endif
hw/cpu/cluster.c +46 -0
65 lines not on this page · raw message
qom/cpu.c +1 -0
@@ -364,6 +364,7 @@ static void cpu_common_initfn(Object *obj)CPUClass *cc =CPU_GET_CLASS (obj); cpu->cpu_index =UNASSIGNED_CPU_INDEX ; + cpu->cluster_index =UNASSIGNED_CLUSTER_INDEX ; cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs;/* *-user doesn't have configurable SMP topology */ /* the default value is changed by qemu_init_vcpu() for softmmu */
Signature · 1 line
2.20.1
[Qemu-devel] [PULL 25/26] accel/tcg: Add cluster number to TCG TB hash
In reply to Peter MaydellInclude the cluster number in the hash we use to look up TBs. This is important because a TB that is valid for one cluster at a given physical address and set of CPU flags is not necessarily valid for another:
the two clusters may have different views of physical memory, or may have different CPU features (eg FPU present or absent).
We put the cluster number in the high 8 bits of the TB cflags. This gives us up to 256 clusters, which should be enough for anybody. If we ever need more, or need more bits in cflags for other purposes, we could make tb_hash_func() take more data (and expand qemu_xxhash7() to qemu_xxhash8()).
Message-id: [email protected]
--- include/exec/exec-all.h | 4 +++- accel/tcg/cpu-exec.c | 3 +++ accel/tcg/translate-all.c | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-)
include/exec/exec-all.h +3 -1
@@ -351,9 +351,11 @@ struct TranslationBlock {#define CF_USE_ICOUNT 0x00020000#define CF_INVALID 0x00040000/* TB is stale. Set with @jmp_lock held */ #define CF_PARALLEL 0x00080000/* Generate code for a parallel context */ +#define CF_CLUSTER_MASK 0xff000000/* Top 8 bits are cluster ID */ +#define CF_CLUSTER_SHIFT 24/* cflags' mask for hashing/comparison */ #define CF_HASH_MASK \ - (CF_COUNT_MASK | CF_LAST_IO | CF_USE_ICOUNT | CF_PARALLEL) + (CF_COUNT_MASK | CF_LAST_IO | CF_USE_ICOUNT | CF_PARALLEL | CF_CLUSTER_MASK)/* Per-vCPU dynamic tracing state used to generate this TB */ uint32_t trace_vcpu_dstate;
accel/tcg/cpu-exec.c +3 -0
@@ -325,6 +325,9 @@ TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc,struct tb_desc desc;uint32_t h; + cf_mask &= ~CF_CLUSTER_MASK ; + cf_mask |= cpu->cluster_index <<CF_CLUSTER_SHIFT ; + desc.env = (CPUArchState *)cpu->env_ptr; desc.cs_base = cs_base; desc.flags = flags;
accel/tcg/translate-all.c +3 -0
@@ -1688,6 +1688,9 @@ TranslationBlock *tb_gen_code(CPUState *cpu, cflags |=CF_NOCACHE |1 ; } + cflags &= ~CF_CLUSTER_MASK ; + cflags |= cpu->cluster_index <<CF_CLUSTER_SHIFT ; + buffer_overflow: tb =tb_alloc (pc);if (unlikely (!tb)) {
Signature · 1 line
2.20.1
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14 === TEST SCRIPT END ===
Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/tmp/qemu-test/install --python=/usr/bin/python3 --cross-prefix=x86_64-w64-mingw32- --enable-trace-backends=simple --enable-gnutls --enable-nettle --enable-curl --enable-vnc --enable-bzip2 --enable-guest-agent --with-sdlabi=2.0
ERROR: "x86_64-w64-mingw32-gcc" either does not exist or does not work
# QEMU configure log Fri Feb 1 12:51:18 UTC 2019
# Configured with: '/tmp/qemu-test/src/configure' '--enable-werror' '--target-list=x86_64-softmmu,aarch64-softmmu' '--prefix=/tmp/qemu-test/install' '--python=/usr/bin/python3' '--cross-prefix=x86_64-w64-mingw32-' '--enable-trace-backends=simple' '--enable-gnutls' '--enable-nettle' '--enable-curl' '--enable-vnc' '--enable-bzip2' '--enable-guest-agent' '--with-sdlabi=2.0'
---
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 636 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 638 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 640 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 642 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 644 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 646 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 648 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 650 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 652 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 654 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 688 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 690 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 696 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 702 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 708 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 710 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 716 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 722 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object check_define main
lines: 92 122 619 724 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
funcs: do_compiler do_cc compile_object main
lines: 92 122 1820 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
ccache: error: Failed to create temporary file for /var/tmp/ccache/tmp/qemu-conf.stdout: Permission denied
Failed to run 'configure'
Traceback (most recent call last):
File "./tests/docker/docker.py", line 563, in <module>
The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]