Skip to content

Commit 7b09f12

Browse files
committed
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210108' into staging
target-arm queue: * intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs * target/arm: Fix MTE0_ACTIVE * target/arm: Implement v8.1M and Cortex-M55 model * hw/arm/highbank: Drop dead KVM support code * util/qemu-timer: Make timer_free() imply timer_del() * various devices: Use ptimer_free() in finalize function * docs/system: arm: Add sabrelite board description * sabrelite: Minor fixes to allow booting U-Boot # gpg: Signature made Fri 08 Jan 2021 15:34:25 GMT # 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-20210108: (23 commits) docs/system: arm: Add sabrelite board description hw/arm: sabrelite: Connect the Ethernet PHY at address 6 hw/msic: imx6_ccm: Correct register value for silicon type hw/misc: imx6_ccm: Update PMU_MISC0 reset value exynos4210_mct: Use ptimer_free() in the finalize function to avoid memleaks musicpal: Use ptimer_free() in the finalize function to avoid memleaks mss-timer: Use ptimer_free() in the finalize function to avoid memleaks exynos4210_pwm: Use ptimer_free() in the finalize function to avoid memleaks exynos4210_rtc: Use ptimer_free() in the finalize function to avoid memleaks allwinner-a10-pit: Use ptimer_free() in the finalize function to avoid memleaks digic-timer: Use ptimer_free() in the finalize function to avoid memleaks target/arm: Remove timer_del()/timer_deinit() before timer_free() Remove superfluous timer_del() calls scripts/coccinelle: New script to remove unnecessary timer_del() calls util/qemu-timer: Make timer_free() imply timer_del() hw/arm/highbank: Drop dead KVM support code target/arm: Implement Cortex-M55 model target/arm: Implement FPCXT_NS fp system register target/arm: Correct store of FPSCR value via FPCXT_S hw/intc/armv7m_nvic: Correct handling of CCR.BFHFNMIGN ... Signed-off-by: Peter Maydell <[email protected]>
2 parents e79de63 + c9f8511 commit 7b09f12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+421
-111
lines changed

block/iscsi.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,12 +1524,10 @@ static void iscsi_detach_aio_context(BlockDriverState *bs)
15241524
iscsilun->events = 0;
15251525

15261526
if (iscsilun->nop_timer) {
1527-
timer_del(iscsilun->nop_timer);
15281527
timer_free(iscsilun->nop_timer);
15291528
iscsilun->nop_timer = NULL;
15301529
}
15311530
if (iscsilun->event_timer) {
1532-
timer_del(iscsilun->event_timer);
15331531
timer_free(iscsilun->event_timer);
15341532
iscsilun->event_timer = NULL;
15351533
}

