Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-2…
Browse files Browse the repository at this point in the history
…0210108' 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]>
  • Loading branch information
pm215 committed Jan 8, 2021
2 parents e79de63 + c9f8511 commit 7b09f12
Show file tree
Hide file tree
Showing 65 changed files with 421 additions and 111 deletions.
2 changes: 0 additions & 2 deletions block/iscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1524,12 +1524,10 @@ static void iscsi_detach_aio_context(BlockDriverState *bs)
iscsilun->events = 0;

if (iscsilun->nop_timer) {
timer_del(iscsilun->nop_timer);
timer_free(iscsilun->nop_timer);
iscsilun->nop_timer = NULL;
}
if (iscsilun->event_timer) {
timer_del(iscsilun->event_timer);
timer_free(iscsilun->event_timer);
iscsilun->event_timer = NULL;
}
Expand Down
1 change: 0 additions & 1 deletion block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ static void nbd_recv_coroutines_wake_all(BDRVNBDState *s)
static void reconnect_delay_timer_del(BDRVNBDState *s)
{
if (s->reconnect_delay_timer) {
timer_del(s->reconnect_delay_timer);
timer_free(s->reconnect_delay_timer);
s->reconnect_delay_timer = NULL;
}
Expand Down
1 change: 0 additions & 1 deletion block/qcow2.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,6 @@ static void cache_clean_timer_del(BlockDriverState *bs)
{
BDRVQcow2State *s = bs->opaque;
if (s->cache_clean_timer) {
timer_del(s->cache_clean_timer);
timer_free(s->cache_clean_timer);
s->cache_clean_timer = NULL;
}
Expand Down
119 changes: 119 additions & 0 deletions docs/system/arm/sabrelite.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
Boundary Devices SABRE Lite (``sabrelite``)
===========================================

Boundary Devices SABRE Lite i.MX6 Development Board is a low-cost development
platform featuring the powerful Freescale / NXP Semiconductor's i.MX 6 Quad
Applications Processor.

Supported devices
-----------------

The SABRE Lite machine supports the following devices:

* Up to 4 Cortex A9 cores
* Generic Interrupt Controller
* 1 Clock Controller Module
* 1 System Reset Controller
* 5 UARTs
* 2 EPIC timers
* 1 GPT timer
* 2 Watchdog timers
* 1 FEC Ethernet controller
* 3 I2C controllers
* 7 GPIO controllers
* 4 SDHC storage controllers
* 4 USB 2.0 host controllers
* 5 ECSPI controllers
* 1 SST 25VF016B flash

Please note above list is a complete superset the QEMU SABRE Lite machine can
support. For a normal use case, a device tree blob that represents a real world
SABRE Lite board, only exposes a subset of devices to the guest software.

Boot options
------------

The SABRE Lite machine can start using the standard -kernel functionality
for loading a Linux kernel, U-Boot bootloader or ELF executable.

Running Linux kernel
--------------------

Linux mainline v5.10 release is tested at the time of writing. To build a Linux
mainline kernel that can be booted by the SABRE Lite machine, simply configure
the kernel using the imx_v6_v7_defconfig configuration:

.. code-block:: bash
$ export ARCH=arm
$ export CROSS_COMPILE=arm-linux-gnueabihf-
$ make imx_v6_v7_defconfig
$ make
To boot the newly built Linux kernel in QEMU with the SABRE Lite machine, use:

.. code-block:: bash
$ qemu-system-arm -M sabrelite -smp 4 -m 1G \
-display none -serial null -serial stdio \
-kernel arch/arm/boot/zImage \
-dtb arch/arm/boot/dts/imx6q-sabrelite.dtb \
-initrd /path/to/rootfs.ext4 \
-append "root=/dev/ram"
Running U-Boot
--------------

U-Boot mainline v2020.10 release is tested at the time of writing. To build a
U-Boot mainline bootloader that can be booted by the SABRE Lite machine, use
the mx6qsabrelite_defconfig with similar commands as described above for Linux:

.. code-block:: bash
$ export CROSS_COMPILE=arm-linux-gnueabihf-
$ make mx6qsabrelite_defconfig
Note we need to adjust settings by:

.. code-block:: bash
$ make menuconfig
then manually select the following configuration in U-Boot:

Device Tree Control > Provider of DTB for DT Control > Embedded DTB

To start U-Boot using the SABRE Lite machine, provide the u-boot binary to
the -kernel argument, along with an SD card image with rootfs:

.. code-block:: bash
$ qemu-system-arm -M sabrelite -smp 4 -m 1G \
-display none -serial null -serial stdio \
-kernel u-boot
The following example shows booting Linux kernel from dhcp, and uses the
rootfs on an SD card. This requires some additional command line parameters
for QEMU:

.. code-block:: none
-nic user,tftp=/path/to/kernel/zImage \
-drive file=sdcard.img,id=rootfs -device sd-card,drive=rootfs
The directory for the built-in TFTP server should also contain the device tree
blob of the SABRE Lite board. The sample SD card image was populated with the
root file system with one single partition. You may adjust the kernel "root="
boot parameter accordingly.

After U-Boot boots, type the following commands in the U-Boot command shell to
boot the Linux kernel:

.. code-block:: none
=> setenv ethaddr 00:11:22:33:44:55
=> setenv bootfile zImage
=> dhcp
=> tftpboot 14000000 imx6q-sabrelite.dtb
=> setenv bootargs root=/dev/mmcblk3p1
=> bootz 12000000 - 14000000
1 change: 1 addition & 0 deletions docs/system/target-arm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ undocumented; you can get a complete list by running
arm/versatile
arm/vexpress
arm/aspeed
arm/sabrelite
arm/digic
arm/musicpal
arm/gumstix
Expand Down
14 changes: 4 additions & 10 deletions hw/arm/highbank.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "hw/arm/boot.h"
#include "hw/loader.h"
#include "net/net.h"
#include "sysemu/kvm.h"
#include "sysemu/runstate.h"
#include "sysemu/sysemu.h"
#include "hw/boards.h"
Expand All @@ -38,6 +37,7 @@
#include "hw/cpu/a15mpcore.h"
#include "qemu/log.h"
#include "qom/object.h"
#include "cpu.h"

#define SMP_BOOT_ADDR 0x100
#define SMP_BOOT_REG 0x40
Expand Down Expand Up @@ -396,15 +396,9 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
highbank_binfo.loader_start = 0;
highbank_binfo.write_secondary_boot = hb_write_secondary;
highbank_binfo.secondary_cpu_reset_hook = hb_reset_secondary;
if (!kvm_enabled()) {
highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR;
highbank_binfo.write_board_setup = hb_write_board_setup;
highbank_binfo.secure_board_setup = true;
} else {
warn_report("cannot load built-in Monitor support "
"if KVM is enabled. Some guests (such as Linux) "
"may not boot.");
}
highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR;
highbank_binfo.write_board_setup = hb_write_board_setup;
highbank_binfo.secure_board_setup = true;

arm_load_kernel(ARM_CPU(first_cpu), machine, &highbank_binfo);
}
Expand Down
12 changes: 12 additions & 0 deletions hw/arm/musicpal.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,17 @@ static void mv88w8618_pit_init(Object *obj)
sysbus_init_mmio(dev, &s->iomem);
}

