[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 10/10] driver/char: add RX support to the XHCI driver


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 5 Aug 2022 10:38:13 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=r4ND0QZIjewxiv+g8758lLOJTKHE4z1UIFkmcwn+BxQ=; b=H29IT0jrHcpIiiZ6sqJCOVNB4yhP6mxegBnnT3JAMomkvdYfA7g15Z12F3Pv1f3bOFaGSXQ7AkOe11INaEUxKlDdfNmZ+XfG9YiKipx73AJ5nS24HC8I06PSJgGL0twl2ViQr8g3+jIPgVbm/gyHz2BubLwPgCEE9Jbl3+HG1HKKgP4f+NA9G2SDCCAxNCNdWmU3S5pBKNCQI+f44OENel1GMCKjkKvJiKURmj83E8/JHfJ/EZseLNS/HTymVEk7YpwchnQCXYBYOLW45nYxxV5skdelx0ST0soFPVU5P4hWY8zLmPKAzKjRmbhW0Zzb0QmizsQo9Fh29/5yDJef7w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QbSi3D91bbilJrF/M2db+x05umSiWv3h3R4n0QtQZe/nO/6u2mx1ZXMwfzmOo5Lo57mVSQQ0dRZhx1/XrHs/+LSQU9DEr+0vJ3KD/UoEdcKJs+XRDmRsuNyEtJRULdWQvuPRFHuwOTD4d+DaOd7/pcUPbzPJ+6jd2PGO3C5WAX8tPZobpnOmYVXZJi3E3RaXcJdqmQ2iOeorMS9TwYISG/NxkyP/U7RetWO/xMAHNs395bbCy/At02p4pO1M3dvmp0qtIaRxCXuy8klXDGJ8zr5sLTPJoAf91g/+xXruRxqyxaOSP8TldpUauHQCUpLbpEonIFS/8WeEQp2WEI4Y0g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 05 Aug 2022 08:38:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.07.2022 05:23, Marek Marczykowski-Górecki wrote:
> @@ -440,6 +442,16 @@ static void xhci_trb_norm_set_ioc(struct xhci_trb *trb)
>      trb->ctrl |= 0x20;
>  }
>  
> +static uint64_t xhci_trb_norm_buf(struct xhci_trb *trb)

const please.

> +{
> +    return trb->params;
> +}
> +
> +static uint32_t xhci_trb_norm_len(struct xhci_trb *trb)

And again.

> +{
> +    return trb->status & 0x1FFFF;
> +}
> +
>  /**
>   * Fields for Transfer Event TRBs (see section 6.4.2.1). Note that event
>   * TRBs are read-only from software
> @@ -454,6 +466,12 @@ static uint32_t xhci_trb_tfre_cc(const struct xhci_trb 
> *trb)
>      return trb->status >> 24;
>  }
>  
> +/* Amount of data _not_ transferred */
> +static uint32_t xhci_trb_tfre_len(const struct xhci_trb *trb)
> +{
> +    return trb->status & 0x1FFFF;
> +}

Same as xhci_trb_norm_len()?

> @@ -985,6 +1054,33 @@ static void dbc_flush(struct dbc *dbc, struct 
> xhci_trb_ring *trb,
>  }
>  
>  /**
> + * Ensure DbC has a pending transfer TRB to receive data into.
> + *
> + * @param dbc the dbc to flush
> + * @param trb the ring for the TRBs to transfer
> + * @param wrk the work ring to receive data into
> + */
> +static void dbc_enqueue_in(struct dbc *dbc, struct xhci_trb_ring *trb,
> +                           struct dbc_work_ring *wrk)

I can't seem to be able to spot any use of this function - it being
static, how do things build for you?

> +{
> +    struct dbc_reg *reg = dbc->dbc_reg;
> +    uint32_t db = (readl(&reg->db) & 0xFFFF00FF) | (trb->db << 8);

I think I've seen this constant in earlier patches. Can this be
a #define please, such that one can easily connect all the places
where the same things is meant?

> +
> +    /* Check if there is already queued TRB */
> +    if ( xhci_trb_ring_size(trb) >= 1 )
> +        return;
> +
> +    if ( dbc_work_ring_full(wrk) )
> +        return;

What made me spot the lack of caller are these return statements.
Without letting the caller know of the failure, how would it know
to make another attempt later?

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.