On Tue, Oct 9, 2018 at 11:20 AM Sunil Kovvuri <[email protected]> wrote:
>
> On Tue, Oct 9, 2018 at 1:27 PM Arnd Bergmann <[email protected]> wrote:
> >
> > On Tue, Oct 9, 2018 at 9:03 AM Sunil Kovvuri <[email protected]>
> > wrote:
> > > On Mon, Oct 8, 2018 at 5:38 PM Arnd Bergmann <[email protected]> wrote:
> > > > On Sun, Oct 7, 2018 at 5:01 PM <[email protected]> wrote:
> > I think if you enable CONFIG_DEBUG_VIRTUAL, the virt_to_page()
> > above should trigger a warning in
> >
> > phys_addr_t __virt_to_phys(unsigned long x)
> > {
> > WARN(!__is_lm_address(x),
> > "virt_to_phys used for non-linear address: %pK (%pS)\n",
> > (void *)x,
> > (void *)x);
> >
> > return __virt_to_phys_nodebug(x);
> > }
> >
> > Can you verify that?
> >
> > Arnd
>
> No, it isn't, as for 64bit systems CONFIG_SPARSEMEM_VMEMMAP is enabled.
But that is also user-selectable, right? It still seems to be really
fragile to rely on non-documented behavior of virt_to_phys()
here, if that only works for some configurations.
> But is there any alternative to what is being done ?
I'm not completely sure, but there may be a way to do this correctly
using the iommu API instead of the dma-mapping API. What you do
here is fairly rare, but not unprecedented.
Arnd