Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1720380ybe; Tue, 3 Sep 2019 02:28:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWp47gU8qK/YVigOzMjr59go0hCMGiGu5qgq7HMDG/vpTlK2y+16cZd4ByJ0qiRmSafTfi X-Received: by 2002:aa7:920b:: with SMTP id 11mr38213091pfo.231.1567502885607; Tue, 03 Sep 2019 02:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567502885; cv=none; d=google.com; s=arc-20160816; b=prW355wRNdwnzipN0Mz8ZOvt4hmx/dnKGCdfz1yKLQp/WsEb4T1t/MrEfR7pypBnDw tKokrlt/I6QUT66yVMj05QfHkU0lWTgDQnbqqQi0ucDpEKSZoZC1depIOL/oIyl9DvNS uLgYeB2Zm0sXWZT1EwpW7RVebXGrzUmbw1vBg3VzQ5Y+LPfH6XcPxZagkVuFxwpItQ4L ngc3HBSu/18Uk4EdwzsVLxq7mkRVHg4ERgfDdqcdF+FHd0zRZBDB4RafHk+hNeMLgafy P2uMO0+NEcXz8HUVKsAjmDADXVjVQcmyHjmBjiVM5vyiAupEVcBoPkd0ZD8e7c1qkdNf qS9w== 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=320H5oeQ/ypZcJNziT2UEvpQLvhZJXO4w0Kft3y1blQ=; b=IRrl4Wh+HayuLIbmLtRaO/NZwImwnl8iLJB7PPkDlAYae1VEYHBU3gZmp7crgoeBiu GPFIPhhEYxOofzz6cOpUtxapK+MOlaHZ1UBc2DcUREbGXUPpotI1YOV5wHAKfeMVBx8o tg7ZwUx5HTF3IDmQ+Lp2ZRazyfAaHdI7jVjgYSiNsztR0ZXxe9uKtuBy2JzRLriFlpmD i/7whXuFpJPvvjVtNfChLcol1Gu2p63hihpV4PtPpL9bOBE1CtXFbanpxBE7Ir0fkEl+ dTEVzI3pooSsA8xX3IuFv2hmExcPiK6fPl7r+g8aMfRv/8c+QMq/V8oiizGNViXyFYma M2oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=L3WvK8Fd; 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 l5si6199429pff.39.2019.09.03.02.27.49; Tue, 03 Sep 2019 02:28:05 -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=L3WvK8Fd; 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 S1728453AbfICJ0n (ORCPT + 99 others); Tue, 3 Sep 2019 05:26:43 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:38940 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728129AbfICJ0n (ORCPT ); Tue, 3 Sep 2019 05:26:43 -0400 Received: by mail-wm1-f68.google.com with SMTP id n2so15947128wmk.4 for ; Tue, 03 Sep 2019 02:26:41 -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=320H5oeQ/ypZcJNziT2UEvpQLvhZJXO4w0Kft3y1blQ=; b=L3WvK8Fda9g/OFils619wQfmyD12uuA61bQl/l1rzqQGS+XiG9DZkPmnxECaVW8Yfy wVQBiPsO1nsrj3ZPVkgQiKFSudKf8UDs7dBhL8+u0WmTx3kQrQqOcxOGFj6ilF+fPB65 IFp7XgPkxr7d6suy26EpCfguqH1uex0AHvemIomAJPgK/Q0aIcEvUETkjIbd8VS4WNlb +YbWv3qDKgIePZyyNcMUIR22ydth/bTj/ms3hvmWEDY8MwurYOy5NGKvA8WftKI8bcpy sH3zMs4IcfX00tZZilYCaxxTN0VMMijcxkDzGD+4OhOE8a4ZGUtbZytBJN/qWz+O3pnY EaWQ== 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=320H5oeQ/ypZcJNziT2UEvpQLvhZJXO4w0Kft3y1blQ=; b=iXBbi1JPTdDk1EWC2QVcQkhxegSnROAScAvayo0u4YJr8etZXcP/UpqcUJnDczvIaE 2tbJFotJwC+LH4q9hmvNnGP1sbZ1AM3rGJ4EpKtGiLelqCdh22GWmwvzjXnKVe9QHwgw 3RSLVJFciyBeXQQ6VjPVuLcIAOv+zAtWskB75jF2OCazKcG335KZ8LrTEQaj3VQtKGt/ 89DmKCtPFmTuUgI2JtHu08rzjuEI7XCMyH1ykOZZro13813tLQbU9U8LiENOc2UQ3olo kC3TC2w+Ti1bbN5GY/bLfx/nNosBfpYY0mAHrbv7NeGUiM1QjztipN2LL9uD/6PqyMtI bnEA== X-Gm-Message-State: APjAAAXkz3KxGdDf42qDlT+SDMp5jC/p1g1CSVWALPfoUqgkUeWgZ14U 0wBT3xh3UiSSzymRPKKmpTvbcPnk8FjkdpsKOwpHqQ== X-Received: by 2002:a1c:c909:: with SMTP id f9mr42044895wmb.52.1567502800623; Tue, 03 Sep 2019 02:26:40 -0700 (PDT) MIME-Version: 1.0 References: <20190829135427.47808-1-anup.patel@wdc.com> <20190829135427.47808-11-anup.patel@wdc.com> <20190903085823.s4amn27pewc54hl2@kamzik.brq.redhat.com> In-Reply-To: <20190903085823.s4amn27pewc54hl2@kamzik.brq.redhat.com> From: Anup Patel Date: Tue, 3 Sep 2019 14:56:29 +0530 Message-ID: Subject: Re: [PATCH v6 10/21] RISC-V: KVM: Handle MMIO exits for VCPU To: Andrew Jones 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 Tue, Sep 3, 2019 at 2:28 PM Andrew Jones wrote: > > On Thu, Aug 29, 2019 at 01:56:18PM +0000, Anup Patel wrote: > > int kvm_riscv_vcpu_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run) > > { > > - /* TODO: */ > > + u8 data8; > > + u16 data16; > > + u32 data32; > > + u64 data64; > > + ulong insn; > > + int len, shift; > > + > > + insn = vcpu->arch.mmio_decode.insn; > > + > > + if (run->mmio.is_write) > > + goto done; > > + > > + len = vcpu->arch.mmio_decode.len; > > + shift = vcpu->arch.mmio_decode.shift; > > + > > + switch (len) { > > + case 1: > > + data8 = *((u8 *)run->mmio.data); > > + SET_RD(insn, &vcpu->arch.guest_context, > > + (ulong)data8 << shift >> shift); > > + break; > > + case 2: > > + data16 = *((u16 *)run->mmio.data); > > + SET_RD(insn, &vcpu->arch.guest_context, > > + (ulong)data16 << shift >> shift); > > + break; > > + case 4: > > + data32 = *((u32 *)run->mmio.data); > > + SET_RD(insn, &vcpu->arch.guest_context, > > + (ulong)data32 << shift >> shift); > > + break; > > + case 8: > > + data64 = *((u64 *)run->mmio.data); > > + SET_RD(insn, &vcpu->arch.guest_context, > > + (ulong)data64 << shift >> shift); > > + break; > > + default: > > + return -ENOTSUPP; > > + }; > > + > > +done: > > + /* Move to next instruction */ > > + vcpu->arch.guest_context.sepc += INSN_LEN(insn); > > + > > As I pointed out in the last review, just moving this instruction skip > here is not enough. Doing so introduces the same problem that 2113c5f62b74 > ("KVM: arm/arm64: Only skip MMIO insn once") fixes for arm. Thanks Drew, I had seen your comment previously but forgot to address it in v6. I will address it in v7. Regards, Anup