Re: disable seemingly unsupported MSI for AMD 17h/Raven Ridge HD Audio in azalia.c

2018-07-09 Thread Bryan Steele
On Mon, Jul 09, 2018 at 11:38:13AM +1000, Jonathan Gray wrote:
> On Sun, Jul 08, 2018 at 12:15:39PM -0700, Thomas Frohwein wrote:
> > Hi,
> > 
> > It appears that HD Audio from AMD's generation Ryzen can't handle MSI.
> > This leads to the bug that I reported here:
> > 
> > https://marc.info/?l=openbsd-bugs=151648196215922=2
> > 
> > Disabling MSI resolves the problem on my current system which is a Raven
> > Ridge APU. I don't have the Summit Ridge hardware anymore to test that
> > it is also resolved there, but the line is included in the diff
> > (PCI_PRODUCT_AMD_AMD64_17_HDA). It seems likely that this diff will also
> > fix HD Audio on Summit Ridge. However, testing would be welcome by
> > anyone who has a first-gen Ryzen.
> > 
> > I was slightly confused by the fact that so far it seems I've been the
> > only one who reported this. Even searching online for such an issue in
> > other OS didn't yield anything. However, the issue was there between 2
> > different Ryzen CPUs, 3 different motherboards, and at least 2 separate
> > OpenBSD -current installations. And it was never there on any
> > Intel-based setup, with otherwise same hardware and OpenBSD install.
> > While there have been several reports of people using Ryzen with
> > OpenBSD, they may not have used audio (that's my explanation for this
> > at the moment).
> > 
> > This diff was collaborative work with brynet@.
> > 
> > ok?
> 
> Does following the HUDSON2_HDA case and enabling pcie snooping
> instead change anything?

I had suggested this to Thomas and he said it had no effect for him,
unfortunately.

