All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-04-15 15:18 ` Pierre-Louis Bossart
  0 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2019-04-15 15:18 UTC (permalink / raw)
  To: alsa-devel
  Cc: linux-kernel, tiwai, broonie, vkoul, gregkh, liam.r.girdwood,
	jank, joe, srinivas.kandagatla, Pierre-Louis Bossart,
	Rafael J. Wysocki, Len Brown, Robert Moore, Erik Schmauss,
	open list:ACPI, open list:ACPI COMPONENT ARCHITECTURE ACPICA

Standards such as the MIPI DisCo for SoundWire 1.0 specification
assume the _ADR field is 64 bits.

_ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
released in 2002. The low levels already use _ADR as 64 bits, e.g. in
struct acpi_device_info.

This patch bumps the representation used for sysfs to 64 bits.

Example with a SoundWire device, the results show the complete
vendorID and linkID which were omitted before:

Before:
$ more /sys/bus/acpi/devices/device\:38/adr
0x5d070000
After:
$ more /sys/bus/acpi/devices/device\:38/adr
0x000010025d070000

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/acpi/device_sysfs.c | 3 +--
 include/acpi/acpi_bus.h     | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
index 8940054d6250..f8d73ae42529 100644
--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -428,8 +428,7 @@ static ssize_t acpi_device_adr_show(struct device *dev,
 {
 	struct acpi_device *acpi_dev = to_acpi_device(dev);
 
-	return sprintf(buf, "0x%08x\n",
-		       (unsigned int)(acpi_dev->pnp.bus_address));
+	return sprintf(buf, "0x%016llx\n", acpi_dev->pnp.bus_address);
 }
 static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
 
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f7981751ac77..9075e28ea60a 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -230,7 +230,7 @@ struct acpi_device_dir {
 /* Plug and Play */
 
 typedef char acpi_bus_id[8];
-typedef unsigned long acpi_bus_address;
+typedef u64 acpi_bus_address;
 typedef char acpi_device_name[40];
 typedef char acpi_device_class[20];
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-04-15 15:18 ` Pierre-Louis Bossart
  0 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2019-04-15 15:18 UTC (permalink / raw)
  To: alsa-devel
  Cc: linux-kernel, tiwai, broonie, vkoul, gregkh, liam.r.girdwood,
	jank, joe, srinivas.kandagatla, Pierre-Louis Bossart,
	Rafael J. Wysocki, Len Brown, Robert Moore, Erik Schmauss,
	open list:ACPI, open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

Standards such as the MIPI DisCo for SoundWire 1.0 specification
assume the _ADR field is 64 bits.

_ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
released in 2002. The low levels already use _ADR as 64 bits, e.g. in
struct acpi_device_info.

This patch bumps the representation used for sysfs to 64 bits.

Example with a SoundWire device, the results show the complete
vendorID and linkID which were omitted before:

Before:
$ more /sys/bus/acpi/devices/device\:38/adr
0x5d070000
After:
$ more /sys/bus/acpi/devices/device\:38/adr
0x000010025d070000

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/acpi/device_sysfs.c | 3 +--
 include/acpi/acpi_bus.h     | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
