Port-xen archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Xen #ifdef-age & x86 bus_space(9) implementation
On Wed, May 05, 2010 at 04:09:44PM -0500, David Young wrote:
> I don't understand some of the code that is conditionally compiled for
> XEN/!XEN.
>
> Why don't both bus_space_map() and bus_space_alloc() do this?
>
> #ifndef XEN
> if (bpa >= IOM_BEGIN && (bpa + size) != 0 && (bpa + size) <= IOM_END)
> {
> *bshp = (bus_space_handle_t)ISA_HOLE_VADDR(bpa);
> return(0);
> }
> #endif /* !XEN */
>
> Only bus_space_map() contains that block.
I guess you used one of the bus_space_map() for something else
above.
I'm not sure, but I think the reason we're not running this for Xen
is that, for Xen the ISA memory hole is not automagically mapped
by locore.S at boot.
>
> In x86_mem_add_mapping(), which both _alloc() and _map() call, there is
> a similar block:
>
> #ifdef XEN
> if (bpa >= IOM_BEGIN && (bpa + size) != 0 && (bpa + size) <= IOM_END)
> {
> sva = (vaddr_t)ISA_HOLE_VADDR(pa);
> } else
> #endif /* XEN */
>
> Should that be #ifndef XEN instead of #ifdef?
No, this is correct. On native x86 we never call this code for
the ISA hole. On Xen we do (because of the #ifndef XEN you asked about
above), and in this case we want to use the matching VA for the
physical ISA hole addresses, not something returned by our
allocator.
>
> I would like for us to avoid this:
>
> for (va = sva; pa != endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
> #ifdef XEN
> pmap_kenter_ma(va, pa, VM_PROT_READ | VM_PROT_WRITE,
> pmapflags);
> #else
> pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE,
> pmapflags);
> #endif /* XEN */
> }
>
> Is there any reason not to add a weak alias pmap_kenter_ma ->
> pmap_kenter_pa, and to extract pmap_kenter_ma() into its own object that
> is linked into the Xen kernels, only?
that would work I guess (and for the pmap_extract* you ask in your
next message too).
--
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
NetBSD: 26 ans d'experience feront toujours la difference
--
Home |
Main Index |
Thread Index |
Old Index