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

Re: [PATCH v4 09/11] drivers/char: mark DMA buffers as reserved for the XHCI


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 17 Aug 2022 16:41:02 +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=b8uwe4jog0+UmSM27cT6RB4SwTz8PGxXA8vTvaE2CtI=; b=YURhSH9XKqGPqcFtVpnvqoRw/b4xsLGQPaqaOQGETzEz831og+gtQnimo+wWT5BAmAupCq9YYXyQM5MESHt/6YK+TJlaUu4m9PNcESGTKamDQqMmDwISNmg0SMh59xGwJjhpja+4GNvCVQypjF2A5Sw6OPlcpJlCTA3TpVWdSRjoY3i3vas05O/Szb5H9R1xsCva8qp6ScohT3fbkLCTElrpDRMVft2idk0+JK2UDYOYAyBG1jdY7wTdVu90+ozjZiVvACnLX2pJjJUhY4xEUkfecZB/cZlGVnn3Phb+BKK5iPIHOiltoxGomwziYT/qNGOQlXsaqWXax3iWXj1Dtw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IiB7iVnDnqSKs8BUm1SVtjg6XVreLuNOXvM/iUa/26gbO9RRuKa69Cu9NFHyVXpPD1RGUefRSmzgnfMGTEfmvkcvDAaWNF84vZ4Kuw/lcrs0ZhXU/zmIKXfunSFA5pjiWK+R74Ftj0yzN2YkitBUQfcByIYB+QcNPbmtMR3Zo4Da8Pg1FTzNdXZL8xYYWWfzETbyy8u1A6JnGqYSLcLTILMwtqNMNzHeA7tuec0tlN1FwqO0uXiyjZfm7LGcKTs0wU14DgLcCzeWSP5ClplZpDXFeJytAIn3QEgmGiecUpXs1dIV9xbP++zmp4wQ+eUxRhl3PFuXFh8RJ4BcZXLrVA==
  • 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: Wed, 17 Aug 2022 14:41:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.08.2022 03:38, Marek Marczykowski-Górecki wrote:
> @@ -1050,13 +1051,20 @@ static struct uart_driver dbc_uart_driver = {
>  };
>  
>  /* Those are accessed via DMA. */
> -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(16);
> -static struct xhci_dbc_ctx ctx __aligned(16);
> -static uint8_t out_wrk_buf[DBC_WORK_RING_CAP];
> -static struct xhci_string_descriptor str_buf[DBC_STRINGS_COUNT];
> +struct dbc_dma_bufs {
> +    struct xhci_trb evt_trb[DBC_TRB_RING_CAP];
> +    struct xhci_trb out_trb[DBC_TRB_RING_CAP];
> +    struct xhci_trb in_trb[DBC_TRB_RING_CAP];
> +    uint8_t out_wrk_buf[DBC_WORK_RING_CAP];
> +    struct xhci_erst_segment erst __aligned(16);
> +    struct xhci_dbc_ctx ctx __aligned(16);
> +    struct xhci_string_descriptor str_buf[DBC_STRINGS_COUNT];
> +    /*
> +     * Don't place anything else on this page - it will be
> +     * DMA-reachable by the USB controller.
> +     */
> +};
> +static struct dbc_dma_bufs dbc_dma_bufs __section(".bss.page_aligned");

Don't you also need __aligned(PAGE_SIZE) here? (Strictly speaking
the type itself would need page alignment, but enforcing it just
for the variable is enough since we force suitable "post"-alignment
in the linker script. Provided, of course, that all other
contributions to the section also force the necessary alignment,
but I think we can take this for given - I do recall changing some
items several years ago, and a quick grep looks to confirm it.)

Jan



 


Rackspace

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