[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: Tue, 30 May 2023 14:04:26 +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=z5M6j9/zLZaXFCotqRCFUrGKX1avJFkRfkyDX0EUj/E=; b=n5rO/cTpMPDaOiFvfuExxVgi2Wd6tqjrxzIykXy5SKTdqYQch9y3gdlaivzmjsyc5nnlpcnH30qb21WfKssMsHCc3zwYmb7Uaedfz8Swlw6lCQSXnSrTwNXcobcq5nrmP1hbdlu/l3h3ZqrRp2SEli2GERDYh04RziZhuWIhaSw5q/rLarPhXw5yMTcfUXw2p4HnP7ffPweCwXSINQH1QL3wxYlNZTEmIM66BWoVsQqBpF26Zxj3iAxOynIdQQjQARH5QnexRHRnUcWMWU2qXRErl47sLyWYCLwyFxJ5vDJsk71Tx98/wyK0N9910d0lmR/JB5GRD46oGz1DUQPIeA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MHa3t8GSuxt9bmWFt2doW+2vY8EB/Vnk3Uq0WGiYp4Yv8O6CNuB25oinK9q183T9Xb82vMzcViyTavn1o5CxJv5J9bIzDHyc1Of2fJxkdVAzkD5cSbrhZuZbKef3SYpAQ0FAoxa9KD9bKiCS7pPX347qUz3crwxIetzOVOa3quGeif6Wf4n+LWE4gY2IOtkyB9c3JVNFCrK/xXXsu579hsQJ1W29kwgwHJgN3f6uXdGe71a2lHueIQOnS7ex0L96fMGXm7tu4lVFFboxdbAKsooVX/KGpMpUMN9kK32nf+Fp4hR0SgkK8lzVv3ft0ht5a6ED1+5IlCh5z7YcssJKeg==
  • 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: Tue, 30 May 2023 12:04:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05.05.2023 23:25, Marek Marczykowski-Górecki wrote:
> Not the whole page, which may contain other registers too. In fact
> on Tiger Lake and newer (at least), this page do contain other registers
> that Linux tries to use.

Please can you clarify whether this is with spec or an erratum? I ask
not the least because I continue to wonder whether we really want/need
the non-negligible amount of new code added by path 1.

> And with share=yes, a domU would use them too.

And gain yet more access to the emulator, as mentioned in patch 1. The
security implications may (will?) want mentioning.

> --- 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.)

Also, doesn't the comment ahead of the construct become stale?

Finally I think indentation of the function call arguments is off by one.

Jan



 


Rackspace

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