From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752381AbbEMFix (ORCPT ); Wed, 13 May 2015 01:38:53 -0400 Received: from mga11.intel.com ([192.55.52.93]:41329 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751776AbbEMFit (ORCPT ); Wed, 13 May 2015 01:38:49 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,419,1427785200"; d="scan'208";a="570530449" Message-ID: <5552E35D.8030501@linux.intel.com> Date: Wed, 13 May 2015 13:38:37 +0800 From: Jiang Liu Organization: Intel User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Hanjun Guo , "Rafael J . Wysocki" , Bjorn Helgaas , Marc Zyngier , Yijing Wang , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org CC: Lv Zheng , "lenb @ kernel . org" , LKML , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [RFC v2 6/7] x86/PCI/ACPI: Use common interface to support PCI host bridge References: <1430793970-11159-1-git-send-email-jiang.liu@linux.intel.com> <1430793970-11159-7-git-send-email-jiang.liu@linux.intel.com> <5551EFC1.2010704@linaro.org> In-Reply-To: <5551EFC1.2010704@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/5/12 20:19, Hanjun Guo wrote: > [...] >> struct pci_root_info { >> - struct acpi_device *bridge; >> - char name[16]; >> - struct pci_controller sd; >> + struct acpi_pci_root_info_common common; >> #ifdef CONFIG_PCI_MMCONFIG >> bool mcfg_added; >> u16 segment; >> @@ -165,14 +164,17 @@ static int check_segment(u16 seg, struct device >> *dev, char *estr) >> return 0; >> } >> >> -static int setup_mcfg_map(struct pci_root_info *info, u16 seg, u8 start, >> - u8 end, phys_addr_t addr) >> +static int setup_mcfg_map(struct acpi_pci_root_info_common *ci) >> { >> int result; >> - struct device *dev = &info->bridge->dev; >> + struct pci_root_info *info; >> + struct acpi_pci_root *root = ci->root; >> + struct device *dev = &ci->bridge->dev; >> + int seg = ci->controller.segment; > > ... > >> >> - info->start_bus = start; >> - info->end_bus = end; >> + info = container_of(ci, struct pci_root_info, common); >> + info->start_bus = (u8)root->secondary.start; >> + info->end_bus = (u8)root->secondary.end; >> info->mcfg_added = false; > > info->segment is not initialized here > >> >> /* return success if MMCFG is not in use */ >> @@ -182,7 +184,8 @@ static int setup_mcfg_map(struct pci_root_info >> *info, u16 seg, u8 start, >> if (!(pci_probe & PCI_PROBE_MMCONF)) >> return check_segment(seg, dev, "MMCONFIG is disabled,"); >> >> - result = pci_mmconfig_insert(dev, seg, start, end, addr); >> + result = pci_mmconfig_insert(dev, seg, info->start_bus, >> info->end_bus, >> + root->mcfg_addr); >> if (result == 0) { >> /* enable MMCFG if it hasn't been enabled yet */ >> if (raw_pci_ext_ops == NULL) >> @@ -195,8 +198,11 @@ static int setup_mcfg_map(struct pci_root_info >> *info, u16 seg, u8 start, >> return 0; >> } >> >> -static void teardown_mcfg_map(struct pci_root_info *info) >> +static void teardown_mcfg_map(struct acpi_pci_root_info_common *ci) >> { >> + struct pci_root_info *info; >> + >> + info = container_of(ci, struct pci_root_info, common); >> if (info->mcfg_added) { >> pci_mmconfig_delete(info->segment, info->start_bus, > > But the segment is used here to delete mmconfig entry, it seems that > the domain is 0 so there will be no problem, did I miss something? Good catch, we should use ci->controller.segment and kill info->segment. > > Thanks > Hanjun