Skip to content

Commit f7fec5e

Browse files
committed
RISC-V: KVM: Add IMSIC related defines
We add IMSIC related defines in a separate header so that different parts of KVM code can share it. Once AIA drivers are merged will have a common IMSIC header shared by both KVM and IRQCHIP driver. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent 77cf33c commit f7fec5e

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (C) 2021 Western Digital Corporation or its affiliates.
4+
* Copyright (C) 2022 Ventana Micro Systems Inc.
5+
*/
6+
#ifndef __KVM_RISCV_AIA_IMSIC_H
7+
#define __KVM_RISCV_AIA_IMSIC_H
8+
9+
#include <linux/types.h>
10+
#include <asm/csr.h>
11+
12+
#define IMSIC_MMIO_PAGE_SHIFT 12
13+
#define IMSIC_MMIO_PAGE_SZ (1UL << IMSIC_MMIO_PAGE_SHIFT)
14+
#define IMSIC_MMIO_PAGE_LE 0x00
15+
#define IMSIC_MMIO_PAGE_BE 0x04
16+
17+
#define IMSIC_MIN_ID 63
18+
#define IMSIC_MAX_ID 2048
19+
20+
#define IMSIC_EIDELIVERY 0x70
21+
22+
#define IMSIC_EITHRESHOLD 0x72
23+
24+
#define IMSIC_EIP0 0x80
25+
#define IMSIC_EIP63 0xbf
26+
#define IMSIC_EIPx_BITS 32
27+
28+
#define IMSIC_EIE0 0xc0
29+
#define IMSIC_EIE63 0xff
30+
#define IMSIC_EIEx_BITS 32
31+
32+
#define IMSIC_FIRST IMSIC_EIDELIVERY
33+
#define IMSIC_LAST IMSIC_EIE63
34+
35+
#define IMSIC_MMIO_SETIPNUM_LE 0x00
36+
#define IMSIC_MMIO_SETIPNUM_BE 0x04
37+
38+
#endif

arch/riscv/kvm/aia.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/percpu.h>
1616
#include <linux/spinlock.h>
1717
#include <asm/hwcap.h>
18+
#include <asm/kvm_aia_imsic.h>
1819

1920
struct aia_hgei_control {
2021
raw_spinlock_t lock;
@@ -364,8 +365,6 @@ static int aia_rmw_iprio(struct kvm_vcpu *vcpu, unsigned int isel,
364365
return KVM_INSN_CONTINUE_NEXT_SEPC;
365366
}
366367

367-
#define IMSIC_FIRST 0x70
368-
#define IMSIC_LAST 0xff
369368
int kvm_riscv_vcpu_aia_rmw_ireg(struct kvm_vcpu *vcpu, unsigned int csr_num,
370369
unsigned long *val, unsigned long new_val,
371370
unsigned long wr_mask)

0 commit comments

Comments
 (0)