From: Atish Patra <atishp@rivosinc.com>
To: linux-kernel@vger.kernel.org
Cc: Atish Patra <atishp@rivosinc.com>,
Alexandre Ghiti <alex@ghiti.fr>,
Andrew Jones <ajones@ventanamicro.com>,
Andrew Morton <akpm@linux-foundation.org>,
Anup Patel <anup@brainfault.org>,
Atish Patra <atishp@atishpatra.org>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>,
Sean Christopherson <seanjc@google.com>,
linux-coco@lists.linux.dev, Dylan Reid <dylan@rivosinc.com>,
abrestic@rivosinc.com, Samuel Ortiz <sameo@rivosinc.com>,
Jiri Slaby <jirislaby@kernel.org>,
kvm-riscv@lists.infradead.org, kvm@vger.kernel.org,
linux-mm@kvack.org, linux-riscv@lists.infradead.org,
Palmer Dabbelt <palmer@dabbelt.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Rajnesh Kanwal <rkanwal@rivosinc.com>,
Uladzislau Rezki <urezki@gmail.com>
Subject: [RFC kvmtool 05/10] riscv: Do not create APLIC for TVMs
Date: Wed, 19 Apr 2023 15:23:45 -0700 [thread overview]
Message-ID: <20230419222350.3604274-6-atishp@rivosinc.com> (raw)
In-Reply-To: <20230419222350.3604274-1-atishp@rivosinc.com>
The CoVE VMs do not support wired interrupts. Thus no need of APLIC at
this point.
Signed-off-by: Atish Patra <atishp@rivosinc.com>
---
riscv/aia.c | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/riscv/aia.c b/riscv/aia.c
index 8c85b3f..a3b8618 100644
--- a/riscv/aia.c
+++ b/riscv/aia.c
@@ -143,6 +143,11 @@ static int aia__init(struct kvm *kvm)
.attr = KVM_DEV_RISCV_AIA_CTRL_INIT,
};
+
+ /* CoVE VM only supports hardware with physical guest interrupt file */
+ if (kvm->cfg.arch.cove_vm)
+ aia_mode = KVM_DEV_RISCV_AIA_MODE_HWACCEL;
+
/* Setup global device attribute variables */
aia_mode_attr.addr = (u64)(unsigned long)&aia_mode;
aia_nr_ids_attr.addr = (u64)(unsigned long)&aia_nr_ids;
@@ -160,10 +165,7 @@ static int aia__init(struct kvm *kvm)
ret = ioctl(aia_fd, KVM_GET_DEVICE_ATTR, &aia_nr_ids_attr);
if (ret)
return ret;
- aia_nr_sources = irq__get_nr_allocated_lines();
- ret = ioctl(aia_fd, KVM_SET_DEVICE_ATTR, &aia_nr_sources_attr);
- if (ret)
- return ret;
+
aia_hart_bits = fls_long(kvm->nrcpus);
ret = ioctl(aia_fd, KVM_SET_DEVICE_ATTR, &aia_hart_bits_attr);
if (ret)
@@ -172,12 +174,21 @@ static int aia__init(struct kvm *kvm)
/* Save number of HARTs for FDT generation */
aia_nr_harts = kvm->nrcpus;
- /* Set AIA device addresses */
- aia_addr = AIA_APLIC_ADDR(aia_nr_harts);
- aia_addr_attr.attr = KVM_DEV_RISCV_AIA_ADDR_APLIC;
- ret = ioctl(aia_fd, KVM_SET_DEVICE_ATTR, &aia_addr_attr);
- if (ret)
- return ret;
+ /* CoVE VMs do not support APLIC yet */
+ if (!kvm->cfg.arch.cove_vm) {
+ aia_nr_sources = irq__get_nr_allocated_lines();
+ ret = ioctl(aia_fd, KVM_SET_DEVICE_ATTR, &aia_nr_sources_attr);
+ if (ret)
+ return ret;
+
+ /* Set AIA device addresses */
+ aia_addr = AIA_APLIC_ADDR(aia_nr_harts);
+ aia_addr_attr.attr = KVM_DEV_RISCV_AIA_ADDR_APLIC;
+ ret = ioctl(aia_fd, KVM_SET_DEVICE_ATTR, &aia_addr_attr);
+ if (ret)
+ return ret;
+ }
+
for (i = 0; i < kvm->nrcpus; i++) {
aia_addr = AIA_IMSIC_ADDR(i);
aia_addr_attr.attr = KVM_DEV_RISCV_AIA_ADDR_IMSIC(i);
--
2.25.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2023-04-19 23:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-19 22:23 [RFC kvmtool 00/10] RISC-V CoVE support Atish Patra
2023-04-19 22:23 ` [RFC kvmtool 01/10] riscv: Add a CoVE VM type Atish Patra
2023-04-19 22:23 ` [RFC kvmtool 02/10] riscv: Define a command line option for CoVE VM Atish Patra
2023-04-19 22:23 ` [RFC kvmtool 03/10] riscv: Define a measure region IOCTL Atish Patra
2023-04-19 22:23 ` [RFC kvmtool 04/10] riscv: Invoke measure region for VM images Atish Patra
2023-04-19 22:23 ` Atish Patra [this message]
2023-04-19 22:23 ` [RFC kvmtool 06/10] riscv: Change initrd alignment to a page size Atish Patra
2023-04-19 22:23 ` [RFC kvmtool 07/10] riscv: Define riscv specific vm_type function Atish Patra
2023-04-19 22:23 ` [RFC kvmtool 08/10] riscv: virtio: Enforce VIRTIO_F_ACCESS_PLATFORM feature flag Atish Patra
2023-04-19 22:23 ` [RFC kvmtool 09/10] riscv: Don't emit MMIO devices for CoVE VM Atish Patra
2023-04-19 22:23 ` [RFC kvmtool 10/10] riscv: cove: Don't emit interrupt_map for pci devices in fdt Atish Patra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230419222350.3604274-6-atishp@rivosinc.com \
--to=atishp@rivosinc.com \
--cc=abrestic@rivosinc.com \
--cc=ajones@ventanamicro.com \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=anup@brainfault.org \
--cc=atishp@atishpatra.org \
--cc=dylan@rivosinc.com \
--cc=jirislaby@kernel.org \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=maz@kernel.org \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=rkanwal@rivosinc.com \
--cc=sameo@rivosinc.com \
--cc=seanjc@google.com \
--cc=suzuki.poulose@arm.com \
--cc=urezki@gmail.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).