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

Re: [PATCH v2 8/9] xue: mark DMA buffers as reserved for the device


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 21 Jul 2022 12:30:19 +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=B/ab/DOg3tdwPdjncFnOMa7rsl9SBFoBkrkz1z2TLaI=; b=B94SEEy/CmsnRhRsaAIGPayUG5OADApPN4heXtsz6TTkGkjAmTeEPGP2MuSIkbsjhELRm97ZujZJyPiCPOlGjA2SI7u6IN+5bEnH3Otd/FO55tBHRzKwc3uCarqhLSwDpFp7q8aqYtlFZfcgukciArzci9aNvJF3WlrzLJxL7yH5GKfw1dRVICBwV2Ngum6Jh9O9g5yVYAuKwaOwlX8Pm7sTK9Ay4ihOVyyzGqGntdi2OiZng45WFNDXE7wRoxbQc3zIEE2/RgH9IjPi2f6ePR3q2WzKFQRM2VO0rNSyUs6M+15NTLblVSwI8yMYg54vGjRVobYPU1JJssV2FTgBwA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gkQjVnPhZEQ1jSNE1/65Aoku5iSzXFqBa7F5kat8a2NZALNUQXEfFYPIig0FV/R3gy1cTMaSdjLQeH24czDUjTwUK7qQhzEMOjTb3SUOR99zoi/LmPzlhGjUt1ZaDILMmtEUY3DIol/oytli0yPR83hFfzYFZJU4acykWlQ1REWk+m3l11vhvB2IPzeMdHjabuaGkyXsD8o8gcKBaeyqqY3R2mapYOAe5h9gZUVK4hULRx09BYxVi8SnAtyOAp7XiAbZqHzfokcvXFz8/jtOU6B82WzYGmawNBM2iqpabEDFM/gEapVs/+RZDXE+c0ayhNVBoy6+w3ZkNXmGbE/6tw==
  • 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>, Kevin Tian <kevin.tian@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 21 Jul 2022 10:30:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.07.2022 22:17, Marek Marczykowski-Górecki wrote:
> On Thu, Jul 14, 2022 at 01:51:06PM +0200, Jan Beulich wrote:
>> On 06.07.2022 17:32, Marek Marczykowski-Górecki wrote:
>>> +    /*
>>> +     * Don't place anything else on this page - it will be
>>> +     * DMA-reachable by the USB controller.
>>> +     */
>>> +    char _pad[0] __aligned(XUE_PAGE_SIZE);
>>
>> I don't think this is needed, due to sizeof() being required to be
>> a multiple of alignof().
> 
> I'd prefer to be explicit about this, because if some future change
> breaks this property (makes alignment smaller than a page size), the
> result will be pretty bad.

I don't mind you leaving the comment; anyone making adjustments there
ought to be checking the effects of what they're doing.

>>> @@ -990,16 +999,22 @@ void __init xue_uart_init(void)
>>>          xue->sbdf = PCI_SBDF(0, bus, slot, func);
>>>      }
>>>  
>>> -    xue->dbc_ctx = &ctx;
>>> -    xue->dbc_erst = &erst;
>>> -    xue->dbc_ering.trb = evt_trb;
>>> -    xue->dbc_oring.trb = out_trb;
>>> -    xue->dbc_iring.trb = in_trb;
>>> -    xue->dbc_owork.buf = wrk_buf;
>>> -    xue->dbc_str = str_buf;
>>> +    xue->dbc_ctx = &xue_dma_bufs.ctx;
>>> +    xue->dbc_erst = &xue_dma_bufs.erst;
>>> +    xue->dbc_ering.trb = xue_dma_bufs.evt_trb;
>>> +    xue->dbc_oring.trb = xue_dma_bufs.out_trb;
>>> +    xue->dbc_iring.trb = xue_dma_bufs.in_trb;
>>> +    xue->dbc_owork.buf = xue_dma_bufs.wrk_buf;
>>> +    xue->dbc_str = xue_dma_bufs.str_buf;
>>>  
>>>      if ( xue_open(xue) )
>>> +    {
>>> +        iommu_add_extra_reserved_device_memory(
>>> +                PFN_DOWN(virt_to_maddr(&xue_dma_bufs)),
>>
>> virt_to_pfn()?
> 
> Doesn't exist. Did you mean virt_to_mfn()?

Oh, sorry, never mind then. virt_to_mfn() would be good to use if
the function took mfn_t, but as long as it doesn't what you have
is as good.

Jan



 


Rackspace

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