Message ID | 20230526101659.437969-4-oswald.buddenhagen@gmx.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ALSA: emu10k1: improvements related to the driver's procfs | expand |
Hi Oswald, kernel test robot noticed the following build warnings: [auto build test WARNING on tiwai-sound/for-next] [also build test WARNING on tiwai-sound/for-linus linus/master v6.4-rc3 next-20230525] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Oswald-Buddenhagen/ALSA-emu10k1-hide-absent-2nd-pointer-offset-register-set-from-proc/20230526-182102 base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next patch link: https://lore.kernel.org/r/20230526101659.437969-4-oswald.buddenhagen%40gmx.de patch subject: [PATCH 3/6] ALSA: emu10k1: actually disassemble DSP instructions in /proc config: x86_64-randconfig-a014-20230528 (https://download.01.org/0day-ci/archive/20230528/202305280731.yycJIsaL-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): mkdir -p ~/bin wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/13e0e28f29ed98ae73420158c2a879c4e32c694a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Oswald-Buddenhagen/ALSA-emu10k1-hide-absent-2nd-pointer-offset-register-set-from-proc/20230526-182102 git checkout 13e0e28f29ed98ae73420158c2a879c4e32c694a # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash sound/pci/emu10k1/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202305280731.yycJIsaL-lkp@intel.com/ All warnings (new ones prefixed by >>): >> sound/pci/emu10k1/emuproc.c:417:41: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] " " + 30 - clamp(65 - len, 0, 30), ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ include/sound/info.h:107:54: note: expanded from macro 'snd_iprintf' seq_printf((struct seq_file *)(buf)->buffer, fmt, ##args) ^~~~ sound/pci/emu10k1/emuproc.c:417:41: note: use array indexing to silence this warning " " + 30 - clamp(65 - len, 0, 30), ^ & [ include/sound/info.h:107:54: note: expanded from macro 'snd_iprintf' seq_printf((struct seq_file *)(buf)->buffer, fmt, ##args) ^ 1 warning generated. vim +/int +417 sound/pci/emu10k1/emuproc.c 380 381 static void snd_emu10k1_proc_acode_read(struct snd_info_entry *entry, 382 struct snd_info_buffer *buffer) 383 { 384 u32 pc; 385 struct snd_emu10k1 *emu = entry->private_data; 386 static const char * const insns[16] = { 387 "MAC0", "MAC1", "MAC2", "MAC3", "MACINT0", "MACINT1", "ACC3", "MACMV", 388 "ANDXOR", "TSTNEG", "LIMITGE", "LIMITLT", "LOG", "EXP", "INTERP", "SKIP", 389 }; 390 391 snd_iprintf(buffer, "FX8010 Instruction List '%s'\n", emu->fx8010.name); 392 snd_iprintf(buffer, " Code dump :\n"); 393 for (pc = 0; pc < (emu->audigy ? 1024 : 512); pc++) { 394 u32 low, high; 395 int len; 396 char buf[100]; 397 char *bufp = buf; 398 399 low = snd_emu10k1_efx_read(emu, pc * 2); 400 high = snd_emu10k1_efx_read(emu, pc * 2 + 1); 401 if (emu->audigy) { 402 bufp += sprintf(bufp, " %-7s ", insns[(high >> 24) & 0x0f]); 403 bufp += disasm_audigy_reg(bufp, (high >> 12) & 0x7ff, ""); 404 bufp += disasm_audigy_reg(bufp, (high >> 0) & 0x7ff, ", "); 405 bufp += disasm_audigy_reg(bufp, (low >> 12) & 0x7ff, ", "); 406 bufp += disasm_audigy_reg(bufp, (low >> 0) & 0x7ff, ", "); 407 } else { 408 bufp += sprintf(bufp, " %-7s ", insns[(high >> 20) & 0x0f]); 409 bufp += disasm_sblive_reg(bufp, (high >> 10) & 0x3ff, ""); 410 bufp += disasm_sblive_reg(bufp, (high >> 0) & 0x3ff, ", "); 411 bufp += disasm_sblive_reg(bufp, (low >> 10) & 0x3ff, ", "); 412 bufp += disasm_sblive_reg(bufp, (low >> 0) & 0x3ff, ", "); 413 } 414 len = (int)(ptrdiff_t)(bufp - buf); 415 snd_iprintf(buffer, "%s %s /* 0x%04x: 0x%08x%08x */\n", 416 buf, > 417 " " + 30 - clamp(65 - len, 0, 30), 418 pc, high, low); 419 } 420 } 421
Hi Oswald, kernel test robot noticed the following build warnings: [auto build test WARNING on tiwai-sound/for-next] [also build test WARNING on tiwai-sound/for-linus linus/master v6.4-rc4 next-20230525] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Oswald-Buddenhagen/ALSA-emu10k1-hide-absent-2nd-pointer-offset-register-set-from-proc/20230526-182102 base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next patch link: https://lore.kernel.org/r/20230526101659.437969-4-oswald.buddenhagen%40gmx.de patch subject: [PATCH 3/6] ALSA: emu10k1: actually disassemble DSP instructions in /proc config: x86_64-randconfig-s021-20230528 (https://download.01.org/0day-ci/archive/20230529/202305291658.Q6wZncPQ-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-12) 11.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://github.com/intel-lab-lkp/linux/commit/13e0e28f29ed98ae73420158c2a879c4e32c694a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Oswald-Buddenhagen/ALSA-emu10k1-hide-absent-2nd-pointer-offset-register-set-from-proc/20230526-182102 git checkout 13e0e28f29ed98ae73420158c2a879c4e32c694a # save the config file mkdir build_dir && cp config build_dir/.config make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 olddefconfig make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash sound/pci/emu10k1/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202305291658.Q6wZncPQ-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) >> sound/pci/emu10k1/emuproc.c:294:21: sparse: sparse: Using plain integer as NULL pointer sound/pci/emu10k1/emuproc.c:316:21: sparse: sparse: Using plain integer as NULL pointer vim +294 sound/pci/emu10k1/emuproc.c 282 283 static const struct emu10k1_reg_entry sblive_reg_entries[] = { 284 { 0, 0x10, "FXBUS" }, 285 { 0x10, 0x10, "EXTIN" }, 286 { 0x20, 0x10, "EXTOUT" }, 287 { 0x30, 0x10, "FXBUS2" }, 288 { 0x40, 0x20, NULL }, // Constants 289 { 0x100, 0x100, "GPR" }, 290 { 0x200, 0x80, "ITRAM_DATA" }, 291 { 0x280, 0x20, "ETRAM_DATA" }, 292 { 0x300, 0x80, "ITRAM_ADDR" }, 293 { 0x380, 0x20, "ETRAM_ADDR" }, > 294 { 0x400, 0, 0 } 295 }; 296
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index 81d48cd478b7..68a4c1a851a4 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c @@ -275,37 +275,147 @@ static void snd_emu10k1_proc_rates_read(struct snd_info_entry *entry, } } -static void snd_emu10k1_proc_acode_read(struct snd_info_entry *entry, +struct emu10k1_reg_entry { + unsigned short base, size; + const char *name; +}; + +static const struct emu10k1_reg_entry sblive_reg_entries[] = { + { 0, 0x10, "FXBUS" }, + { 0x10, 0x10, "EXTIN" }, + { 0x20, 0x10, "EXTOUT" }, + { 0x30, 0x10, "FXBUS2" }, + { 0x40, 0x20, NULL }, // Constants + { 0x100, 0x100, "GPR" }, + { 0x200, 0x80, "ITRAM_DATA" }, + { 0x280, 0x20, "ETRAM_DATA" }, + { 0x300, 0x80, "ITRAM_ADDR" }, + { 0x380, 0x20, "ETRAM_ADDR" }, + { 0x400, 0, 0 } +}; + +static const struct emu10k1_reg_entry audigy_reg_entries[] = { + { 0, 0x40, "FXBUS" }, + { 0x40, 0x10, "EXTIN" }, + { 0x50, 0x10, "P16VIN" }, + { 0x60, 0x20, "EXTOUT" }, + { 0x80, 0x20, "FXBUS2" }, + { 0xa0, 0x10, "EMU32OUTH" }, + { 0xb0, 0x10, "EMU32OUTL" }, + { 0xc0, 0x20, NULL }, // Constants + // This can't be quite right - overlap. + //{ 0x100, 0xc0, "ITRAM_CTL" }, + //{ 0x1c0, 0x40, "ETRAM_CTL" }, + { 0x160, 0x20, "A3_EMU32IN" }, + { 0x1e0, 0x20, "A3_EMU32OUT" }, + { 0x200, 0xc0, "ITRAM_DATA" }, + { 0x2c0, 0x40, "ETRAM_DATA" }, + { 0x300, 0xc0, "ITRAM_ADDR" }, + { 0x3c0, 0x40, "ETRAM_ADDR" }, + { 0x400, 0x200, "GPR" }, + { 0x600, 0, 0 } +}; + +static const char * const emu10k1_const_entries[] = { + "C_00000000", + "C_00000001", + "C_00000002", + "C_00000003", + "C_00000004", + "C_00000008", + "C_00000010", + "C_00000020", + "C_00000100", + "C_00010000", + "C_00000800", + "C_10000000", + "C_20000000", + "C_40000000", + "C_80000000", + "C_7fffffff", + "C_ffffffff", + "C_fffffffe", + "C_c0000000", + "C_4f1bbcdc", + "C_5a7ef9db", + "C_00100000", + "GPR_ACCU", + "GPR_COND", + "GPR_NOISE0", + "GPR_NOISE1", + "GPR_IRQ", + "GPR_DBAC", + "GPR_DBACE", + "???", +}; + +static int disasm_emu10k1_reg(char *buffer, + const struct emu10k1_reg_entry *entries, + unsigned reg, const char *pfx) +{ + for (int i = 0; ; i++) { + unsigned base = entries[i].base; + unsigned size = entries[i].size; + if (!size) + return sprintf(buffer, "%s0x%03x", pfx, reg); + if (reg >= base && reg < base + size) { + const char *name = entries[i].name; + reg -= base; + if (name) + return sprintf(buffer, "%s%s(%u)", pfx, name, reg); + return sprintf(buffer, "%s%s", pfx, emu10k1_const_entries[reg]); + } + } +} + +static int disasm_sblive_reg(char *buffer, unsigned reg, const char *pfx) +{ + return disasm_emu10k1_reg(buffer, sblive_reg_entries, reg, pfx); +} + +static int disasm_audigy_reg(char *buffer, unsigned reg, const char *pfx) +{ + return disasm_emu10k1_reg(buffer, audigy_reg_entries, reg, pfx); +} + +static void snd_emu10k1_proc_acode_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { u32 pc; struct snd_emu10k1 *emu = entry->private_data; + static const char * const insns[16] = { + "MAC0", "MAC1", "MAC2", "MAC3", "MACINT0", "MACINT1", "ACC3", "MACMV", + "ANDXOR", "TSTNEG", "LIMITGE", "LIMITLT", "LOG", "EXP", "INTERP", "SKIP", + }; snd_iprintf(buffer, "FX8010 Instruction List '%s'\n", emu->fx8010.name); snd_iprintf(buffer, " Code dump :\n"); for (pc = 0; pc < (emu->audigy ? 1024 : 512); pc++) { u32 low, high; + int len; + char buf[100]; + char *bufp = buf; low = snd_emu10k1_efx_read(emu, pc * 2); high = snd_emu10k1_efx_read(emu, pc * 2 + 1); - if (emu->audigy) - snd_iprintf(buffer, " OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n", - (high >> 24) & 0x0f, - (high >> 12) & 0x7ff, - (high >> 0) & 0x7ff, - (low >> 12) & 0x7ff, - (low >> 0) & 0x7ff, - pc, - high, low); - else - snd_iprintf(buffer, " OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n", - (high >> 20) & 0x0f, - (high >> 10) & 0x3ff, - (high >> 0) & 0x3ff, - (low >> 10) & 0x3ff, - (low >> 0) & 0x3ff, - pc, - high, low); + if (emu->audigy) { + bufp += sprintf(bufp, " %-7s ", insns[(high >> 24) & 0x0f]); + bufp += disasm_audigy_reg(bufp, (high >> 12) & 0x7ff, ""); + bufp += disasm_audigy_reg(bufp, (high >> 0) & 0x7ff, ", "); + bufp += disasm_audigy_reg(bufp, (low >> 12) & 0x7ff, ", "); + bufp += disasm_audigy_reg(bufp, (low >> 0) & 0x7ff, ", "); + } else { + bufp += sprintf(bufp, " %-7s ", insns[(high >> 20) & 0x0f]); + bufp += disasm_sblive_reg(bufp, (high >> 10) & 0x3ff, ""); + bufp += disasm_sblive_reg(bufp, (high >> 0) & 0x3ff, ", "); + bufp += disasm_sblive_reg(bufp, (low >> 10) & 0x3ff, ", "); + bufp += disasm_sblive_reg(bufp, (low >> 0) & 0x3ff, ", "); + } + len = (int)(ptrdiff_t)(bufp - buf); + snd_iprintf(buffer, "%s %s /* 0x%04x: 0x%08x%08x */\n", + buf, + " " + 30 - clamp(65 - len, 0, 30), + pc, high, low); } }
This is supposed to be an actually readable representation; the binary is already in another file. Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> --- sound/pci/emu10k1/emuproc.c | 148 +++++++++++++++++++++++++++++++----- 1 file changed, 129 insertions(+), 19 deletions(-)