Re: The need to call MmProbeAndLockPages
The "nearer" CPU (more-directly-accessing the shared memory) must
do ->AllocateCommonBuffer, and the "farther" one must map this aperture via
MmMapIoSpace.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@xxxxxxxxxxxxxxxx
http://www.storagecraft.com
"Daniel" <Daniel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:84EFE2C8-F22C-4429-9C2E-FFC97FF87AB2@xxxxxxxxxxxxxxxx
> The system and the subsystem are separate systems, running Windows and have
> separate CPUs. Each CPU needs to access the other's allocated memory directly
> through the bridge (DMA is not used). if the memory allocated is not
> contiguous, then each side needs the physical address of each page?
> --
> Thanks,
>
> Daniel
>
>
> "Maxim S. Shatskih" wrote:
>
> > Maybe ->AllocateCommonBuffer will fit better? It knows about the
possible
> > PCI bridges and apertures before your device, and
> > MmAllocateContiguousMemorySpecifyCache does not.
> >
> > --
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > maxim@xxxxxxxxxxxxxxxx
> > http://www.storagecraft.com
> >
> > "Daniel" <Daniel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > news:799C15B7-C15A-4D6E-9F08-66CFB368471A@xxxxxxxxxxxxxxxx
> > > Thanks for your response.
> > > You are right. If the memory is shared localy, I do not need to allocate
a
> > > contiguous memory. However, The driver is a driver for a PCI bridge chip
to
> > > map the memories of a system and a subsystem across the PCI Bridge.
> > > Each system allocates a contiguous memory using
> > > MmAllocateContiguousMemorySpecifyCache. The driver on each system uses
> > > MmMapIoSpace to map the other side memory through a PCI BAR using one
> > > physical address.
> > >
> > > --
> > > Thanks,
> > >
> > > Daniel
> > >
> > >
> > > "Maxim S. Shatskih" wrote:
> > >
> > > > > If a driver allocates memory using
> > > > >MmAllocateContiguousMemorySpecifyCache,
> > > >
> > > > For what? This function is intended for DMA adapter objects
implementors
> > only -
> > > > like the AGP GART drivers.
> > > >
> > > > Usual drivers should use ->AllocateCommonBuffer instead, if this is for
DMA
> > and
> > > > "contiguous" is really need. Otherwise, use ExAllocatePoolWithTag.
> > > >
> > > > > does the driver need to call MmProbeAndLockPages before calling
> > > > > MmMapLockedPagesSpecifyCache to get a user space virtual address? I
> > > >
> > > > Exposing kernel memory to user mode is a very bad idea. Better to do
vice
> > > > versa - allocate in user, lock and map in kernel.
> > > >
> > > > > Also, If a driver maps a PCI memory BAR using MmMapIoSpace, does the
> > > > >driver
> > > > > need to call MmProbeAndLockPages before calling
> > > > >MmMapLockedPagesSpecifyCache
> > > >
> > > > No need at all.
> > > >
> > > > --
> > > > Maxim Shatskih, Windows DDK MVP
> > > > StorageCraft Corporation
> > > > maxim@xxxxxxxxxxxxxxxx
> > > > http://www.storagecraft.com
> > > >
> > > >
> >
> >
.