From: Alistair <alistair23@gmail.com>
To: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: figlesia@xilinx.com, peter.maydell@linaro.org,
sstabellini@kernel.org, edgar.iglesias@xilinx.com,
sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com,
alistair@alistair23.me, richard.henderson@linaro.org,
frederic.konrad@adacore.com
Subject: Re: [Qemu-devel] [PATCH v1 07/12] net: cadence_gem: Implement support for 64bit descriptor addresses
Date: Fri, 5 Oct 2018 16:12:18 -0700 [thread overview]
Message-ID: <86063442-84a7-c546-a05e-fc4eb50edccc@gmail.com> (raw)
In-Reply-To: <1538579266-8389-8-git-send-email-edgar.iglesias@gmail.com>
On 10/03/2018 08:07 AM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Implement support for 64bit descriptor addresses.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> hw/net/cadence_gem.c | 47 +++++++++++++++++++++++++++++++++++++++--------
> 1 file changed, 39 insertions(+), 8 deletions(-)
>
> diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
> index ab02515..f93cd8e 100644
> --- a/hw/net/cadence_gem.c
> +++ b/hw/net/cadence_gem.c
> @@ -153,6 +153,9 @@
> #define GEM_RECEIVE_Q1_PTR (0x00000480 / 4)
> #define GEM_RECEIVE_Q7_PTR (GEM_RECEIVE_Q1_PTR + 6)
>
> +#define GEM_TBQPH (0x000004C8 / 4)
> +#define GEM_RBQPH (0x000004D4 / 4)
> +
> #define GEM_INT_Q1_ENABLE (0x00000600 / 4)
> #define GEM_INT_Q7_ENABLE (GEM_INT_Q1_ENABLE + 6)
>
> @@ -832,18 +835,42 @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr,
> return 0;
> }
>
> +static hwaddr gem_get_desc_addr(CadenceGEMState *s, bool tx, int q)
> +{
> + hwaddr desc_addr = 0;
> +
> + if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) {
> + desc_addr = s->regs[tx ? GEM_TBQPH : GEM_RBQPH];
> + }
> + desc_addr <<= 32;
> + desc_addr |= tx ? s->tx_desc_addr[q] : s->rx_desc_addr[q];
> + return desc_addr;
> +}
> +
> +static hwaddr gem_get_tx_desc_addr(CadenceGEMState *s, int q)
> +{
> + return gem_get_desc_addr(s, true, q);
> +}
> +
> +static hwaddr gem_get_rx_desc_addr(CadenceGEMState *s, int q)
> +{
> + return gem_get_desc_addr(s, false, q);
> +}
> +
> static void gem_get_rx_desc(CadenceGEMState *s, int q)
> {
> - DB_PRINT("read descriptor 0x%x\n", (unsigned)s->rx_desc_addr[q]);
> + hwaddr desc_addr = gem_get_rx_desc_addr(s, q);
> +
> + DB_PRINT("read descriptor 0x%" HWADDR_PRIx "\n", desc_addr);
> +
> /* read current descriptor */
> - address_space_read(s->dma_as, s->rx_desc_addr[q], MEMTXATTRS_UNSPECIFIED,
> + address_space_read(s->dma_as, desc_addr, MEMTXATTRS_UNSPECIFIED,
> (uint8_t *)s->rx_desc[q],
> sizeof(uint32_t) * gem_get_desc_len(s, true));
>
> /* Descriptor owned by software ? */
> if (rx_desc_get_ownership(s->rx_desc[q]) == 1) {
> - DB_PRINT("descriptor 0x%x owned by sw.\n",
> - (unsigned)s->rx_desc_addr[q]);
> + DB_PRINT("descriptor 0x%" HWADDR_PRIx " owned by sw.\n", desc_addr);
> s->regs[GEM_RXSTATUS] |= GEM_RXSTATUS_NOBUF;
> s->regs[GEM_ISR] |= GEM_INT_RXUSED & ~(s->regs[GEM_IMR]);
> /* Handle interrupt consequences */
> @@ -947,6 +974,8 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)
> q = get_queue_from_screen(s, rxbuf_ptr, rxbufsize);
>
> while (bytes_to_copy) {
> + hwaddr desc_addr;
> +
> /* Do nothing if receive is not enabled. */
> if (!gem_can_receive(nc)) {
> assert(!first_desc);
> @@ -994,7 +1023,8 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)
> }
>
> /* Descriptor write-back. */
> - address_space_write(s->dma_as, s->rx_desc_addr[q],
> + desc_addr = gem_get_rx_desc_addr(s, q);
> + address_space_write(s->dma_as, desc_addr,
> MEMTXATTRS_UNSPECIFIED,
> (uint8_t *)s->rx_desc[q],
> sizeof(uint32_t) * gem_get_desc_len(s, true));
> @@ -1098,7 +1128,7 @@ static void gem_transmit(CadenceGEMState *s)
>
> for (q = s->num_priority_queues - 1; q >= 0; q--) {
> /* read current descriptor */
> - packet_desc_addr = s->tx_desc_addr[q];
> + packet_desc_addr = gem_get_tx_desc_addr(s, q);
>
> DB_PRINT("read descriptor 0x%" HWADDR_PRIx "\n", packet_desc_addr);
> address_space_read(s->dma_as, packet_desc_addr,
> @@ -1144,16 +1174,17 @@ static void gem_transmit(CadenceGEMState *s)
> /* Last descriptor for this packet; hand the whole thing off */
> if (tx_desc_get_last(desc)) {
> uint32_t desc_first[DESC_MAX_NUM_WORDS];
> + hwaddr desc_addr = gem_get_tx_desc_addr(s, q);
>
> /* Modify the 1st descriptor of this packet to be owned by
> * the processor.
> */
> - address_space_read(s->dma_as, s->tx_desc_addr[q],
> + address_space_read(s->dma_as, desc_addr,
> MEMTXATTRS_UNSPECIFIED,
> (uint8_t *)desc_first,
> sizeof(desc_first));
> tx_desc_set_used(desc_first);
> - address_space_write(s->dma_as, s->tx_desc_addr[q],
> + address_space_write(s->dma_as, desc_addr,
> MEMTXATTRS_UNSPECIFIED,
> (uint8_t *)desc_first,
> sizeof(desc_first));
>
next prev parent reply other threads:[~2018-10-05 23:12 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 15:07 [Qemu-devel] [PATCH v1 00/12] arm: Add first models of Xilinx Versal SoC Edgar E. Iglesias
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 01/12] net: cadence_gem: Disable TSU feature bit Edgar E. Iglesias
2018-10-04 17:36 ` Alistair Francis
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 02/12] net: cadence_gem: Announce availability of priority queues Edgar E. Iglesias
2018-10-04 22:14 ` Alistair
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 03/12] net: cadence_gem: Use uint32_t for 32bit descriptor words Edgar E. Iglesias
2018-10-04 22:16 ` Alistair
2018-10-05 23:09 ` Philippe Mathieu-Daudé
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 04/12] net: cadence_gem: Add macro with max number of " Edgar E. Iglesias
2018-10-04 22:16 ` Alistair
2018-10-05 23:10 ` Philippe Mathieu-Daudé
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 05/12] net: cadence_gem: Add support for extended descriptors Edgar E. Iglesias
2018-10-04 22:29 ` Alistair
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 06/12] net: cadence_gem: Add support for selecting the DMA MemoryRegion Edgar E. Iglesias
2018-10-05 22:35 ` Alistair
2018-10-05 23:14 ` Philippe Mathieu-Daudé
2018-10-08 12:26 ` Peter Maydell
2018-10-08 12:24 ` Peter Maydell
2018-10-08 19:54 ` Edgar E. Iglesias
2018-10-08 12:30 ` Peter Maydell
2018-10-08 19:55 ` Edgar E. Iglesias
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 07/12] net: cadence_gem: Implement support for 64bit descriptor addresses Edgar E. Iglesias
2018-10-05 23:12 ` Alistair [this message]
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 08/12] net: cadence_gem: Announce 64bit addressing support Edgar E. Iglesias
2018-10-04 22:32 ` Alistair
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 09/12] target-arm: powerctl: Enable HVC when starting CPUs to EL2 Edgar E. Iglesias
2018-10-08 12:41 ` Peter Maydell
2018-10-08 19:56 ` Edgar E. Iglesias
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 10/12] target/arm: Add the Cortex-A72 Edgar E. Iglesias
2018-10-08 13:10 ` Peter Maydell
2018-10-08 21:34 ` Edgar E. Iglesias
2018-10-09 9:30 ` Peter Maydell
2018-10-09 13:17 ` Edgar E. Iglesias
2018-10-09 13:40 ` Laurent Desnogues
2018-10-09 14:56 ` Edgar E. Iglesias
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 11/12] hw/arm: versal: Add a model of Xilinx Versal SoC Edgar E. Iglesias
2018-10-05 23:21 ` Philippe Mathieu-Daudé
2018-10-08 13:19 ` Peter Maydell
2018-10-08 22:25 ` Edgar E. Iglesias
2018-10-03 15:07 ` [Qemu-devel] [PATCH v1 12/12] hw/arm: versal: Add a virtual Xilinx Versal board Edgar E. Iglesias
2018-10-08 14:08 ` [Qemu-devel] [PATCH v1 00/12] arm: Add first models of Xilinx Versal SoC Peter Maydell
2018-10-09 12:57 ` Edgar E. Iglesias
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=86063442-84a7-c546-a05e-fc4eb50edccc@gmail.com \
--to=alistair23@gmail.com \
--cc=alistair@alistair23.me \
--cc=edgar.iglesias@gmail.com \
--cc=edgar.iglesias@xilinx.com \
--cc=figlesia@xilinx.com \
--cc=frasse.iglesias@gmail.com \
--cc=frederic.konrad@adacore.com \
--cc=peter.maydell@linaro.org \
--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).