Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp210213imm; Wed, 30 May 2018 21:55:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLDlToR9BHZhVl1s04DFSTHWZpdbIG0Uk5Um/KaenFQ7ono4zpqfit0GoKv2h8vZBwEiByO X-Received: by 2002:a62:bd18:: with SMTP id a24-v6mr5310099pff.30.1527742517423; Wed, 30 May 2018 21:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527742517; cv=none; d=google.com; s=arc-20160816; b=R/uFiXTkJQm76Fr9Y5skMNyXqkvZO8042uqRxgXvGiLhHsXM8bNzzTFyWiG7gIQKGh 2alD2bk/kC6qyNaPlT/xm0N1LVmsGI0mYWbfJ3WOGMVAUeD905HgfmW5qN1YlXXH/DFA JBbZZsCqRBmEv0X6MZ2jeDIa7sehMdAEkAJD+m4rWNg9YPRhD657dbFBYLTM7ORbEhNd VpElxgPJPTY8/Yu9q0DVtZXmA/+hioA3SAwbzo8IqFS9bOK65IH4tRolFbg0hnF+z8yM m1qY6WKyZ1BfKmwPmDfPcr5g0dTRXC0aObz61wmB/hMWW8LHaeoMIPZ+hfOftjqdjsmw hT5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=xKiokDYaG+2uYf8Yrxp0QxShSg1P9XC/Yimfhmv1rJI=; b=NSXiVZiq5K6p5W69XhZAWRBpmQ7DA+miM2a39apYtFMKfBYSdkUjwc0rzhGLq1Ekji B+SbP4xYf2OvweX01mL7RDiHwCAp1ng9aCWPc7M+1m+blbkbd068bUnfSxXQvMndvOaG gchoqYYuYjPesoHXyyyTRKFAmc/IgcPGL9tf1Ble75HHES9tBYIBKAJ3SVSmnX8v/rU3 bml8AfaQT08IMkHkbm0znhidEC3cgcIeADKeGj6WZXWt29kIJsVI5fej6ri8KW0QfSmB 8xpZffT2IV4xli5+QQ3aDkESQhrCJc77t1peiptmRMKfZpeMouXCNHOOy6Wz64WAI4kw RhGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V0obgW35; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id a3-v6si24415108pgc.300.2018.05.30.21.55.02; Wed, 30 May 2018 21:55:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V0obgW35; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1753783AbeEaEyh (ORCPT + 99 others); Thu, 31 May 2018 00:54:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:58074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751381AbeEaEyf (ORCPT ); Thu, 31 May 2018 00:54:35 -0400 Received: from localhost (c-73-15-0-24.hsd1.ca.comcast.net [73.15.0.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4401A208A4; Thu, 31 May 2018 04:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527742475; bh=uPf545lSemP85nnDFPljLH2DebsO4oPhktNOq+g8SoM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V0obgW35wAdjB1y8JkZIacWj11xINpc/UDUGK/35qyr+0vVepI9zrGWXMt76dKSDW 6cORGnzMLr5Hlpk6Wo8WvTPKxfUSU+T/rBqS3w1cMaltocW0yv5nPwPqKXhQ7zA5R6 n7ePYDvEJ8YorVhkNv9NXoNg/RrCd2vN6nUXCB5k= Date: Wed, 30 May 2018 23:54:34 -0500 From: Bjorn Helgaas To: Lukas Wunner Cc: linux-pci@vger.kernel.org, Oza Pawandeep , linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 1/2] PCI/AER: Decode Error Source Requester ID Message-ID: <20180531045434.GS39853@bhelgaas-glaptop.roam.corp.google.com> References: <152770259826.80701.7360032106128917833.stgit@bhelgaas-glaptop.roam.corp.google.com> <152770285586.80701.6545710900591672975.stgit@bhelgaas-glaptop.roam.corp.google.com> <20180530183241.GA20222@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180530183241.GA20222@wunner.de> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 30, 2018 at 08:32:41PM +0200, Lukas Wunner wrote: > On Wed, May 30, 2018 at 12:54:15PM -0500, Bjorn Helgaas wrote: > > void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) > > { > > - pci_info(dev, "AER: %s%s error received: id=%04x\n", > > + u8 bus = info->id >> 8; > > + u8 devfn = info->id & 0xff; > > + > > + pci_info(dev, "AER: %s%s error received: %04x:%02x:%02x.%d\n", > > info->multi_error_valid ? "Multiple " : "", > > - aer_error_severity_string[info->severity], info->id); > > + aer_error_severity_string[info->severity], > > + pci_domain_nr(dev->bus), bus, devfn >> 3, devfn & 0x7); > > I think PCI_SLOT(devfn), PCI_FUNC(devfn) is a bit more readable. I used those originally, but of course those definitions predate PCIe so they aren't clearly related to a Requester ID. I searched the PCIe spec for the specifics of the Requester ID composition. It was surprisingly hard to find a clear statement. The best I found was PCIe r4.0, sec 6.13, which says Routing IDs, Requester IDs, and Completer IDs are 16-bit identifiers traditionally composed of three fields: an 8-bit Bus Number, a 5-bit Device Number, and a 3-bit Function Number. Even that isn't specific about where the fields are, But it's probably not worth obsessing over this and PCI_SLOT() and PCI_FUNC() are definitely more readable, so I changed them.