All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/arm/musicpal: Remove nonexistent CDTP2, CDTP3 registers
@ 2014-02-18 15:28 Peter Maydell
  2014-02-21  7:15 ` Jan Kiszka
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Maydell @ 2014-02-18 15:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Kiszka, patches

The ethernet device in the musicpal only has two tx queues,
but we modelled it with four CTDP registers, presumably a
cut and paste from the rx queue registers. Since the tx_queue[]
array is only 2 entries long this allowed a guest to overrun
this buffer. Remove the nonexistent registers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
There's no readily available documentation for this SoC,
but I'm told the BSP for it indicates that there are
indeed only two tx queues.

 hw/arm/musicpal.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 023e875..a8d0086 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -92,8 +92,6 @@
 #define MP_ETH_CRDP3            0x4AC
 #define MP_ETH_CTDP0            0x4E0
 #define MP_ETH_CTDP1            0x4E4
-#define MP_ETH_CTDP2            0x4E8
-#define MP_ETH_CTDP3            0x4EC
 
 /* MII PHY access */
 #define MP_ETH_SMIR_DATA        0x0000FFFF
@@ -308,7 +306,7 @@ static uint64_t mv88w8618_eth_read(void *opaque, hwaddr offset,
     case MP_ETH_CRDP0 ... MP_ETH_CRDP3:
         return s->rx_queue[(offset - MP_ETH_CRDP0)/4];
 
-    case MP_ETH_CTDP0 ... MP_ETH_CTDP3:
+    case MP_ETH_CTDP0 ... MP_ETH_CTDP1:
         return s->tx_queue[(offset - MP_ETH_CTDP0)/4];
 
     default:
@@ -362,7 +360,7 @@ static void mv88w8618_eth_write(void *opaque, hwaddr offset,
             s->cur_rx[(offset - MP_ETH_CRDP0)/4] = value;
         break;
 
-    case MP_ETH_CTDP0 ... MP_ETH_CTDP3:
+    case MP_ETH_CTDP0 ... MP_ETH_CTDP1:
         s->tx_queue[(offset - MP_ETH_CTDP0)/4] = value;
         break;
     }
-- 
1.8.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/musicpal: Remove nonexistent CDTP2, CDTP3 registers
  2014-02-18 15:28 [Qemu-devel] [PATCH] hw/arm/musicpal: Remove nonexistent CDTP2, CDTP3 registers Peter Maydell
@ 2014-02-21  7:15 ` Jan Kiszka
  2014-02-24 15:45   ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2014-02-21  7:15 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: patches

