From patchwork Mon Jan 11 05:30:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 565628 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2CE5A14030D for ; Mon, 11 Jan 2016 16:36:13 +1100 (AEDT) Received: from localhost ([::1]:51615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIV9H-0007hc-0Z for incoming@patchwork.ozlabs.org; Mon, 11 Jan 2016 00:36:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIV5o-0000kO-4f for qemu-devel@nongnu.org; Mon, 11 Jan 2016 00:32:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIV5n-0008HQ-6b for qemu-devel@nongnu.org; Mon, 11 Jan 2016 00:32:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39303) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIV5n-0008HM-1N for qemu-devel@nongnu.org; Mon, 11 Jan 2016 00:32:35 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id AD2C3C0D2230; Mon, 11 Jan 2016 05:32:34 +0000 (UTC) Received: from jason-ThinkPad-T430s.nay.redhat.com (dhcp-15-133.nay.redhat.com [10.66.15.133]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0B5VfLZ018161; Mon, 11 Jan 2016 00:32:30 -0500 From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Mon, 11 Jan 2016 13:30:59 +0800 Message-Id: <1452490275-18217-9-git-send-email-jasowang@redhat.com> In-Reply-To: <1452490275-18217-1-git-send-email-jasowang@redhat.com> References: <1452490275-18217-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Miao Yan , Jason Wang Subject: [Qemu-devel] [PULL 08/24] net/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Miao Yan VMXNET3_CMD_GET_DID_LO should return PCI ID of the device and VMXNET3_CMD_GET_DID_HI should return vmxnet3 revision ID. This behavior can be observed by the following steps: 1) run a Linux distro on esxi server (5.x+) 2) modify vmxnet3 Linux driver to read DID_HI and DID_LO: VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DID_LO); lo = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DID_HI); high = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); pr_info("vmxnet3 DID lo: 0x%x, high: 0x%x\n", lo, high); The kernel log will have something like the following message: [ 7005.111170] vmxnet3 DID lo: 0x7b0, high: 0x1 Signed-off-by: Miao Yan Reviewed-by: Dmitry Fleytman Signed-off-by: Jason Wang --- hw/net/vmxnet3.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 8a992d3..0aff0d4 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -1650,6 +1650,14 @@ static void vmxnet3_handle_command(VMXNET3State *s, uint64_t cmd) "adaptive ring info flags"); break; + case VMXNET3_CMD_GET_DID_LO: + VMW_CBPRN("Set: Get lower part of device ID"); + break; + + case VMXNET3_CMD_GET_DID_HI: + VMW_CBPRN("Set: Get upper part of device ID"); + break; + default: VMW_CBPRN("Received unknown command: %" PRIx64, cmd); break; @@ -1693,6 +1701,14 @@ static uint64_t vmxnet3_get_command_status(VMXNET3State *s) ret = VMXNET3_DISABLE_ADAPTIVE_RING; break; + case VMXNET3_CMD_GET_DID_LO: + ret = PCI_DEVICE_ID_VMWARE_VMXNET3; + break; + + case VMXNET3_CMD_GET_DID_HI: + ret = VMXNET3_DEVICE_REVISION; + break; + default: VMW_WRPRN("Received request for unknown command: %x", s->last_command); ret = -1;