Re: [RFC] arm64: KVM: Honor guest device memory type mappings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[+ Christoffer, Will, Catalin - In the future, please Cc the relevant
maintainers]

On 09/12/16 20:59, Caraman Mihai Claudiu-B02008 wrote:
> From: Mihai Caraman <mike.caraman@xxxxxxx>
> 
> Stage 2 non-Gathering and non-Reordering memory attributes have precedence over stage 1
> Gathering and Reordering attributes. Honor guest device memory type mappings using GRE
> memory type at stage 2.

This feels incredibly scary. One you start enabling gathering and
reordering, there is nothing that prevents a write to a device from a
given guest to be merged or reordered with a write from another guest to
the same device (think of the GIC). This would only require one of the
guests to use GRE attributes itself.

So as it stands, my feeling is that it is a big NO.

> This is a preamble for a bigger change that will honor guest normal memory mappings for
> targets connected to HN-F interfaces.

Normal memory mappings for devices? Unless you can prove that this is a
valid architectural configuration, this is unlikely to happen. And I'm
not keen on taking any such change before seeing the whole thing.

> 
> Signed-off-by: Mihai Caraman <mike.caraman@xxxxxxx>
> ---
>  arch/arm64/include/asm/memory.h       | 2 +-
>  arch/arm64/include/asm/pgtable-prot.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> index b71086d..d4834ba 100644
> --- a/arch/arm64/include/asm/memory.h
> +++ b/arch/arm64/include/asm/memory.h
> @@ -134,7 +134,7 @@
>   * Memory types for Stage-2 translation
>   */
>  #define MT_S2_NORMAL		0xf
> -#define MT_S2_DEVICE_nGnRE	0x1
> +#define MT_S2_DEVICE_GRE	0x3
>  
>  #ifdef CONFIG_ARM64_4K_PAGES
>  #define IOREMAP_MAX_ORDER	(PUD_SHIFT)
> diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h
> index 2142c77..11b43f7 100644
> --- a/arch/arm64/include/asm/pgtable-prot.h
> +++ b/arch/arm64/include/asm/pgtable-prot.h
> @@ -61,7 +61,7 @@
>  #define PAGE_HYP_DEVICE		__pgprot(PROT_DEVICE_nGnRE | PTE_HYP)
>  
>  #define PAGE_S2			__pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_NORMAL) | PTE_S2_RDONLY)
> -#define PAGE_S2_DEVICE		__pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_DEVICE_nGnRE) | PTE_S2_RDONLY | PTE_UXN)
> +#define PAGE_S2_DEVICE		__pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_DEVICE_GRE) | PTE_S2_RDONLY | PTE_UXN)
>  
>  #define PAGE_NONE		__pgprot(((_PAGE_DEFAULT) & ~PTE_VALID) | PTE_PROT_NONE | PTE_PXN | PTE_UXN)
>  #define PAGE_SHARED		__pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE)
> 

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux