qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"KONRAD Frederic" <frederic.konrad@adacore.com>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Francisco Iglesias" <frasse.iglesias@gmail.com>,
	figlesia@xilinx.com,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Sai Pavan Boddu" <sai.pavan.boddu@xilinx.com>
Subject: Re: [Qemu-devel] [PATCH v2 02/12] net: cadence_gem: Announce availability of priority queues
Date: Wed, 17 Oct 2018 15:30:25 +0200	[thread overview]
Message-ID: <20181017133025.GC4229@toto> (raw)
In-Reply-To: <CAFEAcA_c8YiyTtb1pE_ToSF_r6DGjCbjbDHF+6OQeCccbwpc=A@mail.gmail.com>

On Tue, Oct 16, 2018 at 05:15:36PM +0100, Peter Maydell wrote:
> On 11 October 2018 at 03:19, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
> > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> >
> > Announce the availability of the various priority queues.
> > This fixes an issue where guest kernels would miss to
> > configure secondary queues due to inproper feature bits.
> >
> > Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> > ---
> >  hw/net/cadence_gem.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
> > index e560b7a142..901c173970 100644
> > --- a/hw/net/cadence_gem.c
> > +++ b/hw/net/cadence_gem.c
> > @@ -1213,6 +1213,7 @@ static void gem_reset(DeviceState *d)
> >      int i;
> >      CadenceGEMState *s = CADENCE_GEM(d);
> >      const uint8_t *a;
> > +    uint32_t queues_mask;
> >
> >      DB_PRINT("\n");
> >
> > @@ -1229,7 +1230,10 @@ static void gem_reset(DeviceState *d)
> >      s->regs[GEM_DESCONF] = 0x02500111;
> >      s->regs[GEM_DESCONF2] = 0x2ab13fff;
> >      s->regs[GEM_DESCONF5] = 0x002f2045;
> > -    s->regs[GEM_DESCONF6] = 0x00000200;
> > +    s->regs[GEM_DESCONF6] = 0x0;
> > +
> > +    queues_mask = MAKE_64BIT_MASK(1, s->num_priority_queues - 1);
> > +    s->regs[GEM_DESCONF6] |= queues_mask;
> 
> This causes the clang runtime sanitizer to complain:
>   /aarch64/qom/xilinx-zynq-a9:
> /home/petmay01/linaro/qemu-for-merges/hw/net/cadence_gem.c:1306:19:
> runtime error: shift exponent 64 is too large for 64-bit type
> 'unsigned long long'

Argh, my bad.


> 
> because s->num_priority_queues is 1, and so you've
> asked for a zero-width mask, which MAKE_64BIT_MASK
> doesn't permit. What was the intention of the code here?


The intention was a mask with zero bits set when only 1 queue is available.

DESCONF6 has a bit set per queue that is available,
except for queue 0, for which bit 0 is always 0.

For example configuration with 1 queue:
..000000

2 queues:
..000010

3 queues:
..000110

4 queues:
..001110

etc.

I'll post a v3 with this fixed.


> I don't think any value of num_priority_queues can
> produce the old 0x200 value for this ID register.

Right, the 0x200 value was bogus.

> 
> I'm going to drop this patch and "net: cadence_gem:
> Announce 64bit addressing support" (which depends
> on this one) from my pullreq.


Best regards,
Edgar

  reply	other threads:[~2018-10-17 13:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11  2:19 [Qemu-devel] [PATCH v2 00/12] arm: Add first models of Xilinx Versal SoC Edgar E. Iglesias
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 01/12] net: cadence_gem: Disable TSU feature bit Edgar E. Iglesias
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 02/12] net: cadence_gem: Announce availability of priority queues Edgar E. Iglesias
2018-10-16 16:15   ` Peter Maydell
2018-10-17 13:30     ` Edgar E. Iglesias [this message]
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 03/12] net: cadence_gem: Use uint32_t for 32bit descriptor words Edgar E. Iglesias
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 04/12] net: cadence_gem: Add macro with max number of " Edgar E. Iglesias
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 05/12] net: cadence_gem: Add support for extended descriptors Edgar E. Iglesias
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 06/12] net: cadence_gem: Add support for selecting the DMA MemoryRegion Edgar E. Iglesias
2018-10-12 17:52   ` Alistair Francis
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 07/12] net: cadence_gem: Implement support for 64bit descriptor addresses Edgar E. Iglesias
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 08/12] net: cadence_gem: Announce 64bit addressing support Edgar E. Iglesias
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 09/12] target-arm: powerctl: Enable HVC when starting CPUs to EL2 Edgar E. Iglesias
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 10/12] target/arm: Add the Cortex-A72 Edgar E. Iglesias
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 11/12] hw/arm: versal: Add a model of Xilinx Versal SoC Edgar E. Iglesias
2018-10-11  2:19 ` [Qemu-devel] [PATCH v2 12/12] hw/arm: versal: Add a virtual Xilinx Versal board Edgar E. Iglesias
2018-10-16 10:53 ` [Qemu-devel] [PATCH v2 00/12] arm: Add first models of Xilinx Versal SoC Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181017133025.GC4229@toto \
    --to=edgar.iglesias@xilinx.com \
    --cc=alistair@alistair23.me \
    --cc=edgar.iglesias@gmail.com \
    --cc=figlesia@xilinx.com \
    --cc=frasse.iglesias@gmail.com \
    --cc=frederic.konrad@adacore.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sai.pavan.boddu@xilinx.com \
    --cc=sstabellini@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).