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

Re: [XEN v4 04/11] xen/drivers: ns16550: Use paddr_t for io_base/io_size


  • To: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 21 Mar 2023 15:16:13 +0100
  • 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=vmLdBnh+eDAXV3tNCr8h2itPWwIGIlAM+hXFVkNH9Dk=; b=AakKS+fR8PLJcvlgs0OYTNOpMFWdt1lM67Lk9bdmMAqOqpFQ/VXUC9VGHpXEekvvTsbcQW7TlRYlqSRnsMIfrGn/Ij7qhLcOXoJ3E8mm/Jm9jEd1U1OxIqUpnvCMLus11klv25rVG0mHVHpyfSxcQN9G51p6bptd/O0VmQxJCYyJmQvWemeJeEcJmOtSBQQpVaUAGxRPO+XDNm1Hlz33QkDcvg24EVg82mtu24GKkZ6aWRRpkNLWR/5CIesIFL+UuUuY+YeHcU1JdbiCjTrRPjjH86q4NBDUVfC8yQVGvzvQ7YT4svidJOE9Tqusg3XHm421Kpwtn4m3S3IQmM9+0A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HsVjAKwQMzcgcYLfxlKdUQIS0glcaLVoMxCAVGUyqoZxRrw79BkDYhT8H2eZNoYtOVwxXKCgpPxXq+3vPMLS0/H83XnM7r4sKVkh0Qp83MOONJYo8HYGHUFX6DtM2gwPk4VQ3mupEwYkNPqUJH7h7lINo8p/KgNYUrKZB8t7A9TxcVmXHZ22vkwom11h8OE90ypVP83FdVczQOsVr2d8mqx740YTKtEVukGoSVcxolIXGSHEqIbNRo0pa8lAdCZOrfQhba3cazDoIDtpgzRKpcQ3fUvpNju68UOif8AsNmp1VQzygD0fgI+hKijpuiT1cIJiK/GsHyZ7k1s2LKVMkw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, stefano.stabellini@xxxxxxx, julien@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx, bertrand.marquis@xxxxxxx, andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, wl@xxxxxxx, rahul.singh@xxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 21 Mar 2023 14:16:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.03.2023 15:03, Ayan Kumar Halder wrote:
> @@ -1163,10 +1163,16 @@ static const struct ns16550_config __initconst 
> uart_config[] =
>      },
>  };
>  
> +#define PARSE_ERR_RET(_f, _a...)             \
> +    do {                                     \
> +        printk( "ERROR: " _f "\n" , ## _a ); \
> +        return false;                        \
> +    } while ( 0 )

You can't really re-use this construct unchanged (and perhaps it's also
not worth changing for this single use that you need): Note the "return
false", which ...

>  static int __init
>  pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx)

... for a function returning "int" is equivalent to "return 0", which
is kind of a success indicator here. Whatever adjustment you make
needs to be in line with (at least) the two callers checking the
return value (the other two not doing so is suspicious, but then the
way the return values are used is somewhat odd, too).

> @@ -1235,6 +1241,8 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, 
> unsigned int idx)
>                  /* MMIO based */
>                  if ( param->mmio && !(bar & PCI_BASE_ADDRESS_SPACE_IO) )
>                  {
> +                    uint64_t pci_uart_io_base;
> +
>                      pci_conf_write32(PCI_SBDF(0, b, d, f),
>                                       PCI_BASE_ADDRESS_0 + bar_idx*4, ~0u);
>                      len = pci_conf_read32(PCI_SBDF(0, b, d, f),
> @@ -1259,8 +1267,14 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, 
> unsigned int idx)
>                      else
>                          size = len & PCI_BASE_ADDRESS_MEM_MASK;
>  
> -                    uart->io_base = ((u64)bar_64 << 32) |
> -                                    (bar & PCI_BASE_ADDRESS_MEM_MASK);
> +                    pci_uart_io_base = ((u64)bar_64 << 32) |

As you touch this code, please be so kind and also switch to using
uint64_t here.

Also why do you change parse_positional() but not (also)
parse_namevalue_pairs()?

Jan



 


Rackspace

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