Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2243457rwr; Fri, 21 Apr 2023 06:28:33 -0700 (PDT) X-Google-Smtp-Source: AKy350YoqiydstKFHy6AqnU0WnGUTeKCNBbgBgd0h3LOuzhd9umpLNnVTl1QmQQ2VFBjZUjtaf1U X-Received: by 2002:a05:6a00:4103:b0:634:c6b9:92e4 with SMTP id bu3-20020a056a00410300b00634c6b992e4mr5818546pfb.0.1682083712642; Fri, 21 Apr 2023 06:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682083712; cv=none; d=google.com; s=arc-20160816; b=vn48rtpWmaUMoeP1WfACdxCwsoQkf6uzNn9lc4Ysvb4660k85Vc8Q938UgOUIJG81K V5t7oo05YyBGgVPrVS6ut6DHXHrTcs0geOn5omNO+2kUhIdg/V5OmvxKz1cCK1VKf7yt c3P4MP82lZ5nHvSM1KWCI7DpJxfz+I6Iyx1MUCSRJgp9GmsNEulPf/nEz8dOBbjQZgDP 9iEjyurHTJVvCaByl9mHBpdqMiMwPL53if1x+mA34I9oycbGBcSXCxF4PEcGYv+LSxwq v6lFl/BhZ2Nr3z4H8v5c1e6ZA1NdaDunBdHDN3EqJHZrBckXGOlIuuYF3sLvKe38h+04 jXCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=8XMxjEm4UvnsoHzLAHBkPkEwF3Gt/9CwX8y4iqsN5RM=; b=FisUDowKfDNRT/dJj2TVnHvuu+b9Km29lSDeWwYuyKrTrCKW7T1V0rpYpVgwdeM0PG AAu6WJDfYAgbGOGwgO1mHqXPY3l3DVWrXfyyhdLjvybvOPQtssysrDplT+GsDUN2I10h 7nsCn1KYUpyTTCkJ2eDLTRTL7oegdQ068qXUtL6fInn0HapPSc7pB8zKAK8+eL8ciXmA 0dCvOUkX8ijnXVdVgKMq4Jt6LRNP4MAAVVVivedzIMFj6gKFu3m+HmJjGzvcZllL0QqB caKpLWdQUiLCaZww30hlPQ0m5+q3SOZ7Lxf8ew9GPkXQZFXbEpiUpNYbhxNbrAHW7QG7 tGrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20221208.gappssmtp.com header.s=20221208 header.b=jG+FvIrl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020aa7990f000000b0063b21db5973si4244407pff.358.2023.04.21.06.28.20; Fri, 21 Apr 2023 06:28:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20221208.gappssmtp.com header.s=20221208 header.b=jG+FvIrl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232439AbjDUNQT (ORCPT + 99 others); Fri, 21 Apr 2023 09:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232099AbjDUNQR (ORCPT ); Fri, 21 Apr 2023 09:16:17 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00047C654 for ; Fri, 21 Apr 2023 06:16:15 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-95678d891d6so221949466b.1 for ; Fri, 21 Apr 2023 06:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20221208.gappssmtp.com; s=20221208; t=1682082974; x=1684674974; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8XMxjEm4UvnsoHzLAHBkPkEwF3Gt/9CwX8y4iqsN5RM=; b=jG+FvIrl+PnQY2V/+/flKf7p6cz0IwKUMHve/yF8z2kv2EiqetKGPGvzn9z3sWYh+Y iQs/X0Do1qDOY4E0w4wH+jWgK9owtfi4Aer5sxYo/dPb1NYkKAMM6eaEpUBHFiF+AUsS RacrXeGWmbXtI/V0+88BPz5aCwqfR6FVenFm2aRwGDmlh7vbrkUhhLssYsf6ouuG+wNS 73L4fBzQuRIG6JViXq93O7EXoP7uCN/RISzWwBiyLOquRiFH2rhk6+aRyji4ymw34Qk6 JoNdfQqG+p8fcBU1NUvsk1TSgJteVfiNMgY/cntm5cH9Tc3Lk+OWgEqXuXhRcBui/PJc qcYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682082974; x=1684674974; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8XMxjEm4UvnsoHzLAHBkPkEwF3Gt/9CwX8y4iqsN5RM=; b=FDiexVuODteIC1fgLEGH6AKb0FJnnvh49ys0N26gDl9dkSqODGuIRUxBJI0jJcwxOi 0qo7km/FSMKodoMXu3ZtLRx9Lf5YpA/bMHE/NAV800LMep29rOrneTCHvbHZNRakx+VF ERjHpA1kv9oawsrsyNS0MDPE3dhjAeV8C4Un8y7ULERh5vuV/C2bJKzLRqU2Mj9cK+l0 JeNOdDBH+Z63+B/KDMjioD/SI5wdDkrPR/DZQuoccTBAGr/0MZMCPmi+aEAB+vVVgQON pTbnyaG5lplHuwSH1LbpbMf7LlZ3NLb8ebEFgVcULoGuPW9o6p5IxzCieDbhbEU7ddQT BqYg== X-Gm-Message-State: AAQBX9fmyagyxs9QyNKzV8XjkJr0Uirkaj60sny9P0dwMqmKqASizKVX X/WcGXUc1HrdcNqqE6TIGyMbC+rkZ7nxjUiPcJaLlLrnqfp2n69p5N5qPQ== X-Received: by 2002:a17:906:c416:b0:953:37eb:7727 with SMTP id u22-20020a170906c41600b0095337eb7727mr2260294ejz.43.1682082974310; Fri, 21 Apr 2023 06:16:14 -0700 (PDT) MIME-Version: 1.0 References: <20230404153452.2405681-1-apatel@ventanamicro.com> In-Reply-To: <20230404153452.2405681-1-apatel@ventanamicro.com> From: Anup Patel Date: Fri, 21 Apr 2023 18:46:02 +0530 Message-ID: Subject: Re: [PATCH v4 0/9] RISC-V KVM virtualize AIA CSRs To: Anup Patel Cc: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Andrew Jones , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 4, 2023 at 9:05=E2=80=AFPM Anup Patel = wrote: > > The RISC-V AIA specification is now frozen as-per the RISC-V internationa= l > process. The latest frozen specifcation can be found at: > https://github.com/riscv/riscv-aia/releases/download/1.0-RC3/riscv-interr= upts-1.0-RC3.pdf > > This series implements first phase of AIA virtualization which targets > virtualizing AIA CSRs. This also provides a foundation for the second > phase of AIA virtualization which will target in-kernel AIA irqchip > (including both IMSIC and APLIC). > > The first two patches are shared with the "Linux RISC-V AIA Support" > series which adds AIA driver support. > > To test this series, use AIA drivers from the "Linux RISC-V AIA Support" > series and use KVMTOOL from the riscv_aia_v1 branch at: > https://github.com/avpatel/kvmtool.git > > These patches can also be found in the riscv_kvm_aia_csr_v4 branch at: > https://github.com/avpatel/linux.git > > Based-on: 20230401112730.2105240-1-apatel@ventanamicro.com > (https://lore.kernel.org/lkml/20230401112730.2105240-1-apatel@ventanamicr= o.com/) > > Based-on: 20230403121527.2286489-1-apatel@ventanamicro.com > (https://lore.kernel.org/lkml/20230403121527.2286489-1-apatel@ventanamicr= o.com/) > > Changes since v3: > - Split PATCH7 into two patches > - Addressed comments in PATCH7, PATCH8 and PATCH9 > > Changes since v2: > - Rebased on Linux-6.3-rc5 > - Split PATCH5 into two separate patches as suggested by Atish. > > Changes since v1: > - Addressed from Drew and Conor in PATCH1 > - Use alphabetical ordering for SMAIA and SSAIA enum in PATCH2 > - Use GENMASK() in PATCH3 > > Anup Patel (9): > RISC-V: Add AIA related CSR defines > RISC-V: Detect AIA CSRs from ISA string > RISC-V: KVM: Drop the _MASK suffix from hgatp.VMID mask defines > RISC-V: KVM: Initial skeletal support for AIA > RISC-V: KVM: Implement subtype for CSR ONE_REG interface > RISC-V: KVM: Add ONE_REG interface for AIA CSRs > RISC-V: KVM: Use bitmap for irqs_pending and irqs_pending_mask > RISC-V: KVM: Virtualize per-HART AIA CSRs > RISC-V: KVM: Implement guest external interrupt line management I have queued PATCH1 to PATCH8 for Linux-6.4 The PATCH9 depends on "RISC-V IPI Improvements" series so this patch will be sent as separate PR or differed to Linux-6.5 Regards, Anup > > arch/riscv/include/asm/csr.h | 107 ++++- > arch/riscv/include/asm/hwcap.h | 8 + > arch/riscv/include/asm/kvm_aia.h | 137 +++++++ > arch/riscv/include/asm/kvm_host.h | 14 +- > arch/riscv/include/uapi/asm/kvm.h | 18 +- > arch/riscv/kernel/cpu.c | 2 + > arch/riscv/kernel/cpufeature.c | 2 + > arch/riscv/kvm/Makefile | 1 + > arch/riscv/kvm/aia.c | 627 ++++++++++++++++++++++++++++++ > arch/riscv/kvm/main.c | 23 +- > arch/riscv/kvm/mmu.c | 3 +- > arch/riscv/kvm/vcpu.c | 190 +++++++-- > arch/riscv/kvm/vcpu_insn.c | 1 + > arch/riscv/kvm/vm.c | 4 + > arch/riscv/kvm/vmid.c | 4 +- > 15 files changed, 1083 insertions(+), 58 deletions(-) > create mode 100644 arch/riscv/include/asm/kvm_aia.h > create mode 100644 arch/riscv/kvm/aia.c > > -- > 2.34.1 >