[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <15d94e61-9b3d-7854-b65e-6fea6db75450@redhat.com>
Date: Tue, 22 Oct 2019 09:32:36 +0800
From: Jason Wang <jasowang@...hat.com>
To: Simon Horman <simon.horman@...ronome.com>,
"Zhu, Lingshan" <lingshan.zhu@...el.com>
Cc: mst@...hat.com, alex.williamson@...hat.com,
linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org, kvm@...r.kernel.org,
netdev@...r.kernel.org, dan.daly@...el.com,
cunming.liang@...el.com, tiwei.bie@...el.com, jason.zeng@...el.com,
zhiyuan.lv@...el.com
Subject: Re: [RFC 1/2] vhost: IFC VF hardware operation layer
On 2019/10/22 上午12:31, Simon Horman wrote:
> On Mon, Oct 21, 2019 at 05:55:33PM +0800, Zhu, Lingshan wrote:
>> On 10/16/2019 5:53 PM, Simon Horman wrote:
>>> Hi Zhu,
>>>
>>> thanks for your patch.
>>>
>>> On Wed, Oct 16, 2019 at 09:10:40AM +0800, Zhu Lingshan wrote:
> ...
>
>>>> +static void ifcvf_read_dev_config(struct ifcvf_hw *hw, u64 offset,
>>>> + void *dst, int length)
>>>> +{
>>>> + int i;
>>>> + u8 *p;
>>>> + u8 old_gen, new_gen;
>>>> +
>>>> + do {
>>>> + old_gen = ioread8(&hw->common_cfg->config_generation);
>>>> +
>>>> + p = dst;
>>>> + for (i = 0; i < length; i++)
>>>> + *p++ = ioread8((u8 *)hw->dev_cfg + offset + i);
>>>> +
>>>> + new_gen = ioread8(&hw->common_cfg->config_generation);
>>>> + } while (old_gen != new_gen);
>>> Would it be wise to limit the number of iterations of the loop above?
>> Thanks but I don't quite get it. This is used to make sure the function
>> would get the latest config.
> I am worried about the possibility that it will loop forever.
> Could that happen?
>
> ...
My understanding is that the function here is similar to virtio config
generation [1]. So this can only happen for a buggy hardware.
Thanks
[1]
https://docs.oasis-open.org/virtio/virtio/v1.1/csprd01/virtio-v1.1-csprd01.html
Section 2.4.1
>
>>>> +static void io_write64_twopart(u64 val, u32 *lo, u32 *hi)
>>>> +{
>>>> + iowrite32(val & ((1ULL << 32) - 1), lo);
>>>> + iowrite32(val >> 32, hi);
>>>> +}
>>> I see this macro is also in virtio_pci_modern.c
>>>
>>> Assuming lo and hi aren't guaranteed to be sequential
>>> and thus iowrite64_hi_lo() cannot be used perhaps
>>> it would be good to add a common helper somewhere.
>> Thanks, I will try after this IFC patchwork, I will cc you.
> Thanks.
>
> ...
Powered by blists - more mailing lists