 dfadc3bfb4
			
		
	
	
		dfadc3bfb4
		
	
	
	
	
		
			
			Instead of using "1.0" as the system version of SMBIOS, we should use
mc->name for mach-virt machine type to be consistent other architectures.
With this patch, "dmidecode -t 1" (e.g., "-M virt-2.12,accel=kvm") will
show:
    Handle 0x0100, DMI type 1, 27 bytes
    System Information
            Manufacturer: QEMU
            Product Name: KVM Virtual Machine
            Version: virt-2.12
            Serial Number: Not Specified
            ...
instead of:
    Handle 0x0100, DMI type 1, 27 bytes
    System Information
            Manufacturer: QEMU
            Product Name: KVM Virtual Machine
            Version: 1.0
            Serial Number: Not Specified
            ...
For backward compatibility, we allow older machine types to keep "1.0"
as the default system version.
Signed-off-by: Wei Huang <wei@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Message-id: 20180322212318.7182-1-wei@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
		
	
			
		
			
				
	
	
		
			123 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			123 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  *
 | |
|  * Copyright (c) 2015 Linaro Limited
 | |
|  *
 | |
|  * This program is free software; you can redistribute it and/or modify it
 | |
|  * under the terms and conditions of the GNU General Public License,
 | |
|  * version 2 or later, as published by the Free Software Foundation.
 | |
|  *
 | |
|  * This program is distributed in the hope it will be useful, but WITHOUT
 | |
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 | |
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 | |
|  * more details.
 | |
|  *
 | |
|  * You should have received a copy of the GNU General Public License along with
 | |
|  * this program.  If not, see <http://www.gnu.org/licenses/>.
 | |
|  *
 | |
|  * Emulate a virtual board which works by passing Linux all the information
 | |
|  * it needs about what devices are present via the device tree.
 | |
|  * There are some restrictions about what we can do here:
 | |
|  *  + we can only present devices whose Linux drivers will work based
 | |
|  *    purely on the device tree with no platform data at all
 | |
|  *  + we want to present a very stripped-down minimalist platform,
 | |
|  *    both because this reduces the security attack surface from the guest
 | |
|  *    and also because it reduces our exposure to being broken when
 | |
|  *    the kernel updates its device tree bindings and requires further
 | |
|  *    information in a device binding that we aren't providing.
 | |
|  * This is essentially the same approach kvmtool uses.
 | |
|  */
 | |
| 
 | |
| #ifndef QEMU_ARM_VIRT_H
 | |
| #define QEMU_ARM_VIRT_H
 | |
| 
 | |
| #include "qemu-common.h"
 | |
| #include "exec/hwaddr.h"
 | |
| #include "qemu/notify.h"
 | |
| #include "hw/boards.h"
 | |
| #include "hw/arm/arm.h"
 | |
| 
 | |
| #define NUM_GICV2M_SPIS       64
 | |
| #define NUM_VIRTIO_TRANSPORTS 32
 | |
| 
 | |
| #define ARCH_GICV3_MAINT_IRQ  9
 | |
| 
 | |
| #define ARCH_TIMER_VIRT_IRQ   11
 | |
| #define ARCH_TIMER_S_EL1_IRQ  13
 | |
| #define ARCH_TIMER_NS_EL1_IRQ 14
 | |
| #define ARCH_TIMER_NS_EL2_IRQ 10
 | |
| 
 | |
| #define VIRTUAL_PMU_IRQ 7
 | |
| 
 | |
| #define PPI(irq) ((irq) + 16)
 | |
| 
 | |
| enum {
 | |
|     VIRT_FLASH,
 | |
|     VIRT_MEM,
 | |
|     VIRT_CPUPERIPHS,
 | |
|     VIRT_GIC_DIST,
 | |
|     VIRT_GIC_CPU,
 | |
|     VIRT_GIC_V2M,
 | |
|     VIRT_GIC_ITS,
 | |
|     VIRT_GIC_REDIST,
 | |
|     VIRT_UART,
 | |
|     VIRT_MMIO,
 | |
|     VIRT_RTC,
 | |
|     VIRT_FW_CFG,
 | |
|     VIRT_PCIE,
 | |
|     VIRT_PCIE_MMIO,
 | |
|     VIRT_PCIE_PIO,
 | |
|     VIRT_PCIE_ECAM,
 | |
|     VIRT_PLATFORM_BUS,
 | |
|     VIRT_PCIE_MMIO_HIGH,
 | |
|     VIRT_GPIO,
 | |
|     VIRT_SECURE_UART,
 | |
|     VIRT_SECURE_MEM,
 | |
| };
 | |
| 
 | |
| typedef struct MemMapEntry {
 | |
|     hwaddr base;
 | |
|     hwaddr size;
 | |
| } MemMapEntry;
 | |
| 
 | |
| typedef struct {
 | |
|     MachineClass parent;
 | |
|     bool disallow_affinity_adjustment;
 | |
|     bool no_its;
 | |
|     bool no_pmu;
 | |
|     bool claim_edge_triggered_timers;
 | |
|     bool smbios_old_sys_ver;
 | |
| } VirtMachineClass;
 | |
| 
 | |
| typedef struct {
 | |
|     MachineState parent;
 | |
|     Notifier machine_done;
 | |
|     FWCfgState *fw_cfg;
 | |
|     bool secure;
 | |
|     bool highmem;
 | |
|     bool its;
 | |
|     bool virt;
 | |
|     int32_t gic_version;
 | |
|     struct arm_boot_info bootinfo;
 | |
|     const MemMapEntry *memmap;
 | |
|     const int *irqmap;
 | |
|     int smp_cpus;
 | |
|     void *fdt;
 | |
|     int fdt_size;
 | |
|     uint32_t clock_phandle;
 | |
|     uint32_t gic_phandle;
 | |
|     uint32_t msi_phandle;
 | |
|     int psci_conduit;
 | |
| } VirtMachineState;
 | |
| 
 | |
| #define TYPE_VIRT_MACHINE   MACHINE_TYPE_NAME("virt")
 | |
| #define VIRT_MACHINE(obj) \
 | |
|     OBJECT_CHECK(VirtMachineState, (obj), TYPE_VIRT_MACHINE)
 | |
| #define VIRT_MACHINE_GET_CLASS(obj) \
 | |
|     OBJECT_GET_CLASS(VirtMachineClass, obj, TYPE_VIRT_MACHINE)
 | |
| #define VIRT_MACHINE_CLASS(klass) \
 | |
|     OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE)
 | |
| 
 | |
| void virt_acpi_setup(VirtMachineState *vms);
 | |
| 
 | |
| #endif /* QEMU_ARM_VIRT_H */
 |