xref: /openbmc/qemu/target/arm/idau.h (revision 438c78da)
1 /*
2  * QEMU ARM CPU -- interface for the Arm v8M IDAU
3  *
4  * Copyright (c) 2018 Linaro Ltd
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see
18  * <http://www.gnu.org/licenses/gpl-2.0.html>
19  *
20  * In the v8M architecture, the IDAU is a small piece of hardware
21  * typically implemented in the SoC which provides board or SoC
22  * specific security attribution information for each address that
23  * the CPU performs MPU/SAU checks on. For QEMU, we model this with a
24  * QOM interface which is implemented by the board or SoC object and
25  * connected to the CPU using a link property.
26  */
27 
28 #ifndef TARGET_ARM_IDAU_H
29 #define TARGET_ARM_IDAU_H
30 
31 #include "qom/object.h"
32 
33 #define TYPE_IDAU_INTERFACE "idau-interface"
34 #define IDAU_INTERFACE(obj) \
35     INTERFACE_CHECK(IDAUInterface, (obj), TYPE_IDAU_INTERFACE)
36 #define IDAU_INTERFACE_CLASS(class) \
37     OBJECT_CLASS_CHECK(IDAUInterfaceClass, (class), TYPE_IDAU_INTERFACE)
38 #define IDAU_INTERFACE_GET_CLASS(obj) \
39     OBJECT_GET_CLASS(IDAUInterfaceClass, (obj), TYPE_IDAU_INTERFACE)
40 
41 typedef struct IDAUInterface {
42     Object parent;
43 } IDAUInterface;
44 
45 #define IREGION_NOTVALID -1
46 
47 typedef struct IDAUInterfaceClass {
48     InterfaceClass parent;
49 
50     /* Check the specified address and return the IDAU security information
51      * for it by filling in iregion, exempt, ns and nsc:
52      *  iregion: IDAU region number, or IREGION_NOTVALID if not valid
53      *  exempt: true if address is exempt from security attribution
54      *  ns: true if the address is NonSecure
55      *  nsc: true if the address is NonSecure-callable
56      */
57     void (*check)(IDAUInterface *ii, uint32_t address, int *iregion,
58                   bool *exempt, bool *ns, bool *nsc);
59 } IDAUInterfaceClass;
60 
61 #endif
62