SCSI updates for 2013-04-13
The following changes since commit 09dada400328d75daf79e3eca1e48e024fec148d:
configure: remove duplicate test (2013-04-18 14:12:31 +0200)
are available in the git repository at:
git://github.com/bonzini/qemu.git scsi-next
for you to fetch changes up to d6e51919a7e3250bbfb4bb0ad0f208ab6fd688a4:
vhost-scsi-s390: new device supporting the tcm_vhost Linux kernel module (2013-04-19 16:19:13 +0200)
The VMware PVSCSI implementation and vhost-scsi are finally getting in.
Paolo
----------------------------------------------------------------
Dmitry Fleytman (1):
scsi: VMWare PVSCSI paravirtual device implementation
Nicholas Bellinger (3):
vhost: Add vhost_commit callback for SeaBIOS ROM region re-mapping
vhost-scsi: new device supporting the tcm_vhost Linux kernel module
vhost-scsi-pci: new device supporting the tcm_vhost Linux kernel module
Paolo Bonzini (5):
scsi: avoid assertion failure on VERIFY command
virtio-scsi: create VirtIOSCSICommon
virtio: simplify Makefile conditionals
vhost-scsi-ccw: new device supporting the tcm_vhost Linux kernel module
vhost-scsi-s390: new device supporting the tcm_vhost Linux kernel module
configure | 10 + default-configs/pci.mak | 1 + docs/specs/vmw_pvscsi-spec.txt | 92 +++ hw/Makefile.objs | 2 +- hw/s390x/s390-virtio-bus.c | 51 +- hw/s390x/s390-virtio-bus.h | 16 + hw/s390x/virtio-ccw.c | 53 +- hw/s390x/virtio-ccw.h | 14 + hw/scsi/Makefile.objs | 7 +- hw/scsi/scsi-disk.c | 19 +- hw/scsi/vhost-scsi.c | 288 ++++++++++ hw/scsi/virtio-scsi.c | 212 +++---- hw/scsi/vmw_pvscsi.c | 1216 +++++++++++++++++++++++++++++++++++++++ hw/scsi/vmw_pvscsi.h | 434 ++++++++++++++ hw/virtio/Makefile.objs | 8 +- hw/virtio/vhost.c | 53 +- hw/virtio/virtio-pci.c | 65 ++- hw/virtio/virtio-pci.h | 18 + include/hw/pci/pci.h | 1 + include/hw/virtio/vhost-scsi.h | 73 +++ include/hw/virtio/vhost.h | 3 + include/hw/virtio/virtio-scsi.h | 135 ++++- include/qemu/osdep.h | 4 + trace-events | 35 ++ 24 files changed, 2636 insertions(+), 174 deletions(-) create mode 100644 docs/specs/vmw_pvscsi-spec.txt create mode 100644 hw/scsi/vhost-scsi.c create mode 100644 hw/scsi/vmw_pvscsi.c create mode 100644 hw/scsi/vmw_pvscsi.h create mode 100644 include/hw/virtio/vhost-scsi.h
Signature · 1 line
1.8.1.4
PATCH 1/9 scsi: avoid assertion failure on VERIFY command
A verify command is not an actual read (we do not implement compare mode) and thus does not have an AIOCB attached. Do not crash in scsi_dma_complete.
--- hw/scsi/scsi-disk.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
hw/scsi/scsi-disk.c +14 -5
@@ -244,14 +244,15 @@ done: } } -static void scsi_dma_complete (void *opaque,int ret) +static void scsi_dma_complete_noio (void *opaque,int ret) {SCSIDiskReq *r = (SCSIDiskReq *)opaque;SCSIDiskState *s =DO_UPCAST (SCSIDiskState, qdev, r->req.dev); -assert (r->req.aiocb !=NULL ); - r->req.aiocb =NULL ; -bdrv_acct_done (s->qdev.conf.bs, &r->acct); +if (r->req.aiocb !=NULL ) { + r->req.aiocb =NULL ; +bdrv_acct_done (s->qdev.conf.bs, &r->acct); + }if (r->req.io_canceled) { goto done; }
@@ -277,6 +278,14 @@ done: } } +static void scsi_dma_complete (void *opaque,int ret) +{ +SCSIDiskReq *r = (SCSIDiskReq *)opaque; + +assert (r->req.aiocb !=NULL ); +scsi_dma_complete_noio (opaque, ret); +} +static void scsi_read_complete (void * opaque,int ret) {SCSIDiskReq *r = (SCSIDiskReq *)opaque;
@@ -496,7 +505,7 @@ static void scsi_write_data(SCSIRequest *req)if (r->req.cmd.buf[0 ] ==VERIFY_10 || r->req.cmd.buf[0 ] ==VERIFY_12 || r->req.cmd.buf[0 ] ==VERIFY_16 ) {if (r->req.sg) { -scsi_dma_complete (r,0 ); +scsi_dma_complete_noio (r,0 ); }else {scsi_write_complete (r,0 ); }
Signature · 1 line
1.8.1.4
PATCH 2/9 scsi: VMWare PVSCSI paravirtual device implementation
In reply to Paolo BonziniFrom: Dmitry Fleytman <[email protected]>
[ Rename files to vmw_pvscsi, fix setting of hostStatus in
pvscsi_request_cancelled - Paolo ]
--- default-configs/pci.mak | 1 + docs/specs/vmw_pvscsi-spec.txt | 92 +++ hw/scsi/Makefile.objs | 1 + hw/scsi/vmw_pvscsi.c | 1216 ++++++++++++++++++++++++++++++++++++++++ hw/scsi/vmw_pvscsi.h | 434 ++++++++++++++ include/hw/pci/pci.h | 1 + trace-events | 35 ++ 7 files changed, 1780 insertions(+) create mode 100644 docs/specs/vmw_pvscsi-spec.txt create mode 100644 hw/scsi/vmw_pvscsi.c create mode 100644 hw/scsi/vmw_pvscsi.h
default-configs/pci.mak +1 -0
@@ -10,6 +10,7 @@ CONFIG_EEPRO100_PCI=y CONFIG_PCNET_PCI=y CONFIG_PCNET_COMMON=y CONFIG_LSI_SCSI_PCI=y +CONFIG_VMW_PVSCSI_SCSI_PCI=y CONFIG_MEGASAS_SCSI_PCI=y CONFIG_RTL8139_PCI=y CONFIG_E1000_PCI=y
docs/specs/vmw_pvscsi-spec.txt new file +92 -0
92 lines not on this page · raw message
hw/scsi/Makefile.objs +1 -0
@@ -2,6 +2,7 @@ common-obj-y += scsi-disk.o common-obj-y += scsi-generic.o scsi-bus.o common-obj-$(CONFIG_LSI_SCSI_PCI) += lsi53c895a.o common-obj-$(CONFIG_MEGASAS_SCSI_PCI) += megasas.o +common-obj-$(CONFIG_VMW_PVSCSI_SCSI_PCI) += vmw_pvscsi.o common-obj-$(CONFIG_ESP) += esp.o common-obj-$(CONFIG_ESP_PCI) += esp-pci.o obj-$(CONFIG_PSERIES) += spapr_vscsi.o
hw/scsi/vmw_pvscsi.c new file +1216 -0
1,216 lines not on this page · raw message
hw/scsi/vmw_pvscsi.h new file +434 -0
434 lines not on this page · raw message
include/hw/pci/pci.h +1 -0
@@ -59,6 +59,7 @@#define PCI_DEVICE_ID_VMWARE_SVGA 0x0710#define PCI_DEVICE_ID_VMWARE_NET 0x0720#define PCI_DEVICE_ID_VMWARE_SCSI 0x0730 +#define PCI_DEVICE_ID_VMWARE_PVSCSI 0x07C0#define PCI_DEVICE_ID_VMWARE_IDE 0x1729#define PCI_DEVICE_ID_VMWARE_VMXNET3 0x07B0
trace-events +35 -0
@@ -766,6 +766,41 @@ pc87312_info_ide(uint32_t base) "base 0x%x" pc87312_info_parallel(uint32_t base, uint32_t irq) "base 0x%x, irq %u" pc87312_info_serial(int n, uint32_t base, uint32_t irq) "id=%d, base 0x%x, irq %u" +# hw/scsi/vmw_pvscsi.c +pvscsi_ring_init_data(uint32_t txr_len_log2, uint32_t rxr_len_log2) "TX/RX rings logarithms set to %d/%d" +pvscsi_ring_init_msg(uint32_t len_log2) "MSG ring logarithm set to %d" +pvscsi_ring_flush_cmp(uint64_t filled_cmp_ptr) "new production counter of completion ring is 0x%"PRIx64"" +pvscsi_ring_flush_msg(uint64_t filled_cmp_ptr) "new production counter of message ring is 0x%"PRIx64"" +pvscsi_update_irq_level(bool raise, uint64_t mask, uint64_t status) "interrupt level set to %d (MASK: 0x%"PRIx64", STATUS: 0x%"PRIx64")" +pvscsi_update_irq_msi(void) "sending MSI notification" +pvscsi_cmp_ring_put(unsigned long addr) "got completion descriptor 0x%lx" +pvscsi_msg_ring_put(unsigned long addr) "got message descriptor 0x%lx" +pvscsi_complete_request(uint64_t context, uint64_t len, uint8_t sense_key) "completion: ctx: 0x%"PRIx64", len: 0x%"PRIx64", sense key: %u" +pvscsi_get_sg_list(int nsg, size_t size) "get SG list: depth: %u, size: %lu" +pvscsi_get_next_sg_elem(uint32_t flags) "unknown flags in SG element (val: 0x%x)" +pvscsi_command_complete_not_found(uint32_t tag) "can't find request for tag 0x%x" +pvscsi_command_complete_data_run(void) "not all data required for command transferred" +pvscsi_command_complete_sense_len(int len) "sense information length is %d bytes" +pvscsi_convert_sglist(uint64_t context, unsigned long addr, uint32_t resid) "element: ctx: 0x%"PRIx64" addr: 0x%lx, len: %ul" +pvscsi_process_req_descr(uint8_t cmd, uint64_t ctx) "SCSI cmd 0x%x, ctx: 0x%"PRIx64"" +pvscsi_process_req_descr_unknown_device(void) "command directed to unknown device rejected" +pvscsi_process_req_descr_invalid_dir(void) "command with invalid transfer direction rejected" +pvscsi_process_io(unsigned long addr) "got descriptor 0x%lx" +pvscsi_on_cmd_noimpl(const char* cmd) "unimplemented command %s ignored" +pvscsi_on_cmd_reset_dev(uint32_t tgt, int lun, void* dev) "PVSCSI_CMD_RESET_DEVICE[target %u lun %d (dev 0x%p)]" +pvscsi_on_cmd_arrived(const char* cmd) "command %s arrived" +pvscsi_on_cmd_abort(uint64_t ctx, uint32_t tgt) "command PVSCSI_CMD_ABORT_CMD for ctx 0x%"PRIx64", target %u" +pvscsi_on_cmd_unknown(uint64_t cmd_id) "unknown command %"PRIx64"" +pvscsi_on_cmd_unknown_data(uint32_t data) "data for unknown command 0x:%x" +pvscsi_io_write(const char* cmd, uint64_t val) "%s write: %"PRIx64"" +pvscsi_io_write_unknown(unsigned long addr, unsigned sz, uint64_t val) "unknown write address: 0x%lx size: %u bytes value: 0x%"PRIx64"" +pvscsi_io_read(const char* cmd, uint64_t status) "%s read: 0x%"PRIx64"" +pvscsi_io_read_unknown(unsigned long addr, unsigned sz) "unknown read address: 0x%lx size: %u bytes" +pvscsi_init_msi_fail(int res) "failed to initialize MSI, error %d" +pvscsi_state(const char* state) "starting %s ..." +pvscsi_tx_rings_ppn(const char* label, uint64_t ppn) "%s page: %"PRIx64"" +pvscsi_tx_rings_num_pages(const char* label, uint32_t num) "Number of %s pages: %u" + # xen-all.c xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: %#lx, size %#lx" xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "%#"PRIx64" size %#lx, log_dirty %i"
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH 2/9] scsi: VMWare PVSCSI paravirtual device implementation
Hi paolo,
The PVSCSI device can be used as boot device?
I tested with fedora17 + kernel 3.6 ,but failed.Qemu commit id is " 4eda32f588086b6cd0ec2be6a7a6c131f8c2b427". PVSCSI device used as non-boot device works well.partition,mkfs,mount,dd,ok.
Could you give me some advise to debug this problem ? I can provide more information if need.
Regards,
baiqing
Quoted 2,005 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Paolo Bonzini
Sent: Friday, April 19, 2013 10:24 PM
To: [email protected]
Cc: Dmitry Fleytman; Yan Vugenfirer; [email protected]; [email protected]
Subject: [Qemu-devel] [PATCH 2/9] scsi: VMWare PVSCSI paravirtual device implementationFrom: Dmitry Fleytman <[email protected]>
Signed-off-by Dmitry Fleytman <[email protected]>Signed-off-by Yan Vugenfirer <[email protected]>[ Rename files to
vmw_pvscsi, fix setting of hostStatus in
pvscsi_request_cancelled- Paolo ]Signed-off-by Paolo Bonzini <[email protected]>--- default-configs/pci.mak | 1 + docs/specs/vmw_pvscsi-spec.txt | 92 +++ hw/scsi/Makefile.objs | 1 + hw/scsi/vmw_pvscsi.c | 1216 ++++++++++++++++++++++++++++++++++++++++ hw/scsi/vmw_pvscsi.h | 434 ++++++++++++++ include/hw/pci/pci.h | 1 + trace-events | 35 ++ 7 files changed, 1780 insertions(+) create mode 100644 docs/specs/vmw_pvscsi-spec.txt create mode 100644 hw/scsi/vmw_pvscsi.c create mode 100644 hw/scsi/vmw_pvscsi.hdefault-configs/pci.mak +1
-0@@ -10,6 +10,7 @@ CONFIG_EEPRO100_PCI=y CONFIG_PCNET_PCI=y CONFIG_PCNET_COMMON=y CONFIG_LSI_SCSI_PCI=y +CONFIG_VMW_PVSCSI_SCSI_PCI=y CONFIG_MEGASAS_SCSI_PCI=y CONFIG_RTL8139_PCI=y CONFIG_E1000_PCI=ydocs/specs/vmw_pvscsi-spec.txt new file +23
-0@@ -0,0 +1,92 @@ +General Description +=================== + +This document describes VMWare PVSCSI device interface specification. +Created by Dmitry Fleytman ([email protected]), Daynix Computing LTD. +Based on source code of PVSCSI Linux driver from kernel 3.0.4 + +PVSCSI Device Interface Overview +================================ + +The interface is based on memory area shared between hypervisor and VM. +Memory area is obtained by driver as device IO memory resource of +PVSCSI_MEM_SPACE_SIZE length. +The shared memory consists of registers area and rings area. +The registers area is used to raise hypervisor interrupts and issue device +commands. The rings area is used to transfer data descriptors and SCSI +commands from VM to hypervisor and to transfer messages produced by +hypervisor to VM. Data itself is transferred via virtual scatter-gather DMA. + +PVSCSI Device Registers +======================= + +The length of the registers area is 1 page(
PVSCSI_MEM_SPACE_COMMAND_NUM_PAGES).
+The structure of the registers area is described by the PVSCSIRegOffset enum.docs/specs/vmw_pvscsi-spec.txt new file +16
-0+There are registers to issue device command (with optional short data), +issue device interrupt, control interrupts masking. + +PVSCSI Device Rings +=================== + +There are three rings in shared memory: + + 1. Request ring (struct PVSCSIRingReqDesc *req_ring) + - ring for OS to device requests + 2. Completion ring (struct PVSCSIRingCmpDesc *cmp_ring) + - ring for device request completions + 3. Message ring (struct PVSCSIRingMsgDesc *msg_ring) + - ring for messages from device. + This ring is optional and the guest might not configure it. +There is a control area (struct PVSCSIRingsState *rings_state) used tocontrol
docs/specs/vmw_pvscsi-spec.txt new file +28
-0+rings operation. + +PVSCSI Device to Host Interrupts +================================ +There are following interrupt types supported by PVSCSI device: + 1. Completion interrupts (completion ring notifications): + PVSCSI_INTR_CMPL_0 + PVSCSI_INTR_CMPL_1 + 2. Message interrupts (message ring notifications): + PVSCSI_INTR_MSG_0 + PVSCSI_INTR_MSG_1 + +Interrupts are controlled via PVSCSI_REG_OFFSET_INTR_MASK register +Bit set means interrupt enabled, bit cleared - disabled + +Interrupt modes supported are legacy, MSI and MSI-X +In case of legacy interrupts, register PVSCSI_REG_OFFSET_INTR_STATUS +is used to check which interrupt has arrived. Interrupts are +acknowledged when the corresponding bit is written to the interrupt +status register. + +PVSCSI Device Operation Sequences +================================= + +1. Startup sequence: + a. Issue PVSCSI_CMD_ADAPTER_RESET command; + aa. Windows driver reads interrupt status register here; + b. Issue PVSCSI_CMD_SETUP_MSG_RING command with no additionaldata,
docs/specs/vmw_pvscsi-spec.txt new file +3
-0+ check status and disable device messages if error returned; + (Omitted if device messages disabled by driver configuration) + c. Issue PVSCSI_CMD_SETUP_RINGS command, provide ringsconfiguration
docs/specs/vmw_pvscsi-spec.txt new file +4
-0+ as struct PVSCSICmdDescSetupRings; + d. Issue PVSCSI_CMD_SETUP_MSG_RING command again, provide + rings configuration as struct PVSCSICmdDescSetupMsgRing; + e. Unmask completion and message (if device messages enabled)interrupts.
docs/specs/vmw_pvscsi-spec.txt new file +17
-0+ +2. Shutdown sequences + a. Mask interrupts; + b. Flush request ring using PVSCSI_REG_OFFSET_KICK_NON_RW_IO; + c. Issue PVSCSI_CMD_ADAPTER_RESET command. + +3. Send request + a. Fill next free request ring descriptor; + b. Issue PVSCSI_REG_OFFSET_KICK_RW_IO for R/W operations; + or PVSCSI_REG_OFFSET_KICK_NON_RW_IO for other operations. + +4. Abort command + a. Issue PVSCSI_CMD_ABORT_CMD command; + +5. Request completion processing + a. Upon completion interrupt arrival process completion + and message (if enabled) rings.hw/scsi/Makefile.objs +1
-0@@ -2,6 +2,7 @@ common-obj-y += scsi-disk.o common-obj-y += scsi-generic.o scsi-bus.o common-obj-$(CONFIG_LSI_SCSI_PCI) += lsi53c895a.o common-obj-$(CONFIG_MEGASAS_SCSI_PCI) += megasas.o +common-obj-$(CONFIG_VMW_PVSCSI_SCSI_PCI) += vmw_pvscsi.o common-obj-$(CONFIG_ESP) += esp.o common-obj-$(CONFIG_ESP_PCI) += esp-pci.o obj-$(CONFIG_PSERIES) += spapr_vscsi.ohw/scsi/vmw_pvscsi.c new file +20
-0@@ -0,0 +1,1216 @@ +/* +* QEMU VMWARE PVSCSI paravirtual SCSI bus +* +* Copyright (c) 2012 Ravello Systems LTD (http://ravellosystems.com) +* +* Developed by Daynix Computing LTD (http://www.daynix.com) +* +* Based on implementation by Paolo Bonzini +* http://lists.gnu.org/archive/html/qemu-devel/2011-08/msg00729.html +* +* Authors: +* Paolo Bonzini <[email protected]> +* Dmitry Fleytman <[email protected]> +* Yan Vugenfirer <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2. +* See the COPYING file in the top-level directory. +* +* NOTE about MSI-X: +* MSI-X support has been removed for the moment because it leads Windows OS
+ * to crash on startup. The crash happens because Windows driver requires
+ * MSI-X shared memory to be part of the same BAR used for rings state
+ * registers, etc. This is not supported by QEMU infrastructure so separate
+ * BAR created from MSI-X purposes. Windows driver fails to deal with 2 BARs.
+ *
+ */hw/scsi/vmw_pvscsi.c new file +32
-0+ +#include "hw/scsi/scsi.h" +#include <block/scsi.h> +#include "hw/pci/msi.h" +#include "vmw_pvscsi.h" +#include "trace.h" + + +#define PVSCSI_MSI_OFFSET (0x50) +#define PVSCSI_USE_64BIT (true) +#define PVSCSI_PER_VECTOR_MASK (false) + +#define PVSCSI_MAX_DEVS (64) +#define PVSCSI_MSIX_NUM_VECTORS (1) + +#define PVSCSI_MAX_CMD_DATA_WORDS \ + (sizeof(PVSCSICmdDescSetupRings)/sizeof(uint32_t)) + +#define RS_GET_FIELD (rs_pa, field) \ + (ldl_le_phys(rs_pa + offsetof(struct PVSCSIRingsState, field))) +#define RS_SET_FIELD (rs_pa, field, val) \ + (stl_le_phys(rs_pa + offsetof(struct PVSCSIRingsState, field), val)) + +#define TYPE_PVSCSI "pvscsi" +#define PVSCSI (obj) OBJECT_CHECK(PVSCSIState, (obj), TYPE_PVSCSI) + +typedef struct PVSCSIRingInfo { + uint64_t rs_pa; + uint32_t txr_len_mask; + uint32_t rxr_len_mask; + uint32_t msg_len_mask; + uint64_treq_ring_pages_pa[PVSCSI_SETUP_RINGS_MAX_NUM_PAGES];
+uint64_t
cmp_ring_pages_pa[PVSCSI_SETUP_RINGS_MAX_NUM_PAGES];
+uint64_t
msg_ring_pages_pa[PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES];hw/scsi/vmw_pvscsi.c new file +22
-0+uint64_t consumed_ptr; +uint64_t filled_cmp_ptr; +uint64_t filled_msg_ptr; +} PVSCSIRingInfo; + +typedef struct PVSCSISGState { +hwaddr elemAddr; +hwaddr dataAddr; +uint32_t resid; +}PVSCSISGState ; + +typedef QTAILQ_HEAD(, PVSCSIRequest) PVSCSIRequestList; + +typedef struct { + PCIDevice parent_obj; + MemoryRegion io_space; + SCSIBus bus; + QEMUBH *completion_worker; + PVSCSIRequestList pending_queue; + PVSCSIRequestList completion_queue; + + uint64_t reg_interrupt_status; /* Interrupt status registervalue */
+uint64_treg_interrupt_enabled; /* Interrupt mask register
value */
+uint64_treg_command_status; /* Command status
register value */hw/scsi/vmw_pvscsi.c new file +3
-0+ +/* Command data adoption mechanism */ +uint64_t curr_cmd;/* Last command arrived */
+uint32_tcurr_cmd_data_cntr; /* Amount of data for last
command */hw/scsi/vmw_pvscsi.c new file +5
-0+ +/* Collector for current command data */ +uint32_t curr_cmd_data[PVSCSI_MAX_CMD_DATA_WORDS ]; + +uint8_t rings_info_valid;/* Whether data rings initialized */
+uint8_tmsg_ring_info_valid; /* Whether message ring
initialized */
+uint8_tuse_msg; /* Whether to use message
ring */hw/scsi/vmw_pvscsi.c new file +2
-0+ +uint8_t msi_used;/* Whether MSI support was installed successfully */
hw/scsi/vmw_pvscsi.c new file +2
-0+ +PVSCSIRingInfo rings;/* Data transfer rings manager */
+uint32_tresetting; /* Reset in progress
*/hw/scsi/vmw_pvscsi.c new file +35
-0+} PVSCSIState; + +typedef struct PVSCSIRequest { +SCSIRequest *sreq; +PVSCSIState *dev; +uint8_t sense_key; +uint8_t completed; +int lun; +QEMUSGList sgl; +PVSCSISGState sg; +struct PVSCSIRingReqDesc req; +struct PVSCSIRingCmpDesc cmp; +QTAILQ_ENTRY (PVSCSIRequest) next; +}PVSCSIRequest ; + +/* Integer binary logarithm */ +static int +pvscsi_log2 (uint32_t input) +{ +int log =0 ; +assert (input >0 ); +while (input >> ++log) { + } +return log; +} + +static void +pvscsi_ring_init_data (PVSCSIRingInfo *m,PVSCSICmdDescSetupRings *ri) +{ +int i; +uint32_t txr_len_log2, rxr_len_log2; +uint32_t req_ring_size, cmp_ring_size; + m->rs_pa = ri->ringsStatePPN <<VMW_PAGE_SHIFT ; + + req_ring_size = ri->reqRingNumPages *
PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;
+cmp_ring_size=ri->cmpRingNumPages*PVSCSI_MAX_NUM_CMP_ENTRIES_PER_PAGE;hw/scsi/vmw_pvscsi.c new file +11
-0+ txr_len_log2 =pvscsi_log2 (req_ring_size -1 ); + rxr_len_log2 =pvscsi_log2 (cmp_ring_size -1 ); + + m->txr_len_mask =MASK (txr_len_log2); + m->rxr_len_mask =MASK (rxr_len_log2); + + m->consumed_ptr =0 ; + m->filled_cmp_ptr =0 ; + +for (i =0 ; i < ri->reqRingNumPages; i++) { + m->req_ring_pages_pa[i] = ri->reqRingPPNs[i] <<
VMW_PAGE_SHIFT;hw/scsi/vmw_pvscsi.c new file +4
-0+ } + +for (i =0 ; i < ri->cmpRingNumPages; i++) { + m->cmp_ring_pages_pa[i] = ri->cmpRingPPNs[i] <<
VMW_PAGE_SHIFT;hw/scsi/vmw_pvscsi.c new file +18
-0+ } + +RS_SET_FIELD (m->rs_pa, reqProdIdx,0 ); +RS_SET_FIELD (m->rs_pa, reqConsIdx,0 ); +RS_SET_FIELD (m->rs_pa, reqNumEntriesLog2, txr_len_log2); + +RS_SET_FIELD (m->rs_pa, cmpProdIdx,0 ); +RS_SET_FIELD (m->rs_pa, cmpConsIdx,0 ); +RS_SET_FIELD (m->rs_pa, cmpNumEntriesLog2, rxr_len_log2); + +trace_pvscsi_ring_init_data (txr_len_log2, rxr_len_log2); + +/* Flush ring state page changes */ +smp_wmb (); +} + +static void +pvscsi_ring_init_msg(PVSCSIRingInfo *m, PVSCSICmdDescSetupMsgRing*ri)
hw/scsi/vmw_pvscsi.c new file +6
-0+{ +int i; +uint32_t len_log2; +uint32_t ring_size; + + ring_size = ri->numPages *
PVSCSI_MAX_NUM_MSG_ENTRIES_PER_PAGE;hw/scsi/vmw_pvscsi.c new file +8
-0+ len_log2 =pvscsi_log2 (ring_size -1 ); + + m->msg_len_mask =MASK (len_log2); + + m->filled_msg_ptr =0 ; + +for (i =0 ; i < ri->numPages; i++) { + m->msg_ring_pages_pa[i] = ri->ringPPNs[i] <<
VMW_PAGE_SHIFT;hw/scsi/vmw_pvscsi.c new file +23
-0+ } + +RS_SET_FIELD (m->rs_pa, msgProdIdx,0 ); +RS_SET_FIELD (m->rs_pa, msgConsIdx,0 ); +RS_SET_FIELD (m->rs_pa, msgNumEntriesLog2, len_log2); + +trace_pvscsi_ring_init_msg (len_log2); + +/* Flush ring state page changes */ +smp_wmb (); +} + +static void +pvscsi_ring_cleanup (PVSCSIRingInfo *mgr) +{ + mgr->rs_pa =0 ; + mgr->txr_len_mask =0 ; + mgr->rxr_len_mask =0 ; + mgr->msg_len_mask =0 ; + mgr->consumed_ptr =0 ; + mgr->filled_cmp_ptr =0 ; + mgr->filled_msg_ptr =0 ; + memset(mgr->req_ring_pages_pa, 0,
sizeof(mgr->req_ring_pages_pa));
+ memset(mgr->cmp_ring_pages_pa, 0,sizeof(mgr->cmp_ring_pages_pa));
+ memset(mgr->msg_ring_pages_pa, 0,sizeof(mgr->msg_ring_pages_pa));hw/scsi/vmw_pvscsi.c new file +12
-0+} + +static hwaddr +pvscsi_ring_pop_req_descr (PVSCSIRingInfo *mgr) +{ +uint32_t ready_ptr =RS_GET_FIELD (mgr->rs_pa, reqProdIdx); + +if (ready_ptr != mgr->consumed_ptr) { +uint32_t next_ready_ptr = + mgr->consumed_ptr++ & mgr->txr_len_mask; +uint32_t next_ready_page = + next_ready_ptr /
PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;hw/scsi/vmw_pvscsi.c new file +2
-0+uint32_t inpage_idx = + next_ready_ptr %
PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;hw/scsi/vmw_pvscsi.c new file +85
-0+ +return mgr->req_ring_pages_pa[next_ready_page] + + inpage_idx *sizeof (PVSCSIRingReqDesc); + }else { +return 0 ; + } +} + +static void +pvscsi_ring_flush_req (PVSCSIRingInfo *mgr) +{ +RS_SET_FIELD (mgr->rs_pa, reqConsIdx, mgr->consumed_ptr); +} + +static hwaddr +pvscsi_ring_pop_cmp_descr (PVSCSIRingInfo *mgr) +{ +/* +* According to Linux driver code it explicitly verifies that number +* of requests being processed by device is less then the size of +* completion queue, so device may omit completion queue overflow +* conditions check. We assume that this is true for other (Windows) +* drivers as well. +*/ + +uint32_t free_cmp_ptr = + mgr->filled_cmp_ptr++ & mgr->rxr_len_mask; +uint32_t free_cmp_page = + free_cmp_ptr /PVSCSI_MAX_NUM_CMP_ENTRIES_PER_PAGE ; +uint32_t inpage_idx = + free_cmp_ptr %PVSCSI_MAX_NUM_CMP_ENTRIES_PER_PAGE ; +return mgr->cmp_ring_pages_pa[free_cmp_page] + + inpage_idx *sizeof (PVSCSIRingCmpDesc); +} + +static hwaddr +pvscsi_ring_pop_msg_descr (PVSCSIRingInfo *mgr) +{ +uint32_t free_msg_ptr = + mgr->filled_msg_ptr++ & mgr->msg_len_mask; +uint32_t free_msg_page = + free_msg_ptr /PVSCSI_MAX_NUM_MSG_ENTRIES_PER_PAGE ; +uint32_t inpage_idx = + free_msg_ptr %PVSCSI_MAX_NUM_MSG_ENTRIES_PER_PAGE ; +return mgr->msg_ring_pages_pa[free_msg_page] + + inpage_idx *sizeof (PVSCSIRingMsgDesc); +} + +static void +pvscsi_ring_flush_cmp (PVSCSIRingInfo *mgr) +{ +/* Flush descriptor changes */ +smp_wmb (); + +trace_pvscsi_ring_flush_cmp (mgr->filled_cmp_ptr); + +RS_SET_FIELD (mgr->rs_pa, cmpProdIdx, mgr->filled_cmp_ptr); +} + +static bool +pvscsi_ring_msg_has_room (PVSCSIRingInfo *mgr) +{ +uint32_t prodIdx =RS_GET_FIELD (mgr->rs_pa, msgProdIdx); +uint32_t consIdx =RS_GET_FIELD (mgr->rs_pa, msgConsIdx); + +return (prodIdx - consIdx) < (mgr->msg_len_mask +1 ); +} + +static void +pvscsi_ring_flush_msg (PVSCSIRingInfo *mgr) +{ +/* Flush descriptor changes */ +smp_wmb (); + +trace_pvscsi_ring_flush_msg (mgr->filled_msg_ptr); + +RS_SET_FIELD (mgr->rs_pa, msgProdIdx, mgr->filled_msg_ptr); +} + +static void +pvscsi_reset_state (PVSCSIState *s) +{ + s->curr_cmd =PVSCSI_CMD_FIRST ; + s->curr_cmd_data_cntr =0 ; + s->reg_command_status =
PVSCSI_COMMAND_PROCESSING_SUCCEEDED;hw/scsi/vmw_pvscsi.c new file +13
-0+ s->reg_interrupt_status =0 ; +pvscsi_ring_cleanup (&s->rings); + s->rings_info_valid = FALSE; + s->msg_ring_info_valid = FALSE; +QTAILQ_INIT (&s->pending_queue); +QTAILQ_INIT (&s->completion_queue); +} + +static void +pvscsi_update_irq_status (PVSCSIState *s) +{ +PCIDevice *d =PCI_DEVICE (s); + bool should_raise = s->reg_interrupt_enabled &
s->reg_interrupt_status;hw/scsi/vmw_pvscsi.c new file +2
-0+ + trace_pvscsi_update_irq_level(should_raise,
s->reg_interrupt_enabled,hw/scsi/vmw_pvscsi.c new file +37
-0+ s->reg_interrupt_status); + +if (s->msi_used &&msi_enabled (d)) { +if (should_raise) { +trace_pvscsi_update_irq_msi (); +msi_notify (d,PVSCSI_VECTOR_COMPLETION ); + } +return ; + } + +qemu_set_irq (d->irq[0 ], !!should_raise); +} + +static void +pvscsi_raise_completion_interrupt (PVSCSIState *s) +{ + s->reg_interrupt_status |=PVSCSI_INTR_CMPL_0 ; + +/* Memory barrier to flush interrupt status register changes*/ +smp_wmb (); + +pvscsi_update_irq_status (s); +} + +static void +pvscsi_raise_message_interrupt (PVSCSIState *s) +{ + s->reg_interrupt_status |=PVSCSI_INTR_MSG_0 ; + +/* Memory barrier to flush interrupt status register changes*/ +smp_wmb (); + +pvscsi_update_irq_status (s); +} + +static void +pvscsi_cmp_ring_put(PVSCSIState *s, struct PVSCSIRingCmpDesc
*cmp_desc)hw/scsi/vmw_pvscsi.c new file +11
-0+{ +hwaddr cmp_descr_pa; + + cmp_descr_pa =pvscsi_ring_pop_cmp_descr (&s->rings); +trace_pvscsi_cmp_ring_put (cmp_descr_pa); +cpu_physical_memory_write (cmp_descr_pa, (void *)cmp_desc, +sizeof (*cmp_desc)); +} + +static void +pvscsi_msg_ring_put(PVSCSIState *s, struct PVSCSIRingMsgDesc
*msg_desc)hw/scsi/vmw_pvscsi.c new file +82
-0+{ +hwaddr msg_descr_pa; + + msg_descr_pa =pvscsi_ring_pop_msg_descr (&s->rings); +trace_pvscsi_msg_ring_put (msg_descr_pa); +cpu_physical_memory_write (msg_descr_pa, (void *)msg_desc, +sizeof (*msg_desc)); +} + +static void +pvscsi_process_completion_queue (void *opaque) +{ +PVSCSIState *s = opaque; +PVSCSIRequest *pvscsi_req; +bool has_completed = false; + +while (!QTAILQ_EMPTY (&s->completion_queue)) { + pvscsi_req =QTAILQ_FIRST (&s->completion_queue); +QTAILQ_REMOVE (&s->completion_queue, pvscsi_req, next); +pvscsi_cmp_ring_put (s, &pvscsi_req->cmp); +g_free (pvscsi_req); + has_completed++; + } + +if (has_completed) { +pvscsi_ring_flush_cmp (&s->rings); +pvscsi_raise_completion_interrupt (s); + } +} + +static void +pvscsi_reset_adapter (PVSCSIState *s) +{ + s->resetting++; +qbus_reset_all_fn (&s->bus); + s->resetting--; +pvscsi_process_completion_queue (s); +assert (QTAILQ_EMPTY (&s->pending_queue)); +pvscsi_reset_state (s); +} + +static void +pvscsi_schedule_completion_processing (PVSCSIState *s) +{ +/* Try putting more complete requests on the ring. */ +if (!QTAILQ_EMPTY (&s->completion_queue)) { +qemu_bh_schedule (s->completion_worker); + } +} + +static void +pvscsi_complete_request (PVSCSIState *s,PVSCSIRequest *r) +{ +assert (!r->completed); + +trace_pvscsi_complete_request (r->cmp.context, r->cmp.dataLen, + r->sense_key); +if (r->sreq !=NULL ) { +scsi_req_unref (r->sreq); + r->sreq =NULL ; + } + r->completed =1 ; +QTAILQ_REMOVE (&s->pending_queue, r, next); +QTAILQ_INSERT_TAIL (&s->completion_queue, r, next); +pvscsi_schedule_completion_processing (s); +} + +static QEMUSGList *pvscsi_get_sg_list (SCSIRequest *r) +{ +PVSCSIRequest *req = r->hba_private; + +trace_pvscsi_get_sg_list (req->sgl.nsg, req->sgl.size); + +return &req->sgl; +} + +static void +pvscsi_get_next_sg_elem (PVSCSISGState *sg) +{ +struct PVSCSISGElement elem; + + cpu_physical_memory_read(sg->elemAddr, (void *)&elem,sizeof(elem));
hw/scsi/vmw_pvscsi.c new file +3
-0+if ((elem.flags & ~PVSCSI_KNOWN_FLAGS ) !=0 ) { +/* +* There is PVSCSI_SGE_FLAG_CHAIN_ELEMENT flag described in
hw/scsi/vmw_pvscsi.c new file +18
-0+* header file but its value is unknown. This flag requires +* additional processing, so we put warning here to catch it +* some day and make proper implementation +*/ +trace_pvscsi_get_next_sg_elem (elem.flags); + } + + sg->elemAddr +=sizeof (elem); + sg->dataAddr = elem.addr; + sg->resid = elem.length; +} + +static void +pvscsi_write_sense (PVSCSIRequest *r,uint8_t *sense,int len) +{ + r->cmp.senseLen =MIN (r->req.senseLen, len); + r->sense_key = sense[(sense[0 ] &2 ) ?1 :2 ]; + cpu_physical_memory_write(r->req.senseAddr, sense,
r->cmp.senseLen);hw/scsi/vmw_pvscsi.c new file +36
-0+} + +static void +pvscsi_command_complete (SCSIRequest *req,uint32_t status,size_t resid) +{ +PVSCSIRequest *pvscsi_req = req->hba_private; +PVSCSIState *s = pvscsi_req->dev; + +if (!pvscsi_req) { +trace_pvscsi_command_complete_not_found (req->tag); +return ; + } + +if (resid) { +/* Short transfer. */ +trace_pvscsi_command_complete_data_run (); + pvscsi_req->cmp.hostStatus =BTSTAT_DATARUN ; + } + + pvscsi_req->cmp.scsiStatus = status; +if (pvscsi_req->cmp.scsiStatus ==CHECK_CONDITION ) { +uint8_t sense[SCSI_SENSE_BUF_SIZE ]; +int sense_len = +scsi_req_get_sense (pvscsi_req->sreq, sense,sizeof (sense)); + +trace_pvscsi_command_complete_sense_len (sense_len); +pvscsi_write_sense (pvscsi_req, sense, sense_len); + } +qemu_sglist_destroy (&pvscsi_req->sgl); +pvscsi_complete_request (s, pvscsi_req); +} + +static void +pvscsi_send_msg (PVSCSIState *s,SCSIDevice *dev,uint32_t msg_type) +{ +if (s->msg_ring_info_valid &&pvscsi_ring_msg_has_room (&s->rings)){
hw/scsi/vmw_pvscsi.c new file +74
-0+PVSCSIMsgDescDevStatusChanged msg = {0 }; + + msg.type = msg_type; + msg.bus = dev->channel; + msg.target = dev->id; + msg.lun[1 ] = dev->lun; + +pvscsi_msg_ring_put (s, (PVSCSIRingMsgDesc *)&msg); +pvscsi_ring_flush_msg (&s->rings); +pvscsi_raise_message_interrupt (s); + } +} + +static void +pvscsi_hotplug (SCSIBus *bus,SCSIDevice *dev) +{ +PVSCSIState *s =container_of (bus, PVSCSIState, bus); +pvscsi_send_msg (s, dev,PVSCSI_MSG_DEV_ADDED ); +} + +static void +pvscsi_hot_unplug (SCSIBus *bus,SCSIDevice *dev) +{ +PVSCSIState *s =container_of (bus, PVSCSIState, bus); +pvscsi_send_msg (s, dev,PVSCSI_MSG_DEV_REMOVED ); +} + +static void +pvscsi_request_cancelled (SCSIRequest *req) +{ +PVSCSIRequest *pvscsi_req = req->hba_private; +PVSCSIState *s = pvscsi_req->dev; + +if (pvscsi_req->completed) { +return ; + } + +if (pvscsi_req->dev->resetting) { + pvscsi_req->cmp.hostStatus =BTSTAT_BUSRESET ; + }else { + pvscsi_req->cmp.hostStatus =BTSTAT_ABORTQUEUE ; + } + +pvscsi_complete_request (s, pvscsi_req); +} + +static SCSIDevice * +pvscsi_device_find (PVSCSIState *s,int channel,int target, +uint8_t *requested_lun,uint8_t *target_lun) +{ +if (requested_lun[0 ] || requested_lun[2 ] || requested_lun[3 ] || + requested_lun[4 ] || requested_lun[5 ] || requested_lun[6 ] || + requested_lun[7 ] || (target >PVSCSI_MAX_DEVS )) { +return NULL ; + }else { + *target_lun = requested_lun[1 ]; +return scsi_device_find (&s->bus, channel, target, *target_lun); + } +} + +static PVSCSIRequest * +pvscsi_queue_pending_descriptor (PVSCSIState *s,SCSIDevice **d, +struct PVSCSIRingReqDesc *descr) +{ +PVSCSIRequest *pvscsi_req; +uint8_t lun; + + pvscsi_req =g_malloc0 (sizeof (*pvscsi_req)); + pvscsi_req->dev = s; + pvscsi_req->req = *descr; + pvscsi_req->cmp.context = pvscsi_req->req.context; +QTAILQ_INSERT_TAIL (&s->pending_queue, pvscsi_req, next); + + *d = pvscsi_device_find(s, descr->bus, descr->target, descr->lun,&lun);
hw/scsi/vmw_pvscsi.c new file +47
-0+if (*d) { + pvscsi_req->lun = lun; + } + +return pvscsi_req; +} + +static void +pvscsi_convert_sglist (PVSCSIRequest *r) +{ +int chunk_size; +uint64_t data_length = r->req.dataLen; +PVSCSISGState sg = r->sg; +while (data_length) { +while (!sg.resid) { +pvscsi_get_next_sg_elem (&sg); +trace_pvscsi_convert_sglist (r->req.context, r->sg.dataAddr, + r->sg.resid); + } +assert (data_length >0 ); + chunk_size =MIN ((unsigned ) data_length, sg.resid); +if (chunk_size) { +qemu_sglist_add (&r->sgl, sg.dataAddr, chunk_size); + } + + sg.dataAddr += chunk_size; + data_length -= chunk_size; + sg.resid -= chunk_size; + } +} + +static void +pvscsi_build_sglist (PVSCSIState *s,PVSCSIRequest *r) +{ +PCIDevice *d =PCI_DEVICE (s); + +qemu_sglist_init (&r->sgl,1 ,pci_dma_context (d)); +if (r->req.flags &PVSCSI_FLAG_CMD_WITH_SG_LIST ) { +pvscsi_convert_sglist (r); + }else { +qemu_sglist_add (&r->sgl, r->req.dataAddr, r->req.dataLen); + } +} + +static void +pvscsi_process_request_descriptor (PVSCSIState *s, + struct PVSCSIRingReqDesc*descr)
hw/scsi/vmw_pvscsi.c new file +56
-0+{ +SCSIDevice *d; +PVSCSIRequest *r =pvscsi_queue_pending_descriptor (s, &d, descr); +int64_t n; + +trace_pvscsi_process_req_descr (descr->cdb[0 ], descr->context); + +if (!d) { + r->cmp.hostStatus =BTSTAT_SELTIMEO ; +trace_pvscsi_process_req_descr_unknown_device (); +pvscsi_complete_request (s, r); +return ; + } + +if (descr->flags &PVSCSI_FLAG_CMD_WITH_SG_LIST ) { + r->sg.elemAddr = descr->dataAddr; + } + + r->sreq =scsi_req_new (d, descr->context, r->lun, descr->cdb, r); +if (r->sreq->cmd.mode ==SCSI_XFER_FROM_DEV && + (descr->flags &PVSCSI_FLAG_CMD_DIR_TODEVICE )) { + r->cmp.hostStatus =BTSTAT_BADMSG ; +trace_pvscsi_process_req_descr_invalid_dir (); +scsi_req_cancel (r->sreq); +return ; + } +if (r->sreq->cmd.mode ==SCSI_XFER_TO_DEV && + (descr->flags &PVSCSI_FLAG_CMD_DIR_TOHOST )) { + r->cmp.hostStatus =BTSTAT_BADMSG ; +trace_pvscsi_process_req_descr_invalid_dir (); +scsi_req_cancel (r->sreq); +return ; + } + +pvscsi_build_sglist (s, r); + n =scsi_req_enqueue (r->sreq); + +if (n) { +scsi_req_continue (r->sreq); + } +} + +static void +pvscsi_process_io (PVSCSIState *s) +{ +PVSCSIRingReqDesc descr; +hwaddr next_descr_pa; + +assert (s->rings_info_valid); +while ((next_descr_pa =pvscsi_ring_pop_req_descr (&s->rings)) !=0 ) { + +/* Only read after production index verification */ +smp_rmb (); + +trace_pvscsi_process_io (next_descr_pa); + cpu_physical_memory_read(next_descr_pa, &descr,sizeof(descr));
hw/scsi/vmw_pvscsi.c new file +13
-0+pvscsi_process_request_descriptor (s, &descr); + } + +pvscsi_ring_flush_req (&s->rings); +} + +static void +pvscsi_dbg_dump_tx_rings_config (PVSCSICmdDescSetupRings *rc) +{ +int i; +trace_pvscsi_tx_rings_ppn ("Rings State" , rc->ringsStatePPN); + + trace_pvscsi_tx_rings_num_pages("Request Ring",
rc->reqRingNumPages);hw/scsi/vmw_pvscsi.c new file +5
-0+for (i =0 ; i < rc->reqRingNumPages; i++) { +trace_pvscsi_tx_rings_ppn ("Request Ring" , rc->reqRingPPNs[i]); + } + + trace_pvscsi_tx_rings_num_pages("Confirm Ring",
rc->cmpRingNumPages);hw/scsi/vmw_pvscsi.c new file +44
-0+for (i =0 ; i < rc->cmpRingNumPages; i++) { +trace_pvscsi_tx_rings_ppn ("Confirm Ring" , rc->reqRingPPNs[i]); + } +} + +static uint64_t +pvscsi_on_cmd_config (PVSCSIState *s) +{ +trace_pvscsi_on_cmd_noimpl ("PVSCSI_CMD_CONFIG" ); +return PVSCSI_COMMAND_PROCESSING_FAILED ; +} + +static uint64_t +pvscsi_on_cmd_unplug (PVSCSIState *s) +{ +trace_pvscsi_on_cmd_noimpl ("PVSCSI_CMD_DEVICE_UNPLUG" ); +return PVSCSI_COMMAND_PROCESSING_FAILED ; +} + +static uint64_t +pvscsi_on_issue_scsi (PVSCSIState *s) +{ +trace_pvscsi_on_cmd_noimpl ("PVSCSI_CMD_ISSUE_SCSI" ); +return PVSCSI_COMMAND_PROCESSING_FAILED ; +} + +static uint64_t +pvscsi_on_cmd_setup_rings (PVSCSIState *s) +{ +PVSCSICmdDescSetupRings *rc = + (PVSCSICmdDescSetupRings *) s->curr_cmd_data; + +trace_pvscsi_on_cmd_arrived ("PVSCSI_CMD_SETUP_RINGS" ); + +pvscsi_dbg_dump_tx_rings_config (rc); +pvscsi_ring_init_data (&s->rings, rc); + s->rings_info_valid = TRUE; +return PVSCSI_COMMAND_PROCESSING_SUCCEEDED ; +} + +static uint64_t +pvscsi_on_cmd_abort (PVSCSIState *s) +{ + PVSCSICmdDescAbortCmd *cmd = (PVSCSICmdDescAbortCmd *)
s->curr_cmd_data;hw/scsi/vmw_pvscsi.c new file +96
-0+PVSCSIRequest *r, *next; + +trace_pvscsi_on_cmd_abort (cmd->context, cmd->target); + + QTAILQ_FOREACH_SAFE(r, &s->pending_queue, next, next) { +if (r->req.context == cmd->context) { +break ; + } + } +if (r) { +assert (!r->completed); + r->cmp.hostStatus =BTSTAT_ABORTQUEUE ; +scsi_req_cancel (r->sreq); + } + +return PVSCSI_COMMAND_PROCESSING_SUCCEEDED ; +} + +static uint64_t +pvscsi_on_cmd_unknown (PVSCSIState *s) +{ +trace_pvscsi_on_cmd_unknown_data (s->curr_cmd_data[0 ]); +return PVSCSI_COMMAND_PROCESSING_FAILED ; +} + +static uint64_t +pvscsi_on_cmd_reset_device (PVSCSIState *s) +{ +uint8_t target_lun =0 ; +struct PVSCSICmdDescResetDevice *cmd = + (struct PVSCSICmdDescResetDevice *) s->curr_cmd_data; +SCSIDevice *sdev; + + sdev =pvscsi_device_find (s,0 , cmd->target, cmd->lun, &target_lun); + +trace_pvscsi_on_cmd_reset_dev (cmd->target, (int ) target_lun, sdev); + +if (sdev !=NULL ) { + s->resetting++; +device_reset (&sdev->qdev); + s->resetting--; +return PVSCSI_COMMAND_PROCESSING_SUCCEEDED ; + } + +return PVSCSI_COMMAND_PROCESSING_FAILED ; +} + +static uint64_t +pvscsi_on_cmd_reset_bus (PVSCSIState *s) +{ +trace_pvscsi_on_cmd_arrived ("PVSCSI_CMD_RESET_BUS" ); + + s->resetting++; +qbus_reset_all_fn (&s->bus); + s->resetting--; +return PVSCSI_COMMAND_PROCESSING_SUCCEEDED ; +} + +static uint64_t +pvscsi_on_cmd_setup_msg_ring (PVSCSIState *s) +{ +PVSCSICmdDescSetupMsgRing *rc = + (PVSCSICmdDescSetupMsgRing *) s->curr_cmd_data; + +trace_pvscsi_on_cmd_arrived ("PVSCSI_CMD_SETUP_MSG_RING" ); + +if (!s->use_msg) { +return PVSCSI_COMMAND_PROCESSING_FAILED ; + } + +if (s->rings_info_valid) { +pvscsi_ring_init_msg (&s->rings, rc); + s->msg_ring_info_valid = TRUE; + } +return sizeof (PVSCSICmdDescSetupMsgRing) /sizeof (uint32_t ); +} + +static uint64_t +pvscsi_on_cmd_adapter_reset (PVSCSIState *s) +{ +trace_pvscsi_on_cmd_arrived ("PVSCSI_CMD_ADAPTER_RESET" ); + +pvscsi_reset_adapter (s); +return PVSCSI_COMMAND_PROCESSING_SUCCEEDED ; +} + +static const struct { +int data_size; +uint64_t (*handler_fn)(PVSCSIState *s); +} pvscsi_commands[] = { + [PVSCSI_CMD_FIRST ] = { + .data_size =0 , + .handler_fn = pvscsi_on_cmd_unknown, + }, + +/* Not implemented, data size defined based on what arrives on windows */
hw/scsi/vmw_pvscsi.c new file +56
-0+ [PVSCSI_CMD_CONFIG ] = { + .data_size =6 *sizeof (uint32_t ), + .handler_fn = pvscsi_on_cmd_config, + }, + + /* Command not implemented, data size is unknown */ + [PVSCSI_CMD_ISSUE_SCSI ] = { + .data_size =0 , + .handler_fn = pvscsi_on_issue_scsi, + }, + + /* Command not implemented, data size is unknown */ + [PVSCSI_CMD_DEVICE_UNPLUG ] = { + .data_size =0 , + .handler_fn = pvscsi_on_cmd_unplug, + }, + + [PVSCSI_CMD_SETUP_RINGS ] = { + .data_size =sizeof (PVSCSICmdDescSetupRings), + .handler_fn = pvscsi_on_cmd_setup_rings, + }, + + [PVSCSI_CMD_RESET_DEVICE ] = { + .data_size =sizeof (struct PVSCSICmdDescResetDevice ), + .handler_fn = pvscsi_on_cmd_reset_device, + }, + + [PVSCSI_CMD_RESET_BUS ] = { + .data_size =0 , + .handler_fn = pvscsi_on_cmd_reset_bus, + }, + + [PVSCSI_CMD_SETUP_MSG_RING ] = { + .data_size =sizeof (PVSCSICmdDescSetupMsgRing), + .handler_fn = pvscsi_on_cmd_setup_msg_ring, + }, + + [PVSCSI_CMD_ADAPTER_RESET ] = { + .data_size =0 , + .handler_fn = pvscsi_on_cmd_adapter_reset, + }, + + [PVSCSI_CMD_ABORT_CMD ] = { + .data_size =sizeof (struct PVSCSICmdDescAbortCmd ), + .handler_fn = pvscsi_on_cmd_abort, + }, +}; + +static void +pvscsi_do_command_processing (PVSCSIState *s) +{ +size_t bytes_arrived = s->curr_cmd_data_cntr *sizeof (uint32_t ); + +assert (s->curr_cmd <PVSCSI_CMD_LAST ); +if (bytes_arrived >= pvscsi_commands[s->curr_cmd].data_size) { + s->reg_command_status =pvscsi_commands[s->curr_cmd].handler_fn(s);
hw/scsi/vmw_pvscsi.c new file +62
-0+ s->curr_cmd =PVSCSI_CMD_FIRST ; + s->curr_cmd_data_cntr =0 ; + } +} + +static void +pvscsi_on_command_data (PVSCSIState *s,uint32_t value) +{ +size_t bytes_arrived = s->curr_cmd_data_cntr *sizeof (uint32_t ); + +assert (bytes_arrived <sizeof (s->curr_cmd_data)); + s->curr_cmd_data[s->curr_cmd_data_cntr++] = value; + +pvscsi_do_command_processing (s); +} + +static void +pvscsi_on_command (PVSCSIState *s,uint64_t cmd_id) +{ +if ((cmd_id >PVSCSI_CMD_FIRST ) && (cmd_id <PVSCSI_CMD_LAST )) { + s->curr_cmd = cmd_id; + }else { + s->curr_cmd =PVSCSI_CMD_FIRST ; +trace_pvscsi_on_cmd_unknown (cmd_id); + } + + s->curr_cmd_data_cntr =0 ; + s->reg_command_status =PVSCSI_COMMAND_NOT_ENOUGH_DATA ; + +pvscsi_do_command_processing (s); +} + +static void +pvscsi_io_write (void *opaque,hwaddr addr, +uint64_t val,unsigned size) +{ +PVSCSIState *s = opaque; + +switch (addr) { +case PVSCSI_REG_OFFSET_COMMAND : +pvscsi_on_command (s, val); +break ; + +case PVSCSI_REG_OFFSET_COMMAND_DATA : +pvscsi_on_command_data (s, (uint32_t ) val); +break ; + +case PVSCSI_REG_OFFSET_INTR_STATUS : +trace_pvscsi_io_write ("PVSCSI_REG_OFFSET_INTR_STATUS" , val); + s->reg_interrupt_status &= ~val; +pvscsi_update_irq_status (s); +pvscsi_schedule_completion_processing (s); +break ; + +case PVSCSI_REG_OFFSET_INTR_MASK : +trace_pvscsi_io_write ("PVSCSI_REG_OFFSET_INTR_MASK" , val); + s->reg_interrupt_enabled = val; +pvscsi_update_irq_status (s); +break ; + +case PVSCSI_REG_OFFSET_KICK_NON_RW_IO : + trace_pvscsi_io_write("PVSCSI_REG_OFFSET_KICK_NON_RW_IO",val);
hw/scsi/vmw_pvscsi.c new file +37
-0+pvscsi_process_io (s); +break ; + +case PVSCSI_REG_OFFSET_KICK_RW_IO : +trace_pvscsi_io_write ("PVSCSI_REG_OFFSET_KICK_RW_IO" , val); +pvscsi_process_io (s); +break ; + +case PVSCSI_REG_OFFSET_DEBUG : +trace_pvscsi_io_write ("PVSCSI_REG_OFFSET_DEBUG" , val); +break ; + +default : +trace_pvscsi_io_write_unknown (addr, size, val); +break ; + } + +} + +static uint64_t +pvscsi_io_read (void *opaque,hwaddr addr,unsigned size) +{ +PVSCSIState *s = opaque; + +switch (addr) { +case PVSCSI_REG_OFFSET_INTR_STATUS : +trace_pvscsi_io_read ("PVSCSI_REG_OFFSET_INTR_STATUS" , + s->reg_interrupt_status); +return s->reg_interrupt_status; + +case PVSCSI_REG_OFFSET_INTR_MASK : +trace_pvscsi_io_read ("PVSCSI_REG_OFFSET_INTR_MASK" , + s->reg_interrupt_status); +return s->reg_interrupt_enabled; + +case PVSCSI_REG_OFFSET_COMMAND_STATUS : +trace_pvscsi_io_read("PVSCSI_REG_OFFSET_COMMAND_STATUS",
hw/scsi/vmw_pvscsi.c new file +81
-0+ s->reg_interrupt_status); +return s->reg_command_status; + +default : +trace_pvscsi_io_read_unknown (addr, size); +return 0 ; + } +} + + +static bool +pvscsi_init_msi (PVSCSIState *s) +{ +int res; +PCIDevice *d =PCI_DEVICE (s); + + res =msi_init (d,PVSCSI_MSI_OFFSET ,PVSCSI_MSIX_NUM_VECTORS , +PVSCSI_USE_64BIT ,PVSCSI_PER_VECTOR_MASK ); +if (res <0 ) { +trace_pvscsi_init_msi_fail (res); + s->msi_used = false; + }else { + s->msi_used = true; + } + +return s->msi_used; +} + +static void +pvscsi_cleanup_msi (PVSCSIState *s) +{ +PCIDevice *d =PCI_DEVICE (s); + +if (s->msi_used) { +msi_uninit (d); + } +} + +static const MemoryRegionOps pvscsi_ops = { + .read = pvscsi_io_read, + .write = pvscsi_io_write, + .endianness =DEVICE_LITTLE_ENDIAN , + .impl = { + .min_access_size =4 , + .max_access_size =4 , + }, +}; + +static const struct SCSIBusInfo pvscsi_scsi_info = { + .tcq = true, + .max_target =PVSCSI_MAX_DEVS , + .max_channel =0 , + .max_lun =0 , + + .get_sg_list = pvscsi_get_sg_list, + .complete = pvscsi_command_complete, + .cancel = pvscsi_request_cancelled, + .hotplug = pvscsi_hotplug, + .hot_unplug = pvscsi_hot_unplug, +}; + +static int +pvscsi_init (PCIDevice *pci_dev) +{ +PVSCSIState *s =PVSCSI (pci_dev); + +trace_pvscsi_state ("init" ); + +/* PCI subsystem ID */ + pci_dev->config[PCI_SUBSYSTEM_ID ] =0x00 ; + pci_dev->config[PCI_SUBSYSTEM_ID +1 ] =0x10 ; + +/* PCI latency timer = 255 */ + pci_dev->config[PCI_LATENCY_TIMER ] =0xff ; + +/* Interrupt pin A */ +pci_config_set_interrupt_pin (pci_dev->config,1 ); + +memory_region_init_io (&s->io_space, &pvscsi_ops, s, +"pvscsi-io" ,PVSCSI_MEM_SPACE_SIZE ); + pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY,
&s->io_space);hw/scsi/vmw_pvscsi.c new file +4
-0+ +pvscsi_init_msi (s); + + s->completion_worker =
qemu_bh_new(pvscsi_process_completion_queue, s);hw/scsi/vmw_pvscsi.c new file +71
-0+if (!s->completion_worker) { +pvscsi_cleanup_msi (s); +memory_region_destroy (&s->io_space); +return -ENOMEM ; + } + +scsi_bus_new (&s->bus, &pci_dev->qdev, &pvscsi_scsi_info); +pvscsi_reset_state (s); + +return 0 ; +} + +static void +pvscsi_uninit (PCIDevice *pci_dev) +{ +PVSCSIState *s =PVSCSI (pci_dev); + +trace_pvscsi_state ("uninit" ); +qemu_bh_delete (s->completion_worker); + +pvscsi_cleanup_msi (s); + +memory_region_destroy (&s->io_space); +} + +static void +pvscsi_reset (DeviceState *dev) +{ +PCIDevice *d =PCI_DEVICE (dev); +PVSCSIState *s =PVSCSI (d); + +trace_pvscsi_state ("reset" ); +pvscsi_reset_adapter (s); +} + +static void +pvscsi_pre_save (void *opaque) +{ +PVSCSIState *s = (PVSCSIState *) opaque; + +trace_pvscsi_state ("presave" ); + +assert (QTAILQ_EMPTY (&s->pending_queue)); +assert (QTAILQ_EMPTY (&s->completion_queue)); +} + +static int +pvscsi_post_load (void *opaque,int version_id) +{ +trace_pvscsi_state ("postload" ); +return 0 ; +} + +static const VMStateDescription vmstate_pvscsi = { + .name =TYPE_PVSCSI , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .pre_save = pvscsi_pre_save, + .post_load = pvscsi_post_load, + .fields = (VMStateField []) { +VMSTATE_PCI_DEVICE (parent_obj, PVSCSIState), +VMSTATE_UINT8 (msi_used, PVSCSIState), +VMSTATE_UINT32 (resetting, PVSCSIState), +VMSTATE_UINT64 (reg_interrupt_status, PVSCSIState), +VMSTATE_UINT64 (reg_interrupt_enabled, PVSCSIState), +VMSTATE_UINT64 (reg_command_status, PVSCSIState), +VMSTATE_UINT64 (curr_cmd, PVSCSIState), +VMSTATE_UINT32 (curr_cmd_data_cntr, PVSCSIState), + VMSTATE_UINT32_ARRAY(curr_cmd_data, PVSCSIState, + ARRAY_SIZE(((PVSCSIState*)NULL)->curr_cmd_data)),
hw/scsi/vmw_pvscsi.c new file +9
-0+VMSTATE_UINT8 (rings_info_valid, PVSCSIState), +VMSTATE_UINT8 (msg_ring_info_valid, PVSCSIState), +VMSTATE_UINT8 (use_msg, PVSCSIState), + +VMSTATE_UINT64 (rings.rs_pa, PVSCSIState), +VMSTATE_UINT32 (rings.txr_len_mask, PVSCSIState), +VMSTATE_UINT32 (rings.rxr_len_mask, PVSCSIState), + VMSTATE_UINT64_ARRAY(rings.req_ring_pages_pa, PVSCSIState, +
PVSCSI_SETUP_RINGS_MAX_NUM_PAGES),
+ VMSTATE_UINT64_ARRAY(rings.cmp_ring_pages_pa,
PVSCSIState,
+PVSCSI_SETUP_RINGS_MAX_NUM_PAGES),hw/scsi/vmw_pvscsi.c new file +50
-0+VMSTATE_UINT64 (rings.consumed_ptr, PVSCSIState), +VMSTATE_UINT64 (rings.filled_cmp_ptr, PVSCSIState), + + VMSTATE_END_OF_LIST() + } +}; + +static void +pvscsi_write_config (PCIDevice *pci,uint32_t addr,uint32_t val,int len) +{ +pci_default_write_config (pci, addr, val, len); +msi_write_config (pci, addr, val, len); +} + +static Property pvscsi_properties[] = { +DEFINE_PROP_UINT8 ("use_msg" , PVSCSIState, use_msg,1 ), +DEFINE_PROP_END_OF_LIST (), +}; + +static void pvscsi_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); + + k->init = pvscsi_init; + k->exit = pvscsi_uninit; + k->vendor_id =PCI_VENDOR_ID_VMWARE ; + k->device_id =PCI_DEVICE_ID_VMWARE_PVSCSI ; + k->class_id =PCI_CLASS_STORAGE_SCSI ; + k->subsystem_id =0x1000 ; + dc->reset = pvscsi_reset; + dc->vmsd = &vmstate_pvscsi; + dc->props = pvscsi_properties; + k->config_write = pvscsi_write_config; +} + +static const TypeInfo pvscsi_info = { + .name ="pvscsi" , + .parent =TYPE_PCI_DEVICE , + .instance_size =sizeof (PVSCSIState), + .class_init = pvscsi_class_init, +}; + +static void +pvscsi_register_types (void ) +{ +type_register_static (&pvscsi_info); +} + +type_init (pvscsi_register_types);hw/scsi/vmw_pvscsi.h new file +12
-0@@ -0,0 +1,434 @@ +/* +* VMware PVSCSI header file +* +* Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; version 2 of the License and no later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Maintained by: Arvind Kumar <[email protected]>
+ *
+ */hw/scsi/vmw_pvscsi.h new file +14
-0+ +#ifndef VMW_PVSCSI_H +#define VMW_PVSCSI_H + +#define VMW_PAGE_SIZE (4096) +#define VMW_PAGE_SHIFT (12) + +#define MASK (n) ((1 << (n)) - 1)/* make an n-bit mask */ + +/* +* host adapter status/error codes +*/ +enum HostBusAdapterStatus { +BTSTAT_SUCCESS =0x00 ,/* CCB complete normally with no errors */
hw/scsi/vmw_pvscsi.h new file +8
-0+BTSTAT_LINKED_COMMAND_COMPLETED =0x0a , +BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG =0x0b , +BTSTAT_DATA_UNDERRUN =0x0c , +BTSTAT_SELTIMEO =0x11 ,/* SCSI selection timeout */ +BTSTAT_DATARUN =0x12 ,/* data overrun/underrun */ +BTSTAT_BUSFREE =0x13 ,/* unexpected bus free */ +BTSTAT_INVPHASE =0x14 ,/* invalid bus phase or sequence */ +/* requested by target */
+BTSTAT_LUNMISMATCH=0x17, /* linked CCB has different LUN
*/
+ /* from first CCB
*/hw/scsi/vmw_pvscsi.h new file +2
-0+BTSTAT_SENSFAILED =0x1b ,/* auto request sense failed */ + BTSTAT_TAGREJECT = 0x1c, /* SCSI II tagged queueing message*/
+ /* rejected by target
*/
+BTSTAT_BADMSG=0x1d, /* unsupported message received
by */
+ /* the host adapter
*/
+BTSTAT_HAHARDWARE=0x20, /* host adapter hardware failed
*/
+BTSTAT_NORESPONSE=0x21, /* target did not respond to SCSI
ATN, */
+ /* sent a SCSI RST
*/
+BTSTAT_SENTRST=0x22, /* host adapter asserted a SCSI RST
*/
+BTSTAT_RECVRST=0x23, /* other SCSI devices asserted a
SCSI RST */
+BTSTAT_DISCONNECT=0x24, /* target device reconnected
improperly */
+ /* (w/o tag)
*/
+BTSTAT_BUSRESET=0x25, /* host adapter issued BUS device
reset */hw/scsi/vmw_pvscsi.h new file +3
-0+BTSTAT_ABORTQUEUE =0x26 ,/* abort queue generated */ +BTSTAT_HASOFTWARE =0x27 ,/* host adapter software error */ + BTSTAT_HATIMEOUT = 0x30, /* host adapter hardware timeouterror */
hw/scsi/vmw_pvscsi.h new file +91
-0+ BTSTAT_SCSIPARITY = 0x34, /* SCSI parity error detected */ +}; + +/* +* Register offsets. +* +* These registers are accessible both via i/o space and mm i/o. +*/ + +enum PVSCSIRegOffset { +PVSCSI_REG_OFFSET_COMMAND =0x0 , +PVSCSI_REG_OFFSET_COMMAND_DATA =0x4 , +PVSCSI_REG_OFFSET_COMMAND_STATUS =0x8 , +PVSCSI_REG_OFFSET_LAST_STS_0 =0x100 , +PVSCSI_REG_OFFSET_LAST_STS_1 =0x104 , +PVSCSI_REG_OFFSET_LAST_STS_2 =0x108 , +PVSCSI_REG_OFFSET_LAST_STS_3 =0x10c , +PVSCSI_REG_OFFSET_INTR_STATUS =0x100c , +PVSCSI_REG_OFFSET_INTR_MASK =0x2010 , +PVSCSI_REG_OFFSET_KICK_NON_RW_IO =0x3014 , +PVSCSI_REG_OFFSET_DEBUG =0x3018 , +PVSCSI_REG_OFFSET_KICK_RW_IO =0x4018 , +}; + +/* +* Virtual h/w commands. +*/ + +enum PVSCSICommands { +PVSCSI_CMD_FIRST =0 ,/* has to be first */ + +PVSCSI_CMD_ADAPTER_RESET =1 , +PVSCSI_CMD_ISSUE_SCSI =2 , +PVSCSI_CMD_SETUP_RINGS =3 , +PVSCSI_CMD_RESET_BUS =4 , +PVSCSI_CMD_RESET_DEVICE =5 , +PVSCSI_CMD_ABORT_CMD =6 , +PVSCSI_CMD_CONFIG =7 , +PVSCSI_CMD_SETUP_MSG_RING =8 , +PVSCSI_CMD_DEVICE_UNPLUG =9 , + +PVSCSI_CMD_LAST =10 /* has to be last */ +}; + +#define PVSCSI_COMMAND_PROCESSING_SUCCEEDED (0) +#define PVSCSI_COMMAND_PROCESSING_FAILED (-1) +#define PVSCSI_COMMAND_NOT_ENOUGH_DATA (-2) + +/* +* Command descriptor for PVSCSI_CMD_RESET_DEVICE -- +*/ + +struct PVSCSICmdDescResetDevice { +uint32_t target; +uint8_t lun[8 ]; +}QEMU_PACKED ; + +typedef struct PVSCSICmdDescResetDevice PVSCSICmdDescResetDevice ; + +/* +* Command descriptor for PVSCSI_CMD_ABORT_CMD -- +* +* - currently does not support specifying the LUN. +* - pad should be 0. +*/ + +struct PVSCSICmdDescAbortCmd { +uint64_t context; +uint32_t target; +uint32_t pad; +}QEMU_PACKED ; + +typedef struct PVSCSICmdDescAbortCmd PVSCSICmdDescAbortCmd ; + +/* +* Command descriptor for PVSCSI_CMD_SETUP_RINGS -- +* +* Notes: +* - reqRingNumPages and cmpRingNumPages need to be power of two. +* - reqRingNumPages and cmpRingNumPages need to be different from 0, +* - reqRingNumPages and cmpRingNumPages need to be inferior to +* PVSCSI_SETUP_RINGS_MAX_NUM_PAGES. +*/ + +#define PVSCSI_SETUP_RINGS_MAX_NUM_PAGES 32 +struct PVSCSICmdDescSetupRings { +uint32_t reqRingNumPages; +uint32_t cmpRingNumPages; +uint64_t ringsStatePPN; +uint64_t reqRingPPNs[PVSCSI_SETUP_RINGS_MAX_NUM_PAGES ]; +uint64_t cmpRingPPNs[PVSCSI_SETUP_RINGS_MAX_NUM_PAGES];
hw/scsi/vmw_pvscsi.h new file +11
-0+}QEMU_PACKED ; + +typedef struct PVSCSICmdDescSetupRings PVSCSICmdDescSetupRings ; + +/* +* Command descriptor for PVSCSI_CMD_SETUP_MSG_RING -- +* +* Notes: +* - this command was not supported in the initial revision of the h/w +* interface. Before using it, you need to check that it is supported by +* writing PVSCSI_CMD_SETUP_MSG_RING to the 'command' register, then
+ * immediately after read the 'command status' register:
+ * * a value of -1 means that the cmd is NOT supported,
+ * * a value != -1 means that the cmd IS supported.
+ * If it's supported the 'command status' register should return:
+ * sizeof(PVSCSICmdDescSetupMsgRing) /sizeof(uint32_t).
+ * - this command should be issued _after_ the usualSETUP_RINGSso that the
+ * RingsState page is already setup. If not, the command is a nop.
+ * - numPages needs to be a power of two,
+ * - numPages needs to be different from 0,
+ * - pad should be zero.
+ */hw/scsi/vmw_pvscsi.h new file +7
-0+ +#define PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES 16 + +struct PVSCSICmdDescSetupMsgRing { +uint32_t numPages; +uint32_t pad; +uint64_t ringPPNs[PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES];
hw/scsi/vmw_pvscsi.h new file +3
-0+}QEMU_PACKED ; + +typedef struct PVSCSICmdDescSetupMsgRingPVSCSICmdDescSetupMsgRing;
hw/scsi/vmw_pvscsi.h new file +32
-0+ +enum PVSCSIMsgType { +PVSCSI_MSG_DEV_ADDED =0 , +PVSCSI_MSG_DEV_REMOVED =1 , +PVSCSI_MSG_LAST =2 , +}; + +/* +* Msg descriptor. +* +* sizeof(struct PVSCSIRingMsgDesc) == 128. +* +* - type is of type enum PVSCSIMsgType. +* - the content of args depend on the type of event being delivered. +*/ + +struct PVSCSIRingMsgDesc { +uint32_t type; +uint32_t args[31 ]; +}QEMU_PACKED ; + +typedef struct PVSCSIRingMsgDesc PVSCSIRingMsgDesc ; + +struct PVSCSIMsgDescDevStatusChanged { +uint32_t type;/* PVSCSI_MSG_DEV _ADDED / _REMOVED */ +uint32_t bus; +uint32_t target; +uint8_t lun[8 ]; +uint32_t pad[27 ]; +}QEMU_PACKED ; + +typedef struct PVSCSIMsgDescDevStatusChangedPVSCSIMsgDescDevStatusChanged;
hw/scsi/vmw_pvscsi.h new file +38
-0+ +/* +* Rings state. +* +* - the fields: +* . msgProdIdx, +* . msgConsIdx, +* . msgNumEntriesLog2, +* .. are only used once the SETUP_MSG_RING cmd has been issued. +* - 'pad' helps to ensure that the msg related fields are on their own +* cache-line. +*/ + +struct PVSCSIRingsState { +uint32_t reqProdIdx; +uint32_t reqConsIdx; +uint32_t reqNumEntriesLog2; + +uint32_t cmpProdIdx; +uint32_t cmpConsIdx; +uint32_t cmpNumEntriesLog2; + +uint8_t pad[104 ]; + +uint32_t msgProdIdx; +uint32_t msgConsIdx; +uint32_t msgNumEntriesLog2; +}QEMU_PACKED ; + +typedef struct PVSCSIRingsState PVSCSIRingsState ; + +/* +* Request descriptor. +* +* sizeof(RingReqDesc) = 128 +* +* - context: is a unique identifier of a command. It could normally be any +* 64bit value, however we currently store it in the serialNumber variable
+ * of structSCSI_Command, so we have the following restrictions due to
the
+ * way this field is handled in the vmkernel storage stack:
+ * * this value can't be 0,
+ * * the upper 32bit need to be 0 since serialNumber is as auint32_t.
+ * Currently tracked as PR 292060.
+ * - dataLen: contains the total number of bytes that need to be transferred.
+ * - dataAddr:
+ * * ifPVSCSI_FLAG_CMD_WITH_SG_LISTis set: dataAddr is the PA of
the first
+ * s/g table segment, each s/g segment is entirely contained on a
single
+ * page of physical memory,
+ * * ifPVSCSI_FLAG_CMD_WITH_SG_LISTis NOT set, then dataAddr is
the PA of
+ * the buffer used for the DMA transfer,
+ * - flags:+ * * PVSCSI_FLAG_CMD_WITH_SG_LIST: see dataAddr above, + * * PVSCSI_FLAG_CMD_DIR_NONE: no DMA involved, + * * PVSCSI_FLAG_CMD_DIR_TOHOST: transfer from device to mainmemory,
+ * *PVSCSI_FLAG_CMD_DIR_TODEVICE: transfer from main memory to
device,
+ * *PVSCSI_FLAG_CMD_OUT_OF_BAND_CDB: reserved to handle CDBs
larger than
+ * 16bytes. To be specified.
+ * - vcpuHint: vcpuId of the processor that will be most likely waiting for the
+ * completion of the i/o. For guest OSes that use lowest priority
message
+ * delivery mode (such as windows), we use this "hint" to deliver the
+ * completion action to the proper vcpu. For now, we can use the vcpuId
of
+ * the processor that initiated the i/o as a likely candidate for the vcpu
+ * that will be waiting for the completion..
+ * - bus should be 0: we currently only support bus 0 for now.
+ * - unused should be zero'd.
+ */hw/scsi/vmw_pvscsi.h new file +37
-0+ +#define PVSCSI_FLAG_CMD_WITH_SG_LIST (1 << 0) +#define PVSCSI_FLAG_CMD_OUT_OF_BAND_CDB (1 << 1) +#define PVSCSI_FLAG_CMD_DIR_NONE (1 << 2) +#define PVSCSI_FLAG_CMD_DIR_TOHOST (1 << 3) +#define PVSCSI_FLAG_CMD_DIR_TODEVICE (1 << 4) + +#define PVSCSI_KNOWN_FLAGS \ + (PVSCSI_FLAG_CMD_WITH_SG_LIST | \ + PVSCSI_FLAG_CMD_OUT_OF_BAND_CDB | \ + PVSCSI_FLAG_CMD_DIR_NONE | \ + PVSCSI_FLAG_CMD_DIR_TOHOST | \ + PVSCSI_FLAG_CMD_DIR_TODEVICE) + +struct PVSCSIRingReqDesc { +uint64_t context; +uint64_t dataAddr; +uint64_t dataLen; +uint64_t senseAddr; +uint32_t senseLen; +uint32_t flags; +uint8_t cdb[16 ]; +uint8_t cdbLen; +uint8_t lun[8 ]; +uint8_t tag; +uint8_t bus; +uint8_t target; +uint8_t vcpuHint; +uint8_t unused[59 ]; +}QEMU_PACKED ; + +typedef struct PVSCSIRingReqDesc PVSCSIRingReqDesc ; + +/* +* Scatter-gather list management. +* +* As described above, when PVSCSI_FLAG_CMD_WITH_SG_LIST is set in the
+ * RingReqDesc.flags, then RingReqDesc.dataAddr is the PA of the first s/g
+ * table segment.
+ *
+ * - each segment of the s/g table contain a succession of struct
+ * PVSCSISGElement.
+ * - each segment is entirely contained on a single physical page of memory.
+ * - a "chain" s/g element has the flagPVSCSI_SGE_FLAG_CHAIN_ELEMENTset in
+ * PVSCSISGElement.flags and in this case:
+ * * addr is the PA of the next s/g segment,
+ * * length is undefined, assumed to be 0.
+ */hw/scsi/vmw_pvscsi.h new file +63
-0+ +struct PVSCSISGElement { +uint64_t addr; +uint32_t length; +uint32_t flags; +}QEMU_PACKED ; + +typedef struct PVSCSISGElement PVSCSISGElement ; + +/* +* Completion descriptor. +* +* sizeof(RingCmpDesc) = 32 +* +* - context: identifier of the command. The same thing that was specified +* under "context" as part of struct RingReqDesc at initiation time, +* - dataLen: number of bytes transferred for the actual i/o operation, +* - senseLen: number of bytes written into the sense buffer, +* - hostStatus: adapter status, +* - scsiStatus: device status, +* - pad should be zero. +*/ + +struct PVSCSIRingCmpDesc { +uint64_t context; +uint64_t dataLen; +uint32_t senseLen; +uint16_t hostStatus; +uint16_t scsiStatus; +uint32_t pad[2 ]; +}QEMU_PACKED ; + +typedef struct PVSCSIRingCmpDesc PVSCSIRingCmpDesc ; + +/* +* Interrupt status / IRQ bits. +*/ + +#define PVSCSI_INTR_CMPL_0 (1 << 0) +#define PVSCSI_INTR_CMPL_1 (1 << 1) +#define PVSCSI_INTR_CMPL_MASK MASK(2) + +#define PVSCSI_INTR_MSG_0 (1 << 2) +#define PVSCSI_INTR_MSG_1 (1 << 3) +#define PVSCSI_INTR_MSG_MASK (MASK(2) << 2) + +#define PVSCSI_INTR_ALL_SUPPORTED MASK(4) + +/* +* Number of MSI-X vectors supported. +*/ +#define PVSCSI_MAX_INTRS 24 + +/* +* Enumeration of supported MSI-X vectors +*/ +#define PVSCSI_VECTOR_COMPLETION 0 + +/* +* Misc constants for the rings. +*/ + +#define PVSCSI_MAX_NUM_PAGES_REQ_RING
PVSCSI_SETUP_RINGS_MAX_NUM_PAGES
+#definePVSCSI_MAX_NUM_PAGES_CMP_RINGPVSCSI_SETUP_RINGS_MAX_NUM_PAGES
+#definePVSCSI_MAX_NUM_PAGES_MSG_RINGPVSCSI_SETUP_MSG_RING_MAX_NUM_PAGEShw/scsi/vmw_pvscsi.h new file +12
-0+ +#define PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE \ + (VMW_PAGE_SIZE / sizeof(struct PVSCSIRingReqDesc)) + +#define PVSCSI_MAX_NUM_CMP_ENTRIES_PER_PAGE \ + (VMW_PAGE_SIZE / sizeof(PVSCSIRingCmpDesc)) + +#define PVSCSI_MAX_NUM_MSG_ENTRIES_PER_PAGE \ + (VMW_PAGE_SIZE / sizeof(PVSCSIRingMsgDesc)) + +#define PVSCSI_MAX_REQ_QUEUE_DEPTH \ + (PVSCSI_MAX_NUM_PAGES_REQ_RING *
PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE)hw/scsi/vmw_pvscsi.h new file +24
-0+ +#define PVSCSI_MEM_SPACE_COMMAND_NUM_PAGES 1 +#define PVSCSI_MEM_SPACE_INTR_STATUS_NUM_PAGES 1 +#define PVSCSI_MEM_SPACE_MISC_NUM_PAGES 2 +#define PVSCSI_MEM_SPACE_KICK_IO_NUM_PAGES 2 +#define PVSCSI_MEM_SPACE_MSIX_NUM_PAGES 2 + +enum PVSCSIMemSpace { +PVSCSI_MEM_SPACE_COMMAND_PAGE =0 , +PVSCSI_MEM_SPACE_INTR_STATUS_PAGE =1 , +PVSCSI_MEM_SPACE_MISC_PAGE =2 , +PVSCSI_MEM_SPACE_KICK_IO_PAGE =4 , +PVSCSI_MEM_SPACE_MSIX_TABLE_PAGE =6 , +PVSCSI_MEM_SPACE_MSIX_PBA_PAGE =7 , +}; + +#define PVSCSI_MEM_SPACE_NUM_PAGES \ + (PVSCSI_MEM_SPACE_COMMAND_NUM_PAGES + \ + PVSCSI_MEM_SPACE_INTR_STATUS_NUM_PAGES + \ + PVSCSI_MEM_SPACE_MISC_NUM_PAGES + \ + PVSCSI_MEM_SPACE_KICK_IO_NUM_PAGES + \ + PVSCSI_MEM_SPACE_MSIX_NUM_PAGES) + +#define PVSCSI_MEM_SPACE_SIZE (PVSCSI_MEM_SPACE_NUM_PAGES*
VMW_PAGE_SIZE)hw/scsi/vmw_pvscsi.h new file +2
-0+ +#endif /* VMW_PVSCSI_H */ include/hw/pci/pci.h +1
-0@@ -59,6 +59,7 @@#define PCI_DEVICE_ID_VMWARE_SVGA 0x0710#define PCI_DEVICE_ID_VMWARE_NET 0x0720#define PCI_DEVICE_ID_VMWARE_SCSI 0x0730 +#define PCI_DEVICE_ID_VMWARE_PVSCSI 0x07C0#define PCI_DEVICE_ID_VMWARE_IDE 0x1729#define PCI_DEVICE_ID_VMWARE_VMXNET3 0x07B0trace-events +0
-0@@ -766,6 +766,41 @@ pc87312_info_ide(uint32_t base) "base 0x%x" pc87312_info_parallel(uint32_t base, uint32_t irq) "base 0x%x, irq %u" pc87312_info_serial(int n, uint32_t base, uint32_t irq) "id=%d, base 0x%x,irq %u"
trace-events +2
-0+# hw/scsi/vmw_pvscsi.c +pvscsi_ring_init_data(uint32_t txr_len_log2, uint32_t rxr_len_log2) "TX/RXrings logarithms set to %d/%d"
trace-events +2
-0+pvscsi_ring_init_msg(uint32_t len_log2) "MSG ring logarithm set to %d" +pvscsi_ring_flush_cmp(uint64_t filled_cmp_ptr) "new production counter ofcompletion ring is 0x%"PRIx64"" +pvscsi_ring_flush_msg(uint64_t
filled_cmp_ptr) "new production counter of message ring is 0x%"PRIx64""
+pvscsi_update_irq_level(bool raise,uint64_tmask,uint64_tstatus) "interrupt level set to %d (MASK: 0x%"PRIx64", STATUS: 0x%"PRIx64")"trace-events +2
-0+pvscsi_update_irq_msi(void) "sending MSI notification" +pvscsi_cmp_ring_put(unsigned long addr) "got completion descriptor0x%lx"
trace-events +2
-0+pvscsi_msg_ring_put(unsigned long addr) "got message descriptor 0x%lx" +pvscsi_complete_request(uint64_t context, uint64_t len, uint8_t sense_key)"completion: ctx: 0x%"PRIx64", len: 0x%"PRIx64", sense key: %u"
trace-events +2
-0+pvscsi_get_sg_list(int nsg, size_t size) "get SG list: depth: %u, size: %lu" +pvscsi_get_next_sg_elem(uint32_t flags) "unknown flags in SG element (val:0x%x)"
+pvscsi_command_complete_not_found(uint32_t tag) "can't find request for tag 0x%x"
+pvscsi_command_complete_data_run(void) "not all data required for command transferred"
+pvscsi_command_complete_sense_len(int len) "sense information length is %d bytes"
+pvscsi_convert_sglist(uint64_t context, unsigned long addr,uint32_tresid) "element: ctx: 0x%"PRIx64" addr: 0x%lx, len: %ul" +pvscsi_process_req_descr(uint8_t cmd,uint64_tctx) "SCSI cmd 0x%x, ctx:
0x%"PRIx64""
+pvscsi_process_req_descr_unknown_device(void) "command directed to unknown device rejected" +pvscsi_process_req_descr_invalid_dir(void) "command with invalid transfer direction rejected"trace-events +2
-0+pvscsi_process_io(unsigned long addr) "got descriptor 0x%lx" +pvscsi_on_cmd_noimpl(const char* cmd) "unimplemented command %signored"
+pvscsi_on_cmd_reset_dev(uint32_t tgt, int lun, void* dev) "PVSCSI_CMD_RESET_DEVICE[target %u lun %d (dev 0x%p)]"trace-events +2
-0+pvscsi_on_cmd_arrived(const char* cmd) "command %s arrived" +pvscsi_on_cmd_abort(uint64_t ctx, uint32_t tgt) "command
PVSCSI_CMD_ABORT_CMDfor ctx 0x%"PRIx64", target %u" +pvscsi_on_cmd_unknown(uint64_tcmd_id) "unknown command %"PRIx64"" +pvscsi_on_cmd_unknown_data(uint32_t data) "data for unknown command 0x:%x"trace-events +2
-0+pvscsi_io_write(const char* cmd, uint64_t val) "%s write: %"PRIx64"" +pvscsi_io_write_unknown(unsigned long addr, unsigned sz, uint64_t val)"unknown write address: 0x%lx size: %u bytes value: 0x%"PRIx64""
trace-events +2
-0+pvscsi_io_read(const char* cmd, uint64_t status) "%s read: 0x%"PRIx64"" +pvscsi_io_read_unknown(unsigned long addr, unsigned sz) "unknown readaddress: 0x%lx size: %u bytes"
trace-events +4
-0+pvscsi_init_msi_fail(int res) "failed to initialize MSI, error %d" +pvscsi_state(const char* state) "starting %s ..." +pvscsi_tx_rings_ppn(const char* label, uint64_t ppn) "%s page: %"PRIx64"" +pvscsi_tx_rings_num_pages(const char* label, uint32_t num) "Numberof %s pages: %u"
+# xen-all.c xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: %#lx, size %#lx" xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "%#"PRIx64" size %#lx, log_dirty %i" -- 1.8.1.4
Re: [Qemu-devel] [PATCH 2/9] scsi: VMWare PVSCSI paravirtual device implementation
Il 21/06/2013 05:47, Libaiqing ha scritto:
Quoted 5 lines
Hi paolo,
The PVSCSI device can be used as boot device?
I tested with fedora17 + kernel 3.6 ,but failed.Qemu commit id is "4eda32f588086b6cd0ec2be6a7a6c131f8c2b427". PVSCSI device used as non-boot device works well.partition,mkfs,mount,dd,ok.
Could you give me some advise to debug this problem ? I can provide more information if need.
No, there is no support in SeaBIOS for it.
Paolo
Re: [Qemu-devel] [PATCH 2/9] scsi: VMWare PVSCSI paravirtual device implementation
BTW,
Can't we add to QEMU some simplified interface (device) for boot time only, so that system will be able to boot without SeaBIOS support for specific device?
Regards,
Dmitry
Quoted 15 lines · Paolo Bonzini
Il 21/06/2013 05:47, Libaiqing ha scritto:
Quoted 3 lines
Hi paolo,
The PVSCSI device can be used as boot device?
I tested with fedora17 + kernel 3.6 ,but failed.Qemu commit id is "
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427".Quoted 1 line
PVSCSI device used as non-boot device works
well.partition,mkfs,mount,dd,ok.
Quoted 1 line
Could you give me some advise to debug this problem ? I can provide
more information if need.
No, there is no support in SeaBIOS for it.
Paolo
Re: [Qemu-devel] [PATCH 2/9] scsi: VMWare PVSCSI paravirtual device implementation
Il 21/06/2013 13:44, Dmitry Fleytman ha scritto:
Quoted 5 lines
BTW,
Can't we add to QEMU some simplified interface (device) for boot time only, so that system will be able to boot without SeaBIOS support for specific device?
We had it, and we dropped it. :)
Writing a SeaBIOS driver is very easy, and the biggest limitation of pvscsi is that it doesn't support the VMware option ROM. There is a simple interface using only I/O BARs, or so I was told, exactly for the purpose of booting---but we do not implement that interface. I'm not sure how hard it would be to reverse engineere it, I do not have access to vSphere.
Paolo
PATCH 3/9 vhost: Add vhost_commit callback for SeaBIOS ROM region re-mapping
In reply to Paolo BonziniFrom: Nicholas Bellinger <[email protected]>
This patch follows MST's recommendation to move checks for vhost_verify_ring_mappings() -> cpu_physical_memory_map() operations from MemoryListener->region_[add,del]() -> vhost_set_memory() into final MemoryListener->commit() -> vhost_commit() callback.
It addresses the case where virtio-scsi vq ioport RAM re-mapping to read-only SeaBIOS ROM triggers a cpu_physical_memory_map() NIL MemoryRegionSection pointer failure.
Also save vhost_dev->mem_changed_[start,end]_addr values in vhost_set_memory() for final ranges_overlap checks. (Thanks Paolo!)
--- hw/virtio/vhost.c | 53 +++++++++++++++++++++++++++++++++-------------- include/hw/virtio/vhost.h | 3 +++ 2 files changed, 41 insertions(+), 15 deletions(-)
hw/virtio/vhost.c +38 -15
@@ -382,8 +382,6 @@ static void vhost_set_memory(MemoryListener *listener,bool log_dirty =memory_region_is_logging (section->mr);int s = offsetof(struct vhost_memory , regions) + (dev->mem->nregions +1 ) *sizeof dev->mem->regions[0 ]; -uint64_t log_size; -int r;void *ram; dev->mem =g_realloc (dev->mem, s);
@@ -416,12 +414,47 @@ static void vhost_set_memory(MemoryListener *listener,/* Remove old mapping for this memory, if any. */ vhost_dev_unassign_memory (dev, start_addr, size); } + dev->mem_changed_start_addr =MIN (dev->mem_changed_start_addr, start_addr); + dev->mem_changed_end_addr =MAX (dev->mem_changed_end_addr, start_addr + size -1 ); + dev->memory_changed = true; +} + +static bool vhost_section (MemoryRegionSection *section) +{ +return memory_region_is_ram (section->mr); +} + +static void vhost_begin (MemoryListener *listener) +{ + struct vhost_dev *dev = container_of(listener, struct vhost_dev, + memory_listener); + dev->mem_changed_end_addr =0 ; + dev->mem_changed_start_addr =-1 ; +} +static void vhost_commit (MemoryListener *listener) +{ + struct vhost_dev *dev = container_of(listener, struct vhost_dev, + memory_listener); +hwaddr start_addr =0 ; +ram_addr_t size =0 ; +uint64_t log_size; +int r; + +if (!dev->memory_changed) { +return ; + }if (!dev->started) {return ; } +if (dev->mem_changed_start_addr > dev->mem_changed_end_addr) { +return ; + }if (dev->started) { + start_addr = dev->mem_changed_start_addr; + size = dev->mem_changed_end_addr - dev->mem_changed_start_addr +1 ; + r =vhost_verify_ring_mappings (dev, start_addr, size);assert (r >=0 ); }
@@ -429,6 +462,7 @@ static void vhost_set_memory(MemoryListener *listener,if (!dev->log_enabled) { r =ioctl (dev->control,VHOST_SET_MEM_TABLE , dev->mem);assert (r >=0 ); + dev->memory_changed = false;return ; } log_size =vhost_get_log_size (dev);
@@ -445,19 +479,7 @@ static void vhost_set_memory(MemoryListener *listener,if (dev->log_size > log_size +VHOST_LOG_BUFFER ) {vhost_dev_log_resize (dev, log_size); } -} - -static bool vhost_section (MemoryRegionSection *section) -{ -return memory_region_is_ram (section->mr); -} - -static void vhost_begin (MemoryListener *listener) -{ -} - -static void vhost_commit (MemoryListener *listener) -{ + dev->memory_changed = false; } static void vhost_region_add(MemoryListener *listener,
@@ -842,6 +864,7 @@ int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath, hdev->log_size =0 ; hdev->log_enabled = false; hdev->started = false; + hdev->memory_changed = false;memory_listener_register (&hdev->memory_listener, &address_space_memory); hdev->force = force;return 0 ;
include/hw/virtio/vhost.h +3 -0
@@ -45,6 +45,9 @@ struct vhost_dev {vhost_log_chunk_t *log;unsigned long long log_size;bool force; +bool memory_changed; +hwaddr mem_changed_start_addr; +hwaddr mem_changed_end_addr; }; int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath,
Signature · 1 line
1.8.1.4
PATCH 4/9 virtio-scsi: create VirtIOSCSICommon
In reply to Paolo BonziniThis patch refactors existing virtio-scsi code into VirtIOSCSICommon in order to allow virtio_scsi_init_common() to be used by both internal virtio_scsi_init() and external vhost-scsi-pci code.
--- hw/s390x/s390-virtio-bus.c | 2 +- hw/s390x/virtio-ccw.c | 2 +- hw/scsi/virtio-scsi.c | 212 ++++++++++++++-------------------------- hw/virtio/virtio-pci.c | 5 +- include/hw/virtio/virtio-scsi.h | 133 ++++++++++++++++++++++++- include/qemu/osdep.h | 4 + 6 files changed, 210 insertions(+), 148 deletions(-)
hw/s390x/s390-virtio-bus.c +1 -1
@@ -560,7 +560,7 @@ static const TypeInfo virtio_s390_device_info = { };static Property s390_virtio_scsi_properties[] = { -DEFINE_VIRTIO_SCSI_PROPERTIES (VirtIOSCSIS390, vdev.conf), +DEFINE_VIRTIO_SCSI_PROPERTIES (VirtIOSCSIS390, vdev.parent_obj.conf),DEFINE_VIRTIO_SCSI_FEATURES (VirtIOS390Device, host_features),DEFINE_PROP_END_OF_LIST (), };
hw/s390x/virtio-ccw.c +1 -1
@@ -873,7 +873,7 @@ static const TypeInfo virtio_ccw_balloon = {static Property virtio_ccw_scsi_properties[] = {DEFINE_PROP_STRING ("devno" , VirtioCcwDevice, bus_id), -DEFINE_VIRTIO_SCSI_PROPERTIES (VirtIOSCSICcw, vdev.conf), +DEFINE_VIRTIO_SCSI_PROPERTIES (VirtIOSCSICcw, vdev.parent_obj.conf),DEFINE_VIRTIO_SCSI_FEATURES (VirtioCcwDevice, host_features[0 ]),DEFINE_PROP_END_OF_LIST (), };
hw/scsi/virtio-scsi.c +72 -140
343 lines not on this page · raw message
hw/virtio/virtio-pci.c +3 -2
@@ -1236,7 +1236,7 @@ static Property virtio_scsi_pci_properties[] = {DEFINE_PROP_UINT32 ("vectors" , VirtIOPCIProxy, nvectors,DEV_NVECTORS_UNSPECIFIED ),DEFINE_VIRTIO_SCSI_FEATURES (VirtIOPCIProxy, host_features), -DEFINE_VIRTIO_SCSI_PROPERTIES (VirtIOSCSIPCI, vdev.conf), +DEFINE_VIRTIO_SCSI_PROPERTIES (VirtIOSCSIPCI, vdev.parent_obj.conf), DEFINE_PROP_END_OF_LIST(), };
@@ -1244,9 +1244,10 @@ static int virtio_scsi_pci_init_pci(VirtIOPCIProxy *vpci_dev) {VirtIOSCSIPCI *dev =VIRTIO_SCSI_PCI (vpci_dev);DeviceState *vdev =DEVICE (&dev->vdev); +VirtIOSCSICommon *vs =VIRTIO_SCSI_COMMON (vdev);if (vpci_dev->nvectors ==DEV_NVECTORS_UNSPECIFIED ) { - vpci_dev->nvectors = dev->vdev.conf.num_queues +3 ; + vpci_dev->nvectors = vs->conf.num_queues +3 ; }qdev_set_parent_bus (vdev,BUS (&vpci_dev->bus));
include/hw/virtio/virtio-scsi.h +129 -4
163 lines not on this page · raw message
include/qemu/osdep.h +4 -0
@@ -67,6 +67,10 @@ typedef signed int int_fast16_t;#define MAX (a, b) (((a) > (b)) ? (a) : (b))#endif +#ifndef ROUND_UP +#define ROUND_UP (n,d) (((n) + (d) - 1) & -(d)) +#endif +#ifndef DIV_ROUND_UP #define DIV_ROUND_UP (n,d) (((n) + (d) - 1) / (d))#endif
Signature · 1 line
1.8.1.4
PATCH 5/9 virtio: simplify Makefile conditionals
In reply to Paolo Bonzini--- hw/Makefile.objs | 2 +- hw/virtio/Makefile.objs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
hw/Makefile.objs +1 -1
@@ -24,7 +24,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += ssi/ devices-dirs-$(CONFIG_SOFTMMU) += timer/ devices-dirs-$(CONFIG_TPM) += tpm/ devices-dirs-$(CONFIG_SOFTMMU) += usb/ -devices-dirs-$(CONFIG_SOFTMMU) += virtio/ +devices-dirs-$(CONFIG_VIRTIO) += virtio/ devices-dirs-$(CONFIG_SOFTMMU) += watchdog/ devices-dirs-$(CONFIG_SOFTMMU) += xen/ devices-dirs-y += core/
hw/virtio/Makefile.objs +4 -4
@@ -1,7 +1,7 @@ -common-obj-$(CONFIG_VIRTIO) += virtio-rng.o +common-obj-y += virtio-rng.o common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o -common-obj-$(CONFIG_VIRTIO) += virtio-bus.o +common-obj-y += virtio-bus.o common-obj-$(CONFIG_VIRTIO_BLK_DATA_PLANE) += dataplane/ -obj-$(CONFIG_VIRTIO) += virtio.o virtio-balloon.o -obj-$(CONFIG_VHOST_NET) += vhost.o +obj-y += virtio.o virtio-balloon.o +obj-$(CONFIG_LINUX) += vhost.o
Signature · 1 line
1.8.1.4
PATCH 6/9 vhost-scsi: new device supporting the tcm_vhost Linux kernel module
In reply to Paolo BonziniFrom: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci". The tgpt field of the SET_ENDPOINT ioctl is obsolete now, so it is not available from the QEMU command-line. Instead, I hardcode it to zero.
Changes in Patch-v2:
- Add vhost_scsi_get_features() in order to determine feature bits supports by host kernel (mst + nab)
- Re-enable usage of DEFINE_VIRTIO_COMMON_FEATURES, and allow EVENT_IDX to be disabled by host in vhost_scsi_get_features()
- Drop unused hotplug bit in DEFINE_VHOST_SCSI_PROPERTIES
Changes in Patch-v1:
- Set event_idx=off by default (nab, thanks asias)
- Disable hotplug feature bit for v3.9 tcm_vhost kernel code, need to
re-enable in v3.10 (nab)
- Update to latest qemu.git/master HEAD
Changes in WIP-V3:
- Drop ioeventfd vhost_scsi_properties (asias, thanks stefanha)
- Add CONFIG_VHOST_SCSI (asias, thanks stefanha)
- Add hotplug feature bit
Changes in WIP-V2:
- Add backend guest masking support (nab)
- Bump ABI_VERSION to 1 (nab)
- Set up set_guest_notifiers (asias)
- Set up vs->dev.vq_index (asias)
- Drop vs->vs.vdev.{set,clear}_vhost_endpoint (asias)
- Drop VIRTIO_CONFIG_S_DRIVER check in vhost_scsi_set_status (asias)
Howto:
Use the latest seabios, at least commit b44a7be17b git clone git://git.seabios.org/seabios.git
make
cp out/bios.bin /usr/share/qemu/bios.bin qemu -device vhost-scsi-pci,wwpn=naa.6001405bd4e8476d
...
[ Rebase on top of VirtIOSCSICommon patch, fix bugs in feature
negotiation and irqfd masking - Paolo ]
--- configure | 10 ++ hw/scsi/Makefile.objs | 6 +- hw/scsi/vhost-scsi.c | 288 ++++++++++++++++++++++++++++++++++++++++ include/hw/virtio/vhost-scsi.h | 73 ++++++++++ include/hw/virtio/virtio-scsi.h | 2 + 5 files changed, 378 insertions(+), 1 deletion(-) create mode 100644 hw/scsi/vhost-scsi.c create mode 100644 include/hw/virtio/vhost-scsi.h
configure +10 -0
@@ -179,6 +179,7 @@ libattr="" xfs="" vhost_net="no" +vhost_scsi="no" kvm="no" gprof="no" debug_tcg="no"
@@ -543,6 +544,7 @@ Haiku) usb="linux" kvm="yes" vhost_net="yes" + vhost_scsi="yes" if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then audio_possible_drivers="$audio_possible_drivers fmod" fi
@@ -870,6 +872,10 @@ for opt do ;; --enable-vhost-net) vhost_net="yes" ;; + --disable-vhost-scsi) vhost_scsi="no" + ;; + --enable-vhost-scsi) vhost_scsi="yes" + ;; --disable-glx) glx="no" ;; --enable-glx) glx="yes"
@@ -3553,6 +3559,7 @@ echo "sigev_thread_id $sigev_thread_id" echo "uuid support $uuid" echo "libcap-ng support $cap_ng" echo "vhost-net support $vhost_net" +echo "vhost-scsi support $vhost_scsi" echo "Trace backend $trace_backend" echo "Trace output file $trace_file-<pid>" echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
@@ -3836,6 +3843,9 @@ fi if test "$virtfs" = "yes" ; then echo "CONFIG_VIRTFS=y" >> $config_host_mak fi +if test "$vhost_scsi" = "yes" ; then + echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak +fi if test "$blobs" = "yes" ; then echo "INSTALL_BLOBS=yes" >> $config_host_mak fi
hw/scsi/Makefile.objs +5 -1
@@ -6,4 +6,8 @@ common-obj-$(CONFIG_VMW_PVSCSI_SCSI_PCI) += vmw_pvscsi.o common-obj-$(CONFIG_ESP) += esp.o common-obj-$(CONFIG_ESP_PCI) += esp-pci.o obj-$(CONFIG_PSERIES) += spapr_vscsi.o -obj-$(CONFIG_VIRTIO) += virtio-scsi.o + +ifeq ($(CONFIG_VIRTIO),y) +obj-y += virtio-scsi.o +obj-$(CONFIG_VHOST_SCSI) += vhost-scsi.o +endif
hw/scsi/vhost-scsi.c new file +288 -0
288 lines not on this page · raw message
include/hw/virtio/vhost-scsi.h new file +73 -0
73 lines not on this page · raw message
include/hw/virtio/virtio-scsi.h +2 -0
@@ -151,6 +151,8 @@ struct VirtIOSCSIConf {uint32_t num_queues;uint32_t max_sectors;uint32_t cmd_per_lun; +char *vhostfd; +char *wwpn; }; typedef struct VirtIOSCSICommon {
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 6 lines · Paolo Bonzini
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci". The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not available from the QEMU command-line. Instead, I hardcode it to zero.
Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?
Quoted 500 lines
Changes in Patch-v2:
- Addvhost_scsi_get_features()in order to determine feature bits supports by host kernel (mst + nab)
- Re-enable usage ofDEFINE_VIRTIO_COMMON_FEATURES, and allowEVENT_IDXto be disabled by host invhost_scsi_get_features()
- Drop unused hotplug bit inDEFINE_VHOST_SCSI_PROPERTIESChanges in Patch-v1:
- Set event_idx=off by default (nab, thanks asias)
- Disable hotplug feature bit for v3.9tcm_vhostkernel code, need to re-enable in v3.10 (nab)
- Update to latest qemu.git/master HEADChanges in WIP-V3:
- Drop ioeventfdvhost_scsi_properties(asias, thanks stefanha)
- AddCONFIG_VHOST_SCSI(asias, thanks stefanha)
- Add hotplug feature bitChanges in WIP-V2:
- Add backend guest masking support (nab)
- BumpABI_VERSIONto 1 (nab)
- Set upset_guest_notifiers(asias)
- Set upvs->dev.vq_index(asias)
- Drop vs->vs.vdev.{set,clear}_vhost_endpoint (asias)
- DropVIRTIO_CONFIG_S_DRIVERcheck invhost_scsi_set_status(asias)Howto:
Use the latest seabios, at least commitb44a7be17bgit clonegit://git.seabios.org/seabios.git
make
cp out/bios.bin/usr/share/qemu/bios.binqemu -device vhost-scsi-pci,wwpn=naa.6001405bd4e8476d
...Cc Michael S. Tsirkin <[email protected]>Signed-off-by Nicholas Bellinger <[email protected]>Signed-off-by Asias He <[email protected]>[ Rebase on top of VirtIOSCSICommon patch, fix bugs in feature
negotiation and irqfd masking - Paolo ]Signed-off-by Paolo Bonzini <[email protected]>--- configure | 10 ++ hw/scsi/Makefile.objs | 6 +- hw/scsi/vhost-scsi.c | 288 ++++++++++++++++++++++++++++++++++++++++ include/hw/virtio/vhost-scsi.h | 73 ++++++++++ include/hw/virtio/virtio-scsi.h | 2 + 5 files changed, 378 insertions(+), 1 deletion(-)create mode 100644
hw/scsi/vhost-scsi.ccreate mode 100644include/hw/virtio/vhost-scsi.hconfigure +10
-0@@ -179,6 +179,7 @@ libattr="" xfs="" vhost_net="no" +vhost_scsi="no" kvm="no" gprof="no" debug_tcg="no"@@ -543,6 +544,7 @@ Haiku) usb="linux" kvm="yes" vhost_net="yes" + vhost_scsi="yes" if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then audio_possible_drivers="$audio_possible_drivers fmod" fi@@ -870,6 +872,10 @@ for opt do ;; --enable-vhost-net) vhost_net="yes" ;; + --disable-vhost-scsi) vhost_scsi="no" + ;; + --enable-vhost-scsi) vhost_scsi="yes" + ;; --disable-glx) glx="no" ;; --enable-glx) glx="yes"@@ -3553,6 +3559,7 @@ echo "sigev_thread_id $sigev_thread_id" echo "uuid support $uuid" echo "libcap-ng support $cap_ng" echo "vhost-net support $vhost_net" +echo "vhost-scsi support $vhost_scsi" echo "Trace backend $trace_backend" echo "Trace output file $trace_file-<pid>" echo "spice support $spice ($spice_protocol_version/$spice_server_version)"@@ -3836,6 +3843,9 @@ fi if test "$virtfs" = "yes" ; then echo "CONFIG_VIRTFS=y" >> $config_host_mak fi +if test "$vhost_scsi" = "yes" ; then + echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak +fi if test "$blobs" = "yes" ; then echo "INSTALL_BLOBS=yes" >> $config_host_mak fihw/scsi/Makefile.objs +5
-1@@ -6,4 +6,8 @@ common-obj-$(CONFIG_VMW_PVSCSI_SCSI_PCI) += vmw_pvscsi.o common-obj-$(CONFIG_ESP) += esp.o common-obj-$(CONFIG_ESP_PCI) += esp-pci.o obj-$(CONFIG_PSERIES) += spapr_vscsi.o -obj-$(CONFIG_VIRTIO) += virtio-scsi.o + +ifeq ($(CONFIG_VIRTIO),y) +obj-y += virtio-scsi.o +obj-$(CONFIG_VHOST_SCSI) += vhost-scsi.o +endifhw/scsi/vhost-scsi.c new file +288
-0@@ -0,0 +1,288 @@ +/* +* vhost_scsi host device +* +* Copyright IBM, Corp. 2011 +* +* Authors: +* Stefan Hajnoczi <[email protected]> +* +* Changes for QEMU mainline + tcm_vhost kernel upstream: +* Nicholas Bellinger <[email protected]> +* +* This work is licensed under the terms of the GNU LGPL, version 2 or later. +* See the COPYING.LIB file in the top-level directory. +* +*/ + +#include <sys/ioctl.h> +#include "config.h" +#include "qemu/queue.h" +#include "monitor/monitor.h" +#include "migration/migration.h" +#include "hw/virtio/vhost-scsi.h" +#include "hw/virtio/vhost.h" +#include "hw/virtio/virtio-scsi.h" + +static int vhost_scsi_set_endpoint (VHostSCSI *s) +{ +VirtIOSCSICommon *vs =VIRTIO_SCSI_COMMON (s); +struct vhost_scsi_target backend; +int ret; + +memset (&backend,0 ,sizeof (backend)); +pstrcpy (backend.vhost_wwpn,sizeof (backend.vhost_wwpn), vs->conf.wwpn); + ret =ioctl (s->dev.control,VHOST_SCSI_SET_ENDPOINT , &backend); +if (ret <0 ) { +return -errno; + } +return 0 ; +} + +static void vhost_scsi_clear_endpoint (VHostSCSI *s) +{ +VirtIOSCSICommon *vs =VIRTIO_SCSI_COMMON (s); +struct vhost_scsi_target backend; + +memset (&backend,0 ,sizeof (backend)); +pstrcpy (backend.vhost_wwpn,sizeof (backend.vhost_wwpn), vs->conf.wwpn); +ioctl (s->dev.control,VHOST_SCSI_CLEAR_ENDPOINT , &backend); +} + +static int vhost_scsi_start (VHostSCSI *s) +{ +int ret, abi_version, i; +VirtIODevice *vdev =VIRTIO_DEVICE (s); + +if (!vdev->binding->set_guest_notifiers) { +error_report ("binding does not support guest notifiers" ); +return -ENOSYS ; + } + + ret =ioctl (s->dev.control,VHOST_SCSI_GET_ABI_VERSION , &abi_version); +if (ret <0 ) { +return -errno; + } +if (abi_version >VHOST_SCSI_ABI_VERSION ) { +error_report ("vhost-scsi: The running tcm_vhost kernel abi_version:" +" %d is greater than vhost_scsi userspace supports: %d, please" +" upgrade your version of QEMU\n" , abi_version, +VHOST_SCSI_ABI_VERSION ); +return -ENOSYS ; + } + + ret =vhost_dev_enable_notifiers (&s->dev, vdev); +if (ret <0 ) { +return ret; + } + + s->dev.acked_features = vdev->guest_features; + ret =vhost_dev_start (&s->dev, vdev); +if (ret <0 ) { +error_report ("Error start vhost dev" ); + goto err_notifiers; + } + + ret =vhost_scsi_set_endpoint (s); +if (ret <0 ) { +error_report ("Error set vhost-scsi endpoint" ); + goto err_vhost_stop; + } + + ret = vdev->binding->set_guest_notifiers (vdev->binding_opaque, s->dev.nvqs, true); +if (ret <0 ) { +error_report ("Error binding guest notifier" ); + goto err_endpoint; + } + +/* guest_notifier_mask/pending not used yet, so just unmask +* everything here. virtio-pci will do the right thing by +* enabling/disabling irqfd. +*/ +for (i =0 ; i < s->dev.nvqs; i++) { +vhost_virtqueue_mask (&s->dev, vdev, i, false); + } + +return ret; + +err_endpoint: +vhost_scsi_clear_endpoint (s); +err_vhost_stop: +vhost_dev_stop (&s->dev, vdev); +err_notifiers: +vhost_dev_disable_notifiers (&s->dev, vdev); +return ret; +} + +static void vhost_scsi_stop (VHostSCSI *s) +{ +VirtIODevice *vdev =VIRTIO_DEVICE (s); +int ret =0 ; + +if (!vdev->binding->set_guest_notifiers) { + ret = vdev->binding->set_guest_notifiers (vdev->binding_opaque, + s->dev.nvqs, false); +if (ret <0 ) { +error_report ("vhost guest notifier cleanup failed: %d\n" , ret); + } + } +assert (ret >=0 ); + +vhost_scsi_clear_endpoint (s); +vhost_dev_stop (&s->dev, vdev); +vhost_dev_disable_notifiers (&s->dev, vdev); +} + +static uint32_t vhost_scsi_get_features (VirtIODevice *vdev, +uint32_t features) +{ +VHostSCSI *s =VHOST_SCSI (vdev); + +/* Clear features not supported by host kernel. */ +if (!(s->dev.features & (1 <<VIRTIO_F_NOTIFY_ON_EMPTY ))) { + features &= ~(1 <<VIRTIO_F_NOTIFY_ON_EMPTY ); + } +if (!(s->dev.features & (1 <<VIRTIO_RING_F_INDIRECT_DESC ))) { + features &= ~(1 <<VIRTIO_RING_F_INDIRECT_DESC ); + } +if (!(s->dev.features & (1 <<VIRTIO_RING_F_EVENT_IDX ))) { + features &= ~(1 <<VIRTIO_RING_F_EVENT_IDX ); + } +if (!(s->dev.features & (1 <<VIRTIO_SCSI_F_HOTPLUG ))) { + features &= ~(1 <<VIRTIO_SCSI_F_HOTPLUG ); + } + +return features; +} + +static void vhost_scsi_set_config (VirtIODevice *vdev, +const uint8_t *config) +{ +VirtIOSCSIConfig *scsiconf = (VirtIOSCSIConfig *)config; +VirtIOSCSICommon *vs =VIRTIO_SCSI_COMMON (vdev); + +if ((uint32_t )ldl_raw (&scsiconf->sense_size) != vs->sense_size || + (uint32_t )ldl_raw (&scsiconf->cdb_size) != vs->cdb_size) { +error_report ("vhost-scsi does not support changing the sense data and CDB sizes" ); +exit (1 ); + } +} + +static void vhost_scsi_set_status (VirtIODevice *vdev,uint8_t val) +{ +VHostSCSI *s = (VHostSCSI *)vdev; +bool start = (val &VIRTIO_CONFIG_S_DRIVER_OK ); + +if (s->dev.started == start) { +return ; + } + +if (start) { +int ret; + + ret =vhost_scsi_start (s); +if (ret <0 ) { +error_report ("virtio-scsi: unable to start vhost: %s\n" , +strerror (-ret)); + +/* There is no userspace virtio-scsi fallback so exit */ +exit (1 ); + } + }else { +vhost_scsi_stop (s); + } +} + +static int vhost_scsi_init (VirtIODevice *vdev) +{ +VirtIOSCSICommon *vs =VIRTIO_SCSI_COMMON (vdev); +VHostSCSI *s =VHOST_SCSI (vdev); +int vhostfd =-1 ; +int ret; + +if (!vs->conf.wwpn) { +error_report ("vhost-scsi: missing wwpn\n" ); +return -EINVAL ; + } + +if (vs->conf.vhostfd) { + vhostfd =monitor_handle_fd_param (cur_mon, vs->conf.vhostfd); +if (vhostfd ==-1 ) { +error_report ("vhost-scsi: unable to parse vhostfd\n" ); +return -EINVAL ; + } + } + + ret =virtio_scsi_common_init (vs); +if (ret <0 ) { +return ret; + } + + vdev->get_features = vhost_scsi_get_features; + vdev->set_config = vhost_scsi_set_config; + vdev->set_status = vhost_scsi_set_status; + + s->dev.nvqs =VHOST_SCSI_VQ_NUM_FIXED + vs->conf.num_queues; + s->dev.vqs = g_new(struct vhost_virtqueue, s->dev.nvqs); + s->dev.vq_index =0 ; + + ret =vhost_dev_init (&s->dev, vhostfd,"/dev/vhost-scsi" , true); +if (ret <0 ) { +error_report ("vhost-scsi: vhost initialization failed: %s\n" , +strerror (-ret)); +return ret; + } + s->dev.backend_features =0 ; + +error_setg (&s->migration_blocker, +"vhost-scsi does not support migration" ); +migrate_add_blocker (s->migration_blocker); + +return 0 ; +} + +static int vhost_scsi_exit (DeviceState *qdev) +{ +VirtIODevice *vdev =VIRTIO_DEVICE (qdev); +VHostSCSI *s =VHOST_SCSI (qdev); +VirtIOSCSICommon *vs =VIRTIO_SCSI_COMMON (qdev); + +migrate_del_blocker (s->migration_blocker); +error_free (s->migration_blocker); + +/* This will stop vhost backend. */ +vhost_scsi_set_status (vdev,0 ); + +g_free (s->dev.vqs); +return virtio_scsi_common_exit (vs); +} + +static Property vhost_scsi_properties[] = { +DEFINE_VHOST_SCSI_PROPERTIES (VHostSCSI, parent_obj.conf), +DEFINE_PROP_END_OF_LIST (), +}; + +static void vhost_scsi_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +VirtioDeviceClass *vdc =VIRTIO_DEVICE_CLASS (klass); + dc->exit = vhost_scsi_exit; + dc->props = vhost_scsi_properties; + vdc->init = vhost_scsi_init; + vdc->get_features = vhost_scsi_get_features; + vdc->set_config = vhost_scsi_set_config; + vdc->set_status = vhost_scsi_set_status; +} + +static const TypeInfo vhost_scsi_info = { + .name =TYPE_VHOST_SCSI , + .parent =TYPE_VIRTIO_SCSI_COMMON , + .instance_size =sizeof (VHostSCSI), + .class_init = vhost_scsi_class_init, +}; + +static void virtio_register_types (void ) +{ +type_register_static (&vhost_scsi_info); +} + +type_init (virtio_register_types)include/hw/virtio/vhost-scsi.h new file +73
-0@@ -0,0 +1,73 @@ +/* +* vhost_scsi host device +* +* Copyright IBM, Corp. 2011 +* +* Authors: +* Stefan Hajnoczi <[email protected]> +* +* This work is licensed under the terms of the GNU LGPL, version 2 or later. +* See the COPYING.LIB file in the top-level directory. +* +*/ + +#ifndef VHOST_SCSI_H +#define VHOST_SCSI_H + +#include "qemu-common.h" +#include "hw/qdev.h" +#include "hw/virtio/virtio-scsi.h" +#include "hw/virtio/vhost.h" + +/* +* Used by QEMU userspace to ensure a consistent vhost-scsi ABI. +* +* ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate + +* RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage +* ABI Rev 1: January 2013. Ignore vhost_tpgt filed in struct vhost_scsi_target. +* All the targets under vhost_wwpn can be seen and used by guest. +*/ + +#define VHOST_SCSI_ABI_VERSION 1 + +/* TODO #include <linux/vhost.h> properly */ +/* For VHOST_SCSI_SET_ENDPOINT/VHOST_SCSI_CLEAR_ENDPOINT ioctl */ +struct vhost_scsi_target { +int abi_version; +char vhost_wwpn[224 ]; +unsigned short vhost_tpgt; +unsigned short reserved; +}; + +enum vhost_scsi_vq_list { +VHOST_SCSI_VQ_CONTROL =0 , +VHOST_SCSI_VQ_EVENT =1 , +VHOST_SCSI_VQ_NUM_FIXED =2 , +}; + +#define VHOST_VIRTIO 0xAF +#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target) +#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target) +#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int) + +#define TYPE_VHOST_SCSI "vhost-scsi" +#define VHOST_SCSI (obj) \ + OBJECT_CHECK(VHostSCSI, (obj), TYPE_VHOST_SCSI) + +typedef struct VHostSCSI { +VirtIOSCSICommon parent_obj; + +Error *migration_blocker; + +struct vhost_dev dev; +}VHostSCSI ; + +#define DEFINE_VHOST_SCSI_PROPERTIES (_state, _conf_field) \ + DEFINE_PROP_STRING("vhostfd", _state, _conf_field.vhostfd), \ + DEFINE_PROP_STRING("wwpn", _state, _conf_field.wwpn), \ + DEFINE_PROP_UINT32("num_queues", _state, _conf_field.num_queues, 1), \ + DEFINE_PROP_UINT32("max_sectors", _state, _conf_field.max_sectors, 0xFFFF), \ + DEFINE_PROP_UINT32("cmd_per_lun", _state, _conf_field.cmd_per_lun, 128) + + +#endif include/hw/virtio/virtio-scsi.h +2
-0@@ -151,6 +151,8 @@ struct VirtIOSCSIConf {uint32_t num_queues;uint32_t max_sectors;uint32_t cmd_per_lun; +char *vhostfd; +char *wwpn; }; typedef struct VirtIOSCSICommon {
Signature · 3 lines
Best Regards Wenchao Xia
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Il 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci". The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not available from the QEMU command-line. Instead, I hardcode it to zero.Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?
Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd /sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > core/fileio_0/fileio/control echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port
echo naa.60014053226f0388 > nexus
The "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 23 lines · Paolo Bonzini
Il 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci". The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not available from the QEMU command-line. Instead, I hardcode it to zero.Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > core/fileio_0/fileio/control echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port
echo naa.60014053226f0388 > nexus
Quoted 4 lines
The "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
For me, I always use targetcli utils instead of the sysfs interface. targetcli in F18 has vhost support now.
Signature · 1 line
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 24 lines · Asias He
Quoted 23 lines · Paolo Bonzini
Il 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci". The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not available from the QEMU command-line. Instead, I hardcode it to zero.Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > core/fileio_0/fileio/control echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port
echo naa.60014053226f0388 > nexus
Quoted 8 lines
Quoted 4 lines
The "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
For me, I always use targetcli utils instead of the sysfs interface. targetcli in F18 has vhost support now.
Thanks very much for above information, I'll try it for test.
Signature · 3 lines
Best Regards Wenchao Xia
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 31 lines · Wenchao Xia
Quoted 30 lines · Asias He
Quoted 29 lines · Paolo Bonzini
Il 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 11 lines
Quoted 8 lines
Quoted 8 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci". The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not
available from the QEMU command-line. Instead, I hardcode it to zero.Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port echo naa.60014053226f0388 > nexusThe "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Paolo
For me, I always use targetcli utils instead of the sysfs interface. targetcli in F18 has vhost support now.
Thanks very much for above information, I'll try it for test.
I have done a basic test of vhost-scsi, following is the result I'd
like to post, generally it seems fine:
Result:
fdisk/mkfs: fdisk can find it, mke2fs works fine.
mount: can mount it.
file I/O: dd 90M zero to a file in that disk succeed.
Issues:
1) in fdisk -l, sometime timeout with dmesg "end_request: I/O error,
dev fd0, sector 0", I guess it is caused by nested KVM that failed to kick host kernel?
2) in fdisk -l, it shows 512 bytes larger than the parameter I
specified in fd_dev_size parameter in configfs on host.(shows 104858112 bytes, see the invocation script below)
ENV:
nested KVM:
RH6.4
(Qemu Virtual CPU 1.5.50, Linux 3.10.0.rc3)
| (100M vhost-scsi hooked with file backend)
RH6.4
(Common KVM processer, Linux 3.10.0.rc3,
qemu-system-x86_64 1.5.50+, 6a4e17711442849bf2cc731ccddef5a2a2d92d29, seabios 1.7.2.2, e9725dd76d5d7212cb4a97fd18ff2599538955cf)
|
Fefora 18(Intel Xeon X5650, Linux version 3.8.11-200.fc18.x86_64,
QEMU emulator version 1.2.2)
Invocation details:
On RH6.4 host:
1 with root, execute following script to prepare configfs system:
FILEIO=fileio_1
IMAGE=/home/xiawenc/Work/qemu/test/test1.raw
SIZE=104857600
QEMU_WWPN=naa.600140554cf3a1fe
NEXUS=naa.60014053226f03f8
mkdir -p /sys/kernel/config/target/core/$FILEIO/fileio
echo "fd_dev_name=$IMAGE,fd_dev_size=$SIZE" > /sys/kernel/config/target/core/$FILEIO/fileio/control echo 1 > /sys/kernel/config/target/core/$FILEIO/fileio/enable
mkdir -p /sys/kernel/config/target/vhost/$QEMU_WWPN/tpgt_0/lun/lun_0
ln -sf /sys/kernel/config/target/core/$FILEIO/fileio/ /sys/kernel/config/target/vhost/$QEMU_WWPN/tpgt_0/lun/lun_0/virtual_scsi_port echo $NEXUS > /sys/kernel/config/target/vhost/$QEMU_WWPN/tpgt_0/nexus
2 invoke qemu, test_guest_RH64.qcow2 is a pre-made disk containing
RH6.4 system:
x86_64-softmmu/qemu-system-x86_64 --enablem 1024 -drive file=/mnt/nfs/test_guest_RH64.qcow2,if=ide,cache=writethrough -vnc 0.0.0.0:10 -L mybios/ -device vhost-scsi-pci,wwpn=naa.600140554cf3a1fe,event_idx=off
Signature · 3 lines
Best Regards Wenchao Xia
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 47 lines · Wenchao Xia
Quoted 31 lines · Wenchao Xia
Quoted 30 lines · Asias He
Quoted 29 lines · Paolo Bonzini
Il 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 11 lines
Quoted 8 lines
Quoted 8 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci". The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not
available from the QEMU command-line. Instead, I hardcode it to zero.Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port echo naa.60014053226f0388 > nexusThe "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Paolo
For me, I always use targetcli utils instead of the sysfs interface. targetcli in F18 has vhost support now.
Thanks very much for above information, I'll try it for test.
I have done a basic test of vhost-scsi, following is the result I'd
like to post, generally it seems fine:Result:
fdisk/mkfs: fdisk can find it, mke2fs works fine.
mount: can mount it.
file I/O: dd 90M zero to a file in that disk succeed.
Quoted 4 lines
Issues:
1) in fdisk -l, sometime timeout with dmesg "end_request: I/O error,
dev fd0, sector 0", I guess it is caused by nested KVM that failed to kick host kernel?
Did you run without nested KVM?
Quoted 3 lines
2) in fdisk -l, it shows 512 bytes larger than the parameter I
specified infd_dev_sizeparameter in configfs on host.(shows 104858112 bytes, see the invocation script below)
Does targetcli give you the correct size? Also, to narrow the issue down, you can try other backstores, e.g block or ramdisk.
Quoted 48 lines
ENV:
nested KVM:RH6.4(Qemu Virtual CPU 1.5.50, Linux 3.10.0.rc3)
| (100M vhost-scsi hooked with file backend)
RH6.4
(Common KVM processer, Linux 3.10.0.rc3,
qemu-system-x86_64 1.5.50+,6a4e17711442849bf2cc731ccddef5a2a2d92d29, seabios 1.7.2.2,e9725dd76d5d7212cb4a97fd18ff2599538955cf)| Fefora 18(Intel Xeon X5650, Linux version 3.8.11-200.fc18.x86_64,
QEMU emulator version 1.2.2)Invocation details:
On RH6.4 host:
1 with root, execute following script to prepare configfs system:FILEIO=fileio_1
IMAGE=/home/xiawenc/Work/qemu/test/test1.raw
SIZE=104857600
QEMU_WWPN=naa.600140554cf3a1fe
NEXUS=naa.60014053226f03f8mkdir -p
/sys/kernel/config/target/core/$FILEIO/fileioecho "fd_dev_name=$IMAGE,fd_dev_size=$SIZE" >/sys/kernel/config/target/core/$FILEIO/fileio/controlecho 1 >/sys/kernel/config/target/core/$FILEIO/fileio/enablemkdir -p
/sys/kernel/config/target/vhost/$QEMU_WWPN/tpgt_0/lun/lun_0
ln -sf/sys/kernel/config/target/core/$FILEIO/fileio//sys/kernel/config/target/vhost/$QEMU_WWPN/tpgt_0/lun/lun_0/virtual_scsi_portecho $NEXUS >/sys/kernel/config/target/vhost/$QEMU_WWPN/tpgt_0/nexus2 invoke qemu, test_guest_RH64.qcow2 is a pre-made disk containing
RH6.4 system:x86_64-softmmu/qemu-system-x86_64 --enablem 1024 -drive
file=/mnt/nfs/test_guest_RH64.qcow2,if=ide,cache=writethrough -vnc 0.0.0.0:10 -L mybios/ -device vhost-scsi-pci,wwpn=naa.600140554cf3a1fe,event_idx=offSignature · 3 lines
Best Regards Wenchao Xia
Signature · 1 line
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
In reply to Wenchao XiaQuoted 39 lines · Wenchao Xia
Quoted 31 lines · Wenchao Xia
Quoted 30 lines · Asias He
Quoted 29 lines · Paolo Bonzini
Il 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 11 lines
Quoted 8 lines
Quoted 8 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci". The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not
available from the QEMU command-line. Instead, I hardcode it to zero.Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port echo naa.60014053226f0388 > nexusThe "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Paolo
For me, I always use targetcli utils instead of the sysfs interface. targetcli in F18 has vhost support now.
Thanks very much for above information, I'll try it for test.
Quoted 7 lines
I have done a basic test of vhost-scsi, following is the result I'd
like to post, generally it seems fine:Result:
fdisk/mkfs: fdisk can find it, mke2fs works fine.
mount: can mount it.
file I/O: dd 90M zero to a file in that disk succeed.
I tried without nested kvm.
Quoted 5 lines
Issues:
1) in fdisk -l, sometime timeout with dmesg "end_request: I/O error,
dev fd0, sector 0", I guess it is caused by nested KVM that failed to kick host kernel?
I don't see this issue. Are you sure "fd0" is actually the scsi device ? what is "fd0" ?
Quoted 4 lines
2) in fdisk -l, it shows 512 bytes larger than the parameter I
specified infd_dev_sizeparameter in configfs on host.(shows 104858112 bytes, see the invocation script below)
I see the same. For some reason "fdisk -l" in the VM shows 512-bytes more than the actual size for the file (on the host).
Thanks,
Badari
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 64 lines · Badari Pulavarty
Quoted 41 lines · Wenchao Xia
Quoted 33 lines · Wenchao Xia
Quoted 32 lines · Asias He
Quoted 31 lines · Paolo Bonzini
Il 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci".
The tgpt field of theSET_ENDPOINTioctl is obsolete now, so it is not
available from the QEMU command-line. Instead, I hardcode it to zero.Quoted 3 lines
Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port
echo naa.60014053226f0388 > nexusThe "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Paolo
For me, I always use targetcli utils instead of the sysfs interface. targetcli in F18 has vhost support now.
Thanks very much for above information, I'll try it for test.
Quoted 7 lines
I have done a basic test of vhost-scsi, following is the result I'd
like to post, generally it seems fine:Result:
fdisk/mkfs: fdisk can find it, mke2fs works fine.
mount: can mount it.
file I/O: dd 90M zero to a file in that disk succeed.I tried without nested kvm.
Quoted 5 lines
Issues:
1) in fdisk -l, sometime timeout with dmesg "end_request: I/O error,
dev fd0, sector 0", I guess it is caused by nested KVM that failed to kick host kernel?I don't see this issue. Are you sure "fd0" is actually the scsi device ? what is "fd0" ?
Quoted 7 lines
Quoted 4 lines
2) in fdisk -l, it shows 512 bytes larger than the parameter I
specified infd_dev_sizeparameter in configfs on host.(shows 104858112 bytes, see the invocation script below)I see the same. For some reason "fdisk -l" in the VM shows 512-bytes more than the actual size for the file (on the host).
Hmm, interesting. Will look into it.
Nick, Any ideas here?
Quoted 3 lines
Thanks,
Badari
Signature · 1 line
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 3 lines · Asias He
Quoted 2 lines · Badari Pulavarty
Quoted 1 line · Wenchao Xia
于 2013-5-28 17:00, Wenchao Xia 写道:
<SNIP>
Quoted 27 lines
Quoted 27 lines
Quoted 7 lines
I have done a basic test of vhost-scsi, following is the result I'd
like to post, generally it seems fine:Result:
fdisk/mkfs: fdisk can find it, mke2fs works fine.
mount: can mount it.
file I/O: dd 90M zero to a file in that disk succeed.I tried without nested kvm.
Quoted 5 lines
Issues:
1) in fdisk -l, sometime timeout with dmesg "end_request: I/O error,
dev fd0, sector 0", I guess it is caused by nested KVM that failed to kick host kernel?I don't see this issue. Are you sure "fd0" is actually the scsi device ? what is "fd0" ?
Quoted 4 lines
2) in fdisk -l, it shows 512 bytes larger than the parameter I
specified infd_dev_sizeparameter in configfs on host.(shows 104858112 bytes, see the invocation script below)
Quoted 7 lines
Quoted 2 lines
I see the same. For some reason "fdisk -l" in the VM shows 512-bytes more than the actual size for the file (on the host).
Hmm, interesting. Will look into it.
Nick, Any ideas here?
Mmm, fd_get_blocks() is not returning the expected minus one logical blocks with a !S_ISBLK() setup.
This is happening for every other backend ->get_blocks() call already, and should be happening for the fd_dev_size case as well.
Applying the following to target-pending.git now.
drivers/target/target_core_file.c +3 -2
@@ -694,11 +694,12 @@ static sector_t fd_get_blocks(struct se_device *dev)* to handle underlying block_device resize operations. */ if (S_ISBLK (i->i_mode)) - dev_size = (i_size_read (i) - fd_dev->fd_block_size); + dev_size =i_size_read (i);else dev_size = fd_dev->fd_dev_size; -return div_u64 (dev_size, dev->dev_attrib.block_size); +return div_u64 (dev_size - fd_dev->fd_block_size, + dev->dev_attrib.block_size); }static struct sbc_ops fd_sbc_ops = {
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 42 lines · Nicholas A. Bellinger
Quoted 3 lines · Asias He
Quoted 2 lines · Badari Pulavarty
Quoted 1 line · Wenchao Xia
于 2013-5-28 17:00, Wenchao Xia 写道:
<SNIP>
Quoted 27 lines
Quoted 27 lines
Quoted 7 lines
I have done a basic test of vhost-scsi, following is the result I'd
like to post, generally it seems fine:Result:
fdisk/mkfs: fdisk can find it, mke2fs works fine.
mount: can mount it.
file I/O: dd 90M zero to a file in that disk succeed.I tried without nested kvm.
Quoted 5 lines
Issues:
1) in fdisk -l, sometime timeout with dmesg "end_request: I/O error,
dev fd0, sector 0", I guess it is caused by nested KVM that failed to kick host kernel?I don't see this issue. Are you sure "fd0" is actually the scsi device ? what is "fd0" ?
Quoted 4 lines
2) in fdisk -l, it shows 512 bytes larger than the parameter I
specified infd_dev_sizeparameter in configfs on host.(shows 104858112 bytes, see the invocation script below)Quoted 7 lines
Quoted 2 lines
I see the same. For some reason "fdisk -l" in the VM shows 512-bytes more than the actual size for the file (on the host).
Hmm, interesting. Will look into it.
Nick, Any ideas here?
Quoted 8 lines
Mmm,
fd_get_blocks()is not returning the expected minus one logical blocks with a !S_ISBLK() setup.This is happening for every other backend ->get_blocks() call already, and should be happening for the
fd_dev_sizecase as well.Applying the following to target-pending.git now.
Actually sorry, that last patch is not correct..
Here's a better one to properly set fd_dev->fd_block_size at configure time, and use dev_attrib.block_size in fd_get_blocks() to allow for user defined block_sizes.
Thanks,
--nab
commit 9e309f9307fe644dee8718980bfcb77de91ce38e
Author: Nicholas Bellinger <[email protected]> Date: Wed May 29 21:35:23 2013 -0700
target/file: Fix off-by-one READ_CAPACITY bug for !S_ISBLK export
This patch fixes a bug where FILEIO was incorrectly reporting the number of logical blocks (+ 1) when using non struct block_device export mode.
It changes fd_get_blocks() to follow all other backend ->get_blocks() cases, and reduces the calculated dev_size by one dev->dev_attrib.block_size number of bytes, and fixes the initial block_size assignment within fd_configure_device()
drivers/target/target_core_file.c +6 -5
@@ -153,6 +153,7 @@ static int fd_configure_device(struct se_device *dev)struct request_queue *q =bdev_get_queue (inode->i_bdev);unsigned long long dev_size; + fd_dev->fd_block_size =bdev_logical_block_size (inode->i_bdev);/* * Determine the number of bytes from i_size_read() minus * one (1) logical sector from underlying struct block_device
@@ -199,6 +200,7 @@ static int fd_configure_device(struct se_device *dev) goto fail; } + fd_dev->fd_block_size =FD_BLOCKSIZE ;/* * Limit UNMAP emulation to 8k Number of LBAs (NoLB) */
@@ -217,9 +219,7 @@ static int fd_configure_device(struct se_device *dev) dev->dev_attrib.max_write_same_len =0x1000 ; } - fd_dev->fd_block_size = dev->dev_attrib.hw_block_size; - - dev->dev_attrib.hw_block_size =FD_BLOCKSIZE ; + dev->dev_attrib.hw_block_size = fd_dev->fd_block_size; dev->dev_attrib.hw_max_sectors =FD_MAX_SECTORS ; dev->dev_attrib.hw_queue_depth =FD_MAX_DEVICE_QUEUE_DEPTH ;
@@ -694,11 +694,12 @@ static sector_t fd_get_blocks(struct se_device *dev)* to handle underlying block_device resize operations. */ if (S_ISBLK (i->i_mode)) - dev_size = (i_size_read (i) - fd_dev->fd_block_size); + dev_size =i_size_read (i);else dev_size = fd_dev->fd_dev_size; -return div_u64 (dev_size, dev->dev_attrib.block_size); +return div_u64 (dev_size - dev->dev_attrib.block_size, + dev->dev_attrib.block_size); }static struct sbc_ops fd_sbc_ops = {
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 110 lines · Nicholas A. Bellinger
Quoted 35 lines · Nicholas A. Bellinger
Quoted 3 lines · Asias He
Quoted 2 lines · Badari Pulavarty
Quoted 1 line · Wenchao Xia
于 2013-5-28 17:00, Wenchao Xia 写道:
<SNIP>
Quoted 23 lines
Quoted 23 lines
Quoted 7 lines
I have done a basic test of vhost-scsi, following is the result I'd
like to post, generally it seems fine:Result:
fdisk/mkfs: fdisk can find it, mke2fs works fine.
mount: can mount it.
file I/O: dd 90M zero to a file in that disk succeed.I tried without nested kvm.
Quoted 4 lines
Issues:
1) in fdisk -l, sometime timeout with dmesg "end_request: I/O error,
dev fd0, sector 0", I guess it is caused by nested KVM that failed to kick host kernel?I don't see this issue. Are you sure "fd0" is actually the scsi device ? what is "fd0" ?
Quoted 4 lines
2) in fdisk -l, it shows 512 bytes larger than the parameter I
specified infd_dev_sizeparameter in configfs on host.(shows 104858112 bytes, see the invocation script below)Quoted 6 lines
Quoted 2 lines
I see the same. For some reason "fdisk -l" in the VM shows 512-bytes more than the actual size for the file (on the host).
Hmm, interesting. Will look into it.
Nick, Any ideas here?
Quoted 8 lines
Mmm,
fd_get_blocks()is not returning the expected minus one logical blocks with a !S_ISBLK() setup.This is happening for every other backend ->get_blocks() call already, and should be happening for the
fd_dev_sizecase as well.Applying the following to target-pending.git now.
Actually sorry, that last patch is not correct..
Here's a better one to properly set
fd_dev->fd_block_sizeat configure time, and use dev_attrib.block_size infd_get_blocks()to allow for user definedblock_sizes.Thanks,
--nab
commit
9e309f9307fe644dee8718980bfcb77de91ce38eAuthor: Nicholas Bellinger <[email protected]> Date: Wed May 29 21:35:23 2013 -0700target/file: Fix off-by-one
READ_CAPACITYbug for !S_ISBLK exportThis patch fixes a bug where FILEIO was incorrectly reporting the number of logical blocks (+ 1) when using non struct
block_deviceexport mode.It changes
fd_get_blocks()to follow all other backend ->get_blocks() cases, and reduces the calculateddev_sizeby onedev->dev_attrib.block_sizenumber of bytes, and fixes the initialblock_sizeassignment withinfd_configure_device()Reported-by Wenchao Xia <[email protected]>Reported-by Badari Pulavarty <[email protected]>Signed-off-by Nicholas Bellinger <[email protected]>drivers/target/target_core_file.c +3
-4@@ -153,6 +153,7 @@ static int fd_configure_device(struct se_device *dev)struct request_queue *q =bdev_get_queue (inode->i_bdev);unsigned long long dev_size; + fd_dev->fd_block_size =bdev_logical_block_size (inode->i_bdev);/* * Determine the number of bytes from i_size_read() minus * one (1) logical sector from underlying struct block_device @@ -199,6 +200,7 @@ static int fd_configure_device(struct se_device *dev) goto fail; } + fd_dev->fd_block_size =FD_BLOCKSIZE ;/* * Limit UNMAP emulation to 8k Number of LBAs (NoLB) */ @@ -217,9 +219,7 @@ static int fd_configure_device(struct se_device *dev) dev->dev_attrib.max_write_same_len =0x1000 ; } - fd_dev->fd_block_size = dev->dev_attrib.hw_block_size; - - dev->dev_attrib.hw_block_size =FD_BLOCKSIZE ; + dev->dev_attrib.hw_block_size = fd_dev->fd_block_size; dev->dev_attrib.hw_max_sectors =FD_MAX_SECTORS ; dev->dev_attrib.hw_queue_depth =FD_MAX_DEVICE_QUEUE_DEPTH ;@@ -694,11 +694,12 @@ static sector_t fd_get_blocks(struct se_device *dev)* to handle underlying block_device resize operations. */ if (S_ISBLK (i->i_mode)) - dev_size = (i_size_read (i) - fd_dev->fd_block_size);
drivers/target/target_core_file.c static sector_t fd_get_blocks(struct se_device *dev) · line 705
Quoted 10 lines
drivers/target/target_core_file.c +3
-1+ dev_size =i_size_read (i); else dev_size = fd_dev->fd_dev_size; -return div_u64 (dev_size, dev->dev_attrib.block_size); +return div_u64 (dev_size - dev->dev_attrib.block_size, + dev->dev_attrib.block_size); }static struct sbc_ops fd_sbc_ops = {
Verified and it shows the correct value now.
Thanks,
Badari
[Qemu-devel] vhost-scsi and pscsi
In reply to Nicholas A. BellingerHi Nicholas,
I am trying to test vhost-scsi with pscsi lio. I am able to create a target and pass it to QEMU. I don't see any error from tcm_vhost or qemu. But the guest VM doesn't see any SCSI device.
What am I missing ? Here is how I am using pscsi target.
wwpn="naa.6001405bd4e8476e"
tpgt=/sys/kernel/config/target/vhost/$wwpn/tpgt_0
nexus=$tpgt/nexus
mkdir -p $tpgt
echo -n $wwpn > $nexus
n=0
lun=$tpgt/lun/lun_${n} data=/sys/kernel/config/target/core/pscsi_0/data_${n}
dsk=/dev/sdf
mkdir -p $lun
mkdir -p $data
echo -n ${dsk} > $data/udev_path
echo "scsi_host_id=1,scsi_channel_id=0,scsi_target_id=2,scsi_lun_id=0" > $data/control echo -n 1 > $data/enable
ln -s $data $lun
Thanks,
Badari
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
In reply to Badari PulavartyQuoted 55 lines · Badari Pulavarty
Quoted 41 lines · Wenchao Xia
Quoted 33 lines · Wenchao Xia
Quoted 32 lines · Asias He
Quoted 31 lines · Paolo Bonzini
Il 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci".
The tgpt field of theSET_ENDPOINTioctl is obsolete now, so it is not
available from the QEMU command-line. Instead, I hardcode it to zero.Quoted 3 lines
Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port
echo naa.60014053226f0388 > nexusThe "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Paolo
For me, I always use targetcli utils instead of the sysfs interface. targetcli in F18 has vhost support now.
Thanks very much for above information, I'll try it for test.
Quoted 7 lines
I have done a basic test of vhost-scsi, following is the result I'd
like to post, generally it seems fine:Result:
fdisk/mkfs: fdisk can find it, mke2fs works fine.
mount: can mount it.
file I/O: dd 90M zero to a file in that disk succeed.I tried without nested kvm.
Quoted 1 line
Quoted 9 lines
Quoted 4 lines
Issues:
1) in fdisk -l, sometime timeout with dmesg "end_request: I/O error,
dev fd0, sector 0", I guess it is caused by nested KVM that failed to kick host kernel?I don't see this issue. Are you sure "fd0" is actually the scsi device ? what is "fd0" ?
I am not sure, it just come out from dmesg when fdisk -l hung, and
following line is "sdb" which is the vhost-scsi device, and fdisk printing stopped before "sdb" for a few seconds, so I think it's it. it happened once after my partition operation.
My instinct opinion is it happens only in nested KVM when host
missed a kick, since following I/O can succeed. Sadly I have no bare-metal at hand to test as a comparation.
Quoted 11 lines
Quoted 4 lines
2) in fdisk -l, it shows 512 bytes larger than the parameter I
specified infd_dev_sizeparameter in configfs on host.(shows 104858112 bytes, see the invocation script below)I see the same. For some reason "fdisk -l" in the VM shows 512-bytes more than the actual size for the file (on the host).
Thanks,
Badari
Signature · 3 lines
Best Regards Wenchao Xia
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
In reply to Paolo BonziniHi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed.
Could you give me some advise to debug this problem ? I can provide more information if need.
Regards,
baiqing
Quoted 40 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected]; [email protected]; Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci". The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not available from the QEMU command-line. Instead, I hardcode it tozero.
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port echo naa.60014053226f0388 > nexusThe "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 4 lines · Libaiqing
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed.
Could you give me some advise to debug this problem ? I can provide more information if need.
Boot from vhost-scsi is supposed to work. The seabios you used should be fine which contains the fixes for vhost-scsi.
Instead of playing with the /sys/kernel/config/target directly, I really recommend using targetcli utils.
Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need upstream kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse
# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm done
In targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0
# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...
Hope this helps.
Quoted 44 lines
Regards,
baiqingQuoted 40 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected]; [email protected]; Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci". The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not available from the QEMU command-line. Instead, I hardcode it tozero.
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port echo naa.60014053226f0388 > nexusThe "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
Signature · 1 line
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 6 lines · Asias He
Quoted 4 lines · Libaiqing
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed.
Could you give me some advise to debug this problem ? I can provide more information if need.
Quoted 8 lines
Boot from vhost-scsi is supposed to work. The seabios you used should be fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, I really recommend using targetcli utils.Nab, I think we really should write some docs for people to use vhost-scsi.
A section in qemu-options.hx would be great, currently an example is
good enough to me.
Quoted 71 lines
This is how I install and use targetcli in RHEL6. Note you need upstream kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Hope this helps.
Quoted 44 lines
Regards,
baiqingQuoted 40 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected]; [email protected]; Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device vhost-scsi-pci". The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not available from the QEMU command-line. Instead, I hardcode it tozero.
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo 'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' > core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port echo naa.60014053226f0388 > nexusThe "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
Signature · 3 lines
Best Regards Wenchao Xia
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
In reply to Asias HeHi Asias,
Thanks for your config.
According to you config,I test booting from vhost device with upstream kernel and qemu,but failed.
1 installing guest from cdrom,ok.
2 booting vhost-scsi,guest fs error occurs.
3 using fileio backstores,the error is same..
4 rebooting guest,a log printed:
(qemu) hw/scsi/virtio-scsi.c:533:virtio_scsi_handle_event: Object 0x7fccae7f2c88 is not an instance of type virtio-scsi-device
5 using upstream seabios,core dumped.
Could you give me some advise to debug this problem ? I can provide more information if need.
The qemu cmd:
[root@fedora121 x86_64-softmmu]# ./qemu-system-x86_64 -enable-kvm -name fedora -M pc -m 1024 -smp 2 -drive file=/home/fedora18.iso,if=ide,media=cdrom -device vhost-scsi-pci,wwpn=naa.50014057133e25dc -monitor stdio -vga qxl -vnc :1
The vnc output:
Dracut-initqueue[189]:/dev/mapper/fedora-root:UNEXPECTED INCONSISTENCY;RUN FSCK MANUALLY. Dracut-initqueue[189]: Warning: e2fsck returned with 4 Dracut-initqueue[189]: Warning: ***An error occurred during the file system check.
The guest kernel log:
Kernel: virtio-pci 0000:00:04.0: irq 40 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 41 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 42 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 43 for MSI/MSI-X
Kernel: scsi2 : Virtio SCSI HBA
Kernel: scsi 2:0:1:0: Direct-Access LIO-ORG r0
Kernel: sd 2:0:1:0: Attached scsi generic sg1 type 0
Kernel: sd 2:0:1:0: [sda]1258912 512-byte logical .....
Kernel: sd 2:0:1:0: [sda]write protect is off
Kernel: sd 2:0:1:0: [sda]Mode sense :43 00 00 08
Kernel: sd 2:0:1:0: [sda]write cache: disabled, read .....
Kernel: sda sda1 sda2
Kernel: sd 2:0:1:0: [sda] Attached SCSI disk Dracut-initqueue[189]: Scanning devices sda2 for LVM Dracut-initqueue[189]: inactive '/dev/fedora/swap'... Dracut-initqueue[189]: inactive '/dev/fedora/root'...
The info of host:
[root@fedora121 x86_64-softmmu]# uname -a
Linux fedora121 3.10.0-rc6 #1 SMP Wed Jun 19 19:34:24 CST 2013 x86_64 x86_64 x86_64 GNU/Linux [root@fedora121 x86_64-softmmu]# lsmod |grep vhost_scsivhost_scsi 49456 5target_core_mod 282163 14 target_core_iblock,target_core_pscsi,iscsi_target_mod,target_core_file,vhost_scsi
[root@fedora121 x86_64-softmmu]# targetcli
targetcli shell version v2.1.fb26
Copyright 2011 by RisingTide Systems LLC and others.
For help on commands, type 'help'.
/> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 0]
| o- fileio ................................................................................................. [Storage Objects: 0]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 1]
| o- r0 ................................................................................................... [(6.0GiB) activated]
o- iscsi ............................................................................................................ [Targets: 0]
o- loopback ......................................................................................................... [Targets: 0]
o- vhost ............................................................................................................ [Targets: 1]
o- naa.50014057133e25dc .............................................................................................. [TPGs: 1]
o- tpg1 ............................................................................................... [naa.5001405a70ac3421]
o- acls .......................................................................................................... [ACLs: 0]
o- luns .......................................................................................................... [LUNs: 1]
o- lun0 ..................................................................................................... [ramdisk/r0]Regards,
baiqing
Quoted 100 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 9:34 AM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleQuoted 4 lines · Libaiqing
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed. Could you give me some advise to debug this problem ? I can providemore information if need.
Boot from vhost-scsi is supposed to work. The seabios you used should be fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, I really recommend using targetcli utils.Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need upstream kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Hope this helps.
Quoted 12 lines
Regards,
baiqingQuoted 9 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected]; [email protected]; Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supportingthe
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device
vhost-scsi-pci".
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not available from the QEMU command-line. Instead, I hardcode it tozero.
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Quoted 6 lines
Quoted 6 lines
Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' >
Quoted 7 lines
Quoted 7 lines
core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port echo naa.60014053226f0388 > nexusQuoted 5 lines
Quoted 4 lines
The "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
--
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 9 lines · Libaiqing
Hi Asias,
Thanks for your config.
According to you config,I test booting from vhost device with upstream kernel and qemu,but failed.1 installing guest from cdrom,ok.
2 booting vhost-scsi,guest fs error occurs.
3 using fileio backstores,the error is same..
4 rebooting guest,a log printed:
(qemu) hw/scsi/virtio-scsi.c:533:virtio_scsi_handle_event: Object0x7fccae7f2c88is not an instance of type virtio-scsi-device
Paolo, I remember you fixed a similar issue?
Quoted 3 lines
5 using upstream seabios,core dumped.
Could you give me some advise to debug this problem ? I can provide more information if need.
Can you show me qemu commit id you used? Can you verity that if using the host kernel for guest helps? Does booting directly (without the install and reboot process) work?
Quoted 156 lines
The qemu cmd:
[root@fedora121 x86_64-softmmu]# ./qemu-system-x86_64 -enable-kvm -name fedora -M pc -m 1024 -smp 2 -drive file=/home/fedora18.iso,if=ide,media=cdrom -device vhost-scsi-pci,wwpn=naa.50014057133e25dc -monitor stdio -vga qxl -vnc :1The vnc output:
Dracut-initqueue[189]:/dev/mapper/fedora-root:UNEXPECTED INCONSISTENCY;RUN FSCK MANUALLY. Dracut-initqueue[189]: Warning: e2fsck returned with 4 Dracut-initqueue[189]: Warning: ***An error occurred during the file system check.The guest kernel log:
Kernel: virtio-pci 0000:00:04.0: irq 40 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 41 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 42 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 43 for MSI/MSI-X
Kernel: scsi2 : Virtio SCSI HBA
Kernel: scsi 2:0:1:0: Direct-Access LIO-ORG r0
Kernel: sd 2:0:1:0: Attached scsi generic sg1 type 0
Kernel: sd 2:0:1:0: [sda]1258912 512-byte logical .....
Kernel: sd 2:0:1:0: [sda]write protect is off
Kernel: sd 2:0:1:0: [sda]Mode sense :43 00 00 08
Kernel: sd 2:0:1:0: [sda]write cache: disabled, read .....
Kernel: sda sda1 sda2
Kernel: sd 2:0:1:0: [sda] Attached SCSI disk Dracut-initqueue[189]: Scanning devices sda2 for LVM Dracut-initqueue[189]: inactive '/dev/fedora/swap'... Dracut-initqueue[189]: inactive '/dev/fedora/root'...The info of host:
[root@fedora121 x86_64-softmmu]# uname -a
Linux fedora121 3.10.0-rc6 #1 SMP Wed Jun 19 19:34:24 CST 2013x86_64x86_64x86_64GNU/Linux [root@fedora121 x86_64-softmmu]# lsmod |grepvhost_scsivhost_scsi49456 5target_core_mod282163 14 target_core_iblock,target_core_pscsi,iscsi_target_mod,target_core_file,vhost_scsi
[root@fedora121 x86_64-softmmu]# targetcli
targetcli shell version v2.1.fb26
Copyright 2011 by RisingTide Systems LLC and others.
For help on commands, type 'help'./> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]| o- block .................................................................................................. [Storage Objects: 0] | o- fileio ................................................................................................. [Storage Objects: 0] | o- pscsi .................................................................................................. [Storage Objects: 0] | o- ramdisk ................................................................................................ [Storage Objects: 1] | o- r0 ................................................................................................... [(6.0GiB) activated] o- iscsi ............................................................................................................ [Targets: 0] o- loopback ......................................................................................................... [Targets: 0] o- vhost ............................................................................................................ [Targets: 1] o- naa.50014057133e25dc .............................................................................................. [TPGs: 1] o- tpg1 ............................................................................................... [naa.5001405a70ac3421] o- acls .......................................................................................................... [ACLs: 0] o- luns .......................................................................................................... [LUNs: 1] o- lun0 ..................................................................................................... [ramdisk/r0]Regards,
baiqingQuoted 100 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 9:34 AM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleQuoted 4 lines · Libaiqing
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed. Could you give me some advise to debug this problem ? I can providemore information if need.
Boot from vhost-scsi is supposed to work. The seabios you used should be fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, I really recommend using targetcli utils.Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need upstream kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Hope this helps.
Quoted 12 lines
Regards,
baiqingQuoted 9 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected]; [email protected]; Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supportingthe
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device
vhost-scsi-pci".
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it is not available from the QEMU command-line. Instead, I hardcode it tozero.
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs, before
invoking qemu with the WWPN number?Quoted 6 lines
Quoted 6 lines
Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' >
Quoted 7 lines
Quoted 7 lines
core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port echo naa.60014053226f0388 > nexusQuoted 5 lines
Quoted 4 lines
The "nexus" value is the initiator WWN. naa.600140554cf3a18e is the target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
--
Asias
Signature · 1 line
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Hi Asias,
Quoted 24 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 5:39 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleQuoted 3 lines · Libaiqing
Hi Asias,
Thanks for your config.
According to you config,I test booting from vhost device withupstream kernel and qemu,but failed.
Quoted 6 lines
1 installing guest from cdrom,ok.
2 booting vhost-scsi,guest fs error occurs.
3 using fileio backstores,the error is same..
4 rebooting guest,a log printed:
(qemu) hw/scsi/virtio-scsi.c:533:virtio_scsi_handle_event: Object
0x7fccae7f2c88is not an instance of type virtio-scsi-devicePaolo, I remember you fixed a similar issue?
Quoted 8 lines
Quoted 3 lines
5 using upstream seabios,core dumped.
Could you give me some advise to debug this problem ? I can provide
more information if need.
Can you show me qemu commit id you used? Can you verity that if using the host kernel for guest helps? Does booting directly (without the install and reboot process) work?
Qemu commit id is "commit 4eda32f588086b6cd0ec2be6a7a6c131f8c2b427".
Guest kernel updateing is useless.
Booting directly doesn't work too.
Quoted 208 lines
Quoted 2 lines
The qemu cmd:
[root@fedora121 x86_64-softmmu]# ./qemu-system-x86_64 -enable-kvm-name fedora -M pc -m 1024 -smp 2 -drive
file=/home/fedora18.iso,if=ide,media=cdrom -device
vhost-scsi-pci,wwpn=naa.50014057133e25dc -monitor stdio -vga qxl
-vnc :1Quoted 3 lines
The vnc output:
Dracut-initqueue[189]:/dev/mapper/fedora-root:UNEXPECTEDINCONSISTENCY;RUN FSCK MANUALLY.
Quoted 2 lines
Dracut-initqueue[189]: Warning: e2fsck returned with 4 Dracut-initqueue[189]: Warning: ***An error occurred during the file
system check.
Quoted 19 lines
The guest kernel log:
Kernel: virtio-pci 0000:00:04.0: irq 40 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 41 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 42 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 43 for MSI/MSI-X
Kernel: scsi2 : Virtio SCSI HBA
Kernel: scsi 2:0:1:0: Direct-Access LIO-ORG r0
Kernel: sd 2:0:1:0: Attached scsi generic sg1 type 0
Kernel: sd 2:0:1:0: [sda]1258912 512-byte logical .....
Kernel: sd 2:0:1:0: [sda]write protect is off
Kernel: sd 2:0:1:0: [sda]Mode sense :43 00 00 08
Kernel: sd 2:0:1:0: [sda]write cache: disabled, read .....
Kernel: sda sda1 sda2
Kernel: sd 2:0:1:0: [sda] Attached SCSI disk Dracut-initqueue[189]: Scanning devices sda2 for LVM Dracut-initqueue[189]: inactive '/dev/fedora/swap'... Dracut-initqueue[189]: inactive '/dev/fedora/root'...Quoted 3 lines
The info of host:
[root@fedora121 x86_64-softmmu]# uname -a
Linux fedora121 3.10.0-rc6 #1 SMP Wed Jun 19 19:34:24 CST 2013x86_64
x86_64x86_64GNU/LinuxQuoted 3 lines
[root@fedora121 x86_64-softmmu]# lsmod |grep
vhost_scsivhost_scsi49456 5target_core_mod282163 14target_core_iblock,target_core_pscsi,iscsi_target_mod,target_core_file,vh
ost_scsiQuoted 7 lines
[root@fedora121 x86_64-softmmu]# targetcli targetcli shell version v2.1.fb26
Copyright 2011 by RisingTide Systems LLC and others. For help on commands, type 'help'./> ls
o-/ .............................................................................................................. ........... [...]
Quoted 1 line
o-
backstores ............................................................................................... ............... [...]
Quoted 1 line
| o-
block .................................................................................................. [Storage Objects: 0]
Quoted 1 line
| o-
fileio ................................................................................................. [Storage Objects: 0]
Quoted 1 line
| o-
pscsi .................................................................................................. [Storage Objects: 0]
Quoted 1 line
| o-
ramdisk ................................................................................................ [Storage Objects: 1]
Quoted 1 line
| o-
r0 ................................................................................................... [(6.0GiB) activated]
Quoted 1 line
o-
iscsi ......................................................................................................... ... [Targets: 0]
Quoted 1 line
o-
loopback .................................................................................................. ....... [Targets: 0]
Quoted 1 line
o-
vhost ....................................................................................................... ..... [Targets: 1]
Quoted 1 line
o-naa.50014057133e25dc ............................................................................ .................. [TPGs: 1]
Quoted 1 line
o-tpg1 ............................................................................................... [naa.5001405a70ac3421]
Quoted 1 line
o-acls .......................................................................................................... [ACLs: 0]
Quoted 1 line
o-luns .......................................................................................................... [LUNs: 1]
Quoted 1 line
o-lun0 ..................................................................................................... [ramdisk/r0]
Quoted 10 lines
Regards,
baiqingQuoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 9:34 AM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supportingthe
Quoted 7 lines
Quoted 7 lines
tcm_vhostLinux kernel moduleQuoted 4 lines · Libaiqing
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed. Could you give me some advise to debug this problem ? I canprovide
Quoted 3 lines
Quoted 3 lines
more information if need.
Boot from vhost-scsi is supposed to work. The seabios you used should
be
Quoted 31 lines
Quoted 31 lines
fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, I really recommend using targetcli utils.Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need upstream kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Quoted 8 lines
Quoted 8 lines
Hope this helps.
Quoted 6 lines
Regards,
baiqingQuoted 3 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]On
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected];Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 9 lines
Quoted 9 lines
the
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device
vhost-scsi-pci".
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it isnot
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
available from the QEMU command-line. Instead, I hardcode it
to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
zero.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs,before
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
invoking qemu with the WWPN number?
Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' >
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port echo naa.60014053226f0388 > nexusThe "nexus" value is the initiator WWN. naa.600140554cf3a18e is
the
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
--
Asias--
Asias
PATCH 6/9 vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Hi asias,
I'm testing vhost-blk,for comparimg the performance with virtio-blk.
I got the kernel patch from this mail: https://lkml.org/lkml/2012/12/1/174
And I got the userspace code for qemu from this git: https://github.com/asias/qemu/tree/blk.vhost-blk;
Used vhost-blk device as non-bootable device,the configuration is :
Qemu-kvm -enable-kvm -name win7 -M pc-0.15 -m 1024 -smp 2 -boot c -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/home/fedora188.img,if=virtio,index=0,format=raw -drive file=/home/fedora18.img,if=virtio,index=1,format=raw,id=hd,vhost=on -monitor stdio -vga qxl -vnc :1 -device usb-tablet,id=input0
On fedora17 host,I used kernel 3.6.3 for building vhos_blk module,but the vm will hang when vm starting.
1 Is there any new patch for kernel 3.8 3.10?
2 which version of the kernel is suitable for the current kernel patch?
Could you give me some advise to debug this problem ? I can provide more information if need. Or could you give me some advise to run vhost-blk,such as RHEL version,kernel version and so on?
Thanks
Baiqing.
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 3 lines · Libaiqing
Hi asias,
I'm testing vhost-blk,for comparimg the performance with virtio-blk. I got the kernel patch from this mail: https://lkml.org/lkml/2012/12/1/174
You can find the latest vhost-blk kernel bits here:
git://github.com/asias/linux.git blk.vhost-blk
Quoted 3 lines
And I got the userspace code for qemu from this git: https://github.com/asias/qemu/tree/blk.vhost-blk; Used vhost-blk device as non-bootable device,the configuration is : Qemu-kvm -enable-kvm -name win7 -M pc-0.15 -m 1024 -smp 2 -boot c -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/home/fedora188.img,if=virtio,index=0,format=raw -drive file=/home/fedora18.img,if=virtio,index=1,format=raw,id=hd,vhost=on -monitor stdio -vga qxl -vnc :1 -device usb-tablet,id=input0
Please use raw block device for vhost-blk.
Quoted 7 lines
On fedora17 host,I used kernel 3.6.3 for building
vhos_blkmodule,but the vm will hang when vm starting.1 Is there any new patch for kernel 3.8 3.10?
2 which version of the kernel is suitable for the current kernel patch?Could you give me some advise to debug this problem ? I can provide more information if need. Or could you give me some advise to run vhost-blk,such as RHEL version,kernel version and so on?
I recommend you to use the kernel I provided above for both guest and host.
Quoted 2 lines
Thanks
Baiqing.
Signature · 1 line
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
In reply to LibaiqingQuoted 31 lines · Libaiqing
Hi Asias,
Quoted 29 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 5:39 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleQuoted 3 lines · Libaiqing
Hi Asias,
Thanks for your config.
According to you config,I test booting from vhost device withupstream kernel and qemu,but failed.
Quoted 6 lines
1 installing guest from cdrom,ok.
2 booting vhost-scsi,guest fs error occurs.
3 using fileio backstores,the error is same..
4 rebooting guest,a log printed:
(qemu) hw/scsi/virtio-scsi.c:533:virtio_scsi_handle_event: Object
0x7fccae7f2c88is not an instance of type virtio-scsi-devicePaolo, I remember you fixed a similar issue?
Quoted 3 lines
5 using upstream seabios,core dumped.
Could you give me some advise to debug this problem ? I can provide
more information if need.
Quoted 8 lines
Quoted 3 lines
Can you show me qemu commit id you used? Can you verity that if using the host kernel for guest helps? Does booting directly (without the install and reboot process) work?
Qemu commit id is "commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427".Guest kernel updateing is useless.
Booting directly doesn't work too.
Hello Libaiqing,
Sorry for the delay. I will try to reproduce it myself.
Quoted 209 lines
Quoted 209 lines
Quoted 3 lines
The qemu cmd:
[root@fedora121 x86_64-softmmu]# ./qemu-system-x86_64 -enable-kvm-name fedora -M pc -m 1024 -smp 2 -drive
file=/home/fedora18.iso,if=ide,media=cdrom -device
vhost-scsi-pci,wwpn=naa.50014057133e25dc -monitor stdio -vga qxl
-vnc :1Quoted 3 lines
The vnc output:
Dracut-initqueue[189]:/dev/mapper/fedora-root:UNEXPECTEDINCONSISTENCY;RUN FSCK MANUALLY.
Quoted 2 lines
Dracut-initqueue[189]: Warning: e2fsck returned with 4 Dracut-initqueue[189]: Warning: ***An error occurred during the file
system check.
Quoted 19 lines
The guest kernel log:
Kernel: virtio-pci 0000:00:04.0: irq 40 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 41 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 42 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 43 for MSI/MSI-X
Kernel: scsi2 : Virtio SCSI HBA
Kernel: scsi 2:0:1:0: Direct-Access LIO-ORG r0
Kernel: sd 2:0:1:0: Attached scsi generic sg1 type 0
Kernel: sd 2:0:1:0: [sda]1258912 512-byte logical .....
Kernel: sd 2:0:1:0: [sda]write protect is off
Kernel: sd 2:0:1:0: [sda]Mode sense :43 00 00 08
Kernel: sd 2:0:1:0: [sda]write cache: disabled, read .....
Kernel: sda sda1 sda2
Kernel: sd 2:0:1:0: [sda] Attached SCSI disk Dracut-initqueue[189]: Scanning devices sda2 for LVM Dracut-initqueue[189]: inactive '/dev/fedora/swap'... Dracut-initqueue[189]: inactive '/dev/fedora/root'...Quoted 3 lines
The info of host:
[root@fedora121 x86_64-softmmu]# uname -a
Linux fedora121 3.10.0-rc6 #1 SMP Wed Jun 19 19:34:24 CST 2013x86_64
x86_64x86_64GNU/LinuxQuoted 3 lines
[root@fedora121 x86_64-softmmu]# lsmod |grep
vhost_scsivhost_scsi49456 5target_core_mod282163 14target_core_iblock,target_core_pscsi,iscsi_target_mod,target_core_file,vh
ost_scsiQuoted 7 lines
[root@fedora121 x86_64-softmmu]# targetcli targetcli shell version v2.1.fb26
Copyright 2011 by RisingTide Systems LLC and others. For help on commands, type 'help'./> ls
o-/ .............................................................................................................. ........... [...]
Quoted 1 line
o-
backstores ............................................................................................... ............... [...]
Quoted 1 line
| o-
block .................................................................................................. [Storage Objects: 0]
Quoted 1 line
| o-
fileio ................................................................................................. [Storage Objects: 0]
Quoted 1 line
| o-
pscsi .................................................................................................. [Storage Objects: 0]
Quoted 1 line
| o-
ramdisk ................................................................................................ [Storage Objects: 1]
Quoted 1 line
| o-
r0 ................................................................................................... [(6.0GiB) activated]
Quoted 1 line
o-
iscsi ......................................................................................................... ... [Targets: 0]
Quoted 1 line
o-
loopback .................................................................................................. ....... [Targets: 0]
Quoted 1 line
o-
vhost ....................................................................................................... ..... [Targets: 1]
Quoted 1 line
o-naa.50014057133e25dc ............................................................................ .................. [TPGs: 1]
Quoted 1 line
o-tpg1 ............................................................................................... [naa.5001405a70ac3421]
Quoted 1 line
o-acls .......................................................................................................... [ACLs: 0]
Quoted 1 line
o-luns .......................................................................................................... [LUNs: 1]
Quoted 1 line
o-lun0 ..................................................................................................... [ramdisk/r0]
Quoted 10 lines
Regards,
baiqingQuoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 9:34 AM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supportingthe
Quoted 7 lines
Quoted 7 lines
tcm_vhostLinux kernel moduleQuoted 4 lines · Libaiqing
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed. Could you give me some advise to debug this problem ? I canprovide
Quoted 3 lines
Quoted 3 lines
more information if need.
Boot from vhost-scsi is supposed to work. The seabios you used should
be
Quoted 31 lines
Quoted 31 lines
fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, I really recommend using targetcli utils.Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need upstream kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Quoted 8 lines
Quoted 8 lines
Hope this helps.
Quoted 6 lines
Regards,
baiqingQuoted 3 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]On
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected];Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 9 lines
Quoted 9 lines
the
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device
vhost-scsi-pci".
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it isnot
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
available from the QEMU command-line. Instead, I hardcode it
to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
zero.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs,before
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
invoking qemu with the WWPN number?
Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' >
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port echo naa.60014053226f0388 > nexusThe "nexus" value is the initiator WWN. naa.600140554cf3a18e is
the
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
--
Asias--
Asias
Signature · 1 line
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 37 lines · Asias He
Quoted 36 lines · Libaiqing
Hi Asias,
Quoted 24 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 5:39 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleQuoted 3 lines · Libaiqing
Hi Asias,
Thanks for your config.
According to you config,I test booting from vhost device withupstream kernel and qemu,but failed.
Quoted 6 lines
1 installing guest from cdrom,ok.
2 booting vhost-scsi,guest fs error occurs.
3 using fileio backstores,the error is same..
4 rebooting guest,a log printed:
(qemu) hw/scsi/virtio-scsi.c:533:virtio_scsi_handle_event: Object
0x7fccae7f2c88is not an instance of type virtio-scsi-devicePaolo, I remember you fixed a similar issue?
Quoted 8 lines
Quoted 3 lines
5 using upstream seabios,core dumped.
Could you give me some advise to debug this problem ? I can provide
more information if need.
Can you show me qemu commit id you used? Can you verity that if using the host kernel for guest helps? Does booting directly (without the install and reboot process) work?
Qemu commit id is "commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427".
Quoted 8 lines
Quoted 3 lines
Guest kernel updateing is useless.
Booting directly doesn't work too.
Hello Libaiqing,
Sorry for the delay. I will try to reproduce it myself.
I tried 1.5.1 and qemu.git/master and your particular commit 4eda32f588086b6cd0ec2be6a7a6c131f8c2b427.
All work well for me. I used 3.10.0-rc6 as both and guest kernel.
Quoted 213 lines
Quoted 210 lines
Quoted 210 lines
Quoted 4 lines
The qemu cmd:
[root@fedora121 x86_64-softmmu]# ./qemu-system-x86_64 -enable-kvm-name fedora -M pc -m 1024 -smp 2 -drive
file=/home/fedora18.iso,if=ide,media=cdrom -device
vhost-scsi-pci,wwpn=naa.50014057133e25dc -monitor stdio -vga qxl
-vnc :1Quoted 3 lines
The vnc output:
Dracut-initqueue[189]:/dev/mapper/fedora-root:UNEXPECTEDINCONSISTENCY;RUN FSCK MANUALLY.
Quoted 2 lines
Dracut-initqueue[189]: Warning: e2fsck returned with 4 Dracut-initqueue[189]: Warning: ***An error occurred during the file
system check.
Quoted 19 lines
The guest kernel log:
Kernel: virtio-pci 0000:00:04.0: irq 40 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 41 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 42 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 43 for MSI/MSI-X
Kernel: scsi2 : Virtio SCSI HBA
Kernel: scsi 2:0:1:0: Direct-Access LIO-ORG r0
Kernel: sd 2:0:1:0: Attached scsi generic sg1 type 0
Kernel: sd 2:0:1:0: [sda]1258912 512-byte logical .....
Kernel: sd 2:0:1:0: [sda]write protect is off
Kernel: sd 2:0:1:0: [sda]Mode sense :43 00 00 08
Kernel: sd 2:0:1:0: [sda]write cache: disabled, read .....
Kernel: sda sda1 sda2
Kernel: sd 2:0:1:0: [sda] Attached SCSI disk Dracut-initqueue[189]: Scanning devices sda2 for LVM Dracut-initqueue[189]: inactive '/dev/fedora/swap'... Dracut-initqueue[189]: inactive '/dev/fedora/root'...Quoted 3 lines
The info of host:
[root@fedora121 x86_64-softmmu]# uname -a
Linux fedora121 3.10.0-rc6 #1 SMP Wed Jun 19 19:34:24 CST 2013x86_64
x86_64x86_64GNU/LinuxQuoted 3 lines
[root@fedora121 x86_64-softmmu]# lsmod |grep
vhost_scsivhost_scsi49456 5target_core_mod282163 14target_core_iblock,target_core_pscsi,iscsi_target_mod,target_core_file,vh
ost_scsiQuoted 7 lines
[root@fedora121 x86_64-softmmu]# targetcli targetcli shell version v2.1.fb26
Copyright 2011 by RisingTide Systems LLC and others. For help on commands, type 'help'./> ls
o-/ .............................................................................................................. ........... [...]
Quoted 1 line
o-
backstores ............................................................................................... ............... [...]
Quoted 1 line
| o-
block .................................................................................................. [Storage Objects: 0]
Quoted 1 line
| o-
fileio ................................................................................................. [Storage Objects: 0]
Quoted 1 line
| o-
pscsi .................................................................................................. [Storage Objects: 0]
Quoted 1 line
| o-
ramdisk ................................................................................................ [Storage Objects: 1]
Quoted 1 line
| o-
r0 ................................................................................................... [(6.0GiB) activated]
Quoted 1 line
o-
iscsi ......................................................................................................... ... [Targets: 0]
Quoted 1 line
o-
loopback .................................................................................................. ....... [Targets: 0]
Quoted 1 line
o-
vhost ....................................................................................................... ..... [Targets: 1]
Quoted 1 line
o-naa.50014057133e25dc ............................................................................ .................. [TPGs: 1]
Quoted 1 line
o-tpg1 ............................................................................................... [naa.5001405a70ac3421]
Quoted 1 line
o-acls .......................................................................................................... [ACLs: 0]
Quoted 1 line
o-luns .......................................................................................................... [LUNs: 1]
Quoted 1 line
o-lun0 ..................................................................................................... [ramdisk/r0]
Quoted 10 lines
Regards,
baiqingQuoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 9:34 AM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supportingthe
Quoted 7 lines
Quoted 7 lines
tcm_vhostLinux kernel moduleQuoted 4 lines · Libaiqing
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed. Could you give me some advise to debug this problem ? I canprovide
Quoted 3 lines
Quoted 3 lines
more information if need.
Boot from vhost-scsi is supposed to work. The seabios you used should
be
Quoted 31 lines
Quoted 31 lines
fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, I really recommend using targetcli utils.Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need upstream kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Quoted 8 lines
Quoted 8 lines
Hope this helps.
Quoted 6 lines
Regards,
baiqingQuoted 3 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]On
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected];Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 9 lines
Quoted 9 lines
the
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device
vhost-scsi-pci".
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The tgpt field of the
SET_ENDPOINTioctl is obsolete now, so it isnot
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
available from the QEMU command-line. Instead, I hardcode it
to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
zero.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs,before
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
invoking qemu with the WWPN number?
Unfortunately no, but vhost-scsi doesn't have many knobs (unlike iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' >
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0
cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/ lun/lun_0/virtual_scsi_port echo naa.60014053226f0388 > nexusThe "nexus" value is the initiator WWN. naa.600140554cf3a18e is
the
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
--
Asias--
AsiasSignature · 1 line
Asias
Signature · 1 line
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Hi asias,
I got the rootcause:guest was installed on raw img with lvm partition,which vhost does not support.
Now vhost-scsi can be used as bootable device.
Thanks
baiqing
Quoted 312 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 4:09 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleQuoted 10 lines · Asias He
Quoted 9 lines · Libaiqing
Hi Asias,
Quoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 5:39 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleQuoted 3 lines · Libaiqing
Hi Asias,
Thanks for your config.
According to you config,I test booting from vhost device withQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
upstream kernel and qemu,but failed.
Quoted 6 lines
1 installing guest from cdrom,ok.
2 booting vhost-scsi,guest fs error occurs.
3 using fileio backstores,the error is same..
4 rebooting guest,a log printed:
(qemu) hw/scsi/virtio-scsi.c:533:virtio_scsi_handle_event:Object
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
0x7fccae7f2c88is not an instance of type virtio-scsi-devicePaolo, I remember you fixed a similar issue?
Quoted 3 lines
5 using upstream seabios,core dumped.
Could you give me some advise to debug this problem ? I can
provide
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
more information if need.
Can you show me qemu commit id you used? Can you verity that if
using the
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
host kernel for guest helps? Does booting directly (without the install and reboot process) work?
Qemu commit id is "commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427".Quoted 9 lines
Quoted 4 lines
Guest kernel updateing is useless.
Booting directly doesn't work too.
Hello Libaiqing,
Sorry for the delay. I will try to reproduce it myself.
I tried 1.5.1 and qemu.git/master and your particular commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427.All work well for me. I used 3.10.0-rc6 as both and guest kernel.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The qemu cmd:
[root@fedora121 x86_64-softmmu]# ./qemu-system-x86_64-enable-kvm
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
-name fedora -M pc -m 1024 -smp 2 -drive
file=/home/fedora18.iso,if=ide,media=cdrom -device
vhost-scsi-pci,wwpn=naa.50014057133e25dc -monitor stdio -vgaqxl
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
-vnc :1
Quoted 3 lines
The vnc output:
Dracut-initqueue[189]:/dev/mapper/fedora-root:UNEXPECTEDINCONSISTENCY;RUN FSCK MANUALLY.
Quoted 2 lines
Dracut-initqueue[189]: Warning: e2fsck returned with 4 Dracut-initqueue[189]: Warning: ***An error occurred during the file
system check.
Quoted 19 lines
The guest kernel log:
Kernel: virtio-pci 0000:00:04.0: irq 40 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 41 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 42 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 43 for MSI/MSI-X
Kernel: scsi2 : Virtio SCSI HBA
Kernel: scsi 2:0:1:0: Direct-Access LIO-ORG r0
Kernel: sd 2:0:1:0: Attached scsi generic sg1 type 0
Kernel: sd 2:0:1:0: [sda]1258912 512-byte logical .....
Kernel: sd 2:0:1:0: [sda]write protect is off
Kernel: sd 2:0:1:0: [sda]Mode sense :43 00 00 08
Kernel: sd 2:0:1:0: [sda]write cache: disabled, read .....
Kernel: sda sda1 sda2
Kernel: sd 2:0:1:0: [sda] Attached SCSI disk Dracut-initqueue[189]: Scanning devices sda2 for LVM Dracut-initqueue[189]: inactive '/dev/fedora/swap'... Dracut-initqueue[189]: inactive '/dev/fedora/root'...Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The info of host:
[root@fedora121 x86_64-softmmu]# uname -a
Linux fedora121 3.10.0-rc6 #1 SMP Wed Jun 19 19:34:24 CST 2013
x86_64Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
x86_64x86_64GNU/LinuxQuoted 3 lines
[root@fedora121 x86_64-softmmu]# lsmod |grep
vhost_scsivhost_scsi49456 5target_core_mod282163 14target_core_iblock,target_core_pscsi,iscsi_target_mod,target_core_file,vh
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
ost_scsiQuoted 7 lines
[root@fedora121 x86_64-softmmu]# targetcli targetcli shell version v2.1.fb26
Copyright 2011 by RisingTide Systems LLC and others. For help on commands, type 'help'./> ls
o-/ ..............................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
........... [...]
Quoted 1 line
o-
backstores ...............................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
............... [...]
Quoted 1 line
| o-
block ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
fileio .................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
pscsi ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
ramdisk ................................................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
[Storage Objects: 1]
Quoted 1 line
| o-
r0 ................................................................................................... [(6.0GiB) activated]
Quoted 1 line
o-
iscsi .........................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
... [Targets: 0]
Quoted 1 line
o-
loopback ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
....... [Targets: 0]
Quoted 1 line
o-
vhost .......................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
..... [Targets: 1]
Quoted 1 line
o-naa.50014057133e25dc ............................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
.................. [TPGs: 1]
Quoted 1 line
o-tpg1 ............................................................................................... [naa.5001405a70ac3421]
Quoted 1 line
o-acls ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[ACLs: 0]
Quoted 1 line
o-luns ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[LUNs: 1]
Quoted 1 line
o-lun0 .....................................................................................................
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
[ramdisk/r0]
Quoted 10 lines
Regards,
baiqingQuoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 9:34 AM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
the
Quoted 3 lines
Quoted 3 lines
tcm_vhostLinux kernel moduleOn Wed, Jun 19, 2013 at 12:55:10PM +0000, Libaiqing wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed. Could you give me some advise to debug this problem ? I canprovide
Quoted 3 lines
Quoted 3 lines
more information if need.
Boot from vhost-scsi is supposed to work. The seabios you used
should
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
be
Quoted 3 lines
Quoted 3 lines
fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, Ireally
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
recommend using targetcli utils.
Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need
upstream
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hope this helps.
Quoted 6 lines
Regards,
baiqingQuoted 3 lines
-----Original Message-----
From: [email protected][mailto:[email protected]]
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
On
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected];Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 1 line
Quoted 1 line
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device
vhost-scsi-pci".
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The tgpt field of the
SET_ENDPOINTioctl is obsolete now,so it is
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
not
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
available from the QEMU command-line. Instead, I
hardcode it
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
zero.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs,before
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
invoking qemu with the WWPN number?
Unfortunately no, but vhost-scsi doesn't have many knobs
(unlike
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' >
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0 cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/lun/lun_0/virtual_scsi_port
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
echo naa.60014053226f0388 > nexus
The "nexus" value is the initiator WWN.
naa.600140554cf3a18e is
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
the
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
--
Asias--
Asias--
Asias--
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Il 03/07/2013 14:33, Libaiqing ha scritto:
Quoted 2 lines
Hi asias,
I got the rootcause:guest was installed on raw img with lvm partition,which vhost does not support.
You mean LVM in the host or the guest? I guess in the host, but I'd rather make sure because otherwise you've found a bug.
Paolo
Quoted 1 line
Now vhost-scsi can be used as bootable device.
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Hi paolo,
Sorry for the late reply.
LVM partition is in guest.So when booting for vhost-scsi,the guest always reports the fs is broken,and enters the emergency mode.
I can provide more information if need.
Thanks
Baiqing.
Quoted 20 lines
-----Original Message-----
From: Paolo Bonzini [mailto:[email protected]]
Sent: Thursday, July 04, 2013 7:24 PM
To: Libaiqing
Cc: Asias He; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleIl 03/07/2013 14:33, Libaiqing ha scritto:
Quoted 2 lines
Hi asias,
I got the rootcause:guest was installed on raw img with lvmpartition,which vhost does not support.
You mean LVM in the host or the guest? I guess in the host, but I'd rather make sure because otherwise you've found a bug.
Paolo
Quoted 1 line
Now vhost-scsi can be used as bootable device.
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
In reply to Asias HeHi asias,
1 Window can not boot from vhost-scsi device;
2 A non-bootable vhost-scsi device can not be driven by windows guest.(I used the driver virtio-win-0.1-59 version.)
Do you have any plan about these?
Thanks,
Baiqing.
Quoted 312 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 4:09 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleQuoted 10 lines · Asias He
Quoted 9 lines · Libaiqing
Hi Asias,
Quoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 5:39 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleQuoted 3 lines · Libaiqing
Hi Asias,
Thanks for your config.
According to you config,I test booting from vhost device withQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
upstream kernel and qemu,but failed.
Quoted 6 lines
1 installing guest from cdrom,ok.
2 booting vhost-scsi,guest fs error occurs.
3 using fileio backstores,the error is same..
4 rebooting guest,a log printed:
(qemu) hw/scsi/virtio-scsi.c:533:virtio_scsi_handle_event:Object
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
0x7fccae7f2c88is not an instance of type virtio-scsi-devicePaolo, I remember you fixed a similar issue?
Quoted 3 lines
5 using upstream seabios,core dumped.
Could you give me some advise to debug this problem ? I can
provide
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
more information if need.
Can you show me qemu commit id you used? Can you verity that if
using the
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
host kernel for guest helps? Does booting directly (without the install and reboot process) work?
Qemu commit id is "commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427".Quoted 9 lines
Quoted 4 lines
Guest kernel updateing is useless.
Booting directly doesn't work too.
Hello Libaiqing,
Sorry for the delay. I will try to reproduce it myself.
I tried 1.5.1 and qemu.git/master and your particular commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427.All work well for me. I used 3.10.0-rc6 as both and guest kernel.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The qemu cmd:
[root@fedora121 x86_64-softmmu]# ./qemu-system-x86_64-enable-kvm
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
-name fedora -M pc -m 1024 -smp 2 -drive
file=/home/fedora18.iso,if=ide,media=cdrom -device
vhost-scsi-pci,wwpn=naa.50014057133e25dc -monitor stdio -vgaqxl
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
-vnc :1
Quoted 3 lines
The vnc output:
Dracut-initqueue[189]:/dev/mapper/fedora-root:UNEXPECTEDINCONSISTENCY;RUN FSCK MANUALLY.
Quoted 2 lines
Dracut-initqueue[189]: Warning: e2fsck returned with 4 Dracut-initqueue[189]: Warning: ***An error occurred during the file
system check.
Quoted 19 lines
The guest kernel log:
Kernel: virtio-pci 0000:00:04.0: irq 40 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 41 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 42 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 43 for MSI/MSI-X
Kernel: scsi2 : Virtio SCSI HBA
Kernel: scsi 2:0:1:0: Direct-Access LIO-ORG r0
Kernel: sd 2:0:1:0: Attached scsi generic sg1 type 0
Kernel: sd 2:0:1:0: [sda]1258912 512-byte logical .....
Kernel: sd 2:0:1:0: [sda]write protect is off
Kernel: sd 2:0:1:0: [sda]Mode sense :43 00 00 08
Kernel: sd 2:0:1:0: [sda]write cache: disabled, read .....
Kernel: sda sda1 sda2
Kernel: sd 2:0:1:0: [sda] Attached SCSI disk Dracut-initqueue[189]: Scanning devices sda2 for LVM Dracut-initqueue[189]: inactive '/dev/fedora/swap'... Dracut-initqueue[189]: inactive '/dev/fedora/root'...Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The info of host:
[root@fedora121 x86_64-softmmu]# uname -a
Linux fedora121 3.10.0-rc6 #1 SMP Wed Jun 19 19:34:24 CST 2013
x86_64Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
x86_64x86_64GNU/LinuxQuoted 3 lines
[root@fedora121 x86_64-softmmu]# lsmod |grep
vhost_scsivhost_scsi49456 5target_core_mod282163 14target_core_iblock,target_core_pscsi,iscsi_target_mod,target_core_file,vh
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
ost_scsiQuoted 7 lines
[root@fedora121 x86_64-softmmu]# targetcli targetcli shell version v2.1.fb26
Copyright 2011 by RisingTide Systems LLC and others. For help on commands, type 'help'./> ls
o-/ ..............................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
........... [...]
Quoted 1 line
o-
backstores ...............................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
............... [...]
Quoted 1 line
| o-
block ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
fileio .................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
pscsi ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
ramdisk ................................................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
[Storage Objects: 1]
Quoted 1 line
| o-
r0 ................................................................................................... [(6.0GiB) activated]
Quoted 1 line
o-
iscsi .........................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
... [Targets: 0]
Quoted 1 line
o-
loopback ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
....... [Targets: 0]
Quoted 1 line
o-
vhost .......................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
..... [Targets: 1]
Quoted 1 line
o-naa.50014057133e25dc ............................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
.................. [TPGs: 1]
Quoted 1 line
o-tpg1 ............................................................................................... [naa.5001405a70ac3421]
Quoted 1 line
o-acls ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[ACLs: 0]
Quoted 1 line
o-luns ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[LUNs: 1]
Quoted 1 line
o-lun0 .....................................................................................................
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
[ramdisk/r0]
Quoted 10 lines
Regards,
baiqingQuoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 9:34 AM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
the
Quoted 3 lines
Quoted 3 lines
tcm_vhostLinux kernel moduleOn Wed, Jun 19, 2013 at 12:55:10PM +0000, Libaiqing wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed. Could you give me some advise to debug this problem ? I canprovide
Quoted 3 lines
Quoted 3 lines
more information if need.
Boot from vhost-scsi is supposed to work. The seabios you used
should
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
be
Quoted 3 lines
Quoted 3 lines
fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, Ireally
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
recommend using targetcli utils.
Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need
upstream
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hope this helps.
Quoted 6 lines
Regards,
baiqingQuoted 3 lines
-----Original Message-----
From: [email protected][mailto:[email protected]]
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
On
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected];Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 1 line
Quoted 1 line
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device
vhost-scsi-pci".
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The tgpt field of the
SET_ENDPOINTioctl is obsolete now,so it is
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
not
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
available from the QEMU command-line. Instead, I
hardcode it
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
zero.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs,before
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
invoking qemu with the WWPN number?
Unfortunately no, but vhost-scsi doesn't have many knobs
(unlike
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' >
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0 cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/lun/lun_0/virtual_scsi_port
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
echo naa.60014053226f0388 > nexus
The "nexus" value is the initiator WWN.
naa.600140554cf3a18e is
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
the
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
--
Asias--
Asias--
Asias--
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 5 lines · Libaiqing
Hi asias,
1 Window can not boot from vhost-scsi device;
2 A non-bootable vhost-scsi device can not be driven by windows guest.(I used the driver virtio-win-0.1-59 version.)Do you have any plan about these?
Thanks for testing. I will take a look.
Quoted 315 lines
Thanks,
Baiqing.Quoted 312 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 4:09 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleQuoted 10 lines · Asias He
Quoted 9 lines · Libaiqing
Hi Asias,
Quoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 5:39 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleQuoted 3 lines · Libaiqing
Hi Asias,
Thanks for your config.
According to you config,I test booting from vhost device withQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
upstream kernel and qemu,but failed.
Quoted 6 lines
1 installing guest from cdrom,ok.
2 booting vhost-scsi,guest fs error occurs.
3 using fileio backstores,the error is same..
4 rebooting guest,a log printed:
(qemu) hw/scsi/virtio-scsi.c:533:virtio_scsi_handle_event:Object
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
0x7fccae7f2c88is not an instance of type virtio-scsi-devicePaolo, I remember you fixed a similar issue?
Quoted 3 lines
5 using upstream seabios,core dumped.
Could you give me some advise to debug this problem ? I can
provide
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
more information if need.
Can you show me qemu commit id you used? Can you verity that if
using the
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
host kernel for guest helps? Does booting directly (without the install and reboot process) work?
Qemu commit id is "commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427".Quoted 9 lines
Quoted 4 lines
Guest kernel updateing is useless.
Booting directly doesn't work too.
Hello Libaiqing,
Sorry for the delay. I will try to reproduce it myself.
I tried 1.5.1 and qemu.git/master and your particular commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427.All work well for me. I used 3.10.0-rc6 as both and guest kernel.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The qemu cmd:
[root@fedora121 x86_64-softmmu]# ./qemu-system-x86_64-enable-kvm
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
-name fedora -M pc -m 1024 -smp 2 -drive
file=/home/fedora18.iso,if=ide,media=cdrom -device
vhost-scsi-pci,wwpn=naa.50014057133e25dc -monitor stdio -vgaqxl
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
-vnc :1
Quoted 3 lines
The vnc output:
Dracut-initqueue[189]:/dev/mapper/fedora-root:UNEXPECTEDINCONSISTENCY;RUN FSCK MANUALLY.
Quoted 2 lines
Dracut-initqueue[189]: Warning: e2fsck returned with 4 Dracut-initqueue[189]: Warning: ***An error occurred during the file
system check.
Quoted 19 lines
The guest kernel log:
Kernel: virtio-pci 0000:00:04.0: irq 40 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 41 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 42 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 43 for MSI/MSI-X
Kernel: scsi2 : Virtio SCSI HBA
Kernel: scsi 2:0:1:0: Direct-Access LIO-ORG r0
Kernel: sd 2:0:1:0: Attached scsi generic sg1 type 0
Kernel: sd 2:0:1:0: [sda]1258912 512-byte logical .....
Kernel: sd 2:0:1:0: [sda]write protect is off
Kernel: sd 2:0:1:0: [sda]Mode sense :43 00 00 08
Kernel: sd 2:0:1:0: [sda]write cache: disabled, read .....
Kernel: sda sda1 sda2
Kernel: sd 2:0:1:0: [sda] Attached SCSI disk Dracut-initqueue[189]: Scanning devices sda2 for LVM Dracut-initqueue[189]: inactive '/dev/fedora/swap'... Dracut-initqueue[189]: inactive '/dev/fedora/root'...Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The info of host:
[root@fedora121 x86_64-softmmu]# uname -a
Linux fedora121 3.10.0-rc6 #1 SMP Wed Jun 19 19:34:24 CST 2013
x86_64Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
x86_64x86_64GNU/LinuxQuoted 3 lines
[root@fedora121 x86_64-softmmu]# lsmod |grep
vhost_scsivhost_scsi49456 5target_core_mod282163 14target_core_iblock,target_core_pscsi,iscsi_target_mod,target_core_file,vh
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
ost_scsiQuoted 7 lines
[root@fedora121 x86_64-softmmu]# targetcli targetcli shell version v2.1.fb26
Copyright 2011 by RisingTide Systems LLC and others. For help on commands, type 'help'./> ls
o-/ ..............................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
........... [...]
Quoted 1 line
o-
backstores ...............................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
............... [...]
Quoted 1 line
| o-
block ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
fileio .................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
pscsi ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
ramdisk ................................................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
[Storage Objects: 1]
Quoted 1 line
| o-
r0 ................................................................................................... [(6.0GiB) activated]
Quoted 1 line
o-
iscsi .........................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
... [Targets: 0]
Quoted 1 line
o-
loopback ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
....... [Targets: 0]
Quoted 1 line
o-
vhost .......................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
..... [Targets: 1]
Quoted 1 line
o-naa.50014057133e25dc ............................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
.................. [TPGs: 1]
Quoted 1 line
o-tpg1 ............................................................................................... [naa.5001405a70ac3421]
Quoted 1 line
o-acls ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[ACLs: 0]
Quoted 1 line
o-luns ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[LUNs: 1]
Quoted 1 line
o-lun0 .....................................................................................................
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
[ramdisk/r0]
Quoted 10 lines
Regards,
baiqingQuoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 9:34 AM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
the
Quoted 3 lines
Quoted 3 lines
tcm_vhostLinux kernel moduleOn Wed, Jun 19, 2013 at 12:55:10PM +0000, Libaiqing wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed. Could you give me some advise to debug this problem ? I canprovide
Quoted 3 lines
Quoted 3 lines
more information if need.
Boot from vhost-scsi is supposed to work. The seabios you used
should
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
be
Quoted 3 lines
Quoted 3 lines
fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, Ireally
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
recommend using targetcli utils.
Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need
upstream
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hope this helps.
Quoted 6 lines
Regards,
baiqingQuoted 3 lines
-----Original Message-----
From: [email protected][mailto:[email protected]]
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
On
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected];Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 1 line
Quoted 1 line
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device
vhost-scsi-pci".
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The tgpt field of the
SET_ENDPOINTioctl is obsolete now,so it is
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
not
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
available from the QEMU command-line. Instead, I
hardcode it
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
zero.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs,before
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
invoking qemu with the WWPN number?
Unfortunately no, but vhost-scsi doesn't have many knobs
(unlike
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' >
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0 cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/lun/lun_0/virtual_scsi_port
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
echo naa.60014053226f0388 > nexus
The "nexus" value is the initiator WWN.
naa.600140554cf3a18e is
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
the
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
--
Asias--
Asias--
Asias--
Asias
Signature · 1 line
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
In reply to Libaiqing[CCing Vadim and Yan]
Quoted 5 lines · Libaiqing
Hi asias,
1 Window can not boot from vhost-scsi device;
2 A non-bootable vhost-scsi device can not be driven by windows guest.(I used the driver virtio-win-0.1-59 version.)Do you have any plan about these?
I can reproduce this issue on win2003 (Linux guest works fine). The guest hangs in the boot process. OS is on virito-blk disk, vhost-scsi is attached as the second disk.
Guest probes from target 0 to 255. Only target 1 is available. vhost-scsi sends VIRTIO_SCSI_S_BAD_TARGET back to target 0 and 255 except tareget 1. Howerver, from the log we can see, guest is sending to target 0 again and hangs afterwards.
Vadim and Yan, any ideas?
[ 3109.954237] br0: port 2(tap0) entered disabled state [ 3109.954387] device tap0 left promiscuous mode [ 3109.954389] br0: port 2(tap0) entered disabled state [ 3119.534136] device tap0 entered promiscuous mode [ 3119.534169] br0: port 2(tap0) entered forwarding state [ 3119.534180] br0: port 2(tap0) entered forwarding state [ 3120.138334] vhost_scsi_ctl_handle_kick: The handling func for control queue. [ 3120.138666] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.138669] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.138671] target=0, tpg= (null) [ 3120.138672] send bad target head=0, out=1 [ 3120.138673] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139219] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139221] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.139223] target=1, tpg=ffff88021f8fc800 [ 3120.139225] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 36, data_direction: 2 [ 3120.139226] vhost_scsi got command opcode: 0x12, lun: 0 [ 3120.139228] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.139229] Mapping 1 iovecs for 1 pages [ 3120.139233] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139261] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.139470] vhost_get_vq_desc: head: 0, out: 1 in: 1 [ 3120.139472] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006bd9, len: 51 [ 3120.139474] target=1, tpg=ffff88021f8fc800 [ 3120.139475] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 0, data_direction: 3 [ 3120.139476] vhost_scsi got command opcode: 0x0, lun: 0 [ 3120.139480] vhost_get_vq_desc: head: 128, out: 1 in: 1 [ 3120.139487] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.139554] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139557] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.139558] target=1, tpg=ffff88021f8fc800 [ 3120.139560] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 8, data_direction: 2 [ 3120.139561] vhost_scsi got command opcode: 0x25, lun: 0 [ 3120.139563] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.139564] Mapping 1 iovecs for 1 pages [ 3120.139568] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139575] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.139783] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139785] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.139787] target=2, tpg= (null) [ 3120.139788] send bad target head=0, out=1 [ 3120.139789] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139938] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139940] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51
...
[ 3120.170209] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.170304] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.170305] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.170306] target=255, tpg= (null) [ 3120.170306] send bad target head=0, out=1 [ 3120.170307] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.474648] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.474652] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f280efe85, len: 51 [ 3120.474654] target=1, tpg=ffff88021f8fc800 [ 3120.474656] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 512, data_direction: 2 [ 3120.474658] vhost_scsi got command opcode: 0x28, lun: 0 [ 3120.474660] vhost_scsi_map_iov_to_sgl sg ffff880208f70d40 sgl_count 2 is_err 0 [ 3120.474662] Mapping 1 iovecs for 2 pages [ 3120.474666] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.474680] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.532843] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.532845] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f280efe85, len: 51 [ 3120.532847] target=1, tpg=ffff88021f8fc800 [ 3120.532848] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 512, data_direction: 2 [ 3120.532850] vhost_scsi got command opcode: 0x28, lun: 0 [ 3120.532852] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.532853] Mapping 1 iovecs for 1 pages [ 3120.532857] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.532863] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.532889] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.532891] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f280efe85, len: 51 [ 3120.532892] target=1, tpg=ffff88021f8fc800 [ 3120.532894] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 512, data_direction: 2 [ 3120.532895] vhost_scsi got command opcode: 0x28, lun: 0 [ 3120.532897] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.532898] Mapping 1 iovecs for 1 pages [ 3120.532901] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.532906] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3123.852940] vhost_scsi_ctl_handle_kick: The handling func for control queue. [ 3123.853694] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3123.853696] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f2e6c53ac, len: 51 [ 3123.853697] target=0, tpg= (null) [ 3123.853698] send bad target head=0, out=1 [ 3123.853700] vhost_get_vq_desc: head: 128, out: 1 in: 2
Quoted 314 lines
Thanks,
Baiqing.Quoted 312 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 4:09 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleQuoted 10 lines · Asias He
Quoted 9 lines · Libaiqing
Hi Asias,
Quoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 5:39 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleQuoted 3 lines · Libaiqing
Hi Asias,
Thanks for your config.
According to you config,I test booting from vhost device withQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
upstream kernel and qemu,but failed.
Quoted 6 lines
1 installing guest from cdrom,ok.
2 booting vhost-scsi,guest fs error occurs.
3 using fileio backstores,the error is same..
4 rebooting guest,a log printed:
(qemu) hw/scsi/virtio-scsi.c:533:virtio_scsi_handle_event:Object
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
0x7fccae7f2c88is not an instance of type virtio-scsi-devicePaolo, I remember you fixed a similar issue?
Quoted 3 lines
5 using upstream seabios,core dumped.
Could you give me some advise to debug this problem ? I can
provide
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
more information if need.
Can you show me qemu commit id you used? Can you verity that if
using the
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
host kernel for guest helps? Does booting directly (without the install and reboot process) work?
Qemu commit id is "commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427".Quoted 9 lines
Quoted 4 lines
Guest kernel updateing is useless.
Booting directly doesn't work too.
Hello Libaiqing,
Sorry for the delay. I will try to reproduce it myself.
I tried 1.5.1 and qemu.git/master and your particular commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427.All work well for me. I used 3.10.0-rc6 as both and guest kernel.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The qemu cmd:
[root@fedora121 x86_64-softmmu]# ./qemu-system-x86_64-enable-kvm
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
-name fedora -M pc -m 1024 -smp 2 -drive
file=/home/fedora18.iso,if=ide,media=cdrom -device
vhost-scsi-pci,wwpn=naa.50014057133e25dc -monitor stdio -vgaqxl
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
-vnc :1
Quoted 3 lines
The vnc output:
Dracut-initqueue[189]:/dev/mapper/fedora-root:UNEXPECTEDINCONSISTENCY;RUN FSCK MANUALLY.
Quoted 2 lines
Dracut-initqueue[189]: Warning: e2fsck returned with 4 Dracut-initqueue[189]: Warning: ***An error occurred during the file
system check.
Quoted 19 lines
The guest kernel log:
Kernel: virtio-pci 0000:00:04.0: irq 40 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 41 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 42 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 43 for MSI/MSI-X
Kernel: scsi2 : Virtio SCSI HBA
Kernel: scsi 2:0:1:0: Direct-Access LIO-ORG r0
Kernel: sd 2:0:1:0: Attached scsi generic sg1 type 0
Kernel: sd 2:0:1:0: [sda]1258912 512-byte logical .....
Kernel: sd 2:0:1:0: [sda]write protect is off
Kernel: sd 2:0:1:0: [sda]Mode sense :43 00 00 08
Kernel: sd 2:0:1:0: [sda]write cache: disabled, read .....
Kernel: sda sda1 sda2
Kernel: sd 2:0:1:0: [sda] Attached SCSI disk Dracut-initqueue[189]: Scanning devices sda2 for LVM Dracut-initqueue[189]: inactive '/dev/fedora/swap'... Dracut-initqueue[189]: inactive '/dev/fedora/root'...Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The info of host:
[root@fedora121 x86_64-softmmu]# uname -a
Linux fedora121 3.10.0-rc6 #1 SMP Wed Jun 19 19:34:24 CST 2013
x86_64Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
x86_64x86_64GNU/LinuxQuoted 3 lines
[root@fedora121 x86_64-softmmu]# lsmod |grep
vhost_scsivhost_scsi49456 5target_core_mod282163 14target_core_iblock,target_core_pscsi,iscsi_target_mod,target_core_file,vh
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
ost_scsiQuoted 7 lines
[root@fedora121 x86_64-softmmu]# targetcli targetcli shell version v2.1.fb26
Copyright 2011 by RisingTide Systems LLC and others. For help on commands, type 'help'./> ls
o-/ ..............................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
........... [...]
Quoted 1 line
o-
backstores ...............................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
............... [...]
Quoted 1 line
| o-
block ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
fileio .................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
pscsi ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
ramdisk ................................................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
[Storage Objects: 1]
Quoted 1 line
| o-
r0 ................................................................................................... [(6.0GiB) activated]
Quoted 1 line
o-
iscsi .........................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
... [Targets: 0]
Quoted 1 line
o-
loopback ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
....... [Targets: 0]
Quoted 1 line
o-
vhost .......................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
..... [Targets: 1]
Quoted 1 line
o-naa.50014057133e25dc ............................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
.................. [TPGs: 1]
Quoted 1 line
o-tpg1 ............................................................................................... [naa.5001405a70ac3421]
Quoted 1 line
o-acls ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[ACLs: 0]
Quoted 1 line
o-luns ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[LUNs: 1]
Quoted 1 line
o-lun0 .....................................................................................................
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
[ramdisk/r0]
Quoted 10 lines
Regards,
baiqingQuoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 9:34 AM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
the
Quoted 3 lines
Quoted 3 lines
tcm_vhostLinux kernel moduleOn Wed, Jun 19, 2013 at 12:55:10PM +0000, Libaiqing wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed. Could you give me some advise to debug this problem ? I canprovide
Quoted 3 lines
Quoted 3 lines
more information if need.
Boot from vhost-scsi is supposed to work. The seabios you used
should
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
be
Quoted 3 lines
Quoted 3 lines
fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, Ireally
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
recommend using targetcli utils.
Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need
upstream
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hope this helps.
Quoted 6 lines
Regards,
baiqingQuoted 3 lines
-----Original Message-----
From: [email protected][mailto:[email protected]]
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
On
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected];Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 1 line
Quoted 1 line
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device
vhost-scsi-pci".
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The tgpt field of the
SET_ENDPOINTioctl is obsolete now,so it is
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
not
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
available from the QEMU command-line. Instead, I
hardcode it
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
zero.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs,before
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
invoking qemu with the WWPN number?
Unfortunately no, but vhost-scsi doesn't have many knobs
(unlike
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' >
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0 cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/lun/lun_0/virtual_scsi_port
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
echo naa.60014053226f0388 > nexus
The "nexus" value is the initiator WWN.
naa.600140554cf3a18e is
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
the
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
--
Asias--
Asias--
Asias--
Asias
Signature · 1 line
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Hi Asias,
Windows driver should be able to support as many logical units and targets as reported by QEMU. In case of VIRTIO_SCSI_S_BAD_TARGET it will just propagate the relevant SRB error code to the port driver.
In any case, I will try reproducing this problem on my system.
Best,
Vadim.
----- Original Message -----
From: "Asias He" <[email protected]>
To: "Libaiqing" <[email protected]>
Cc: "Paolo Bonzini" <[email protected]>, "Wenchao Xia" <[email protected]>, [email protected], [email protected], "Michael S. Tsirkin" <[email protected]>, "Haofeng" <[email protected]>, "Vadim Rozenfeld" <[email protected]>, "Yan Vugenfirer" <[email protected]>
Sent: Friday, July 5, 2013 4:52:05 PM
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
[CCing Vadim and Yan]
Quoted 5 lines · Libaiqing
Hi asias,
1 Window can not boot from vhost-scsi device;
2 A non-bootable vhost-scsi device can not be driven by windows guest.(I used the driver virtio-win-0.1-59 version.)Do you have any plan about these?
I can reproduce this issue on win2003 (Linux guest works fine). The guest hangs in the boot process. OS is on virito-blk disk, vhost-scsi is attached as the second disk.
Guest probes from target 0 to 255. Only target 1 is available. vhost-scsi sends VIRTIO_SCSI_S_BAD_TARGET back to target 0 and 255 except tareget 1. Howerver, from the log we can see, guest is sending to target 0 again and hangs afterwards.
Vadim and Yan, any ideas?
[ 3109.954237] br0: port 2(tap0) entered disabled state [ 3109.954387] device tap0 left promiscuous mode [ 3109.954389] br0: port 2(tap0) entered disabled state [ 3119.534136] device tap0 entered promiscuous mode [ 3119.534169] br0: port 2(tap0) entered forwarding state [ 3119.534180] br0: port 2(tap0) entered forwarding state [ 3120.138334] vhost_scsi_ctl_handle_kick: The handling func for control queue. [ 3120.138666] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.138669] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.138671] target=0, tpg= (null) [ 3120.138672] send bad target head=0, out=1 [ 3120.138673] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139219] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139221] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.139223] target=1, tpg=ffff88021f8fc800 [ 3120.139225] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 36, data_direction: 2 [ 3120.139226] vhost_scsi got command opcode: 0x12, lun: 0 [ 3120.139228] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.139229] Mapping 1 iovecs for 1 pages [ 3120.139233] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139261] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.139470] vhost_get_vq_desc: head: 0, out: 1 in: 1 [ 3120.139472] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006bd9, len: 51 [ 3120.139474] target=1, tpg=ffff88021f8fc800 [ 3120.139475] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 0, data_direction: 3 [ 3120.139476] vhost_scsi got command opcode: 0x0, lun: 0 [ 3120.139480] vhost_get_vq_desc: head: 128, out: 1 in: 1 [ 3120.139487] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.139554] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139557] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.139558] target=1, tpg=ffff88021f8fc800 [ 3120.139560] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 8, data_direction: 2 [ 3120.139561] vhost_scsi got command opcode: 0x25, lun: 0 [ 3120.139563] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.139564] Mapping 1 iovecs for 1 pages [ 3120.139568] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139575] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.139783] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139785] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.139787] target=2, tpg= (null) [ 3120.139788] send bad target head=0, out=1 [ 3120.139789] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139938] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139940] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51
...
[ 3120.170209] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.170304] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.170305] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.170306] target=255, tpg= (null) [ 3120.170306] send bad target head=0, out=1 [ 3120.170307] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.474648] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.474652] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f280efe85, len: 51 [ 3120.474654] target=1, tpg=ffff88021f8fc800 [ 3120.474656] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 512, data_direction: 2 [ 3120.474658] vhost_scsi got command opcode: 0x28, lun: 0 [ 3120.474660] vhost_scsi_map_iov_to_sgl sg ffff880208f70d40 sgl_count 2 is_err 0 [ 3120.474662] Mapping 1 iovecs for 2 pages [ 3120.474666] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.474680] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.532843] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.532845] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f280efe85, len: 51 [ 3120.532847] target=1, tpg=ffff88021f8fc800 [ 3120.532848] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 512, data_direction: 2 [ 3120.532850] vhost_scsi got command opcode: 0x28, lun: 0 [ 3120.532852] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.532853] Mapping 1 iovecs for 1 pages [ 3120.532857] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.532863] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.532889] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.532891] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f280efe85, len: 51 [ 3120.532892] target=1, tpg=ffff88021f8fc800 [ 3120.532894] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 512, data_direction: 2 [ 3120.532895] vhost_scsi got command opcode: 0x28, lun: 0 [ 3120.532897] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.532898] Mapping 1 iovecs for 1 pages [ 3120.532901] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.532906] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3123.852940] vhost_scsi_ctl_handle_kick: The handling func for control queue. [ 3123.853694] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3123.853696] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f2e6c53ac, len: 51 [ 3123.853697] target=0, tpg= (null) [ 3123.853698] send bad target head=0, out=1 [ 3123.853700] vhost_get_vq_desc: head: 128, out: 1 in: 2
Quoted 314 lines
Thanks,
Baiqing.Quoted 312 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 4:09 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleQuoted 10 lines · Asias He
Quoted 9 lines · Libaiqing
Hi Asias,
Quoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 5:39 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleQuoted 3 lines · Libaiqing
Hi Asias,
Thanks for your config.
According to you config,I test booting from vhost device withQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
upstream kernel and qemu,but failed.
Quoted 6 lines
1 installing guest from cdrom,ok.
2 booting vhost-scsi,guest fs error occurs.
3 using fileio backstores,the error is same..
4 rebooting guest,a log printed:
(qemu) hw/scsi/virtio-scsi.c:533:virtio_scsi_handle_event:Object
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
0x7fccae7f2c88is not an instance of type virtio-scsi-devicePaolo, I remember you fixed a similar issue?
Quoted 3 lines
5 using upstream seabios,core dumped.
Could you give me some advise to debug this problem ? I can
provide
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
more information if need.
Can you show me qemu commit id you used? Can you verity that if
using the
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
host kernel for guest helps? Does booting directly (without the install and reboot process) work?
Qemu commit id is "commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427".Quoted 9 lines
Quoted 4 lines
Guest kernel updateing is useless.
Booting directly doesn't work too.
Hello Libaiqing,
Sorry for the delay. I will try to reproduce it myself.
I tried 1.5.1 and qemu.git/master and your particular commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427.All work well for me. I used 3.10.0-rc6 as both and guest kernel.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The qemu cmd:
[root@fedora121 x86_64-softmmu]# ./qemu-system-x86_64-enable-kvm
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
-name fedora -M pc -m 1024 -smp 2 -drive
file=/home/fedora18.iso,if=ide,media=cdrom -device
vhost-scsi-pci,wwpn=naa.50014057133e25dc -monitor stdio -vgaqxl
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
-vnc :1
Quoted 3 lines
The vnc output:
Dracut-initqueue[189]:/dev/mapper/fedora-root:UNEXPECTEDINCONSISTENCY;RUN FSCK MANUALLY.
Quoted 2 lines
Dracut-initqueue[189]: Warning: e2fsck returned with 4 Dracut-initqueue[189]: Warning: ***An error occurred during the file
system check.
Quoted 19 lines
The guest kernel log:
Kernel: virtio-pci 0000:00:04.0: irq 40 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 41 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 42 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 43 for MSI/MSI-X
Kernel: scsi2 : Virtio SCSI HBA
Kernel: scsi 2:0:1:0: Direct-Access LIO-ORG r0
Kernel: sd 2:0:1:0: Attached scsi generic sg1 type 0
Kernel: sd 2:0:1:0: [sda]1258912 512-byte logical .....
Kernel: sd 2:0:1:0: [sda]write protect is off
Kernel: sd 2:0:1:0: [sda]Mode sense :43 00 00 08
Kernel: sd 2:0:1:0: [sda]write cache: disabled, read .....
Kernel: sda sda1 sda2
Kernel: sd 2:0:1:0: [sda] Attached SCSI disk Dracut-initqueue[189]: Scanning devices sda2 for LVM Dracut-initqueue[189]: inactive '/dev/fedora/swap'... Dracut-initqueue[189]: inactive '/dev/fedora/root'...Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The info of host:
[root@fedora121 x86_64-softmmu]# uname -a
Linux fedora121 3.10.0-rc6 #1 SMP Wed Jun 19 19:34:24 CST 2013
x86_64Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
x86_64x86_64GNU/LinuxQuoted 3 lines
[root@fedora121 x86_64-softmmu]# lsmod |grep
vhost_scsivhost_scsi49456 5target_core_mod282163 14target_core_iblock,target_core_pscsi,iscsi_target_mod,target_core_file,vh
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
ost_scsiQuoted 7 lines
[root@fedora121 x86_64-softmmu]# targetcli targetcli shell version v2.1.fb26
Copyright 2011 by RisingTide Systems LLC and others. For help on commands, type 'help'./> ls
o-/ ..............................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
........... [...]
Quoted 1 line
o-
backstores ...............................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
............... [...]
Quoted 1 line
| o-
block ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
fileio .................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
pscsi ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
ramdisk ................................................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
[Storage Objects: 1]
Quoted 1 line
| o-
r0 ................................................................................................... [(6.0GiB) activated]
Quoted 1 line
o-
iscsi .........................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
... [Targets: 0]
Quoted 1 line
o-
loopback ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
....... [Targets: 0]
Quoted 1 line
o-
vhost .......................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
..... [Targets: 1]
Quoted 1 line
o-naa.50014057133e25dc ............................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
.................. [TPGs: 1]
Quoted 1 line
o-tpg1 ............................................................................................... [naa.5001405a70ac3421]
Quoted 1 line
o-acls ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[ACLs: 0]
Quoted 1 line
o-luns ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[LUNs: 1]
Quoted 1 line
o-lun0 .....................................................................................................
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
[ramdisk/r0]
Quoted 10 lines
Regards,
baiqingQuoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 9:34 AM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
the
Quoted 3 lines
Quoted 3 lines
tcm_vhostLinux kernel moduleOn Wed, Jun 19, 2013 at 12:55:10PM +0000, Libaiqing wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed. Could you give me some advise to debug this problem ? I canprovide
Quoted 3 lines
Quoted 3 lines
more information if need.
Boot from vhost-scsi is supposed to work. The seabios you used
should
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
be
Quoted 3 lines
Quoted 3 lines
fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, Ireally
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
recommend using targetcli utils.
Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need
upstream
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hope this helps.
Quoted 6 lines
Regards,
baiqingQuoted 3 lines
-----Original Message-----
From: [email protected][mailto:[email protected]]
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
On
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected];Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 1 line
Quoted 1 line
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device
vhost-scsi-pci".
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The tgpt field of the
SET_ENDPOINTioctl is obsolete now,so it is
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
not
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
available from the QEMU command-line. Instead, I
hardcode it
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
zero.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs,before
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
invoking qemu with the WWPN number?
Unfortunately no, but vhost-scsi doesn't have many knobs
(unlike
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' >
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0 cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/lun/lun_0/virtual_scsi_port
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
echo naa.60014053226f0388 > nexus
The "nexus" value is the initiator WWN.
naa.600140554cf3a18e is
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
the
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
--
Asias--
Asias--
Asias--
Asias
Signature · 1 line
Asias
Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Quoted 6 lines · Vadim Rozenfeld
Hi Asias,
Windows driver should be able to support as many logical units and targets as reported by QEMU. In case of
VIRTIO_SCSI_S_BAD_TARGETit will just propagate the relevant SRB error code to the port driver.
In any case, I will try reproducing this problem on my system.
Thanks, let me know if you have issue to setup the vhost-scsi environment. In the other mail of this thread, I wrote a howto to setup up vhost-scsi in RHEL6.
Quoted 434 lines
Best,
Vadim.----- Original Message -----
From: "Asias He" <[email protected]>
To: "Libaiqing" <[email protected]>
Cc: "Paolo Bonzini" <[email protected]>, "Wenchao Xia" <[email protected]>, [email protected], [email protected], "Michael S. Tsirkin" <[email protected]>, "Haofeng" <[email protected]>, "Vadim Rozenfeld" <[email protected]>, "Yan Vugenfirer" <[email protected]>
Sent: Friday, July 5, 2013 4:52:05 PM
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel module[CCing Vadim and Yan]
Quoted 5 lines · Libaiqing
Hi asias,
1 Window can not boot from vhost-scsi device;
2 A non-bootable vhost-scsi device can not be driven by windows guest.(I used the driver virtio-win-0.1-59 version.)Do you have any plan about these?
I can reproduce this issue on win2003 (Linux guest works fine). The guest hangs in the boot process. OS is on virito-blk disk, vhost-scsi is attached as the second disk.
Guest probes from target 0 to 255. Only target 1 is available. vhost-scsi sends
VIRTIO_SCSI_S_BAD_TARGETback to target 0 and 255 except tareget 1. Howerver, from the log we can see, guest is sending to target 0 again and hangs afterwards.Vadim and Yan, any ideas?
[ 3109.954237] br0: port 2(tap0) entered disabled state [ 3109.954387] device tap0 left promiscuous mode [ 3109.954389] br0: port 2(tap0) entered disabled state [ 3119.534136] device tap0 entered promiscuous mode [ 3119.534169] br0: port 2(tap0) entered forwarding state [ 3119.534180] br0: port 2(tap0) entered forwarding state [ 3120.138334] vhost_scsi_ctl_handle_kick: The handling func for control queue. [ 3120.138666] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.138669] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.138671] target=0, tpg= (null) [ 3120.138672] send bad target head=0, out=1 [ 3120.138673] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139219] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139221] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.139223] target=1, tpg=ffff88021f8fc800 [ 3120.139225] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 36, data_direction: 2 [ 3120.139226] vhost_scsi got command opcode: 0x12, lun: 0 [ 3120.139228] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.139229] Mapping 1 iovecs for 1 pages [ 3120.139233] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139261] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.139470] vhost_get_vq_desc: head: 0, out: 1 in: 1 [ 3120.139472] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006bd9, len: 51 [ 3120.139474] target=1, tpg=ffff88021f8fc800 [ 3120.139475] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 0, data_direction: 3 [ 3120.139476] vhost_scsi got command opcode: 0x0, lun: 0 [ 3120.139480] vhost_get_vq_desc: head: 128, out: 1 in: 1 [ 3120.139487] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.139554] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139557] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.139558] target=1, tpg=ffff88021f8fc800 [ 3120.139560] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 8, data_direction: 2 [ 3120.139561] vhost_scsi got command opcode: 0x25, lun: 0 [ 3120.139563] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.139564] Mapping 1 iovecs for 1 pages [ 3120.139568] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139575] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.139783] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139785] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.139787] target=2, tpg= (null) [ 3120.139788] send bad target head=0, out=1 [ 3120.139789] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.139938] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.139940] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51...
[ 3120.170209] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.170304] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.170305] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f28006c15, len: 51 [ 3120.170306] target=255, tpg= (null) [ 3120.170306] send bad target head=0, out=1 [ 3120.170307] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.474648] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.474652] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f280efe85, len: 51 [ 3120.474654] target=1, tpg=ffff88021f8fc800 [ 3120.474656] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 512, data_direction: 2 [ 3120.474658] vhost_scsi got command opcode: 0x28, lun: 0 [ 3120.474660] vhost_scsi_map_iov_to_sgl sg ffff880208f70d40 sgl_count 2 is_err 0 [ 3120.474662] Mapping 1 iovecs for 2 pages [ 3120.474666] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.474680] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.532843] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.532845] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f280efe85, len: 51 [ 3120.532847] target=1, tpg=ffff88021f8fc800 [ 3120.532848] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 512, data_direction: 2 [ 3120.532850] vhost_scsi got command opcode: 0x28, lun: 0 [ 3120.532852] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.532853] Mapping 1 iovecs for 1 pages [ 3120.532857] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.532863] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3120.532889] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3120.532891] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f280efe85, len: 51 [ 3120.532892] target=1, tpg=ffff88021f8fc800 [ 3120.532894] Allocated tv_cmd: ffff880223cbf800 exp_data_len: 512, data_direction: 2 [ 3120.532895] vhost_scsi got command opcode: 0x28, lun: 0 [ 3120.532897] vhost_scsi_map_iov_to_sgl sg ffff8802242bde60 sgl_count 1 is_err 0 [ 3120.532898] Mapping 1 iovecs for 1 pages [ 3120.532901] vhost_get_vq_desc: head: 128, out: 1 in: 2 [ 3120.532906] vhost_scsi_complete_cmd_work tv_cmd ffff880223cbf800 resid 0 status 0x0 [ 3123.852940] vhost_scsi_ctl_handle_kick: The handling func for control queue. [ 3123.853694] vhost_get_vq_desc: head: 0, out: 1 in: 2 [ 3123.853696] Calling __copy_from_user: vq->iov[0].iov_base: 00007f8f2e6c53ac, len: 51 [ 3123.853697] target=0, tpg= (null) [ 3123.853698] send bad target head=0, out=1 [ 3123.853700] vhost_get_vq_desc: head: 128, out: 1 in: 2Quoted 314 lines
Thanks,
Baiqing.Quoted 312 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Wednesday, July 03, 2013 4:09 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new device supporting thetcm_vhostLinux kernel moduleQuoted 10 lines · Asias He
Quoted 9 lines · Libaiqing
Hi Asias,
Quoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 5:39 PM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleQuoted 3 lines · Libaiqing
Hi Asias,
Thanks for your config.
According to you config,I test booting from vhost device withQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
upstream kernel and qemu,but failed.
Quoted 6 lines
1 installing guest from cdrom,ok.
2 booting vhost-scsi,guest fs error occurs.
3 using fileio backstores,the error is same..
4 rebooting guest,a log printed:
(qemu) hw/scsi/virtio-scsi.c:533:virtio_scsi_handle_event:Object
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
0x7fccae7f2c88is not an instance of type virtio-scsi-devicePaolo, I remember you fixed a similar issue?
Quoted 3 lines
5 using upstream seabios,core dumped.
Could you give me some advise to debug this problem ? I can
provide
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
more information if need.
Can you show me qemu commit id you used? Can you verity that if
using the
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
host kernel for guest helps? Does booting directly (without the install and reboot process) work?
Qemu commit id is "commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427".Quoted 9 lines
Quoted 4 lines
Guest kernel updateing is useless.
Booting directly doesn't work too.
Hello Libaiqing,
Sorry for the delay. I will try to reproduce it myself.
I tried 1.5.1 and qemu.git/master and your particular commit
4eda32f588086b6cd0ec2be6a7a6c131f8c2b427.All work well for me. I used 3.10.0-rc6 as both and guest kernel.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The qemu cmd:
[root@fedora121 x86_64-softmmu]# ./qemu-system-x86_64-enable-kvm
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
-name fedora -M pc -m 1024 -smp 2 -drive
file=/home/fedora18.iso,if=ide,media=cdrom -device
vhost-scsi-pci,wwpn=naa.50014057133e25dc -monitor stdio -vgaqxl
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
-vnc :1
Quoted 3 lines
The vnc output:
Dracut-initqueue[189]:/dev/mapper/fedora-root:UNEXPECTEDINCONSISTENCY;RUN FSCK MANUALLY.
Quoted 2 lines
Dracut-initqueue[189]: Warning: e2fsck returned with 4 Dracut-initqueue[189]: Warning: ***An error occurred during the file
system check.
Quoted 19 lines
The guest kernel log:
Kernel: virtio-pci 0000:00:04.0: irq 40 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 41 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 42 for MSI/MSI-X
Kernel: virtio-pci 0000:00:04.0: irq 43 for MSI/MSI-X
Kernel: scsi2 : Virtio SCSI HBA
Kernel: scsi 2:0:1:0: Direct-Access LIO-ORG r0
Kernel: sd 2:0:1:0: Attached scsi generic sg1 type 0
Kernel: sd 2:0:1:0: [sda]1258912 512-byte logical .....
Kernel: sd 2:0:1:0: [sda]write protect is off
Kernel: sd 2:0:1:0: [sda]Mode sense :43 00 00 08
Kernel: sd 2:0:1:0: [sda]write cache: disabled, read .....
Kernel: sda sda1 sda2
Kernel: sd 2:0:1:0: [sda] Attached SCSI disk Dracut-initqueue[189]: Scanning devices sda2 for LVM Dracut-initqueue[189]: inactive '/dev/fedora/swap'... Dracut-initqueue[189]: inactive '/dev/fedora/root'...Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The info of host:
[root@fedora121 x86_64-softmmu]# uname -a
Linux fedora121 3.10.0-rc6 #1 SMP Wed Jun 19 19:34:24 CST 2013
x86_64Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
x86_64x86_64GNU/LinuxQuoted 3 lines
[root@fedora121 x86_64-softmmu]# lsmod |grep
vhost_scsivhost_scsi49456 5target_core_mod282163 14target_core_iblock,target_core_pscsi,iscsi_target_mod,target_core_file,vh
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
ost_scsiQuoted 7 lines
[root@fedora121 x86_64-softmmu]# targetcli targetcli shell version v2.1.fb26
Copyright 2011 by RisingTide Systems LLC and others. For help on commands, type 'help'./> ls
o-/ ..............................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
........... [...]
Quoted 1 line
o-
backstores ...............................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
............... [...]
Quoted 1 line
| o-
block ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
fileio .................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
pscsi ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[Storage Objects: 0]
Quoted 1 line
| o-
ramdisk ................................................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
[Storage Objects: 1]
Quoted 1 line
| o-
r0 ................................................................................................... [(6.0GiB) activated]
Quoted 1 line
o-
iscsi .........................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
... [Targets: 0]
Quoted 1 line
o-
loopback ..................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
....... [Targets: 0]
Quoted 1 line
o-
vhost .......................................................................................................
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
..... [Targets: 1]
Quoted 1 line
o-naa.50014057133e25dc ............................................................................
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
.................. [TPGs: 1]
Quoted 1 line
o-tpg1 ............................................................................................... [naa.5001405a70ac3421]
Quoted 1 line
o-acls ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[ACLs: 0]
Quoted 1 line
o-luns ......................................................................................................... .
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[LUNs: 1]
Quoted 1 line
o-lun0 .....................................................................................................
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
[ramdisk/r0]
Quoted 10 lines
Regards,
baiqingQuoted 7 lines
-----Original Message-----
From: Asias He [mailto:[email protected]]
Sent: Thursday, June 20, 2013 9:34 AM
To: Libaiqing
Cc: Paolo Bonzini; Wenchao Xia; [email protected]; [email protected]; Michael S. Tsirkin; Haofeng
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
the
Quoted 3 lines
Quoted 3 lines
tcm_vhostLinux kernel moduleOn Wed, Jun 19, 2013 at 12:55:10PM +0000, Libaiqing wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi paolo,
The vhost-scsi device can be used as boot device?
I tested with your config + 3.10 rc6 + seabios 1.7.2.2,but failed. Could you give me some advise to debug this problem ? I canprovide
Quoted 3 lines
Quoted 3 lines
more information if need.
Boot from vhost-scsi is supposed to work. The seabios you used
should
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
be
Quoted 3 lines
Quoted 3 lines
fine which contains the fixes for vhost-scsi.
Instead of playing with the
/sys/kernel/config/targetdirectly, Ireally
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
recommend using targetcli utils.
Nab, I think we really should write some docs for people to use vhost-scsi.
This is how I install and use targetcli in RHEL6. Note you need
upstream
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
kernel and qemu bits for vhost-scsi.
# yum groupinstall 'Development tools' # yum install python-devel epydoc python-simpleparse# git clone git://github.com/agrover/rtslib-fb.git # git clone git://github.com/agrover/targetcli-fb.git # git clone git://github.com/agrover/configshell-fb.git # for i in rtslib-fb configshell-fb targetcli-fb; do make -C $i rpm yum localinstall $i/dist/*.noarch.rpm doneIn targetcli, create a backstore and vhost wwpn, e.g.
# targetcli /> /backstores/ramdisk create r0 1g /> /vhost create /> cd /vhost/naa.500140527cb6616b/tpg1/luns /> create /backstores/ramdisk/r0# qemu -device vhost-scsi-pci,wwpn=naa.500140527cb6616b ...Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hope this helps.
Quoted 6 lines
Regards,
baiqingQuoted 3 lines
-----Original Message-----
From: [email protected][mailto:[email protected]]
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
On
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Behalf Of Paolo Bonzini
Sent: Tuesday, May 28, 2013 4:01 PM
To: Wenchao Xia
Cc: [email protected]; [email protected];Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH 6/9] vhost-scsi: new devicesupporting
Quoted 1 line
Quoted 1 line
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
tcm_vhostLinux kernel moduleIl 28/05/2013 09:13, Wenchao Xia ha scritto:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
From: Nicholas Bellinger <[email protected]>
The WWPN specified in configfs is passed to "-device
vhost-scsi-pci".
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The tgpt field of the SET_ENDPOINT ioctl is obsolete now,
so it is
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
not
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
available from the QEMU command-line. Instead, I
hardcode it
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
to
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
zero.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Hi, Paolo
Any document about how to config it correctly in configfs,before
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
invoking qemu with the WWPN number?
Unfortunately no, but vhost-scsi doesn't have many knobs
(unlike
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
iSCSI for example) so it's quite simple. Here is an example:
cd
/sys/kernel/config/target
mkdir -p core/fileio_0/fileio
echo'fd_dev_name=/home/pbonzini/test.img,fd_dev_size=5905580032' >
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
core/fileio_0/fileio/control
echo 1 > core/fileio_0/fileio/enable
mkdir -p vhost/naa.600140554cf3a18e/tpgt_0/lun/lun_0 cd vhost/naa.600140554cf3a18e/tpgt_0
ln -sf ../../../../../core/fileio_0/fileio/lun/lun_0/virtual_scsi_port
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
echo naa.60014053226f0388 > nexus
The "nexus" value is the initiator WWN.
naa.600140554cf3a18e is
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
the
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
target WWN that you have to pass to "-device vhost-scsi-pci".
Paolo
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
--
Asias--
Asias--
Asias--
AsiasSignature · 1 line
Asias
Signature · 1 line
Asias
PATCH 7/9 vhost-scsi-pci: new device supporting the tcm_vhost Linux kernel module
In reply to Paolo BonziniFrom: Nicholas Bellinger <[email protected]>
--- hw/virtio/virtio-pci.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.h | 18 +++++++++++++++ 2 files changed, 78 insertions(+)
hw/virtio/virtio-pci.c +60 -0
@@ -1285,6 +1285,63 @@ static const TypeInfo virtio_scsi_pci_info = { .class_init = virtio_scsi_pci_class_init, }; +/* vhost-scsi-pci */ + +#ifdef CONFIG_VHOST_SCSI +static Property vhost_scsi_pci_properties[] = { +DEFINE_PROP_UINT32 ("vectors" , VirtIOPCIProxy, nvectors, +DEV_NVECTORS_UNSPECIFIED ), +DEFINE_VIRTIO_COMMON_FEATURES (VirtIOPCIProxy, host_features), +DEFINE_VHOST_SCSI_PROPERTIES (VHostSCSIPCI, vdev.parent_obj.conf), +DEFINE_PROP_END_OF_LIST (), +}; + +static int vhost_scsi_pci_init_pci (VirtIOPCIProxy *vpci_dev) +{ +VHostSCSIPCI *dev =VHOST_SCSI_PCI (vpci_dev); +DeviceState *vdev =DEVICE (&dev->vdev); +VirtIOSCSICommon *vs =VIRTIO_SCSI_COMMON (vdev); + +if (vpci_dev->nvectors ==DEV_NVECTORS_UNSPECIFIED ) { + vpci_dev->nvectors = vs->conf.num_queues +3 ; + } + +qdev_set_parent_bus (vdev,BUS (&vpci_dev->bus)); +if (qdev_init (vdev) <0 ) { +return -1 ; + } +return 0 ; +} + +static void vhost_scsi_pci_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +VirtioPCIClass *k =VIRTIO_PCI_CLASS (klass); +PCIDeviceClass *pcidev_k =PCI_DEVICE_CLASS (klass); + k->init = vhost_scsi_pci_init_pci; + dc->props = vhost_scsi_pci_properties; + pcidev_k->vendor_id =PCI_VENDOR_ID_REDHAT_QUMRANET ; + pcidev_k->device_id =PCI_DEVICE_ID_VIRTIO_SCSI ; + pcidev_k->revision =0x00 ; + pcidev_k->class_id =PCI_CLASS_STORAGE_SCSI ; +} + +static void vhost_scsi_pci_instance_init (Object *obj) +{ +VHostSCSIPCI *dev =VHOST_SCSI_PCI (obj); +object_initialize (OBJECT (&dev->vdev),TYPE_VHOST_SCSI ); +object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +} + +static const TypeInfo vhost_scsi_pci_info = { + .name =TYPE_VHOST_SCSI_PCI , + .parent =TYPE_VIRTIO_PCI , + .instance_size =sizeof (VHostSCSIPCI), + .instance_init = vhost_scsi_pci_instance_init, + .class_init = vhost_scsi_pci_class_init, +}; +#endif +/* virtio-balloon-pci */ static void balloon_pci_stats_get_all(Object *obj, struct Visitor *v,
@@ -1541,6 +1598,9 @@ static void virtio_pci_register_types(void)type_register_static (&virtio_balloon_pci_info);type_register_static (&virtio_serial_pci_info);type_register_static (&virtio_net_pci_info); +#ifdef CONFIG_VHOST_SCSI +type_register_static (&vhost_scsi_pci_info); +#endif }type_init (virtio_pci_register_types)
hw/virtio/virtio-pci.h +18 -0
@@ -24,6 +24,9 @@#include "hw/virtio/virtio-balloon.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-9p.h" +#ifdef CONFIG_VHOST_SCSI +#include "hw/virtio/vhost-scsi.h" +#endif typedef struct VirtIOPCIProxy VirtIOPCIProxy ;typedef struct VirtIOBlkPCI VirtIOBlkPCI ;
@@ -31,6 +34,7 @@ typedef struct VirtIOSCSIPCI VirtIOSCSIPCI;typedef struct VirtIOBalloonPCI VirtIOBalloonPCI ;typedef struct VirtIOSerialPCI VirtIOSerialPCI ;typedef struct VirtIONetPCI VirtIONetPCI ; +typedef struct VHostSCSIPCI VHostSCSIPCI ;/* virtio-pci-bus */
@@ -104,6 +108,20 @@ struct VirtIOSCSIPCI {VirtIOSCSI vdev; }; +#ifdef CONFIG_VHOST_SCSI +/* +* vhost-scsi-pci: This extends VirtioPCIProxy. +*/ +#define TYPE_VHOST_SCSI_PCI "vhost-scsi-pci" +#define VHOST_SCSI_PCI (obj) \ + OBJECT_CHECK(VHostSCSIPCI, (obj), TYPE_VHOST_SCSI_PCI) + +struct VHostSCSIPCI { +VirtIOPCIProxy parent_obj; +VHostSCSI vdev; +}; +#endif +/* * virtio-blk-pci: This extends VirtioPCIProxy. */
Signature · 1 line
1.8.1.4
PATCH 8/9 vhost-scsi-ccw: new device supporting the tcm_vhost Linux kernel module
In reply to Paolo Bonzini--- hw/s390x/virtio-ccw.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ hw/s390x/virtio-ccw.h | 14 ++++++++++++++ 2 files changed, 65 insertions(+)
hw/s390x/virtio-ccw.c +51 -0
@@ -687,6 +687,28 @@ static void virtio_ccw_scsi_instance_init(Object *obj)object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); } +#ifdef CONFIG_VHOST_SCSI +static int vhost_ccw_scsi_init (VirtioCcwDevice *ccw_dev) +{ +VHostSCSICcw *dev =VHOST_SCSI_CCW (ccw_dev); +DeviceState *vdev =DEVICE (&dev->vdev); + +qdev_set_parent_bus (vdev,BUS (&ccw_dev->bus)); +if (qdev_init (vdev) <0 ) { +return -1 ; + } + +return virtio_ccw_device_init (ccw_dev,VIRTIO_DEVICE (vdev)); +} + +static void vhost_ccw_scsi_instance_init (Object *obj) +{ +VHostSCSICcw *dev =VHOST_SCSI_CCW (obj); +object_initialize (OBJECT (&dev->vdev),TYPE_VHOST_SCSI ); +object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +} +#endif +static int virtio_ccw_rng_init (VirtioCcwDevice *dev) {VirtIODevice *vdev;
@@ -897,6 +919,34 @@ static const TypeInfo virtio_ccw_scsi = { .class_init = virtio_ccw_scsi_class_init, }; +#ifdef CONFIG_VHOST_SCSI +static Property vhost_ccw_scsi_properties[] = { +DEFINE_PROP_STRING ("devno" , VirtioCcwDevice, bus_id), +DEFINE_VHOST_SCSI_PROPERTIES (VirtIOSCSICcw, vdev.parent_obj.conf), +DEFINE_VIRTIO_COMMON_FEATURES (VirtioCcwDevice, host_features[0 ]), +DEFINE_PROP_END_OF_LIST (), +}; + +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->exit = virtio_ccw_exit; + dc->reset = virtio_ccw_reset; + dc->props = vhost_ccw_scsi_properties; +} + +static const TypeInfo vhost_ccw_scsi = { + .name =TYPE_VHOST_SCSI_CCW , + .parent =TYPE_VIRTIO_CCW_DEVICE , + .instance_size =sizeof (VirtIOSCSICcw), + .instance_init = vhost_ccw_scsi_instance_init, + .class_init = vhost_ccw_scsi_class_init, +}; +#endif +static void virtio_ccw_rng_initfn (Object *obj) {VirtioCcwDevice *dev =VIRTIO_CCW_DEVICE (obj);
@@ -1054,6 +1104,7 @@ static void virtio_ccw_register(void)type_register_static (&virtio_ccw_net);type_register_static (&virtio_ccw_balloon);type_register_static (&virtio_ccw_scsi); +type_register_static (&vhost_ccw_scsi);type_register_static (&virtio_ccw_rng);type_register_static (&virtual_css_bridge_info); }
hw/s390x/virtio-ccw.h +14 -0
@@ -16,6 +16,9 @@#include <hw/virtio/virtio-net.h> #include <hw/virtio/virtio-serial.h> #include <hw/virtio/virtio-scsi.h> +#ifdef CONFIG_VHOST_SCSI +#include <hw/virtio/vhost-scsi.h> +#endif #include <hw/virtio/virtio-balloon.h> #include <hw/virtio/virtio-rng.h> #include <hw/virtio/virtio-bus.h>
@@ -101,6 +104,17 @@ typedef struct VirtIOSCSICcw {VirtIOSCSI vdev; } VirtIOSCSICcw; +/* vhost-scsi-ccw */ + +#define TYPE_VHOST_SCSI_CCW "vhost-scsi-ccw" +#define VHOST_SCSI_CCW (obj) \ + OBJECT_CHECK(VHostSCSICcw, (obj), TYPE_VHOST_SCSI_CCW) + +typedef struct VHostSCSICcw { +VirtioCcwDevice parent_obj; +VHostSCSI vdev; +}VHostSCSICcw ; +/* virtio-blk-ccw */ #define TYPE_VIRTIO_BLK_CCW "virtio-blk-ccw"
Signature · 1 line
1.8.1.4
PATCH 9/9 vhost-scsi-s390: new device supporting the tcm_vhost Linux kernel module
In reply to Paolo Bonzini--- hw/s390x/s390-virtio-bus.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++ hw/s390x/s390-virtio-bus.h | 16 +++++++++++++++ 2 files changed, 65 insertions(+)
hw/s390x/s390-virtio-bus.c +49 -0
@@ -28,6 +28,7 @@#include "hw/virtio/virtio-rng.h" #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-net.h" +#include "hw/virtio/vhost-scsi.h" #include "hw/sysbus.h" #include "sysemu/kvm.h"
@@ -239,6 +240,28 @@ static void s390_virtio_scsi_instance_init(Object *obj)object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); } +#ifdef CONFIG_VHOST_SCSI +static int s390_vhost_scsi_init (VirtIOS390Device *s390_dev) +{ +VHostSCSIS390 *dev =VHOST_SCSI_S390 (s390_dev); +DeviceState *vdev =DEVICE (&dev->vdev); + +qdev_set_parent_bus (vdev,BUS (&s390_dev->bus)); +if (qdev_init (vdev) <0 ) { +return -1 ; + } + +return s390_virtio_device_init (s390_dev,VIRTIO_DEVICE (vdev)); +} + +static void s390_vhost_scsi_instance_init (Object *obj) +{ +VHostSCSIS390 *dev =VHOST_SCSI_S390 (obj); +object_initialize (OBJECT (&dev->vdev),TYPE_VHOST_SCSI ); +object_property_add_child (obj,"virtio-backend" ,OBJECT (&dev->vdev),NULL ); +} +#endif +static int s390_virtio_rng_init (VirtIOS390Device *dev) {VirtIODevice *vdev;
@@ -582,6 +605,31 @@ static const TypeInfo s390_virtio_scsi = { .class_init = s390_virtio_scsi_class_init, }; +#ifdef CONFIG_VHOST_SCSI +static Property s390_vhost_scsi_properties[] = { +DEFINE_VIRTIO_COMMON_FEATURES (VirtIOS390Device, host_features), +DEFINE_VHOST_SCSI_PROPERTIES (VHostSCSIS390, vdev.parent_obj.conf), +DEFINE_PROP_END_OF_LIST (), +}; + +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; + dc->props = s390_vhost_scsi_properties; +} + +static const TypeInfo s390_vhost_scsi = { + .name =TYPE_VHOST_SCSI_S390 , + .parent =TYPE_VIRTIO_S390_DEVICE , + .instance_size =sizeof (VHostSCSIS390), + .instance_init = s390_vhost_scsi_instance_init, + .class_init = s390_vhost_scsi_class_init, +}; +#endif +/***************** S390 Virtio Bus Bridge Device *******************/ /* Only required to have the virtio bus as child in the system bus */
@@ -643,6 +691,7 @@ static void s390_virtio_register_types(void)type_register_static (&s390_virtio_blk);type_register_static (&s390_virtio_net);type_register_static (&s390_virtio_scsi); +type_register_static (&s390_vhost_scsi);type_register_static (&s390_virtio_rng);type_register_static (&s390_virtio_bridge_info); }
hw/s390x/s390-virtio-bus.h +16 -0
@@ -25,6 +25,9 @@#include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-scsi.h" #include "hw/virtio/virtio-bus.h" +#ifdef CONFIG_VHOST_SCSI +#include "hw/virtio/vhost-scsi.h" +#endif #define VIRTIO_DEV_OFFS_TYPE 0/* 8 bits */ #define VIRTIO_DEV_OFFS_NUM_VQ 1/* 8 bits */
@@ -160,4 +163,17 @@ typedef struct VirtIONetS390 { VirtIONet vdev; } VirtIONetS390; +/* vhost-scsi-s390 */ + +#ifdef CONFIG_VHOST_SCSI +#define TYPE_VHOST_SCSI_S390 "vhost-scsi-s390" +#define VHOST_SCSI_S390 (obj) \ + OBJECT_CHECK(VHostSCSIS390, (obj), TYPE_VHOST_SCSI_S390) + +typedef struct VHostSCSIS390 { +VirtIOS390Device parent_obj; +VHostSCSI vdev; +}VHostSCSIS390 ; +#endif +#endif
Signature · 1 line
1.8.1.4
Quoted 6 lines · Paolo Bonzini
The following changes since commit
09dada400328d75daf79e3eca1e48e024fec148d:configure: remove duplicate test (2013-04-18 14:12:31 +0200)
are available in the git repository at:
Quoted 8 lines
git://github.com/bonzini/qemu.gitscsi-nextfor you to fetch changes up to
d6e51919a7e3250bbfb4bb0ad0f208ab6fd688a4:vhost-scsi-s390: new device supporting the
tcm_vhostLinux kernel module (2013-04-19 16:19:13 +0200)The VMware PVSCSI implementation and vhost-scsi are finally getting in.
Hi Paolo & Co,
Thanks for all of the efforts to finally get the vhost-scsi series merged into upstream QEMU v1.5 code!
Also, just a reminder that pc-bios/bios.bin needs to be updated to include Asias's seabios.git commits below for this code to boot.
b44a7be17bdd270ea029a8e2ec0c2e80c6cd0444 virtio-scsi: Pack struct virtio_scsi_{req_cmd,resp_cmd} 5a7730db57ab0715223421e65b54fb50d6fefe5c virtio-scsi: Set _DRIVER_OK flag before scsi target scanning
I just tested with this afternoon's qemu.git and seabios.git HEADs, and both are functioning as expected.
Anthony + Gerd, can we expect an rev to pc-bios/bios.bin soon to pick up these seabios changes for vhost-scsi..?
Thanks,
--nab
Quoted 47 lines
Paolo
----------------------------------------------------------------
Dmitry Fleytman (1):
scsi: VMWare PVSCSI paravirtual device implementationNicholas Bellinger (3):
vhost: Addvhost_commitcallback for SeaBIOS ROM region re-mapping
vhost-scsi: new device supporting thetcm_vhostLinux kernel module
vhost-scsi-pci: new device supporting thetcm_vhostLinux kernel modulePaolo Bonzini (5):
scsi: avoid assertion failure on VERIFY command
virtio-scsi: create VirtIOSCSICommon
virtio: simplifyMakefileconditionals
vhost-scsi-ccw: new device supporting thetcm_vhostLinux kernel module
vhost-scsi-s390: new device supporting thetcm_vhostLinux kernel moduleconfigure | 10 + default-configs/pci.mak | 1 + docs/specs/vmw_pvscsi-spec.txt | 92 +++ hw/Makefile.objs | 2 +- hw/s390x/s390-virtio-bus.c | 51 +- hw/s390x/s390-virtio-bus.h | 16 + hw/s390x/virtio-ccw.c | 53 +- hw/s390x/virtio-ccw.h | 14 + hw/scsi/Makefile.objs | 7 +- hw/scsi/scsi-disk.c | 19 +- hw/scsi/vhost-scsi.c | 288 ++++++++++ hw/scsi/virtio-scsi.c | 212 +++---- hw/scsi/vmw_pvscsi.c | 1216 +++++++++++++++++++++++++++++++++++++++ hw/scsi/vmw_pvscsi.h | 434 ++++++++++++++ hw/virtio/Makefile.objs | 8 +- hw/virtio/vhost.c | 53 +- hw/virtio/virtio-pci.c | 65 ++- hw/virtio/virtio-pci.h | 18 + include/hw/pci/pci.h | 1 + include/hw/virtio/vhost-scsi.h | 73 +++ include/hw/virtio/vhost.h | 3 + include/hw/virtio/virtio-scsi.h | 135 ++++- include/qemu/osdep.h | 4 + trace-events | 35 ++ 24 files changed, 2636 insertions(+), 174 deletions(-) create mode 100644 docs/specs/vmw_pvscsi-spec.txt create mode 100644 hw/scsi/vhost-scsi.c create mode 100644 hw/scsi/vmw_pvscsi.c create mode 100644 hw/scsi/vmw_pvscsi.h create mode 100644 include/hw/virtio/vhost-scsi.h
[Qemu-devel] seabios for qemu 1.5
Hi,
Quoted 5 lines
b44a7be17bdd270ea029a8e2ec0c2e80c6cd0444virtio-scsi: Pack struct virtio_scsi_{req_cmd,resp_cmd}5a7730db57ab0715223421e65b54fb50d6fefe5cvirtio-scsi: Set_DRIVER_OKflag before scsi target scanningAnthony + Gerd, can we expect an rev to pc-bios/bios.bin soon to pick up these seabios changes for vhost-scsi..?
I don't feel like placing a seabios git snapshot into qemu.
I think we should just cherry-pick everything we need for qemu 1.5 into the 1.7.2-stable branch, roll out a 1.7.2.2 release and put that into qemu 1.5.
So, what will be needed?
(1) The two commits listed above.
(2) The patch for the pvpanic device (assuming it gets
merged for 1.5).
Anything else?
Hard freeze for qemu 1.5 is next Wednesday.
cheers,
Gerd
PS: For qemu 1.6 (which will hopefully include the acpi table
reorganization) we will need a new release from the master branch and thus a bit more careful release planning.
Re: [Qemu-devel] seabios for qemu 1.5
Quoted 14 lines · Gerd Hoffmann
Hi,
Quoted 5 lines
b44a7be17bdd270ea029a8e2ec0c2e80c6cd0444virtio-scsi: Pack struct virtio_scsi_{req_cmd,resp_cmd}5a7730db57ab0715223421e65b54fb50d6fefe5cvirtio-scsi: Set_DRIVER_OKflag before scsi target scanningAnthony + Gerd, can we expect an rev to pc-bios/bios.bin soon to pick up these seabios changes for vhost-scsi..?
I don't feel like placing a seabios git snapshot into qemu.
I think we should just cherry-pick everything we need for qemu 1.5 into the 1.7.2-stable branch, roll out a 1.7.2.2 release and put that into qemu 1.5.
Quoted 7 lines
So, what will be needed?
(1) The two commits listed above.
(2) The patch for the pvpanic device (assuming it getsmerged for 1.5).Anything else?
Hi Gerd,
This bug fix is needed:
| commit 11a7234491cb2a027b0fa5e82af38a3e78b44c80 | Author: Kevin O'Connor <[email protected]> | Date: Tue Mar 5 17:52:21 2013 +0800 | | Cache boot-fail-wait to avoid romfile access after POST. | | Memory allocated with malloc_tmp() can't be used after the POST phase. | So, access boot-fail-wait in post phase and store it for the boot | phase to use. This fixes the regression introduced by commit | 59d6ca52.
Quoted 9 lines
Hard freeze for qemu 1.5 is next Wednesday.
cheers,
GerdPS: For qemu 1.6 (which will hopefully include the acpi table
reorganization) we will need a new release from the master branch and thus a bit more careful release planning.
Signature · 1 line
Amos.
Re: [Qemu-devel] seabios for qemu 1.5
Quoted 27 lines · Amos Kong
Quoted 14 lines · Gerd Hoffmann
Hi,
Quoted 5 lines
b44a7be17bdd270ea029a8e2ec0c2e80c6cd0444virtio-scsi: Pack struct virtio_scsi_{req_cmd,resp_cmd}5a7730db57ab0715223421e65b54fb50d6fefe5cvirtio-scsi: Set_DRIVER_OKflag before scsi target scanningAnthony + Gerd, can we expect an rev to pc-bios/bios.bin soon to pick up these seabios changes for vhost-scsi..?
I don't feel like placing a seabios git snapshot into qemu.
I think we should just cherry-pick everything we need for qemu 1.5 into the 1.7.2-stable branch, roll out a 1.7.2.2 release and put that into qemu 1.5.
Quoted 7 lines
So, what will be needed?
(1) The two commits listed above.
(2) The patch for the pvpanic device (assuming it getsmerged for 1.5).Anything else?
Hi Gerd,
This bug fix is needed:
Quoted 10 lines
| commit 11a7234491cb2a027b0fa5e82af38a3e78b44c80 | Author: Kevin O'Connor <[email protected]> | Date: Tue Mar 5 17:52:21 2013 +0800 | | Cache boot-fail-wait to avoid romfile access after POST. | | Memory allocated with malloc_tmp() can't be used after the POST phase. | So, access boot-fail-wait in post phase and store it for the boot | phase to use. This fixes the regression introduced by commit | 59d6ca52.
This patch doesn't contain in seabios-1.7.2.1, it wasn't contained in latest bios.bin of qemu, it caused 'strict boot' doesn't work.
# qemu -boot strict=on
What can we do for this? push Kevin add this patch in stable branch and re-built bios.bin?
Quoted 8 lines
Quoted 8 lines
Hard freeze for qemu 1.5 is next Wednesday.
cheers,
GerdPS: For qemu 1.6 (which will hopefully include the acpi table
reorganization) we will need a new release from the master branch and thus a bit more careful release planning.
Signature · 1 line
Amos.
Re: [Qemu-devel] seabios for qemu 1.5
Hi,
Quoted 12 lines
Quoted 10 lines
| commit 11a7234491cb2a027b0fa5e82af38a3e78b44c80 | Author: Kevin O'Connor <[email protected]> | Date: Tue Mar 5 17:52:21 2013 +0800 | | Cache boot-fail-wait to avoid romfile access after POST. | | Memory allocated with malloc_tmp() can't be used after the POST phase. | So, access boot-fail-wait in post phase and store it for the boot | phase to use. This fixes the regression introduced by commit | 59d6ca52.
Quoted 7 lines
This patch doesn't contain in seabios-1.7.2.1, it wasn't contained in latest bios.bin of qemu, it caused 'strict boot' doesn't work.
# qemu -boot strict=onWhat can we do for this? push Kevin add this patch in stable branch and re-built bios.bin?
It's in the 1.7.2-stable branch meanwhile. 1.7.2.2 isn't tagged yet though. It's going slower than usual, seems Kevin is a bit busy with non-seabios things these days.
Once we have a release released I'll put updates into master and the stable-1.5 branch.
cheers,
Gerd
Re: [Qemu-devel] seabios for qemu 1.5
In reply to Gerd HoffmannIl 24/04/2013 07:59, Gerd Hoffmann ha scritto:
Quoted 16 lines
Hi,
Quoted 5 lines
b44a7be17bdd270ea029a8e2ec0c2e80c6cd0444virtio-scsi: Pack struct virtio_scsi_{req_cmd,resp_cmd}5a7730db57ab0715223421e65b54fb50d6fefe5cvirtio-scsi: Set_DRIVER_OKflag before scsi target scanningAnthony + Gerd, can we expect an rev to pc-bios/bios.bin soon to pick up these seabios changes for vhost-scsi..?
I don't feel like placing a seabios git snapshot into qemu.
I think we should just cherry-pick everything we need for qemu 1.5 into the 1.7.2-stable branch, roll out a 1.7.2.2 release and put that into qemu 1.5.
So, what will be needed?
Quoted 7 lines
(1) The two commits listed above.
(2) The patch for the pvpanic device (assuming it getsmerged for 1.5).Anything else?
Hard freeze for qemu 1.5 is next Wednesday.
It's just a few patches, so we can do it in -rc1 too.
Paolo
Quoted 7 lines
cheers,
GerdPS: For qemu 1.6 (which will hopefully include the acpi table
reorganization) we will need a new release from the master branch and thus a bit more careful release planning.
Am 19.04.2013 16:24, schrieb Paolo Bonzini:
Quoted 24 lines
The following changes since commit
09dada400328d75daf79e3eca1e48e024fec148d:configure: remove duplicate test (2013-04-18 14:12:31 +0200)
are available in the git repository at:
git://github.com/bonzini/qemu.gitscsi-nextfor you to fetch changes up to
d6e51919a7e3250bbfb4bb0ad0f208ab6fd688a4:vhost-scsi-s390: new device supporting the
tcm_vhostLinux kernel module (2013-04-19 16:19:13 +0200)The VMware PVSCSI implementation and vhost-scsi are finally getting in.
Paolo
----------------------------------------------------------------
Dmitry Fleytman (1):
scsi: VMWare PVSCSI paravirtual device implementationNicholas Bellinger (3):
vhost: Addvhost_commitcallback for SeaBIOS ROM region re-mapping
vhost-scsi: new device supporting thetcm_vhostLinux kernel module
vhost-scsi-pci: new device supporting thetcm_vhostLinux kernel module
Quoted 7 lines
Paolo Bonzini (5):
scsi: avoid assertion failure on VERIFY command
virtio-scsi: create VirtIOSCSICommon
virtio: simplifyMakefileconditionals
vhost-scsi-ccw: new device supporting thetcm_vhostLinux kernel module
vhost-scsi-s390: new device supporting thetcm_vhostLinux kernel module
Hi Paolo,
the latest QEMU build is broken when CONFIG_VHOST_SCSI is undefined.
Regards,
Stefan
Il 24/04/2013 06:56, Stefan Weil ha scritto:
Quoted 3 lines
Hi Paolo,
the latest QEMU build is broken when
CONFIG_VHOST_SCSIis undefined.
--verbose, please. :)
$ ../configure --disable-vhost-scsi $ grep VHOST_SC */config-* config-* $
works here.
Paolo
Am 24.04.2013 10:19, schrieb Paolo Bonzini:
Quoted 4 lines
Il 24/04/2013 06:56, Stefan Weil ha scritto:
Quoted 2 lines
Hi Paolo, the latest QEMU build is broken when
CONFIG_VHOST_SCSIis undefined.--verbose, please. :)
Sorry, I thought it was obvious. The error occurs in a cross build for w64 when building s390x-softmmu.
Regards,
Stefan
$ make -C bin/debug/amd64-mingw32msvc -k make: Entering directory `/qemu/bin/debug/amd64-mingw32msvc' CC s390x-softmmu/hw/s390x/s390-virtio-bus.o /qemu/hw/s390x/s390-virtio-bus.c: In function 's390_virtio_register_types': /qemu/hw/s390x/s390-virtio-bus.c:694: error: 's390_vhost_scsi' undeclared (first use in this function) /qemu/hw/s390x/s390-virtio-bus.c:694: error: (Each undeclared identifier is reported only once /qemu/hw/s390x/s390-virtio-bus.c:694: error: for each function it appears in.) make[1]: *** [hw/s390x/s390-virtio-bus.o] Fehler 1 CC s390x-softmmu/hw/s390x/s390-virtio-ccw.o In file included from /qemu/hw/s390x/s390-virtio-ccw.c:18: /qemu/hw/s390x/virtio-ccw.h:115: error: expected specifier-qualifier-list before 'VHostSCSI' make[1]: *** [hw/s390x/s390-virtio-ccw.o] Fehler 1 CC s390x-softmmu/hw/s390x/virtio-ccw.o In file included from /qemu/hw/s390x/virtio-ccw.c:27: /qemu/hw/s390x/virtio-ccw.h:115: error: expected specifier-qualifier-list before 'VHostSCSI' /qemu/hw/s390x/virtio-ccw.c: In function 'virtio_ccw_register': /qemu/hw/s390x/virtio-ccw.c:1107: error: 'vhost_ccw_scsi' undeclared (first use in this function) /qemu/hw/s390x/virtio-ccw.c:1107: error: (Each undeclared identifier is reported only once /qemu/hw/s390x/virtio-ccw.c:1107: error: for each function it appears in.) make[1]: *** [hw/s390x/virtio-ccw.o] Fehler 1 CC s390x-softmmu/target-s390x/translate.o
Il 24/04/2013 18:56, Stefan Weil ha scritto:
Quoted 8 lines
Am 24.04.2013 10:19, schrieb Paolo Bonzini:
Quoted 4 lines
Il 24/04/2013 06:56, Stefan Weil ha scritto:
Quoted 2 lines
Hi Paolo, the latest QEMU build is broken when
CONFIG_VHOST_SCSIis undefined.--verbose, please. :)
Sorry, I thought it was obvious. The error occurs in a cross build for w64 when building s390x-softmmu.
Will fix it next week, -rc0 should be fine.
Paolo
Quoted 32 lines
Regards,
Stefan$ make -C bin/debug/amd64-mingw32msvc -k make: Entering directory `/qemu/bin/debug/amd64-mingw32msvc' CC s390x-softmmu/hw/s390x/s390-virtio-bus.o /qemu/hw/s390x/s390-virtio-bus.c: In function 's390_virtio_register_types': /qemu/hw/s390x/s390-virtio-bus.c:694: error: 's390_vhost_scsi' undeclared (first use in this function) /qemu/hw/s390x/s390-virtio-bus.c:694: error: (Each undeclared identifier is reported only once /qemu/hw/s390x/s390-virtio-bus.c:694: error: for each function it appears in.) make[1]: *** [hw/s390x/s390-virtio-bus.o] Fehler 1 CC s390x-softmmu/hw/s390x/s390-virtio-ccw.o In file included from /qemu/hw/s390x/s390-virtio-ccw.c:18: /qemu/hw/s390x/virtio-ccw.h:115: error: expected specifier-qualifier-list before 'VHostSCSI' make[1]: *** [hw/s390x/s390-virtio-ccw.o] Fehler 1 CC s390x-softmmu/hw/s390x/virtio-ccw.o In file included from /qemu/hw/s390x/virtio-ccw.c:27: /qemu/hw/s390x/virtio-ccw.h:115: error: expected specifier-qualifier-list before 'VHostSCSI' /qemu/hw/s390x/virtio-ccw.c: In function 'virtio_ccw_register': /qemu/hw/s390x/virtio-ccw.c:1107: error: 'vhost_ccw_scsi' undeclared (first use in this function) /qemu/hw/s390x/virtio-ccw.c:1107: error: (Each undeclared identifier is reported only once /qemu/hw/s390x/virtio-ccw.c:1107: error: for each function it appears in.) make[1]: *** [hw/s390x/virtio-ccw.o] Fehler 1 CC s390x-softmmu/target-s390x/translate.o
Pulled. Thanks.
Regards,
Anthony Liguori