Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752676AbbHTOMD (ORCPT ); Thu, 20 Aug 2015 10:12:03 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:33350 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751387AbbHTOMB (ORCPT ); Thu, 20 Aug 2015 10:12:01 -0400 X-AuditID: cbfec7f5-f794b6d000001495-cf-55d5e02ec5c9 From: Pavel Fedin To: "'David Daney'" , linux-arm-kernel@lists.infradead.org, "'Catalin Marinas'" , "'Will Deacon'" , "'Bjorn Helgaas'" , linux-pci@vger.kernel.org, "'Thomas Gleixner'" , "'Jason Cooper'" Cc: linux-kernel@vger.kernel.org, "'Robert Richter'" , "'David Daney'" References: <1436979285-8177-1-git-send-email-ddaney.cavm@gmail.com> <1436979285-8177-3-git-send-email-ddaney.cavm@gmail.com> In-reply-to: <1436979285-8177-3-git-send-email-ddaney.cavm@gmail.com> Subject: RE: [PATCH 2/5] gic-its: Allow pci_requester_id to be overridden. Date: Thu, 20 Aug 2015 17:11:57 +0300 Message-id: <01a101d0db52$2d23b360$876b1a20$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AQGf2qBEZGgXkHP0rWPqoMWI1nNJBQLJMCNJnmCjUjA= Content-language: ru X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHIsWRmVeSWpSXmKPExsVy+t/xK7p6D66GGrQfVrdY0pRh8X5ZD6PF /t7DzBZH/r5itWhccpnFYtPja6wWl3fNYbM4O+84m8W3T++YLDZvmsps8fLjCRYHbo8189Yw esz4vYjFY+esu+weCzaVejQcOM/i8e7cOXaPzUvqPT5vkgvgiOKySUnNySxLLdK3S+DKWDlz BkvBE9GK2euPMzYwThPqYuTkkBAwkTj37iEThC0mceHeerYuRi4OIYGljBLnurewQjjfGSW2 TzjMDlLFJqAucfrrBxYQW0RgD5PE/ie2XYwcHMwCRRIT2o1ATCGBeomm23kgFZwCrhKvli0F 6xQW8JJYe+gpI4jNIqAqsbTrMhuIzStgKbG4/zMjhC0o8WPyPbDpzAJaEut3HmeCsOUlNq95 ywxxp4LEjrOvGSEusJI4u/sqG0SNiMS0f/eYJzAKzUIyahaSUbOQjJqFpGUBI8sqRtHU0uSC 4qT0XCO94sTc4tK8dL3k/NxNjJBY+7qDcekxq0OMAhyMSjy8GmJXQ4VYE8uKK3MPMUpwMCuJ 8O6/ARTiTUmsrEotyo8vKs1JLT7EKM3BoiTOO3PX+xAhgfTEktTs1NSC1CKYLBMHp1QD43XH c44cj/4HHZiVOT/kpPhG+xWnZjT3H5pz1yro/qFvoto7Y9ffsvuzWjK77sOM64l7uULLlBQM ny+d0WTLaBp+j4n1768Hyj/mX1rz4NWFPf8aWNVPb1NaFua176aaxobkU/fcgzcH9kxeFGK9 NebSoWjPG6s+7tMQXnb48+XfWf+UfuVy51cosRRnJBpqMRcVJwIAdNHXP7ECAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2956 Lines: 83 Hello! > -----Original Message----- > From: linux-pci-owner@vger.kernel.org [mailto:linux-pci-owner@vger.kernel.org] On Behalf Of David > Daney > Sent: Wednesday, July 15, 2015 7:55 PM > To: linux-arm-kernel@lists.infradead.org; Catalin Marinas; Will Deacon; Bjorn Helgaas; linux- > pci@vger.kernel.org; Thomas Gleixner; Jason Cooper > Cc: linux-kernel@vger.kernel.org; Robert Richter; David Daney > Subject: [PATCH 2/5] gic-its: Allow pci_requester_id to be overridden. > > From: David Daney > > Signed-off-by: David Daney > --- > drivers/irqchip/irq-gic-v3-its.c | 14 +++++++++++++- > include/linux/irqchip/arm-gic-v3.h | 2 ++ > 2 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c > index 1b7e155..4580970 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -1189,11 +1189,23 @@ static int its_pci_msi_vec_count(struct pci_dev *pdev) > return max(msi, msix); > } > > +static u32 its_dflt_pci_requester_id(struct pci_dev *pdev, u16 alias) > +{ > + return alias; > +} > + > +static its_pci_requester_id_t its_pci_requester_id = its_dflt_pci_requester_id; > +void set_its_pci_requester_id(its_pci_requester_id_t fn) > +{ > + its_pci_requester_id = fn; > +} > +EXPORT_SYMBOL(set_its_pci_requester_id); IMHO having a globally defined function is a horrible approach. What if some HW has two different PCI host controllers, each of them wants to provide different form of IDs? I know, this is just imaginary, but still... What if instead of this function we simply add a field to a struct pci_bus ? Then bus driver would fill in HW-specific ID bits for every bus. I can send a patch if interested. > + > static int its_get_pci_alias(struct pci_dev *pdev, u16 alias, void *data) > { > struct its_pci_alias *dev_alias = data; > > - dev_alias->dev_id = alias; > + dev_alias->dev_id = its_pci_requester_id(pdev, alias); > if (pdev != dev_alias->pdev) > dev_alias->count += its_pci_msi_vec_count(dev_alias->pdev); > > diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h > index ffbc034..18e3757 100644 > --- a/include/linux/irqchip/arm-gic-v3.h > +++ b/include/linux/irqchip/arm-gic-v3.h > @@ -389,6 +389,8 @@ int its_cpu_init(void); > int its_init(struct device_node *node, struct rdists *rdists, > struct irq_domain *domain); > > +typedef u32 (*its_pci_requester_id_t)(struct pci_dev *, u16); > +void set_its_pci_requester_id(its_pci_requester_id_t fn); > #endif > > #endif > -- Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/