mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-03 07:21:55 -06:00
hw/riscv/riscv-iommu: parametrize CAP.IGS
Interrupt Generation Support (IGS) is a capability that is tied to the interrupt deliver mechanism, not with the core IOMMU emulation. We should allow device implementations to set IGS as they wish. A new helper is added to make it easier for device impls to set IGS. Use it in our existing IOMMU device (riscv-iommu-pci) to set RISCV_IOMMU_CAPS_IGS_MSI. Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20241106133407.604587-3-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
4876e6f7b5
commit
d13346d105
4 changed files with 16 additions and 0 deletions
|
@ -88,6 +88,12 @@ struct riscv_iommu_pq_record {
|
||||||
#define RISCV_IOMMU_CAP_PD17 BIT_ULL(39)
|
#define RISCV_IOMMU_CAP_PD17 BIT_ULL(39)
|
||||||
#define RISCV_IOMMU_CAP_PD20 BIT_ULL(40)
|
#define RISCV_IOMMU_CAP_PD20 BIT_ULL(40)
|
||||||
|
|
||||||
|
enum riscv_iommu_igs_modes {
|
||||||
|
RISCV_IOMMU_CAP_IGS_MSI = 0,
|
||||||
|
RISCV_IOMMU_CAP_IGS_WSI,
|
||||||
|
RISCV_IOMMU_CAP_IGS_BOTH
|
||||||
|
};
|
||||||
|
|
||||||
/* 5.4 Features control register (32bits) */
|
/* 5.4 Features control register (32bits) */
|
||||||
#define RISCV_IOMMU_REG_FCTL 0x0008
|
#define RISCV_IOMMU_REG_FCTL 0x0008
|
||||||
#define RISCV_IOMMU_FCTL_BE BIT(0)
|
#define RISCV_IOMMU_FCTL_BE BIT(0)
|
||||||
|
|
|
@ -155,6 +155,7 @@ static void riscv_iommu_pci_init(Object *obj)
|
||||||
qdev_alias_all_properties(DEVICE(iommu), obj);
|
qdev_alias_all_properties(DEVICE(iommu), obj);
|
||||||
|
|
||||||
iommu->icvec_avail_vectors = RISCV_IOMMU_PCI_ICVEC_VECTORS;
|
iommu->icvec_avail_vectors = RISCV_IOMMU_PCI_ICVEC_VECTORS;
|
||||||
|
riscv_iommu_set_cap_igs(iommu, RISCV_IOMMU_CAP_IGS_MSI);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Property riscv_iommu_pci_properties[] = {
|
static const Property riscv_iommu_pci_properties[] = {
|
||||||
|
|
|
@ -2130,6 +2130,11 @@ static const MemoryRegionOps riscv_iommu_trap_ops = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void riscv_iommu_set_cap_igs(RISCVIOMMUState *s, riscv_iommu_igs_mode mode)
|
||||||
|
{
|
||||||
|
s->cap = set_field(s->cap, RISCV_IOMMU_CAP_IGS, mode);
|
||||||
|
}
|
||||||
|
|
||||||
static void riscv_iommu_instance_init(Object *obj)
|
static void riscv_iommu_instance_init(Object *obj)
|
||||||
{
|
{
|
||||||
RISCVIOMMUState *s = RISCV_IOMMU(obj);
|
RISCVIOMMUState *s = RISCV_IOMMU(obj);
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
|
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
#include "hw/riscv/iommu.h"
|
#include "hw/riscv/iommu.h"
|
||||||
|
#include "hw/riscv/riscv-iommu-bits.h"
|
||||||
|
|
||||||
|
typedef enum riscv_iommu_igs_modes riscv_iommu_igs_mode;
|
||||||
|
|
||||||
struct RISCVIOMMUState {
|
struct RISCVIOMMUState {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
@ -85,6 +88,7 @@ struct RISCVIOMMUState {
|
||||||
|
|
||||||
void riscv_iommu_pci_setup_iommu(RISCVIOMMUState *iommu, PCIBus *bus,
|
void riscv_iommu_pci_setup_iommu(RISCVIOMMUState *iommu, PCIBus *bus,
|
||||||
Error **errp);
|
Error **errp);
|
||||||
|
void riscv_iommu_set_cap_igs(RISCVIOMMUState *s, riscv_iommu_igs_mode mode);
|
||||||
|
|
||||||
/* private helpers */
|
/* private helpers */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue