mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'mips-20230113' of https://github.com/philmd/qemu into staging
MIPS patches queue A bunch of cleanups from various people. - Improved GT64120 on big-endian hosts - GT64120 north bridge and MC146818 RTC devices are now target independent - Bonito64 north bridge converted to 3-phase reset API - PCI refactors around PIIX devices - Support for nanoMIPS in bootloader generator API - New YAMON Malta Avocado test - Removal of 'trap and emulate' KVM support - System-specific QMP commands restricted to system emulation # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmPBekAACgkQ4+MsLN6t # wN4wjxAAtYxyt6WUBpiYfV/LnbQFpAsacues1Vhy9MPYEg5a/iuXWKvWtgRYvGww # qR0GVQH8rH7tgnCZK+ioq9jX+hvfBskP6CnKhxmb5zDGm7vP7jhhu8UFWY/EtBgq # 0zpNeLMXtnRJ6PBqo/nWFCVtcpDRZ6IkSbpGWkVkciRFc5n/2VCnlIj8k2I1oMvL # 11cp2xFQnaPReFXIpMjJHuHv1NObykdlvVg6wQo/A/4qIb8EvJQEPmePjG9Sf0i0 # v2dhnnxG9mze7+uq0dIC16x8Azko3N7dmtNlBU/aGb9OELwx35aux2M4dNDVogwn # DqL/Wsk54TFewECOfS48t/a/TqV8j/ISW1d/JvovBrN2KovmIAbtqHuMUqKVk5l0 # 23ZOIIPIYwmScZwIlkCIGUuIzFig1zhEmQcoEQaFe/B0oLB2eN/x0Bk9Yklo+i2A # WNiyiAj7k5492qEdndOySEEDVt6886F/+CdQ6QYF5Z1L/ELck7XHBH3mGDznWpPn # 6IURyVquPJx7ul62jSGI+Gc+qakNoahIhPo5O7hklOM9GwWNOWXHveyb7xjs7j+O # eWyVcet+o7hoHkCzmfbyTPySI4qCpF9fA42jqPhATwQPwmGXpbr+4BxUq3KtE43y # w9tEigwd4voN3dWLItVh6QE4in70osz3XHp93byvo8bHlS0huVY= # =oXX+ # -----END PGP SIGNATURE----- # gpg: Signature made Fri 13 Jan 2023 15:35:28 GMT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * tag 'mips-20230113' of https://github.com/philmd/qemu: (46 commits) scripts/git.orderfile: Display MAINTAINERS changes first target/mips: Restrict 'qapi-commands-machine.h' to system emulation hw/mips/boston: Rename MachineState 'mc' pointer to 'ms' hw/pci-host/bonito: Declare TYPE_BONITO_PCI_HOST_BRIDGE in header hw/pci-host/bonito: Use 'bonito_pci' for PCI function #0 code hw/pci-host/bonito: Use 'bonito_host' for PCI host bridge code hw/pci-host/bonito: Convert to 3-phase reset softmmu/rtc: Emit warning when using driftfix=slew on systems without mc146818 hw/rtc/mc146818rtc: Make the mc146818 RTC device target independent hw/core/qdev-properties-system: Allow the 'slew' policy only on x86 hw/intc: Extract the IRQ counting functions into a separate file hw/intc/i8259: Make using the isa_pic singleton more type-safe hw/usb/hcd-uhci: Introduce TYPE_ defines for device models hw/mips/Kconfig: Track Malta's PIIX dependencies via Kconfig hw/isa/piix4: Decouple INTx-to-LNKx routing which is board-specific hw/isa/piix3: Decouple INTx-to-LNKx routing which is board-specific hw/pci/pci: Factor out pci_bus_map_irqs() from pci_bus_irqs() hw/pci/pci_host: Trace config accesses on unexisting functions mips: Always include nanomips disassembler mips: Remove support for trap and emulate KVM ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+2
-1
@@ -1249,7 +1249,7 @@ S: Odd Fixes
|
||||
F: hw/isa/piix4.c
|
||||
F: hw/acpi/piix4.c
|
||||
F: hw/mips/malta.c
|
||||
F: hw/mips/gt64xxx_pci.c
|
||||
F: hw/pci-host/gt64120.c
|
||||
F: include/hw/southbridge/piix.h
|
||||
F: tests/avocado/linux_ssh_mips_malta.py
|
||||
F: tests/avocado/machine_mips_malta.py
|
||||
@@ -1270,6 +1270,7 @@ F: hw/isa/vt82c686.c
|
||||
F: hw/pci-host/bonito.c
|
||||
F: hw/usb/vt82c686-uhci-pci.c
|
||||
F: include/hw/isa/vt82c686.h
|
||||
F: include/hw/pci-host/bonito.h
|
||||
F: tests/avocado/machine_mips_fuloong2e.py
|
||||
|
||||
Loongson-3 virtual platforms
|
||||
|
||||
@@ -17,14 +17,11 @@ CONFIG_I8254=y
|
||||
CONFIG_PCSPK=y
|
||||
CONFIG_PCKBD=y
|
||||
CONFIG_FDC=y
|
||||
CONFIG_ACPI_PIIX4=y
|
||||
CONFIG_I8257=y
|
||||
CONFIG_PIIX4=y
|
||||
CONFIG_IDE_ISA=y
|
||||
CONFIG_PFLASH_CFI01=y
|
||||
CONFIG_I8259=y
|
||||
CONFIG_MC146818RTC=y
|
||||
CONFIG_EMPTY_SLOT=y
|
||||
CONFIG_MIPS_CPS=y
|
||||
CONFIG_MIPS_ITU=y
|
||||
CONFIG_MALTA=y
|
||||
|
||||
+1
-2
@@ -4,8 +4,7 @@ common_ss.add(when: 'CONFIG_HEXAGON_DIS', if_true: files('hexagon.c'))
|
||||
common_ss.add(when: 'CONFIG_HPPA_DIS', if_true: files('hppa.c'))
|
||||
common_ss.add(when: 'CONFIG_M68K_DIS', if_true: files('m68k.c'))
|
||||
common_ss.add(when: 'CONFIG_MICROBLAZE_DIS', if_true: files('microblaze.c'))
|
||||
common_ss.add(when: 'CONFIG_MIPS_DIS', if_true: files('mips.c'))
|
||||
common_ss.add(when: 'CONFIG_NANOMIPS_DIS', if_true: files('nanomips.c'))
|
||||
common_ss.add(when: 'CONFIG_MIPS_DIS', if_true: files('mips.c', 'nanomips.c'))
|
||||
common_ss.add(when: 'CONFIG_NIOS2_DIS', if_true: files('nios2.c'))
|
||||
common_ss.add(when: 'CONFIG_RISCV_DIS', if_true: files('riscv.c'))
|
||||
common_ss.add(when: 'CONFIG_SH4_DIS', if_true: files('sh4.c'))
|
||||
|
||||
@@ -171,15 +171,6 @@ accepted incorrect commands will return an error. Users should make sure that
|
||||
all arguments passed to ``device_add`` are consistent with the documented
|
||||
property types.
|
||||
|
||||
System accelerators
|
||||
-------------------
|
||||
|
||||
MIPS ``Trap-and-Emul`` KVM support (since 6.0)
|
||||
''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
The MIPS ``Trap-and-Emul`` KVM host and guest support has been removed
|
||||
from Linux upstream kernel, declare it deprecated.
|
||||
|
||||
Host Architectures
|
||||
------------------
|
||||
|
||||
|
||||
@@ -652,6 +652,15 @@ Userspace local APIC with KVM (x86, removed 8.0)
|
||||
a local APIC. The ``split`` setting is supported, as is using ``-M
|
||||
kernel-irqchip=off`` when the CPU does not have a local APIC.
|
||||
|
||||
System accelerators
|
||||
-------------------
|
||||
|
||||
MIPS "Trap-and-Emulate" KVM support (removed in 8.0)
|
||||
''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
The MIPS "Trap-and-Emulate" KVM host and guest support was removed
|
||||
from Linux in 2021, and is not supported anymore by QEMU either.
|
||||
|
||||
System emulator machines
|
||||
------------------------
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "net/net.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "hw/pci/pcie.h"
|
||||
#include "hw/i386/x86.h"
|
||||
#include "util/block-helpers.h"
|
||||
|
||||
static bool check_prop_still_unset(Object *obj, const char *name,
|
||||
@@ -558,13 +559,38 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd)
|
||||
|
||||
/* --- lost tick policy --- */
|
||||
|
||||
static void qdev_propinfo_set_losttickpolicy(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
Property *prop = opaque;
|
||||
int *ptr = object_field_prop_ptr(obj, prop);
|
||||
int value;
|
||||
|
||||
if (!visit_type_enum(v, name, &value, prop->info->enum_table, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (value == LOST_TICK_POLICY_SLEW) {
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
|
||||
if (!object_dynamic_cast(OBJECT(ms), TYPE_X86_MACHINE)) {
|
||||
error_setg(errp,
|
||||
"the 'slew' policy is only available for x86 machines");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
*ptr = value;
|
||||
}
|
||||
|
||||
QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) != sizeof(int));
|
||||
|
||||
const PropertyInfo qdev_prop_losttickpolicy = {
|
||||
.name = "LostTickPolicy",
|
||||
.enum_table = &LostTickPolicy_lookup,
|
||||
.get = qdev_propinfo_get_enum,
|
||||
.set = qdev_propinfo_set_enum,
|
||||
.set = qdev_propinfo_set_losttickpolicy,
|
||||
.set_default_value = qdev_propinfo_set_default_value_enum,
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
#include "hw/isa/i8259_internal.h"
|
||||
#include "hw/intc/i8259.h"
|
||||
#include "qemu/module.h"
|
||||
#include "hw/i386/apic_internal.h"
|
||||
#include "hw/intc/kvm_irqcount.h"
|
||||
#include "hw/irq.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "qom/object.h"
|
||||
@@ -117,7 +117,7 @@ static void kvm_pic_set_irq(void *opaque, int irq, int level)
|
||||
|
||||
pic_stat_update_irq(irq, level);
|
||||
delivered = kvm_set_irq(kvm_state, irq, level);
|
||||
apic_report_irq_delivered(delivered);
|
||||
kvm_report_irq_delivered(delivered);
|
||||
}
|
||||
|
||||
static void kvm_pic_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "hw/i386/x86.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/i386/ioapic_internal.h"
|
||||
#include "hw/i386/apic_internal.h"
|
||||
#include "hw/intc/kvm_irqcount.h"
|
||||
#include "sysemu/kvm.h"
|
||||
|
||||
/* PC Utility function */
|
||||
@@ -116,7 +116,7 @@ static void kvm_ioapic_set_irq(void *opaque, int irq, int level)
|
||||
|
||||
ioapic_stat_update_irq(common, irq, level);
|
||||
delivered = kvm_set_irq(kvm_state, s->kvm_gsi_base + irq, level);
|
||||
apic_report_irq_delivered(delivered);
|
||||
kvm_report_irq_delivered(delivered);
|
||||
}
|
||||
|
||||
static void kvm_ioapic_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
+17
-1
@@ -47,9 +47,11 @@
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/i2c/smbus_eeprom.h"
|
||||
#include "hw/xen/xen-x86.h"
|
||||
#include "hw/xen/xen.h"
|
||||
#include "exec/memory.h"
|
||||
#include "hw/acpi/acpi.h"
|
||||
#include "hw/acpi/piix4.h"
|
||||
#include "hw/usb/hcd-uhci.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/xen.h"
|
||||
@@ -73,6 +75,17 @@ static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
|
||||
static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return the global irq number corresponding to a given device irq
|
||||
* pin. We could also use the bus number to have a more precise mapping.
|
||||
*/
|
||||
static int pc_pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
|
||||
{
|
||||
int slot_addend;
|
||||
slot_addend = PCI_SLOT(pci_dev->devfn) - 1;
|
||||
return (pci_intx + slot_addend) & 3;
|
||||
}
|
||||
|
||||
/* PC hardware initialisation */
|
||||
static void pc_init1(MachineState *machine,
|
||||
const char *host_type, const char *pci_type)
|
||||
@@ -216,6 +229,9 @@ static void pc_init1(MachineState *machine,
|
||||
x86ms->below_4g_mem_size,
|
||||
x86ms->above_4g_mem_size,
|
||||
pci_memory, ram_memory);
|
||||
pci_bus_map_irqs(pci_bus,
|
||||
xen_enabled() ? xen_pci_slot_get_pirq
|
||||
: pc_pci_slot_get_pirq);
|
||||
pcms->bus = pci_bus;
|
||||
|
||||
pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type);
|
||||
@@ -290,7 +306,7 @@ static void pc_init1(MachineState *machine,
|
||||
#endif
|
||||
|
||||
if (pcmc->pci_enabled && machine_usb(machine)) {
|
||||
pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
|
||||
pci_create_simple(pci_bus, piix3_devfn + 2, TYPE_PIIX3_USB_UHCI);
|
||||
}
|
||||
|
||||
if (pcmc->pci_enabled && x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) {
|
||||
|
||||
+9
-8
@@ -48,6 +48,7 @@
|
||||
#include "hw/ide/pci.h"
|
||||
#include "hw/ide/ahci.h"
|
||||
#include "hw/usb.h"
|
||||
#include "hw/usb/hcd-uhci.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/numa.h"
|
||||
@@ -65,15 +66,15 @@ struct ehci_companions {
|
||||
};
|
||||
|
||||
static const struct ehci_companions ich9_1d[] = {
|
||||
{ .name = "ich9-usb-uhci1", .func = 0, .port = 0 },
|
||||
{ .name = "ich9-usb-uhci2", .func = 1, .port = 2 },
|
||||
{ .name = "ich9-usb-uhci3", .func = 2, .port = 4 },
|
||||
{ .name = TYPE_ICH9_USB_UHCI(1), .func = 0, .port = 0 },
|
||||
{ .name = TYPE_ICH9_USB_UHCI(2), .func = 1, .port = 2 },
|
||||
{ .name = TYPE_ICH9_USB_UHCI(3), .func = 2, .port = 4 },
|
||||
};
|
||||
|
||||
static const struct ehci_companions ich9_1a[] = {
|
||||
{ .name = "ich9-usb-uhci4", .func = 0, .port = 0 },
|
||||
{ .name = "ich9-usb-uhci5", .func = 1, .port = 2 },
|
||||
{ .name = "ich9-usb-uhci6", .func = 2, .port = 4 },
|
||||
{ .name = TYPE_ICH9_USB_UHCI(4), .func = 0, .port = 0 },
|
||||
{ .name = TYPE_ICH9_USB_UHCI(5), .func = 1, .port = 2 },
|
||||
{ .name = TYPE_ICH9_USB_UHCI(6), .func = 2, .port = 4 },
|
||||
};
|
||||
|
||||
static int ehci_create_ich9_with_companions(PCIBus *bus, int slot)
|
||||
@@ -268,8 +269,8 @@ static void pc_q35_init(MachineState *machine)
|
||||
for (i = 0; i < GSI_NUM_PINS; i++) {
|
||||
qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, x86ms->gsi[i]);
|
||||
}
|
||||
pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc_map_irq, ich9_lpc,
|
||||
ICH9_LPC_NB_PIRQS);
|
||||
pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc, ICH9_LPC_NB_PIRQS);
|
||||
pci_bus_map_irqs(host_bus, ich9_lpc_map_irq);
|
||||
pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq);
|
||||
isa_bus = ich9_lpc->isa_bus;
|
||||
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@
|
||||
#include "hw/i386/apic.h"
|
||||
#include "hw/i386/ioapic.h"
|
||||
#include "hw/intc/i8259.h"
|
||||
#include "hw/intc/kvm_irqcount.h"
|
||||
#include "hw/pci/msi.h"
|
||||
#include "qemu/host-utils.h"
|
||||
#include "sysemu/kvm.h"
|
||||
@@ -399,7 +400,7 @@ void apic_poll_irq(DeviceState *dev)
|
||||
|
||||
static void apic_set_irq(APICCommonState *s, int vector_num, int trigger_mode)
|
||||
{
|
||||
apic_report_irq_delivered(!apic_get_bit(s->irr, vector_num));
|
||||
kvm_report_irq_delivered(!apic_get_bit(s->irr, vector_num));
|
||||
|
||||
apic_set_bit(s->irr, vector_num);
|
||||
if (trigger_mode)
|
||||
|
||||
+2
-28
@@ -25,6 +25,7 @@
|
||||
#include "qapi/visitor.h"
|
||||
#include "hw/i386/apic.h"
|
||||
#include "hw/i386/apic_internal.h"
|
||||
#include "hw/intc/kvm_irqcount.h"
|
||||
#include "trace.h"
|
||||
#include "hw/boards.h"
|
||||
#include "sysemu/hax.h"
|
||||
@@ -33,7 +34,6 @@
|
||||
#include "hw/sysbus.h"
|
||||
#include "migration/vmstate.h"
|
||||
|
||||
static int apic_irq_delivered;
|
||||
bool apic_report_tpr_access;
|
||||
|
||||
void cpu_set_apic_base(DeviceState *dev, uint64_t val)
|
||||
@@ -122,32 +122,6 @@ void apic_handle_tpr_access_report(DeviceState *dev, target_ulong ip,
|
||||
vapic_report_tpr_access(s->vapic, CPU(s->cpu), ip, access);
|
||||
}
|
||||
|
||||
void apic_report_irq_delivered(int delivered)
|
||||
{
|
||||
apic_irq_delivered += delivered;
|
||||
|
||||
trace_apic_report_irq_delivered(apic_irq_delivered);
|
||||
}
|
||||
|
||||
void apic_reset_irq_delivered(void)
|
||||
{
|
||||
/* Copy this into a local variable to encourage gcc to emit a plain
|
||||
* register for a sys/sdt.h marker. For details on this workaround, see:
|
||||
* https://sourceware.org/bugzilla/show_bug.cgi?id=13296
|
||||
*/
|
||||
volatile int a_i_d = apic_irq_delivered;
|
||||
trace_apic_reset_irq_delivered(a_i_d);
|
||||
|
||||
apic_irq_delivered = 0;
|
||||
}
|
||||
|
||||
int apic_get_irq_delivered(void)
|
||||
{
|
||||
trace_apic_get_irq_delivered(apic_irq_delivered);
|
||||
|
||||
return apic_irq_delivered;
|
||||
}
|
||||
|
||||
void apic_deliver_nmi(DeviceState *dev)
|
||||
{
|
||||
APICCommonState *s = APIC_COMMON(dev);
|
||||
@@ -272,7 +246,7 @@ static void apic_reset_common(DeviceState *dev)
|
||||
s->apicbase = APIC_DEFAULT_ADDRESS | bsp | MSR_IA32_APICBASE_ENABLE;
|
||||
s->id = s->initial_apic_id;
|
||||
|
||||
apic_reset_irq_delivered();
|
||||
kvm_reset_irq_delivered();
|
||||
|
||||
s->vapic_paddr = 0;
|
||||
info->vapic_base_update(s);
|
||||
|
||||
+4
-7
@@ -55,7 +55,7 @@ struct PICClass {
|
||||
#ifdef DEBUG_IRQ_LATENCY
|
||||
static int64_t irq_time[16];
|
||||
#endif
|
||||
DeviceState *isa_pic;
|
||||
PICCommonState *isa_pic;
|
||||
static PICCommonState *slave_pic;
|
||||
|
||||
/* return the highest priority found in mask (highest = smallest
|
||||
@@ -173,9 +173,8 @@ static void pic_intack(PICCommonState *s, int irq)
|
||||
pic_update_irq(s);
|
||||
}
|
||||
|
||||
int pic_read_irq(DeviceState *d)
|
||||
int pic_read_irq(PICCommonState *s)
|
||||
{
|
||||
PICCommonState *s = PIC_COMMON(d);
|
||||
int irq, intno;
|
||||
|
||||
irq = pic_get_irq(s);
|
||||
@@ -354,10 +353,8 @@ static uint64_t pic_ioport_read(void *opaque, hwaddr addr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int pic_get_output(DeviceState *d)
|
||||
int pic_get_output(PICCommonState *s)
|
||||
{
|
||||
PICCommonState *s = PIC_COMMON(d);
|
||||
|
||||
return (pic_get_irq(s) >= 0);
|
||||
}
|
||||
|
||||
@@ -426,7 +423,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
|
||||
irq_set[i] = qdev_get_gpio_in(dev, i);
|
||||
}
|
||||
|
||||
isa_pic = dev;
|
||||
isa_pic = PIC_COMMON(dev);
|
||||
|
||||
isadev = i8259_init_chip(TYPE_I8259, bus, false);
|
||||
dev = DEVICE(isadev);
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* KVM PIC functions for counting the delivered IRQs.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/intc/kvm_irqcount.h"
|
||||
#include "trace.h"
|
||||
|
||||
static int kvm_irq_delivered;
|
||||
|
||||
void kvm_report_irq_delivered(int delivered)
|
||||
{
|
||||
kvm_irq_delivered += delivered;
|
||||
|
||||
trace_kvm_report_irq_delivered(kvm_irq_delivered);
|
||||
}
|
||||
|
||||
void kvm_reset_irq_delivered(void)
|
||||
{
|
||||
/*
|
||||
* Copy this into a local variable to encourage gcc to emit a plain
|
||||
* register for a sys/sdt.h marker. For details on this workaround, see:
|
||||
* https://sourceware.org/bugzilla/show_bug.cgi?id=13296
|
||||
*/
|
||||
volatile int k_i_d = kvm_irq_delivered;
|
||||
trace_kvm_reset_irq_delivered(k_i_d);
|
||||
|
||||
kvm_irq_delivered = 0;
|
||||
}
|
||||
|
||||
int kvm_get_irq_delivered(void)
|
||||
{
|
||||
trace_kvm_get_irq_delivered(kvm_irq_delivered);
|
||||
|
||||
return kvm_irq_delivered;
|
||||
}
|
||||
@@ -25,6 +25,12 @@ softmmu_ss.add(when: 'CONFIG_XILINX', if_true: files('xilinx_intc.c'))
|
||||
softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP', if_true: files('xlnx-zynqmp-ipi.c'))
|
||||
softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-intc.c'))
|
||||
|
||||
if config_all_devices.has_key('CONFIG_APIC') or \
|
||||
config_all_devices.has_key('CONFIG_I8259') or \
|
||||
config_all_devices.has_key('CONFIG_MC146818RTC')
|
||||
softmmu_ss.add(files('kvm_irqcount.c'))
|
||||
endif
|
||||
|
||||
specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c'))
|
||||
specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c'))
|
||||
specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c'))
|
||||
|
||||
@@ -10,10 +10,6 @@ pic_ioport_read(bool master, uint64_t addr, int val) "master %d addr 0x%"PRIx64"
|
||||
# apic_common.c
|
||||
cpu_set_apic_base(uint64_t val) "0x%016"PRIx64
|
||||
cpu_get_apic_base(uint64_t val) "0x%016"PRIx64
|
||||
# coalescing
|
||||
apic_report_irq_delivered(int apic_irq_delivered) "coalescing %d"
|
||||
apic_reset_irq_delivered(int apic_irq_delivered) "old coalescing %d"
|
||||
apic_get_irq_delivered(int apic_irq_delivered) "returning coalescing %d"
|
||||
|
||||
# apic.c
|
||||
apic_local_deliver(int vector, uint32_t lvt) "vector %d delivery mode %d"
|
||||
@@ -30,6 +26,11 @@ ioapic_mem_read(uint8_t addr, uint8_t regsel, uint8_t size, uint32_t val) "ioapi
|
||||
ioapic_mem_write(uint8_t addr, uint8_t regsel, uint8_t size, uint32_t val) "ioapic mem write addr 0x%"PRIx8" regsel: 0x%"PRIx8" size 0x%"PRIx8" val 0x%"PRIx32
|
||||
ioapic_set_irq(int vector, int level) "vector: %d level: %d"
|
||||
|
||||
# kvm_irqcount.c
|
||||
kvm_report_irq_delivered(int irq_delivered) "coalescing %d"
|
||||
kvm_reset_irq_delivered(int irq_delivered) "old coalescing %d"
|
||||
kvm_get_irq_delivered(int irq_delivered) "returning coalescing %d"
|
||||
|
||||
# slavio_intctl.c
|
||||
slavio_intctl_mem_readl(uint32_t cpu, uint64_t addr, uint32_t ret) "read cpu %d reg 0x%"PRIx64" = 0x%x"
|
||||
slavio_intctl_mem_writel(uint32_t cpu, uint64_t addr, uint32_t val) "write cpu %d reg 0x%"PRIx64" = 0x%x"
|
||||
|
||||
+2
-15
@@ -79,17 +79,6 @@ static void piix3_set_irq(void *opaque, int pirq, int level)
|
||||
piix3_set_irq_level(piix3, pirq, level);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the global irq number corresponding to a given device irq
|
||||
* pin. We could also use the bus number to have a more precise mapping.
|
||||
*/
|
||||
static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx)
|
||||
{
|
||||
int slot_addend;
|
||||
slot_addend = PCI_SLOT(pci_dev->devfn) - 1;
|
||||
return (pci_intx + slot_addend) & 3;
|
||||
}
|
||||
|
||||
static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin)
|
||||
{
|
||||
PIIX3State *piix3 = opaque;
|
||||
@@ -384,8 +373,7 @@ static void piix3_realize(PCIDevice *dev, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
pci_bus_irqs(pci_bus, piix3_set_irq, pci_slot_get_pirq,
|
||||
piix3, PIIX_NUM_PIRQS);
|
||||
pci_bus_irqs(pci_bus, piix3_set_irq, piix3, PIIX_NUM_PIRQS);
|
||||
pci_bus_set_route_irq_fn(pci_bus, piix3_route_intx_pin_to_irq);
|
||||
}
|
||||
|
||||
@@ -420,8 +408,7 @@ static void piix3_xen_realize(PCIDevice *dev, Error **errp)
|
||||
* connected to the IOAPIC directly.
|
||||
* These additional routes can be discovered through ACPI.
|
||||
*/
|
||||
pci_bus_irqs(pci_bus, xen_piix3_set_irq, xen_pci_slot_get_pirq,
|
||||
piix3, XEN_PIIX_NUM_PIRQS);
|
||||
pci_bus_irqs(pci_bus, xen_piix3_set_irq, piix3, XEN_PIIX_NUM_PIRQS);
|
||||
}
|
||||
|
||||
static void piix3_xen_class_init(ObjectClass *klass, void *data)
|
||||
|
||||
+6
-31
@@ -79,31 +79,6 @@ static void piix4_set_irq(void *opaque, int irq_num, int level)
|
||||
}
|
||||
}
|
||||
|
||||
static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
|
||||
{
|
||||
int slot;
|
||||
|
||||
slot = PCI_SLOT(pci_dev->devfn);
|
||||
|
||||
switch (slot) {
|
||||
/* PIIX4 USB */
|
||||
case 10:
|
||||
return 3;
|
||||
/* AMD 79C973 Ethernet */
|
||||
case 11:
|
||||
return 1;
|
||||
/* Crystal 4281 Sound */
|
||||
case 12:
|
||||
return 2;
|
||||
/* PCI slot 1 to 4 */
|
||||
case 18 ... 21:
|
||||
return ((slot - 18) + irq_num) & 0x03;
|
||||
/* Unknown device, don't do any translation */
|
||||
default:
|
||||
return irq_num;
|
||||
}
|
||||
}
|
||||
|
||||
static void piix4_isa_reset(DeviceState *dev)
|
||||
{
|
||||
PIIX4State *d = PIIX4_PCI_DEVICE(dev);
|
||||
@@ -116,10 +91,10 @@ static void piix4_isa_reset(DeviceState *dev)
|
||||
pci_conf[0x4c] = 0x4d;
|
||||
pci_conf[0x4e] = 0x03;
|
||||
pci_conf[0x4f] = 0x00;
|
||||
pci_conf[0x60] = 0x0a; // PCI A -> IRQ 10
|
||||
pci_conf[0x61] = 0x0a; // PCI B -> IRQ 10
|
||||
pci_conf[0x62] = 0x0b; // PCI C -> IRQ 11
|
||||
pci_conf[0x63] = 0x0b; // PCI D -> IRQ 11
|
||||
pci_conf[0x60] = 0x80;
|
||||
pci_conf[0x61] = 0x80;
|
||||
pci_conf[0x62] = 0x80;
|
||||
pci_conf[0x63] = 0x80;
|
||||
pci_conf[0x69] = 0x02;
|
||||
pci_conf[0x70] = 0x80;
|
||||
pci_conf[0x76] = 0x0c;
|
||||
@@ -271,7 +246,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp)
|
||||
}
|
||||
qdev_connect_gpio_out(DEVICE(&s->pm), 0, s->isa[9]);
|
||||
|
||||
pci_bus_irqs(pci_bus, piix4_set_irq, pci_slot_get_pirq, s, PIIX_NUM_PIRQS);
|
||||
pci_bus_irqs(pci_bus, piix4_set_irq, s, PIIX_NUM_PIRQS);
|
||||
}
|
||||
|
||||
static void piix4_init(Object *obj)
|
||||
@@ -280,7 +255,7 @@ static void piix4_init(Object *obj)
|
||||
|
||||
object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC);
|
||||
object_initialize_child(obj, "ide", &s->ide, TYPE_PIIX4_IDE);
|
||||
object_initialize_child(obj, "uhci", &s->uhci, "piix4-usb-uhci");
|
||||
object_initialize_child(obj, "uhci", &s->uhci, TYPE_PIIX4_USB_UHCI);
|
||||
|
||||
object_initialize_child(obj, "pm", &s->pm, TYPE_PIIX4_PM);
|
||||
qdev_prop_set_uint32(DEVICE(&s->pm), "smb_io_base", 0x1100);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
config MALTA
|
||||
bool
|
||||
select GT64120
|
||||
select ISA_SUPERIO
|
||||
select PIIX4
|
||||
|
||||
config MIPSSIM
|
||||
bool
|
||||
|
||||
+113
-28
@@ -54,17 +54,37 @@ static bool bootcpu_supports_isa(uint64_t isa_mask)
|
||||
return cpu_supports_isa(&MIPS_CPU(first_cpu)->env, isa_mask);
|
||||
}
|
||||
|
||||
/* Base types */
|
||||
static void bl_gen_nop(uint32_t **p)
|
||||
static void st_nm32_p(void **ptr, uint32_t insn)
|
||||
{
|
||||
stl_p(*p, 0);
|
||||
*p = *p + 1;
|
||||
uint16_t *p = *ptr;
|
||||
|
||||
stw_p(p, insn >> 16);
|
||||
p++;
|
||||
stw_p(p, insn >> 0);
|
||||
p++;
|
||||
|
||||
*ptr = p;
|
||||
}
|
||||
|
||||
static void bl_gen_r_type(uint32_t **p, uint8_t opcode,
|
||||
/* Base types */
|
||||
static void bl_gen_nop(void **ptr)
|
||||
{
|
||||
if (bootcpu_supports_isa(ISA_NANOMIPS32)) {
|
||||
st_nm32_p(ptr, 0x8000c000);
|
||||
} else {
|
||||
uint32_t *p = *ptr;
|
||||
|
||||
stl_p(p, 0);
|
||||
p++;
|
||||
*ptr = p;
|
||||
}
|
||||
}
|
||||
|
||||
static void bl_gen_r_type(void **ptr, uint8_t opcode,
|
||||
bl_reg rs, bl_reg rt, bl_reg rd,
|
||||
uint8_t shift, uint8_t funct)
|
||||
{
|
||||
uint32_t *p = *ptr;
|
||||
uint32_t insn = 0;
|
||||
|
||||
insn = deposit32(insn, 26, 6, opcode);
|
||||
@@ -74,13 +94,16 @@ static void bl_gen_r_type(uint32_t **p, uint8_t opcode,
|
||||
insn = deposit32(insn, 6, 5, shift);
|
||||
insn = deposit32(insn, 0, 6, funct);
|
||||
|
||||
stl_p(*p, insn);
|
||||
*p = *p + 1;
|
||||
stl_p(p, insn);
|
||||
p++;
|
||||
|
||||
*ptr = p;
|
||||
}
|
||||
|
||||
static void bl_gen_i_type(uint32_t **p, uint8_t opcode,
|
||||
static void bl_gen_i_type(void **ptr, uint8_t opcode,
|
||||
bl_reg rs, bl_reg rt, uint16_t imm)
|
||||
{
|
||||
uint32_t *p = *ptr;
|
||||
uint32_t insn = 0;
|
||||
|
||||
insn = deposit32(insn, 26, 6, opcode);
|
||||
@@ -88,12 +111,14 @@ static void bl_gen_i_type(uint32_t **p, uint8_t opcode,
|
||||
insn = deposit32(insn, 16, 5, rt);
|
||||
insn = deposit32(insn, 0, 16, imm);
|
||||
|
||||
stl_p(*p, insn);
|
||||
*p = *p + 1;
|
||||
stl_p(p, insn);
|
||||
p++;
|
||||
|
||||
*ptr = p;
|
||||
}
|
||||
|
||||
/* Single instructions */
|
||||
static void bl_gen_dsll(uint32_t **p, bl_reg rd, bl_reg rt, uint8_t sa)
|
||||
static void bl_gen_dsll(void **p, bl_reg rd, bl_reg rt, uint8_t sa)
|
||||
{
|
||||
if (bootcpu_supports_isa(ISA_MIPS3)) {
|
||||
bl_gen_r_type(p, 0, 0, rt, rd, sa, 0x38);
|
||||
@@ -102,28 +127,83 @@ static void bl_gen_dsll(uint32_t **p, bl_reg rd, bl_reg rt, uint8_t sa)
|
||||
}
|
||||
}
|
||||
|
||||
static void bl_gen_jalr(uint32_t **p, bl_reg rs)
|
||||
static void bl_gen_jalr(void **p, bl_reg rs)
|
||||
{
|
||||
bl_gen_r_type(p, 0, rs, 0, BL_REG_RA, 0, 0x09);
|
||||
if (bootcpu_supports_isa(ISA_NANOMIPS32)) {
|
||||
uint32_t insn = 0;
|
||||
|
||||
insn = deposit32(insn, 26, 6, 0b010010); /* JALRC */
|
||||
insn = deposit32(insn, 21, 5, BL_REG_RA);
|
||||
insn = deposit32(insn, 16, 5, rs);
|
||||
|
||||
st_nm32_p(p, insn);
|
||||
} else {
|
||||
bl_gen_r_type(p, 0, rs, 0, BL_REG_RA, 0, 0x09);
|
||||
}
|
||||
}
|
||||
|
||||
static void bl_gen_lui(uint32_t **p, bl_reg rt, uint16_t imm)
|
||||
static void bl_gen_lui_nm(void **ptr, bl_reg rt, uint32_t imm20)
|
||||
{
|
||||
uint32_t insn = 0;
|
||||
|
||||
assert(extract32(imm20, 0, 20) == imm20);
|
||||
insn = deposit32(insn, 26, 6, 0b111000);
|
||||
insn = deposit32(insn, 21, 5, rt);
|
||||
insn = deposit32(insn, 12, 9, extract32(imm20, 0, 9));
|
||||
insn = deposit32(insn, 2, 10, extract32(imm20, 9, 10));
|
||||
insn = deposit32(insn, 0, 1, sextract32(imm20, 19, 1));
|
||||
|
||||
st_nm32_p(ptr, insn);
|
||||
}
|
||||
|
||||
static void bl_gen_lui(void **p, bl_reg rt, uint16_t imm)
|
||||
{
|
||||
/* R6: It's a alias of AUI with RS = 0 */
|
||||
bl_gen_i_type(p, 0x0f, 0, rt, imm);
|
||||
}
|
||||
|
||||
static void bl_gen_ori(uint32_t **p, bl_reg rt, bl_reg rs, uint16_t imm)
|
||||
static void bl_gen_ori_nm(void **ptr, bl_reg rt, bl_reg rs, uint16_t imm12)
|
||||
{
|
||||
uint32_t insn = 0;
|
||||
|
||||
assert(extract32(imm12, 0, 12) == imm12);
|
||||
insn = deposit32(insn, 26, 6, 0b100000);
|
||||
insn = deposit32(insn, 21, 5, rt);
|
||||
insn = deposit32(insn, 16, 5, rs);
|
||||
insn = deposit32(insn, 0, 12, imm12);
|
||||
|
||||
st_nm32_p(ptr, insn);
|
||||
}
|
||||
|
||||
static void bl_gen_ori(void **p, bl_reg rt, bl_reg rs, uint16_t imm)
|
||||
{
|
||||
bl_gen_i_type(p, 0x0d, rs, rt, imm);
|
||||
}
|
||||
|
||||
static void bl_gen_sw(uint32_t **p, bl_reg rt, uint8_t base, uint16_t offset)
|
||||
static void bl_gen_sw_nm(void **ptr, bl_reg rt, uint8_t rs, uint16_t ofs12)
|
||||
{
|
||||
bl_gen_i_type(p, 0x2b, base, rt, offset);
|
||||
uint32_t insn = 0;
|
||||
|
||||
assert(extract32(ofs12, 0, 12) == ofs12);
|
||||
insn = deposit32(insn, 26, 6, 0b100001);
|
||||
insn = deposit32(insn, 21, 5, rt);
|
||||
insn = deposit32(insn, 16, 5, rs);
|
||||
insn = deposit32(insn, 12, 4, 0b1001);
|
||||
insn = deposit32(insn, 0, 12, ofs12);
|
||||
|
||||
st_nm32_p(ptr, insn);
|
||||
}
|
||||
|
||||
static void bl_gen_sd(uint32_t **p, bl_reg rt, uint8_t base, uint16_t offset)
|
||||
static void bl_gen_sw(void **p, bl_reg rt, uint8_t base, uint16_t offset)
|
||||
{
|
||||
if (bootcpu_supports_isa(ISA_NANOMIPS32)) {
|
||||
bl_gen_sw_nm(p, rt, base, offset);
|
||||
} else {
|
||||
bl_gen_i_type(p, 0x2b, base, rt, offset);
|
||||
}
|
||||
}
|
||||
|
||||
static void bl_gen_sd(void **p, bl_reg rt, uint8_t base, uint16_t offset)
|
||||
{
|
||||
if (bootcpu_supports_isa(ISA_MIPS3)) {
|
||||
bl_gen_i_type(p, 0x3f, base, rt, offset);
|
||||
@@ -133,13 +213,18 @@ static void bl_gen_sd(uint32_t **p, bl_reg rt, uint8_t base, uint16_t offset)
|
||||
}
|
||||
|
||||
/* Pseudo instructions */
|
||||
static void bl_gen_li(uint32_t **p, bl_reg rt, uint32_t imm)
|
||||
static void bl_gen_li(void **p, bl_reg rt, uint32_t imm)
|
||||
{
|
||||
bl_gen_lui(p, rt, extract32(imm, 16, 16));
|
||||
bl_gen_ori(p, rt, rt, extract32(imm, 0, 16));
|
||||
if (bootcpu_supports_isa(ISA_NANOMIPS32)) {
|
||||
bl_gen_lui_nm(p, rt, extract32(imm, 12, 20));
|
||||
bl_gen_ori_nm(p, rt, rt, extract32(imm, 0, 12));
|
||||
} else {
|
||||
bl_gen_lui(p, rt, extract32(imm, 16, 16));
|
||||
bl_gen_ori(p, rt, rt, extract32(imm, 0, 16));
|
||||
}
|
||||
}
|
||||
|
||||
static void bl_gen_dli(uint32_t **p, bl_reg rt, uint64_t imm)
|
||||
static void bl_gen_dli(void **p, bl_reg rt, uint64_t imm)
|
||||
{
|
||||
bl_gen_li(p, rt, extract64(imm, 32, 32));
|
||||
bl_gen_dsll(p, rt, rt, 16);
|
||||
@@ -148,7 +233,7 @@ static void bl_gen_dli(uint32_t **p, bl_reg rt, uint64_t imm)
|
||||
bl_gen_ori(p, rt, rt, extract64(imm, 0, 16));
|
||||
}
|
||||
|
||||
static void bl_gen_load_ulong(uint32_t **p, bl_reg rt, target_ulong imm)
|
||||
static void bl_gen_load_ulong(void **p, bl_reg rt, target_ulong imm)
|
||||
{
|
||||
if (bootcpu_supports_isa(ISA_MIPS3)) {
|
||||
bl_gen_dli(p, rt, imm); /* 64bit */
|
||||
@@ -158,14 +243,14 @@ static void bl_gen_load_ulong(uint32_t **p, bl_reg rt, target_ulong imm)
|
||||
}
|
||||
|
||||
/* Helpers */
|
||||
void bl_gen_jump_to(uint32_t **p, target_ulong jump_addr)
|
||||
void bl_gen_jump_to(void **p, target_ulong jump_addr)
|
||||
{
|
||||
bl_gen_load_ulong(p, BL_REG_T9, jump_addr);
|
||||
bl_gen_jalr(p, BL_REG_T9);
|
||||
bl_gen_nop(p); /* delay slot */
|
||||
}
|
||||
|
||||
void bl_gen_jump_kernel(uint32_t **p,
|
||||
void bl_gen_jump_kernel(void **p,
|
||||
bool set_sp, target_ulong sp,
|
||||
bool set_a0, target_ulong a0,
|
||||
bool set_a1, target_ulong a1,
|
||||
@@ -192,7 +277,7 @@ void bl_gen_jump_kernel(uint32_t **p,
|
||||
bl_gen_jump_to(p, kernel_addr);
|
||||
}
|
||||
|
||||
void bl_gen_write_ulong(uint32_t **p, target_ulong addr, target_ulong val)
|
||||
void bl_gen_write_ulong(void **p, target_ulong addr, target_ulong val)
|
||||
{
|
||||
bl_gen_load_ulong(p, BL_REG_K0, val);
|
||||
bl_gen_load_ulong(p, BL_REG_K1, addr);
|
||||
@@ -203,14 +288,14 @@ void bl_gen_write_ulong(uint32_t **p, target_ulong addr, target_ulong val)
|
||||
}
|
||||
}
|
||||
|
||||
void bl_gen_write_u32(uint32_t **p, target_ulong addr, uint32_t val)
|
||||
void bl_gen_write_u32(void **p, target_ulong addr, uint32_t val)
|
||||
{
|
||||
bl_gen_li(p, BL_REG_K0, val);
|
||||
bl_gen_load_ulong(p, BL_REG_K1, addr);
|
||||
bl_gen_sw(p, BL_REG_K0, BL_REG_K1, 0x0);
|
||||
}
|
||||
|
||||
void bl_gen_write_u64(uint32_t **p, target_ulong addr, uint64_t val)
|
||||
void bl_gen_write_u64(void **p, target_ulong addr, uint64_t val)
|
||||
{
|
||||
bl_gen_dli(p, BL_REG_K0, val);
|
||||
bl_gen_load_ulong(p, BL_REG_K1, addr);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user