static void mv88w8618_pit_finalize(Object *obj)
{
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
mv88w8618_pit_state *s = MV88W8618_PIT(dev);
int i;

for (i = 0; i < 4; i++) {
ptimer_free(s->timer[i].ptimer);
}
}

static const VMStateDescription mv88w8618_timer_vmsd = {
.name = "timer",
.version_id = 1,
Expand Down Expand Up @@ -994,6 +1005,7 @@ static const TypeInfo mv88w8618_pit_info = {
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(mv88w8618_pit_state),
.instance_init = mv88w8618_pit_init,
.instance_finalize = mv88w8618_pit_finalize,
.class_init = mv88w8618_pit_class_init,
};

Expand Down
4 changes: 4 additions & 0 deletions hw/arm/sabrelite.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ static void sabrelite_init(MachineState *machine)

s = FSL_IMX6(object_new(TYPE_FSL_IMX6));
object_property_add_child(OBJECT(machine), "soc", OBJECT(s));

/* Ethernet PHY address is 6 */
object_property_set_int(OBJECT(s), "fec-phy-num", 6, &error_fatal);

qdev_realize(DEVICE(s), NULL, &error_fatal);

memory_region_add_subregion(get_system_memory(), FSL_IMX6_MMDC_ADDR,
Expand Down
9 changes: 5 additions & 4 deletions hw/arm/virt-acpi-build.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@

#define ACPI_BUILD_TABLE_SIZE 0x20000

static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
static void acpi_dsdt_add_cpus(Aml *scope, VirtMachineState *vms)
{
MachineState *ms = MACHINE(vms);
uint16_t i;

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

for (i = 0; i < vms->smp_cpus; i++) {
for (i = 0; i < MACHINE(vms)->smp.cpus; i++) {
AcpiMadtGenericCpuInterface *gicc = acpi_data_push(table_data,
sizeof(*gicc));
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i));
Expand Down Expand Up @@ -603,7 +604,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
* the RTC ACPI device at all when using UEFI.
*/
scope = aml_scope("\\_SB");
acpi_dsdt_add_cpus(scope, vms->smp_cpus);
acpi_dsdt_add_cpus(scope, vms);
acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
(irqmap[VIRT_UART] + ARM_SPI_BASE));
if (vmc->acpi_expose_flash) {
Expand Down
21 changes: 10 additions & 11 deletions hw/arm/virt.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ static void fdt_add_timer_nodes(const VirtMachineState *vms)
if (vms->gic_version == VIRT_GIC_VERSION_2) {
irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
GIC_FDT_IRQ_PPI_CPU_WIDTH,
(1 << vms->smp_cpus) - 1);
(1 << MACHINE(vms)->smp.cpus) - 1);
}

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

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

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

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

if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED
&& vms->smp_cpus > 1) {
if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED && smp_cpus > 1) {
qemu_fdt_setprop_string(vms->fdt, nodename,
"enable-method", "psci");
}
Expand Down Expand Up @@ -534,7 +534,7 @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)
if (vms->gic_version == VIRT_GIC_VERSION_2) {
irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
GIC_FDT_IRQ_PPI_CPU_WIDTH,
(1 << vms->smp_cpus) - 1);
(1 << MACHINE(vms)->smp.cpus) - 1);
}

