target-arm queue
Subsystems (3)
Second lot of ARM changes to sneak in before freeze:
* fixed version of the raspi2 sd controller patches
* GICv3 save/restore
* v7M QOMify
I've also included the Linux header update patches stolen from Paolo's pullreq since it hasn't quite hit master yet.
thanks
-- PMM
The following changes since commit 1bbe5dc66b770d7bedd1d51d7935da948a510dd6:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170228' into staging (2017-02-28 14:50:17 +0000)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170228-1
for you to fetch changes up to 1eeb5c7deacbfb4d4cad17590a16a99f3d85eabb:
bcm2835: add sdhost and gpio controllers (2017-02-28 17:10:00 +0000)
----------------------------------------------------------------
target-arm queue:
* raspi2: add gpio controller and sdhost controller, with the wiring so the guest can switch which controller the SD card is attached to
(this is sufficient to get raspbian kernels to boot)
* GICv3: support state save/restore from KVM
* update Linux headers to 4.11
* refactor and QOMify the ARMv7M container object
----------------------------------------------------------------
Clement Deschamps (3):
hw/sd: add card-reparenting function
bcm2835_gpio: add bcm2835 gpio controller
bcm2835: add sdhost and gpio controllers
Paolo Bonzini (2):
update-linux-headers: update for 4.11
update Linux headers to 4.11
Peter Maydell (12):
armv7m: Abstract out the "load kernel" code
armv7m: Move NVICState struct definition into header
armv7m: QOMify the armv7m container
armv7m: Use QOMified armv7m object in armv7m_init()
armv7m: Make ARMv7M object take memory region link
armv7m: Make NVIC expose a memory region rather than mapping itself
armv7m: Make bitband device take the address space to access
armv7m: Don't put core v7M devices under CONFIG_STELLARIS
armv7m: Split systick out from NVIC
stm32f205: Create armv7m object without using armv7m_init()
stm32f205: Rename 'nvic' local to 'armv7m'
qdev: Have qdev_set_parent_bus() handle devices already on a bus
Vijaya Kumar K (4):
hw/intc/arm_gicv3_kvm: Add ICC_SRE_EL1 register to vmstate hw/intc/arm_gicv3_kvm: Implement get/put functions
target-arm: Add GICv3CPUState in CPUARMState struct hw/intc/arm_gicv3_kvm: Reset GICv3 cpu interface registers
hw/gpio/Makefile.objs | 1 + hw/intc/Makefile.objs | 2 +- hw/timer/Makefile.objs | 1 + hw/intc/gicv3_internal.h | 3 + include/hw/arm/arm.h | 12 + include/hw/arm/armv7m.h | 63 +++ include/hw/arm/armv7m_nvic.h | 62 ++ include/hw/arm/bcm2835_peripherals.h | 4 + include/hw/arm/stm32f205_soc.h | 4 +- include/hw/gpio/bcm2835_gpio.h | 39 ++ include/hw/intc/arm_gicv3_common.h | 1 + include/hw/sd/sd.h | 11 + include/hw/timer/armv7m_systick.h | 34 ++ include/standard-headers/asm-x86/hyperv.h | 8 + include/standard-headers/linux/input-event-codes.h | 2 +- include/standard-headers/linux/pci_regs.h | 25 + include/standard-headers/linux/virtio_ids.h | 1 + linux-headers/asm-arm/kvm.h | 15 + linux-headers/asm-arm/unistd-common.h | 357 ++++++++++++ linux-headers/asm-arm/unistd-eabi.h | 5 + linux-headers/asm-arm/unistd-oabi.h | 17 + linux-headers/asm-arm/unistd.h | 419 +------------- linux-headers/asm-arm64/kvm.h | 13 + linux-headers/asm-powerpc/kvm.h | 27 + linux-headers/asm-powerpc/unistd.h | 1 + linux-headers/asm-x86/kvm_para.h | 13 +- linux-headers/linux/kvm.h | 24 +- linux-headers/linux/kvm_para.h | 2 + linux-headers/linux/userfaultfd.h | 67 ++- linux-headers/linux/vfio.h | 10 + target/arm/cpu.h | 2 + hw/arm/armv7m.c | 379 ++++++++----- hw/arm/bcm2835_peripherals.c | 43 +- hw/arm/netduino2.c | 7 +- hw/arm/stm32f205_soc.c | 28 +- hw/core/qdev.c | 14 + hw/gpio/bcm2835_gpio.c | 353 ++++++++++++ hw/intc/arm_gicv3_common.c | 38 ++ hw/intc/arm_gicv3_cpuif.c | 8 + hw/intc/arm_gicv3_kvm.c | 629 ++++++++++++++++++++- hw/intc/armv7m_nvic.c | 214 ++----- hw/sd/core.c | 27 + hw/timer/armv7m_systick.c | 240 ++++++++ default-configs/arm-softmmu.mak | 2 + hw/timer/trace-events | 6 + scripts/update-linux-headers.sh | 13 +- 46 files changed, 2479 insertions(+), 767 deletions(-) create mode 100644 include/hw/arm/armv7m.h create mode 100644 include/hw/arm/armv7m_nvic.h create mode 100644 include/hw/gpio/bcm2835_gpio.h create mode 100644 include/hw/timer/armv7m_systick.h create mode 100644 linux-headers/asm-arm/unistd-common.h create mode 100644 linux-headers/asm-arm/unistd-eabi.h create mode 100644 linux-headers/asm-arm/unistd-oabi.h create mode 100644 hw/gpio/bcm2835_gpio.c create mode 100644 hw/timer/armv7m_systick.c
[Qemu-devel] [PULL 03/21] armv7m: QOMify the armv7m container
Create a proper QOM object for the armv7m container, which holds the CPU, the NVIC and the bitband regions.
Message-id: [email protected]
--- include/hw/arm/armv7m.h | 51 ++++++++++++++++++ hw/arm/armv7m.c | 139 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 178 insertions(+), 12 deletions(-) create mode 100644 include/hw/arm/armv7m.h
include/hw/arm/armv7m.h new file +51 -0
@@ -0,0 +1,51 @@ +/* +* ARMv7M CPU object +* +* Copyright (c) 2017 Linaro Ltd +* Written by Peter Maydell <[email protected]> +* +* This code is licensed under the GPL version 2 or later. +*/ + +#ifndef HW_ARM_ARMV7M_H +#define HW_ARM_ARMV7M_H + +#include "hw/sysbus.h" +#include "hw/arm/armv7m_nvic.h" + +#define TYPE_BITBAND "ARM,bitband-memory" +#define BITBAND (obj) OBJECT_CHECK(BitBandState, (obj), TYPE_BITBAND) + +typedef struct { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +MemoryRegion iomem; +uint32_t base; +}BitBandState ; + +#define TYPE_ARMV7M "armv7m" +#define ARMV7M (obj) OBJECT_CHECK(ARMv7MState, (obj), TYPE_ARMV7M) + +#define ARMV7M_NUM_BITBANDS 2 + +/* ARMv7M container object. +* + Unnamed GPIO input lines: external IRQ lines for the NVIC +* + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ +* + Property "cpu-model": CPU model to instantiate +* + Property "num-irq": number of external IRQ lines +*/ +typedef struct ARMv7MState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ +NVICState nvic; +BitBandState bitband[ARMV7M_NUM_BITBANDS ]; +ARMCPU *cpu; + +/* Properties */ +char *cpu_model; +}ARMv7MState ; + +#endif
hw/arm/armv7m.c +127 -12
163 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 01/21] armv7m: Abstract out the "load kernel" code
In reply to Peter MaydellAbstract the "load kernel" code out of armv7m_init() into its own function. This includes the registration of the CPU reset function, to parallel how we handle this for A profile cores.
We make the function public so that boards which choose to directly instantiate an ARMv7M device object can call it.
Message-id: [email protected]
--- include/hw/arm/arm.h | 12 ++++++++++++ hw/arm/armv7m.c | 23 ++++++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-)
include/hw/arm/arm.h +12 -0
@@ -26,6 +26,18 @@ typedef enum {/* armv7m.c */ DeviceState *armv7m_init (MemoryRegion *system_memory,int mem_size,int num_irq,const char *kernel_filename,const char *cpu_model); +/** +* armv7m_load_kernel: +* @cpu: CPU +* @kernel_filename: file to load +* @mem_size: mem_size: maximum image size to load +* +* Load the guest image for an ARMv7M system. This must be called by +* any ARMv7M board, either directly or via armv7m_init(). (This is +* necessary to ensure that the CPU resets correctly on system reset, +* as well as for kernel loading.) +*/ +void armv7m_load_kernel (ARMCPU *cpu,const char *kernel_filename,int mem_size);/* * struct used as a parameter of the arm_load_kernel machine init
hw/arm/armv7m.c +18 -5
@@ -176,10 +176,6 @@ DeviceState *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq,ARMCPU *cpu;CPUARMState *env;DeviceState *nvic; -int image_size; -uint64_t entry; -uint64_t lowaddr; -int big_endian;if (cpu_model ==NULL ) { cpu_model ="cortex-m3" ;
@@ -199,6 +195,16 @@ DeviceState *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq,qdev_init_nofail (nvic);sysbus_connect_irq (SYS_BUS_DEVICE (nvic),0 ,qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_IRQ )); +armv7m_load_kernel (cpu, kernel_filename, mem_size); +return nvic; +} + +void armv7m_load_kernel (ARMCPU *cpu,const char *kernel_filename,int mem_size) +{ +int image_size; +uint64_t entry; +uint64_t lowaddr; +int big_endian;#ifdef TARGET_WORDS_BIGENDIAN big_endian =1 ;
@@ -224,8 +230,15 @@ DeviceState *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq, } } +/* CPU objects (unlike devices) are not automatically reset on system +* reset, so we must always register a handler to do so. Unlike +* A-profile CPUs, we don't need to do anything special in the +* handler to arrange that it starts correctly. +* This is arguably the wrong place to do this, but it matches the +* way A-profile does it. Note that this means that every M profile +* board must call this function! +*/ qemu_register_reset (armv7m_reset, cpu); -return nvic; }static Property bitband_properties[] = {
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 02/21] armv7m: Move NVICState struct definition into header
In reply to Peter MaydellMove the NVICState struct definition into a header, so we can embed it into other QOM objects like SoCs.
Message-id: [email protected]
--- include/hw/arm/armv7m_nvic.h | 66 ++++++++++++++++++++++++++++++++++++++++++++ hw/intc/armv7m_nvic.c | 49 +------------------------------- 2 files changed, 67 insertions(+), 48 deletions(-) create mode 100644 include/hw/arm/armv7m_nvic.h
include/hw/arm/armv7m_nvic.h new file +66 -0
@@ -0,0 +1,66 @@ +/* +* ARMv7M NVIC object +* +* Copyright (c) 2017 Linaro Ltd +* Written by Peter Maydell <[email protected]> +* +* This code is licensed under the GPL version 2 or later. +*/ + +#ifndef HW_ARM_ARMV7M_NVIC_H +#define HW_ARM_ARMV7M_NVIC_H + +#include "target/arm/cpu.h" +#include "hw/sysbus.h" + +#define TYPE_NVIC "armv7m_nvic" + +#define NVIC (obj) \ + OBJECT_CHECK(NVICState, (obj), TYPE_NVIC) + +/* Highest permitted number of exceptions (architectural limit) */ +#define NVIC_MAX_VECTORS 512 + +typedef struct VecInfo { +/* Exception priorities can range from -3 to 255; only the unmodifiable +* priority values for RESET, NMI and HardFault can be negative. +*/ +int16_t prio; +uint8_t enabled; +uint8_t pending; +uint8_t active; +uint8_t level;/* exceptions <=15 never set level */ +}VecInfo ; + +typedef struct NVICState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +ARMCPU *cpu; + +VecInfo vectors[NVIC_MAX_VECTORS ]; +uint32_t prigroup; + +/* vectpending and exception_prio are both cached state that can +* be recalculated from the vectors[] array and the prigroup field. +*/ +unsigned int vectpending;/* highest prio pending enabled exception */ +int exception_prio;/* group prio of the highest prio active exception */ + +struct { +uint32_t control; +uint32_t reload; +int64_t tick; +QEMUTimer *timer; + } systick; + +MemoryRegion sysregmem; +MemoryRegion container; + +uint32_t num_irq; +qemu_irq excpout; +qemu_irq sysresetreq; +}NVICState ; + +#endif
hw/intc/armv7m_nvic.c +1 -48
67 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 05/21] armv7m: Make ARMv7M object take memory region link
In reply to Peter MaydellMake the ARMv7M object take a memory region link which it uses to wire up the bitband rather than having them always put themselves in the system address space.
Message-id: [email protected]
--- include/hw/arm/armv7m.h | 10 ++++++++++ hw/arm/armv7m.c | 23 ++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-)
include/hw/arm/armv7m.h +10 -0
@@ -35,6 +35,9 @@ typedef struct {* + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ * + Property "cpu-model": CPU model to instantiate * + Property "num-irq": number of external IRQ lines +* + Property "memory": MemoryRegion defining the physical address space +* that CPU accesses see. (The NVIC, bitbanding and other CPU-internal +* devices will be automatically layered on top of this view.) */ typedef struct ARMv7MState { /*< private >*/
@@ -44,8 +47,15 @@ typedef struct ARMv7MState {BitBandState bitband[ARMV7M_NUM_BITBANDS ];ARMCPU *cpu; +/* MemoryRegion we pass to the CPU, with our devices layered on +* top of the ones the board provides in board_memory. +*/ +MemoryRegion container; +/* Properties */ char *cpu_model; +/* MemoryRegion the board provides to us (with its devices, RAM, etc) */ + MemoryRegion *board_memory; } ARMv7MState;#endif
hw/arm/armv7m.c +22 -1
@@ -18,6 +18,7 @@#include "elf.h" #include "sysemu/qtest.h" #include "qemu/error-report.h" +#include "exec/address-spaces.h" /* Bitbanded IO. Each word corresponds to a single bit. */
@@ -148,6 +149,14 @@ static void armv7m_instance_init(Object *obj)/* Can't init the cpu here, we don't yet know which model to use */ +object_property_add_link (obj,"memory" , +TYPE_MEMORY_REGION , + (Object **)&s->board_memory, + qdev_prop_allow_set_link_before_realize, +OBJ_PROP_LINK_UNREF_ON_RELEASE , + &error_abort); +memory_region_init (&s->container, obj,"armv7m-container" ,UINT64_MAX ); +object_initialize (&s->nvic,sizeof (s->nvic),"armv7m_nvic" );qdev_set_parent_bus (DEVICE (&s->nvic),sysbus_get_default ()); object_property_add_alias(obj, "num-irq",
@@ -169,6 +178,13 @@ static void armv7m_realize(DeviceState *dev, Error **errp)const char *typename;CPUClass *cc; +if (!s->board_memory) { +error_setg (errp,"memory property was not set" ); +return ; + } + +memory_region_add_subregion_overlap (&s->container,0 , s->board_memory,-1 ); + cpustr =g_strsplit (s->cpu_model,"," ,2 ); oc =cpu_class_by_name (TYPE_ARM_CPU , cpustr[0 ]);
@@ -193,6 +209,8 @@ static void armv7m_realize(DeviceState *dev, Error **errp)return ; } +object_property_set_link (OBJECT (s->cpu),OBJECT (&s->container),"memory" , + &error_abort);object_property_set_bool (OBJECT (s->cpu), true,"realized" , &err);if (err !=NULL ) {error_propagate (errp, err);
@@ -233,7 +251,8 @@ static void armv7m_realize(DeviceState *dev, Error **errp)return ; } -sysbus_mmio_map (sbd,0 , bitband_output_addr[i]); +memory_region_add_subregion (&s->container, bitband_output_addr[i], +sysbus_mmio_get_region (sbd,0 )); } }
@@ -281,6 +300,8 @@ DeviceState *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq, armv7m =qdev_create (NULL ,"armv7m" );qdev_prop_set_uint32 (armv7m,"num-irq" , num_irq);qdev_prop_set_string (armv7m,"cpu-model" , cpu_model); +object_property_set_link (OBJECT (armv7m),OBJECT (get_system_memory ()), +"memory" , &error_abort);/* This will exit with an error if the user passed us a bad cpu_model */ qdev_init_nofail (armv7m);
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 08/21] armv7m: Don't put core v7M devices under CONFIG_STELLARIS
In reply to Peter MaydellThe NVIC is a core v7M device that exists for all v7M CPUs; put it under a CONFIG_ARM_V7M rather than hiding it under CONFIG_STELLARIS.
(We'll use CONFIG_ARM_V7M for the SysTick device too when we split it out of the NVIC.)
Message-id: [email protected]
--- hw/intc/Makefile.objs | 2 +- default-configs/arm-softmmu.mak | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
hw/intc/Makefile.objs +1 -1
@@ -24,7 +24,7 @@ obj-$(CONFIG_APIC) += apic.o apic_common.o obj-$(CONFIG_ARM_GIC_KVM) += arm_gic_kvm.o obj-$(call land,$(CONFIG_ARM_GIC_KVM),$(TARGET_AARCH64)) += arm_gicv3_kvm.o obj-$(call land,$(CONFIG_ARM_GIC_KVM),$(TARGET_AARCH64)) += arm_gicv3_its_kvm.o -obj-$(CONFIG_STELLARIS) += armv7m_nvic.o +obj-$(CONFIG_ARM_V7M) += armv7m_nvic.o obj-$(CONFIG_EXYNOS4) += exynos4210_gic.o exynos4210_combiner.o obj-$(CONFIG_GRLIB) += grlib_irqmp.o obj-$(CONFIG_IOAPIC) += ioapic.o
default-configs/arm-softmmu.mak +2 -0
@@ -42,6 +42,8 @@ CONFIG_ARM11MPCORE=y CONFIG_A9MPCORE=y CONFIG_A15MPCORE=y +CONFIG_ARM_V7M=y + CONFIG_ARM_GIC=y CONFIG_ARM_GIC_KVM=$(CONFIG_KVM) CONFIG_ARM_TIMER=y
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 07/21] armv7m: Make bitband device take the address space to access
In reply to Peter MaydellInstead of the bitband device doing a cpu_physical_memory_read/write, make it take a MemoryRegion which specifies where it should be accessing, and use address_space_read/write to access the corresponding AddressSpace.
Since this entails pretty much a rewrite, convert away from old_mmio in the process.
Message-id: [email protected]
--- include/hw/arm/armv7m.h | 2 + hw/arm/armv7m.c | 166 +++++++++++++++++++++++------------------------- 2 files changed, 81 insertions(+), 87 deletions(-)
include/hw/arm/armv7m.h +2 -0
@@ -21,8 +21,10 @@ typedef struct {SysBusDevice parent_obj;/*< public >*/ +AddressSpace *source_as;MemoryRegion iomem;uint32_t base; +MemoryRegion *source_memory; } BitBandState;#define TYPE_ARMV7M "armv7m"
hw/arm/armv7m.c +79 -87
205 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 10/21] stm32f205: Create armv7m object without using armv7m_init()
In reply to Peter MaydellSwitch the stm32f205 SoC to create the armv7m object directly rather than via the armv7m_init() wrapper. This fits better with the SoC model's very QOMified design.
In particular this means we can push loading the guest image out to the top level board code where it belongs, rather than the SoC object having a QOM property for the filename to load.
Message-id: [email protected]
--- include/hw/arm/stm32f205_soc.h | 4 +++- hw/arm/netduino2.c | 7 ++++--- hw/arm/stm32f205_soc.c | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 7 deletions(-)
include/hw/arm/stm32f205_soc.h +3 -1
@@ -31,6 +31,7 @@#include "hw/adc/stm32f2xx_adc.h" #include "hw/or-irq.h" #include "hw/ssi/stm32f2xx_spi.h" +#include "hw/arm/armv7m.h" #define TYPE_STM32F205_SOC "stm32f205-soc"#define STM32F205_SOC (obj) \
@@ -51,9 +52,10 @@ typedef struct STM32F205State {SysBusDevice parent_obj;/*< public >*/ -char *kernel_filename;char *cpu_model; +ARMv7MState armv7m; +STM32F2XXSyscfgState syscfg;STM32F2XXUsartState usart[STM_NUM_USARTS ];STM32F2XXTimerState timer[STM_NUM_TIMERS ];
hw/arm/netduino2.c +4 -3
@@ -27,17 +27,18 @@#include "hw/boards.h" #include "qemu/error-report.h" #include "hw/arm/stm32f205_soc.h" +#include "hw/arm/arm.h" static void netduino2_init (MachineState *machine) {DeviceState *dev; dev =qdev_create (NULL ,TYPE_STM32F205_SOC ); -if (machine->kernel_filename) { -qdev_prop_set_string (dev,"kernel-filename" , machine->kernel_filename); - }qdev_prop_set_string (dev,"cpu-model" ,"cortex-m3" );object_property_set_bool (OBJECT (dev), true,"realized" , &error_fatal); + +armv7m_load_kernel (ARM_CPU (first_cpu), machine->kernel_filename, +FLASH_SIZE ); }static void netduino2_machine_init (MachineClass *mc)
hw/arm/stm32f205_soc.c +13 -3
@@ -49,6 +49,9 @@ static void stm32f205_soc_initfn(Object *obj)STM32F205State *s =STM32F205_SOC (obj);int i; +object_initialize (&s->armv7m,sizeof (s->armv7m),TYPE_ARMV7M ); +qdev_set_parent_bus (DEVICE (&s->armv7m),sysbus_get_default ()); +object_initialize (&s->syscfg,sizeof (s->syscfg),TYPE_STM32F2XX_SYSCFG );qdev_set_parent_bus (DEVICE (&s->syscfg),sysbus_get_default ());
@@ -110,8 +113,16 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)vmstate_register_ram_global (sram);memory_region_add_subregion (system_memory,SRAM_BASE_ADDRESS , sram); - nvic =armv7m_init (get_system_memory (),FLASH_SIZE ,96 , - s->kernel_filename, s->cpu_model); + nvic =DEVICE (&s->armv7m); +qdev_prop_set_uint32 (nvic,"num-irq" ,96 ); +qdev_prop_set_string (nvic,"cpu-model" , s->cpu_model); +object_property_set_link (OBJECT (&s->armv7m),OBJECT (get_system_memory ()), +"memory" , &error_abort); +object_property_set_bool (OBJECT (&s->armv7m), true,"realized" , &err); +if (err !=NULL ) { +error_propagate (errp, err); +return ; + }/* System configuration controller */ dev =DEVICE (&s->syscfg);
@@ -192,7 +203,6 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) }static Property stm32f205_soc_properties[] = { -DEFINE_PROP_STRING ("kernel-filename" , STM32F205State, kernel_filename),DEFINE_PROP_STRING ("cpu-model" , STM32F205State, cpu_model),DEFINE_PROP_END_OF_LIST (), };
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 11/21] stm32f205: Rename 'nvic' local to 'armv7m'
In reply to Peter MaydellThe local variable 'nvic' in stm32f205_soc_realize() no longer holds a direct pointer to the NVIC device; it is a pointer to the ARMv7M container object. Rename it 'armv7m' accordingly.
Message-id: [email protected]
--- hw/arm/stm32f205_soc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
hw/arm/stm32f205_soc.c +9 -9
@@ -85,7 +85,7 @@ static void stm32f205_soc_initfn(Object *obj)static void stm32f205_soc_realize (DeviceState *dev_soc,Error **errp) {STM32F205State *s =STM32F205_SOC (dev_soc); -DeviceState *dev, *nvic; +DeviceState *dev, *armv7m;SysBusDevice *busdev;Error *err =NULL ;int i;
@@ -113,9 +113,9 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)vmstate_register_ram_global (sram);memory_region_add_subregion (system_memory,SRAM_BASE_ADDRESS , sram); - nvic =DEVICE (&s->armv7m); -qdev_prop_set_uint32 (nvic,"num-irq" ,96 ); -qdev_prop_set_string (nvic,"cpu-model" , s->cpu_model); + armv7m =DEVICE (&s->armv7m); +qdev_prop_set_uint32 (armv7m,"num-irq" ,96 ); +qdev_prop_set_string (armv7m,"cpu-model" , s->cpu_model);object_property_set_link (OBJECT (&s->armv7m),OBJECT (get_system_memory ()),"memory" , &error_abort);object_property_set_bool (OBJECT (&s->armv7m), true,"realized" , &err);
@@ -133,7 +133,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) } busdev =SYS_BUS_DEVICE (dev);sysbus_mmio_map (busdev,0 ,0x40013800 ); -sysbus_connect_irq (busdev,0 ,qdev_get_gpio_in (nvic,71 )); +sysbus_connect_irq (busdev,0 ,qdev_get_gpio_in (armv7m,71 ));/* Attach UART (uses USART registers) and USART controllers */ for (i =0 ; i <STM_NUM_USARTS ; i++) {
@@ -147,7 +147,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) } busdev =SYS_BUS_DEVICE (dev);sysbus_mmio_map (busdev,0 , usart_addr[i]); -sysbus_connect_irq (busdev,0 ,qdev_get_gpio_in (nvic, usart_irq[i])); +sysbus_connect_irq (busdev,0 ,qdev_get_gpio_in (armv7m, usart_irq[i])); }/* Timer 2 to 5 */
@@ -161,7 +161,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) } busdev =SYS_BUS_DEVICE (dev);sysbus_mmio_map (busdev,0 , timer_addr[i]); -sysbus_connect_irq (busdev,0 ,qdev_get_gpio_in (nvic, timer_irq[i])); +sysbus_connect_irq (busdev,0 ,qdev_get_gpio_in (armv7m, timer_irq[i])); }/* ADC 1 to 3 */
@@ -173,7 +173,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)return ; }qdev_connect_gpio_out (DEVICE (s->adc_irqs),0 , -qdev_get_gpio_in (nvic,ADC_IRQ )); +qdev_get_gpio_in (armv7m,ADC_IRQ ));for (i =0 ; i <STM_NUM_ADCS ; i++) { dev =DEVICE (&(s->adc[i]));
@@ -198,7 +198,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) } busdev =SYS_BUS_DEVICE (dev);sysbus_mmio_map (busdev,0 , spi_addr[i]); -sysbus_connect_irq (busdev,0 ,qdev_get_gpio_in (nvic, spi_irq[i])); +sysbus_connect_irq (busdev,0 ,qdev_get_gpio_in (armv7m, spi_irq[i])); } }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 12/21] update-linux-headers: update for 4.11
In reply to Peter MaydellFrom: Paolo Bonzini <[email protected]>
The linux-headers/asm-arm/unistd.h file has been split in three sub-files, copy them along. However, building them requires setting ARCH rather than SRCARCH.
SRCARCH defaults to $(ARCH) anyway; to avoid future occurrence of the same problem use ARCH for all architectures where SRCARCH=ARCH. Currently these are all except x86, sparc, sh and tile.
Message-id: [email protected]
--- scripts/update-linux-headers.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
scripts/update-linux-headers.sh +12 -1
@@ -75,7 +75,13 @@ for arch in $ARCHLIST; do continue fi - make -C "$linux" INSTALL_HDR_PATH="$tmpdir" SRCARCH=$arch headers_install + if [ "$arch" = x86 ]; then + arch_var=SRCARCH + else + arch_var=ARCH + fi + + make -C "$linux" INSTALL_HDR_PATH="$tmpdir" $arch_var=$arch headers_install rm -rf "$output/linux-headers/asm-$arch" mkdir -p "$output/linux-headers/asm-$arch"
@@ -92,6 +98,11 @@ for arch in $ARCHLIST; do cp_portable "$tmpdir/include/asm/kvm_virtio.h" "$output/include/standard-headers/asm-s390/" cp_portable "$tmpdir/include/asm/virtio-ccw.h" "$output/include/standard-headers/asm-s390/" fi + if [ $arch = arm ]; then + cp "$tmpdir/include/asm/unistd-eabi.h" "$output/linux-headers/asm-arm/" + cp "$tmpdir/include/asm/unistd-oabi.h" "$output/linux-headers/asm-arm/" + cp "$tmpdir/include/asm/unistd-common.h" "$output/linux-headers/asm-arm/" + fi if [ $arch = x86 ]; then cp_portable "$tmpdir/include/asm/hyperv.h" "$output/include/standard-headers/asm-x86/" cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-x86/"
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 04/21] armv7m: Use QOMified armv7m object in armv7m_init()
In reply to Peter MaydellMake the legacy armv7m_init() function use the newly QOMified armv7m object rather than doing everything by hand.
We can return the armv7m object rather than the NVIC from armv7m_init() because its interface to the rest of the board (GPIOs, etc) is identical.
Message-id: [email protected]
--- hw/arm/armv7m.c | 49 ++++++++++++------------------------------------- 1 file changed, 12 insertions(+), 37 deletions(-)
hw/arm/armv7m.c +12 -37
@@ -131,21 +131,6 @@ static void bitband_init(Object *obj)sysbus_init_mmio (dev, &s->iomem); } -static void armv7m_bitband_init (void ) -{ -DeviceState *dev; - - dev =qdev_create (NULL ,TYPE_BITBAND ); -qdev_prop_set_uint32 (dev,"base" ,0x20000000 ); -qdev_init_nofail (dev); -sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 ,0x22000000 ); - - dev =qdev_create (NULL ,TYPE_BITBAND ); -qdev_prop_set_uint32 (dev,"base" ,0x40000000 ); -qdev_init_nofail (dev); -sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 ,0x42000000 ); -} -/* Board init. */ static const hwaddr bitband_input_addr[ARMV7M_NUM_BITBANDS ] = {
@@ -282,35 +267,25 @@ static void armv7m_reset(void *opaque)/* Init CPU and memory for a v7-M based board. mem_size is in bytes. -Returns the NVIC array. */ +Returns the ARMv7M device. */ DeviceState *armv7m_init (MemoryRegion *system_memory,int mem_size,int num_irq,const char *kernel_filename,const char *cpu_model) { -ARMCPU *cpu; -CPUARMState *env; -DeviceState *nvic; +DeviceState *armv7m;if (cpu_model ==NULL ) { - cpu_model ="cortex-m3" ; + cpu_model ="cortex-m3" ; } - cpu =cpu_arm_init (cpu_model); -if (cpu ==NULL ) { -fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); - } - env = &cpu->env; - -armv7m_bitband_init (); - - nvic =qdev_create (NULL ,"armv7m_nvic" ); -qdev_prop_set_uint32 (nvic,"num-irq" , num_irq); - env->nvic = nvic; -qdev_init_nofail (nvic); -sysbus_connect_irq (SYS_BUS_DEVICE (nvic),0 , -qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_IRQ )); -armv7m_load_kernel (cpu, kernel_filename, mem_size); -return nvic; + + armv7m =qdev_create (NULL ,"armv7m" ); +qdev_prop_set_uint32 (armv7m,"num-irq" , num_irq); +qdev_prop_set_string (armv7m,"cpu-model" , cpu_model); +/* This will exit with an error if the user passed us a bad cpu_model */ +qdev_init_nofail (armv7m); + +armv7m_load_kernel (ARM_CPU (first_cpu), kernel_filename, mem_size); +return armv7m; }void armv7m_load_kernel (ARMCPU *cpu,const char *kernel_filename,int mem_size)
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 06/21] armv7m: Make NVIC expose a memory region rather than mapping itself
In reply to Peter MaydellMake the NVIC device expose a memory region for its users to map, rather than mapping itself into the system memory space on realize, and get the one user (the ARMv7M object) to do this.
Message-id: [email protected]
--- hw/arm/armv7m.c | 7 ++++++- hw/intc/armv7m_nvic.c | 7 ++----- 2 files changed, 8 insertions(+), 6 deletions(-)
hw/arm/armv7m.c +6 -1
@@ -171,6 +171,7 @@ static void armv7m_instance_init(Object *obj)static void armv7m_realize (DeviceState *dev,Error **errp) {ARMv7MState *s =ARMV7M (dev); +SysBusDevice *sbd;Error *err =NULL ;int i;char **cpustr;
@@ -232,10 +233,14 @@ static void armv7m_realize(DeviceState *dev, Error **errp)qdev_pass_gpios (DEVICE (&s->nvic), dev,"SYSRESETREQ" );/* Wire the NVIC up to the CPU */ -sysbus_connect_irq (SYS_BUS_DEVICE (&s->nvic),0 , + sbd =SYS_BUS_DEVICE (&s->nvic); +sysbus_connect_irq (sbd,0 ,qdev_get_gpio_in (DEVICE (s->cpu),ARM_CPU_IRQ )); s->cpu->env.nvic = &s->nvic; +memory_region_add_subregion (&s->container,0xe000e000 , +sysbus_mmio_get_region (sbd,0 )); +for (i =0 ; i <ARRAY_SIZE (s->bitband); i++) {Object *obj =OBJECT (&s->bitband[i]);SysBusDevice *sbd =SYS_BUS_DEVICE (&s->bitband[i]);
hw/intc/armv7m_nvic.c +2 -5
@@ -19,7 +19,6 @@#include "hw/arm/arm.h" #include "hw/arm/armv7m_nvic.h" #include "target/arm/cpu.h" -#include "exec/address-spaces.h" #include "qemu/log.h" #include "trace.h"
@@ -1043,10 +1042,8 @@ static void armv7m_nvic_realize(DeviceState *dev, Error **errp) "nvic_sysregs", 0x1000);memory_region_add_subregion (&s->container,0 , &s->sysregmem); -/* Map the whole thing into system memory at the location required -* by the v7M architecture. -*/ -memory_region_add_subregion (get_system_memory (),0xe000e000 , &s->container); +sysbus_init_mmio (SYS_BUS_DEVICE (dev), &s->container); + s->systick.timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , systick_timer_tick, s); }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 09/21] armv7m: Split systick out from NVIC
In reply to Peter MaydellThe SysTick timer isn't really part of the NVIC proper; we just modelled it that way back when we couldn't easily have devices that only occupied a small chunk of a memory region. Split it out into its own device.
Message-id: [email protected]
--- hw/timer/Makefile.objs | 1 + include/hw/arm/armv7m_nvic.h | 10 +- include/hw/timer/armv7m_systick.h | 34 ++++++ hw/intc/armv7m_nvic.c | 160 ++++++------------------- hw/timer/armv7m_systick.c | 240 ++++++++++++++++++++++++++++++++++++++ hw/timer/trace-events | 6 + 6 files changed, 318 insertions(+), 133 deletions(-) create mode 100644 include/hw/timer/armv7m_systick.h create mode 100644 hw/timer/armv7m_systick.c
hw/timer/Makefile.objs +1 -0
@@ -1,5 +1,6 @@ common-obj-$(CONFIG_ARM_TIMER) += arm_timer.o common-obj-$(CONFIG_ARM_MPTIMER) += arm_mptimer.o +common-obj-$(CONFIG_ARM_V7M) += armv7m_systick.o common-obj-$(CONFIG_A9_GTIMER) += a9gtimer.o common-obj-$(CONFIG_CADENCE) += cadence_ttc.o common-obj-$(CONFIG_DS1338) += ds1338.o
include/hw/arm/armv7m_nvic.h +3 -7
@@ -12,6 +12,7 @@#include "target/arm/cpu.h" #include "hw/sysbus.h" +#include "hw/timer/armv7m_systick.h" #define TYPE_NVIC "armv7m_nvic"
@@ -48,19 +49,14 @@ typedef struct NVICState {unsigned int vectpending;/* highest prio pending enabled exception */ int exception_prio;/* group prio of the highest prio active exception */ -struct { -uint32_t control; -uint32_t reload; -int64_t tick; -QEMUTimer *timer; - } systick; -MemoryRegion sysregmem;MemoryRegion container;uint32_t num_irq;qemu_irq excpout;qemu_irq sysresetreq; + + SysTickState systick; } NVICState;#endif
include/hw/timer/armv7m_systick.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* ARMv7M SysTick timer +* +* Copyright (c) 2006-2007 CodeSourcery. +* Written by Paul Brook +* Copyright (c) 2017 Linaro Ltd +* Written by Peter Maydell +* +* This code is licensed under the GPL (version 2 or later). +*/ + +#ifndef HW_TIMER_ARMV7M_SYSTICK_H +#define HW_TIMER_ARMV7M_SYSTICK_H + +#include "hw/sysbus.h" + +#define TYPE_SYSTICK "armv7m_systick" + +#define SYSTICK (obj) OBJECT_CHECK(SysTickState, (obj), TYPE_SYSTICK) + +typedef struct SysTickState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +uint32_t control; +uint32_t reload; +int64_t tick; +QEMUTimer *timer; +MemoryRegion iomem; +qemu_irq irq; +}SysTickState ; + +#endif
hw/intc/armv7m_nvic.c +34 -126
226 lines not on this page · raw message
hw/timer/armv7m_systick.c new file +240 -0
240 lines not on this page · raw message
hw/timer/trace-events +6 -0
@@ -49,3 +49,9 @@ aspeed_timer_ctrl_pulse_enable(uint8_t i, bool enable) "Timer %" PRIu8 ": %d" aspeed_timer_set_ctrl2(uint32_t value) "Value: 0x%" PRIx32 aspeed_timer_set_value(int timer, int reg, uint32_t value) "Timer %d register %d: 0x%" PRIx32 aspeed_timer_read(uint64_t offset, unsigned size, uint64_t value) "From 0x%" PRIx64 ": of size %u: 0x%" PRIx64 + +# hw/timer/armv7m_systick.c +systick_reload(void) "systick reload" +systick_timer_tick(void) "systick reload" +systick_read(uint64_t addr, uint32_t value, unsigned size) "systick read addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u" +systick_write(uint64_t addr, uint32_t value, unsigned size) "systick write addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u"
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 14/21] hw/intc/arm_gicv3_kvm: Add ICC_SRE_EL1 register to vmstate
In reply to Peter MaydellFrom: Vijaya Kumar K <[email protected]>
To Save and Restore ICC_SRE_EL1 register introduce vmstate subsection and load only if non-zero.
Also initialize icc_sre_el1 with to 0x7 in pre_load function.
Message-id: [email protected]
--- include/hw/intc/arm_gicv3_common.h | 1 + hw/intc/arm_gicv3_common.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+)
include/hw/intc/arm_gicv3_common.h +1 -0
@@ -172,6 +172,7 @@ struct GICv3CPUState {uint8_t gicr_ipriorityr[GIC_INTERNAL ];/* CPU interface */ +uint64_t icc_sre_el1;uint64_t icc_ctlr_el1[2 ];uint64_t icc_pmr_el1;uint64_t icc_bpr[3 ];
hw/intc/arm_gicv3_common.c +36 -0
@@ -70,6 +70,38 @@ static const VMStateDescription vmstate_gicv3_cpu_virt = { } }; +static int icc_sre_el1_reg_pre_load (void *opaque) +{ +GICv3CPUState *cs = opaque; + +/* +* If the sre_el1 subsection is not transferred this +* means SRE_EL1 is 0x7 (which might not be the same as +* our reset value). +*/ + cs->icc_sre_el1 =0x7 ; +return 0 ; +} + +static bool icc_sre_el1_reg_needed (void *opaque) +{ +GICv3CPUState *cs = opaque; + +return cs->icc_sre_el1 !=7 ; +} + +const VMStateDescription vmstate_gicv3_cpu_sre_el1 = { + .name ="arm_gicv3_cpu/sre_el1" , + .version_id =1 , + .minimum_version_id =1 , + .pre_load = icc_sre_el1_reg_pre_load, + .needed = icc_sre_el1_reg_needed, + .fields = (VMStateField []) { +VMSTATE_UINT64 (icc_sre_el1, GICv3CPUState), +VMSTATE_END_OF_LIST () + } +}; +static const VMStateDescription vmstate_gicv3_cpu = { .name ="arm_gicv3_cpu" , .version_id =1 ,
@@ -100,6 +132,10 @@ static const VMStateDescription vmstate_gicv3_cpu = { .subsections = (const VMStateDescription * []) { &vmstate_gicv3_cpu_virt,NULL + }, + .subsections = (const VMStateDescription * []) { + &vmstate_gicv3_cpu_sre_el1, +NULL } };
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 16/21] target-arm: Add GICv3CPUState in CPUARMState struct
In reply to Peter MaydellFrom: Vijaya Kumar K <[email protected]>
Add gicv3state void pointer to CPUARMState struct to store GICv3CPUState.
In case of usecase like CPU reset, we need to reset GICv3CPUState of the CPU. In such scenario, this pointer becomes handy.
Message-id: [email protected]
--- hw/intc/gicv3_internal.h | 2 ++ target/arm/cpu.h | 2 ++ hw/intc/arm_gicv3_common.c | 2 ++ hw/intc/arm_gicv3_cpuif.c | 8 ++++++++ 4 files changed, 14 insertions(+)
hw/intc/gicv3_internal.h +2 -0
@@ -408,4 +408,6 @@ static inline void gicv3_cache_all_target_cpustates(GICv3State *s) } } +void gicv3_set_gicv3state (CPUState *cpu,GICv3CPUState *s); +#endif /* QEMU_ARM_GICV3_INTERNAL_H */
target/arm/cpu.h +2 -0
@@ -521,6 +521,8 @@ typedef struct CPUARMState {void *nvic;const struct arm_boot_info *boot_info; +/* Store GICv3CPUState to access from this struct */ +void *gicv3state; } CPUARMState;/**
hw/intc/arm_gicv3_common.c +2 -0
@@ -252,6 +252,8 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) s->cpu[i].cpu = cpu; s->cpu[i].gic = s; +/* Store GICv3CPUState in CPUARMState gicv3state pointer */ +gicv3_set_gicv3state (cpu, &s->cpu[i]);/* Pre-construct the GICR_TYPER: * For our implementation:
hw/intc/arm_gicv3_cpuif.c +8 -0
@@ -19,6 +19,14 @@#include "gicv3_internal.h" #include "cpu.h" +void gicv3_set_gicv3state (CPUState *cpu,GICv3CPUState *s) +{ +ARMCPU *arm_cpu =ARM_CPU (cpu); +CPUARMState *env = &arm_cpu->env; + + env->gicv3state = (void *)s; +}; +static GICv3CPUState *icc_cs_from_env (CPUARMState *env) {/* Given the CPU, find the right GICv3CPUState struct.
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 18/21] qdev: Have qdev_set_parent_bus() handle devices already on a bus
In reply to Peter MaydellInstead of qdev_set_parent_bus() silently doing the wrong thing if it's handed a device that's already on a bus, have it remove the device from the old bus and add it to the new one. This is useful for the raspi2 sdcard.
Message-id: [email protected]
--- hw/core/qdev.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
hw/core/qdev.c +14 -0
@@ -102,9 +102,23 @@ static void bus_add_child(BusState *bus, DeviceState *child)void qdev_set_parent_bus (DeviceState *dev,BusState *bus) { +bool replugging = dev->parent_bus !=NULL ; + +if (replugging) { +/* Keep a reference to the device while it's not plugged into +* any bus, to avoid it potentially evaporating when it is +* dereffed in bus_remove_child(). +*/ +object_ref (OBJECT (dev)); +bus_remove_child (dev->parent_bus, dev); +object_unref (OBJECT (dev->parent_bus)); + } dev->parent_bus = bus;object_ref (OBJECT (bus));bus_add_child (bus, dev); +if (replugging) { +object_unref (OBJECT (dev)); + } }/* Create a new device. This only initializes the device state
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 17/21] hw/intc/arm_gicv3_kvm: Reset GICv3 cpu interface registers
In reply to Peter MaydellFrom: Vijaya Kumar K <[email protected]>
Reset CPU interface registers of GICv3 when CPU is reset. For this, ARMCPRegInfo struct is registered with one ICC register whose resetfn is called when cpu is reset.
All the ICC registers are reset under one single register reset function instead of calling resetfn for each ICC register.
Message-id: [email protected]
--- hw/intc/arm_gicv3_kvm.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
hw/intc/arm_gicv3_kvm.c +60 -0
@@ -604,6 +604,32 @@ static void kvm_arm_gicv3_get(GICv3State *s) } } +static void arm_gicv3_icc_reset (CPUARMState *env,const ARMCPRegInfo *ri) +{ +ARMCPU *cpu; +GICv3State *s; +GICv3CPUState *c; + + c = (GICv3CPUState *)env->gicv3state; + s = c->gic; + cpu =ARM_CPU (c->cpu); + +/* Initialize to actual HW supported configuration */ +kvm_device_access (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS , +KVM_VGIC_ATTR (ICC_CTLR_EL1 , cpu->mp_affinity), + &c->icc_ctlr_el1[GICV3_NS ], false); + + c->icc_ctlr_el1[GICV3_S ] = c->icc_ctlr_el1[GICV3_NS ]; + c->icc_pmr_el1 =0 ; + c->icc_bpr[GICV3_G0 ] =GIC_MIN_BPR ; + c->icc_bpr[GICV3_G1 ] =GIC_MIN_BPR ; + c->icc_bpr[GICV3_G1NS ] =GIC_MIN_BPR ; + + c->icc_sre_el1 =0x7 ; +memset (c->icc_apr,0 ,sizeof (c->icc_apr)); +memset (c->icc_igrpen,0 ,sizeof (c->icc_igrpen)); +} +static void kvm_arm_gicv3_reset (DeviceState *dev) {GICv3State *s =ARM_GICV3_COMMON (dev);
@@ -621,6 +647,34 @@ static void kvm_arm_gicv3_reset(DeviceState *dev)kvm_arm_gicv3_put (s); } +/* +* CPU interface registers of GIC needs to be reset on CPU reset. +* For the calling arm_gicv3_icc_reset() on CPU reset, we register +* below ARMCPRegInfo. As we reset the whole cpu interface under single +* register reset, we define only one register of CPU interface instead +* of defining all the registers. +*/ +static const ARMCPRegInfo gicv3_cpuif_reginfo[] = { + { .name ="ICC_CTLR_EL1" , .state =ARM_CP_STATE_BOTH , + .opc0 =3 , .opc1 =0 , .crn =12 , .crm =12 , .opc2 =4 , +/* +* If ARM_CP_NOP is used, resetfn is not called, +* So ARM_CP_NO_RAW is appropriate type. +*/ + .type =ARM_CP_NO_RAW , + .access =PL1_RW , + .readfn = arm_cp_read_zero, + .writefn = arm_cp_write_ignore, +/* +* We hang the whole cpu interface reset routine off here +* rather than parcelling it out into one little function +* per register +*/ + .resetfn = arm_gicv3_icc_reset, + }, +REGINFO_SENTINEL +}; +static void kvm_arm_gicv3_realize (DeviceState *dev,Error **errp) {GICv3State *s =KVM_ARM_GICV3 (dev);
@@ -644,6 +698,12 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)gicv3_init_irqs_and_mmio (s, kvm_arm_gicv3_set_irq,NULL ); +for (i =0 ; i < s->num_cpu; i++) { +ARMCPU *cpu =ARM_CPU (qemu_get_cpu (i)); + +define_arm_cp_regs (cpu, gicv3_cpuif_reginfo); + } +/* Try to create the device via the device control API */ s->dev_fd =kvm_create_device (kvm_state,KVM_DEV_TYPE_ARM_VGIC_V3 , false);if (s->dev_fd <0 ) {
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 19/21] hw/sd: add card-reparenting function
In reply to Peter MaydellFrom: Clement Deschamps <[email protected]>
Provide a new function sdbus_reparent_card() in sd core for reparenting a card from a SDBus to another one.
This function is required by the raspi platform, where the two SD controllers can be dynamically switched.
Message-id: [email protected]
Message-id: [email protected]
[PMM: added a doc comment to the header file; changed to
use new behaviour of qdev_set_parent_bus()]
--- include/hw/sd/sd.h | 11 +++++++++++ hw/sd/core.c | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+)
include/hw/sd/sd.h +11 -0
@@ -140,6 +140,17 @@ uint8_t sdbus_read_data(SDBus *sd);bool sdbus_data_ready (SDBus *sd);bool sdbus_get_inserted (SDBus *sd);bool sdbus_get_readonly (SDBus *sd); +/** +* sdbus_reparent_card: Reparent an SD card from one controller to another +* @from: controller bus to remove card from +* @to: controller bus to move card to +* +* Reparent an SD card, effectively unplugging it from one controller +* and inserting it into another. This is useful for SoCs like the +* bcm2835 which have two SD controllers and connect a single SD card +* to them, selected by the guest reprogramming GPIO line routing. +*/ +void sdbus_reparent_card (SDBus *from,SDBus *to);/* Functions to be used by SD devices to report back to qdevified controllers */ void sdbus_set_inserted (SDBus *sd,bool inserted);
hw/sd/core.c +27 -0
@@ -131,6 +131,33 @@ void sdbus_set_readonly(SDBus *sdbus, bool readonly) } } +void sdbus_reparent_card (SDBus *from,SDBus *to) +{ +SDState *card =get_card (from); +SDCardClass *sc; +bool readonly; + +/* We directly reparent the card object rather than implementing this +* as a hotpluggable connection because we don't want to expose SD cards +* to users as being hotpluggable, and we can get away with it in this +* limited use case. This could perhaps be implemented more cleanly in +* future by adding support to the hotplug infrastructure for "device +* can be hotplugged only via code, not by user". +*/ + +if (!card) { +return ; + } + + sc =SD_CARD_GET_CLASS (card); + readonly = sc->get_readonly (card); + +sdbus_set_inserted (from, false); +qdev_set_parent_bus (DEVICE (card), &to->qbus); +sdbus_set_inserted (to, true); +sdbus_set_readonly (to, readonly); +} +static const TypeInfo sd_bus_info = { .name =TYPE_SD_BUS , .parent =TYPE_BUS ,
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 15/21] hw/intc/arm_gicv3_kvm: Implement get/put functions
In reply to Peter MaydellFrom: Vijaya Kumar K <[email protected]>
This actually implements pre_save and post_load methods for in-kernel vGICv3.
Message-id: [email protected] [PMM:
* use decimal, not 0bnnn
* fixed typo in names of ICC_APR0R_EL1 and ICC_AP1R_EL1
* completely rearranged the get and put functions to read and write the state in a natural order, rather than mixing distributor and redistributor state together]
[Vijay:
* Update macro KVM_VGIC_ATTR
* Use 32 bit access for gicd and gicr
* GICD_IROUTER, GICD_TYPER, GICR_PROPBASER and GICR_PENDBASER reg access are changed from 64-bit to 32-bit access
* Add ICC_SRE_EL1 save and restore
* Dropped translate_fn mechanism and coded functions to handle save and restore of edge_trigger and priority
* Number of APnR register saved/restored based on number of priority bits supported]
--- hw/intc/gicv3_internal.h | 1 + hw/intc/arm_gicv3_kvm.c | 573 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 558 insertions(+), 16 deletions(-)
hw/intc/gicv3_internal.h +1 -0
@@ -138,6 +138,7 @@#define ICC_CTLR_EL1_EOIMODE (1U << 1)#define ICC_CTLR_EL1_PMHE (1U << 6)#define ICC_CTLR_EL1_PRIBITS_SHIFT 8 +#define ICC_CTLR_EL1_PRIBITS_MASK (7U << ICC_CTLR_EL1_PRIBITS_SHIFT)#define ICC_CTLR_EL1_IDBITS_SHIFT 11#define ICC_CTLR_EL1_SEIS (1U << 14)#define ICC_CTLR_EL1_A3V (1U << 15)
hw/intc/arm_gicv3_kvm.c +557 -16
617 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 20/21] bcm2835_gpio: add bcm2835 gpio controller
In reply to Peter MaydellFrom: Clement Deschamps <[email protected]>
This adds the BCM2835 GPIO controller.
It currently implements:
- The 54 GPIOs as outputs (qemu_irq)
- The SD controller selection via alternate function of GPIOs 48-53
Message-id: [email protected]
Message-id: [email protected]
--- hw/gpio/Makefile.objs | 1 + include/hw/gpio/bcm2835_gpio.h | 39 +++++ hw/gpio/bcm2835_gpio.c | 353 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 393 insertions(+) create mode 100644 include/hw/gpio/bcm2835_gpio.h create mode 100644 hw/gpio/bcm2835_gpio.c
hw/gpio/Makefile.objs +1 -0
@@ -7,3 +7,4 @@ common-obj-$(CONFIG_GPIO_KEY) += gpio_key.o obj-$(CONFIG_OMAP) += omap_gpio.o obj-$(CONFIG_IMX) += imx_gpio.o +obj-$(CONFIG_RASPI) += bcm2835_gpio.o
include/hw/gpio/bcm2835_gpio.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* Raspberry Pi (BCM2835) GPIO Controller +* +* Copyright (c) 2017 Antfield SAS +* +* Authors: +* Clement Deschamps <[email protected]> +* Luc Michel <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ + +#ifndef BCM2835_GPIO_H +#define BCM2835_GPIO_H + +#include "hw/sd/sd.h" + +typedef struct BCM2835GpioState { +SysBusDevice parent_obj; + +MemoryRegion iomem; + +/* SDBus selector */ +SDBus sdbus; +SDBus *sdbus_sdhci; +SDBus *sdbus_sdhost; + +uint8_t fsel[54 ]; +uint32_t lev0, lev1; +uint8_t sd_fsel; +qemu_irq out[54 ]; +}BCM2835GpioState ; + +#define TYPE_BCM2835_GPIO "bcm2835_gpio" +#define BCM2835_GPIO (obj) \ + OBJECT_CHECK(BCM2835GpioState, (obj), TYPE_BCM2835_GPIO) + +#endif
hw/gpio/bcm2835_gpio.c new file +353 -0
353 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 21/21] bcm2835: add sdhost and gpio controllers
In reply to Peter MaydellFrom: Clement Deschamps <[email protected]>
This adds the bcm2835_sdhost and bcm2835_gpio to the BCM2835 platform.
For supporting the SD controller selection (alternate function of GPIOs 48-53), the bcm2835_gpio now exposes an sdbus.
It also has a link to both the sdbus of sdhci and sdhost controllers, and the card is reparented from one bus to another when the alternate function of GPIOs 48-53 is modified.
Message-id: [email protected]
Message-id: [email protected]
--- include/hw/arm/bcm2835_peripherals.h | 4 ++++ hw/arm/bcm2835_peripherals.c | 43 ++++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-)
include/hw/arm/bcm2835_peripherals.h +4 -0
@@ -22,6 +22,8 @@#include "hw/misc/bcm2835_rng.h" #include "hw/misc/bcm2835_mbox.h" #include "hw/sd/sdhci.h" +#include "hw/sd/bcm2835_sdhost.h" +#include "hw/gpio/bcm2835_gpio.h" #define TYPE_BCM2835_PERIPHERALS "bcm2835-peripherals"#define BCM2835_PERIPHERALS (obj) \
@@ -45,6 +47,8 @@ typedef struct BCM2835PeripheralState {BCM2835RngState rng;BCM2835MboxState mboxes;SDHCIState sdhci; +BCM2835SDHostState sdhost; + BCM2835GpioState gpio; } BCM2835PeripheralState;#endif /* BCM2835_PERIPHERALS_H */
hw/arm/bcm2835_peripherals.c +41 -2
72 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 13/21] update Linux headers to 4.11
In reply to Peter MaydellFrom: Paolo Bonzini <[email protected]>
virtio_mmio.h would be deleted; I am leaving it in though it was a mistake to add it.
--- include/standard-headers/asm-x86/hyperv.h | 8 + include/standard-headers/linux/input-event-codes.h | 2 +- include/standard-headers/linux/pci_regs.h | 25 ++ include/standard-headers/linux/virtio_ids.h | 1 + linux-headers/asm-arm/kvm.h | 15 + linux-headers/asm-arm/unistd-common.h | 357 ++++++++++++++++++ linux-headers/asm-arm/unistd-eabi.h | 5 + linux-headers/asm-arm/unistd-oabi.h | 17 + linux-headers/asm-arm/unistd.h | 419 +-------------------- linux-headers/asm-arm64/kvm.h | 13 + linux-headers/asm-powerpc/kvm.h | 27 ++ linux-headers/asm-powerpc/unistd.h | 1 + linux-headers/asm-x86/kvm_para.h | 13 +- linux-headers/linux/kvm.h | 24 +- linux-headers/linux/kvm_para.h | 2 + linux-headers/linux/userfaultfd.h | 67 +++- linux-headers/linux/vfio.h | 10 + 17 files changed, 577 insertions(+), 429 deletions(-) create mode 100644 linux-headers/asm-arm/unistd-common.h create mode 100644 linux-headers/asm-arm/unistd-eabi.h create mode 100644 linux-headers/asm-arm/unistd-oabi.h
include/standard-headers/asm-x86/hyperv.h +8 -0
@@ -73,6 +73,9 @@*/ #define HV_X64_MSR_STAT_PAGES_AVAILABLE (1 << 8) +/* Crash MSR available */ +#define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE (1 << 10) +/* * Feature identification: EBX indicates which flags were specified at * partition creation. The format is the same as the partition creation
@@ -144,6 +147,11 @@*/ #define HV_X64_RELAXED_TIMING_RECOMMENDED (1 << 5) +/* +* Crash notification flag. +*/ +#define HV_CRASH_CTL_CRASH_NOTIFY (1ULL << 63) +/* MSR used to identify the guest OS. */ #define HV_X64_MSR_GUEST_OS_ID 0x40000000
include/standard-headers/linux/input-event-codes.h +1 -1
@@ -640,7 +640,7 @@* Control a data application associated with the currently viewed channel, * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.) */ -#define KEY_DATA 0x275 +#define KEY_DATA 0x277#define BTN_TRIGGER_HAPPY 0x2c0#define BTN_TRIGGER_HAPPY1 0x2c0
include/standard-headers/linux/pci_regs.h +25 -0
@@ -23,6 +23,14 @@#define LINUX_PCI_REGS_H /* +* Conventional PCI and PCI-X Mode 1 devices have 256 bytes of +* configuration space. PCI-X Mode 2 and PCIe devices have 4096 bytes of +* configuration space. +*/ +#define PCI_CFG_SPACE_SIZE 256 +#define PCI_CFG_SPACE_EXP_SIZE 4096 + +/* * Under PCI, each device has 256 bytes of configuration address space, * of which the first 64 bytes are standardized as follows: */
@@ -674,6 +682,7 @@#define PCI_EXT_CAP_ID_PMUX 0x1A/* Protocol Multiplexing */ #define PCI_EXT_CAP_ID_PASID 0x1B/* Process Address Space ID */ #define PCI_EXT_CAP_ID_DPC 0x1D/* Downstream Port Containment */ +#define PCI_EXT_CAP_ID_L1SS 0x1E/* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1F/* Precision Time Measurement */ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PTM
@@ -965,6 +974,7 @@#define PCI_EXP_DPC_STATUS 8/* DPC Status */ #define PCI_EXP_DPC_STATUS_TRIGGER 0x01/* Trigger Status */ #define PCI_EXP_DPC_STATUS_INTERRUPT 0x08/* Interrupt Status */ +#define PCI_EXP_DPC_RP_BUSY 0x10/* Root Port Busy */ #define PCI_EXP_DPC_SOURCE_ID 10/* DPC Source Identifier */
@@ -977,4 +987,19 @@#define PCI_PTM_CTRL_ENABLE 0x00000001/* PTM enable */ #define PCI_PTM_CTRL_ROOT 0x00000002/* Root select */ +/* L1 PM Substates */ +#define PCI_L1SS_CAP 4/* capability register */ +#define PCI_L1SS_CAP_PCIPM_L1_2 1/* PCI PM L1.2 Support */ +#define PCI_L1SS_CAP_PCIPM_L1_1 2/* PCI PM L1.1 Support */ +#define PCI_L1SS_CAP_ASPM_L1_2 4/* ASPM L1.2 Support */ +#define PCI_L1SS_CAP_ASPM_L1_1 8/* ASPM L1.1 Support */ +#define PCI_L1SS_CAP_L1_PM_SS 16/* L1 PM Substates Support */ +#define PCI_L1SS_CTL1 8/* Control Register 1 */ +#define PCI_L1SS_CTL1_PCIPM_L1_2 1/* PCI PM L1.2 Enable */ +#define PCI_L1SS_CTL1_PCIPM_L1_1 2/* PCI PM L1.1 Support */ +#define PCI_L1SS_CTL1_ASPM_L1_2 4/* ASPM L1.2 Support */ +#define PCI_L1SS_CTL1_ASPM_L1_1 8/* ASPM L1.1 Support */ +#define PCI_L1SS_CTL1_L1SS_MASK 0x0000000F +#define PCI_L1SS_CTL2 0xC/* Control Register 2 */ +#endif /* LINUX_PCI_REGS_H */
include/standard-headers/linux/virtio_ids.h +1 -0
@@ -43,4 +43,5 @@#define VIRTIO_ID_INPUT 18/* virtio input */ #define VIRTIO_ID_VSOCK 19/* virtio vsock transport */ #define VIRTIO_ID_CRYPTO 20/* virtio crypto */ +#endif /* _LINUX_VIRTIO_IDS_H */
linux-headers/asm-arm/kvm.h +15 -0
@@ -87,9 +87,11 @@ struct kvm_regs {/* Supported VGICv3 address types */ #define KVM_VGIC_V3_ADDR_TYPE_DIST 2#define KVM_VGIC_V3_ADDR_TYPE_REDIST 3 +#define KVM_VGIC_ITS_ADDR_TYPE 4#define KVM_VGIC_V3_DIST_SIZE SZ_64K#define KVM_VGIC_V3_REDIST_SIZE (2 * SZ_64K) +#define KVM_VGIC_V3_ITS_SIZE (2 * SZ_64K)#define KVM_ARM_VCPU_POWER_OFF 0/* CPU is started in OFF state */ #define KVM_ARM_VCPU_PSCI_0_2 1/* CPU uses PSCI v0.2 */
@@ -179,10 +181,23 @@ struct kvm_arch_memory_slot {#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2#define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT) +#define KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT 32 +#define KVM_DEV_ARM_VGIC_V3_MPIDR_MASK \ + (0xffffffffULL << KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT)#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT) +#define KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK (0xffff)#define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3#define KVM_DEV_ARM_VGIC_GRP_CTRL 4 +#define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5 +#define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6 +#define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \ + (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT) +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff +#define VGIC_LEVEL_INFO_LINE_LEVEL 0 +#define KVM_DEV_ARM_VGIC_CTRL_INIT 0/* KVM_IRQ_LINE irq field index values */
linux-headers/asm-arm/unistd-common.h new file +357 -0
357 lines not on this page · raw message
linux-headers/asm-arm/unistd-eabi.h new file +5 -0
@@ -0,0 +1,5 @@ +#ifndef _ASM_ARM_UNISTD_EABI_H +#define _ASM_ARM_UNISTD_EABI_H 1 + + +#endif /* _ASM_ARM_UNISTD_EABI_H */
linux-headers/asm-arm/unistd-oabi.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef _ASM_ARM_UNISTD_OABI_H +#define _ASM_ARM_UNISTD_OABI_H 1 + +#define __NR_time (__NR_SYSCALL_BASE + 13) +#define __NR_umount (__NR_SYSCALL_BASE + 22) +#define __NR_stime (__NR_SYSCALL_BASE + 25) +#define __NR_alarm (__NR_SYSCALL_BASE + 27) +#define __NR_utime (__NR_SYSCALL_BASE + 30) +#define __NR_getrlimit (__NR_SYSCALL_BASE + 76) +#define __NR_select (__NR_SYSCALL_BASE + 82) +#define __NR_readdir (__NR_SYSCALL_BASE + 89) +#define __NR_mmap (__NR_SYSCALL_BASE + 90) +#define __NR_socketcall (__NR_SYSCALL_BASE + 102) +#define __NR_syscall (__NR_SYSCALL_BASE + 113) +#define __NR_ipc (__NR_SYSCALL_BASE + 117) + +#endif /* _ASM_ARM_UNISTD_OABI_H */
linux-headers/asm-arm/unistd.h +3 -416
434 lines not on this page · raw message
linux-headers/asm-arm64/kvm.h +13 -0
@@ -201,10 +201,23 @@ struct kvm_arch_memory_slot {#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2#define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT) +#define KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT 32 +#define KVM_DEV_ARM_VGIC_V3_MPIDR_MASK \ + (0xffffffffULL << KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT)#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT) +#define KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK (0xffff)#define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3#define KVM_DEV_ARM_VGIC_GRP_CTRL 4 +#define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5 +#define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6 +#define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10 +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \ + (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT) +#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff +#define VGIC_LEVEL_INFO_LINE_LEVEL 0 +#define KVM_DEV_ARM_VGIC_CTRL_INIT 0/* Device Control API on vcpu fd */
linux-headers/asm-powerpc/kvm.h +27 -0
@@ -413,6 +413,26 @@ struct kvm_get_htab_header {__u16 n_invalid; }; +/* For KVM_PPC_CONFIGURE_V3_MMU */ +struct kvm_ppc_mmuv3_cfg { +__u64 flags; +__u64 process_table;/* second doubleword of partition table entry */ +}; + +/* Flag values for KVM_PPC_CONFIGURE_V3_MMU */ +#define KVM_PPC_MMUV3_RADIX 1/* 1 = radix mode, 0 = HPT */ +#define KVM_PPC_MMUV3_GTSE 2/* global translation shootdown enb. */ + +/* For KVM_PPC_GET_RMMU_INFO */ +struct kvm_ppc_rmmu_info { +struct kvm_ppc_radix_geom { +__u8 page_shift; +__u8 level_bits[4 ]; +__u8 pad[3 ]; + } geometries[8 ]; +__u32 ap_encodings[8 ]; +}; +/* Per-vcpu XICS interrupt controller state */ #define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c)
@@ -573,6 +593,10 @@ struct kvm_get_htab_header {#define KVM_REG_PPC_SPRG9 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba)#define KVM_REG_PPC_DBSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbb) +/* POWER9 registers */ +#define KVM_REG_PPC_TIDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbc) +#define KVM_REG_PPC_PSSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbd) +/* Transactional Memory checkpointed state: * This is all GPRs, all VSX regs and a subset of SPRs */
@@ -596,6 +620,7 @@ struct kvm_get_htab_header {#define KVM_REG_PPC_TM_VSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U32 | 0x67)#define KVM_REG_PPC_TM_DSCR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x68)#define KVM_REG_PPC_TM_TAR (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x69) +#define KVM_REG_PPC_TM_XER (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x6a)/* PPC64 eXternal Interrupt Controller Specification */ #define KVM_DEV_XICS_GRP_SOURCES 1/* 64-bit source attributes */
@@ -608,5 +633,7 @@ struct kvm_get_htab_header {#define KVM_XICS_LEVEL_SENSITIVE (1ULL << 40)#define KVM_XICS_MASKED (1ULL << 41)#define KVM_XICS_PENDING (1ULL << 42) +#define KVM_XICS_PRESENTED (1ULL << 43) +#define KVM_XICS_QUEUED (1ULL << 44)#endif /* __LINUX_KVM_POWERPC_H */
linux-headers/asm-powerpc/unistd.h +1 -0
@@ -392,5 +392,6 @@#define __NR_copy_file_range 379#define __NR_preadv2 380#define __NR_pwritev2 381 +#define __NR_kexec_file_load 382#endif /* _ASM_POWERPC_UNISTD_H_ */
linux-headers/asm-x86/kvm_para.h +12 -1
@@ -45,7 +45,18 @@ struct kvm_steal_time {__u64 steal;__u32 version;__u32 flags; -__u32 pad[12 ]; +__u8 preempted; +__u8 u8_pad[3 ]; +__u32 pad[11 ]; +}; + +#define KVM_CLOCK_PAIRING_WALLCLOCK 0 +struct kvm_clock_pairing { +__s64 sec; +__s64 nsec; +__u64 tsc; +__u32 flags; +__u32 pad[9 ]; };#define KVM_STEAL_ALIGNMENT_BITS 5
linux-headers/linux/kvm.h +22 -2
@@ -218,7 +218,8 @@ struct kvm_hyperv_exit {struct kvm_run {/* in */ __u8 request_interrupt_window; -__u8 padding1[7 ]; +__u8 immediate_exit; +__u8 padding1[6 ];/* out */ __u32 exit_reason;
@@ -651,6 +652,9 @@ struct kvm_enable_cap { };/* for KVM_PPC_GET_PVINFO */ + +#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) +struct kvm_ppc_pvinfo {/* out */ __u32 flags;
@@ -682,7 +686,12 @@ struct kvm_ppc_smmu_info {struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ ]; }; -#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) +/* for KVM_PPC_RESIZE_HPT_{PREPARE,COMMIT} */ +struct kvm_ppc_resize_hpt { +__u64 flags; +__u32 shift; +__u32 pad; +};#define KVMIO 0xAE
@@ -870,6 +879,10 @@ struct kvm_ppc_smmu_info {#define KVM_CAP_S390_USER_INSTR0 130#define KVM_CAP_MSI_DEVID 131#define KVM_CAP_PPC_HTM 132 +#define KVM_CAP_SPAPR_RESIZE_HPT 133 +#define KVM_CAP_PPC_MMU_RADIX 134 +#define KVM_CAP_PPC_MMU_HASH_V3 135 +#define KVM_CAP_IMMEDIATE_EXIT 136#ifdef KVM_CAP_IRQ_ROUTING
@@ -1186,6 +1199,13 @@ struct kvm_s390_ucas_mapping {#define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr)/* Available with KVM_CAP_PPC_RTAS */ #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO, 0xac, struct kvm_rtas_token_args) +/* Available with KVM_CAP_SPAPR_RESIZE_HPT */ +#define KVM_PPC_RESIZE_HPT_PREPARE _IOR(KVMIO, 0xad, struct kvm_ppc_resize_hpt) +#define KVM_PPC_RESIZE_HPT_COMMIT _IOR(KVMIO, 0xae, struct kvm_ppc_resize_hpt) +/* Available with KVM_CAP_PPC_RADIX_MMU or KVM_CAP_PPC_HASH_MMU_V3 */ +#define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg) +/* Available with KVM_CAP_PPC_RADIX_MMU */ +#define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info)/* ioctl for vm fd */ #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
linux-headers/linux/kvm_para.h +2 -0
@@ -14,6 +14,7 @@#define KVM_EFAULT EFAULT#define KVM_E2BIG E2BIG#define KVM_EPERM EPERM +#define KVM_EOPNOTSUPP 95#define KVM_HC_VAPIC_POLL_IRQ 1#define KVM_HC_MMU_OP 2
@@ -23,6 +24,7 @@#define KVM_HC_MIPS_GET_CLOCK_FREQ 6#define KVM_HC_MIPS_EXIT_VM 7#define KVM_HC_MIPS_CONSOLE_OUTPUT 8 +#define KVM_HC_CLOCK_PAIRING 9/* * hypercalls use architecture specific
linux-headers/linux/userfaultfd.h +58 -9
103 lines not on this page · raw message
linux-headers/linux/vfio.h +10 -0
@@ -203,6 +203,16 @@ struct vfio_device_info { };#define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7) +/* +* Vendor driver using Mediated device framework should provide device_api +* attribute in supported type attribute groups. Device API string should be one +* of the following corresponding to device flags in vfio_device_info structure. +*/ + +#define VFIO_DEVICE_API_PCI_STRING "vfio-pci" +#define VFIO_DEVICE_API_PLATFORM_STRING "vfio-platform" +#define VFIO_DEVICE_API_AMBA_STRING "vfio-amba" +/** * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8, * struct vfio_region_info)
Signature · 1 line
2.7.4
Peter Maydell
AppliedQuoted 23 lines · Peter Maydell
Second lot of ARM changes to sneak in before freeze:
* fixed version of the raspi2 sd controller patches
* GICv3 save/restore
* v7M QOMifyI've also included the Linux header update patches stolen from Paolo's pullreq since it hasn't quite hit master yet.
thanks
-- PMMThe following changes since commit
1bbe5dc66b770d7bedd1d51d7935da948a510dd6:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170228' into staging (2017-02-28 14:50:17 +0000)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.gittags/pull-target-arm-20170228-1for you to fetch changes up to
1eeb5c7deacbfb4d4cad17590a16a99f3d85eabb:bcm2835: add sdhost and gpio controllers (2017-02-28 17:10:00 +0000)
Quoted 9 lines
----------------------------------------------------------------
target-arm queue:
* raspi2: add gpio controller and sdhost controller, with the wiring so the guest can switch which controller the SD card is attached to
(this is sufficient to get raspbian kernels to boot)
* GICv3: support state save/restore from KVM
* update Linux headers to 4.11
* refactor and QOMify the ARMv7M container object
Applied, thanks.
-- PMM