Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp685774ybi; Fri, 2 Aug 2019 02:35:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6DB/k9C9LedA3oN/D2TolMGr5nO5lzksUJQGhSCLLxUPiadKILw9TpQM7RKT1ho/lwxDd X-Received: by 2002:a17:902:aa5:: with SMTP id 34mr135054197plp.166.1564738558246; Fri, 02 Aug 2019 02:35:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564738558; cv=none; d=google.com; s=arc-20160816; b=IMqVJtSThdRNzXAS5hA7FqXw1/CuOQ0e/w9b6lAXqDeSKMYkfEir6kqM9CjpT0q8uA YGDbOQ0YnjZQZVkVgjF70AX9gJUkHo86dpmEvBqf1b512ngcx5KtVi2lxA9qKF/+W6Hk DPCULi4DBT6vDL2BEnDAFI7tFZfwH9ChL0t9eP+4k5RYJxBaR7pAjNVd3ogHHeFAak9L 7QWyPGQup4Cl6HDzF8HsoZbeSXE5rXiPiprd+jttcxn8jfbjXkWZBjJD6fz0onx9sKZ5 qb9EJmoLWj2jgs5for6GS7iABx71TVtUBYoHxfqwP/RZ2bThgRdVw7NwJEsCeKMyuIW0 R3zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject; bh=+MjSLRhTHy/z+LM8sRLnyEruabbpzZhCsOii1dxVU9Y=; b=xnImgx1AUbv7fZM9dw/NWr0pq7Yl24Ks9ciOdtGeT8CulfvEAHSAkJ+YgR9d3urp2d ZDwoECPWnjimPyLz1zfXtitpCWOGjE/jPm6EIlftxWrKwDExDKvEtq2yA8rsufiRVT/F An5KPobfb7YIjWNr7zvgWCU6L29oFAciyKvAXlB57LpJNpJqgtblJPfM9N4d0dv8gGqd aSbz5b5EfX691vrDRmYqR0A3oDZnX0n1gRKgc6a9zN9R5RsuU/Gm8sAiEeRCsLoZboB0 kQzhxEpf1JoI/Y95zpj+bHo1K7C0Sblh1c6gsPAawd5L718POuA7BGPFLWBcxwWvhwNT oDMQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 142si39451470pgf.35.2019.08.02.02.35.41; Fri, 02 Aug 2019 02:35:58 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404194AbfHBIaO (ORCPT + 99 others); Fri, 2 Aug 2019 04:30:14 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36788 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731185AbfHBIaO (ORCPT ); Fri, 2 Aug 2019 04:30:14 -0400 Received: by mail-wr1-f68.google.com with SMTP id n4so76340990wrs.3 for ; Fri, 02 Aug 2019 01:30:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+MjSLRhTHy/z+LM8sRLnyEruabbpzZhCsOii1dxVU9Y=; b=SUifxYEa7EV1FZnh/CbwjTsf3V9F4jCxKT5U+YyPuYr26jiQgcLRkDb4aU6c05c2jC YXzDSj5HpSZRmVdzOl6GjcQXX5y8EsIUsGON6aH7i5fBA0X1yXYmNW4OweZbqGCqY8Im Hug4pvAyz9gNAwBknouFPA0MGbv5+3uRJcgkNEUjcF5mxhOrn1U9QJ0n85ndm3XaVJqr qv+bhjyAZ+4zg+kgQjXps5yOP0dzmbvU4j/4oWmA3bKXg3wVJ3GyapPeckV7vGIwSUZI W3nER1De2WyL8Xyh5TBPjhXAis+7cskSFlZMbzsNphvzfIMTOUc+YlvWHVViwpKWacV4 /M8w== X-Gm-Message-State: APjAAAXgrq5cJMjdNv4UicggS1H2H4NtDks7VRySbpVXYG8l+EnCMWhr lLTxHCoa8vR+qt0ZUK/v1WdfuqNvxag= X-Received: by 2002:adf:dcc6:: with SMTP id x6mr117116586wrm.322.1564734611723; Fri, 02 Aug 2019 01:30:11 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:4013:e920:9388:c3ff? ([2001:b07:6468:f312:4013:e920:9388:c3ff]) by smtp.gmail.com with ESMTPSA id b8sm99851723wmh.46.2019.08.02.01.30.10 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 02 Aug 2019 01:30:11 -0700 (PDT) Subject: Re: [RFC PATCH v2 08/19] RISC-V: KVM: Implement VCPU world-switch To: Anup Patel , Palmer Dabbelt , Paul Walmsley , Radim K Cc: Daniel Lezcano , Thomas Gleixner , Atish Patra , Alistair Francis , Damien Le Moal , Christoph Hellwig , Anup Patel , "kvm@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" References: <20190802074620.115029-1-anup.patel@wdc.com> <20190802074620.115029-9-anup.patel@wdc.com> From: Paolo Bonzini Openpgp: preference=signencrypt Message-ID: <72d8efbf-ec62-ab1e-68bf-e0c5f0bc256e@redhat.com> Date: Fri, 2 Aug 2019 10:30:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190802074620.115029-9-anup.patel@wdc.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/08/19 09:47, Anup Patel wrote: > + /* Save Host SSTATUS, HSTATUS, SCRATCH and STVEC */ > + csrr t0, CSR_SSTATUS > + REG_S t0, (KVM_ARCH_HOST_SSTATUS)(a0) > + csrr t1, CSR_HSTATUS > + REG_S t1, (KVM_ARCH_HOST_HSTATUS)(a0) > + csrr t2, CSR_SSCRATCH > + REG_S t2, (KVM_ARCH_HOST_SSCRATCH)(a0) > + csrr t3, CSR_STVEC > + REG_S t3, (KVM_ARCH_HOST_STVEC)(a0) > + A possible optimization: if these cannot change while Linux runs (I am thinking especially of STVEC and HSTATUS, but perhaps SSCRATCH can be saved on kvm_arch_vcpu_load too) you can avoid the csrr and store. Paolo