s390x/kvm: Features and fixes for 2.3
Peter,
this pull reuqest contains a header sync to 4.0-rc3. This should cause no merge conflicts with other header syncs against 4.0-rc2. So here is the s390 pull request.
The following changes since commit 277263e1b320d759a760ba6c5ea75ec268f929e5:
Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging (2015-03-09 14:04:14 +0000)
are available in the git repository at:
git://github.com/borntraeger/qemu.git tags/s390x-20150310
for you to fetch changes up to 6342cb1443b37d249a0e2005128ade07a80a97f5:
s390-ccw: rebuild BIOS (2015-03-10 09:26:33 +0100)
----------------------------------------------------------------
s390x/kvm: Features and fixes for 2.3
- an extension to the elf loader to allow relocations
- make the ccw bios relocatable. This allows for bigger ramdisks or smaller guests
- Handle all slow SIGPs in QEMU (instead of kernel) for better compliance and correctness
- tell the KVM module the maximum guest size. This allows KVM to reduce the number or page table levels
- Several fixes/cleanups
----------------------------------------------------------------
Christian Borntraeger (4):
synchronize Linux headers to 4.0-rc3 s390-ccw.img: Allow bigger ramdisk sizes or offsets s390-ccw.img: Reinitialize guessing on reboot
s390-ccw: rebuild BIOS
David Hildenbrand (10):
s390x: introduce defines for SIGP condition codes
s390x/kvm: more details for SIGP handler with one destination vcpu
s390x/kvm: pass the SIGP instruction parameter to the SIGP handler
s390x/kvm: helper to set the SIGP status in SigpInfo
s390x/kvm: trace all SIGP orders
s390x/kvm: implement handling of new SIGP orders
s390x/kvm: SIGP START is only applicable when STOPPED
s390x: add function to deliver restart irqs
s390x/kvm: deliver SIGP RESTART directly if stopped
s390x/kvm: enable the new SIGP handling in user spaceDominik Dingel (1):
s390x/kvm: passing max memory size to accelerator
Markus Armbruster (3):
virtio-s390: s390_virtio_device_init() can't fail, simplify
virtio-s390: Convert to realize()
virtio-ccw: Convert to realize()
Thomas Huth (2):
elf-loader: Provide the possibility to relocate s390 ELF files s390/bios: Make the s390-ccw.img relocatable
hw/core/loader.c | 2 + hw/s390x/ipl.c | 23 +- hw/s390x/s390-virtio-bus.c | 97 ++++--- hw/s390x/s390-virtio-bus.h | 2 +- hw/s390x/s390-virtio-ccw.c | 10 + hw/s390x/virtio-ccw.c | 134 +++++---- hw/s390x/virtio-ccw.h | 2 +- include/elf.h | 2 + include/hw/elf_ops.h | 78 ++++++ include/standard-headers/linux/virtio_net.h | 54 ++-- linux-headers/asm-arm/kvm.h | 2 + linux-headers/asm-arm64/kvm.h | 9 + linux-headers/asm-s390/kvm.h | 37 +++ linux-headers/asm-x86/hyperv.h | 11 + linux-headers/linux/kvm.h | 20 +- pc-bios/s390-ccw.img | Bin 17752 -> 13616 bytes pc-bios/s390-ccw/Makefile | 11 +- pc-bios/s390-ccw/main.c | 1 + pc-bios/s390-ccw/s390-ccw.h | 1 + pc-bios/s390-ccw/virtio.c | 5 +- target-s390x/cpu.c | 2 + target-s390x/cpu.h | 40 ++- target-s390x/helper.c | 35 ++- target-s390x/kvm.c | 416 ++++++++++++++++++++++++---- target-s390x/machine.c | 5 +- target-s390x/misc_helper.c | 4 +- trace-events | 1 + 27 files changed, 780 insertions(+), 224 deletions(-)
[Qemu-devel] [PULL 05/20] s390x/kvm: helper to set the SIGP status in SigpInfo
From: David Hildenbrand <[email protected]>
Whenever we set the SIGP status in the status register, we have to wipe out the lower 4 bytes and keep the higher 4 bytes. Also the condition code will always be set to STATUS_STORED.
Let's introduce the wrapper for SigpInfo, as this will avoid most duplicate code in the future.
Message-Id: <[email protected]>
--- target-s390x/kvm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
target-s390x/kvm.c +8 -3
@@ -1118,6 +1118,13 @@ typedef struct SigpInfo {uint64_t *status_reg; } SigpInfo; +static void set_sigp_status (SigpInfo *si,uint64_t status) +{ + *si->status_reg &=0xffffffff00000000ULL ; + *si->status_reg |= status; + si->cc =SIGP_CC_STATUS_STORED ; +} +static void sigp_start (void *arg) {SigpInfo *si = arg;
@@ -1202,9 +1209,7 @@ static int handle_sigp_single_dst(S390CPU *dst_cpu, uint8_t order,break ;default :DPRINTF ("KVM: unknown SIGP: 0x%x\n" , order); - *status_reg &=0xffffffff00000000ULL ; - *status_reg |=SIGP_STAT_INVALID_ORDER ; - si.cc =SIGP_CC_STATUS_STORED ; +set_sigp_status (&si,SIGP_STAT_INVALID_ORDER ); }return si.cc;
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 06/20] s390x/kvm: trace all SIGP orders
In reply to Christian BorntraegerFrom: David Hildenbrand <[email protected]>
This patch adds tracing code for all SIGP orders (including the destination vcpu and the resulting condition code).
Message-Id: <[email protected]>
--- target-s390x/kvm.c | 4 +++- trace-events | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
target-s390x/kvm.c +3 -1
@@ -1131,7 +1131,6 @@ static void sigp_start(void *arg)s390_cpu_set_state (CPU_STATE_OPERATING , si->cpu); si->cc =SIGP_CC_ORDER_CODE_ACCEPTED ; -DPRINTF ("DONE: KVM cpu start: %p\n" , &si->cpu->env); }static void sigp_restart (void *arg)
@@ -1247,6 +1246,9 @@ static int handle_sigp(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) ret =handle_sigp_single_dst (dst_cpu, order, param, status_reg); } +trace_kvm_sigp_finished (order,CPU (cpu)->cpu_index, + dst_cpu ?CPU (dst_cpu)->cpu_index :-1 , ret); +if (ret >=0 ) {setcc (cpu, ret);return 0 ;
trace-events +1 -0
@@ -1581,6 +1581,7 @@ mhp_pc_dimm_assigned_address(uint64_t addr) "0x%"PRIx64 kvm_enable_cmma(int rc) "CMMA: enabling with result code %d" kvm_clear_cmma(int rc) "CMMA: clearing with result code %d" kvm_failed_cpu_state_set(int cpu_index, uint8_t state, const char *msg) "Warning: Unable to set cpu %d state %" PRIu8 " to KVM: %s" +kvm_sigp_finished(uint8_t order, int cpu_index, int dst_index, int cc) "SIGP: Finished order %u on cpu %d -> cpu %d with cc=%d" # hw/dma/i8257.c i8257_unregistered_dma(int nchan, int dma_pos, int dma_len) "unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d"
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 04/20] s390x/kvm: pass the SIGP instruction parameter to the SIGP handler
In reply to Christian BorntraegerFrom: David Hildenbrand <[email protected]>
The parameter of the SIGP instruction will be neded in the future. Let's read it out and store it in the struct sigp_info, so it can be passed to the sigp handlers.
Message-Id: <[email protected]>
--- target-s390x/kvm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
target-s390x/kvm.c +6 -2
@@ -1113,6 +1113,7 @@ static int handle_diag(S390CPU *cpu, struct kvm_run *run, uint32_t ipb)typedef struct SigpInfo {S390CPU *cpu; +uint64_t param;int cc;uint64_t *status_reg; }SigpInfo ;
@@ -1174,10 +1175,11 @@ static void sigp_cpu_reset(void *arg) }static int handle_sigp_single_dst (S390CPU *dst_cpu,uint8_t order, -uint64_t *status_reg) +uint64_t param,uint64_t *status_reg) {SigpInfo si = { .cpu = dst_cpu, + .param = param, .status_reg = status_reg, };
@@ -1218,6 +1220,7 @@ static int handle_sigp(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)int ret;uint8_t order;uint64_t *status_reg; +uint64_t param;S390CPU *dst_cpu =NULL ;cpu_synchronize_state (CPU (cpu));
@@ -1225,6 +1228,7 @@ static int handle_sigp(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)/* get order code */ order =decode_basedisp_rs (env, run->s390_sieic.ipb) &SIGP_ORDER_MASK ; status_reg = &env->regs[r1]; + param = (r1 %2 ) ? env->regs[r1] : env->regs[r1 +1 ];switch (order) {case SIGP_SET_ARCH :
@@ -1235,7 +1239,7 @@ static int handle_sigp(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)default :/* all other sigp orders target a single vcpu */ dst_cpu =s390_cpu_addr2state (env->regs[r3]); - ret =handle_sigp_single_dst (dst_cpu, order, status_reg); + ret =handle_sigp_single_dst (dst_cpu, order, param, status_reg); }if (ret >=0 ) {
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 08/20] s390x/kvm: SIGP START is only applicable when STOPPED
In reply to Christian BorntraegerFrom: David Hildenbrand <[email protected]>
In preparation for other CPU states, SIGP START will only start a VCPU if it is in the STOPPED state.
Message-Id: <[email protected]>
--- target-s390x/kvm.c | 5 +++++ 1 file changed, 5 insertions(+)
target-s390x/kvm.c +5 -0
@@ -1130,6 +1130,11 @@ static void sigp_start(void *arg) {SigpInfo *si = arg; +if (s390_cpu_get_state (si->cpu) !=CPU_STATE_STOPPED ) { + si->cc =SIGP_CC_ORDER_CODE_ACCEPTED ; +return ; + } +s390_cpu_set_state (CPU_STATE_OPERATING , si->cpu); si->cc =SIGP_CC_ORDER_CODE_ACCEPTED ; }
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 10/20] s390x/kvm: deliver SIGP RESTART directly if stopped
In reply to Christian BorntraegerFrom: David Hildenbrand <[email protected]>
According to the PoP, a restart irq has to be delivered "without first honoring any other pending interruptions", if a cpu is in the STOPPED state.
While it is hard to implement this case in kvm, it can easily be handled in qemu.
Message-Id: <[email protected]>
--- target-s390x/kvm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
target-s390x/kvm.c +11 -2
@@ -1254,8 +1254,17 @@ static void sigp_restart(void *arg) .type = KVM_S390_RESTART, }; -kvm_s390_vcpu_interrupt (si->cpu, &irq); -s390_cpu_set_state (CPU_STATE_OPERATING , si->cpu); +switch (s390_cpu_get_state (si->cpu)) { +case CPU_STATE_STOPPED : +/* the restart irq has to be delivered prior to any other pending irq */ +cpu_synchronize_state (CPU (si->cpu)); +do_restart_interrupt (&si->cpu->env); +s390_cpu_set_state (CPU_STATE_OPERATING , si->cpu); +break ; +case CPU_STATE_OPERATING : +kvm_s390_vcpu_interrupt (si->cpu, &irq); +break ; + } si->cc =SIGP_CC_ORDER_CODE_ACCEPTED ; }
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 02/20] s390x: introduce defines for SIGP condition codes
In reply to Christian BorntraegerFrom: David Hildenbrand <[email protected]>
This patch introduces defines for the SIGP condition codes and replaces all occurrences of numeral condition codes with the new defines.
Message-Id: <[email protected]>
--- target-s390x/cpu.h | 9 ++++++++- target-s390x/kvm.c | 14 +++++++------- target-s390x/misc_helper.c | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-)
target-s390x/cpu.h +8 -1
@@ -864,6 +864,7 @@ struct sysib_322 {#define SK_F (0x1 << 3)#define SK_ACC_MASK (0xf << 4) +/* SIGP order codes */ #define SIGP_SENSE 0x01#define SIGP_EXTERNAL_CALL 0x02#define SIGP_EMERGENCY 0x03
@@ -877,7 +878,13 @@ struct sysib_322 {#define SIGP_STORE_STATUS_ADDR 0x0e#define SIGP_SET_ARCH 0x12 -/* cpu status bits */ +/* SIGP condition codes */ +#define SIGP_CC_ORDER_CODE_ACCEPTED 0 +#define SIGP_CC_STATUS_STORED 1 +#define SIGP_CC_BUSY 2 +#define SIGP_CC_NOT_OPERATIONAL 3 + +/* SIGP status bits */ #define SIGP_STAT_EQUIPMENT_CHECK 0x80000000UL#define SIGP_STAT_INCORRECT_STATE 0x00000200UL#define SIGP_STAT_INVALID_PARAMETER 0x00000100UL
target-s390x/kvm.c +7 -7
@@ -1178,37 +1178,37 @@ static int handle_sigp(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) cpu_addr = env->regs[ipa1 &0x0f ]; target_cpu =s390_cpu_addr2state (cpu_addr);if (target_cpu ==NULL ) { - cc =3 ;/* not operational */ + cc =SIGP_CC_NOT_OPERATIONAL ; goto out; }switch (order_code) {case SIGP_START :run_on_cpu (CPU (target_cpu), sigp_cpu_start,CPU (target_cpu)); - cc =0 ; + cc =SIGP_CC_ORDER_CODE_ACCEPTED ;break ;case SIGP_RESTART :run_on_cpu (CPU (target_cpu), sigp_cpu_restart,CPU (target_cpu)); - cc =0 ; + cc =SIGP_CC_ORDER_CODE_ACCEPTED ;break ;case SIGP_SET_ARCH : *statusreg &=0xffffffff00000000UL ; *statusreg |=SIGP_STAT_INVALID_PARAMETER ; - cc =1 ;/* status stored */ + cc =SIGP_CC_STATUS_STORED ;break ;case SIGP_INITIAL_CPU_RESET :run_on_cpu (CPU (target_cpu), sigp_initial_cpu_reset,CPU (target_cpu)); - cc =0 ; + cc =SIGP_CC_ORDER_CODE_ACCEPTED ;break ;case SIGP_CPU_RESET :run_on_cpu (CPU (target_cpu), sigp_cpu_reset,CPU (target_cpu)); - cc =0 ; + cc =SIGP_CC_ORDER_CODE_ACCEPTED ;break ;default :DPRINTF ("KVM: unknown SIGP: 0x%x\n" , order_code); *statusreg &=0xffffffff00000000UL ; *statusreg |=SIGP_STAT_INVALID_ORDER ; - cc =1 ;/* status stored */ + cc =SIGP_CC_STATUS_STORED ;break ; }
target-s390x/misc_helper.c +2 -2
@@ -456,7 +456,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0,uint32_t HELPER (sigp )(CPUS390XState *env,uint64_t order_code,uint32_t r1,uint64_t cpu_addr) { -int cc =0 ; +int cc =SIGP_CC_ORDER_CODE_ACCEPTED ;HELPER_LOG ("%s: %016" PRIx64" %08x %016" PRIx64"\n" , __func__, order_code, r1, cpu_addr);
@@ -490,7 +490,7 @@ uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t order_code, uint32_t r1,default :/* unknown sigp */ fprintf (stderr,"XXX unknown sigp: 0x%" PRIx64"\n" , order_code); - cc =3 ; + cc =SIGP_CC_NOT_OPERATIONAL ; }return cc;
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 11/20] s390x/kvm: enable the new SIGP handling in user space
In reply to Christian BorntraegerFrom: David Hildenbrand <[email protected]>
All required SIGP handlers have been implemented in QEMU.
Let's enable the new sigp handling in user space if the kernel supports it.
Message-Id: <[email protected]>
--- target-s390x/kvm.c | 3 +++ 1 file changed, 3 insertions(+)
target-s390x/kvm.c +3 -0
@@ -187,6 +187,9 @@ int kvm_arch_init(KVMState *s) || !kvm_check_extension(s, KVM_CAP_S390_COW)) {phys_mem_set_alloc (legacy_s390_alloc); } + +kvm_vm_enable_cap (s,KVM_CAP_S390_USER_SIGP ,0 ); +return 0 ; }
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 16/20] s390-ccw.img: Allow bigger ramdisk sizes or offsets
In reply to Christian BorntraegerThe s390-ccw bios creates the the virtqueue at 100MB. For big ramdisks or offsets (via zipl) this gets overwritten. As a quick band-aid, lets move the virtqueue into the bss section, which is at 0x7f00000. As the bios code (text) is at 0x7e00000 we can now handle ramdisk which are ~27MB bigger.
Long term we want to make the s390-ccw bios position independent and load of at the end of memory.
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/main.c | 1 + pc-bios/s390-ccw/s390-ccw.h | 1 + pc-bios/s390-ccw/virtio.c | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-)
pc-bios/s390-ccw/main.c +1 -0
@@ -12,6 +12,7 @@#include "virtio.h" char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE))); +char ring_area[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));uint64_t boot_value;static struct subchannel_id blk_schid = { .one =1 };
pc-bios/s390-ccw/s390-ccw.h +1 -0
@@ -52,6 +52,7 @@ void disabled_wait(void);void virtio_panic (const char *string);void write_subsystem_identification (void ); extern char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE))); +extern char ring_area[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));extern uint64_t boot_value;/* sclp-ascii.c */
pc-bios/s390-ccw/virtio.c +2 -2
@@ -378,10 +378,10 @@ void virtio_setup_block(struct subchannel_id schid)if (run_ccw (schid,CCW_CMD_READ_CONF , &blk_cfg,sizeof (blk_cfg))) {virtio_panic ("Could not get block device configuration\n" ); } -vring_init (&block, config.num, (void *)(100 *1024 *1024 ), +vring_init (&block, config.num, ring_area,KVM_S390_VIRTIO_RING_ALIGN ); - info.queue = (100ULL *1024ULL *1024ULL ); + info.queue = (unsigned long long ) ring_area; info.align =KVM_S390_VIRTIO_RING_ALIGN ; info.index =0 ; info.num = config.num;
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 17/20] s390-ccw.img: Reinitialize guessing on reboot
In reply to Christian Borntraegerguessed_disk_nature is a static zero variable. As the QEMU ELF loader does not zero the BSS section, lets do it explicitely here.
This fixes reboot for some corner cases (like FCP flash devices with logical_block_size=512, physical_block_size=4096)
Message-Id: <[email protected]>
--- pc-bios/s390-ccw/virtio.c | 1 + 1 file changed, 1 insertion(+)
pc-bios/s390-ccw/virtio.c +1 -0
@@ -362,6 +362,7 @@ void virtio_setup_block(struct subchannel_id schid)struct vq_config_block config = {}; blk_cfg.blk_size =0 ;/* mark "illegal" - setup started... */ + guessed_disk_nature = false;virtio_reset (schid);
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 18/20] elf-loader: Provide the possibility to relocate s390 ELF files
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
On s390, we would like to load our "BIOS" s390-ccw.img to the end of the RAM. Therefor we need the possibility to relocate the ELF file so that it can also run from different addresses. This patch adds the necessary code to the QEMU ELF loader function.
Message-Id: <[email protected]>
--- hw/core/loader.c | 2 ++ include/elf.h | 2 ++ include/hw/elf_ops.h | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+)
hw/core/loader.c +2 -0
@@ -297,6 +297,7 @@ static void *load_at(int fd, int offset, int size)#undef elf_phdr#undef elf_shdr#undef elf_sym +#undef elf_rela#undef elf_note#undef elf_word#undef elf_sword
@@ -307,6 +308,7 @@ static void *load_at(int fd, int offset, int size)#define elf_note elf64_note#define elf_shdr elf64_shdr#define elf_sym elf64_sym +#define elf_rela elf64_rela#define elf_word uint64_t#define elf_sword int64_t#define bswapSZs bswap64s
include/elf.h +2 -0
@@ -1508,6 +1508,7 @@ struct elf32_fdpic_loadmap {#define elf_shdr elf32_shdr#define elf_sym elf32_sym#define elf_addr_t Elf32_Off +#define elf_rela elf32_rela#ifdef ELF_USES_RELOCA # define ELF_RELOC Elf32_Rela
@@ -1523,6 +1524,7 @@ struct elf32_fdpic_loadmap {#define elf_shdr elf64_shdr#define elf_sym elf64_sym#define elf_addr_t Elf64_Off +#define elf_rela elf64_rela#ifdef ELF_USES_RELOCA # define ELF_RELOC Elf64_Rela
include/hw/elf_ops.h +78 -0
96 lines not on this page · raw message
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 01/20] synchronize Linux headers to 4.0-rc3
In reply to Christian Borntraegersynchronize linux headers up to
commit 9eccca0843205f87c ("Linux 4.0-rc3")
--- include/standard-headers/linux/virtio_net.h | 54 +++++++++++++---------------- linux-headers/asm-arm/kvm.h | 2 ++ linux-headers/asm-arm64/kvm.h | 9 +++++ linux-headers/asm-s390/kvm.h | 37 ++++++++++++++++++++ linux-headers/asm-x86/hyperv.h | 11 ++++++ linux-headers/linux/kvm.h | 20 +++++------ 6 files changed, 93 insertions(+), 40 deletions(-)
include/standard-headers/linux/virtio_net.h +25 -29
@@ -74,39 +74,12 @@ struct virtio_net_config {uint16_t max_virtqueue_pairs; }QEMU_PACKED ; -#ifndef VIRTIO_NET_NO_LEGACY -/* This header comes first in the scatter-gather list. - * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must - * be the first element of the scatter-gather list. If you don't - * specify GSO or CSUM features, you can simply ignore the header. */ -struct virtio_net_hdr { -#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset -#define VIRTIO_NET_HDR_F_DATA_VALID 2 // Csum is valid - uint8_t flags; -#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame -#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) -#define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) -#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP -#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set - uint8_t gso_type; - __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ - __virtio16 gso_size; /* Bytes to append to hdr_len per frame */ - __virtio16 csum_start; /* Position to start checksumming from */ - __virtio16 csum_offset; /* Offset after that to place checksum */ -}; - -/* This is the version of the header to use when the MRG_RXBUF - * feature has been negotiated. */ -struct virtio_net_hdr_mrg_rxbuf { - struct virtio_net_hdr hdr; - __virtio16 num_buffers; /* Number of merged rx buffers */ -}; -#else /* ... VIRTIO_NET_NO_LEGACY *//* * This header comes first in the scatter-gather list. If you don't * specify GSO or CSUM features, you can simply ignore the header. * - * This is bitwise-equivalent to the legacy struct virtio_net_hdr_mrg_rxbuf. +* This is bitwise-equivalent to the legacy struct virtio_net_hdr_mrg_rxbuf, +* only flattened. */ struct virtio_net_hdr_v1 {#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1/* Use csum_start, csum_offset */
@@ -124,6 +97,29 @@ struct virtio_net_hdr_v1 {__virtio16 csum_offset;/* Offset after that to place checksum */ __virtio16 num_buffers;/* Number of merged rx buffers */ }; + +#ifndef VIRTIO_NET_NO_LEGACY +/* This header comes first in the scatter-gather list. +* For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must +* be the first element of the scatter-gather list. If you don't +* specify GSO or CSUM features, you can simply ignore the header. */ +struct virtio_net_hdr { +/* See VIRTIO_NET_HDR_F_* */ +uint8_t flags; +/* See VIRTIO_NET_HDR_GSO_* */ +uint8_t gso_type; +__virtio16 hdr_len;/* Ethernet + IP + tcp/udp hdrs */ +__virtio16 gso_size;/* Bytes to append to hdr_len per frame */ +__virtio16 csum_start;/* Position to start checksumming from */ +__virtio16 csum_offset;/* Offset after that to place checksum */ +}; + +/* This is the version of the header to use when the MRG_RXBUF +* feature has been negotiated. */ +struct virtio_net_hdr_mrg_rxbuf { +struct virtio_net_hdr hdr; +__virtio16 num_buffers;/* Number of merged rx buffers */ +};#endif /* ...VIRTIO_NET_NO_LEGACY */ /*
linux-headers/asm-arm/kvm.h +2 -0
@@ -175,6 +175,8 @@ struct kvm_arch_memory_slot {#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_GRP_NR_IRQS 3 +#define KVM_DEV_ARM_VGIC_GRP_CTRL 4 +#define KVM_DEV_ARM_VGIC_CTRL_INIT 0/* KVM_IRQ_LINE irq field index values */ #define KVM_ARM_IRQ_TYPE_SHIFT 24
linux-headers/asm-arm64/kvm.h +9 -0
@@ -78,6 +78,13 @@ struct kvm_regs {#define KVM_VGIC_V2_DIST_SIZE 0x1000#define KVM_VGIC_V2_CPU_SIZE 0x2000 +/* Supported VGICv3 address types */ +#define KVM_VGIC_V3_ADDR_TYPE_DIST 2 +#define KVM_VGIC_V3_ADDR_TYPE_REDIST 3 + +#define KVM_VGIC_V3_DIST_SIZE SZ_64K +#define KVM_VGIC_V3_REDIST_SIZE (2 * SZ_64K) +#define KVM_ARM_VCPU_POWER_OFF 0/* CPU is started in OFF state */ #define KVM_ARM_VCPU_EL1_32BIT 1/* CPU running a 32bit VM */ #define KVM_ARM_VCPU_PSCI_0_2 2/* CPU uses PSCI v0.2 */
@@ -161,6 +168,8 @@ struct kvm_arch_memory_slot {#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_GRP_NR_IRQS 3 +#define KVM_DEV_ARM_VGIC_GRP_CTRL 4 +#define KVM_DEV_ARM_VGIC_CTRL_INIT 0/* KVM_IRQ_LINE irq field index values */ #define KVM_ARM_IRQ_TYPE_SHIFT 24
linux-headers/asm-s390/kvm.h +37 -0
@@ -57,10 +57,44 @@ struct kvm_s390_io_adapter_req {/* kvm attr_group on vm fd */ #define KVM_S390_VM_MEM_CTRL 0 +#define KVM_S390_VM_TOD 1 +#define KVM_S390_VM_CRYPTO 2 +#define KVM_S390_VM_CPU_MODEL 3/* kvm attributes for mem_ctrl */ #define KVM_S390_VM_MEM_ENABLE_CMMA 0#define KVM_S390_VM_MEM_CLR_CMMA 1 +#define KVM_S390_VM_MEM_LIMIT_SIZE 2 + +/* kvm attributes for KVM_S390_VM_TOD */ +#define KVM_S390_VM_TOD_LOW 0 +#define KVM_S390_VM_TOD_HIGH 1 + +/* kvm attributes for KVM_S390_VM_CPU_MODEL */ +/* processor related attributes are r/w */ +#define KVM_S390_VM_CPU_PROCESSOR 0 +struct kvm_s390_vm_cpu_processor { +__u64 cpuid; +__u16 ibc; +__u8 pad[6 ]; +__u64 fac_list[256 ]; +}; + +/* machine related attributes are r/o */ +#define KVM_S390_VM_CPU_MACHINE 1 +struct kvm_s390_vm_cpu_machine { +__u64 cpuid; +__u32 ibc; +__u8 pad[4 ]; +__u64 fac_mask[256 ]; +__u64 fac_list[256 ]; +}; + +/* kvm attributes for crypto */ +#define KVM_S390_VM_CRYPTO_ENABLE_AES_KW 0 +#define KVM_S390_VM_CRYPTO_ENABLE_DEA_KW 1 +#define KVM_S390_VM_CRYPTO_DISABLE_AES_KW 2 +#define KVM_S390_VM_CRYPTO_DISABLE_DEA_KW 3/* for KVM_GET_REGS and KVM_SET_REGS */ struct kvm_regs {
@@ -107,6 +141,9 @@ struct kvm_guest_debug_arch {struct kvm_hw_breakpoint *hw_bp; }; +/* for KVM_SYNC_PFAULT and KVM_REG_S390_PFTOKEN */ +#define KVM_S390_PFAULT_TOKEN_INVALID 0xffffffffffffffffULL +#define KVM_SYNC_PREFIX (1UL << 0)#define KVM_SYNC_GPRS (1UL << 1)#define KVM_SYNC_ACRS (1UL << 2)
linux-headers/asm-x86/hyperv.h +11 -0
@@ -187,6 +187,17 @@#define HV_X64_MSR_SINT14 0x4000009E#define HV_X64_MSR_SINT15 0x4000009F +/* +* Synthetic Timer MSRs. Four timers per vcpu. +*/ +#define HV_X64_MSR_STIMER0_CONFIG 0x400000B0 +#define HV_X64_MSR_STIMER0_COUNT 0x400000B1 +#define HV_X64_MSR_STIMER1_CONFIG 0x400000B2 +#define HV_X64_MSR_STIMER1_COUNT 0x400000B3 +#define HV_X64_MSR_STIMER2_CONFIG 0x400000B4 +#define HV_X64_MSR_STIMER2_COUNT 0x400000B5 +#define HV_X64_MSR_STIMER3_CONFIG 0x400000B6 +#define HV_X64_MSR_STIMER3_COUNT 0x400000B7#define HV_X64_MSR_HYPERCALL_ENABLE 0x00000001#define HV_X64_MSR_HYPERCALL_PAGE_ADDRESS_SHIFT 12
linux-headers/linux/kvm.h +9 -11
@@ -491,6 +491,11 @@ struct kvm_s390_emerg_info {__u16 code; }; +#define KVM_S390_STOP_FLAG_STORE_STATUS 0x01 +struct kvm_s390_stop_info { +__u32 flags; +}; +struct kvm_s390_mchk_info {__u64 cr14;__u64 mcic;
@@ -509,6 +514,7 @@ struct kvm_s390_irq {struct kvm_s390_emerg_info emerg;struct kvm_s390_extcall_info extcall;struct kvm_s390_prefix_info prefix; +struct kvm_s390_stop_info stop;struct kvm_s390_mchk_info mchk;char reserved[64 ]; } u;
@@ -647,11 +653,7 @@ struct kvm_ppc_smmu_info {#define KVM_CAP_MP_STATE 14#define KVM_CAP_COALESCED_MMIO 15#define KVM_CAP_SYNC_MMU 16/* Changes to host mmap are reflected in guest */ -#define KVM_CAP_DEVICE_ASSIGNMENT 17#define KVM_CAP_IOMMU 18 -#ifdef __KVM_HAVE_MSI -#define KVM_CAP_DEVICE_MSI 20 -#endif /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21#define KVM_CAP_USER_NMI 22
@@ -663,10 +665,6 @@ struct kvm_ppc_smmu_info {#endif #define KVM_CAP_IRQ_ROUTING 25#define KVM_CAP_IRQ_INJECT_STATUS 26 -#define KVM_CAP_DEVICE_DEASSIGNMENT 27 -#ifdef __KVM_HAVE_MSIX -#define KVM_CAP_DEVICE_MSIX 28 -#endif #define KVM_CAP_ASSIGN_DEV_IRQ 29/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */ #define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30
@@ -761,6 +759,7 @@ struct kvm_ppc_smmu_info {#define KVM_CAP_PPC_FIXUP_HCALL 103#define KVM_CAP_PPC_ENABLE_HCALL 104#define KVM_CAP_CHECK_EXTENSION_VM 105 +#define KVM_CAP_S390_USER_SIGP 106#ifdef KVM_CAP_IRQ_ROUTING
@@ -960,6 +959,8 @@ enum kvm_device_type {#define KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_FLIC,#define KVM_DEV_TYPE_FLIC KVM_DEV_TYPE_FLIC + KVM_DEV_TYPE_ARM_VGIC_V3, +#define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_MAX, };
@@ -1107,9 +1108,6 @@ struct kvm_s390_ucas_mapping {#define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64)#define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64)#define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce) -/* IA64 stack access */ -#define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *) -#define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *)/* Available with KVM_CAP_VCPU_EVENTS */ #define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events)#define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events)
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 20/20] s390-ccw: rebuild BIOS
In reply to Christian Borntraegerrebuild bios to get latest changes:
s390/bios: Make the s390-ccw.img relocatable s390-ccw.img: Reinitialize guessing on reboot s390-ccw.img: Allow bigger ramdisk sizes or offsets
--- pc-bios/s390-ccw.img | Bin 17752 -> 13616 bytes 1 file changed, 0 insertions(+), 0 deletions(-)
pc-bios/s390-ccw.img binary +0 -0
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 09/20] s390x: add function to deliver restart irqs
In reply to Christian BorntraegerFrom: David Hildenbrand <[email protected]>
This patch adds a helper function to deliver restart irqs. To be able to be used by kvm, the psw load/store methods have to perform special cc-code handling only when running with tcg.
Message-Id: <[email protected]>
--- target-s390x/cpu.h | 5 ++++- target-s390x/helper.c | 35 ++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 8 deletions(-)
target-s390x/cpu.h +4 -1
@@ -352,7 +352,10 @@ int s390_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int rw,#include "ioinst.h" +#ifndef CONFIG_USER_ONLY +void do_restart_interrupt (CPUS390XState *env); +static inline hwaddr decode_basedisp_s (CPUS390XState *env,uint32_t ipb) {hwaddr addr =0 ;
@@ -671,7 +674,7 @@ typedef struct LowCorePSW mcck_old_psw;/* 0x160 */ PSW io_old_psw;/* 0x170 */ uint8_t pad7[0x1a0 -0x180 ];/* 0x180 */ -PSW restart_psw;/* 0x1a0 */ +PSW restart_new_psw;/* 0x1a0 */ PSW external_new_psw;/* 0x1b0 */ PSW svc_new_psw;/* 0x1c0 */ PSW program_new_psw;/* 0x1d0 */
target-s390x/helper.c +28 -7
@@ -183,7 +183,9 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr) { env->psw.addr = addr; env->psw.mask = mask; - env->cc_op = (mask >>44 ) &3 ; +if (tcg_enabled ()) { + env->cc_op = (mask >>44 ) &3 ; + }if (mask &PSW_MASK_WAIT ) {S390CPU *cpu =s390_env_get_cpu (env);
@@ -197,14 +199,16 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)static uint64_t get_psw_mask (CPUS390XState *env) { -uint64_t r; +uint64_t r = env->psw.mask; - env->cc_op =calc_cc (env, env->cc_op, env->cc_src, env->cc_dst, env->cc_vr); +if (tcg_enabled ()) { + env->cc_op =calc_cc (env, env->cc_op, env->cc_src, env->cc_dst, + env->cc_vr); - r = env->psw.mask; - r &= ~PSW_MASK_CC ; -assert (!(env->cc_op & ~3 )); - r |= (uint64_t )env->cc_op <<44 ; + r &= ~PSW_MASK_CC ; +assert (!(env->cc_op & ~3 )); + r |= (uint64_t )env->cc_op <<44 ; + }return r; }
@@ -229,6 +233,23 @@ static void cpu_unmap_lowcore(LowCore *lowcore)cpu_physical_memory_unmap (lowcore,sizeof (LowCore),1 ,sizeof (LowCore)); } +void do_restart_interrupt (CPUS390XState *env) +{ +uint64_t mask, addr; +LowCore *lowcore; + + lowcore =cpu_map_lowcore (env); + + lowcore->restart_old_psw.mask =cpu_to_be64 (get_psw_mask (env)); + lowcore->restart_old_psw.addr =cpu_to_be64 (env->psw.addr); + mask =be64_to_cpu (lowcore->restart_new_psw.mask); + addr =be64_to_cpu (lowcore->restart_new_psw.addr); + +cpu_unmap_lowcore (lowcore); + +load_psw (env, mask, addr); +} +static void do_svc_interrupt (CPUS390XState *env) {uint64_t mask, addr;
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 12/20] virtio-s390: s390_virtio_device_init() can't fail, simplify
In reply to Christian BorntraegerFrom: Markus Armbruster <[email protected]>
Message-Id: <[email protected]>
--- hw/s390x/s390-virtio-bus.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
hw/s390x/s390-virtio-bus.c +15 -14
@@ -111,7 +111,8 @@ VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size)return bus; } -static int s390_virtio_device_init (VirtIOS390Device *dev,VirtIODevice *vdev) +static void s390_virtio_device_init (VirtIOS390Device *dev, +VirtIODevice *vdev) {VirtIOS390Bus *bus;int dev_len;
@@ -135,8 +136,6 @@ static int s390_virtio_device_init(VirtIOS390Device *dev, VirtIODevice *vdev)if (dev->qdev.hotplugged) {s390_virtio_irq (VIRTIO_PARAM_DEV_ADD , dev->dev_offs); } - -return 0 ; }static int s390_virtio_net_init (VirtIOS390Device *s390_dev)
@@ -153,7 +152,8 @@ static int s390_virtio_net_init(VirtIOS390Device *s390_dev)return -1 ; } -return s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); +s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); +return 0 ; }static void s390_virtio_net_instance_init (Object *obj)
@@ -174,7 +174,8 @@ static int s390_virtio_blk_init(VirtIOS390Device *s390_dev)if (qdev_init (vdev) <0 ) {return -1 ; } -return s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); +s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); +return 0 ; }static void s390_virtio_blk_instance_init (Object *obj)
@@ -215,12 +216,9 @@ static int s390_virtio_serial_init(VirtIOS390Device *s390_dev)return -1 ; } - r =s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); -if (!r) { - bus->console = s390_dev; - } - -return r; +s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); + bus->console = s390_dev; +return 0 ; }static void s390_virtio_serial_instance_init (Object *obj)
@@ -253,7 +251,8 @@ static int s390_virtio_scsi_init(VirtIOS390Device *s390_dev)return -1 ; } -return s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); +s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); +return 0 ; }static void s390_virtio_scsi_instance_init (Object *obj)
@@ -275,7 +274,8 @@ static int s390_vhost_scsi_init(VirtIOS390Device *s390_dev)return -1 ; } -return s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); +s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); +return 0 ; }static void s390_vhost_scsi_instance_init (Object *obj)
@@ -302,7 +302,8 @@ static int s390_virtio_rng_init(VirtIOS390Device *s390_dev)OBJECT (dev->vdev.conf.rng),"rng" , NULL); -return s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); +s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); +return 0 ; }static void s390_virtio_rng_instance_init (Object *obj)
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 13/20] virtio-s390: Convert to realize()
In reply to Christian BorntraegerFrom: Markus Armbruster <[email protected]>
Message-Id: <[email protected]>
--- hw/s390x/s390-virtio-bus.c | 80 ++++++++++++++++++++++++++-------------------- hw/s390x/s390-virtio-bus.h | 2 +- 2 files changed, 47 insertions(+), 35 deletions(-)
hw/s390x/s390-virtio-bus.c +46 -34
@@ -138,22 +138,24 @@ static void s390_virtio_device_init(VirtIOS390Device *dev, } } -static int s390_virtio_net_init (VirtIOS390Device *s390_dev) +static void s390_virtio_net_realize (VirtIOS390Device *s390_dev,Error **errp) {DeviceState *qdev =DEVICE (s390_dev);VirtIONetS390 *dev =VIRTIO_NET_S390 (s390_dev);DeviceState *vdev =DEVICE (&dev->vdev); +Error *err =NULL ;virtio_net_set_config_size (&dev->vdev, s390_dev->host_features);virtio_net_set_netclient_name (&dev->vdev, qdev->id,object_get_typename (OBJECT (qdev)));qdev_set_parent_bus (vdev,BUS (&s390_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; }s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); -return 0 ; }static void s390_virtio_net_instance_init (Object *obj)
@@ -166,16 +168,19 @@ static void s390_virtio_net_instance_init(Object *obj) "bootindex", &error_abort); } -static int s390_virtio_blk_init (VirtIOS390Device *s390_dev) +static void s390_virtio_blk_realize (VirtIOS390Device *s390_dev,Error **errp) {VirtIOBlkS390 *dev =VIRTIO_BLK_S390 (s390_dev);DeviceState *vdev =DEVICE (&dev->vdev); +Error *err =NULL ; +qdev_set_parent_bus (vdev,BUS (&s390_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; }s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); -return 0 ; }static void s390_virtio_blk_instance_init (Object *obj)
@@ -190,13 +195,13 @@ static void s390_virtio_blk_instance_init(Object *obj) "bootindex", &error_abort); } -static int s390_virtio_serial_init (VirtIOS390Device *s390_dev) +static void s390_virtio_serial_realize (VirtIOS390Device *s390_dev,Error **errp) {VirtIOSerialS390 *dev =VIRTIO_SERIAL_S390 (s390_dev);DeviceState *vdev =DEVICE (&dev->vdev);DeviceState *qdev =DEVICE (s390_dev); +Error *err =NULL ;VirtIOS390Bus *bus; -int r;char *bus_name; bus =DO_UPCAST (VirtIOS390Bus, bus, qdev->parent_bus);
@@ -212,13 +217,14 @@ static int s390_virtio_serial_init(VirtIOS390Device *s390_dev) }qdev_set_parent_bus (vdev,BUS (&s390_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; }s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); bus->console = s390_dev; -return 0 ; }static void s390_virtio_serial_instance_init (Object *obj)
@@ -229,11 +235,12 @@ static void s390_virtio_serial_instance_init(Object *obj) TYPE_VIRTIO_SERIAL); } -static int s390_virtio_scsi_init (VirtIOS390Device *s390_dev) +static void s390_virtio_scsi_realize (VirtIOS390Device *s390_dev,Error **errp) {VirtIOSCSIS390 *dev =VIRTIO_SCSI_S390 (s390_dev);DeviceState *vdev =DEVICE (&dev->vdev);DeviceState *qdev =DEVICE (s390_dev); +Error *err =NULL ;char *bus_name;/*
@@ -247,12 +254,13 @@ static int s390_virtio_scsi_init(VirtIOS390Device *s390_dev) }qdev_set_parent_bus (vdev,BUS (&s390_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; }s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); -return 0 ; }static void s390_virtio_scsi_instance_init (Object *obj)
@@ -264,18 +272,20 @@ static void s390_virtio_scsi_instance_init(Object *obj) }#ifdef CONFIG_VHOST_SCSI -static int s390_vhost_scsi_init (VirtIOS390Device *s390_dev) +static void s390_vhost_scsi_realize (VirtIOS390Device *s390_dev,Error **errp) {VHostSCSIS390 *dev =VHOST_SCSI_S390 (s390_dev);DeviceState *vdev =DEVICE (&dev->vdev); +Error *err =NULL ;qdev_set_parent_bus (vdev,BUS (&s390_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; }s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); -return 0 ; }static void s390_vhost_scsi_instance_init (Object *obj)
@@ -288,14 +298,17 @@ static void s390_vhost_scsi_instance_init(Object *obj)#endif -static int s390_virtio_rng_init (VirtIOS390Device *s390_dev) +static void s390_virtio_rng_realize (VirtIOS390Device *s390_dev,Error **errp) {VirtIORNGS390 *dev =VIRTIO_RNG_S390 (s390_dev);DeviceState *vdev =DEVICE (&dev->vdev); +Error *err =NULL ;qdev_set_parent_bus (vdev,BUS (&s390_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; } object_property_set_link(OBJECT(dev),
@@ -303,7 +316,6 @@ static int s390_virtio_rng_init(VirtIOS390Device *s390_dev) NULL);s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); -return 0 ; }static void s390_virtio_rng_instance_init (Object *obj)
@@ -510,7 +522,7 @@ static void s390_virtio_net_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOS390DeviceClass *k =VIRTIO_S390_DEVICE_CLASS (klass); - k->init = s390_virtio_net_init; + k->realize = s390_virtio_net_realize; dc->props = s390_virtio_net_properties; }
@@ -526,7 +538,7 @@ static void s390_virtio_blk_class_init(ObjectClass *klass, void *data) {VirtIOS390DeviceClass *k =VIRTIO_S390_DEVICE_CLASS (klass); - k->init = s390_virtio_blk_init; + k->realize = s390_virtio_blk_realize; }static const TypeInfo s390_virtio_blk = {
@@ -546,7 +558,7 @@ static void s390_virtio_serial_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOS390DeviceClass *k =VIRTIO_S390_DEVICE_CLASS (klass); - k->init = s390_virtio_serial_init; + k->realize = s390_virtio_serial_realize; dc->props = s390_virtio_serial_properties; }
@@ -568,7 +580,7 @@ static void s390_virtio_rng_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOS390DeviceClass *k =VIRTIO_S390_DEVICE_CLASS (klass); - k->init = s390_virtio_rng_init; + k->realize = s390_virtio_rng_realize; dc->props = s390_virtio_rng_properties; }
@@ -580,14 +592,14 @@ static const TypeInfo s390_virtio_rng = { .class_init = s390_virtio_rng_class_init, }; -static int s390_virtio_busdev_init (DeviceState *dev) +static void s390_virtio_busdev_realize (DeviceState *dev,Error **errp) {VirtIOS390Device *_dev = (VirtIOS390Device *)dev;VirtIOS390DeviceClass *_info =VIRTIO_S390_DEVICE_GET_CLASS (dev);virtio_s390_bus_new (&_dev->bus,sizeof (_dev->bus), _dev); -return _info->init (_dev); + _info->realize (_dev, errp); }static void s390_virtio_busdev_reset (DeviceState *dev)
@@ -601,7 +613,7 @@ static void virtio_s390_device_class_init(ObjectClass *klass, void *data) {DeviceClass *dc =DEVICE_CLASS (klass); - dc->init = s390_virtio_busdev_init; + dc->realize = s390_virtio_busdev_realize; dc->bus_type =TYPE_S390_VIRTIO_BUS ; dc->reset = s390_virtio_busdev_reset; }
@@ -626,7 +638,7 @@ static void s390_virtio_scsi_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOS390DeviceClass *k =VIRTIO_S390_DEVICE_CLASS (klass); - k->init = s390_virtio_scsi_init; + k->realize = s390_virtio_scsi_realize; dc->props = s390_virtio_scsi_properties; }
@@ -649,7 +661,7 @@ static void s390_vhost_scsi_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOS390DeviceClass *k =VIRTIO_S390_DEVICE_CLASS (klass); - k->init = s390_vhost_scsi_init; + k->realize = s390_vhost_scsi_realize; dc->props = s390_vhost_scsi_properties; }
hw/s390x/s390-virtio-bus.h +1 -1
@@ -83,7 +83,7 @@ typedef struct VirtIOS390Device VirtIOS390Device;typedef struct VirtIOS390DeviceClass {DeviceClass qdev; -int (*init)(VirtIOS390Device *dev); +void (*realize)(VirtIOS390Device *dev,Error **errp); }VirtIOS390DeviceClass ;struct VirtIOS390Device {
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 03/20] s390x/kvm: more details for SIGP handler with one destination vcpu
In reply to Christian BorntraegerFrom: David Hildenbrand <[email protected]>
Whenever a sigp order is to be executed by a target vcpu, we use run_on_cpu(). As we have only one pointer to pass all data to these sigp handlers, let's introduce the struct sigp_info and use it as a transport container.
All orders targeting a single vcpu are now dispatched from a separate handler. The destination vcpu is only valid for these orders and must not be checked for SIGP SET ARCHITECTURE.
The sigp_info is filled with life in this new handler and used to pass the information about the sigp order to the existing handlers. The cc is set within these handlers.
Rename sigp_cpu_start() and sigp_cpu_restart() on the way to match the SIGP order names (in order to avoid touching affected lines several times).
Message-Id: <[email protected]>
--- target-s390x/kvm.c | 153 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 91 insertions(+), 62 deletions(-)
target-s390x/kvm.c +91 -62
@@ -1111,110 +1111,139 @@ static int handle_diag(S390CPU *cpu, struct kvm_run *run, uint32_t ipb)return r; } -static void sigp_cpu_start (void *arg) +typedef struct SigpInfo { +S390CPU *cpu; +int cc; +uint64_t *status_reg; +}SigpInfo ; + +static void sigp_start (void *arg) { -CPUState *cs = arg; -S390CPU *cpu =S390_CPU (cs); +SigpInfo *si = arg; -s390_cpu_set_state (CPU_STATE_OPERATING , cpu); -DPRINTF ("DONE: KVM cpu start: %p\n" , &cpu->env); +s390_cpu_set_state (CPU_STATE_OPERATING , si->cpu); + si->cc =SIGP_CC_ORDER_CODE_ACCEPTED ; +DPRINTF ("DONE: KVM cpu start: %p\n" , &si->cpu->env); } -static void sigp_cpu_restart (void *arg) +static void sigp_restart (void *arg) { -CPUState *cs = arg; -S390CPU *cpu =S390_CPU (cs); +SigpInfo *si = arg;struct kvm_s390_irq irq = { .type =KVM_S390_RESTART , }; -kvm_s390_vcpu_interrupt (cpu, &irq); -s390_cpu_set_state (CPU_STATE_OPERATING , cpu); +kvm_s390_vcpu_interrupt (si->cpu, &irq); +s390_cpu_set_state (CPU_STATE_OPERATING , si->cpu); + si->cc =SIGP_CC_ORDER_CODE_ACCEPTED ; }int kvm_s390_cpu_restart (S390CPU *cpu) { -run_on_cpu (CPU (cpu), sigp_cpu_restart,CPU (cpu)); +SigpInfo si = { + .cpu = cpu, + }; + +run_on_cpu (CPU (cpu), sigp_restart, &si);DPRINTF ("DONE: KVM cpu restart: %p\n" , &cpu->env);return 0 ; }static void sigp_initial_cpu_reset (void *arg) { -CPUState *cpu = arg; -S390CPUClass *scc =S390_CPU_GET_CLASS (cpu); +SigpInfo *si = arg; +CPUState *cs =CPU (si->cpu); +S390CPUClass *scc =S390_CPU_GET_CLASS (si->cpu); -cpu_synchronize_state (cpu); - scc->initial_cpu_reset (cpu); -cpu_synchronize_post_reset (cpu); +cpu_synchronize_state (cs); + scc->initial_cpu_reset (cs); +cpu_synchronize_post_reset (cs); + si->cc =SIGP_CC_ORDER_CODE_ACCEPTED ; }static void sigp_cpu_reset (void *arg) { -CPUState *cpu = arg; -S390CPUClass *scc =S390_CPU_GET_CLASS (cpu); +SigpInfo *si = arg; +CPUState *cs =CPU (si->cpu); +S390CPUClass *scc =S390_CPU_GET_CLASS (si->cpu); -cpu_synchronize_state (cpu); - scc->cpu_reset (cpu); -cpu_synchronize_post_reset (cpu); +cpu_synchronize_state (cs); + scc->cpu_reset (cs); +cpu_synchronize_post_reset (cs); + si->cc =SIGP_CC_ORDER_CODE_ACCEPTED ; } -#define SIGP_ORDER_MASK 0x000000ff - -static int handle_sigp (S390CPU *cpu,struct kvm_run *run,uint8_t ipa1) +static int handle_sigp_single_dst (S390CPU *dst_cpu,uint8_t order, +uint64_t *status_reg) { -CPUS390XState *env = &cpu->env; -uint8_t order_code; -uint16_t cpu_addr; -S390CPU *target_cpu; -uint64_t *statusreg = &env->regs[ipa1 >>4 ]; -int cc; - -cpu_synchronize_state (CPU (cpu)); - -/* get order code */ - order_code =decode_basedisp_rs (env, run->s390_sieic.ipb) &SIGP_ORDER_MASK ; +SigpInfo si = { + .cpu = dst_cpu, + .status_reg = status_reg, + }; - cpu_addr = env->regs[ipa1 &0x0f ]; - target_cpu =s390_cpu_addr2state (cpu_addr); -if (target_cpu ==NULL ) { - cc =SIGP_CC_NOT_OPERATIONAL ; - goto out; +/* cpu available? */ +if (dst_cpu ==NULL ) { +return SIGP_CC_NOT_OPERATIONAL ; } -switch (order_code) { +switch (order) {case SIGP_START : -run_on_cpu (CPU (target_cpu), sigp_cpu_start,CPU (target_cpu)); - cc =SIGP_CC_ORDER_CODE_ACCEPTED ; +run_on_cpu (CPU (dst_cpu), sigp_start, &si);break ;case SIGP_RESTART : -run_on_cpu (CPU (target_cpu), sigp_cpu_restart,CPU (target_cpu)); - cc =SIGP_CC_ORDER_CODE_ACCEPTED ; -break ; -case SIGP_SET_ARCH : - *statusreg &=0xffffffff00000000UL ; - *statusreg |=SIGP_STAT_INVALID_PARAMETER ; - cc =SIGP_CC_STATUS_STORED ; -break ; +run_on_cpu (CPU (dst_cpu), sigp_restart, &si);case SIGP_INITIAL_CPU_RESET : -run_on_cpu (CPU (target_cpu), sigp_initial_cpu_reset,CPU (target_cpu)); - cc =SIGP_CC_ORDER_CODE_ACCEPTED ; +run_on_cpu (CPU (dst_cpu), sigp_initial_cpu_reset, &si);break ;case SIGP_CPU_RESET : -run_on_cpu (CPU (target_cpu), sigp_cpu_reset,CPU (target_cpu)); - cc =SIGP_CC_ORDER_CODE_ACCEPTED ; +run_on_cpu (CPU (dst_cpu), sigp_cpu_reset, &si);break ;default : -DPRINTF ("KVM: unknown SIGP: 0x%x\n" , order_code); - *statusreg &=0xffffffff00000000UL ; - *statusreg |=SIGP_STAT_INVALID_ORDER ; - cc =SIGP_CC_STATUS_STORED ; +DPRINTF ("KVM: unknown SIGP: 0x%x\n" , order); + *status_reg &=0xffffffff00000000ULL ; + *status_reg |=SIGP_STAT_INVALID_ORDER ; + si.cc =SIGP_CC_STATUS_STORED ; + } + +return si.cc; +} + +#define SIGP_ORDER_MASK 0x000000ff + +static int handle_sigp (S390CPU *cpu,struct kvm_run *run,uint8_t ipa1) +{ +CPUS390XState *env = &cpu->env; +const uint8_t r1 = ipa1 >>4 ; +const uint8_t r3 = ipa1 &0x0f ; +int ret; +uint8_t order; +uint64_t *status_reg; +S390CPU *dst_cpu =NULL ; + +cpu_synchronize_state (CPU (cpu)); + +/* get order code */ + order =decode_basedisp_rs (env, run->s390_sieic.ipb) &SIGP_ORDER_MASK ; + status_reg = &env->regs[r1]; + +switch (order) { +case SIGP_SET_ARCH : + *status_reg &=0xffffffff00000000ULL ; + *status_reg |=SIGP_STAT_INVALID_PARAMETER ; + ret =SIGP_CC_STATUS_STORED ;break ; +default : +/* all other sigp orders target a single vcpu */ + dst_cpu =s390_cpu_addr2state (env->regs[r3]); + ret =handle_sigp_single_dst (dst_cpu, order, status_reg); } -out: -setcc (cpu, cc); -return 0 ; +if (ret >=0 ) { +setcc (cpu, ret); +return 0 ; + } + +return ret; }static int handle_instruction (S390CPU *cpu,struct kvm_run *run)
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 07/20] s390x/kvm: implement handling of new SIGP orders
In reply to Christian BorntraegerFrom: David Hildenbrand <[email protected]>
This patch adds handling code for the following SIGP orders:
- SIGP SET ARCHITECTURE
- SIGP SET PREFIX
- SIGP STOP
- SIGP STOP AND STORE STATUS
- SIGP STORE STATUS AT ADDRESS
SIGP STOP (AND STORE STATUS) are the only orders that can stay pending forever (and may only be interrupted by resets), so special care has to be taken about them. Their status also has to be tracked within QEMU. This patch takes care of migrating this status (e.g. if migration happens during a SIGP STOP).
Due to the BQL, only one VCPU is currently able to execute SIGP handlers at a time. According to the PoP, BUSY should be returned if another SIGP order is currently being executed on a VCPU. This can only be implemented when the BQL does not protect all handlers. For now, all SIGP orders on all VCPUs will be serialized, which will be okay for the first shot.
Message-Id: <[email protected]>
--- target-s390x/cpu.c | 2 + target-s390x/cpu.h | 12 +++ target-s390x/kvm.c | 204 ++++++++++++++++++++++++++++++++++++++++++++++++- target-s390x/machine.c | 5 +- 4 files changed, 218 insertions(+), 5 deletions(-)
target-s390x/cpu.c +2 -0
@@ -96,6 +96,7 @@ static void s390_cpu_reset(CPUState *s) env->pfault_token =-1UL ; scc->parent_reset (s); + cpu->env.sigp_order =0 ;s390_cpu_set_state (CPU_STATE_STOPPED , cpu);tlb_flush (s,1 ); }
@@ -131,6 +132,7 @@ static void s390_cpu_full_reset(CPUState *s)CPUS390XState *env = &cpu->env; scc->parent_reset (s); + cpu->env.sigp_order =0 ;s390_cpu_set_state (CPU_STATE_STOPPED , cpu);memset (env,0 , offsetof(CPUS390XState , cpu_num));
target-s390x/cpu.h +12 -0
@@ -157,6 +157,9 @@ typedef struct CPUS390XState {#define CPU_STATE_LOAD 0x04uint8_t cpu_state; +/* currently processed sigp order */ +uint8_t sigp_order; + } CPUS390XState;#include "cpu-qom.h"
@@ -411,6 +414,10 @@ S390CPU *s390_cpu_addr2state(uint16_t cpu_addr);unsigned int s390_cpu_halt (S390CPU *cpu);void s390_cpu_unhalt (S390CPU *cpu);unsigned int s390_cpu_set_state (uint8_t cpu_state,S390CPU *cpu); +static inline uint8_t s390_cpu_get_state (S390CPU *cpu) +{ +return cpu->env.cpu_state; +}/* service interrupts are floating therefore we must not pass an cpustate */ void s390_sclp_extint (uint32_t parm);
@@ -896,6 +903,11 @@ struct sysib_322 {#define SIGP_STAT_INVALID_ORDER 0x00000002UL#define SIGP_STAT_RECEIVER_CHECK 0x00000001UL +/* SIGP SET ARCHITECTURE modes */ +#define SIGP_MODE_ESA_S390 0 +#define SIGP_MODE_Z_ARCH_TRANS_ALL_PSW 1 +#define SIGP_MODE_Z_ARCH_TRANS_CUR_PSW 2 +void load_psw (CPUS390XState *env,uint64_t mask,uint64_t addr);int mmu_translate (CPUS390XState *env,target_ulong vaddr,int rw,uint64_t asc,target_ulong *raddr,int *flags,bool exc);
target-s390x/kvm.c +201 -3
252 lines not on this page · raw message
target-s390x/machine.c +3 -2
@@ -36,8 +36,8 @@ static int cpu_post_load(void *opaque, int version_id)const VMStateDescription vmstate_s390_cpu = { .name ="cpu" , .post_load = cpu_post_load, - .version_id =1 , - .minimum_version_id =1 , + .version_id =2 , + .minimum_version_id =2 , .fields = (VMStateField []) {VMSTATE_UINT64 (env.fregs[0 ].ll,S390CPU ),VMSTATE_UINT64 (env.fregs[1 ].ll,S390CPU ),
@@ -71,6 +71,7 @@ const VMStateDescription vmstate_s390_cpu = { VMSTATE_UINT32_ARRAY(env.aregs, S390CPU, 16), VMSTATE_UINT64_ARRAY(env.cregs, S390CPU, 16), VMSTATE_UINT8(env.cpu_state, S390CPU), + VMSTATE_UINT8(env.sigp_order, S390CPU),VMSTATE_END_OF_LIST () }, };
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 14/20] virtio-ccw: Convert to realize()
In reply to Christian BorntraegerFrom: Markus Armbruster <[email protected]>
Message-Id: <[email protected]>
--- hw/s390x/virtio-ccw.c | 134 ++++++++++++++++++++++++++++---------------------- hw/s390x/virtio-ccw.h | 2 +- 2 files changed, 75 insertions(+), 61 deletions(-)
hw/s390x/virtio-ccw.c +74 -60
@@ -607,7 +607,8 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)return ret; } -static int virtio_ccw_device_init (VirtioCcwDevice *dev,VirtIODevice *vdev) +static void virtio_ccw_device_realize (VirtioCcwDevice *dev, +VirtIODevice *vdev,Error **errp) {unsigned int cssid =0 ;unsigned int ssid =0 ;
@@ -616,7 +617,6 @@ static int virtio_ccw_device_init(VirtioCcwDevice *dev, VirtIODevice *vdev)bool have_devno = false;bool found = false;SubchDev *sch; -int ret;int num;DeviceState *parent =DEVICE (dev);
@@ -639,21 +639,19 @@ static int virtio_ccw_device_init(VirtioCcwDevice *dev, VirtIODevice *vdev) num =sscanf (dev->bus_id,"%x.%x.%04x" , &cssid, &ssid, &devno);if (num ==3 ) {if ((cssid >MAX_CSSID ) || (ssid >MAX_SSID )) { - ret = -EINVAL ; -error_report ("Invalid cssid or ssid: cssid %x, ssid %x" , - cssid, ssid); +error_setg (errp,"Invalid cssid or ssid: cssid %x, ssid %x" , + cssid, ssid); goto out_err; }/* Enforce use of virtual cssid. */ if (cssid !=VIRTUAL_CSSID ) { - ret = -EINVAL ; -error_report ("cssid %x not valid for virtio devices" , cssid); +error_setg (errp,"cssid %x not valid for virtio devices" , + cssid); goto out_err; }if (css_devno_used (cssid, ssid, devno)) { - ret = -EEXIST ; -error_report ("Device %x.%x.%04x already exists" , cssid, ssid, - devno); +error_setg (errp,"Device %x.%x.%04x already exists" , + cssid, ssid, devno); goto out_err; } sch->cssid = cssid;
@@ -661,8 +659,7 @@ static int virtio_ccw_device_init(VirtioCcwDevice *dev, VirtIODevice *vdev) sch->devno = devno; have_devno = true; }else { - ret = -EINVAL ; -error_report ("Malformed devno parameter '%s'" , dev->bus_id); +error_setg (errp,"Malformed devno parameter '%s'" , dev->bus_id); goto out_err; } }
@@ -678,9 +675,8 @@ static int virtio_ccw_device_init(VirtioCcwDevice *dev, VirtIODevice *vdev) } }if (!found) { - ret = -ENODEV ; -error_report ("No free subchannel found for %x.%x.%04x" , cssid, ssid, - devno); +error_setg (errp,"No free subchannel found for %x.%x.%04x" , + cssid, ssid, devno); goto out_err; } trace_virtio_ccw_new_device(cssid, ssid, schid, devno,
@@ -702,8 +698,7 @@ static int virtio_ccw_device_init(VirtioCcwDevice *dev, VirtIODevice *vdev)if (devno ==MAX_SCHID ) { devno =0 ; }else if (devno == schid -1 ) { - ret = -ENODEV ; -error_report ("No free devno found" ); +error_setg (errp,"No free devno found" ); goto out_err; }else { devno++;
@@ -720,8 +715,7 @@ static int virtio_ccw_device_init(VirtioCcwDevice *dev, VirtIODevice *vdev) } }if (!found) { - ret = -ENODEV ; -error_report ("Virtual channel subsystem is full!" ); +error_setg (errp,"Virtual channel subsystem is full!" ); goto out_err; } trace_virtio_ccw_new_device(cssid, ssid, schid, devno,
@@ -748,12 +742,11 @@ static int virtio_ccw_device_init(VirtioCcwDevice *dev, VirtIODevice *vdev)css_generate_sch_crws (sch->cssid, sch->ssid, sch->schid, parent->hotplugged,1 ); -return 0 ; +return ; out_err: dev->sch =NULL ;g_free (sch); -return ret; }static int virtio_ccw_exit (VirtioCcwDevice *dev)
@@ -771,21 +764,24 @@ static int virtio_ccw_exit(VirtioCcwDevice *dev)return 0 ; } -static int virtio_ccw_net_init (VirtioCcwDevice *ccw_dev) +static void virtio_ccw_net_realize (VirtioCcwDevice *ccw_dev,Error **errp) {DeviceState *qdev =DEVICE (ccw_dev);VirtIONetCcw *dev =VIRTIO_NET_CCW (ccw_dev);DeviceState *vdev =DEVICE (&dev->vdev); +Error *err =NULL ;virtio_net_set_config_size (&dev->vdev, ccw_dev->host_features[0 ]);virtio_net_set_netclient_name (&dev->vdev, qdev->id,object_get_typename (OBJECT (qdev)));qdev_set_parent_bus (vdev,BUS (&ccw_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; } -return virtio_ccw_device_init (ccw_dev,VIRTIO_DEVICE (vdev)); +virtio_ccw_device_realize (ccw_dev,VIRTIO_DEVICE (vdev), errp); }static void virtio_ccw_net_instance_init (Object *obj)
@@ -798,16 +794,20 @@ static void virtio_ccw_net_instance_init(Object *obj) "bootindex", &error_abort); } -static int virtio_ccw_blk_init (VirtioCcwDevice *ccw_dev) +static void virtio_ccw_blk_realize (VirtioCcwDevice *ccw_dev,Error **errp) {VirtIOBlkCcw *dev =VIRTIO_BLK_CCW (ccw_dev);DeviceState *vdev =DEVICE (&dev->vdev); +Error *err =NULL ; +qdev_set_parent_bus (vdev,BUS (&ccw_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; } -return virtio_ccw_device_init (ccw_dev,VIRTIO_DEVICE (vdev)); +virtio_ccw_device_realize (ccw_dev,VIRTIO_DEVICE (vdev), errp); }static void virtio_ccw_blk_instance_init (Object *obj)
@@ -822,11 +822,12 @@ static void virtio_ccw_blk_instance_init(Object *obj) "bootindex", &error_abort); } -static int virtio_ccw_serial_init (VirtioCcwDevice *ccw_dev) +static void virtio_ccw_serial_realize (VirtioCcwDevice *ccw_dev,Error **errp) {VirtioSerialCcw *dev =VIRTIO_SERIAL_CCW (ccw_dev);DeviceState *vdev =DEVICE (&dev->vdev);DeviceState *proxy =DEVICE (ccw_dev); +Error *err =NULL ;char *bus_name;/*
@@ -840,11 +841,13 @@ static int virtio_ccw_serial_init(VirtioCcwDevice *ccw_dev) }qdev_set_parent_bus (vdev,BUS (&ccw_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; } -return virtio_ccw_device_init (ccw_dev,VIRTIO_DEVICE (vdev)); +virtio_ccw_device_realize (ccw_dev,VIRTIO_DEVICE (vdev), errp); }
@@ -856,17 +859,20 @@ static void virtio_ccw_serial_instance_init(Object *obj) TYPE_VIRTIO_SERIAL); } -static int virtio_ccw_balloon_init (VirtioCcwDevice *ccw_dev) +static void virtio_ccw_balloon_realize (VirtioCcwDevice *ccw_dev,Error **errp) {VirtIOBalloonCcw *dev =VIRTIO_BALLOON_CCW (ccw_dev);DeviceState *vdev =DEVICE (&dev->vdev); +Error *err =NULL ;qdev_set_parent_bus (vdev,BUS (&ccw_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; } -return virtio_ccw_device_init (ccw_dev,VIRTIO_DEVICE (vdev)); +virtio_ccw_device_realize (ccw_dev,VIRTIO_DEVICE (vdev), errp); } static void balloon_ccw_stats_get_all(Object *obj, struct Visitor *v,
@@ -909,11 +915,12 @@ static void virtio_ccw_balloon_instance_init(Object *obj) NULL, dev, NULL); } -static int virtio_ccw_scsi_init (VirtioCcwDevice *ccw_dev) +static void virtio_ccw_scsi_realize (VirtioCcwDevice *ccw_dev,Error **errp) {VirtIOSCSICcw *dev =VIRTIO_SCSI_CCW (ccw_dev);DeviceState *vdev =DEVICE (&dev->vdev);DeviceState *qdev =DEVICE (ccw_dev); +Error *err =NULL ;char *bus_name;/*
@@ -927,11 +934,13 @@ static int virtio_ccw_scsi_init(VirtioCcwDevice *ccw_dev) }qdev_set_parent_bus (vdev,BUS (&ccw_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; } -return virtio_ccw_device_init (ccw_dev,VIRTIO_DEVICE (vdev)); +virtio_ccw_device_realize (ccw_dev,VIRTIO_DEVICE (vdev), errp); }static void virtio_ccw_scsi_instance_init (Object *obj)
@@ -945,17 +954,20 @@ static void virtio_ccw_scsi_instance_init(Object *obj) }#ifdef CONFIG_VHOST_SCSI -static int vhost_ccw_scsi_init (VirtioCcwDevice *ccw_dev) +static void vhost_ccw_scsi_realize (VirtioCcwDevice *ccw_dev,Error **errp) {VHostSCSICcw *dev =VHOST_SCSI_CCW (ccw_dev);DeviceState *vdev =DEVICE (&dev->vdev); +Error *err =NULL ;qdev_set_parent_bus (vdev,BUS (&ccw_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; } -return virtio_ccw_device_init (ccw_dev,VIRTIO_DEVICE (vdev)); +virtio_ccw_device_realize (ccw_dev,VIRTIO_DEVICE (vdev), errp); }static void vhost_ccw_scsi_instance_init (Object *obj)
@@ -967,21 +979,24 @@ static void vhost_ccw_scsi_instance_init(Object *obj) }#endif -static int virtio_ccw_rng_init (VirtioCcwDevice *ccw_dev) +static void virtio_ccw_rng_realize (VirtioCcwDevice *ccw_dev,Error **errp) {VirtIORNGCcw *dev =VIRTIO_RNG_CCW (ccw_dev);DeviceState *vdev =DEVICE (&dev->vdev); +Error *err =NULL ;qdev_set_parent_bus (vdev,BUS (&ccw_dev->bus)); -if (qdev_init (vdev) <0 ) { -return -1 ; +object_property_set_bool (OBJECT (vdev), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; }object_property_set_link (OBJECT (dev),OBJECT (dev->vdev.conf.rng),"rng" ,NULL ); -return virtio_ccw_device_init (ccw_dev,VIRTIO_DEVICE (vdev)); +virtio_ccw_device_realize (ccw_dev,VIRTIO_DEVICE (vdev), errp); }/* DeviceState to VirtioCcwDevice. Note: used on datapath,
@@ -1391,7 +1406,7 @@ static void virtio_ccw_net_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOCCWDeviceClass *k =VIRTIO_CCW_DEVICE_CLASS (klass); - k->init = virtio_ccw_net_init; + k->realize = virtio_ccw_net_realize; k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_net_properties;
@@ -1417,7 +1432,7 @@ static void virtio_ccw_blk_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOCCWDeviceClass *k =VIRTIO_CCW_DEVICE_CLASS (klass); - k->init = virtio_ccw_blk_init; + k->realize = virtio_ccw_blk_realize; k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_blk_properties;
@@ -1443,7 +1458,7 @@ static void virtio_ccw_serial_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOCCWDeviceClass *k =VIRTIO_CCW_DEVICE_CLASS (klass); - k->init = virtio_ccw_serial_init; + k->realize = virtio_ccw_serial_realize; k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_serial_properties;
@@ -1469,7 +1484,7 @@ static void virtio_ccw_balloon_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOCCWDeviceClass *k =VIRTIO_CCW_DEVICE_CLASS (klass); - k->init = virtio_ccw_balloon_init; + k->realize = virtio_ccw_balloon_realize; k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_balloon_properties;
@@ -1496,7 +1511,7 @@ static void virtio_ccw_scsi_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOCCWDeviceClass *k =VIRTIO_CCW_DEVICE_CLASS (klass); - k->init = virtio_ccw_scsi_init; + k->realize = virtio_ccw_scsi_realize; k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_scsi_properties;
@@ -1521,7 +1536,7 @@ static void vhost_ccw_scsi_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOCCWDeviceClass *k =VIRTIO_CCW_DEVICE_CLASS (klass); - k->init = vhost_ccw_scsi_init; + k->realize = vhost_ccw_scsi_realize; k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = vhost_ccw_scsi_properties;
@@ -1558,7 +1573,7 @@ static void virtio_ccw_rng_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);VirtIOCCWDeviceClass *k =VIRTIO_CCW_DEVICE_CLASS (klass); - k->init = virtio_ccw_rng_init; + k->realize = virtio_ccw_rng_realize; k->exit = virtio_ccw_exit; dc->reset = virtio_ccw_reset; dc->props = virtio_ccw_rng_properties;
@@ -1572,14 +1587,13 @@ static const TypeInfo virtio_ccw_rng = { .class_init = virtio_ccw_rng_class_init, }; -static int virtio_ccw_busdev_init (DeviceState *dev) +static void virtio_ccw_busdev_realize (DeviceState *dev,Error **errp) {VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;VirtIOCCWDeviceClass *_info =VIRTIO_CCW_DEVICE_GET_CLASS (dev);virtio_ccw_bus_new (&_dev->bus,sizeof (_dev->bus), _dev); - -return _info->init (_dev); + _info->realize (_dev, errp); }static int virtio_ccw_busdev_exit (DeviceState *dev)
@@ -1622,7 +1636,7 @@ static void virtio_ccw_device_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass); dc->props = virtio_ccw_properties; - dc->init = virtio_ccw_busdev_init; + dc->realize = virtio_ccw_busdev_realize; dc->exit = virtio_ccw_busdev_exit; dc->bus_type =TYPE_VIRTUAL_CSS_BUS ; }
hw/s390x/virtio-ccw.h +1 -1
@@ -64,7 +64,7 @@ typedef struct VirtioCcwDevice VirtioCcwDevice;typedef struct VirtIOCCWDeviceClass {DeviceClass parent_class; -int (*init)(VirtioCcwDevice *dev); +void (*realize)(VirtioCcwDevice *dev,Error **errp);int (*exit)(VirtioCcwDevice *dev); }VirtIOCCWDeviceClass ;
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 15/20] s390x/kvm: passing max memory size to accelerator
In reply to Christian BorntraegerFrom: Dominik Dingel <[email protected]>
With "KVM: s390: Allow userspace to limit guest memory size" KVM is able to do some optimizations based on the guest memory limit.
The guest memory limit is computed by the initial definition and with the notion of hotplugged memory.
Message-Id: <[email protected]>
--- hw/s390x/s390-virtio-ccw.c | 10 ++++++++++ target-s390x/cpu.h | 14 ++++++++++++++ target-s390x/kvm.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+)
hw/s390x/s390-virtio-ccw.c +10 -0
@@ -97,6 +97,7 @@ static void ccw_init(MachineState *machine)ram_addr_t pad_size =0 ;ram_addr_t maxmem =qemu_opt_get_size (opts,"maxmem" , my_ram_size);ram_addr_t standby_mem_size = maxmem - my_ram_size; +uint64_t kvm_limit;/* The storage increment size is a multiple of 1M and is a power of 2. * The number of storage increments must be MAX_STORAGE_INCREMENTS or fewer.
@@ -121,6 +122,15 @@ static void ccw_init(MachineState *machine)/* let's propagate the changed ram size into the global variable. */ ram_size = my_ram_size; + machine->maxram_size = my_ram_size + standby_mem_size; + + ret =s390_set_memory_limit (machine->maxram_size, &kvm_limit); +if (ret == -E2BIG ) { +hw_error ("qemu: host supports a maximum of %" PRIu64" GB" , + kvm_limit >>30 ); + }else if (ret) { +hw_error ("qemu: setting the guest size failed" ); + }/* get a BUS */ css_bus =virtual_css_bus_init ();
target-s390x/cpu.h +14 -0
@@ -1029,6 +1029,7 @@ int kvm_s390_get_memslot_count(KVMState *s);void kvm_s390_clear_cmma_callback (void *opaque);int kvm_s390_set_cpu_state (S390CPU *cpu,uint8_t cpu_state);void kvm_s390_reset_vcpu (S390CPU *cpu); +int kvm_s390_set_mem_limit (KVMState *s,uint64_t new_limit,uint64_t *hw_limit);#else static inline void kvm_s390_io_interrupt(uint16_t subchannel_id, uint16_t subchannel_nr,
@@ -1066,8 +1067,21 @@ static inline int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state)static inline void kvm_s390_reset_vcpu (S390CPU *cpu) { } +static inline int kvm_s390_set_mem_limit (KVMState *s,uint64_t new_limit, +uint64_t *hw_limit) +{ +return 0 ; +}#endif +static inline int s390_set_memory_limit (uint64_t new_limit,uint64_t *hw_limit) +{ +if (kvm_enabled ()) { +return kvm_s390_set_mem_limit (kvm_state, new_limit, hw_limit); + } +return 0 ; +} +static inline void cmma_reset (S390CPU *cpu) {if (kvm_enabled ()) {
target-s390x/kvm.c +45 -0
51 lines not on this page · raw message
Signature · 1 line
2.3.0
[Qemu-devel] [PULL 19/20] s390/bios: Make the s390-ccw.img relocatable
In reply to Christian BorntraegerFrom: Thomas Huth <[email protected]>
The current bios sits at location 0x7e00000 in the guest RAM and thus prevents loading of bigger ramdisks. By making the image relocatable we can move it to the end of the RAM so that it is getting out of the way.
Message-Id: <[email protected]>
--- hw/s390x/ipl.c | 23 +++++++++++++++++++++-- pc-bios/s390-ccw/Makefile | 11 ++++++----- 2 files changed, 27 insertions(+), 7 deletions(-)
hw/s390x/ipl.c +21 -2
@@ -14,6 +14,7 @@#include "sysemu/sysemu.h" #include "cpu.h" #include "elf.h" +#include "exec/ram_addr.h" #include "hw/loader.h" #include "hw/sysbus.h" #include "hw/s390x/virtio-ccw.h"
@@ -95,6 +96,16 @@ static const VMStateDescription vmstate_ipl = { } }; +static uint64_t bios_translate_addr (void *opaque,uint64_t srcaddr) +{ +uint64_t dstaddr = (uint64_t )opaque; +/* +* Assuming that our s390-ccw.img was linked for starting at address 0, +* we can simply add the destination address for the final location +*/ +return srcaddr + dstaddr; +} +static int s390_ipl_init (SysBusDevice *dev) {S390IPLState *ipl =S390_IPL (dev);
@@ -109,6 +120,8 @@ static int s390_ipl_init(SysBusDevice *dev)* even if an external kernel has been defined. */ if (!ipl->kernel || ipl->enforce_bios) { +uint64_t fwbase = (MIN (ram_size,0x80000000U ) -0x200000 ) & ~0xffffUL ; +if (bios_name ==NULL ) { bios_name = ipl->firmware; }
@@ -118,9 +131,15 @@ static int s390_ipl_init(SysBusDevice *dev)hw_error ("could not find stage1 bootloader\n" ); } - bios_size =load_elf (bios_filename,NULL ,NULL , &ipl->bios_start_addr, + bios_size =load_elf (bios_filename, bios_translate_addr, + (void *)fwbase, &ipl->bios_start_addr,NULL ,NULL ,1 ,ELF_MACHINE ,0 ); -if (bios_size <0 ) { + +if (bios_size >0 ) { +/* Adjust ELF start address to final location */ + ipl->bios_start_addr += fwbase; + }else { +/* Try to load non-ELF file (e.g. s390-zipl.rom) */ bios_size =load_image_targphys (bios_filename,ZIPL_IMAGE_START ,4096 ); ipl->bios_start_addr =ZIPL_IMAGE_START ;
pc-bios/s390-ccw/Makefile +6 -5
@@ -9,10 +9,9 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) .PHONY : all clean build-all -OBJECTS=main.o bootmap.o sclp-ascii.o virtio.o start.o -CFLAGS += -fno-stack-protector -# XXX find a more clever to locate the bootloader -LDFLAGS += -Wl,-Ttext,0x7e00000,-Tbss,0x7f00000 -nostdlib +OBJECTS = start.o main.o bootmap.o sclp-ascii.o virtio.o +CFLAGS += -fPIE -fno-stack-protector -ffreestanding +LDFLAGS += -Wl,-pie -nostdlib build-all: s390-ccw.img
@@ -20,7 +19,9 @@ s390-ccw.elf: $(OBJECTS) $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS)," Building $(TARGET_DIR)$@") s390-ccw.img: s390-ccw.elf - $(call quiet-command,strip $< -o $@," Stripping $(TARGET_DIR)$@") + $(call quiet-command,strip --strip-unneeded $< -o $@," Stripping $(TARGET_DIR)$@") + +$(OBJECTS): Makefile clean: rm -f *.o *.d *.img *.elf *~
Signature · 1 line
2.3.0
Quoted 10 lines · Christian Borntraeger
Peter,
this pull reuqest contains a header sync to 4.0-rc3. This should cause no merge conflicts with other header syncs against 4.0-rc2. So here is the s390 pull request.
The following changes since commit
277263e1b320d759a760ba6c5ea75ec268f929e5:Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging (2015-03-09 14:04:14 +0000)
Quoted 7 lines
are available in the git repository at:
git://github.com/borntraeger/qemu.gittags/s390x-20150310for you to fetch changes up to
6342cb1443b37d249a0e2005128ade07a80a97f5:s390-ccw: rebuild BIOS (2015-03-10 09:26:33 +0100)
Unfortunately I see build failures on 32 bit hosts:
/root/qemu/hw/s390x/ipl.c: In function ‘bios_translate_addr’:/root/qemu/hw/s390x/ipl.c:101:24: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] /root/qemu/hw/s390x/ipl.c: In function ‘s390_ipl_init’:/root/qemu/hw/s390x/ipl.c:135:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
-- PMM
Am 10.03.2015 um 19:01 schrieb Peter Maydell:
Quoted 19 lines · Christian Borntraeger
Quoted 10 lines
Peter,
this pull reuqest contains a header sync to 4.0-rc3. This should cause no merge conflicts with other header syncs against 4.0-rc2. So here is the s390 pull request.
The following changes since commit
277263e1b320d759a760ba6c5ea75ec268f929e5:Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging (2015-03-09 14:04:14 +0000)
Quoted 7 lines
are available in the git repository at:
git://github.com/borntraeger/qemu.gittags/s390x-20150310for you to fetch changes up to
6342cb1443b37d249a0e2005128ade07a80a97f5:s390-ccw: rebuild BIOS (2015-03-10 09:26:33 +0100)
Quoted 9 lines
Unfortunately I see build failures on 32 bit hosts:
/root/qemu/hw/s390x/ipl.c: In function ‘bios_translate_addr’:/root/qemu/hw/s390x/ipl.c:101:24: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]/root/qemu/hw/s390x/ipl.c: In function ‘s390_ipl_init’:/root/qemu/hw/s390x/ipl.c:135:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
O dear. Seems that every pull request after your vacation is somewhat broken. I fixed up patch 19 (" s390/bios: Make the s390-ccw.img relocatable") as such
hw/s390x/ipl.c +4 -4
@@ -98,7 +98,7 @@ static const VMStateDescription vmstate_ipl = {static uint64_t bios_translate_addr (void *opaque,uint64_t srcaddr) { -uint64_t dstaddr = (uint64_t )opaque; +uint64_t dstaddr = (uint64_t ) (unsigned long ) opaque;/* * Assuming that our s390-ccw.img was linked for starting at address 0, * we can simply add the destination address for the final location
@@ -132,9 +132,9 @@ static int s390_ipl_init(SysBusDevice *dev) } bios_size =load_elf (bios_filename, bios_translate_addr, - (void *)fwbase, &ipl->bios_start_addr, -NULL ,NULL ,1 ,ELF_MACHINE ,0 ); - + (void *) (unsigned long ) fwbase, + &ipl->bios_start_addr,NULL ,NULL ,1 , +ELF_MACHINE ,0 );if (bios_size >0 ) {/* Adjust ELF start address to final location */ ipl->bios_start_addr += fwbase;
Updated pull request will follow.
Quoted 42 lines · Christian Borntraeger
Am 10.03.2015 um 19:01 schrieb Peter Maydell:
Quoted 22 lines
Quoted 12 lines · Christian Borntraeger
Peter,
this pull reuqest contains a header sync to 4.0-rc3. This should cause no merge conflicts with other header syncs against 4.0-rc2. So here is the s390 pull request.
The following changes since commit
277263e1b320d759a760ba6c5ea75ec268f929e5:Merge remote-tracking branch
remotes/agraf/tags/signed-ppc-for-upstream' into staging (2015-03-09 14:04:14 +0000)Quoted 7 lines
are available in the git repository at:
git://github.com/borntraeger/qemu.gittags/s390x-20150310for you to fetch changes up to
6342cb1443b37d249a0e2005128ade07a80a97f5:s390-ccw: rebuild BIOS (2015-03-10 09:26:33 +0100)
Quoted 9 lines
Unfortunately I see build failures on 32 bit hosts:
/root/qemu/hw/s390x/ipl.c: In function ‘bios_translate_addr’:/root/qemu/hw/s390x/ipl.c:101:24: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]/root/qemu/hw/s390x/ipl.c: In function ‘s390_ipl_init’:/root/qemu/hw/s390x/ipl.c:135:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]O dear. Seems that every pull request after your vacation is somewhat broken. I fixed up patch 19 (" s390/bios: Make the s390-ccw.img relocatable") as such
hw/s390x/ipl.c +0
-0
hw/s390x/ipl.c static const VMStateDescription vmstate_ipl = { · line 104
Quoted 8 lines
hw/s390x/ipl.c +1
-1@@ -98,7 +98,7 @@ static const VMStateDescription vmstate_ipl = {static uint64_t bios_translate_addr (void *opaque,uint64_t srcaddr) { -uint64_t dstaddr = (uint64_t )opaque; +uint64_t dstaddr = (uint64_t ) (unsigned long ) opaque;/* * Assuming that our s390-ccw.img was linked for starting at address 0, * we can simply add the destination address for the final location
Won't this shift the warning from hosts where sizeof(void *) != sizeof(uint64_t) to hosts where it's != sizeof(unsigned long)?
What about using uintptr_t instead?
[...]
Quoted 35 lines · On Wed, 11 Mar 2015 08:57:34 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 33 lines · Christian Borntraeger
Am 10.03.2015 um 19:01 schrieb Peter Maydell:
Quoted 31 lines
Quoted 12 lines · Christian Borntraeger
Peter,
this pull reuqest contains a header sync to 4.0-rc3. This should cause no merge conflicts with other header syncs against 4.0-rc2. So here is the s390 pull request.
The following changes since commit
277263e1b320d759a760ba6c5ea75ec268f929e5:Merge remote-tracking branch
remotes/agraf/tags/signed-ppc-for-upstream' into staging (2015-03-09 14:04:14 +0000)Quoted 7 lines
are available in the git repository at:
git://github.com/borntraeger/qemu.gittags/s390x-20150310for you to fetch changes up to
6342cb1443b37d249a0e2005128ade07a80a97f5:s390-ccw: rebuild BIOS (2015-03-10 09:26:33 +0100)
Unfortunately I see build failures on 32 bit hosts:
/root/qemu/hw/s390x/ipl.c: In function ‘bios_translate_addr’:/root/qemu/hw/s390x/ipl.c:101:24: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]/root/qemu/hw/s390x/ipl.c: In function ‘s390_ipl_init’:/root/qemu/hw/s390x/ipl.c:135:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
Quoted 3 lines
Quoted 3 lines
O dear. Seems that every pull request after your vacation is somewhat broken. I fixed up patch 19 (" s390/bios: Make the s390-ccw.img relocatable") as such
Oops, sorry, should have tested my patch with -m32 as well :-/ Thanks for fixing, Christian!
Quoted 17 lines
hw/s390x/ipl.c static const VMStateDescription vmstate_ipl = { · line 104
Quoted 13 lines
hw/s390x/ipl.c +1
-1@@ -98,7 +98,7 @@ static const VMStateDescription vmstate_ipl = {static uint64_t bios_translate_addr (void *opaque,uint64_t srcaddr) { -uint64_t dstaddr = (uint64_t )opaque; +uint64_t dstaddr = (uint64_t ) (unsigned long ) opaque;/* * Assuming that our s390-ccw.img was linked for starting at address 0, * we can simply add the destination address for the final location Won't this shift the warning from hosts where
sizeof(void *)!=sizeof(uint64_t)to hosts where it's != sizeof(unsigned long)?
Quoted 1 line
What about using
uintptr_tinstead?
uintptr_t sounds also like the better solution to me.
Thomas
Am 11.03.2015 um 08:57 schrieb Markus Armbruster:
Quoted 45 lines
Quoted 43 lines · Christian Borntraeger
Am 10.03.2015 um 19:01 schrieb Peter Maydell:
Quoted 22 lines
Quoted 12 lines · Christian Borntraeger
Peter,
this pull reuqest contains a header sync to 4.0-rc3. This should cause no merge conflicts with other header syncs against 4.0-rc2. So here is the s390 pull request.
The following changes since commit
277263e1b320d759a760ba6c5ea75ec268f929e5:Merge remote-tracking branch
remotes/agraf/tags/signed-ppc-for-upstream' into staging (2015-03-09 14:04:14 +0000)Quoted 7 lines
are available in the git repository at:
git://github.com/borntraeger/qemu.gittags/s390x-20150310for you to fetch changes up to
6342cb1443b37d249a0e2005128ade07a80a97f5:s390-ccw: rebuild BIOS (2015-03-10 09:26:33 +0100)
Quoted 9 lines
Unfortunately I see build failures on 32 bit hosts:
/root/qemu/hw/s390x/ipl.c: In function ‘bios_translate_addr’:/root/qemu/hw/s390x/ipl.c:101:24: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]/root/qemu/hw/s390x/ipl.c: In function ‘s390_ipl_init’:/root/qemu/hw/s390x/ipl.c:135:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]O dear. Seems that every pull request after your vacation is somewhat broken. I fixed up patch 19 (" s390/bios: Make the s390-ccw.img relocatable") as such
hw/s390x/ipl.c +0
-0@@ -98,7 +98,7 @@ static const VMStateDescription vmstate_ipl = {
Quoted 10 lines
hw/s390x/ipl.c static const VMStateDescription vmstate_ipl = { · line 104
Quoted 7 lines
hw/s390x/ipl.c +1
-1static uint64_t bios_translate_addr (void *opaque,uint64_t srcaddr) { -uint64_t dstaddr = (uint64_t )opaque; +uint64_t dstaddr = (uint64_t ) (unsigned long ) opaque;/* * Assuming that our s390-ccw.img was linked for starting at address 0, * we can simply add the destination address for the final location Won't this shift the warning from hosts where
sizeof(void *)!=sizeof(uint64_t)to hosts where it's != sizeof(unsigned long)?
Indeed. I was only thinking about Linux, where sizeof(unsigned long) == sizeof(void*). But Windows has a different model. We have to cover all kind of lp64, llp64 and friends.
Quoted 1 line
What about using
uintptr_tinstead?
Should work. Will have a try on Linux 32bit/64bit..no way to test on windows, though :-(
Quoted 57 lines · On Wed, 11 Mar 2015 09:09:21 +0100 Christian Borntraeger…
Am 11.03.2015 um 08:57 schrieb Markus Armbruster:
Quoted 45 lines
Quoted 43 lines · Christian Borntraeger
Am 10.03.2015 um 19:01 schrieb Peter Maydell:
Quoted 22 lines
Quoted 12 lines · Christian Borntraeger
Peter,
this pull reuqest contains a header sync to 4.0-rc3. This should cause no merge conflicts with other header syncs against 4.0-rc2. So here is the s390 pull request.
The following changes since commit
277263e1b320d759a760ba6c5ea75ec268f929e5:Merge remote-tracking branch
remotes/agraf/tags/signed-ppc-for-upstream' into staging (2015-03-09 14:04:14 +0000)Quoted 7 lines
are available in the git repository at:
git://github.com/borntraeger/qemu.gittags/s390x-20150310for you to fetch changes up to
6342cb1443b37d249a0e2005128ade07a80a97f5:s390-ccw: rebuild BIOS (2015-03-10 09:26:33 +0100)
Quoted 9 lines
Unfortunately I see build failures on 32 bit hosts:
/root/qemu/hw/s390x/ipl.c: In function ‘bios_translate_addr’:/root/qemu/hw/s390x/ipl.c:101:24: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]/root/qemu/hw/s390x/ipl.c: In function ‘s390_ipl_init’:/root/qemu/hw/s390x/ipl.c:135:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]O dear. Seems that every pull request after your vacation is somewhat broken. I fixed up patch 19 (" s390/bios: Make the s390-ccw.img relocatable") as such
hw/s390x/ipl.c +0
-0@@ -98,7 +98,7 @@ static const VMStateDescription vmstate_ipl = {Quoted 10 lines
hw/s390x/ipl.c static const VMStateDescription vmstate_ipl = { · line 104
Quoted 7 lines
hw/s390x/ipl.c +1
-1static uint64_t bios_translate_addr (void *opaque,uint64_t srcaddr) { -uint64_t dstaddr = (uint64_t )opaque; +uint64_t dstaddr = (uint64_t ) (unsigned long ) opaque;/* * Assuming that our s390-ccw.img was linked for starting at address 0, * we can simply add the destination address for the final location Won't this shift the warning from hosts where
sizeof(void *)!=sizeof(uint64_t)to hosts where it's != sizeof(unsigned long)?
Quoted 6 lines
Indeed. I was only thinking about Linux, where sizeof(unsigned long) ==
sizeof(void*). But Windows has a different model. We have to cover all kind of lp64, llp64 and friends.Quoted 1 line
What about using
uintptr_tinstead?Should work. Will have a try on Linux 32bit/64bit..no way to test on windows, though :-(
Thinking about this again, I think the really proper solution is rather this:
hw/s390x/ipl.c +2 -2
@@ -98,7 +98,7 @@ static const VMStateDescription vmstate_ipl = {static uint64_t bios_translate_addr (void *opaque,uint64_t srcaddr) { -uint64_t dstaddr = (uint64_t )opaque; +uint64_t dstaddr = *(uint64_t *)opaque;/* * Assuming that our s390-ccw.img was linked for starting at address 0, * we can simply add the destination address for the final location
@@ -132,7 +132,7 @@ static int s390_ipl_init(SysBusDevice *dev) } bios_size =load_elf (bios_filename, bios_translate_addr, - (void *)fwbase, &ipl->bios_start_addr, + &fwbase, &ipl->bios_start_addr,NULL ,NULL ,1 ,ELF_MACHINE ,0 );if (bios_size >0 ) {
Instead of passing the uint64 value in the pointer, let's rather pass a pointer to that value instead. Then we can also be sure to get the full 64-bit value in bios_translate_addr().
Thomas
Am 11.03.2015 um 10:00 schrieb Thomas Huth:
Quoted 93 lines
Quoted 57 lines · On Wed, 11 Mar 2015 09:09:21 +0100 Christian Borntraeger…
Am 11.03.2015 um 08:57 schrieb Markus Armbruster:
Quoted 45 lines
Quoted 43 lines · Christian Borntraeger
Am 10.03.2015 um 19:01 schrieb Peter Maydell:
Quoted 22 lines
Quoted 12 lines · Christian Borntraeger
Peter,
this pull reuqest contains a header sync to 4.0-rc3. This should cause no merge conflicts with other header syncs against 4.0-rc2. So here is the s390 pull request.
The following changes since commit
277263e1b320d759a760ba6c5ea75ec268f929e5:Merge remote-tracking branch
remotes/agraf/tags/signed-ppc-for-upstream' into staging (2015-03-09 14:04:14 +0000)Quoted 7 lines
are available in the git repository at:
git://github.com/borntraeger/qemu.gittags/s390x-20150310for you to fetch changes up to
6342cb1443b37d249a0e2005128ade07a80a97f5:s390-ccw: rebuild BIOS (2015-03-10 09:26:33 +0100)
Quoted 9 lines
Unfortunately I see build failures on 32 bit hosts:
/root/qemu/hw/s390x/ipl.c: In function ‘bios_translate_addr’:/root/qemu/hw/s390x/ipl.c:101:24: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]/root/qemu/hw/s390x/ipl.c: In function ‘s390_ipl_init’:/root/qemu/hw/s390x/ipl.c:135:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]O dear. Seems that every pull request after your vacation is somewhat broken. I fixed up patch 19 (" s390/bios: Make the s390-ccw.img relocatable") as such
hw/s390x/ipl.c +0
-0@@ -98,7 +98,7 @@ static const VMStateDescription vmstate_ipl = {Quoted 10 lines
hw/s390x/ipl.c static const VMStateDescription vmstate_ipl = { · line 104
Quoted 7 lines
hw/s390x/ipl.c +1
-1static uint64_t bios_translate_addr (void *opaque,uint64_t srcaddr) { -uint64_t dstaddr = (uint64_t )opaque; +uint64_t dstaddr = (uint64_t ) (unsigned long ) opaque;/* * Assuming that our s390-ccw.img was linked for starting at address 0, * we can simply add the destination address for the final location Won't this shift the warning from hosts where
sizeof(void *)!=sizeof(uint64_t)to hosts where it's != sizeof(unsigned long)?Quoted 6 lines
Indeed. I was only thinking about Linux, where sizeof(unsigned long) ==
sizeof(void*). But Windows has a different model. We have to cover all kind of lp64, llp64 and friends.Quoted 1 line
What about using
uintptr_tinstead?Should work. Will have a try on Linux 32bit/64bit..no way to test on windows, though :-(
Thinking about this again, I think the really proper solution is rather this:
hw/s390x/ipl.c +2
-2@@ -98,7 +98,7 @@ static const VMStateDescription vmstate_ipl = {static uint64_t bios_translate_addr (void *opaque,uint64_t srcaddr) { -uint64_t dstaddr = (uint64_t )opaque; +uint64_t dstaddr = *(uint64_t *)opaque;/* * Assuming that our s390-ccw.img was linked for starting at address 0, * we can simply add the destination address for the final location @@ -132,7 +132,7 @@ static int s390_ipl_init(SysBusDevice *dev) } bios_size =load_elf (bios_filename, bios_translate_addr, - (void *)fwbase, &ipl->bios_start_addr, + &fwbase, &ipl->bios_start_addr,NULL ,NULL ,1 ,ELF_MACHINE ,0 );if (bios_size >0 ) {
Quoted 3 lines
Instead of passing the uint64 value in the pointer, let's rather pass a pointer to that value instead. Then we can also be sure to get the full 64-bit value in
bios_translate_addr().
Yes, thats even better. Will fixup and resend.