Skip to content

Commit

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

target-arm queue:
 * Fix vd == vm overlap in sve_ldff1_z
 * Add support for MTE with KVM guests
 * Add RAZ/WI handling for DBGDTR[TX|RX]
 * Start of conversion of A64 decoder to decodetree
 * Saturate L2CTLR_EL1 core count field rather than overflowing
 * vexpress: Avoid trivial memory leak of 'flashalias'
 * sbsa-ref: switch default cpu core to Neoverse-N1
 * sbsa-ref: use Bochs graphics card instead of VGA
 * MAINTAINERS: Add Marcin Juszkiewicz to sbsa-ref reviewer list
 * docs: Convert u2f.txt to rST

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmRmHvMZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3vqqEACFEcWq3E2gRjwnz8JAEk/0
# jYuYg9jUG6Ev6xY5x31+M4DfK78eXgHYtCxhEcT6FSwpFg/ZXC+bPlZcRlM+8692
# gkp+JJeBA4VRy9e7Uk6GvRWnpGzjnkHTHf4E9PZB8iIvbJY9nFTtMZydn1w0EnMW
# HsetnNLIxrtJaETwUa5mDWh0Bt4t6ZIEB2bJSr3O0fy7uiJ8xvpRMYxqfxvI0h+0
# 7xSaG7xb5Dy4LxohMK0CLdj1wy+8uWpYgD6ZneJ2hlqjknvNWa3zdR8bRLNT0aZL
# 8ubR1ioFvfi+uA26SNVrdRrGEhqMrTxD0XstFutz0zlOjn0wjo1Ny/ojmGYWuvcU
# aG09UvcecMP8hy+ygTXJ+2D04eH1VGmS1GEwRS3p+fdODsgHy0Ctln8IPK8SuG7q
# 67BG/F4GNdkbktHGbZlwduxh30furH8pSSlIJOeTq7d20+atqZ94MWaoW1iQ+t4B
# 9gDi3MsKoUKVNEhJPorHlDxvtlQppr0ziL0IVPeYUNJONlSza88hkx34ScA5Rl7+
# 5vQYjLkhS1qZQqvd1fNSRNtHeGx2uBeE9eZF/ZCp7bA5rxcRn//LmG7hO7Octuii
# zIVaOektXeShALdJ7dMt4MZh0z1RjVVLf0ouC1HHCg9rlzvB+0I5AhXYacGkmCqW
# wf9S0hvNqdGmJRQhNRonGg==
# =ooCi
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 18 May 2023 05:49:55 AM PDT
# 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]

* tag 'pull-target-arm-20230518' of https://git.linaro.org/people/pmaydell/qemu-arm: (29 commits)
  docs: Convert u2f.txt to rST
  hw/arm/vexpress: Avoid trivial memory leak of 'flashalias'
  target/arm: Saturate L2CTLR_EL1 core count field rather than overflowing
  target/arm: Convert ERET, ERETAA, ERETAB to decodetree
  target/arm: Convert BRAA, BRAB, BLRAA, BLRAB to decodetree
  target/arm: Convert BRA[AB]Z, BLR[AB]Z, RETA[AB] to decodetree
  target/arm: Convert BR, BLR, RET to decodetree
  target/arm: Convert conditional branch insns to decodetree
  target/arm: Convert TBZ, TBNZ to decodetree
  target/arm: Convert CBZ, CBNZ to decodetree
  target/arm: Convert unconditional branch immediate to decodetree
  target/arm: Convert Extract instructions to decodetree
  target/arm: Convert Bitfield to decodetree
  target/arm: Convert Move wide (immediate) to decodetree
  target/arm: Convert Logical (immediate) to decodetree
  target/arm: Replace bitmask64 with MAKE_64BIT_MASK
  target/arm: Convert Add/subtract (immediate with tags) to decodetree
  target/arm: Convert Add/subtract (immediate) to decodetree
  target/arm: Split gen_add_CC and gen_sub_CC
  target/arm: Convert PC-rel addressing to decodetree
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed May 18, 2023
2 parents d27e7c3 + 91608e2 commit 266ccbb
Show file tree
Hide file tree
Showing 20 changed files with 973 additions and 918 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Expand Up @@ -940,6 +940,7 @@ SBSA-REF
M: Radoslaw Biernacki <rad@semihalf.com>
M: Peter Maydell <peter.maydell@linaro.org>
R: Leif Lindholm <quic_llindhol@quicinc.com>
R: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
L: qemu-arm@nongnu.org
S: Maintained
F: hw/arm/sbsa-ref.c
Expand Down
1 change: 1 addition & 0 deletions docs/system/device-emulation.rst
Expand Up @@ -93,4 +93,5 @@ Emulated Devices
devices/virtio-pmem.rst
devices/vhost-user-rng.rst
devices/canokey.rst
devices/usb-u2f.rst
devices/igb.rst
93 changes: 93 additions & 0 deletions docs/system/devices/usb-u2f.rst
@@ -0,0 +1,93 @@
Universal Second Factor (U2F) USB Key Device
============================================

