Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp132058pxv; Tue, 13 Jul 2021 23:56:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1LMmG3At0Z/cw+xsj8FXDQlN/tAO47ZQJfDUv9LPQFaDYgy3kH4VTCFEwRpySKB1TfM8D X-Received: by 2002:a05:6e02:c73:: with SMTP id f19mr5550362ilj.291.1626245801610; Tue, 13 Jul 2021 23:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626245801; cv=none; d=google.com; s=arc-20160816; b=tX0vr/xMa47bYSo+CsIWPacOMUsbtyUOm6F3WxNS/dZUmMWiNlSip6XO8Nkm/opFjX hX0KFjlTWEpi4e4dz0wJEKdk3+Pxp3pMzZgiDqNZWlSGDED61ffbHMXfGHFDpzVFgTgp 2r1rxL/vwAedgeJiTtoZoNKr8+nGelezOsxbbfd3j9llhtHpaTn5I7J5muY+c8oDAvbZ 2HEJPLXYfviqhwhyOhIs6x1HtNd1vrUPocUqCKbyQf17zf/OZuvdwfG0AJHVcLUh7065 +tKCyJPEVoqIxXZY3BlZWmKOxqw/MgJNfF+I+Vzxu7gkuTGDObVSYvLV3OERin24P4RY pGBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=krbJiHzO9v7NiomaRq+vI2Zouy+TLw2zKDa7Ig1bng0=; b=zI3tKT+qAmFx7UdWFyFh498aYtwpYgGEw6tab+1bCz+gTlu2WpXtPM7JR97wIgv/qu YserN1fPp7m+4luChaHv7uoitJxE6fU++eBtyzIYxX2uEsXKrnsR88AK8JcOBSQ66liY QWSMT2i8DErh+jDVcvJqAwF59TbuOVMUNofEOf01DYP93EMM9OkBYR6jcikURQ+m9iji WmNC+PNfpOVlIPc0yR62uDzDWTBhs/pLQlc7iIJsLsk/s6M/FkxQcdOxshpdZH4JCkeW irXPzMxbWA/Z3c84Huz/eZOJpRZDv4nOzQ7/wJVk6ya2vZO5YdBQYAuLWCau2O6YLFLJ F89w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si1562976iln.80.2021.07.13.23.56.29; Tue, 13 Jul 2021 23:56:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238130AbhGNG5f (ORCPT + 99 others); Wed, 14 Jul 2021 02:57:35 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]:41780 "EHLO mail-wr1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238104AbhGNG5e (ORCPT ); Wed, 14 Jul 2021 02:57:34 -0400 Received: by mail-wr1-f45.google.com with SMTP id k4so1809975wrc.8; Tue, 13 Jul 2021 23:54:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=krbJiHzO9v7NiomaRq+vI2Zouy+TLw2zKDa7Ig1bng0=; b=ICKdiKx0Uo3z5XWzvsX9d2kOsYbzyh9YWED+Dp3CG2gGGN8jQ50a+fsMhFLNTMPkhx 1l3oFvVt5B19WGcJjIo559vuww5ZV/j+0NkHj25+PLM46Tx+5RBQSwdrfi1M4tVU45sN 2Tl4AwXh5kkBP1q6h9JX6t8B6msSA8TrhIVzYTIssg6UOzCxp8Ae2KuBgUNvo7WmPZAv 4OQVynroNZmaw8qNT7U/TaFw9bsY+7KFtrYCVWq7u2O/pbXWWtQ2mGBJTx/h1tiZvPJI KYUe9A3KtxoQJEgC/Kh9ORlMggp5ae//C1bBywBAwq4VlAFlieV+kOFA3oE/zetbSJn7 jTAw== X-Gm-Message-State: AOAM532Tt6ef/uPBusGRR9ce8YtUhXniXsqgP9WvdyCkgUePnVqeR5Rn 1ggG7ihGL1dRF+bUrg5wNdQ= X-Received: by 2002:a5d:6dd2:: with SMTP id d18mr11005264wrz.94.1626245681918; Tue, 13 Jul 2021 23:54:41 -0700 (PDT) Received: from ?IPv6:2a0b:e7c0:0:107::70f? ([2a0b:e7c0:0:107::70f]) by smtp.gmail.com with ESMTPSA id o3sm1359925wrm.5.2021.07.13.23.54.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jul 2021 23:54:41 -0700 (PDT) Subject: Re: [PATCH v1 3/4] serial: 8250_pci: Always try MSI/MSI-X To: Andy Shevchenko , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ralf Ramsauer References: <20210713104026.58560-1-andriy.shevchenko@linux.intel.com> <20210713104026.58560-3-andriy.shevchenko@linux.intel.com> From: Jiri Slaby Message-ID: <9af24b96-8119-7ccf-f0d0-d725af80aa0b@kernel.org> Date: Wed, 14 Jul 2021 08:54:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210713104026.58560-3-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset=iso-8859-2; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13. 07. 21, 12:40, Andy Shevchenko wrote: > There is no need to try MSI/MSI-X only on selected devices. > If MSI is not supported while neing advertised it means device being > is broken and we rather introduce a list of such devices which > hopefully will be small or never appear. Hmm, have you checked the commit which introduced the whitelist? Nevertheless, this needs to handled with care: while many 8250 devices actually claim to support MSI(-X) interrupts it should not be enabled be default. I had at least one device in my hands with broken MSI implementation. So better introduce a whitelist with devices that are known to support MSI(-X) interrupts. I tested all devices mentioned in the patch. You should have at least CCed the author for an input. > Signed-off-by: Andy Shevchenko > --- > drivers/tty/serial/8250/8250_pci.c | 28 ++++++++-------------------- > 1 file changed, 8 insertions(+), 20 deletions(-) > > diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c > index 937861327aca..02825c8c5f84 100644 > --- a/drivers/tty/serial/8250/8250_pci.c > +++ b/drivers/tty/serial/8250/8250_pci.c > @@ -58,18 +58,6 @@ struct serial_private { > > #define PCI_DEVICE_ID_HPE_PCI_SERIAL 0x37e > > -static const struct pci_device_id pci_use_msi[] = { > - { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900, > - 0xA000, 0x1000) }, > - { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9912, > - 0xA000, 0x1000) }, > - { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922, > - 0xA000, 0x1000) }, > - { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL, > - PCI_ANY_ID, PCI_ANY_ID) }, > - { } > -}; > - > static int pci_default_setup(struct serial_private*, > const struct pciserial_board*, struct uart_8250_port *, int); > > @@ -3994,14 +3982,9 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board) > if (board->flags & FL_NOIRQ) { > uart.port.irq = 0; > } else { > - if (pci_match_id(pci_use_msi, dev)) { > - dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n"); > - pci_set_master(dev); > - rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES); > - } else { > - dev_dbg(&dev->dev, "Using legacy interrupts\n"); > - rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_LEGACY); > - } > + pci_set_master(dev); But bus mastering is not about MSIs. I *think* it's still OK, but you need to document that in the commit log too. Actually, why the commit which added this code turns on bus mastering? > + > + rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES); > if (rc < 0) { > kfree(priv); > priv = ERR_PTR(rc); > @@ -4009,6 +3992,11 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board) > } > > uart.port.irq = pci_irq_vector(dev, 0); > + > + if (pci_dev_msi_enabled(dev)) > + dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n"); > + else > + dev_dbg(&dev->dev, "Using legacy interrupts\n"); > } > > uart.port.dev = &dev->dev; > thanks, -- js suse labs