s390x patches for 2.5
cover s390x patches for 2.5
Hopefully last big batch of s390x patches, including:
- bugfixes for LE host and for pci translation
- MAINTAINERS update
- hugetlbfs enablement (kernel patches pending)
- boot from El Torito iso images on virtio-blk (boot from scsi pending)
- cleanup in the ipl device code
There's also a helper function for resetting busless devices in the qdev core in there.
Christian Borntraeger (1):
s390: deprecate the non-ccw machine in 2.5
Cornelia Huck (4):
s390x/css: sense data endianness
MAINTAINERS: update s390 file patterns
MAINTAINERS: update virtio-ccw/s390 git tree
pc-bios/s390-ccw: rebuild image
David Hildenbrand (3):
qdev: provide qdev_reset_all_fn()
s390x/ipl: clean up qom definitions and turn into TYPE_DEVICE s390x/ipl: switch error reporting to error_setg
Dominik Dingel (2):
s390x: switch to memory_region_allocate_system_memory s390x/kvm: don't enable CMMA when hugetlbfs will be used
Maxim Samoylov (4):
pc-bios/s390-ccw: Always adjust virtio sector count pc-bios/s390-ccw: ISO-9660 El Torito boot implementation pc-bios/s390-ccw: El Torito s390x boot entry check pc-bios/s390-ccw: El Torito 16-bit boot image size field workaround
Yi Min Zhao (1):
s390x/pci : fix up s390 pci iommu translation function
MAINTAINERS | 20 +++-- hw/core/qdev.c | 5 ++ hw/s390x/css.c | 6 ++ hw/s390x/ipl.c | 68 ++++----------- hw/s390x/ipl.h | 25 ++++++ hw/s390x/s390-pci-bus.c | 8 +- hw/s390x/s390-virtio-ccw.c | 3 +- hw/s390x/s390-virtio.c | 16 ++-- include/hw/qdev-core.h | 1 + pc-bios/s390-ccw.img | Bin 13856 -> 17760 bytes pc-bios/s390-ccw/bootmap.c | 206 +++++++++++++++++++++++++++++++++++++++++++++ pc-bios/s390-ccw/bootmap.h | 206 +++++++++++++++++++++++++++++++++++++++++++++ pc-bios/s390-ccw/virtio.c | 7 ++ pc-bios/s390-ccw/virtio.h | 8 +- target-s390x/kvm.c | 4 +- 15 files changed, 506 insertions(+), 77 deletions(-)
Signature · 1 line
2.6.3
PATCH 1/15 s390x/css: sense data endianness
We keep the device's sense data in a byte array (following the architecture), but the ecws are an array of 32 bit values. If we just blindly copy the values, the sense data will change from de-facto BE data to de-facto cpu-endian data, which means we end up doing an incorrect conversion on LE hosts.
Let's just explicitly convert to cpu-endianness while assembling the irb.
--- hw/s390x/css.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/s390x/css.c +6 -0
@@ -892,8 +892,14 @@ int css_do_tsch_get_irb(SubchDev *sch, IRB *target_irb, int *irb_len)/* If a unit check is pending, copy sense data. */ if ((s->dstat &SCSW_DSTAT_UNIT_CHECK ) && (p->chars &PMCW_CHARS_MASK_CSENSE )) { +int i; + irb.scsw.flags |=SCSW_FLAGS_MASK_ESWF |SCSW_FLAGS_MASK_ECTL ; +/* Attention: sense_data is already BE! */ memcpy (irb.ecw, sch->sense_data,sizeof (sch->sense_data)); +for (i =0 ; i <ARRAY_SIZE (irb.ecw); i++) { + irb.ecw[i] =be32_to_cpu (irb.ecw[i]); + } irb.esw[1 ] =0x01000000 | (sizeof (sch->sense_data) <<8 ); } }
Signature · 1 line
2.6.3
PATCH 2/15 s390x/pci : fix up s390 pci iommu translation function
In reply to Cornelia HuckFrom: Yi Min Zhao <[email protected]>
On s390x, each pci device has its own iommu, which is only properly setup in qemu once the mpcifc instruction used to register the translation table has been intercepted. Therefore, for a pci device that is not configured or has not been initialized, proper translation is neither required nor possible. Moreover, we may not have a host bridge device ready yet.
This was exposed by a recent vfio change that triggers iommu translation during the initialization of the vfio pci device. Let's do an early exit in that case.
--- hw/s390x/s390-pci-bus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
hw/s390x/s390-pci-bus.c +6 -2
@@ -309,8 +309,7 @@ static IOMMUTLBEntry s390_translate_iommu(MemoryRegion *iommu, hwaddr addr,uint64_t pte;uint32_t flags;S390PCIBusDevice *pbdev =container_of (iommu, S390PCIBusDevice, mr); -S390pciState *s =S390_PCI_HOST_BRIDGE (pci_device_root_bus (pbdev->pdev) - ->qbus.parent); +S390pciState *s;IOMMUTLBEntry ret = { .target_as = &address_space_memory, .iova =0 ,
@@ -319,8 +318,13 @@ static IOMMUTLBEntry s390_translate_iommu(MemoryRegion *iommu, hwaddr addr, .perm = IOMMU_NONE, }; +if (!pbdev->configured || !pbdev->pdev) { +return ret; + } +DPRINTF ("iommu trans addr 0x%" PRIx64"\n" , addr); + s =S390_PCI_HOST_BRIDGE (pci_device_root_bus (pbdev->pdev)->qbus.parent);/* s390 does not have an APIC mapped to main storage so we use * a separate AddressSpace only for msix notifications */
Signature · 1 line
2.6.3
PATCH 3/15 MAINTAINERS: update s390 file patterns
In reply to Cornelia HuckWe were missing some files, and some files should get an additional entry to add the people actually looking after the code.
--- MAINTAINERS | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
MAINTAINERS +6 -6
@@ -237,9 +237,12 @@ M: Cornelia Huck <[email protected]> M: Alexander Graf <[email protected]> S: Maintained F: target-s390x/kvm.c +F: target-s390x/ioinst.[ch] +F: target-s390x/machine.c F: hw/intc/s390_flic.c F: hw/intc/s390_flic_kvm.c F: include/hw/s390x/s390_flic.h +F: gdb-xml/s390*.xml X86 M: Paolo Bonzini <[email protected]>
@@ -637,14 +640,11 @@ M: Christian Borntraeger <[email protected]> M: Alexander Graf <[email protected]> S: Supported F: hw/char/sclp*.[hc] -F: hw/s390x/s390-virtio-ccw.c -F: hw/s390x/css.[hc] -F: hw/s390x/sclp*.[hc] -F: hw/s390x/ipl*.[hc] -F: hw/s390x/*pci*.[hc] -F: hw/s390x/s390-skeys*.c +F: hw/s390x/ +X: hw/s390x/s390-virtio-bus.[ch] F: include/hw/s390x/ F: pc-bios/s390-ccw/ +F: hw/watchdog/wdt_diag288.c T: git git://github.com/cohuck/qemu virtio-ccw-upstr UniCore32 Machines
Signature · 1 line
2.6.3
PATCH 4/15 MAINTAINERS: update virtio-ccw/s390 git tree
In reply to Cornelia HuckLet's reference the git branch I actually use, and add Christian's git tree.
--- MAINTAINERS | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
MAINTAINERS +6 -2
@@ -243,6 +243,8 @@ F: hw/intc/s390_flic.c F: hw/intc/s390_flic_kvm.c F: include/hw/s390x/s390_flic.h F: gdb-xml/s390*.xml +T: git git://github.com/cohuck/qemu.git s390-next +T: git git://github.com/borntraeger/qemu.git s390-next X86 M: Paolo Bonzini <[email protected]>
@@ -645,7 +647,8 @@ X: hw/s390x/s390-virtio-bus.[ch] F: include/hw/s390x/ F: pc-bios/s390-ccw/ F: hw/watchdog/wdt_diag288.c -T: git git://github.com/cohuck/qemu virtio-ccw-upstr +T: git git://github.com/cohuck/qemu.git s390-next +T: git git://github.com/borntraeger/qemu.git s390-next UniCore32 Machines -------------
@@ -872,7 +875,8 @@ M: Cornelia Huck <[email protected]> M: Christian Borntraeger <[email protected]> S: Supported F: hw/s390x/virtio-ccw.[hc] -T: git git://github.com/cohuck/qemu virtio-ccw-upstr +T: git git://github.com/cohuck/qemu.git s390-next +T: git git://github.com/borntraeger/qemu.git s390-next virtio-input M: Gerd Hoffmann <[email protected]>
Signature · 1 line
2.6.3
PATCH 5/15 s390x: switch to memory_region_allocate_system_memory
In reply to Cornelia HuckFrom: Dominik Dingel <[email protected]>
By replacing memory_region_init_ram with memory_region_allocate_system_memory we gain goodies like mem-path backends. This will allow us to use hugetlbfs once the kernel supports it.
--- hw/s390x/s390-virtio-ccw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
hw/s390x/s390-virtio-ccw.c +1 -2
@@ -104,8 +104,7 @@ void s390_memory_init(ram_addr_t mem_size)MemoryRegion *ram =g_new (MemoryRegion,1 );/* allocate RAM for core */ -memory_region_init_ram (ram,NULL ,"s390.ram" , mem_size, &error_fatal); -vmstate_register_ram_global (ram); +memory_region_allocate_system_memory (ram,NULL ,"s390.ram" , mem_size);memory_region_add_subregion (sysmem,0 , ram);/* Initialize storage key device */
Signature · 1 line
2.6.3
PATCH 6/15 s390x/kvm: don't enable CMMA when hugetlbfs will be used
In reply to Cornelia HuckFrom: Dominik Dingel <[email protected]>
On hugetlbfs CMMA will not be useful as every ESSA instruction will trap. So don't offer CMMA to guests with a hugepages backing.
--- target-s390x/kvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target-s390x/kvm.c +3 -1
@@ -258,7 +258,9 @@ int kvm_arch_init(MachineState *ms, KVMState *s) cap_mem_op =kvm_check_extension (s,KVM_CAP_S390_MEM_OP ); cap_s390_irq =kvm_check_extension (s,KVM_CAP_S390_INJECT_IRQ ); -kvm_s390_enable_cmma (s); +if (!mem_path) { +kvm_s390_enable_cmma (s); + }if (!kvm_check_extension (s,KVM_CAP_S390_GMAP ) || !kvm_check_extension (s,KVM_CAP_S390_COW )) {
Signature · 1 line
2.6.3
PATCH 7/15 pc-bios/s390-ccw: Always adjust virtio sector count
In reply to Cornelia HuckFrom: Maxim Samoylov <[email protected]>
Let's always adjust the sector number to be read using the current virtio block size value.
This prepares for the implementation of IPL from ISO-9660 media.
--- pc-bios/s390-ccw/virtio.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
pc-bios/s390-ccw/virtio.h +1 -6
@@ -199,14 +199,9 @@ extern int virtio_read_many(ulong sector, void *load_addr, int sec_num);#define VIRTIO_SECTOR_SIZE 512 -static inline ulong virtio_eckd_sector_adjust (ulong sector) -{ -return sector * (virtio_get_block_size () /VIRTIO_SECTOR_SIZE ); -} -static inline ulong virtio_sector_adjust (ulong sector) { -return virtio_disk_is_eckd () ?virtio_eckd_sector_adjust (sector) : sector; +return sector * (virtio_get_block_size () /VIRTIO_SECTOR_SIZE ); }#endif /* VIRTIO_H */
Signature · 1 line
2.6.3
PATCH 8/15 pc-bios/s390-ccw: ISO-9660 El Torito boot implementation
In reply to Cornelia HuckFrom: Maxim Samoylov <[email protected]>
This patch enables boot from media formatted according to ISO-9660 and El Torito bootable CD specification.
We try to boot from device as ISO-9660 media when SCSI IPL failed.
The first boot catalog entry with bootable flag is used.
ISO-9660 media with default 2048-bytes sector size only is supported.
--- pc-bios/s390-ccw/bootmap.c | 107 +++++++++++++++++++++++++ pc-bios/s390-ccw/bootmap.h | 191 +++++++++++++++++++++++++++++++++++++++++++++ pc-bios/s390-ccw/virtio.c | 7 ++ pc-bios/s390-ccw/virtio.h | 1 + 4 files changed, 306 insertions(+)
pc-bios/s390-ccw/bootmap.c +107 -0
@@ -445,6 +445,107 @@ static void ipl_scsi(void) }/*********************************************************************** +* IPL El Torito ISO9660 image or DVD +*/ + +static bool is_iso_bc_entry_compatible (IsoBcSection *s) +{ +return true; +} + +static void load_iso_bc_entry (IsoBcSection *load) +{ +IsoBcSection s = *load; +/* +* According to spec, extent for each file +* is padded and ISO_SECTOR_SIZE bytes aligned +*/ +uint32_t blks_to_load =bswap16 (s.sector_count) >>ET_SECTOR_SHIFT ; + +read_iso_boot_image (bswap32 (s.load_rba), + (void *)((uint64_t )bswap16 (s.load_segment)), + blks_to_load); + +/* Trying to get PSW at zero address */ +if (*((uint64_t *)0 ) &IPL_PSW_MASK ) { +jump_to_IPL_code ((*((uint64_t *)0 )) &0x7fffffff ); + } + +/* Try default linux start address */ +jump_to_IPL_code (KERN_IMAGE_START ); +} + +static uint32_t find_iso_bc (void ) +{ +IsoVolDesc *vd = (IsoVolDesc *)sec; +uint32_t block_num =ISO_PRIMARY_VD_SECTOR ; + +if (virtio_read_many (block_num++, sec,1 )) { +/* If primary vd cannot be read, there is no boot catalog */ +return 0 ; + } + +while (is_iso_vd_valid (vd) && vd->type !=VOL_DESC_TERMINATOR ) { +if (vd->type ==VOL_DESC_TYPE_BOOT ) { +IsoVdElTorito *et = &vd->vd.boot; + +if (!_memcmp (&et->el_torito[0 ], el_torito_magic,32 )) { +return bswap32 (et->bc_offset); + } + } +read_iso_sector (block_num++, sec, +"Failed to read ISO volume descriptor" ); + } + +return 0 ; +} + +static IsoBcSection *find_iso_bc_entry (void ) +{ +IsoBcEntry *e = (IsoBcEntry *)sec; +uint32_t offset =find_iso_bc (); +int i; + +if (!offset) { +return NULL ; + } + +read_iso_sector (offset, sec,"Failed to read El Torito boot catalog" ); + +if (!is_iso_bc_valid (e)) { +/* The validation entry is mandatory */ +virtio_panic ("No valid boot catalog found!\n" ); +return NULL ; + } + +/* +* Each entry has 32 bytes size, so one sector cannot contain > 64 entries. +* We consider only boot catalogs with no more than 64 entries. +*/ +for (i =1 ; i <ISO_BC_ENTRY_PER_SECTOR ; i++) { +if (e[i].id ==ISO_BC_BOOTABLE_SECTION ) { +if (is_iso_bc_entry_compatible (&e[i].body.sect)) { +return &e[i].body.sect; + } + } + } + +virtio_panic ("No suitable boot entry found on ISO-9660 media!\n" ); + +return NULL ; +} + +static void ipl_iso_el_torito (void ) +{ +IsoBcSection *s =find_iso_bc_entry (); + +if (s) { +load_iso_bc_entry (s); +/* no return */ + } +} + +/*********************************************************************** * IPL starts here */
@@ -463,6 +564,12 @@ void zipl_load(void)ipl_scsi ();/* no return */ } +/* Check if we can boot as ISO media */ +if (virtio_guessed_disk_nature ()) { +virtio_assume_iso9660 (); + } +ipl_iso_el_torito (); +/* We have failed to follow the SCSI scheme, so */ if (virtio_guessed_disk_nature ()) {sclp_print ("Using guessed DASD geometry.\n" );
pc-bios/s390-ccw/bootmap.h +191 -0
195 lines not on this page · raw message
pc-bios/s390-ccw/virtio.c +7 -0
@@ -278,6 +278,13 @@ void virtio_assume_scsi(void) blk_cfg.physical_block_exp =0 ; } +void virtio_assume_iso9660 (void ) +{ + guessed_disk_nature = true; + blk_cfg.blk_size =2048 ; + blk_cfg.physical_block_exp =0 ; +} +void virtio_assume_eckd (void ) { guessed_disk_nature = true;
pc-bios/s390-ccw/virtio.h +1 -0
@@ -187,6 +187,7 @@ typedef struct VirtioBlkConfig {bool virtio_guessed_disk_nature (void );void virtio_assume_scsi (void );void virtio_assume_eckd (void ); +void virtio_assume_iso9660 (void );extern bool virtio_disk_is_scsi (void );extern bool virtio_disk_is_eckd (void );
Signature · 1 line
2.6.3
PATCH 9/15 pc-bios/s390-ccw: El Torito s390x boot entry check
In reply to Cornelia HuckFrom: Maxim Samoylov <[email protected]>
Boot entry is considered compatible if boot image is Linux kernel with matching S390 Linux magic string.
Empty boot images with sector_count == 0 are considered broken.
--- pc-bios/s390-ccw/bootmap.c | 11 ++++++++++- pc-bios/s390-ccw/bootmap.h | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
pc-bios/s390-ccw/bootmap.c +10 -1
@@ -450,7 +450,16 @@ static void ipl_scsi(void)static bool is_iso_bc_entry_compatible (IsoBcSection *s) { -return true; +uint8_t *magic_sec = (uint8_t *)(sec +ISO_SECTOR_SIZE ); + +if (s->unused || !s->sector_count) { +return false; + } +read_iso_sector (bswap32 (s->load_rba), magic_sec, +"Failed to read image sector 0" ); + +/* Checking bytes 8 - 32 for S390 Linux magic */ +return !_memcmp (magic_sec +8 , linux_s390_magic,24 ); }static void load_iso_bc_entry (IsoBcSection *load)
pc-bios/s390-ccw/bootmap.h +8 -0
@@ -495,6 +495,14 @@ typedef struct IsoBcHdr {uint8_t id[28 ]; } __attribute__((packed)) IsoBcHdr; +/* +* Match two CCWs located after PSW and eight filler bytes. +* From libmagic and arch/s390/kernel/head.S. +*/ +const uint8_t linux_s390_magic[] ="\x02\x00\x00\x18\x60\x00\x00\x50\x02\x00" +"\x00\x68\x60\x00\x00\x50\x40\x40\x40\x40" +"\x40\x40\x40\x40" ; + typedef struct IsoBcEntry { uint8_t id; union {
Signature · 1 line
2.6.3
PATCH 10/15 pc-bios/s390-ccw: El Torito 16-bit boot image size field workaround
In reply to Cornelia HuckFrom: Maxim Samoylov <[email protected]>
Because of El Torito spec flaw boot image size needs to be verified.
Boot catalog entry size field has 16-bit width, and specifies size in 512-byte units.
Thus, boot image size cannot exceed 32M.
We actually search for the file to get the file size.
This is done by scanning the ISO directory tree for the ISO block number and reading the file size from the directory entry.
--- pc-bios/s390-ccw/bootmap.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++ pc-bios/s390-ccw/bootmap.h | 7 ++++ 2 files changed, 97 insertions(+)
pc-bios/s390-ccw/bootmap.c +90 -0
@@ -462,6 +462,87 @@ static bool is_iso_bc_entry_compatible(IsoBcSection *s)return !_memcmp (magic_sec +8 , linux_s390_magic,24 ); } +/* Location of the current sector of the directory */ +static uint32_t sec_loc[ISO9660_MAX_DIR_DEPTH ]; +/* Offset in the current sector of the directory */ +static uint32_t sec_offset[ISO9660_MAX_DIR_DEPTH ]; +/* Remained directory space in bytes */ +static uint32_t dir_rem[ISO9660_MAX_DIR_DEPTH ]; + +static inline uint32_t iso_get_file_size (uint32_t load_rba) +{ +IsoVolDesc *vd = (IsoVolDesc *)sec; +IsoDirHdr *cur_record = &vd->vd.primary.rootdir; +uint8_t *temp = sec +ISO_SECTOR_SIZE ; +int level =0 ; + +read_iso_sector (ISO_PRIMARY_VD_SECTOR , sec, +"Failed to read ISO primary descriptor" ); + sec_loc[0 ] =iso_733_to_u32 (cur_record->ext_loc); + dir_rem[0 ] =0 ; + sec_offset[0 ] =0 ; + +while (level >=0 ) { +IPL_assert (sec_offset[level] <=ISO_SECTOR_SIZE , +"Directory tree structure violation" ); + + cur_record = (IsoDirHdr *)(temp + sec_offset[level]); + +if (sec_offset[level] ==0 ) { +read_iso_sector (sec_loc[level], temp, +"Failed to read ISO directory" ); +if (dir_rem[level] ==0 ) { +/* Skip self and parent records */ + dir_rem[level] =iso_733_to_u32 (cur_record->data_len) - + cur_record->dr_len; + sec_offset[level] += cur_record->dr_len; + + cur_record = (IsoDirHdr *)(temp + sec_offset[level]); + dir_rem[level] -= cur_record->dr_len; + sec_offset[level] += cur_record->dr_len; +continue ; + } + } + +if (!cur_record->dr_len || sec_offset[level] ==ISO_SECTOR_SIZE ) { +/* Zero-padding and/or the end of current sector */ + dir_rem[level] -=ISO_SECTOR_SIZE - sec_offset[level]; + sec_offset[level] =0 ; + sec_loc[level]++; + }else { +/* The directory record is valid */ +if (load_rba ==iso_733_to_u32 (cur_record->ext_loc)) { +return iso_733_to_u32 (cur_record->data_len); + } + + dir_rem[level] -= cur_record->dr_len; + sec_offset[level] += cur_record->dr_len; + +if (cur_record->file_flags &0x2 ) { +/* Subdirectory */ +if (level ==ISO9660_MAX_DIR_DEPTH -1 ) { +sclp_print ("ISO-9660 directory depth limit exceeded\n" ); + }else { + level++; + sec_loc[level] =iso_733_to_u32 (cur_record->ext_loc); + sec_offset[level] =0 ; + dir_rem[level] =0 ; +continue ; + } + } + } + +if (dir_rem[level] ==0 ) { +/* Nothing remaining */ + level--; +read_iso_sector (sec_loc[level], temp, +"Failed to read ISO directory" ); + } + } + +return 0 ; +} +static void load_iso_bc_entry (IsoBcSection *load) {IsoBcSection s = *load;
@@ -470,6 +551,15 @@ static void load_iso_bc_entry(IsoBcSection *load)* is padded and ISO_SECTOR_SIZE bytes aligned */ uint32_t blks_to_load =bswap16 (s.sector_count) >>ET_SECTOR_SHIFT ; +uint32_t real_size =iso_get_file_size (bswap32 (s.load_rba)); + +if (real_size) { +/* Round up blocks to load */ + blks_to_load = (real_size +ISO_SECTOR_SIZE -1 ) /ISO_SECTOR_SIZE ; +sclp_print ("ISO boot image size verified\n" ); + }else { +sclp_print ("ISO boot image size could not be verified\n" ); + } read_iso_boot_image(bswap32(s.load_rba), (void *)((uint64_t)bswap16(s.load_segment)),
pc-bios/s390-ccw/bootmap.h +7 -0
@@ -381,6 +381,11 @@ static inline uint64_t bswap64(uint64_t x) ((x &0xff00000000000000ULL ) >>56 ); } +static inline uint32_t iso_733_to_u32 (uint64_t x) +{ +return (uint32_t )x; +} +#define ISO_SECTOR_SIZE 2048/* El Torito specifies boot image size in 512 byte blocks */ #define ET_SECTOR_SHIFT 2
@@ -407,6 +412,8 @@ static inline void read_iso_boot_image(uint32_t block_offset, void *load_addr,const uint8_t el_torito_magic[] ="EL TORITO SPECIFICATION" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ; +#define ISO9660_MAX_DIR_DEPTH 8 + typedef struct IsoDirHdr { uint8_t dr_len; uint8_t ear_len;
Signature · 1 line
2.6.3
PATCH 11/15 pc-bios/s390-ccw: rebuild image
In reply to Cornelia HuckContains:
pc-bios/s390-ccw: Always adjust virtio sector count pc-bios/s390-ccw: ISO-9660 El Torito boot implementation pc-bios/s390-ccw: El Torito s390x boot entry check pc-bios/s390-ccw: El Torito 16-bit boot image size field workaround
--- pc-bios/s390-ccw.img | Bin 13856 -> 17760 bytes 1 file changed, 0 insertions(+), 0 deletions(-)
pc-bios/s390-ccw.img binary +0 -0
Signature · 1 line
2.6.3
PATCH 12/15 qdev: provide qdev_reset_all_fn()
In reply to Cornelia HuckFrom: David Hildenbrand <[email protected]>
For TYPE_DEVICE, the dc->reset() function is not called on system resets yet. Until that is changed, we have to manually register a reset handler. Let's provide qdev_reset_all_fn(), that can directly be used - just like the reset handler that is already available for qbus.
--- hw/core/qdev.c | 5 +++++ include/hw/qdev-core.h | 1 + 2 files changed, 6 insertions(+)
hw/core/qdev.c +5 -0
@@ -325,6 +325,11 @@ void qdev_reset_all(DeviceState *dev)qdev_walk_children (dev,NULL ,NULL , qdev_reset_one, qbus_reset_one,NULL ); } +void qdev_reset_all_fn (void *opaque) +{ +qdev_reset_all (DEVICE (opaque)); +} +void qbus_reset_all (BusState *bus) {qbus_walk_children (bus,NULL ,NULL , qdev_reset_one, qbus_reset_one,NULL );
include/hw/qdev-core.h +1 -0
@@ -337,6 +337,7 @@ int qdev_walk_children(DeviceState *dev, void *opaque);void qdev_reset_all (DeviceState *dev); +void qdev_reset_all_fn (void *opaque);/** * @qbus_reset_all:
Signature · 1 line
2.6.3
PATCH 13/15 s390x/ipl: clean up qom definitions and turn into TYPE_DEVICE
In reply to Cornelia HuckFrom: David Hildenbrand <[email protected]>
Let's move the qom definitions of the ipl device into ipl.h, replace "s390-ipl" by a proper type define, turn it into a TYPE_DEVICE and remove the unneeded class definition.
--- hw/s390x/ipl.c | 52 ++++++-------------------------------------------- hw/s390x/ipl.h | 25 ++++++++++++++++++++++++ hw/s390x/s390-virtio.c | 10 +++++----- 3 files changed, 36 insertions(+), 51 deletions(-)
hw/s390x/ipl.c +6 -46
@@ -15,7 +15,6 @@#include "cpu.h" #include "elf.h" #include "hw/loader.h" -#include "hw/sysbus.h" #include "hw/s390x/virtio-ccw.h" #include "hw/s390x/css.h" #include "ipl.h"
@@ -29,44 +28,6 @@#define ZIPL_IMAGE_START 0x009000UL#define IPL_PSW_MASK (PSW_MASK_32 | PSW_MASK_64) -#define TYPE_S390_IPL "s390-ipl" -#define S390_IPL (obj) \ - OBJECT_CHECK(S390IPLState, (obj), TYPE_S390_IPL) -#if 0 -#define S390_IPL_CLASS (klass) \ - OBJECT_CLASS_CHECK(S390IPLState, (klass), TYPE_S390_IPL) -#define S390_IPL_GET_CLASS (obj) \ - OBJECT_GET_CLASS(S390IPLState, (obj), TYPE_S390_IPL) -#endif - -typedef struct S390IPLClass { -/*< private >*/ -SysBusDeviceClass parent_class; -/*< public >*/ - -void (*parent_reset) (SysBusDevice *dev); -}S390IPLClass ; - -typedef struct S390IPLState { -/*< private >*/ -SysBusDevice parent_obj; -uint64_t start_addr; -uint64_t bios_start_addr; -bool enforce_bios; -IplParameterBlock iplb; -bool iplb_valid; -bool reipl_requested; - -/*< public >*/ -char *kernel; -char *initrd; -char *cmdline; -char *firmware; -uint8_t cssid; -uint8_t ssid; -uint16_t devno; -}S390IPLState ; -static const VMStateDescription vmstate_iplb = { .name ="ipl/iplb" , .version_id =0 ,
@@ -110,7 +71,7 @@ static uint64_t bios_translate_addr(void *opaque, uint64_t srcaddr)return srcaddr + dstaddr; } -static int s390_ipl_init (SysBusDevice *dev) +static void s390_ipl_realize (DeviceState *dev,Error **errp) {S390IPLState *ipl =S390_IPL (dev);uint64_t pentry =KERN_IMAGE_START ;
@@ -165,7 +126,7 @@ static int s390_ipl_init(SysBusDevice *dev) }if (kernel_size <0 ) {fprintf (stderr,"could not load kernel '%s'\n" , ipl->kernel); -return -1 ; +exit (1 ); }/* * Is it a Linux kernel (starting at 0x10000)? If yes, we fill in the
@@ -205,7 +166,7 @@ static int s390_ipl_init(SysBusDevice *dev)stq_p (rom_ptr (INITRD_PARM_SIZE ), initrd_size); } } -return 0 ; +qemu_register_reset (qdev_reset_all_fn, dev); }static Property s390_ipl_properties[] = {
@@ -308,9 +269,8 @@ static void s390_ipl_reset(DeviceState *dev)static void s390_ipl_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); -SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - k->init = s390_ipl_init; + dc->realize = s390_ipl_realize; dc->props = s390_ipl_properties; dc->reset = s390_ipl_reset; dc->vmsd = &vmstate_ipl;
@@ -319,8 +279,8 @@ static void s390_ipl_class_init(ObjectClass *klass, void *data)static const TypeInfo s390_ipl_info = { .class_init = s390_ipl_class_init, - .parent =TYPE_SYS_BUS_DEVICE , - .name ="s390-ipl" , + .parent =TYPE_DEVICE , + .name =TYPE_S390_IPL , .instance_size =sizeof (S390IPLState), };
hw/s390x/ipl.h +25 -0
@@ -12,6 +12,7 @@ #ifndef HW_S390_IPL_H #define HW_S390_IPL_H +#include "hw/qdev.h" #include "cpu.h" typedef struct IplParameterBlock {
@@ -25,4 +26,28 @@ void s390_ipl_prepare_cpu(S390CPU *cpu);IplParameterBlock *s390_ipl_get_iplb (void );void s390_reipl_request (void ); +#define TYPE_S390_IPL "s390-ipl" +#define S390_IPL (obj) OBJECT_CHECK(S390IPLState, (obj), TYPE_S390_IPL) + +struct S390IPLState { +/*< private >*/ +DeviceState parent_obj; +uint64_t start_addr; +uint64_t bios_start_addr; +bool enforce_bios; +IplParameterBlock iplb; +bool iplb_valid; +bool reipl_requested; + +/*< public >*/ +char *kernel; +char *initrd; +char *cmdline; +char *firmware; +uint8_t cssid; +uint8_t ssid; +uint16_t devno; +}; +typedef struct S390IPLState S390IPLState ; +#endif
hw/s390x/s390-virtio.c +5 -5
@@ -31,7 +31,6 @@#include "hw/boards.h" #include "hw/loader.h" #include "hw/virtio/virtio.h" -#include "hw/sysbus.h" #include "sysemu/kvm.h" #include "exec/address-spaces.h"
@@ -151,9 +150,9 @@ void s390_init_ipl_dev(const char *kernel_filename,const char *firmware, bool enforce_bios) { - DeviceState *dev; + Object *new = object_new(TYPE_S390_IPL); +DeviceState *dev =DEVICE (new); - dev =qdev_create (NULL ,"s390-ipl" );if (kernel_filename) {qdev_prop_set_string (dev,"kernel" , kernel_filename); }
@@ -163,8 +162,9 @@ void s390_init_ipl_dev(const char *kernel_filename,qdev_prop_set_string (dev,"cmdline" , kernel_cmdline);qdev_prop_set_string (dev,"firmware" , firmware);qdev_prop_set_bit (dev,"enforce_bios" , enforce_bios); -object_property_add_child (qdev_get_machine (),"s390-ipl" , -OBJECT (dev),NULL ); +object_property_add_child (qdev_get_machine (),TYPE_S390_IPL , + new,NULL ); +object_unref (new);qdev_init_nofail (dev); }
Signature · 1 line
2.6.3
PATCH 14/15 s390x/ipl: switch error reporting to error_setg
In reply to Cornelia HuckFrom: David Hildenbrand <[email protected]>
Now that we can report errors in the realize function, let's replace the fprintf's and hw_error's with error_setg.
--- hw/s390x/ipl.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
hw/s390x/ipl.c +11 -7
@@ -76,6 +76,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)S390IPLState *ipl =S390_IPL (dev);uint64_t pentry =KERN_IMAGE_START ;int kernel_size; +Error *l_err =NULL ;int bios_size;char *bios_filename;
@@ -93,7 +94,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) bios_filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name);if (bios_filename ==NULL ) { -hw_error ("could not find stage1 bootloader\n" ); +error_setg (&l_err,"could not find stage1 bootloader\n" ); + goto error; } bios_size = load_elf(bios_filename, bios_translate_addr, &fwbase,
@@ -111,7 +113,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)g_free (bios_filename);if (bios_size ==-1 ) { -hw_error ("could not load bootloader '%s'\n" , bios_name); +error_setg (&l_err,"could not load bootloader '%s'\n" , bios_name); + goto error; }/* default boot target is the bios */
@@ -125,8 +128,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) kernel_size =load_image_targphys (ipl->kernel,0 , ram_size); }if (kernel_size <0 ) { -fprintf (stderr,"could not load kernel '%s'\n" , ipl->kernel); -exit (1 ); +error_setg (&l_err,"could not load kernel '%s'\n" , ipl->kernel); + goto error; }/* * Is it a Linux kernel (starting at 0x10000)? If yes, we fill in the
@@ -153,9 +156,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) initrd_size =load_image_targphys (ipl->initrd, initrd_offset, ram_size - initrd_offset);if (initrd_size ==-1 ) { -fprintf (stderr,"qemu: could not load initrd '%s'\n" , - ipl->initrd); -exit (1 ); +error_setg (&l_err,"could not load initrd '%s'\n" , ipl->initrd); + goto error; }/*
@@ -167,6 +169,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) } }qemu_register_reset (qdev_reset_all_fn, dev); +error: +error_propagate (errp, l_err); }static Property s390_ipl_properties[] = {
Signature · 1 line
2.6.3
PATCH 15/15 s390: deprecate the non-ccw machine in 2.5
In reply to Cornelia HuckFrom: Christian Borntraeger <[email protected]>
The non-ccw machine for s390 (s390-virtio) is not very well maintained and caused several issues in the past:
- aliases like virtio-blk did not work for s390
- virtio refactoring failed due to long standing bugs (e.g.see commit cb927b8a "s390-virtio: Accommodate guests using virtqueues too early")
- some features like memory hotplug will cause trouble due to virtio storage being above guest memory
- the boot loader bios no longer seems to work. the source code of that loader is also no longer maintained
2.4 changed the default to the ccw machine, let's deprecate the old machine for 2.5.
Message-Id: <[email protected]>
--- hw/s390x/s390-virtio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
hw/s390x/s390-virtio.c +5 -1
@@ -268,6 +268,10 @@ static void s390_init(MachineState *machine)hwaddr virtio_region_len;hwaddr virtio_region_start; +error_printf ("WARNING\n" +"The s390-virtio machine (non-ccw) is deprecated.\n" +"It will be removed in 2.6. Please use s390-ccw-virtio\n" ); +if (machine->ram_slots) {error_report ("Memory hotplug not supported by the selected machine." );exit (EXIT_FAILURE );
@@ -334,7 +338,7 @@ static void s390_machine_class_init(ObjectClass *oc, void *data)NMIClass *nc =NMI_CLASS (oc); mc->alias ="s390" ; - mc->desc ="VirtIO based S390 machine" ; + mc->desc ="VirtIO based S390 machine (deprecated)" ; mc->init = s390_init; mc->reset = s390_machine_reset; mc->block_default_type =IF_VIRTIO ;
Signature · 1 line
2.6.3
Am 09.11.2015 um 16:56 schrieb Cornelia Huck:
Quoted 38 lines
Hopefully last big batch of s390x patches, including:
- bugfixes for LE host and for pci translation
-MAINTAINERSupdate
- hugetlbfs enablement (kernel patches pending)
- boot from El Torito iso images on virtio-blk (boot from scsi pending)
- cleanup in the ipl device codeThere's also a helper function for resetting busless devices in the qdev core in there.
Christian Borntraeger (1):
s390: deprecate the non-ccw machine in 2.5Cornelia Huck (4):
s390x/css: sense data endianness
MAINTAINERS: update s390 file patterns
MAINTAINERS: update virtio-ccw/s390 git tree
pc-bios/s390-ccw: rebuild imageDavid Hildenbrand (3):
qdev: provideqdev_reset_all_fn()
s390x/ipl: clean up qom definitions and turn intoTYPE_DEVICEs390x/ipl: switch error reporting toerror_setgDominik Dingel (2):
s390x: switch tomemory_region_allocate_system_memorys390x/kvm: don't enable CMMA when hugetlbfs will be usedMaxim Samoylov (4):
pc-bios/s390-ccw: Always adjust virtio sector count pc-bios/s390-ccw: ISO-9660 El Torito boot implementation pc-bios/s390-ccw: El Torito s390x boot entry check pc-bios/s390-ccw: El Torito 16-bit boot image size field workaroundYi Min Zhao (1):
s390x/pci : fix up s390 pci iommu translation function
Quoted 17 lines
MAINTAINERS | 20 +++-- hw/core/qdev.c | 5 ++ hw/s390x/css.c | 6 ++ hw/s390x/ipl.c | 68 ++++----------- hw/s390x/ipl.h | 25 ++++++ hw/s390x/s390-pci-bus.c | 8 +- hw/s390x/s390-virtio-ccw.c | 3 +- hw/s390x/s390-virtio.c | 16 ++-- include/hw/qdev-core.h | 1 + pc-bios/s390-ccw.img | Bin 13856 -> 17760 bytes pc-bios/s390-ccw/bootmap.c | 206 +++++++++++++++++++++++++++++++++++++++++++++ pc-bios/s390-ccw/bootmap.h | 206 +++++++++++++++++++++++++++++++++++++++++++++ pc-bios/s390-ccw/virtio.c | 7 ++ pc-bios/s390-ccw/virtio.h | 8 +- target-s390x/kvm.c | 4 +- 15 files changed, 506 insertions(+), 77 deletions(-)
Series looks good for 2.5.