From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a81i0-0003E3-Vy for qemu-devel@nongnu.org; Sun, 13 Dec 2015 03:08:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a81i0-0001LH-08 for qemu-devel@nongnu.org; Sun, 13 Dec 2015 03:08:44 -0500 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:37345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a81hz-0001LD-Q8 for qemu-devel@nongnu.org; Sun, 13 Dec 2015 03:08:43 -0500 Received: by wmnn186 with SMTP id n186so83234214wmn.0 for ; Sun, 13 Dec 2015 00:08:43 -0800 (PST) From: Shmulik Ladkani Date: Sun, 13 Dec 2015 10:08:27 +0200 Message-Id: <1449994112-7054-2-git-send-email-shmulik.ladkani@ravellosystems.com> In-Reply-To: <1449994112-7054-1-git-send-email-shmulik.ladkani@ravellosystems.com> References: <1449994112-7054-1-git-send-email-shmulik.ladkani@ravellosystems.com> Subject: [Qemu-devel] [PATCH v2 1/6] vmw_pvscsi: Set device subsystem and revision List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dmitry Fleytman , Paolo Bonzini Cc: idan.brown@ravellosystems.com, qemu-devel@nongnu.org, Shmulik Ladkani To be VMware PVSCSI SCSI Controller, rev 02. As reported by the VMware virtual hardware. Signed-off-by: Shmulik Ladkani --- hw/scsi/vmw_pvscsi.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c index 9c71f31..ce099f9 100644 --- a/hw/scsi/vmw_pvscsi.c +++ b/hw/scsi/vmw_pvscsi.c @@ -52,6 +52,14 @@ #define TYPE_PVSCSI "pvscsi" #define PVSCSI(obj) OBJECT_CHECK(PVSCSIState, (obj), TYPE_PVSCSI) +/* Compatability flags for migration */ +#define PVSCSI_COMPAT_OLD_PCI_CONFIGURATION_BIT 0 +#define PVSCSI_COMPAT_OLD_PCI_CONFIGURATION \ + (1 << PVSCSI_COMPAT_OLD_PCI_CONFIGURATION_BIT) + +#define PVSCSI_USE_OLD_PCI_CONFIGURATION(s) \ + ((s)->compat_flags & PVSCSI_COMPAT_OLD_PCI_CONFIGURATION) + typedef struct PVSCSIRingInfo { uint64_t rs_pa; uint32_t txr_len_mask; @@ -100,6 +108,8 @@ typedef struct { PVSCSIRingInfo rings; /* Data transfer rings manager */ uint32_t resetting; /* Reset in progress */ + + uint32_t compat_flags; } PVSCSIState; typedef struct PVSCSIRequest { @@ -1069,9 +1079,16 @@ pvscsi_init(PCIDevice *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 subsystem ID, subsystem vendor ID, revision */ + if (PVSCSI_USE_OLD_PCI_CONFIGURATION(s)) { + pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID, 0x1000); + } else { + pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID, + PCI_VENDOR_ID_VMWARE); + pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID, + PCI_DEVICE_ID_VMWARE_PVSCSI); + pci_config_set_revision(pci_dev->config, 0x2); + } /* PCI latency timer = 255 */ pci_dev->config[PCI_LATENCY_TIMER] = 0xff; -- 1.9.1