On 20.07.2022 22:12, Marek Marczykowski-Górecki wrote:
> On Thu, Jul 14, 2022 at 01:58:25PM +0200, Jan Beulich wrote:
>> On 06.07.2022 17:32, Marek Marczykowski-Górecki wrote:
>>> +static int xue_init_dbc(struct xue *xue)
>>> +{
>>> +    uint64_t erdp = 0;
>>> +    uint64_t out = 0;
>>> +    uint64_t in = 0;
>>> +    uint64_t mbs = 0;
>>> +    struct xue_dbc_reg *reg = xue_find_dbc(xue);
>>> +
>>> +    if ( !reg )
>>> +        return 0;
>>> +
>>> +    xue->dbc_reg = reg;
>>> +    xue_disable_dbc(xue);
>>> +
>>> +    xue_trb_ring_init(xue, &xue->dbc_ering, 0, XUE_DB_INVAL);
>>> +    xue_trb_ring_init(xue, &xue->dbc_oring, 1, XUE_DB_OUT);
>>> +    xue_trb_ring_init(xue, &xue->dbc_iring, 1, XUE_DB_IN);
>>> +
>>> +    erdp = virt_to_maddr(xue->dbc_ering.trb);
>>> +    if ( !erdp )
>>> +        return 0;
>>> +
>>> +    memset(xue->dbc_erst, 0, sizeof(*xue->dbc_erst));
>>> +    xue->dbc_erst->base = erdp;
>>> +    xue->dbc_erst->size = XUE_TRB_RING_CAP;
>>> +
>>> +    mbs = (reg->ctrl & 0xFF0000) >> 16;
>>> +    out = virt_to_maddr(xue->dbc_oring.trb);
>>> +    in = virt_to_maddr(xue->dbc_iring.trb);
>>> +
>>> +    memset(xue->dbc_ctx, 0, sizeof(*xue->dbc_ctx));
>>> +    xue_init_strings(xue, xue->dbc_ctx->info);
>>> +    xue_init_ep(xue->dbc_ctx->ep_out, mbs, xue_ep_bulk_out, out);
>>> +    xue_init_ep(xue->dbc_ctx->ep_in, mbs, xue_ep_bulk_in, in);
>>> +
>>> +    reg->erstsz = 1;
>>> +    reg->erstba = virt_to_maddr(xue->dbc_erst);
>>> +    reg->erdp = erdp;
>>> +    reg->cp = virt_to_maddr(xue->dbc_ctx);
>>
>> The only place this field is read looks to be xue_dump().
> 
> No, reg is MMIO, all those assignments are actually configuring the
> device.

Well, then the pointer would preferably be marked __iomem and the
writes should be carried out via writel() and friends.

Jan

Reply via email to