[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAE9FiQW2aFMxO54aD_GFSegjsfwexA2E+azFr3bqkh9248z3Uw@mail.gmail.com>
Date: Wed, 8 Aug 2012 17:01:50 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: charlie.mear@...com
Cc: ">" <"tglx@...utronix.de, mingo@...hat.com, hpa"@zytor.com>,
x86@...nel.org, bhelgaas@...gle.com, jbarnes@...tuousgeek.org,
davej@...hat.com, liuj97@...il.com, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org
Subject: Re: [PATCH] x86/pci: Allow x86 platforms to use translation offsets
On Wed, Aug 8, 2012 at 4:42 PM, <charlie.mear@...com> wrote:
> From: Charlie Mear <charlie.mear@...com>
>
> The memory range descriptors in the _CRS control method contain an
> address translation offset for host bridges. This value is used to
> translate addresses across the bridge. The support to use _TRA values
> is present for other architectures but not for X86 platforms.
>
> For existing X86 platforms the _TRA value is zero. Non zero _TRA values
> are expected on future X86 platforms and this change will register that
> value with the resource.
>
> Signed-off-by: Charlie Mear <charlie.mear@...com>
> ---
> arch/x86/pci/acpi.c | 18 ++++++++++++++++--
> 1 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
> index 505acdd..37acbae 100644
> --- a/arch/x86/pci/acpi.c
> +++ b/arch/x86/pci/acpi.c
> @@ -12,6 +12,7 @@ struct pci_root_info {
> char name[16];
> unsigned int res_num;
> struct resource *res;
> + u64 *res_offset;
resource_size_t * ?
> struct pci_sysdata sd;
> #ifdef CONFIG_PCI_MMCONFIG
> bool mcfg_added;
> @@ -306,6 +307,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
> res->start = start;
> res->end = end;
> res->child = NULL;
> + info->res_offset[info->res_num] = addr.translation_offset;
>
> if (!pci_use_crs) {
> dev_printk(KERN_DEBUG, &info->bridge->dev,
> @@ -375,7 +377,8 @@ static void add_resources(struct pci_root_info *info,
> "ignoring host bridge window %pR (conflicts with %s %pR)\n",
> res, conflict->name, conflict);
> else
> - pci_add_resource(resources, res);
> + pci_add_resource_offset(resources, res,
> + info->res_offset[i]);
> }
> }
>
> @@ -383,6 +386,8 @@ static void free_pci_root_info_res(struct pci_root_info *info)
> {
> kfree(info->res);
> info->res = NULL;
> + kfree(info->res_offset);
> + info->res_offset = NULL;
> info->res_num = 0;
> }
>
> @@ -433,11 +438,20 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
> return;
>
> size = sizeof(*info->res) * info->res_num;
> - info->res_num = 0;
> info->res = kmalloc(size, GFP_KERNEL);
> if (!info->res)
you need to info->res_num = 0 here
> return;
>
> + size = sizeof(*info->res_offset) * info->res_num;
> + info->res_offset = kmalloc(size, GFP_KERNEL);
> + if (!info->res_offset) {
> + kfree(info->res);
> + info->res = NULL;
> + return;
> + }
> + info->res_num = 0;
need to move it before: if (!info->res_offset) {
Thanks
Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists