All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dongdong Liu <liudongdong3@huawei.com>
To: Tomasz Nowicki <tn@semihalf.com>,
	helgaas@kernel.org, arnd@arndb.de, rafael@kernel.org,
	Lorenzo.Pieralisi@arm.com, wangzhou1@hisilicon.com,
	pratyush.anand@gmail.com
Cc: linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, jcm@redhat.com,
	gabriele.paoloni@huawei.com, charles.chenxin@huawei.com,
	hanjun.guo@linaro.org, linuxarm@huawei.com
Subject: Re: [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform
Date: Wed, 23 Nov 2016 09:44:24 +0800	[thread overview]
Message-ID: <7c6b49b1-fa79-d0b0-180e-25a342350245@huawei.com> (raw)
In-Reply-To: <56c1d551-a18d-8ee0-eb3c-b2b7d5341161@semihalf.com>

Hi Tomasz

在 2016/11/22 20:32, Tomasz Nowicki 写道:
> Hi Dongdong,
>
> On 22.11.2016 13:08, Dongdong Liu wrote:
>> The acpi_get_rc_resources() is used to get the RC register address that can
>> not be described in MCFG. It takes the _HID&segment to look for and returns
>> the RC address resource. Use PNP0C02 devices to describe such RC address
>> resource. Use _UID to match segment to tell which root bus the PNP0C02
>> resource belong to.
>>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
>> ---
>>  drivers/pci/pci-acpi.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>  drivers/pci/pci.h      |  4 +++
>>  2 files changed, 73 insertions(+)
>>
>> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
>> index d966d47..76fd6f4 100644
>> --- a/drivers/pci/pci-acpi.c
>> +++ b/drivers/pci/pci-acpi.c
>> @@ -29,6 +29,75 @@
>>      0x91, 0x17, 0xea, 0x4d, 0x19, 0xc3, 0x43, 0x4d
>>  };
>>
>> +#ifdef CONFIG_ARM64
>> +static struct resource *acpi_get_rc_addr(struct acpi_device *adev)
>> +{
>> +    struct resource_entry *entry;
>> +    struct list_head list;
>> +    unsigned long flags;
>> +    int ret;
>> +    struct resource *res;
>> +
>> +    INIT_LIST_HEAD(&list);
>> +    flags = IORESOURCE_MEM;
>> +    ret = acpi_dev_get_resources(adev, &list,
>> +                     acpi_dev_filter_resource_type_cb,
>> +                     (void *) flags);
>> +    if (ret <= 0)
>> +        return NULL;
>> +
>> +    entry = list_first_entry(&list, struct resource_entry, node);
>> +    res = entry->res;
>
> You return "res" memory pointer and...
>
>> +    acpi_dev_free_resource_list(&list);
>
> free it here.

  acpi_dev_free_resource_list
	--->resource_list_free
		--->resource_list_destroy_entry
			--->resource_list_free_entry
				--->kfree(entry)
only free entry not free entry->res, so this is ok.

Thanks
Dongdong
>
>> +    return res;
>> +}
>
>
> We either allocate memory for res here or get it from the caller.
>
> Tomasz
>
> .
>


WARNING: multiple messages have this Message-ID (diff)
From: Dongdong Liu <liudongdong3@huawei.com>
To: Tomasz Nowicki <tn@semihalf.com>, <helgaas@kernel.org>,
	<arnd@arndb.de>, <rafael@kernel.org>, <Lorenzo.Pieralisi@arm.com>,
	<wangzhou1@hisilicon.com>, <pratyush.anand@gmail.com>
Cc: <linux-pci@vger.kernel.org>, <linux-acpi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <jcm@redhat.com>,
	<gabriele.paoloni@huawei.com>, <charles.chenxin@huawei.com>,
	<hanjun.guo@linaro.org>, <linuxarm@huawei.com>