U2F is an open authentication standard that enables relying parties
exposed to the internet to offer a strong second factor option for end
user authentication.

The second factor is provided by a device implementing the U2F
protocol. In case of a USB U2F security key, it is a USB HID device
that implements the U2F protocol.

QEMU supports both pass-through of a host U2F key device to a VM,
and software emulation of a U2F key.

``u2f-passthru``
----------------

The ``u2f-passthru`` device allows you to connect a real hardware
U2F key on your host to a guest VM. All requests made from the guest
are passed through to the physical security key connected to the
host machine and vice versa.

In addition, the dedicated pass-through allows you to share a single
U2F security key with several guest VMs, which is not possible with a
simple host device assignment pass-through.

You can specify the host U2F key to use with the ``hidraw``
option, which takes the host path to a Linux ``/dev/hidrawN`` device:

.. parsed-literal::
|qemu_system| -usb -device u2f-passthru,hidraw=/dev/hidraw0
If you don't specify the device, the ``u2f-passthru`` device will
autoscan to take the first U2F device it finds on the host (this
requires a working libudev):

.. parsed-literal::
|qemu_system| -usb -device u2f-passthru
``u2f-emulated``
----------------

``u2f-emulated`` is a completely software emulated U2F device.
It uses `libu2f-emu <https://github.com/MattGorko/libu2f-emu>`__
for the U2F key emulation. libu2f-emu
provides a complete implementation of the U2F protocol device part for
all specified transports given by the FIDO Alliance.

To work, an emulated U2F device must have four elements:

* ec x509 certificate
* ec private key
* counter (four bytes value)
* 48 bytes of entropy (random bits)

To use this type of device, these have to be configured, and these
four elements must be passed one way or another.

Assuming that you have a working libu2f-emu installed on the host,
there are three possible ways to configure the ``u2f-emulated`` device:

* ephemeral
* setup directory
* manual

Ephemeral is the simplest way to configure; it lets the device generate
all the elements it needs for a single use of the lifetime of the device.
It is the default if you do not pass any other options to the device.

.. parsed-literal::
|qemu_system| -usb -device u2f-emulated
You can pass the device the path of a setup directory on the host
using the ``dir`` option; the directory must contain these four files:

* ``certificate.pem``: ec x509 certificate
* ``private-key.pem``: ec private key
* ``counter``: counter value
* ``entropy``: 48 bytes of entropy

.. parsed-literal::
|qemu_system| -usb -device u2f-emulated,dir=$dir
You can also manually pass the device the paths to each of these files,
if you don't want them all to be in the same directory, using the options

* ``cert``
* ``priv``
* ``counter``
* ``entropy``

.. parsed-literal::
|qemu_system| -usb -device u2f-emulated,cert=$DIR1/$FILE1,priv=$DIR2/$FILE2,counter=$DIR3/$FILE3,entropy=$DIR4/$FILE4
2 changes: 1 addition & 1 deletion docs/system/devices/usb.rst
Expand Up @@ -207,7 +207,7 @@ option or the ``device_add`` monitor command. Available devices are:
USB audio device

``u2f-{emulated,passthru}``
Universal Second Factor device
:doc:`usb-u2f`

``canokey``
An Open-source Secure Key implementing FIDO2, OpenPGP, PIV and more.
Expand Down
110 changes: 0 additions & 110 deletions docs/u2f.txt

This file was deleted.

4 changes: 2 additions & 2 deletions hw/arm/sbsa-ref.c
Expand Up @@ -648,7 +648,7 @@ static void create_pcie(SBSAMachineState *sms)
}
}

pci_create_simple(pci->bus, -1, "VGA");
pci_create_simple(pci->bus, -1, "bochs-display");

create_smmu(sms, pci->bus);
}
Expand Down Expand Up @@ -852,7 +852,7 @@ static void sbsa_ref_class_init(ObjectClass *oc, void *data)

