Re: [Alsa-user] CMI8738, accessing MIDI port causes sudden system reboot

2019-12-16 Thread Takashi Iwai
On Mon, 16 Dec 2019 22:16:34 +0100,
Patrick May wrote:
> 
> Hello,
> 
> Takashi Iwai wrote:
> >Good to hear.  I'll merge with a proper changelog later.
> 
> >Meanwhile, maybe it'd be better to disable the MIDI port automatically
> >on such a device if possible.  Could you check the PCI SSID of this
> >device (e.g. the output of lspci -nv)?  If it looks like a proper and
> >unique ID, we can make a blacklist for excluding the MIDI port.
> 
> I've attached the output of "lspci -nv" to this message. Let me know
> if you want any other information.
(snip)
> 09:00.0 0401: 13f6:0111 (rev 10)
>   Subsystem: 13f6:0111

So unfortunately it's a generic SSID, and can't be used as the
identifier.  The only way is to pass the option manually.

I'm going to merge the patch for 5.6 kernel, as it's no critical
issue nor regression.


thanks,

Takashi


___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user


Re: [Alsa-user] CMI8738, accessing MIDI port causes sudden system reboot

2019-12-16 Thread Patrick May

Hello,

Takashi Iwai wrote:
>Good to hear.  I'll merge with a proper changelog later.

>Meanwhile, maybe it'd be better to disable the MIDI port automatically
>on such a device if possible.  Could you check the PCI SSID of this
>device (e.g. the output of lspci -nv)?  If it looks like a proper and
>unique ID, we can make a blacklist for excluding the MIDI port.

I've attached the output of "lspci -nv" to this message. Let me know if 
you want any other information.


Regards,
Patrick

 This is the output of "lspci -nv" run as root -


00:00.0 0600: 1022:1480
Subsystem: 1043:87c0
Flags: fast devsel

00:00.2 0806: 1022:1481
Subsystem: 1043:87c0
Flags: bus master, fast devsel, latency 0
Capabilities: [40] Secure device 
Capabilities: [64] MSI: Enable- Count=1/4 Maskable- 64bit+
Capabilities: [74] HyperTransport: MSI Mapping Enable+ Fixed+
Capabilities: [c8] Vendor Specific Information: Len=18 

00:01.0 0600: 1022:1482
Flags: fast devsel

