All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] make qemu buildable without CONFIG_VT
@ 2006-02-09 15:51 Atsushi Nemoto
  2006-02-09 16:32 ` changing the page properties to cached/uncached Niels Sterrenburg
  2006-02-16 14:40 ` [PATCH] make qemu buildable without CONFIG_VT Ralf Baechle
  0 siblings, 2 replies; 6+ messages in thread
From: Atsushi Nemoto @ 2006-02-09 15:51 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff --git a/arch/mips/qemu/Makefile b/arch/mips/qemu/Makefile
index 11189fa..5f34a85 100644
--- a/arch/mips/qemu/Makefile
+++ b/arch/mips/qemu/Makefile
@@ -2,4 +2,5 @@
 # Makefile for Qemu specific kernel interface routines under Linux.
 #
 
-obj-y		= q-firmware.o q-int.o q-irq.o q-mem.o q-setup.o q-vga.o
+obj-y		= q-firmware.o q-int.o q-irq.o q-mem.o q-setup.o
+obj-$(CONFIG_VT) = q-vga.o
diff --git a/arch/mips/qemu/q-setup.c b/arch/mips/qemu/q-setup.c
index 32c3d4c..acf0f5b 100644
--- a/arch/mips/qemu/q-setup.c
+++ b/arch/mips/qemu/q-setup.c
@@ -23,6 +23,8 @@ static void __init qemu_timer_setup(stru
 void __init plat_setup(void)
 {
 	set_io_port_base(QEMU_PORT_BASE);
+#ifdef CONFIG_VT
 	qvga_init();
+#endif
 	board_timer_setup = qemu_timer_setup;
 }

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* changing the page properties to cached/uncached
  2006-02-09 15:51 [PATCH] make qemu buildable without CONFIG_VT Atsushi Nemoto
@ 2006-02-09 16:32 ` Niels Sterrenburg
  2006-02-10 16:01   ` Alan Cox
  2006-02-16 14:40 ` [PATCH] make qemu buildable without CONFIG_VT Ralf Baechle
  1 sibling, 1 reply; 6+ messages in thread
From: Niels Sterrenburg @ 2006-02-09 16:32 UTC (permalink / raw)
  To: linux-mips

Dear list members,

Sorry for the long mail, but we're trying some exiting things
on which we need help....

----------------------

What we want:

----------------------

We have a multiprocessor system containing one MIPS r4k and
one DSP (alike) processor.

We are porting our Inter Processor Communication software to
do communication by the use of
interrupts between MIPS and DSP and
via a shared memory area in RAM for the data transfer.



SDRAM memory map:



0x00000000-0x03000000: MIPS with Linux:	48 MB

0x03000000-0x04000000: DSP software:    16 MB

0x04000000-0x08000000: Shared memory:   64 MB



We want to make this shared memory available to userspace applications so
that they can use it
without having a copy over the kernel boundary.



Besides that we want to set the shared memory cache coherancy to cached
copy-back !!!



----------------------

Our strategy:

----------------------

- Do not use swapping in the system

- Limit Linux memory usage via the mem= option in the kernel command line.

- From MIPS user space: do a mmap for the shared memory area.

- From MIPS user space: call (our selfwritten) shmemipc driver with the
request to set the mapped pages to cached (by passing virtual address and
length).

- From kernel space: find the vma for the supplied virtual address range
and change cache properties of all pages in that virtual range.



At this point the userspace application should have a cached view to
shared memory.

For flushing and invalidate we intend to use the same shmemipc driver
(e.g. to delegate the job to kernel space).



E.g.

userapp wants to read shared memory: call shmemipc driver to invalidate a
certain virtual range (before the read)

userapp wants to write shared memory: call shmemipc driver to flush a
certain virtual range (after the write)

etc.



----------------------

What we tried:

----------------------

We exported the cache flush routines in the kernel so that we can use them
in a loadable module.

We exported the tlb flush routines in the kernel so that we can use them
in a loadable module.

We succesfully do an mmap of the shared memory:

- As we mmap outside the kernel sdram (<48MB), mmap creates new pages
which are initialized to uncached, e.g. it assumes I/O)



In the driver we can find a valid vma for the memory mapped range.



We (try to) change the cache porperties of the page(s) in the vma by:

- adapting the vma->vm_page_prot and set cache properties to cached.

- for this we created the following inline derived from pgprot_noncached:

static inline pgprot_t pgprot_cached(pgprot_t _prot)

{

    unsigned long prot = pgprot_val(_prot);



    prot = (prot & ~_CACHE_MASK) | _CACHE_CACHABLE_NONCOHERENT;



    return __pgprot(prot);

}

- this inline we use as follows:

vma->vm_page_prot = pgprot_cached(vma->vm_page_prot);

- After this we do a local_flush_tlb_page or local_flush_tlb_all in order
to get the hardware TLB updated by the adapted oine in the page table.



----------------------

Open issues:

----------------------

We use dump_tlb_all to see if the cache properties of the page has
changed, which is not the case.
We use a multiprocessor test to check if the shared memory view from MIPS
is cached, which is not the case.



What are we missing here ?

What are the exact steps for adapting page properties in the kernel (for
MIPS) ?

We looked at remap_pfn_range but this sets pages to be IO and reserved....



Any help is very much appreciated.

regards,

Niels Sterrenburg

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: changing the page properties to cached/uncached
  2006-02-09 16:32 ` changing the page properties to cached/uncached Niels Sterrenburg
@ 2006-02-10 16:01   ` Alan Cox
  2006-02-13  8:40     ` Niels Sterrenburg
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Cox @ 2006-02-10 16:01 UTC (permalink / raw)
  To: pulsar; +Cc: linux-mips

On Iau, 2006-02-09 at 17:32 +0100, Niels Sterrenburg wrote:
> - Do not use swapping in the system
> - Limit Linux memory usage via the mem= option in the kernel command line.
> - From MIPS user space: do a mmap for the shared memory area.
> - From MIPS user space: call (our selfwritten) shmemipc driver with the
> request to set the mapped pages to cached (by passing virtual address and
> length).
> - From kernel space: find the vma for the supplied virtual address range
> and change cache properties of all pages in that virtual range.

You don't need to worry about swapping. You can simply mark the pages in
question reserved just as i386 does with the 640K-1Mb hole or since when
a page has a use count it won't swap out, mark it as having a user. In
your case the "user" is the DSP so you just need to account fine

> - As we mmap outside the kernel sdram (<48MB), mmap creates new pages
> which are initialized to uncached, e.g. it assumes I/O)

