Skip to content

Commit af3d690

Browse files
committed
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200720' into staging
target-arm queue: * virt: Don't enable MTE emulation by default * virt: Diagnose attempts to use MTE with memory-hotplug or KVM (rather than silently not working correctly) * util: Implement qemu_get_thread_id() for OpenBSD * qdev: Add doc comments for qdev_unrealize and GPIO functions, and standardize on doc-comments-in-header-file * hw/arm/armsse: Assert info->num_cpus is in-bounds in armsse_realize() * docs/system: Document canon-a1100, collie, gumstix, virt boards # gpg: Signature made Mon 20 Jul 2020 13:55:36 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-20200720: docs/system: Document the arm virt board docs/system: Briefly document gumstix boards docs/system: Briefly document collie board docs/system: Briefly document canon-a1100 board hw/arm/armsse: Assert info->num_cpus is in-bounds in armsse_realize() qdev: Document GPIO related functions qdev: Document qdev_unrealize() qdev: Move doc comments from qdev.c to qdev-core.h util: Implement qemu_get_thread_id() for OpenBSD hw/arm/virt: Disable memory hotplug when MTE is enabled hw/arm/virt: Error for MTE enabled with KVM hw/arm/virt: Enable MTE via a machine property Signed-off-by: Peter Maydell <[email protected]>
2 parents 1e6c50a + 6a0b750 commit af3d690

File tree

15 files changed

+559
-50
lines changed

15 files changed

+559
-50
lines changed

MAINTAINERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ F: include/hw/arm/digic.h
636636
F: hw/*/digic*
637637
F: include/hw/*/digic*
638638
F: tests/acceptance/machine_arm_canona1100.py
639+
F: docs/system/arm/digic.rst
639640

640641
Goldfish RTC
641642
M: Anup Patel <[email protected]>
@@ -651,6 +652,7 @@ R: Philippe Mathieu-Daudé <[email protected]>
651652
652653
S: Odd Fixes
653654
F: hw/arm/gumstix.c
655+
F: docs/system/arm/gumstix.rst
654656

655657
i.MX25 PDK
656658
M: Peter Maydell <[email protected]>
@@ -846,6 +848,7 @@ L: [email protected]
846848
S: Odd Fixes
847849
F: hw/arm/collie.c
848850
F: hw/arm/strongarm*
851+
F: docs/system/arm/collie.rst
849852

850853
Stellaris
851854
M: Peter Maydell <[email protected]>
@@ -877,6 +880,7 @@ L: [email protected]
877880
S: Maintained
878881
F: hw/arm/virt*
879882
F: include/hw/arm/virt.h
883+
F: docs/system/arm/virt.rst
880884

881885
Xilinx Zynq
882886
M: Edgar E. Iglesias <[email protected]>

docs/system/arm/collie.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Sharp Zaurus SL-5500 (``collie``)
2+
=================================
3+
4+
This machine is a model of the Sharp Zaurus SL-5500, which was
5+
a 1990s PDA based on the StrongARM SA1110.
6+
7+
Implemented devices:
8+
9+
* NOR flash
10+
* Interrupt controller
11+
* Timer
12+
* RTC
13+
* GPIO
14+
* Peripheral Pin Controller (PPC)
15+
* UARTs
16+
* Synchronous Serial Ports (SSP)

docs/system/arm/digic.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Canon A1100 (``canon-a1100``)
2+
=============================
3+
4+
This machine is a model of the Canon PowerShot A1100 camera, which
5+
uses the DIGIC SoC. This model is based on reverse engineering efforts
6+
by the contributors to the `CHDK <http://chdk.wikia.com/>`_ and
7+
`Magic Lantern <http://www.magiclantern.fm/>`_ projects.
8+
9+
The emulation is incomplete. In particular it can't be used
10+
to run the original camera firmware, but it can successfully run
11+
an experimental version of the `barebox bootloader <http://www.barebox.org/>`_.

