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

Re: [PATCH v3 01/10] drivers/char: Add support for USB3 DbC debugger


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 5 Aug 2022 09:23:32 +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=jD3Z5U7ynBWJinUPIyLJ7Q4mDxOQ7+sfhFNLejLCdRY=; b=W/Ll0QD36tH/sgMKtLhufKoqzvOihWo2N/orz1Axi2vZ3Jg9YItX8NvyGlupLTRZT4vbSo+S27n75oJmmAeMoB/5argwGsf4QmZA7iOtGFnqFzZt7QtxsaW2UFRfMFhmS2+6IesjCmn2L7/OYwWU6GNTj/iYGLiHnsS+lo5cY4i/kDju2KIcKt0gslcf9etNKQdKXrczYmmJTpdszF4uSI7TtZKyzWr1vOjpE94LO3hMnY11KUpWyqebXiGYx7cnNC+JTKQ0ThZdfM91JJp5rNyxkP9vSsGRexwPN9eykpmmp9tucGjCCRfReBTr2s4cGDTBIgoktL0nQp9y371WGQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SW+xUOiM2IA9oOViiqE1XayNT1M9ZeK1i8olmhGE2qhuoDlF5pGtIBaFbJCXSDslpV1IgCoyTfMDZ8VTbGQvaJ3+FCsRocUze6K5Sld896bj+PgPd5d3SuvXa5TWENhcRRA53UMavK595OO7BLGCdHT5tL8QRYq01S/1nicLVr5kb/CwJDnnHmooFmyhNHP4cBFYbuPFFM9qNMVEdUYiGOzjmjmfkpDb67EplRZwlDaqsLiqZ9UmsX41EGFuge6t27FGAS3gDTbHgCLCCed75mXkko7UR1bIucLxwHsfmDxJAdh5uppFaJAKdgefe4BpbB7g4Bkq/xQlnUhtsEdxcQ==
  • 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>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 05 Aug 2022 07:23:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.07.2022 05:23, Marek Marczykowski-Górecki wrote:
> +static uint64_t dbc_work_ring_size(const struct dbc_work_ring *ring)
> +{
> +    if ( ring->enq >= ring->deq )
> +        return ring->enq - ring->deq;
> +
> +    return DBC_WORK_RING_CAP - ring->deq + ring->enq;
> +}

Doesn't unsigned int suffice as a return type here?

> +static int64_t dbc_push_work(struct dbc *dbc, struct dbc_work_ring *ring,
> +                             const char *buf, unsigned int len)
> +{
> +    unsigned int i = 0;
> +    unsigned int end, start = ring->enq;
> +
> +    while ( !dbc_work_ring_full(ring) && i < len )
> +    {
> +        ring->buf[ring->enq] = buf[i++];
> +        ring->enq = (ring->enq + 1) & (DBC_WORK_RING_CAP - 1);
> +    }
> +
> +    end = ring->enq;
> +
> +    if ( end > start )
> +        cache_flush(&ring->buf[start], end - start);
> +    else if ( i > 0 )
> +    {
> +        cache_flush(&ring->buf[start], DBC_WORK_RING_CAP - start);
> +        cache_flush(&ring->buf[0], end);
> +    }
> +
> +    return i;
> +}

The function's return type is int64_t but the sole return statement
hands back an unsigned int - what's the deal here?

> +static struct xhci_trb evt_trb[DBC_TRB_RING_CAP];
> +static struct xhci_trb out_trb[DBC_TRB_RING_CAP];
> +static struct xhci_trb in_trb[DBC_TRB_RING_CAP];
> +static struct xhci_erst_segment erst __aligned(64);
> +static struct xhci_dbc_ctx ctx __aligned(64);
> +static uint8_t out_wrk_buf[DBC_WORK_RING_CAP] __aligned(DBC_PAGE_SIZE);

I've been trying to identify the reason for the alignment here,
compared to the other buffers which are no longer page-aligned. I
haven't even been able to locate the place where the address of
this buffer is actually written to hardware; all I could find was
the respective virt_to_maddr(). Could you please point me at that?

Jan



 


Rackspace

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