From: Hannes Reinecke <hare@suse.de>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH][v9] megasas: LSI Megaraid SAS HBA emulation
Date: Mon, 16 Jan 2012 10:18:32 +0100 [thread overview]
Message-ID: <4F13EB68.7020500@suse.de> (raw)
In-Reply-To: <4F10584F.3020107@codemonkey.ws>
On 01/13/2012 05:14 PM, Anthony Liguori wrote:
> On 01/13/2012 05:19 AM, Hannes Reinecke wrote:
>> This patch adds an emulation for the LSI Megaraid SAS 8708EM2 HBA.
>> I've tested it to work with Linux, Windows Vista, and Windows7.
>>
>> Changes since v8:
>> - Remove 'disable' keyword from trace definitions
>> - Convert hand-crafted debugging statements with trace
>> definitions
>> - Treat 'context' tag as little endian
>>
>> Changes since v7:
>> - Port to new memory API
>> - Port to new PCI infrastructure
>> - Use fixed buffers for sense processing
>> - Update to updated SCSI infrastructure
>>
>> Changes since v6:
>> - Preliminary patches pushed to Kevins block tree
>> - Implement 64bit contexts, required for Windows7
>> - Use iovecs for DCMD processing
>> - Add MSI-X support
>> Latest Linux driver now happily uses MSI-X.
>> - Static iovec allocation
>> We have a fixed upper number of iovecs, so we can
>> save us the allocation. Suggested by Alex Graf.
>> - Update MFI header
>> Latest Linux driver has some more definitions,
>> add them
>> - Fixup AEN handling
>> - Update tracing details
>> - Remove sdev pointer from megasas_cmd_t
>>
>> Changes since v5:
>> - megasas: Use tracing infrastructure instead of DPRINTF
>> - megasas: Use new PCI infrastructure
>> - megasas: Check for iovec mapping failure
>> cpu_map_physical_memory() might fail, so we need to check for
>> it when mapping iovecs.
>> - megasas: Trace scsi buffer overflow
>> The transfer length as specified in the SCSI command might
>> disagree with the length of the iovec. We should be tracing
>> these issues.
>> - megasas: Reset frames after init firmware
>> When receiving an INIT FIRMWARE command we need reset all
>> frames, otherwise some frames might point to invalid memory.
>>
>> Chances since v4:
>> - megasas: checkpatch.pl fixes and update to work with the
>> changed interface in scsi_req_new(). Also included the
>> suggested fixes from Alex.
>>
>> Signed-off-by: Hannes Reinecke<hare@suse.de>
>> ---
>> Makefile.objs | 1 +
>> default-configs/pci.mak | 1 +
>> hw/megasas.c | 2119
>> +++++++++++++++++++++++++++++++++++++++++++++++
>> hw/mfi.h | 1281 ++++++++++++++++++++++++++++
>> hw/pci_ids.h | 3 +-
>> trace-events | 73 ++
>> 6 files changed, 3477 insertions(+), 1 deletions(-)
>> create mode 100644 hw/megasas.c
>> create mode 100644 hw/mfi.h
>>
>> diff --git a/Makefile.objs b/Makefile.objs
>> index 4f6d26c..3bb2e57 100644
>> --- a/Makefile.objs
>> +++ b/Makefile.objs
>> @@ -275,6 +275,7 @@ hw-obj-$(CONFIG_AHCI) += ide/ich.o
>>
>> # SCSI layer
>> hw-obj-$(CONFIG_LSI_SCSI_PCI) += lsi53c895a.o
>> +hw-obj-$(CONFIG_MEGASAS_SCSI_PCI) += megasas.o
>> hw-obj-$(CONFIG_ESP) += esp.o
>>
>> hw-obj-y += dma-helpers.o sysbus.o isa-bus.o
>> diff --git a/default-configs/pci.mak b/default-configs/pci.mak
>> index 22bd350..fabb56c 100644
>> --- a/default-configs/pci.mak
>> +++ b/default-configs/pci.mak
>> @@ -9,6 +9,7 @@ CONFIG_EEPRO100_PCI=y
>> CONFIG_PCNET_PCI=y
>> CONFIG_PCNET_COMMON=y
>> CONFIG_LSI_SCSI_PCI=y
>> +CONFIG_MEGASAS_SCSI_PCI=y
>> CONFIG_RTL8139_PCI=y
>> CONFIG_E1000_PCI=y
>> CONFIG_IDE_CORE=y
>> diff --git a/hw/megasas.c b/hw/megasas.c
>> new file mode 100644
>> index 0000000..c49edd0
>> --- /dev/null
>> +++ b/hw/megasas.c
>> @@ -0,0 +1,2119 @@
>> +/*
>> + * QEMU MegaRAID SAS 8708EM2 Host Bus Adapter emulation
>> + *
>> + * Copyright (c) 2009-2011 Hannes Reinecke, SUSE Labs
>> + *
>> + * This code is licensed under the LGPL.
>> + */
>> +
>> +#include "hw.h"
>> +#include "pci.h"
>> +#include "dma.h"
>> +#include "msix.h"
>> +#include "iov.h"
>> +#include "scsi.h"
>> +#include "scsi-defs.h"
>> +#include "block_int.h"
>> +#include "trace.h"
>> +
>> +#include "mfi.h"
>> +
>> +/* Static definitions */
>> +#define MEGASAS_VERSION "1.50"
>> +#define MEGASAS_MAX_FRAMES 2048 /* Firmware limit at
>> 65535 */
>> +#define MEGASAS_DEFAULT_FRAMES 1000 /* Windows requires this */
>> +#define MEGASAS_MAX_SGE 128 /* Firmware limit */
>> +#define MEGASAS_DEFAULT_SGE 80
>> +#define MEGASAS_MAX_SECTORS 0xFFFF /* No real limit */
>> +#define MEGASAS_MAX_ARRAYS 128
>> +
>> +#define MEGASAS_FLAG_USE_JBOD 0x00000001
>> +#define MEGASAS_FLAG_USE_MSIX 0x00000002
>> +#define MEGASAS_FLAG_USE_QUEUE64 0x00000004
>> +
>> +const char *megasas_raid_modes[] = {
>> + "raid", "jbod"
>> +};
>> +
>> +const char *mfi_frame_desc[] = {
>> + "MFI init", "LD Read", "LD Write", "LD SCSI", "PD SCSI",
>> + "MFI Doorbell", "MFI Abort", "MFI SMP", "MFI Stop"};
>> +
>> +struct megasas_cmd_t {
>> + uint32_t index;
>> + uint16_t flags;
>> + uint16_t count;
>> + uint64_t context;
>> +
>> + target_phys_addr_t pa;
>> + target_phys_addr_t pa_size;
>> + union mfi_frame *frame;
>> + SCSIRequest *req;
>> + struct iovec iov[MEGASAS_MAX_SGE];
>> + int iov_cnt;
>> + size_t iov_size;
>> + size_t iov_offset;
>> + struct megasas_state_t *state;
>> +};
>
> This needs a check-patch.pl cleanup pass.
>
Hmm. checkpatch just complained here:
perl ./scripts/checkpatch.pl
0001-megasas-LSI-Megaraid-SAS-HBA-emulation.patch
ERROR: space required after that ',' (ctx:VxV)
#1356: FILE: hw/megasas.c:1259:
+ dummy[0x00], dummy[0x01],dummy[0x02], dummy[0x03],
^
total: 1 errors, 0 warnings, 3510 lines checked
0001-megasas-LSI-Megaraid-SAS-HBA-emulation.patch has style
problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
I'll fix this.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
next prev parent reply other threads:[~2012-01-16 9:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-13 11:19 [Qemu-devel] [PATCH][v9] megasas: LSI Megaraid SAS HBA emulation Hannes Reinecke
2012-01-13 16:14 ` Anthony Liguori
2012-01-13 16:35 ` Paolo Bonzini
2012-01-16 9:18 ` Hannes Reinecke [this message]
2012-01-16 13:38 ` Anthony Liguori
2012-01-13 16:54 ` Andreas Färber
2012-01-15 9:21 ` Avi Kivity
2012-01-16 7:18 ` Hannes Reinecke
2012-01-16 13:39 ` Anthony Liguori
2012-01-16 13:59 ` Hannes Reinecke
2012-01-16 14:05 ` Alexander Graf
2012-01-16 14:50 ` Avi Kivity
2012-01-16 15:35 ` Alexander Graf
2012-01-16 15:38 ` Avi Kivity
2012-01-16 15:39 ` Alexander Graf
2012-01-16 15:53 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F13EB68.7020500@suse.de \
--to=hare@suse.de \
--cc=agraf@suse.de \
--cc=anthony@codemonkey.ws \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.