docs/system/arm/gumstix.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Gumstix Connex and Verdex (``connex``, ``verdex``)
2+
==================================================
3+
4+
These machines model the Gumstix Connex and Verdex boards.
5+
The Connex has a PXA255 CPU and the Verdex has a PXA270.
6+
7+
Implemented devices:
8+
9+
* NOR flash
10+
* SMC91C111 ethernet
11+
* Interrupt controller
12+
* DMA
13+
* Timer
14+
* GPIO
15+
* MMC/SD card
16+
* Fast infra-red communications port (FIR)
17+
* LCD controller
18+
* Synchronous serial ports (SPI)
19+
* PCMCIA interface
20+
* I2C
21+
* I2S

docs/system/arm/virt.rst

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
'virt' generic virtual platform (``virt``)
2+
==========================================
3+
4+
The `virt` board is a platform which does not correspond to any
5+
real hardware; it is designed for use in virtual machines.
6+
It is the recommended board type if you simply want to run
7+
a guest such as Linux and do not care about reproducing the
8+
idiosyncrasies and limitations of a particular bit of real-world
9+
hardware.
10+
11+
This is a "versioned" board model, so as well as the ``virt`` machine
12+
type itself (which may have improvements, bugfixes and other minor
13+
changes between QEMU versions) a version is provided that guarantees
14+
to have the same behaviour as that of previous QEMU releases, so
15+
that VM migration will work between QEMU versions. For instance the
16+
``virt-5.0`` machine type will behave like the ``virt`` machine from
17+
the QEMU 5.0 release, and migration should work between ``virt-5.0``
18+
of the 5.0 release and ``virt-5.0`` of the 5.1 release. Migration
19+
is not guaranteed to work between different QEMU releases for
20+
the non-versioned ``virt`` machine type.
21+
22+
Supported devices
23+
"""""""""""""""""
24+
25+
The virt board supports:
26+
27+
- PCI/PCIe devices
28+
- Flash memory
29+
- One PL011 UART
30+
- An RTC
31+
- The fw_cfg device that allows a guest to obtain data from QEMU
32+
- A PL061 GPIO controller
33+
- An optional SMMUv3 IOMMU
34+
- hotpluggable DIMMs
35+
- hotpluggable NVDIMMs
36+
- An MSI controller (GICv2M or ITS). GICv2M is selected by default along
37+
with GICv2. ITS is selected by default with GICv3 (>= virt-2.7). Note
38+
that ITS is not modeled in TCG mode.
39+
- 32 virtio-mmio transport devices
40+
- running guests using the KVM accelerator on aarch64 hardware
41+
- large amounts of RAM (at least 255GB, and more if using highmem)
42+
- many CPUs (up to 512 if using a GICv3 and highmem)
43+
- Secure-World-only devices if the CPU has TrustZone:
44+
45+
- A second PL011 UART
46+
- A secure flash memory
47+
- 16MB of secure RAM
48+
49+
Supported guest CPU types:
50+
51+
- ``cortex-a7`` (32-bit)
52+
- ``cortex-a15`` (32-bit; the default)
53+
- ``cortex-a53`` (64-bit)
54+
- ``cortex-a57`` (64-bit)
55+
- ``cortex-a72`` (64-bit)
56+
- ``host`` (with KVM only)
57+
- ``max`` (same as ``host`` for KVM; best possible emulation with TCG)
58+
59+
Note that the default is ``cortex-a15``, so for an AArch64 guest you must
60+
specify a CPU type.
61+
62+
Graphics output is available, but unlike the x86 PC machine types
63+
there is no default display device enabled: you should select one from
64+
the Display devices section of "-device help". The recommended option
65+
is ``virtio-gpu-pci``; this is the only one which will work correctly
66+
with KVM. You may also need to ensure your guest kernel is configured
67+
with support for this; see below.
68+
69+
Machine-specific options
70+
""""""""""""""""""""""""
71+
72+
The following machine-specific options are supported:
73+
74+
secure
75+
Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the
76+
Arm Security Extensions (TrustZone). The default is ``off``.
77+
78+
virtualization
79+
Set ``on``/``off`` to enable/disable emulating a guest CPU which implements the
80+
Arm Virtualization Extensions. The default is ``off``.
81+
82+
highmem
83+
Set ``on``/``off`` to enable/disable placing devices and RAM in physical
84+
address space above 32 bits. The default is ``on`` for machine types
85+
later than ``virt-2.12``.
86+
87+
gic-version
88+
Specify the version of the Generic Interrupt Controller (GIC) to provide.
89+
Valid values are:
90+
91+
``2``
92+
GICv2
93+
``3``
94+
GICv3
95+
``host``
96+
Use the same GIC version the host provides, when using KVM
97+
``max``
98+
Use the best GIC version possible (same as host when using KVM;
99+
currently same as ``3``` for TCG, but this may change in future)
100+
101+
its
102+
Set ``on``/``off`` to enable/disable ITS instantiation. The default is ``on``
103+
for machine types later than ``virt-2.7``.
104+
105+
iommu
106+
Set the IOMMU type to create for the guest. Valid values are:
107+
108+
``none``
109+
Don't create an IOMMU (the default)
110+
``smmuv3``
111+
Create an SMMUv3
112+
113+
ras
114+
Set ``on``/``off`` to enable/disable reporting host memory errors to a guest
115+
using ACPI and guest external abort exceptions. The default is off.
116+
117+
Linux guest kernel configuration
118+
""""""""""""""""""""""""""""""""
119+
120+
The 'defconfig' for Linux arm and arm64 kernels should include the
121+
right device drivers for virtio and the PCI controller; however some older
122+
kernel versions, especially for 32-bit Arm, did not have everything
123+
enabled by default. If you're not seeing PCI devices that you expect,
124+
then check that your guest config has::
125+
126+
CONFIG_PCI=y
127+
CONFIG_VIRTIO_PCI=y
128+
CONFIG_PCI_HOST_GENERIC=y
129+
130+
If you want to use the ``virtio-gpu-pci`` graphics device you will also
131+
need::
132+
133+
CONFIG_DRM=y
134+
CONFIG_DRM_VIRTIO_GPU=y
135+
136+
Hardware configuration information for bare-metal programming
137+
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
138+
139+
The ``virt`` board automatically generates a device tree blob ("dtb")
140+
which it passes to the guest. This provides information about the
141+
addresses, interrupt lines and other configuration of the various devices
142+
in the system. Guest code can rely on and hard-code the following
143+
addresses:
144+
145+
- Flash memory starts at address 0x0000_0000
146+
147+
- RAM starts at 0x4000_0000
148+
149+
All other information about device locations may change between
150+
QEMU versions, so guest code must look in the DTB.
151+
152+
QEMU supports two types of guest image boot for ``virt``, and
153+
the way for the guest code to locate the dtb binary differs:
154+
155+
- For guests using the Linux kernel boot protocol (this means any
156+
non-ELF file passed to the QEMU ``-kernel`` option) the address
157+
of the DTB is passed in a register (``r2`` for 32-bit guests,
158+
or ``x0`` for 64-bit guests)
159+
160+
- For guests booting as "bare-metal" (any other kind of boot),
161+
the DTB is at the start of RAM (0x4000_0000)

docs/system/target-arm.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,17 @@ undocumented; you can get a complete list by running
8282
arm/versatile
8383
arm/vexpress
8484
arm/aspeed
85+
arm/digic
8586
arm/musicpal
87+
arm/gumstix
8688
arm/nseries
8789
arm/orangepi
8890
arm/palm
8991
arm/xscale
92+
arm/collie
9093
arm/sx1
9194
arm/stellaris
95+
arm/virt
9296

9397
Arm CPU features
9498
================

hw/arm/armsse.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ static void armsse_realize(DeviceState *dev, Error **errp)
452452
return;
453453
}
454454

455+
assert(info->num_cpus <= SSE_MAX_CPUS);
456+
455457
/* max SRAM_ADDR_WIDTH: 24 - log2(SRAM_NUM_BANK) */
456458
assert(is_power_of_2(info->sram_banks));
457459
addr_width_max = 24 - ctz32(info->sram_banks);

hw/arm/virt.c

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,6 +1773,12 @@ static void machvirt_init(MachineState *machine)
17731773
exit(1);
17741774
}
17751775

1776+
if (vms->mte && kvm_enabled()) {
1777+
error_report("mach-virt: KVM does not support providing "
1778+
"MTE to the guest CPU");
1779+
exit(1);
1780+
}
1781+
17761782
create_fdt(vms);
17771783

17781784
possible_cpus = mc->possible_cpu_arch_ids(machine);
@@ -1837,12 +1843,19 @@ static void machvirt_init(MachineState *machine)
18371843
OBJECT(secure_sysmem), &error_abort);
18381844
}
18391845

1840-
/*
1841-
* The cpu adds the property if and only if MemTag is supported.
1842-
* If it is, we must allocate the ram to back that up.
1843-
*/
1844-
if (object_property_find(cpuobj, "tag-memory", NULL)) {
1846+
if (vms->mte) {
1847+
/* Create the memory region only once, but link to all cpus. */
18451848
if (!tag_sysmem) {
1849+
/*
1850+
* The property exists only if MemTag is supported.
1851+
* If it is, we must allocate the ram to back that up.
1852+
*/
1853+
if (!object_property_find(cpuobj, "tag-memory", NULL)) {
1854+
error_report("MTE requested, but not supported "
1855+
"by the guest CPU");
1856+
exit(1);
1857+
}
1858+
18461859
tag_sysmem = g_new(MemoryRegion, 1);
18471860
memory_region_init(tag_sysmem, OBJECT(machine),
18481861
"tag-memory", UINT64_MAX / 32);
@@ -2061,6 +2074,20 @@ static void virt_set_ras(Object *obj, bool value, Error **errp)
20612074
vms->ras = value;
20622075
}
20632076

2077+
static bool virt_get_mte(Object *obj, Error **errp)
2078+
{
2079+
VirtMachineState *vms = VIRT_MACHINE(obj);
2080+
2081+
return vms->mte;
2082+
}
2083+
2084+
static void virt_set_mte(Object *obj, bool value, Error **errp)
2085+
{
2086+
VirtMachineState *vms = VIRT_MACHINE(obj);
2087+
2088+
vms->mte = value;
2089+
}
2090+
20642091
static char *virt_get_gic_version(Object *obj, Error **errp)
20652092
{
20662093
VirtMachineState *vms = VIRT_MACHINE(obj);
@@ -2167,6 +2194,11 @@ static void virt_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
21672194
return;
21682195
}
21692196

2197+
if (vms->mte) {
2198+
error_setg(errp, "memory hotplug is not enabled: MTE is enabled");
2199+
return;
2200+
}
2201+
21702202
if (is_nvdimm && !ms->nvdimms_state->is_enabled) {
21712203
error_setg(errp, "nvdimm is not enabled: add 'nvdimm=on' to '-M'");
21722204
return;
@@ -2481,6 +2513,14 @@ static void virt_instance_init(Object *obj)
24812513
"Set on/off to enable/disable reporting host memory errors "
24822514
"to a KVM guest using ACPI and guest external abort exceptions");
24832515

2516+
/* MTE is disabled by default. */
2517+
vms->mte = false;
2518+
object_property_add_bool(obj, "mte", virt_get_mte, virt_set_mte);
2519+
object_property_set_description(obj, "mte",
2520+
"Set on/off to enable/disable emulating a "
2521+
"guest CPU which implements the ARM "
2522+
"Memory Tagging Extension");
2523+
24842524
vms->irqmap = a15irqmap;
24852525

24862526
virt_flash_create(vms);

0 commit comments

Comments
 (0)