target-arm queue
Subsystems (2)
ARM queue, various patches accumulated over the Christmas break.
-- PMM
The following changes since commit 612061b277915fadd80631eb7a6926f48a110c44:
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-01-10' into staging (2018-01-11 11:52:40 +0000)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180111
for you to fetch changes up to 0cf09852015e47a5fbb974ff7ac320366afd21ee:
hw/intc/arm_gic: reserved register addresses are RAZ/WI (2018-01-11 13:25:40 +0000)
----------------------------------------------------------------
target-arm queue:
* add aarch64_be linux-user target
* Virt: ACPI: fix qemu assert due to re-assigned table data address
* imx_fec: various bug fixes and cleanups
* hw/timer/pxa2xx_timer: replace hw_error() -> qemu_log_mask()
* hw/sd/pxa2xx_mmci: add read/write() trace events
* linux-user/arm/nwfpe: Check coprocessor number for FPA emulation
* target/arm: Make disas_thumb2_insn() generate its own UNDEF exceptions
* hw/intc/arm_gicv3: Make reserved register addresses RAZ/WI
* hw/intc/arm_gic: reserved register addresses are RAZ/WI
----------------------------------------------------------------
Andrey Smirnov (11):
imx_fec: Do not link to netdev
imx_fec: Refactor imx_eth_enable_rx()
imx_fec: Change queue flushing heuristics
imx_fec: Move Tx frame buffer away from the stack
imx_fec: Use ENET_FTRL to determine truncation length
imx_fec: Use MIN instead of explicit ternary operator
imx_fec: Emulate SHIFT16 in ENETx_RACC
imx_fec: Add support for multiple Tx DMA rings
imx_fec: Use correct length for packet size
imx_fec: Fix a typo in imx_enet_receive()
imx_fec: Reserve full FSL_IMX25_FEC_SIZE page for the register file
Michael Weiser (8):
linux-user: Add support for big-endian aarch64
linux-user: Add separate aarch64_be uname
linux-user: Fix endianess of aarch64 signal trampoline
configure: Add aarch64_be-linux-user target
linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh
linux-user: Separate binfmt arm CPU families
linux-user: Activate armeb handler registration target/arm: Fix stlxp for aarch64_be
Peter Maydell (4):
linux-user/arm/nwfpe: Check coprocessor number for FPA emulation target/arm: Make disas_thumb2_insn() generate its own UNDEF exceptions hw/intc/arm_gicv3: Make reserved register addresses RAZ/WI hw/intc/arm_gic: reserved register addresses are RAZ/WI
Philippe Mathieu-Daudé (2):
hw/timer/pxa2xx_timer: replace hw_error() -> qemu_log_mask() hw/sd/pxa2xx_mmci: add read/write() trace events
Zhaoshenglong (1):
Virt: ACPI: fix qemu assert due to re-assigned table data address
configure | 5 +- include/hw/arm/fsl-imx25.h | 1 - include/hw/net/imx_fec.h | 27 +++- linux-user/aarch64/target_syscall.h | 4 + hw/arm/fsl-imx6.c | 1 + hw/arm/virt-acpi-build.c | 18 ++- hw/intc/arm_gic.c | 5 +- hw/intc/arm_gicv3_dist.c | 13 ++ hw/intc/arm_gicv3_its_common.c | 8 +- hw/intc/arm_gicv3_redist.c | 13 ++ hw/net/imx_fec.c | 210 +++++++++++++++++++++++------- hw/sd/pxa2xx_mmci.c | 78 +++++++---- hw/timer/pxa2xx_timer.c | 17 ++- linux-user/arm/nwfpe/fpa11.c | 9 ++ linux-user/main.c | 6 + linux-user/signal.c | 10 +- target/arm/helper-a64.c | 7 +- target/arm/translate.c | 23 ++-- default-configs/aarch64_be-linux-user.mak | 1 + hw/sd/trace-events | 4 + scripts/qemu-binfmt-conf.sh | 15 ++- 21 files changed, 356 insertions(+), 119 deletions(-) create mode 100644 default-configs/aarch64_be-linux-user.mak
[Qemu-devel] [PULL 08/26] target/arm: Fix stlxp for aarch64_be
From: Michael Weiser <[email protected]>
ldxp loads two consecutive doublewords from memory regardless of CPU endianness. On store, stlxp currently assumes to work with a 128bit value and consequently switches order in big-endian mode. With this change it packs the doublewords in reverse order in anticipation of the 128bit big-endian store operation interposing them so they end up in memory in the right order. This makes it work for both MTTCG and !MTTCG. It effectively implements the ARM ARM STLXP operation pseudo-code:
data = if BigEndian() then el1:el2 else el2:el1;
With this change an aarch64_be Linux 4.14.4 kernel succeeds to boot up in system emulation mode.
--- target/arm/helper-a64.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
target/arm/helper-a64.c +5 -2
@@ -506,8 +506,11 @@ static uint64_t do_paired_cmpxchg64_be(CPUARMState *env, uint64_t addr,Int128 oldv, cmpv, newv;bool success; - cmpv =int128_make128 (env->exclusive_val, env->exclusive_high); - newv =int128_make128 (new_lo, new_hi); +/* high and low need to be switched here because this is not actually a +* 128bit store but two doublewords stored consecutively +*/ + cmpv =int128_make128 (env->exclusive_high, env->exclusive_val); + newv =int128_make128 (new_hi, new_lo);if (parallel) {#ifndef CONFIG_ATOMIC128
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 10/26] imx_fec: Do not link to netdev
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
Binding to a particular netdev doesn't seem to belong to this layer and should probably be done as a part of board or SoC specific code.
Convert all of the users of this IP block to useqdev_set_nic_properties() instead.
--- hw/arm/fsl-imx6.c | 1 + hw/net/imx_fec.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-)
hw/arm/fsl-imx6.c +1 -0
@@ -385,6 +385,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) spi_table[i].irq)); } +qdev_set_nic_properties (DEVICE (&s->eth), &nd_table[0 ]);object_property_set_bool (OBJECT (&s->eth), true,"realized" , &err);if (err) {error_propagate (errp, err);
hw/net/imx_fec.c +0 -2
@@ -1171,8 +1171,6 @@ static void imx_eth_realize(DeviceState *dev, Error **errp)qemu_macaddr_default_if_unset (&s->conf.macaddr); - s->conf.peers.ncs[0 ] = nd_table[0 ].netdev; - s->nic =qemu_new_nic (&imx_eth_net_info, &s->conf,object_get_typename (OBJECT (dev)),DEVICE (dev)->id, s);
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 09/26] Virt: ACPI: fix qemu assert due to re-assigned table data address
In reply to Peter MaydellFrom: Zhaoshenglong <[email protected]>
acpi_data_push uses g_array_set_size to resize the memory size. If there is no enough contiguous memory, the address will be changed. If we use the old value, it will assert.
qemu-kvm: hw/acpi/bios-linker-loader.c:214: bios_linker_loader_add_checksum:
Assertion start_offset < file->blob->len' failed.
This issue only happens in building SRAT table now but here we unify the pattern for other tables as well to avoid possible issues in the future.
--- hw/arm/virt-acpi-build.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
hw/arm/virt-acpi-build.c +11 -7
@@ -453,6 +453,7 @@ build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)AcpiSerialPortConsoleRedirection *spcr;const MemMapEntry *uart_memmap = &vms->memmap[VIRT_UART ];int irq = vms->irqmap[VIRT_UART ] +ARM_SPI_BASE ; +int spcr_start = table_data->len; spcr =acpi_data_push (table_data,sizeof (*spcr));
@@ -476,8 +477,8 @@ build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) spcr->pci_device_id =0xffff ;/* PCI Device ID: not a PCI device */ spcr->pci_vendor_id =0xffff ;/* PCI Vendor ID: not a PCI device */ -build_header (linker, table_data, (void *)spcr,"SPCR" ,sizeof (*spcr),2 , -NULL ,NULL ); +build_header (linker, table_data, (void *)(table_data->data + spcr_start), +"SPCR" , table_data->len - spcr_start,2 ,NULL ,NULL ); } static void
@@ -512,8 +513,8 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) mem_base += numa_info[i].node_mem; } -build_header (linker, table_data, (void *)srat,"SRAT" , - table_data->len - srat_start,3 ,NULL ,NULL ); +build_header (linker, table_data, (void *)(table_data->data + srat_start), +"SRAT" , table_data->len - srat_start,3 ,NULL ,NULL ); } static void
@@ -522,6 +523,7 @@ build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)AcpiTableMcfg *mcfg;const MemMapEntry *memmap = vms->memmap;int len =sizeof (*mcfg) +sizeof (mcfg->allocation[0 ]); +int mcfg_start = table_data->len; mcfg =acpi_data_push (table_data, len); mcfg->allocation[0 ].address =cpu_to_le64 (memmap[VIRT_PCIE_ECAM ].base);
@@ -532,7 +534,8 @@ build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) mcfg->allocation[0 ].end_bus_number = (memmap[VIRT_PCIE_ECAM ].size /PCIE_MMCFG_SIZE_MIN ) -1 ; -build_header (linker, table_data, (void *)mcfg,"MCFG" , len,1 ,NULL ,NULL ); +build_header (linker, table_data, (void *)(table_data->data + mcfg_start), +"MCFG" , table_data->len - mcfg_start,1 ,NULL ,NULL ); }/* GTDT */
@@ -651,6 +654,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)static void build_fadt (GArray *table_data,BIOSLinker *linker,VirtMachineState *vms,unsigned dsdt_tbl_offset) { +int fadt_start = table_data->len;AcpiFadtDescriptorRev5_1 *fadt =acpi_data_push (table_data,sizeof (*fadt));unsigned xdsdt_entry_offset = (char *)&fadt->x_dsdt - table_data->data;uint16_t bootflags;
@@ -681,8 +685,8 @@ static void build_fadt(GArray *table_data, BIOSLinker *linker,ACPI_BUILD_TABLE_FILE , xdsdt_entry_offset,sizeof (fadt->x_dsdt), ACPI_BUILD_TABLE_FILE, dsdt_tbl_offset); -build_header (linker, table_data, - (void *)fadt,"FACP" ,sizeof (*fadt),5 ,NULL ,NULL ); +build_header (linker, table_data, (void *)(table_data->data + fadt_start), +"FACP" , table_data->len - fadt_start,5 ,NULL ,NULL ); }/* DSDT */
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 11/26] imx_fec: Refactor imx_eth_enable_rx()
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
Refactor imx_eth_enable_rx() to have more meaningfull variable name than 'tmp' and to reduce number of logical negations done.
--- hw/net/imx_fec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/net/imx_fec.c +4 -4
@@ -536,19 +536,19 @@ static void imx_eth_do_tx(IMXFECState *s)static void imx_eth_enable_rx (IMXFECState *s) {IMXFECBufDesc bd; -bool tmp; +bool rx_ring_full;imx_fec_read_bd (&bd, s->rx_descriptor); - tmp = ((bd.flags &ENET_BD_E ) !=0 ); + rx_ring_full = !(bd.flags &ENET_BD_E ); -if (!tmp) { +if (rx_ring_full) {FEC_PRINTF ("RX buffer full\n" ); }else if (!s->regs[ENET_RDAR ]) {qemu_flush_queued_packets (qemu_get_queue (s->nic)); } - s->regs[ENET_RDAR ] = tmp ?ENET_RDAR_RDAR :0 ; + s->regs[ENET_RDAR ] = rx_ring_full ?0 :ENET_RDAR_RDAR ; }static void imx_eth_reset (DeviceState *d)
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 06/26] linux-user: Separate binfmt arm CPU families
In reply to Peter MaydellFrom: Michael Weiser <[email protected]>
Give big-endian arm and aarch64 CPUs their own family in qemu-binfmt-conf.sh to make sure we register qemu-user for binaries of the opposite endianness on arm and aarch64. Apart from the family assignments of the magic values, qemu_get_family() needs to be able to distinguish the two and recognise aarch64{,_be} as well.
Message-id: [email protected]
--- scripts/qemu-binfmt-conf.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
scripts/qemu-binfmt-conf.sh +6 -3
@@ -24,7 +24,7 @@ arm_family=arm armeb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28' armeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' -armeb_family=arm +armeb_family=armeb sparc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02' sparc_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
@@ -94,7 +94,7 @@ aarch64_family=arm aarch64_be_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7' aarch64_be_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' -aarch64_be_family=arm +aarch64_be_family=armeb hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f' hppa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
@@ -115,9 +115,12 @@ qemu_get_family() { ppc64el|ppc64le) echo "ppcle" ;; - arm|armel|armhf|arm64|armv[4-9]*) + arm|armel|armhf|arm64|armv[4-9]*l|aarch64) echo "arm" ;; + armeb|armv[4-9]*b|aarch64_be) + echo "armeb" + ;; sparc*) echo "sparc" ;;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 07/26] linux-user: Activate armeb handler registration
In reply to Peter MaydellFrom: Michael Weiser <[email protected]>
armeb is missing from the target list in qemu-binfmt-conf.sh. Add it so the handler for those binaries gets registered by the script.
Message-id: [email protected]
--- scripts/qemu-binfmt-conf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qemu-binfmt-conf.sh +1 -1
@@ -2,7 +2,7 @@ # enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390/HPPA # program execution by the kernel -qemu_target_list="i386 i486 alpha arm sparc32plus ppc ppc64 ppc64le m68k \ +qemu_target_list="i386 i486 alpha arm armeb sparc32plus ppc ppc64 ppc64le m68k \ mips mipsel mipsn32 mipsn32el mips64 mips64el \ sh4 sh4eb s390x aarch64 aarch64_be hppa"
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 13/26] imx_fec: Move Tx frame buffer away from the stack
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
Make Tx frame assembly buffer to be a paort of IMXFECState structure to avoid a concern about having large data buffer on the stack.
--- include/hw/net/imx_fec.h | 3 +++ hw/net/imx_fec.c | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-)
include/hw/net/imx_fec.h +3 -0
@@ -252,6 +252,9 @@ typedef struct IMXFECState {uint32_t phy_int_mask;bool is_fec; + +/* Buffer used to assemble a Tx frame */ + uint8_t frame[ENET_MAX_FRAME_SIZE]; } IMXFECState;#endif
hw/net/imx_fec.c +11 -11
@@ -405,8 +405,7 @@ static void imx_eth_update(IMXFECState *s)static void imx_fec_do_tx (IMXFECState *s) {int frame_size =0 , descnt =0 ; -uint8_t frame[ENET_MAX_FRAME_SIZE ]; -uint8_t *ptr = frame; +uint8_t *ptr = s->frame;uint32_t addr = s->tx_descriptor;while (descnt++ <IMX_MAX_DESC ) {
@@ -431,8 +430,8 @@ static void imx_fec_do_tx(IMXFECState *s) frame_size += len;if (bd.flags &ENET_BD_L ) {/* Last buffer in frame. */ -qemu_send_packet (qemu_get_queue (s->nic), frame, frame_size); - ptr = frame; +qemu_send_packet (qemu_get_queue (s->nic), s->frame, frame_size); + ptr = s->frame; frame_size =0 ; s->regs[ENET_EIR ] |=ENET_INT_TXF ; }
@@ -456,8 +455,7 @@ static void imx_fec_do_tx(IMXFECState *s)static void imx_enet_do_tx (IMXFECState *s) {int frame_size =0 , descnt =0 ; -uint8_t frame[ENET_MAX_FRAME_SIZE ]; -uint8_t *ptr = frame; +uint8_t *ptr = s->frame;uint32_t addr = s->tx_descriptor;while (descnt++ <IMX_MAX_DESC ) {
@@ -482,13 +480,13 @@ static void imx_enet_do_tx(IMXFECState *s) frame_size += len;if (bd.flags &ENET_BD_L ) {if (bd.option &ENET_BD_PINS ) { -struct ip_header *ip_hd =PKT_GET_IP_HDR (frame); +struct ip_header *ip_hd =PKT_GET_IP_HDR (s->frame);if (IP_HEADER_VERSION (ip_hd) ==4 ) { -net_checksum_calculate (frame, frame_size); +net_checksum_calculate (s->frame, frame_size); } }if (bd.option &ENET_BD_IINS ) { -struct ip_header *ip_hd =PKT_GET_IP_HDR (frame); +struct ip_header *ip_hd =PKT_GET_IP_HDR (s->frame);/* We compute checksum only for IPv4 frames */ if (IP_HEADER_VERSION (ip_hd) ==4 ) {uint16_t csum;
@@ -498,8 +496,10 @@ static void imx_enet_do_tx(IMXFECState *s) } }/* Last buffer in frame. */ -qemu_send_packet (qemu_get_queue (s->nic), frame, len); - ptr = frame; + +qemu_send_packet (qemu_get_queue (s->nic), s->frame, len); + ptr = s->frame; + frame_size =0 ;if (bd.option &ENET_BD_TX_INT ) { s->regs[ENET_EIR ] |=ENET_INT_TXF ;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 05/26] linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh
In reply to Peter MaydellFrom: Michael Weiser <[email protected]>
As we now have a linux-user aarch64_be target, we can add it to the list of supported targets in qemu-binfmt-conf.sh
Message-id: [email protected]
--- scripts/qemu-binfmt-conf.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/qemu-binfmt-conf.sh +5 -1
@@ -4,7 +4,7 @@ qemu_target_list="i386 i486 alpha arm sparc32plus ppc ppc64 ppc64le m68k \ mips mipsel mipsn32 mipsn32el mips64 mips64el \ -sh4 sh4eb s390x aarch64 hppa" +sh4 sh4eb s390x aarch64 aarch64_be hppa" i386_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00' i386_mask='\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
@@ -92,6 +92,10 @@ aarch64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x aarch64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' aarch64_family=arm +aarch64_be_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7' +aarch64_be_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' +aarch64_be_family=arm + hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f' hppa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' hppa_family=hppa
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 01/26] linux-user: Add support for big-endian aarch64
In reply to Peter MaydellFrom: Michael Weiser <[email protected]>
Enable big-endian mode for data accesses on aarch64 for big-endian linux user mode. Activate it for all exception levels as documented by ARM:
Set the SCTLR EE bit for ELs 1 through 3. Additionally set bit E0E in EL1 to enable it in EL0 as well.
Message-id: [email protected]
--- linux-user/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
linux-user/main.c +6 -0
@@ -4629,6 +4629,12 @@ int main(int argc, char **argv, char **envp) } env->pc = regs->pc; env->xregs[31 ] = regs->sp; +#ifdef TARGET_WORDS_BIGENDIAN + env->cp15.sctlr_el[1 ] |=SCTLR_E0E ; +for (i =1 ; i <4 ; ++i) { + env->cp15.sctlr_el[i] |=SCTLR_EE ; + } +#endif }#elif defined(TARGET_ARM) {
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 02/26] linux-user: Add separate aarch64_be uname
In reply to Peter MaydellFrom: Michael Weiser <[email protected]>
Make big-endian aarch64 systems identify as aarch64_be as expected by big-endian userland and toolchains.
Message-id: [email protected]
--- linux-user/aarch64/target_syscall.h | 4 ++++ 1 file changed, 4 insertions(+)
linux-user/aarch64/target_syscall.h +4 -0
@@ -8,7 +8,11 @@ struct target_pt_regs {uint64_t pstate; }; +#if defined(TARGET_WORDS_BIGENDIAN ) +#define UNAME_MACHINE "aarch64_be" +#else #define UNAME_MACHINE "aarch64" +#endif #define UNAME_MINIMUM_RELEASE "3.8.0"#define TARGET_CLONE_BACKWARDS #define TARGET_MINSIGSTKSZ 2048
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 03/26] linux-user: Fix endianess of aarch64 signal trampoline
In reply to Peter MaydellFrom: Michael Weiser <[email protected]>
Since for aarch64 the signal trampoline is synthesized directly into the signal frame we need to make sure the instructions end up little-endian. Otherwise the wrong endianness will cause a SIGILL upon return from the signal handler on big-endian targets.
Message-id: [email protected]
--- linux-user/signal.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
linux-user/signal.c +7 -3
@@ -1599,9 +1599,13 @@ static void target_setup_frame(int usig, struct target_sigaction *ka,if (ka->sa_flags &TARGET_SA_RESTORER ) { return_addr = ka->sa_restorer; }else { -/* mov x8,#__NR_rt_sigreturn; svc #0 */ -__put_user (0xd2801168 , &frame->tramp[0 ]); -__put_user (0xd4000001 , &frame->tramp[1 ]); +/* +* mov x8,#__NR_rt_sigreturn; svc #0 +* Since these are instructions they need to be put as little-endian +* regardless of target default or current CPU endianness. +*/ +__put_user_e (0xd2801168 , &frame->tramp[0 ], le); +__put_user_e (0xd4000001 , &frame->tramp[1 ], le); return_addr = frame_addr + offsetof(struct target_rt_sigframe , tramp); } env->xregs[0 ] = usig;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 04/26] configure: Add aarch64_be-linux-user target
In reply to Peter MaydellFrom: Michael Weiser <[email protected]>
Add target aarch64_be-linux-user. This allows a qemu-aarch64_be binary to be built that will run big-endian aarch64 binaries.
Message-id: [email protected]
--- configure | 5 +++-- default-configs/aarch64_be-linux-user.mak | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 default-configs/aarch64_be-linux-user.mak
configure +3 -2
@@ -6439,7 +6439,7 @@ target_name=$(echo $target | cut -d '-' -f 1) target_bigendian="no" case "$target_name" in - armeb|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) + armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) target_bigendian=yes ;; esac
@@ -6494,7 +6494,8 @@ case "$target_name" in mttcg="yes" gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" ;; - aarch64) + aarch64|aarch64_be) + TARGET_ARCH=aarch64 TARGET_BASE_ARCH=arm bflt="yes" mttcg="yes"
default-configs/aarch64_be-linux-user.mak new file +1 -0
@@ -0,0 +1 @@ +# Default configuration for aarch64_be-linux-user
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 16/26] imx_fec: Emulate SHIFT16 in ENETx_RACC
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
Needed to support latest Linux kernel driver which relies on that functionality.
--- include/hw/net/imx_fec.h | 2 ++ hw/net/imx_fec.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+)
include/hw/net/imx_fec.h +2 -0
@@ -170,6 +170,8 @@#define ENET_TWFR_TFWR_LENGTH (6)#define ENET_TWFR_STRFWD (1 << 8) +#define ENET_RACC_SHIFT16 BIT(7) +/* Buffer Descriptor. */ typedef struct { uint16_t length;
hw/net/imx_fec.c +23 -0
@@ -1037,6 +1037,7 @@ static ssize_t imx_enet_receive(NetClientState *nc, const uint8_t *buf,uint8_t *crc_ptr;unsigned int buf_len;size_t size = len; +bool shift16 = s->regs[ENET_RACC ] &ENET_RACC_SHIFT16 ;FEC_PRINTF ("len %d\n" , (int )size);
@@ -1051,6 +1052,10 @@ static ssize_t imx_enet_receive(NetClientState *nc, const uint8_t *buf, crc =cpu_to_be32 (crc32 (~0 , buf, size)); crc_ptr = (uint8_t *) &crc; +if (shift16) { + size +=2 ; + } +/* Huge frames are truncted. */ if (size > s->regs[ENET_FTRL ]) { size = s->regs[ENET_FTRL ];
@@ -1087,6 +1092,24 @@ static ssize_t imx_enet_receive(NetClientState *nc, const uint8_t *buf, buf_len += size -4 ; } buf_addr = bd.data; + +if (shift16) { +/* +* If SHIFT16 bit of ENETx_RACC register is set we need to +* align the payload to 4-byte boundary. +*/ +const uint8_t zeros[2 ] = {0 }; + +dma_memory_write (&address_space_memory, buf_addr, + zeros,sizeof (zeros)); + + buf_addr +=sizeof (zeros); + buf_len -=sizeof (zeros); + +/* We only do this once per Ethernet frame */ + shift16 = false; + } +dma_memory_write (&address_space_memory, buf_addr, buf, buf_len); buf += buf_len;if (size <4 ) {
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 12/26] imx_fec: Change queue flushing heuristics
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
In current implementation, packet queue flushing logic seem to suffer from a deadlock like scenario if a packet is received by the interface before before Rx ring is initialized by Guest's driver. Consider the following sequence of events:
1. A QEMU instance is started against a TAP device on Linux host, running Linux guest, e. g., something to the effect of:
qemu-system-arm \
-net nic,model=imx.fec,netdev=lan0 \
netdev tap,id=lan0,ifname=tap0,script=no,downscript=no \
... rest of the arguments ...
2. Once QEMU starts, but before guest reaches the point where FEC deriver is done initializing the HW, Guest, via TAP interface, receives a number of multicast MDNS packets from Host (not necessarily true for every OS, but it happens at least on Fedora 25)
3. Recieving a packet in such a state results in imx_eth_can_receive() returning '0', which in turn causes tap_send() to disable corresponding event (tap.c:203)
4. Once Guest's driver reaches the point where it is ready to recieve packets it prepares Rx ring descriptors and writes ENET_RDAR_RDAR to ENET_RDAR register to indicate to HW that more descriptors are ready. And at this points emulation layer does this:
s->regs[index] = ENET_RDAR_RDAR;
imx_eth_enable_rx(s);
which, combined with:
if (!s->regs[ENET_RDAR]) {
qemu_flush_queued_packets(qemu_get_queue(s->nic));
}
results in Rx queue never being flushed and corresponding I/O event beign disabled.
To prevent the problem, change the code to always flush packet queue when ENET_RDAR transitions 0 -> ENET_RDAR_RDAR.
--- hw/net/imx_fec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
hw/net/imx_fec.c +6 -6
@@ -533,7 +533,7 @@ static void imx_eth_do_tx(IMXFECState *s) } } -static void imx_eth_enable_rx (IMXFECState *s) +static void imx_eth_enable_rx (IMXFECState *s,bool flush) {IMXFECBufDesc bd;bool rx_ring_full;
@@ -544,7 +544,7 @@ static void imx_eth_enable_rx(IMXFECState *s)if (rx_ring_full) {FEC_PRINTF ("RX buffer full\n" ); - }else if (!s->regs[ENET_RDAR ]) { + }else if (flush) {qemu_flush_queued_packets (qemu_get_queue (s->nic)); }
@@ -807,7 +807,7 @@ static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value,if (s->regs[ENET_ECR ] &ENET_ECR_ETHEREN ) {if (!s->regs[index]) { s->regs[index] =ENET_RDAR_RDAR ; -imx_eth_enable_rx (s); +imx_eth_enable_rx (s, true); } }else { s->regs[index] =0 ;
@@ -930,7 +930,7 @@ static int imx_eth_can_receive(NetClientState *nc)FEC_PRINTF ("\n" ); -return s->regs[ENET_RDAR ] ?1 :0 ; +return !!s->regs[ENET_RDAR ]; } static ssize_t imx_fec_receive(NetClientState *nc, const uint8_t *buf,
@@ -1020,7 +1020,7 @@ static ssize_t imx_fec_receive(NetClientState *nc, const uint8_t *buf, } } s->rx_descriptor = addr; -imx_eth_enable_rx (s); +imx_eth_enable_rx (s, false);imx_eth_update (s);return len; }
@@ -1116,7 +1116,7 @@ static ssize_t imx_enet_receive(NetClientState *nc, const uint8_t *buf, } } s->rx_descriptor = addr; -imx_eth_enable_rx (s); +imx_eth_enable_rx (s, false);imx_eth_update (s);return len; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 15/26] imx_fec: Use MIN instead of explicit ternary operator
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
--- hw/net/imx_fec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/imx_fec.c +1 -1
@@ -1076,7 +1076,7 @@ static ssize_t imx_enet_receive(NetClientState *nc, const uint8_t *buf, TYPE_IMX_FEC, __func__);break ; } - buf_len = (size <= s->regs[ENET_MRBR ]) ? size : s->regs[ENET_MRBR ]; + buf_len =MIN (size, s->regs[ENET_MRBR ]); bd.length = buf_len; size -= buf_len;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 18/26] imx_fec: Use correct length for packet size
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
Use 'frame_size' instead of 'len' when calling qemu_send_packet(), failing to do so results in malformed packets send in case when that packed is fragmented into multiple DMA transactions.
--- hw/net/imx_fec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/imx_fec.c +1 -1
@@ -556,7 +556,7 @@ static void imx_enet_do_tx(IMXFECState *s, uint32_t index) }/* Last buffer in frame. */ -qemu_send_packet (qemu_get_queue (s->nic), s->frame, len); +qemu_send_packet (qemu_get_queue (s->nic), s->frame, frame_size); ptr = s->frame; frame_size =0 ;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 19/26] imx_fec: Fix a typo in imx_enet_receive()
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
--- hw/net/imx_fec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/imx_fec.c +1 -1
@@ -1150,7 +1150,7 @@ static ssize_t imx_enet_receive(NetClientState *nc, const uint8_t *buf, size +=2 ; } -/* Huge frames are truncted. */ +/* Huge frames are truncated. */ if (size > s->regs[ENET_FTRL ]) { size = s->regs[ENET_FTRL ]; flags |=ENET_BD_TR |ENET_BD_LG ;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 14/26] imx_fec: Use ENET_FTRL to determine truncation length
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
Frame truncation length, TRUNC_FL, is determined by the contents of ENET_FTRL register, so convert the code to use it instead of a hardcoded constant.
To avoid the case where TRUNC_FL is greater that ENET_MAX_FRAME_SIZE, increase the value of the latter to its theoretical maximum of 16K.
--- include/hw/net/imx_fec.h | 3 ++- hw/net/imx_fec.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
include/hw/net/imx_fec.h +2 -1
@@ -86,7 +86,6 @@#define ENET_TCCR3 393#define ENET_MAX 400 -#define ENET_MAX_FRAME_SIZE 2032/* EIR and EIMR */ #define ENET_INT_HB (1 << 31)
@@ -155,6 +154,8 @@#define ENET_RCR_NLC (1 << 30)#define ENET_RCR_GRS (1 << 31) +#define ENET_MAX_FRAME_SIZE (1 << ENET_RCR_MAX_FL_LENGTH) +/* TCR */ #define ENET_TCR_GTS (1 << 0)#define ENET_TCR_FDEN (1 << 2)
hw/net/imx_fec.c +2 -2
@@ -1052,8 +1052,8 @@ static ssize_t imx_enet_receive(NetClientState *nc, const uint8_t *buf, crc_ptr = (uint8_t *) &crc;/* Huge frames are truncted. */ -if (size >ENET_MAX_FRAME_SIZE ) { - size =ENET_MAX_FRAME_SIZE ; +if (size > s->regs[ENET_FTRL ]) { + size = s->regs[ENET_FTRL ]; flags |=ENET_BD_TR |ENET_BD_LG ; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 20/26] imx_fec: Reserve full FSL_IMX25_FEC_SIZE page for the register file
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
Some i.MX SoCs (e.g. i.MX7) have FEC registers going as far as offset 0x614, so to avoid getting aborts when accessing those on QEMU, extend the register file to cover FSL_IMX25_FEC_SIZE(16K) of address space instead of just 1K.
--- include/hw/arm/fsl-imx25.h | 1 - include/hw/net/imx_fec.h | 1 + hw/net/imx_fec.c | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-)
include/hw/arm/fsl-imx25.h +0 -1
@@ -192,7 +192,6 @@ typedef struct FslIMX25State {#define FSL_IMX25_UART5_ADDR 0x5002C000#define FSL_IMX25_UART5_SIZE 0x4000#define FSL_IMX25_FEC_ADDR 0x50038000 -#define FSL_IMX25_FEC_SIZE 0x4000#define FSL_IMX25_CCM_ADDR 0x53F80000#define FSL_IMX25_CCM_SIZE 0x4000#define FSL_IMX25_GPT4_ADDR 0x53F84000
include/hw/net/imx_fec.h +1 -0
@@ -245,6 +245,7 @@ typedef struct {#define ENET_TX_RING_NUM 3 +#define FSL_IMX25_FEC_SIZE 0x4000 typedef struct IMXFECState { /*< private >*/
hw/net/imx_fec.c +1 -1
@@ -1281,7 +1281,7 @@ static void imx_eth_realize(DeviceState *dev, Error **errp)SysBusDevice *sbd =SYS_BUS_DEVICE (dev);memory_region_init_io (&s->iomem,OBJECT (dev), &imx_eth_ops, s, -TYPE_IMX_FEC ,0x400 ); +TYPE_IMX_FEC ,FSL_IMX25_FEC_SIZE );sysbus_init_mmio (sbd, &s->iomem);sysbus_init_irq (sbd, &s->irq[0 ]);sysbus_init_irq (sbd, &s->irq[1 ]);
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 21/26] hw/timer/pxa2xx_timer: replace hw_error() -> qemu_log_mask()
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Message-id: [email protected]
--- hw/timer/pxa2xx_timer.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
hw/timer/pxa2xx_timer.c +15 -2
@@ -13,6 +13,7 @@#include "sysemu/sysemu.h" #include "hw/arm/pxa.h" #include "hw/sysbus.h" +#include "qemu/log.h" #define OSMR0 0x00#define OSMR1 0x04
@@ -252,8 +253,14 @@ static uint64_t pxa2xx_timer_read(void *opaque, hwaddr offset,case OSNR :return s->snapshot;default : +qemu_log_mask (LOG_UNIMP , +"%s: unknown register 0x%02" HWADDR_PRIx"\n" , + __func__, offset); +break ; badreg: -hw_error ("pxa2xx_timer_read: Bad offset " REG_FMT "\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: incorrect register 0x%02" HWADDR_PRIx"\n" , + __func__, offset); }return 0 ;
@@ -377,8 +384,14 @@ static void pxa2xx_timer_write(void *opaque, hwaddr offset, }break ;default : +qemu_log_mask (LOG_UNIMP , +"%s: unknown register 0x%02" HWADDR_PRIx" " +"(value 0x%08" PRIx64")\n" , __func__, offset, value); +break ; badreg: -hw_error ("pxa2xx_timer_write: Bad offset " REG_FMT "\n" , offset); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: incorrect register 0x%02" HWADDR_PRIx" " +"(value 0x%08" PRIx64")\n" , __func__, offset, value); } }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 17/26] imx_fec: Add support for multiple Tx DMA rings
In reply to Peter MaydellFrom: Andrey Smirnov <[email protected]>
More recent version of the IP block support more than one Tx DMA ring, so add the code implementing that feature.
--- include/hw/net/imx_fec.h | 18 ++++++- hw/net/imx_fec.c | 133 ++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 130 insertions(+), 21 deletions(-)
include/hw/net/imx_fec.h +16 -2
@@ -52,6 +52,8 @@#define ENET_TFWR 81#define ENET_FRBR 83#define ENET_FRSR 84 +#define ENET_TDSR1 89 +#define ENET_TDSR2 92#define ENET_RDSR 96#define ENET_TDSR 97#define ENET_MRBR 98
@@ -66,6 +68,8 @@#define ENET_FTRL 108#define ENET_TACC 112#define ENET_RACC 113 +#define ENET_TDAR1 121 +#define ENET_TDAR2 123#define ENET_MIIGSK_CFGR 192#define ENET_MIIGSK_ENR 194#define ENET_ATCR 256
@@ -105,13 +109,18 @@#define ENET_INT_WAKEUP (1 << 17)#define ENET_INT_TS_AVAIL (1 << 16)#define ENET_INT_TS_TIMER (1 << 15) +#define ENET_INT_TXF2 (1 << 7) +#define ENET_INT_TXB2 (1 << 6) +#define ENET_INT_TXF1 (1 << 3) +#define ENET_INT_TXB1 (1 << 2)#define ENET_INT_MAC (ENET_INT_HB | ENET_INT_BABR | ENET_INT_BABT | \ ENET_INT_GRA | ENET_INT_TXF | ENET_INT_TXB | \ ENET_INT_RXF | ENET_INT_RXB | ENET_INT_MII | \ ENET_INT_EBERR | ENET_INT_LC | ENET_INT_RL | \ ENET_INT_UN | ENET_INT_PLR | ENET_INT_WAKEUP | \ - ENET_INT_TS_AVAIL) + ENET_INT_TS_AVAIL | ENET_INT_TXF1 | \ + ENET_INT_TXB1 | ENET_INT_TXF2 | ENET_INT_TXB2)/* RDAR */ #define ENET_RDAR_RDAR (1 << 24)
@@ -234,6 +243,9 @@ typedef struct {#define ENET_BD_BDU (1 << 31) +#define ENET_TX_RING_NUM 3 + + typedef struct IMXFECState { /*< private >*/ SysBusDevice parent_obj;
@@ -246,7 +258,9 @@ typedef struct IMXFECState {uint32_t regs[ENET_MAX ];uint32_t rx_descriptor; -uint32_t tx_descriptor; + +uint32_t tx_descriptor[ENET_TX_RING_NUM ]; +uint32_t tx_ring_num;uint32_t phy_status;uint32_t phy_control;
hw/net/imx_fec.c +114 -19
234 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 26/26] hw/intc/arm_gic: reserved register addresses are RAZ/WI
In reply to Peter MaydellThe GICv2 specification says that reserved register addresses must RAZ/WI; now that we implement external abort handling for Arm CPUs this means we must return MEMTX_OK rather than MEMTX_ERROR, to avoid generating a spurious guest data abort.
Message-id: [email protected]
--- hw/intc/arm_gic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/intc/arm_gic.c +3 -2
@@ -1261,7 +1261,8 @@ static MemTxResult gic_cpu_read(GICState *s, int cpu, int offset,default :qemu_log_mask (LOG_GUEST_ERROR ,"gic_cpu_read: Bad offset %x\n" , (int )offset); -return MEMTX_ERROR ; + *data =0 ; +break ; }return MEMTX_OK ; }
@@ -1329,7 +1330,7 @@ static MemTxResult gic_cpu_write(GICState *s, int cpu, int offset,default :qemu_log_mask (LOG_GUEST_ERROR ,"gic_cpu_write: Bad offset %x\n" , (int )offset); -return MEMTX_ERROR ; +return MEMTX_OK ; }gic_update (s);return MEMTX_OK ;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 22/26] hw/sd/pxa2xx_mmci: add read/write() trace events
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Message-id: [email protected]
--- hw/sd/pxa2xx_mmci.c | 78 ++++++++++++++++++++++++++++++++++------------------- hw/sd/trace-events | 4 +++ 2 files changed, 54 insertions(+), 28 deletions(-)
hw/sd/pxa2xx_mmci.c +50 -28
@@ -19,6 +19,8 @@#include "hw/qdev.h" #include "hw/qdev-properties.h" #include "qemu/error-report.h" +#include "qemu/log.h" +#include "trace.h" #define TYPE_PXA2XX_MMCI "pxa2xx-mmci"#define PXA2XX_MMCI (obj) OBJECT_CHECK(PXA2xxMMCIState, (obj), TYPE_PXA2XX_MMCI)
@@ -278,45 +280,56 @@ static void pxa2xx_mmci_wakequeues(PXA2xxMMCIState *s)static uint64_t pxa2xx_mmci_read (void *opaque,hwaddr offset,unsigned size) {PXA2xxMMCIState *s = (PXA2xxMMCIState *) opaque; -uint32_t ret; +uint32_t ret =0 ;switch (offset) {case MMC_STRPCL : -return 0 ; +break ;case MMC_STAT : -return s->status; + ret = s->status; +break ;case MMC_CLKRT : -return s->clkrt; + ret = s->clkrt; +break ;case MMC_SPI : -return s->spi; + ret = s->spi; +break ;case MMC_CMDAT : -return s->cmdat; + ret = s->cmdat; +break ;case MMC_RESTO : -return s->resp_tout; + ret = s->resp_tout; +break ;case MMC_RDTO : -return s->read_tout; + ret = s->read_tout; +break ;case MMC_BLKLEN : -return s->blklen; + ret = s->blklen; +break ;case MMC_NUMBLK : -return s->numblk; + ret = s->numblk; +break ;case MMC_PRTBUF : -return 0 ; +break ;case MMC_I_MASK : -return s->intmask; + ret = s->intmask; +break ;case MMC_I_REG : -return s->intreq; + ret = s->intreq; +break ;case MMC_CMD : -return s->cmd |0x40 ; + ret = s->cmd |0x40 ; +break ;case MMC_ARGH : -return s->arg >>16 ; + ret = s->arg >>16 ; +break ;case MMC_ARGL : -return s->arg &0xffff ; + ret = s->arg &0xffff ; +break ;case MMC_RES : -if (s->resp_len <9 ) -return s->resp_fifo[s->resp_len ++]; -return 0 ; + ret = (s->resp_len <9 ) ? s->resp_fifo[s->resp_len++] :0 ; +break ;case MMC_RXFIFO : - ret =0 ;while (size-- && s->rx_len) { ret |= s->rx_fifo[s->rx_start++] << (size <<3 ); s->rx_start &=0x1f ;
@@ -324,16 +337,20 @@ static uint64_t pxa2xx_mmci_read(void *opaque, hwaddr offset, unsigned size) } s->intreq &= ~INT_RXFIFO_REQ ;pxa2xx_mmci_fifo_update (s); -return ret; +break ;case MMC_RDWAIT : -return 0 ; +break ;case MMC_BLKS_REM : -return s->numblk; + ret = s->numblk; +break ;default : -hw_error ("%s: Bad offset " REG_FMT "\n" , __FUNCTION__, offset); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: incorrect register 0x%02" HWADDR_PRIx"\n" , + __func__, offset); } +trace_pxa2xx_mmci_read (size, offset, ret); -return 0 ; +return ret; } static void pxa2xx_mmci_write(void *opaque,
@@ -341,6 +358,7 @@ static void pxa2xx_mmci_write(void *opaque, {PXA2xxMMCIState *s = (PXA2xxMMCIState *) opaque; +trace_pxa2xx_mmci_write (size, offset, value);switch (offset) {case MMC_STRPCL :if (value &STRPCL_STRT_CLK ) {
@@ -368,8 +386,10 @@ static void pxa2xx_mmci_write(void *opaque,case MMC_SPI : s->spi = value &0xf ; -if (value &SPI_SPI_MODE ) -printf ("%s: attempted to use card in SPI mode\n" , __FUNCTION__); +if (value &SPI_SPI_MODE ) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: attempted to use card in SPI mode\n" , __func__); + }break ;case MMC_CMDAT :
@@ -442,7 +462,9 @@ static void pxa2xx_mmci_write(void *opaque,break ;default : -hw_error ("%s: Bad offset " REG_FMT "\n" , __FUNCTION__, offset); +qemu_log_mask (LOG_GUEST_ERROR , +"%s: incorrect reg 0x%02" HWADDR_PRIx" " +"(value 0x%08" PRIx64")\n" , __func__, offset, value); } }
hw/sd/trace-events +4 -0
@@ -3,3 +3,7 @@ # hw/sd/milkymist-memcard.c milkymist_memcard_memory_read(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x" milkymist_memcard_memory_write(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x" + +# hw/sd/pxa2xx_mmci.c +pxa2xx_mmci_read(uint8_t size, uint32_t addr, uint32_t value) "size %d addr 0x%02x value 0x%08x" +pxa2xx_mmci_write(uint8_t size, uint32_t addr, uint32_t value) "size %d addr 0x%02x value 0x%08x"
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 23/26] linux-user/arm/nwfpe: Check coprocessor number for FPA emulation
In reply to Peter MaydellOur copy of the nwfpe code for emulating of the old FPA11 floating point unit doesn't check the coprocessor number in the instruction when it emulates it. This means that we might treat some instructions which should really UNDEF as being FPA11 instructions by accident.
The kernel's copy of the nwfpe code doesn't make this error; I suspect the bug was noticed and fixed as part of the process of mainlining the nwfpe code more than a decade ago.
Add a check that the coprocessor number (which is always in bits [11:8] of the instruction) is either 1 or 2, which is where the FPA11 lives.
--- linux-user/arm/nwfpe/fpa11.c | 9 +++++++++ 1 file changed, 9 insertions(+)
linux-user/arm/nwfpe/fpa11.c +9 -0
@@ -137,8 +137,17 @@ unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs)unsigned int nRc =0 ;// unsigned long flags; FPA11 *fpa11; +unsigned int cp;// save_flags(flags); sti(); +/* Check that this is really an FPA11 instruction: the coprocessor +* field in bits [11:8] must be 1 or 2. +*/ + cp = (opcode >>8 ) &0xf ; +if (cp !=1 && cp !=2 ) { +return 0 ; + } + qemufpa=qfpa; user_registers=qregs;
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 24/26] target/arm: Make disas_thumb2_insn() generate its own UNDEF exceptions
In reply to Peter MaydellRefactor disas_thumb2_insn() so that it generates the code for raising an UNDEF exception for invalid insns, rather than returning a flag which the caller must check to see if it needs to generate the UNDEF code. This brings the function in to line with the behaviour of disas_thumb_insn() and disas_arm_insn().
Message-id: [email protected]
--- target/arm/translate.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
target/arm/translate.c +10 -13
@@ -9775,9 +9775,8 @@ gen_thumb2_data_op(DisasContext *s, int op, int conds, uint32_t shifter_out,return 0 ; } -/* Translate a 32-bit thumb instruction. Returns nonzero if the instruction -is not legal. */ -static int disas_thumb2_insn (DisasContext *s,uint32_t insn) +/* Translate a 32-bit thumb instruction. */ +static void disas_thumb2_insn (DisasContext *s,uint32_t insn) {uint32_t imm, shift, offset;uint32_t rd, rn, rm, rs;
@@ -11016,16 +11015,16 @@ static int disas_thumb2_insn(DisasContext *s, uint32_t insn)/* UNPREDICTABLE, unallocated hint or * PLD/PLDW/PLI (literal) */ -return 0 ; +return ; }if (op1 &1 ) { -return 0 ;/* PLD/PLDW/PLI or unallocated hint */ +return ;/* PLD/PLDW/PLI or unallocated hint */ }if ((op2 ==0 ) || ((op2 &0x3c ) ==0x30 )) { -return 0 ;/* PLD/PLDW/PLI or unallocated hint */ +return ;/* PLD/PLDW/PLI or unallocated hint */ }/* UNDEF space, or an UNPREDICTABLE */ -return 1 ; + goto illegal_op; } } memidx =get_mem_index (s);
@@ -11151,9 +11150,10 @@ static int disas_thumb2_insn(DisasContext *s, uint32_t insn)default : goto illegal_op; } -return 0 ; +return ; illegal_op: -return 1 ; +gen_exception_insn (s,4 ,EXCP_UDEF ,syn_uncategorized (), +default_exception_el (s)); }static void disas_thumb_insn (DisasContext *s,uint32_t insn)
@@ -12275,10 +12275,7 @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)if (is_16bit) {disas_thumb_insn (dc, insn); }else { -if (disas_thumb2_insn (dc, insn)) { -gen_exception_insn (dc,4 ,EXCP_UDEF ,syn_uncategorized (), -default_exception_el (dc)); - } +disas_thumb2_insn (dc, insn); }/* Advance the Thumb condexec condition. */
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 25/26] hw/intc/arm_gicv3: Make reserved register addresses RAZ/WI
In reply to Peter MaydellThe GICv3 specification says that reserved register addresses should RAZ/WI. This means we need to return MEMTX_OK, not MEMTX_ERROR, because now that we support generating external aborts the latter will cause an abort on new board models.
Message-id: [email protected]
--- hw/intc/arm_gicv3_dist.c | 13 +++++++++++++ hw/intc/arm_gicv3_its_common.c | 8 +++----- hw/intc/arm_gicv3_redist.c | 13 +++++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-)
hw/intc/arm_gicv3_dist.c +13 -0
@@ -817,6 +817,13 @@ MemTxResult gicv3_dist_read(void *opaque, hwaddr offset, uint64_t *data,"%s: invalid guest read at offset " TARGET_FMT_plx "size %u\n", __func__, offset, size);trace_gicv3_dist_badread (offset, size, attrs.secure); +/* The spec requires that reserved registers are RAZ/WI; +* so use MEMTX_ERROR returns from leaf functions as a way to +* trigger the guest-error logging but don't return it to +* the caller, or we'll cause a spurious guest data abort. +*/ + r =MEMTX_OK ; + *data =0 ; }else {trace_gicv3_dist_read (offset, *data, size, attrs.secure); }
@@ -852,6 +859,12 @@ MemTxResult gicv3_dist_write(void *opaque, hwaddr offset, uint64_t data,"%s: invalid guest write at offset " TARGET_FMT_plx "size %u\n", __func__, offset, size);trace_gicv3_dist_badwrite (offset, data, size, attrs.secure); +/* The spec requires that reserved registers are RAZ/WI; +* so use MEMTX_ERROR returns from leaf functions as a way to +* trigger the guest-error logging but don't return it to +* the caller, or we'll cause a spurious guest data abort. +*/ + r =MEMTX_OK ; }else {trace_gicv3_dist_write (offset, data, size, attrs.secure); }
hw/intc/arm_gicv3_its_common.c +3 -5
@@ -67,7 +67,8 @@ static MemTxResult gicv3_its_trans_read(void *opaque, hwaddr offset, MemTxAttrs attrs) {qemu_log_mask (LOG_GUEST_ERROR ,"ITS read at offset 0x%" PRIx64"\n" , offset); -return MEMTX_ERROR ; + *data =0 ; +return MEMTX_OK ; } static MemTxResult gicv3_its_trans_write(void *opaque, hwaddr offset,
@@ -82,15 +83,12 @@ static MemTxResult gicv3_its_trans_write(void *opaque, hwaddr offset,if (ret <=0 ) {qemu_log_mask (LOG_GUEST_ERROR ,"ITS: Error sending MSI: %s\n" ,strerror (-ret)); -return MEMTX_DECODE_ERROR ; } - -return MEMTX_OK ; }else {qemu_log_mask (LOG_GUEST_ERROR ,"ITS write at bad offset 0x%" PRIx64"\n" , offset); -return MEMTX_DECODE_ERROR ; } +return MEMTX_OK ; }static const MemoryRegionOps gicv3_its_trans_ops = {
hw/intc/arm_gicv3_redist.c +13 -0
@@ -455,6 +455,13 @@ MemTxResult gicv3_redist_read(void *opaque, hwaddr offset, uint64_t *data, "size %u\n", __func__, offset, size);trace_gicv3_redist_badread (gicv3_redist_affid (cs), offset, size, attrs.secure); +/* The spec requires that reserved registers are RAZ/WI; +* so use MEMTX_ERROR returns from leaf functions as a way to +* trigger the guest-error logging but don't return it to +* the caller, or we'll cause a spurious guest data abort. +*/ + r =MEMTX_OK ; + *data =0 ; }else {trace_gicv3_redist_read (gicv3_redist_affid (cs), offset, *data, size, attrs.secure);
@@ -505,6 +512,12 @@ MemTxResult gicv3_redist_write(void *opaque, hwaddr offset, uint64_t data, "size %u\n", __func__, offset, size);trace_gicv3_redist_badwrite (gicv3_redist_affid (cs), offset, data, size, attrs.secure); +/* The spec requires that reserved registers are RAZ/WI; +* so use MEMTX_ERROR returns from leaf functions as a way to +* trigger the guest-error logging but don't return it to +* the caller, or we'll cause a spurious guest data abort. +*/ + r =MEMTX_OK ; }else {trace_gicv3_redist_write (gicv3_redist_affid (cs), offset, data, size, attrs.secure);
Signature · 1 line
2.7.4
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 00/26] target-arm queue
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'2359930d5a hw/intc/arm_gic: reserved register addresses are RAZ/WI 48694e29ed hw/intc/arm_gicv3: Make reserved register addresses RAZ/WI 676e0cb89f target/arm: Make disas_thumb2_insn() generate its own UNDEF exceptions d25c6959f3 linux-user/arm/nwfpe: Check coprocessor number for FPA emulation 1341a890b4 hw/sd/pxa2xx_mmci: add read/write() trace events a885104099 hw/timer/pxa2xx_timer: replace hw_error() -> qemu_log_mask() bc0eeb50f5 imx_fec: Reserve full FSL_IMX25_FEC_SIZE page for the register file 368df2ab10 imx_fec: Fix a typo in imx_enet_receive()5e23b9482d imx_fec: Use correct length for packet size78340a7865 imx_fec: Add support for multiple Tx DMA rings9149d3af96 imx_fec: Emulate SHIFT16 in ENETx_RACC4bd1e35856 imx_fec: Use MIN instead of explicit ternary operator 518029255c imx_fec: Use ENET_FTRL to determine truncation length bc493c7448 imx_fec: Move Tx frame buffer away from the stack 0c1827e654 imx_fec: Change queue flushing heuristicsc6d90ff752 imx_fec: Refactor imx_eth_enable_rx()a749448e1e imx_fec: Do not link to netdevb38e7a3b8f Virt: ACPI: fix qemu assert due to re-assigned table data address d814544e4b target/arm: Fix stlxp for aarch64_be3a6faeef7b linux-user: Activate armeb handler registration 8ee0d2d481 linux-user: Separate binfmt arm CPU families951c02fe87 linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh b1c1e90ee6 configure: Add aarch64_be-linux-user target19d80bb62a linux-user: Fix endianess of aarch64 signal trampoline cf99ea09bf linux-user: Add separate aarch64_be unamedae5fc1bf7 linux-user: Add support for big-endian aarch64
=== OUTPUT BEGIN ===
Checking PATCH 1/26: linux-user: Add support for big-endian aarch64... Checking PATCH 2/26: linux-user: Add separate aarch64_be uname...
Checking PATCH 3/26: linux-user: Fix endianess of aarch64 signal trampoline... Checking PATCH 4/26: configure: Add aarch64_be-linux-user target...
Checking PATCH 5/26: linux-user: Add aarch64_be magic numbers to qemu-binfmt-conf.sh...
WARNING: line over 80 characters
#33: FILE: scripts/qemu-binfmt-conf.sh:95:
+aarch64_be_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7'
ERROR: line over 90 characters
#34: FILE: scripts/qemu-binfmt-conf.sh:96:
+aarch64_be_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
total: 1 errors, 1 warnings, 18 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 6/26: linux-user: Separate binfmt arm CPU families...
Checking PATCH 7/26: linux-user: Activate armeb handler registration...
Checking PATCH 8/26: target/arm: Fix stlxp for aarch64_be...
Checking PATCH 9/26: Virt: ACPI: fix qemu assert due to re-assigned table data address... Checking PATCH 10/26: imx_fec: Do not link to netdev...
Checking PATCH 11/26: imx_fec: Refactor imx_eth_enable_rx()...
Checking PATCH 12/26: imx_fec: Change queue flushing heuristics...
Checking PATCH 13/26: imx_fec: Move Tx frame buffer away from the stack... Checking PATCH 14/26: imx_fec: Use ENET_FTRL to determine truncation length... Checking PATCH 15/26: imx_fec: Use MIN instead of explicit ternary operator... Checking PATCH 16/26: imx_fec: Emulate SHIFT16 in ENETx_RACC...
Checking PATCH 17/26: imx_fec: Add support for multiple Tx DMA rings...
Checking PATCH 18/26: imx_fec: Use correct length for packet size...
Checking PATCH 19/26: imx_fec: Fix a typo in imx_enet_receive()...
Checking PATCH 20/26: imx_fec: Reserve full FSL_IMX25_FEC_SIZE page for the register file... Checking PATCH 21/26: hw/timer/pxa2xx_timer: replace hw_error() -> qemu_log_mask()... Checking PATCH 22/26: hw/sd/pxa2xx_mmci: add read/write() trace events... Checking PATCH 23/26: linux-user/arm/nwfpe: Check coprocessor number for FPA emulation... Checking PATCH 24/26: target/arm: Make disas_thumb2_insn() generate its own UNDEF exceptions... Checking PATCH 25/26: hw/intc/arm_gicv3: Make reserved register addresses RAZ/WI... Checking PATCH 26/26: hw/intc/arm_gic: reserved register addresses are RAZ/WI... === OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Peter Maydell
AppliedQuoted 10 lines · Peter Maydell
ARM queue, various patches accumulated over the Christmas break.
-- PMM
The following changes since commit
612061b277915fadd80631eb7a6926f48a110c44:Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-01-10' into staging (2018-01-11 11:52:40 +0000)
are available in the git repository at:
Quoted 7 lines
git://git.linaro.org/people/pmaydell/qemu-arm.gittags/pull-target-arm-20180111for you to fetch changes up to
0cf09852015e47a5fbb974ff7ac320366afd21ee:hw/intc/arm_gic: reserved register addresses are RAZ/WI (2018-01-11 13:25:40 +0000)
----------------------------------------------------------------
Applied, thanks.
-- PMM