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

Re: [PATCH v4 3/3] ns16550: Gate all PCI code with CONFIG_X86


  • To: Rahul Singh <Rahul.Singh@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 26 Nov 2020 09:08:45 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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-SenderADCheck; bh=ZZc0iU4XJgomLAA7yeWFerjA4qG1+thulaxjrCx6OLU=; b=efeo3ZWuc9XKtNxznUzHSAzU4XfymXrt4uPiAGXKQk6vwxbTuSsRo6ID8Zh9AX/J849UwLQ+DAraD6GW3WLCxej2qDCjs04dFb4imXgmx8PZE9Ld/C0HXHfoSY1mkSOa6Ycp48OsGhHSy1Pa8//y+gyQfFoXEjjcKyUsjNMzSSWAXGKuYYWdzFLGwav7X/PFGVy/nvUTXani7LSJxZ7EOf6DEN+HrH3LWEmAyKcAx7kqwpLwKyeLQGbCZ7kXJTwOninvUoOeH86z1R6lxcKyjT2ENmA82juLlVr2gx7LIXFOPbHUar3uUT3fqrmMC3k2p1jbhuQ2PkvOxrsnfaXN/A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BItqkU2mZv7R6POemE2PvrIpnJqgZO52yjb+CkdWqEewglBf0bPzLVQlKBye3QUt0j0w22cuyXAs4V8e77TnCeXLzYLv17+EOh15T0TEmwitNInPvsFbjQEKKhnC0jc/8UtTLZTrDiRRu3k18rh9x/9l/CHLKG76a1wqrwAQ8wUhzRGvfFOMkA3vDYCtxXZTV9S7OCf31R7WqEen6s5lA1tQpSoV1bnIoquTgedjxC0CJjU5wncNxOf/nC4JS9/huUrLZ/mEpGzGkgRWFMkXGJ3a+ndFdByFdBKJboVjrJz5JWy1E+Ydo9Uni1XvT7EAsoRcgsxxj4hJClZb0Z21HQ==
  • Authentication-results-original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 26 Nov 2020 09:09:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHWw1cvptOzj+DOhEKKe2XksTlGiKnZKPiAgAD31YA=
  • Thread-topic: [PATCH v4 3/3] ns16550: Gate all PCI code with CONFIG_X86