> > 
> > Index: azalia.c
> > ===
> > RCS file: /cvs/src/sys/dev/pci/azalia.c,v
> > retrieving revision 1.244
> > diff -u -p -r1.244 azalia.c
> > --- azalia.c22 Apr 2018 10:02:13 -  1.244
> > +++ azalia.c7 Jul 2018 18:26:20 -
> > @@ -517,6 +517,15 @@ azalia_pci_attach(struct device *parent,
> > azalia_pci_write(sc->pc, sc->tag, ICH_PCI_MMC, reg);
> > }
> >  
> > +   /* disable MSI for AMD Summit Ridge/Raven Ridge HD Audio */
> > +   if (PCI_VENDOR(sc->pciid) == PCI_VENDOR_AMD) {
> > +   switch (PCI_PRODUCT(sc->pciid)) {
> > +   case PCI_PRODUCT_AMD_AMD64_17_HDA:
> > +   case PCI_PRODUCT_AMD_RAVENRIDGE_HDA:
> > +   pa->pa_flags &= ~PCI_FLAGS_MSI_ENABLED;
> > +   }
> > +   }
> > +
> > /* interrupt */
> > if (pci_intr_map_msi(pa, ) && pci_intr_map(pa, )) {
> > printf(": can't map interrupt\n");
> > 
> 
> 



Re: disable seemingly unsupported MSI for AMD 17h/Raven Ridge HD Audio in azalia.c

2018-07-08 Thread Jonathan Gray
On Sun, Jul 08, 2018 at 12:15:39PM -0700, Thomas Frohwein wrote:
> Hi,
> 
> It appears that HD Audio from AMD's generation Ryzen can't handle MSI.
> This leads to the bug that I reported here:
> 
> https://marc.info/?l=openbsd-bugs=151648196215922=2
> 
> Disabling MSI resolves the problem on my current system which is a Raven
> Ridge APU. I don't have the Summit Ridge hardware anymore to test that
> it is also resolved there, but the line is included in the diff
> (PCI_PRODUCT_AMD_AMD64_17_HDA). It seems likely that this diff will also
> fix HD Audio on Summit Ridge. However, testing would be welcome by
> anyone who has a first-gen Ryzen.
> 
> I was slightly confused by the fact that so far it seems I've been the
> only one who reported this. Even searching online for such an issue in
> other OS didn't yield anything. However, the issue was there between 2
> different Ryzen CPUs, 3 different motherboards, and at least 2 separate
> OpenBSD -current installations. And it was never there on any
> Intel-based setup, with otherwise same hardware and OpenBSD install.
> While there have been several reports of people using Ryzen with
> OpenBSD, they may not have used audio (that's my explanation for this
> at the moment).
> 
> This diff was collaborative work with brynet@.
> 
> ok?

Does following the HUDSON2_HDA case and enabling pcie snooping
instead change anything?

> 
> Index: azalia.c
> ===
> RCS file: /cvs/src/sys/dev/pci/azalia.c,v
> retrieving revision 1.244
> diff -u -p -r1.244 azalia.c
> --- azalia.c  22 Apr 2018 10:02:13 -  1.244
> +++ azalia.c  7 Jul 2018 18:26:20 -
> @@ -517,6 +517,15 @@ azalia_pci_attach(struct device *parent,
>   azalia_pci_write(sc->pc, sc->tag, ICH_PCI_MMC, reg);
>   }
>  
> + /* disable MSI for AMD Summit Ridge/Raven Ridge HD Audio */
> + if (PCI_VENDOR(sc->pciid) == PCI_VENDOR_AMD) {
> + switch (PCI_PRODUCT(sc->pciid)) {
> + case PCI_PRODUCT_AMD_AMD64_17_HDA:
> + case PCI_PRODUCT_AMD_RAVENRIDGE_HDA:
> + pa->pa_flags &= ~PCI_FLAGS_MSI_ENABLED;
> + }
> + }
> +
>   /* interrupt */
>   if (pci_intr_map_msi(pa, ) && pci_intr_map(pa, )) {
>   printf(": can't map interrupt\n");
> 



disable seemingly unsupported MSI for AMD 17h/Raven Ridge HD Audio in azalia.c

2018-07-08 Thread Thomas Frohwein
Hi,

It appears that HD Audio from AMD's generation Ryzen can't handle MSI.
This leads to the bug that I reported here:

https://marc.info/?l=openbsd-bugs=151648196215922=2

Disabling MSI resolves the problem on my current system which is a Raven
Ridge APU. I don't have the Summit Ridge hardware anymore to test that
it is also resolved there, but the line is included in the diff
(PCI_PRODUCT_AMD_AMD64_17_HDA). It seems likely that this diff will also
fix HD Audio on Summit Ridge. However, testing would be welcome by
anyone who has a first-gen Ryzen.

I was slightly confused by the fact that so far it seems I've been the
only one who reported this. Even searching online for such an issue in
other OS didn't yield anything. However, the issue was there between 2
different Ryzen CPUs, 3 different motherboards, and at least 2 separate
OpenBSD -current installations. And it was never there on any
Intel-based setup, with otherwise same hardware and OpenBSD install.
While there have been several reports of people using Ryzen with
OpenBSD, they may not have used audio (that's my explanation for this
at the moment).

This diff was collaborative work with brynet@.

ok?

Index: azalia.c
===
RCS file: /cvs/src/sys/dev/pci/azalia.c,v
retrieving revision 1.244
diff -u -p -r1.244 azalia.c
--- azalia.c22 Apr 2018 10:02:13 -  1.244
+++ azalia.c7 Jul 2018 18:26:20 -
@@ -517,6 +517,15 @@ azalia_pci_attach(struct device *parent,
azalia_pci_write(sc->pc, sc->tag, ICH_PCI_MMC, reg);
}
 
+   /* disable MSI for AMD Summit Ridge/Raven Ridge HD Audio */
+   if (PCI_VENDOR(sc->pciid) == PCI_VENDOR_AMD) {
+   switch (PCI_PRODUCT(sc->pciid)) {
+   case PCI_PRODUCT_AMD_AMD64_17_HDA:
+   case PCI_PRODUCT_AMD_RAVENRIDGE_HDA:
+   pa->pa_flags &= ~PCI_FLAGS_MSI_ENABLED;
+   }
+   }
+
/* interrupt */
if (pci_intr_map_msi(pa, ) && pci_intr_map(pa, )) {
printf(": can't map interrupt\n");