block/nbd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ static void nbd_recv_coroutines_wake_all(BDRVNBDState *s)
194194
static void reconnect_delay_timer_del(BDRVNBDState *s)
195195
{
196196
if (s->reconnect_delay_timer) {
197-
timer_del(s->reconnect_delay_timer);
198197
timer_free(s->reconnect_delay_timer);
199198
s->reconnect_delay_timer = NULL;
200199
}

block/qcow2.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,6 @@ static void cache_clean_timer_del(BlockDriverState *bs)
852852
{
853853
BDRVQcow2State *s = bs->opaque;
854854
if (s->cache_clean_timer) {
855-
timer_del(s->cache_clean_timer);
856855
timer_free(s->cache_clean_timer);
857856
s->cache_clean_timer = NULL;
858857
}

docs/system/arm/sabrelite.rst

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
Boundary Devices SABRE Lite (``sabrelite``)
2+
===========================================
3+
4+
Boundary Devices SABRE Lite i.MX6 Development Board is a low-cost development
5+
platform featuring the powerful Freescale / NXP Semiconductor's i.MX 6 Quad
6+
Applications Processor.
7+
8+
Supported devices
9+
-----------------
10+
11+
The SABRE Lite machine supports the following devices:
12+
13+
* Up to 4 Cortex A9 cores
14+
* Generic Interrupt Controller
15+
* 1 Clock Controller Module
16+
* 1 System Reset Controller
17+
* 5 UARTs
18+
* 2 EPIC timers
19+
* 1 GPT timer
20+
* 2 Watchdog timers
21+
* 1 FEC Ethernet controller
22+
* 3 I2C controllers
23+
* 7 GPIO controllers
24+
* 4 SDHC storage controllers
25+
* 4 USB 2.0 host controllers
26+
* 5 ECSPI controllers
27+
* 1 SST 25VF016B flash
28+
29+
Please note above list is a complete superset the QEMU SABRE Lite machine can
30+
support. For a normal use case, a device tree blob that represents a real world
31+
SABRE Lite board, only exposes a subset of devices to the guest software.
32+
33+
Boot options
34+
------------
35+
36+
The SABRE Lite machine can start using the standard -kernel functionality
37+
for loading a Linux kernel, U-Boot bootloader or ELF executable.
38+
39+
Running Linux kernel
40+
--------------------
41+
42+
Linux mainline v5.10 release is tested at the time of writing. To build a Linux
43+
mainline kernel that can be booted by the SABRE Lite machine, simply configure
44+
the kernel using the imx_v6_v7_defconfig configuration:
45+
46+
.. code-block:: bash
47+
48+
$ export ARCH=arm
49+
$ export CROSS_COMPILE=arm-linux-gnueabihf-
50+
$ make imx_v6_v7_defconfig
51+
$ make
52+
53+
To boot the newly built Linux kernel in QEMU with the SABRE Lite machine, use:
54+
55+
.. code-block:: bash
56+
57+
$ qemu-system-arm -M sabrelite -smp 4 -m 1G \
58+
-display none -serial null -serial stdio \
59+
-kernel arch/arm/boot/zImage \
60+
-dtb arch/arm/boot/dts/imx6q-sabrelite.dtb \
61+
-initrd /path/to/rootfs.ext4 \
62+
-append "root=/dev/ram"
63+
64+
Running U-Boot
65+
--------------
66+
67+
U-Boot mainline v2020.10 release is tested at the time of writing. To build a
68+
U-Boot mainline bootloader that can be booted by the SABRE Lite machine, use
69+
the mx6qsabrelite_defconfig with similar commands as described above for Linux:
70+
71+
.. code-block:: bash
72+
73+
$ export CROSS_COMPILE=arm-linux-gnueabihf-
74+
$ make mx6qsabrelite_defconfig
75+
76+
Note we need to adjust settings by:
77+
78+
.. code-block:: bash
79+
80+
$ make menuconfig
81+
82+
then manually select the following configuration in U-Boot:
83+
84+
Device Tree Control > Provider of DTB for DT Control > Embedded DTB
85+
86+
To start U-Boot using the SABRE Lite machine, provide the u-boot binary to
87+
the -kernel argument, along with an SD card image with rootfs:
88+
89+
.. code-block:: bash
90+
91+
$ qemu-system-arm -M sabrelite -smp 4 -m 1G \
92+
-display none -serial null -serial stdio \
93+
-kernel u-boot
94+
95+
The following example shows booting Linux kernel from dhcp, and uses the
96+
rootfs on an SD card. This requires some additional command line parameters
97+
for QEMU:
98+
99+
.. code-block:: none
100+
101+
-nic user,tftp=/path/to/kernel/zImage \
102+
-drive file=sdcard.img,id=rootfs -device sd-card,drive=rootfs
103+
104+
The directory for the built-in TFTP server should also contain the device tree
105+
blob of the SABRE Lite board. The sample SD card image was populated with the
106+
root file system with one single partition. You may adjust the kernel "root="
107+
boot parameter accordingly.
108+
109+
After U-Boot boots, type the following commands in the U-Boot command shell to
110+
boot the Linux kernel:
111+
112+
.. code-block:: none
113+
114+
=> setenv ethaddr 00:11:22:33:44:55
115+
=> setenv bootfile zImage
116+
=> dhcp
117+
=> tftpboot 14000000 imx6q-sabrelite.dtb
118+
=> setenv bootargs root=/dev/mmcblk3p1
119+
=> bootz 12000000 - 14000000

docs/system/target-arm.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ undocumented; you can get a complete list by running
8383
arm/versatile
8484
arm/vexpress
8585
arm/aspeed
86+
arm/sabrelite
8687
arm/digic
8788
arm/musicpal
8889
arm/gumstix

hw/arm/highbank.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "hw/arm/boot.h"
2727
#include "hw/loader.h"
2828
#include "net/net.h"
29-
#include "sysemu/kvm.h"
3029
#include "sysemu/runstate.h"
3130
#include "sysemu/sysemu.h"
3231
#include "hw/boards.h"
@@ -38,6 +37,7 @@
3837
#include "hw/cpu/a15mpcore.h"
3938
#include "qemu/log.h"
4039
#include "qom/object.h"
40+
#include "cpu.h"
4141

4242
#define SMP_BOOT_ADDR 0x100
4343
#define SMP_BOOT_REG 0x40
@@ -396,15 +396,9 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
396396
highbank_binfo.loader_start = 0;
397397
highbank_binfo.write_secondary_boot = hb_write_secondary;
398398
highbank_binfo.secondary_cpu_reset_hook = hb_reset_secondary;
399-
if (!kvm_enabled()) {
400-
highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR;
401-
highbank_binfo.write_board_setup = hb_write_board_setup;
402-
highbank_binfo.secure_board_setup = true;
403-
} else {
404-
warn_report("cannot load built-in Monitor support "
405-
"if KVM is enabled. Some guests (such as Linux) "
406-
"may not boot.");
407-
}
399+
highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR;
400+
highbank_binfo.write_board_setup = hb_write_board_setup;
401+
highbank_binfo.secure_board_setup = true;
408402

409403
arm_load_kernel(ARM_CPU(first_cpu), machine, &highbank_binfo);
410404
}

hw/arm/musicpal.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,17 @@ static void mv88w8618_pit_init(Object *obj)
959959
sysbus_init_mmio(dev, &s->iomem);
960960
}
961961

