Skip to content

Commit

Permalink
Merge tag 'pull-target-arm-20230704' of https://git.linaro.org/people…
Browse files Browse the repository at this point in the history
…/pmaydell/qemu-arm into staging

target-arm queue:
 * Add raw_writes ops for register whose write induce TLB maintenance
 * hw/arm/sbsa-ref: use XHCI to replace EHCI
 * Avoid splitting Zregs across lines in dump
 * Dump ZA[] when active
 * Fix SME full tile indexing
 * Handle IC IVAU to improve compatibility with JITs
 * xlnx-canfd-test: Fix code coverity issues
 * gdbstub: Guard M-profile code with CONFIG_TCG
 * allwinner-sramc: Set class_size
 * target/xtensa: Assert that interrupt level is within bounds

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmSkSnEZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3txnD/9AOIGrr03CKG1RLitM+6b2
# dNOx//iFpRVIOja5PmENQ8eNOF9MXHiQeJ5Xd83ldnSsuV3wvXRiQ0YfJCoFRrL3
# 3uklz61SL3S5/aQ6uvCiewE+nORX39kl+2CUzsczYOTSkjc/gzsUxaojPlP7aXqJ
# n2OaDLLuXkW3P19L/TZulTbzEg80p5Xmpr7RwaYndxoQlMTeyr80CKoJ76M8TZP0
# hTciij5nlBjUTLGxejD1BCrhtYwa+HNkYTRrDUPVZogIYpIJeD90uI9dsORpT0Df
# zZLxCW+xPtm/057PSDbYM3QLX3nQN09WmciWrv5rsyk4JU49v2NLaYeNWV7SXi/V
# FpNwA67M0pm7f1fep9yOCjVt51iGDONweQkqRIz+ok40FsoKbslKQuFhuXxl4LE3
# OLVLE26hu6cEVsMd0I1zipvDzyhuWk2lw+Qpi8zxSGoKaXYTK8oq8YTJ2lZspC8K
# EXAaDipr9gtWpOGHLQbX30fY/+2KX29g9Ih2FXjN5p5/UlcyJZKRyYI/jMvCUHRm
# f8k7vGlx8+s8hRoa6stXXbbFXoJbgywMd6B5sXMTVXnRvTLN3im4QQlyHDbHhrg9
# qoksSQ5hGG3og29drDKXIkoMxn2m71DXmriPweLp2MRqkhD4DMQS1YGjeJSxSrZe
# u+Z4cusrj1nzwSQK98j2UA==
# =vtOk
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 04 Jul 2023 06:36:01 PM CEST
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [full]
# gpg:                 aka "Peter Maydell <peter@archaic.org.uk>" [unknown]

* tag 'pull-target-arm-20230704' of https://git.linaro.org/people/pmaydell/qemu-arm:
  target/xtensa: Assert that interrupt level is within bounds
  hw: arm: allwinner-sramc: Set class_size
  target/arm: gdbstub: Guard M-profile code with CONFIG_TCG
  tests/qtest: xlnx-canfd-test: Fix code coverity issues
  tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
  target/arm: Handle IC IVAU to improve compatibility with JITs
  target/arm: Fix SME full tile indexing
  target/arm: Dump ZA[] when active
  target/arm: Avoid splitting Zregs across lines in dump
  hw/arm/sbsa-ref: use XHCI to replace EHCI
  target/arm: Add raw_writes ops for register whose write induce TLB maintenance

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Jul 4, 2023
2 parents 0618e72 + 86a7827 commit 726e2ad
Show file tree
Hide file tree
Showing 13 changed files with 436 additions and 79 deletions.
5 changes: 4 additions & 1 deletion docs/system/arm/sbsa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The ``sbsa-ref`` board supports:
- A configurable number of AArch64 CPUs
- GIC version 3
- System bus AHCI controller
- System bus EHCI controller
- System bus XHCI controller
- CDROM and hard disc on AHCI bus
- E1000E ethernet card on PCIe bus
- Bochs display adapter on PCIe bus
Expand Down Expand Up @@ -68,3 +68,6 @@ Platform version changes:

0.2
GIC ITS information is present in devicetree.

