From patchwork Fri Nov 8 11:37:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 2008418 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=eAnm0Ou9; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=brainfault-org.20230601.gappssmtp.com header.i=@brainfault-org.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=C3pMQ0+l; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XlHkj4XHTz1xyS for ; Fri, 8 Nov 2024 23:07:41 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=RnG3BqfjBv81x+Rh3ZrWBrRKiU3oFpMCv+1izwDs5Ic=; b=eAnm0Ou9R6Ka8u 3HetrLTkkjwjgIirlEj8u1cGkYmC703pDOiUcP37IDLY5/JEEHlvuWEnjY+5LPpzsAD/3CkQ+fwpR o4Z7cEl3D5IP6c93ALNcoxpYaq4E5V6OJqoDWwEudp8NlHkGhVa0KdZu+PWzGE+RoCiZV6BM0xIPS VvgWU6Qy6xtilpwbfuV6c0UcrznmChzEcciS8v7VZjtRMZdtjsMjpIV4M0B5JcXTT+1boxGJQWviU qYPtFeophGLEVqcnp0FIPz3j4YVx8nsi8w1JEqDsTD2wT5aDBBIQbhXgrts4z54D38sPocF/AtPln 99qsYzXUlQCONBFg1W2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9Nm8-0000000ASSb-0WkA; Fri, 08 Nov 2024 12:07:40 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9NJD-0000000AN09-0W8n for kvm-riscv@lists.infradead.org; Fri, 08 Nov 2024 11:37:57 +0000 Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-83aacecc8efso91755039f.0 for ; Fri, 08 Nov 2024 03:37:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20230601.gappssmtp.com; s=20230601; t=1731065865; x=1731670665; darn=lists.infradead.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=uOXTxT3QVzkr6+CIu71XOWqnHn0lKuAZkobd+xubmCQ=; b=C3pMQ0+lKa5y0fAQyxN6WWVyZP0L40mkuUnoTgHaRm9/hhgq4wco46aF3wofu9yjjE 5yDdL0BjmsxtvDOjGckwSAa0twsmpNPTOUXrBqubn9wFyM/BF5sXr5W6HrGo0fVAAuoI KNQqtz3iapv51jgH6T/SoAP6VH2IZDIW3Uiv1VwhSmUIUbL24uZkUE5MKSc+GU0/XyfY q7tm+Myh5D0yQ+rmbqoWcYxT+zFtKKFJuaqewY5Rg3h0BCNJjP2dV72olNKYM9lnOpHL G4P49o5DUBtRgzBDzqI8GZ4TeEjLTiTT6Da6oUmzZLRzNYw1fGqU2zmBaVTh5hi3TlnW xu5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731065865; x=1731670665; h=content-transfer-encoding:cc:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uOXTxT3QVzkr6+CIu71XOWqnHn0lKuAZkobd+xubmCQ=; b=SQPsXDsW0p/YPC1iIUwynGlxojzbHCXtUKa2Y5f+qbCY/FNCV32G4gebuGO0hy3Ff4 jFEXgUwbcBjZwnj5qaIIaodBzciG+hkh/Mmav56H0gJaSyhLBCccm6pjNEamyPw0/CHM 7KbKKPUoN9KacUsTD4EkIk6iSLgPMPzf6Itbn6w11WLqs9MGujkBopkc2ZVfKfq4JyIM byFMiALYUrAT14PFnZq/7nbC0mjiMO/nPV4GX30QVkHvcuDRLMRRh3kPMXGAr9qoB/kD skD/tWk4yC4LATZzrM1yXWxCDU80kkecoPJKkGmgGdDpi1ozzVVGe593keJ4w1y+44p8 /TVA== X-Forwarded-Encrypted: i=1; AJvYcCVt6+OUcvlXPdbDEQiH/waQiDEsfZZ/ykQUImFG00+Aw5yHiHscaXO7KTrpGdHxZjIpdViC2FTGog8=@lists.infradead.org X-Gm-Message-State: AOJu0YzIHMK4kN5u3HqwGh13hk7S1ftl9sc4e9kLsycbr5RGX4vtkPK8 uGEAOmJNinfV3mMwHo10tt34/vATRmo5QUiLIas0Z1+0of9fmb3kGa/XNcLjmCmlA5KsTe0iXa2 xvJPjdh/x0VIBjo/cF8SArt6hX3SF8E2VBdRpNg== X-Google-Smtp-Source: AGHT+IF+ciN17ub4TIrETUvpzLaSq6I/9rWGP4XRPhpnawOHx3FcfWs8O7SeGXcL/Hobw0nycafCJTqEinG8leLSWHc= X-Received: by 2002:a05:6e02:349c:b0:3a0:9c04:8047 with SMTP id e9e14a558f8ab-3a6f24b2433mr21370795ab.6.1731065865452; Fri, 08 Nov 2024 03:37:45 -0800 (PST) MIME-Version: 1.0 From: Anup Patel Date: Fri, 8 Nov 2024 17:07:34 +0530 Message-ID: Subject: [GIT PULL] KVM/riscv changes for 6.13 To: Paolo Bonzini Cc: Palmer Dabbelt , Palmer Dabbelt , Andrew Jones , Atish Patra , Atish Patra , "open list:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv)" , KVM General , linux-riscv X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241108_033747_451511_A86EB33A X-CRM114-Status: UNSURE ( 9.02 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi Paolo, We have the following KVM RISC-V changes for 6.13: 1) Accelerate KVM RISC-V when running as a guest 2) Perf support to collect KVM guest statistics from host side In addition, the pointer masking support (Ssnpm and Smnpm) for KVM guest is going through the RISC-V tree. Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:d2e listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hi Paolo, We have the following KVM RISC-V changes for 6.13: 1) Accelerate KVM RISC-V when running as a guest 2) Perf support to collect KVM guest statistics from host side In addition, the pointer masking support (Ssnpm and Smnpm) for KVM guest is going through the RISC-V tree. I also have Svade and Svadu support for host and guest in my queue which I will send in the second week of the merge window to avoid conflict with the RISC-V tree. Please pull. Regards, Anup The following changes since commit 81983758430957d9a5cb3333fe324fd70cf63e7e: Linux 6.12-rc5 (2024-10-27 12:52:02 -1000) are available in the Git repository at: https://github.com/kvm-riscv/linux.git tags/kvm-riscv-6.13-1 for you to fetch changes up to 332fa4a802b16ccb727199da685294f85f9880cb: riscv: kvm: Fix out-of-bounds array access (2024-11-05 13:27:32 +0530) ---------------------------------------------------------------- KVM/riscv changes for 6.13 - Accelerate KVM RISC-V when running as a guest - Perf support to collect KVM guest statistics from host side ---------------------------------------------------------------- Anup Patel (13): RISC-V: KVM: Order the object files alphabetically RISC-V: KVM: Save/restore HSTATUS in C source RISC-V: KVM: Save/restore SCOUNTEREN in C source RISC-V: KVM: Break down the __kvm_riscv_switch_to() into macros RISC-V: KVM: Replace aia_set_hvictl() with aia_hvictl_value() RISC-V: KVM: Don't setup SGEI for zero guest external interrupts RISC-V: Add defines for the SBI nested acceleration extension RISC-V: KVM: Add common nested acceleration support RISC-V: KVM: Use nacl_csr_xyz() for accessing H-extension CSRs RISC-V: KVM: Use nacl_csr_xyz() for accessing AIA CSRs RISC-V: KVM: Use SBI sync SRET call when available RISC-V: KVM: Save trap CSRs in kvm_riscv_vcpu_enter_exit() RISC-V: KVM: Use NACL HFENCEs for KVM request based HFENCEs Björn Töpel (1): riscv: kvm: Fix out-of-bounds array access Quan Zhou (2): riscv: perf: add guest vs host distinction riscv: KVM: add basic support for host vs guest profiling Yong-Xuan Wang (1): RISC-V: KVM: Fix APLIC in_clrip and clripnum write emulation arch/riscv/include/asm/kvm_host.h | 10 ++ arch/riscv/include/asm/kvm_nacl.h | 245 ++++++++++++++++++++++++++++++++++++ arch/riscv/include/asm/perf_event.h | 6 + arch/riscv/include/asm/sbi.h | 120 ++++++++++++++++++ arch/riscv/kernel/perf_callchain.c | 38 ++++++ arch/riscv/kvm/Kconfig | 1 + arch/riscv/kvm/Makefile | 27 ++-- arch/riscv/kvm/aia.c | 114 +++++++++++------ arch/riscv/kvm/aia_aplic.c | 3 +- arch/riscv/kvm/main.c | 63 +++++++++- arch/riscv/kvm/mmu.c | 4 +- arch/riscv/kvm/nacl.c | 152 ++++++++++++++++++++++ arch/riscv/kvm/tlb.c | 57 ++++++--- arch/riscv/kvm/vcpu.c | 191 +++++++++++++++++++++------- arch/riscv/kvm/vcpu_sbi.c | 11 +- arch/riscv/kvm/vcpu_switch.S | 137 ++++++++++++-------- arch/riscv/kvm/vcpu_timer.c | 28 ++--- 17 files changed, 1022 insertions(+), 185 deletions(-) create mode 100644 arch/riscv/include/asm/kvm_nacl.h create mode 100644 arch/riscv/kvm/nacl.c