Bug 201021
Summary: | ALSA bebob driver often can't take bootloader to run firmware even if sending cue | ||
---|---|---|---|
Product: | Drivers | Reporter: | Takashi Sakamoto (o-takashi) |
Component: | Sound(ALSA) | Assignee: | Jaroslav Kysela (perex) |
Status: | RESOLVED CODE_FIX | ||
Severity: | normal | CC: | o-takashi |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | at least v3.16 or later | Subsystem: | |
Regression: | Yes | Bisected commit-id: |
Description
Takashi Sakamoto
2018-09-05 11:04:16 UTC
My protocol analyzer of IEEE 1394 bus record below entry for the cue from snd-bebob in Ubuntu 18.10 (4.18.0-7-generic) on AMD Ryzen 5 2400G. ``` rel. time (uSec),type,source ID,dest. ID,offset,label,retry code,response code,priority,data length,quadlet data,tag,channel,sync.,speed,acknowledge,data 0.000,WriteBlockReq,0xFFC2,0xFFC1,0xFFFFC8021000,23,retry_X,,0,12,,,,,400,ack_pending,0x134F6737,0x174F273B,0xB3DD570C,0xB7D632ED ``` The transaction includes unexpected content of payload: - expected: 0x01000000,0x00001101,0x00000000 - actual: 0x134F6737,0x174F273B,0xB3DD570C This transaction is executed in below code of 'sound/firewire/bebob/bebob_maudio.c'. ``` 94 int snd_bebob_maudio_load_firmware(struct fw_unit *unit) 95 { 96 struct fw_device *device = fw_parent_device(unit); 97 int err, rcode; 98 u64 date; 99 __le32 cues[3] = { 100 cpu_to_le32(MAUDIO_BOOTLOADER_CUE1), 101 cpu_to_le32(MAUDIO_BOOTLOADER_CUE2), 102 cpu_to_le32(MAUDIO_BOOTLOADER_CUE3) 103 }; 104 105 /* check date of software used to build */ 106 err = snd_bebob_read_block(unit, INFO_OFFSET_SW_DATE, 107 &date, sizeof(u64)); 108 if (err < 0) 109 goto end; 110 /* 111 * firmware version 5058 or later has date later than "20070401", but 112 * 'date' is not null-terminated. 113 */ 114 if (date < 0x3230303730343031LL) { 115 dev_err(&unit->device, 116 "Use firmware version 5058 or later\n"); 117 err = -ENOSYS; 118 goto end; 119 } 120 121 rcode = fw_run_transaction(device->card, TCODE_WRITE_BLOCK_REQUEST, 122 device->node_id, device->generation, 123 device->max_speed, BEBOB_ADDR_REG_REQ, 124 cues, sizeof(cues)); 125 if (rcode != RCODE_COMPLETE) { 126 dev_err(&unit->device, 127 "Failed to send a cue to load firmware\n"); 128 err = -EIO; 129 } 130 end: 131 return err; 132 } ``` If the data of 'cues' is in kernel stack, the cause is enabled 'CONFIG_VMAP_STACK'[1] introduced in v4.9 kernel because 7th argument of 'fw_run_transaction()' is passed as a 2nd argument of 'dma_map_single()' in 'at_context_queue_packet()' of 'drivers/firewire/ohci.c'. [1] https://lwn.net/Articles/692208/ A fix was applied to sound tree. https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?id=493626f2d87a74e6dbea1686499ed6e7e600484e This will be pulled into v4.20 kernel. |