0.3
The USB controller is an XHCI device, not EHCI
2 changes: 1 addition & 1 deletion hw/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ config SBSA_REF
select PL011 # UART
select PL031 # RTC
select PL061 # GPIO
select USB_EHCI_SYSBUS
select USB_XHCI_SYSBUS
select WDT_SBSA
select BOCHS_DISPLAY

Expand Down
23 changes: 13 additions & 10 deletions hw/arm/sbsa-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "hw/pci-host/gpex.h"
#include "hw/qdev-properties.h"
#include "hw/usb.h"
#include "hw/usb/xhci.h"
#include "hw/char/pl011.h"
#include "hw/watchdog/sbsa_gwdt.h"
#include "net/net.h"
Expand Down Expand Up @@ -85,7 +86,7 @@ enum {
SBSA_SECURE_UART_MM,
SBSA_SECURE_MEM,
SBSA_AHCI,
SBSA_EHCI,
SBSA_XHCI,
};

struct SBSAMachineState {
Expand Down Expand Up @@ -123,7 +124,7 @@ static const MemMapEntry sbsa_ref_memmap[] = {
[SBSA_SMMU] = { 0x60050000, 0x00020000 },
/* Space here reserved for more SMMUs */
[SBSA_AHCI] = { 0x60100000, 0x00010000 },
[SBSA_EHCI] = { 0x60110000, 0x00010000 },
[SBSA_XHCI] = { 0x60110000, 0x00010000 },
/* Space here reserved for other devices */
[SBSA_PCIE_PIO] = { 0x7fff0000, 0x00010000 },
/* 32-bit address PCIE MMIO space */
Expand All @@ -143,7 +144,7 @@ static const int sbsa_ref_irqmap[] = {
[SBSA_SECURE_UART] = 8,
[SBSA_SECURE_UART_MM] = 9,
[SBSA_AHCI] = 10,
[SBSA_EHCI] = 11,
[SBSA_XHCI] = 11,
[SBSA_SMMU] = 12, /* ... to 15 */
[SBSA_GWDT_WS0] = 16,
};
Expand Down Expand Up @@ -230,7 +231,7 @@ static void create_fdt(SBSAMachineState *sms)
* fw compatibility.
*/
qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0);
qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 2);
qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 3);

if (ms->numa_state->have_numa_distance) {
int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t);
Expand Down Expand Up @@ -604,13 +605,15 @@ static void create_ahci(const SBSAMachineState *sms)
}
}

static void create_ehci(const SBSAMachineState *sms)
static void create_xhci(const SBSAMachineState *sms)
{
hwaddr base = sbsa_ref_memmap[SBSA_EHCI].base;
int irq = sbsa_ref_irqmap[SBSA_EHCI];
hwaddr base = sbsa_ref_memmap[SBSA_XHCI].base;
int irq = sbsa_ref_irqmap[SBSA_XHCI];
DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS);

sysbus_create_simple("platform-ehci-usb", base,
qdev_get_gpio_in(sms->gic, irq));
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(sms->gic, irq));
}

static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
Expand Down Expand Up @@ -832,7 +835,7 @@ static void sbsa_ref_init(MachineState *machine)

create_ahci(sms);

create_ehci(sms);
create_xhci(sms);

create_pcie(sms);

Expand Down
1 change: 1 addition & 0 deletions hw/misc/allwinner-sramc.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ static const TypeInfo allwinner_sramc_info = {
.parent = TYPE_SYS_BUS_DEVICE,
.instance_init = allwinner_sramc_init,
.instance_size = sizeof(AwSRAMCState),
.class_size = sizeof(AwSRAMCClass),
.class_init = allwinner_sramc_class_init,
};

Expand Down
65 changes: 43 additions & 22 deletions target/arm/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
ARMCPU *cpu = ARM_CPU(cs);
CPUARMState *env = &cpu->env;
uint32_t psr = pstate_read(env);
int i;
int i, j;
int el = arm_current_el(env);
const char *ns_status;
bool sve;
Expand Down Expand Up @@ -1014,7 +1014,7 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
}

if (sve) {
int j, zcr_len = sve_vqm1_for_el(env, el);
int zcr_len = sve_vqm1_for_el(env, el);

for (i = 0; i <= FFR_PRED_NUM; i++) {
bool eol;
Expand Down Expand Up @@ -1054,32 +1054,24 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
}
}

