qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] hw/net/opencores_eth: Trivial patches
@ 2020-06-08  9:15 Philippe Mathieu-Daudé
  2020-06-08  9:15 ` [PATCH 1/2] hw/net/opencores_eth: Use definitions instead of magic values Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-08  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Jason Wang, Michael Tokarev, Laurent Vivier,
	Philippe Mathieu-Daudé, Max Filippov

Remove unnecessary mask, use #define instead of magic.

Philippe Mathieu-Daudé (2):
  hw/net/opencores_eth: Use definitions instead of magic values
  hw/net/opencores_eth: Remove unnecessary address masking

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

-- 
2.21.3



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

* [PATCH 1/2] hw/net/opencores_eth: Use definitions instead of magic values
  2020-06-08  9:15 [PATCH 0/2] hw/net/opencores_eth: Trivial patches Philippe Mathieu-Daudé
@ 2020-06-08  9:15 ` Philippe Mathieu-Daudé
  2020-06-08  9:25   ` Max Filippov
  2020-06-08  9:15 ` [PATCH 2/2] hw/net/opencores_eth: Remove unnecessary address masking Philippe Mathieu-Daudé
  2020-09-02 12:26 ` [PATCH 0/2] hw/net/opencores_eth: Trivial patches Philippe Mathieu-Daudé
  2 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-08  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Jason Wang, Michael Tokarev, Laurent Vivier,
	Philippe Mathieu-Daudé, Max Filippov

Use definitions from "hw/net/mii.h".
This also helps when using git-grep.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/net/opencores_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c
index 2ba0dc8c2f..90d3846bb7 100644
--- a/hw/net/opencores_eth.c
+++ b/hw/net/opencores_eth.c
@@ -86,8 +86,8 @@ static void mii_reset(Mii *s)
     s->regs[MII_BMSR] = MII_BMSR_100TX_FD | MII_BMSR_100TX_HD |
         MII_BMSR_10T_FD | MII_BMSR_10T_HD | MII_BMSR_MFPS |
         MII_BMSR_AN_COMP | MII_BMSR_AUTONEG;
-    s->regs[MII_PHYID1] = 0x2000;
-    s->regs[MII_PHYID2] = 0x5c90;
+    s->regs[MII_PHYID1] = DP83848_PHYID1;
+    s->regs[MII_PHYID2] = DP83848_PHYID2;
     s->regs[MII_ANAR] = MII_ANAR_TXFD | MII_ANAR_TX |
         MII_ANAR_10FD | MII_ANAR_10 | MII_ANAR_CSMACD;
     mii_set_link(s, s->link_ok);
-- 
2.21.3



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

* [PATCH 2/2] hw/net/opencores_eth: Remove unnecessary address masking
  2020-06-08  9:15 [PATCH 0/2] hw/net/opencores_eth: Trivial patches Philippe Mathieu-Daudé
  2020-06-08  9:15 ` [PATCH 1/2] hw/net/opencores_eth: Use definitions instead of magic values Philippe Mathieu-Daudé
@ 2020-06-08  9:15 ` Philippe Mathieu-Daudé
  2020-06-08  9:27   ` Max Filippov
  2020-09-02 12:26 ` [PATCH 0/2] hw/net/opencores_eth: Trivial patches Philippe Mathieu-Daudé
  2 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-08  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Jason Wang, Michael Tokarev, Laurent Vivier,
	Philippe Mathieu-Daudé, Max Filippov

The memory region is limited to 1 KiB, so the address is
garantied to be in that range. No need to mask.

  711 static const MemoryRegionOps open_eth_desc_ops = {
  712     .read = open_eth_desc_read,
  713     .write = open_eth_desc_write,
  714 };
  ...
  725     memory_region_init_io(&s->desc_io, OBJECT(dev),
  725                           &open_eth_desc_ops, s,
  726                           "open_eth.desc", 0x400);

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/net/opencores_eth.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c
index 90d3846bb7..0c9879e8a7 100644
--- a/hw/net/opencores_eth.c
+++ b/hw/net/opencores_eth.c
@@ -687,7 +687,6 @@ static uint64_t open_eth_desc_read(void *opaque,
     OpenEthState *s = opaque;
     uint64_t v = 0;
 
-    addr &= 0x3ff;
     memcpy(&v, (uint8_t *)s->desc + addr, size);
     trace_open_eth_desc_read((uint32_t)addr, (uint32_t)v);
     return v;
@@ -698,7 +697,6 @@ static void open_eth_desc_write(void *opaque,
 {
     OpenEthState *s = opaque;
 
-    addr &= 0x3ff;
     trace_open_eth_desc_write((uint32_t)addr, (uint32_t)val);
     memcpy((uint8_t *)s->desc + addr, &val, size);
     open_eth_check_start_xmit(s);
-- 
2.21.3



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

* Re: [PATCH 1/2] hw/net/opencores_eth: Use definitions instead of magic values
  2020-06-08  9:15 ` [PATCH 1/2] hw/net/opencores_eth: Use definitions instead of magic values Philippe Mathieu-Daudé
@ 2020-06-08  9:25   ` Max Filippov
  0 siblings, 0 replies; 8+ messages in thread
From: Max Filippov @ 2020-06-08  9:25 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: QEMU Trivial, Jason Wang, Michael Tokarev, qemu-devel,
	Laurent Vivier

On Mon, Jun 8, 2020 at 2:15 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Use definitions from "hw/net/mii.h".
> This also helps when using git-grep.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/net/opencores_eth.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Max Filippov <jcmvbkbc@gmail.com>

-- 
Thanks.
-- Max


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

* Re: [PATCH 2/2] hw/net/opencores_eth: Remove unnecessary address masking
  2020-06-08  9:15 ` [PATCH 2/2] hw/net/opencores_eth: Remove unnecessary address masking Philippe Mathieu-Daudé
