Lines Matching full:aia
65 kvm->arch.aia.in_kernel = true; in aia_create()
80 struct kvm_aia *aia = &kvm->arch.aia; in aia_config() local
106 aia->mode = *nr; in aia_config()
108 *nr = aia->mode; in aia_config()
118 aia->nr_ids = *nr; in aia_config()
120 *nr = aia->nr_ids; in aia_config()
127 aia->nr_sources = *nr; in aia_config()
129 *nr = aia->nr_sources; in aia_config()
135 aia->nr_group_bits = *nr; in aia_config()
137 *nr = aia->nr_group_bits; in aia_config()
144 aia->nr_group_shift = *nr; in aia_config()
146 *nr = aia->nr_group_shift; in aia_config()
152 aia->nr_hart_bits = *nr; in aia_config()
154 *nr = aia->nr_hart_bits; in aia_config()
160 aia->nr_guest_bits = *nr; in aia_config()
162 *nr = aia->nr_guest_bits; in aia_config()
173 struct kvm_aia *aia = &kvm->arch.aia; in aia_aplic_addr() local
183 aia->aplic_addr = *addr; in aia_aplic_addr()
185 *addr = aia->aplic_addr; in aia_aplic_addr()
220 static gpa_t aia_imsic_ppn(struct kvm_aia *aia, gpa_t addr) in aia_imsic_ppn() argument
225 h = aia->nr_hart_bits + aia->nr_guest_bits + in aia_imsic_ppn()
229 if (aia->nr_group_bits) { in aia_imsic_ppn()
230 h = aia->nr_group_bits + aia->nr_group_shift - 1; in aia_imsic_ppn()
231 l = aia->nr_group_shift; in aia_imsic_ppn()
238 static u32 aia_imsic_hart_index(struct kvm_aia *aia, gpa_t addr) in aia_imsic_hart_index() argument
242 if (aia->nr_hart_bits) in aia_imsic_hart_index()
243 hart = (addr >> (aia->nr_guest_bits + IMSIC_MMIO_PAGE_SHIFT)) & in aia_imsic_hart_index()
244 GENMASK_ULL(aia->nr_hart_bits - 1, 0); in aia_imsic_hart_index()
245 if (aia->nr_group_bits) in aia_imsic_hart_index()
246 group = (addr >> aia->nr_group_shift) & in aia_imsic_hart_index()
247 GENMASK_ULL(aia->nr_group_bits - 1, 0); in aia_imsic_hart_index()
249 return (group << aia->nr_hart_bits) | hart; in aia_imsic_hart_index()
258 struct kvm_aia *aia = &kvm->arch.aia; in aia_init() local
270 if (aia->nr_ids < aia->nr_sources) in aia_init()
274 if (aia->nr_sources && aia->aplic_addr == KVM_RISCV_AIA_UNDEF_ADDR) in aia_init()
294 base_ppn = aia_imsic_ppn(aia, vaia->imsic_addr); in aia_init()
295 if (base_ppn != aia_imsic_ppn(aia, vaia->imsic_addr)) { in aia_init()
301 vaia->hart_index = aia_imsic_hart_index(aia, in aia_init()
311 kvm->arch.aia.initialized = true; in aia_init()
508 .name = "kvm-riscv-aia",
518 /* Proceed only if AIA was initialized successfully */ in kvm_riscv_vcpu_aia_update()
536 /* Proceed only if AIA was initialized successfully */ in kvm_riscv_vcpu_aia_reset()
553 * will be done after AIA device is initialized by the user-space. in kvm_riscv_vcpu_aia_init()
558 /* Initialize default values in AIA vcpu context */ in kvm_riscv_vcpu_aia_init()
567 /* Proceed only if AIA was initialized successfully */ in kvm_riscv_vcpu_aia_deinit()
581 /* Proceed only if AIA was initialized successfully */ in kvm_riscv_aia_inject_msi_by_id()
602 struct kvm_aia *aia = &kvm->arch.aia; in kvm_riscv_aia_inject_msi() local
605 /* Proceed only if AIA was initialized successfully */ in kvm_riscv_aia_inject_msi()
613 g = tppn & (BIT(aia->nr_guest_bits) - 1); in kvm_riscv_aia_inject_msi()
614 tppn &= ~((gpa_t)(BIT(aia->nr_guest_bits) - 1)); in kvm_riscv_aia_inject_msi()
632 /* Proceed only if AIA was initialized successfully */ in kvm_riscv_aia_inject_irq()
642 struct kvm_aia *aia = &kvm->arch.aia; in kvm_riscv_aia_init_vm() local
649 * will be done after AIA device is initialized by the user-space. in kvm_riscv_aia_init_vm()
654 /* Initialize default values in AIA global context */ in kvm_riscv_aia_init_vm()
655 aia->mode = (kvm_riscv_aia_nr_hgei) ? in kvm_riscv_aia_init_vm()
657 aia->nr_ids = kvm_riscv_aia_max_ids - 1; in kvm_riscv_aia_init_vm()
658 aia->nr_sources = 0; in kvm_riscv_aia_init_vm()
659 aia->nr_group_bits = 0; in kvm_riscv_aia_init_vm()
660 aia->nr_group_shift = KVM_DEV_RISCV_AIA_GROUP_SHIFT_MIN; in kvm_riscv_aia_init_vm()
661 aia->nr_hart_bits = 0; in kvm_riscv_aia_init_vm()
662 aia->nr_guest_bits = 0; in kvm_riscv_aia_init_vm()
663 aia->aplic_addr = KVM_RISCV_AIA_UNDEF_ADDR; in kvm_riscv_aia_init_vm()
668 /* Proceed only if AIA was initialized successfully */ in kvm_riscv_aia_destroy_vm()