Skip to content

Commit 53ef8a9

Browse files
committed
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200406' into staging
target-arm queue: * don't expose "ieee_half" via gdbstub (prevents gdb crashes or errors with older GDB versions) * hw/arm/collie: Put StrongARMState* into a CollieMachineState struct * PSTATE.PAN should not clear exec bits * hw/gpio/aspeed_gpio.c: Don't directly include assert.h (fixes compilation on some Windows build scenarios) * dump: Fix writing of ELF section * dma/xlnx-zdma: various bug fixes * target/arm/helperc. delete obsolete TODO comment # gpg: Signature made Mon 06 Apr 2020 11:04:01 BST # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "[email protected]" # gpg: Good signature from "Peter Maydell <[email protected]>" [ultimate] # gpg: aka "Peter Maydell <[email protected]>" [ultimate] # gpg: aka "Peter Maydell <[email protected]>" [ultimate] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20200406: dma/xlnx-zdma: Reorg to fix CUR_DSCR dma/xlnx-zdma: Advance the descriptor address when stopping dma/xlnx-zdma: Clear DMA_DONE when halting dma/xlnx-zdma: Populate DBG0.CMN_BUF_FREE dma/xlnx-zdma: Remove comment dump: Fix writing of ELF section hw/gpio/aspeed_gpio.c: Don't directly include assert.h target/arm: Remove obsolete TODO note from get_phys_addr_lpae() target/arm: PSTATE.PAN should not clear exec bits hw/arm/collie: Put StrongARMState* into a CollieMachineState struct target/arm: don't expose "ieee_half" via gdbstub Signed-off-by: Peter Maydell <[email protected]>
2 parents 547522c + 8893790 commit 53ef8a9

File tree

6 files changed

+69
-44
lines changed

6 files changed

+69
-44
lines changed

dump/dump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ static void write_elf_section(DumpState *s, int type, Error **errp)
364364
shdr = &shdr64;
365365
}
366366

367-
ret = fd_write_vmcore(&shdr, shdr_size, s);
367+
ret = fd_write_vmcore(shdr, shdr_size, s);
368368
if (ret < 0) {
369369
error_setg_errno(errp, -ret,
370370
"dump: failed to write section header table");

hw/arm/collie.c

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,26 @@
1919
#include "exec/address-spaces.h"
2020
#include "cpu.h"
2121

22+
typedef struct {
23+
MachineState parent;
24+
25+
StrongARMState *sa1110;
26+
} CollieMachineState;
27+
28+
#define TYPE_COLLIE_MACHINE MACHINE_TYPE_NAME("collie")
29+
#define COLLIE_MACHINE(obj) \
30+
OBJECT_CHECK(CollieMachineState, obj, TYPE_COLLIE_MACHINE)
31+
2232
static struct arm_boot_info collie_binfo = {
2333
.loader_start = SA_SDCS0,
2434
.ram_size = 0x20000000,
2535
};
2636

2737
static void collie_init(MachineState *machine)
2838
{
29-
StrongARMState *s;
3039
DriveInfo *dinfo;
3140
MachineClass *mc = MACHINE_GET_CLASS(machine);
41+
CollieMachineState *cms = COLLIE_MACHINE(machine);
3242

3343
if (machine->ram_size != mc->default_ram_size) {
3444
char *sz = size_to_str(mc->default_ram_size);
@@ -37,7 +47,7 @@ static void collie_init(MachineState *machine)
3747
exit(EXIT_FAILURE);
3848
}
3949

40-
s = sa1110_init(machine->cpu_type);
50+
cms->sa1110 = sa1110_init(machine->cpu_type);
4151

4252
memory_region_add_subregion(get_system_memory(), SA_SDCS0, machine->ram);
4353

@@ -54,11 +64,13 @@ static void collie_init(MachineState *machine)
5464
sysbus_create_simple("scoop", 0x40800000, NULL);
5565

5666
collie_binfo.board_id = 0x208;
57-
arm_load_kernel(s->cpu, machine, &collie_binfo);
67+
arm_load_kernel(cms->sa1110->cpu, machine, &collie_binfo);
5868
}
5969

60-
static void collie_machine_init(MachineClass *mc)
70+
static void collie_machine_class_init(ObjectClass *oc, void *data)
6171
{
72+
MachineClass *mc = MACHINE_CLASS(oc);
73+
6274
mc->desc = "Sharp SL-5500 (Collie) PDA (SA-1110)";
6375
mc->init = collie_init;
6476
mc->ignore_memory_transaction_failures = true;
@@ -67,4 +79,15 @@ static void collie_machine_init(MachineClass *mc)
6779
mc->default_ram_id = "strongarm.sdram";
6880
}
6981

70-
DEFINE_MACHINE("collie", collie_machine_init)
82+
static const TypeInfo collie_machine_typeinfo = {
83+
.name = TYPE_COLLIE_MACHINE,
84+
.parent = TYPE_MACHINE,
85+
.class_init = collie_machine_class_init,
86+
.instance_size = sizeof(CollieMachineState),
87+
};
88+
89+
static void collie_machine_register_types(void)
90+
{
91+
type_register_static(&collie_machine_typeinfo);
92+
}
93+
type_init(collie_machine_register_types);

hw/dma/xlnx-zdma.c

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,28 @@ static void zdma_load_src_descriptor(XlnxZDMA *s)
333333
}
334334
}
335335

