2017-12-27 12:55:14 -06:00
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-01 16:49:51 +10:00
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
|
|
|
|
|
2021-08-16 14:26:16 +01:00
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
2020-09-22 15:31:03 +02:00
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-31 11:32:54 +01:00
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
|
|
|
|
|
2012-12-06 14:55:41 -08:00
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
|
|
|
|
|
2010-04-13 16:13:22 -07:00
|
|
|
|
2019-04-25 09:45:54 +08:00
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
|
|
|
|
|
2010-08-06 09:25:50 -06:00
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-04-13 16:13:22 -07:00
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
2022-01-18 11:34:04 -06:00
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
2010-04-13 16:13:22 -07:00
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-10-20 11:45:13 -06:00
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
2010-04-13 16:12:29 -07:00
|
|
|
|
2008-10-26 21:51:25 +00:00
|
|
|
|
2010-06-08 07:48:21 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-25 18:33:13 +03:00
|
|
|
|
2010-06-08 07:48:21 -06:00
|
|
|
|
2015-08-25 12:08:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-10-26 21:51:25 +00:00
|
|
|
|
|
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
2010-10-20 11:45:13 -06:00
|
|
|
|
2021-08-16 14:26:17 +01:00
|
|
|
|
2021-08-16 14:26:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-16 14:26:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-16 14:26:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-02 09:44:49 +08:00
|
|
|
|
|
|
|
|
|
2021-08-16 14:26:17 +01:00
|
|
|
|
2022-07-02 09:44:49 +08:00
|
|
|
|
|
|
|
|
|
2021-08-16 14:26:16 +01:00
|
|
|
|
|
|
|
|
|
2021-09-17 14:14:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-16 14:26:17 +01:00
|
|
|
|
2021-08-16 14:26:16 +01:00
|
|
|
|
|
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
2021-03-18 10:40:27 +00:00
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
|
|
|
|
|
2018-05-03 16:25:08 +02:00
|
|
|
|
|
|
|
|
|
2020-06-19 09:20:08 +01:00
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-19 09:20:08 +01:00
|
|
|
|
|
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
2016-04-07 18:42:05 +01:00
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
2022-09-29 13:48:38 +01:00
|
|
|
|
2020-10-26 16:27:55 +01:00
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
2022-09-29 13:48:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
2017-08-31 11:32:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-03 16:25:08 +02:00
|
|
|
|
2017-08-31 11:32:54 +01:00
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
2020-10-26 16:27:55 +01:00
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
|
|
|
|
|
2020-11-02 11:54:22 +01:00
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-03 12:52:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
2015-03-03 12:52:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
2017-04-10 16:51:02 +05:30
|
|
|
|
2015-03-03 12:52:10 -05:00
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
|
|
|
|
|
2017-08-31 11:32:54 +01:00
|
|
|
|
2018-07-23 23:16:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-31 11:32:54 +01:00
|
|
|
|
2018-07-23 23:16:12 +01:00
|
|
|
|
|
|
|
|
|
2017-08-31 11:32:54 +01:00
|
|
|
|
2018-07-23 23:16:12 +01:00
|
|
|
|
2017-08-31 11:32:54 +01:00
|
|
|
|
2018-07-23 23:16:12 +01:00
|
|
|
|
2017-08-31 11:32:54 +01:00
|
|
|
|
2018-07-23 23:16:12 +01:00
|
|
|
|
|
|
|
|
|
2017-08-31 11:32:54 +01:00
|
|
|
|
2015-03-03 14:44:57 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
2019-11-21 10:26:44 +01:00
|
|
|
|
of: fix DMA mask generation
Historically, DMA masks have suffered some ambiguity between whether
they represent the range of physical memory a device can access, or the
address bits a device is capable of driving, particularly since on many
platforms the two are equivalent. Whilst there are some stragglers left
(dma_max_pfn(), I'm looking at you...), the majority of DMA code has
been cleaned up to follow the latter definition, not least since it is
the only one which makes sense once IOMMUs are involved.
In this respect, of_dma_configure() has always done the wrong thing in
how it generates initial masks based on "dma-ranges". Although rounding
down did not affect the TI Keystone platform where dma_addr + size is
already a power of two, in any other case it results in a mask which is
at best unnecessarily constrained and at worst unusable.
BCM2837 illustrates the problem nicely, where we have a DMA base of 3GB
and a size of 1GB - 16MB, giving dma_addr + size = 0xff000000 and a
resultant mask of 0x7fffffff, which is then insufficient to even cover
the necessary offset, effectively making all DMA addresses out-of-range.
This has been hidden until now (mostly because we don't yet prevent
drivers from simply overwriting this initial mask later upon probe), but
due to recent changes elsewhere now shows up as USB being broken on
Raspberry Pi 3.
Make it right by rounding up instead of down, such that the mask
correctly correctly describes all possisble bits the device needs to
emit.
Fixes: 9a6d7298b083 ("of: Calculate device DMA masks based on DT dma-range size")
Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
Reported-by: Andreas Färber <afaerber@suse.de>
Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2017-08-11 17:29:56 +01:00
|
|
|
|
|
|
|
|
|
2021-01-19 18:52:03 +08:00
|
|
|
|
|
|
|
|
|
2019-11-21 10:26:44 +01:00
|
|
|
|
2021-01-19 18:52:03 +08:00
|
|
|
|
|
|
|
|
|
2015-03-03 14:44:57 -06:00
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-19 09:20:08 +01:00
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
2021-01-19 18:52:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
2017-05-27 19:17:41 +05:30
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
2017-04-10 16:51:02 +05:30
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-17 18:43:40 +02:00
|
|
|
|
2017-04-10 16:51:02 +05:30
|
|
|
|
2021-06-19 11:40:43 +08:00
|
|
|
|
2021-08-16 14:26:17 +01:00
|
|
|
|
2021-06-19 11:40:43 +08:00
|
|
|
|
2017-04-10 16:51:02 +05:30
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
2020-06-19 09:20:08 +01:00
|
|
|
|
2015-03-03 12:52:09 -05:00
|
|
|
|
2010-10-20 11:45:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
|
|
|
|
|
2010-07-22 13:59:23 -06:00
|
|
|
|
2007-05-01 16:40:36 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-05-16 11:57:45 +10:00
|
|
|
|
2015-05-06 20:09:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-22 09:16:27 -05:00
|
|
|
|
2008-05-16 11:57:45 +10:00
|
|
|
|
|
|
|
|
|
2017-07-21 15:45:32 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-23 18:03:52 -07:00
|
|
|
|
2008-05-16 11:57:45 +10:00
|
|
|
|
2014-01-14 16:46:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-05-16 11:57:45 +10:00
|
|
|
|
2018-08-27 20:00:19 -05:00
|
|
|
|
|
|
|
|
|
2018-08-29 08:36:12 -05:00
|
|
|
|
2017-08-23 18:03:52 -07:00
|
|
|
|
2017-07-21 15:45:32 -05:00
|
|
|
|
2017-08-23 18:03:52 -07:00
|
|
|
|
|
|
|
|
|
2017-07-21 15:45:32 -05:00
|
|
|
|
|
|
|
|
|
2017-08-23 18:03:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-21 15:45:32 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-05-16 11:57:45 +10:00
|
|
|
|
|
|
|
|
|
2017-08-23 18:03:52 -07:00
|
|
|
|
2008-05-16 11:57:45 +10:00
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
2016-12-28 14:56:47 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
of: Fix modalias string generation
[ Upstream commit b19a4266c52de78496fe40f0b37580a3b762e67d ]
The helper generating an OF based modalias (of_device_get_modalias())
works fine, but due to the use of snprintf() internally it needs a
buffer one byte longer than what should be needed just for the entire
string (excluding the '\0'). Most users of this helper are sysfs hooks
providing the modalias string to users. They all provide a PAGE_SIZE
buffer which is way above the number of bytes required to fit the
modalias string and hence do not suffer from this issue.
There is another user though, of_device_request_module(), which is only
called by drivers/usb/common/ulpi.c. This request module function is
faulty, but maybe because in most cases there is an alternative, ULPI
driver users have not noticed it.
In this function, of_device_get_modalias() is called twice. The first
time without buffer just to get the number of bytes required by the
modalias string (excluding the null byte), and a second time, after
buffer allocation, to fill the buffer. The allocation asks for an
additional byte, in order to store the trailing '\0'. However, the
buffer *length* provided to of_device_get_modalias() excludes this extra
byte. The internal use of snprintf() with a length that is exactly the
number of bytes to be written has the effect of using the last available
byte to store a '\0', which then smashes the last character of the
modalias string.
Provide the actual size of the buffer to of_device_get_modalias() to fix
this issue.
Note: the "str[size - 1] = '\0';" line is not really needed as snprintf
will anyway end the string with a null byte, but there is a possibility
that this function might be called on a struct device_node without
compatible, in this case snprintf() would not be executed. So we keep it
just to avoid possible unbounded strings.
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Peter Chen <peter.chen@kernel.org>
Fixes: 9c829c097f2f ("of: device: Support loading a module with OF based modalias")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230404172148.82422-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-04 18:21:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-12-28 14:56:47 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
of: Fix modalias string generation
[ Upstream commit b19a4266c52de78496fe40f0b37580a3b762e67d ]
The helper generating an OF based modalias (of_device_get_modalias())
works fine, but due to the use of snprintf() internally it needs a
buffer one byte longer than what should be needed just for the entire
string (excluding the '\0'). Most users of this helper are sysfs hooks
providing the modalias string to users. They all provide a PAGE_SIZE
buffer which is way above the number of bytes required to fit the
modalias string and hence do not suffer from this issue.
There is another user though, of_device_request_module(), which is only
called by drivers/usb/common/ulpi.c. This request module function is
faulty, but maybe because in most cases there is an alternative, ULPI
driver users have not noticed it.
In this function, of_device_get_modalias() is called twice. The first
time without buffer just to get the number of bytes required by the
modalias string (excluding the null byte), and a second time, after
buffer allocation, to fill the buffer. The allocation asks for an
additional byte, in order to store the trailing '\0'. However, the
buffer *length* provided to of_device_get_modalias() excludes this extra
byte. The internal use of snprintf() with a length that is exactly the
number of bytes to be written has the effect of using the last available
byte to store a '\0', which then smashes the last character of the
modalias string.
Provide the actual size of the buffer to of_device_get_modalias() to fix
this issue.
Note: the "str[size - 1] = '\0';" line is not really needed as snprintf
will anyway end the string with a null byte, but there is a possibility
that this function might be called on a struct device_node without
compatible, in this case snprintf() would not be executed. So we keep it
just to avoid possible unbounded strings.
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Peter Chen <peter.chen@kernel.org>
Fixes: 9c829c097f2f ("of: device: Support loading a module with OF based modalias")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230404172148.82422-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-04 18:21:09 +01:00
|
|
|
|
2016-12-28 14:56:47 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-22 09:16:27 -05:00
|
|
|
|
|
|
|
|
|
2021-03-18 10:40:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-22 09:16:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-23 18:04:04 -07:00
|
|
|
|
|
|
|
|
|
2017-03-22 09:16:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
|
|
|
|
|
2021-03-18 10:40:27 +00:00
|
|
|
|
|
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
2012-02-01 11:22:22 -07:00
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
2018-08-29 08:36:12 -05:00
|
|
|
|
2012-12-06 14:55:41 -08:00
|
|
|
|
2017-07-21 15:45:32 -05:00
|
|
|
|
|
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
|
|
|
|
|
2012-02-01 11:22:22 -07:00
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
2018-08-27 20:00:19 -05:00
|
|
|
|
2017-06-01 15:50:55 -05:00
|
|
|
|
2018-08-29 08:36:12 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-21 15:45:32 -05:00
|
|
|
|
2012-02-01 11:22:22 -07:00
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
|
|
|
|
|
2012-02-01 11:22:22 -07:00
|
|
|
|
2012-12-06 14:55:41 -08:00
|
|
|
|
|
|
|
|
|
2014-07-04 19:58:03 +03:00
|
|
|
|
2012-12-06 14:55:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-04 19:58:03 +03:00
|
|
|
|
2012-02-01 11:22:22 -07:00
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
2012-02-01 11:22:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
2012-02-01 11:22:22 -07:00
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-08 07:48:13 -06:00
|
|
|
|
2010-06-08 07:48:12 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-12-28 14:56:48 -08:00
|
|
|
|