@ 2020-06-08  9:27   ` Max Filippov
  0 siblings, 0 replies; 8+ messages in thread
From: Max Filippov @ 2020-06-08  9:27 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: QEMU Trivial, Jason Wang, Michael Tokarev, qemu-devel,
	Laurent Vivier

On Mon, Jun 8, 2020 at 2:15 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> The memory region is limited to 1 KiB, so the address is
> garantied to be in that range. No need to mask.
>
>   711 static const MemoryRegionOps open_eth_desc_ops = {
>   712     .read = open_eth_desc_read,
>   713     .write = open_eth_desc_write,
>   714 };
>   ...
>   725     memory_region_init_io(&s->desc_io, OBJECT(dev),
>   725                           &open_eth_desc_ops, s,
>   726                           "open_eth.desc", 0x400);
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/net/opencores_eth.c | 2 --
>  1 file changed, 2 deletions(-)

Acked-by: Max Filippov <jcmvbkbc@gmail.com>

-- 
Thanks.
-- Max


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

* Re: [PATCH 0/2] hw/net/opencores_eth: Trivial patches
  2020-06-08  9:15 [PATCH 0/2] hw/net/opencores_eth: Trivial patches Philippe Mathieu-Daudé
  2020-06-08  9:15 ` [PATCH 1/2] hw/net/opencores_eth: Use definitions instead of magic values Philippe Mathieu-Daudé
  2020-06-08  9:15 ` [PATCH 2/2] hw/net/opencores_eth: Remove unnecessary address masking Philippe Mathieu-Daudé
@ 2020-09-02 12:26 ` Philippe Mathieu-Daudé
  2020-09-09 18:00   ` Philippe Mathieu-Daudé
  2 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-02 12:26 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Max Filippov, Jason Wang, Michael Tokarev,
	Laurent Vivier

On 6/8/20 11:15 AM, Philippe Mathieu-Daudé wrote:
> Remove unnecessary mask, use #define instead of magic.
> 
> Philippe Mathieu-Daudé (2):
>   hw/net/opencores_eth: Use definitions instead of magic values
>   hw/net/opencores_eth: Remove unnecessary address masking
> 
>  hw/net/opencores_eth.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 

Ping to Jason as the series is reviewed :)


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

* Re: [PATCH 0/2] hw/net/opencores_eth: Trivial patches
  2020-09-02 12:26 ` [PATCH 0/2] hw/net/opencores_eth: Trivial patches Philippe Mathieu-Daudé
@ 2020-09-09 18:00   ` Philippe Mathieu-Daudé
  2020-09-10  1:44     ` Jason Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-09 18:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Max Filippov, Jason Wang, Michael Tokarev,
	Laurent Vivier

On 9/2/20 2:26 PM, Philippe Mathieu-Daudé wrote:
> On 6/8/20 11:15 AM, Philippe Mathieu-Daudé wrote:
>> Remove unnecessary mask, use #define instead of magic.
>>
>> Philippe Mathieu-Daudé (2):
>>   hw/net/opencores_eth: Use definitions instead of magic values
>>   hw/net/opencores_eth: Remove unnecessary address masking
>>
>>  hw/net/opencores_eth.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
> 
> Ping to Jason as the series is reviewed :)

Ping^2


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

* Re: [PATCH 0/2] hw/net/opencores_eth: Trivial patches
  2020-09-09 18:00   ` Philippe Mathieu-Daudé
@ 2020-09-10  1:44     ` Jason Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Jason Wang @ 2020-09-10  1:44 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Max Filippov, Michael Tokarev, Laurent Vivier


On 2020/9/10 上午2:00, Philippe Mathieu-Daudé wrote:
> On 9/2/20 2:26 PM, Philippe Mathieu-Daudé wrote:
>> On 6/8/20 11:15 AM, Philippe Mathieu-Daudé wrote:
>>> Remove unnecessary mask, use #define instead of magic.
>>>
>>> Philippe Mathieu-Daudé (2):
>>>    hw/net/opencores_eth: Use definitions instead of magic values
>>>    hw/net/opencores_eth: Remove unnecessary address masking
>>>
>>>   hw/net/opencores_eth.c | 6 ++----
>>>   1 file changed, 2 insertions(+), 4 deletions(-)
>>>
>> Ping to Jason as the series is reviewed :)
> Ping^2
>

Applied.

Thanks



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

end of thread, other threads:[~2020-09-10  1:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-08  9:15 [PATCH 0/2] hw/net/opencores_eth: Trivial patches Philippe Mathieu-Daudé
2020-06-08  9:15 ` [PATCH 1/2] hw/net/opencores_eth: Use definitions instead of magic values Philippe Mathieu-Daudé
2020-06-08  9:25   ` Max Filippov
2020-06-08  9:15 ` [PATCH 2/2] hw/net/opencores_eth: Remove unnecessary address masking Philippe Mathieu-Daudé
2020-06-08  9:27   ` Max Filippov
2020-09-02 12:26 ` [PATCH 0/2] hw/net/opencores_eth: Trivial patches Philippe Mathieu-Daudé
2020-09-09 18:00   ` Philippe Mathieu-Daudé
2020-09-10  1:44     ` Jason Wang

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).