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

Reply via email to