qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Nabih Estefan <nabihestefan@google.com>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, kfting@nuvoton.com,
	 wuhaotsh@google.com, jasowang@redhat.com,
	avi.fishman@nuvoton.com,  kwliu@nuvoton.com,
	tomer.maimon@nuvoton.com, Hila.Miranda-Kuzi@nuvoton.com
Subject: Re: [PATCH v9 07/10] include/hw/net: General GMAC Implementation
Date: Mon, 8 Jan 2024 14:58:46 +0000	[thread overview]
Message-ID: <CAFEAcA82Bgh8qQ7sxdMTHTfdMO97qTdbdB4xCcGLnKXgoATGMg@mail.gmail.com> (raw)
In-Reply-To: <20231219213255.604535-8-nabihestefan@google.com>

On Tue, 19 Dec 2023 at 21:33, Nabih Estefan <nabihestefan@google.com> wrote:
>
> From: Nabih Estefan Diaz <nabihestefan@google.com>
>
> Implemented Classes and Masks for GMAC Descriptors
>  - Implemeted classes for GMAC Receive and Transmit Descriptors
>  - Implemented Masks for said descriptors
>
> - General GMAC Register handling
> - GMAC IRQ Handling
>

This commit message doesn't match the changes in the patch:
it claims it's adding a lot more than it actually does.


