[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] memory: introduce memory_region_init_ram_protected()
From: |
Peter Maydell |
Subject: |
Re: [PATCH 1/2] memory: introduce memory_region_init_ram_protected() |
Date: |
Thu, 22 Jun 2023 14:16:59 +0100 |
On Tue, 20 Jun 2023 at 20:51, Laurent Vivier <lvivier@redhat.com> wrote:
>
> Commit 56918a126a ("memory: Add RAM_PROTECTED flag to skip IOMMU mappings")
> has introduced the RAM_PROTECTED flag to denote "protected" memory.
>
> This flags is only used with qemu_ram_alloc_from_fd() for now.
>
> To be able to register memory region with this flag, define
> memory_region_init_ram_protected() and declare the flag as valid in
> qemu_ram_alloc_internal() and qemu_ram_alloc().
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> include/exec/memory.h | 33 +++++++++++++++++++++++++++++++++
> softmmu/memory.c | 33 +++++++++++++++++++++++++++------
> softmmu/physmem.c | 4 ++--
> 3 files changed, 62 insertions(+), 8 deletions(-)
>
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index 47c2e0221c35..d8760015c381 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -1520,6 +1520,39 @@ void memory_region_init_iommu(void *_iommu_mr,
> const char *name,
> uint64_t size);
>
> +/**
> + * memory_region_init_ram_protected - Initialize RAM memory region. Accesses
> + * into the region will modify memory
> + * directly.
> + *
> + * The memory is created with the RAM_PROTECTED flag, for memory that
> + * looks and acts like RAM but inaccessible via normal mechanisms,
> + * including DMA.
This doesn't really tell me why you might want to mark
a region as RAM_PROTECTED. What kind of memory region is
not DMAable to? What are "normal mechanisms" here?
What are the "non-normal mechanisms" that you *can* use on
this memory region?
At the moment we only seem to use RAM_PROTECTED for
the SGX EPC memory backend. The commit message adding
that flag is pretty vague about what it means...
thanks
-- PMM
- [PATCH 0/2] vhost-vdpa: skip TPM CRB memory section, Laurent Vivier, 2023/06/20
- [PATCH 1/2] memory: introduce memory_region_init_ram_protected(), Laurent Vivier, 2023/06/20
- [PATCH 2/2] tpm_crb: mark memory as protected, Laurent Vivier, 2023/06/20
- Re: [PATCH 2/2] tpm_crb: mark memory as protected, Stefan Berger, 2023/06/21
- Re: [PATCH 2/2] tpm_crb: mark memory as protected, David Hildenbrand, 2023/06/22
- Re: [PATCH 2/2] tpm_crb: mark memory as protected, Peter Maydell, 2023/06/22
Re: [PATCH 0/2] vhost-vdpa: skip TPM CRB memory section, Peter Xu, 2023/06/21