mc->init = sbsa_ref_init;
mc->desc = "QEMU 'SBSA Reference' ARM Virtual Machine";
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a57");
mc->default_cpu_type = ARM_CPU_TYPE_NAME("neoverse-n1");
mc->max_cpus = 512;
mc->pci_allow_0_address = true;
mc->minimum_page_bits = 12;
Expand Down
40 changes: 20 additions & 20 deletions hw/arm/vexpress.c
Expand Up @@ -173,6 +173,11 @@ struct VexpressMachineClass {

struct VexpressMachineState {
MachineState parent;
MemoryRegion vram;
MemoryRegion sram;
MemoryRegion flashalias;
MemoryRegion lowram;
MemoryRegion a15sram;
bool secure;
bool virt;
};
Expand All @@ -182,7 +187,7 @@ struct VexpressMachineState {
#define TYPE_VEXPRESS_A15_MACHINE MACHINE_TYPE_NAME("vexpress-a15")
OBJECT_DECLARE_TYPE(VexpressMachineState, VexpressMachineClass, VEXPRESS_MACHINE)

typedef void DBoardInitFn(const VexpressMachineState *machine,
typedef void DBoardInitFn(VexpressMachineState *machine,
ram_addr_t ram_size,
const char *cpu_type,
qemu_irq *pic);
Expand Down Expand Up @@ -263,14 +268,13 @@ static void init_cpus(MachineState *ms, const char *cpu_type,
}
}

static void a9_daughterboard_init(const VexpressMachineState *vms,
static void a9_daughterboard_init(VexpressMachineState *vms,
ram_addr_t ram_size,
const char *cpu_type,
qemu_irq *pic)
{
MachineState *machine = MACHINE(vms);
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *lowram = g_new(MemoryRegion, 1);
ram_addr_t low_ram_size;

if (ram_size > 0x40000000) {
Expand All @@ -287,9 +291,9 @@ static void a9_daughterboard_init(const VexpressMachineState *vms,
* address space should in theory be remappable to various
* things including ROM or RAM; we always map the RAM there.
*/
memory_region_init_alias(lowram, NULL, "vexpress.lowmem", machine->ram,
0, low_ram_size);
memory_region_add_subregion(sysmem, 0x0, lowram);
memory_region_init_alias(&vms->lowram, NULL, "vexpress.lowmem",
machine->ram, 0, low_ram_size);
memory_region_add_subregion(sysmem, 0x0, &vms->lowram);
memory_region_add_subregion(sysmem, 0x60000000, machine->ram);

/* 0x1e000000 A9MPCore (SCU) private memory region */
Expand Down Expand Up @@ -348,14 +352,13 @@ static VEDBoardInfo a9_daughterboard = {
.init = a9_daughterboard_init,
};

static void a15_daughterboard_init(const VexpressMachineState *vms,
static void a15_daughterboard_init(VexpressMachineState *vms,
ram_addr_t ram_size,
const char *cpu_type,
qemu_irq *pic)
{
MachineState *machine = MACHINE(vms);
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *sram = g_new(MemoryRegion, 1);

{
/* We have to use a separate 64 bit variable here to avoid the gcc
Expand Down Expand Up @@ -386,9 +389,9 @@ static void a15_daughterboard_init(const VexpressMachineState *vms,
/* 0x2b060000: SP805 watchdog: not modelled */
/* 0x2b0a0000: PL341 dynamic memory controller: not modelled */
/* 0x2e000000: system SRAM */
memory_region_init_ram(sram, NULL, "vexpress.a15sram", 0x10000,
memory_region_init_ram(&vms->a15sram, NULL, "vexpress.a15sram", 0x10000,
&error_fatal);
memory_region_add_subregion(sysmem, 0x2e000000, sram);
memory_region_add_subregion(sysmem, 0x2e000000, &vms->a15sram);

/* 0x7ffb0000: DMA330 DMA controller: not modelled */
/* 0x7ffd0000: PL354 static memory controller: not modelled */
Expand Down Expand Up @@ -547,10 +550,6 @@ static void vexpress_common_init(MachineState *machine)
I2CBus *i2c;
ram_addr_t vram_size, sram_size;
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *vram = g_new(MemoryRegion, 1);
MemoryRegion *sram = g_new(MemoryRegion, 1);
MemoryRegion *flashalias = g_new(MemoryRegion, 1);
MemoryRegion *flash0mem;
const hwaddr *map = daughterboard->motherboard_map;
int i;

Expand Down Expand Up @@ -662,24 +661,25 @@ static void vexpress_common_init(MachineState *machine)

if (map[VE_NORFLASHALIAS] != -1) {
/* Map flash 0 as an alias into low memory */
MemoryRegion *flash0mem;
flash0mem = sysbus_mmio_get_region(SYS_BUS_DEVICE(pflash0), 0);
memory_region_init_alias(flashalias, NULL, "vexpress.flashalias",
memory_region_init_alias(&vms->flashalias, NULL, "vexpress.flashalias",
flash0mem, 0, VEXPRESS_FLASH_SIZE);
memory_region_add_subregion(sysmem, map[VE_NORFLASHALIAS], flashalias);
memory_region_add_subregion(sysmem, map[VE_NORFLASHALIAS], &vms->flashalias);
}

dinfo = drive_get(IF_PFLASH, 0, 1);
ve_pflash_cfi01_register(map[VE_NORFLASH1], "vexpress.flash1", dinfo);

sram_size = 0x2000000;
memory_region_init_ram(sram, NULL, "vexpress.sram", sram_size,
memory_region_init_ram(&vms->sram, NULL, "vexpress.sram", sram_size,
&error_fatal);
memory_region_add_subregion(sysmem, map[VE_SRAM], sram);
memory_region_add_subregion(sysmem, map[VE_SRAM], &vms->sram);

vram_size = 0x800000;
memory_region_init_ram(vram, NULL, "vexpress.vram", vram_size,
memory_region_init_ram(&vms->vram, NULL, "vexpress.vram", vram_size,
&error_fatal);
memory_region_add_subregion(sysmem, map[VE_VIDEORAM], vram);
memory_region_add_subregion(sysmem, map[VE_VIDEORAM], &vms->vram);

/* 0x4e000000 LAN9118 Ethernet */
if (nd_table[0].used) {
Expand Down

0 comments on commit 266ccbb

Please sign in to comment.