All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hvmloader: pci range cache policy
@ 2008-05-23 14:58 Jean Guyader
  2008-05-23 16:00 ` Keir Fraser
  0 siblings, 1 reply; 3+ messages in thread
From: Jean Guyader @ 2008-05-23 14:58 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]


hvmloader: pci range cache policy

Use frame number instead address when we write the msr for the mtrr of 
the pci range.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>


[-- Attachment #2: msr_pci_range.patch --]
[-- Type: text/plain, Size: 1073 bytes --]

diff -r ef7525e87030 tools/firmware/hvmloader/cacheattr.c
--- a/tools/firmware/hvmloader/cacheattr.c	Fri May 23 11:58:08 2008 +0100
+++ b/tools/firmware/hvmloader/cacheattr.c	Fri May 23 15:53:32 2008 +0100
@@ -89,9 +89,9 @@ void cacheattr_init(void)
     if ( nr_var_ranges != 0 )
     {
         /* A single UC range covering PCI space. */
-        wrmsr(MSR_MTRRphysBase(0), PCI_MEMBASE);
+        wrmsr(MSR_MTRRphysBase(0), PCI_MEMBASE >> PAGE_SHIFT);
         wrmsr(MSR_MTRRphysMask(0),
-              ((uint64_t)(int32_t)PCI_MEMBASE & addr_mask) | (1u << 11));
+              (((uint64_t)(int32_t)PCI_MEMBASE & addr_mask) | (1u << 11)) >> PAGE_SHIFT);
         printf("var MTRRs ... ");
     }
 
diff -r ef7525e87030 tools/firmware/hvmloader/util.h
--- a/tools/firmware/hvmloader/util.h	Fri May 23 11:58:08 2008 +0100
+++ b/tools/firmware/hvmloader/util.h	Fri May 23 15:53:32 2008 +0100
@@ -9,6 +9,8 @@
 
 #undef NULL
 #define NULL ((void*)0)
+
+#define PAGE_SHIFT      12
 
 void __assert_failed(char *assertion, char *file, int line)
     __attribute__((noreturn));

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: [PATCH] hvmloader: pci range cache policy
  2008-05-23 14:58 [PATCH] hvmloader: pci range cache policy Jean Guyader
@ 2008-05-23 16:00 ` Keir Fraser
  2008-05-23 16:08   ` Jean Guyader
  0 siblings, 1 reply; 3+ messages in thread
From: Keir Fraser @ 2008-05-23 16:00 UTC (permalink / raw)
  To: Jean Guyader, xen-devel

The code is correct as it is. The frame number goes into bits 12 upwards of
the MSR, and this is equivalent to writing the full address into bits 0
upwards.

 -- Keir

On 23/5/08 15:58, "Jean Guyader" <jean.guyader@eu.citrix.com> wrote:

> 
> hvmloader: pci range cache policy
> 
> Use frame number instead address when we write the msr for the mtrr of
> the pci range.
> 
> Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
> 
> diff -r ef7525e87030 tools/firmware/hvmloader/cacheattr.c
> --- a/tools/firmware/hvmloader/cacheattr.c Fri May 23 11:58:08 2008 +0100
> +++ b/tools/firmware/hvmloader/cacheattr.c Fri May 23 15:53:32 2008 +0100
> @@ -89,9 +89,9 @@ void cacheattr_init(void)
>      if ( nr_var_ranges != 0 )
>      {
>          /* A single UC range covering PCI space. */
> -        wrmsr(MSR_MTRRphysBase(0), PCI_MEMBASE);
> +        wrmsr(MSR_MTRRphysBase(0), PCI_MEMBASE >> PAGE_SHIFT);
>          wrmsr(MSR_MTRRphysMask(0),
> -              ((uint64_t)(int32_t)PCI_MEMBASE & addr_mask) | (1u << 11));
> +              (((uint64_t)(int32_t)PCI_MEMBASE & addr_mask) | (1u << 11)) >>
> PAGE_SHIFT);
>          printf("var MTRRs ... ");
>      }
>  
> diff -r ef7525e87030 tools/firmware/hvmloader/util.h
> --- a/tools/firmware/hvmloader/util.h Fri May 23 11:58:08 2008 +0100
> +++ b/tools/firmware/hvmloader/util.h Fri May 23 15:53:32 2008 +0100
> @@ -9,6 +9,8 @@
>  
>  #undef NULL
>  #define NULL ((void*)0)
> +
> +#define PAGE_SHIFT      12
>  
>  void __assert_failed(char *assertion, char *file, int line)
>      __attribute__((noreturn));
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

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

* Re: [PATCH] hvmloader: pci range cache policy
  2008-05-23 16:00 ` Keir Fraser
@ 2008-05-23 16:08   ` Jean Guyader
  0 siblings, 0 replies; 3+ messages in thread
From: Jean Guyader @ 2008-05-23 16:08 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

Yes, indeed. Sorry for the noise.

Keir Fraser wrote:
> The code is correct as it is. The frame number goes into bits 12 upwards of
> the MSR, and this is equivalent to writing the full address into bits 0
> upwards.
> 
>  -- Keir
> 

-- 
Jean Guyader

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

end of thread, other threads:[~2008-05-23 16:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-23 14:58 [PATCH] hvmloader: pci range cache policy Jean Guyader
2008-05-23 16:00 ` Keir Fraser
2008-05-23 16:08   ` Jean Guyader

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.