for (i = 0; i < 32; i++) {
if (zcr_len == 0) {
if (zcr_len == 0) {
/*
* With vl=16, there are only 37 columns per register,
* so output two registers per line.
*/
for (i = 0; i < 32; i++) {
qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64 "%s",
i, env->vfp.zregs[i].d[1],
env->vfp.zregs[i].d[0], i & 1 ? "\n" : " ");
} else if (zcr_len == 1) {
qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64
":%016" PRIx64 ":%016" PRIx64 "\n",
i, env->vfp.zregs[i].d[3], env->vfp.zregs[i].d[2],
env->vfp.zregs[i].d[1], env->vfp.zregs[i].d[0]);
} else {
}
} else {
for (i = 0; i < 32; i++) {
qemu_fprintf(f, "Z%02d=", i);
for (j = zcr_len; j >= 0; j--) {
bool odd = (zcr_len - j) % 2 != 0;
if (j == zcr_len) {
qemu_fprintf(f, "Z%02d[%x-%x]=", i, j, j - 1);
} else if (!odd) {
if (j > 0) {
qemu_fprintf(f, " [%x-%x]=", j, j - 1);
} else {
qemu_fprintf(f, " [%x]=", j);
}
}
qemu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%s",
env->vfp.zregs[i].d[j * 2 + 1],
env->vfp.zregs[i].d[j * 2],
odd || j == 0 ? "\n" : ":");
env->vfp.zregs[i].d[j * 2 + 0],
j ? ":" : "\n");
}
}
}
Expand All @@ -1090,6 +1082,24 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
i, q[1], q[0], (i & 1 ? "\n" : " "));
}
}

if (cpu_isar_feature(aa64_sme, cpu) &&
FIELD_EX64(env->svcr, SVCR, ZA) &&
sme_exception_el(env, el) == 0) {
int zcr_len = sve_vqm1_for_el_sm(env, el, true);
int svl = (zcr_len + 1) * 16;
int svl_lg10 = svl < 100 ? 2 : 3;

for (i = 0; i < svl; i++) {
qemu_fprintf(f, "ZA[%0*d]=", svl_lg10, i);
for (j = zcr_len; j >= 0; --j) {
qemu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%c",
env->zarray[i].d[2 * j + 1],
env->zarray[i].d[2 * j],
j ? ':' : '\n');
}
}
}
}

#else
Expand Down Expand Up @@ -1684,6 +1694,17 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
return;
}

#ifdef CONFIG_USER_ONLY
/*
* User mode relies on IC IVAU instructions to catch modification of
* dual-mapped code.
*
* Clear CTR_EL0.DIC to ensure that software that honors these flags uses
* IC IVAU even if the emulated processor does not normally require it.
*/
cpu->ctr = FIELD_DP64(cpu->ctr, CTR_EL0, DIC, 0);
#endif

if (arm_feature(env, ARM_FEATURE_AARCH64) &&
cpu->has_vfp != cpu->has_neon) {
/*
Expand Down
4 changes: 4 additions & 0 deletions target/arm/gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ static int arm_gen_dynamic_sysreg_xml(CPUState *cs, int base_reg)
return cpu->dyn_sysreg_xml.num;
}

#ifdef CONFIG_TCG
typedef enum {
M_SYSREG_MSP,
M_SYSREG_PSP,
Expand Down Expand Up @@ -481,6 +482,7 @@ static int arm_gen_dynamic_m_secextreg_xml(CPUState *cs, int orig_base_reg)
return cpu->dyn_m_secextreg_xml.num;
}
#endif
#endif /* CONFIG_TCG */

const char *arm_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname)
{
Expand Down Expand Up @@ -561,6 +563,7 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
arm_gen_dynamic_sysreg_xml(cs, cs->gdb_num_regs),
"system-registers.xml", 0);

#ifdef CONFIG_TCG
if (arm_feature(env, ARM_FEATURE_M) && tcg_enabled()) {
gdb_register_coprocessor(cs,
arm_gdb_get_m_systemreg, arm_gdb_set_m_systemreg,
Expand All @@ -575,4 +578,5 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
}
#endif
}
#endif /* CONFIG_TCG */
}

0 comments on commit 726e2ad

Please sign in to comment.