962+
static void mv88w8618_pit_finalize(Object *obj)
963+
{
964+
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
965+
mv88w8618_pit_state *s = MV88W8618_PIT(dev);
966+
int i;
967+
968+
for (i = 0; i < 4; i++) {
969+
ptimer_free(s->timer[i].ptimer);
970+
}
971+
}
972+
962973
static const VMStateDescription mv88w8618_timer_vmsd = {
963974
.name = "timer",
964975
.version_id = 1,
@@ -994,6 +1005,7 @@ static const TypeInfo mv88w8618_pit_info = {
9941005
.parent = TYPE_SYS_BUS_DEVICE,
9951006
.instance_size = sizeof(mv88w8618_pit_state),
9961007
.instance_init = mv88w8618_pit_init,
1008+
.instance_finalize = mv88w8618_pit_finalize,
9971009
.class_init = mv88w8618_pit_class_init,
9981010
};
9991011

hw/arm/sabrelite.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ static void sabrelite_init(MachineState *machine)
5151

5252
s = FSL_IMX6(object_new(TYPE_FSL_IMX6));
5353
object_property_add_child(OBJECT(machine), "soc", OBJECT(s));
54+
55+
/* Ethernet PHY address is 6 */
56+
object_property_set_int(OBJECT(s), "fec-phy-num", 6, &error_fatal);
57+
5458
qdev_realize(DEVICE(s), NULL, &error_fatal);
5559

5660
memory_region_add_subregion(get_system_memory(), FSL_IMX6_MMDC_ADDR,

hw/arm/virt-acpi-build.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@
5959

6060
#define ACPI_BUILD_TABLE_SIZE 0x20000
6161

62-
static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
62+
static void acpi_dsdt_add_cpus(Aml *scope, VirtMachineState *vms)
6363
{
64+
MachineState *ms = MACHINE(vms);
6465
uint16_t i;
6566

66-
for (i = 0; i < smp_cpus; i++) {
67+
for (i = 0; i < ms->smp.cpus; i++) {
6768
Aml *dev = aml_device("C%.03X", i);
6869
aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
6970
aml_append(dev, aml_name_decl("_UID", aml_int(i)));
@@ -484,7 +485,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
484485
gicd->base_address = cpu_to_le64(memmap[VIRT_GIC_DIST].base);
485486
gicd->version = vms->gic_version;
486487

487-
for (i = 0; i < vms->smp_cpus; i++) {
488+
for (i = 0; i < MACHINE(vms)->smp.cpus; i++) {
488489
AcpiMadtGenericCpuInterface *gicc = acpi_data_push(table_data,
489490
sizeof(*gicc));
490491
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i));
@@ -603,7 +604,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
603604
* the RTC ACPI device at all when using UEFI.
604605
*/
605606
scope = aml_scope("\\_SB");
606-
acpi_dsdt_add_cpus(scope, vms->smp_cpus);
607+
acpi_dsdt_add_cpus(scope, vms);
607608
acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
608609
(irqmap[VIRT_UART] + ARM_SPI_BASE));
609610
if (vmc->acpi_expose_flash) {

hw/arm/virt.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ static void fdt_add_timer_nodes(const VirtMachineState *vms)
323323
if (vms->gic_version == VIRT_GIC_VERSION_2) {
324324
irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
325325
GIC_FDT_IRQ_PPI_CPU_WIDTH,
326-
(1 << vms->smp_cpus) - 1);
326+
(1 << MACHINE(vms)->smp.cpus) - 1);
327327
}
328328

329329
qemu_fdt_add_subnode(vms->fdt, "/timer");
@@ -350,6 +350,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
350350
int cpu;
351351
int addr_cells = 1;
352352
const MachineState *ms = MACHINE(vms);
353+
int smp_cpus = ms->smp.cpus;
353354

354355
/*
355356
* From Documentation/devicetree/bindings/arm/cpus.txt
@@ -364,7 +365,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
364365
* The simplest way to go is to examine affinity IDs of all our CPUs. If
365366
* at least one of them has Aff3 populated, we set #address-cells to 2.
366367
*/
367-
for (cpu = 0; cpu < vms->smp_cpus; cpu++) {
368+
for (cpu = 0; cpu < smp_cpus; cpu++) {
368369
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu));
369370

370371
if (armcpu->mp_affinity & ARM_AFF3_MASK) {
@@ -377,7 +378,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
377378
qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#address-cells", addr_cells);
378379
qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#size-cells", 0x0);
379380

380-
for (cpu = vms->smp_cpus - 1; cpu >= 0; cpu--) {
381+
for (cpu = smp_cpus - 1; cpu >= 0; cpu--) {
381382
char *nodename = g_strdup_printf("/cpus/cpu@%d", cpu);
382383
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu));
383384
CPUState *cs = CPU(armcpu);
@@ -387,8 +388,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
387388
qemu_fdt_setprop_string(vms->fdt, nodename, "compatible",
388389
armcpu->dtb_compatible);
389390

390-
if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED
391-
&& vms->smp_cpus > 1) {
391+
if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED && smp_cpus > 1) {
392392
qemu_fdt_setprop_string(vms->fdt, nodename,
393393
"enable-method", "psci");
394394
}
@@ -534,7 +534,7 @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)
534534
if (vms->gic_version == VIRT_GIC_VERSION_2) {
535535
irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
536536
GIC_FDT_IRQ_PPI_CPU_WIDTH,
537-
(1 << vms->smp_cpus) - 1);
537+
(1 << MACHINE(vms)->smp.cpus) - 1);
538538
}
539539