336+
static void zdma_update_descr_addr(XlnxZDMA *s, bool type,
337+
unsigned int basereg)
338+
{
339+
uint64_t addr, next;
340+
341+
if (type == DTYPE_LINEAR) {
342+
addr = zdma_get_regaddr64(s, basereg);
343+
next = addr + sizeof(s->dsc_dst);
344+
} else {
345+
addr = zdma_get_regaddr64(s, basereg);
346+
addr += sizeof(s->dsc_dst);
347+
address_space_read(s->dma_as, addr, s->attr, (void *) &next, 8);
348+
}
349+
350+
zdma_put_regaddr64(s, basereg, next);
351+
}
352+
336353
static void zdma_load_dst_descriptor(XlnxZDMA *s)
337354
{
338355
uint64_t dst_addr;
339356
unsigned int ptype = ARRAY_FIELD_EX32(s->regs, ZDMA_CH_CTRL0, POINT_TYPE);
357+
bool dst_type;
340358

341359
if (ptype == PT_REG) {
342360
memcpy(&s->dsc_dst, &s->regs[R_ZDMA_CH_DST_DSCR_WORD0],
@@ -349,24 +367,10 @@ static void zdma_load_dst_descriptor(XlnxZDMA *s)
349367
if (!zdma_load_descriptor(s, dst_addr, &s->dsc_dst)) {
350368
ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, AXI_RD_DST_DSCR, true);
351369
}
352-
}
353-
354-
static uint64_t zdma_update_descr_addr(XlnxZDMA *s, bool type,
355-
unsigned int basereg)
356-
{
357-
uint64_t addr, next;
358370

359-
if (type == DTYPE_LINEAR) {
360-
next = zdma_get_regaddr64(s, basereg);
361-
next += sizeof(s->dsc_dst);
362-
zdma_put_regaddr64(s, basereg, next);
363-
} else {
364-
addr = zdma_get_regaddr64(s, basereg);
365-
addr += sizeof(s->dsc_dst);
366-
address_space_read(s->dma_as, addr, s->attr, &next, 8);
367-
zdma_put_regaddr64(s, basereg, next);
368-
}
369-
return next;
371+
/* Advance the descriptor pointer. */
372+
dst_type = FIELD_EX32(s->dsc_dst.words[3], ZDMA_CH_DST_DSCR_WORD3, TYPE);
373+
zdma_update_descr_addr(s, dst_type, R_ZDMA_CH_DST_CUR_DSCR_LSB);
370374
}
371375

372376
static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, uint32_t len)
@@ -387,14 +391,7 @@ static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, uint32_t len)
387391
dst_size = FIELD_EX32(s->dsc_dst.words[2], ZDMA_CH_DST_DSCR_WORD2,
388392
SIZE);
389393
if (dst_size == 0 && ptype == PT_MEM) {
390-
uint64_t next;
391-
bool dst_type = FIELD_EX32(s->dsc_dst.words[3],
392-
ZDMA_CH_DST_DSCR_WORD3,
393-
TYPE);
394-
395-
next = zdma_update_descr_addr(s, dst_type,
396-
R_ZDMA_CH_DST_CUR_DSCR_LSB);
397-
zdma_load_descriptor(s, next, &s->dsc_dst);
394+
zdma_load_dst_descriptor(s);
398395
dst_size = FIELD_EX32(s->dsc_dst.words[2], ZDMA_CH_DST_DSCR_WORD2,
399396
SIZE);
400397
}
@@ -511,16 +508,15 @@ static void zdma_process_descr(XlnxZDMA *s)
511508
zdma_src_done(s);
512509
}
513510