[-- Attachment #1: Type: text/plain, Size: 1871 bytes --]

On 2014-02-18 16:28, Peter Maydell wrote:
> The ethernet device in the musicpal only has two tx queues,
> but we modelled it with four CTDP registers, presumably a
> cut and paste from the rx queue registers. Since the tx_queue[]
> array is only 2 entries long this allowed a guest to overrun
> this buffer. Remove the nonexistent registers.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Acked-by: Jan Kiszka <jan.kiszka@web.de>

> ---
> There's no readily available documentation for this SoC,
> but I'm told the BSP for it indicates that there are
> indeed only two tx queues.
> 
>  hw/arm/musicpal.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
> index 023e875..a8d0086 100644
> --- a/hw/arm/musicpal.c
> +++ b/hw/arm/musicpal.c
> @@ -92,8 +92,6 @@
>  #define MP_ETH_CRDP3            0x4AC
>  #define MP_ETH_CTDP0            0x4E0
>  #define MP_ETH_CTDP1            0x4E4
> -#define MP_ETH_CTDP2            0x4E8
> -#define MP_ETH_CTDP3            0x4EC
>  
>  /* MII PHY access */
>  #define MP_ETH_SMIR_DATA        0x0000FFFF
> @@ -308,7 +306,7 @@ static uint64_t mv88w8618_eth_read(void *opaque, hwaddr offset,
>      case MP_ETH_CRDP0 ... MP_ETH_CRDP3:
>          return s->rx_queue[(offset - MP_ETH_CRDP0)/4];
>  
> -    case MP_ETH_CTDP0 ... MP_ETH_CTDP3:
> +    case MP_ETH_CTDP0 ... MP_ETH_CTDP1:
>          return s->tx_queue[(offset - MP_ETH_CTDP0)/4];
>  
>      default:
> @@ -362,7 +360,7 @@ static void mv88w8618_eth_write(void *opaque, hwaddr offset,
>              s->cur_rx[(offset - MP_ETH_CRDP0)/4] = value;
>          break;
>  
> -    case MP_ETH_CTDP0 ... MP_ETH_CTDP3:
> +    case MP_ETH_CTDP0 ... MP_ETH_CTDP1:
>          s->tx_queue[(offset - MP_ETH_CTDP0)/4] = value;
>          break;
>      }
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/musicpal: Remove nonexistent CDTP2, CDTP3 registers
  2014-02-21  7:15 ` Jan Kiszka
@ 2014-02-24 15:45   ` Peter Maydell
  2014-02-24 15:55     ` Andreas Färber
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Maydell @ 2014-02-24 15:45 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: QEMU Developers, Patch Tracking

On 21 February 2014 07:15, Jan Kiszka <jan.kiszka@web.de> wrote:
> On 2014-02-18 16:28, Peter Maydell wrote:
>> The ethernet device in the musicpal only has two tx queues,
>> but we modelled it with four CTDP registers, presumably a
>> cut and paste from the rx queue registers. Since the tx_queue[]
>> array is only 2 entries long this allowed a guest to overrun
>> this buffer. Remove the nonexistent registers.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>
> Acked-by: Jan Kiszka <jan.kiszka@web.de>

Thanks, applied to target-arm.next (with added cc:stable line).

-- PMM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/musicpal: Remove nonexistent CDTP2, CDTP3 registers
  2014-02-24 15:45   ` Peter Maydell
@ 2014-02-24 15:55     ` Andreas Färber
  2014-02-24 16:02       ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Färber @ 2014-02-24 15:55 UTC (permalink / raw)
  To: Peter Maydell, Jan Kiszka; +Cc: QEMU Developers, Patch Tracking

Am 24.02.2014 16:45, schrieb Peter Maydell:
> On 21 February 2014 07:15, Jan Kiszka <jan.kiszka@web.de> wrote:
>> On 2014-02-18 16:28, Peter Maydell wrote:
>>> The ethernet device in the musicpal only has two tx queues,
>>> but we modelled it with four CTDP registers, presumably a
>>> cut and paste from the rx queue registers. Since the tx_queue[]
>>> array is only 2 entries long this allowed a guest to overrun
>>> this buffer. Remove the nonexistent registers.
>>>
>>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>>
>> Acked-by: Jan Kiszka <jan.kiszka@web.de>
> 
> Thanks, applied to target-arm.next (with added cc:stable line).

Jan/Peter, is there any other outstanding work on musicpal that I should
be aware of? If not, I'd like to base the long-planned file splitup on
Peter's next pull. Hopefully we can still get that done for 2.0.

Cheers,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/musicpal: Remove nonexistent CDTP2, CDTP3 registers
  2014-02-24 15:55     ` Andreas Färber
@ 2014-02-24 16:02       ` Peter Maydell
  2014-02-24 18:50         ` Andreas Färber
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Maydell @ 2014-02-24 16:02 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Jan Kiszka, QEMU Developers, Patch Tracking

On 24 February 2014 15:55, Andreas Färber <afaerber@suse.de> wrote:
> Jan/Peter, is there any other outstanding work on musicpal that I should
> be aware of? If not, I'd like to base the long-planned file splitup on
> Peter's next pull. Hopefully we can still get that done for 2.0.

I have a trivial patch on list for it:
http://patchwork.ozlabs.org/patch/322857/

which I'm probably not going to put into my next pull unless
somebody reviews those patches since they've not been on
list very long. Other than that I'm not aware of anything.
(I can trivially rebase that on top of a file split, obviously.)

I assume you just mean splitting the devices currently in
hw/arm/musicpal.c out into their own files? That would be
good to do, yes.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/musicpal: Remove nonexistent CDTP2, CDTP3 registers
  2014-02-24 16:02       ` Peter Maydell
@ 2014-02-24 18:50         ` Andreas Färber
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2014-02-24 18:50 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Jan Kiszka, QEMU Developers, Patch Tracking

Am 24.02.2014 17:02, schrieb Peter Maydell:
> On 24 February 2014 15:55, Andreas Färber <afaerber@suse.de> wrote:
>> Jan/Peter, is there any other outstanding work on musicpal that I should
>> be aware of? If not, I'd like to base the long-planned file splitup on
>> Peter's next pull. Hopefully we can still get that done for 2.0.
> 
> I have a trivial patch on list for it:
> http://patchwork.ozlabs.org/patch/322857/
> 
> which I'm probably not going to put into my next pull unless
> somebody reviews those patches since they've not been on
> list very long. Other than that I'm not aware of anything.

Maybe Jan as author can review it? :)

> (I can trivially rebase that on top of a file split, obviously.)
> 
> I assume you just mean splitting the devices currently in
> hw/arm/musicpal.c out into their own files?

Yes, in particular I had noticed that the NIC (which your linked patch
indeed seems to be touching) was missing in hw/net/, we had previously
talked about doing this. Now that we have qom-test for musicpal and the
Soft Freeze coming up might be a good time to finally do this.

Cheers,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-24 18:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-18 15:28 [Qemu-devel] [PATCH] hw/arm/musicpal: Remove nonexistent CDTP2, CDTP3 registers Peter Maydell
2014-02-21  7:15 ` Jan Kiszka
2014-02-24 15:45   ` Peter Maydell
2014-02-24 15:55     ` Andreas Färber
2014-02-24 16:02       ` Peter Maydell
2014-02-24 18:50         ` Andreas Färber

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.