> Signed-off-by: Nabih Estefan <nabihestefan@google.com>
> Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
> ---
>  hw/net/npcm_gmac.c  | 40 ++++++++++++++++++++++++++++++++++++++++
>  hw/net/trace-events |  8 ++++++++
>  2 files changed, 48 insertions(+)
>
> diff --git a/hw/net/npcm_gmac.c b/hw/net/npcm_gmac.c
> index 98b3c33c94..44c4ffaff4 100644
> --- a/hw/net/npcm_gmac.c
> +++ b/hw/net/npcm_gmac.c
> @@ -149,6 +149,46 @@ static bool gmac_can_receive(NetClientState *nc)
>      return true;
>  }
>
> +/*
> + * Function that updates the GMAC IRQ
> + * It find the logical OR of the enabled bits for NIS (if enabled)
> + * It find the logical OR of the enabled bits for AIS (if enabled)
> + */
> +static void gmac_update_irq(NPCMGMACState *gmac)
> +{
> +    /*
> +     * Check if the normal interrupts summary is enabled
> +     * if so, add the bits for the summary that are enabled
> +     */
> +    if (gmac->regs[R_NPCM_DMA_INTR_ENA] & gmac->regs[R_NPCM_DMA_STATUS] &
> +        (NPCM_DMA_INTR_ENAB_NIE_BITS)) {
> +        gmac->regs[R_NPCM_DMA_STATUS] |=  NPCM_DMA_STATUS_NIS;
> +    }
> +    /*
> +     * Check if the abnormal interrupts summary is enabled
> +     * if so, add the bits for the summary that are enabled
> +     */
> +    if (gmac->regs[R_NPCM_DMA_INTR_ENA] & gmac->regs[R_NPCM_DMA_STATUS] &
> +        (NPCM_DMA_INTR_ENAB_AIE_BITS)) {
> +        gmac->regs[R_NPCM_DMA_STATUS] |=  NPCM_DMA_STATUS_AIS;
> +    }
> +
> +    /* Get the logical OR of both normal and abnormal interrupts */
> +    int level = !!((gmac->regs[R_NPCM_DMA_STATUS] &
> +                    gmac->regs[R_NPCM_DMA_INTR_ENA] &
> +                    NPCM_DMA_STATUS_NIS) |
> +                   (gmac->regs[R_NPCM_DMA_STATUS] &
> +                   gmac->regs[R_NPCM_DMA_INTR_ENA] &
> +                   NPCM_DMA_STATUS_AIS));
> +
> +    /* Set the IRQ */
> +    trace_npcm_gmac_update_irq(DEVICE(gmac)->canonical_path,
> +                               gmac->regs[R_NPCM_DMA_STATUS],
> +                               gmac->regs[R_NPCM_DMA_INTR_ENA],
> +                               level);
> +    qemu_set_irq(gmac->irq, level);
> +}
> +
>  static ssize_t gmac_receive(NetClientState *nc, const uint8_t *buf, size_t len)
>  {
>      /* Placeholder. Function will be filled in following patches */
> diff --git a/hw/net/trace-events b/hw/net/trace-events
> index 33514548b8..78efa2ec2c 100644
> --- a/hw/net/trace-events
> +++ b/hw/net/trace-events
> @@ -473,6 +473,14 @@ npcm_gmac_reg_write(const char *name, uint64_t offset, uint32_t value) "%s: offs
>  npcm_gmac_mdio_access(const char *name, uint8_t is_write, uint8_t pa, uint8_t gr, uint16_t val) "%s: is_write: %" PRIu8 " pa: %" PRIu8 " gr: %" PRIu8 " val: 0x%04" PRIx16
>  npcm_gmac_reset(const char *name, uint16_t value) "%s: phy_regs[0][1]: 0x%04" PRIx16
>  npcm_gmac_set_link(bool active) "Set link: active=%u"
> +npcm_gmac_update_irq(const char *name, uint32_t status, uint32_t intr_en, int level) "%s: Status Reg: 0x%04" PRIX32 " Interrupt Enable Reg: 0x%04" PRIX32 " IRQ Set: %d"
> +npcm_gmac_packet_desc_read(const char* name, uint32_t desc_addr) "%s: attempting to read descriptor @0x%04" PRIX32
> +npcm_gmac_packet_receive(const char* name, uint32_t len) "%s: RX packet length: 0x%04" PRIX32
> +npcm_gmac_packet_receiving_buffer(const char* name, uint32_t buf_len, uint32_t rx_buf_addr) "%s: Receiving into Buffer size: 0x%04" PRIX32 " at address 0x%04" PRIX32
> +npcm_gmac_packet_received(const char* name, uint32_t len) "%s: Reception finished, packet left: 0x%04" PRIX32
> +npcm_gmac_packet_sent(const char* name, uint16_t len) "%s: TX packet sent!, length: 0x%04" PRIX16
> +npcm_gmac_debug_desc_data(const char* name, void* addr, uint32_t des0, uint32_t des1, uint32_t des2, uint32_t des3)"%s: Address: %p Descriptor 0: 0x%04" PRIX32 " Descriptor 1: 0x%04" PRIX32 "Descriptor 2: 0x%04" PRIX32 " Descriptor 3: 0x%04" PRIX32
> +npcm_gmac_packet_tx_desc_data(const char* name, uint32_t tdes0, uint32_t tdes1) "%s: Tdes0: 0x%04" PRIX32 " Tdes1: 0x%04" PRIX32

Most of these trace events don't correspond to the code change
in the patch; they should be added in the same patch which adds
the call to the trace event.

thanks
-- PMM


  reply	other threads:[~2024-01-08 14:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 21:32 [PATCH v9 00/10] Implementation of NPI Mailbox and GMAC Networking Module Nabih Estefan
2023-12-19 21:32 ` [PATCH v9 01/10] hw/misc: Add Nuvoton's PCI Mailbox Module Nabih Estefan
2023-12-19 21:32 ` [PATCH v9 02/10] hw/arm: Add PCI mailbox module to Nuvoton SoC Nabih Estefan
2023-12-19 21:32 ` [PATCH v9 03/10] hw/misc: Add qtest for NPCM7xx PCI Mailbox Nabih Estefan
2023-12-19 21:32 ` [PATCH v9 04/10] hw/net: Add NPCMXXX GMAC device Nabih Estefan
2023-12-19 21:32 ` [PATCH v9 05/10] hw/arm: Add GMAC devices to NPCM7XX SoC Nabih Estefan
2023-12-19 21:32 ` [PATCH v9 06/10] tests/qtest: Creating qtest for GMAC Module Nabih Estefan
2023-12-19 21:32 ` [PATCH v9 07/10] include/hw/net: General GMAC Implementation Nabih Estefan
2024-01-08 14:58   ` Peter Maydell [this message]
2023-12-19 21:32 ` [PATCH v9 08/10] hw/net: GMAC Rx Implementation Nabih Estefan
2024-01-08 15:00   ` Peter Maydell
2024-01-08 15:19   ` Philippe Mathieu-Daudé
2023-12-19 21:32 ` [PATCH v9 09/10] hw/net: GMAC Tx Implementation Nabih Estefan
2024-01-08 14:56   ` Peter Maydell
2023-12-19 21:32 ` [PATCH v9 10/10] tests/qtest: Adding PCS Module test to GMAC Qtest Nabih Estefan

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=CAFEAcA82Bgh8qQ7sxdMTHTfdMO97qTdbdB4xCcGLnKXgoATGMg@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=Hila.Miranda-Kuzi@nuvoton.com \
    --cc=avi.fishman@nuvoton.com \
    --cc=jasowang@redhat.com \
    --cc=kfting@nuvoton.com \
    --cc=kwliu@nuvoton.com \
    --cc=nabihestefan@google.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=tomer.maimon@nuvoton.com \
    --cc=wuhaotsh@google.com \
    /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).