514-
/* Load next descriptor. */
515511
if (ptype == PT_REG || src_cmd == CMD_STOP) {
516512
ARRAY_FIELD_DP32(s->regs, ZDMA_CH_CTRL2, EN, 0);
517513
zdma_set_state(s, DISABLED);
518-
return;
519514
}
520515

521516
if (src_cmd == CMD_HALT) {
522517
zdma_set_state(s, PAUSED);
523518
ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, DMA_PAUSE, 1);
519+
ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, DMA_DONE, false);
524520
zdma_ch_imr_update_irq(s);
525521
return;
526522
}
@@ -681,6 +677,12 @@ static RegisterAccessInfo zdma_regs_info[] = {
681677
},{ .name = "ZDMA_CH_DBG0", .addr = A_ZDMA_CH_DBG0,
682678
.rsvd = 0xfffffe00,
683679
.ro = 0x1ff,
680+
681+
/*
682+
* There's SW out there that will check the debug regs for free space.
683+
* Claim that we always have 0x100 free.
684+
*/
685+
.reset = 0x100
684686
},{ .name = "ZDMA_CH_DBG1", .addr = A_ZDMA_CH_DBG1,
685687
.rsvd = 0xfffffe00,
686688
.ro = 0x1ff,

hw/gpio/aspeed_gpio.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* SPDX-License-Identifier: GPL-2.0-or-later
77
*/
88

9-
#include <assert.h>
10-
119
#include "qemu/osdep.h"
1210
#include "qemu/host-utils.h"
1311
#include "qemu/log.h"

target/arm/gdbstub.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ static const struct TypeSize vec_lanes[] = {
192192
/* 16 bit */
193193
{ "uint16", 16, 'h', 'u' },
194194
{ "int16", 16, 'h', 's' },
195-
{ "ieee_half", 16, 'h', 'f' },
195+
/*
196+
* TODO: currently there is no reliable way of telling
197+
* if the remote gdb actually understands ieee_half so
198+
* we don't expose it in the target description for now.
199+
* { "ieee_half", 16, 'h', 'f' },
200+
*/
196201
/* bytes */
197202
{ "uint8", 8, 'b', 'u' },
198203
{ "int8", 8, 'b', 's' },

target/arm/helper.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10025,9 +10025,11 @@ static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu_idx, bool is_aa64,
1002510025
prot_rw = user_rw;
1002610026
} else {
1002710027
if (user_rw && regime_is_pan(env, mmu_idx)) {
10028-
return 0;
10028+
/* PAN forbids data accesses but doesn't affect insn fetch */
10029+
prot_rw = 0;
10030+
} else {
10031+
prot_rw = simple_ap_to_rw_prot_is_user(ap, false);
1002910032
}
10030-
prot_rw = simple_ap_to_rw_prot_is_user(ap, false);
1003110033
}
1003210034

1003310035
if (ns && arm_is_secure(env) && (env->cp15.scr_el3 & SCR_SIF)) {
@@ -10751,12 +10753,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
1075110753
bool aarch64 = arm_el_is_aa64(env, el);
1075210754
bool guarded = false;
1075310755

10754-
/* TODO:
10755-
* This code does not handle the different format TCR for VTCR_EL2.
10756-
* This code also does not support shareability levels.
10757-
* Attribute and permission bit handling should also be checked when adding
10758-
* support for those page table walks.
10759-
*/
10756+
/* TODO: This code does not support shareability levels. */
1076010757
if (aarch64) {
1076110758
param = aa64_va_parameters(env, address, mmu_idx,
1076210759
access_type != MMU_INST_FETCH);

0 commit comments

Comments
 (0)