diff mbox

[00/13] mvneta Buffer Management and enhancements

Message ID 87two0254c.fsf@free-electrons.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Gregory CLEMENT Dec. 2, 2015, 4:21 p.m. UTC
Hi,
 
 On mer., déc. 02 2015, Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:

>>
>> So far the issue may have been not noticed, because in every IO driver
>> using mvebu_mbus_dram_info for configuring MBUS windows, there's
>> following substraction:
>> (cs->size - 1) & 0xfffff000
>>
>> I think there are two options:
>> 1. Change size type to u64.
>
> If we switch to u64 we really must pay attention to be sure that it
> won't be used to be written in a register, but the regsiter remains
> 32bits.
>
>> 2. Change condition in mvebu_mbus_get_dram_win_info to:
>> if (cs->base <= phyaddr && phyaddr <= (cs->base + cs->size -1))
>
> I think it would be the best solution.

So I applied the following patch:

I didn't get any errors during boot related to the BM. However I did not
manage to use an ethernet interface. The udhcpc never managed to get an
IP and if I set the IP manually I could not ping.

But on Armada 388 GP I didn't have any issue.

Do you have some idea about waht I could check?

Gregory

Comments

Marcin Wojtas Dec. 2, 2015, 10:15 p.m. UTC | #1
Hi Gregory,

2015-12-02 17:21 GMT+01:00 Gregory CLEMENT <gregory.clement@free-electrons.com>:
> Hi,
>
>  On mer., déc. 02 2015, Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:
>
>>>
>>> So far the issue may have been not noticed, because in every IO driver
>>> using mvebu_mbus_dram_info for configuring MBUS windows, there's
>>> following substraction:
>>> (cs->size - 1) & 0xfffff000
>>>
>>> I think there are two options:
>>> 1. Change size type to u64.
>>
>> If we switch to u64 we really must pay attention to be sure that it
>> won't be used to be written in a register, but the regsiter remains
>> 32bits.
>>
>>> 2. Change condition in mvebu_mbus_get_dram_win_info to:
>>> if (cs->base <= phyaddr && phyaddr <= (cs->base + cs->size -1))
>>
>> I think it would be the best solution.
>
> So I applied the following patch:
> --- a/drivers/bus/mvebu-mbus.c
> +++ b/drivers/bus/mvebu-mbus.c
> @@ -964,7 +964,7 @@ int mvebu_mbus_get_dram_win_info(phys_addr_t phyaddr, u8 *target, u8 *attr)
>         for (i = 0; i < dram->num_cs; i++) {
>                 const struct mbus_dram_window *cs = dram->cs + i;
>
> -               if (cs->base <= phyaddr && phyaddr <= (cs->base + cs->size)) {
> +               if (cs->base <= phyaddr && phyaddr <= (cs->base + cs->size - 1)) {
>                         *target = dram->mbus_dram_target_id;
>                         *attr = cs->mbus_attr;
>                         return 0;
>
> I didn't get any errors during boot related to the BM. However I did not
> manage to use an ethernet interface. The udhcpc never managed to get an
> IP and if I set the IP manually I could not ping.
>
> But on Armada 388 GP I didn't have any issue.
>
> Do you have some idea about waht I could check?
>

I replaced 2GB with 8GB DIMM and after that, on the same kernel/board,
I can't ping either. Very strange, but as I can reproduce the issue,
don't debug it, I will.

Best regards,
Marcin
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gregory CLEMENT Dec. 2, 2015, 10:56 p.m. UTC | #2
Hi Marcin,
 
 On mer., déc. 02 2015, Marcin Wojtas <mw@semihalf.com> wrote:
>>>
>>>> 2. Change condition in mvebu_mbus_get_dram_win_info to:
>>>> if (cs->base <= phyaddr && phyaddr <= (cs->base + cs->size -1))
>>>
>>> I think it would be the best solution.
>>
>> So I applied the following patch:
>> --- a/drivers/bus/mvebu-mbus.c
>> +++ b/drivers/bus/mvebu-mbus.c
>> @@ -964,7 +964,7 @@ int mvebu_mbus_get_dram_win_info(phys_addr_t phyaddr, u8 *target, u8 *attr)
>>         for (i = 0; i < dram->num_cs; i++) {
>>                 const struct mbus_dram_window *cs = dram->cs + i;
>>
>> -               if (cs->base <= phyaddr && phyaddr <= (cs->base + cs->size)) {
>> +               if (cs->base <= phyaddr && phyaddr <= (cs->base + cs->size - 1)) {
>>                         *target = dram->mbus_dram_target_id;
>>                         *attr = cs->mbus_attr;
>>                         return 0;
>>
>> I didn't get any errors during boot related to the BM. However I did not
>> manage to use an ethernet interface. The udhcpc never managed to get an
>> IP and if I set the IP manually I could not ping.
>>
>> But on Armada 388 GP I didn't have any issue.
>>
>> Do you have some idea about waht I could check?
>>
>
> I replaced 2GB with 8GB DIMM and after that, on the same kernel/board,
> I can't ping either. Very strange, but as I can reproduce the issue,
> don't debug it, I will.

Thanks to care about it!


Gregory
diff mbox

Patch

--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -964,7 +964,7 @@  int mvebu_mbus_get_dram_win_info(phys_addr_t phyaddr, u8 *target, u8 *attr)
        for (i = 0; i < dram->num_cs; i++) {
                const struct mbus_dram_window *cs = dram->cs + i;
 
-               if (cs->base <= phyaddr && phyaddr <= (cs->base + cs->size)) {
+               if (cs->base <= phyaddr && phyaddr <= (cs->base + cs->size - 1)) {
                        *target = dram->mbus_dram_target_id;
                        *attr = cs->mbus_attr;
                        return 0;