You can provide your own "nopage" method. Good example is
sound/oss/via82cxxx_audio.c 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: changing the page properties to cached/uncached
  2006-02-10 16:01   ` Alan Cox
@ 2006-02-13  8:40     ` Niels Sterrenburg
  0 siblings, 0 replies; 6+ messages in thread
From: Niels Sterrenburg @ 2006-02-13  8:40 UTC (permalink / raw)
  To: Alan Cox; +Cc: pulsar, linux-mips

> On Iau, 2006-02-09 at 17:32 +0100, Niels Sterrenburg wrote:
>> - Do not use swapping in the system
>> - Limit Linux memory usage via the mem= option in the kernel command
>> line.
>> - From MIPS user space: do a mmap for the shared memory area.
>> - From MIPS user space: call (our selfwritten) shmemipc driver with the
>> request to set the mapped pages to cached (by passing virtual address
>> and
>> length).
>> - From kernel space: find the vma for the supplied virtual address range
>> and change cache properties of all pages in that virtual range.
>
> You don't need to worry about swapping. You can simply mark the pages in
> question reserved just as i386 does with the 640K-1Mb hole or since when
> a page has a use count it won't swap out, mark it as having a user. In
> your case the "user" is the DSP so you just need to account fine

Ok, swapping is not (yet) relevant for us, but I'll keep it in mind.

> You can provide your own "nopage" method. Good example is
> sound/oss/via82cxxx_audio.c
>
So if I understand correctly I can implement my own nopage routine
as part of my driver mmap functionanlity (via initializing vm_ops in mmap).

When an mmap on my driver is done to a virtual area for which nopage's
exist then my nopage routine is called, right ?

Then I can handle tha cache properties while creating the page(s), right ?

In the case of the via82cxxx_aucio.c it grabs a dma page, claims it
and returns it, right ?

If all my above interpretations are correct, how can I then toggle the
page caching properties:
- on which level should I do that: pte/page level or vma level ?

regards,

Niels

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] make qemu buildable without CONFIG_VT
  2006-02-09 15:51 [PATCH] make qemu buildable without CONFIG_VT Atsushi Nemoto
  2006-02-09 16:32 ` changing the page properties to cached/uncached Niels Sterrenburg
@ 2006-02-16 14:40 ` Ralf Baechle
  2006-02-16 16:10   ` Atsushi Nemoto
  1 sibling, 1 reply; 6+ messages in thread
From: Ralf Baechle @ 2006-02-16 14:40 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Fri, Feb 10, 2006 at 12:51:04AM +0900, Atsushi Nemoto wrote:

> Subject: [PATCH] make qemu buildable without CONFIG_VT

Applied.

  Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] make qemu buildable without CONFIG_VT
  2006-02-16 14:40 ` [PATCH] make qemu buildable without CONFIG_VT Ralf Baechle
@ 2006-02-16 16:10   ` Atsushi Nemoto
  0 siblings, 0 replies; 6+ messages in thread
From: Atsushi Nemoto @ 2006-02-16 16:10 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips

>>>>> On Thu, 16 Feb 2006 14:40:19 +0000, Ralf Baechle <ralf@linux-mips.org> said:

>> Subject: [PATCH] make qemu buildable without CONFIG_VT

ralf> Applied.

Thanks.  And thank you for fixing my fault in Makefile.

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-02-16 16:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-09 15:51 [PATCH] make qemu buildable without CONFIG_VT Atsushi Nemoto
2006-02-09 16:32 ` changing the page properties to cached/uncached Niels Sterrenburg
2006-02-10 16:01   ` Alan Cox
2006-02-13  8:40     ` Niels Sterrenburg
2006-02-16 14:40 ` [PATCH] make qemu buildable without CONFIG_VT Ralf Baechle
2006-02-16 16:10   ` Atsushi Nemoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.