1. 21 Feb, 2024 1 commit
    • Takashi Iwai's avatar
      ALSA: hda: Set up BDL table at hw_params · 04438a06
      Takashi Iwai authored
      So far the setup of BDL table is performed at the prepare stage, where
      all PCM parameters have been already set up.  When something wrong
      happens at it, we return -EINVAL; it's supposed to be a rare case
      since the involved memory allocation is a small chunk of kmalloc for
      the table.
      
      However, when we receive too many small non-contiguous pages in highly
      fragmented memories, it may overflow the max table size, resulting in
      the same -EINVAL error from the prepare, too.  A bad scenario is that
      user-space cannot know what went wrong (as it's an error from the
      prepare stage) and -EINVAL, hence it may retry with the same
      parameters, failing again repeatedly.
      
      In this patch, we try to set up the BDL table at hw_params right after
      the buffer allocation, and return -ENOMEM if it overflows.
      This allows user-space knowing that it should reduce the buffer size
      request accordingly and may retry with more fitting parameters.
      
      Link: https://lore.kernel.org/r/20240221100607.6565-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      04438a06
  2. 19 Feb, 2024 5 commits
    • Takashi Sakamoto's avatar
      ALSA: oxfw: add support for Miglia Harmony Audio · 52592932
      Takashi Sakamoto authored
      Miglia Technology ships Harmony Audio 2004. It uses Oxford Semiconductor
      OXFW970 for communication function in IEEE 1394 bus. This commit adds
      support for the model.
      
      In my opinion, the firmware of ASIC is really the initial stage, since
      it has the following quirks.
      
      * It skips several isochronous cycles to transmit isochronous packets
        when receiving any asynchronous transaction.
      * The value of dbc field in the transmitted packet is the number of
        accumulated quadlets in CIP payload, instead of the accumulated data
        blocks. Furthermore, the value includes the quadlets of CIP payload in
        the packet.
      * It neither supports AV/C Stream Format Information command nor AV/C
        Extended Stream Format Information command.
      * The vendor and model information in root directory of configuration
        ROM includes some mistakes.
      
      Additionally, when operating at 96.0 kHz, it often skips much isochronous
      cycles to transmit the isochronous packets. The issue is detected as cycle
      discontinuity and ALSA PCM application receives -EIO at any operation for
      PCM substream. I have never found any workaround yet.
      
      $ config-rom-pretty-printer < /sys/bus/firewire/devices/fw1/config_rom
                     ROM header and bus information block
                     -----------------------------------------------------------------
      1024  04249e04  bus_info_length 4, crc_length 36, crc 40452
      1028  31333934  bus_name "1394"
      1032  20ff5003  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 5 (64)
      1036  0030e002  company_id 0030e0     |
      1040  00454647  device_id 8594474567  | EUI-64 13757098081207879
      
                     root directory
                     -----------------------------------------------------------------
      1044  00062d69  directory_length 6, crc 11625
      1048  030030e0  vendor
      1052  8100000a  --> descriptor leaf at 1092
      1056  1700f970  model
      1060  81000011  --> descriptor leaf at 1128
      1064  0c0083c0  node capabilities: per IEEE 1394
      1068  d1000001  --> unit directory at 1072
      
                     unit directory at 1072
                     -----------------------------------------------------------------
      1072  00046ff9  directory_length 4, crc 28665 (should be 43676)
      1076  1200a02d  specifier id
      1080  13010001  version
      1084  1700f970  model
      1088  8100000f  --> descriptor leaf at 1148
      
                     descriptor leaf at 1092
                     -----------------------------------------------------------------
      1092  00085f8a  leaf_length 8, crc 24458
      1096  00000000  textual descriptor
      1100  00000000  minimal ASCII
      1104  4d69676c  "Migl"
      1108  69612054  "ia T"
      1112  6563686e  "echn"
      1116  6f6c6f67  "olog"
      1120  79204c74  "y Lt"
      1124  642e0000  "d."
      
                     descriptor leaf at 1128
                     -----------------------------------------------------------------
      1128  00040514  leaf_length 4, crc 1300
      1132  00000000  textual descriptor
      1136  00000000  minimal ASCII
      1140  4f584657  "OXFW"
      1144  20393730  " 970"
      
                     descriptor leaf at 1148
                     -----------------------------------------------------------------
      1148  0005a1dc  leaf_length 5, crc 41436
      1152  00000000  textual descriptor
      1156  00000000  minimal ASCII
      1160  4861726d  "Harm"
      1164  6f6e7941  "onyA"
      1168  7564696f  "udio"
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20240218074128.95210-5-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      52592932
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: handle quirk to calculate payload quadlets as data block counter · 4a486439
      Takashi Sakamoto authored
      Miglia Harmony Audio (OXFW970) has a quirk to put the number of
      accumulated quadlets in CIP payload into the dbc field of CIP header.
      
      This commit handles the quirk in the packet processing layer.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20240218074128.95210-4-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      4a486439
    • Takashi Sakamoto's avatar
      ALSA: oxfw: support the case that AV/C Stream Format Information command is not available · 25ab2b2f
      Takashi Sakamoto authored
      Miglia Harmony Audio does neither support AV/C Stream Format Information
      command nor AV/C Extended Stream Format Information command.
      
      This commit adds a workaround for the case and uses the hard-coded formats.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20240218074128.95210-3-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      25ab2b2f
    • Takashi Sakamoto's avatar
      ALSA: oxfw: use const qualifier for immutable argument · 5c0a35b2
      Takashi Sakamoto authored
      In the helper function, the first argument is immutable, thus it is
      preferable to use const qualifier.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20240218074128.95210-2-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5c0a35b2
    • Arnd Bergmann's avatar
      ALSA: core: fix buffer overflow in test_format_fill_silence() · e8991d1d
      Arnd Bergmann authored
      KASAN caught a buffer overflow with the hardcoded 2048 byte buffer
      size, when 2080 bytes are written to it:
      
       BUG: KASAN: slab-out-of-bounds in snd_pcm_format_set_silence+0x3bc/0x3e4
       Write of size 8 at addr ffff0000c8149800 by task kunit_try_catch/1297
      
       CPU: 0 PID: 1297 Comm: kunit_try_catch Tainted: G N 6.8.0-rc4-next-20240216 #1
       Hardware name: linux,dummy-virt (DT)
       Call trace:
        kasan_report+0x78/0xc0
        __asan_report_store_n_noabort+0x1c/0x28
        snd_pcm_format_set_silence+0x3bc/0x3e4
        _test_fill_silence+0xdc/0x298
        test_format_fill_silence+0x110/0x228
        kunit_try_run_case+0x144/0x3bc
        kunit_generic_run_threadfn_adapter+0x50/0x94
        kthread+0x330/0x3e8
        ret_from_fork+0x10/0x20
      
       Allocated by task 1297:
        __kmalloc+0x17c/0x2f0
        kunit_kmalloc_array+0x2c/0x78
        test_format_fill_silence+0xcc/0x228
        kunit_try_run_case+0x144/0x3bc
        kunit_generic_run_threadfn_adapter+0x50/0x94
        kthread+0x330/0x3e8
        ret_from_fork+0x10/0x20
      
      Replace the incorrect size with the correct length of 260 64-bit samples.
      Reported-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
      Suggested-by: default avatarIvan Orlov <ivan.orlov0322@gmail.com>
      Fixes: 3e39acf5 ("ALSA: core: Add sound core KUnit test")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Tested-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
      Acked-by: default avatarIvan Orlov <ivan.orlov0322@gmail.com>
      Link: https://lore.kernel.org/r/20240217104311.3749655-1-arnd@kernel.orgSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e8991d1d
  3. 16 Feb, 2024 2 commits
  4. 15 Feb, 2024 7 commits
  5. 14 Feb, 2024 3 commits
  6. 13 Feb, 2024 11 commits
  7. 12 Feb, 2024 11 commits