Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-19 Thread Keir Fraser
On 19 Mar 2005, at 10:56, Christian Limpach wrote: For this specific case there may be another resolution but could you please, please look at marking the missing pages PG_reserved and not hacking phys_to_virt. At this point anything short of explicitly introducing an intermediate step say

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-19 Thread Christian Limpach
On Sat, Mar 19, 2005 at 03:07:18AM -0700, Eric W. Biederman wrote: > For this specific case there may be another resolution but could > you please, please look at marking the missing pages PG_reserved > and not hacking phys_to_virt. > > At this point anything short of explicitly introducing an

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-19 Thread Eric W. Biederman
Keir Fraser <[EMAIL PROTECTED]> writes: > > > now, the patch lines that poke into the GATT I guess stay as they are. > > > We can maintain an out-of-tree patch for Xen, or perhaps if > > > virt_to_phys() is not used very much we can override its definition. > > > > It sounds like xen is trying

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-19 Thread Eric W. Biederman
Keir Fraser [EMAIL PROTECTED] writes: now, the patch lines that poke into the GATT I guess stay as they are. We can maintain an out-of-tree patch for Xen, or perhaps if virt_to_phys() is not used very much we can override its definition. It sounds like xen is trying to overload

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-19 Thread Christian Limpach
On Sat, Mar 19, 2005 at 03:07:18AM -0700, Eric W. Biederman wrote: For this specific case there may be another resolution but could you please, please look at marking the missing pages PG_reserved and not hacking phys_to_virt. At this point anything short of explicitly introducing an

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-19 Thread Keir Fraser
On 19 Mar 2005, at 10:56, Christian Limpach wrote: For this specific case there may be another resolution but could you please, please look at marking the missing pages PG_reserved and not hacking phys_to_virt. At this point anything short of explicitly introducing an intermediate step say

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-18 Thread Keir Fraser
On 18 Mar 2005, at 00:16, Paul Mackerras wrote: That sounds like a good way to make AGP accesses slower. :) Seriously, given that AGP is a technology that is being superseded by PCI Express, I think it's reasonable to look at the range of current implementations to see what we have to cope with.

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-18 Thread Keir Fraser
On 18 Mar 2005, at 00:16, Paul Mackerras wrote: That sounds like a good way to make AGP accesses slower. :) Seriously, given that AGP is a technology that is being superseded by PCI Express, I think it's reasonable to look at the range of current implementations to see what we have to cope with.

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-17 Thread Rik van Riel
On Fri, 18 Mar 2005, Paul Mackerras wrote: > However, the idea of having phys_to_agp/agp_to_phys (or > virt_to_agp/agp_to_virt) sounds like it wouldn't be too much effort, if > it would help Xen. It would be absolutely trivial. On most architectures you would have: #define virt_to_agp

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-17 Thread Paul Mackerras
Alan Cox writes: > On Iau, 2005-03-17 at 09:34, Paul Mackerras wrote: > > This code needs real physical addresses, which are not the same things > > as bus addresses. > > Not always. The code needs platform specific goodies. We've only never > been burned so far because there isn't a box with

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-17 Thread Alan Cox
On Iau, 2005-03-17 at 09:34, Paul Mackerras wrote: > This code needs real physical addresses, which are not the same things > as bus addresses. Not always. The code needs platform specific goodies. We've only never been burned so far because there isn't a box with an IOMMU and AGPGART where one

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-17 Thread Keir Fraser
> > So: I would very much like you to take the patches I made to generic.c > > that replace __get_free_pages() calls with dma_alloc_coherent(). For > > This is also wrong - the base address of the GATT is a physical > address not a bus address. This change will break agpgart on ppc64 > systems

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-17 Thread Paul Mackerras
Keir Fraser writes: > Yes, Xen will break w/o them, because physical addresses are an > illusory trick that the guest OS plays on itself to give itself the > impression of a contiguous memory map. We use _to_machine and _to_bus > macros to get 'real' physical addresses. This code needs real

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-17 Thread Keir Fraser
On 16 Mar 2005, at 22:06, Jesse Barnes wrote: The distinction is that physical addresses are what are used to access physical memory, whereas bus addresses are what appears on some external bus (usually PCI). The GATT sits between an external (AGP) bus and memory, so while the GATT is indexed

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-17 Thread Keir Fraser
On 16 Mar 2005, at 22:06, Jesse Barnes wrote: The distinction is that physical addresses are what are used to access physical memory, whereas bus addresses are what appears on some external bus (usually PCI). The GATT sits between an external (AGP) bus and memory, so while the GATT is indexed

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-17 Thread Keir Fraser
So: I would very much like you to take the patches I made to generic.c that replace __get_free_pages() calls with dma_alloc_coherent(). For This is also wrong - the base address of the GATT is a physical address not a bus address. This change will break agpgart on ppc64 systems and I

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-17 Thread Alan Cox
On Iau, 2005-03-17 at 09:34, Paul Mackerras wrote: This code needs real physical addresses, which are not the same things as bus addresses. Not always. The code needs platform specific goodies. We've only never been burned so far because there isn't a box with an IOMMU and AGPGART where one

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-17 Thread Paul Mackerras
Alan Cox writes: On Iau, 2005-03-17 at 09:34, Paul Mackerras wrote: This code needs real physical addresses, which are not the same things as bus addresses. Not always. The code needs platform specific goodies. We've only never been burned so far because there isn't a box with an IOMMU

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-17 Thread Rik van Riel
On Fri, 18 Mar 2005, Paul Mackerras wrote: However, the idea of having phys_to_agp/agp_to_phys (or virt_to_agp/agp_to_virt) sounds like it wouldn't be too much effort, if it would help Xen. It would be absolutely trivial. On most architectures you would have: #define virt_to_agp

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Rik van Riel
On Thu, 17 Mar 2005, Christoph Hellwig wrote: > On Wed, Mar 16, 2005 at 06:55:13PM -0500, Rik van Riel wrote: > > Thing is, the rest of the kernel uses virt_to_phys for > > two different things. Only one of them has to do with > > the real physical address, the other is about getting > > the page

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Christoph Hellwig
On Wed, Mar 16, 2005 at 06:55:13PM -0500, Rik van Riel wrote: > Thing is, the rest of the kernel uses virt_to_phys for > two different things. Only one of them has to do with > the real physical address, the other is about getting > the page frame number. The latter usage has been converted to

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Rik van Riel
On Thu, 17 Mar 2005, Paul Mackerras wrote: > > Under Xen, however, the two are different - and the > > AGPGART really needs to have the physical address ;) > > If Xen is letting the kernel program the GART, you just lost any > memory isolation between partitions you might have been trying to >

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Tupshin Harper
Paul Mackerras wrote: Rik van Riel writes: Thing is, the rest of the kernel uses virt_to_phys for two different things. Only one of them has to do with the real physical address, the other is about getting the page frame number. So fix the places that are using virt_to_phys to get the

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Paul Mackerras
Rik van Riel writes: > Thing is, the rest of the kernel uses virt_to_phys for > two different things. Only one of them has to do with > the real physical address, the other is about getting > the page frame number. So fix the places that are using virt_to_phys to get the page frame number to

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Rik van Riel
On Wed, 16 Mar 2005, Jesse Barnes wrote: > Thanks for the explanation Paul, now the code actually makes sense. > Converting to the DMA mapping API doesn't make sense at all in this context > then, since we're basically programming the GATT (an IOMMU type table) with > physical addresses.

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Jesse Barnes
On Wednesday, March 16, 2005 1:24 pm, Paul Mackerras wrote: > Keir Fraser writes: > > This patch cleans up AGP driver treatment of bus/device memory. Every > > use of virt_to_phys/phys_to_virt should properly be converting between > > virtual and bus addresses: this distinction really matters for

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Paul Mackerras
Keir Fraser writes: > This patch cleans up AGP driver treatment of bus/device memory. Every > use of virt_to_phys/phys_to_virt should properly be converting between > virtual and bus addresses: this distinction really matters for the Xen > hypervisor. I think you are misunderstanding the

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Keir Fraser
On 16 Mar 2005, at 19:06, Christoph Hellwig wrote: The AGP driver is only configurable for ppc32, alpha, x86, x86_64 and ia64, all of which have virt_to_bus. and ppc64 now, which doesn't. Sounds like the new DMA-mapping interface is the way to go then. -- Keir - To unsubscribe from this list:

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Christoph Hellwig
On Wed, Mar 16, 2005 at 06:35:28PM +, Keir Fraser wrote: > > On 16 Mar 2005, at 18:10, Christoph Hellwig wrote: > > >On Wed, Mar 16, 2005 at 10:01:07AM -0500, Rik van Riel wrote: > >>In the case of AGP, the AGPGART effectively _is_ the > >>IOMMU. Calculating the addresses right for

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Keir Fraser
On 16 Mar 2005, at 18:42, Jesse Barnes wrote: The AGP driver is only configurable for ppc32, alpha, x86, x86_64 and ia64, all of which have virt_to_bus. Yeah, but that doesn't mean it makes sense on all those platforms. The biggest problem with virt_to_bus (well, depending on who you talk to) is

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Jesse Barnes
On Wednesday, March 16, 2005 10:35 am, Keir Fraser wrote: > On 16 Mar 2005, at 18:10, Christoph Hellwig wrote: > > On Wed, Mar 16, 2005 at 10:01:07AM -0500, Rik van Riel wrote: > >> In the case of AGP, the AGPGART effectively _is_ the > >> IOMMU. Calculating the addresses right for programming >

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Keir Fraser
On 16 Mar 2005, at 18:10, Christoph Hellwig wrote: On Wed, Mar 16, 2005 at 10:01:07AM -0500, Rik van Riel wrote: In the case of AGP, the AGPGART effectively _is_ the IOMMU. Calculating the addresses right for programming the AGPGART is probably worth fixing. Well, it's a half-assed one. And some

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Christoph Hellwig
On Wed, Mar 16, 2005 at 10:01:07AM -0500, Rik van Riel wrote: > In the case of AGP, the AGPGART effectively _is_ the > IOMMU. Calculating the addresses right for programming > the AGPGART is probably worth fixing. Well, it's a half-assed one. And some systems have a real one. But the real

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Jesse Barnes
On Wednesday, March 16, 2005 3:48 am, Keir Fraser wrote: > This patch cleans up AGP driver treatment of bus/device memory. Every > use of virt_to_phys/phys_to_virt should properly be converting between > virtual and bus addresses: this distinction really matters for the Xen > hypervisor. > >

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Alan Cox
On Mer, 2005-03-16 at 14:31, Christoph Hellwig wrote: > It's bogus either way. You must never use virt_to_phys or virt_to_bus > for bus address. For systems with an IOMMU there's no 1:1 mapping. The AGPGART _is_ the IOMMU. Alan - To unsubscribe from this list: send the line "unsubscribe

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Rik van Riel
On Wed, 16 Mar 2005, Christoph Hellwig wrote: > On Wed, Mar 16, 2005 at 11:48:29AM +, Keir Fraser wrote: > > This patch cleans up AGP driver treatment of bus/device memory. Every > > use of virt_to_phys/phys_to_virt should properly be converting between > > virtual and bus addresses: this

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Keir Fraser
> On Wed, Mar 16, 2005 at 11:48:29AM +, Keir Fraser wrote: > > This patch cleans up AGP driver treatment of bus/device memory. Every > > use of virt_to_phys/phys_to_virt should properly be converting between > > virtual and bus addresses: this distinction really matters for the Xen > >

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Christoph Hellwig
On Wed, Mar 16, 2005 at 11:48:29AM +, Keir Fraser wrote: > This patch cleans up AGP driver treatment of bus/device memory. Every > use of virt_to_phys/phys_to_virt should properly be converting between > virtual and bus addresses: this distinction really matters for the Xen > hypervisor. It's

[PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Keir Fraser
This patch cleans up AGP driver treatment of bus/device memory. Every use of virt_to_phys/phys_to_virt should properly be converting between virtual and bus addresses: this distinction really matters for the Xen hypervisor. Furthermore, when allocating the GATT, it is necessary to use

[PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Keir Fraser
This patch cleans up AGP driver treatment of bus/device memory. Every use of virt_to_phys/phys_to_virt should properly be converting between virtual and bus addresses: this distinction really matters for the Xen hypervisor. Furthermore, when allocating the GATT, it is necessary to use

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Keir Fraser
On Wed, Mar 16, 2005 at 11:48:29AM +, Keir Fraser wrote: This patch cleans up AGP driver treatment of bus/device memory. Every use of virt_to_phys/phys_to_virt should properly be converting between virtual and bus addresses: this distinction really matters for the Xen hypervisor.

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Rik van Riel
On Wed, 16 Mar 2005, Christoph Hellwig wrote: On Wed, Mar 16, 2005 at 11:48:29AM +, Keir Fraser wrote: This patch cleans up AGP driver treatment of bus/device memory. Every use of virt_to_phys/phys_to_virt should properly be converting between virtual and bus addresses: this distinction

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Alan Cox
On Mer, 2005-03-16 at 14:31, Christoph Hellwig wrote: It's bogus either way. You must never use virt_to_phys or virt_to_bus for bus address. For systems with an IOMMU there's no 1:1 mapping. The AGPGART _is_ the IOMMU. Alan - To unsubscribe from this list: send the line unsubscribe

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Jesse Barnes
On Wednesday, March 16, 2005 3:48 am, Keir Fraser wrote: This patch cleans up AGP driver treatment of bus/device memory. Every use of virt_to_phys/phys_to_virt should properly be converting between virtual and bus addresses: this distinction really matters for the Xen hypervisor.

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Christoph Hellwig
On Wed, Mar 16, 2005 at 10:01:07AM -0500, Rik van Riel wrote: In the case of AGP, the AGPGART effectively _is_ the IOMMU. Calculating the addresses right for programming the AGPGART is probably worth fixing. Well, it's a half-assed one. And some systems have a real one. But the real problem

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Keir Fraser
On 16 Mar 2005, at 18:10, Christoph Hellwig wrote: On Wed, Mar 16, 2005 at 10:01:07AM -0500, Rik van Riel wrote: In the case of AGP, the AGPGART effectively _is_ the IOMMU. Calculating the addresses right for programming the AGPGART is probably worth fixing. Well, it's a half-assed one. And some

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Jesse Barnes
On Wednesday, March 16, 2005 10:35 am, Keir Fraser wrote: On 16 Mar 2005, at 18:10, Christoph Hellwig wrote: On Wed, Mar 16, 2005 at 10:01:07AM -0500, Rik van Riel wrote: In the case of AGP, the AGPGART effectively _is_ the IOMMU. Calculating the addresses right for programming the

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Keir Fraser
On 16 Mar 2005, at 18:42, Jesse Barnes wrote: The AGP driver is only configurable for ppc32, alpha, x86, x86_64 and ia64, all of which have virt_to_bus. Yeah, but that doesn't mean it makes sense on all those platforms. The biggest problem with virt_to_bus (well, depending on who you talk to) is

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Christoph Hellwig
On Wed, Mar 16, 2005 at 06:35:28PM +, Keir Fraser wrote: On 16 Mar 2005, at 18:10, Christoph Hellwig wrote: On Wed, Mar 16, 2005 at 10:01:07AM -0500, Rik van Riel wrote: In the case of AGP, the AGPGART effectively _is_ the IOMMU. Calculating the addresses right for programming the

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Keir Fraser
On 16 Mar 2005, at 19:06, Christoph Hellwig wrote: The AGP driver is only configurable for ppc32, alpha, x86, x86_64 and ia64, all of which have virt_to_bus. and ppc64 now, which doesn't. Sounds like the new DMA-mapping interface is the way to go then. -- Keir - To unsubscribe from this list:

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Paul Mackerras
Keir Fraser writes: This patch cleans up AGP driver treatment of bus/device memory. Every use of virt_to_phys/phys_to_virt should properly be converting between virtual and bus addresses: this distinction really matters for the Xen hypervisor. I think you are misunderstanding the distinction

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Jesse Barnes
On Wednesday, March 16, 2005 1:24 pm, Paul Mackerras wrote: Keir Fraser writes: This patch cleans up AGP driver treatment of bus/device memory. Every use of virt_to_phys/phys_to_virt should properly be converting between virtual and bus addresses: this distinction really matters for the Xen

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Rik van Riel
On Wed, 16 Mar 2005, Jesse Barnes wrote: Thanks for the explanation Paul, now the code actually makes sense. Converting to the DMA mapping API doesn't make sense at all in this context then, since we're basically programming the GATT (an IOMMU type table) with physical addresses. Ken,

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Paul Mackerras
Rik van Riel writes: Thing is, the rest of the kernel uses virt_to_phys for two different things. Only one of them has to do with the real physical address, the other is about getting the page frame number. So fix the places that are using virt_to_phys to get the page frame number to use

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Tupshin Harper
Paul Mackerras wrote: Rik van Riel writes: Thing is, the rest of the kernel uses virt_to_phys for two different things. Only one of them has to do with the real physical address, the other is about getting the page frame number. So fix the places that are using virt_to_phys to get the

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Rik van Riel
On Thu, 17 Mar 2005, Paul Mackerras wrote: Under Xen, however, the two are different - and the AGPGART really needs to have the physical address ;) If Xen is letting the kernel program the GART, you just lost any memory isolation between partitions you might have been trying to enforce.

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Christoph Hellwig
On Wed, Mar 16, 2005 at 06:55:13PM -0500, Rik van Riel wrote: Thing is, the rest of the kernel uses virt_to_phys for two different things. Only one of them has to do with the real physical address, the other is about getting the page frame number. The latter usage has been converted to

Re: [PATCH] Xen/i386 cleanups - AGP bus/phys cleanups

2005-03-16 Thread Rik van Riel
On Thu, 17 Mar 2005, Christoph Hellwig wrote: On Wed, Mar 16, 2005 at 06:55:13PM -0500, Rik van Riel wrote: Thing is, the rest of the kernel uses virt_to_phys for two different things. Only one of them has to do with the real physical address, the other is about getting the page frame