mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
target-arm queue:
* hw/arm/virt: Add properties to allow more granular configuration of use of highmem space * target/arm: Add Cortex-A55 CPU * hw/intc/arm_gicv3: Fix GICD_TYPER ITLinesNumber advertisement * Implement FEAT_EVT * Some 3-phase-reset conversions for Arm GIC, SMMU * hw/arm/boot: set initrd with #address-cells type in fdt * hw/misc: Move some arm-related files from specific_ss into softmmu_ss * Restrict arm_cpu_exec_interrupt() to TCG accelerator -----BEGIN PGP SIGNATURE----- iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmObW5wZHHBldGVyLm1h eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3nWUD/4xKR9eAX9NTgASnvW3MffZ GMkCW8TVFJdJy7rNq7TvPfdBEieVwrAGUmsTpkqN41/CHIIwIfssLzq6k1iliCOa /BrqA6p/vff+gRfV0rEgy7i/VsHmWzD5TU6qR/Jm899HA1ZsHGUFHzjs5p+V9Uzz r3awYTYsYbmuUgeoCaAQhbsyLCRmSi7gVbxeEc6UZst36xZEVwG8tPTwnhZUk55E KkZkSPvGiQ+1VKeGnL2yvjGS8blZnJL55oJ7wI7yAypCxy6gudB1HGegaNPnNcxf 9lwph5sYaXbc0vyyAK3EJ+KUaJV9ZDU/ipjt3o88egYSYlB40IRVH1d+3ckZKSdG EBlD2vIx4vHjaIUXorB9U6BuktBsPtDmJ6jEsTT+cbb8roGDMB/opDZMNQB4WMIU kVEGZg7o3qkNDruAQOjakz8kOLq1J/ZKXBkLKWAsTTzdfMlnOMxAbFuFMxut7a+q JULMPjX9dBJDhsjE841QkAbYst1phDg8hCc00JB6Rbrl39jr4GZWfvaLKnci17ts nskPa/ElXvQj5WLhNZmn6vAco8mtGeDHzSNPnAoCCcDHd+hwfXkXKkweWZzzAr3f /PprDZy4hrksYqyYa9YMMQjHOlXQrJs5GntptnZwQQR2hhuQcCnBSNKxF+G6tk+K 7Q1FjpE2d8NvL8Ar+WaX8w== =YAjF -----END PGP SIGNATURE----- Merge tag 'pull-target-arm-20221215-1' of https://git.linaro.org/people/pmaydell/qemu-arm into staging target-arm queue: * hw/arm/virt: Add properties to allow more granular configuration of use of highmem space * target/arm: Add Cortex-A55 CPU * hw/intc/arm_gicv3: Fix GICD_TYPER ITLinesNumber advertisement * Implement FEAT_EVT * Some 3-phase-reset conversions for Arm GIC, SMMU * hw/arm/boot: set initrd with #address-cells type in fdt * hw/misc: Move some arm-related files from specific_ss into softmmu_ss * Restrict arm_cpu_exec_interrupt() to TCG accelerator # gpg: Signature made Thu 15 Dec 2022 17:38:36 GMT # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "peter.maydell@linaro.org" # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@gmail.com>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate] # gpg: aka "Peter Maydell <peter@archaic.org.uk>" [ultimate] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * tag 'pull-target-arm-20221215-1' of https://git.linaro.org/people/pmaydell/qemu-arm: (28 commits) target/arm: Restrict arm_cpu_exec_interrupt() to TCG accelerator hw/misc: Move some arm-related files from specific_ss into softmmu_ss hw/arm/boot: set initrd with #address-cells type in fdt hw/intc: Convert TYPE_KVM_ARM_ITS to 3-phase reset hw/intc: Convert TYPE_ARM_GICV3_ITS to 3-phase reset hw/intc: Convert TYPE_ARM_GICV3_ITS_COMMON to 3-phase reset hw/intc: Convert TYPE_KVM_ARM_GICV3 to 3-phase reset hw/intc: Convert TYPE_ARM_GICV3_COMMON to 3-phase reset hw/intc: Convert TYPE_ARM_GIC_KVM to 3-phase reset hw/intc: Convert TYPE_ARM_GIC_COMMON to 3-phase reset hw/arm: Convert TYPE_ARM_SMMUV3 to 3-phase reset hw/arm: Convert TYPE_ARM_SMMU to 3-phase reset target/arm: Report FEAT_EVT for TCG '-cpu max' target/arm: Implement HCR_EL2.TID4 traps target/arm: Implement HCR_EL2.TICAB,TOCU traps target/arm: Implement HCR_EL2.TTLBOS traps target/arm: Implement HCR_EL2.TTLBIS traps target/arm: Allow relevant HCR bits to be written for FEAT_EVT hw/intc/arm_gicv3: Fix GICD_TYPER ITLinesNumber advertisement target/arm: Add Cortex-A55 CPU ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
29dc49f031
26 changed files with 459 additions and 141 deletions
202
hw/arm/virt.c
202
hw/arm/virt.c
|
@ -174,6 +174,12 @@ static const MemMapEntry base_memmap[] = {
|
|||
* Note the extended_memmap is sized so that it eventually also includes the
|
||||
* base_memmap entries (VIRT_HIGH_GIC_REDIST2 index is greater than the last
|
||||
* index of base_memmap).
|
||||
*
|
||||
* The memory map for these Highmem IO Regions can be in legacy or compact
|
||||
* layout, depending on 'compact-highmem' property. With legacy layout, the
|
||||
* PA space for one specific region is always reserved, even if the region
|
||||
* has been disabled or doesn't fit into the PA space. However, the PA space
|
||||
* for the region won't be reserved in these circumstances with compact layout.
|
||||
*/
|
||||
static MemMapEntry extended_memmap[] = {
|
||||
/* Additional 64 MB redist region (can contain up to 512 redistributors) */
|
||||
|
@ -201,6 +207,7 @@ static const char *valid_cpus[] = {
|
|||
ARM_CPU_TYPE_NAME("cortex-a15"),
|
||||
ARM_CPU_TYPE_NAME("cortex-a35"),
|
||||
ARM_CPU_TYPE_NAME("cortex-a53"),
|
||||
ARM_CPU_TYPE_NAME("cortex-a55"),
|
||||
ARM_CPU_TYPE_NAME("cortex-a57"),
|
||||
ARM_CPU_TYPE_NAME("cortex-a72"),
|
||||
ARM_CPU_TYPE_NAME("cortex-a76"),
|
||||
|
@ -1608,9 +1615,11 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
|
|||
static void virt_build_smbios(VirtMachineState *vms)
|
||||
{
|
||||
MachineClass *mc = MACHINE_GET_CLASS(vms);
|
||||
MachineState *ms = MACHINE(vms);
|
||||
VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
|
||||
uint8_t *smbios_tables, *smbios_anchor;
|
||||
size_t smbios_tables_len, smbios_anchor_len;
|
||||
struct smbios_phys_mem_area mem_array;
|
||||
const char *product = "QEMU Virtual Machine";
|
||||
|
||||
if (kvm_enabled()) {
|
||||
|
@ -1621,7 +1630,11 @@ static void virt_build_smbios(VirtMachineState *vms)
|
|||
vmc->smbios_old_sys_ver ? "1.0" : mc->name, false,
|
||||
true, SMBIOS_ENTRY_POINT_TYPE_64);
|
||||
|
||||
smbios_get_tables(MACHINE(vms), NULL, 0,
|
||||
/* build the array of physical mem area from base_memmap */
|
||||
mem_array.address = vms->memmap[VIRT_MEM].base;
|
||||
mem_array.length = ms->ram_size;
|
||||
|
||||
smbios_get_tables(ms, &mem_array, 1,
|
||||
&smbios_tables, &smbios_tables_len,
|
||||
&smbios_anchor, &smbios_anchor_len,
|
||||
&error_fatal);
|
||||
|
@ -1690,6 +1703,58 @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx)
|
|||
return arm_cpu_mp_affinity(idx, clustersz);
|
||||
}
|
||||
|
||||
static inline bool *virt_get_high_memmap_enabled(VirtMachineState *vms,
|
||||
int index)
|
||||
{
|
||||
bool *enabled_array[] = {
|
||||
&vms->highmem_redists,
|
||||
&vms->highmem_ecam,
|
||||
&vms->highmem_mmio,
|
||||
};
|
||||
|
||||
assert(ARRAY_SIZE(extended_memmap) - VIRT_LOWMEMMAP_LAST ==
|
||||
ARRAY_SIZE(enabled_array));
|
||||
assert(index - VIRT_LOWMEMMAP_LAST < ARRAY_SIZE(enabled_array));
|
||||
|
||||
return enabled_array[index - VIRT_LOWMEMMAP_LAST];
|
||||
}
|
||||
|
||||
static void virt_set_high_memmap(VirtMachineState *vms,
|
||||
hwaddr base, int pa_bits)
|
||||
{
|
||||
hwaddr region_base, region_size;
|
||||
bool *region_enabled, fits;
|
||||
int i;
|
||||
|
||||
for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) {
|
||||
region_enabled = virt_get_high_memmap_enabled(vms, i);
|
||||
region_base = ROUND_UP(base, extended_memmap[i].size);
|
||||
region_size = extended_memmap[i].size;
|
||||
|
||||
vms->memmap[i].base = region_base;
|
||||
vms->memmap[i].size = region_size;
|
||||
|
||||
/*
|
||||
* Check each device to see if it fits in the PA space,
|
||||
* moving highest_gpa as we go. For compatibility, move
|
||||
* highest_gpa for disabled fitting devices as well, if
|
||||
* the compact layout has been disabled.
|
||||
*
|
||||
* For each device that doesn't fit, disable it.
|
||||
*/
|
||||
fits = (region_base + region_size) <= BIT_ULL(pa_bits);
|
||||
*region_enabled &= fits;
|
||||
if (vms->highmem_compact && !*region_enabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
base = region_base + region_size;
|
||||
if (fits) {
|
||||
vms->highest_gpa = base - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void virt_set_memmap(VirtMachineState *vms, int pa_bits)
|
||||
{
|
||||
MachineState *ms = MACHINE(vms);
|
||||
|
@ -1745,39 +1810,7 @@ static void virt_set_memmap(VirtMachineState *vms, int pa_bits)
|
|||
/* We know for sure that at least the memory fits in the PA space */
|
||||
vms->highest_gpa = memtop - 1;
|
||||
|
||||
for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) {
|
||||
hwaddr size = extended_memmap[i].size;
|
||||
bool fits;
|
||||
|
||||
base = ROUND_UP(base, size);
|
||||
vms->memmap[i].base = base;
|
||||
vms->memmap[i].size = size;
|
||||
|
||||
/*
|
||||
* Check each device to see if they fit in the PA space,
|
||||
* moving highest_gpa as we go.
|
||||
*
|
||||
* For each device that doesn't fit, disable it.
|
||||
*/
|
||||
fits = (base + size) <= BIT_ULL(pa_bits);
|
||||
if (fits) {
|
||||
vms->highest_gpa = base + size - 1;
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case VIRT_HIGH_GIC_REDIST2:
|
||||
vms->highmem_redists &= fits;
|
||||
break;
|
||||
case VIRT_HIGH_PCIE_ECAM:
|
||||
vms->highmem_ecam &= fits;
|
||||
break;
|
||||
case VIRT_HIGH_PCIE_MMIO:
|
||||
vms->highmem_mmio &= fits;
|
||||
break;
|
||||
}
|
||||
|
||||
base += size;
|
||||
}
|
||||
virt_set_high_memmap(vms, base, pa_bits);
|
||||
|
||||
if (device_memory_size > 0) {
|
||||
ms->device_memory = g_malloc0(sizeof(*ms->device_memory));
|
||||
|
@ -2070,14 +2103,20 @@ static void machvirt_init(MachineState *machine)
|
|||
if (vms->gic_version == VIRT_GIC_VERSION_2) {
|
||||
virt_max_cpus = GIC_NCPU;
|
||||
} else {
|
||||
virt_max_cpus = virt_redist_capacity(vms, VIRT_GIC_REDIST) +
|
||||
virt_redist_capacity(vms, VIRT_HIGH_GIC_REDIST2);
|
||||
virt_max_cpus = virt_redist_capacity(vms, VIRT_GIC_REDIST);
|
||||
if (vms->highmem_redists) {
|
||||
virt_max_cpus += virt_redist_capacity(vms, VIRT_HIGH_GIC_REDIST2);
|
||||
}
|
||||
}
|
||||
|
||||
if (max_cpus > virt_max_cpus) {
|
||||
error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
|
||||
"supported by machine 'mach-virt' (%d)",
|
||||
max_cpus, virt_max_cpus);
|
||||
if (vms->gic_version != VIRT_GIC_VERSION_2 && !vms->highmem_redists) {
|
||||
error_printf("Try 'highmem-redists=on' for more CPUs\n");
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -2332,6 +2371,63 @@ static void virt_set_highmem(Object *obj, bool value, Error **errp)
|
|||
vms->highmem = value;
|
||||
}
|
||||
|
||||
static bool virt_get_compact_highmem(Object *obj, Error **errp)
|
||||
{
|
||||
VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
|
||||
return vms->highmem_compact;
|
||||
}
|
||||
|
||||
static void virt_set_compact_highmem(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
|
||||
vms->highmem_compact = value;
|
||||
}
|
||||
|
||||
static bool virt_get_highmem_redists(Object *obj, Error **errp)
|
||||
{
|
||||
VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
|
||||
return vms->highmem_redists;
|
||||
}
|
||||
|
||||
static void virt_set_highmem_redists(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
|
||||
vms->highmem_redists = value;
|
||||
}
|
||||
|
||||
static bool virt_get_highmem_ecam(Object *obj, Error **errp)
|
||||
{
|
||||
VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
|
||||
return vms->highmem_ecam;
|
||||
}
|
||||
|
||||
static void virt_set_highmem_ecam(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
|
||||
vms->highmem_ecam = value;
|
||||
}
|
||||
|
||||
static bool virt_get_highmem_mmio(Object *obj, Error **errp)
|
||||
{
|
||||
VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
|
||||
return vms->highmem_mmio;
|
||||
}
|
||||
|
||||
static void virt_set_highmem_mmio(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
|
||||
vms->highmem_mmio = value;
|
||||
}
|
||||
|
||||
|
||||
static bool virt_get_its(Object *obj, Error **errp)
|
||||
{
|
||||
VirtMachineState *vms = VIRT_MACHINE(obj);
|
||||
|
@ -2946,6 +3042,35 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
|
|||
"Set on/off to enable/disable using "
|
||||
"physical address space above 32 bits");
|
||||
|
||||
object_class_property_add_bool(oc, "compact-highmem",
|
||||
virt_get_compact_highmem,
|
||||
virt_set_compact_highmem);
|
||||
object_class_property_set_description(oc, "compact-highmem",
|
||||
"Set on/off to enable/disable compact "
|
||||
"layout for high memory regions");
|
||||
|
||||
object_class_property_add_bool(oc, "highmem-redists",
|
||||
virt_get_highmem_redists,
|
||||
virt_set_highmem_redists);
|
||||
object_class_property_set_description(oc, "highmem-redists",
|
||||
"Set on/off to enable/disable high "
|
||||
"memory region for GICv3 or GICv4 "
|
||||
"redistributor");
|
||||
|
||||
object_class_property_add_bool(oc, "highmem-ecam",
|
||||
virt_get_highmem_ecam,
|
||||
virt_set_highmem_ecam);
|
||||
object_class_property_set_description(oc, "highmem-ecam",
|
||||
"Set on/off to enable/disable high "
|
||||
"memory region for PCI ECAM");
|
||||
|
||||
object_class_property_add_bool(oc, "highmem-mmio",
|
||||
virt_get_highmem_mmio,
|
||||
virt_set_highmem_mmio);
|
||||
object_class_property_set_description(oc, "highmem-mmio",
|
||||
"Set on/off to enable/disable high "
|
||||
"memory region for PCI MMIO");
|
||||
|
||||
object_class_property_add_str(oc, "gic-version", virt_get_gic_version,
|
||||
virt_set_gic_version);
|
||||
object_class_property_set_description(oc, "gic-version",
|
||||
|
@ -3030,6 +3155,7 @@ static void virt_instance_init(Object *obj)
|
|||
|
||||
/* High memory is enabled by default */
|
||||
vms->highmem = true;
|
||||
vms->highmem_compact = !vmc->no_highmem_compact;
|
||||
vms->gic_version = VIRT_GIC_VERSION_NOSEL;
|
||||
|
||||
vms->highmem_ecam = !vmc->no_highmem_ecam;
|
||||
|
@ -3099,8 +3225,12 @@ DEFINE_VIRT_MACHINE_AS_LATEST(7, 2)
|
|||
|
||||
static void virt_machine_7_1_options(MachineClass *mc)
|
||||
{
|
||||
VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
|
||||
|
||||
virt_machine_7_2_options(mc);
|
||||
compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len);
|
||||
/* Compact layout for high memory regions was introduced with 7.2 */
|
||||
vmc->no_highmem_compact = true;
|
||||
}
|
||||
DEFINE_VIRT_MACHINE(7, 1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue