linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ucsi_acpi: probe of USBC000:00 fails with ioremap error
@ 2022-03-18 12:36 Paul Menzel
  2022-03-18 14:37 ` Heikki Krogerus
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Menzel @ 2022-03-18 12:36 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: linux-usb, LKML, Dell.Client.Kernel

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

Dear Linux folks,


On a Dell Precision 3540, Linux 5.16.12 reports an ioremap error:

     [    0.000000] Linux version 5.16.0-4-amd64 
(debian-kernel@lists.debian.org) (gcc-11 (Debian 11.2.0-18) 11.2.0, GNU 
ld (GNU Binutils for Debian) 2.38) #1 SMP PREEMPT Debian 5.16.12-1 
(2022-03-08)
     [    0.000000] Command line: BOOT_IMAGE=/vmlinuz-5.16.0-4-amd64 
root=UUID=c9342a55-b747-4442-b2f4-bc03eb7a51cf ro quiet noisapnp 
log_buf_len=2M cryptomgr.notests btusb.enable_autosuspend=y 
random.trust_cpu=on
     […]
     [    0.000000] DMI: Dell Inc. Precision 3540/0M14W7, BIOS 1.15.0 
12/08/2021
     […]
     [   24.230968] videodev: Linux video capture interface: v2.00
     [   24.237747] ioremap error for 0x78e31000-0x78e32000, requested 
0x2, got 0x0
     [   24.238100] ucsi_acpi: probe of USBC000:00 failed with error -12
     […]
     $ sudo more /proc/iomem
     […]
     78a04000-78ea2fff : ACPI Non-volatile Storage
       78e31000-78e31fff : USBC000:00
     […]

This seems to happen on a lot of Dell devices, cf. bug 199741 (ioremap 
error on Dell XPS 9370) [1].


Kind regards,

Paul


[1]: https://bugzilla.kernel.org/show_bug.cgi?id=199741

[-- Attachment #2: iomem.txt --]
[-- Type: text/plain, Size: 4762 bytes --]

00000000-00000fff : Reserved
00001000-0009dfff : System RAM
0009e000-0009efff : Reserved
0009f000-0009ffff : System RAM
000a0000-000fffff : Reserved
  00000000-00000000 : PCI Bus 0000:00
  00000000-00000000 : PCI Bus 0000:00
  00000000-00000000 : PCI Bus 0000:00
  00000000-00000000 : PCI Bus 0000:00
  00000000-00000000 : PCI Bus 0000:00
  00000000-00000000 : PCI Bus 0000:00
  00000000-00000000 : PCI Bus 0000:00
  00000000-00000000 : PCI Bus 0000:00
  000a0000-000dffff : PCI Bus 0000:00
    000c0000-000dffff : 0000:00:02.0
  000f0000-000fffff : System ROM
00100000-3fffffff : System RAM
40000000-403fffff : Reserved
  40000000-403fffff : pnp 00:00
40400000-6d86cfff : System RAM
6d86d000-6d86dfff : ACPI Non-volatile Storage
6d86e000-6d86efff : Reserved
6d86f000-73628fff : System RAM
73629000-736b2fff : Reserved
736b3000-782d8fff : System RAM
782d9000-78986fff : Reserved
78987000-78a03fff : ACPI Tables
78a04000-78ea2fff : ACPI Non-volatile Storage
  78e31000-78e31fff : USBC000:00
78ea3000-7ab22fff : Reserved
7ab23000-7acfefff : Unknown E820 type
7acff000-7acfffff : System RAM
7ad00000-7f7fffff : Reserved
  7d800000-7f7fffff : Graphics Stolen Memory
7f800000-efffffff : PCI Bus 0000:00
  7f800000-7f800fff : 0000:00:15.0
    7f800000-7f8001ff : lpss_dev
      7f800000-7f8001ff : i2c_designware.0 lpss_dev
    7f800200-7f8002ff : lpss_priv
    7f800800-7f800fff : idma64.0
      7f800800-7f800fff : idma64.0 idma64.0
  7f801000-7f801fff : 0000:00:15.1
    7f801000-7f8011ff : lpss_dev
      7f801000-7f8011ff : i2c_designware.1 lpss_dev
    7f801200-7f8012ff : lpss_priv
    7f801800-7f801fff : idma64.1
      7f801800-7f801fff : idma64.1 idma64.1
  7f802000-7f802fff : 0000:00:19.0
    7f802000-7f8021ff : lpss_dev
      7f802000-7f8021ff : i2c_designware.2 lpss_dev
    7f802200-7f8022ff : lpss_priv
  80000000-8fffffff : 0000:00:02.0
  90000000-b1ffffff : PCI Bus 0000:02
    90000000-b1ffffff : PCI Bus 0000:03
      90000000-b1ffffff : PCI Bus 0000:05
  c0000000-d01fffff : PCI Bus 0000:3b
    c0000000-cfffffff : 0000:3b:00.0
    d0000000-d01fffff : 0000:3b:00.0
  d4000000-ea0fffff : PCI Bus 0000:02
    d4000000-ea0fffff : PCI Bus 0000:03
      d4000000-e9efffff : PCI Bus 0000:05
      e9f00000-e9ffffff : PCI Bus 0000:3a
        e9f00000-e9f0ffff : 0000:3a:00.0
          e9f00000-e9f0ffff : xhci-hcd
      ea000000-ea0fffff : PCI Bus 0000:04
        ea000000-ea03ffff : 0000:04:00.0
          ea000000-ea03ffff : thunderbolt
        ea040000-ea040fff : 0000:04:00.0
  eb000000-ebffffff : 0000:00:02.0
  ec000000-ec0fffff : 0000:00:1f.3
  ec100000-ec1fffff : PCI Bus 0000:3c
    ec100000-ec103fff : 0000:3c:00.0
      ec100000-ec103fff : nvme
  ec200000-ec2fffff : PCI Bus 0000:3b
    ec200000-ec23ffff : 0000:3b:00.0
    ec240000-ec25ffff : 0000:3b:00.0
  ec300000-ec3fffff : PCI Bus 0000:01
    ec300000-ec300fff : 0000:01:00.0
      ec300000-ec300fff : rtsx_pci
  ec400000-ec41ffff : 0000:00:1f.6
    ec400000-ec41ffff : e1000e
  ec420000-ec42ffff : 0000:00:14.0
    ec420000-ec42ffff : xhci-hcd
  ec430000-ec437fff : 0000:00:04.0
    ec430000-ec437fff : proc_thermal
  ec438000-ec43bfff : 0000:00:1f.3
    ec438000-ec43bfff : ICH HD audio
  ec43c000-ec43ffff : 0000:00:14.3
    ec43c000-ec43ffff : iwlwifi
  ec440000-ec441fff : 0000:00:14.2
  ec442000-ec4420ff : 0000:00:1f.4
  ec444000-ec444fff : 0000:00:16.0
    ec444000-ec444fff : mei_me
  ec447000-ec447fff : 0000:00:14.2
  ec448000-ec448fff : 0000:00:12.0
    ec448000-ec448fff : Intel PCH thermal driver
  ec449000-ec449fff : 0000:00:08.0
f0000000-f7ffffff : PCI MMCONFIG 0000 [bus 00-7f]
  f0000000-f7ffffff : Reserved
    f0000000-f7ffffff : pnp 00:06
fc800000-fe7fffff : PCI Bus 0000:00
  fd000000-fd69ffff : pnp 00:07
  fd6a0000-fd6affff : INT34BB:00
    fd6a0000-fd6affff : INT34BB:00 INT34BB:00
  fd6b0000-fd6cffff : pnp 00:07
  fd6d0000-fd6dffff : INT34BB:00
    fd6d0000-fd6dffff : INT34BB:00 INT34BB:00
  fd6e0000-fd6effff : INT34BB:00
    fd6e0000-fd6effff : INT34BB:00 INT34BB:00
  fd6f0000-fdffffff : pnp 00:07
  fe000000-fe010fff : Reserved
    fe010000-fe010fff : 0000:00:1f.5
  fe200000-fe7fffff : pnp 00:07
fec00000-fec00fff : Reserved
  fec00000-fec003ff : IOAPIC 0
fed00000-fed003ff : HPET 0
  fed00000-fed003ff : PNP0103:00
fed10000-fed17fff : pnp 00:06
fed18000-fed18fff : pnp 00:06
fed19000-fed19fff : pnp 00:06
fed20000-fed3ffff : pnp 00:06
fed45000-fed8ffff : pnp 00:06
fed90000-fed90fff : dmar0
fed91000-fed91fff : dmar1
fee00000-fee00fff : Local APIC
  fee00000-fee00fff : Reserved
ff000000-ffffffff : Reserved
  ff000000-ffffffff : pnp 00:07
100000000-87c7fffff : System RAM
  232a00000-233601e3f : Kernel code
  233800000-23403cfff : Kernel rodata
  234200000-2344ac4bf : Kernel data
  234ae3000-234ffffff : Kernel bss
87c800000-87fffffff : RAM buffer

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

* Re: ucsi_acpi: probe of USBC000:00 fails with ioremap error
  2022-03-18 12:36 ucsi_acpi: probe of USBC000:00 fails with ioremap error Paul Menzel
@ 2022-03-18 14:37 ` Heikki Krogerus
  2022-03-19  5:36   ` Paul Menzel
  0 siblings, 1 reply; 3+ messages in thread
From: Heikki Krogerus @ 2022-03-18 14:37 UTC (permalink / raw)
  To: Paul Menzel; +Cc: linux-usb, LKML, Dell.Client.Kernel

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

Hi Paul,

On Fri, Mar 18, 2022 at 01:36:37PM +0100, Paul Menzel wrote:
> Dear Linux folks,
> 
> 
> On a Dell Precision 3540, Linux 5.16.12 reports an ioremap error:
> 
>     [    0.000000] Linux version 5.16.0-4-amd64
> (debian-kernel@lists.debian.org) (gcc-11 (Debian 11.2.0-18) 11.2.0, GNU ld
> (GNU Binutils for Debian) 2.38) #1 SMP PREEMPT Debian 5.16.12-1 (2022-03-08)
>     [    0.000000] Command line: BOOT_IMAGE=/vmlinuz-5.16.0-4-amd64
> root=UUID=c9342a55-b747-4442-b2f4-bc03eb7a51cf ro quiet noisapnp
> log_buf_len=2M cryptomgr.notests btusb.enable_autosuspend=y
> random.trust_cpu=on
>     […]
>     [    0.000000] DMI: Dell Inc. Precision 3540/0M14W7, BIOS 1.15.0
> 12/08/2021
>     […]
>     [   24.230968] videodev: Linux video capture interface: v2.00
>     [   24.237747] ioremap error for 0x78e31000-0x78e32000, requested 0x2,
> got 0x0
>     [   24.238100] ucsi_acpi: probe of USBC000:00 failed with error -12
>     […]
>     $ sudo more /proc/iomem
>     […]
>     78a04000-78ea2fff : ACPI Non-volatile Storage
>       78e31000-78e31fff : USBC000:00
>     […]
> 
> This seems to happen on a lot of Dell devices, cf. bug 199741 (ioremap error
> on Dell XPS 9370) [1].

I'm not sure if this helps, but I'm going to change the ioremap() call
to memremap() soon in any case in this driver. Can you test the
attached patch?

thanks,

-- 
heikki

[-- Attachment #2: 0001-usb-typec-ucsi-acpi-Map-the-mailbox-with-memremap.patch --]
[-- Type: text/plain, Size: 2080 bytes --]

From be67ec57a68e28877e4d379d7624d30141e324ab Mon Sep 17 00:00:00 2001
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date: Fri, 18 Mar 2022 17:23:09 +0300
Subject: [PATCH] usb: typec: ucsi: acpi: Map the mailbox with memremap()

Interim.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/ucsi/ucsi_acpi.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
index 6771f05e32c29..7455e3aff2be0 100644
--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
@@ -19,7 +19,7 @@
 struct ucsi_acpi {
 	struct device *dev;
 	struct ucsi *ucsi;
-	void __iomem *base;
+	void *base;
 	struct completion complete;
 	unsigned long flags;
 	guid_t guid;
@@ -51,7 +51,7 @@ static int ucsi_acpi_read(struct ucsi *ucsi, unsigned int offset,
 	if (ret)
 		return ret;
 
-	memcpy(val, (const void __force *)(ua->base + offset), val_len);
+	memcpy(val, ua->base + offset, val_len);
 
 	return 0;
 }
@@ -61,7 +61,7 @@ static int ucsi_acpi_async_write(struct ucsi *ucsi, unsigned int offset,
 {
 	struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
 
-	memcpy((void __force *)(ua->base + offset), val, val_len);
+	memcpy(ua->base + offset, val, val_len);
 
 	return ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_WRITE);
 }
@@ -132,18 +132,7 @@ static int ucsi_acpi_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	/* This will make sure we can use ioremap() */
-	status = acpi_release_memory(ACPI_HANDLE(&pdev->dev), res, 1);
-	if (ACPI_FAILURE(status))
-		return -ENOMEM;
-
-	/*
-	 * NOTE: The memory region for the data structures is used also in an
-	 * operation region, which means ACPI has already reserved it. Therefore
-	 * it can not be requested here, and we can not use
-	 * devm_ioremap_resource().
-	 */
-	ua->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+	ua->base = devm_memremap(&pdev->dev, res->start, resource_size(res), MEMREMAP_WB);
 	if (!ua->base)
 		return -ENOMEM;
 
-- 
2.35.1


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

* Re: ucsi_acpi: probe of USBC000:00 fails with ioremap error
  2022-03-18 14:37 ` Heikki Krogerus
