Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2005923ybh; Fri, 24 Jul 2020 01:56:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDicCyYkyb9EBYiXYj12IoCJRUkWSeMJv/MEiUA+/p6377UMHbja81WpvR4RT30gCGCObF X-Received: by 2002:a05:6402:1b0e:: with SMTP id by14mr7681065edb.266.1595580967300; Fri, 24 Jul 2020 01:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595580967; cv=none; d=google.com; s=arc-20160816; b=Ph92gUI//EgP8nk1HISHrF7vpIJMa6gf24KaXAuTbl2f6JTocQDJvrdSA17+6Nx6Pb 4oL6sosUVUAcCz4vBY5H2Mhw4ZjjYRaUexLJlH6kbvrhrm/C6e9wPmbuuzxFNI1lBRxh 1IngEiUqyZj8MQx0flyONx2KGmabfzcPO5DOZzGW9wS/TeRJAKJSNXu3/y2XL6znWF80 ZDZQ+b7ZTkBbJ8sNO9cOHX2/PCYyCy8an+Dion4AEbqfw9OqEs4GCuj4lgZpFTLQRh8o he47+qZan6MkX+MRMdWmwUFyMr+nQ5ghR0gu3tdKlcb8jBZahohBkwfwPtDp2YxUNRX5 ayVA== 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:mime-version :message-id:date:subject:cc:to:from; bh=zGpqA1e3S1UEl+qayUC/6kxwrVkcUKzhbM7+xFqtEmg=; b=e2P0DdysgoyX4HqEeRGs8P0VQXTCj0Etjt/V3DZcZIXQS9aZuV1NajtaMzLuR/xxU7 zvb8MCM0evJeqvo8a8JYlm1l/oQtAUrBYkTY7NzHSBg+gB0FGnjIgZD8fsSWME2rDYQh IU5nCj0vBgsaOg8x08tPOmhlqEzy+wsDZX5NagGJVOlDpuKZtz2WSa/kYSE1r2lt9B2s rMSQHkMaoQYTkWYPhek1Bv64jmitmPv6STgVa56E28eybX9PgzLTY0dkf7YXyneLIkm0 CTI74lrcFA5ERDy1kL7JvJf8d0KdPjhRcnedM3sSHs1+UeBnrPqiXQGMew1KW62p/Iaz V67w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j6si161682edq.8.2020.07.24.01.55.45; Fri, 24 Jul 2020 01:56:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726987AbgGXIzf (ORCPT + 99 others); Fri, 24 Jul 2020 04:55:35 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:54784 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726554AbgGXIzf (ORCPT ); Fri, 24 Jul 2020 04:55:35 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D3DA38FE8846B0F92B8C; Fri, 24 Jul 2020 16:55:33 +0800 (CST) Received: from huawei.com (10.174.187.31) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Fri, 24 Jul 2020 16:55:27 +0800 From: Yifei Jiang To: , , , CC: , , , , , , , , , , , Yifei Jiang Subject: [RFC 0/2] Add risc-v vhost-net support Date: Fri, 24 Jul 2020 16:54:39 +0800 Message-ID: <20200724085441.1514-1-jiangyifei@huawei.com> X-Mailer: git-send-email 2.26.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Originating-IP: [10.174.187.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, These two patches enable support for vhost-net on RISC-V architecture. They are developed based on the Linux source in this repo: https://github.com/avpatel/linux, the branch is riscv_kvm_v13. The accompanying QEMU is from the repo: https://github.com/alistair23/qemu, the branch is hyp-ext-v0.6.next. In order for the QEMU to work with KVM, the patch found here is necessary: https://patchwork.kernel.org/cover/11435965/ Several steps to use this: 1. create virbr0 on riscv64 emulation $ brctl addbr virbr0 $ brctl stp virbr0 on $ ifconfig virbr0 up $ ifconfig virbr0 netmask 2. boot riscv64 guestOS on riscv64 emulation $ ./qemu-system-riscv64 -M virt,accel=kvm -m 1024M -cpu host -nographic \ -name guest=riscv-guest \ -smp 2 \ -kernel ./Image \ -drive file=./guest.img,format=raw,id=hd0 \ -device virtio-blk,drive=hd0 \ -netdev type=tap,vhost=on,script=./ifup.sh,downscript=./ifdown.sh,id=net0 \ -append "root=/dev/vda rw console=ttyS0 earlycon=sbi" $ cat ifup.sh #!/bin/sh brctl addif virbr0 $1 ifconfig $1 up $ cat ifdown.sh #!/bin/sh ifconfig $1 down brctl delif virbr0 $1 This brenchmark is vhost-net compare with virtio: $ ./netperf -H -l 100 -t TCP_STREAM vhost-net: Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 131072 16384 16384 100.07 457.55 virtio: Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 131072 16384 16384 100.07 227.02 The next step is to support irqfd on RISC-V architecture. Yifei Jiang (2): RISC-V: KVM: enable ioeventfd capability and compile for risc-v RISC-V: KVM: read\write kernel mmio device support arch/riscv/kvm/Kconfig | 2 ++ arch/riscv/kvm/Makefile | 2 +- arch/riscv/kvm/vcpu_exit.c | 38 ++++++++++++++++++++++++++++++++------ arch/riscv/kvm/vm.c | 1 + 4 files changed, 36 insertions(+), 7 deletions(-) -- 2.19.1