mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 18:44:58 -06:00
pci,pc,virtio: features, tests, fixes, cleanups
lots of acpi rework first version of biosbits infrastructure ASID support in vhost-vdpa core_count2 support in smbios PCIe DOE emulation virtio vq reset HMAT support part of infrastructure for viommu support in vhost-vdpa VTD PASID support fixes, tests all over the place Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmNpXDkPHG1zdEByZWRo YXQuY29tAAoJECgfDbjSjVRpD0AH/2G8ZPrgrxJC9y3uD5/5J6QRzO+TsDYbg5ut uBf4rKSHHzcu6zdyAfsrhbAKKzyD4HrEGNXZrBjnKM1xCiB/SGBcDIWntwrca2+s 5Dpbi4xvd4tg6tVD4b47XNDCcn2uUbeI0e2M5QIbtCmzdi/xKbFAfl5G8DQp431X Kmz79G4CdKWyjVlM0HoYmdCw/4FxkdjD02tE/Uc5YMrePNaEg5Bw4hjCHbx1b6ur 6gjeXAtncm9s4sO0l+sIdyiqlxiTry9FSr35WaQ0qPU+Og5zaf1EiWfdl8TRo4qU EAATw5A4hyw11GfOGp7oOVkTGvcNB/H7aIxD7emdWZV8+BMRPKo= =zTCn -----END PGP SIGNATURE----- Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging pci,pc,virtio: features, tests, fixes, cleanups lots of acpi rework first version of biosbits infrastructure ASID support in vhost-vdpa core_count2 support in smbios PCIe DOE emulation virtio vq reset HMAT support part of infrastructure for viommu support in vhost-vdpa VTD PASID support fixes, tests all over the place Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # -----BEGIN PGP SIGNATURE----- # # iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmNpXDkPHG1zdEByZWRo # YXQuY29tAAoJECgfDbjSjVRpD0AH/2G8ZPrgrxJC9y3uD5/5J6QRzO+TsDYbg5ut # uBf4rKSHHzcu6zdyAfsrhbAKKzyD4HrEGNXZrBjnKM1xCiB/SGBcDIWntwrca2+s # 5Dpbi4xvd4tg6tVD4b47XNDCcn2uUbeI0e2M5QIbtCmzdi/xKbFAfl5G8DQp431X # Kmz79G4CdKWyjVlM0HoYmdCw/4FxkdjD02tE/Uc5YMrePNaEg5Bw4hjCHbx1b6ur # 6gjeXAtncm9s4sO0l+sIdyiqlxiTry9FSr35WaQ0qPU+Og5zaf1EiWfdl8TRo4qU # EAATw5A4hyw11GfOGp7oOVkTGvcNB/H7aIxD7emdWZV8+BMRPKo= # =zTCn # -----END PGP SIGNATURE----- # gpg: Signature made Mon 07 Nov 2022 14:27:53 EST # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu: (83 commits) checkpatch: better pattern for inline comments hw/virtio: introduce virtio_device_should_start tests/acpi: update tables for new core count test bios-tables-test: add test for number of cores > 255 tests/acpi: allow changes for core_count2 test bios-tables-test: teach test to use smbios 3.0 tables hw/smbios: add core_count2 to smbios table type 4 vhost-user: Support vhost_dev_start vhost: Change the sequence of device start intel-iommu: PASID support intel-iommu: convert VTD_PE_GET_FPD_ERR() to be a function intel-iommu: drop VTDBus intel-iommu: don't warn guest errors when getting rid2pasid entry vfio: move implement of vfio_get_xlat_addr() to memory.c tests: virt: Update expected *.acpihmatvirt tables tests: acpi: aarch64/virt: add a test for hmat nodes with no initiators hw/arm/virt: Enable HMAT on arm virt machine tests: Add HMAT AArch64/virt empty table files tests: acpi: q35: update expected blobs *.hmat-noinitiators expected HMAT: tests: acpi: q35: add test for hmat nodes without initiators ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
commit
f21f1cfeb9
155 changed files with 7996 additions and 1020 deletions
|
@ -60,6 +60,7 @@
|
|||
#include "hw/i386/fw_cfg.h"
|
||||
#include "hw/i386/ich9.h"
|
||||
#include "hw/pci/pci_bus.h"
|
||||
#include "hw/pci-host/i440fx.h"
|
||||
#include "hw/pci-host/q35.h"
|
||||
#include "hw/i386/x86-iommu.h"
|
||||
|
||||
|
@ -112,7 +113,6 @@ typedef struct AcpiPmInfo {
|
|||
} AcpiPmInfo;
|
||||
|
||||
typedef struct AcpiMiscInfo {
|
||||
bool is_piix4;
|
||||
bool has_hpet;
|
||||
#ifdef CONFIG_TPM
|
||||
TPMVersion tpm_version;
|
||||
|
@ -121,13 +121,6 @@ typedef struct AcpiMiscInfo {
|
|||
unsigned dsdt_size;
|
||||
} AcpiMiscInfo;
|
||||
|
||||
typedef struct AcpiBuildPciBusHotplugState {
|
||||
GArray *device_table;
|
||||
GArray *notify_table;
|
||||
struct AcpiBuildPciBusHotplugState *parent;
|
||||
bool pcihp_bridge_en;
|
||||
} AcpiBuildPciBusHotplugState;
|
||||
|
||||
typedef struct FwCfgTPMConfig {
|
||||
uint32_t tpmppi_address;
|
||||
uint8_t tpm_version;
|
||||
|
@ -288,17 +281,6 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm)
|
|||
|
||||
static void acpi_get_misc_info(AcpiMiscInfo *info)
|
||||
{
|
||||
Object *piix = object_resolve_type_unambiguous(TYPE_PIIX4_PM);
|
||||
Object *lpc = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE);
|
||||
assert(!!piix != !!lpc);
|
||||
|
||||
if (piix) {
|
||||
info->is_piix4 = true;
|
||||
}
|
||||
if (lpc) {
|
||||
info->is_piix4 = false;
|
||||
}
|
||||
|
||||
info->has_hpet = hpet_find();
|
||||
#ifdef CONFIG_TPM
|
||||
info->tpm_version = tpm_get_version(tpm_find());
|
||||
|
@ -430,18 +412,11 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
|
|||
bool hotpluggbale_slot = false;
|
||||
bool bridge_in_acpi = false;
|
||||
bool cold_plugged_bridge = false;
|
||||
bool is_vga = false;
|
||||
|
||||
if (pdev) {
|
||||
pc = PCI_DEVICE_GET_CLASS(pdev);
|
||||
dc = DEVICE_GET_CLASS(pdev);
|
||||
|
||||
if (pc->class_id == PCI_CLASS_BRIDGE_ISA) {
|
||||
continue;
|
||||
}
|
||||
|
||||
is_vga = pc->class_id == PCI_CLASS_DISPLAY_VGA;
|
||||
|
||||
/*
|
||||
* Cold plugged bridges aren't themselves hot-pluggable.
|
||||
* Hotplugged bridges *are* hot-pluggable.
|
||||
|
@ -455,9 +430,10 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
|
|||
/*
|
||||
* allow describing coldplugged bridges in ACPI even if they are not
|
||||
* on function 0, as they are not unpluggable, for all other devices
|
||||
* generate description only for function 0 per slot
|
||||
* generate description only for function 0 per slot, and for other
|
||||
* functions if device on function provides its own AML
|
||||
*/
|
||||
if (func && !bridge_in_acpi) {
|
||||
if (func && !bridge_in_acpi && !get_dev_aml_func(DEVICE(pdev))) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
|
@ -489,28 +465,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
|
|||
aml_append(dev, aml_pci_device_dsm());
|
||||
}
|
||||
|
||||
if (is_vga) {
|
||||
/* add VGA specific AML methods */
|
||||
int s3d;
|
||||
|
||||
if (object_dynamic_cast(OBJECT(pdev), "qxl-vga")) {
|
||||
s3d = 3;
|
||||
} else {
|
||||
s3d = 0;
|
||||
}
|
||||
|
||||
method = aml_method("_S1D", 0, AML_NOTSERIALIZED);
|
||||
aml_append(method, aml_return(aml_int(0)));
|
||||
aml_append(dev, method);
|
||||
|
||||
method = aml_method("_S2D", 0, AML_NOTSERIALIZED);
|
||||
aml_append(method, aml_return(aml_int(0)));
|
||||
aml_append(dev, method);
|
||||
|
||||
method = aml_method("_S3D", 0, AML_NOTSERIALIZED);
|
||||
aml_append(method, aml_return(aml_int(s3d)));
|
||||
aml_append(dev, method);
|
||||
}
|
||||
call_dev_aml_func(DEVICE(pdev), dev);
|
||||
|
||||
bridge_in_acpi = cold_plugged_bridge && pcihp_bridge_en;
|
||||
if (bridge_in_acpi) {
|
||||
|
@ -1030,7 +985,6 @@ static void build_piix4_pci0_int(Aml *table)
|
|||
{
|
||||
Aml *dev;
|
||||
Aml *crs;
|
||||
Aml *field;
|
||||
Aml *method;
|
||||
uint32_t irqs;
|
||||
Aml *sb_scope = aml_scope("_SB");
|
||||
|
@ -1039,13 +993,6 @@ static void build_piix4_pci0_int(Aml *table)
|
|||
aml_append(pci0_scope, build_prt(true));
|
||||
aml_append(sb_scope, pci0_scope);
|
||||
|
||||
field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
|
||||
aml_append(field, aml_named_field("PRQ0", 8));
|
||||
aml_append(field, aml_named_field("PRQ1", 8));
|
||||
aml_append(field, aml_named_field("PRQ2", 8));
|
||||
aml_append(field, aml_named_field("PRQ3", 8));
|
||||
aml_append(sb_scope, field);
|
||||
|
||||
aml_append(sb_scope, build_irq_status_method());
|
||||
aml_append(sb_scope, build_iqcr_method(true));
|
||||
|
||||
|
@ -1149,7 +1096,6 @@ static Aml *build_q35_routing_table(const char *str)
|
|||
|
||||
static void build_q35_pci0_int(Aml *table)
|
||||
{
|
||||
Aml *field;
|
||||
Aml *method;
|
||||
Aml *sb_scope = aml_scope("_SB");
|
||||
Aml *pci0_scope = aml_scope("PCI0");
|
||||
|
@ -1186,18 +1132,6 @@ static void build_q35_pci0_int(Aml *table)
|
|||
aml_append(pci0_scope, method);
|
||||
aml_append(sb_scope, pci0_scope);
|
||||
|
||||
field = aml_field("PCI0.ISA.PIRQ", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
|
||||
aml_append(field, aml_named_field("PRQA", 8));
|
||||
aml_append(field, aml_named_field("PRQB", 8));
|
||||
aml_append(field, aml_named_field("PRQC", 8));
|
||||
aml_append(field, aml_named_field("PRQD", 8));
|
||||
aml_append(field, aml_reserved_field(0x20));
|
||||
aml_append(field, aml_named_field("PRQE", 8));
|
||||
aml_append(field, aml_named_field("PRQF", 8));
|
||||
aml_append(field, aml_named_field("PRQG", 8));
|
||||
aml_append(field, aml_named_field("PRQH", 8));
|
||||
aml_append(sb_scope, field);
|
||||
|
||||
aml_append(sb_scope, build_irq_status_method());
|
||||
aml_append(sb_scope, build_iqcr_method(false));
|
||||
|
||||
|
@ -1262,54 +1196,6 @@ static Aml *build_q35_dram_controller(const AcpiMcfgInfo *mcfg)
|
|||
return dev;
|
||||
}
|
||||
|
||||
static void build_q35_isa_bridge(Aml *table)
|
||||
{
|
||||
Aml *dev;
|
||||
Aml *scope;
|
||||
Object *obj;
|
||||
bool ambiguous;
|
||||
|
||||
/*
|
||||
* temporarily fish out isa bridge, build_q35_isa_bridge() will be dropped
|
||||
* once PCI is converted to AcpiDevAmlIf and would be ble to generate
|
||||
* AML for bridge itself
|
||||
*/
|
||||
obj = object_resolve_path_type("", TYPE_ICH9_LPC_DEVICE, &ambiguous);
|
||||
assert(obj && !ambiguous);
|
||||
|
||||
scope = aml_scope("_SB.PCI0");
|
||||
dev = aml_device("ISA");
|
||||
aml_append(dev, aml_name_decl("_ADR", aml_int(0x001F0000)));
|
||||
|
||||
call_dev_aml_func(DEVICE(obj), dev);
|
||||
aml_append(scope, dev);
|
||||
aml_append(table, scope);
|
||||
}
|
||||
|
||||
static void build_piix4_isa_bridge(Aml *table)
|
||||
{
|
||||
Aml *dev;
|
||||
Aml *scope;
|
||||
Object *obj;
|
||||
bool ambiguous;
|
||||
|
||||
/*
|
||||
* temporarily fish out isa bridge, build_piix4_isa_bridge() will be dropped
|
||||
* once PCI is converted to AcpiDevAmlIf and would be ble to generate
|
||||
* AML for bridge itself
|
||||
*/
|
||||
obj = object_resolve_path_type("", TYPE_PIIX3_PCI_DEVICE, &ambiguous);
|
||||
assert(obj && !ambiguous);
|
||||
|
||||
scope = aml_scope("_SB.PCI0");
|
||||
dev = aml_device("ISA");
|
||||
aml_append(dev, aml_name_decl("_ADR", aml_int(0x00010000)));
|
||||
|
||||
call_dev_aml_func(DEVICE(obj), dev);
|
||||
aml_append(scope, dev);
|
||||
aml_append(table, scope);
|
||||
}
|
||||
|
||||
static void build_x86_acpi_pci_hotplug(Aml *table, uint64_t pcihp_addr)
|
||||
{
|
||||
Aml *scope;
|
||||
|
@ -1416,25 +1302,6 @@ static Aml *build_q35_osc_method(bool enable_native_pcie_hotplug)
|
|||
return method;
|
||||
}
|
||||
|
||||
static void build_smb0(Aml *table, int devnr, int func)
|
||||
{
|
||||
Aml *scope = aml_scope("_SB.PCI0");
|
||||
Aml *dev = aml_device("SMB0");
|
||||
bool ambiguous;
|
||||
Object *obj;
|
||||
/*
|
||||
* temporarily fish out device hosting SMBUS, build_smb0 will be gone once
|
||||
* PCI enumeration will be switched to call_dev_aml_func()
|
||||
*/
|
||||
obj = object_resolve_path_type("", TYPE_ICH9_SMB_DEVICE, &ambiguous);
|
||||
assert(obj && !ambiguous);
|
||||
|
||||
aml_append(dev, aml_name_decl("_ADR", aml_int(devnr << 16 | func)));
|
||||
call_dev_aml_func(DEVICE(obj), dev);
|
||||
aml_append(scope, dev);
|
||||
aml_append(table, scope);
|
||||
}
|
||||
|
||||
static void build_acpi0017(Aml *table)
|
||||
{
|
||||
Aml *dev, *scope, *method;
|
||||
|
@ -1456,6 +1323,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||
AcpiPmInfo *pm, AcpiMiscInfo *misc,
|
||||
Range *pci_hole, Range *pci_hole64, MachineState *machine)
|
||||
{
|
||||
Object *i440fx = object_resolve_type_unambiguous(TYPE_I440FX_PCI_HOST_BRIDGE);
|
||||
Object *q35 = object_resolve_type_unambiguous(TYPE_Q35_HOST_DEVICE);
|
||||
CrsRangeEntry *entry;
|
||||
Aml *dsdt, *sb_scope, *scope, *dev, *method, *field, *pkg, *crs;
|
||||
CrsRangeSet crs_range_set;
|
||||
|
@ -1476,11 +1345,13 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||
AcpiTable table = { .sig = "DSDT", .rev = 1, .oem_id = x86ms->oem_id,
|
||||
.oem_table_id = x86ms->oem_table_id };
|
||||
|
||||
assert(!!i440fx != !!q35);
|
||||
|
||||
acpi_table_begin(&table, table_data);
|
||||
dsdt = init_aml_allocator();
|
||||
|
||||
build_dbg_aml(dsdt);
|
||||
if (misc->is_piix4) {
|
||||
if (i440fx) {
|
||||
sb_scope = aml_scope("_SB");
|
||||
dev = aml_device("PCI0");
|
||||
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
|
||||
|
@ -1489,12 +1360,11 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||
aml_append(sb_scope, dev);
|
||||
aml_append(dsdt, sb_scope);
|
||||
|
||||
build_piix4_isa_bridge(dsdt);
|
||||
if (pm->pcihp_bridge_en || pm->pcihp_root_en) {
|
||||
build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
|
||||
}
|
||||
build_piix4_pci0_int(dsdt);
|
||||
} else {
|
||||
} else if (q35) {
|
||||
sb_scope = aml_scope("_SB");
|
||||
dev = aml_device("PCI0");
|
||||
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
|
||||
|
@ -1534,14 +1404,10 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||
|
||||
aml_append(dsdt, sb_scope);
|
||||
|
||||
build_q35_isa_bridge(dsdt);
|
||||
if (pm->pcihp_bridge_en) {
|
||||
build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
|
||||
}
|
||||
build_q35_pci0_int(dsdt);
|
||||
if (pcms->smbus) {
|
||||
build_smb0(dsdt, ICH9_SMB_DEV, ICH9_SMB_FUNC);
|
||||
}
|
||||
}
|
||||
|
||||
if (misc->has_hpet) {
|
||||
|
@ -1554,6 +1420,18 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||
aml_append(dsdt, sb_scope);
|
||||
}
|
||||
|
||||
scope = aml_scope("_GPE");
|
||||
{
|
||||
aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006")));
|
||||
if (machine->nvdimms_state->is_enabled) {
|
||||
method = aml_method("_E04", 0, AML_NOTSERIALIZED);
|
||||
aml_append(method, aml_notify(aml_name("\\_SB.NVDR"),
|
||||
aml_int(0x80)));
|
||||
aml_append(scope, method);
|
||||
}
|
||||
}
|
||||
aml_append(dsdt, scope);
|
||||
|
||||
if (pcmc->legacy_cpu_hotplug) {
|
||||
build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base);
|
||||
} else {
|
||||
|
@ -1572,28 +1450,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||
pcms->memhp_io_base);
|
||||
}
|
||||
|
||||
scope = aml_scope("_GPE");
|
||||
{
|
||||
aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006")));
|
||||
|
||||
if (pm->pcihp_bridge_en || pm->pcihp_root_en) {
|
||||
method = aml_method("_E01", 0, AML_NOTSERIALIZED);
|
||||
aml_append(method,
|
||||
aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF));
|
||||
aml_append(method, aml_call0("\\_SB.PCI0.PCNT"));
|
||||
aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK")));
|
||||
aml_append(scope, method);
|
||||
}
|
||||
|
||||
if (machine->nvdimms_state->is_enabled) {
|
||||
method = aml_method("_E04", 0, AML_NOTSERIALIZED);
|
||||
aml_append(method, aml_notify(aml_name("\\_SB.NVDR"),
|
||||
aml_int(0x80)));
|
||||
aml_append(scope, method);
|
||||
}
|
||||
}
|
||||
aml_append(dsdt, scope);
|
||||
|
||||
crs_range_set_init(&crs_range_set);
|
||||
bus = PC_MACHINE(machine)->bus;
|
||||
if (bus) {
|
||||
|
@ -1872,6 +1728,19 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||
}
|
||||
aml_append(dsdt, sb_scope);
|
||||
|
||||
if (pm->pcihp_bridge_en || pm->pcihp_root_en) {
|
||||
scope = aml_scope("_GPE");
|
||||
{
|
||||
method = aml_method("_E01", 0, AML_NOTSERIALIZED);
|
||||
aml_append(method,
|
||||
aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF));
|
||||
aml_append(method, aml_call0("\\_SB.PCI0.PCNT"));
|
||||
aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK")));
|
||||
aml_append(scope, method);
|
||||
}
|
||||
aml_append(dsdt, scope);
|
||||
}
|
||||
|
||||
/* copy AML table into ACPI tables blob and patch header there */
|
||||
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
|
||||
acpi_table_end(linker, &table);
|
||||
|
|
|
@ -11,29 +11,11 @@
|
|||
#include "e820_memory_layout.h"
|
||||
|
||||
static size_t e820_entries;
|
||||
struct e820_table e820_reserve;
|
||||
struct e820_entry *e820_table;
|
||||
|
||||
int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
|
||||
{
|
||||
int index = le32_to_cpu(e820_reserve.count);
|
||||
struct e820_entry *entry;
|
||||
|
||||
if (type != E820_RAM) {
|
||||
/* old FW_CFG_E820_TABLE entry -- reservations only */
|
||||
if (index >= E820_NR_ENTRIES) {
|
||||
return -EBUSY;
|
||||
}
|
||||
entry = &e820_reserve.entry[index++];
|
||||
|
||||
entry->address = cpu_to_le64(address);
|
||||
entry->length = cpu_to_le64(length);
|
||||
entry->type = cpu_to_le32(type);
|
||||
|
||||
e820_reserve.count = cpu_to_le32(index);
|
||||
}
|
||||
|
||||
/* new "etc/e820" file -- include ram too */
|
||||
/* new "etc/e820" file -- include ram and reserved entries */
|
||||
e820_table = g_renew(struct e820_entry, e820_table, e820_entries + 1);
|
||||
e820_table[e820_entries].address = cpu_to_le64(address);
|
||||
e820_table[e820_entries].length = cpu_to_le64(length);
|
||||
|
|
|
@ -16,20 +16,12 @@
|
|||
#define E820_NVS 4
|
||||
#define E820_UNUSABLE 5
|
||||
|
||||
#define E820_NR_ENTRIES 16
|
||||
|
||||
struct e820_entry {
|
||||
uint64_t address;
|
||||
uint64_t length;
|
||||
uint32_t type;
|
||||
} QEMU_PACKED __attribute((__aligned__(4)));
|
||||
|
||||
struct e820_table {
|
||||
uint32_t count;
|
||||
struct e820_entry entry[E820_NR_ENTRIES];
|
||||
} QEMU_PACKED __attribute((__aligned__(4)));
|
||||
|
||||
extern struct e820_table e820_reserve;
|
||||
extern struct e820_entry *e820_table;
|
||||
|
||||
int e820_add_entry(uint64_t address, uint64_t length, uint32_t type);
|
||||
|
|
|
@ -36,7 +36,6 @@ const char *fw_cfg_arch_key_name(uint16_t key)
|
|||
{FW_CFG_ACPI_TABLES, "acpi_tables"},
|
||||
{FW_CFG_SMBIOS_ENTRIES, "smbios_entries"},
|
||||
{FW_CFG_IRQ0_OVERRIDE, "irq0_override"},
|
||||
{FW_CFG_E820_TABLE, "e820_table"},
|
||||
{FW_CFG_HPET, "hpet"},
|
||||
};
|
||||
|
||||
|
@ -127,8 +126,6 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms,
|
|||
#endif
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, 1);
|
||||
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE,
|
||||
&e820_reserve, sizeof(e820_reserve));
|
||||
fw_cfg_add_file(fw_cfg, "etc/e820", e820_table,
|
||||
sizeof(struct e820_entry) * e820_get_num_entries());
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0)
|
||||
#define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)
|
||||
#define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2)
|
||||
#define FW_CFG_E820_TABLE (FW_CFG_ARCH_LOCAL + 3)
|
||||
#define FW_CFG_HPET (FW_CFG_ARCH_LOCAL + 4)
|
||||
|
||||
FWCfgState *fw_cfg_arch_create(MachineState *ms,
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -114,8 +114,9 @@
|
|||
VTD_INTERRUPT_ADDR_FIRST + 1)
|
||||
|
||||
/* The shift of source_id in the key of IOTLB hash table */
|
||||
#define VTD_IOTLB_SID_SHIFT 36
|
||||
#define VTD_IOTLB_LVL_SHIFT 52
|
||||
#define VTD_IOTLB_SID_SHIFT 20
|
||||
#define VTD_IOTLB_LVL_SHIFT 28
|
||||
#define VTD_IOTLB_PASID_SHIFT 30
|
||||
#define VTD_IOTLB_MAX_SIZE 1024 /* Max size of the hash table */
|
||||
|
||||
/* IOTLB_REG */
|
||||
|
@ -191,6 +192,7 @@
|
|||
#define VTD_ECAP_SC (1ULL << 7)
|
||||
#define VTD_ECAP_MHMV (15ULL << 20)
|
||||
#define VTD_ECAP_SRS (1ULL << 31)
|
||||
#define VTD_ECAP_PASID (1ULL << 40)
|
||||
#define VTD_ECAP_SMTS (1ULL << 43)
|
||||
#define VTD_ECAP_SLTS (1ULL << 46)
|
||||
|
||||
|
@ -211,6 +213,8 @@
|
|||
#define VTD_CAP_DRAIN_READ (1ULL << 55)
|
||||
#define VTD_CAP_DRAIN (VTD_CAP_DRAIN_READ | VTD_CAP_DRAIN_WRITE)
|
||||
#define VTD_CAP_CM (1ULL << 7)
|
||||
#define VTD_PASID_ID_SHIFT 20
|
||||
#define VTD_PASID_ID_MASK ((1ULL << VTD_PASID_ID_SHIFT) - 1)
|
||||
|
||||
/* Supported Adjusted Guest Address Widths */
|
||||
#define VTD_CAP_SAGAW_SHIFT 8
|
||||
|
@ -262,6 +266,8 @@
|
|||
#define VTD_FRCD_SID(val) ((val) & VTD_FRCD_SID_MASK)
|
||||
/* For the low 64-bit of 128-bit */
|
||||
#define VTD_FRCD_FI(val) ((val) & ~0xfffULL)
|
||||
#define VTD_FRCD_PV(val) (((val) & 0xffffULL) << 40)
|
||||
#define VTD_FRCD_PP(val) (((val) & 0x1) << 31)
|
||||
|
||||
/* DMA Remapping Fault Conditions */
|
||||
typedef enum VTDFaultReason {
|
||||
|
@ -379,6 +385,11 @@ typedef union VTDInvDesc VTDInvDesc;
|
|||
#define VTD_INV_DESC_IOTLB_AM(val) ((val) & 0x3fULL)
|
||||
#define VTD_INV_DESC_IOTLB_RSVD_LO 0xffffffff0000ff00ULL
|
||||
#define VTD_INV_DESC_IOTLB_RSVD_HI 0xf80ULL
|
||||
#define VTD_INV_DESC_IOTLB_PASID_PASID (2ULL << 4)
|
||||
#define VTD_INV_DESC_IOTLB_PASID_PAGE (3ULL << 4)
|
||||
#define VTD_INV_DESC_IOTLB_PASID(val) (((val) >> 32) & VTD_PASID_ID_MASK)
|
||||
#define VTD_INV_DESC_IOTLB_PASID_RSVD_LO 0xfff00000000001c0ULL
|
||||
#define VTD_INV_DESC_IOTLB_PASID_RSVD_HI 0xf80ULL
|
||||
|
||||
/* Mask for Device IOTLB Invalidate Descriptor */
|
||||
#define VTD_INV_DESC_DEVICE_IOTLB_ADDR(val) ((val) & 0xfffffffffffff000ULL)
|
||||
|
@ -413,6 +424,7 @@ typedef union VTDInvDesc VTDInvDesc;
|
|||
/* Information about page-selective IOTLB invalidate */
|
||||
struct VTDIOTLBPageInvInfo {
|
||||
uint16_t domain_id;
|
||||
uint32_t pasid;
|
||||
uint64_t addr;
|
||||
uint8_t mask;
|
||||
};
|
||||
|
|
|
@ -324,8 +324,6 @@ static void microvm_memory_init(MicrovmMachineState *mms)
|
|||
fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, machine->smp.max_cpus);
|
||||
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, 1);
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE,
|
||||
&e820_reserve, sizeof(e820_reserve));
|
||||
fw_cfg_add_file(fw_cfg, "etc/e820", e820_table,
|
||||
sizeof(struct e820_entry) * e820_get_num_entries());
|
||||
|
||||
|
|
|
@ -1061,7 +1061,6 @@ void pc_memory_init(PCMachineState *pcms,
|
|||
hwaddr cxl_size = MiB;
|
||||
|
||||
cxl_base = pc_get_cxl_range_start(pcms);
|
||||
e820_add_entry(cxl_base, cxl_size, E820_RESERVED);
|
||||
memory_region_init(mr, OBJECT(machine), "cxl_host_reg", cxl_size);
|
||||
memory_region_add_subregion(system_memory, cxl_base, mr);
|
||||
cxl_resv_end = cxl_base + cxl_size;
|
||||
|
@ -1077,7 +1076,6 @@ void pc_memory_init(PCMachineState *pcms,
|
|||
memory_region_init_io(&fw->mr, OBJECT(machine), &cfmws_ops, fw,
|
||||
"cxl-fixed-memory-region", fw->size);
|
||||
memory_region_add_subregion(system_memory, fw->base, &fw->mr);
|
||||
e820_add_entry(fw->base, fw->size, E820_RESERVED);
|
||||
cxl_fmw_base += fw->size;
|
||||
cxl_resv_end = cxl_fmw_base;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ vtd_inv_desc_cc_devices(uint16_t sid, uint16_t fmask) "context invalidate device
|
|||
vtd_inv_desc_iotlb_global(void) "iotlb invalidate global"
|
||||
vtd_inv_desc_iotlb_domain(uint16_t domain) "iotlb invalidate whole domain 0x%"PRIx16
|
||||
vtd_inv_desc_iotlb_pages(uint16_t domain, uint64_t addr, uint8_t mask) "iotlb invalidate domain 0x%"PRIx16" addr 0x%"PRIx64" mask 0x%"PRIx8
|
||||
vtd_inv_desc_iotlb_pasid_pages(uint16_t domain, uint64_t addr, uint8_t mask, uint32_t pasid) "iotlb invalidate domain 0x%"PRIx16" addr 0x%"PRIx64" mask 0x%"PRIx8" pasid 0x%"PRIx32
|
||||
vtd_inv_desc_iotlb_pasid(uint16_t domain, uint32_t pasid) "iotlb invalidate domain 0x%"PRIx16" pasid 0x%"PRIx32
|
||||
vtd_inv_desc_wait_sw(uint64_t addr, uint32_t data) "wait invalidate status write addr 0x%"PRIx64" data 0x%"PRIx32
|
||||
vtd_inv_desc_wait_irq(const char *msg) "%s"
|
||||
vtd_inv_desc_wait_write_fail(uint64_t hi, uint64_t lo) "write fail for wait desc hi 0x%"PRIx64" lo 0x%"PRIx64
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue