On Sun, Jun 21, 2009 at 01:07:37AM +0000, Jacob Meuser wrote: > On Mon, Feb 09, 2009 at 12:40:31AM +0000, Owain Ainsworth wrote: > > On Sun, Feb 08, 2009 at 05:11:16PM -0500, Brad wrote: > > > Please test the following diff with any azalia(4) adapter, but especially > > > with any ATI or NVIDIA chipsets. Make sure sound still works properly > > > without any unusual sound artifacts. > > > > Surely this isn't much of an improvement. At least only map uncached > > on the hardware that needs it. Why give non-broken chips the cpu-time > > hit? > > I recently got some reports of broken sound with azalia, all with > amd64.mp with nVidia chipsets. at least two of the reports said > that this is a new problem, that the devices were working properly > a couple months ago. one (not sure if it was working before) was > fixed by switching from enabling pcie snoop to enabling > BUS_DMA_NOCACHE. haven't heard back from the others yet. > > please test the following if you have ATI or NVIDIA chipsets.
haven't gotten much feedback on this one ... -- [email protected] SDF Public Access UNIX System - http://sdf.lonestar.org Index: azalia.c =================================================================== RCS file: /cvs/src/sys/dev/pci/azalia.c,v retrieving revision 1.140 diff -u -p azalia.c --- azalia.c 18 Jun 2009 08:19:03 -0000 1.140 +++ azalia.c 20 Jun 2009 11:01:18 -0000 @@ -143,6 +143,7 @@ typedef struct azalia_t { bus_dma_tag_t dmat; pcireg_t pciid; uint32_t subid; + int dma_nocache; codec_t codecs[15]; int ncodecs; /* number of codecs */ @@ -361,7 +362,6 @@ azalia_pci_attach(struct device *parent, struct device pcireg_t v; pci_intr_handle_t ih; const char *interrupt_str; - uint8_t reg; sc = (azalia_t*)self; pa = aux; @@ -384,15 +384,10 @@ azalia_pci_attach(struct device *parent, struct device v = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x44); pci_conf_write(pa->pa_pc, pa->pa_tag, 0x44, v & (~0x7)); - /* enable PCIe snoop */ + sc->dma_nocache = 0; switch (PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_ATI_SB450_HDA: case PCI_PRODUCT_ATI_SBX00_HDA: - reg = azalia_pci_read(pa->pa_pc, pa->pa_tag, ATI_PCIE_SNOOP_REG); - reg &= ATI_PCIE_SNOOP_MASK; - reg |= ATI_PCIE_SNOOP_ENABLE; - azalia_pci_write(pa->pa_pc, pa->pa_tag, ATI_PCIE_SNOOP_REG, reg); - break; case PCI_PRODUCT_NVIDIA_MCP51_HDA: case PCI_PRODUCT_NVIDIA_MCP55_HDA: case PCI_PRODUCT_NVIDIA_MCP61_HDA_1: @@ -415,10 +410,7 @@ azalia_pci_attach(struct device *parent, struct device case PCI_PRODUCT_NVIDIA_MCP89_HDA_2: case PCI_PRODUCT_NVIDIA_MCP89_HDA_3: case PCI_PRODUCT_NVIDIA_MCP89_HDA_4: - reg = azalia_pci_read(pa->pa_pc, pa->pa_tag, NVIDIA_PCIE_SNOOP_REG); - reg &= NVIDIA_PCIE_SNOOP_MASK; - reg |= NVIDIA_PCIE_SNOOP_ENABLE; - azalia_pci_write(pa->pa_pc, pa->pa_tag, NVIDIA_PCIE_SNOOP_REG, reg); + sc->dma_nocache = BUS_DMA_NOCACHE; break; } @@ -1109,7 +1101,7 @@ azalia_alloc_dmamem(azalia_t *az, size_t size, size_t if (nsegs != 1) goto free; err = bus_dmamem_map(az->dmat, d->segments, 1, size, - &d->addr, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); + &d->addr, BUS_DMA_NOWAIT | BUS_DMA_COHERENT | az->dma_nocache); if (err) goto free; err = bus_dmamap_create(az->dmat, size, 1, size, 0,
