tree:
https://github.com/Freescale/linux-fslc 5.10-2.1.x-imx
head: 97b03e732ae16a3b30736ac12cf838a5c2db3eca
commit: 6ba9191d51ddea63f1924c87411ae6745bc0cbbf [9000/16146] LF-3665-5 ASoC: SOF: compr:
Add compress ops implementation
config: riscv-randconfig-r042-20211207
(
https://download.01.org/0day-ci/archive/20211209/202112091312.E8YDGdAj-lk...)
compiler: clang version 14.0.0 (
https://github.com/llvm/llvm-project
097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
#
https://github.com/Freescale/linux-fslc/commit/6ba9191d51ddea63f1924c8741...
git remote add freescale-fslc
https://github.com/Freescale/linux-fslc
git fetch --no-tags freescale-fslc 5.10-2.1.x-imx
git checkout 6ba9191d51ddea63f1924c87411ae6745bc0cbbf
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir
ARCH=riscv SHELL=/bin/bash drivers/firmware/imx/ drivers/regulator/ sound/soc/sof/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:564:9: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inw(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:56:76: note: expanded from macro 'inw'
#define inw(c) ({ u16 __v; __io_pbr(); __v = readw_cpu((void*)(PCI_IOBASE +
(c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:88:76: note: expanded from macro 'readw_cpu'
#define readw_cpu(c) ({ u16 __r = le16_to_cpu((__force
__le16)__raw_readw(c)); __r; })
^
include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro
'__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from sound/soc/sof/compress.c:7:
In file included from include/sound/soc.h:18:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:572:9: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inl(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:57:76: note: expanded from macro 'inl'
#define inl(c) ({ u32 __v; __io_pbr(); __v = readl_cpu((void*)(PCI_IOBASE +
(c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:89:76: note: expanded from macro 'readl_cpu'
#define readl_cpu(c) ({ u32 __r = le32_to_cpu((__force
__le32)__raw_readl(c)); __r; })
^
include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro
'__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from sound/soc/sof/compress.c:7:
In file included from include/sound/soc.h:18:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:580:2: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
outb(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:59:68: note: expanded from macro 'outb'
#define outb(v,c) ({ __io_pbw(); writeb_cpu((v),(void*)(PCI_IOBASE + (c)));
__io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:91:52: note: expanded from macro 'writeb_cpu'
#define writeb_cpu(v, c) ((void)__raw_writeb((v), (c)))
^
In file included from sound/soc/sof/compress.c:7:
In file included from include/sound/soc.h:18:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:588:2: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
outw(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:60:68: note: expanded from macro 'outw'
#define outw(v,c) ({ __io_pbw(); writew_cpu((v),(void*)(PCI_IOBASE + (c)));
__io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:92:76: note: expanded from macro 'writew_cpu'
#define writew_cpu(v, c) ((void)__raw_writew((__force u16)cpu_to_le16(v), (c)))
^
In file included from sound/soc/sof/compress.c:7:
In file included from include/sound/soc.h:18:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:596:2: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
outl(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:61:68: note: expanded from macro 'outl'
#define outl(v,c) ({ __io_pbw(); writel_cpu((v),(void*)(PCI_IOBASE + (c)));
__io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:93:76: note: expanded from macro 'writel_cpu'
#define writel_cpu(v, c) ((void)__raw_writel((__force u32)cpu_to_le32(v), (c)))
^
In file included from sound/soc/sof/compress.c:7:
In file included from include/sound/soc.h:18:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:1005:55: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
~~~~~~~~~~ ^
> sound/soc/sof/compress.c:91:5: warning: no previous prototype for
function 'sof_compr_open' [-Wmissing-prototypes]
int
sof_compr_open(struct snd_soc_component *component,
^
sound/soc/sof/compress.c:91:1: note: declare 'static' if the function is not
intended to be used outside of this translation unit
int sof_compr_open(struct snd_soc_component *component,
^
static
> sound/soc/sof/compress.c:122:5: warning: no previous prototype
for function 'sof_compr_free' [-Wmissing-prototypes]
int
sof_compr_free(struct snd_soc_component *component,
^
sound/soc/sof/compress.c:122:1: note: declare 'static' if the function is not
intended to be used outside of this translation unit
int sof_compr_free(struct snd_soc_component *component,
^
static
> sound/soc/sof/compress.c:140:5: warning: no previous prototype
for function 'sof_compr_set_params' [-Wmissing-prototypes]
int
sof_compr_set_params(struct snd_soc_component *component,
^
sound/soc/sof/compress.c:140:1: note: declare 'static' if the function is not
intended to be used outside of this translation unit
int sof_compr_set_params(struct snd_soc_component *component,
^
static
> sound/soc/sof/compress.c:194:5: warning: no previous prototype
for function 'sof_compr_get_params' [-Wmissing-prototypes]
int
sof_compr_get_params(struct snd_soc_component *component,
^
sound/soc/sof/compress.c:194:1: note: declare 'static' if the function is not
intended to be used outside of this translation unit
int sof_compr_get_params(struct snd_soc_component *component,
^
static
> sound/soc/sof/compress.c:200:5: warning: no previous prototype
for function 'sof_compr_trigger' [-Wmissing-prototypes]
int
sof_compr_trigger(struct snd_soc_component *component,
^
sound/soc/sof/compress.c:200:1: note: declare 'static' if the function is not
intended to be used outside of this translation unit
int sof_compr_trigger(struct snd_soc_component *component,
^
static
> sound/soc/sof/compress.c:234:5: warning: no previous prototype
for function 'sof_compr_copy' [-Wmissing-prototypes]
int
sof_compr_copy(struct snd_soc_component *component,
^
sound/soc/sof/compress.c:234:1: note: declare 'static' if the function is not
intended to be used outside of this translation unit
int sof_compr_copy(struct snd_soc_component *component,
^
static
13 warnings generated.
vim +/sof_compr_open +91 sound/soc/sof/compress.c
90
91 int sof_compr_open(struct snd_soc_component *component,
92 struct snd_compr_stream *cstream)
93 {
94 struct snd_soc_pcm_runtime *rtd = cstream->private_data;
95 struct snd_compr_runtime *runtime = cstream->runtime;
96 struct sof_compr_stream *sstream;
97 struct snd_sof_pcm *spcm;
98 int dir;
99
100 sstream = kzalloc(sizeof(*sstream), GFP_KERNEL);
101 if (!sstream)
102 return -ENOMEM;
103
104 spcm = snd_sof_find_spcm_dai(component, rtd);
105 if (!spcm) {
106 kfree(sstream);
107 return -EINVAL;
108 }
109
110 dir = cstream->direction;
111
112 spcm->stream[dir].posn.host_posn = 0;
113 spcm->stream[dir].posn.dai_posn = 0;
114 spcm->stream[dir].cstream = cstream;
115 spcm->prepared[dir] = false;
116
117 runtime->private_data = sstream;
118
119 return 0;
120 }
121
122 int sof_compr_free(struct snd_soc_component *component,
123 struct snd_compr_stream *cstream)
124 {
125 struct snd_soc_pcm_runtime *rtd = cstream->private_data;
126 struct snd_compr_runtime *runtime = cstream->runtime;
127 struct sof_compr_stream *sstream = runtime->private_data;
128 struct snd_sof_pcm *spcm;
129
130 spcm = snd_sof_find_spcm_dai(component, rtd);
131 if (!spcm)
132 return -EINVAL;
133
134 cancel_work_sync(&spcm->stream[cstream->direction].period_elapsed_work);
135 kfree(sstream);
136
137 return 0;
138 }
139
140 int sof_compr_set_params(struct snd_soc_component *component,
141 struct snd_compr_stream *cstream, struct snd_compr_params *params)
142 {
143 struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
144 struct snd_soc_pcm_runtime *rtd_pcm = cstream->private_data;
145 struct snd_compr_runtime *rtd = cstream->runtime;
146 struct sof_compr_stream *sstream = rtd->private_data;
147 struct sof_ipc_pcm_params_reply ipc_params_reply;
148 struct sof_ipc_pcm_params pcm;
149 struct snd_sof_pcm *spcm;
150 int ret;
151
152 spcm = snd_sof_find_spcm_dai(component, rtd_pcm);
153 if (!spcm)
154 return -EINVAL;
155
156 cstream->dma_buffer.dev.type = SNDRV_DMA_TYPE_DEV_SG;
157 cstream->dma_buffer.dev.dev = sdev->dev;
158 ret = snd_compr_malloc_pages(cstream, rtd->buffer_size);
159 if (ret < 0)
160 return ret;
161
162 create_page_table(component, cstream, rtd->dma_area, rtd->dma_bytes);
163
164 pcm.params.buffer.pages = PFN_UP(rtd->dma_bytes);
165 pcm.hdr.size = sizeof(pcm);
166 pcm.hdr.cmd = SOF_IPC_GLB_STREAM_MSG | SOF_IPC_STREAM_PCM_PARAMS;
167
168 pcm.comp_id = spcm->stream[cstream->direction].comp_id;
169 pcm.params.hdr.size = sizeof(pcm.params);
170 pcm.params.buffer.phy_addr =
spcm->stream[cstream->direction].page_table.addr;
171 pcm.params.buffer.size = rtd->dma_bytes;
172 pcm.params.direction = cstream->direction;
173 pcm.params.channels = params->codec.ch_out;
174 pcm.params.rate = params->codec.sample_rate;
175 pcm.params.buffer_fmt = SOF_IPC_BUFFER_INTERLEAVED;
176 pcm.params.frame_fmt = SOF_IPC_FRAME_S32_LE;
177 pcm.params.sample_container_bytes =
178 snd_pcm_format_physical_width(SNDRV_PCM_FORMAT_S32) >> 3;
179 pcm.params.host_period_bytes = params->buffer.fragment_size;
180
181 ret = sof_ipc_tx_message(sdev->ipc, pcm.hdr.cmd, &pcm, sizeof(pcm),
182 &ipc_params_reply, sizeof(ipc_params_reply));
183 if (ret < 0) {
184 dev_err(component->dev, "error ipc failed\n");
185 return ret;
186 }
187
188 sstream->sample_rate = params->codec.sample_rate;
189 spcm->prepared[cstream->direction] = true;
190
191 return 0;
192 }
193
194 int sof_compr_get_params(struct snd_soc_component *component,
195 struct snd_compr_stream *cstream, struct snd_codec *params)
196 {
197 return 0;
198 }
199
200 int sof_compr_trigger(struct snd_soc_component *component,
201 struct snd_compr_stream *cstream, int cmd)
202 {
203 struct sof_ipc_stream stream;
204 struct sof_ipc_reply reply;
205 struct snd_soc_pcm_runtime *rtd = cstream->private_data;
206 struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
207 struct snd_sof_pcm *spcm;
208
209 spcm = snd_sof_find_spcm_dai(component, rtd);
210 if (!spcm)
211 return -EINVAL;
212
213 stream.hdr.size = sizeof(stream);
214 stream.hdr.cmd = SOF_IPC_GLB_STREAM_MSG;
215 stream.comp_id = spcm->stream[cstream->direction].comp_id;
216
217 switch (cmd) {
218 case SNDRV_PCM_TRIGGER_START:
219 stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_START;
220 break;
221 case SNDRV_PCM_TRIGGER_STOP:
222 stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_STOP;
223 break;
224 default:
225 dev_err(component->dev, "error: unhandled trigger cmd %d\n", cmd);
226 break;
227 }
228
229 return sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd,
230 &stream, sizeof(stream),
231 &reply, sizeof(reply));
232 }
233
234 int sof_compr_copy(struct snd_soc_component *component,
235 struct snd_compr_stream *cstream,
236 char __user *buf, size_t count)
237 {
238 struct snd_compr_runtime *rtd = cstream->runtime;
239 unsigned int offset, n;
240 void *ptr;
241 int ret;
242
243 if (count > rtd->buffer_size)
244 count = rtd->buffer_size;
245
246 div_u64_rem(rtd->total_bytes_available, rtd->buffer_size, &offset);
247 ptr = rtd->dma_area + offset;
248 n = rtd->buffer_size - offset;
249
250 if (count < n) {
251 ret = copy_from_user(ptr, buf, count);
252 } else {
253 ret = copy_from_user(ptr, buf, n);
254 ret += copy_from_user(rtd->dma_area, buf + n, count - n);
255 }
256
257 return count - ret;
258 }
259
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org