mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
memory: Define API for MemoryRegionOps to take attrs and return status
Define an API so that devices can register MemoryRegionOps whose read and write callback functions are passed an arbitrary pointer to some transaction attributes and can return a success-or-failure status code. This will allow us to model devices which: * behave differently for ARM Secure/NonSecure memory accesses * behave differently for privileged/unprivileged accesses * may return a transaction failure (causing a guest exception) for erroneous accesses This patch defines the new API and plumbs the attributes parameter through to the memory.c public level functions io_mem_read() and io_mem_write(), where it is currently dummied out. The success/failure response indication is also propagated out to io_mem_read() and io_mem_write(), which retain the old-style boolean true-for-error return. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
parent
e1a5476354
commit
cc05c43ad9
3 changed files with 204 additions and 68 deletions
41
include/exec/memattrs.h
Normal file
41
include/exec/memattrs.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Memory transaction attributes
|
||||
*
|
||||
* Copyright (c) 2015 Linaro Limited.
|
||||
*
|
||||
* Authors:
|
||||
* Peter Maydell <peter.maydell@linaro.org>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MEMATTRS_H
|
||||
#define MEMATTRS_H
|
||||
|
||||
/* 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
|
||||
* bus (such as the ARM Secure/NonSecure bit). We define them
|
||||
* all as non-overlapping bitfields in a single struct to avoid
|
||||
* confusion if different parts of QEMU used the same bit for
|
||||
* different semantics.
|
||||
*/
|
||||
typedef struct MemTxAttrs {
|
||||
/* Bus masters which don't specify any attributes will get this
|
||||
* (via the MEMTXATTRS_UNSPECIFIED constant), so that we can
|
||||
* distinguish "all attributes deliberately clear" from
|
||||
* "didn't specify" if necessary.
|
||||
*/
|
||||
unsigned int unspecified:1;
|
||||
} MemTxAttrs;
|
||||
|
||||
/* Bus masters which don't specify any attributes will get this,
|
||||
* which has all attribute bits clear except the topmost one
|
||||
* (so that we can distinguish "all attributes deliberately clear"
|
||||
* from "didn't specify" if necessary).
|
||||
*/
|
||||
#define MEMTXATTRS_UNSPECIFIED ((MemTxAttrs) { .unspecified = 1 })
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue