[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/5] ftgmac100: check RX and TX buffer alignment
From: |
Cédric Le Goater |
Subject: |
Re: [PATCH 3/5] ftgmac100: check RX and TX buffer alignment |
Date: |
Tue, 7 Jan 2020 09:36:24 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 |
On 1/7/20 9:27 AM, Philippe Mathieu-Daudé wrote:
> On 1/7/20 8:34 AM, Cédric Le Goater wrote:
>> These buffers should be aligned on 16 bytes.
>>
>> Signed-off-by: Cédric Le Goater <address@hidden>
>> ---
>> hw/net/ftgmac100.c | 13 +++++++++++++
>> 1 file changed, 13 insertions(+)
>>
>> diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
>> index 86ac25894a89..051f7b7af2d6 100644
>> --- a/hw/net/ftgmac100.c
>> +++ b/hw/net/ftgmac100.c
>> @@ -198,6 +198,8 @@ typedef struct {
>> uint32_t des3;
>> } FTGMAC100Desc;
>> +#define FTGMAC100_DESC_ALIGNMENT 16
>> +
>> /*
>> * Specific RTL8211E MII Registers
>> */
>> @@ -722,6 +724,12 @@ static void ftgmac100_write(void *opaque, hwaddr addr,
>> s->itc = value;
>> break;
>> case FTGMAC100_RXR_BADR: /* Ring buffer address */
>> + if (!QEMU_IS_ALIGNED(value, FTGMAC100_DESC_ALIGNMENT)) {
>> + qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad RX buffer alignment 0x%"
>> + HWADDR_PRIx "\n", __func__, value);
>> + return;
>
> What is the hardware behavior?
This is not documented :/
C.
>
>> + }
>> +
>> s->rx_ring = value;
>> s->rx_descriptor = s->rx_ring;
>> break;
>> @@ -731,6 +739,11 @@ static void ftgmac100_write(void *opaque, hwaddr addr,
>> break;
>> case FTGMAC100_NPTXR_BADR: /* Transmit buffer address */
>> + if (!QEMU_IS_ALIGNED(value, FTGMAC100_DESC_ALIGNMENT)) {
>> + qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad TX buffer alignment 0x%"
>> + HWADDR_PRIx "\n", __func__, value);
>> + return;
>> + }
>> s->tx_ring = value;
>> s->tx_descriptor = s->tx_ring;
>> break;
>>
>
[PATCH 4/5] hw/arm/aspeed: add a 'execute-in-place' property to boot directly from CE0, Cédric Le Goater, 2020/01/07
[PATCH 5/5] misc/pca9552: Add qom set and get, Cédric Le Goater, 2020/01/07
Re: [PATCH 0/5] aspeed: extensions and fixes, Cédric Le Goater, 2020/01/13