mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
hw/riscv: virt: Add optional AIA APLIC support to virt machine
We extend virt machine to emulate AIA APLIC devices only when "aia=aplic" parameter is passed along with machine name in QEMU command-line. When "aia=none" or not specified then we fallback to original PLIC device emulation. Signed-off-by: Anup Patel <anup.patel@wdc.com> Signed-off-by: Anup Patel <anup@brainfault.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20220220085526.808674-2-anup@brainfault.org> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
90f9e35b78
commit
e6faee6585
3 changed files with 259 additions and 59 deletions
|
@ -32,18 +32,24 @@ typedef struct RISCVVirtState RISCVVirtState;
|
|||
DECLARE_INSTANCE_CHECKER(RISCVVirtState, RISCV_VIRT_MACHINE,
|
||||
TYPE_RISCV_VIRT_MACHINE)
|
||||
|
||||
typedef enum RISCVVirtAIAType {
|
||||
VIRT_AIA_TYPE_NONE = 0,
|
||||
VIRT_AIA_TYPE_APLIC,
|
||||
} RISCVVirtAIAType;
|
||||
|
||||
struct RISCVVirtState {
|
||||
/*< private >*/
|
||||
MachineState parent;
|
||||
|
||||
/*< public >*/
|
||||
RISCVHartArrayState soc[VIRT_SOCKETS_MAX];
|
||||
DeviceState *plic[VIRT_SOCKETS_MAX];
|
||||
DeviceState *irqchip[VIRT_SOCKETS_MAX];
|
||||
PFlashCFI01 *flash[2];
|
||||
FWCfgState *fw_cfg;
|
||||
|
||||
int fdt_size;
|
||||
bool have_aclint;
|
||||
RISCVVirtAIAType aia_type;
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -54,6 +60,8 @@ enum {
|
|||
VIRT_CLINT,
|
||||
VIRT_ACLINT_SSWI,
|
||||
VIRT_PLIC,
|
||||
VIRT_APLIC_M,
|
||||
VIRT_APLIC_S,
|
||||
VIRT_UART0,
|
||||
VIRT_VIRTIO,
|
||||
VIRT_FW_CFG,
|
||||
|
@ -73,8 +81,9 @@ enum {
|
|||
VIRTIO_NDEV = 0x35 /* Arbitrary maximum number of interrupts */
|
||||
};
|
||||
|
||||
#define VIRT_PLIC_NUM_SOURCES 127
|
||||
#define VIRT_PLIC_NUM_PRIORITIES 7
|
||||
#define VIRT_IRQCHIP_NUM_SOURCES 127
|
||||
#define VIRT_IRQCHIP_NUM_PRIO_BITS 3
|
||||
|
||||
#define VIRT_PLIC_PRIORITY_BASE 0x04
|
||||
#define VIRT_PLIC_PENDING_BASE 0x1000
|
||||
#define VIRT_PLIC_ENABLE_BASE 0x2000
|
||||
|
@ -86,9 +95,14 @@ enum {
|
|||
|
||||
#define FDT_PCI_ADDR_CELLS 3
|
||||
#define FDT_PCI_INT_CELLS 1
|
||||
#define FDT_PLIC_ADDR_CELLS 0
|
||||
#define FDT_PLIC_INT_CELLS 1
|
||||
#define FDT_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + 1 + \
|
||||
FDT_PLIC_ADDR_CELLS + FDT_PLIC_INT_CELLS)
|
||||
#define FDT_APLIC_INT_CELLS 2
|
||||
#define FDT_MAX_INT_CELLS 2
|
||||
#define FDT_MAX_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
|
||||
1 + FDT_MAX_INT_CELLS)
|
||||
#define FDT_PLIC_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
|
||||
1 + FDT_PLIC_INT_CELLS)
|
||||
#define FDT_APLIC_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
|
||||
1 + FDT_APLIC_INT_CELLS)
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue