From patchwork Wed Jul 18 15:07:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 1211551 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 7A7ADE0087 for ; Wed, 18 Jul 2012 15:08:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754792Ab2GRPIn (ORCPT ); Wed, 18 Jul 2012 11:08:43 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:43927 "EHLO e06smtp12.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753967Ab2GRPIe (ORCPT ); Wed, 18 Jul 2012 11:08:34 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Jul 2012 16:08:32 +0100 Received: from d06nrmr1307.portsmouth.uk.ibm.com (9.149.38.129) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 18 Jul 2012 16:08:29 +0100 Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6IF8TTo2846960 for ; Wed, 18 Jul 2012 16:08:29 +0100 Received: from d06av08.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6IF8SF8020269 for ; Wed, 18 Jul 2012 09:08:28 -0600 Received: from localhost (sig-9-145-185-169.de.ibm.com [9.145.185.169]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6IF8RfN020263; Wed, 18 Jul 2012 09:08:28 -0600 From: Stefan Hajnoczi To: Cc: , Anthony Liguori , Kevin Wolf , Paolo Bonzini , "Michael S. Tsirkin" , Asias He , Khoa Huynh , Stefan Hajnoczi Subject: [RFC v9 06/27] virtio-blk: Take PCI memory range into account Date: Wed, 18 Jul 2012 16:07:33 +0100 Message-Id: <1342624074-24650-7-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1342624074-24650-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1342624074-24650-1-git-send-email-stefanha@linux.vnet.ibm.com> x-cbid: 12071815-8372-0000-0000-00000339CDEE Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Support >4 GB physical memory accesses. Signed-off-by: Stefan Hajnoczi --- hw/virtio-blk.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index abd9386..99654f1 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -64,6 +64,13 @@ static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev) */ static inline void *phys_to_host(VirtIOBlock *s, target_phys_addr_t phys) { + /* Adjust for 3.6-4 GB PCI memory range */ + if (phys >= 0x100000000) { + phys -= 0x100000000 - 0xe0000000; + } else if (phys >= 0xe0000000) { + fprintf(stderr, "phys_to_host bad physical address in PCI range %#lx\n", phys); + exit(1); + } return s->phys_mem_zero_host_ptr + phys; }