Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2668975ybh; Mon, 5 Aug 2019 04:57:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9usDAgg+uYZoEYWq/5fxvR8QYOEFJnAt6NHnk77MqvdXkO3npkYnRoDgrUxUUcUsBmf4M X-Received: by 2002:a63:60d1:: with SMTP id u200mr24878863pgb.439.1565006272836; Mon, 05 Aug 2019 04:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565006272; cv=none; d=google.com; s=arc-20160816; b=oqjPHjKAzjfhKQ8c2x47IsmIA6IXcnF93YI9CiOwBeBJeh+bEUEtKHrdEcKuowWCoM GoXSyph+gTTlpQwER82l95s7INCskqQ1q52AJrLc7N0b5FsmUQaxRSnuPc70OBJ7fz1R jqC6yvxs+hwWChrlSPkey/CwTp6R4vrH8hTJaqezNMIUApV8O5RSFHJGih7yuomgM43e cKWFgeeyN/o39ZTEinbwAOesMfyUzfIHAOz7qXwPrsJ9DFHY0K8AyQnwg1TjDHaNdC7Q YlwCAT521Novz9T1Sh0EDFGeF91omWbo8Bqx9a2+sF5jBH/HCNl0k360FgRU8yPDkvwb hzuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=vhTBJZEcsjvTkvOpSV7JcEtFKAA9Exg0pMP9uE8HBUs=; b=FzV/lmeZXWMQO4Fng8OgTHkZwyCxhE8k0FZ4wQ6mvYrfQFnk2RDLC371TfT2+HpMO6 gXT0qg2QMe14Dq9R4vVLbwTHIfazZ/qgp2z7LnZdK/+NPoTWlnT3tAn6uUhzeqAMQD0d BnHiv4+HDzlRw6Z9Xp2XkePyOmIx4oIBjsPfN+sK9oUTTHc8j4DdTerjbzT420IVBN6o 8vFMGOmqKAONhr+hBwNCyanwWVe+NRJK8NqUxnH5JzabKbyvgP3APzVv/DUhi3l0sTAw rocOljlHo6JvF27ezbVC1RHP++Ir4Jf8zx6G2UFl1qGQOGyPlQgOPErQq2kieFXyHZ8I LShg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=j2cxRWIz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m32si43092791pld.438.2019.08.05.04.57.37; Mon, 05 Aug 2019 04:57:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=j2cxRWIz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728672AbfHEL4f (ORCPT + 99 others); Mon, 5 Aug 2019 07:56:35 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55540 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728659AbfHEL4f (ORCPT ); Mon, 5 Aug 2019 07:56:35 -0400 Received: by mail-wm1-f66.google.com with SMTP id a15so74448161wmj.5 for ; Mon, 05 Aug 2019 04:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vhTBJZEcsjvTkvOpSV7JcEtFKAA9Exg0pMP9uE8HBUs=; b=j2cxRWIzJWwkZSXOsd7iqkdySk76thOrHaNvBOCn2itmKfoj5zmnKFKd5PZ83DQUpd VWN6CriBZdpZ6mayWW41Dg0KK6Np+Wv8SZf0ZyjwXE42dDXcHFU2P964QIOrXYcB9RrJ th68YmT5hWQKspO1CFMPKRhlZ68MHu1nfflC4c316MaJM41iyU3eG+5jEOH6IOSi6FDc JOQPdmSu01w6czCcx8rCHJLaXZ4Ig5ko6Qtd28QVjqmvlANS2GK+V/gisiBAt9NChtg0 e42XgEfznhyur69CRHk2XN/GF62OC+Xd06npgkw7ZqGvaqWVi0uGxeeRuDsHgwc+JF7P /5Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vhTBJZEcsjvTkvOpSV7JcEtFKAA9Exg0pMP9uE8HBUs=; b=IZaVFcxJ0SCop8SRJ9ziM7eblZ3cNg5+NU7+tpYJc1DR34FTXv/WHgvZXabTO1OEOA eD1GmgIu/uNS2rdWlrVD+4LQJANemHyx8ryjbzqYeeu21vqeNoSSIGJsLYyudhRd0U// /uR6+fbcq7tY/tIwTyq6WpXDeJtKifHUW9ukBi9BjB16p/0fiN4TolAdN6LhW3vu+vEX S56taByH8syYpNgYJ0elQXc0q0cxUAMIU5S86z+paUFBKScQOnvDykAyQY25Kv5PtJvB 8gXlwrARipK9TsnZcejver5zfIjK6SwvY3qBE6agJFJ7RHTgbGzmV5n85vV/7rQNxaUJ 5Uyg== X-Gm-Message-State: APjAAAUp/1IgL/f5b/zbtJOxiHY6Z8CX6evXAgjdu/K/YoX3MIZXhqP2 va97pmyMexaugSKnjf8JPNeAtaEfdXSqq9Ki5d+ybg== X-Received: by 2002:a05:600c:254b:: with SMTP id e11mr17243611wma.171.1565006193144; Mon, 05 Aug 2019 04:56:33 -0700 (PDT) MIME-Version: 1.0 References: <20190802074620.115029-1-anup.patel@wdc.com> <20190802074620.115029-8-anup.patel@wdc.com> In-Reply-To: From: Anup Patel Date: Mon, 5 Aug 2019 17:26:21 +0530 Message-ID: Subject: Re: [RFC PATCH v2 07/19] RISC-V: KVM: Implement KVM_GET_ONE_REG/KVM_SET_ONE_REG ioctls To: Christian Borntraeger Cc: Anup Patel , Palmer Dabbelt , Paul Walmsley , Paolo Bonzini , Radim K , Daniel Lezcano , Thomas Gleixner , Atish Patra , Alistair Francis , Damien Le Moal , Christoph Hellwig , "kvm@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 5, 2019 at 5:08 PM Christian Borntraeger wrote: > > > > On 02.08.19 09:47, Anup Patel wrote: > > For KVM RISC-V, we use KVM_GET_ONE_REG/KVM_SET_ONE_REG ioctls to access > > VCPU config and registers from user-space. > > > > We have three types of VCPU registers: > > 1. CONFIG - these are VCPU config and capabilities > > 2. CORE - these are VCPU general purpose registers > > 3. CSR - these are VCPU control and status registers > > > > The CONFIG registers available to user-space are ISA and TIMEBASE. Out > > of these, TIMEBASE is a read-only register which inform user-space about > > VCPU timer base frequency. The ISA register is a read and write register > > where user-space can only write the desired VCPU ISA capabilities before > > running the VCPU. > > > > The CORE registers available to user-space are PC, RA, SP, GP, TP, A0-A7, > > T0-T6, S0-S11 and MODE. Most of these are RISC-V general registers except > > PC and MODE. The PC register represents program counter whereas the MODE > > register represent VCPU privilege mode (i.e. S/U-mode). > > > > The CSRs available to user-space are SSTATUS, SIE, STVEC, SSCRATCH, SEPC, > > SCAUSE, STVAL, SIP, and SATP. All of these are read/write registers. > > > > In future, more VCPU register types will be added (such as FP) for the > > KVM_GET_ONE_REG/KVM_SET_ONE_REG ioctls. > > While have ONE_REG will certainly work, have you considered the sync_reg scheme > (registers as part of kvm_run structure) > This will speed up the exit to QEMU as you do not have to do multiple ioctls > (each imposing a systemcall overhead) for one exit. > > Ideally you should not exit too often into qemu, but for those cases sync_regs > is faster than ONE_REG. > We will certainly explore sync_regs interface. Reducing exits to user-space will definitely help. This is the first series for KVM RISC-V so here we want to establish a stable and extensible UAPI header using which we will add support to QEMU KVM. For time being, we are using KVMTOOL for debug and development. Thanks, Anup