Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp729372pxu; Thu, 3 Dec 2020 11:06:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyH42q59VbXUbR0zlLnQaYhicvRXUwCND6L+blcM0GdH/kzlnArHKj2C0caDUQa8zYp4XjS X-Received: by 2002:a17:906:d87:: with SMTP id m7mr3808611eji.108.1607022381391; Thu, 03 Dec 2020 11:06:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607022381; cv=none; d=google.com; s=arc-20160816; b=xt+LW+0wS7x+LdJDhAV8wUPURsrLm3CZhIXeBr5QbnwxGyMFJ5WU8L65jjLBDAtUst e0hGsYAJ7f+cff0eyLxWeUqbO6TZyZAHxYhSlfaq4IdeELIwU8mCMK7kw2Kv/7+dcbjA Z07d5YLyiOFnNYNMZRsIYviwSBdCWgTPhrZJRQlFcTf0v0GH9hccOE/HEwFKXeZ0z793 eFlMpmeurNxY/qqMtZvEPRBiiQax7wg5VcoH0/AFyxIMonisvVCrHlJDkgB1I03tmr71 CADqZXFw9V9tLxwliGw8TziAWHCy67cofaHrco3F8BXdEMf3otGuFTK4pQINbOAYWnkZ BVBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Jq7vSLsV6byVAkVtan9MuuBS66+ooNRMO13M285XTYI=; b=MN/fkb9x0jmYrqXqZbWglx/uI0iewjRG0RnNpBjp4bAdJM0omTTaBDKu6Tppvgvj9P 8HdxFobs8xsgulj/fcc83rmZ5iIeTVyS64jceqFCoMtxHg0nosoibUdEFg6xYdpmqyzO 7qv8NSFrIDcwBcwF5WjrxacuN0qnxwOsj6xLLZ+E3n4dP5FYs3SFBvTCpZwgSjS8w4JX rD6t5tLgNsFzebkPnwDhhsxEM6Lu8GzAWzQ0rI6GxqhqbT6GYPrABTg1OlOQ6Iks1hl2 237ZP7hN2+oHQ1tjdGJSoBuh1utO82wf9VZvTXVvfg7uKHlTcux9mvMj8VimDzlwljpw fjFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=a2vr3PmJ; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j12si1511676eds.530.2020.12.03.11.05.58; Thu, 03 Dec 2020 11:06:21 -0800 (PST) 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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=a2vr3PmJ; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731778AbgLCTEh (ORCPT + 99 others); Thu, 3 Dec 2020 14:04:37 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:6680 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726600AbgLCTEg (ORCPT ); Thu, 3 Dec 2020 14:04:36 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Thu, 03 Dec 2020 11:03:56 -0800 Received: from [10.25.75.116] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 3 Dec 2020 19:03:49 +0000 Subject: Re: [PATCH V2] PCI/MSI: Set device flag indicating only 32-bit MSI support To: Bjorn Helgaas CC: , , , , , , , , References: <20201203182423.GA1555592@bjorn-Precision-5520> From: Vidya Sagar Message-ID: <75de8b9d-b4f1-5a68-8510-019017163baa@nvidia.com> Date: Fri, 4 Dec 2020 00:33:45 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.2 MIME-Version: 1.0 In-Reply-To: <20201203182423.GA1555592@bjorn-Precision-5520> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1607022236; bh=Jq7vSLsV6byVAkVtan9MuuBS66+ooNRMO13M285XTYI=; h=Subject:To:CC:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=a2vr3PmJr/WLDQU0AgXbrsMW7RvDqop+L0APY0lfCQCc+zJsR3QlBHHU9BgY6XDeQ PmuXTxals7cIn9U+N4P6FqbecgkKL0iANtEYnrhbdN8WFTQNHqqMfBnwOkX7kZ5h/5 /pdmffHR7CvyoF/G/oDeZFYOHS1GZCpizOZS2UQvKLkzAu76wQa6owRrwNtdesjrOk 5uxT4S6vvJGn7LzRW8fnpGeYB23Obib3UwVh4syjDMTSNzTTOVsCPTmVttj1h0+ewQ RMAsFo55j98c9IOvHqYsCiaB+EFZmgusXNND6ZDHbRAkGxFqoNOuV1Ob+g9G3QfiZs VYskpei0sC35w== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/3/2020 11:54 PM, Bjorn Helgaas wrote: > External email: Use caution opening links or attachments > > > On Tue, Nov 24, 2020 at 04:20:35PM +0530, Vidya Sagar wrote: >> There are devices (Ex:- Marvell SATA controller) that don't support >> 64-bit MSIs and the same is advertised through their MSI capability >> register. Set no_64bit_msi flag explicitly for such devices in the >> MSI setup code so that the msi_verify_entries() API would catch >> if the MSI arch code tries to use 64-bit MSI. > > This seems good to me. I'll post a possible revision to set > dev->no_64bit_msi in the device enumeration path instead of in the IRQ > allocation path, since it's really a property of the device, not of > the msi_desc. > > I like the extra checking this gives us. Was this prompted by > tripping over something, or is it something you noticed by code > reading? If the former, a hint about what was wrong and how it's > being fixed would be useful. I observed functionality issue with Marvell SATA controller (1b4b:9171) when the allocated MSI target address was a 64-bit address. I mentioned the Marvell SATA controller as an example in the commit message. Thanks, Vidya Sagar > >> Signed-off-by: Vidya Sagar >> --- >> V2: >> * Addressed Bjorn's comment and changed the error message >> >> drivers/pci/msi.c | 11 +++++++---- >> 1 file changed, 7 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c >> index d52d118979a6..8de5ba6b4a59 100644 >> --- a/drivers/pci/msi.c >> +++ b/drivers/pci/msi.c >> @@ -581,10 +581,12 @@ msi_setup_entry(struct pci_dev *dev, int nvec, struct irq_affinity *affd) >> entry->msi_attrib.multi_cap = (control & PCI_MSI_FLAGS_QMASK) >> 1; >> entry->msi_attrib.multiple = ilog2(__roundup_pow_of_two(nvec)); >> >> - if (control & PCI_MSI_FLAGS_64BIT) >> + if (control & PCI_MSI_FLAGS_64BIT) { >> entry->mask_pos = dev->msi_cap + PCI_MSI_MASK_64; >> - else >> + } else { >> entry->mask_pos = dev->msi_cap + PCI_MSI_MASK_32; >> + dev->no_64bit_msi = 1; >> + } >> >> /* Save the initial mask status */ >> if (entry->msi_attrib.maskbit) >> @@ -602,8 +604,9 @@ static int msi_verify_entries(struct pci_dev *dev) >> for_each_pci_msi_entry(entry, dev) { >> if (!dev->no_64bit_msi || !entry->msg.address_hi) >> continue; >> - pci_err(dev, "Device has broken 64-bit MSI but arch" >> - " tried to assign one above 4G\n"); >> + pci_err(dev, "Device has either broken 64-bit MSI or " >> + "only 32-bit MSI support but " >> + "arch tried to assign one above 4G\n"); >> return -EIO; >> } >> return 0; >> -- >> 2.17.1 >>