qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Gerhard Wiesinger <lists@wiesinger.com>,
	Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, Andreas Faerber <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH][v14] megasas: LSI Megaraid SAS HBA emulation
Date: Mon, 27 Feb 2012 16:24:07 +0100	[thread overview]
Message-ID: <4F4BA017.3090905@suse.de> (raw)
In-Reply-To: <20120227103140.GA6731@redhat.com>

On 02/27/2012 11:31 AM, Michael S. Tsirkin wrote:
> On Mon, Feb 27, 2012 at 10:17:21AM +0100, Hannes Reinecke wrote:
[ .. ]
>>
>> The problem with mfi.h is that it's not actually _my_ file, but
>> rather copied over from NetBSD. I felt a bit stupid doing a recoding
>> of all the values which are already present in NetBSD ...
>> Hence the name 'mfi.h', and the different copyright.
>> For the same reason I try to keep the differences between the
>> NetBSD and my version as small as possible.
>>
>> If you have a better solution on how I should handle this
>> I'm willing to listen ...
> 
> Document where's the file from as suggested below.
> 
Yes, done.

>>>> +    if (megasas_use_msix(s) &&
>>>> +        msix_init(&s->dev, 15, &s->mmio_io, 0, 0x2000)) {
>>>> +        s->flags &= ~MEGASAS_MASK_USE_MSIX;
>>>
>>> You'd want an error message here. maybe even fail init.
>>>
>> But why? The driver continues happily without MSI-X.
>> And the failure message will be printed out via trace events,
>> in case someone is interested.
> 
> It is important that the configuration is fully specified
> by the flags.
> For example, otherwise migration to another host where
> MSIX does work will then fail.
> 
> 
Ok, thanks for the explanation.
But I'll be #ifdef'inf MSI-X support for the time being anyway.

>>>> diff --git a/hw/mfi.h b/hw/mfi.h
>>>> new file mode 100644
>>>> index 0000000..4790c7c
>>>> --- /dev/null
>>>> +++ b/hw/mfi.h
>>>
>>> Sorry if this was discussed already, where is this
>>> code from? freebsd? it seems to have this:
>>> http://gitorious.org/freebsd/freebsd/blobs/HEAD/sys/dev/mfi/mfireg.h
>> Yes, that's the case.
>>
>>> Want to name the file the same and add a link?
>>> This would be an explanation why we keep the
>>> file in a weird style incompatible with qemu.
>>>
>>> Still some things I think are better off fixed.
>>> Noted below.
>>>
>>>> +
>>>> +/* Controller properties */
>>>> +struct mfi_ctrl_props {
>>>> +    uint16_t seq_num;
>>>> +    uint16_t pred_fail_poll_interval;
>>>> +    uint16_t intr_throttle_cnt;
>>>> +    uint16_t intr_throttle_timeout;
>>>> +    uint8_t rebuild_rate;
>>>> +    uint8_t patrol_read_rate;
>>>> +    uint8_t bgi_rate;
>>>> +    uint8_t cc_rate;
>>>> +    uint8_t recon_rate;
>>>> +    uint8_t cache_flush_interval;
>>>> +    uint8_t spinup_drv_cnt;
>>>> +    uint8_t spinup_delay;
>>>> +    uint8_t cluster_enable;
>>>> +    uint8_t coercion_mode;
>>>> +    uint8_t alarm_enable;
>>>> +    uint8_t disable_auto_rebuild;
>>>> +    uint8_t disable_battery_warn;
>>>> +    uint8_t ecc_bucket_size;
>>>> +    uint16_t ecc_bucket_leak_rate;
>>>> +    uint8_t restore_hotspare_on_insertion;
>>>> +    uint8_t expose_encl_devices;
>>>> +    uint8_t maintainPdFailHistory;
>>>> +    uint8_t disallowHostRequestReordering;
>>>> +    uint8_t abortCCOnError;
>>>> +    uint8_t loadBalanceMode;
>>>> +    uint8_t disableAutoDetectBackplane;
>>>> +    uint8_t snapVDSpace;
>>>> +    struct {
>>>> +        /* set TRUE to disable copyBack (0=copyback enabled) */
>>>> +        uint32_t copyBackDisabled:1,
>>>> +            SMARTerEnabled:1,
>>>> +            prCorrectUnconfiguredAreas:1,
>>>> +            useFdeOnly:1,
>>>> +            disableNCQ:1,
>>>> +            SSDSMARTerEnabled:1,
>>>> +            SSDPatrolReadEnabled:1,
>>>> +            enableSpinDownUnconfigured:1,
>>>> +            autoEnhancedImport:1,
>>>> +            enableSecretKeyControl:1,
>>>> +            disableOnlineCtrlReset:1,
>>>> +            allowBootWithPinnedCache:1,
>>>> +            disableSpinDownHS:1,
>>>> +            enableJBOD:1,
>>>> +            reserved:18;
>>>> +    } OnOffProperties;
>>>
>>> Using bitfields for anything where you care about endian-ness
>>> is IMO wrong, and you normally do care for BE host + LE guest.
>>> No idea what bsd does to handle this.
>>>
>> Well, I don't really have a choice. That the firmware interface,
>> which is using this kind of construct.
>> So I'm getting passed in a bitfield, which I then have to evaluate.
>> I should be okay as I'll be doing a byteshuffle before evaluation.
>> But yes, this interface is absolutely horrible.
> 
> Bits are pretty comment as an interface.
> The sane thing to do is to have some macros or enums
> specifying the bits. Then you can do
> le32_to_cpu(x) & MFI_DISABLE_SPIN_DOWN_HS
> 
Yes, that's a good idea. Will be doing it.

> I don't see the shuffle in code.
> E.g. info->properties.OnOffProperties.enableJBOD = 1
> and no shuffle in sight.  Add a comment
> here and where you do the shuffle?
> 
Oh. Looks like wishful thinking here.
I _thought_ I did ...

Anyway, will be fixing it up.

Thanks for the review.

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)

  reply	other threads:[~2012-02-27 15:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21  9:36 [Qemu-devel] [PATCH][v14] megasas: LSI Megaraid SAS HBA emulation Hannes Reinecke
2012-02-21 18:54 ` Gerhard Wiesinger
2012-02-23  7:03   ` Gerhard Wiesinger
2012-02-23  7:14     ` Andreas Färber
2012-02-23  7:20       ` Gerhard Wiesinger
2012-02-23  7:12 ` Alexander Graf
2012-02-23 15:34 ` Michael S. Tsirkin
2012-02-24 15:58   ` Anthony Liguori
2012-02-24 16:05     ` Alexander Graf
2012-02-24 16:13       ` Anthony Liguori
2012-02-27  9:17   ` Hannes Reinecke
2012-02-27 10:31     ` Michael S. Tsirkin
2012-02-27 15:24       ` Hannes Reinecke [this message]
2012-03-02  7:20         ` Gerhard Wiesinger
2012-02-27 13:47   ` Andreas Färber

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=4F4BA017.3090905@suse.de \
    --to=hare@suse.de \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=lists@wiesinger.com \
    --cc=mst@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).