Subject: Re: [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform
Date: Wed, 23 Nov 2016 09:44:24 +0800	[thread overview]
Message-ID: <7c6b49b1-fa79-d0b0-180e-25a342350245@huawei.com> (raw)
In-Reply-To: <56c1d551-a18d-8ee0-eb3c-b2b7d5341161@semihalf.com>

Hi Tomasz

在 2016/11/22 20:32, Tomasz Nowicki 写道:
> Hi Dongdong,
>
> On 22.11.2016 13:08, Dongdong Liu wrote:
>> The acpi_get_rc_resources() is used to get the RC register address that can
>> not be described in MCFG. It takes the _HID&segment to look for and returns
>> the RC address resource. Use PNP0C02 devices to describe such RC address
>> resource. Use _UID to match segment to tell which root bus the PNP0C02
>> resource belong to.
>>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
>> ---
>>  drivers/pci/pci-acpi.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>  drivers/pci/pci.h      |  4 +++
>>  2 files changed, 73 insertions(+)
>>
>> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
>> index d966d47..76fd6f4 100644
>> --- a/drivers/pci/pci-acpi.c
>> +++ b/drivers/pci/pci-acpi.c
>> @@ -29,6 +29,75 @@
>>      0x91, 0x17, 0xea, 0x4d, 0x19, 0xc3, 0x43, 0x4d
>>  };
>>
>> +#ifdef CONFIG_ARM64
>> +static struct resource *acpi_get_rc_addr(struct acpi_device *adev)
>> +{
>> +    struct resource_entry *entry;
>> +    struct list_head list;
>> +    unsigned long flags;
>> +    int ret;
>> +    struct resource *res;
>> +
>> +    INIT_LIST_HEAD(&list);
>> +    flags = IORESOURCE_MEM;
>> +    ret = acpi_dev_get_resources(adev, &list,
>> +                     acpi_dev_filter_resource_type_cb,
>> +                     (void *) flags);
>> +    if (ret <= 0)
>> +        return NULL;
>> +
>> +    entry = list_first_entry(&list, struct resource_entry, node);
>> +    res = entry->res;
>
> You return "res" memory pointer and...
>
>> +    acpi_dev_free_resource_list(&list);
>
> free it here.

  acpi_dev_free_resource_list
	--->resource_list_free
		--->resource_list_destroy_entry
			--->resource_list_free_entry
				--->kfree(entry)
only free entry not free entry->res, so this is ok.

Thanks
Dongdong
>
>> +    return res;
>> +}
>
>
> We either allocate memory for res here or get it from the caller.
>
> Tomasz
>
> .
>

  reply	other threads:[~2016-11-23  1:45 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22 12:08 [PATCH V6 0/2] Add ACPI support for HiSilicon SoCs Host Controllers Dongdong Liu
2016-11-22 12:08 ` Dongdong Liu
2016-11-22 12:08 ` [PATCH V6 1/2] PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform Dongdong Liu
2016-11-22 12:08   ` Dongdong Liu
2016-11-22 12:32   ` Tomasz Nowicki
2016-11-23  1:44     ` Dongdong Liu [this message]
2016-11-23  1:44       ` Dongdong Liu
2016-11-23  2:24       ` Dongdong Liu
2016-11-23  2:24         ` Dongdong Liu
2016-11-22 15:56   ` Lorenzo Pieralisi
2016-11-22 16:09     ` Gabriele Paoloni
2016-11-22 16:09       ` Gabriele Paoloni
2016-11-22 17:03       ` Lorenzo Pieralisi
2016-11-22 12:08 ` [PATCH V6 2/2] PCI/ACPI: hisi: Add ACPI support for HiSilicon SoCs Host Controllers Dongdong Liu
2016-11-22 12:08   ` Dongdong Liu
2016-11-22 13:58   ` Tomasz Nowicki
2016-11-22 15:05     ` Gabriele Paoloni
2016-11-22 15:05       ` Gabriele Paoloni
2016-11-23  9:44       ` Graeme Gregory
2016-11-23 14:02         ` Gabriele Paoloni
2016-11-23 14:02           ` Gabriele Paoloni
2016-12-22  8:31 ` [PATCH V6 0/2] " Ming Lei
2016-12-22  8:31   ` Ming Lei
2016-12-22 12:30   ` Dongdong Liu
2016-12-22 12:30     ` Dongdong Liu
2016-12-22 12:40     ` Ming Lei
2016-12-22 12:40       ` Ming Lei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c6b49b1-fa79-d0b0-180e-25a342350245@huawei.com \
    --to=liudongdong3@huawei.com \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=arnd@arndb.de \
    --cc=charles.chenxin@huawei.com \
    --cc=gabriele.paoloni@huawei.com \
    --cc=hanjun.guo@linaro.org \
    --cc=helgaas@kernel.org \
    --cc=jcm@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=pratyush.anand@gmail.com \
    --cc=rafael@kernel.org \
    --cc=tn@semihalf.com \
    --cc=wangzhou1@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.