00:01.3 0604: 1022:1483 (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=01, subordinate=09, sec-latency=0
I/O behind bridge: c000-efff
Memory behind bridge: f650-f67f
Capabilities: [50] Power Management version 3
Capabilities: [58] Express Root Port (Slot+), MSI 00
Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [c0] Subsystem: 1043:87c0
Capabilities: [c8] HyperTransport: MSI Mapping Enable+ Fixed+
Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 

Capabilities: [140] Device Serial Number 00-0c-87-00-00-00-00-01
Capabilities: [150] Advanced Error Reporting
Capabilities: [270] #19
Capabilities: [2a0] Access Control Services
Capabilities: [370] L1 PM Substates
Capabilities: [380] #1d
Capabilities: [3c4] #23
Capabilities: [400] #25
Capabilities: [410] #26
Capabilities: [440] #27
Kernel driver in use: pcieport

00:02.0 0600: 1022:1482
Flags: fast devsel

00:03.0 0600: 1022:1482
Flags: fast devsel

00:03.1 0604: 1022:1483 (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=0a, subordinate=0a, sec-latency=0
I/O behind bridge: f000-
Memory behind bridge: f500-f60f
Prefetchable memory behind bridge: e800-f1ff
Capabilities: [50] Power Management version 3
Capabilities: [58] Express Root Port (Slot+), MSI 00
Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [c0] Subsystem: 1043:87c0
Capabilities: [c8] HyperTransport: MSI Mapping Enable+ Fixed+
Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 

Capabilities: [140] Device Serial Number 00-0c-87-00-00-00-00-01
Capabilities: [150] Advanced Error Reporting
Capabilities: [270] #19
Capabilities: [2a0] Access Control Services
Capabilities: [370] L1 PM Substates
Capabilities: [380] #1d
Capabilities: [3c4] #23
Capabilities: [400] #25
Capabilities: [410] #26
Capabilities: [440] #27
Kernel driver in use: pcieport

00:04.0 0600: 1022:1482
Flags: fast devsel

00:05.0 0600: 1022:1482
Flags: fast devsel

00:07.0 0600: 1022:1482
Flags: fast devsel

00:07.1 0604: 1022:1484 (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=0b, subordinate=0b, sec-latency=0
Capabilities: [50] Power Management version 3
Capabilities: [58] Express Root Port (Slot-), MSI 00
Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [c0] Subsystem: 1022:1484
Capabilities: [c8] HyperTransport: MSI Mapping Enable+ Fixed+
Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 

Capabilities: [270] #19
Capabilities: [400] #25
Capabilities: [410] #26
Capabilities: [440] #27
Kernel driver in use: pcieport

00:08.0 0600: 1022:1482
Flags: fast devsel

00:08.1 0604: 1022:1484 (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=0c, subordinate=0c, sec-latency=0
Memory behind bridge: f620-f64f
Capabilities: [50] Power Management version 3
Capabilities: [58] Express Root Port (Slot-), MSI 00
Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [c0] Subsystem: 1022:1484
Capabilities: [c8] HyperTransport: MSI Mapping Enable+ Fixed+
Capabilities: 

Re: [Alsa-user] CMI8738, accessing MIDI port causes sudden system reboot

2019-12-16 Thread Takashi Iwai
On Mon, 16 Dec 2019 19:02:45 +0100,
Patrick May wrote:
> 
> Hi Takashi,
> 
> Thanks very much, this patch worked perfectly!
> 
> Regards, Patrick
> (Sorry, at first I accidentally replied directly to Takashi which I
> hadn't meant to do. I'm not used to using mailing lists...)

Good to hear.  I'll merge with a proper changelog later.

Meanwhile, maybe it'd be better to disable the MIDI port automatically
on such a device if possible.  Could you check the PCI SSID of this
device (e.g. the output of lspci -nv)?  If it looks like a proper and
unique ID, we can make a blacklist for excluding the MIDI port.


thanks,

Takashi


___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user


Re: [Alsa-user] CMI8738, accessing MIDI port causes sudden system reboot

2019-12-16 Thread Patrick May

Hi Takashi,

Thanks very much, this patch worked perfectly!

Regards, Patrick
(Sorry, at first I accidentally replied directly to Takashi which I 
hadn't meant to do. I'm not used to using mailing lists...)



___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user


Re: [Alsa-user] CMI8738, accessing MIDI port causes sudden system reboot

2019-12-16 Thread Takashi Iwai
On Mon, 16 Dec 2019 17:06:14 +0100,
Patrick May wrote:
> 
> Hello,
> 
> I have a C-Media CMI8738 soundcard. I'm using it because it has a
> special feature that I want: the OPL3 synth.
> 
> It creates two ALSA MIDI ports. In my case, these are '20:0, C-Media
> CMI8738, C-Media CMI8738 MIDI' and '21:0, OPL3 FM synth, OPL3 FM
> Port'.
> The first one is completely useless - this soundcard actually has no
> game/midi port connector on it. The second one is what I really want.
> 
> The problem I have is that the first port has a weird problem in that
> if you access it in some way (eg. play a midi file through it with
> aplaymidi) it has a very high chance of making the computer reboot
> suddenly and without warning. This seems to be different from a kernel
> panic because my system is configured not to automatically reboot on
> panic, and I don't get the capslock/scroll lock lights flashing - the
> system just reboots suddenly and without warning.
> 
> I can't simply avoid using that MIDI port - music software I use, such
> as Rosegarden, seems to automatically connect to all MIDI ports as
> part of its initialisation routine. I discovered the problem because
> it was happening (my system was unexpectedly rebooting) every few
> times I opened a project file in Rosegarden.
> 
> So I'm looking for a workaround that will remove/destroy/eliminate
> this unwanted and unused MIDI port so that nothing can make my system
> reboot by accident. So far I have tried this:
> 
> * load snd_cmipci with parameter 'mpu_port=0'. This didn't work, the
> unwanted port was still created and still caused the reboot when I
> tested it.
> * prevent snd_mpu401_uart from loading. This didn't work - snd_cmipci
> refused to load without it.
> 
> Does anyone have any ideas or suggestions?
> Maybe this is something that the ALSA driver developers should be made
> aware of, but I thought I should ask about it here first.

A patch like below should make mpu_port=0 option working to disable
for the MIDI port.  Give it a try.


Takashi

diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 4bfab21c53f4..92610ab3290d 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -42,7 +42,7 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8738},"
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;  /* ID for this card */
 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable 
switches */
-static long mpu_port[SNDRV_CARDS];
+static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
 static long fm_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
 static bool soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
 #ifdef SUPPORT_JOYSTICK
@@ -3132,7 +3132,8 @@ static int snd_cmipci_create(struct snd_card *card, 
struct pci_dev *pci,
if (cm->chip_version >= 39) {
val = snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1);
if (val != 0x00 && val != 0xff) {
-   iomidi = cm->iobase + CM_REG_MPU_PCI;
+   if (mpu_port[dev])
+   iomidi = cm->iobase + CM_REG_MPU_PCI;
integrated_midi = 1;
}
}


___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user