@ 2022-03-19  5:36   ` Paul Menzel
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Menzel @ 2022-03-19  5:36 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: linux-usb, LKML, Dell.Client.Kernel, Kai-Heng Feng, Hans de Goede

[Cc: +Kai-Heng, +Hans]

Dear Heikki,


Am 18.03.22 um 15:37 schrieb Heikki Krogerus:

> On Fri, Mar 18, 2022 at 01:36:37PM +0100, Paul Menzel wrote:

>> On a Dell Precision 3540, Linux 5.16.12 reports an ioremap error:
>>
>>      [    0.000000] Linux version 5.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc-11 (Debian 11.2.0-18) 11.2.0, GNU ld (GNU Binutils for Debian) 2.38) #1 SMP PREEMPT Debian 5.16.12-1 (2022-03-08)
>>      [    0.000000] Command line: BOOT_IMAGE=/vmlinuz-5.16.0-4-amd64 root=UUID=c9342a55-b747-4442-b2f4-bc03eb7a51cf ro quiet noisapnp log_buf_len=2M cryptomgr.notests btusb.enable_autosuspend=y random.trust_cpu=on
>>      […]
>>      [    0.000000] DMI: Dell Inc. Precision 3540/0M14W7, BIOS 1.15.0 12/08/2021
>>      […]
>>      [   24.230968] videodev: Linux video capture interface: v2.00
>>      [   24.237747] ioremap error for 0x78e31000-0x78e32000, requested 0x2, got 0x0
>>      [   24.238100] ucsi_acpi: probe of USBC000:00 failed with error -12
>>      […]
>>      $ sudo more /proc/iomem
>>      […]
>>      78a04000-78ea2fff : ACPI Non-volatile Storage
>>        78e31000-78e31fff : USBC000:00
>>      […]
>>
>> This seems to happen on a lot of Dell devices, cf. bug 199741 (ioremap error
>> on Dell XPS 9370) [1].
> 
> I'm not sure if this helps, but I'm going to change the ioremap() call
> to memremap() soon in any case in this driver. Can you test the
> attached patch?

Thank you very much for the instant reply and patch. Unfortunately, the 
device is in active use by a user, so I do not think I am going to able 
able to test it. I had hoped that the Dell client Linux kernel team 
could help out, or that the Intel Linux folks have access to recent Dell 
devices internally. Maybe Kai-Heng or Hans have an idea.


Kind regards,

Paul


PS: If there is a way to test this with a QEMU VM by passing through 
some devices, I should be able to test that, as it does not involve a 
system reboot.

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

end of thread, other threads:[~2022-03-19  5:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18 12:36 ucsi_acpi: probe of USBC000:00 fails with ioremap error Paul Menzel
2022-03-18 14:37 ` Heikki Krogerus
2022-03-19  5:36   ` Paul Menzel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).