> On 25 Nov 2020, at 18:21, Rahul Singh <Rahul.Singh@xxxxxxx> wrote:
> 
> Hello Julien,
> 
>> On 25 Nov 2020, at 6:16 pm, Rahul Singh <rahul.singh@xxxxxxx> wrote:
>> 
>> The NS16550 driver is assuming that NS16550 PCI card are usable if the
>> architecture supports PCI (i.e. CONFIG_HAS_PCI=y). However, the code is
>> very x86 focus and will fail to build on Arm (/!\ it is not all the
>> errors):
>> 
>> ns16550.c: In function ‘ns16550_init_irq’:
>> ns16550.c:726:21: error: implicit declaration of function ‘create_irq’;
>> did you mean ‘release_irq’? [-Werror=implicit-function-declaration]
>>         uart->irq = create_irq(0, false);
>>                     ^~~~~~~~~~
>>                     release_irq
>> ns16550.c:726:21: error: nested extern declaration of ‘create_irq’
>> [-Werror=nested-externs]
>> ns16550.c: In function ‘ns16550_init_postirq’:
>> ns16550.c:768:33: error: ‘mmio_ro_ranges’ undeclared (first use in this
>> function); did you mean ‘mmio_handler’?
>>              rangeset_add_range(mmio_ro_ranges, uart->io_base,
>>                                 ^~~~~~~~~~~~~~
>>                                 mmio_handler
>> ns16550.c:768:33: note: each undeclared identifier is reported only once
>> for each function it appears in
>> ns16550.c:780:20: error: variable ‘msi’ has initializer but incomplete
>> type
>>             struct msi_info msi = {
>>                    ^~~~~~~~
>> 
>> Enabling support for NS16550 PCI card on Arm would require more plumbing
>> in addition to fixing the compilation error.
>> 
>> Arm systems tend to have platform UART available such as NS16550, PL011.
>> So there are limited reasons to get NS16550 PCI support for now on Arm.
>> 
>> Guard all remaining PCI code that is not under x86 flag with CONFIG_X86.
>> 
>> No functional change intended.
>> 
>> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

> 
> Sorry I missed to add the signed off for the commit msg. I will send the next 
> version once reviewed done.
> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
> 

I guess the commiter can add this while commiting this patch ?

Regards
Bertrand

> Regards,
> Rahul
>> ---
>> 
>> Changes in v4:
>> - As per the discussion guard all remaining PCI code with CONFIG_X86
>> 
>> ---
>> xen/drivers/char/ns16550.c | 16 ++++++++--------
>> 1 file changed, 8 insertions(+), 8 deletions(-)
>> 
>> diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
>> index 9235d854fe..26e601857a 100644
>> --- a/xen/drivers/char/ns16550.c
>> +++ b/xen/drivers/char/ns16550.c
>> @@ -16,7 +16,7 @@
>> #include <xen/timer.h>
>> #include <xen/serial.h>
>> #include <xen/iocap.h>
>> -#ifdef CONFIG_HAS_PCI
>> +#if defined(CONFIG_X86) && defined(CONFIG_HAS_PCI)
>> #include <xen/pci.h>
>> #include <xen/pci_regs.h>
>> #include <xen/pci_ids.h>
>> @@ -51,7 +51,7 @@ static struct ns16550 {
>>    unsigned int timeout_ms;
>>    bool_t intr_works;
>>    bool_t dw_usr_bsy;
>> -#ifdef CONFIG_HAS_PCI
>> +#if defined(CONFIG_X86) && defined(CONFIG_HAS_PCI)
>>    /* PCI card parameters. */
>>    bool_t pb_bdf_enable;   /* if =1, pb-bdf effective, port behind bridge */
>>    bool_t ps_bdf_enable;   /* if =1, ps_bdf effective, port on pci card */
>> @@ -66,7 +66,7 @@ static struct ns16550 {
>> #endif
>> } ns16550_com[2] = { { 0 } };
>> 
>> -#ifdef CONFIG_HAS_PCI
>> +#if defined(CONFIG_X86) && defined(CONFIG_HAS_PCI)
>> struct ns16550_config {
>>    u16 vendor_id;
>>    u16 dev_id;
>> @@ -256,7 +256,7 @@ static int ns16550_getc(struct serial_port *port, char 
>> *pc)
>> 
>> static void pci_serial_early_init(struct ns16550 *uart)
>> {
>> -#ifdef CONFIG_HAS_PCI
>> +#if defined(CONFIG_X86) && defined(CONFIG_HAS_PCI)
>>    if ( !uart->ps_bdf_enable || uart->io_base >= 0x10000 )
>>        return;
>> 
>> @@ -355,7 +355,7 @@ static void __init ns16550_init_preirq(struct 
>> serial_port *port)
>> 
>> static void __init ns16550_init_irq(struct serial_port *port)
>> {
>> -#ifdef CONFIG_HAS_PCI
>> +#if defined(CONFIG_X86) && defined(CONFIG_HAS_PCI)
>>    struct ns16550 *uart = port->uart;
>> 
>>    if ( uart->msi )
>> @@ -397,7 +397,7 @@ static void __init ns16550_init_postirq(struct 
>> serial_port *port)
>>    uart->timeout_ms = max_t(
>>        unsigned int, 1, (bits * uart->fifo_size * 1000) / uart->baud);
>> 
>> -#ifdef CONFIG_HAS_PCI
>> +#if defined(CONFIG_X86) && defined(CONFIG_HAS_PCI)
>>    if ( uart->bar || uart->ps_bdf_enable )
>>    {
>>        if ( uart->param && uart->param->mmio &&
>> @@ -477,7 +477,7 @@ static void ns16550_suspend(struct serial_port *port)
>> 
>>    stop_timer(&uart->timer);
>> 
>> -#ifdef CONFIG_HAS_PCI
>> +#if defined(CONFIG_X86) && defined(CONFIG_HAS_PCI)
>>    if ( uart->bar )
>>       uart->cr = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], 
>> uart->ps_bdf[1],
>>                                  uart->ps_bdf[2]), PCI_COMMAND);
>> @@ -486,7 +486,7 @@ static void ns16550_suspend(struct serial_port *port)
>> 
>> static void _ns16550_resume(struct serial_port *port)
>> {
>> -#ifdef CONFIG_HAS_PCI
>> +#if defined(CONFIG_X86) && defined(CONFIG_HAS_PCI)
>>    struct ns16550 *uart = port->uart;
>> 
>>    if ( uart->bar )
>> --
>> 2.17.1


 


Rackspace

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