diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c index e68f3433ad2c816b449eb015be3134f0124d59a5..281d3ef490bbd001983db4e67407ce3bf92c2b2e 100644 --- a/accel/stubs/kvm-stub.c +++ b/accel/stubs/kvm-stub.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "sysemu/kvm.h" #include "hw/pci/msi.h" +#include "hw/ub/ub_usi.h" KVMState *kvm_state; bool kvm_kernel_irqchip; @@ -139,3 +140,15 @@ int kvm_load_user_data(hwaddr loader_start, hwaddr image_end, hwaddr initrd_star { return -ENOSYS; } + +#ifdef CONFIG_UB +int kvm_irqchip_add_usi_route(KVMRouteChange *c, USIMessage msg, uint32_t devid, UBDevice *udev) +{ + return -ENOSYS; +} + +int kvm_irqchip_update_usi_route(KVMRouteChange *c, int virq, USIMessage msg, UBDevice *udev) +{ + return -ENOSYS; +} +#endif // CONFIG_UB \ No newline at end of file diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 120fe0d0a1b942c9ff914977b06b624985282c64..5b742d6861dd83d81039e82b303a0834a45d351f 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -1383,7 +1383,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) build_dsdt(tables_blob, tables->linker, vms); #ifdef CONFIG_UB acpi_add_table(table_offsets, tables_blob); - build_ubrt(tables_blob, tables->linker, vms); + build_ubrt(tables_blob, tables->linker); #endif /* FADT MADT PPTT GTDT MCFG SPCR DBG2 pointed to by RSDT */ acpi_add_table(table_offsets, tables_blob); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index e29c0d47d61d23cca600c64097427052246e3aa4..a1ec1dd4bfdeafcd297b4f00c3b88fa44c0f0b27 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -402,7 +402,7 @@ static void create_ubios_info_table_fdt(VirtMachineState *vms, MemoryRegion *mac qemu_log("create fdt for ubios-information-table 0x%lx\n", vms->memmap[VIRT_UBIOS_INFO_TABLE].base); - ub_init_ubios_info_table(vms, ROUND_UP(UBIOS_TABLE_SIZE, 4 * KiB)); + ub_init_ubios_info_table(ROUND_UP(UBIOS_TABLE_SIZE, 4 * KiB)); } #endif // CONFIG_UB @@ -2086,7 +2086,7 @@ void virt_machine_done(Notifier *notifier, void *data) fw_cfg_add_extra_pci_roots(vms->bus, vms->fw_cfg); #ifdef CONFIG_UB - if (ub_dev_finally_setup(vms, &error_fatal) < 0) { + if (ub_dev_finally_setup(&error_fatal) < 0) { exit(1); } #endif // CONFIG_UB diff --git a/hw/ub/ub.c b/hw/ub/ub.c index 4bd970b560020daac64fb923c9ebbc7ea78ed60e..e39f92a0d56ac90f4e915df58db596d642eeb516 100644 --- a/hw/ub/ub.c +++ b/hw/ub/ub.c @@ -1234,7 +1234,7 @@ static int ub_bus_instance_verify(Error **errp) * 1. check ub device bus instance type * 2. init the port info * */ -int ub_dev_finally_setup(VirtMachineState *vms, Error **errp) +int ub_dev_finally_setup(Error **errp) { if (ub_bus_instance_verify(errp)) { return -1; @@ -1248,7 +1248,7 @@ int ub_dev_finally_setup(VirtMachineState *vms, Error **errp) return -1; } - ub_set_ubinfo_in_ubc_table(vms); + ub_set_ubinfo_in_ubc_table(); return 0; } diff --git a/hw/ub/ub_acpi.c b/hw/ub/ub_acpi.c index 4f4c77b869b0402ca90de1024118f53b82ef18dd..3d6830b947f457735fe0647672ccf9238a4d88b6 100644 --- a/hw/ub/ub_acpi.c +++ b/hw/ub/ub_acpi.c @@ -19,6 +19,7 @@ #include "qemu/cutils.h" #include "qemu/units.h" #include "hw/arm/virt.h" +#include "hw/qdev-core.h" #include "hw/boards.h" #include "hw/qdev-properties.h" #include "hw/qdev-properties-system.h" @@ -246,8 +247,9 @@ static void ub_init_ubios_rsv_mem_table(DtsRsvMemTable *rsv_mem_table, VirtMachi mem_range->size = 0x100000; /* MSI_IOVA_LENGTH */ } -void ub_init_ubios_info_table(VirtMachineState *vms, uint64_t total_size) +void ub_init_ubios_info_table(uint64_t total_size) { + VirtMachineState *vms = VIRT_MACHINE(qdev_get_machine()); uint64_t ubios_info_tables = vms->memmap[VIRT_UBIOS_INFO_TABLE].base; uint64_t ubc_tables_addr = ubios_info_tables + UBIOS_INFO_TABLE_SIZE; uint64_t ummu_tables_addr; @@ -307,8 +309,9 @@ void ub_init_ubios_info_table(VirtMachineState *vms, uint64_t total_size) cpu_physical_memory_unmap(ubios, size, true, size); } -void ub_set_ubinfo_in_ubc_table(VirtMachineState *vms) +void ub_set_ubinfo_in_ubc_table(void) { + VirtMachineState *vms = VIRT_MACHINE(qdev_get_machine()); uint64_t ubios_info_tables = vms->memmap[VIRT_UBIOS_INFO_TABLE].base; uint64_t total_size = ROUND_UP(UBIOS_TABLE_SIZE, 4 * KiB); uint64_t size = total_size; @@ -511,8 +514,9 @@ void ub_idev_ers_free_address_space(hwaddr offset) } } -void build_ubrt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) +void build_ubrt(GArray *table_data, BIOSLinker *linker) { + VirtMachineState *vms = VIRT_MACHINE(qdev_get_machine()); /* 3 subtables: ubc, ummu, UB Reserved Memory */ uint8_t table_cnt = 3; uint64_t ubios_info_tables = vms->memmap[VIRT_UBIOS_INFO_TABLE].base; diff --git a/include/hw/ub/ub.h b/include/hw/ub/ub.h index 9e52486c0b0d39ddf003f43f39a5109ec6d7f5a8..236b2a1c7a247e3fcfaeb27206c572d2b6bf8df7 100644 --- a/include/hw/ub/ub.h +++ b/include/hw/ub/ub.h @@ -21,7 +21,6 @@ #include "qemu/typedefs.h" #include "exec/memory.h" #include "sysemu/host_iommu_device.h" -#include "hw/arm/virt.h" #define BYTE_SIZE 1 #define WORD_SIZE 2 @@ -267,7 +266,7 @@ void ub_default_read_config(UBDevice *dev, uint64_t offset, void ub_default_write_config(UBDevice *dev, uint64_t offset, uint32_t *val, uint32_t dw_mask); UBDevice *ub_find_device_by_guid(UbGuid *guid); -int ub_dev_finally_setup(VirtMachineState *vms, Error **errp); +int ub_dev_finally_setup(Error **errp); static inline uint64_t ub_config_size(void) { return UB_DEV_CONFIG_SPACE_TOTAL_SIZE; diff --git a/include/hw/ub/ub_acpi.h b/include/hw/ub/ub_acpi.h index 47f3950dfe7485bcf42cbc2858f3af8090724422..6113e11cda79864704e5fd01fb019a0b7c85983d 100644 --- a/include/hw/ub/ub_acpi.h +++ b/include/hw/ub/ub_acpi.h @@ -17,7 +17,6 @@ #ifndef HW_UB_ACPI_H #define HW_UB_ACPI_H -#include "hw/arm/virt.h" #include "hw/acpi/acpi-defs.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/acpi/aml-build.h" @@ -174,12 +173,12 @@ typedef struct AcpiUbrtTable { UBIOS_UMMU_TABLE_SIZE(UBIOS_UMMU_TABLE_CNT) + \ UBIOS_RSV_MEM_TABLE_SIZE(UBIOS_UMMU_TABLE_CNT)) -void ub_init_ubios_info_table(VirtMachineState *vms, uint64_t total_size); +void ub_init_ubios_info_table(uint64_t total_size); hwaddr ub_idev_ers_alloc_address_space(uint64_t size, uint32_t sys_pgs); void ub_idev_ers_free_address_space(hwaddr offset); void ub_set_gpa_bits(uint8_t bits); -void build_ubrt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms); -void ub_set_ubinfo_in_ubc_table(VirtMachineState *vms); +void build_ubrt(GArray *table_data, BIOSLinker *linker); +void ub_set_ubinfo_in_ubc_table(void); void acpi_dsdt_add_ub(Aml *scope); void acpi_iort_add_ub(GArray *table_data); #endif \ No newline at end of file