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: 13868103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71572D5C0C0 for ; Fri, 8 Nov 2024 12:07:45 +0000 (UTC) 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=X+r/IhIU5VYlDnXqjp4tE9rmNpU8tW5VKWnhSuQcTks=; b=2zsVaQxzdTnxLV YkfLwM8uidW3N6ZEjUHBwY7Vy+vTKu6OtsxLhxIlH0IUtb0Ffw8/DpEaGTpZX15F3ENg4vGZVnw6s sr07dJX7Fr0ukxCf6DumAvBum1DibOUQO/WJ6jBS/kOiHHgAiiTQmqBa2XPqLPrdFoMMFjkbAGI5G cMFVsn9XpZ30q2DDd253Hu65rn6kkTfeTdln2gxjgrcjT9liX8WPJL2TwDl8oiEadacEWHpDEw4Ip u0ZEVqo/jCdNoEDbMTGo4WYM4IjnGuF/44p+zDXJvIcO6kXkopdbiuGykU0PYdSavu7LmLY55ZKog 8SLLx881w90CGfUS+oAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9Nm7-0000000ASSR-1P2o; Fri, 08 Nov 2024 12:07:39 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9NJD-0000000AN0A-0Ptr for linux-riscv@lists.infradead.org; Fri, 08 Nov 2024 11:37:57 +0000 Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-83b83f83b63so89880439f.1 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=eW7vwuwgeiV9kizaz3PHoGspa7k7bpo+OGIlW00Tr7pZCdkBnH2S0c5/3GX//9tAfN IkqH0OOTAk8hUDu1xhiqiqbSrutqmQ/L2XTS5LVT/ru4UFZCyR7qpifZzRMp4XhZqhdc 5seC9ViFxkPC07m3s/QY20ZrfOf8twoBtzvXT/D+Jzjx5rn8eZms5Q7exE+eRoYlga7G 4yWdAkPpXMP3s4y6rd1Vl2KcsMjsBp1Ign1i9BCSglfPeGO2b2VEAO9RWRShqNv9vyyn 0EpSFfjxowe/lo6qvRy+4CzGPg92GC2DeWZqfxufz7mvhcPanwtrlwxiLyK1+M6xfviV bHrw== X-Forwarded-Encrypted: i=1; AJvYcCWduOnDlcaBqTNkYVjLmknpbFlGPrU9ujytlHVC66ZdEgxKzH94s1K+D8vS3gFOPRaWGxtGAUCmo83o1Q==@lists.infradead.org X-Gm-Message-State: AOJu0YxocJWbf3NgOFLgFLMKAGrA0KutixLuwbt8WVRyt7M0JWVSOjVw XG2VKT5wMC3gFC2GNEj0aC8YnwBz2vKHh1L94pTTUSNk7TWYuQNdu4YU+ld2Pp9efgKJROXy6Fb L1C2FC9V2IFW9BUTCsNremsnqJhesJFHPhy/Xlq46yp8gw+aX 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_451270_A804A618 X-CRM114-Status: UNSURE ( 9.02 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-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: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.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