540540
qemu_fdt_add_subnode(vms->fdt, "/pmu");
@@ -1674,9 +1674,9 @@ static void finalize_gic_version(VirtMachineState *vms)
16741674
* virt_cpu_post_init() must be called after the CPUs have
16751675
* been realized and the GIC has been created.
16761676
*/
1677-
static void virt_cpu_post_init(VirtMachineState *vms, int max_cpus,
1678-
MemoryRegion *sysmem)
1677+
static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem)
16791678
{
1679+
int max_cpus = MACHINE(vms)->smp.max_cpus;
16801680
bool aarch64, pmu, steal_time;
16811681
CPUState *cpu;
16821682

@@ -1829,8 +1829,6 @@ static void machvirt_init(MachineState *machine)
18291829
exit(1);
18301830
}
18311831

1832-
vms->smp_cpus = smp_cpus;
1833-
18341832
if (vms->virt && kvm_enabled()) {
18351833
error_report("mach-virt: KVM does not support providing "
18361834
"Virtualization extensions to the guest CPU");
@@ -1846,6 +1844,7 @@ static void machvirt_init(MachineState *machine)
18461844
create_fdt(vms);
18471845

18481846
possible_cpus = mc->possible_cpu_arch_ids(machine);
1847+
assert(possible_cpus->len == max_cpus);
18491848
for (n = 0; n < possible_cpus->len; n++) {
18501849
Object *cpuobj;
18511850
CPUState *cs;
@@ -1966,7 +1965,7 @@ static void machvirt_init(MachineState *machine)
19661965

19671966
create_gic(vms);
19681967

1969-
virt_cpu_post_init(vms, possible_cpus->len, sysmem);
1968+
virt_cpu_post_init(vms, sysmem);
19701969

19711970
fdt_add_pmu_nodes(vms);
19721971

0 commit comments

Comments
 (0)