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

Re: [PATCH v2 2/2] drivers/char: Use sub-page ro API to make just xhci dbc cap RO


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 5 Jul 2023 10:28:41 +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=fSCsdsKH5vjcnrekux052uZhke+6/pmXzEvD35uhqW4=; b=EhTYcsa1aWOj7K6/qxLyG2asF+8BakpY/JAZ/hPFMKCZIk3XBPaNR3S6CpN6rzd28WHbrZNNZ7nGg60wBKdLDd6dmnTzkkiIbKN+4pp6+/5G6sWWIFDpRtrXw8KDoopPsYfOVInCAGuUzv31b5jqtcw1bhN4eKnHSNPtG288qfIANr2M40ShVMsS0b0okqHuxFLwFLaD4hGTaBQ8dqrwus+xonCsOxG895Gg0NygX03jFZwtVoIGeW+u0tTNO62M/Ha4qPW72eqWYUCQ9raQBL5LFCo8P4SbRkVnE9gxIiWyhpdsjp9xKyavHYK1zPtcdobt9dXipJXcufVkfbVDgg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fvF3cSBlaFVVxPuyTq6ZVQe4GaJReC1PbYPnw5x70HW0Ah9/yatQtTYhmn5cMuh6htvh8LoCIoqCgAuOdthsuyjUe6gRjE++HKfwisnwjo/uY+a5GuEUs5nsdWNqhyQjTYppX0j6jUAogpMFdT9+hk7/ajl/giHqS49zC4OUcxs2Ye1Qfb5FWjW3RXc/5NpbPqbb/z5AH8OE4RXEWEw7+RAnhinOQCdbJ1dqcdMMyKs86lsByjMQOHIjZus8z0wjPn1lOO/dDs2BozZxisHw6KKLjFaXx/noaLrXQqiNAIYf0s0AnUCgZkXe6NLOiL2yUU0/XmeewYq0eb62Ebr+HA==
  • 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, 05 Jul 2023 08:28:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 01.07.2023 00:38, Marek Marczykowski-Górecki wrote:
> On Tue, May 30, 2023 at 02:04:26PM +0200, Jan Beulich wrote:
>> On 05.05.2023 23:25, Marek Marczykowski-Górecki wrote:
>>> --- a/xen/drivers/char/xhci-dbc.c
>>> +++ b/xen/drivers/char/xhci-dbc.c
>>> @@ -1221,14 +1221,12 @@ static void __init cf_check 
>>> dbc_uart_init_postirq(struct serial_port *port)
>>>       * Linux's XHCI driver (as of 5.18) works without writting to the whole
>>>       * page, so keep it simple.
>>>       */
>>> -    if ( rangeset_add_range(mmio_ro_ranges,
>>> -                PFN_DOWN((uart->dbc.bar_val & PCI_BASE_ADDRESS_MEM_MASK) +
>>> -                         uart->dbc.xhc_dbc_offset),
>>> -                PFN_UP((uart->dbc.bar_val & PCI_BASE_ADDRESS_MEM_MASK) +
>>> -                       uart->dbc.xhc_dbc_offset +
>>> -                sizeof(*uart->dbc.dbc_reg)) - 1) )
>>> -        printk(XENLOG_INFO
>>> -               "Error while adding MMIO range of device to 
>>> mmio_ro_ranges\n");
>>> +    if ( subpage_mmio_ro_add(
>>> +            (uart->dbc.bar_val & PCI_BASE_ADDRESS_MEM_MASK) +
>>> +             uart->dbc.xhc_dbc_offset,
>>> +            sizeof(*uart->dbc.dbc_reg)) )
>>> +        printk(XENLOG_WARNING
>>> +               "Error while marking MMIO range of XHCI console as R/O\n");
>>
>> So how about falling back to just rangeset_add_range(mmio_ro_ranges, ...)
>> in this failure case? (I did mention an alternative to doing it here in
>> the comments on patch 1.)
> 
> Or fallback to XHCI_SHARE_NONE (IOW, pci_ro_device()).
> 
>> Also, doesn't the comment ahead of the construct become stale?
> 
> Indeed.
> 
>> Finally I think indentation of the function call arguments is off by one.
> 
> How is it supposed to be? Currently it's 8 spaces over the "if", should
> it be 4 spaces over the function name?

Yes. All our indentation is using a granularity of 4 spaces, of course 
taking into account aligning with respective items on earlier lines
(the length of which may not be a multiple of 4). It is always the
innermost construct relative to which the new indentation level is
determined.

Jan



 


Rackspace

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