mirror of https://github.com/xemu-project/xemu.git
hw/arm: xlnx-versal-virt: Add AMD/Xilinx TRNG device
Connect the support for Versal True Random Number Generator (TRNG) device. Warning: unlike the TRNG component in a real device from the Versal device familiy, the connected TRNG model is not of cryptographic grade and is not intended for use cases when cryptograpically strong TRNG is needed. Signed-off-by: Tong Ho <tong.ho@amd.com> Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20231031184611.3029156-3-tong.ho@amd.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
921923583f
commit
3b22376ba4
|
@ -482,6 +482,7 @@ config XLNX_VERSAL
|
||||||
select XLNX_BBRAM
|
select XLNX_BBRAM
|
||||||
select XLNX_EFUSE_VERSAL
|
select XLNX_EFUSE_VERSAL
|
||||||
select XLNX_USB_SUBSYS
|
select XLNX_USB_SUBSYS
|
||||||
|
select XLNX_VERSAL_TRNG
|
||||||
|
|
||||||
config NPCM7XX
|
config NPCM7XX
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -373,6 +373,21 @@ static void versal_create_rtc(Versal *s, qemu_irq *pic)
|
||||||
qdev_get_gpio_in(DEVICE(&s->pmc.apb_irq_orgate), 0));
|
qdev_get_gpio_in(DEVICE(&s->pmc.apb_irq_orgate), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void versal_create_trng(Versal *s, qemu_irq *pic)
|
||||||
|
{
|
||||||
|
SysBusDevice *sbd;
|
||||||
|
MemoryRegion *mr;
|
||||||
|
|
||||||
|
object_initialize_child(OBJECT(s), "trng", &s->pmc.trng,
|
||||||
|
TYPE_XLNX_VERSAL_TRNG);
|
||||||
|
sbd = SYS_BUS_DEVICE(&s->pmc.trng);
|
||||||
|
sysbus_realize(sbd, &error_fatal);
|
||||||
|
|
||||||
|
mr = sysbus_mmio_get_region(sbd, 0);
|
||||||
|
memory_region_add_subregion(&s->mr_ps, MM_PMC_TRNG, mr);
|
||||||
|
sysbus_connect_irq(sbd, 0, pic[VERSAL_TRNG_IRQ]);
|
||||||
|
}
|
||||||
|
|
||||||
static void versal_create_xrams(Versal *s, qemu_irq *pic)
|
static void versal_create_xrams(Versal *s, qemu_irq *pic)
|
||||||
{
|
{
|
||||||
int nr_xrams = ARRAY_SIZE(s->lpd.xram.ctrl);
|
int nr_xrams = ARRAY_SIZE(s->lpd.xram.ctrl);
|
||||||
|
@ -909,6 +924,7 @@ static void versal_realize(DeviceState *dev, Error **errp)
|
||||||
versal_create_sds(s, pic);
|
versal_create_sds(s, pic);
|
||||||
versal_create_pmc_apb_irq_orgate(s, pic);
|
versal_create_pmc_apb_irq_orgate(s, pic);
|
||||||
versal_create_rtc(s, pic);
|
versal_create_rtc(s, pic);
|
||||||
|
versal_create_trng(s, pic);
|
||||||
versal_create_xrams(s, pic);
|
versal_create_xrams(s, pic);
|
||||||
versal_create_bbram(s, pic);
|
versal_create_bbram(s, pic);
|
||||||
versal_create_efuse(s, pic);
|
versal_create_efuse(s, pic);
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "hw/dma/xlnx_csu_dma.h"
|
#include "hw/dma/xlnx_csu_dma.h"
|
||||||
#include "hw/misc/xlnx-versal-crl.h"
|
#include "hw/misc/xlnx-versal-crl.h"
|
||||||
#include "hw/misc/xlnx-versal-pmc-iou-slcr.h"
|
#include "hw/misc/xlnx-versal-pmc-iou-slcr.h"
|
||||||
|
#include "hw/misc/xlnx-versal-trng.h"
|
||||||
#include "hw/net/xlnx-versal-canfd.h"
|
#include "hw/net/xlnx-versal-canfd.h"
|
||||||
#include "hw/misc/xlnx-versal-cfu.h"
|
#include "hw/misc/xlnx-versal-cfu.h"
|
||||||
#include "hw/misc/xlnx-versal-cframe-reg.h"
|
#include "hw/misc/xlnx-versal-cframe-reg.h"
|
||||||
|
@ -115,6 +116,7 @@ struct Versal {
|
||||||
} iou;
|
} iou;
|
||||||
|
|
||||||
XlnxZynqMPRTC rtc;
|
XlnxZynqMPRTC rtc;
|
||||||
|
XlnxVersalTRng trng;
|
||||||
XlnxBBRam bbram;
|
XlnxBBRam bbram;
|
||||||
XlnxEFuse efuse;
|
XlnxEFuse efuse;
|
||||||
XlnxVersalEFuseCtrl efuse_ctrl;
|
XlnxVersalEFuseCtrl efuse_ctrl;
|
||||||
|
@ -159,6 +161,7 @@ struct Versal {
|
||||||
#define VERSAL_OSPI_IRQ 124
|
#define VERSAL_OSPI_IRQ 124
|
||||||
#define VERSAL_SD0_IRQ_0 126
|
#define VERSAL_SD0_IRQ_0 126
|
||||||
#define VERSAL_EFUSE_IRQ 139
|
#define VERSAL_EFUSE_IRQ 139
|
||||||
|
#define VERSAL_TRNG_IRQ 141
|
||||||
#define VERSAL_RTC_ALARM_IRQ 142
|
#define VERSAL_RTC_ALARM_IRQ 142
|
||||||
#define VERSAL_RTC_SECONDS_IRQ 143
|
#define VERSAL_RTC_SECONDS_IRQ 143
|
||||||
|
|
||||||
|
@ -328,4 +331,6 @@ struct Versal {
|
||||||
#define MM_PMC_CRP_SIZE 0x10000
|
#define MM_PMC_CRP_SIZE 0x10000
|
||||||
#define MM_PMC_RTC 0xf12a0000
|
#define MM_PMC_RTC 0xf12a0000
|
||||||
#define MM_PMC_RTC_SIZE 0x10000
|
#define MM_PMC_RTC_SIZE 0x10000
|
||||||
|
#define MM_PMC_TRNG 0xf1230000
|
||||||
|
#define MM_PMC_TRNG_SIZE 0x10000
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue