aboutsummaryrefslogtreecommitdiffstats
path: root/src/hw/virtio-scsi.c
Commit message (Collapse)AuthorAgeFilesLines
* virtio-mmio: add support for scsi devices.Gerd Hoffmann2020-05-151-11/+62
| | | | | | | | | | | | | | | Add new fields to struct virtio_lun_s for mmio support, add mmio parameter to virtio_scsi_init_lun(), so both pci and mmio devices can be handled. Add and use bootprio_find_scsi_mmio_device() to figure boot priority of devices connected to a virtio-mmio scsi controller. Finally add init_virtio_scsi_mmio() to initialize one virtio-mmio scsi controller. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio-scsi: skip initializing non-bootable devicesGerd Hoffmann2020-01-141-1/+10
| | | | | | | Check each disk attached to a virtio-scsi device whenever it is bootable and skip initialization in case it isn't. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio: Do not init non-bootable devicesAlexey Kirillov2020-01-141-1/+10
| | | | | | | | | | | Because initializing a virtio-blk or virtio-scsi device requires a large amount of memory, you cannot create more than about 10 virtio devices. Since initialization is required for booting from media, we will not initialize those devices that are not in the boot order list. Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru> Message-id: 20200107171917.7535-3-lekiravi@yandex-team.ru Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* geometry: Apply LCHS values for boot devicesSam Eiderman2019-11-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Boot devices which use overriden LCHS values are: * ata * ahci * scsi * esp * lsi * megasas * mpt * pvscsi * virtio * virtio-blk We use these values in get_translation() and setup_translation() by introducing a new translation type: "TRANSLATION_HOST". We treat this translation as TRANSLATION_NONE in fill_ata_edd(), although this does not really matter since now the translation between physical and logical geometry does not exist. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190626123816.8907-6-shmuel.eiderman@oracle.com>
* Revert "geometry: Apply LCHS values for boot devices"Gerd Hoffmann2019-11-181-2/+0
| | | | This reverts commit 9caa19be0e534c687081fbdfcd301406e728c98c.
* geometry: Apply LCHS values for boot devicesSam Eiderman2019-11-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Boot devices which use overriden LCHS values are: * ata * ahci * scsi * esp * lsi * megasas * mpt * pvscsi * virtio * virtio-blk We use these values in get_translation() and setup_translation() by introducing a new translation type: "TRANSLATION_MACHINE". We treat this translation as TRANSLATION_NONE in fill_ata_edd(), although this does not really matter since now the translation between physical and logical geometry does not exist. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190612093704.47175-6-shmuel.eiderman@oracle.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio: Allocate drive_s storage in low memoryKevin O'Connor2017-09-271-2/+1
| | | | | | | | Use the "low" memory segment instead of the f-segment for the drive_s storage. This can help avoid running out of memory in the f-segment. Tested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* block: Rename disk_op_s->drive_gf to drive_flKevin O'Connor2017-09-271-1/+1
| | | | | | | | | | Now that the drive_s struct does not need to be in the f-segment, rename references to drive_gf in the generic drive code to drive_fl. This is just variable renames - no code changes. Tested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* virtio: IOMMU supportJason Wang2017-07-071-1/+2
| | | | | | | | | Since we don't enable IOMMU at all, we can then simply enable the IOMMU support by claiming the support of VIRITO_F_IOMMU_PLATFORM. This fixes booting failure when iommu_platform is set from qemu cli. Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
* virtio-scsi: enumerate luns with REPORT LUNSRoman Kagan2017-05-021-12/+26
| | | | Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
* virtio: Use threads when scanning for virtio devicesKevin O'Connor2016-04-061-2/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pci: Split low-level pci code from higher-level 'struct pci_device' codeKevin O'Connor2016-02-031-1/+1
| | | | | | | | | Split pci.c into pci.c and pcidevice.c. The low-level code that interacts directly with the PCI devices remains in pci.c, while functions dealing with the higher level pci_device cache move to pcidevice.c. Only pci.c is needed in 16bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pci: Implement '%pP' printf handler for 'struct pci_device' pointersKevin O'Connor2016-02-031-9/+4
| | | | | | | Handle '%pP' format descriptions as a pointer to a 'struct pci_device' and display it in bus:device.function (%02x:%02x.%x) format. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* blockcmd: Convert cdb_is_read() to scsi_is_read()Kevin O'Connor2015-07-141-1/+1
| | | | | | | Convert the cdb_is_read() function to a new function scsi_is_read() which takes a 'struct disk_op_s' as a paramter. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* virtio-scsi: Handle virtio drives directly via 'struct disk_op_s' requestsKevin O'Connor2015-07-141-22/+15
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* virtio-scsi: 32bit cleanupGerd Hoffmann2015-07-011-6/+6
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio: also probe version 1.0 pci idsGerd Hoffmann2015-07-011-2/+3
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio-scsi: fix initialization for version 1.0Gerd Hoffmann2015-07-011-2/+23
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio: pass struct pci_device to vp_init_simpleGerd Hoffmann2015-07-011-1/+1
| | | | | | ... instead of the bdf only. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio: add struct vp_deviceGerd Hoffmann2015-07-011-15/+22
| | | | | | | | For virtio 1.0 support we will need more state than just the (legacy mode) ioaddr for each virtio-pci device. Prepare for that by adding a new struct for it. For now it carries the ioaddr only. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* init_virtio_blk, init_virtio_scsi: reset HBA on errorEric Northup2014-03-201-3/+2
| | | | | | | Extend commit 5f2d17d35b2339526f3b3d580b279ea78e406a25: reset on all error paths, and also for virtio_blk not just virtio_scsi. Signed-off-by: Eric Northup <digitaleric@google.com>
* init_virtio_scsi(): reset the HBA before freeing its virtio ringLaszlo Ersek2014-01-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | When init_virtio_scsi() finds no SCSI targets connected to the HBA, it frees the virtio ring. Other code in SeaBIOS proceeds to overwrite the area. However, the ring is in use by qemu at that point -- not only did we report the (ACK|DRIVER|DRIVER_OK) status earlier, we even communicated over the ring. Of course SeaBIOS doesn't "kick" the HBA ever again, hence qemu has no reason to look at the ring. However, when qemu uses KVM acceleration, and ioeventfd is enabled for the HBA, then a vmstate change to "running" (including stop->cont monitor commands and incoming migration) "forces" a kick (see qemu commit 25db9ebe). Qemu then tries to interpret whatever unrelated guest data is in the HBA's original ring area, as virtio protocol. Qemu exits upon seeing the garbage. init_virtio_scsi() should reset the HBA before allowing the virtio ring memory to be reused. Device reset causes the hypervisor to drop its references. This change is justified / underpinned by pure virtio-spec compliance as well. Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1013418 Signed-off-by: Laszlo Ersek <lersek@redhat.com>
* Convert op->drive_g from a 16bit pointer to a 32 bit "GLOBALFLAT" pointer.Kevin O'Connor2013-10-261-6/+7
| | | | | | | | | | | | The "drive" structure is always malloc'ed and therefore always starts off described as a 32-bit "flat" pointer. Instead of switching to/from 16bit pointers, make all the code use the 32bit pointer. This eliminates the confusing 16/32 bit pointer switches. This patch also removes the "_g" suffixes on local variables in functions that are always called in 32bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Merge bmp.h, boot.h, jpeg.h, and post.h into util.h.Kevin O'Connor2013-09-181-1/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Split disk.h into block.h and std/disk.h.Kevin O'Connor2013-09-181-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor2013-09-181-8/+9
| | | | | | Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move malloc code from pmm.c to new files malloc.c and malloc.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename util.c to string.c and introduce string.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move code centered around specific hardware devices to src/hw/Kevin O'Connor2013-09-021-0/+182
Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>