index 8940054d6250..f8d73ae42529 100644
--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -428,8 +428,7 @@ static ssize_t acpi_device_adr_show(struct device *dev,
 {
 	struct acpi_device *acpi_dev = to_acpi_device(dev);
 
-	return sprintf(buf, "0x%08x\n",
-		       (unsigned int)(acpi_dev->pnp.bus_address));
+	return sprintf(buf, "0x%016llx\n", acpi_dev->pnp.bus_address);
 }
 static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
 
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f7981751ac77..9075e28ea60a 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -230,7 +230,7 @@ struct acpi_device_dir {
 /* Plug and Play */
 
 typedef char acpi_bus_id[8];
-typedef unsigned long acpi_bus_address;
+typedef u64 acpi_bus_address;
 typedef char acpi_device_name[40];
 typedef char acpi_device_class[20];
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
  2019-04-15 15:18 ` Pierre-Louis Bossart
  (?)
@ 2019-04-16  3:29 ` Vinod Koul
  2019-04-16  8:09     ` Rafael J. Wysocki
  -1 siblings, 1 reply; 13+ messages in thread
From: Vinod Koul @ 2019-04-16  3:29 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, linux-kernel, tiwai, broonie, gregkh,
	liam.r.girdwood, jank, joe, srinivas.kandagatla,
	Rafael J. Wysocki, Len Brown, Robert Moore, Erik Schmauss,
	open list:ACPI, open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

On 15-04-19, 10:18, Pierre-Louis Bossart wrote:
> Standards such as the MIPI DisCo for SoundWire 1.0 specification
> assume the _ADR field is 64 bits.
> 
> _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
> released in 2002. The low levels already use _ADR as 64 bits, e.g. in
> struct acpi_device_info.
> 
> This patch bumps the representation used for sysfs to 64 bits.
> 
> Example with a SoundWire device, the results show the complete
> vendorID and linkID which were omitted before:
> 
> Before:
> $ more /sys/bus/acpi/devices/device\:38/adr
> 0x5d070000
> After:
> $ more /sys/bus/acpi/devices/device\:38/adr
> 0x000010025d070000

This looks fine but the sysfs file is an ABI. Not sure if we can modify
the value returned this way.. Though it should not cause userspace
reading 32bits to break...


> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  drivers/acpi/device_sysfs.c | 3 +--
>  include/acpi/acpi_bus.h     | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
> index 8940054d6250..f8d73ae42529 100644
> --- a/drivers/acpi/device_sysfs.c
> +++ b/drivers/acpi/device_sysfs.c
> @@ -428,8 +428,7 @@ static ssize_t acpi_device_adr_show(struct device *dev,
>  {
>  	struct acpi_device *acpi_dev = to_acpi_device(dev);
>  
> -	return sprintf(buf, "0x%08x\n",
> -		       (unsigned int)(acpi_dev->pnp.bus_address));
> +	return sprintf(buf, "0x%016llx\n", acpi_dev->pnp.bus_address);
>  }
>  static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
>  
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index f7981751ac77..9075e28ea60a 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -230,7 +230,7 @@ struct acpi_device_dir {
>  /* Plug and Play */
>  
>  typedef char acpi_bus_id[8];
> -typedef unsigned long acpi_bus_address;
> +typedef u64 acpi_bus_address;
>  typedef char acpi_device_name[40];
>  typedef char acpi_device_class[20];
>  
> -- 
> 2.17.1

-- 
~Vinod

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-04-16  8:09     ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2019-04-16  8:09 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Pierre-Louis Bossart,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linux Kernel Mailing List, Takashi Iwai, Mark Brown,
	Greg Kroah-Hartman, Liam Girdwood, jank, Joe Perches,
	Srini Kandagatla, Rafael J. Wysocki, Len Brown, Robert Moore,
	Erik Schmauss, open list:ACPI,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

On Tue, Apr 16, 2019 at 5:29 AM Vinod Koul <vkoul@kernel.org> wrote:
>
> On 15-04-19, 10:18, Pierre-Louis Bossart wrote:
> > Standards such as the MIPI DisCo for SoundWire 1.0 specification
> > assume the _ADR field is 64 bits.
> >
> > _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
> > released in 2002. The low levels already use _ADR as 64 bits, e.g. in
> > struct acpi_device_info.
> >
> > This patch bumps the representation used for sysfs to 64 bits.
> >
> > Example with a SoundWire device, the results show the complete
> > vendorID and linkID which were omitted before:
> >
> > Before:
> > $ more /sys/bus/acpi/devices/device\:38/adr
> > 0x5d070000
> > After:
> > $ more /sys/bus/acpi/devices/device\:38/adr
> > 0x000010025d070000
>
> This looks fine but the sysfs file is an ABI. Not sure if we can modify
> the value returned this way.. Though it should not cause userspace
> reading 32bits to break...

Well, IIRC using "08" instead of "016" in the format field would
preserve the existing behavior for 32-bit values, wouldn't it?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-04-16  8:09     ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2019-04-16  8:09 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Pierre-Louis Bossart,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linux Kernel Mailing List, Takashi Iwai, Mark Brown,
	Greg Kroah-Hartman, Liam Girdwood, jank, Joe Perches,
	Srini Kandagatla, Rafael J. Wysocki, Len Brown, Robert Moore,
	Erik Schmauss, open list:ACPI,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

On Tue, Apr 16, 2019 at 5:29 AM Vinod Koul <vkoul@kernel.org> wrote:
>
> On 15-04-19, 10:18, Pierre-Louis Bossart wrote:
> > Standards such as the MIPI DisCo for SoundWire 1.0 specification
> > assume the _ADR field is 64 bits.
> >
> > _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
> > released in 2002. The low levels already use _ADR as 64 bits, e.g. in
> > struct acpi_device_info.
> >
> > This patch bumps the representation used for sysfs to 64 bits.
> >
> > Example with a SoundWire device, the results show the complete
> > vendorID and linkID which were omitted before:
> >
> > Before:
> > $ more /sys/bus/acpi/devices/device\:38/adr
> > 0x5d070000
> > After:
> > $ more /sys/bus/acpi/devices/device\:38/adr
> > 0x000010025d070000
>
> This looks fine but the sysfs file is an ABI. Not sure if we can modify
> the value returned this way.. Though it should not cause userspace
> reading 32bits to break...

Well, IIRC using "08" instead of "016" in the format field would
preserve the existing behavior for 32-bit values, wouldn't it?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Devel] [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-04-16  8:09     ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2019-04-16  8:09 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

On Tue, Apr 16, 2019 at 5:29 AM Vinod Koul <vkoul(a)kernel.org> wrote:
>
> On 15-04-19, 10:18, Pierre-Louis Bossart wrote:
> > Standards such as the MIPI DisCo for SoundWire 1.0 specification
> > assume the _ADR field is 64 bits.
> >
> > _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
> > released in 2002. The low levels already use _ADR as 64 bits, e.g. in
> > struct acpi_device_info.
> >
> > This patch bumps the representation used for sysfs to 64 bits.
> >
> > Example with a SoundWire device, the results show the complete
> > vendorID and linkID which were omitted before:
> >
> > Before:
> > $ more /sys/bus/acpi/devices/device\:38/adr
> > 0x5d070000
> > After:
> > $ more /sys/bus/acpi/devices/device\:38/adr
> > 0x000010025d070000
>
> This looks fine but the sysfs file is an ABI. Not sure if we can modify
> the value returned this way.. Though it should not cause userspace
> reading 32bits to break...

Well, IIRC using "08" instead of "016" in the format field would
preserve the existing behavior for 32-bit values, wouldn't it?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-04-16  9:09       ` Vinod Koul
  0 siblings, 0 replies; 13+ messages in thread
From: Vinod Koul @ 2019-04-16  9:09 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Pierre-Louis Bossart,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linux Kernel Mailing List, Takashi Iwai, Mark Brown,
	Greg Kroah-Hartman, Liam Girdwood, jank, Joe Perches,
	Srini Kandagatla, Rafael J. Wysocki, Len Brown, Robert Moore,
	Erik Schmauss, open list:ACPI,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

On 16-04-19, 10:09, Rafael J. Wysocki wrote:
> On Tue, Apr 16, 2019 at 5:29 AM Vinod Koul <vkoul@kernel.org> wrote:
> >
> > On 15-04-19, 10:18, Pierre-Louis Bossart wrote:
> > > Standards such as the MIPI DisCo for SoundWire 1.0 specification
> > > assume the _ADR field is 64 bits.
> > >
> > > _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
> > > released in 2002. The low levels already use _ADR as 64 bits, e.g. in
> > > struct acpi_device_info.
> > >
> > > This patch bumps the representation used for sysfs to 64 bits.
> > >
> > > Example with a SoundWire device, the results show the complete
> > > vendorID and linkID which were omitted before:
> > >
> > > Before:
> > > $ more /sys/bus/acpi/devices/device\:38/adr
> > > 0x5d070000
> > > After:
> > > $ more /sys/bus/acpi/devices/device\:38/adr
> > > 0x000010025d070000
> >
> > This looks fine but the sysfs file is an ABI. Not sure if we can modify
> > the value returned this way.. Though it should not cause userspace
> > reading 32bits to break...
> 
> Well, IIRC using "08" instead of "016" in the format field would
> preserve the existing behavior for 32-bit values, wouldn't it?

Yeah that should do :)

-- 
~Vinod

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-04-16  9:09       ` Vinod Koul
  0 siblings, 0 replies; 13+ messages in thread
From: Vinod Koul @ 2019-04-16  9:09 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Pierre-Louis Bossart,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	Linux Kernel Mailing List, Takashi Iwai, Mark Brown,
	Greg Kroah-Hartman, Liam Girdwood, jank, Joe Perches,
	Srini Kandagatla, Rafael J. Wysocki, Len Brown, Robert Moore,
	Erik Schmauss, open list:ACPI,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA)

On 16-04-19, 10:09, Rafael J. Wysocki wrote:
> On Tue, Apr 16, 2019 at 5:29 AM Vinod Koul <vkoul@kernel.org> wrote:
> >
> > On 15-04-19, 10:18, Pierre-Louis Bossart wrote:
> > > Standards such as the MIPI DisCo for SoundWire 1.0 specification
> > > assume the _ADR field is 64 bits.
> > >
> > > _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
> > > released in 2002. The low levels already use _ADR as 64 bits, e.g. in
> > > struct acpi_device_info.
> > >
> > > This patch bumps the representation used for sysfs to 64 bits.
> > >
> > > Example with a SoundWire device, the results show the complete
> > > vendorID and linkID which were omitted before:
> > >
> > > Before:
> > > $ more /sys/bus/acpi/devices/device\:38/adr
> > > 0x5d070000
> > > After:
> > > $ more /sys/bus/acpi/devices/device\:38/adr
> > > 0x000010025d070000
> >
> > This looks fine but the sysfs file is an ABI. Not sure if we can modify
> > the value returned this way.. Though it should not cause userspace
> > reading 32bits to break...
> 
> Well, IIRC using "08" instead of "016" in the format field would
> preserve the existing behavior for 32-bit values, wouldn't it?

Yeah that should do :)

-- 
~Vinod

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [alsa-devel] [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-04-30 18:23       ` Pierre-Louis Bossart
  0 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2019-04-30 18:23 UTC (permalink / raw)
  To: Rafael J. Wysocki, Vinod Koul
  Cc: moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list:ACPI, Takashi Iwai, Greg Kroah-Hartman,
	Rafael J. Wysocki, Linux Kernel Mailing List, Liam Girdwood,
	Robert Moore, Mark Brown, Srini Kandagatla, jank, Joe Perches,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Erik Schmauss, Len Brown



On 4/16/19 3:09 AM, Rafael J. Wysocki wrote:
> On Tue, Apr 16, 2019 at 5:29 AM Vinod Koul <vkoul@kernel.org> wrote:
>>
>> On 15-04-19, 10:18, Pierre-Louis Bossart wrote:
>>> Standards such as the MIPI DisCo for SoundWire 1.0 specification
>>> assume the _ADR field is 64 bits.
>>>
>>> _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
>>> released in 2002. The low levels already use _ADR as 64 bits, e.g. in
>>> struct acpi_device_info.
>>>
>>> This patch bumps the representation used for sysfs to 64 bits.
>>>
>>> Example with a SoundWire device, the results show the complete
>>> vendorID and linkID which were omitted before:
>>>
>>> Before:
>>> $ more /sys/bus/acpi/devices/device\:38/adr
>>> 0x5d070000
>>> After:
>>> $ more /sys/bus/acpi/devices/device\:38/adr
>>> 0x000010025d070000
>>
>> This looks fine but the sysfs file is an ABI. Not sure if we can modify
>> the value returned this way.. Though it should not cause userspace
>> reading 32bits to break...
> 
> Well, IIRC using "08" instead of "016" in the format field would
> preserve the existing behavior for 32-bit values, wouldn't it?

yes, but it makes the 64-bit address not aligned depending on the number 
of leading zeroes, see below. I get a migraine just looking at the results.

Maybe add a test to use 08 for values that are below 0xFFFFFFFF and 16 
for addresses who really need the full range, typically because of an 
encoding?

w/ value-dependent format:
/sys/bus/acpi/devices# cat */*/adr

0x00160000
0x00140003
0x000d0000
0x000d0002
0x000d0003
0x00070000
0x00070001
0x00070002
0x00070003
0x000010025d070100
0x000110025d070100
0x000210025d070100
0x000310025d070100
0x000010025d070000
0x000110025d070000
0x000210025d070000
0x000310025d070000
0x00000000

w/ 0x08 only:

0x00160000
0x00140003
0x000d0000
0x000d0002
0x000d0003
0x00070000
0x00070001
0x00070002
0x00070003
0x10025d070100
0x110025d070100
0x210025d070100
0x310025d070100
0x10025d070000
0x110025d070000
0x210025d070000
0x310025d070000
0x00000000
0x00000000

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [alsa-devel] [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-04-30 18:23       ` Pierre-Louis Bossart
  0 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2019-04-30 18:23 UTC (permalink / raw)
  To: Rafael J. Wysocki, Vinod Koul
  Cc: moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list:ACPI, Takashi Iwai, Greg Kroah-Hartman,
	Rafael J. Wysocki, Linux Kernel Mailing List, Liam Girdwood,
	Robert Moore, Mark Brown, Srini Kandagatla, jank, Joe Perches,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Erik Schmauss, Len Brown



On 4/16/19 3:09 AM, Rafael J. Wysocki wrote:
> On Tue, Apr 16, 2019 at 5:29 AM Vinod Koul <vkoul@kernel.org> wrote:
>>
>> On 15-04-19, 10:18, Pierre-Louis Bossart wrote:
>>> Standards such as the MIPI DisCo for SoundWire 1.0 specification
>>> assume the _ADR field is 64 bits.
>>>
>>> _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
>>> released in 2002. The low levels already use _ADR as 64 bits, e.g. in
>>> struct acpi_device_info.
>>>
>>> This patch bumps the representation used for sysfs to 64 bits.
>>>
>>> Example with a SoundWire device, the results show the complete
>>> vendorID and linkID which were omitted before:
>>>
>>> Before:
>>> $ more /sys/bus/acpi/devices/device\:38/adr
>>> 0x5d070000
>>> After:
>>> $ more /sys/bus/acpi/devices/device\:38/adr
>>> 0x000010025d070000
>>
>> This looks fine but the sysfs file is an ABI. Not sure if we can modify
>> the value returned this way.. Though it should not cause userspace
>> reading 32bits to break...
> 
> Well, IIRC using "08" instead of "016" in the format field would
> preserve the existing behavior for 32-bit values, wouldn't it?

yes, but it makes the 64-bit address not aligned depending on the number 
of leading zeroes, see below. I get a migraine just looking at the results.

Maybe add a test to use 08 for values that are below 0xFFFFFFFF and 16 
for addresses who really need the full range, typically because of an 
encoding?

w/ value-dependent format:
/sys/bus/acpi/devices# cat */*/adr

0x00160000
0x00140003
0x000d0000
0x000d0002
0x000d0003
0x00070000
0x00070001
0x00070002
0x00070003
0x000010025d070100
0x000110025d070100
0x000210025d070100
0x000310025d070100
0x000010025d070000
0x000110025d070000
0x000210025d070000
0x000310025d070000
0x00000000

w/ 0x08 only:

0x00160000
0x00140003
0x000d0000
0x000d0002
0x000d0003
0x00070000
0x00070001
0x00070002
0x00070003
0x10025d070100
0x110025d070100
0x210025d070100
0x310025d070100
0x10025d070000
0x110025d070000
0x210025d070000
0x310025d070000
0x00000000
0x00000000


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [alsa-devel] [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-05-01  7:59         ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2019-05-01  7:59 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Rafael J. Wysocki, Vinod Koul,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list:ACPI, Takashi Iwai, Greg Kroah-Hartman,
	Rafael J. Wysocki, Linux Kernel Mailing List, Liam Girdwood,
	Robert Moore, Mark Brown, Srini Kandagatla, jank, Joe Perches,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Erik Schmauss, Len Brown

On Tue, Apr 30, 2019 at 8:23 PM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
>
>
>
> On 4/16/19 3:09 AM, Rafael J. Wysocki wrote:
> > On Tue, Apr 16, 2019 at 5:29 AM Vinod Koul <vkoul@kernel.org> wrote:
> >>
> >> On 15-04-19, 10:18, Pierre-Louis Bossart wrote:
> >>> Standards such as the MIPI DisCo for SoundWire 1.0 specification
> >>> assume the _ADR field is 64 bits.
> >>>
> >>> _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
> >>> released in 2002. The low levels already use _ADR as 64 bits, e.g. in
> >>> struct acpi_device_info.
> >>>
> >>> This patch bumps the representation used for sysfs to 64 bits.
> >>>
> >>> Example with a SoundWire device, the results show the complete
> >>> vendorID and linkID which were omitted before:
> >>>
> >>> Before:
> >>> $ more /sys/bus/acpi/devices/device\:38/adr
> >>> 0x5d070000
> >>> After:
> >>> $ more /sys/bus/acpi/devices/device\:38/adr
> >>> 0x000010025d070000
> >>
> >> This looks fine but the sysfs file is an ABI. Not sure if we can modify
> >> the value returned this way.. Though it should not cause userspace
> >> reading 32bits to break...
> >
> > Well, IIRC using "08" instead of "016" in the format field would
> > preserve the existing behavior for 32-bit values, wouldn't it?
>
> yes, but it makes the 64-bit address not aligned depending on the number
> of leading zeroes, see below. I get a migraine just looking at the results.

Well, scripts reading them won't get that, but fair enough.

> Maybe add a test to use 08 for values that are below 0xFFFFFFFF and 16
> for addresses who really need the full range, typically because of an
> encoding?

That would be fine by me.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [alsa-devel] [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-05-01  7:59         ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2019-05-01  7:59 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Rafael J. Wysocki, Vinod Koul,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list:ACPI, Takashi Iwai, Greg Kroah-Hartman,
	Rafael J. Wysocki, Linux Kernel Mailing List, Liam Girdwood,
	Robert Moore, Mark Brown, Srini Kandagatla, jank, Joe Perches,
	open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Erik Schmauss, Len Brown

On Tue, Apr 30, 2019 at 8:23 PM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
>
>
>
> On 4/16/19 3:09 AM, Rafael J. Wysocki wrote:
> > On Tue, Apr 16, 2019 at 5:29 AM Vinod Koul <vkoul@kernel.org> wrote:
> >>
> >> On 15-04-19, 10:18, Pierre-Louis Bossart wrote:
> >>> Standards such as the MIPI DisCo for SoundWire 1.0 specification
> >>> assume the _ADR field is 64 bits.
> >>>
> >>> _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
> >>> released in 2002. The low levels already use _ADR as 64 bits, e.g. in
> >>> struct acpi_device_info.
> >>>
> >>> This patch bumps the representation used for sysfs to 64 bits.
> >>>
> >>> Example with a SoundWire device, the results show the complete
> >>> vendorID and linkID which were omitted before:
> >>>
> >>> Before:
> >>> $ more /sys/bus/acpi/devices/device\:38/adr
> >>> 0x5d070000
> >>> After:
> >>> $ more /sys/bus/acpi/devices/device\:38/adr
> >>> 0x000010025d070000
> >>
> >> This looks fine but the sysfs file is an ABI. Not sure if we can modify
> >> the value returned this way.. Though it should not cause userspace
> >> reading 32bits to break...
> >
> > Well, IIRC using "08" instead of "016" in the format field would
> > preserve the existing behavior for 32-bit values, wouldn't it?
>
> yes, but it makes the 64-bit address not aligned depending on the number
> of leading zeroes, see below. I get a migraine just looking at the results.

Well, scripts reading them won't get that, but fair enough.

> Maybe add a test to use 08 for values that are below 0xFFFFFFFF and 16
> for addresses who really need the full range, typically because of an
> encoding?

That would be fine by me.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Devel] [alsa-devel] [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits
@ 2019-05-01  7:59         ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2019-05-01  7:59 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1737 bytes --]

On Tue, Apr 30, 2019 at 8:23 PM Pierre-Louis Bossart
<pierre-louis.bossart(a)linux.intel.com> wrote:
>
>
>
> On 4/16/19 3:09 AM, Rafael J. Wysocki wrote:
> > On Tue, Apr 16, 2019 at 5:29 AM Vinod Koul <vkoul(a)kernel.org> wrote:
> >>
> >> On 15-04-19, 10:18, Pierre-Louis Bossart wrote:
> >>> Standards such as the MIPI DisCo for SoundWire 1.0 specification
> >>> assume the _ADR field is 64 bits.
> >>>
> >>> _ADR is defined as an "Integer" represented as 64 bits since ACPI 2.0
> >>> released in 2002. The low levels already use _ADR as 64 bits, e.g. in
> >>> struct acpi_device_info.
> >>>
> >>> This patch bumps the representation used for sysfs to 64 bits.
> >>>
> >>> Example with a SoundWire device, the results show the complete
> >>> vendorID and linkID which were omitted before:
> >>>
> >>> Before:
> >>> $ more /sys/bus/acpi/devices/device\:38/adr
> >>> 0x5d070000
> >>> After:
> >>> $ more /sys/bus/acpi/devices/device\:38/adr
> >>> 0x000010025d070000
> >>
> >> This looks fine but the sysfs file is an ABI. Not sure if we can modify
> >> the value returned this way.. Though it should not cause userspace
> >> reading 32bits to break...
> >
> > Well, IIRC using "08" instead of "016" in the format field would
> > preserve the existing behavior for 32-bit values, wouldn't it?
>
> yes, but it makes the 64-bit address not aligned depending on the number
> of leading zeroes, see below. I get a migraine just looking at the results.

Well, scripts reading them won't get that, but fair enough.

> Maybe add a test to use 08 for values that are below 0xFFFFFFFF and 16
> for addresses who really need the full range, typically because of an
> encoding?

That would be fine by me.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-05-01  7:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-15 15:18 [PATCH] ACPI / device_sysfs: change _ADR representation to 64 bits Pierre-Louis Bossart
2019-04-15 15:18 ` Pierre-Louis Bossart
2019-04-16  3:29 ` Vinod Koul
2019-04-16  8:09   ` Rafael J. Wysocki
2019-04-16  8:09     ` [Devel] " Rafael J. Wysocki
2019-04-16  8:09     ` Rafael J. Wysocki
2019-04-16  9:09     ` Vinod Koul
2019-04-16  9:09       ` Vinod Koul
2019-04-30 18:23     ` [alsa-devel] " Pierre-Louis Bossart
2019-04-30 18:23       ` Pierre-Louis Bossart
2019-05-01  7:59       ` Rafael J. Wysocki
2019-05-01  7:59         ` [Devel] " Rafael J. Wysocki
2019-05-01  7:59         ` Rafael J. Wysocki

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.