Date: Thu, 12 Dec 2013 13:00:08 +0000 (UTC) From: Andreas Tobler <andreast@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259258 - in stable/10/sys/powerpc: ofw pseries Message-ID: <201312121300.rBCD08Df005630@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andreast Date: Thu Dec 12 13:00:07 2013 New Revision: 259258 URL: http://svnweb.freebsd.org/changeset/base/259258 Log: MFC: r258427, r258694 r258694: Make RTAS calls, which call setfault() to recover from machine checks, preserve any existing fault buffer. RTAS calls are meant to be safe from interrupt context (and are indeed used there to implement the xics PIC driver). Without this, calling into RTAS in interrupt context would have the effect of clearing any existing onfault state of the interrupted thread, potentially leading to a panic. r258427: For PCI<->PCI bridges, #address-cells may be 3. Allow this when parsing the ibm,dma-window properties. This is especially a concern when #ibm,dma-address-cells is not specified and we have to use the regular #address-cells property. Modified: stable/10/sys/powerpc/ofw/rtas.c stable/10/sys/powerpc/pseries/plpar_iommu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/powerpc/ofw/rtas.c ============================================================================== --- stable/10/sys/powerpc/ofw/rtas.c Thu Dec 12 12:36:40 2013 (r259257) +++ stable/10/sys/powerpc/ofw/rtas.c Thu Dec 12 13:00:07 2013 (r259258) @@ -192,7 +192,7 @@ int rtas_call_method(cell_t token, int nargs, int nreturns, ...) { vm_offset_t argsptr; - faultbuf env; + faultbuf env, *oldfaultbuf; va_list ap; struct { cell_t token; @@ -221,6 +221,7 @@ rtas_call_method(cell_t token, int nargs /* Get rid of any stale machine checks that have been waiting. */ __asm __volatile ("sync; isync"); + oldfaultbuf = curthread->td_pcb->pcb_onfault; if (!setfault(env)) { __asm __volatile ("sync"); result = rtascall(argsptr, rtas_private_data); @@ -228,7 +229,7 @@ rtas_call_method(cell_t token, int nargs } else { result = RTAS_HW_ERROR; } - curthread->td_pcb->pcb_onfault = 0; + curthread->td_pcb->pcb_onfault = oldfaultbuf; __asm __volatile ("sync"); rtas_real_unmap(argsptr, &args, sizeof(args)); Modified: stable/10/sys/powerpc/pseries/plpar_iommu.c ============================================================================== --- stable/10/sys/powerpc/pseries/plpar_iommu.c Thu Dec 12 12:36:40 2013 (r259257) +++ stable/10/sys/powerpc/pseries/plpar_iommu.c Thu Dec 12 13:00:07 2013 (r259258) @@ -73,8 +73,9 @@ phyp_iommu_set_dma_tag(device_t dev, dev { device_t p; phandle_t node; - cell_t dma_acells, dma_scells, dmawindow[5]; + cell_t dma_acells, dma_scells, dmawindow[6]; struct iommu_map *i; + int cell; for (p = child; p != NULL; p = device_get_parent(p)) { if (ofw_bus_has_prop(p, "ibm,my-dma-window")) @@ -104,16 +105,17 @@ phyp_iommu_set_dma_tag(device_t dev, dev struct dma_window *window = malloc(sizeof(struct dma_window), M_PHYPIOMMU, M_WAITOK); - if (dma_acells == 1) - window->start = dmawindow[1]; - else - window->start = ((uint64_t)(dmawindow[1]) << 32) | dmawindow[2]; - if (dma_scells == 1) - window->end = window->start + dmawindow[dma_acells + 1]; - else - window->end = window->start + - (((uint64_t)(dmawindow[dma_acells + 1]) << 32) | - dmawindow[dma_acells + 2]); + window->start = 0; + for (cell = 1; cell < 1 + dma_acells; cell++) { + window->start <<= 32; + window->start |= dmawindow[cell]; + } + window->end = 0; + for (; cell < 1 + dma_acells + dma_scells; cell++) { + window->end <<= 32; + window->end |= dmawindow[cell]; + } + window->end += window->start; if (bootverbose) device_printf(dev, "Mapping IOMMU domain %#x\n", dmawindow[0]);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312121300.rBCD08Df005630>