From patchwork Wed Jan 6 11:03:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12001361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 085DBC433E9 for ; Wed, 6 Jan 2021 11:05:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AFA8C22482 for ; Wed, 6 Jan 2021 11:05:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFA8C22482 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:References: To:From:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Cu2gt19z4acCe3HwKE2Dq6+aA33OShF1BCoMHHvWrq0=; b=XikSkny0iaSec6kaHKmOBztHG 8LO0GACvGnunaihbDfZRYBotdvgqBLP/3M+UCK8wOLGFcgZtOoYuw93zNyLY5OsUzm2oVgsZZo5Om gzx3cimYTuQQa8bsbQ7xpbf2kcxG/cOhtXPNJ3qYjbq92w1454dNEPTTklqg1DKWCrVANEsJI3k3P Kuqvn8cVu+XxyFbrO6/65BdLJ4+dVnLTkOQPLbUj1P5t7h/6VnOQ0azIpKYKQcuwppqDSMYUBuKuy plt1I4O4JKt9l2TTKteJXIzP7FDFAlpGvGJ1KzTaQNMZ+hAs91XbBnXn7oneIynYRbLwxJric5gij ytZx/dQUw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kx6aq-0006tH-Ei; Wed, 06 Jan 2021 11:03:08 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kx6an-0006sG-HX for linux-arm-kernel@lists.infradead.org; Wed, 06 Jan 2021 11:03:06 +0000 Received: by mail-ej1-x62e.google.com with SMTP id ce23so4442936ejb.8 for ; Wed, 06 Jan 2021 03:03:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4ghlzx0ngHPmtJ8Qunegeez7cCjaR86UkMnCfsZmtjo=; b=jDTBxuk8u1KOGxA7ihc5vhOEISiXcpoaaMsyFJWcgUPuiLWF+CJLvigEf8XYPkBXSP yJmvSrytcHol8IhMyvSXGTNnuJlU/HmLKFteEUw3VFh6xipYFVUXg5bICRZEa3NyXAIq E30jv2cN5/jfxzZj0rllxDDtNLmEu6XGp06CAKduICikbZEggfT04toCFcMYXNlvWIXX rC/CTJT7Vzq3t+B9xzobs02Y9kDsuhalj0jjJu1X2CVjD2cZU6ZHuHMmaLF3Kuqo+jDr mCJaBPI793MdRwkJhTZKFg4VXbzGJh7lp04YTIsUCwrbv+Ax23V+zjSREqJejceofE3J Fq8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4ghlzx0ngHPmtJ8Qunegeez7cCjaR86UkMnCfsZmtjo=; b=UYUZX8l8O4LatSFUa9klhDRIvZjIUtJ8ba0HbHfNEpryECGyJTxbPz4SXF6G8ND/EI EDpH161BaetJpVTqDSFWQfLgG5CXIQj6UcDIcrNkTPEud1k04GYwu2oacmOZ0MO598Ls SsO+HaappIb9B3xWok/PymzIpoBzbADG4OOzEb1UOJxjLRJAybbBfrvr8Ffxp9tbV0rB KinaUgPrhSVbyaBHsqeInILPlb3TCa/k4zBSejPE/vcK5xamycwau/NhCoM6jfD+FkD/ afuoOtUgCnM9F8yrO94DH1d+avB5Fffo6MhQSS3hOVzFg2WxIbYYDa4tEcbldoqd6139 fYpA== X-Gm-Message-State: AOAM531eE6zErixPGr4gmf4EnXuLsDcHzU5oXXD22bbD0XmCw63/P4Wp G//VZDhkCxRUk1m+xvZjOcY= X-Google-Smtp-Source: ABdhPJyxFiGtR9Ws4sEhjtXSSCtcsOpKSeQJXnWvsImiv4jVFI2dVvQyy8pW9yHANVwlV1wjMO6y/g== X-Received: by 2002:a17:906:4d8d:: with SMTP id s13mr2482699eju.305.1609930984438; Wed, 06 Jan 2021 03:03:04 -0800 (PST) Received: from ?IPv6:2003:ea:8f06:5500:e1db:b990:7e09:f1cf? (p200300ea8f065500e1dbb9907e09f1cf.dip0.t-ipconnect.de. [2003:ea:8f06:5500:e1db:b990:7e09:f1cf]) by smtp.googlemail.com with ESMTPSA id qu21sm1092635ejb.95.2021.01.06.03.03.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Jan 2021 03:03:03 -0800 (PST) Subject: [PATCH v2 1/3] PCI: Disable parity checking if broken_parity is set From: Heiner Kallweit To: Bjorn Helgaas , Russell King - ARM Linux , Realtek linux nic maintainers , David Miller , Jakub Kicinski References: Message-ID: Date: Wed, 6 Jan 2021 12:03:00 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210106_060305_603562_E5EC239E X-CRM114-Status: GOOD ( 16.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "netdev@vger.kernel.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If we know that a device has broken parity checking, then disable it. This avoids quirks like in r8169 where on the first parity error interrupt parity checking will be disabled if broken_parity_status is set. Make pci_quirk_broken_parity() public so that it can be used by platform code, e.g. for Thecus N2100. Signed-off-by: Heiner Kallweit Reviewed-by: Leon Romanovsky --- drivers/pci/quirks.c | 17 +++++++++++------ include/linux/pci.h | 2 ++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 653660e3b..ab54e26b8 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -205,17 +205,22 @@ static void quirk_mmio_always_on(struct pci_dev *dev) DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on); +void pci_quirk_broken_parity(struct pci_dev *dev) +{ + u16 cmd; + + dev->broken_parity_status = 1; /* This device gives false positives */ + pci_read_config_word(dev, PCI_COMMAND, &cmd); + pci_write_config_word(dev, PCI_COMMAND, cmd & ~PCI_COMMAND_PARITY); +} + /* * The Mellanox Tavor device gives false positive parity errors. Mark this * device with a broken_parity_status to allow PCI scanning code to "skip" * this now blacklisted device. */ -static void quirk_mellanox_tavor(struct pci_dev *dev) -{ - dev->broken_parity_status = 1; /* This device gives false positives */ -} -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, quirk_mellanox_tavor); -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, quirk_mellanox_tavor); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, pci_quirk_broken_parity); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, pci_quirk_broken_parity); /* * Deal with broken BIOSes that neglect to enable passive release, diff --git a/include/linux/pci.h b/include/linux/pci.h index b32126d26..161dcc474 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1916,6 +1916,8 @@ enum pci_fixup_pass { pci_fixup_suspend_late, /* pci_device_suspend_late() */ }; +void pci_quirk_broken_parity(struct pci_dev *dev); + #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS #define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ class_shift, hook) \