From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hanjun Guo Subject: Re: [PATCH V2 22/23] pci, acpi: Match PCI config space accessors against platfrom specific quirks. Date: Wed, 23 Dec 2015 17:38:45 +0800 Message-ID: <567A6BA5.1030408@linaro.org> References: <1450278993-12664-1-git-send-email-tn@semihalf.com> <1450278993-12664-23-git-send-email-tn@semihalf.com> <567923D2.2010202@semihalf.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Gabriele Paoloni , Tomasz Nowicki , "bhelgaas@google.com" , "arnd@arndb.de" , "will.deacon@arm.com" , "catalin.marinas@arm.com" , "rjw@rjwysocki.net" , "Lorenzo.Pieralisi@arm.com" , "okaya@codeaurora.org" , "jiang.liu@linux.intel.com" , "Stefano.Stabellini@eu.citrix.com" , "liudongdong (C)" Cc: "robert.richter@caviumnetworks.com" , "mw@semihalf.com" , "Liviu.Dudau@arm.com" , "ddaney@caviumnetworks.com" , "tglx@linutronix.de" , Wangyijing , "Suravee.Suthikulpanit@amd.com" , "msalter@redhat.com" , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linaro-acpi@lists.linaro.org" , "jchandra@broadcom.com" , "jcm@redhat.com" List-Id: linux-acpi@vger.kernel.org On 12/22/2015 10:48 PM, Gabriele Paoloni wrote: > Hi Tomasz > >> -----Original Message----- >> From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel- >> owner@vger.kernel.org] On Behalf Of Tomasz Nowicki >> Sent: 22 December 2015 10:20 >> To: Gabriele Paoloni; bhelgaas@google.com; arnd@arndb.de; >> will.deacon@arm.com; catalin.marinas@arm.com; rjw@rjwysocki.net; >> hanjun.guo@linaro.org; Lorenzo.Pieralisi@arm.com; okaya@codeaurora.org; >> jiang.liu@linux.intel.com; Stefano.Stabellini@eu.citrix.com >> Cc: robert.richter@caviumnetworks.com; mw@semihalf.com; >> Liviu.Dudau@arm.com; ddaney@caviumnetworks.com; tglx@linutronix.de; >> Wangyijing; Suravee.Suthikulpanit@amd.com; msalter@redhat.com; linux- >> pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux- >> acpi@vger.kernel.org; linux-kernel@vger.kernel.org; linaro- >> acpi@lists.linaro.org; jchandra@broadcom.com; jcm@redhat.com >> Subject: Re: [PATCH V2 22/23] pci, acpi: Match PCI config space >> accessors against platfrom specific quirks. >> >> On 21.12.2015 12:47, Gabriele Paoloni wrote: >>> 2) In the quirk mechanism you proposed, I see that the callback >> function >>> allows to do some preparation work for the host bridge. For >> example in >>> Hisilicon hip05 case we would need to read some values from the >> ACPI >>> table (see acpi_pci_root_hisi_add() function in >>> https://lkml.org/lkml/2015/12/3/426). >>> I am quite new to ACPI and I wonder if it is OK to add such >> "Packages" >>> to the PCI host bridge ACPI device...or maybe we need to declare >> a new >>> one...? >> >> I may miss sth so please correct me in that case. >> >> https://lkml.org/lkml/2015/12/3/426 shows that you need special >> handling for root->secondary.start bus number only, right? So how about >> creating special MCFG region only for >> . >> Like that: >> >> [0008] Base Address : >> [0002] Segment Group Number : >> [0001] Start Bus Number : secondary.start> >> [0001] End Bus Number : secondary.start> >> [0004] Reserved : 00000000 >> >> >> static const struct dmi_system_id hisi_quirk[] = { >> { >> .ident = "HiSi...", >> .matches = { >> DMI_MATCH(), >> }, >> }, >> { } >> }; >> >> static struct pci_ops hisi_ecam_pci_ops = { >> .map_bus = pci_mcfg_dev_base, >> .read = hisi_pcie_cfg_read, >> .write = hisi_pcie_cfg_write, >> }; >> >> DECLARE_ACPI_MCFG_FIXUP(hisi_quirk, &hisi_ecam_pci_ops, >> , ); >> >> With above code you can use your custom PCI config accessor only for >> that region. >> >> Let me know if that is not enough for you. > > In principle I think it can work... > > Liudongdong, Guo Hanjun what is your opinion about? Let me and Dongdong prepare a patch for Hip05 and then will back to this discussion to see if we met some problems. Thanks Hanjun From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933896AbbLWJjs (ORCPT ); Wed, 23 Dec 2015 04:39:48 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:33576 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754998AbbLWJjn (ORCPT ); Wed, 23 Dec 2015 04:39:43 -0500 From: Hanjun Guo Subject: Re: [PATCH V2 22/23] pci, acpi: Match PCI config space accessors against platfrom specific quirks. To: Gabriele Paoloni , Tomasz Nowicki , "bhelgaas@google.com" , "arnd@arndb.de" , "will.deacon@arm.com" , "catalin.marinas@arm.com" , "rjw@rjwysocki.net" , "Lorenzo.Pieralisi@arm.com" , "okaya@codeaurora.org" , "jiang.liu@linux.intel.com" , "Stefano.Stabellini@eu.citrix.com" , "liudongdong (C)" References: <1450278993-12664-1-git-send-email-tn@semihalf.com> <1450278993-12664-23-git-send-email-tn@semihalf.com> <567923D2.2010202@semihalf.com> Cc: "robert.richter@caviumnetworks.com" , "mw@semihalf.com" , "Liviu.Dudau@arm.com" , "ddaney@caviumnetworks.com" , "tglx@linutronix.de" , Wangyijing , "Suravee.Suthikulpanit@amd.com" , "msalter@redhat.com" , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linaro-acpi@lists.linaro.org" , "jchandra@broadcom.com" , "jcm@redhat.com" Message-ID: <567A6BA5.1030408@linaro.org> Date: Wed, 23 Dec 2015 17:38:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/22/2015 10:48 PM, Gabriele Paoloni wrote: > Hi Tomasz > >> -----Original Message----- >> From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel- >> owner@vger.kernel.org] On Behalf Of Tomasz Nowicki >> Sent: 22 December 2015 10:20 >> To: Gabriele Paoloni; bhelgaas@google.com; arnd@arndb.de; >> will.deacon@arm.com; catalin.marinas@arm.com; rjw@rjwysocki.net; >> hanjun.guo@linaro.org; Lorenzo.Pieralisi@arm.com; okaya@codeaurora.org; >> jiang.liu@linux.intel.com; Stefano.Stabellini@eu.citrix.com >> Cc: robert.richter@caviumnetworks.com; mw@semihalf.com; >> Liviu.Dudau@arm.com; ddaney@caviumnetworks.com; tglx@linutronix.de; >> Wangyijing; Suravee.Suthikulpanit@amd.com; msalter@redhat.com; linux- >> pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux- >> acpi@vger.kernel.org; linux-kernel@vger.kernel.org; linaro- >> acpi@lists.linaro.org; jchandra@broadcom.com; jcm@redhat.com >> Subject: Re: [PATCH V2 22/23] pci, acpi: Match PCI config space >> accessors against platfrom specific quirks. >> >> On 21.12.2015 12:47, Gabriele Paoloni wrote: >>> 2) In the quirk mechanism you proposed, I see that the callback >> function >>> allows to do some preparation work for the host bridge. For >> example in >>> Hisilicon hip05 case we would need to read some values from the >> ACPI >>> table (see acpi_pci_root_hisi_add() function in >>> https://lkml.org/lkml/2015/12/3/426). >>> I am quite new to ACPI and I wonder if it is OK to add such >> "Packages" >>> to the PCI host bridge ACPI device...or maybe we need to declare >> a new >>> one...? >> >> I may miss sth so please correct me in that case. >> >> https://lkml.org/lkml/2015/12/3/426 shows that you need special >> handling for root->secondary.start bus number only, right? So how about >> creating special MCFG region only for >> . >> Like that: >> >> [0008] Base Address : >> [0002] Segment Group Number : >> [0001] Start Bus Number : secondary.start> >> [0001] End Bus Number : secondary.start> >> [0004] Reserved : 00000000 >> >> >> static const struct dmi_system_id hisi_quirk[] = { >> { >> .ident = "HiSi...", >> .matches = { >> DMI_MATCH(), >> }, >> }, >> { } >> }; >> >> static struct pci_ops hisi_ecam_pci_ops = { >> .map_bus = pci_mcfg_dev_base, >> .read = hisi_pcie_cfg_read, >> .write = hisi_pcie_cfg_write, >> }; >> >> DECLARE_ACPI_MCFG_FIXUP(hisi_quirk, &hisi_ecam_pci_ops, >> , ); >> >> With above code you can use your custom PCI config accessor only for >> that region. >> >> Let me know if that is not enough for you. > > In principle I think it can work... > > Liudongdong, Guo Hanjun what is your opinion about? Let me and Dongdong prepare a patch for Hip05 and then will back to this discussion to see if we met some problems. Thanks Hanjun From mboxrd@z Thu Jan 1 00:00:00 1970 From: hanjun.guo@linaro.org (Hanjun Guo) Date: Wed, 23 Dec 2015 17:38:45 +0800 Subject: [PATCH V2 22/23] pci, acpi: Match PCI config space accessors against platfrom specific quirks. In-Reply-To: References: <1450278993-12664-1-git-send-email-tn@semihalf.com> <1450278993-12664-23-git-send-email-tn@semihalf.com> <567923D2.2010202@semihalf.com> Message-ID: <567A6BA5.1030408@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 12/22/2015 10:48 PM, Gabriele Paoloni wrote: > Hi Tomasz > >> -----Original Message----- >> From: linux-kernel-owner at vger.kernel.org [mailto:linux-kernel- >> owner at vger.kernel.org] On Behalf Of Tomasz Nowicki >> Sent: 22 December 2015 10:20 >> To: Gabriele Paoloni; bhelgaas at google.com; arnd at arndb.de; >> will.deacon at arm.com; catalin.marinas at arm.com; rjw at rjwysocki.net; >> hanjun.guo at linaro.org; Lorenzo.Pieralisi at arm.com; okaya at codeaurora.org; >> jiang.liu at linux.intel.com; Stefano.Stabellini at eu.citrix.com >> Cc: robert.richter at caviumnetworks.com; mw at semihalf.com; >> Liviu.Dudau at arm.com; ddaney at caviumnetworks.com; tglx at linutronix.de; >> Wangyijing; Suravee.Suthikulpanit at amd.com; msalter at redhat.com; linux- >> pci at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux- >> acpi at vger.kernel.org; linux-kernel at vger.kernel.org; linaro- >> acpi at lists.linaro.org; jchandra at broadcom.com; jcm at redhat.com >> Subject: Re: [PATCH V2 22/23] pci, acpi: Match PCI config space >> accessors against platfrom specific quirks. >> >> On 21.12.2015 12:47, Gabriele Paoloni wrote: >>> 2) In the quirk mechanism you proposed, I see that the callback >> function >>> allows to do some preparation work for the host bridge. For >> example in >>> Hisilicon hip05 case we would need to read some values from the >> ACPI >>> table (see acpi_pci_root_hisi_add() function in >>> https://lkml.org/lkml/2015/12/3/426). >>> I am quite new to ACPI and I wonder if it is OK to add such >> "Packages" >>> to the PCI host bridge ACPI device...or maybe we need to declare >> a new >>> one...? >> >> I may miss sth so please correct me in that case. >> >> https://lkml.org/lkml/2015/12/3/426 shows that you need special >> handling for root->secondary.start bus number only, right? So how about >> creating special MCFG region only for >> . >> Like that: >> >> [0008] Base Address : >> [0002] Segment Group Number : >> [0001] Start Bus Number : secondary.start> >> [0001] End Bus Number : secondary.start> >> [0004] Reserved : 00000000 >> >> >> static const struct dmi_system_id hisi_quirk[] = { >> { >> .ident = "HiSi...", >> .matches = { >> DMI_MATCH(), >> }, >> }, >> { } >> }; >> >> static struct pci_ops hisi_ecam_pci_ops = { >> .map_bus = pci_mcfg_dev_base, >> .read = hisi_pcie_cfg_read, >> .write = hisi_pcie_cfg_write, >> }; >> >> DECLARE_ACPI_MCFG_FIXUP(hisi_quirk, &hisi_ecam_pci_ops, >> , ); >> >> With above code you can use your custom PCI config accessor only for >> that region. >> >> Let me know if that is not enough for you. > > In principle I think it can work... > > Liudongdong, Guo Hanjun what is your opinion about? Let me and Dongdong prepare a patch for Hip05 and then will back to this discussion to see if we met some problems. Thanks Hanjun