Re: [RFC Patch 14/19] ACPI: Translate resource into master side address for bridge window resources

2015-01-21 Thread Rafael J. Wysocki
On Wednesday, January 21, 2015 01:36:21 PM Jiang Liu wrote:
> On 2015/1/21 8:50, Rafael J. Wysocki wrote:
> > On Thursday, January 08, 2015 10:33:01 AM Jiang Liu wrote:
> >> Add translation_offset into the result address for bridge window
> >> resources to form the master side address.
> >>
> >> Currently acpi_dev_resource_{ext_}address_space() are only used for
> >> devices instead of bridges, so it won't break current users. Later
> >> it will be used to support PCI host bridge drivers.
> >>
> >> Signed-off-by: Jiang Liu 
> >> ---
> >>  drivers/acpi/resource.c |   14 ++
> >>  1 file changed, 14 insertions(+)
> >>
> >> diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
> >> index d3aa56674bd4..16d334a1ee25 100644
> >> --- a/drivers/acpi/resource.c
> >> +++ b/drivers/acpi/resource.c
> >> @@ -203,6 +203,20 @@ static bool acpi_decode_space(struct resource *res, 
> >> resource_size_t *offset,
> >>res->start = addr->minimum;
> >>res->end = addr->maximum;
> >>  
> >> +  /*
> >> +   * For bridges that translate addresses across the bridge,
> >> +   * translation_offset is the offset that must be added to the
> >> +   * address on the secondary side to obtain the address on the
> >> +   * primary side. Non-bridge devices must list 0 for all Address
> >> +   * Translation offset bits.
> >> +   */
> >> +  if (base->producer_consumer == ACPI_PRODUCER) {
> > 
> > OK, so the assumption is that this check is never true in the current code, 
> > right?
> Yes.
> > 
> >> +  res->start += addr->translation_offset;
> >> +  res->end += addr->translation_offset;
> >> +  } else if (addr->translation_offset) {
> > 
> > And won't this break anything even if so?
> I'm trying to follow the spec, how about giving a warning here
> instead of failure?

Yes, that would be safer IMO.


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC Patch 14/19] ACPI: Translate resource into master side address for bridge window resources

2015-01-21 Thread Rafael J. Wysocki
On Wednesday, January 21, 2015 01:36:21 PM Jiang Liu wrote:
 On 2015/1/21 8:50, Rafael J. Wysocki wrote:
  On Thursday, January 08, 2015 10:33:01 AM Jiang Liu wrote:
  Add translation_offset into the result address for bridge window
  resources to form the master side address.
 
  Currently acpi_dev_resource_{ext_}address_space() are only used for
  devices instead of bridges, so it won't break current users. Later
  it will be used to support PCI host bridge drivers.
 
  Signed-off-by: Jiang Liu jiang@linux.intel.com
  ---
   drivers/acpi/resource.c |   14 ++
   1 file changed, 14 insertions(+)
 
  diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
  index d3aa56674bd4..16d334a1ee25 100644
  --- a/drivers/acpi/resource.c
  +++ b/drivers/acpi/resource.c
  @@ -203,6 +203,20 @@ static bool acpi_decode_space(struct resource *res, 
  resource_size_t *offset,
 res-start = addr-minimum;
 res-end = addr-maximum;
   
  +  /*
  +   * For bridges that translate addresses across the bridge,
  +   * translation_offset is the offset that must be added to the
  +   * address on the secondary side to obtain the address on the
  +   * primary side. Non-bridge devices must list 0 for all Address
  +   * Translation offset bits.
  +   */
  +  if (base-producer_consumer == ACPI_PRODUCER) {
  
  OK, so the assumption is that this check is never true in the current code, 
  right?
 Yes.
  
  +  res-start += addr-translation_offset;
  +  res-end += addr-translation_offset;
  +  } else if (addr-translation_offset) {
  
  And won't this break anything even if so?
 I'm trying to follow the spec, how about giving a warning here
 instead of failure?

Yes, that would be safer IMO.


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC Patch 14/19] ACPI: Translate resource into master side address for bridge window resources

2015-01-20 Thread Jiang Liu
On 2015/1/21 8:50, Rafael J. Wysocki wrote:
> On Thursday, January 08, 2015 10:33:01 AM Jiang Liu wrote:
>> Add translation_offset into the result address for bridge window
>> resources to form the master side address.
>>
>> Currently acpi_dev_resource_{ext_}address_space() are only used for
>> devices instead of bridges, so it won't break current users. Later
>> it will be used to support PCI host bridge drivers.
>>
>> Signed-off-by: Jiang Liu 
>> ---
>>  drivers/acpi/resource.c |   14 ++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
>> index d3aa56674bd4..16d334a1ee25 100644
>> --- a/drivers/acpi/resource.c
>> +++ b/drivers/acpi/resource.c
>> @@ -203,6 +203,20 @@ static bool acpi_decode_space(struct resource *res, 
>> resource_size_t *offset,
>>  res->start = addr->minimum;
>>  res->end = addr->maximum;
>>  
>> +/*
>> + * For bridges that translate addresses across the bridge,
>> + * translation_offset is the offset that must be added to the
>> + * address on the secondary side to obtain the address on the
>> + * primary side. Non-bridge devices must list 0 for all Address
>> + * Translation offset bits.
>> + */
>> +if (base->producer_consumer == ACPI_PRODUCER) {
> 
> OK, so the assumption is that this check is never true in the current code, 
> right?
Yes.
> 
>> +res->start += addr->translation_offset;
>> +res->end += addr->translation_offset;
>> +} else if (addr->translation_offset) {
> 
> And won't this break anything even if so?
I'm trying to follow the spec, how about giving a warning here
instead of failure?
Regards!
Gerry
> 
>> +return false;
>> +}
>> +
>>  switch(base->resource_type) {
>>  case ACPI_MEMORY_RANGE:
>>  acpi_dev_memresource_flags(res, len, wp);
>>
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC Patch 14/19] ACPI: Translate resource into master side address for bridge window resources

2015-01-20 Thread Rafael J. Wysocki
On Thursday, January 08, 2015 10:33:01 AM Jiang Liu wrote:
> Add translation_offset into the result address for bridge window
> resources to form the master side address.
> 
> Currently acpi_dev_resource_{ext_}address_space() are only used for
> devices instead of bridges, so it won't break current users. Later
> it will be used to support PCI host bridge drivers.
> 
> Signed-off-by: Jiang Liu 
> ---
>  drivers/acpi/resource.c |   14 ++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
> index d3aa56674bd4..16d334a1ee25 100644
> --- a/drivers/acpi/resource.c
> +++ b/drivers/acpi/resource.c
> @@ -203,6 +203,20 @@ static bool acpi_decode_space(struct resource *res, 
> resource_size_t *offset,
>   res->start = addr->minimum;
>   res->end = addr->maximum;
>  
> + /*
> +  * For bridges that translate addresses across the bridge,
> +  * translation_offset is the offset that must be added to the
> +  * address on the secondary side to obtain the address on the
> +  * primary side. Non-bridge devices must list 0 for all Address
> +  * Translation offset bits.
> +  */
> + if (base->producer_consumer == ACPI_PRODUCER) {

OK, so the assumption is that this check is never true in the current code, 
right?

> + res->start += addr->translation_offset;
> + res->end += addr->translation_offset;
> + } else if (addr->translation_offset) {

And won't this break anything even if so?

> + return false;
> + }
> +
>   switch(base->resource_type) {
>   case ACPI_MEMORY_RANGE:
>   acpi_dev_memresource_flags(res, len, wp);
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC Patch 14/19] ACPI: Translate resource into master side address for bridge window resources

2015-01-20 Thread Rafael J. Wysocki
On Thursday, January 08, 2015 10:33:01 AM Jiang Liu wrote:
 Add translation_offset into the result address for bridge window
 resources to form the master side address.
 
 Currently acpi_dev_resource_{ext_}address_space() are only used for
 devices instead of bridges, so it won't break current users. Later
 it will be used to support PCI host bridge drivers.
 
 Signed-off-by: Jiang Liu jiang@linux.intel.com
 ---
  drivers/acpi/resource.c |   14 ++
  1 file changed, 14 insertions(+)
 
 diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
 index d3aa56674bd4..16d334a1ee25 100644
 --- a/drivers/acpi/resource.c
 +++ b/drivers/acpi/resource.c
 @@ -203,6 +203,20 @@ static bool acpi_decode_space(struct resource *res, 
 resource_size_t *offset,
   res-start = addr-minimum;
   res-end = addr-maximum;
  
 + /*
 +  * For bridges that translate addresses across the bridge,
 +  * translation_offset is the offset that must be added to the
 +  * address on the secondary side to obtain the address on the
 +  * primary side. Non-bridge devices must list 0 for all Address
 +  * Translation offset bits.
 +  */
 + if (base-producer_consumer == ACPI_PRODUCER) {

OK, so the assumption is that this check is never true in the current code, 
right?

 + res-start += addr-translation_offset;
 + res-end += addr-translation_offset;
 + } else if (addr-translation_offset) {

And won't this break anything even if so?

 + return false;
 + }
 +
   switch(base-resource_type) {
   case ACPI_MEMORY_RANGE:
   acpi_dev_memresource_flags(res, len, wp);
 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC Patch 14/19] ACPI: Translate resource into master side address for bridge window resources

2015-01-20 Thread Jiang Liu
On 2015/1/21 8:50, Rafael J. Wysocki wrote:
 On Thursday, January 08, 2015 10:33:01 AM Jiang Liu wrote:
 Add translation_offset into the result address for bridge window
 resources to form the master side address.

 Currently acpi_dev_resource_{ext_}address_space() are only used for
 devices instead of bridges, so it won't break current users. Later
 it will be used to support PCI host bridge drivers.

 Signed-off-by: Jiang Liu jiang@linux.intel.com
 ---
  drivers/acpi/resource.c |   14 ++
  1 file changed, 14 insertions(+)

 diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
 index d3aa56674bd4..16d334a1ee25 100644
 --- a/drivers/acpi/resource.c
 +++ b/drivers/acpi/resource.c
 @@ -203,6 +203,20 @@ static bool acpi_decode_space(struct resource *res, 
 resource_size_t *offset,
  res-start = addr-minimum;
  res-end = addr-maximum;
  
 +/*
 + * For bridges that translate addresses across the bridge,
 + * translation_offset is the offset that must be added to the
 + * address on the secondary side to obtain the address on the
 + * primary side. Non-bridge devices must list 0 for all Address
 + * Translation offset bits.
 + */
 +if (base-producer_consumer == ACPI_PRODUCER) {
 
 OK, so the assumption is that this check is never true in the current code, 
 right?
Yes.
 
 +res-start += addr-translation_offset;
 +res-end += addr-translation_offset;
 +} else if (addr-translation_offset) {
 
 And won't this break anything even if so?
I'm trying to follow the spec, how about giving a warning here
instead of failure?
Regards!
Gerry
 
 +return false;
 +}
 +
  switch(base-resource_type) {
  case ACPI_MEMORY_RANGE:
  acpi_dev_memresource_flags(res, len, wp);

 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC Patch 14/19] ACPI: Translate resource into master side address for bridge window resources

2015-01-07 Thread Jiang Liu
Add translation_offset into the result address for bridge window
resources to form the master side address.

Currently acpi_dev_resource_{ext_}address_space() are only used for
devices instead of bridges, so it won't break current users. Later
it will be used to support PCI host bridge drivers.

Signed-off-by: Jiang Liu 
---
 drivers/acpi/resource.c |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index d3aa56674bd4..16d334a1ee25 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -203,6 +203,20 @@ static bool acpi_decode_space(struct resource *res, 
resource_size_t *offset,
res->start = addr->minimum;
res->end = addr->maximum;
 
+   /*
+* For bridges that translate addresses across the bridge,
+* translation_offset is the offset that must be added to the
+* address on the secondary side to obtain the address on the
+* primary side. Non-bridge devices must list 0 for all Address
+* Translation offset bits.
+*/
+   if (base->producer_consumer == ACPI_PRODUCER) {
+   res->start += addr->translation_offset;
+   res->end += addr->translation_offset;
+   } else if (addr->translation_offset) {
+   return false;
+   }
+
switch(base->resource_type) {
case ACPI_MEMORY_RANGE:
acpi_dev_memresource_flags(res, len, wp);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC Patch 14/19] ACPI: Translate resource into master side address for bridge window resources

2015-01-07 Thread Jiang Liu
Add translation_offset into the result address for bridge window
resources to form the master side address.

Currently acpi_dev_resource_{ext_}address_space() are only used for
devices instead of bridges, so it won't break current users. Later
it will be used to support PCI host bridge drivers.

Signed-off-by: Jiang Liu jiang@linux.intel.com
---
 drivers/acpi/resource.c |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index d3aa56674bd4..16d334a1ee25 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -203,6 +203,20 @@ static bool acpi_decode_space(struct resource *res, 
resource_size_t *offset,
res-start = addr-minimum;
res-end = addr-maximum;
 
+   /*
+* For bridges that translate addresses across the bridge,
+* translation_offset is the offset that must be added to the
+* address on the secondary side to obtain the address on the
+* primary side. Non-bridge devices must list 0 for all Address
+* Translation offset bits.
+*/
+   if (base-producer_consumer == ACPI_PRODUCER) {
+   res-start += addr-translation_offset;
+   res-end += addr-translation_offset;
+   } else if (addr-translation_offset) {
+   return false;
+   }
+
switch(base-resource_type) {
case ACPI_MEMORY_RANGE:
acpi_dev_memresource_flags(res, len, wp);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/