[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v2 3/5] exec/memattrs: Introduce MemTxAttrs::bus_perm fie
From: |
Stefan Hajnoczi |
Subject: |
Re: [RFC PATCH v2 3/5] exec/memattrs: Introduce MemTxAttrs::bus_perm field |
Date: |
Tue, 24 Aug 2021 14:08:26 +0100 |
On Mon, Aug 23, 2021 at 06:41:55PM +0200, Philippe Mathieu-Daudé wrote:
> Add the 'direct_access' bit to the memory attributes to restrict
> bus master access to ROM/RAM.
> Have read/write accessors return MEMTX_BUS_ERROR if an access is
> restricted and the region is not ROM/RAM ('direct').
> Add corresponding trace events.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> include/exec/memattrs.h | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
> index 95f2d20d55b..7a94ee75a88 100644
> --- a/include/exec/memattrs.h
> +++ b/include/exec/memattrs.h
> @@ -14,6 +14,13 @@
> #ifndef MEMATTRS_H
> #define MEMATTRS_H
>
> +/* Permission to restrict bus memory accesses. See MemTxAttrs::bus_perm */
> +enum {
> + MEMTXPERM_UNSPECIFIED = 0,
> + MEMTXPERM_UNRESTRICTED = 1,
> + MEMTXPERM_RAM_DEVICE = 2,
> +};
> +
> /* Every memory transaction has associated with it a set of
> * attributes. Some of these are generic (such as the ID of
> * the bus master); some are specific to a particular kind of
> @@ -35,6 +42,19 @@ typedef struct MemTxAttrs {
> unsigned int secure:1;
> /* Memory access is usermode (unprivileged) */
> unsigned int user:1;
> + /*
> + * Bus memory access permission.
> + *
> + * Some devices (such DMA) might be restricted to only access
> + * some type of device, such RAM devices. By default memory
> + * accesses are unspecified (MEMTXPERM_UNSPECIFIED), but could be
> + * unrestricted (MEMTXPERM_UNRESTRICTED, similar to an allow list)
> + * or restricted to a type of devices (similar to a deny list).
> + * Currently only RAM devices can be restricted (MEMTXPERM_RAM_DEVICE).
I don't understand these 3 categories.
MEMTXPERM_UNSPECIFIED means any MemoryRegion can be accessed?
What does MEMTXPERM_UNRESTRICTED mean? How does this differ from
MEMTXPERM_UNSPECIFIED?
What exactly does MEMTXPERM_RAM_DEVICE mean? Maybe that only
MemoryRegions where memory_region_is_ram() is true can be accessed?
signature.asc
Description: PGP signature
- Re: [RFC PATCH v2 1/5] softmmu/physmem: Simplify flatview_write and address_space_access_valid, (continued)