qemu_fdt_add_subnode(vms->fdt, "/pmu");
Expand Down Expand Up @@ -1674,9 +1674,9 @@ static void finalize_gic_version(VirtMachineState *vms)
* virt_cpu_post_init() must be called after the CPUs have
* been realized and the GIC has been created.
*/
static void virt_cpu_post_init(VirtMachineState *vms, int max_cpus,
MemoryRegion *sysmem)
static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem)
{
int max_cpus = MACHINE(vms)->smp.max_cpus;
bool aarch64, pmu, steal_time;
CPUState *cpu;

Expand Down Expand Up @@ -1829,8 +1829,6 @@ static void machvirt_init(MachineState *machine)
exit(1);
}

vms->smp_cpus = smp_cpus;

if (vms->virt && kvm_enabled()) {
error_report("mach-virt: KVM does not support providing "
"Virtualization extensions to the guest CPU");
Expand All @@ -1846,6 +1844,7 @@ static void machvirt_init(MachineState *machine)
create_fdt(vms);

possible_cpus = mc->possible_cpu_arch_ids(machine);
assert(possible_cpus->len == max_cpus);
for (n = 0; n < possible_cpus->len; n++) {
Object *cpuobj;
CPUState *cs;
Expand Down Expand Up @@ -1966,7 +1965,7 @@ static void machvirt_init(MachineState *machine)

create_gic(vms);

virt_cpu_post_init(vms, possible_cpus->len, sysmem);
virt_cpu_post_init(vms, sysmem);

fdt_add_pmu_nodes(vms);

Expand Down
2 changes: 0 additions & 2 deletions hw/block/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,6 @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest *req)
static void nvme_free_sq(NvmeSQueue *sq, NvmeCtrl *n)
{
n->sq[sq->sqid] = NULL;
timer_del(sq->timer);
timer_free(sq->timer);
g_free(sq->io_req);
if (sq->sqid) {
Expand Down Expand Up @@ -1334,7 +1333,6 @@ static uint16_t nvme_get_log(NvmeCtrl *n, NvmeRequest *req)
static void nvme_free_cq(NvmeCQueue *cq, NvmeCtrl *n)
{
n->cq[cq->cqid] = NULL;
timer_del(cq->timer);
timer_free(cq->timer);
msix_vector_unuse(&n->parent_obj, cq->vector);
if (cq->cqid) {
Expand Down
2 changes: 0 additions & 2 deletions hw/char/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,10 +941,8 @@ static void serial_unrealize(DeviceState *dev)

qemu_chr_fe_deinit(&s->chr, false);

timer_del(s->modem_status_poll);
timer_free(s->modem_status_poll);

timer_del(s->fifo_timeout_timer);
timer_free(s->fifo_timeout_timer);

fifo8_destroy(&s->recv_fifo);
Expand Down
2 changes: 0 additions & 2 deletions hw/char/virtio-serial-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,6 @@ static void virtio_serial_post_load_timer_cb(void *opaque)
}
}
g_free(s->post_load->connected);
timer_del(s->post_load->timer);
timer_free(s->post_load->timer);
g_free(s->post_load);
s->post_load = NULL;
Expand Down Expand Up @@ -1138,7 +1137,6 @@ static void virtio_serial_device_unrealize(DeviceState *dev)
g_free(vser->ports_map);
if (vser->post_load) {
g_free(vser->post_load->connected);
timer_del(vser->post_load->timer);
timer_free(vser->post_load->timer);
g_free(vser->post_load);
}
Expand Down
Loading

0 comments on commit 7b09f12

Please sign in to comment.